@synergenius/flow-weaver 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +122 -0
- package/README.md +315 -0
- package/dist/annotation-generator.d.ts +45 -0
- package/dist/annotation-generator.js +557 -0
- package/dist/api/builder.d.ts +223 -0
- package/dist/api/builder.js +345 -0
- package/dist/api/compile.d.ts +92 -0
- package/dist/api/compile.js +149 -0
- package/dist/api/extract-types.d.ts +29 -0
- package/dist/api/extract-types.js +57 -0
- package/dist/api/generate-in-place.d.ts +73 -0
- package/dist/api/generate-in-place.js +1353 -0
- package/dist/api/generate.d.ts +83 -0
- package/dist/api/generate.js +510 -0
- package/dist/api/helpers.d.ts +248 -0
- package/dist/api/helpers.js +285 -0
- package/dist/api/index.d.ts +46 -0
- package/dist/api/index.js +45 -0
- package/dist/api/inline-runtime.d.ts +27 -0
- package/dist/api/inline-runtime.js +551 -0
- package/dist/api/manipulation/connections.d.ts +79 -0
- package/dist/api/manipulation/connections.js +151 -0
- package/dist/api/manipulation/index.d.ts +34 -0
- package/dist/api/manipulation/index.js +41 -0
- package/dist/api/manipulation/node-types.d.ts +123 -0
- package/dist/api/manipulation/node-types.js +200 -0
- package/dist/api/manipulation/nodes.d.ts +144 -0
- package/dist/api/manipulation/nodes.js +333 -0
- package/dist/api/manipulation/ports.d.ts +59 -0
- package/dist/api/manipulation/ports.js +228 -0
- package/dist/api/manipulation/scopes.d.ts +52 -0
- package/dist/api/manipulation/scopes.js +156 -0
- package/dist/api/manipulation/validation.d.ts +6 -0
- package/dist/api/manipulation/validation.js +6 -0
- package/dist/api/manipulation/workflow.d.ts +81 -0
- package/dist/api/manipulation/workflow.js +116 -0
- package/dist/api/manipulation.d.ts +8 -0
- package/dist/api/manipulation.js +8 -0
- package/dist/api/parse.d.ts +48 -0
- package/dist/api/parse.js +110 -0
- package/dist/api/patterns.d.ts +112 -0
- package/dist/api/patterns.js +306 -0
- package/dist/api/query.d.ts +429 -0
- package/dist/api/query.js +816 -0
- package/dist/api/templates.d.ts +98 -0
- package/dist/api/templates.js +117 -0
- package/dist/api/transform.d.ts +31 -0
- package/dist/api/transform.js +40 -0
- package/dist/api/validate.d.ts +25 -0
- package/dist/api/validate.js +39 -0
- package/dist/api/workflow-file-operations.d.ts +29 -0
- package/dist/api/workflow-file-operations.js +180 -0
- package/dist/ast/builder.d.ts +210 -0
- package/dist/ast/builder.js +395 -0
- package/dist/ast/index.d.ts +5 -0
- package/dist/ast/index.js +5 -0
- package/dist/ast/serialization-node.d.ts +6 -0
- package/dist/ast/serialization-node.js +30 -0
- package/dist/ast/serialization.d.ts +43 -0
- package/dist/ast/serialization.js +134 -0
- package/dist/ast/types.d.ts +852 -0
- package/dist/ast/types.js +2 -0
- package/dist/ast/workflow-utils.d.ts +54 -0
- package/dist/ast/workflow-utils.js +114 -0
- package/dist/body-generator.d.ts +31 -0
- package/dist/body-generator.js +35 -0
- package/dist/built-in-nodes/delay.d.ts +11 -0
- package/dist/built-in-nodes/delay.js +29 -0
- package/dist/built-in-nodes/index.d.ts +5 -0
- package/dist/built-in-nodes/index.js +4 -0
- package/dist/built-in-nodes/invoke-workflow.d.ts +13 -0
- package/dist/built-in-nodes/invoke-workflow.js +25 -0
- package/dist/built-in-nodes/mock-types.d.ts +18 -0
- package/dist/built-in-nodes/mock-types.js +12 -0
- package/dist/built-in-nodes/wait-for-event.d.ts +13 -0
- package/dist/built-in-nodes/wait-for-event.js +25 -0
- package/dist/chevrotain-parser/connect-parser.d.ts +24 -0
- package/dist/chevrotain-parser/connect-parser.js +98 -0
- package/dist/chevrotain-parser/grammar-diagrams.d.ts +29 -0
- package/dist/chevrotain-parser/grammar-diagrams.js +264 -0
- package/dist/chevrotain-parser/index.d.ts +25 -0
- package/dist/chevrotain-parser/index.js +27 -0
- package/dist/chevrotain-parser/map-parser.d.ts +33 -0
- package/dist/chevrotain-parser/map-parser.js +130 -0
- package/dist/chevrotain-parser/node-parser.d.ts +36 -0
- package/dist/chevrotain-parser/node-parser.js +466 -0
- package/dist/chevrotain-parser/path-parser.d.ts +28 -0
- package/dist/chevrotain-parser/path-parser.js +118 -0
- package/dist/chevrotain-parser/port-parser.d.ts +36 -0
- package/dist/chevrotain-parser/port-parser.js +442 -0
- package/dist/chevrotain-parser/position-parser.d.ts +20 -0
- package/dist/chevrotain-parser/position-parser.js +83 -0
- package/dist/chevrotain-parser/scope-parser.d.ts +19 -0
- package/dist/chevrotain-parser/scope-parser.js +104 -0
- package/dist/chevrotain-parser/tokens.d.ts +78 -0
- package/dist/chevrotain-parser/tokens.js +384 -0
- package/dist/chevrotain-parser/trigger-cancel-parser.d.ts +50 -0
- package/dist/chevrotain-parser/trigger-cancel-parser.js +282 -0
- package/dist/cli/commands/changelog.d.ts +13 -0
- package/dist/cli/commands/changelog.js +135 -0
- package/dist/cli/commands/compile.d.ts +64 -0
- package/dist/cli/commands/compile.js +278 -0
- package/dist/cli/commands/create.d.ts +33 -0
- package/dist/cli/commands/create.js +147 -0
- package/dist/cli/commands/describe.d.ts +68 -0
- package/dist/cli/commands/describe.js +377 -0
- package/dist/cli/commands/dev.d.ts +32 -0
- package/dist/cli/commands/dev.js +384 -0
- package/dist/cli/commands/diagram.d.ts +13 -0
- package/dist/cli/commands/diagram.js +33 -0
- package/dist/cli/commands/diff.d.ts +11 -0
- package/dist/cli/commands/diff.js +59 -0
- package/dist/cli/commands/doctor.d.ts +57 -0
- package/dist/cli/commands/doctor.js +719 -0
- package/dist/cli/commands/export.d.ts +57 -0
- package/dist/cli/commands/export.js +163 -0
- package/dist/cli/commands/grammar.d.ts +9 -0
- package/dist/cli/commands/grammar.js +39 -0
- package/dist/cli/commands/init.d.ts +59 -0
- package/dist/cli/commands/init.js +435 -0
- package/dist/cli/commands/listen.d.ts +16 -0
- package/dist/cli/commands/listen.js +39 -0
- package/dist/cli/commands/market.d.ts +52 -0
- package/dist/cli/commands/market.js +436 -0
- package/dist/cli/commands/migrate.d.ts +13 -0
- package/dist/cli/commands/migrate.js +89 -0
- package/dist/cli/commands/openapi.d.ts +37 -0
- package/dist/cli/commands/openapi.js +67 -0
- package/dist/cli/commands/pattern.d.ts +34 -0
- package/dist/cli/commands/pattern.js +185 -0
- package/dist/cli/commands/plugin.d.ts +16 -0
- package/dist/cli/commands/plugin.js +176 -0
- package/dist/cli/commands/run.d.ts +49 -0
- package/dist/cli/commands/run.js +191 -0
- package/dist/cli/commands/serve.d.ts +45 -0
- package/dist/cli/commands/serve.js +81 -0
- package/dist/cli/commands/templates.d.ts +8 -0
- package/dist/cli/commands/templates.js +54 -0
- package/dist/cli/commands/ui.d.ts +16 -0
- package/dist/cli/commands/ui.js +130 -0
- package/dist/cli/commands/validate.d.ts +12 -0
- package/dist/cli/commands/validate.js +247 -0
- package/dist/cli/commands/watch.d.ts +9 -0
- package/dist/cli/commands/watch.js +70 -0
- package/dist/cli/flow-weaver.mjs +92924 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.js +742 -0
- package/dist/cli/templates/ai/mock-provider.d.ts +7 -0
- package/dist/cli/templates/ai/mock-provider.js +64 -0
- package/dist/cli/templates/ai/types.d.ts +47 -0
- package/dist/cli/templates/ai/types.js +5 -0
- package/dist/cli/templates/approvals/index.d.ts +15 -0
- package/dist/cli/templates/approvals/index.js +241 -0
- package/dist/cli/templates/index.d.ts +102 -0
- package/dist/cli/templates/index.js +101 -0
- package/dist/cli/templates/nodes/agent-router.d.ts +3 -0
- package/dist/cli/templates/nodes/agent-router.js +114 -0
- package/dist/cli/templates/nodes/aggregator.d.ts +7 -0
- package/dist/cli/templates/nodes/aggregator.js +63 -0
- package/dist/cli/templates/nodes/conversation-memory.d.ts +3 -0
- package/dist/cli/templates/nodes/conversation-memory.js +85 -0
- package/dist/cli/templates/nodes/http.d.ts +7 -0
- package/dist/cli/templates/nodes/http.js +80 -0
- package/dist/cli/templates/nodes/human-approval.d.ts +3 -0
- package/dist/cli/templates/nodes/human-approval.js +110 -0
- package/dist/cli/templates/nodes/json-extractor.d.ts +3 -0
- package/dist/cli/templates/nodes/json-extractor.js +119 -0
- package/dist/cli/templates/nodes/llm-call.d.ts +3 -0
- package/dist/cli/templates/nodes/llm-call.js +106 -0
- package/dist/cli/templates/nodes/prompt-template.d.ts +3 -0
- package/dist/cli/templates/nodes/prompt-template.js +52 -0
- package/dist/cli/templates/nodes/rag-retriever.d.ts +3 -0
- package/dist/cli/templates/nodes/rag-retriever.js +128 -0
- package/dist/cli/templates/nodes/tool-executor.d.ts +3 -0
- package/dist/cli/templates/nodes/tool-executor.js +108 -0
- package/dist/cli/templates/nodes/transformer.d.ts +7 -0
- package/dist/cli/templates/nodes/transformer.js +68 -0
- package/dist/cli/templates/nodes/validator.d.ts +7 -0
- package/dist/cli/templates/nodes/validator.js +62 -0
- package/dist/cli/templates/providers/index.d.ts +14 -0
- package/dist/cli/templates/providers/index.js +239 -0
- package/dist/cli/templates/shared/approval-types.d.ts +9 -0
- package/dist/cli/templates/shared/approval-types.js +31 -0
- package/dist/cli/templates/shared/llm-types.d.ts +15 -0
- package/dist/cli/templates/shared/llm-types.js +104 -0
- package/dist/cli/templates/workflows/aggregator.d.ts +7 -0
- package/dist/cli/templates/workflows/aggregator.js +104 -0
- package/dist/cli/templates/workflows/ai-agent-durable.d.ts +8 -0
- package/dist/cli/templates/workflows/ai-agent-durable.js +338 -0
- package/dist/cli/templates/workflows/ai-agent.d.ts +31 -0
- package/dist/cli/templates/workflows/ai-agent.js +326 -0
- package/dist/cli/templates/workflows/ai-chat.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-chat.js +169 -0
- package/dist/cli/templates/workflows/ai-pipeline-durable.d.ts +8 -0
- package/dist/cli/templates/workflows/ai-pipeline-durable.js +330 -0
- package/dist/cli/templates/workflows/ai-rag.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-rag.js +186 -0
- package/dist/cli/templates/workflows/ai-react.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-react.js +294 -0
- package/dist/cli/templates/workflows/conditional.d.ts +12 -0
- package/dist/cli/templates/workflows/conditional.js +142 -0
- package/dist/cli/templates/workflows/error-handler.d.ts +7 -0
- package/dist/cli/templates/workflows/error-handler.js +147 -0
- package/dist/cli/templates/workflows/foreach.d.ts +7 -0
- package/dist/cli/templates/workflows/foreach.js +143 -0
- package/dist/cli/templates/workflows/sequential.d.ts +7 -0
- package/dist/cli/templates/workflows/sequential.js +198 -0
- package/dist/cli/templates/workflows/webhook.d.ts +7 -0
- package/dist/cli/templates/workflows/webhook.js +161 -0
- package/dist/cli/utils/logger.d.ts +15 -0
- package/dist/cli/utils/logger.js +46 -0
- package/dist/constants.d.ts +100 -0
- package/dist/constants.js +125 -0
- package/dist/defaults.d.ts +3 -0
- package/dist/defaults.js +3 -0
- package/dist/deployment/config/defaults.d.ts +29 -0
- package/dist/deployment/config/defaults.js +98 -0
- package/dist/deployment/config/loader.d.ts +24 -0
- package/dist/deployment/config/loader.js +236 -0
- package/dist/deployment/config/types.d.ts +117 -0
- package/dist/deployment/config/types.js +5 -0
- package/dist/deployment/core/adapters.d.ts +90 -0
- package/dist/deployment/core/adapters.js +251 -0
- package/dist/deployment/core/executor.d.ts +62 -0
- package/dist/deployment/core/executor.js +197 -0
- package/dist/deployment/core/formatters.d.ts +57 -0
- package/dist/deployment/core/formatters.js +170 -0
- package/dist/deployment/index.d.ts +31 -0
- package/dist/deployment/index.js +48 -0
- package/dist/deployment/openapi/generator.d.ts +146 -0
- package/dist/deployment/openapi/generator.js +347 -0
- package/dist/deployment/openapi/schema-converter.d.ts +49 -0
- package/dist/deployment/openapi/schema-converter.js +192 -0
- package/dist/deployment/targets/base.d.ts +316 -0
- package/dist/deployment/targets/base.js +823 -0
- package/dist/deployment/targets/cloudflare.d.ts +23 -0
- package/dist/deployment/targets/cloudflare.js +1125 -0
- package/dist/deployment/targets/inngest.d.ts +38 -0
- package/dist/deployment/targets/inngest.js +926 -0
- package/dist/deployment/targets/lambda.d.ts +23 -0
- package/dist/deployment/targets/lambda.js +1289 -0
- package/dist/deployment/targets/vercel.d.ts +23 -0
- package/dist/deployment/targets/vercel.js +886 -0
- package/dist/deployment/types.d.ts +183 -0
- package/dist/deployment/types.js +8 -0
- package/dist/diagram/geometry.d.ts +26 -0
- package/dist/diagram/geometry.js +850 -0
- package/dist/diagram/index.d.ts +16 -0
- package/dist/diagram/index.js +42 -0
- package/dist/diagram/layout.d.ts +11 -0
- package/dist/diagram/layout.js +143 -0
- package/dist/diagram/orthogonal-router.d.ts +79 -0
- package/dist/diagram/orthogonal-router.js +568 -0
- package/dist/diagram/renderer.d.ts +3 -0
- package/dist/diagram/renderer.js +207 -0
- package/dist/diagram/theme.d.ts +20 -0
- package/dist/diagram/theme.js +189 -0
- package/dist/diagram/types.d.ts +70 -0
- package/dist/diagram/types.js +2 -0
- package/dist/diff/WorkflowDiffer.d.ts +13 -0
- package/dist/diff/WorkflowDiffer.js +429 -0
- package/dist/diff/formatDiff.d.ts +10 -0
- package/dist/diff/formatDiff.js +220 -0
- package/dist/diff/impact.d.ts +29 -0
- package/dist/diff/impact.js +119 -0
- package/dist/diff/index.d.ts +10 -0
- package/dist/diff/index.js +9 -0
- package/dist/diff/types.d.ts +138 -0
- package/dist/diff/types.js +35 -0
- package/dist/doc-metadata/extractors/annotations.d.ts +56 -0
- package/dist/doc-metadata/extractors/annotations.js +337 -0
- package/dist/doc-metadata/extractors/cli-commands.d.ts +17 -0
- package/dist/doc-metadata/extractors/cli-commands.js +355 -0
- package/dist/doc-metadata/extractors/mcp-tools.d.ts +16 -0
- package/dist/doc-metadata/extractors/mcp-tools.js +689 -0
- package/dist/doc-metadata/extractors/plugin-api.d.ts +19 -0
- package/dist/doc-metadata/extractors/plugin-api.js +279 -0
- package/dist/doc-metadata/index.d.ts +5 -0
- package/dist/doc-metadata/index.js +4 -0
- package/dist/doc-metadata/types.d.ts +120 -0
- package/dist/doc-metadata/types.js +5 -0
- package/dist/editor-completions/annotationValues.d.ts +12 -0
- package/dist/editor-completions/annotationValues.js +138 -0
- package/dist/editor-completions/contextParser.d.ts +40 -0
- package/dist/editor-completions/contextParser.js +410 -0
- package/dist/editor-completions/dataTypes.d.ts +16 -0
- package/dist/editor-completions/dataTypes.js +95 -0
- package/dist/editor-completions/goToDefinition.d.ts +27 -0
- package/dist/editor-completions/goToDefinition.js +112 -0
- package/dist/editor-completions/index.d.ts +39 -0
- package/dist/editor-completions/index.js +181 -0
- package/dist/editor-completions/jsDocAnnotations.d.ts +29 -0
- package/dist/editor-completions/jsDocAnnotations.js +357 -0
- package/dist/editor-completions/modifierCompletions.d.ts +17 -0
- package/dist/editor-completions/modifierCompletions.js +197 -0
- package/dist/editor-completions/types.d.ts +119 -0
- package/dist/editor-completions/types.js +8 -0
- package/dist/export/index.d.ts +68 -0
- package/dist/export/index.js +1074 -0
- package/dist/export/templates.d.ts +24 -0
- package/dist/export/templates.js +186 -0
- package/dist/friendly-errors.d.ts +35 -0
- package/dist/friendly-errors.js +375 -0
- package/dist/function-like.d.ts +38 -0
- package/dist/function-like.js +83 -0
- package/dist/generated-branding.d.ts +16 -0
- package/dist/generated-branding.js +22 -0
- package/dist/generator/async-detection.d.ts +27 -0
- package/dist/generator/async-detection.js +56 -0
- package/dist/generator/code-utils.d.ts +76 -0
- package/dist/generator/code-utils.js +410 -0
- package/dist/generator/control-flow.d.ts +54 -0
- package/dist/generator/control-flow.js +284 -0
- package/dist/generator/inngest.d.ts +53 -0
- package/dist/generator/inngest.js +1126 -0
- package/dist/generator/scope-function-generator.d.ts +78 -0
- package/dist/generator/scope-function-generator.js +360 -0
- package/dist/generator/unified.d.ts +42 -0
- package/dist/generator/unified.js +1504 -0
- package/dist/generator.d.ts +54 -0
- package/dist/generator.js +100 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +89 -0
- package/dist/jsdoc-parser.d.ts +308 -0
- package/dist/jsdoc-parser.js +923 -0
- package/dist/jsdoc-port-sync/constants.d.ts +41 -0
- package/dist/jsdoc-port-sync/constants.js +103 -0
- package/dist/jsdoc-port-sync/diff.d.ts +76 -0
- package/dist/jsdoc-port-sync/diff.js +319 -0
- package/dist/jsdoc-port-sync/index.d.ts +42 -0
- package/dist/jsdoc-port-sync/index.js +45 -0
- package/dist/jsdoc-port-sync/port-parser.d.ts +68 -0
- package/dist/jsdoc-port-sync/port-parser.js +579 -0
- package/dist/jsdoc-port-sync/rename.d.ts +21 -0
- package/dist/jsdoc-port-sync/rename.js +256 -0
- package/dist/jsdoc-port-sync/signature-parser.d.ts +104 -0
- package/dist/jsdoc-port-sync/signature-parser.js +559 -0
- package/dist/jsdoc-port-sync/sync.d.ts +36 -0
- package/dist/jsdoc-port-sync/sync.js +644 -0
- package/dist/jsdoc-port-sync.d.ts +10 -0
- package/dist/jsdoc-port-sync.js +10 -0
- package/dist/marketplace/index.d.ts +11 -0
- package/dist/marketplace/index.js +10 -0
- package/dist/marketplace/manifest.d.ts +32 -0
- package/dist/marketplace/manifest.js +176 -0
- package/dist/marketplace/registry.d.ts +30 -0
- package/dist/marketplace/registry.js +100 -0
- package/dist/marketplace/types.d.ts +154 -0
- package/dist/marketplace/types.js +9 -0
- package/dist/marketplace/validator.d.ts +13 -0
- package/dist/marketplace/validator.js +131 -0
- package/dist/mcp/auto-registration.d.ts +3 -0
- package/dist/mcp/auto-registration.js +62 -0
- package/dist/mcp/editor-connection.d.ts +50 -0
- package/dist/mcp/editor-connection.js +125 -0
- package/dist/mcp/event-buffer.d.ts +62 -0
- package/dist/mcp/event-buffer.js +150 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.js +11 -0
- package/dist/mcp/resources.d.ts +14 -0
- package/dist/mcp/resources.js +55 -0
- package/dist/mcp/response-utils.d.ts +63 -0
- package/dist/mcp/response-utils.js +89 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.js +99 -0
- package/dist/mcp/tools-diagram.d.ts +8 -0
- package/dist/mcp/tools-diagram.js +53 -0
- package/dist/mcp/tools-editor.d.ts +5 -0
- package/dist/mcp/tools-editor.js +190 -0
- package/dist/mcp/tools-export.d.ts +9 -0
- package/dist/mcp/tools-export.js +180 -0
- package/dist/mcp/tools-marketplace.d.ts +9 -0
- package/dist/mcp/tools-marketplace.js +132 -0
- package/dist/mcp/tools-pattern.d.ts +3 -0
- package/dist/mcp/tools-pattern.js +783 -0
- package/dist/mcp/tools-query.d.ts +3 -0
- package/dist/mcp/tools-query.js +364 -0
- package/dist/mcp/tools-template.d.ts +10 -0
- package/dist/mcp/tools-template.js +119 -0
- package/dist/mcp/types.d.ts +70 -0
- package/dist/mcp/types.js +8 -0
- package/dist/mcp/workflow-executor.d.ts +47 -0
- package/dist/mcp/workflow-executor.js +133 -0
- package/dist/migration/registry.d.ts +30 -0
- package/dist/migration/registry.js +29 -0
- package/dist/node-types-generator.d.ts +49 -0
- package/dist/node-types-generator.js +139 -0
- package/dist/npm-packages.d.ts +56 -0
- package/dist/npm-packages.js +255 -0
- package/dist/parser.d.ts +204 -0
- package/dist/parser.js +2100 -0
- package/dist/plugin/PluginPanel.d.ts +12 -0
- package/dist/plugin/PluginPanel.js +5 -0
- package/dist/plugin/index.d.ts +13 -0
- package/dist/plugin/index.js +14 -0
- package/dist/plugin/types.d.ts +75 -0
- package/dist/plugin/types.js +8 -0
- package/dist/resolve-package-types.d.ts +17 -0
- package/dist/resolve-package-types.js +123 -0
- package/dist/runtime/CancellationError.d.ts +11 -0
- package/dist/runtime/CancellationError.js +20 -0
- package/dist/runtime/ExecutionContext.d.ts +146 -0
- package/dist/runtime/ExecutionContext.js +235 -0
- package/dist/runtime/builtin-functions.d.ts +8 -0
- package/dist/runtime/builtin-functions.js +549 -0
- package/dist/runtime/events.d.ts +50 -0
- package/dist/runtime/events.js +2 -0
- package/dist/runtime/function-registry.d.ts +59 -0
- package/dist/runtime/function-registry.js +66 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/parameter-resolver.d.ts +62 -0
- package/dist/runtime/parameter-resolver.js +113 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +6 -0
- package/dist/server/types.d.ts +93 -0
- package/dist/server/types.js +5 -0
- package/dist/server/webhook-server.d.ts +50 -0
- package/dist/server/webhook-server.js +269 -0
- package/dist/server/workflow-registry.d.ts +61 -0
- package/dist/server/workflow-registry.js +202 -0
- package/dist/shared-project.d.ts +9 -0
- package/dist/shared-project.js +28 -0
- package/dist/sugar-optimizer.d.ts +40 -0
- package/dist/sugar-optimizer.js +387 -0
- package/dist/testing/assertions.d.ts +51 -0
- package/dist/testing/assertions.js +127 -0
- package/dist/testing/index.d.ts +30 -0
- package/dist/testing/index.js +24 -0
- package/dist/testing/mock-approval.d.ts +81 -0
- package/dist/testing/mock-approval.js +98 -0
- package/dist/testing/mock-llm.d.ts +124 -0
- package/dist/testing/mock-llm.js +119 -0
- package/dist/testing/recorder.d.ts +72 -0
- package/dist/testing/recorder.js +70 -0
- package/dist/testing/replayer.d.ts +56 -0
- package/dist/testing/replayer.js +143 -0
- package/dist/testing/token-tracker.d.ts +71 -0
- package/dist/testing/token-tracker.js +94 -0
- package/dist/type-checker.d.ts +42 -0
- package/dist/type-checker.js +190 -0
- package/dist/type-mappings.d.ts +29 -0
- package/dist/type-mappings.js +125 -0
- package/dist/types/branded-ports.d.ts +151 -0
- package/dist/types/branded-ports.js +121 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.js +15 -0
- package/dist/utils/error-utils.d.ts +15 -0
- package/dist/utils/error-utils.js +27 -0
- package/dist/utils/lru-cache.d.ts +15 -0
- package/dist/utils/lru-cache.js +40 -0
- package/dist/utils/port-ordering.d.ts +26 -0
- package/dist/utils/port-ordering.js +88 -0
- package/dist/utils/port-tag-utils.d.ts +23 -0
- package/dist/utils/port-tag-utils.js +41 -0
- package/dist/utils/string-distance.d.ts +14 -0
- package/dist/utils/string-distance.js +56 -0
- package/dist/validation/agent-detection.d.ts +33 -0
- package/dist/validation/agent-detection.js +115 -0
- package/dist/validation/agent-rules.d.ts +48 -0
- package/dist/validation/agent-rules.js +262 -0
- package/dist/validator.d.ts +92 -0
- package/dist/validator.js +970 -0
- package/package.json +109 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ForEach Batch Processing Template
|
|
3
|
+
* Iterate over array items with scoped ports
|
|
4
|
+
*/
|
|
5
|
+
export const foreachTemplate = {
|
|
6
|
+
id: 'foreach',
|
|
7
|
+
name: 'ForEach Batch',
|
|
8
|
+
description: 'Batch processing with iteration over arrays',
|
|
9
|
+
category: 'data-processing',
|
|
10
|
+
generate: (opts) => {
|
|
11
|
+
const { workflowName, async: isAsync } = opts;
|
|
12
|
+
const asyncKeyword = isAsync ? 'async ' : '';
|
|
13
|
+
const returnType = isAsync
|
|
14
|
+
? 'Promise<{ onSuccess: boolean; onFailure: boolean; results: any[]; successCount: number; failedCount: number }>'
|
|
15
|
+
: '{ onSuccess: boolean; onFailure: boolean; results: any[]; successCount: number; failedCount: number }';
|
|
16
|
+
return `
|
|
17
|
+
/**
|
|
18
|
+
* Iterates over items and processes each one
|
|
19
|
+
*
|
|
20
|
+
* @flowWeaver nodeType
|
|
21
|
+
* @label For Each Item
|
|
22
|
+
* @input items [order:1] - Array of items to iterate
|
|
23
|
+
* @input success scope:processItem [order:0] - From child onSuccess
|
|
24
|
+
* @input failure scope:processItem [order:1] - From child onFailure
|
|
25
|
+
* @input result scope:processItem [order:2] - Result from child
|
|
26
|
+
* @input execute [order:0] - Execute
|
|
27
|
+
* @output start scope:processItem [order:0] - Triggers child execute
|
|
28
|
+
* @output item scope:processItem [order:1] - Current item to process
|
|
29
|
+
* @output results [order:2] - Collected results after iteration
|
|
30
|
+
* @output onSuccess [order:0] - On Success
|
|
31
|
+
* @output onFailure [order:1] - On Failure
|
|
32
|
+
*/
|
|
33
|
+
function forEachItem(
|
|
34
|
+
execute: boolean,
|
|
35
|
+
items: any[],
|
|
36
|
+
processItem: (start: boolean, item: any) => { success: boolean; failure: boolean; result: any }
|
|
37
|
+
): { onSuccess: boolean; onFailure: boolean; results: any[] } {
|
|
38
|
+
if (!execute) {
|
|
39
|
+
return { onSuccess: false, onFailure: false, results: [] };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const results: any[] = [];
|
|
43
|
+
for (const item of items) {
|
|
44
|
+
const r = processItem(true, item);
|
|
45
|
+
results.push(r.result);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return { onSuccess: true, onFailure: false, results };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Processes a single item
|
|
53
|
+
*
|
|
54
|
+
* @flowWeaver nodeType
|
|
55
|
+
* @label Process Item
|
|
56
|
+
* @input item [order:1] - Item to process
|
|
57
|
+
* @input execute [order:0] - Execute
|
|
58
|
+
* @output result [order:2] - Processed result
|
|
59
|
+
* @output onSuccess [order:0] - On Success
|
|
60
|
+
* @output onFailure [order:1] - On Failure
|
|
61
|
+
*/
|
|
62
|
+
function processItem(
|
|
63
|
+
execute: boolean,
|
|
64
|
+
item: any
|
|
65
|
+
): { onSuccess: boolean; onFailure: boolean; result: any } {
|
|
66
|
+
if (!execute) {
|
|
67
|
+
return { onSuccess: false, onFailure: false, result: null };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// TODO: Add your processing logic here
|
|
71
|
+
const result = { ...item, processed: true };
|
|
72
|
+
|
|
73
|
+
return { onSuccess: true, onFailure: false, result };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Aggregates results from iteration
|
|
78
|
+
*
|
|
79
|
+
* @flowWeaver nodeType
|
|
80
|
+
* @label Aggregate Results
|
|
81
|
+
* @input results [order:1] - Array of processed results
|
|
82
|
+
* @input execute [order:0] - Execute
|
|
83
|
+
* @output successCount [order:2] - Number of successes
|
|
84
|
+
* @output failedCount [order:3] - Number of failures
|
|
85
|
+
* @output onSuccess [order:0] - On Success
|
|
86
|
+
* @output onFailure [order:1] - On Failure
|
|
87
|
+
*/
|
|
88
|
+
function aggregateResults(
|
|
89
|
+
execute: boolean,
|
|
90
|
+
results: any[]
|
|
91
|
+
): { onSuccess: boolean; onFailure: boolean; successCount: number; failedCount: number } {
|
|
92
|
+
if (!execute) {
|
|
93
|
+
return { onSuccess: false, onFailure: false, successCount: 0, failedCount: 0 };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const successCount = results.filter(r => r?.processed).length;
|
|
97
|
+
const failedCount = results.length - successCount;
|
|
98
|
+
|
|
99
|
+
return { onSuccess: true, onFailure: false, successCount, failedCount };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @flowWeaver workflow
|
|
104
|
+
* @node iterator forEachItem [size: 300 200]
|
|
105
|
+
* @node processor processItem iterator.processItem
|
|
106
|
+
* @node aggregator aggregateResults
|
|
107
|
+
* @position Start -450 0
|
|
108
|
+
* @position iterator -90 0
|
|
109
|
+
* @position processor 90 0
|
|
110
|
+
* @position aggregator 270 0
|
|
111
|
+
* @position Exit 450 0
|
|
112
|
+
* @connect Start.execute -> iterator.execute
|
|
113
|
+
* @connect Start.items -> iterator.items
|
|
114
|
+
* @connect iterator.start:processItem -> processor.execute
|
|
115
|
+
* @connect iterator.item:processItem -> processor.item
|
|
116
|
+
* @connect processor.result -> iterator.result:processItem
|
|
117
|
+
* @connect processor.onSuccess -> iterator.success:processItem
|
|
118
|
+
* @connect processor.onFailure -> iterator.failure:processItem
|
|
119
|
+
* @connect iterator.results -> Exit.results
|
|
120
|
+
* @connect iterator.results -> aggregator.results
|
|
121
|
+
* @connect iterator.onSuccess -> aggregator.execute
|
|
122
|
+
* @connect aggregator.successCount -> Exit.successCount
|
|
123
|
+
* @connect aggregator.failedCount -> Exit.failedCount
|
|
124
|
+
* @connect aggregator.onSuccess -> Exit.onSuccess
|
|
125
|
+
* @connect aggregator.onFailure -> Exit.onFailure
|
|
126
|
+
* @param execute [order:0] - Execute
|
|
127
|
+
* @param items [order:1] - Array of items to process
|
|
128
|
+
* @returns onSuccess [order:0] - On Success
|
|
129
|
+
* @returns onFailure [order:1] - On Failure
|
|
130
|
+
* @returns results [order:2] - Processed results
|
|
131
|
+
* @returns successCount [order:3] - Number of successful items
|
|
132
|
+
* @returns failedCount [order:4] - Number of failed items
|
|
133
|
+
*/
|
|
134
|
+
export ${asyncKeyword}function ${workflowName}(
|
|
135
|
+
execute: boolean,
|
|
136
|
+
params: { items: any[] }
|
|
137
|
+
): ${returnType} {
|
|
138
|
+
throw new Error("Compile with: flow-weaver compile <file>");
|
|
139
|
+
}
|
|
140
|
+
`.trim();
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=foreach.js.map
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sequential Pipeline Template
|
|
3
|
+
* Linear data processing: validate -> transform -> output
|
|
4
|
+
*/
|
|
5
|
+
const configSchema = {
|
|
6
|
+
nodes: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
label: 'Node Names',
|
|
9
|
+
description: 'Comma-separated list of node function names (e.g. "fetch,parse,store")',
|
|
10
|
+
placeholder: 'validateData,transformData,outputResult',
|
|
11
|
+
},
|
|
12
|
+
input: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
label: 'Input Port Name',
|
|
15
|
+
description: 'Name of the input data port',
|
|
16
|
+
default: 'data',
|
|
17
|
+
placeholder: 'data',
|
|
18
|
+
},
|
|
19
|
+
output: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
label: 'Output Port Name',
|
|
22
|
+
description: 'Name of the output data port',
|
|
23
|
+
default: 'result',
|
|
24
|
+
placeholder: 'result',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
function generateDefaultTemplate(workflowName, asyncKeyword, returnType) {
|
|
28
|
+
return `
|
|
29
|
+
// Use @expression for pure functions, normal mode for branching
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Validates input data
|
|
33
|
+
* Normal mode: explicit error routing with data on failure
|
|
34
|
+
*
|
|
35
|
+
* @flowWeaver nodeType
|
|
36
|
+
* @label Validate
|
|
37
|
+
* @input data [order:1] - Data to validate
|
|
38
|
+
* @input execute [order:0] - Execute
|
|
39
|
+
* @output data [order:2] - Validated data
|
|
40
|
+
* @output isValid [order:3] - Validation passed
|
|
41
|
+
* @output error [order:4] - Validation error message
|
|
42
|
+
* @output onSuccess [order:0] - On Success
|
|
43
|
+
* @output onFailure [order:1] - On Failure
|
|
44
|
+
*/
|
|
45
|
+
function validateData(
|
|
46
|
+
execute: boolean,
|
|
47
|
+
data: any
|
|
48
|
+
): { onSuccess: boolean; onFailure: boolean; data: any; isValid: boolean; error: string | null } {
|
|
49
|
+
if (!execute) {
|
|
50
|
+
return { onSuccess: false, onFailure: false, data: null, isValid: false, error: null };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// TODO: Add validation logic
|
|
54
|
+
if (!data) {
|
|
55
|
+
return { onSuccess: false, onFailure: true, data: null, isValid: false, error: "Data is required" };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return { onSuccess: true, onFailure: false, data, isValid: true, error: null };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Transforms validated data
|
|
63
|
+
*
|
|
64
|
+
* @flowWeaver nodeType
|
|
65
|
+
* @expression
|
|
66
|
+
* @label Transform
|
|
67
|
+
* @input data [order:0] - Data to transform
|
|
68
|
+
* @output data [order:0] - Transformed data
|
|
69
|
+
*/
|
|
70
|
+
function transformData(data: any): { data: any } {
|
|
71
|
+
// TODO: Add transformation logic
|
|
72
|
+
return { data: { ...data, processedAt: new Date().toISOString() } };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Outputs the final result
|
|
77
|
+
*
|
|
78
|
+
* @flowWeaver nodeType
|
|
79
|
+
* @expression
|
|
80
|
+
* @label Output
|
|
81
|
+
* @input data [order:0] - Data to output
|
|
82
|
+
* @output result [order:0] - Final result
|
|
83
|
+
*/
|
|
84
|
+
function outputResult(data: any): { result: any } {
|
|
85
|
+
return { result: data };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @flowWeaver workflow
|
|
90
|
+
* @node validator validateData
|
|
91
|
+
* @node transformer transformData
|
|
92
|
+
* @node outputter outputResult
|
|
93
|
+
* @position Start -600 0
|
|
94
|
+
* @position validator -300 0
|
|
95
|
+
* @position transformer 0 0
|
|
96
|
+
* @position outputter 300 0
|
|
97
|
+
* @position Exit 600 0
|
|
98
|
+
* @path Start -> validator -> transformer -> outputter -> Exit
|
|
99
|
+
* @connect validator.onFailure -> Exit.onFailure
|
|
100
|
+
* @connect validator.error -> Exit.error
|
|
101
|
+
* @param execute [order:0] - Execute
|
|
102
|
+
* @param data [order:1] - Input data
|
|
103
|
+
* @returns onSuccess [order:0] - On Success
|
|
104
|
+
* @returns onFailure [order:1] - On Failure
|
|
105
|
+
* @returns result [order:2] - Processed result
|
|
106
|
+
* @returns error [order:3] - Error message if failed
|
|
107
|
+
*/
|
|
108
|
+
export ${asyncKeyword}function ${workflowName}(
|
|
109
|
+
execute: boolean,
|
|
110
|
+
params: { data: any }
|
|
111
|
+
): ${returnType} {
|
|
112
|
+
throw new Error("Compile with: flow-weaver compile <file>");
|
|
113
|
+
}
|
|
114
|
+
`.trim();
|
|
115
|
+
}
|
|
116
|
+
function generateCustomTemplate(workflowName, asyncKeyword, returnType, nodeNames, inputPort, outputPort) {
|
|
117
|
+
// Generate node type functions
|
|
118
|
+
const nodeTypeDefs = nodeNames.map((name, i) => {
|
|
119
|
+
const isFirst = i === 0;
|
|
120
|
+
const isLast = i === nodeNames.length - 1;
|
|
121
|
+
const inputPortName = isFirst ? inputPort : 'data';
|
|
122
|
+
const outputPortName = isLast ? outputPort : 'data';
|
|
123
|
+
return `/**
|
|
124
|
+
* ${name} step
|
|
125
|
+
*
|
|
126
|
+
* @flowWeaver nodeType
|
|
127
|
+
* @expression
|
|
128
|
+
* @label ${name.charAt(0).toUpperCase() + name.slice(1)}
|
|
129
|
+
* @input ${inputPortName} [order:0] - Input data
|
|
130
|
+
* @output ${outputPortName} [order:0] - Output data
|
|
131
|
+
*/
|
|
132
|
+
function ${name}(${inputPortName}: any): { ${outputPortName}: any } {
|
|
133
|
+
// TODO: Implement ${name} logic
|
|
134
|
+
return { ${outputPortName}: ${inputPortName} };
|
|
135
|
+
}`;
|
|
136
|
+
});
|
|
137
|
+
// Generate workflow annotations
|
|
138
|
+
const nodeAnnotations = nodeNames.map((name, i) => ` * @node step${i} ${name}`).join('\n');
|
|
139
|
+
const spacing = 300;
|
|
140
|
+
const startX = -(nodeNames.length * (spacing / 2) + spacing / 2);
|
|
141
|
+
const positionAnnotations = [
|
|
142
|
+
` * @position Start ${startX} 0`,
|
|
143
|
+
...nodeNames.map((_, i) => ` * @position step${i} ${startX + (i + 1) * spacing} 0`),
|
|
144
|
+
` * @position Exit ${startX + (nodeNames.length + 1) * spacing} 0`,
|
|
145
|
+
].join('\n');
|
|
146
|
+
// Build connections using @path sugar
|
|
147
|
+
const pathNodes = ['Start', ...nodeNames.map((_, i) => `step${i}`), 'Exit'];
|
|
148
|
+
const connections = [];
|
|
149
|
+
connections.push(` * @path ${pathNodes.join(' -> ')}`);
|
|
150
|
+
connections.push(` * @connect step0.onFailure -> Exit.onFailure`);
|
|
151
|
+
return `${nodeTypeDefs.join('\n\n')}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @flowWeaver workflow
|
|
155
|
+
${nodeAnnotations}
|
|
156
|
+
${positionAnnotations}
|
|
157
|
+
${connections.join('\n')}
|
|
158
|
+
* @param execute [order:0] - Execute
|
|
159
|
+
* @param ${inputPort} [order:1] - Input data
|
|
160
|
+
* @returns onSuccess [order:0] - On Success
|
|
161
|
+
* @returns onFailure [order:1] - On Failure
|
|
162
|
+
* @returns ${outputPort} [order:2] - Processed result
|
|
163
|
+
* @returns error [order:3] - Error message if failed
|
|
164
|
+
*/
|
|
165
|
+
export ${asyncKeyword}function ${workflowName}(
|
|
166
|
+
execute: boolean,
|
|
167
|
+
params: { ${inputPort}: any }
|
|
168
|
+
): ${returnType} {
|
|
169
|
+
throw new Error("Compile with: flow-weaver compile <file>");
|
|
170
|
+
}`.trim();
|
|
171
|
+
}
|
|
172
|
+
export const sequentialTemplate = {
|
|
173
|
+
id: 'sequential',
|
|
174
|
+
name: 'Sequential Pipeline',
|
|
175
|
+
description: 'Linear pipeline: validate -> transform -> output',
|
|
176
|
+
category: 'data-processing',
|
|
177
|
+
configSchema,
|
|
178
|
+
generate: (opts) => {
|
|
179
|
+
const { workflowName, async: isAsync, config } = opts;
|
|
180
|
+
const asyncKeyword = isAsync ? 'async ' : '';
|
|
181
|
+
const returnType = isAsync
|
|
182
|
+
? 'Promise<{ onSuccess: boolean; onFailure: boolean; result: any; error?: string }>'
|
|
183
|
+
: '{ onSuccess: boolean; onFailure: boolean; result: any; error?: string }';
|
|
184
|
+
// If custom nodes are provided, generate custom template
|
|
185
|
+
const customNodes = config?.nodes;
|
|
186
|
+
const inputPort = config?.input || 'data';
|
|
187
|
+
const outputPort = config?.output || 'result';
|
|
188
|
+
if (customNodes && Array.isArray(customNodes) && customNodes.length > 0) {
|
|
189
|
+
return generateCustomTemplate(workflowName, asyncKeyword, returnType, customNodes, inputPort, outputPort);
|
|
190
|
+
}
|
|
191
|
+
// If only input/output are customized but no custom nodes
|
|
192
|
+
if (inputPort !== 'data' || outputPort !== 'result') {
|
|
193
|
+
return generateCustomTemplate(workflowName, asyncKeyword, returnType, ['validateData', 'transformData', 'outputResult'], inputPort, outputPort);
|
|
194
|
+
}
|
|
195
|
+
return generateDefaultTemplate(workflowName, asyncKeyword, returnType);
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=sequential.js.map
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhook Template
|
|
3
|
+
* HTTP-triggered workflow entry point
|
|
4
|
+
*/
|
|
5
|
+
export const webhookTemplate = {
|
|
6
|
+
id: "webhook",
|
|
7
|
+
name: "Webhook Handler",
|
|
8
|
+
description: "HTTP-triggered workflow with request/response handling",
|
|
9
|
+
category: "integration",
|
|
10
|
+
generate: (opts) => {
|
|
11
|
+
const { workflowName, async: isAsync } = opts;
|
|
12
|
+
const asyncKeyword = isAsync ? "async " : "";
|
|
13
|
+
const returnType = isAsync
|
|
14
|
+
? "Promise<{ onSuccess: boolean; onFailure: boolean; statusCode: number; body: any }>"
|
|
15
|
+
: "{ onSuccess: boolean; onFailure: boolean; statusCode: number; body: any }";
|
|
16
|
+
return `
|
|
17
|
+
/**
|
|
18
|
+
* Validates incoming webhook request
|
|
19
|
+
*
|
|
20
|
+
* @flowWeaver nodeType
|
|
21
|
+
* @label Validate Request
|
|
22
|
+
* @input headers [order:1] - Request headers
|
|
23
|
+
* @input body [order:2] - Request body
|
|
24
|
+
* @input execute [order:0] - Execute
|
|
25
|
+
* @output isValid [order:2] - Whether request is valid
|
|
26
|
+
* @output validatedData [order:3] - Validated request data
|
|
27
|
+
* @output error [order:4] - Validation error message
|
|
28
|
+
* @output onSuccess [order:0] - On Success
|
|
29
|
+
* @output onFailure [order:1] - On Failure
|
|
30
|
+
*/
|
|
31
|
+
function validateRequest(
|
|
32
|
+
execute: boolean,
|
|
33
|
+
headers: Record<string, string>,
|
|
34
|
+
body: any
|
|
35
|
+
): { onSuccess: boolean; onFailure: boolean; isValid: boolean; validatedData: any; error: string } {
|
|
36
|
+
if (!execute) {
|
|
37
|
+
return { onSuccess: false, onFailure: false, isValid: false, validatedData: null, error: "" };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// TODO: Add your validation logic
|
|
41
|
+
// Example: Check API key, validate body schema, etc.
|
|
42
|
+
const apiKey = headers["x-api-key"] || headers["authorization"];
|
|
43
|
+
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
return { onSuccess: false, onFailure: true, isValid: false, validatedData: null, error: "Missing API key" };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return { onSuccess: true, onFailure: false, isValid: true, validatedData: body, error: "" };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Processes the webhook payload
|
|
53
|
+
*
|
|
54
|
+
* @flowWeaver nodeType
|
|
55
|
+
* @label Process Payload
|
|
56
|
+
* @input data [order:1] - Validated payload data
|
|
57
|
+
* @input execute [order:0] - Execute
|
|
58
|
+
* @output result [order:2] - Processing result
|
|
59
|
+
* @output onSuccess [order:0] - On Success
|
|
60
|
+
* @output onFailure [order:1] - On Failure
|
|
61
|
+
*/
|
|
62
|
+
function processPayload(
|
|
63
|
+
execute: boolean,
|
|
64
|
+
data: any
|
|
65
|
+
): { onSuccess: boolean; onFailure: boolean; result: any } {
|
|
66
|
+
if (!execute) {
|
|
67
|
+
return { onSuccess: false, onFailure: false, result: null };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// TODO: Add your business logic
|
|
71
|
+
const result = {
|
|
72
|
+
processed: true,
|
|
73
|
+
timestamp: new Date().toISOString(),
|
|
74
|
+
data
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return { onSuccess: true, onFailure: false, result };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Formats the HTTP response
|
|
82
|
+
*
|
|
83
|
+
* @flowWeaver nodeType
|
|
84
|
+
* @label Format Response
|
|
85
|
+
* @input result [order:1] - Processing result
|
|
86
|
+
* @input error [order:2] - Error message if any
|
|
87
|
+
* @input isSuccess [order:3] - Whether processing succeeded
|
|
88
|
+
* @input execute [order:0] - Execute
|
|
89
|
+
* @output statusCode [order:2] - HTTP status code
|
|
90
|
+
* @output body [order:3] - Response body
|
|
91
|
+
* @output onSuccess [order:0] - On Success
|
|
92
|
+
* @output onFailure [order:1] - On Failure
|
|
93
|
+
*/
|
|
94
|
+
function formatResponse(
|
|
95
|
+
execute: boolean,
|
|
96
|
+
result: any,
|
|
97
|
+
error: string,
|
|
98
|
+
isSuccess: boolean
|
|
99
|
+
): { onSuccess: boolean; onFailure: boolean; statusCode: number; body: any } {
|
|
100
|
+
if (!execute) {
|
|
101
|
+
return { onSuccess: false, onFailure: false, statusCode: 0, body: null };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (isSuccess) {
|
|
105
|
+
return {
|
|
106
|
+
onSuccess: true,
|
|
107
|
+
onFailure: false,
|
|
108
|
+
statusCode: 200,
|
|
109
|
+
body: { success: true, data: result }
|
|
110
|
+
};
|
|
111
|
+
} else {
|
|
112
|
+
return {
|
|
113
|
+
onSuccess: true,
|
|
114
|
+
onFailure: false,
|
|
115
|
+
statusCode: 400,
|
|
116
|
+
body: { success: false, error: error || "Processing failed" }
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @flowWeaver workflow
|
|
123
|
+
* @node validator validateRequest
|
|
124
|
+
* @node processor processPayload
|
|
125
|
+
* @node responder formatResponse
|
|
126
|
+
* @position Start -450 0
|
|
127
|
+
* @position validator -180 0
|
|
128
|
+
* @position processor 90 -60
|
|
129
|
+
* @position responder 270 0
|
|
130
|
+
* @position Exit 450 0
|
|
131
|
+
* @connect Start.execute -> validator.execute
|
|
132
|
+
* @connect Start.headers -> validator.headers
|
|
133
|
+
* @connect Start.body -> validator.body
|
|
134
|
+
* @connect validator.onSuccess -> processor.execute
|
|
135
|
+
* @connect validator.validatedData -> processor.data
|
|
136
|
+
* @connect validator.error -> responder.error
|
|
137
|
+
* @connect processor.onSuccess -> responder.execute
|
|
138
|
+
* @connect processor.result -> responder.result
|
|
139
|
+
* @connect validator.isValid -> responder.isSuccess
|
|
140
|
+
* @connect responder.statusCode -> Exit.statusCode
|
|
141
|
+
* @connect responder.body -> Exit.body
|
|
142
|
+
* @connect responder.onSuccess -> Exit.onSuccess
|
|
143
|
+
* @connect responder.onFailure -> Exit.onFailure
|
|
144
|
+
* @param execute [order:0] - Execute
|
|
145
|
+
* @param headers [order:1] - HTTP request headers
|
|
146
|
+
* @param body [order:2] - HTTP request body
|
|
147
|
+
* @returns onSuccess [order:0] - On Success
|
|
148
|
+
* @returns onFailure [order:1] - On Failure
|
|
149
|
+
* @returns statusCode [order:2] - HTTP response status code
|
|
150
|
+
* @returns body [order:3] - HTTP response body
|
|
151
|
+
*/
|
|
152
|
+
export ${asyncKeyword}function ${workflowName}(
|
|
153
|
+
execute: boolean,
|
|
154
|
+
params: { headers: Record<string, string>; body: any }
|
|
155
|
+
): ${returnType} {
|
|
156
|
+
throw new Error("Compile with: flow-weaver compile <file>");
|
|
157
|
+
}
|
|
158
|
+
`.trim();
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=webhook.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI logging utility with colors and formatting
|
|
3
|
+
*/
|
|
4
|
+
export declare const logger: {
|
|
5
|
+
info(message: string): void;
|
|
6
|
+
success(message: string): void;
|
|
7
|
+
error(message: string): void;
|
|
8
|
+
warn(message: string): void;
|
|
9
|
+
debug(message: string): void;
|
|
10
|
+
log(message: string): void;
|
|
11
|
+
newline(): void;
|
|
12
|
+
section(title: string): void;
|
|
13
|
+
progress(current: number, total: number, item: string): void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/**
|
|
3
|
+
* CLI logging utility with colors and formatting
|
|
4
|
+
*/
|
|
5
|
+
// ANSI color support - respects NO_COLOR env var and non-TTY
|
|
6
|
+
const USE_COLOR = !process.env.NO_COLOR && process.stdout.isTTY !== false;
|
|
7
|
+
const RESET = USE_COLOR ? '\x1b[0m' : '';
|
|
8
|
+
const GREEN = USE_COLOR ? '\x1b[32m' : '';
|
|
9
|
+
const RED = USE_COLOR ? '\x1b[31m' : '';
|
|
10
|
+
const YELLOW = USE_COLOR ? '\x1b[33m' : '';
|
|
11
|
+
const BLUE = USE_COLOR ? '\x1b[34m' : '';
|
|
12
|
+
const BOLD = USE_COLOR ? '\x1b[1m' : '';
|
|
13
|
+
const DIM = USE_COLOR ? '\x1b[2m' : '';
|
|
14
|
+
export const logger = {
|
|
15
|
+
info(message) {
|
|
16
|
+
console.log(`${BLUE}βΉ ${message}${RESET}`);
|
|
17
|
+
},
|
|
18
|
+
success(message) {
|
|
19
|
+
console.log(`${GREEN}β ${message}${RESET}`);
|
|
20
|
+
},
|
|
21
|
+
error(message) {
|
|
22
|
+
console.error(`${RED}β ${message}${RESET}`);
|
|
23
|
+
},
|
|
24
|
+
warn(message) {
|
|
25
|
+
console.warn(`${YELLOW}β ${message}${RESET}`);
|
|
26
|
+
},
|
|
27
|
+
debug(message) {
|
|
28
|
+
if (process.env.DEBUG) {
|
|
29
|
+
console.log(`${DIM}π ${message}${RESET}`);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
log(message) {
|
|
33
|
+
console.log(message);
|
|
34
|
+
},
|
|
35
|
+
newline() {
|
|
36
|
+
console.log();
|
|
37
|
+
},
|
|
38
|
+
section(title) {
|
|
39
|
+
console.log();
|
|
40
|
+
console.log(`${BOLD}βββ ${title} βββ${RESET}`);
|
|
41
|
+
},
|
|
42
|
+
progress(current, total, item) {
|
|
43
|
+
console.log(`[${current}/${total}] ${item}`);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # Flow Weaver Constants
|
|
3
|
+
*
|
|
4
|
+
* This module defines reserved names and constants used throughout the Flow Weaver system.
|
|
5
|
+
*
|
|
6
|
+
* ## Scoped Port Architecture
|
|
7
|
+
*
|
|
8
|
+
* Scoped ports enable iteration patterns (forEach, map) WITHOUT graph cycles.
|
|
9
|
+
* The key insight is that port directions are INVERTED for scoped ports:
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
13
|
+
* β SCOPED PORT DIRECTION MAPPING β
|
|
14
|
+
* βββββββββββββββββββ¬βββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ€
|
|
15
|
+
* β Scoped OUTPUT β Parentβ β Parameters TO children (start, item) β
|
|
16
|
+
* β Scoped INPUT β βParent β Returns FROM children (success, result)β
|
|
17
|
+
* βββββββββββββββββββ΄βββββββββββ΄βββββββββββββββββββββββββββββββββββββββββ
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* **Why this inversion?**
|
|
21
|
+
* - Scoped OUTPUT ports (like `start`, `item`) are data the parent SENDS to nested nodes
|
|
22
|
+
* - Scoped INPUT ports (like `success`, `result`) are data the parent RECEIVES from nested nodes
|
|
23
|
+
* - The loop iteration happens in the parent's imperative code, not as graph cycles
|
|
24
|
+
*
|
|
25
|
+
* ## Mandatory Scoped Ports
|
|
26
|
+
*
|
|
27
|
+
* Every scoped node must have these ports for each scope it declares:
|
|
28
|
+
* - `start` (OUTPUT) - Triggers scope execution, passed as first param
|
|
29
|
+
* - `success` (INPUT) - Signals successful completion from child
|
|
30
|
+
* - `failure` (INPUT) - Signals failure from child
|
|
31
|
+
*
|
|
32
|
+
* ## Example: forEach Node
|
|
33
|
+
*
|
|
34
|
+
* ```typescript
|
|
35
|
+
* @scope processItem
|
|
36
|
+
* @output start scope:processItem // OUTPUT β function param (triggers iteration)
|
|
37
|
+
* @output item scope:processItem // OUTPUT β function param (current item)
|
|
38
|
+
* @input success scope:processItem // INPUT β return value (completion signal)
|
|
39
|
+
* @input processed scope:processItem // INPUT β return value (processed data)
|
|
40
|
+
*
|
|
41
|
+
* function forEach(execute, items, processItem) {
|
|
42
|
+
* const results = [];
|
|
43
|
+
* for (const item of items) {
|
|
44
|
+
* const r = processItem(true, item); // Calls generated closure
|
|
45
|
+
* if (r.success) results.push(r.processed);
|
|
46
|
+
* }
|
|
47
|
+
* return { onSuccess: true, results };
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const RESERVED_NODE_NAMES: {
|
|
52
|
+
readonly START: "Start";
|
|
53
|
+
readonly EXIT: "Exit";
|
|
54
|
+
};
|
|
55
|
+
export declare const RESERVED_PORT_NAMES: {
|
|
56
|
+
readonly EXECUTE: "execute";
|
|
57
|
+
readonly ON_SUCCESS: "onSuccess";
|
|
58
|
+
readonly ON_FAILURE: "onFailure";
|
|
59
|
+
};
|
|
60
|
+
export declare const SCOPED_PORT_NAMES: {
|
|
61
|
+
readonly START: "start";
|
|
62
|
+
readonly SUCCESS: "success";
|
|
63
|
+
readonly FAILURE: "failure";
|
|
64
|
+
};
|
|
65
|
+
export declare const EXECUTION_STRATEGIES: {
|
|
66
|
+
readonly CONJUNCTION: "CONJUNCTION";
|
|
67
|
+
readonly DISJUNCTION: "DISJUNCTION";
|
|
68
|
+
readonly CUSTOM: "CUSTOM";
|
|
69
|
+
};
|
|
70
|
+
export declare const BRANCHING_STRATEGIES: {
|
|
71
|
+
readonly VALUE_BASED: "value-based";
|
|
72
|
+
readonly EXCEPTION_BASED: "exception-based";
|
|
73
|
+
readonly NONE: "none";
|
|
74
|
+
};
|
|
75
|
+
export type ReservedNodeName = (typeof RESERVED_NODE_NAMES)[keyof typeof RESERVED_NODE_NAMES];
|
|
76
|
+
export type ReservedPortName = (typeof RESERVED_PORT_NAMES)[keyof typeof RESERVED_PORT_NAMES];
|
|
77
|
+
export type ExecutionStrategy = (typeof EXECUTION_STRATEGIES)[keyof typeof EXECUTION_STRATEGIES];
|
|
78
|
+
export type BranchingStrategyType = (typeof BRANCHING_STRATEGIES)[keyof typeof BRANCHING_STRATEGIES];
|
|
79
|
+
export declare function isReservedNodeName(name: string): name is ReservedNodeName;
|
|
80
|
+
export declare function isReservedPortName(name: string): name is ReservedPortName;
|
|
81
|
+
export declare function isStartNode(nodeName: string): boolean;
|
|
82
|
+
export declare function isExitNode(nodeName: string): boolean;
|
|
83
|
+
export declare function isSpecialNode(nodeName: string): boolean;
|
|
84
|
+
export declare function isExecutePort(portName: string): boolean;
|
|
85
|
+
export declare function isSuccessPort(portName: string): boolean;
|
|
86
|
+
export declare function isFailurePort(portName: string): boolean;
|
|
87
|
+
export declare function isScopedStartPort(portName: string): boolean;
|
|
88
|
+
export declare function isScopedSuccessPort(portName: string): boolean;
|
|
89
|
+
export declare function isScopedFailurePort(portName: string): boolean;
|
|
90
|
+
export declare function isScopedMandatoryPort(portName: string): boolean;
|
|
91
|
+
export declare function isControlFlowPort(portName: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Check if a port definition represents a scoped port
|
|
94
|
+
* Scoped ports are FUNCTION type with a scope attribute
|
|
95
|
+
*/
|
|
96
|
+
export declare function isScopedPort(portDef: {
|
|
97
|
+
dataType: string;
|
|
98
|
+
scope?: string;
|
|
99
|
+
}): boolean;
|
|
100
|
+
//# sourceMappingURL=constants.d.ts.map
|