@decaf-ts/as-graph 0.7.0 → 0.8.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/README.md +92 -12
- package/assets/i18n/en.json +1519 -130
- package/dist/as-graph.cjs +1 -1
- package/dist/as-graph.cjs.map +1 -1
- package/dist/as-graph.js +1 -1
- package/dist/as-graph.js.map +1 -1
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +13 -0
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -1
- package/lib/cjs/dagster/capabilities.cjs +5 -0
- package/lib/cjs/dagster/capabilities.cjs.map +1 -1
- package/lib/cjs/engine/execution/GraphCodeMode.cjs +42 -0
- package/lib/cjs/engine/execution/GraphCodeMode.cjs.map +1 -1
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +35 -4
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
- package/lib/cjs/engine/validation/GraphNodeInstanceValidator.cjs +29 -1
- package/lib/cjs/engine/validation/GraphNodeInstanceValidator.cjs.map +1 -1
- package/lib/cjs/engine/validation/GraphWorkflowDocumentValidator.cjs +6 -2
- package/lib/cjs/engine/validation/GraphWorkflowDocumentValidator.cjs.map +1 -1
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +41 -9
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphEngineController.cjs +18 -0
- package/lib/cjs/nest/graph/GraphEngineController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs +14 -0
- package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphRunController.cjs +17 -0
- package/lib/cjs/nest/graph/GraphRunController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs +34 -5
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +1 -1
- package/lib/cjs/node/comms/discord/node.cjs +384 -0
- package/lib/cjs/node/comms/discord/node.cjs.map +1 -0
- package/lib/cjs/node/comms/outlook/node.cjs +395 -0
- package/lib/cjs/node/comms/outlook/node.cjs.map +1 -0
- package/lib/cjs/node/comms/whatsapp/node.cjs +341 -0
- package/lib/cjs/node/comms/whatsapp/node.cjs.map +1 -0
- package/lib/cjs/node/data/aggregate/node.cjs +196 -0
- package/lib/cjs/node/data/aggregate/node.cjs.map +1 -0
- package/lib/cjs/node/data/compare-datasets/node.cjs +331 -0
- package/lib/cjs/node/data/compare-datasets/node.cjs.map +1 -0
- package/lib/cjs/node/data/item-lists/node.cjs +416 -0
- package/lib/cjs/node/data/item-lists/node.cjs.map +1 -0
- package/lib/cjs/node/data/remove-duplicates/node.cjs +141 -0
- package/lib/cjs/node/data/remove-duplicates/node.cjs.map +1 -0
- package/lib/cjs/node/data/summarize/node.cjs +155 -0
- package/lib/cjs/node/data/summarize/node.cjs.map +1 -0
- package/lib/cjs/node/data/support.cjs +5 -0
- package/lib/cjs/node/data/support.cjs.map +1 -1
- package/lib/cjs/node/data/transform-utils.cjs +719 -0
- package/lib/cjs/node/data/transform-utils.cjs.map +1 -0
- package/lib/cjs/node/index.cjs +216 -110
- package/lib/cjs/node/index.cjs.map +1 -1
- package/lib/cjs/node/io/confluence/node.cjs +253 -0
- package/lib/cjs/node/io/confluence/node.cjs.map +1 -0
- package/lib/cjs/node/io/convert-to-file/node.cjs +349 -0
- package/lib/cjs/node/io/convert-to-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/file-support.cjs +311 -0
- package/lib/cjs/node/io/file-support.cjs.map +1 -0
- package/lib/cjs/node/io/google-calendar/node.cjs +359 -0
- package/lib/cjs/node/io/google-calendar/node.cjs.map +1 -0
- package/lib/cjs/node/io/google-docs/node.cjs +272 -0
- package/lib/cjs/node/io/google-docs/node.cjs.map +1 -0
- package/lib/cjs/node/io/html/node.cjs +275 -0
- package/lib/cjs/node/io/html/node.cjs.map +1 -0
- package/lib/cjs/node/io/html-extract/node.cjs +162 -0
- package/lib/cjs/node/io/html-extract/node.cjs.map +1 -0
- package/lib/cjs/node/io/html-support.cjs +246 -0
- package/lib/cjs/node/io/html-support.cjs.map +1 -0
- package/lib/cjs/node/io/jira/node.cjs +351 -0
- package/lib/cjs/node/io/jira/node.cjs.map +1 -0
- package/lib/cjs/node/io/markdown/node.cjs +229 -0
- package/lib/cjs/node/io/markdown/node.cjs.map +1 -0
- package/lib/cjs/node/io/microsoft-excel/node.cjs +261 -0
- package/lib/cjs/node/io/microsoft-excel/node.cjs.map +1 -0
- package/lib/cjs/node/io/microsoft-sharepoint/node.cjs +274 -0
- package/lib/cjs/node/io/microsoft-sharepoint/node.cjs.map +1 -0
- package/lib/cjs/node/io/read-binary-file/node.cjs +114 -0
- package/lib/cjs/node/io/read-binary-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/read-binary-files/node.cjs +113 -0
- package/lib/cjs/node/io/read-binary-files/node.cjs.map +1 -0
- package/lib/cjs/node/io/write-binary-file/node.cjs +164 -0
- package/lib/cjs/node/io/write-binary-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/xml/node.cjs +322 -0
- package/lib/cjs/node/io/xml/node.cjs.map +1 -0
- package/lib/cjs/node/manifests.cjs +137 -79
- package/lib/cjs/node/manifests.cjs.map +1 -1
- package/lib/cjs/node/storage/rabbitmq/node.cjs +252 -0
- package/lib/cjs/node/storage/rabbitmq/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/error/node.cjs +108 -0
- package/lib/cjs/node/triggers/error/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/postgres/node.cjs +244 -0
- package/lib/cjs/node/triggers/postgres/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/rabbitmq/node.cjs +284 -0
- package/lib/cjs/node/triggers/rabbitmq/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/redis/node.cjs +233 -0
- package/lib/cjs/node/triggers/redis/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/sse/node.cjs +196 -0
- package/lib/cjs/node/triggers/sse/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/support.cjs +107 -0
- package/lib/cjs/node/triggers/support.cjs.map +1 -0
- package/lib/cjs/node/triggers/workflow/node.cjs +193 -0
- package/lib/cjs/node/triggers/workflow/node.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphValueSchemaDerivation.cjs +20 -3
- package/lib/cjs/shared/graph/catalog/GraphValueSchemaDerivation.cjs.map +1 -1
- package/lib/cjs/workflows/boundary-value.workflow.cjs +38 -0
- package/lib/cjs/workflows/boundary-value.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/builders.cjs +47 -0
- package/lib/cjs/workflows/builders.cjs.map +1 -0
- package/lib/cjs/workflows/chat-agent.workflow.cjs +40 -0
- package/lib/cjs/workflows/chat-agent.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/error-boundary.workflow.cjs +54 -0
- package/lib/cjs/workflows/error-boundary.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/event-map.workflow.cjs +37 -0
- package/lib/cjs/workflows/event-map.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/foreach-break.workflow.cjs +58 -0
- package/lib/cjs/workflows/foreach-break.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/human-approval.workflow.cjs +44 -0
- package/lib/cjs/workflows/human-approval.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/if-switch.workflow.cjs +66 -0
- package/lib/cjs/workflows/if-switch.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/index.cjs +135 -0
- package/lib/cjs/workflows/index.cjs.map +1 -0
- package/lib/cjs/workflows/loops-while-until.workflow.cjs +76 -0
- package/lib/cjs/workflows/loops-while-until.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/manual-log.workflow.cjs +52 -0
- package/lib/cjs/workflows/manual-log.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/schedule-code.workflow.cjs +42 -0
- package/lib/cjs/workflows/schedule-code.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/types.cjs +4 -0
- package/lib/cjs/workflows/types.cjs.map +1 -0
- package/lib/cjs/workflows/value-templates.workflow.cjs +43 -0
- package/lib/cjs/workflows/value-templates.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/webhook-form.workflow.cjs +48 -0
- package/lib/cjs/workflows/webhook-form.workflow.cjs.map +1 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js +13 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -1
- package/lib/esm/dagster/capabilities.js +5 -0
- package/lib/esm/dagster/capabilities.js.map +1 -1
- package/lib/esm/engine/execution/GraphCodeMode.js +40 -0
- package/lib/esm/engine/execution/GraphCodeMode.js.map +1 -1
- package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -1
- package/lib/esm/engine/execution/GraphExecutionEngine.js +36 -5
- package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
- package/lib/esm/engine/validation/GraphNodeInstanceValidator.js +29 -1
- package/lib/esm/engine/validation/GraphNodeInstanceValidator.js.map +1 -1
- package/lib/esm/engine/validation/GraphWorkflowDocumentValidator.js +6 -2
- package/lib/esm/engine/validation/GraphWorkflowDocumentValidator.js.map +1 -1
- package/lib/esm/mastra/MastraMemory.js.map +1 -1
- package/lib/esm/mastra/MastraWorkflowCompiler.js +41 -9
- package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -1
- package/lib/esm/nest/graph/GraphEngineController.js +19 -1
- package/lib/esm/nest/graph/GraphEngineController.js.map +1 -1
- package/lib/esm/nest/graph/GraphNodeCatalogueController.js +15 -1
- package/lib/esm/nest/graph/GraphNodeCatalogueController.js.map +1 -1
- package/lib/esm/nest/graph/GraphRunController.js +18 -1
- package/lib/esm/nest/graph/GraphRunController.js.map +1 -1
- package/lib/esm/nest/graph/GraphWorkflowController.js +35 -6
- package/lib/esm/nest/graph/GraphWorkflowController.js.map +1 -1
- package/lib/esm/node/comms/discord/node.js +375 -0
- package/lib/esm/node/comms/discord/node.js.map +1 -0
- package/lib/esm/node/comms/outlook/node.js +386 -0
- package/lib/esm/node/comms/outlook/node.js.map +1 -0
- package/lib/esm/node/comms/whatsapp/node.js +332 -0
- package/lib/esm/node/comms/whatsapp/node.js.map +1 -0
- package/lib/esm/node/data/aggregate/node.js +187 -0
- package/lib/esm/node/data/aggregate/node.js.map +1 -0
- package/lib/esm/node/data/compare-datasets/node.js +322 -0
- package/lib/esm/node/data/compare-datasets/node.js.map +1 -0
- package/lib/esm/node/data/item-lists/node.js +407 -0
- package/lib/esm/node/data/item-lists/node.js.map +1 -0
- package/lib/esm/node/data/remove-duplicates/node.js +132 -0
- package/lib/esm/node/data/remove-duplicates/node.js.map +1 -0
- package/lib/esm/node/data/summarize/node.js +146 -0
- package/lib/esm/node/data/summarize/node.js.map +1 -0
- package/lib/esm/node/data/support.js +5 -1
- package/lib/esm/node/data/support.js.map +1 -1
- package/lib/esm/node/data/transform-utils.js +702 -0
- package/lib/esm/node/data/transform-utils.js.map +1 -0
- package/lib/esm/node/index.js +110 -4
- package/lib/esm/node/index.js.map +1 -1
- package/lib/esm/node/io/confluence/node.js +244 -0
- package/lib/esm/node/io/confluence/node.js.map +1 -0
- package/lib/esm/node/io/convert-to-file/node.js +340 -0
- package/lib/esm/node/io/convert-to-file/node.js.map +1 -0
- package/lib/esm/node/io/file-support.js +299 -0
- package/lib/esm/node/io/file-support.js.map +1 -0
- package/lib/esm/node/io/google-calendar/node.js +350 -0
- package/lib/esm/node/io/google-calendar/node.js.map +1 -0
- package/lib/esm/node/io/google-docs/node.js +263 -0
- package/lib/esm/node/io/google-docs/node.js.map +1 -0
- package/lib/esm/node/io/html/node.js +266 -0
- package/lib/esm/node/io/html/node.js.map +1 -0
- package/lib/esm/node/io/html-extract/node.js +153 -0
- package/lib/esm/node/io/html-extract/node.js.map +1 -0
- package/lib/esm/node/io/html-support.js +206 -0
- package/lib/esm/node/io/html-support.js.map +1 -0
- package/lib/esm/node/io/jira/node.js +342 -0
- package/lib/esm/node/io/jira/node.js.map +1 -0
- package/lib/esm/node/io/markdown/node.js +217 -0
- package/lib/esm/node/io/markdown/node.js.map +1 -0
- package/lib/esm/node/io/microsoft-excel/node.js +252 -0
- package/lib/esm/node/io/microsoft-excel/node.js.map +1 -0
- package/lib/esm/node/io/microsoft-sharepoint/node.js +265 -0
- package/lib/esm/node/io/microsoft-sharepoint/node.js.map +1 -0
- package/lib/esm/node/io/read-binary-file/node.js +105 -0
- package/lib/esm/node/io/read-binary-file/node.js.map +1 -0
- package/lib/esm/node/io/read-binary-files/node.js +104 -0
- package/lib/esm/node/io/read-binary-files/node.js.map +1 -0
- package/lib/esm/node/io/write-binary-file/node.js +155 -0
- package/lib/esm/node/io/write-binary-file/node.js.map +1 -0
- package/lib/esm/node/io/xml/node.js +313 -0
- package/lib/esm/node/io/xml/node.js.map +1 -0
- package/lib/esm/node/manifests.js +58 -0
- package/lib/esm/node/manifests.js.map +1 -1
- package/lib/esm/node/storage/rabbitmq/node.js +243 -0
- package/lib/esm/node/storage/rabbitmq/node.js.map +1 -0
- package/lib/esm/node/triggers/error/node.js +99 -0
- package/lib/esm/node/triggers/error/node.js.map +1 -0
- package/lib/esm/node/triggers/postgres/node.js +235 -0
- package/lib/esm/node/triggers/postgres/node.js.map +1 -0
- package/lib/esm/node/triggers/rabbitmq/node.js +275 -0
- package/lib/esm/node/triggers/rabbitmq/node.js.map +1 -0
- package/lib/esm/node/triggers/redis/node.js +224 -0
- package/lib/esm/node/triggers/redis/node.js.map +1 -0
- package/lib/esm/node/triggers/sse/node.js +187 -0
- package/lib/esm/node/triggers/sse/node.js.map +1 -0
- package/lib/esm/node/triggers/support.js +99 -0
- package/lib/esm/node/triggers/support.js.map +1 -0
- package/lib/esm/node/triggers/workflow/node.js +184 -0
- package/lib/esm/node/triggers/workflow/node.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphValueSchemaDerivation.js +20 -3
- package/lib/esm/shared/graph/catalog/GraphValueSchemaDerivation.js.map +1 -1
- package/lib/esm/workflows/boundary-value.workflow.js +34 -0
- package/lib/esm/workflows/boundary-value.workflow.js.map +1 -0
- package/lib/esm/workflows/builders.js +40 -0
- package/lib/esm/workflows/builders.js.map +1 -0
- package/lib/esm/workflows/chat-agent.workflow.js +36 -0
- package/lib/esm/workflows/chat-agent.workflow.js.map +1 -0
- package/lib/esm/workflows/error-boundary.workflow.js +50 -0
- package/lib/esm/workflows/error-boundary.workflow.js.map +1 -0
- package/lib/esm/workflows/event-map.workflow.js +33 -0
- package/lib/esm/workflows/event-map.workflow.js.map +1 -0
- package/lib/esm/workflows/foreach-break.workflow.js +54 -0
- package/lib/esm/workflows/foreach-break.workflow.js.map +1 -0
- package/lib/esm/workflows/human-approval.workflow.js +40 -0
- package/lib/esm/workflows/human-approval.workflow.js.map +1 -0
- package/lib/esm/workflows/if-switch.workflow.js +62 -0
- package/lib/esm/workflows/if-switch.workflow.js.map +1 -0
- package/lib/esm/workflows/index.js +116 -0
- package/lib/esm/workflows/index.js.map +1 -0
- package/lib/esm/workflows/loops-while-until.workflow.js +72 -0
- package/lib/esm/workflows/loops-while-until.workflow.js.map +1 -0
- package/lib/esm/workflows/manual-log.workflow.js +48 -0
- package/lib/esm/workflows/manual-log.workflow.js.map +1 -0
- package/lib/esm/workflows/schedule-code.workflow.js +38 -0
- package/lib/esm/workflows/schedule-code.workflow.js.map +1 -0
- package/lib/esm/workflows/types.js +2 -0
- package/lib/esm/workflows/types.js.map +1 -0
- package/lib/esm/workflows/value-templates.workflow.js +39 -0
- package/lib/esm/workflows/value-templates.workflow.js.map +1 -0
- package/lib/esm/workflows/webhook-form.workflow.js +44 -0
- package/lib/esm/workflows/webhook-form.workflow.js.map +1 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +7 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +7 -0
- package/lib/types/engine/execution/GraphCodeMode.d.cts +46 -0
- package/lib/types/engine/execution/GraphCodeMode.d.mts +46 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.cts +21 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.mts +21 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.cts +28 -3
- package/lib/types/engine/execution/GraphExecutionEngine.d.mts +28 -3
- package/lib/types/engine/validation/GraphNodeInstanceValidator.d.cts +11 -1
- package/lib/types/engine/validation/GraphNodeInstanceValidator.d.mts +11 -1
- package/lib/types/engine/validation/GraphWorkflowDocumentValidator.d.cts +7 -0
- package/lib/types/engine/validation/GraphWorkflowDocumentValidator.d.mts +7 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.cts +23 -8
- package/lib/types/mastra/MastraWorkflowCompiler.d.mts +23 -8
- package/lib/types/nest/graph/GraphEngineController.d.cts +19 -0
- package/lib/types/nest/graph/GraphEngineController.d.mts +19 -0
- package/lib/types/nest/graph/GraphNodeCatalogueController.d.cts +13 -0
- package/lib/types/nest/graph/GraphNodeCatalogueController.d.mts +13 -0
- package/lib/types/nest/graph/GraphRunController.d.cts +16 -0
- package/lib/types/nest/graph/GraphRunController.d.mts +16 -0
- package/lib/types/nest/graph/GraphWorkflowController.d.cts +26 -3
- package/lib/types/nest/graph/GraphWorkflowController.d.mts +26 -3
- package/lib/types/node/comms/discord/node.d.cts +67 -0
- package/lib/types/node/comms/discord/node.d.mts +67 -0
- package/lib/types/node/comms/outlook/node.d.cts +77 -0
- package/lib/types/node/comms/outlook/node.d.mts +77 -0
- package/lib/types/node/comms/whatsapp/node.d.cts +71 -0
- package/lib/types/node/comms/whatsapp/node.d.mts +71 -0
- package/lib/types/node/data/aggregate/node.d.cts +58 -0
- package/lib/types/node/data/aggregate/node.d.mts +58 -0
- package/lib/types/node/data/compare-datasets/node.d.cts +72 -0
- package/lib/types/node/data/compare-datasets/node.d.mts +72 -0
- package/lib/types/node/data/item-lists/node.d.cts +92 -0
- package/lib/types/node/data/item-lists/node.d.mts +92 -0
- package/lib/types/node/data/remove-duplicates/node.d.cts +47 -0
- package/lib/types/node/data/remove-duplicates/node.d.mts +47 -0
- package/lib/types/node/data/summarize/node.d.cts +44 -0
- package/lib/types/node/data/summarize/node.d.mts +44 -0
- package/lib/types/node/data/support.d.cts +13 -0
- package/lib/types/node/data/support.d.mts +13 -0
- package/lib/types/node/data/transform-utils.d.cts +236 -0
- package/lib/types/node/data/transform-utils.d.mts +236 -0
- package/lib/types/node/index.d.cts +54 -6
- package/lib/types/node/index.d.mts +54 -6
- package/lib/types/node/io/confluence/node.d.cts +49 -0
- package/lib/types/node/io/confluence/node.d.mts +49 -0
- package/lib/types/node/io/convert-to-file/node.d.cts +75 -0
- package/lib/types/node/io/convert-to-file/node.d.mts +75 -0
- package/lib/types/node/io/file-support.d.cts +118 -0
- package/lib/types/node/io/file-support.d.mts +118 -0
- package/lib/types/node/io/google-calendar/node.d.cts +65 -0
- package/lib/types/node/io/google-calendar/node.d.mts +65 -0
- package/lib/types/node/io/google-docs/node.d.cts +51 -0
- package/lib/types/node/io/google-docs/node.d.mts +51 -0
- package/lib/types/node/io/html/node.d.cts +68 -0
- package/lib/types/node/io/html/node.d.mts +68 -0
- package/lib/types/node/io/html-extract/node.d.cts +42 -0
- package/lib/types/node/io/html-extract/node.d.mts +42 -0
- package/lib/types/node/io/html-support.d.cts +69 -0
- package/lib/types/node/io/html-support.d.mts +69 -0
- package/lib/types/node/io/jira/node.d.cts +57 -0
- package/lib/types/node/io/jira/node.d.mts +57 -0
- package/lib/types/node/io/markdown/node.d.cts +61 -0
- package/lib/types/node/io/markdown/node.d.mts +61 -0
- package/lib/types/node/io/microsoft-excel/node.d.cts +45 -0
- package/lib/types/node/io/microsoft-excel/node.d.mts +45 -0
- package/lib/types/node/io/microsoft-sharepoint/node.d.cts +47 -0
- package/lib/types/node/io/microsoft-sharepoint/node.d.mts +47 -0
- package/lib/types/node/io/read-binary-file/node.d.cts +45 -0
- package/lib/types/node/io/read-binary-file/node.d.mts +45 -0
- package/lib/types/node/io/read-binary-files/node.d.cts +41 -0
- package/lib/types/node/io/read-binary-files/node.d.mts +41 -0
- package/lib/types/node/io/write-binary-file/node.d.cts +55 -0
- package/lib/types/node/io/write-binary-file/node.d.mts +55 -0
- package/lib/types/node/io/xml/node.d.cts +67 -0
- package/lib/types/node/io/xml/node.d.mts +67 -0
- package/lib/types/node/storage/rabbitmq/node.d.cts +55 -0
- package/lib/types/node/storage/rabbitmq/node.d.mts +55 -0
- package/lib/types/node/triggers/error/node.d.cts +34 -0
- package/lib/types/node/triggers/error/node.d.mts +34 -0
- package/lib/types/node/triggers/postgres/node.d.cts +54 -0
- package/lib/types/node/triggers/postgres/node.d.mts +54 -0
- package/lib/types/node/triggers/rabbitmq/node.d.cts +59 -0
- package/lib/types/node/triggers/rabbitmq/node.d.mts +59 -0
- package/lib/types/node/triggers/redis/node.d.cts +53 -0
- package/lib/types/node/triggers/redis/node.d.mts +53 -0
- package/lib/types/node/triggers/sse/node.d.cts +43 -0
- package/lib/types/node/triggers/sse/node.d.mts +43 -0
- package/lib/types/node/triggers/support.d.cts +41 -0
- package/lib/types/node/triggers/support.d.mts +41 -0
- package/lib/types/node/triggers/workflow/node.d.cts +46 -0
- package/lib/types/node/triggers/workflow/node.d.mts +46 -0
- package/lib/types/workflows/boundary-value.workflow.d.cts +3 -0
- package/lib/types/workflows/boundary-value.workflow.d.mts +3 -0
- package/lib/types/workflows/builders.d.cts +31 -0
- package/lib/types/workflows/builders.d.mts +31 -0
- package/lib/types/workflows/chat-agent.workflow.d.cts +3 -0
- package/lib/types/workflows/chat-agent.workflow.d.mts +3 -0
- package/lib/types/workflows/error-boundary.workflow.d.cts +3 -0
- package/lib/types/workflows/error-boundary.workflow.d.mts +3 -0
- package/lib/types/workflows/event-map.workflow.d.cts +3 -0
- package/lib/types/workflows/event-map.workflow.d.mts +3 -0
- package/lib/types/workflows/foreach-break.workflow.d.cts +3 -0
- package/lib/types/workflows/foreach-break.workflow.d.mts +3 -0
- package/lib/types/workflows/human-approval.workflow.d.cts +3 -0
- package/lib/types/workflows/human-approval.workflow.d.mts +3 -0
- package/lib/types/workflows/if-switch.workflow.d.cts +3 -0
- package/lib/types/workflows/if-switch.workflow.d.mts +3 -0
- package/lib/types/workflows/index.d.cts +37 -0
- package/lib/types/workflows/index.d.mts +37 -0
- package/lib/types/workflows/loops-while-until.workflow.d.cts +3 -0
- package/lib/types/workflows/loops-while-until.workflow.d.mts +3 -0
- package/lib/types/workflows/manual-log.workflow.d.cts +3 -0
- package/lib/types/workflows/manual-log.workflow.d.mts +3 -0
- package/lib/types/workflows/schedule-code.workflow.d.cts +3 -0
- package/lib/types/workflows/schedule-code.workflow.d.mts +3 -0
- package/lib/types/workflows/types.d.cts +32 -0
- package/lib/types/workflows/types.d.mts +32 -0
- package/lib/types/workflows/value-templates.workflow.d.cts +16 -0
- package/lib/types/workflows/value-templates.workflow.d.mts +16 -0
- package/lib/types/workflows/webhook-form.workflow.d.cts +3 -0
- package/lib/types/workflows/webhook-form.workflow.d.mts +3 -0
- package/package.json +247 -25
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @module as-graph/nodes/io/convert-to-file
|
|
12
|
+
* @description Converts item data into file payloads. The implemented
|
|
13
|
+
* operations are `csv`, `html`, `toJson`, `toText`, and `toBinary`; the
|
|
14
|
+
* declared `iCal`, `ods`, `rtf`, `xls`, and `xlsx` operations are accepted by
|
|
15
|
+
* the type but rejected at execution time. Text outputs are UTF-8 encoded with
|
|
16
|
+
* an optional BOM, and every result is a `BinaryFilePayload` carrying base64
|
|
17
|
+
* data, file name, MIME type, and byte length.
|
|
18
|
+
*/
|
|
19
|
+
import { model, required } from "@decaf-ts/decorator-validation";
|
|
20
|
+
import { uielement } from "@decaf-ts/ui-decorators";
|
|
21
|
+
import { input, node, output } from "./../../../shared/graph/index.js";
|
|
22
|
+
import { GraphNode } from "./../../base.js";
|
|
23
|
+
import { GraphExecutionError } from "./../../../engine/errors/GraphExecutionError.js";
|
|
24
|
+
import { asGraphDataArray, getGraphDataValue, isGraphDataRecord, } from "./../../data/support.js";
|
|
25
|
+
import { binaryPayloadOf, } from "./../file-support.js";
|
|
26
|
+
import { graphDataToHtmlTable } from "./../html-support.js";
|
|
27
|
+
const SUPPORTED_OPERATIONS = [
|
|
28
|
+
"csv",
|
|
29
|
+
"html",
|
|
30
|
+
"toJson",
|
|
31
|
+
"toText",
|
|
32
|
+
"toBinary",
|
|
33
|
+
];
|
|
34
|
+
function csvCell(value, delimiter) {
|
|
35
|
+
if (value === undefined || value === null)
|
|
36
|
+
return "";
|
|
37
|
+
const text = typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
38
|
+
if (text.includes('"') ||
|
|
39
|
+
text.includes("\n") ||
|
|
40
|
+
text.includes("\r") ||
|
|
41
|
+
text.includes(delimiter)) {
|
|
42
|
+
return `"${text.replace(/"/g, '""')}"`;
|
|
43
|
+
}
|
|
44
|
+
return text;
|
|
45
|
+
}
|
|
46
|
+
function recordsToCsv(records, delimiter, headerRow) {
|
|
47
|
+
const headers = Array.from(new Set(records.flatMap((record) => Object.keys(record))));
|
|
48
|
+
const lines = [];
|
|
49
|
+
if (headerRow) {
|
|
50
|
+
lines.push(headers.map((header) => csvCell(header, delimiter)).join(delimiter));
|
|
51
|
+
}
|
|
52
|
+
for (const record of records) {
|
|
53
|
+
lines.push(headers.map((header) => csvCell(record[header], delimiter)).join(delimiter));
|
|
54
|
+
}
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
57
|
+
function textBytes(text, addBOM) {
|
|
58
|
+
return Buffer.from(`${addBOM ? "\uFEFF" : ""}${text}`, "utf8");
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Convert to File node (`core.io.convertToFile`): serializes items to CSV,
|
|
62
|
+
* HTML, JSON, text, or base64-backed binary file payloads.
|
|
63
|
+
*/
|
|
64
|
+
let ConvertToFileNode = class ConvertToFileNode extends GraphNode {
|
|
65
|
+
constructor() {
|
|
66
|
+
super(...arguments);
|
|
67
|
+
/** Target format (default `csv`). */
|
|
68
|
+
this.operation = "csv";
|
|
69
|
+
/** Declared binary property name option; the implemented conversion paths do not read it. */
|
|
70
|
+
this.binaryPropertyName = "data";
|
|
71
|
+
/** `toJson` output granularity: one payload for all items or one payload per item (default `once`). */
|
|
72
|
+
this.mode = "once";
|
|
73
|
+
/** CSV field delimiter (default `,`). */
|
|
74
|
+
this.delimiter = ",";
|
|
75
|
+
/** Emit a CSV header row (default `true`). */
|
|
76
|
+
this.headerRow = true;
|
|
77
|
+
/** Prefix UTF-8 text output with a byte-order mark (default `false`). */
|
|
78
|
+
this.addBOM = false;
|
|
79
|
+
/** Pretty-print JSON with two-space indentation (default `false`). */
|
|
80
|
+
this.format = false;
|
|
81
|
+
/** Treat the `toBinary` source as base64; when `false` it is read as UTF-8 (default `true`). */
|
|
82
|
+
this.dataIsBase64 = true;
|
|
83
|
+
/** Omit the default inline table styles (default `false`). */
|
|
84
|
+
this.customStyling = false;
|
|
85
|
+
/** Capitalize and humanize HTML table headers (default `false`). */
|
|
86
|
+
this.capitalize = false;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Converts the input items into file payloads.
|
|
90
|
+
*
|
|
91
|
+
* @param request - Execution request; `inputs.value` holds the items to convert.
|
|
92
|
+
* @returns Execution values with the generated payload(s), the text
|
|
93
|
+
* `content` for single text files, and the total `bytes`.
|
|
94
|
+
* @throws {GraphExecutionError} `GRAPH_CONVERT_TO_FILE_UNSUPPORTED_OPERATION`
|
|
95
|
+
* for a declared-but-unimplemented format, or
|
|
96
|
+
* `GRAPH_CONVERT_TO_FILE_SOURCE_REQUIRED` when `toText`/`toBinary` cannot
|
|
97
|
+
* find a usable source value.
|
|
98
|
+
*/
|
|
99
|
+
execute(request) {
|
|
100
|
+
if (!SUPPORTED_OPERATIONS.includes(this.operation)) {
|
|
101
|
+
throw new GraphExecutionError(`Convert to File operation '${this.operation}' is not supported`, "GRAPH_CONVERT_TO_FILE_UNSUPPORTED_OPERATION", { operation: this.operation });
|
|
102
|
+
}
|
|
103
|
+
const items = asGraphDataArray(request.inputs["value"]);
|
|
104
|
+
const records = items.map((item) => isGraphDataRecord(item) ? item : { value: item });
|
|
105
|
+
switch (this.operation) {
|
|
106
|
+
case "csv": {
|
|
107
|
+
const text = recordsToCsv(records, this.delimiter || ",", this.headerRow !== false);
|
|
108
|
+
const payload = binaryPayloadOf(textBytes(text, this.addBOM), this.fileName || "file.csv", undefined, "text/csv");
|
|
109
|
+
return { result: payload, content: text, bytes: payload.byteLength };
|
|
110
|
+
}
|
|
111
|
+
case "html": {
|
|
112
|
+
const table = graphDataToHtmlTable(records, {
|
|
113
|
+
caption: this.caption,
|
|
114
|
+
customStyling: this.customStyling === true,
|
|
115
|
+
capitalize: this.capitalize === true,
|
|
116
|
+
});
|
|
117
|
+
const text = `<!DOCTYPE html><html><body>${table}</body></html>`;
|
|
118
|
+
const payload = binaryPayloadOf(textBytes(text, this.addBOM), this.fileName || "file.html", undefined, "text/html");
|
|
119
|
+
return { result: payload, content: text, bytes: payload.byteLength };
|
|
120
|
+
}
|
|
121
|
+
case "toText": {
|
|
122
|
+
const payloads = this.textPayloads(records);
|
|
123
|
+
return this.returnPayloads(payloads);
|
|
124
|
+
}
|
|
125
|
+
case "toBinary": {
|
|
126
|
+
const payloads = this.binaryPayloads(records);
|
|
127
|
+
return this.returnPayloads(payloads);
|
|
128
|
+
}
|
|
129
|
+
case "toJson":
|
|
130
|
+
default: {
|
|
131
|
+
if (this.mode === "each") {
|
|
132
|
+
const payloads = records.map((record) => binaryPayloadOf(textBytes(JSON.stringify(record, null, this.format ? 2 : 0), this.addBOM), this.fileName || "file.json", undefined, "application/json"));
|
|
133
|
+
return this.returnPayloads(payloads);
|
|
134
|
+
}
|
|
135
|
+
const text = JSON.stringify(records, null, this.format ? 2 : 0);
|
|
136
|
+
const payload = binaryPayloadOf(textBytes(text, this.addBOM), this.fileName || "file.json", undefined, "application/json");
|
|
137
|
+
return { result: payload, content: text, bytes: payload.byteLength };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
textPayloads(records) {
|
|
142
|
+
return records.map((record) => {
|
|
143
|
+
const value = this.sourceProperty
|
|
144
|
+
? getGraphDataValue(record, this.sourceProperty, true)
|
|
145
|
+
: record.value ?? record;
|
|
146
|
+
if (value === undefined || value === null) {
|
|
147
|
+
throw new GraphExecutionError(`Convert to File node could not find '${this.sourceProperty}' in the input`, "GRAPH_CONVERT_TO_FILE_SOURCE_REQUIRED", { sourceProperty: this.sourceProperty });
|
|
148
|
+
}
|
|
149
|
+
const text = typeof value === "string" ? value : String(value);
|
|
150
|
+
return binaryPayloadOf(textBytes(text, this.addBOM), this.fileName || "file.txt", undefined, "text/plain");
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
binaryPayloads(records) {
|
|
154
|
+
return records.map((record) => {
|
|
155
|
+
const value = this.sourceProperty
|
|
156
|
+
? getGraphDataValue(record, this.sourceProperty, true)
|
|
157
|
+
: record.data ?? record.value;
|
|
158
|
+
if (typeof value !== "string") {
|
|
159
|
+
throw new GraphExecutionError(`Convert to File node requires a base64 string in '${this.sourceProperty ?? "data"}'`, "GRAPH_CONVERT_TO_FILE_SOURCE_REQUIRED", { sourceProperty: this.sourceProperty });
|
|
160
|
+
}
|
|
161
|
+
const base64 = value.startsWith("data:")
|
|
162
|
+
? value.slice(value.indexOf(",") + 1)
|
|
163
|
+
: value;
|
|
164
|
+
if (this.dataIsBase64 === false) {
|
|
165
|
+
return binaryPayloadOf(Buffer.from(base64, "utf8"), this.fileName || "file.bin", undefined, this.mimeType || "application/octet-stream");
|
|
166
|
+
}
|
|
167
|
+
return binaryPayloadOf(Buffer.from(base64, "base64"), this.fileName || "file.bin", undefined, this.mimeType || "application/octet-stream");
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
returnPayloads(payloads) {
|
|
171
|
+
if (payloads.length === 1) {
|
|
172
|
+
return {
|
|
173
|
+
result: payloads[0],
|
|
174
|
+
bytes: payloads[0].byteLength,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
result: payloads,
|
|
179
|
+
bytes: payloads.reduce((total, entry) => total + entry.byteLength, 0),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
__decorate([
|
|
184
|
+
required(),
|
|
185
|
+
input({ handle: "value" }),
|
|
186
|
+
__metadata("design:type", Object)
|
|
187
|
+
], ConvertToFileNode.prototype, "value", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
uielement("ngx-decaf-crud-field", {
|
|
190
|
+
label: "graph.node.io.convert_to_file.fields.operation.label",
|
|
191
|
+
type: "select",
|
|
192
|
+
}),
|
|
193
|
+
input({ handle: "operation", userControlled: true }),
|
|
194
|
+
__metadata("design:type", String)
|
|
195
|
+
], ConvertToFileNode.prototype, "operation", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
uielement("ngx-decaf-crud-field", {
|
|
198
|
+
label: "graph.node.io.convert_to_file.fields.binaryPropertyName.label",
|
|
199
|
+
type: "text",
|
|
200
|
+
}),
|
|
201
|
+
input({ handle: "binaryPropertyName", userControlled: true }),
|
|
202
|
+
__metadata("design:type", String)
|
|
203
|
+
], ConvertToFileNode.prototype, "binaryPropertyName", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
uielement("ngx-decaf-crud-field", {
|
|
206
|
+
label: "graph.node.io.convert_to_file.fields.sourceProperty.label",
|
|
207
|
+
placeholder: "graph.node.io.convert_to_file.fields.sourceProperty.placeholder",
|
|
208
|
+
type: "text",
|
|
209
|
+
}),
|
|
210
|
+
input({ handle: "sourceProperty", userControlled: true }),
|
|
211
|
+
__metadata("design:type", String)
|
|
212
|
+
], ConvertToFileNode.prototype, "sourceProperty", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
uielement("ngx-decaf-crud-field", {
|
|
215
|
+
label: "graph.node.io.convert_to_file.fields.mode.label",
|
|
216
|
+
type: "select",
|
|
217
|
+
}),
|
|
218
|
+
input({ handle: "mode", userControlled: true }),
|
|
219
|
+
__metadata("design:type", String)
|
|
220
|
+
], ConvertToFileNode.prototype, "mode", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
uielement("ngx-decaf-crud-field", {
|
|
223
|
+
label: "graph.node.io.convert_to_file.fields.fileName.label",
|
|
224
|
+
placeholder: "graph.node.io.convert_to_file.fields.fileName.placeholder",
|
|
225
|
+
type: "text",
|
|
226
|
+
}),
|
|
227
|
+
input({ handle: "fileName", userControlled: true }),
|
|
228
|
+
__metadata("design:type", String)
|
|
229
|
+
], ConvertToFileNode.prototype, "fileName", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
uielement("ngx-decaf-crud-field", {
|
|
232
|
+
label: "graph.node.io.convert_to_file.fields.mimeType.label",
|
|
233
|
+
type: "text",
|
|
234
|
+
}),
|
|
235
|
+
input({ handle: "mimeType", userControlled: true }),
|
|
236
|
+
__metadata("design:type", String)
|
|
237
|
+
], ConvertToFileNode.prototype, "mimeType", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
uielement("ngx-decaf-crud-field", {
|
|
240
|
+
label: "graph.node.io.convert_to_file.fields.delimiter.label",
|
|
241
|
+
type: "text",
|
|
242
|
+
}),
|
|
243
|
+
input({ handle: "delimiter", userControlled: true }),
|
|
244
|
+
__metadata("design:type", String)
|
|
245
|
+
], ConvertToFileNode.prototype, "delimiter", void 0);
|
|
246
|
+
__decorate([
|
|
247
|
+
uielement("ngx-decaf-crud-field", {
|
|
248
|
+
label: "graph.node.io.convert_to_file.fields.headerRow.label",
|
|
249
|
+
type: "checkbox",
|
|
250
|
+
}),
|
|
251
|
+
input({ handle: "headerRow", userControlled: true }),
|
|
252
|
+
__metadata("design:type", Boolean)
|
|
253
|
+
], ConvertToFileNode.prototype, "headerRow", void 0);
|
|
254
|
+
__decorate([
|
|
255
|
+
uielement("ngx-decaf-crud-field", {
|
|
256
|
+
label: "graph.node.io.convert_to_file.fields.sheetName.label",
|
|
257
|
+
type: "text",
|
|
258
|
+
}),
|
|
259
|
+
input({ handle: "sheetName", userControlled: true }),
|
|
260
|
+
__metadata("design:type", String)
|
|
261
|
+
], ConvertToFileNode.prototype, "sheetName", void 0);
|
|
262
|
+
__decorate([
|
|
263
|
+
uielement("ngx-decaf-crud-field", {
|
|
264
|
+
label: "graph.node.io.convert_to_file.fields.addBOM.label",
|
|
265
|
+
type: "checkbox",
|
|
266
|
+
}),
|
|
267
|
+
input({ handle: "addBOM", userControlled: true }),
|
|
268
|
+
__metadata("design:type", Boolean)
|
|
269
|
+
], ConvertToFileNode.prototype, "addBOM", void 0);
|
|
270
|
+
__decorate([
|
|
271
|
+
uielement("ngx-decaf-crud-field", {
|
|
272
|
+
label: "graph.node.io.convert_to_file.fields.format.label",
|
|
273
|
+
type: "checkbox",
|
|
274
|
+
}),
|
|
275
|
+
input({ handle: "format", userControlled: true }),
|
|
276
|
+
__metadata("design:type", Boolean)
|
|
277
|
+
], ConvertToFileNode.prototype, "format", void 0);
|
|
278
|
+
__decorate([
|
|
279
|
+
uielement("ngx-decaf-crud-field", {
|
|
280
|
+
label: "graph.node.io.convert_to_file.fields.dataIsBase64.label",
|
|
281
|
+
type: "checkbox",
|
|
282
|
+
}),
|
|
283
|
+
input({ handle: "dataIsBase64", userControlled: true }),
|
|
284
|
+
__metadata("design:type", Boolean)
|
|
285
|
+
], ConvertToFileNode.prototype, "dataIsBase64", void 0);
|
|
286
|
+
__decorate([
|
|
287
|
+
uielement("ngx-decaf-crud-field", {
|
|
288
|
+
label: "graph.node.io.convert_to_file.fields.caption.label",
|
|
289
|
+
type: "text",
|
|
290
|
+
}),
|
|
291
|
+
input({ handle: "caption", userControlled: true }),
|
|
292
|
+
__metadata("design:type", String)
|
|
293
|
+
], ConvertToFileNode.prototype, "caption", void 0);
|
|
294
|
+
__decorate([
|
|
295
|
+
uielement("ngx-decaf-crud-field", {
|
|
296
|
+
label: "graph.node.io.convert_to_file.fields.customStyling.label",
|
|
297
|
+
type: "checkbox",
|
|
298
|
+
}),
|
|
299
|
+
input({ handle: "customStyling", userControlled: true }),
|
|
300
|
+
__metadata("design:type", Boolean)
|
|
301
|
+
], ConvertToFileNode.prototype, "customStyling", void 0);
|
|
302
|
+
__decorate([
|
|
303
|
+
uielement("ngx-decaf-crud-field", {
|
|
304
|
+
label: "graph.node.io.convert_to_file.fields.capitalize.label",
|
|
305
|
+
type: "checkbox",
|
|
306
|
+
}),
|
|
307
|
+
input({ handle: "capitalize", userControlled: true }),
|
|
308
|
+
__metadata("design:type", Boolean)
|
|
309
|
+
], ConvertToFileNode.prototype, "capitalize", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
required(),
|
|
312
|
+
output({ handle: "result" }),
|
|
313
|
+
__metadata("design:type", Object)
|
|
314
|
+
], ConvertToFileNode.prototype, "result", void 0);
|
|
315
|
+
__decorate([
|
|
316
|
+
output({ handle: "content" }),
|
|
317
|
+
__metadata("design:type", String)
|
|
318
|
+
], ConvertToFileNode.prototype, "content", void 0);
|
|
319
|
+
__decorate([
|
|
320
|
+
output({ handle: "bytes" }),
|
|
321
|
+
__metadata("design:type", Number)
|
|
322
|
+
], ConvertToFileNode.prototype, "bytes", void 0);
|
|
323
|
+
ConvertToFileNode = __decorate([
|
|
324
|
+
node("core.io.convertToFile", {
|
|
325
|
+
kind: "core.io.convertToFile",
|
|
326
|
+
category: "IO",
|
|
327
|
+
color: "#0ea5e9",
|
|
328
|
+
icon: "ti-file-arrow-right",
|
|
329
|
+
width: 96,
|
|
330
|
+
height: 96,
|
|
331
|
+
labels: ["io", "file", "convert", "binary", "csv", "json"],
|
|
332
|
+
metadata: {
|
|
333
|
+
title: "graph.node.io.convert_to_file.name",
|
|
334
|
+
description: "graph.node.io.convert_to_file.description",
|
|
335
|
+
},
|
|
336
|
+
}),
|
|
337
|
+
model()
|
|
338
|
+
], ConvertToFileNode);
|
|
339
|
+
export { ConvertToFileNode };
|
|
340
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../../src/node/io/convert-to-file/node.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,yCAA8B;AAC5D,OAAO,EAAE,SAAS,EAAE,wBAAmB;AAKvC,OAAO,EAAE,mBAAmB,EAAE,wDAAmD;AACjF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,GAClB,gCAA2B;AAC5B,OAAO,EACL,eAAe,GAEhB,6BAAwB;AACzB,OAAO,EAAE,oBAAoB,EAAE,6BAAwB;AA8BvD,MAAM,oBAAoB,GAA6B;IACrD,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,UAAU;CACX,CAAC;AAEF,SAAS,OAAO,CAAC,KAAc,EAAE,SAAiB;IAChD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACrD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AAE,IAAI,EAAE,CAAC;;kDAClC;AAQjB;IALC,SAAS,CAAC,sBAAsB,EAAE;QACjC,KAAK,EAAE,0DAA0D;QACjE,IAAI,EAAE,UAAU;KACjB,CAAC;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;;wDACzB;AAQhC;IALC,SAAS,CAAC,sBAAsB,EAAE;QACjC,KAAK,EAAE,uDAAuD;QAC9D,IAAI,EAAE,UAAU;KACjB,CAAC;IACD,KAAK,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;;qDACzB;AAK7B;IAFC,QAAQ,EAAE;IACV,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;;iDACoB;AAIjD;IADC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;;kDACb;AAIjB;IADC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;;gDACb;AAvTJ,iBAAiB;IAd7B,IAAI,CAAC,uBAAuB,EAAE;QAC7B,IAAI,EAAE,uBAAuB;QAC7B,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC;QAC1D,QAAQ,EAAE;YACR,KAAK,EAAE,oCAAoC;YAC3C,WAAW,EAAE,2CAA2C;SACzD;KACF,CAAC;IACD,KAAK,EAAE;GACK,iBAAiB,CAwT7B"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module as-graph/nodes/io/file-support
|
|
3
|
+
* @summary Path-safe file IO and binary payload helpers for the IO nodes.
|
|
4
|
+
* @description Every file path is resolved under a single file-IO base —
|
|
5
|
+
* `GRAPH_FILE_IO_BASE` when set, otherwise the process working directory — and
|
|
6
|
+
* checked against that base after symlink resolution. Paths containing NUL
|
|
7
|
+
* bytes, escaping the base, or targeting `workdocs`, `/etc`, `/proc`, `/root`,
|
|
8
|
+
* or `~/.ssh` are rejected with `GRAPH_FILE_PATH_FORBIDDEN`/`GRAPH_FILE_INVALID_PATH`.
|
|
9
|
+
* The module also maps extensions to MIME types and converts between strings,
|
|
10
|
+
* buffers, base64 payload records, and the `BinaryFilePayload` shape the file
|
|
11
|
+
* nodes emit.
|
|
12
|
+
*/
|
|
13
|
+
import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
14
|
+
import { homedir } from "node:os";
|
|
15
|
+
import { realpathSync } from "node:fs";
|
|
16
|
+
import { glob, mkdir, readFile, realpath, writeFile, appendFile } from "node:fs/promises";
|
|
17
|
+
import { GraphExecutionError } from "./../../engine/errors/GraphExecutionError.js";
|
|
18
|
+
import { isBinaryGraphDataPayload, isGraphDataRecord } from "./../data/support.js";
|
|
19
|
+
const FILE_IO_BASE_ENV = "GRAPH_FILE_IO_BASE";
|
|
20
|
+
const FORBIDDEN_PATH_SEGMENTS = new Set(["workdocs"]);
|
|
21
|
+
function forbiddenAbsoluteDirectories() {
|
|
22
|
+
return ["/etc", "/proc", "/root", resolve(homedir(), ".ssh")];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the file-IO base directory.
|
|
26
|
+
*
|
|
27
|
+
* @returns The real path of `GRAPH_FILE_IO_BASE` (when set and non-empty) or
|
|
28
|
+
* the current working directory; the lexical path is returned when it cannot
|
|
29
|
+
* be resolved.
|
|
30
|
+
*/
|
|
31
|
+
export function fileIoBase() {
|
|
32
|
+
const configured = process.env[FILE_IO_BASE_ENV]?.trim();
|
|
33
|
+
const lexical = resolve(configured && configured.length > 0 ? configured : process.cwd());
|
|
34
|
+
try {
|
|
35
|
+
return realpathSync(lexical);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return lexical;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function isWithinBase(base, candidate) {
|
|
42
|
+
const rel = relative(base, candidate);
|
|
43
|
+
return rel === "" || (!rel.startsWith("..") && !isAbsolute(rel));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Asserts that a resolved candidate path stays inside the base and avoids the
|
|
47
|
+
* forbidden directories.
|
|
48
|
+
*
|
|
49
|
+
* @param base - The resolved file-IO base.
|
|
50
|
+
* @param candidate - The resolved candidate path.
|
|
51
|
+
* @param configuredPath - The original configured path for error context.
|
|
52
|
+
* @throws {GraphExecutionError} `GRAPH_FILE_PATH_FORBIDDEN` when the path
|
|
53
|
+
* escapes the base or targets a forbidden directory or segment.
|
|
54
|
+
*/
|
|
55
|
+
export function assertContainedPath(base, candidate, configuredPath) {
|
|
56
|
+
if (!isWithinBase(base, candidate)) {
|
|
57
|
+
throw new GraphExecutionError(`File node path '${configuredPath}' resolves outside the configured file IO base`, "GRAPH_FILE_PATH_FORBIDDEN", { path: configuredPath, base });
|
|
58
|
+
}
|
|
59
|
+
for (const forbidden of forbiddenAbsoluteDirectories()) {
|
|
60
|
+
if (isWithinBase(forbidden, candidate)) {
|
|
61
|
+
throw new GraphExecutionError(`File node path '${configuredPath}' targets a forbidden directory`, "GRAPH_FILE_PATH_FORBIDDEN", { path: configuredPath });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const segments = relative(base, candidate).split(sep).filter(Boolean);
|
|
65
|
+
for (const segment of segments) {
|
|
66
|
+
if (FORBIDDEN_PATH_SEGMENTS.has(segment.toLowerCase())) {
|
|
67
|
+
throw new GraphExecutionError(`File node path '${configuredPath}' targets a forbidden directory`, "GRAPH_FILE_PATH_FORBIDDEN", { path: configuredPath, segment });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function assertNotForbiddenAbsolutePath(configuredPath) {
|
|
72
|
+
if (!isAbsolute(configuredPath))
|
|
73
|
+
return;
|
|
74
|
+
const lexical = resolve(configuredPath);
|
|
75
|
+
for (const forbidden of forbiddenAbsoluteDirectories()) {
|
|
76
|
+
if (isWithinBase(forbidden, lexical)) {
|
|
77
|
+
throw new GraphExecutionError(`File node path '${configuredPath}' targets a forbidden directory`, "GRAPH_FILE_PATH_FORBIDDEN", { path: configuredPath });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Resolves a configured path under the file-IO base and validates containment.
|
|
83
|
+
*
|
|
84
|
+
* Leading separators are stripped so configured paths are always treated as
|
|
85
|
+
* base-relative; NUL bytes are rejected before resolution.
|
|
86
|
+
*
|
|
87
|
+
* @param configuredPath - The configured file path.
|
|
88
|
+
* @returns The resolved base directory and candidate path.
|
|
89
|
+
* @throws {GraphExecutionError} `GRAPH_FILE_INVALID_PATH` for NUL bytes and
|
|
90
|
+
* `GRAPH_FILE_PATH_FORBIDDEN` for escaping/forbidden paths.
|
|
91
|
+
*/
|
|
92
|
+
export function resolveGraphFilePath(configuredPath) {
|
|
93
|
+
if (configuredPath.includes("\0")) {
|
|
94
|
+
throw new GraphExecutionError("File node path contains a NUL byte", "GRAPH_FILE_INVALID_PATH", { path: configuredPath });
|
|
95
|
+
}
|
|
96
|
+
const base = fileIoBase();
|
|
97
|
+
assertNotForbiddenAbsolutePath(configuredPath);
|
|
98
|
+
const normalized = configuredPath.replace(/^[/\\]+/, "");
|
|
99
|
+
const candidate = resolve(base, normalized);
|
|
100
|
+
assertContainedPath(base, candidate, configuredPath);
|
|
101
|
+
return { base, candidate };
|
|
102
|
+
}
|
|
103
|
+
async function realPathOfNearestExisting(candidate) {
|
|
104
|
+
let current = candidate;
|
|
105
|
+
while (true) {
|
|
106
|
+
try {
|
|
107
|
+
return await realpath(current);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
const parent = dirname(current);
|
|
111
|
+
if (parent === current)
|
|
112
|
+
return undefined;
|
|
113
|
+
current = parent;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const MIME_TYPES = {
|
|
118
|
+
".csv": "text/csv",
|
|
119
|
+
".gif": "image/gif",
|
|
120
|
+
".htm": "text/html",
|
|
121
|
+
".html": "text/html",
|
|
122
|
+
".ics": "text/calendar",
|
|
123
|
+
".jpeg": "image/jpeg",
|
|
124
|
+
".jpg": "image/jpeg",
|
|
125
|
+
".json": "application/json",
|
|
126
|
+
".md": "text/markdown",
|
|
127
|
+
".ods": "application/vnd.oasis.opendocument.spreadsheet",
|
|
128
|
+
".pdf": "application/pdf",
|
|
129
|
+
".png": "image/png",
|
|
130
|
+
".rtf": "application/rtf",
|
|
131
|
+
".svg": "image/svg+xml",
|
|
132
|
+
".txt": "text/plain",
|
|
133
|
+
".xls": "application/vnd.ms-excel",
|
|
134
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
135
|
+
".xml": "application/xml",
|
|
136
|
+
".zip": "application/zip",
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Infers a MIME type from a file extension.
|
|
140
|
+
*
|
|
141
|
+
* @param fileName - File name or path.
|
|
142
|
+
* @returns The mapped MIME type, or `application/octet-stream` for unknown
|
|
143
|
+
* extensions.
|
|
144
|
+
*/
|
|
145
|
+
export function mimeTypeFor(fileName) {
|
|
146
|
+
return MIME_TYPES[extname(fileName).toLowerCase()] ?? "application/octet-stream";
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Wraps a buffer as a `BinaryFilePayload`, encoding the data as base64.
|
|
150
|
+
*
|
|
151
|
+
* @param buffer - The file content.
|
|
152
|
+
* @param fileName - File name used for payload metadata.
|
|
153
|
+
* @param path - Optional original configured path.
|
|
154
|
+
* @param mimeType - Optional MIME override; otherwise inferred from the name.
|
|
155
|
+
* @returns The serialized payload.
|
|
156
|
+
*/
|
|
157
|
+
export function binaryPayloadOf(buffer, fileName, path, mimeType) {
|
|
158
|
+
const payload = {
|
|
159
|
+
fileName,
|
|
160
|
+
mimeType: mimeType || mimeTypeFor(fileName),
|
|
161
|
+
byteLength: buffer.byteLength,
|
|
162
|
+
data: buffer.toString("base64"),
|
|
163
|
+
};
|
|
164
|
+
if (path !== undefined)
|
|
165
|
+
payload.path = path;
|
|
166
|
+
return payload;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Decodes a node input into a `Buffer`.
|
|
170
|
+
*
|
|
171
|
+
* Strings decode as UTF-8 or base64; `data:` URLs drop their prefix; buffers,
|
|
172
|
+
* typed arrays, and array buffers pass through; records are searched for the
|
|
173
|
+
* first of `dataPropertyName`, `data`, `content`, or `value`.
|
|
174
|
+
*
|
|
175
|
+
* @param value - The input value.
|
|
176
|
+
* @param encoding - Decoding mode (default `utf8`; `auto` inspects payload records).
|
|
177
|
+
* @param dataPropertyName - Preferred record field (default `data`).
|
|
178
|
+
* @returns The decoded buffer.
|
|
179
|
+
* @throws {GraphExecutionError} `GRAPH_BINARY_INPUT_REQUIRED` when the value
|
|
180
|
+
* cannot be decoded.
|
|
181
|
+
*/
|
|
182
|
+
export function binaryBufferOf(value, encoding = "utf8", dataPropertyName = "data") {
|
|
183
|
+
if (typeof value === "string") {
|
|
184
|
+
if (value.startsWith("data:")) {
|
|
185
|
+
const comma = value.indexOf(",");
|
|
186
|
+
if (comma >= 0) {
|
|
187
|
+
return Buffer.from(value.slice(comma + 1), "base64");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return encoding === "base64"
|
|
191
|
+
? Buffer.from(value, "base64")
|
|
192
|
+
: Buffer.from(value, "utf8");
|
|
193
|
+
}
|
|
194
|
+
if (isBinaryGraphDataPayload(value)) {
|
|
195
|
+
return Buffer.isBuffer(value)
|
|
196
|
+
? value
|
|
197
|
+
: Buffer.from(value instanceof ArrayBuffer ? new Uint8Array(value) : value);
|
|
198
|
+
}
|
|
199
|
+
if (isGraphDataRecord(value)) {
|
|
200
|
+
const recordEncoding = encoding === "auto"
|
|
201
|
+
? typeof value["byteLength"] === "number" ||
|
|
202
|
+
typeof value["mimeType"] === "string"
|
|
203
|
+
? "base64"
|
|
204
|
+
: "utf8"
|
|
205
|
+
: encoding;
|
|
206
|
+
for (const key of [dataPropertyName, "data", "content", "value"]) {
|
|
207
|
+
if (key && value[key] !== undefined && value[key] !== value) {
|
|
208
|
+
return binaryBufferOf(value[key], recordEncoding, dataPropertyName);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
throw new GraphExecutionError("File node requires a binary payload", "GRAPH_BINARY_INPUT_REQUIRED", { valueType: typeof value });
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Reads a contained file and serializes it as a payload.
|
|
216
|
+
*
|
|
217
|
+
* @param configuredPath - The configured path, relative to the file-IO base.
|
|
218
|
+
* @returns The payload and its byte length.
|
|
219
|
+
* @throws {GraphExecutionError} `GRAPH_FILE_INVALID_PATH` when the file does
|
|
220
|
+
* not exist, plus the containment errors from `resolveGraphFilePath`.
|
|
221
|
+
*/
|
|
222
|
+
export async function readGraphFilePayload(configuredPath) {
|
|
223
|
+
const { base, candidate } = resolveGraphFilePath(configuredPath);
|
|
224
|
+
let existing;
|
|
225
|
+
try {
|
|
226
|
+
existing = await realpath(candidate);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
throw new GraphExecutionError(`File node path '${configuredPath}' does not exist`, "GRAPH_FILE_INVALID_PATH", { path: configuredPath });
|
|
230
|
+
}
|
|
231
|
+
assertContainedPath(base, existing, configuredPath);
|
|
232
|
+
const content = await readFile(existing);
|
|
233
|
+
return {
|
|
234
|
+
payload: binaryPayloadOf(content, basename(candidate), configuredPath, mimeTypeFor(candidate)),
|
|
235
|
+
bytes: content.byteLength,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Writes a buffer to a contained file.
|
|
240
|
+
*
|
|
241
|
+
* Existing targets and the nearest existing ancestor are re-checked after
|
|
242
|
+
* symlink resolution; parent directories are created unless disabled.
|
|
243
|
+
*
|
|
244
|
+
* @param configuredPath - The configured path, relative to the file-IO base.
|
|
245
|
+
* @param data - The bytes to write.
|
|
246
|
+
* @param options - Append and directory-creation options.
|
|
247
|
+
* @returns The configured path and the number of bytes written.
|
|
248
|
+
* @throws {GraphExecutionError} `GRAPH_FILE_PATH_FORBIDDEN` when the target or
|
|
249
|
+
* its parent resolves outside the base.
|
|
250
|
+
*/
|
|
251
|
+
export async function writeGraphFile(configuredPath, data, options = {}) {
|
|
252
|
+
const { base, candidate } = resolveGraphFilePath(configuredPath);
|
|
253
|
+
const existing = await realPathOfNearestExisting(candidate);
|
|
254
|
+
if (existing)
|
|
255
|
+
assertContainedPath(base, existing, configuredPath);
|
|
256
|
+
if (options.createDirectories) {
|
|
257
|
+
await mkdir(dirname(candidate), { recursive: true });
|
|
258
|
+
}
|
|
259
|
+
const parentRealPath = await realpath(dirname(candidate));
|
|
260
|
+
assertContainedPath(base, parentRealPath, configuredPath);
|
|
261
|
+
const targetRealPath = await realPathOfNearestExisting(candidate);
|
|
262
|
+
if (targetRealPath)
|
|
263
|
+
assertContainedPath(base, targetRealPath, configuredPath);
|
|
264
|
+
if (options.append) {
|
|
265
|
+
await appendFile(candidate, data);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
await writeFile(candidate, data);
|
|
269
|
+
}
|
|
270
|
+
return { path: configuredPath, bytes: data.byteLength };
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Expands a glob pattern inside the file-IO base.
|
|
274
|
+
*
|
|
275
|
+
* @param pattern - The glob pattern; leading separators are stripped.
|
|
276
|
+
* @returns Matching, contained, existing paths in sorted order.
|
|
277
|
+
* @throws {GraphExecutionError} `GRAPH_FILE_PATH_FORBIDDEN` when a match
|
|
278
|
+
* resolves outside the base.
|
|
279
|
+
*/
|
|
280
|
+
export async function graphGlobFiles(pattern) {
|
|
281
|
+
const base = fileIoBase();
|
|
282
|
+
const normalized = pattern.replace(/^[/\\]+/, "");
|
|
283
|
+
const matches = [];
|
|
284
|
+
for await (const match of glob(normalized, { cwd: base })) {
|
|
285
|
+
matches.push(match);
|
|
286
|
+
}
|
|
287
|
+
matches.sort();
|
|
288
|
+
const files = [];
|
|
289
|
+
for (const match of matches) {
|
|
290
|
+
const { candidate } = resolveGraphFilePath(match);
|
|
291
|
+
const existing = await realPathOfNearestExisting(candidate);
|
|
292
|
+
if (!existing)
|
|
293
|
+
continue;
|
|
294
|
+
assertContainedPath(base, existing, match);
|
|
295
|
+
files.push(match);
|
|
296
|
+
}
|
|
297
|
+
return files;
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=file-support.js.map
|