diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/AvailableNodesGenerator.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/AvailableNodesGenerator.java index 4a255fe72..023db96e7 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/AvailableNodesGenerator.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/AvailableNodesGenerator.java @@ -34,13 +34,17 @@ import io.ballerina.compiler.syntax.tree.Node; import io.ballerina.compiler.syntax.tree.NonTerminalNode; import io.ballerina.compiler.syntax.tree.SyntaxKind; +import io.ballerina.flowmodelgenerator.core.central.ConnectorResponse; import io.ballerina.flowmodelgenerator.core.central.LocalIndexCentral; +import io.ballerina.flowmodelgenerator.core.central.RemoteCentral; import io.ballerina.flowmodelgenerator.core.model.AvailableNode; import io.ballerina.flowmodelgenerator.core.model.Category; import io.ballerina.flowmodelgenerator.core.model.Codedata; import io.ballerina.flowmodelgenerator.core.model.Item; import io.ballerina.flowmodelgenerator.core.model.Metadata; +import io.ballerina.flowmodelgenerator.core.model.NodeBuilder; import io.ballerina.flowmodelgenerator.core.model.NodeKind; +import io.ballerina.flowmodelgenerator.core.model.node.NewConnection; import io.ballerina.projects.Document; import io.ballerina.tools.text.LinePosition; import io.ballerina.tools.text.TextRange; @@ -61,12 +65,14 @@ public class AvailableNodesGenerator { private final SemanticModel semanticModel; private final Document document; private final Gson gson; + private final boolean forceAssign; - public AvailableNodesGenerator(SemanticModel semanticModel, Document document) { + public AvailableNodesGenerator(SemanticModel semanticModel, Document document, boolean forceAssign) { this.rootBuilder = new Category.Builder(null).name(Category.Name.ROOT); this.gson = new Gson(); this.semanticModel = semanticModel; this.document = document; + this.forceAssign = forceAssign; } public JsonArray getAvailableNodes(LinePosition position) { @@ -133,34 +139,45 @@ private void setDefaultNodes() { true ); - this.rootBuilder - .stepIn(Category.Name.STATEMENT) - .node(NodeKind.ASSIGN) + this.rootBuilder.stepIn(Category.Name.STATEMENT).node(NodeKind.ASSIGN); + + if (!forceAssign) { + this.rootBuilder.stepIn(Category.Name.STATEMENT) .node(function) - .stepOut() - .stepIn(Category.Name.CONTROL) - .node(NodeKind.IF) - .node(NodeKind.MATCH) - .node(NodeKind.WHILE) - .node(NodeKind.FOREACH) - .node(NodeKind.RETURN) - .stepOut() - .stepIn(Category.Name.DATA) + .node(NodeKind.DATA_MAPPER) + .node(NodeKind.RETRY); + } + + this.rootBuilder.stepIn(Category.Name.CONTROL) + .node(NodeKind.IF) + .node(NodeKind.MATCH) + .node(NodeKind.WHILE) + .node(NodeKind.FOREACH) + .node(NodeKind.RETURN); + + if (!forceAssign) { + this.rootBuilder.stepIn(Category.Name.DATA) .node(NodeKind.JSON_PAYLOAD) .node(NodeKind.XML_PAYLOAD) - .node(NodeKind.BINARY_DATA) - .node(NodeKind.DATA_MAPPER) - .stepOut() + .node(NodeKind.BINARY_DATA); + } + + this.rootBuilder .stepIn(Category.Name.ERROR_HANDLING) - .node(NodeKind.ERROR_HANDLER) + // TODO: Uncomment when error handling is implemented +// .node(NodeKind.ERROR_HANDLER) .node(NodeKind.FAIL) .node(NodeKind.PANIC) - .stepOut() - .stepIn(Category.Name.CONCURRENCY) - .node(NodeKind.TRANSACTION) - .node(NodeKind.LOCK) - .node(NodeKind.START) .stepOut(); + // TODO: Uncomment when concurrency is implemented +// this.rootBuilder +// .stepIn(Category.Name.CONCURRENCY) +// .node(NodeKind.TRANSACTION) +// .node(NodeKind.COMMIT) +// .node(NodeKind.ROLLBACK) +// .node(NodeKind.LOCK) +// .node(NodeKind.START) +// .stepOut(); } private void setStopNode(NonTerminalNode node) { @@ -203,11 +220,16 @@ private Optional getConnection(Symbol symbol) { .node(NodeKind.NEW_CONNECTION) .org(moduleSymbol.id().orgName()) .module(moduleSymbol.getName().orElseThrow()) + .version(moduleSymbol.id().version()) .object("Client") .symbol("init") .build(); List connections = LocalIndexCentral.getInstance().getConnectorActions(codedata); + if (connections == null) { + connections = fetchConnections(codedata); + } + Metadata metadata = new Metadata.Builder<>(null) .label(symbol.getName().orElseThrow()) .build(); @@ -216,4 +238,32 @@ private Optional getConnection(Symbol symbol) { return Optional.empty(); } } + + private static List fetchConnections(Codedata codedata) { + List connectorActions = new ArrayList<>(); + ConnectorResponse connector = RemoteCentral.getInstance() + .connector(codedata.org(), codedata.module(), codedata.version(), codedata.object()); + for (ConnectorResponse.Function function : connector.functions()) { + if (function.name().equals(NewConnection.INIT_SYMBOL)) { + continue; + } + NodeBuilder actionBuilder = NodeBuilder.getNodeFromKind(NodeKind.ACTION_CALL); + actionBuilder + .metadata() + .label(function.name()) + .icon(connector.icon()) + .description(function.documentation()) + .stepOut() + .codedata() + .node(NodeKind.ACTION_CALL) + .org(codedata.org()) + .module(codedata.module()) + .object(codedata.object()) + .id(String.valueOf(connector.id())) + .symbol(function.name()); + connectorActions.add(actionBuilder.buildAvailableNode()); + } + return connectorActions; + } + } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CodeAnalyzer.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CodeAnalyzer.java index 582bfe02a..2074498b0 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CodeAnalyzer.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CodeAnalyzer.java @@ -38,6 +38,7 @@ import io.ballerina.compiler.syntax.tree.CheckExpressionNode; import io.ballerina.compiler.syntax.tree.ClientResourceAccessActionNode; import io.ballerina.compiler.syntax.tree.CommentNode; +import io.ballerina.compiler.syntax.tree.CommitActionNode; import io.ballerina.compiler.syntax.tree.CompoundAssignmentStatementNode; import io.ballerina.compiler.syntax.tree.ContinueStatementNode; import io.ballerina.compiler.syntax.tree.DoStatementNode; @@ -80,6 +81,7 @@ import io.ballerina.compiler.syntax.tree.SeparatedNodeList; import io.ballerina.compiler.syntax.tree.SimpleNameReferenceNode; import io.ballerina.compiler.syntax.tree.StartActionNode; +import io.ballerina.compiler.syntax.tree.StatementNode; import io.ballerina.compiler.syntax.tree.SyntaxKind; import io.ballerina.compiler.syntax.tree.TemplateExpressionNode; import io.ballerina.compiler.syntax.tree.Token; @@ -94,14 +96,17 @@ import io.ballerina.flowmodelgenerator.core.model.NodeBuilder; import io.ballerina.flowmodelgenerator.core.model.NodeKind; import io.ballerina.flowmodelgenerator.core.model.Property; +import io.ballerina.flowmodelgenerator.core.model.node.ActionCall; import io.ballerina.flowmodelgenerator.core.model.node.Assign; import io.ballerina.flowmodelgenerator.core.model.node.BinaryData; import io.ballerina.flowmodelgenerator.core.model.node.DataMapper; import io.ballerina.flowmodelgenerator.core.model.node.Fail; +import io.ballerina.flowmodelgenerator.core.model.node.FunctionCall; import io.ballerina.flowmodelgenerator.core.model.node.If; import io.ballerina.flowmodelgenerator.core.model.node.JsonPayload; import io.ballerina.flowmodelgenerator.core.model.node.Panic; import io.ballerina.flowmodelgenerator.core.model.node.Return; +import io.ballerina.flowmodelgenerator.core.model.node.Rollback; import io.ballerina.flowmodelgenerator.core.model.node.Start; import io.ballerina.flowmodelgenerator.core.model.node.XmlPayload; import io.ballerina.tools.text.LinePosition; @@ -132,9 +137,10 @@ class CodeAnalyzer extends NodeVisitor { private final String connectionScope; private final TextDocument textDocument; private final String defaultModuleName; + private final boolean forceAssign; public CodeAnalyzer(SemanticModel semanticModel, String connectionScope, Map dataMappings, - TextDocument textDocument, String defaultModuleName) { + TextDocument textDocument, String defaultModuleName, boolean forceAssign) { this.flowNodeList = new ArrayList<>(); this.semanticModel = semanticModel; this.flowNodeBuilderStack = new Stack<>(); @@ -142,6 +148,7 @@ public CodeAnalyzer(SemanticModel semanticModel, String connectionScope, Map nodeBuilder.properties().functionArguments( @@ -572,6 +593,7 @@ public void visit(FunctionCallExpressionNode functionCallExpressionNode) { .codedata() .org(orgName) .module(defaultModuleName) + .version(functionSymbol.getModule().get().id().version()) .symbol(functionName); functionSymbol.typeDescriptor().params().ifPresent( params -> nodeBuilder.properties() @@ -675,12 +697,51 @@ public void visit(ForEachStatementNode forEachStatementNode) { @Override public void visit(RollbackStatementNode rollbackStatementNode) { - handleDefaultStatementNode(rollbackStatementNode, () -> super.visit(rollbackStatementNode)); + startNode(NodeKind.ROLLBACK); + Optional optExpr = rollbackStatementNode.expression(); + if (optExpr.isPresent()) { + ExpressionNode expr = optExpr.get(); + expr.accept(this); + nodeBuilder.properties().expression(expr, Rollback.ROLLBACK_EXPRESSION_DOC); + } + endNode(rollbackStatementNode); } @Override public void visit(RetryStatementNode retryStatementNode) { - handleDefaultStatementNode(retryStatementNode, () -> super.visit(retryStatementNode)); + int retryCount = retryStatementNode.arguments().isEmpty() ? 3 : + Integer.parseInt(retryStatementNode.arguments() + .map(arg -> arg.arguments().get(0)).get().toString()); + + StatementNode statementNode = retryStatementNode.retryBody(); + if (statementNode.kind() == SyntaxKind.BLOCK_STATEMENT) { + startNode(NodeKind.RETRY) + .properties().retryCount(retryCount); + + Branch.Builder branchBuilder = + startBranch(Branch.BODY_LABEL, NodeKind.BODY, Branch.BranchKind.BLOCK, Branch.Repeatable.ONE); + analyzeBlock((BlockStatementNode) statementNode, branchBuilder); + endBranch(branchBuilder, statementNode); + retryStatementNode.onFailClause().ifPresent(this::processOnFailClause); + endNode(retryStatementNode); + } else { // retry transaction node + TransactionStatementNode transactionStatementNode = (TransactionStatementNode) statementNode; + BlockStatementNode blockStatementNode = transactionStatementNode.blockStatement(); + startNode(NodeKind.TRANSACTION) + .properties().retryCount(retryCount); + Branch.Builder branchBuilder = + startBranch(Branch.BODY_LABEL, NodeKind.BODY, Branch.BranchKind.BLOCK, Branch.Repeatable.ONE); + analyzeBlock(blockStatementNode, branchBuilder); + endBranch(branchBuilder, blockStatementNode); + transactionStatementNode.onFailClause().ifPresent(this::processOnFailClause); + endNode(retryStatementNode); + } + } + + @Override + public void visit(CommitActionNode commitActionNode) { + startNode(NodeKind.COMMIT); + endNode(); } @Override @@ -770,7 +831,8 @@ private void handleConstructorExpressionNode(ExpressionNode constructorExprNode) Optional parentSymbol = semanticModel.symbol(parent); if (parentSymbol.isPresent() && CommonUtils.getRawType( - ((VariableSymbol) parentSymbol.get()).typeDescriptor()).typeKind() == TypeDescKind.JSON) { + ((VariableSymbol) parentSymbol.get()).typeDescriptor()).typeKind() == TypeDescKind.JSON && + !forceAssign) { startNode(NodeKind.JSON_PAYLOAD) .metadata() .description(JsonPayload.DESCRIPTION) @@ -792,6 +854,7 @@ private void handleConstructorExpressionNode(ExpressionNode constructorExprNode) } // Utility methods + /** * It's the responsibility of the parent node to add the children nodes when building the diagram. Hence, the method * only adds the node to the diagram if there is no active parent node which is building its branches. diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CommonUtils.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CommonUtils.java index 879615765..e0f28689a 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CommonUtils.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CommonUtils.java @@ -37,6 +37,7 @@ import io.ballerina.compiler.syntax.tree.SyntaxKind; import io.ballerina.compiler.syntax.tree.SyntaxTree; import io.ballerina.compiler.syntax.tree.TypedBindingPatternNode; +import io.ballerina.flowmodelgenerator.core.central.ConnectorResponse; import io.ballerina.projects.Document; import io.ballerina.tools.text.LinePosition; import io.ballerina.tools.text.LineRange; @@ -298,4 +299,11 @@ public static TypeSymbol getRawType(TypeSymbol typeDescriptor) { } return typeDescriptor; } + + public static Object getTypeConstraint(ConnectorResponse.Parameter param, String typeName) { + return switch (typeName) { + case "inclusion" -> param.inclusionType(); + default -> typeName; + }; + } } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/ModelGenerator.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/ModelGenerator.java index f6425d7c2..b4c60e4d9 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/ModelGenerator.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/ModelGenerator.java @@ -65,15 +65,17 @@ public class ModelGenerator { private final Path filePath; private final Document dataMappingDoc; private final Gson gson; + private final boolean forceAssign; public ModelGenerator(SemanticModel model, Document document, LineRange lineRange, Path filePath, - Document dataMappingDoc) { + Document dataMappingDoc, boolean forceAssign) { this.semanticModel = model; this.document = document; this.lineRange = lineRange; this.filePath = filePath; this.dataMappingDoc = dataMappingDoc; this.gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); + this.forceAssign = forceAssign; } /** @@ -95,7 +97,9 @@ public JsonElement getFlowModel() { semanticModel.visibleSymbols(document, canvasNode.lineRange().startLine()).stream() .flatMap(symbol -> buildConnection(syntaxTree, symbol, textDocument).stream()) .sorted(Comparator.comparing( - node -> node.properties().get(Property.VARIABLE_KEY).value().toString())) + node -> Optional.ofNullable(node.properties().get(Property.VARIABLE_KEY)) + .map(property -> property.value().toString()) + .orElse(""))) .toList(); // Obtain the data mapping function names @@ -114,7 +118,7 @@ public JsonElement getFlowModel() { // Analyze the code block to find the flow nodes CodeAnalyzer codeAnalyzer = new CodeAnalyzer(semanticModel, Property.LOCAL_SCOPE, dataMappings, textDocument, - CommonUtils.getProjectName(document)); + CommonUtils.getProjectName(document), forceAssign); canvasNode.accept(codeAnalyzer); // Generate the flow model @@ -164,7 +168,8 @@ private Optional buildConnection(SyntaxTree syntaxTree, Symbol symbol, return Optional.empty(); } CodeAnalyzer codeAnalyzer = - new CodeAnalyzer(semanticModel, scope, Map.of(), textDocument, CommonUtils.getProjectName(document)); + new CodeAnalyzer(semanticModel, scope, Map.of(), textDocument, CommonUtils.getProjectName(document), + forceAssign); statementNode.accept(codeAnalyzer); List connections = codeAnalyzer.getFlowNodes(); return connections.stream().findFirst(); diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/SuggestedModelGenerator.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/SuggestedModelGenerator.java index 0a1242375..671b61262 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/SuggestedModelGenerator.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/SuggestedModelGenerator.java @@ -56,6 +56,7 @@ public void markSuggestedNodes(JsonArray newNodes, int startIndex) { } else { i = handleSuggestedNode(newNodes, i, newNode); } + setSuggestedNodes(newNode); continue; } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/central/RestClient.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/central/RestClient.java index eec638208..f3e6bb404 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/central/RestClient.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/central/RestClient.java @@ -91,7 +91,7 @@ public ConnectorResponse connector(String id) { } public ConnectorResponse connector(String org, String module, String version, String connector) { - String path = String.format("connectors/%s/%s/%s/%s/%s", org, module, version, module, connector); + String path = String.format("%s/connectors/%s/%s/%s/%s/%s", BASE_URL, org, module, version, module, connector); String response = query(path); return gson.fromJson(response, ConnectorResponse.class); } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/FlowNode.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/FlowNode.java index db401aa8f..6af087520 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/FlowNode.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/FlowNode.java @@ -62,5 +62,4 @@ public boolean hasFlag(int flag) { public static final int NODE_FLAG_FINAL = 1 << 2; public static final int NODE_FLAG_REMOTE = 1 << 10; public static final int NODE_FLAG_RESOURCE = 1 << 11; - } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/NodeBuilder.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/NodeBuilder.java index cab7d3d4b..2307bcdcb 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/NodeBuilder.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/NodeBuilder.java @@ -39,6 +39,7 @@ import io.ballerina.flowmodelgenerator.core.model.node.BinaryData; import io.ballerina.flowmodelgenerator.core.model.node.Break; import io.ballerina.flowmodelgenerator.core.model.node.Comment; +import io.ballerina.flowmodelgenerator.core.model.node.Commit; import io.ballerina.flowmodelgenerator.core.model.node.Continue; import io.ballerina.flowmodelgenerator.core.model.node.DataMapper; import io.ballerina.flowmodelgenerator.core.model.node.DefaultExpression; @@ -53,7 +54,9 @@ import io.ballerina.flowmodelgenerator.core.model.node.Match; import io.ballerina.flowmodelgenerator.core.model.node.NewConnection; import io.ballerina.flowmodelgenerator.core.model.node.Panic; +import io.ballerina.flowmodelgenerator.core.model.node.Retry; import io.ballerina.flowmodelgenerator.core.model.node.Return; +import io.ballerina.flowmodelgenerator.core.model.node.Rollback; import io.ballerina.flowmodelgenerator.core.model.node.Start; import io.ballerina.flowmodelgenerator.core.model.node.Stop; import io.ballerina.flowmodelgenerator.core.model.node.Transaction; @@ -110,32 +113,36 @@ public abstract class NodeBuilder { protected String defaultModuleName; private static final Map> CONSTRUCTOR_MAP = new HashMap<>() {{ - put(NodeKind.IF, If::new); - put(NodeKind.RETURN, Return::new); - put(NodeKind.EXPRESSION, DefaultExpression::new); - put(NodeKind.ERROR_HANDLER, ErrorHandler::new); - put(NodeKind.WHILE, While::new); - put(NodeKind.CONTINUE, Continue::new); - put(NodeKind.BREAK, Break::new); - put(NodeKind.PANIC, Panic::new); - put(NodeKind.EVENT_HTTP_API, HttpApiEvent::new); - put(NodeKind.ACTION_CALL, ActionCall::new); - put(NodeKind.NEW_CONNECTION, NewConnection::new); - put(NodeKind.START, Start::new); - put(NodeKind.TRANSACTION, Transaction::new); - put(NodeKind.LOCK, Lock::new); - put(NodeKind.FAIL, Fail::new); - put(NodeKind.XML_PAYLOAD, XmlPayload::new); - put(NodeKind.JSON_PAYLOAD, JsonPayload::new); - put(NodeKind.BINARY_DATA, BinaryData::new); - put(NodeKind.STOP, Stop::new); - put(NodeKind.FUNCTION_CALL, FunctionCall::new); - put(NodeKind.FOREACH, Foreach::new); - put(NodeKind.DATA_MAPPER, DataMapper::new); - put(NodeKind.ASSIGN, Assign::new); - put(NodeKind.COMMENT, Comment::new); - put(NodeKind.MATCH, Match::new); - }}; + put(NodeKind.IF, If::new); + put(NodeKind.RETURN, Return::new); + put(NodeKind.EXPRESSION, DefaultExpression::new); + put(NodeKind.ERROR_HANDLER, ErrorHandler::new); + put(NodeKind.WHILE, While::new); + put(NodeKind.CONTINUE, Continue::new); + put(NodeKind.BREAK, Break::new); + put(NodeKind.PANIC, Panic::new); + put(NodeKind.EVENT_HTTP_API, HttpApiEvent::new); + put(NodeKind.ACTION_CALL, ActionCall::new); + put(NodeKind.NEW_CONNECTION, NewConnection::new); + put(NodeKind.START, Start::new); + put(NodeKind.TRANSACTION, Transaction::new); + put(NodeKind.RETRY, Retry::new); + put(NodeKind.LOCK, Lock::new); + put(NodeKind.FAIL, Fail::new); + put(NodeKind.COMMIT, Commit::new); + put(NodeKind.ROLLBACK, Rollback::new); + put(NodeKind.XML_PAYLOAD, XmlPayload::new); + put(NodeKind.JSON_PAYLOAD, JsonPayload::new); + put(NodeKind.BINARY_DATA, BinaryData::new); + put(NodeKind.STOP, Stop::new); + put(NodeKind.FUNCTION_CALL, FunctionCall::new); + put(NodeKind.FOREACH, Foreach::new); + put(NodeKind.DATA_MAPPER, DataMapper::new); + put(NodeKind.ASSIGN, Assign::new); + put(NodeKind.COMMENT, Comment::new); + put(NodeKind.MATCH, Match::new); + }}; + public static NodeBuilder getNodeFromKind(NodeKind kind) { return CONSTRUCTOR_MAP.getOrDefault(kind, DefaultExpression::new).get(); @@ -631,6 +638,25 @@ public PropertiesBuilder condition(ExpressionNode expressionNode) { return this; } + public PropertiesBuilder retryCount(int retryCount) { + return retryCount(retryCount, false); + } + + public PropertiesBuilder retryCount(int retryCount, boolean optional) { + Property property = propertyBuilder + .metadata() + .label(Property.RETRY_COUNT_LABEL) + .description(Property.RETRY_COUNT_DOC) + .stepOut() + .value(String.valueOf(retryCount)) + .type(Property.ValueType.EXPRESSION) + .optional(optional) + .editable() + .build(); + addProperty(Property.RETRY_COUNT_KEY, property); + return this; + } + public PropertiesBuilder expression(String expr, String expressionDoc) { Property property = propertyBuilder .metadata() diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/NodeKind.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/NodeKind.java index e50739ed4..03db6fbbb 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/NodeKind.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/NodeKind.java @@ -22,8 +22,11 @@ public enum NodeKind { PANIC, START, TRANSACTION, + RETRY, LOCK, FAIL, + COMMIT, + ROLLBACK, ASSIGN, XML_PAYLOAD, JSON_PAYLOAD, diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java index e34baeeff..70945e90e 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java @@ -80,11 +80,11 @@ public T valueAsType(TypeToken typeToken) { public static final String COLLECTION_KEY = "collection"; public static final String COLLECTION_DOC = "Collection to iterate"; - public static final String DATA_VARIABLE_LABEL = "Data variable"; + public static final String DATA_VARIABLE_LABEL = "Variable"; public static final String DATA_VARIABLE_KEY = "variable"; public static final String DATA_VARIABLE_DOC = "Name of the variable"; - public static final String DATA_TYPE_LABEL = "Data type"; + public static final String DATA_TYPE_LABEL = "Type"; public static final String DATA_TYPE_KEY = "type"; public static final String DATA_TYPE_DOC = "Type of the variable"; @@ -110,6 +110,10 @@ public T valueAsType(TypeToken typeToken) { public static final String GUARD_KEY = "guard"; public static final String GUARD_DOC = "Guard expression"; + public static final String RETRY_COUNT_KEY = "retryCount"; + public static final String RETRY_COUNT_LABEL = "Retry Count"; + public static final String RETRY_COUNT_DOC = "Number of retries"; + public String toSourceCode() { return value.toString(); } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/SourceBuilder.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/SourceBuilder.java index 8d39a3be1..a9e6a32c7 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/SourceBuilder.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/SourceBuilder.java @@ -357,7 +357,10 @@ public TokenBuilder expression(Property property) { } public TokenBuilder expressionWithType(Property type, Property variable) { - sb.append(type.toSourceCode()).append(WHITE_SPACE).append(variable.toSourceCode()).append(WHITE_SPACE); + String typeSourceCode = type.toSourceCode(); + int lastDotIndex = typeSourceCode.lastIndexOf('.'); + String typeName = lastDotIndex >= 0 ? typeSourceCode.substring(lastDotIndex + 1) : type.toSourceCode(); + sb.append(typeName).append(WHITE_SPACE).append(variable.toSourceCode()).append(WHITE_SPACE); return this; } @@ -383,6 +386,16 @@ public TokenBuilder closeBrace() { return this; } + public TokenBuilder openParen() { + sb.append(SyntaxKind.OPEN_PAREN_TOKEN.stringValue()); + return this; + } + + public TokenBuilder closeParen() { + sb.append(SyntaxKind.CLOSE_PAREN_TOKEN.stringValue()); + return this; + } + public TokenBuilder endOfStatement() { sb.append(SyntaxKind.SEMICOLON_TOKEN.stringValue()).append(System.lineSeparator()); return this; diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/ActionCall.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/ActionCall.java index eb613398e..8b81d1592 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/ActionCall.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/ActionCall.java @@ -19,7 +19,11 @@ package io.ballerina.flowmodelgenerator.core.model.node; import io.ballerina.compiler.syntax.tree.SyntaxKind; +import io.ballerina.flowmodelgenerator.core.CommonUtils; +import io.ballerina.flowmodelgenerator.core.central.ConnectorResponse; import io.ballerina.flowmodelgenerator.core.central.LocalIndexCentral; +import io.ballerina.flowmodelgenerator.core.central.RemoteCentral; +import io.ballerina.flowmodelgenerator.core.model.Codedata; import io.ballerina.flowmodelgenerator.core.model.FlowNode; import io.ballerina.flowmodelgenerator.core.model.NodeBuilder; import io.ballerina.flowmodelgenerator.core.model.NodeKind; @@ -60,6 +64,13 @@ public Map> toSource(SourceBuilder sourceBuilder) { } FlowNode nodeTemplate = LocalIndexCentral.getInstance().getNodeTemplate(sourceBuilder.flowNode.codedata()); + if (nodeTemplate == null) { + nodeTemplate = fetchNodeTemplate(NodeBuilder.getNodeFromKind(NodeKind.ACTION_CALL), + sourceBuilder.flowNode.codedata()); + } + if (nodeTemplate == null) { + throw new IllegalStateException("Action call node template not found"); + } Optional connection = sourceBuilder.flowNode.getProperty(Property.CONNECTION_KEY); if (connection.isEmpty()) { @@ -77,8 +88,72 @@ public Map> toSource(SourceBuilder sourceBuilder) { .build(); } + private static FlowNode fetchNodeTemplate(NodeBuilder nodeBuilder, Codedata codedata) { + if (codedata.org().equals("$anon")) { + return null; + } + + ConnectorResponse connector = codedata.id() != null ? RemoteCentral.getInstance().connector(codedata.id()) : + RemoteCentral.getInstance() + .connector(codedata.org(), codedata.module(), codedata.version(), codedata.object()); + + if (connector == null) { + return null; + } + + Optional optFunction = connector.functions().stream() + .filter(f -> f.name().equals(codedata.symbol())) + .findFirst(); + if (optFunction.isEmpty()) { + return null; + } + nodeBuilder + .metadata() + .label(optFunction.get().name()) + .icon(connector.icon()) + .description(optFunction.get().documentation()) + .stepOut() + .codedata() + .org(codedata.org()) + .module(codedata.module()) + .object(codedata.object()) + .id(codedata.id()) + .symbol(codedata.symbol()); + + for (ConnectorResponse.Parameter param : optFunction.get().parameters()) { + nodeBuilder.properties().custom(param.name(), param.name(), param.documentation(), + Property.valueTypeFrom(param.typeName()), + CommonUtils.getTypeConstraint(param, param.typeName()), + CommonUtils.getDefaultValueForType(param.typeName()), param.optional()); + } + + String returnType = optFunction.get().returnType().typeName(); + if (returnType != null) { + nodeBuilder.properties().type(returnType).data(null); + } + + nodeBuilder.properties().custom(Property.CONNECTION_KEY, connector.name(), connector.documentation(), + Property.ValueType.EXPRESSION, connector.moduleName() + ":" + connector.name(), connector.name(), + false); + return nodeBuilder.build(); + } + + public static FlowNode getNodeTemplate(Codedata codedata) { + FlowNode nodeTemplate = LocalIndexCentral.getInstance().getNodeTemplate(codedata); + if (nodeTemplate == null) { + return fetchNodeTemplate(NodeBuilder.getNodeFromKind(NodeKind.ACTION_CALL), codedata); + } + return nodeTemplate; + } + @Override public void setConcreteTemplateData(TemplateContext context) { - this.cachedFlowNode = LocalIndexCentral.getInstance().getNodeTemplate(context.codedata()); + Codedata codedata = context.codedata(); + FlowNode nodeTemplate = LocalIndexCentral.getInstance().getNodeTemplate(codedata); + if (nodeTemplate != null) { + this.cachedFlowNode = nodeTemplate; + } else { + fetchNodeTemplate(this, codedata); + } } } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Assign.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Assign.java index 1e6b81a61..8aa6f010b 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Assign.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Assign.java @@ -51,7 +51,11 @@ public void setConcreteConstData() { public Map> toSource(SourceBuilder sourceBuilder) { FlowNode flowNode = sourceBuilder.flowNode; Optional dataType = flowNode.getProperty(Property.DATA_TYPE_KEY); - dataType.ifPresent(value -> sourceBuilder.token().expression(value).whiteSpace()); + + + if (dataType.isPresent() && !dataType.get().toSourceCode().isEmpty()) { + sourceBuilder.token().expression(dataType.get()).whiteSpace(); + } Optional variable = flowNode.getProperty(Property.VARIABLE_KEY); if (variable.isEmpty()) { diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/BinaryData.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/BinaryData.java index f63ce31bf..1b8bc601e 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/BinaryData.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/BinaryData.java @@ -36,7 +36,7 @@ */ public class BinaryData extends NodeBuilder { - public static final String LABEL = "Binary Data"; + public static final String LABEL = "Assign Binary"; public static final String DESCRIPTION = LABEL; public static final String BINARY_DATA_DOC = "Create new Binary Data"; private static final String DUMMY_BINARY_DATA_EXPR = "base64 `abcd`"; diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Commit.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Commit.java new file mode 100644 index 000000000..be99ceab7 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Commit.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.flowmodelgenerator.core.model.node; + +import io.ballerina.compiler.syntax.tree.SyntaxKind; +import io.ballerina.flowmodelgenerator.core.model.FlowNode; +import io.ballerina.flowmodelgenerator.core.model.NodeBuilder; +import io.ballerina.flowmodelgenerator.core.model.NodeKind; +import io.ballerina.flowmodelgenerator.core.model.SourceBuilder; +import org.eclipse.lsp4j.TextEdit; + +import java.nio.file.Path; +import java.util.List; +import java.util.Map; + +/** + * Represents the properties of a commit node. + * + * @since 1.4.0 + */ +public class Commit extends NodeBuilder { + + public static final String LABEL = "Commit"; + public static final String DESCRIPTION = "Commit transaction"; + + @Override + public void setConcreteConstData() { + metadata().label(LABEL).description(DESCRIPTION); + codedata().node(NodeKind.COMMIT); + } + + @Override + public void setConcreteTemplateData(TemplateContext context) { + } + + @Override + public Map> toSource(SourceBuilder sourceBuilder) { + if (sourceBuilder.flowNode.hasFlag(FlowNode.NODE_FLAG_CHECKED)) { + sourceBuilder.token().keyword(SyntaxKind.CHECK_KEYWORD); + } + + return sourceBuilder + .token() + .keyword(SyntaxKind.COMMIT_KEYWORD) + .endOfStatement() + .stepOut() + .textEdit(false).build(); + } +} diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/FunctionCall.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/FunctionCall.java index 10fa55ee8..438c05f44 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/FunctionCall.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/FunctionCall.java @@ -137,7 +137,10 @@ public Map> toSource(SourceBuilder sourceBuilder) { .build(); } - FlowNode nodeTemplate = LocalIndexCentral.getInstance().getNodeTemplate(codedata); + FlowNode nodeTemplate = getNodeTemplate(codedata); + if (nodeTemplate == null) { + throw new IllegalStateException("Function call node template not found"); + } String module = nodeTemplate.codedata().module(); String methodCallPrefix = (module != null) ? module.substring(module.lastIndexOf('.') + 1) + ":" : ""; @@ -152,7 +155,53 @@ public Map> toSource(SourceBuilder sourceBuilder) { .build(); } - private String escapeDefaultValue(String value) { + public static FlowNode getNodeTemplate(Codedata codedata) { + FlowNode nodeTemplate = LocalIndexCentral.getInstance().getNodeTemplate(codedata); + if (nodeTemplate == null) { + return fetchNodeTemplate(NodeBuilder.getNodeFromKind(NodeKind.FUNCTION_CALL), codedata); + } + return nodeTemplate; + } + + private static FlowNode fetchNodeTemplate(NodeBuilder nodeBuilder, Codedata codedata) { + FunctionResponse functionResponse = RemoteCentral.getInstance() + .function(codedata.org(), codedata.module(), codedata.version(), codedata.symbol()); + Function function; + try { + function = functionResponse.data().apiDocs().docsData().modules().get(0).functions(); + } catch (Exception e) { + return null; + } + + nodeBuilder.metadata() + .label(function.name()) + .description(function.description()); + nodeBuilder.codedata() + .node(NodeKind.FUNCTION_CALL) + .org(codedata.org()) + .module(codedata.module()) + .object(codedata.object()) + .version(codedata.version()) + .symbol(codedata.symbol()); + + for (Function.Parameter parameter : function.parameters()) { + String typeName = parameter.type().name(); + String defaultValue = parameter.defaultValue(); + String defaultString = defaultValue != null ? escapeDefaultValue(defaultValue) : + CommonUtils.getDefaultValueForType(typeName); + boolean optional = defaultValue != null && !defaultValue.isEmpty(); + nodeBuilder.properties().custom(parameter.name(), parameter.name(), parameter.description(), + Property.ValueType.EXPRESSION, typeName, defaultString, optional); + } + + List returnParameters = function.returnParameters(); + if (!returnParameters.isEmpty()) { + nodeBuilder.properties().type(returnParameters.get(0).type().name()).data(null); + } + return nodeBuilder.build(); + } + + private static String escapeDefaultValue(String value) { return value.isEmpty() ? "\"\"" : value; } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/JsonPayload.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/JsonPayload.java index 5095c62a9..ad61768d6 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/JsonPayload.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/JsonPayload.java @@ -36,7 +36,7 @@ */ public class JsonPayload extends NodeBuilder { - public static final String LABEL = "JSON Payload"; + public static final String LABEL = "Assign JSON"; public static final String DESCRIPTION = LABEL; public static final String JSON_PAYLOAD_DOC = "Create new JSON payload"; private static final String DUMMY_JSON_PAYLOAD = "{\"value\": \"Dummy JSON value\"}"; diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/NewConnection.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/NewConnection.java index 31b28eac1..818f408a9 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/NewConnection.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/NewConnection.java @@ -61,65 +61,83 @@ public void setConcreteTemplateData(TemplateContext context) { FlowNode nodeTemplate = LocalIndexCentral.getInstance().getNodeTemplate(codedata); if (nodeTemplate != null) { this.cachedFlowNode = nodeTemplate; + } else { + fetchNodeTemplate(this, codedata); } + } + + @Override + public Map> toSource(SourceBuilder sourceBuilder) { + sourceBuilder.newVariable(); + + FlowNode nodeTemplate = LocalIndexCentral.getInstance().getNodeTemplate(sourceBuilder.flowNode.codedata()); + // Fetch the information from the central if there is a cache miss. + if (nodeTemplate == null) { + nodeTemplate = fetchNodeTemplate(NodeBuilder.getNodeFromKind(NodeKind.NEW_CONNECTION), + sourceBuilder.flowNode.codedata()); + } + + if (nodeTemplate == null) { + throw new IllegalStateException("Node template is not available for the new connection node"); + } + + sourceBuilder.token() + .keyword(SyntaxKind.CHECK_KEYWORD) + .keyword(SyntaxKind.NEW_KEYWORD) + .stepOut() + .functionParameters(nodeTemplate, + Set.of(Property.VARIABLE_KEY, Property.DATA_TYPE_KEY, Property.SCOPE_KEY)); + + Optional scope = sourceBuilder.flowNode.getProperty(Property.SCOPE_KEY); + if (scope.isEmpty()) { + throw new IllegalStateException("Scope is not defined for the new connection node"); + } + return switch (scope.get().value().toString()) { + case Property.LOCAL_SCOPE -> sourceBuilder.textEdit(false).build(); + case Property.GLOBAL_SCOPE -> sourceBuilder.textEdit(false, "connections.bal").build(); + default -> throw new IllegalStateException("Invalid scope for the new connection node"); + }; + } + + private static FlowNode fetchNodeTemplate(NodeBuilder nodeBuilder, Codedata codedata) { if (codedata.id() != null) { ConnectorResponse connector = RemoteCentral.getInstance().connector(codedata.id()); Optional initFunction = connector.functions().stream() .filter(function -> function.name().equals(INIT_SYMBOL)) .findFirst(); - metadata() + nodeBuilder.metadata() .label(connector.moduleName()) .keywords(connector.packageInfo().keywords()) .icon(connector.icon()) .description(connector.documentation()); - codedata() + nodeBuilder.codedata() .node(NodeKind.NEW_CONNECTION) .org(connector.packageInfo().organization()) .module(connector.moduleName()) .object(connector.name()) + .id(String.valueOf(connector.id())) .symbol(INIT_SYMBOL); if (initFunction.isPresent()) { for (ConnectorResponse.Parameter param : initFunction.get().parameters()) { - properties().custom(param.name(), param.name(), param.documentation(), + nodeBuilder.properties().custom(param.name(), param.name(), param.documentation(), Property.valueTypeFrom(param.typeName()), getTypeConstraint(param, param.typeName()), CommonUtils.getDefaultValueForType(param.typeName()), param.optional()); } String returnType = initFunction.get().returnType().typeName(); if (returnType != null) { - properties().type(returnType).data(null); + nodeBuilder.properties().type(connector.moduleName() + ":" + connector.name()).data(null); } } + nodeBuilder.properties().scope(Property.GLOBAL_SCOPE); + return nodeBuilder.build(); } - + return null; //TODO: Obtain the connector from the codedata information if id doesn't exist. } - @Override - public Map> toSource(SourceBuilder sourceBuilder) { - sourceBuilder.newVariable(); - - FlowNode nodeTemplate = LocalIndexCentral.getInstance().getNodeTemplate(sourceBuilder.flowNode.codedata()); - sourceBuilder.token() - .keyword(SyntaxKind.CHECK_KEYWORD) - .keyword(SyntaxKind.NEW_KEYWORD) - .stepOut() - .functionParameters(nodeTemplate, - Set.of(Property.VARIABLE_KEY, Property.DATA_TYPE_KEY, Property.SCOPE_KEY)); - - Optional scope = sourceBuilder.flowNode.getProperty(Property.SCOPE_KEY); - if (scope.isEmpty()) { - throw new IllegalStateException("Scope is not defined for the new connection node"); - } - return switch (scope.get().value().toString()) { - case Property.LOCAL_SCOPE -> sourceBuilder.textEdit(false).build(); - case Property.GLOBAL_SCOPE -> sourceBuilder.textEdit(false, "connections.bal").build(); - default -> throw new IllegalStateException("Invalid scope for the new connection node"); - }; - } - private static Object getTypeConstraint(ConnectorResponse.Parameter param, String typeName) { return switch (typeName) { case "inclusion" -> param.inclusionType(); diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Retry.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Retry.java new file mode 100644 index 000000000..0207891c5 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Retry.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.flowmodelgenerator.core.model.node; + +import io.ballerina.compiler.syntax.tree.SyntaxKind; +import io.ballerina.flowmodelgenerator.core.model.Branch; +import io.ballerina.flowmodelgenerator.core.model.NodeBuilder; +import io.ballerina.flowmodelgenerator.core.model.NodeKind; +import io.ballerina.flowmodelgenerator.core.model.Property; +import io.ballerina.flowmodelgenerator.core.model.SourceBuilder; +import org.eclipse.lsp4j.TextEdit; + +import java.nio.file.Path; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * Represents retry block in the flow model. + * + * @since 1.4.0 + */ +public class Retry extends NodeBuilder { + + public static final String LABEL = "Retry Block"; + public static final String DESCRIPTION = "Retry block."; + + @Override + public void setConcreteConstData() { + metadata().label(LABEL).description(DESCRIPTION); + codedata().node(NodeKind.RETRY); + } + + @Override + public void setConcreteTemplateData(TemplateContext context) { + this.branches = List.of(Branch.DEFAULT_BODY_BRANCH, Branch.getDefaultOnFailBranch(true)); + properties().retryCount(3); + } + + @Override + public Map> toSource(SourceBuilder sourceBuilder) { + Optional body = sourceBuilder.flowNode.getBranch(Branch.BODY_LABEL); + Property retryCount = sourceBuilder.flowNode.properties().get(Property.RETRY_COUNT_KEY); + + return sourceBuilder.token() + .keyword(SyntaxKind.RETRY_KEYWORD) + .openParen() + .expression(retryCount) + .closeParen() + .whiteSpace() + .stepOut() + .body(body.isPresent() ? body.get().children() : Collections.emptyList()) + .onFailure() + .textEdit(false) + .build(); + } +} diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Rollback.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Rollback.java new file mode 100644 index 000000000..b4dd98162 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Rollback.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.flowmodelgenerator.core.model.node; + +import io.ballerina.compiler.syntax.tree.SyntaxKind; +import io.ballerina.flowmodelgenerator.core.model.NodeBuilder; +import io.ballerina.flowmodelgenerator.core.model.NodeKind; +import io.ballerina.flowmodelgenerator.core.model.Property; +import io.ballerina.flowmodelgenerator.core.model.SourceBuilder; +import org.eclipse.lsp4j.TextEdit; + +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * Represents the properties of a return node. + * + * @since 1.4.0 + */ +public class Rollback extends NodeBuilder { + + public static final String LABEL = "Rollback"; + public static final String DESCRIPTION = "Rollback the transaction"; + public static final String ROLLBACK_EXPRESSION_DOC = "Rollback transaction"; + + @Override + public void setConcreteConstData() { + metadata().label(LABEL).description(DESCRIPTION); + codedata().node(NodeKind.ROLLBACK); + } + + @Override + public void setConcreteTemplateData(TemplateContext context) { + properties().expression("", ROLLBACK_EXPRESSION_DOC); + } + + @Override + public Map> toSource(SourceBuilder sourceBuilder) { + sourceBuilder.token().keyword(SyntaxKind.ROLLBACK_KEYWORD); + Optional property = sourceBuilder.flowNode.getProperty(Property.EXPRESSION_KEY); + property.ifPresent(value -> sourceBuilder.token() + .whiteSpace() + .expression(value)); + sourceBuilder.token().endOfStatement(); + return sourceBuilder.textEdit(false).build(); + } +} diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Transaction.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Transaction.java index 3bb86fa54..ee7d9c144 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Transaction.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/Transaction.java @@ -22,6 +22,7 @@ import io.ballerina.flowmodelgenerator.core.model.Branch; import io.ballerina.flowmodelgenerator.core.model.NodeBuilder; import io.ballerina.flowmodelgenerator.core.model.NodeKind; +import io.ballerina.flowmodelgenerator.core.model.Property; import io.ballerina.flowmodelgenerator.core.model.SourceBuilder; import org.eclipse.lsp4j.TextEdit; @@ -51,6 +52,22 @@ public void setConcreteConstData() { public Map> toSource(SourceBuilder sourceBuilder) { Optional body = sourceBuilder.flowNode.getBranch(Branch.BODY_LABEL); + if (sourceBuilder.flowNode.properties() != null) { + Property retryCount = sourceBuilder.flowNode.properties().get(Property.RETRY_COUNT_KEY); + return sourceBuilder.token() + .keyword(SyntaxKind.RETRY_KEYWORD) + .openParen() + .expression(retryCount) + .closeParen() + .whiteSpace() + .keyword(SyntaxKind.TRANSACTION_KEYWORD) + .stepOut() + .body(body.isPresent() ? body.get().children() : Collections.emptyList()) + .onFailure() + .textEdit(false) + .build(); + } + return sourceBuilder.token() .keyword(SyntaxKind.TRANSACTION_KEYWORD) .stepOut() @@ -63,5 +80,6 @@ public Map> toSource(SourceBuilder sourceBuilder) { @Override public void setConcreteTemplateData(TemplateContext context) { this.branches = List.of(Branch.DEFAULT_BODY_BRANCH, Branch.getDefaultOnFailBranch(true)); + properties().retryCount(3, true); } } diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/XmlPayload.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/XmlPayload.java index d01b0fb93..b66bd9889 100644 --- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/XmlPayload.java +++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/XmlPayload.java @@ -36,7 +36,7 @@ */ public class XmlPayload extends NodeBuilder { - public static final String LABEL = "XML Payload"; + public static final String LABEL = "Assign XML"; public static final String DESCRIPTION = LABEL; public static final String XML_PAYLOAD_DOC = "Create new XML payload"; private static final String DUMMY_XML_PAYLOAD = "xml `Dummy XML value`"; diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/FlowModelGeneratorService.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/FlowModelGeneratorService.java index 268b5930c..f7a54c885 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/FlowModelGeneratorService.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/FlowModelGeneratorService.java @@ -122,7 +122,7 @@ public CompletableFuture getFlowModel(FlowModelGener // Generate the flow design model ModelGenerator modelGenerator = new ModelGenerator(semanticModel.get(), document.get(), - request.lineRange(), filePath, dataMappingsDoc.orElse(null)); + request.lineRange(), filePath, dataMappingsDoc.orElse(null), request.forceAssign()); response.setFlowDesignModel(modelGenerator.getFlowModel()); } catch (Throwable e) { response.setError(e); @@ -158,7 +158,7 @@ public CompletableFuture getSuggestedFlowModel( // Generate the flow design model ModelGenerator modelGenerator = new ModelGenerator(semanticModel.get(), document.get(), - request.lineRange(), filePath, dataMappingsDoc.orElse(null)); + request.lineRange(), filePath, dataMappingsDoc.orElse(null), request.forceAssign()); JsonElement oldFlowModel = modelGenerator.getFlowModel(); // Create a temporary directory for the in-memory cache @@ -196,7 +196,7 @@ public CompletableFuture getSuggestedFlowModel( ModelGenerator suggestedModelGenerator = new ModelGenerator(newDoc.module().getCompilation().getSemanticModel(), newDoc, - endLineRange, filePath, newDataMappingsDoc.orElse(null)); + endLineRange, filePath, newDataMappingsDoc.orElse(null), request.forceAssign()); JsonElement newFlowModel = suggestedModelGenerator.getFlowModel(); LinePosition endPosition = newTextDocument.linePositionFrom(textPosition + request.text().length()); @@ -267,7 +267,7 @@ public CompletableFuture getAvailableNodes( } AvailableNodesGenerator availableNodesGenerator = - new AvailableNodesGenerator(semanticModel.get(), document.get()); + new AvailableNodesGenerator(semanticModel.get(), document.get(), request.forceAssign()); response.setCategories( availableNodesGenerator.getAvailableNodes(request.position())); } catch (Throwable e) { diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelAvailableNodesRequest.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelAvailableNodesRequest.java index 7bb70b5e4..a4cb88715 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelAvailableNodesRequest.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelAvailableNodesRequest.java @@ -23,10 +23,11 @@ /** * Represents the request for the flow model getAvailableNodes API. * - * @param filePath file path of the source file - * @param position position of the node to be added + * @param filePath file path of the source file + * @param position position of the node to be added + * @param forceAssign whether to render the assign node wherever possible * @since 1.4.0 */ -public record FlowModelAvailableNodesRequest(String filePath, LinePosition position) { +public record FlowModelAvailableNodesRequest(String filePath, LinePosition position, boolean forceAssign) { } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelGeneratorRequest.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelGeneratorRequest.java index a8d4de35c..ab31f5b27 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelGeneratorRequest.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelGeneratorRequest.java @@ -24,12 +24,14 @@ /** * Represents the request for the flow model getFlowDesignModel API. * - * @param filePath file path of the source file - * @param startLine start line of the source range - * @param endLine end line of the source range + * @param filePath file path of the source file + * @param startLine start line of the source range + * @param endLine end line of the source range + * @param forceAssign whether to render the assign node wherever possible * @since 1.4.0 */ -public record FlowModelGeneratorRequest(String filePath, LinePosition startLine, LinePosition endLine) { +public record FlowModelGeneratorRequest(String filePath, LinePosition startLine, LinePosition endLine, + boolean forceAssign) { public LineRange lineRange() { return LineRange.from(filePath, startLine, endLine); diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelSuggestedGenerationRequest.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelSuggestedGenerationRequest.java index 3b548b22a..eb6da444d 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelSuggestedGenerationRequest.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/request/FlowModelSuggestedGenerationRequest.java @@ -24,15 +24,16 @@ /** * Represents the request for the flow model getFlowDesignModel API. * - * @param filePath file path of the source file - * @param startLine start line of the source range - * @param endLine end line of the source range - * @param text the AI generated text - * @param position the position of the AI generated text + * @param filePath file path of the source file + * @param startLine start line of the source range + * @param endLine end line of the source range + * @param text the AI generated text + * @param position the position of the AI generated text + * @param forceAssign whether to render the assign node wherever possible * @since 1.4.0 */ public record FlowModelSuggestedGenerationRequest(String filePath, LinePosition startLine, LinePosition endLine, - String text, LinePosition position) { + String text, LinePosition position, boolean forceAssign) { public LineRange lineRange() { return LineRange.from(filePath, startLine, endLine); diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/functions.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/functions.json index 3c5f9bd54..6246bfd3d 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/functions.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/main/resources/functions.json @@ -74,424 +74,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "data.jsondata", - "symbol": "toJson", - "org": "ballerina", - "importStmt": "import ballerina/data.jsondata as jsondata", - "version": "0.2.0", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "data.xmldata", - "symbol": "toXml", - "org": "ballerina", - "importStmt": "import ballerina/data.xmldata as xmldata", - "version": "1.0.0", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "data.jsondata", - "symbol": "parseAsType", - "org": "ballerina", - "importStmt": "import ballerina/data.jsondata as jsondata", - "version": "0.2.0", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "data.xmldata", - "symbol": "parseAsType", - "org": "ballerina", - "importStmt": "import ballerina/data.xmldata as xmldata", - "version": "1.0.0", - "flags": 1 - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "data.jsondata", - "symbol": "read", - "org": "ballerina", - "importStmt": "import ballerina/data.jsondata as jsondata", - "version": "0.2.0", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "data.jsondata", - "symbol": "prettify", - "org": "ballerina", - "importStmt": "import ballerina/data.jsondata as jsondata", - "version": "0.2.0", - "flags": 1 - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML\/HTML\/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "xslt", - "symbol": "transform", - "org": "ballerina", - "importStmt": "import ballerina/xslt as xslt", - "version": "2.7.0", - "flags": 1 - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\".\/resources\/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\".\/resources\/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "io", - "symbol": "fileReadCsv", - "org": "ballerina", - "importStmt": "import ballerina/io as io", - "version": "1.6.1", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\".\/resources\/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "io", - "symbol": "fileReadJson", - "org": "ballerina", - "importStmt": "import ballerina/io as io", - "version": "1.6.1", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\".\/resources\/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "io", - "symbol": "fileReadBytes", - "org": "ballerina", - "importStmt": "import ballerina/io as io", - "version": "1.6.1", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\".\/resources\/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "io", - "symbol": "fileReadXml", - "org": "ballerina", - "importStmt": "import ballerina/io as io", - "version": "1.6.1", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\".\/resources\/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\".\/resources\/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "io", - "symbol": "fileWriteCsv", - "org": "ballerina", - "importStmt": "import ballerina/io as io", - "version": "1.6.1", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\".\/resources\/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "io", - "symbol": "fileWriteJson", - "org": "ballerina", - "importStmt": "import ballerina/io as io", - "version": "1.6.1", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\".\/resources\/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "io", - "symbol": "fileWriteBytes", - "org": "ballerina", - "importStmt": "import ballerina/io as io", - "version": "1.6.1", - "flags": 1 - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World<\/book>`;\nio:Error? result = io:fileWriteXml(\".\/resources\/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "module": "io", - "symbol": "fileWriteXml", - "org": "ballerina", - "importStmt": "import ballerina/io as io", - "version": "1.6.1", - "flags": 1 - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } \ No newline at end of file diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/AvailableNodesTest.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/AvailableNodesTest.java index 51fa558d1..ba7ea30ad 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/AvailableNodesTest.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/AvailableNodesTest.java @@ -43,19 +43,27 @@ public void test(Path config) throws IOException { FlowModelAvailableNodesRequest request = new FlowModelAvailableNodesRequest(sourceDir.resolve(testConfig.source()).toAbsolutePath().toString(), - testConfig.position()); + testConfig.position(), testConfig.forceAssign()); JsonArray availableNodes = getResponse(request).getAsJsonArray("categories"); JsonArray categories = availableNodes.getAsJsonArray(); if (!categories.equals(testConfig.categories())) { TestConfig updateConfig = new TestConfig(testConfig.description(), testConfig.position(), - testConfig.source(), categories); + testConfig.source(), testConfig.forceAssign(), categories); // updateConfig(config, updateConfig); compareJsonElements(categories, testConfig.categories()); Assert.fail(String.format("Failed test: '%s' (%s)", testConfig.description(), configJsonPath)); } } + @Override + protected String[] skipList() { + //TODO: Need a better approach on how we can mock the central data + return new String[]{ + "remote_connector.json" + }; + } + @Override protected String getResourceDir() { return "available_nodes"; @@ -77,9 +85,11 @@ protected String getApiName() { * @param description The description of the test * @param position The position of the node to be added * @param source The source file path + * @param forceAssign whether to render the assign node wherever possible * @param categories The available categories for the given input */ - private record TestConfig(String description, LinePosition position, String source, JsonArray categories) { + private record TestConfig(String description, LinePosition position, String source, boolean forceAssign, + JsonArray categories) { } } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/DeleteNodeTest.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/DeleteNodeTest.java index c87966f1d..3b5aa8ee4 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/DeleteNodeTest.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/DeleteNodeTest.java @@ -61,7 +61,7 @@ public void test(Path config) throws IOException { String sourceFile = sourceDir.resolve(testConfig.source()).toAbsolutePath().toString(); FlowModelGeneratorRequest request = new FlowModelGeneratorRequest(sourceFile, testConfig.functionStart(), - testConfig.functionEnd()); + testConfig.functionEnd(), testConfig.forceAssign()); Endpoint endpoint = TestUtil.newLanguageServer().withLanguageServer(new BallerinaLanguageServer()).build(); JsonObject jsonMap = getResponse(endpoint, request, "getFlowModel").getAsJsonObject("flowModel"); @@ -72,7 +72,7 @@ public void test(Path config) throws IOException { if (optNodeToDelete.isPresent()) { nodeToDelete = optNodeToDelete.get(); } - } + } if (nodeToDelete == null) { Assert.fail(String.format("Failed test: '%s', cannot find the node to delete", configJsonPath)); } @@ -100,12 +100,21 @@ public void test(Path config) throws IOException { if (assertFailure) { TestConfig updatedConfig = new TestConfig(testConfig.description(), testConfig.functionStart(), testConfig.functionEnd(), - testConfig.nodeStart(), testConfig.nodeEnd(), testConfig.source(), newMap); + testConfig.nodeStart(), testConfig.nodeEnd(), testConfig.source(), testConfig.forceAssign(), + newMap); // updateConfig(configJsonPath, updatedConfig); Assert.fail(String.format("Failed test: '%s' (%s)", testConfig.description(), configJsonPath)); } } + @Override + protected String[] skipList() { + // TODO: Remove after fixing the log symbol issue + return new String[]{ + "delete_node8.json" + }; + } + private Optional findNodeToDelete(FlowNode node, LinePosition deleteNodeStart, LinePosition deleteNodeEnd) { LinePosition nodeStart = node.codedata().lineRange().startLine(); @@ -153,10 +162,11 @@ protected String getApiName() { * @param nodeStart The end position of the node to be deleted * @param nodeEnd The start position of the node to be deleted * @param source The source file that contains the nodes to be deleted + * @param forceAssign whether to render the assign node wherever possible * @param output The expected output */ private record TestConfig(String description, LinePosition functionStart, LinePosition functionEnd, - LinePosition nodeStart, LinePosition nodeEnd, String source, + LinePosition nodeStart, LinePosition nodeEnd, String source, boolean forceAssign, Map> output) { public String description() { diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ModelGeneratorTest.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ModelGeneratorTest.java index 28b025624..77feeda39 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ModelGeneratorTest.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ModelGeneratorTest.java @@ -48,7 +48,7 @@ public void test(Path config) throws IOException { FlowModelGeneratorRequest request = new FlowModelGeneratorRequest( sourceDir.resolve(testConfig.source()).toAbsolutePath().toString(), testConfig.start(), - testConfig.end()); + testConfig.end(), testConfig.forceAssign()); JsonObject jsonModel = getResponse(endpoint, request).getAsJsonObject("flowModel"); // Assert only the file name since the absolute path may vary depending on the machine @@ -61,7 +61,7 @@ public void test(Path config) throws IOException { boolean flowEquality = modifiedDiagram.equals(testConfig.diagram()); if (!fileNameEquality || !flowEquality) { TestConfig updatedConfig = new TestConfig(testConfig.start(), testConfig.end(), testConfig.source(), - testConfig.description(), modifiedDiagram); + testConfig.description(), testConfig.forceAssign(), modifiedDiagram); // updateConfig(configJsonPath, updatedConfig); compareJsonElements(modifiedDiagram, testConfig.diagram()); Assert.fail(String.format("Failed test: '%s' (%s)", testConfig.description(), configJsonPath)); @@ -69,6 +69,15 @@ public void test(Path config) throws IOException { TestUtil.shutdownLanguageServer(endpoint); } + @Override + protected String[] skipList() { + // TODO: Remove after fixing the log symbol issue + return new String[]{ + "function_call-log1.json", + "currency_converter1.json" + }; + } + @Override protected String getResourceDir() { return "diagram_generator"; @@ -91,11 +100,12 @@ protected String getApiName() { * @param end The end position of the diagram * @param source The source file * @param description The description of the test + * @param forceAssign whether to render the assign node wherever possible * @param diagram The expected diagram for the given inputs * @since 1.4.0 */ private record TestConfig(LinePosition start, LinePosition end, String source, String description, - JsonObject diagram) { + boolean forceAssign, JsonObject diagram) { public String description() { return description == null ? "" : description; diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ServiceGeneratorTest.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ServiceGeneratorTest.java index 3cbc950f9..a6aad0306 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ServiceGeneratorTest.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ServiceGeneratorTest.java @@ -44,7 +44,7 @@ public class ServiceGeneratorTest extends AbstractLSTest { protected Object[] getConfigsList() { return new Object[][]{ {Path.of("config1.json")}, -// {Path.of("config2.json")}, + {Path.of("config2.json")}, {Path.of("config3.json")} }; } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/SuggestedModelGeneratorTest.java b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/SuggestedModelGeneratorTest.java index a47b0f0a3..a18edc737 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/SuggestedModelGeneratorTest.java +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/SuggestedModelGeneratorTest.java @@ -48,7 +48,7 @@ public void test(Path config) throws IOException { FlowModelSuggestedGenerationRequest request = new FlowModelSuggestedGenerationRequest( sourceDir.resolve(testConfig.source()).toAbsolutePath().toString(), testConfig.start(), - testConfig.end(), testConfig.text(), testConfig.position()); + testConfig.end(), testConfig.text(), testConfig.position(), testConfig.forceAssign()); JsonObject jsonModel = getResponse(endpoint, request).getAsJsonObject("flowModel"); // Assert only the file name since the absolute path may vary depending on the machine @@ -61,7 +61,8 @@ public void test(Path config) throws IOException { boolean flowEquality = modifiedDiagram.equals(testConfig.diagram()); if (!fileNameEquality || !flowEquality) { TestConfig updatedConfig = new TestConfig(testConfig.start(), testConfig.end(), testConfig.source(), - testConfig.text(), testConfig.position(), testConfig.description(), modifiedDiagram); + testConfig.text(), testConfig.position(), testConfig.description(), testConfig.forceAssign(), + modifiedDiagram); // updateConfig(configJsonPath, updatedConfig); compareJsonElements(modifiedDiagram, testConfig.diagram()); Assert.fail(String.format("Failed test: '%s' (%s)", testConfig.description(), configJsonPath)); @@ -93,11 +94,12 @@ protected String getApiName() { * @param text the AI generated text * @param position the position of the AI generated text * @param description The description of the test + * @param forceAssign whether to render the assign node wherever possible * @param diagram The expected diagram for the given inputs * @since 1.4.0 */ private record TestConfig(LinePosition start, LinePosition end, String source, String text, LinePosition position, - String description, JsonObject diagram) { + String description, boolean forceAssign, JsonObject diagram) { public String description() { return description == null ? "" : description; diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/connector1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/connector1.json index 7f1f9d2d3..f253bca75 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/connector1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/connector1.json @@ -5,6 +5,7 @@ "offset": 0 }, "source": "connector.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -271,6 +272,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -349,7 +370,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -358,7 +379,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -367,23 +388,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -393,16 +404,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -425,44 +426,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -529,394 +492,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/connector2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/connector2.json index 3692844fa..3aa9e4ec2 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/connector2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/connector2.json @@ -5,6 +5,7 @@ "offset": 0 }, "source": "connector.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -1883,6 +1884,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -1951,7 +1972,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -1960,7 +1981,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -1969,23 +1990,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -1995,16 +2006,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -2027,44 +2028,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -2131,394 +2094,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/force_assign.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/force_assign.json new file mode 100644 index 000000000..c1820018f --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/force_assign.json @@ -0,0 +1,198 @@ +{ + "description": "", + "position": { + "line": 1, + "offset": 8 + }, + "source": "function_body.bal", + "forceAssign": true, + "categories": [ + { + "metadata": { + "label": "Connections", + "description": "The connections used in the flow" + }, + "items": [] + }, + { + "metadata": { + "label": "Statement", + "description": "Fundamental executable units in a program" + }, + "items": [ + { + "metadata": { + "label": "Assign", + "description": "Assign a value to a variable" + }, + "codedata": { + "node": "ASSIGN" + }, + "enabled": true + } + ] + }, + { + "metadata": { + "label": "Control", + "description": "Control nodes" + }, + "items": [ + { + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF" + }, + "enabled": true + }, + { + "metadata": { + "label": "Match", + "description": "Switches the data flow based on the value of an expression." + }, + "codedata": { + "node": "MATCH" + }, + "enabled": true + }, + { + "metadata": { + "label": "While", + "description": "Loop over a block of code." + }, + "codedata": { + "node": "WHILE" + }, + "enabled": true + }, + { + "metadata": { + "label": "Foreach", + "description": "Iterate over a block of code." + }, + "codedata": { + "node": "FOREACH" + }, + "enabled": true + }, + { + "metadata": { + "label": "Return" + }, + "codedata": { + "node": "RETURN" + }, + "enabled": true + }, + { + "metadata": { + "label": "Stop", + "description": "Stop the flow" + }, + "codedata": { + "node": "STOP" + }, + "enabled": true + } + ] + }, + { + "metadata": { + "label": "Error Handling", + "description": "Handle errors that occur during execution" + }, + "items": [ + { + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL" + }, + "enabled": true + }, + { + "metadata": { + "label": "Panic", + "description": "Panic and stop the execution" + }, + "codedata": { + "node": "PANIC" + }, + "enabled": true + } + ] + }, + { + "metadata": { + "label": "Logging" + }, + "items": [ + { + "metadata": { + "label": "Log Info", + "description": "Prints info logs.\n```ballerina\nlog:printInfo(\"info message\", id = 845315)\n```\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_log_2.10.0.png" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "log", + "symbol": "printInfo", + "version": "2.10.0" + }, + "enabled": true + }, + { + "metadata": { + "label": "Log Error", + "description": "Prints error logs.\n```ballerina\nerror e = error(\"error occurred\");\nlog:printError(\"error log with cause\", 'error = e, id = 845315);\n```\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_log_2.10.0.png" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "log", + "symbol": "printError", + "version": "2.10.0" + }, + "enabled": true + }, + { + "metadata": { + "label": "Log Warn", + "description": "Prints warn logs.\n```ballerina\nlog:printWarn(\"warn message\", id = 845315)\n```\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_log_2.10.0.png" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "log", + "symbol": "printWarn", + "version": "2.10.0" + }, + "enabled": true + }, + { + "metadata": { + "label": "Log Debug", + "description": "Prints debug logs.\n```ballerina\nlog:printDebug(\"debug message\", id = 845315)\n```\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_log_2.10.0.png" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "log", + "symbol": "printDebug", + "version": "2.10.0" + }, + "enabled": true + } + ] + } + ] +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/foreach1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/foreach1.json index ec4aca942..86d103fe1 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/foreach1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/foreach1.json @@ -5,6 +5,7 @@ "offset": 35 }, "source": "foreach_body.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -136,7 +157,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -145,7 +166,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -154,23 +175,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -180,16 +191,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -212,44 +213,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -316,394 +279,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function1.json index dea249753..b48e981cc 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function1.json @@ -5,6 +5,7 @@ "offset": 8 }, "source": "function_body.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -116,7 +137,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -125,7 +146,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -134,23 +155,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -160,16 +171,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -192,44 +193,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -296,394 +259,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function2.json index adf789134..24c1d17f6 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function2.json @@ -5,6 +5,7 @@ "offset": 20 }, "source": "function_body.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -116,7 +137,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -125,7 +146,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -134,23 +155,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -160,16 +171,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -192,44 +193,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -296,394 +259,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function3.json index e41bf72b7..1a9f7d9e9 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/function3.json @@ -5,6 +5,7 @@ "offset": 8 }, "source": "function_body.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -106,7 +127,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -115,7 +136,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -124,23 +145,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -150,16 +161,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -182,44 +183,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -286,394 +249,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/lock1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/lock1.json index d8ea86b3f..6beab6114 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/lock1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/lock1.json @@ -5,6 +5,7 @@ "offset": 14 }, "source": "lock.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -116,7 +137,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -125,7 +146,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -134,23 +155,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -160,16 +171,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -192,44 +193,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -296,394 +259,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/match1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/match1.json index e56588a1a..4ac9a99c2 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/match1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/match1.json @@ -5,6 +5,7 @@ "offset": 17 }, "source": "match.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -116,7 +137,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -125,7 +146,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -134,23 +155,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -160,16 +171,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -192,44 +193,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -296,394 +259,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/match2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/match2.json index f46b767d3..0329de1d2 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/match2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/match2.json @@ -5,6 +5,7 @@ "offset": 18 }, "source": "match.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -116,7 +137,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -125,7 +146,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -134,23 +155,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -160,16 +171,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -192,44 +193,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -296,394 +259,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/method1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/method1.json index 35652fa45..f20ca3d44 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/method1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/method1.json @@ -5,6 +5,7 @@ "offset": 12 }, "source": "function_body.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -106,7 +127,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -115,7 +136,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -124,23 +145,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -150,16 +161,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -182,44 +183,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -286,394 +249,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/on_fail_clause1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/on_fail_clause1.json index d9e85e10c..f5ce612a4 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/on_fail_clause1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/on_fail_clause1.json @@ -5,6 +5,7 @@ "offset": 23 }, "source": "transaction.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -116,7 +137,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -125,7 +146,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -134,23 +155,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -160,16 +171,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -192,44 +193,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -296,394 +259,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/remote_connector.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/remote_connector.json new file mode 100644 index 000000000..5fdaacf56 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/remote_connector.json @@ -0,0 +1,859 @@ +{ + "description": "A simple example of a package", + "position": { + "line": 8, + "offset": 0 + }, + "source": "remote_connector.bal", + "categories": [ + { + "metadata": { + "label": "Connections", + "description": "The connections used in the flow" + }, + "items": [ + { + "metadata": { + "label": "covidClient" + }, + "items": [ + { + "metadata": { + "label": "getGlobalStatus", + "description": "Get global COVID-19 totals for today, yesterday and two days ago\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getGlobalStatus", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getAllUSAStatesStatus", + "description": "Get COVID-19 totals for all US States\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getAllUSAStatesStatus", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getUSAStatusByState", + "description": "Get COVID-19 totals for specific US State(s)\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getUSAStatusByState", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getAllContinentsStatus", + "description": "Get COVID-19 totals for all continents\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getAllContinentsStatus", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getStatusByContinent", + "description": "Get COVID-19 totals for a specific continent\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getStatusByContinent", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getAllCountriesStatus", + "description": "Get COVID-19 totals for all countries\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getAllCountriesStatus", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getStatusByCountry", + "description": "Get COVID-19 totals for a specific country\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getStatusByCountry", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getMultipleCountriesStatus", + "description": "Get COVID-19 totals for a specific set of countries\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getMultipleCountriesStatus", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getAllCountriesAndProvincesStatus", + "description": "Get COVID-19 totals for all countries and their provinces\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getAllCountriesAndProvincesStatus", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getUSCountiesStatus", + "description": "Get COVID-19 totals for all US counties\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getUSCountiesStatus", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getUSAStatusByCounty", + "description": "Get COVID-19 totals for a specific county\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getUSAStatusByCounty", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesForAllCountriesAndProvinces", + "description": "Get COVID-19 time series data for all countries and their provinces\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesForAllCountriesAndProvinces", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getGlobalStatusInTimeSeries", + "description": "Get global accumulated COVID-19 time series data\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getGlobalStatusInTimeSeries", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesBycountry", + "description": "Get COVID-19 time series data for a specific country\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesBycountry", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesOfMultipleCountries", + "description": "Get COVID-19 time series data for a specific set of countries\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesOfMultipleCountries", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesByProvince", + "description": "Get COVID-19 time series data for a specific province in a country\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesByProvince", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesDataForMultipleProvinces", + "description": "Get COVID-19 time series data for a set of provinces in a country\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesDataForMultipleProvinces", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesForUSACounties", + "description": "Get all possible US States to query the /historical/usacounties/{state} endpoint with\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesForUSACounties", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getUSACountiesDataByState", + "description": "Get COVID-19 time series data for all counties in a specified US state\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getUSACountiesDataByState", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesForAllUSAStatesNYT", + "description": "Get COVID-19 time series data for all states, with an entry for each day since the pandemic began\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesForAllUSAStatesNYT", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesByUSAStateNYT", + "description": "Get COVID-19 time series data for a state or set of states, with an entry for each day since the pandemic began\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesByUSAStateNYT", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesByUSACountyNYT", + "description": "Get COVID-19 time series data for a county or set of counties, with an entry for each day since the pandemic began\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesByUSACountyNYT", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTimeSeriesForUSANYT", + "description": "Get COVID-19 time series data for the entire USA, with an entry for each day since the pandemic began\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTimeSeriesForUSANYT", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getAppleMobilityDataSupportedCountries", + "description": "Get a list of supported countries for Apple mobility data\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getAppleMobilityDataSupportedCountries", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getAppleMobilityDataSupportedSubRegions", + "description": "Get a list of supported subregions for specific country in the Apple mobility data set\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getAppleMobilityDataSupportedSubRegions", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getStatusBySubRegionUsingAppleMobilotyData", + "description": "Get COVID-19 Apple mobility data for subregions of a country\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getStatusBySubRegionUsingAppleMobilotyData", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getGovenrmentDataSupportedCountries", + "description": "Get a list of supported countries for government specific data\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getGovenrmentDataSupportedCountries", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getGovernmentReportedDataByCountry", + "description": "Get COVID-19 government reported data for a specific country\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getGovernmentReportedDataByCountry", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getVaccineTrialData", + "description": "Get vaccine trial data from RAPS (Regulatory Affairs Professional Society). Specifically published by Jeff Craven at https://www.raps.org/news-and-articles/news-articles/2020/3/covid-19-vaccine-tracker\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getVaccineTrialData", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTotalGlobalVaccineDosesAdministered", + "description": "Get total global COVID-19 vaccine doses administered. Sourced from https://covid.ourworldindata.org/\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTotalGlobalVaccineDosesAdministered", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getVaccineCoverageOfAllCountries", + "description": "Get COVID-19 vaccine doses administered for all countries that have reported rolling out vaccination. Sourced from https://covid.ourworldindata.org/\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getVaccineCoverageOfAllCountries", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getVaccineCoverageByCountry", + "description": "Get COVID-19 vaccine doses administered for a country that has reported vaccination rollout. Sourced from https://covid.ourworldindata.org/\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getVaccineCoverageByCountry", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getVaccineCoverageOfAllUSAStates", + "description": "Get COVID-19 vaccine doses administered for all states that have reported rolling out vaccination. Sourced from https://covid.ourworldindata.org/\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getVaccineCoverageOfAllUSAStates", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getVaccineCoverageByUSAState", + "description": "Get COVID-19 vaccine doses administered for a state that has reported vaccination rollout. Sourced from https://covid.ourworldindata.org/\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getVaccineCoverageByUSAState", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getTherapeuticsTrialData", + "description": "Get therapeutics trial data from RAPS (Regulatory Affairs Professional Society). Specifically published by Jeff Craven at https://www.raps.org/news-and-articles/news-articles/2020/3/covid-19-therapeutics-tracker\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getTherapeuticsTrialData", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getInfluenzaLikeIllnessData", + "description": "Get Influenza-like-illness data for the 2019 and 2020 outbreaks from the US Center for Disease Control\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getInfluenzaLikeIllnessData", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getInfluenzaReportsByUCLA", + "description": "Get Influenza report data for the 2019 and 2020 outbreaks from the US Center for Disease Control, reported by US clinical labs\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getInfluenzaReportsByUCLA", + "id": "6267" + }, + "enabled": true + }, + { + "metadata": { + "label": "getInfluenzaReportsByUSPHL", + "description": "Get Influenza report data for the 2019 and 2020 outbreaks from the US Center for Disease Control, reported by US public health labs\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getInfluenzaReportsByUSPHL", + "id": "6267" + }, + "enabled": true + } + ] + } + ] + }, + { + "metadata": { + "label": "Statement", + "description": "Fundamental executable units in a program" + }, + "items": [ + { + "metadata": { + "label": "Assign", + "description": "Assign a value to a variable" + }, + "codedata": { + "node": "ASSIGN" + }, + "enabled": true + }, + { + "metadata": { + "label": "Function Call", + "description": "Both project and utility functions" + }, + "codedata": { + "node": "FUNCTION" + }, + "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + } + ] + }, + { + "metadata": { + "label": "Control", + "description": "Control nodes" + }, + "items": [ + { + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF" + }, + "enabled": true + }, + { + "metadata": { + "label": "Match", + "description": "Switches the data flow based on the value of an expression." + }, + "codedata": { + "node": "MATCH" + }, + "enabled": true + }, + { + "metadata": { + "label": "While", + "description": "Loop over a block of code." + }, + "codedata": { + "node": "WHILE" + }, + "enabled": true + }, + { + "metadata": { + "label": "Foreach", + "description": "Iterate over a block of code." + }, + "codedata": { + "node": "FOREACH" + }, + "enabled": true + }, + { + "metadata": { + "label": "Return" + }, + "codedata": { + "node": "RETURN" + }, + "enabled": true + } + ] + }, + { + "metadata": { + "label": "Data", + "description": "Data nodes are used to create, read, update, delete, and transform data" + }, + "items": [ + { + "metadata": { + "label": "Assign JSON" + }, + "codedata": { + "node": "JSON_PAYLOAD" + }, + "enabled": true + }, + { + "metadata": { + "label": "Assign XML" + }, + "codedata": { + "node": "XML_PAYLOAD" + }, + "enabled": true + }, + { + "metadata": { + "label": "Assign Binary", + "description": "Assign Binary" + }, + "codedata": { + "node": "BINARY_DATA" + }, + "enabled": true + } + ] + }, + { + "metadata": { + "label": "Error Handling", + "description": "Handle errors that occur during execution" + }, + "items": [ + { + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL" + }, + "enabled": true + }, + { + "metadata": { + "label": "Panic", + "description": "Panic and stop the execution" + }, + "codedata": { + "node": "PANIC" + }, + "enabled": true + } + ] + }, + { + "metadata": { + "label": "Logging" + }, + "items": [ + { + "metadata": { + "label": "Log Info", + "description": "Prints info logs.\n```ballerina\nlog:printInfo(\"info message\", id = 845315)\n```\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_log_2.10.0.png" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "log", + "symbol": "printInfo", + "version": "2.10.0" + }, + "enabled": true + }, + { + "metadata": { + "label": "Log Error", + "description": "Prints error logs.\n```ballerina\nerror e = error(\"error occurred\");\nlog:printError(\"error log with cause\", 'error = e, id = 845315);\n```\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_log_2.10.0.png" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "log", + "symbol": "printError", + "version": "2.10.0" + }, + "enabled": true + }, + { + "metadata": { + "label": "Log Warn", + "description": "Prints warn logs.\n```ballerina\nlog:printWarn(\"warn message\", id = 845315)\n```\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_log_2.10.0.png" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "log", + "symbol": "printWarn", + "version": "2.10.0" + }, + "enabled": true + }, + { + "metadata": { + "label": "Log Debug", + "description": "Prints debug logs.\n```ballerina\nlog:printDebug(\"debug message\", id = 845315)\n```\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_log_2.10.0.png" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "log", + "symbol": "printDebug", + "version": "2.10.0" + }, + "enabled": true + } + ] + } + ] +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/transaction1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/transaction1.json index 947c352ff..c9a5963b9 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/transaction1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/transaction1.json @@ -5,6 +5,7 @@ "offset": 21 }, "source": "transaction.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -116,7 +137,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -125,7 +146,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -134,23 +155,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -160,16 +171,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -192,44 +193,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -296,394 +259,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/transaction2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/transaction2.json index d9e85e10c..f5ce612a4 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/transaction2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/transaction2.json @@ -5,6 +5,7 @@ "offset": 23 }, "source": "transaction.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -116,7 +137,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -125,7 +146,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -134,23 +155,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -160,16 +171,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -192,44 +193,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -296,394 +259,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/while1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/while1.json index 28065e3a0..7266a6d37 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/while1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/config/while1.json @@ -5,6 +5,7 @@ "offset": 20 }, "source": "while_body.bal", + "forceAssign": false, "categories": [ { "metadata": { @@ -38,6 +39,26 @@ "node": "FUNCTION" }, "enabled": true + }, + { + "metadata": { + "label": "Data Mapper", + "description": "Map data from multiple variables to a record type" + }, + "codedata": { + "node": "DATA_MAPPER" + }, + "enabled": true + }, + { + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "enabled": true } ] }, @@ -136,7 +157,7 @@ "items": [ { "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -145,7 +166,7 @@ }, { "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -154,23 +175,13 @@ }, { "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" }, "enabled": true - }, - { - "metadata": { - "label": "Data Mapper", - "description": "Map data from multiple variables to a record type" - }, - "codedata": { - "node": "DATA_MAPPER" - }, - "enabled": true } ] }, @@ -180,16 +191,6 @@ "description": "Handle errors that occur during execution" }, "items": [ - { - "metadata": { - "label": "ErrorHandler", - "description": "Catch and handle errors" - }, - "codedata": { - "node": "ERROR_HANDLER" - }, - "enabled": true - }, { "metadata": { "label": "Fail", @@ -212,44 +213,6 @@ } ] }, - { - "metadata": { - "label": "Concurrency", - "description": "Concurrency nodes" - }, - "items": [ - { - "metadata": { - "label": "Transaction", - "description": "Handle transaction." - }, - "codedata": { - "node": "TRANSACTION" - }, - "enabled": true - }, - { - "metadata": { - "label": "Lock", - "description": "Allow to access mutable states safely" - }, - "codedata": { - "node": "LOCK" - }, - "enabled": true - }, - { - "metadata": { - "label": "Start", - "description": "Execute a function or a method invocation in a new strand" - }, - "codedata": { - "node": "START" - }, - "enabled": true - } - ] - }, { "metadata": { "label": "Logging" @@ -316,394 +279,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/source/remote_connector.bal b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/source/remote_connector.bal new file mode 100644 index 000000000..1f5ae08a2 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/available_nodes/source/remote_connector.bal @@ -0,0 +1,13 @@ +import ballerina/http; +import ballerinax/covid19; + +final covid19:Client covidClient = check new ({}, ""); + +service /covid19 on new http:Listener(8080) { + + resource function get stats(http:Caller caller, http:Request req) returns error? { + } + + resource function get countryStats(http:Caller caller, http:Request req, string country) returns error? { + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get1.json index 1c09f3f5f..8f8e05ab7 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get1.json @@ -97,7 +97,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -126,7 +126,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -298,7 +298,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -317,7 +317,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -368,7 +368,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -387,7 +387,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -438,7 +438,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -457,7 +457,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -508,7 +508,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -527,7 +527,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -578,7 +578,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -597,7 +597,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -648,7 +648,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -668,7 +668,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -719,7 +719,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -738,7 +738,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -789,7 +789,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -808,7 +808,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -879,7 +879,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -889,7 +889,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get2.json index 09d0abd1a..25dbcde45 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get2.json @@ -97,7 +97,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -126,7 +126,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -177,7 +177,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -206,7 +206,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -277,7 +277,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -287,7 +287,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get3.json index 1c5a579fd..fe2346b99 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get3.json @@ -177,7 +177,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -187,7 +187,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get4.json index 24d4771ea..66d30a8a5 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-get4.json @@ -115,7 +115,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -125,7 +125,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -256,7 +256,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -266,7 +266,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post1.json index 6cc4e752b..6cc0194e8 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post1.json @@ -97,7 +97,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -145,7 +145,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -275,7 +275,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -313,7 +313,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -364,7 +364,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -403,7 +403,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -454,7 +454,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -492,7 +492,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -543,7 +543,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -581,7 +581,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -632,7 +632,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -671,7 +671,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -722,7 +722,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -760,7 +760,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -811,7 +811,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -849,7 +849,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -920,7 +920,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -930,7 +930,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post2.json index 871d50253..cda7868af 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post2.json @@ -97,7 +97,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -145,7 +145,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -234,7 +234,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -305,7 +305,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -315,7 +315,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post3.json index de2877b7b..a82c54940 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post3.json @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -206,7 +206,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post4.json index bc3b48182..241ddb85d 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/action_call-http-post4.json @@ -115,7 +115,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -125,7 +125,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -275,7 +275,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -285,7 +285,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign1.json index 66a057f0c..ed848126b 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign1.json @@ -47,7 +47,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -57,7 +57,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -103,7 +103,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -113,7 +113,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -159,7 +159,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -169,7 +169,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -215,7 +215,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -271,7 +271,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -281,7 +281,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -327,7 +327,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -337,7 +337,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -383,7 +383,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -393,7 +393,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -439,7 +439,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -449,7 +449,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign10.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign10.json index 54038c615..90459bf7a 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign10.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign10.json @@ -51,8 +51,8 @@ { "id": "48766", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -107,8 +107,8 @@ { "id": "49767", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign11.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign11.json index a8e97e6b7..fc8aaf5e5 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign11.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign11.json @@ -51,8 +51,8 @@ { "id": "53767", "metadata": { - "label": "JSON Payload", - "description": "JSON Payload" + "label": "Assign JSON", + "description": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD", @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -185,7 +185,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -195,7 +195,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign2.json index 97c227771..16f4e81f6 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign2.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -139,7 +139,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -149,7 +149,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign3.json index 61647fe63..9501030e6 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign3.json @@ -51,8 +51,8 @@ { "id": "49766", "metadata": { - "label": "JSON Payload", - "description": "JSON Payload" + "label": "Assign JSON", + "description": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD", @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign4.json index 6dd322d8d..0e3507bc8 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign4.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -107,8 +107,8 @@ { "id": "54721", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", @@ -139,7 +139,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -149,7 +149,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -163,8 +163,8 @@ { "id": "55723", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", @@ -195,7 +195,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -205,7 +205,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign5.json index 1b4293759..398543613 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign5.json @@ -51,8 +51,8 @@ { "id": "59696", "metadata": { - "label": "JSON Payload", - "description": "JSON Payload" + "label": "Assign JSON", + "description": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD", @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign6.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign6.json index a46d4385d..1d1a21d0e 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign6.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign6.json @@ -51,8 +51,8 @@ { "id": "63687", "metadata": { - "label": "JSON Payload", - "description": "JSON Payload" + "label": "Assign JSON", + "description": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD", @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -139,7 +139,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -149,7 +149,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -195,7 +195,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -205,7 +205,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign7.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign7.json index bd7ed1bb8..3b837e6e9 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign7.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign7.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign8.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign8.json index 4f1fd2cbe..f02cb137e 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign8.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign8.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign9.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign9.json index f6342f262..9ae6033f9 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign9.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/assign9.json @@ -51,8 +51,8 @@ { "id": "43814", "metadata": { - "label": "JSON Payload", - "description": "JSON Payload" + "label": "Assign JSON", + "description": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD", @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/binary_data.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/binary_data.json index 8b2127e3d..e3a83a15d 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/binary_data.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/binary_data.json @@ -15,8 +15,8 @@ { "id": "32894", "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA", @@ -47,7 +47,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -57,7 +57,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -71,8 +71,8 @@ { "id": "33882", "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA", @@ -103,7 +103,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -113,7 +113,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -127,8 +127,8 @@ { "id": "34881", "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA", @@ -159,7 +159,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -169,7 +169,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -183,8 +183,8 @@ { "id": "35867", "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA", @@ -215,7 +215,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -239,8 +239,8 @@ { "id": "36855", "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA", @@ -271,7 +271,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -281,7 +281,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/clients1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/clients1.json index 09072e0d6..d6c90dba7 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/clients1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/clients1.json @@ -88,7 +88,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -117,7 +117,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -222,7 +222,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -232,7 +232,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -283,7 +283,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -312,7 +312,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -358,7 +358,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -368,7 +368,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -511,7 +511,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -521,7 +521,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -567,7 +567,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -577,7 +577,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -623,7 +623,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -633,7 +633,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment1.json index 3fcd8d046..8cb3ea87a 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment1.json @@ -119,7 +119,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -129,7 +129,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment10.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment10.json index 96b3227b5..521114f48 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment10.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment10.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -271,7 +271,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -281,7 +281,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment11.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment11.json index 323d0e4b8..5e12f3220 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment11.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment11.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment12.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment12.json index d4cae7f77..49036c5f6 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment12.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment12.json @@ -119,7 +119,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -129,7 +129,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment13.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment13.json index cd58bcb23..e1ffff09a 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment13.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment13.json @@ -119,7 +119,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -129,7 +129,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment2.json index fd265a11f..9814de2a1 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment2.json @@ -174,7 +174,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -184,7 +184,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -230,7 +230,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -240,7 +240,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment3.json index f9c279e85..1886121cb 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment3.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment5.json index 01a7741cb..c9093d700 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment5.json @@ -207,7 +207,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -217,7 +217,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -357,7 +357,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -367,7 +367,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment6.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment6.json index 7e04d9d49..6940c7ee0 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment6.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment6.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment7.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment7.json index 5be600e07..0d8576df8 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment7.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment7.json @@ -262,7 +262,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -272,7 +272,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment8.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment8.json index 903824b49..53de7c19e 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment8.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment8.json @@ -162,7 +162,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -172,7 +172,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment9.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment9.json index a60c604f0..326f82b14 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment9.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/comment9.json @@ -9,6 +9,7 @@ }, "source": "comment.bal", "description": "Tests a simple diagram flow", + "forceAssign": false, "diagram": { "fileName": "comment.bal", "nodes": [ @@ -130,11 +131,11 @@ { "id": "112375", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "comment.bal", "startLine": { @@ -150,19 +151,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -172,7 +163,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/commit1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/commit1.json new file mode 100644 index 000000000..af559e74f --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/commit1.json @@ -0,0 +1,91 @@ +{ + "start": { + "line": 1, + "offset": 0 + }, + "end": { + "line": 4, + "offset": 1 + }, + "source": "commit.bal", + "description": "Tests flow nodes generation for commit statement", + "forceAssign": false, + "diagram": { + "fileName": "commit.bal", + "nodes": [ + { + "id": "32927", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "commit.bal", + "startLine": { + "line": 1, + "offset": 4 + }, + "endLine": { + "line": 3, + "offset": 5 + } + }, + "sourceCode": "transaction {\n check commit;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "commit.bal", + "startLine": { + "line": 1, + "offset": 16 + }, + "endLine": { + "line": 3, + "offset": 5 + } + }, + "sourceCode": "{\n check commit;\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "33997", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "commit.bal", + "startLine": { + "line": 2, + "offset": 8 + }, + "endLine": { + "line": 2, + "offset": 21 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + } + ], + "flags": 0 + } + ], + "connections": [] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/data_mapper1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/data_mapper1.json index 0662e201d..2e0d01941 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/data_mapper1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/data_mapper1.json @@ -119,7 +119,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -129,7 +129,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -175,7 +175,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -185,7 +185,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -231,7 +231,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -241,7 +241,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -367,7 +367,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -413,7 +413,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -423,7 +423,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -548,7 +548,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -569,6 +569,7 @@ "org": "nipunaf", "module": "new_connection1", "symbol": "logEmployee", + "version": "0.1.0", "lineRange": { "fileName": "main.bal", "startLine": { @@ -656,7 +657,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -666,7 +667,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler1.json index 6636546be..4ed0ac8a1 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler1.json @@ -140,7 +140,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -169,7 +169,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -359,7 +359,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -369,7 +369,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler2.json index cceec8f46..6cb5b258b 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler2.json @@ -140,7 +140,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -169,7 +169,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -377,7 +377,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -425,7 +425,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -620,7 +620,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -630,7 +630,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler3.json index 8dd3f7de7..5e279906a 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler3.json @@ -140,7 +140,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -169,7 +169,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -371,7 +371,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -381,7 +381,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler6.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler6.json index ff849c2da..5b9e4eaf9 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler6.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/error_handler6.json @@ -126,7 +126,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -136,7 +136,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/flags1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/flags1.json index ea0d18de5..192cc157f 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/flags1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/flags1.json @@ -58,6 +58,7 @@ "org": "$anon", "module": ".", "symbol": "fnWithError", + "version": "0.0.0", "lineRange": { "fileName": "flags.bal", "startLine": { @@ -85,6 +86,7 @@ "org": "$anon", "module": ".", "symbol": "fnWithError", + "version": "0.0.0", "lineRange": { "fileName": "flags.bal", "startLine": { @@ -112,6 +114,7 @@ "org": "$anon", "module": ".", "symbol": "fnWithErrorAndValue", + "version": "0.0.0", "lineRange": { "fileName": "flags.bal", "startLine": { @@ -129,7 +132,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -139,7 +142,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -160,6 +163,7 @@ "org": "$anon", "module": ".", "symbol": "fnWithErrorAndValue", + "version": "0.0.0", "lineRange": { "fileName": "flags.bal", "startLine": { @@ -177,7 +181,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -187,7 +191,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -208,6 +212,7 @@ "org": "$anon", "module": ".", "symbol": "fnWithErrorAndValue", + "version": "0.0.0", "lineRange": { "fileName": "flags.bal", "startLine": { @@ -225,7 +230,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -235,7 +240,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -256,6 +261,7 @@ "org": "$anon", "module": ".", "symbol": "fnWithErrorAndValue", + "version": "0.0.0", "lineRange": { "fileName": "flags.bal", "startLine": { @@ -273,7 +279,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -283,7 +289,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/force_assign_function.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/force_assign_function.json new file mode 100644 index 000000000..b2eb0bae7 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/force_assign_function.json @@ -0,0 +1,292 @@ +{ + "start": { + "line": 21, + "offset": 4 + }, + "end": { + "line": 25, + "offset": 5 + }, + "source": "function_call.bal", + "description": "Tests a simple diagram flow", + "forceAssign": true, + "diagram": { + "fileName": "function_call.bal", + "nodes": [ + { + "id": "52829", + "metadata": { + "label": "HTTP API" + }, + "codedata": { + "node": "EVENT_HTTP_API", + "lineRange": { + "fileName": "function_call.bal", + "startLine": { + "line": 21, + "offset": 4 + }, + "endLine": { + "line": 25, + "offset": 5 + } + }, + "sourceCode": "resource function post apples(string payload) returns Apple|jsondata:Error {\n json jsonResult = check jsondata:toJson(payload);\n Apple apple = check jsondata:parseAsType(jsonResult);\n return apple;\n }" + }, + "returning": false, + "properties": { + "method": { + "metadata": { + "label": "Method", + "description": "HTTP Method" + }, + "valueType": "IDENTIFIER", + "value": "post", + "optional": false, + "editable": true + }, + "path": { + "metadata": { + "label": "Path", + "description": "HTTP Path" + }, + "valueType": "STRING", + "value": "apples", + "optional": false, + "editable": true + } + }, + "flags": 2048 + }, + { + "id": "53873", + "metadata": { + "label": "Assign", + "description": "Assign a value to a variable" + }, + "codedata": { + "node": "ASSIGN", + "lineRange": { + "fileName": "function_call.bal", + "startLine": { + "line": 22, + "offset": 8 + }, + "endLine": { + "line": 22, + "offset": 57 + } + }, + "sourceCode": "json jsonResult = check jsondata:toJson(payload);" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Expression" + }, + "valueType": "EXPRESSION", + "value": "jsondata:toJson(payload)", + "optional": false, + "editable": true + }, + "variable": { + "metadata": { + "label": "Variable", + "description": "Name of the variable" + }, + "valueType": "IDENTIFIER", + "value": "jsonResult", + "optional": false, + "editable": true + }, + "type": { + "metadata": { + "label": "Type", + "description": "Type of the variable" + }, + "valueType": "TYPE", + "value": "json", + "optional": false, + "editable": true + } + }, + "flags": 1 + }, + { + "id": "54869", + "metadata": { + "label": "Assign", + "description": "Assign a value to a variable" + }, + "codedata": { + "node": "ASSIGN", + "lineRange": { + "fileName": "function_call.bal", + "startLine": { + "line": 23, + "offset": 8 + }, + "endLine": { + "line": 23, + "offset": 61 + } + }, + "sourceCode": "Apple apple = check jsondata:parseAsType(jsonResult);" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Expression" + }, + "valueType": "EXPRESSION", + "value": "jsondata:parseAsType(jsonResult)", + "optional": false, + "editable": true + }, + "variable": { + "metadata": { + "label": "Variable", + "description": "Name of the variable" + }, + "valueType": "IDENTIFIER", + "value": "apple", + "optional": false, + "editable": true + }, + "type": { + "metadata": { + "label": "Type", + "description": "Type of the variable" + }, + "valueType": "TYPE", + "value": "Apple", + "optional": false, + "editable": true + } + }, + "flags": 1 + }, + { + "id": "55821", + "metadata": { + "label": "Return", + "description": "Value of 'apple'" + }, + "codedata": { + "node": "RETURN", + "lineRange": { + "fileName": "function_call.bal", + "startLine": { + "line": 24, + "offset": 8 + }, + "endLine": { + "line": 24, + "offset": 21 + } + }, + "sourceCode": "return apple;" + }, + "returning": true, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Return value" + }, + "valueType": "EXPRESSION", + "value": "apple", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ], + "connections": [ + { + "id": "36771", + "metadata": { + "label": "New Connection", + "description": "Create a new connection" + }, + "codedata": { + "node": "NEW_CONNECTION", + "org": "ballerina", + "module": "http", + "object": "Client", + "symbol": "init", + "lineRange": { + "fileName": "function_call.bal", + "startLine": { + "line": 5, + "offset": 0 + }, + "endLine": { + "line": 5, + "offset": 67 + } + }, + "sourceCode": "final http:Client foodClient = check new (\"http://localhost:9090\");" + }, + "returning": false, + "properties": { + "scope": { + "metadata": { + "label": "Connection Scope", + "description": "Scope of the connection, Global or Local" + }, + "valueType": "ENUM", + "value": "Global", + "optional": false, + "editable": true + }, + "url": { + "metadata": { + "label": "url", + "description": "URL of the target service\n" + }, + "valueType": "EXPRESSION", + "value": "\"http://localhost:9090\"", + "optional": false, + "editable": true + }, + "config": { + "metadata": { + "label": "config", + "description": "The configurations to be used when initializing the `client`\n" + }, + "valueType": "EXPRESSION", + "optional": false, + "editable": true + }, + "variable": { + "metadata": { + "label": "Variable", + "description": "Name of the variable" + }, + "valueType": "IDENTIFIER", + "value": "foodClient", + "optional": false, + "editable": true + }, + "type": { + "metadata": { + "label": "Type", + "description": "Type of the variable" + }, + "valueType": "TYPE", + "value": "http:Client", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach1.json index 07f1de1c8..80f4455d8 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach1.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -199,7 +199,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -209,7 +209,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach2.json index 07f1de1c8..80f4455d8 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach2.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -199,7 +199,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -209,7 +209,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach3.json index 076531732..1a7a15908 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach3.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -257,7 +257,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -267,7 +267,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach4.json index 16d921c9d..d946a3d97 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach4.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -289,7 +289,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -299,7 +299,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach5.json index 4efe26cc9..580a75396 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/foreach5.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -199,7 +199,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -209,7 +209,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/function_call-json1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/function_call-json1.json index ca0cc24f2..8018c7b71 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/function_call-json1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/function_call-json1.json @@ -96,7 +96,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -106,7 +106,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -165,7 +165,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -175,7 +175,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -282,7 +282,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -292,7 +292,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/function_call-user1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/function_call-user1.json index 11dfb5824..0a6d1f28c 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/function_call-user1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/function_call-user1.json @@ -9,6 +9,7 @@ }, "source": "function_call.bal", "description": "Tests a simple diagram flow", + "forceAssign": false, "diagram": { "fileName": "function_call.bal", "nodes": [ @@ -58,6 +59,7 @@ "org": "$anon", "module": ".", "symbol": "greet", + "version": "0.0.0", "lineRange": { "fileName": "function_call.bal", "startLine": { @@ -84,7 +86,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -94,7 +96,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -115,6 +117,7 @@ "org": "$anon", "module": ".", "symbol": "power", + "version": "0.0.0", "lineRange": { "fileName": "function_call.bal", "startLine": { @@ -149,7 +152,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -159,7 +162,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -180,6 +183,7 @@ "org": "$anon", "module": ".", "symbol": "power", + "version": "0.0.0", "lineRange": { "fileName": "function_call.bal", "startLine": { @@ -215,7 +219,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +229,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -239,11 +243,15 @@ { "id": "102361", "metadata": { - "label": "Custom Expression", - "description": "Represents a custom Ballerina expression" + "label": "println", + "description": "Prints `any`, `error` or string templates(such as `The respective int value is ${val}`) value(s) to the STDOUT\nfollowed by a new line.\n```ballerina\nio:println(\"Start processing the CSV file from \", srcFileName);\n```\n\n" }, "codedata": { - "node": "EXPRESSION", + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "io", + "symbol": "println", + "version": "1.6.1", "lineRange": { "fileName": "function_call.bal", "startLine": { @@ -258,18 +266,7 @@ "sourceCode": "io:println(\"3 squared: \", squared, \", 3 cubed: \", cubed);" }, "returning": false, - "properties": { - "statement": { - "metadata": { - "label": "Statement", - "description": "Ballerina statement" - }, - "valueType": "EXPRESSION", - "value": "io:println(\"3 squared: \", squared, \", 3 cubed: \", cubed)", - "optional": false, - "editable": true - } - }, + "properties": {}, "flags": 0 }, { @@ -282,6 +279,7 @@ "org": "$anon", "module": ".", "symbol": "asum", + "version": "0.0.0", "lineRange": { "fileName": "function_call.bal", "startLine": { @@ -299,7 +297,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -309,7 +307,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -330,6 +328,7 @@ "org": "$anon", "module": ".", "symbol": "operate", + "version": "0.0.0", "lineRange": { "fileName": "function_call.bal", "startLine": { @@ -374,7 +373,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -384,7 +383,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -398,11 +397,15 @@ { "id": "108287", "metadata": { - "label": "Custom Expression", - "description": "Represents a custom Ballerina expression" + "label": "println", + "description": "Prints `any`, `error` or string templates(such as `The respective int value is ${val}`) value(s) to the STDOUT\nfollowed by a new line.\n```ballerina\nio:println(\"Start processing the CSV file from \", srcFileName);\n```\n\n" }, "codedata": { - "node": "EXPRESSION", + "node": "FUNCTION_CALL", + "org": "ballerina", + "module": "io", + "symbol": "println", + "version": "1.6.1", "lineRange": { "fileName": "function_call.bal", "startLine": { @@ -417,18 +420,7 @@ "sourceCode": "io:println(\"6 * 3 = \", result);" }, "returning": false, - "properties": { - "statement": { - "metadata": { - "label": "Statement", - "description": "Ballerina statement" - }, - "valueType": "EXPRESSION", - "value": "io:println(\"6 * 3 = \", result)", - "optional": false, - "editable": true - } - }, + "properties": {}, "flags": 0 }, { @@ -441,6 +433,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "function_call.bal", "startLine": { @@ -518,7 +511,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -528,7 +521,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if1.json index 1e09d787a..23ce98399 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if1.json @@ -147,7 +147,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -157,7 +157,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -225,7 +225,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -235,7 +235,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -281,7 +281,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -291,7 +291,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -367,7 +367,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -377,7 +377,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if10.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if10.json index 4050f87a5..f24124473 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if10.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if10.json @@ -411,7 +411,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -421,7 +421,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if2.json index 885ad2521..8bd42c925 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if2.json @@ -202,7 +202,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -212,7 +212,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -316,7 +316,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -326,7 +326,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -479,7 +479,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -489,7 +489,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if3.json index 0247d17cf..2066d57d2 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if3.json @@ -643,7 +643,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -653,7 +653,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if4.json index 34abe54c5..a542dce42 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if4.json @@ -92,7 +92,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -102,7 +102,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -567,7 +567,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -577,7 +577,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if5.json index e94e54c0a..36623ffc4 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if5.json @@ -341,7 +341,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -351,7 +351,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if6.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if6.json index 53968a94d..7d0688071 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if6.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if6.json @@ -319,7 +319,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -329,7 +329,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if7.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if7.json index 53a543673..2cd1525d2 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if7.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if7.json @@ -459,7 +459,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -469,7 +469,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if8.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if8.json index b2d68fd49..9edcc3c48 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if8.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if8.json @@ -529,7 +529,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -539,7 +539,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if9.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if9.json index 6c7ce2cb4..c5f18c0aa 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if9.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/if9.json @@ -389,7 +389,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -399,7 +399,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/json_payload1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/json_payload1.json index 671a4eb89..6e7f8ed8a 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/json_payload1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/json_payload1.json @@ -15,8 +15,8 @@ { "id": "32892", "metadata": { - "label": "JSON Payload", - "description": "JSON Payload" + "label": "Assign JSON", + "description": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD", @@ -47,7 +47,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -57,7 +57,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock1.json index 7964d3a15..e3655a013 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock1.json @@ -126,7 +126,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -136,7 +136,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock2.json index 4dfb9489e..7ebdc68a3 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock2.json @@ -126,7 +126,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -136,7 +136,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock3.json index 74a5d0426..661b4ff8b 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/lock3.json @@ -126,7 +126,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -136,7 +136,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/match12.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/match12.json index 56736497e..6bf08d3d6 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/match12.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/match12.json @@ -168,7 +168,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -178,7 +178,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -224,7 +224,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -234,7 +234,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/match8.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/match8.json index 827c1f945..7842cb000 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/match8.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/match8.json @@ -147,7 +147,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -157,7 +157,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node1.json index b1543f0c4..002c3cd67 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node1.json @@ -140,7 +140,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -169,7 +169,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -257,7 +257,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -267,7 +267,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node2.json index 212bed51e..2d55355ba 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node2.json @@ -9,6 +9,7 @@ }, "source": "nested_node.bal", "description": "Tests a diagram flow with nested nodes", + "forceAssign": false, "diagram": { "fileName": "nested_node.bal", "nodes": [ @@ -195,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -224,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -297,7 +298,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -326,7 +327,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -345,11 +346,11 @@ { "id": "50012", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "nested_node.bal", "startLine": { @@ -365,19 +366,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -387,7 +378,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -463,7 +454,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -473,7 +464,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node3.json index 8b5844186..b99f8c1a6 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node3.json @@ -176,7 +176,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -186,7 +186,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node4.json index f399d4da4..3c6aa5dca 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node4.json @@ -9,6 +9,7 @@ }, "source": "nested_node.bal", "description": "Tests a diagram flow with nested nodes", + "forceAssign": false, "diagram": { "fileName": "nested_node.bal", "nodes": [ @@ -226,7 +227,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -274,7 +275,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -288,11 +289,11 @@ { "id": "65133", "metadata": { - "label": "Custom Expression", - "description": "Represents a custom Ballerina expression" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "EXPRESSION", + "node": "COMMIT", "lineRange": { "fileName": "nested_node.bal", "startLine": { @@ -307,18 +308,6 @@ "sourceCode": "check commit;" }, "returning": false, - "properties": { - "statement": { - "metadata": { - "label": "Statement", - "description": "Ballerina statement" - }, - "valueType": "EXPRESSION", - "value": "check commit;", - "optional": false, - "editable": true - } - }, "flags": 1 } ] @@ -366,7 +355,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -395,7 +384,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -463,7 +452,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -492,7 +481,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -580,7 +569,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -590,7 +579,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node5.json index d58d3e403..63efbba4c 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/nested_node5.json @@ -9,6 +9,7 @@ }, "source": "nested_node.bal", "description": "Tests a diagram flow with nested nodes", + "forceAssign": false, "diagram": { "fileName": "nested_node.bal", "nodes": [ @@ -226,7 +227,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -274,7 +275,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -288,11 +289,11 @@ { "id": "78029", "metadata": { - "label": "Custom Expression", - "description": "Represents a custom Ballerina expression" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "EXPRESSION", + "node": "COMMIT", "lineRange": { "fileName": "nested_node.bal", "startLine": { @@ -307,18 +308,6 @@ "sourceCode": "check commit;" }, "returning": false, - "properties": { - "statement": { - "metadata": { - "label": "Statement", - "description": "Ballerina statement" - }, - "valueType": "EXPRESSION", - "value": "check commit;", - "optional": false, - "editable": true - } - }, "flags": 1 } ] @@ -409,7 +398,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -438,7 +427,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -560,7 +549,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -570,7 +559,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection1.json index f5b1097fe..39655c579 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection1.json @@ -106,7 +106,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -116,7 +116,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -175,7 +175,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -185,7 +185,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -256,7 +256,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -266,7 +266,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -335,7 +335,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -345,7 +345,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -404,7 +404,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -414,7 +414,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -473,7 +473,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -483,7 +483,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection2.json index f2fc98f73..0c9f40256 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection2.json @@ -106,7 +106,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -116,7 +116,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -175,7 +175,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -185,7 +185,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -256,7 +256,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -266,7 +266,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -335,7 +335,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -345,7 +345,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -404,7 +404,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -414,7 +414,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -473,7 +473,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -483,7 +483,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection3.json index 742bb4757..b28e3e196 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/new_connection3.json @@ -117,7 +117,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -127,7 +127,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -206,7 +206,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -265,7 +265,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -275,7 +275,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -334,7 +334,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -344,7 +344,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -413,7 +413,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -482,7 +482,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/panic4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/panic4.json index ef4657f43..d649b607b 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/panic4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/panic4.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/retry.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/retry.json new file mode 100644 index 000000000..45bd7a9ea --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/retry.json @@ -0,0 +1,835 @@ +{ + "start": { + "line": 1, + "offset": 0 + }, + "end": { + "line": 28, + "offset": 1 + }, + "source": "retry.bal", + "description": "Tests flow nodes generation for retry statement", + "forceAssign": false, + "diagram": { + "fileName": "retry.bal", + "nodes": [ + { + "id": "32927", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 1, + "offset": 4 + }, + "endLine": { + "line": 3, + "offset": 5 + } + }, + "sourceCode": "retry {\n check nameOrError();\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 1, + "offset": 10 + }, + "endLine": { + "line": 3, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "34004", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "version": "0.0.0", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 2, + "offset": 8 + }, + "endLine": { + "line": 2, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "36957", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 5, + "offset": 4 + }, + "endLine": { + "line": 9, + "offset": 5 + } + }, + "sourceCode": "retry {\n check nameOrError();\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 5, + "offset": 10 + }, + "endLine": { + "line": 7, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "37972", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "version": "0.0.0", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 6, + "offset": 8 + }, + "endLine": { + "line": 6, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 7, + "offset": 22 + }, + "endLine": { + "line": 9, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "39946", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 8, + "offset": 8 + }, + "endLine": { + "line": 8, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "42909", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 11, + "offset": 4 + }, + "endLine": { + "line": 15, + "offset": 5 + } + }, + "sourceCode": "retry (4) {\n check nameOrError();\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 11, + "offset": 14 + }, + "endLine": { + "line": 13, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "43924", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "version": "0.0.0", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 12, + "offset": 8 + }, + "endLine": { + "line": 12, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 13, + "offset": 22 + }, + "endLine": { + "line": 15, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "45898", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 14, + "offset": 8 + }, + "endLine": { + "line": 14, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "48861", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 17, + "offset": 4 + }, + "endLine": { + "line": 21, + "offset": 5 + } + }, + "sourceCode": "retry (4) {\n fail error(\"failed retry\");\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 17, + "offset": 14 + }, + "endLine": { + "line": 19, + "offset": 5 + } + }, + "sourceCode": "{\n fail error(\"failed retry\");\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "49883", + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 18, + "offset": 8 + }, + "endLine": { + "line": 18, + "offset": 35 + } + }, + "sourceCode": "fail error(\"failed retry\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Fail value" + }, + "valueType": "EXPRESSION", + "value": "error(\"failed retry\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 19, + "offset": 22 + }, + "endLine": { + "line": 21, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "51850", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 20, + "offset": 8 + }, + "endLine": { + "line": 20, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "54813", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 23, + "offset": 4 + }, + "endLine": { + "line": 27, + "offset": 5 + } + }, + "sourceCode": "retry (4) {\n fail error(\"failed retry\");\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 23, + "offset": 41 + }, + "endLine": { + "line": 25, + "offset": 5 + } + }, + "sourceCode": "{\n fail error(\"failed retry\");\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "55835", + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 24, + "offset": 8 + }, + "endLine": { + "line": 24, + "offset": 35 + } + }, + "sourceCode": "fail error(\"failed retry\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Fail value" + }, + "valueType": "EXPRESSION", + "value": "error(\"failed retry\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 25, + "offset": 22 + }, + "endLine": { + "line": 27, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "57802", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 26, + "offset": 8 + }, + "endLine": { + "line": 26, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ], + "connections": [] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/retry_transaction.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/retry_transaction.json new file mode 100644 index 000000000..b2dbc0a79 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/retry_transaction.json @@ -0,0 +1,1075 @@ +{ + "start": { + "line": 1, + "offset": 0 + }, + "end": { + "line": 37, + "offset": 1 + }, + "source": "retry_transaction.bal", + "description": "Tests flow nodes generation for retry transaction statement", + "forceAssign": false, + "diagram": { + "fileName": "retry_transaction.bal", + "nodes": [ + { + "id": "32958", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 1, + "offset": 4 + }, + "endLine": { + "line": 4, + "offset": 5 + } + }, + "sourceCode": "retry transaction {\n check nameOrError();\n check commit;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 1, + "offset": 22 + }, + "endLine": { + "line": 4, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n check commit;\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "34004", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "version": "0.0.0", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 2, + "offset": 8 + }, + "endLine": { + "line": 2, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + }, + { + "id": "34989", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 3, + "offset": 8 + }, + "endLine": { + "line": 3, + "offset": 21 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "37980", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 6, + "offset": 4 + }, + "endLine": { + "line": 11, + "offset": 5 + } + }, + "sourceCode": "retry transaction {\n check nameOrError();\n check commit;\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 6, + "offset": 22 + }, + "endLine": { + "line": 9, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n check commit;\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "38964", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "version": "0.0.0", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 7, + "offset": 8 + }, + "endLine": { + "line": 7, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + }, + { + "id": "39949", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 8, + "offset": 8 + }, + "endLine": { + "line": 8, + "offset": 21 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 9, + "offset": 22 + }, + "endLine": { + "line": 11, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "41930", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 10, + "offset": 8 + }, + "endLine": { + "line": 10, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "44924", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 13, + "offset": 4 + }, + "endLine": { + "line": 18, + "offset": 5 + } + }, + "sourceCode": "retry (4) transaction {\n check nameOrError();\n check commit;\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 13, + "offset": 26 + }, + "endLine": { + "line": 16, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n check commit;\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "45908", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "version": "0.0.0", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 14, + "offset": 8 + }, + "endLine": { + "line": 14, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + }, + { + "id": "46893", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 15, + "offset": 8 + }, + "endLine": { + "line": 15, + "offset": 21 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 16, + "offset": 22 + }, + "endLine": { + "line": 18, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "48874", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 17, + "offset": 8 + }, + "endLine": { + "line": 17, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "51930", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 20, + "offset": 4 + }, + "endLine": { + "line": 27, + "offset": 5 + } + }, + "sourceCode": "retry (4) transaction {\n if true {\n check commit;\n }\n fail error(\"failed retry\");\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 20, + "offset": 26 + }, + "endLine": { + "line": 25, + "offset": 5 + } + }, + "sourceCode": "{\n if true {\n check commit;\n }\n fail error(\"failed retry\");\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "52895", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 21, + "offset": 8 + }, + "endLine": { + "line": 23, + "offset": 9 + } + }, + "sourceCode": "if true {\n check commit;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 21, + "offset": 16 + }, + "endLine": { + "line": 23, + "offset": 9 + } + }, + "sourceCode": "{\n check commit;\n }" + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "true ", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "53965", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 22, + "offset": 12 + }, + "endLine": { + "line": 22, + "offset": 25 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + } + ], + "flags": 0 + }, + { + "id": "55835", + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 24, + "offset": 8 + }, + "endLine": { + "line": 24, + "offset": 35 + } + }, + "sourceCode": "fail error(\"failed retry\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Fail value" + }, + "valueType": "EXPRESSION", + "value": "error(\"failed retry\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 25, + "offset": 22 + }, + "endLine": { + "line": 27, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "57802", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 26, + "offset": 8 + }, + "endLine": { + "line": 26, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "60858", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 29, + "offset": 4 + }, + "endLine": { + "line": 36, + "offset": 5 + } + }, + "sourceCode": "retry (4) transaction {\n if true {\n check commit;\n }\n fail error(\"failed retry\");\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 29, + "offset": 53 + }, + "endLine": { + "line": 34, + "offset": 5 + } + }, + "sourceCode": "{\n if true {\n check commit;\n }\n fail error(\"failed retry\");\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "61823", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 30, + "offset": 8 + }, + "endLine": { + "line": 32, + "offset": 9 + } + }, + "sourceCode": "if true {\n check commit;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 30, + "offset": 16 + }, + "endLine": { + "line": 32, + "offset": 9 + } + }, + "sourceCode": "{\n check commit;\n }" + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "true ", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "62893", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 31, + "offset": 12 + }, + "endLine": { + "line": 31, + "offset": 25 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + } + ], + "flags": 0 + }, + { + "id": "64763", + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 33, + "offset": 8 + }, + "endLine": { + "line": 33, + "offset": 35 + } + }, + "sourceCode": "fail error(\"failed retry\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Fail value" + }, + "valueType": "EXPRESSION", + "value": "error(\"failed retry\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 34, + "offset": 22 + }, + "endLine": { + "line": 36, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "66730", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 35, + "offset": 8 + }, + "endLine": { + "line": 35, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ], + "connections": [] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/simple_flow.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/simple_flow.json index 5d02386c0..cda7b05c4 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/simple_flow.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/simple_flow.json @@ -152,7 +152,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -181,7 +181,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -290,7 +290,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -319,7 +319,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -431,7 +431,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -441,7 +441,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -510,7 +510,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -520,7 +520,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/start1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/start1.json index 58e57194c..564404aad 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/start1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/start1.json @@ -119,7 +119,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -129,7 +129,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/start2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/start2.json index ff0601b1c..e537cab61 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/start2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/start2.json @@ -83,7 +83,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +93,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -175,7 +175,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -185,7 +185,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction1.json index dc85e1dc3..5f3a7c1c0 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction1.json @@ -9,6 +9,7 @@ }, "source": "transaction.bal", "description": "Tests a simple diagram flow", + "forceAssign": false, "diagram": { "fileName": "transaction.bal", "nodes": [ @@ -58,11 +59,11 @@ { "id": "34007", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -78,19 +79,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -100,7 +91,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction2.json index 549e45151..334b2e1db 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction2.json @@ -9,6 +9,7 @@ }, "source": "transaction.bal", "description": "Tests a simple diagram flow", + "forceAssign": false, "diagram": { "fileName": "transaction.bal", "nodes": [ @@ -83,7 +84,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -93,7 +94,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -150,11 +151,11 @@ { "id": "41943", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -170,19 +171,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -192,7 +183,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -254,11 +245,11 @@ { "id": "45911", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -274,19 +265,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -296,7 +277,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction3.json index 463a2c55b..465890585 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction3.json @@ -9,6 +9,7 @@ }, "source": "transaction.bal", "description": "Tests a simple diagram flow", + "forceAssign": false, "diagram": { "fileName": "transaction.bal", "nodes": [ @@ -137,11 +138,11 @@ { "id": "53975", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -157,19 +158,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -179,7 +170,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -198,11 +189,11 @@ { "id": "55831", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -218,19 +209,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -240,7 +221,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction4.json index d4ec3c31d..204109845 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction4.json @@ -9,6 +9,7 @@ }, "source": "transaction.bal", "description": "Tests a simple diagram flow", + "forceAssign": false, "diagram": { "fileName": "transaction.bal", "nodes": [ @@ -94,11 +95,11 @@ { "id": "61781", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -114,19 +115,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -136,7 +127,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction5.json index aaa5edbf2..cc50d2987 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction5.json @@ -9,6 +9,7 @@ }, "source": "transaction.bal", "description": "Tests a simple diagram flow", + "forceAssign": false, "diagram": { "fileName": "transaction.bal", "nodes": [ @@ -94,11 +95,11 @@ { "id": "69717", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -114,19 +115,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -136,7 +127,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction6.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction6.json index b56040572..fd5f4b4cb 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction6.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction6.json @@ -9,6 +9,7 @@ }, "source": "transaction.bal", "description": "Tests a simple diagram flow", + "forceAssign": false, "diagram": { "fileName": "transaction.bal", "nodes": [ @@ -137,11 +138,11 @@ { "id": "78773", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -157,19 +158,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -179,7 +170,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -198,11 +189,11 @@ { "id": "80629", "metadata": { - "label": "Assign", - "description": "Assign a value to a variable" + "label": "Commit", + "description": "Commit transaction" }, "codedata": { - "node": "ASSIGN", + "node": "COMMIT", "lineRange": { "fileName": "transaction.bal", "startLine": { @@ -218,19 +209,9 @@ }, "returning": false, "properties": { - "expression": { - "metadata": { - "label": "Expression", - "description": "Expression" - }, - "valueType": "EXPRESSION", - "value": "check commit", - "optional": false, - "editable": true - }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -240,7 +221,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction7.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction7.json new file mode 100644 index 000000000..760b7d704 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction7.json @@ -0,0 +1,91 @@ +{ + "start": { + "line": 1, + "offset": 0 + }, + "end": { + "line": 3, + "offset": 1 + }, + "source": "commit.bal", + "description": "Tests a simple diagram flow", + "forceAssign": false, + "diagram": { + "fileName": "commit.bal", + "nodes": [ + { + "id": "32927", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "commit.bal", + "startLine": { + "line": 1, + "offset": 4 + }, + "endLine": { + "line": 3, + "offset": 5 + } + }, + "sourceCode": "transaction {\n check commit;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "commit.bal", + "startLine": { + "line": 1, + "offset": 16 + }, + "endLine": { + "line": 3, + "offset": 5 + } + }, + "sourceCode": "{\n check commit;\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "33997", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "commit.bal", + "startLine": { + "line": 2, + "offset": 8 + }, + "endLine": { + "line": 2, + "offset": 21 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + } + ], + "flags": 0 + } + ], + "connections": [] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction8.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction8.json new file mode 100644 index 000000000..f53591c2c --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction8.json @@ -0,0 +1,233 @@ +{ + "start": { + "line": 0, + "offset": 0 + }, + "end": { + "line": 8, + "offset": 1 + }, + "source": "rollback.bal", + "description": "Tests a simple diagram flow", + "forceAssign": false, + "diagram": { + "fileName": "rollback.bal", + "nodes": [ + { + "id": "31993", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 8, + "offset": 1 + } + }, + "sourceCode": "function testRollback(int? i) returns error? {\n transaction {\n if i is () {\n check commit;\n } else {\n rollback;\n }\n }\n}" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "function testRollback(int? i) returns error? {\n transaction {\n if i is () {\n check commit;\n } else {\n rollback;\n }\n }\n}", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "33051", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 1, + "offset": 4 + }, + "endLine": { + "line": 7, + "offset": 5 + } + }, + "sourceCode": "transaction {\n if i is () {\n check commit;\n } else {\n rollback;\n }\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 1, + "offset": 16 + }, + "endLine": { + "line": 7, + "offset": 5 + } + }, + "sourceCode": "{\n if i is () {\n check commit;\n } else {\n rollback;\n }\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "34109", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 2, + "offset": 8 + }, + "endLine": { + "line": 6, + "offset": 9 + } + }, + "sourceCode": "if i is () {\n check commit;\n } else {\n rollback;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 2, + "offset": 19 + }, + "endLine": { + "line": 4, + "offset": 9 + } + }, + "sourceCode": "{\n check commit;\n }" + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "i is () ", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "35117", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 3, + "offset": 12 + }, + "endLine": { + "line": 3, + "offset": 25 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + }, + { + "label": "Else", + "kind": "BLOCK", + "codedata": { + "node": "ELSE", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 4, + "offset": 15 + }, + "endLine": { + "line": 6, + "offset": 9 + } + }, + "sourceCode": "{\n rollback;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "children": [ + { + "id": "37097", + "metadata": { + "label": "Rollback", + "description": "Rollback the transaction" + }, + "codedata": { + "node": "ROLLBACK", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 5, + "offset": 12 + }, + "endLine": { + "line": 5, + "offset": 21 + } + }, + "sourceCode": "rollback;" + }, + "returning": false, + "flags": 0 + } + ] + } + ], + "flags": 0 + } + ] + } + ], + "flags": 0 + } + ], + "connections": [] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction9.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction9.json new file mode 100644 index 000000000..e541361c0 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/transaction9.json @@ -0,0 +1,245 @@ +{ + "start": { + "line": 10, + "offset": 0 + }, + "end": { + "line": 18, + "offset": 1 + }, + "source": "rollback.bal", + "description": "Tests a simple diagram flow", + "forceAssign": false, + "diagram": { + "fileName": "rollback.bal", + "nodes": [ + { + "id": "41913", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 10, + "offset": 0 + }, + "endLine": { + "line": 18, + "offset": 1 + } + }, + "sourceCode": "function testRollbackWithExpression(int? i) returns error? {\n transaction {\n if i is () {\n check commit;\n } else {\n rollback error(\"Rollback the transaction\");\n }\n }\n}" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "function testRollbackWithExpression(int? i) returns error? {\n transaction {\n if i is () {\n check commit;\n } else {\n rollback error(\"Rollback the transaction\");\n }\n }\n}", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + { + "id": "42971", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 11, + "offset": 4 + }, + "endLine": { + "line": 17, + "offset": 5 + } + }, + "sourceCode": "transaction {\n if i is () {\n check commit;\n } else {\n rollback error(\"Rollback the transaction\");\n }\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 11, + "offset": 16 + }, + "endLine": { + "line": 17, + "offset": 5 + } + }, + "sourceCode": "{\n if i is () {\n check commit;\n } else {\n rollback error(\"Rollback the transaction\");\n }\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "44029", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 12, + "offset": 8 + }, + "endLine": { + "line": 16, + "offset": 9 + } + }, + "sourceCode": "if i is () {\n check commit;\n } else {\n rollback error(\"Rollback the transaction\");\n }" + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 12, + "offset": 19 + }, + "endLine": { + "line": 14, + "offset": 9 + } + }, + "sourceCode": "{\n check commit;\n }" + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "i is () ", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "45037", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 13, + "offset": 12 + }, + "endLine": { + "line": 13, + "offset": 25 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "flags": 1 + } + ] + }, + { + "label": "Else", + "kind": "BLOCK", + "codedata": { + "node": "ELSE", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 14, + "offset": 15 + }, + "endLine": { + "line": 16, + "offset": 9 + } + }, + "sourceCode": "{\n rollback error(\"Rollback the transaction\");\n }" + }, + "repeatable": "ZERO_OR_ONE", + "children": [ + { + "id": "47051", + "metadata": { + "label": "Rollback", + "description": "Rollback the transaction" + }, + "codedata": { + "node": "ROLLBACK", + "lineRange": { + "fileName": "rollback.bal", + "startLine": { + "line": 15, + "offset": 12 + }, + "endLine": { + "line": 15, + "offset": 55 + } + }, + "sourceCode": "rollback error(\"Rollback the transaction\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Rollback transaction" + }, + "valueType": "EXPRESSION", + "value": "error(\"Rollback the transaction\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + } + ], + "flags": 0 + } + ] + } + ], + "flags": 0 + } + ], + "connections": [] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while1.json index 79e6c04f0..4d0586091 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while1.json @@ -92,7 +92,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -102,7 +102,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -533,7 +533,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -543,7 +543,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while2.json index 7215d7c67..5ba309b05 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while2.json @@ -176,7 +176,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -186,7 +186,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while3.json index f511ef242..bb869a9db 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while3.json @@ -92,7 +92,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -102,7 +102,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -463,7 +463,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -473,7 +473,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while4.json index cbbcfe8f4..a400a3cb1 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while4.json @@ -92,7 +92,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -102,7 +102,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -495,7 +495,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -505,7 +505,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while5.json index 09aeceb8f..11113cdca 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while5.json @@ -92,7 +92,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -102,7 +102,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -148,7 +148,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -158,7 +158,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -252,7 +252,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -281,7 +281,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -453,7 +453,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -463,7 +463,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -532,7 +532,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -542,7 +542,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -732,7 +732,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -780,7 +780,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -1051,7 +1051,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -1061,7 +1061,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while6.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while6.json index a6682bde0..dba6cab15 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while6.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while6.json @@ -92,7 +92,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -102,7 +102,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -547,7 +547,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -557,7 +557,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while7.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while7.json index e91cc79ba..68c51dbe9 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while7.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while7.json @@ -92,7 +92,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -102,7 +102,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -547,7 +547,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -557,7 +557,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while8.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while8.json index bc1fbf260..a96a437fb 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while8.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/while8.json @@ -92,7 +92,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -102,7 +102,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -196,7 +196,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -631,7 +631,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -641,7 +641,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/xml_payload.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/xml_payload.json index cef60d3ec..efcab98a4 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/xml_payload.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/config/xml_payload.json @@ -15,8 +15,8 @@ { "id": "32896", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", @@ -47,7 +47,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -57,7 +57,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -71,8 +71,8 @@ { "id": "33881", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", @@ -103,7 +103,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -113,7 +113,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -127,8 +127,8 @@ { "id": "34880", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", @@ -159,7 +159,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -169,7 +169,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -183,8 +183,8 @@ { "id": "35872", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", @@ -215,7 +215,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -225,7 +225,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -239,8 +239,8 @@ { "id": "36860", "metadata": { - "label": "XML Payload", - "description": "XML Payload" + "label": "Assign XML", + "description": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD", @@ -271,7 +271,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -281,7 +281,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/commit.bal b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/commit.bal new file mode 100644 index 000000000..8c0c28765 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/commit.bal @@ -0,0 +1,5 @@ +public function testCommit() returns error? { + transaction { + check commit; + } +} \ No newline at end of file diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/retry.bal b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/retry.bal new file mode 100644 index 000000000..184a53a5a --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/retry.bal @@ -0,0 +1,31 @@ +function testRetryStatement() returns error? { + retry { + check nameOrError(); + } + + retry { + check nameOrError(); + } on fail var err { + check err; + } + + retry (4) { + check nameOrError(); + } on fail var err { + check err; + } + + retry (4) { + fail error("failed retry"); + } on fail var err { + check err; + } + + retry (4) { + fail error("failed retry"); + } on fail var err { + check err; + } +} + +function nameOrError() returns error? => (); diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/retry_transaction.bal b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/retry_transaction.bal new file mode 100644 index 000000000..51b085ba1 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/retry_transaction.bal @@ -0,0 +1,40 @@ +function testRetryTransactionStatement() returns error? { + retry transaction { + check nameOrError(); + check commit; + } + + retry transaction { + check nameOrError(); + check commit; + } on fail var err { + check err; + } + + retry (4) transaction { + check nameOrError(); + check commit; + } on fail var err { + check err; + } + + retry (4) transaction { + if true { + check commit; + } + fail error("failed retry"); + } on fail var err { + check err; + } + + retry (4) transaction { + if true { + check commit; + } + fail error("failed retry"); + } on fail var err { + check err; + } +} + +function nameOrError() returns error? => (); diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/rollback.bal b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/rollback.bal new file mode 100644 index 000000000..329d29078 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/diagram_generator/source/rollback.bal @@ -0,0 +1,19 @@ +function testRollback(int? i) returns error? { + transaction { + if i is () { + check commit; + } else { + rollback; + } + } +} + +function testRollbackWithExpression(int? i) returns error? { + transaction { + if i is () { + check commit; + } else { + rollback error("Rollback the transaction"); + } + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_connectors/covid.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_connectors/covid.json new file mode 100644 index 000000000..190be7513 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_connectors/covid.json @@ -0,0 +1,26 @@ +{ + "description": "Sample flow model", + "keyword": "covid", + "categories": [ + { + "metadata": { + "label": "covid19", + "description": "Connects to [Novel COVID-19 API](https://disease.sh/docs/) from Ballerina.", + "keywords": [ + "Lifestyle & Entertainment/News & Lifestyle", + "Cost/Free" + ], + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "NEW_CONNECTION", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "init", + "id": "6267" + }, + "enabled": true + } + ] +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_functions/config/custom_default.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_functions/config/custom_default.json index 4ec1f1d27..b01e25ed8 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_functions/config/custom_default.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_functions/config/custom_default.json @@ -169,394 +169,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_functions/config/default.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_functions/config/default.json index 85b2f2080..052d97904 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_functions/config/default.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/get_functions/config/default.json @@ -105,394 +105,6 @@ "enabled": true } ] - }, - { - "metadata": { - "label": "Data Conversion" - }, - "items": [ - { - "metadata": { - "label": "Type To JSON", - "description": "Converts a value of type `anydata` to `json`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "toJson", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Type To XML", - "description": "Converts a `Map` or `Record` representation to its XML representation.\nAdditionally, when converting from a record, the `xmldata:Namespace`, `xmldata:Name`, and `xmldata:Attribute`\nannotations can be used to add `namespaces`, `name of elements`, and `attributes` to XML representation.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "toXml", - "version": "1.0.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON To Type", - "description": "Convert value of type `json` to subtype of `anydata`.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "parseAsType", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "XML To Type", - "description": "Converts XML to record type with projection.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.xmldata", - "symbol": "parseAsType", - "version": "1.0.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "JSON" - }, - "items": [ - { - "metadata": { - "label": "Evaluate JSON Path", - "description": "Extract details from the given JSON value using the provided query template expression.\n\n```ballerina\nread({id: 1, \"name\": \"John Doe\"}, `$.name`) => \"John Doe\"\n```\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "read", - "version": "0.2.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "JSON Pretty Print", - "description": "Prettifies a `json` value to print it.\n\n", - "icon": "" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "data.jsondata", - "symbol": "prettify", - "version": "0.2.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "XML" - }, - "items": [ - { - "metadata": { - "label": "XSLT Transform", - "description": "Transforms the single-rooted XML content to another XML/HTML/plain text using XSL transformations.\n```ballerina\nxml|error target = xslt:transform(sourceXml, xsl);\n```\n\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_xslt_2.7.0.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "xslt", - "symbol": "transform", - "version": "2.7.0" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "File Data" - }, - "items": [ - { - "metadata": { - "label": "Read CSV", - "description": "Read file content as a CSV.\nWhen the expected data type is record[], the first entry of the csv file should contain matching headers.\n```ballerina\nstring[][]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\nrecord{}[]|io:Error content = io:fileReadCsv(\"./resources/myfile.csv\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read JSON", - "description": "Reads file content as a JSON.\n```ballerina\njson|io:Error content = io:fileReadJson(\"./resources/myfile.json\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read Bytes", - "description": "Read the entire file content as a byte array.\n```ballerina\nbyte[]|io:Error content = io:fileReadBytes(\"./resources/myfile.txt\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Read XML", - "description": "Reads file content as an XML.\n```ballerina\nxml|io:Error content = io:fileReadXml(\"./resources/myfile.xml\");\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileReadXml", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write CSV", - "description": "Write CSV content to a file.\nWhen the input is a record[] type in `OVERWRITE`, headers will be written to the CSV file by default.\nFor `APPEND`, order of the existing csv file is inferred using the headers and used as the order.\n```ballerina\ntype Coord record {int x;int y;};\nCoord[] contentRecord = [{x: 1,y: 2},{x: 1,y: 2}]\nstring[][] content = [[\"Anne\", \"Johnson\", \"SE\"], [\"John\", \"Cameron\", \"QA\"]];\nio:Error? result = io:fileWriteCsv(\"./resources/myfile.csv\", content);\nio:Error? resultRecord = io:fileWriteCsv(\"./resources/myfileRecord.csv\", contentRecord);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteCsv", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write JSON", - "description": "Write a JSON to a file.\n```ballerina\njson content = {\"name\": \"Anne\", \"age\": 30};\nio:Error? result = io:fileWriteJson(\"./resources/myfile.json\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteJson", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write Bytes", - "description": "Write a set of bytes to a file.\n```ballerina\nbyte[] content = [60, 78, 39, 28];\nio:Error? result = io:fileWriteBytes(\"./resources/myfile.txt\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteBytes", - "version": "1.6.1" - }, - "enabled": true - }, - { - "metadata": { - "label": "Write XML", - "description": "Write XML content to a file.\n```ballerina\nxml content = xml `The Lost World`;\nio:Error? result = io:fileWriteXml(\"./resources/myfile.xml\", content);\n```\n", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_io_1.6.1.png" - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "io", - "symbol": "fileWriteXml", - "version": "1.6.1" - }, - "enabled": true - } - ] - }, - { - "metadata": { - "label": "Time", - "description": "This package provides a set of APIs that have the capabilities to generate and manipulate UTC and localized time.", - "icon": "https://bcentral-packageicons.azureedge.net/images/ballerina_time_2.5.0.png" - }, - "items": [ - { - "metadata": { - "label": "Get Current UTC Time", - "description": "Returns the UTC representing the current time." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Current Monotonic Time", - "description": "Returns the number of seconds from an unspecified epoch." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "monotonicNow", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Time Zone", - "description": "Return the time zone object of a given zone ID." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "getZone", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Get Day of Week", - "description": "Get the day of week for a specified date." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dayOfWeek", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "UTC Time Difference in Seconds", - "description": "Returns the difference in seconds between `utc1` and `utc2`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcDiffSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Add Seconds to UTC", - "description": "Returns UTC time that occurs seconds after `utc`." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcAddSeconds", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Validate Gregorian Date", - "description": "Check that days and months are within range as per Gregorian calendar rules." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "dateValidate", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert Civil to UTC", - "description": "Converts a given `Civil` value to a `Utc` timestamp." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcFromCivil", - "version": "2.5.0" - }, - "enabled": true - }, - { - "metadata": { - "label": "Convert UTC to Civil", - "description": "Converts a given `time:Utc` timestamp to a `time:Civil` value." - }, - "codedata": { - "node": "FUNCTION_CALL", - "org": "ballerina", - "module": "time", - "symbol": "utcToCivil", - "version": "2.5.0" - }, - "enabled": true - } - ] } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/commit.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/commit.json new file mode 100644 index 000000000..67c45a50a --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/commit.json @@ -0,0 +1,18 @@ +{ + "description": "Sample diagram node", + "codedata": { + "node": "COMMIT" + }, + "output": { + "id": "31", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT" + }, + "returning": false, + "flags": 0 + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/action_call-covid-getStatusByCountry.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/action_call-covid-getStatusByCountry.json new file mode 100644 index 000000000..1771b5089 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/action_call-covid-getStatusByCountry.json @@ -0,0 +1,117 @@ +{ + "description": "Sample diagram node", + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getStatusByCountry", + "id": "6267" + }, + "output": { + "id": "31", + "metadata": { + "label": "getStatusByCountry", + "description": "Get COVID-19 totals for a specific country\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getStatusByCountry", + "id": "6267" + }, + "returning": false, + "properties": { + "country": { + "metadata": { + "label": "country", + "description": "A country name, iso2, iso3, or country ID code \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": false, + "editable": true + }, + "yesterday": { + "metadata": { + "label": "yesterday", + "description": "Enter `true`(1) to receive data reported a day ago. Default is `false`(0) \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": true, + "editable": true + }, + "twoDaysAgo": { + "metadata": { + "label": "twoDaysAgo", + "description": "Enter `true`(1) to receive data reported two days ago. Default is `false`(0) \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": true, + "editable": true + }, + "strict": { + "metadata": { + "label": "strict", + "description": "Setting to false gives you the ability to fuzzy search countries (i.e. Oman vs. rOMANia) \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": false, + "editable": true + }, + "allowNull": { + "metadata": { + "label": "allowNull", + "description": "By default, value is 0. Enter `1` to allow nulls to be returned \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": true, + "editable": true + }, + "type": { + "metadata": { + "label": "Type", + "description": "Type of the variable" + }, + "valueType": "TYPE", + "value": "union", + "optional": false, + "editable": true + }, + "variable": { + "metadata": { + "label": "Variable", + "description": "Name of the variable" + }, + "valueType": "IDENTIFIER", + "value": "item", + "optional": false, + "editable": true + }, + "connection": { + "metadata": { + "label": "Client", + "description": "This is a generated connector from [Novel COVID-19 API version 3.0.0](https://disease.sh/docs/) OpenAPI Specification.\nBallerina connector for COVID-19 provides easy access to latest COVID-19 related data across the world. Please refer to [API documentation](https://disease.sh) for more detail.\n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "covid19:Client", + "value": "Client", + "optional": false, + "editable": true + } + }, + "flags": 0 + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/assign.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/assign.json index 7f7c69a84..7eaed7821 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/assign.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/assign.json @@ -16,7 +16,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -26,7 +26,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/binary_data.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/binary_data.json index 5cfa7104a..bfdbe7220 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/binary_data.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/binary_data.json @@ -6,8 +6,8 @@ "output": { "id": "31", "metadata": { - "label": "Binary Data", - "description": "Binary Data" + "label": "Assign Binary", + "description": "Assign Binary" }, "codedata": { "node": "BINARY_DATA" @@ -16,7 +16,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -26,7 +26,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-main.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-main.json index 0e091c3d3..67ac3ae1a 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-main.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-main.json @@ -21,7 +21,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-service.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-service.json index 8523e864c..f850322a1 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-service.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/data_mapper-service.json @@ -21,7 +21,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/foreach.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/foreach.json index b8abe53ef..2bf6c87d2 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/foreach.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/foreach.json @@ -68,7 +68,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -78,7 +78,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function_call-json-toJson.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function_call-json-toJson.json index 670bdee5b..6dd676ff7 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function_call-json-toJson.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function_call-json-toJson.json @@ -35,7 +35,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -44,7 +44,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function_call-user.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function_call-user.json index 2357f5a6a..3b27e7830 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function_call-user.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/function_call-user.json @@ -31,23 +31,23 @@ "optional": false, "editable": true }, - "variable": { + "type": { "metadata": { - "label": "Data variable", - "description": "Name of the variable" + "label": "Type", + "description": "Type of the variable" }, - "valueType": "IDENTIFIER", - "value": "item", + "valueType": "TYPE", + "value": "var", "optional": false, "editable": true }, - "type": { + "variable": { "metadata": { - "label": "Data type", - "description": "Type of the variable" + "label": "Variable", + "description": "Name of the variable" }, - "valueType": "TYPE", - "value": "var", + "valueType": "IDENTIFIER", + "value": "item", "optional": false, "editable": true } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/json_payload.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/json_payload.json index eefd87125..5bce9f8f7 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/json_payload.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/json_payload.json @@ -6,7 +6,7 @@ "output": { "id": "31", "metadata": { - "label": "JSON Payload" + "label": "Assign JSON" }, "codedata": { "node": "JSON_PAYLOAD" @@ -15,7 +15,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -25,7 +25,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/new_connection-covid.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/new_connection-covid.json new file mode 100644 index 000000000..57252589a --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/new_connection-covid.json @@ -0,0 +1,87 @@ +{ + "description": "", + "codedata": { + "node": "NEW_CONNECTION", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "init", + "id": "6267" + }, + "output": { + "id": "31", + "metadata": { + "label": "New Connection", + "description": "This is a generated connector from [Novel COVID-19 API version 3.0.0](https://disease.sh/docs/) OpenAPI Specification.\nBallerina connector for COVID-19 provides easy access to latest COVID-19 related data across the world. Please refer to [API documentation](https://disease.sh) for more detail.\n", + "keywords": [ + "Lifestyle & Entertainment/News & Lifestyle", + "Cost/Free" + ], + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "NEW_CONNECTION", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "init", + "id": "6267" + }, + "returning": false, + "properties": { + "config": { + "metadata": { + "label": "config", + "description": "The configurations to be used when initializing the `connector` \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "record", + "value": "{}", + "optional": false, + "editable": true + }, + "serviceUrl": { + "metadata": { + "label": "serviceUrl", + "description": "URL of the target service \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": false, + "editable": true + }, + "type": { + "metadata": { + "label": "Type", + "description": "Type of the variable" + }, + "valueType": "TYPE", + "value": "covid19:Client", + "optional": false, + "editable": true + }, + "variable": { + "metadata": { + "label": "Variable", + "description": "Name of the variable" + }, + "valueType": "IDENTIFIER", + "value": "item", + "optional": false, + "editable": true + }, + "scope": { + "metadata": { + "label": "Connection Scope", + "description": "Scope of the connection, Global or Local" + }, + "valueType": "ENUM", + "value": "Global", + "optional": false, + "editable": true + } + }, + "flags": 0 + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/retry.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/retry.json new file mode 100644 index 000000000..7b9ab25b9 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/retry.json @@ -0,0 +1,82 @@ +{ + "description": "Test node template for the retry node", + "codedata": { + "node": "RETRY" + }, + "output": { + "id": "31", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY" + }, + "repeatable": "ONE", + "children": [] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "true", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/transaction.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/transaction.json index 453422d5a..53d315ddc 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/transaction.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/transaction.json @@ -65,6 +65,18 @@ "children": [] } ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": true, + "editable": true + } + }, "flags": 0 } } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/xml_payload.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/xml_payload.json index 988ced075..8d1739be5 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/xml_payload.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/config/xml_payload.json @@ -6,7 +6,7 @@ "output": { "id": "31", "metadata": { - "label": "XML Payload" + "label": "Assign XML" }, "codedata": { "node": "XML_PAYLOAD" @@ -15,7 +15,7 @@ "properties": { "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -25,7 +25,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/rollback.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/rollback.json new file mode 100644 index 000000000..ed1dd1c0a --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/node_template/rollback.json @@ -0,0 +1,30 @@ +{ + "description": "Sample diagram node", + "codedata": { + "kind": "ROLLBACK" + }, + "output": { + "id": "31", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "", + "optional": false, + "editable": true + } + }, + "flags": 0 + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/error_handler2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/error_handler2.json index b0ee33780..c8a091fdb 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/error_handler2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/error_handler2.json @@ -16,7 +16,214 @@ "description": "", "diagram": { "fileName": "service.bal", - "nodes": [], + "nodes": [ + { + "id": "36089", + "metadata": { + "label": "HTTP API" + }, + "codedata": { + "node": "EVENT_HTTP_API", + "lineRange": { + "fileName": "service.bal", + "startLine": { + "line": 4, + "offset": 4 + }, + "endLine": { + "line": 12, + "offset": 5 + } + }, + "sourceCode": "resource function get greeting(string? name) returns string|error {\n do {\n if name is string {\n\n }\n } on fail error e {\n return message in e; \n }\n }" + }, + "returning": false, + "properties": { + "method": { + "metadata": { + "label": "Method", + "description": "HTTP Method" + }, + "valueType": "IDENTIFIER", + "value": "get", + "optional": false, + "editable": true + }, + "path": { + "metadata": { + "label": "Path", + "description": "HTTP Path" + }, + "valueType": "STRING", + "value": "greeting", + "optional": false, + "editable": true + } + }, + "flags": 2048 + }, + { + "id": "37147", + "metadata": { + "label": "ErrorHandler", + "description": "Catch and handle errors" + }, + "codedata": { + "node": "ERROR_HANDLER", + "lineRange": { + "fileName": "service.bal", + "startLine": { + "line": 5, + "offset": 8 + }, + "endLine": { + "line": 11, + "offset": 9 + } + }, + "sourceCode": "do {\n if name is string {\n\n }\n } on fail error e {\n return message in e; \n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "service.bal", + "startLine": { + "line": 5, + "offset": 11 + }, + "endLine": { + "line": 9, + "offset": 9 + } + }, + "sourceCode": "{\n if name is string {\n\n }\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "38143", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "service.bal", + "startLine": { + "line": 6, + "offset": 12 + }, + "endLine": { + "line": 8, + "offset": 13 + } + }, + "sourceCode": "if name is string {\n\n }" + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "service.bal", + "startLine": { + "line": 6, + "offset": 30 + }, + "endLine": { + "line": 8, + "offset": 13 + } + }, + "sourceCode": "{\n\n }" + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "name is string ", + "optional": false, + "editable": true + } + }, + "children": [] + } + ], + "flags": 0 + } + ], + "suggested": false + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "service.bal", + "startLine": { + "line": 9, + "offset": 26 + }, + "endLine": { + "line": 11, + "offset": 9 + } + }, + "sourceCode": "{\n return message in e; \n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "e ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [] + } + ], + "flags": 0 + } + ], "connections": [] } } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if1.json index 3117e3008..e6b91c5b0 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if1.json @@ -88,7 +88,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -98,7 +98,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -215,7 +215,8 @@ ] } ], - "flags": 0 + "flags": 0, + "suggested": true }, { "id": "36858", @@ -252,7 +253,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -262,7 +263,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if2.json index cd9f00e36..8712421ec 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if2.json @@ -88,7 +88,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -98,7 +98,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -145,7 +145,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -155,7 +155,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -272,7 +272,8 @@ ] } ], - "flags": 0 + "flags": 0, + "suggested": true } ], "connections": [] diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if3.json index 4fd65a980..2e61514d7 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if3.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if3.json @@ -143,7 +143,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -153,7 +153,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -200,7 +200,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -210,7 +210,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -225,7 +225,8 @@ ] } ], - "flags": 0 + "flags": 0, + "suggested": true }, { "id": "35883", @@ -262,7 +263,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -272,7 +273,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -319,7 +320,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -329,7 +330,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if4.json index 1dddbed1a..f1176b454 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if4.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if4.json @@ -88,7 +88,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -98,7 +98,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -145,7 +145,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -155,7 +155,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -232,6 +232,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -292,6 +293,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -385,6 +387,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -445,6 +448,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -476,7 +480,8 @@ ] } ], - "flags": 0 + "flags": 0, + "suggested": true } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if5.json index 0ef5d174e..21cea6e12 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if5.json @@ -88,7 +88,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -98,7 +98,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -145,7 +145,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -155,7 +155,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -287,6 +287,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -347,6 +348,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -378,7 +380,8 @@ ] } ], - "flags": 0 + "flags": 0, + "suggested": true }, { "id": "47069", @@ -390,6 +393,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -450,6 +454,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if6.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if6.json index dd49b09e8..dabde912a 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if6.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if6.json @@ -88,7 +88,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -98,7 +98,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -145,7 +145,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -155,7 +155,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -202,7 +202,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -212,7 +212,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -289,6 +289,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -341,7 +342,8 @@ "children": [] } ], - "flags": 0 + "flags": 0, + "suggested": true }, { "id": "46877", @@ -408,6 +410,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -467,6 +470,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if7.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if7.json index 3838f295d..ad0376721 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if7.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/suggested_flow_model/config/if7.json @@ -88,7 +88,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -98,7 +98,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -145,7 +145,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -155,7 +155,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -202,7 +202,7 @@ }, "variable": { "metadata": { - "label": "Data variable", + "label": "Variable", "description": "Name of the variable" }, "valueType": "IDENTIFIER", @@ -212,7 +212,7 @@ }, "type": { "metadata": { - "label": "Data type", + "label": "Type", "description": "Type of the variable" }, "valueType": "TYPE", @@ -289,6 +289,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -379,7 +380,8 @@ ] } ], - "flags": 0 + "flags": 0, + "suggested": true }, { "id": "48861", @@ -446,6 +448,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { @@ -505,6 +508,7 @@ "org": "$anon", "module": ".", "symbol": "print", + "version": "0.0.0", "lineRange": { "fileName": "if.bal", "startLine": { diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/action_call-covid-getStatusByCountry.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/action_call-covid-getStatusByCountry.json new file mode 100644 index 000000000..a1c73be6d --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/action_call-covid-getStatusByCountry.json @@ -0,0 +1,151 @@ +{ + "source": "empty.bal", + "description": "Sample diagram node", + "diagram": { + "id": "31", + "metadata": { + "label": "getStatusByCountry", + "description": "Get COVID-19 totals for a specific country\n\n", + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "ACTION_CALL", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "getStatusByCountry", + "id": "6267", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "properties": { + "country": { + "metadata": { + "label": "country", + "description": "A country name, iso2, iso3, or country ID code \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": false, + "editable": true + }, + "yesterday": { + "metadata": { + "label": "yesterday", + "description": "Enter `true`(1) to receive data reported a day ago. Default is `false`(0) \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": true, + "editable": true + }, + "twoDaysAgo": { + "metadata": { + "label": "twoDaysAgo", + "description": "Enter `true`(1) to receive data reported two days ago. Default is `false`(0) \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": true, + "editable": true + }, + "strict": { + "metadata": { + "label": "strict", + "description": "Setting to false gives you the ability to fuzzy search countries (i.e. Oman vs. rOMANia) \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": false, + "editable": true + }, + "allowNull": { + "metadata": { + "label": "allowNull", + "description": "By default, value is 0. Enter `1` to allow nulls to be returned \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": true, + "editable": true + }, + "type": { + "metadata": { + "label": "Data type", + "description": "Type of the variable" + }, + "valueType": "TYPE", + "value": "union", + "optional": false, + "editable": true + }, + "variable": { + "metadata": { + "label": "Data variable", + "description": "Name of the variable" + }, + "valueType": "IDENTIFIER", + "value": "item", + "optional": false, + "editable": true + }, + "connection": { + "metadata": { + "label": "Client", + "description": "This is a generated connector from [Novel COVID-19 API version 3.0.0](https://disease.sh/docs/) OpenAPI Specification.\nBallerina connector for COVID-19 provides easy access to latest COVID-19 related data across the world. Please refer to [API documentation](https://disease.sh) for more detail.\n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "covid19:Client", + "value": "Client", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "import ballerinax/covid19;" + }, + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "union item = Client->getStatusByCountry(\"\", strict = \"\");" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/commit0.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/commit0.json new file mode 100644 index 000000000..c6e662c8a --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/commit0.json @@ -0,0 +1,44 @@ +{ + "source": "empty.bal", + "description": "Test to source of commit statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "commit;" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/error_handler5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/error_handler5.json index b5a2ad6f8..b300deac0 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/error_handler5.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/error_handler5.json @@ -188,7 +188,7 @@ "character": 5 } }, - "newText": "do {\n fail error AssertionError(ASSERTION_ERROR_REASON, message = \"Assertion error\");\n} on fail .:error e {\n return e;\n}" + "newText": "do {\n fail error AssertionError(ASSERTION_ERROR_REASON, message = \"Assertion error\");\n} on fail :error e {\n return e;\n}" } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/error_handler6.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/error_handler6.json index fc49e4390..1a91759c2 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/error_handler6.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/error_handler6.json @@ -244,7 +244,7 @@ "character": 5 } }, - "newText": "do {\n AssertionError e = error AssertionError(ASSERTION_ERROR_REASON, message = \"Assertion error\");\n fail e;\n} on fail .:error e {\n return e;\n}" + "newText": "do {\n AssertionError e = error AssertionError(ASSERTION_ERROR_REASON, message = \"Assertion error\");\n fail e;\n} on fail :error e {\n return e;\n}" } ] } diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/new_connection-covid.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/new_connection-covid.json new file mode 100644 index 000000000..347e56df0 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/new_connection-covid.json @@ -0,0 +1,121 @@ +{ + "source": "new_connection-http/main.bal", + "description": "Sample diagram node", + "diagram": { + "id": "31", + "metadata": { + "label": "New Connection", + "description": "This is a generated connector from [Novel COVID-19 API version 3.0.0](https://disease.sh/docs/) OpenAPI Specification.\nBallerina connector for COVID-19 provides easy access to latest COVID-19 related data across the world. Please refer to [API documentation](https://disease.sh) for more detail.\n", + "keywords": [ + "Lifestyle & Entertainment/News & Lifestyle", + "Cost/Free" + ], + "icon": "https://bcentral-packageicons.azureedge.net/images/ballerinax_covid19_1.5.1.png" + }, + "codedata": { + "node": "NEW_CONNECTION", + "org": "ballerinax", + "module": "covid19", + "object": "Client", + "symbol": "init", + "id": "6267", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "properties": { + "config": { + "metadata": { + "label": "config", + "description": "The configurations to be used when initializing the `connector` \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "record", + "value": "{}", + "optional": false, + "editable": true + }, + "serviceUrl": { + "metadata": { + "label": "serviceUrl", + "description": "URL of the target service \n" + }, + "valueType": "EXPRESSION", + "valueTypeConstraint": "string", + "value": "\"\"", + "optional": false, + "editable": true + }, + "type": { + "metadata": { + "label": "Data type", + "description": "Type of the variable" + }, + "valueType": "TYPE", + "value": "covid19:Client", + "optional": false, + "editable": true + }, + "variable": { + "metadata": { + "label": "Data variable", + "description": "Name of the variable" + }, + "valueType": "IDENTIFIER", + "value": "item", + "optional": false, + "editable": true + }, + "scope": { + "metadata": { + "label": "Connection Scope", + "description": "Scope of the connection, Global or Local" + }, + "valueType": "ENUM", + "value": "Global", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "new_connection-http/connections.bal": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "import ballerinax/covid19;" + }, + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "covid19:Client item = check new ({}, \"\");" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry1.json new file mode 100644 index 000000000..ec5a1bfac --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry1.json @@ -0,0 +1,108 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "empty.bal", + "startLine": { + "line": 1, + "offset": 4 + }, + "endLine": { + "line": 3, + "offset": 5 + } + }, + "sourceCode": "retry {\n check nameOrError();\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "empty.bal", + "startLine": { + "line": 1, + "offset": 10 + }, + "endLine": { + "line": 3, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "34004", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "lineRange": { + "fileName": "empty.bal", + "startLine": { + "line": 2, + "offset": 8 + }, + "endLine": { + "line": 2, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 3, + "character": 5 + } + }, + "newText": "retry(3) {\n check nameOrError();\n}" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry2.json new file mode 100644 index 000000000..749b285ec --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry2.json @@ -0,0 +1,198 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 5, + "offset": 4 + }, + "endLine": { + "line": 9, + "offset": 5 + } + }, + "sourceCode": "retry {\n check nameOrError();\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 5, + "offset": 10 + }, + "endLine": { + "line": 7, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "37972", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 6, + "offset": 8 + }, + "endLine": { + "line": 6, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 7, + "offset": 22 + }, + "endLine": { + "line": 9, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "39946", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 8, + "offset": 8 + }, + "endLine": { + "line": 8, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 5, + "character": 4 + }, + "end": { + "line": 9, + "character": 5 + } + }, + "newText": "retry(3) {\n check nameOrError();\n} on fail error err {\n check err;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry3.json new file mode 100644 index 000000000..e13149df7 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry3.json @@ -0,0 +1,198 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 11, + "offset": 4 + }, + "endLine": { + "line": 15, + "offset": 5 + } + }, + "sourceCode": "retry (4) {\n check nameOrError();\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 11, + "offset": 14 + }, + "endLine": { + "line": 13, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "43924", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 12, + "offset": 8 + }, + "endLine": { + "line": 12, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 13, + "offset": 22 + }, + "endLine": { + "line": 15, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "45898", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 14, + "offset": 8 + }, + "endLine": { + "line": 14, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 11, + "character": 4 + }, + "end": { + "line": 15, + "character": 5 + } + }, + "newText": "retry(4) {\n check nameOrError();\n} on fail error err {\n check err;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry4.json new file mode 100644 index 000000000..ef5c624b2 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry4.json @@ -0,0 +1,207 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 17, + "offset": 4 + }, + "endLine": { + "line": 21, + "offset": 5 + } + }, + "sourceCode": "retry (4) {\n fail error(\"failed retry\");\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 17, + "offset": 14 + }, + "endLine": { + "line": 19, + "offset": 5 + } + }, + "sourceCode": "{\n fail error(\"failed retry\");\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "49883", + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 18, + "offset": 8 + }, + "endLine": { + "line": 18, + "offset": 35 + } + }, + "sourceCode": "fail error(\"failed retry\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Fail value" + }, + "valueType": "EXPRESSION", + "value": "error(\"failed retry\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 19, + "offset": 22 + }, + "endLine": { + "line": 21, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "51850", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 20, + "offset": 8 + }, + "endLine": { + "line": 20, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 17, + "character": 4 + }, + "end": { + "line": 21, + "character": 5 + } + }, + "newText": "retry(4) {\n fail error(\"failed retry\");\n} on fail error err {\n check err;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry5.json new file mode 100644 index 000000000..92b2ce6a7 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry5.json @@ -0,0 +1,207 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Retry Block", + "description": "Retry block." + }, + "codedata": { + "node": "RETRY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 23, + "offset": 4 + }, + "endLine": { + "line": 27, + "offset": 5 + } + }, + "sourceCode": "retry (4) {\n fail error(\"failed retry\");\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 23, + "offset": 41 + }, + "endLine": { + "line": 25, + "offset": 5 + } + }, + "sourceCode": "{\n fail error(\"failed retry\");\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "55835", + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 24, + "offset": 8 + }, + "endLine": { + "line": 24, + "offset": 35 + } + }, + "sourceCode": "fail error(\"failed retry\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Fail value" + }, + "valueType": "EXPRESSION", + "value": "error(\"failed retry\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 25, + "offset": 22 + }, + "endLine": { + "line": 27, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "57802", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry.bal", + "startLine": { + "line": 26, + "offset": 8 + }, + "endLine": { + "line": 26, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 23, + "character": 4 + }, + "end": { + "line": 27, + "character": 5 + } + }, + "newText": "retry(4) {\n fail error(\"failed retry\");\n} on fail error err {\n check err;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction1.json new file mode 100644 index 000000000..5025e7044 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction1.json @@ -0,0 +1,144 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry transaction statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 1, + "offset": 4 + }, + "endLine": { + "line": 4, + "offset": 5 + } + }, + "sourceCode": "retry transaction {\n check nameOrError();\n check commit;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 1, + "offset": 22 + }, + "endLine": { + "line": 4, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n check commit;\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "34004", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 2, + "offset": 8 + }, + "endLine": { + "line": 2, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + }, + { + "id": "34989", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 3, + "offset": 8 + }, + "endLine": { + "line": 3, + "offset": 21 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check commit;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 1, + "character": 4 + }, + "end": { + "line": 4, + "character": 5 + } + }, + "newText": "retry(3) transaction {\n check nameOrError();\n check commit;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction2.json new file mode 100644 index 000000000..2725517d5 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction2.json @@ -0,0 +1,234 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry transaction statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 6, + "offset": 4 + }, + "endLine": { + "line": 11, + "offset": 5 + } + }, + "sourceCode": "retry transaction {\n check nameOrError();\n check commit;\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 6, + "offset": 22 + }, + "endLine": { + "line": 9, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n check commit;\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "38964", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 7, + "offset": 8 + }, + "endLine": { + "line": 7, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + }, + { + "id": "39949", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 8, + "offset": 8 + }, + "endLine": { + "line": 8, + "offset": 21 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check commit;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 9, + "offset": 22 + }, + "endLine": { + "line": 11, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "41930", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 10, + "offset": 8 + }, + "endLine": { + "line": 10, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "3", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 6, + "character": 4 + }, + "end": { + "line": 11, + "character": 5 + } + }, + "newText": "retry(3) transaction {\n check nameOrError();\n check commit;\n; } on fail error err {\n check err;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction3.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction3.json new file mode 100644 index 000000000..d395416e7 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction3.json @@ -0,0 +1,234 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry transaction statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 13, + "offset": 4 + }, + "endLine": { + "line": 18, + "offset": 5 + } + }, + "sourceCode": "retry (4) transaction {\n check nameOrError();\n check commit;\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 13, + "offset": 26 + }, + "endLine": { + "line": 16, + "offset": 5 + } + }, + "sourceCode": "{\n check nameOrError();\n check commit;\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "45908", + "metadata": { + "label": "nameOrError" + }, + "codedata": { + "node": "FUNCTION_CALL", + "org": "$anon", + "module": ".", + "symbol": "nameOrError", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 14, + "offset": 8 + }, + "endLine": { + "line": 14, + "offset": 28 + } + }, + "sourceCode": "check nameOrError();" + }, + "returning": false, + "properties": {}, + "flags": 1 + }, + { + "id": "46893", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 15, + "offset": 8 + }, + "endLine": { + "line": 15, + "offset": 21 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check commit;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 16, + "offset": 22 + }, + "endLine": { + "line": 18, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "48874", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 17, + "offset": 8 + }, + "endLine": { + "line": 17, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 13, + "character": 4 + }, + "end": { + "line": 18, + "character": 5 + } + }, + "newText": "retry(4) transaction {\n check nameOrError();\n check commit;\n; } on fail error err {\n check err;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction4.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction4.json new file mode 100644 index 000000000..70c515dbe --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction4.json @@ -0,0 +1,303 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry transaction statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 20, + "offset": 4 + }, + "endLine": { + "line": 27, + "offset": 5 + } + }, + "sourceCode": "retry (4) transaction {\n if true {\n check commit;\n }\n fail error(\"failed retry\");\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 20, + "offset": 26 + }, + "endLine": { + "line": 25, + "offset": 5 + } + }, + "sourceCode": "{\n if true {\n check commit;\n }\n fail error(\"failed retry\");\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "52895", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 21, + "offset": 8 + }, + "endLine": { + "line": 23, + "offset": 9 + } + }, + "sourceCode": "if true {\n check commit;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 21, + "offset": 16 + }, + "endLine": { + "line": 23, + "offset": 9 + } + }, + "sourceCode": "{\n check commit;\n }" + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "true ", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "53965", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 22, + "offset": 12 + }, + "endLine": { + "line": 22, + "offset": 25 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check commit;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "flags": 0 + }, + { + "id": "55835", + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 24, + "offset": 8 + }, + "endLine": { + "line": 24, + "offset": 35 + } + }, + "sourceCode": "fail error(\"failed retry\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Fail value" + }, + "valueType": "EXPRESSION", + "value": "error(\"failed retry\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 25, + "offset": 22 + }, + "endLine": { + "line": 27, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "57802", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 26, + "offset": 8 + }, + "endLine": { + "line": 26, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 20, + "character": 4 + }, + "end": { + "line": 27, + "character": 5 + } + }, + "newText": "retry(4) transaction {\n if true {\n check commit;\n; }\n fail error(\"failed retry\");\n} on fail error err {\n check err;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction5.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction5.json new file mode 100644 index 000000000..c846c2a71 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/retry_transaction5.json @@ -0,0 +1,303 @@ +{ + "source": "empty.bal", + "description": "Test code generation for retry transaction statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 29, + "offset": 4 + }, + "endLine": { + "line": 36, + "offset": 5 + } + }, + "sourceCode": "retry (4) transaction {\n if true {\n check commit;\n }\n fail error(\"failed retry\");\n } on fail var err {\n check err;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 29, + "offset": 53 + }, + "endLine": { + "line": 34, + "offset": 5 + } + }, + "sourceCode": "{\n if true {\n check commit;\n }\n fail error(\"failed retry\");\n }" + }, + "repeatable": "ONE", + "children": [ + { + "id": "61823", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 30, + "offset": 8 + }, + "endLine": { + "line": 32, + "offset": 9 + } + }, + "sourceCode": "if true {\n check commit;\n }" + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 30, + "offset": 16 + }, + "endLine": { + "line": 32, + "offset": 9 + } + }, + "sourceCode": "{\n check commit;\n }" + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "true ", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "62893", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 31, + "offset": 12 + }, + "endLine": { + "line": 31, + "offset": 25 + } + }, + "sourceCode": "check commit;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check commit;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "flags": 0 + }, + { + "id": "64763", + "metadata": { + "label": "Fail", + "description": "Fail the execution" + }, + "codedata": { + "node": "FAIL", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 33, + "offset": 8 + }, + "endLine": { + "line": 33, + "offset": 35 + } + }, + "sourceCode": "fail error(\"failed retry\");" + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Fail value" + }, + "valueType": "EXPRESSION", + "value": "error(\"failed retry\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + }, + { + "label": "On Failure", + "kind": "BLOCK", + "codedata": { + "node": "ON_FAILURE", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 34, + "offset": 22 + }, + "endLine": { + "line": 36, + "offset": 5 + } + }, + "sourceCode": "{\n check err;\n }" + }, + "repeatable": "ZERO_OR_ONE", + "properties": { + "ignore": { + "metadata": { + "label": "Ignore", + "description": "Ignore the error value" + }, + "valueType": "EXPRESSION", + "value": "false", + "optional": false, + "editable": true + }, + "errorVariable": { + "metadata": { + "label": "Error Variable", + "description": "Name of the error variable" + }, + "valueType": "IDENTIFIER", + "value": "err ", + "optional": false, + "editable": true + }, + "errorType": { + "metadata": { + "label": "Error Type", + "description": "Type of the error" + }, + "valueType": "TYPE", + "value": "error", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "66730", + "metadata": { + "label": "Custom Expression", + "description": "Represents a custom Ballerina expression" + }, + "codedata": { + "node": "EXPRESSION", + "lineRange": { + "fileName": "retry_transaction.bal", + "startLine": { + "line": 35, + "offset": 8 + }, + "endLine": { + "line": 35, + "offset": 18 + } + }, + "sourceCode": "check err;" + }, + "returning": false, + "properties": { + "statement": { + "metadata": { + "label": "Statement", + "description": "Ballerina statement" + }, + "valueType": "EXPRESSION", + "value": "check err;", + "optional": false, + "editable": true + } + }, + "flags": 1 + } + ] + } + ], + "properties": { + "retryCount": { + "metadata": { + "label": "Retry Count", + "description": "Number of retries" + }, + "valueType": "EXPRESSION", + "value": "4", + "optional": false, + "editable": true + } + }, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 29, + "character": 4 + }, + "end": { + "line": 36, + "character": 5 + } + }, + "newText": "retry(4) transaction {\n if true {\n check commit;\n; }\n fail error(\"failed retry\");\n} on fail error err {\n check err;\n; }" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/rollback0.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/rollback0.json new file mode 100644 index 000000000..337f7f92c --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/rollback0.json @@ -0,0 +1,44 @@ +{ + "source": "empty.bal", + "description": "Test to source of rollback statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Rollback", + "description": "Rollback the transaction" + }, + "codedata": { + "node": "ROLLBACK", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "rollback;" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction10.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction10.json new file mode 100644 index 000000000..dcdcde59b --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction10.json @@ -0,0 +1,201 @@ +{ + "source": "empty.bal", + "description": "Test complex transaction block", + "diagram": { + "id": "31", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + }, + "repeatable": "ONE", + "children": [ + { + "id": "31", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "i is () ", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "31", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "flags": 1 + } + ] + }, + { + "label": "Else", + "kind": "BLOCK", + "codedata": { + "node": "ELSE", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "repeatable": "ZERO_OR_ONE", + "children": [ + { + "id": "31", + "metadata": { + "label": "Rollback", + "description": "Rollback the transaction" + }, + "codedata": { + "node": "ROLLBACK", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "properties": { + "expression": { + "metadata": { + "label": "Expression", + "description": "Rollback transaction" + }, + "valueType": "EXPRESSION", + "value": "error(\"Rollback the transaction\")", + "optional": false, + "editable": true + } + }, + "flags": 0 + } + ] + } + ], + "flags": 0 + } + ] + } + ], + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "transaction {\n if i is () {\n check commit;\n } else {\n rollback error(\"Rollback the transaction\");\n }\n}" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction8.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction8.json new file mode 100644 index 000000000..4738252c7 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction8.json @@ -0,0 +1,90 @@ +{ + "source": "empty.bal", + "description": "Test to source of transaction with commit statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "repeatable": "ONE", + "children": [ + { + "id": "33997", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "flags": 1 + } + ] + } + ], + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "transaction {\n check commit;\n}" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction9.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction9.json new file mode 100644 index 000000000..06dd2bab2 --- /dev/null +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/to_source/config/transaction9.json @@ -0,0 +1,192 @@ +{ + "source": "empty.bal", + "description": "Test to source of transaction with commit and rollback statement", + "diagram": { + "id": "31", + "metadata": { + "label": "Transaction", + "description": "Handle transaction." + }, + "codedata": { + "node": "TRANSACTION", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "branches": [ + { + "label": "Body", + "kind": "BLOCK", + "codedata": { + "node": "BODY", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "repeatable": "ONE", + "children": [ + { + "id": "31", + "metadata": { + "label": "If", + "description": "Add conditional branch to the integration flow." + }, + "codedata": { + "node": "IF", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "branches": [ + { + "label": "Then", + "kind": "BLOCK", + "codedata": { + "node": "CONDITIONAL", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "repeatable": "ONE_OR_MORE", + "properties": { + "condition": { + "metadata": { + "label": "Condition", + "description": "Boolean Condition" + }, + "valueType": "EXPRESSION", + "value": "i is () ", + "optional": false, + "editable": true + } + }, + "children": [ + { + "id": "31", + "metadata": { + "label": "Commit", + "description": "Commit transaction" + }, + "codedata": { + "node": "COMMIT", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "flags": 1 + } + ] + }, + { + "label": "Else", + "kind": "BLOCK", + "codedata": { + "node": "ELSE", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "repeatable": "ZERO_OR_ONE", + "children": [ + { + "id": "31", + "metadata": { + "label": "Rollback", + "description": "Rollback the transaction" + }, + "codedata": { + "node": "ROLLBACK", + "lineRange": { + "fileName": "test.bal", + "startLine": { + "line": 0, + "offset": 0 + }, + "endLine": { + "line": 0, + "offset": 0 + } + } + }, + "returning": false, + "flags": 0 + } + ] + } + ], + "flags": 0 + } + ] + } + ], + "flags": 0 + }, + "output": { + "empty.bal": [ + { + "range": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 0, + "character": 0 + } + }, + "newText": "transaction {\n if i is () {\n check commit;\n } else {\n rollback;\n }\n}" + } + ] + } +} diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/config1.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/config1.json index 7edb1c508..591c1ea85 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/config1.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/config1.json @@ -23,7 +23,7 @@ "name": "ClientObject", "orgName": "ballerina", "moduleName": "http", - "version": "2.11.0" + "version": "2.12.1" }, "defaultable": false, "isRestType": false @@ -41,7 +41,7 @@ "name": "Client", "orgName": "ballerina", "moduleName": "http", - "version": "2.11.0" + "version": "2.12.1" }, "defaultable": false, "isRestType": false diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/config2.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/config2.json index c746239d1..c7d1edd22 100644 --- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/config2.json +++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/config2.json @@ -23,7 +23,7 @@ "name": "ClientObject", "orgName": "ballerina", "moduleName": "http", - "version": "2.11.0" + "version": "2.12.1" }, "defaultable": false, "isRestType": false @@ -41,7 +41,7 @@ "name": "Client", "orgName": "ballerina", "moduleName": "http", - "version": "2.11.0" + "version": "2.12.1" }, "defaultable": false, "isRestType": false diff --git a/gradle.properties b/gradle.properties index 87f18f198..ac89be73f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ observeInternalVersion=1.2.2 # Standard Library Dependencies # Stdlib Level 01 -stdlibIoVersion=1.6.0 +stdlibIoVersion=1.6.1 stdlibTimeVersion=2.4.0 stdlibUrlVersion=2.4.0 @@ -41,7 +41,7 @@ stdlibOAuth2Version=2.11.0 stdlibJsonDataVersion=0.2.0 # Stdlib Level 05 -stdlibHttpVersion=2.11.0 +stdlibHttpVersion=2.12.1 # Stdlib Level 06 stdlibGrpcVersion=1.11.0