@vertesia/workflow 1.2.0 → 1.4.0-dev.20260615.042549Z
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 +1 -2
- package/lib/{types/activities → activities}/advanced/createDocumentTypeFromInteractionRun.d.ts +2 -2
- package/lib/activities/advanced/createDocumentTypeFromInteractionRun.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/advanced/createDocumentTypeFromInteractionRun.js +9 -9
- package/lib/activities/advanced/createDocumentTypeFromInteractionRun.js.map +1 -0
- package/lib/{types/activities → activities}/advanced/createOrUpdateDocumentFromInteractionRun.d.ts +2 -2
- package/lib/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/advanced/createOrUpdateDocumentFromInteractionRun.js +29 -22
- package/lib/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +1 -0
- package/lib/{types/activities → activities}/advanced/updateDocumentFromInteractionRun.d.ts +1 -1
- package/lib/activities/advanced/updateDocumentFromInteractionRun.d.ts.map +1 -0
- package/lib/activities/advanced/updateDocumentFromInteractionRun.js +16 -0
- package/lib/activities/advanced/updateDocumentFromInteractionRun.js.map +1 -0
- package/lib/{types/activities → activities}/chunkDocument.d.ts +3 -3
- package/lib/activities/chunkDocument.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/chunkDocument.js +38 -33
- package/lib/activities/chunkDocument.js.map +1 -0
- package/lib/{types/activities → activities}/createDocumentFromOther.d.ts +1 -1
- package/lib/activities/createDocumentFromOther.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/createDocumentFromOther.js +15 -13
- package/lib/activities/createDocumentFromOther.js.map +1 -0
- package/lib/{types/activities → activities}/executeInteraction.d.ts +19 -10
- package/lib/activities/executeInteraction.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/executeInteraction.js +97 -78
- package/lib/activities/executeInteraction.js.map +1 -0
- package/lib/{types/activities → activities}/executeRemoteActivity.d.ts +4 -4
- package/lib/activities/executeRemoteActivity.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/executeRemoteActivity.js +48 -23
- package/lib/activities/executeRemoteActivity.js.map +1 -0
- package/lib/{types/activities → activities}/extractDocumentText.d.ts +3 -3
- package/lib/activities/extractDocumentText.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/extractDocumentText.js +65 -52
- package/lib/activities/extractDocumentText.js.map +1 -0
- package/lib/{types/activities → activities}/generateDocumentProperties.d.ts +4 -4
- package/lib/activities/generateDocumentProperties.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/generateDocumentProperties.js +37 -33
- package/lib/activities/generateDocumentProperties.js.map +1 -0
- package/lib/{types/activities → activities}/generateEmbeddings.d.ts +3 -3
- package/lib/activities/generateEmbeddings.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/generateEmbeddings.js +80 -80
- package/lib/activities/generateEmbeddings.js.map +1 -0
- package/lib/{types/activities → activities}/generateOrAssignContentType.d.ts +4 -4
- package/lib/activities/generateOrAssignContentType.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/generateOrAssignContentType.js +51 -49
- package/lib/activities/generateOrAssignContentType.js.map +1 -0
- package/lib/{types/activities → activities}/getObjectFromStore.d.ts +1 -1
- package/lib/activities/getObjectFromStore.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/getObjectFromStore.js +4 -3
- package/lib/activities/getObjectFromStore.js.map +1 -0
- package/lib/{types/activities → activities}/handleError.d.ts +1 -1
- package/lib/activities/handleError.d.ts.map +1 -0
- package/lib/activities/handleError.js +37 -0
- package/lib/activities/handleError.js.map +1 -0
- package/lib/activities/index-dsl.d.ts +31 -0
- package/lib/activities/index-dsl.d.ts.map +1 -0
- package/lib/activities/index-dsl.js +29 -0
- package/lib/activities/index-dsl.js.map +1 -0
- package/lib/{types/activities → activities}/index.d.ts +1 -1
- package/lib/activities/index.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/index.js +1 -1
- package/lib/activities/index.js.map +1 -0
- package/lib/{types/activities → activities}/loadChildWorkflowSpec.d.ts +1 -1
- package/lib/activities/loadChildWorkflowSpec.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/loadChildWorkflowSpec.js +4 -2
- package/lib/activities/loadChildWorkflowSpec.js.map +1 -0
- package/lib/{types/activities → activities}/media/prepareAudio.d.ts +1 -1
- package/lib/activities/media/prepareAudio.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/media/prepareAudio.js +27 -23
- package/lib/activities/media/prepareAudio.js.map +1 -0
- package/lib/{types/activities → activities}/media/prepareVideo.d.ts +2 -2
- package/lib/activities/media/prepareVideo.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/media/prepareVideo.js +72 -54
- package/lib/activities/media/prepareVideo.js.map +1 -0
- package/lib/{types/activities → activities}/media/probeMediaStreams.d.ts +2 -3
- package/lib/activities/media/probeMediaStreams.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/media/probeMediaStreams.js +7 -5
- package/lib/activities/media/probeMediaStreams.js.map +1 -0
- package/lib/{types/activities → activities}/media/processPdfWithTextract.d.ts +3 -3
- package/lib/activities/media/processPdfWithTextract.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/media/processPdfWithTextract.js +43 -26
- package/lib/activities/media/processPdfWithTextract.js.map +1 -0
- package/lib/{types/activities → activities}/media/saveGladiaTranscription.d.ts +2 -2
- package/lib/activities/media/saveGladiaTranscription.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/media/saveGladiaTranscription.js +35 -25
- package/lib/activities/media/saveGladiaTranscription.js.map +1 -0
- package/lib/{types/activities → activities}/media/transcribeMediaWithGladia.d.ts +2 -2
- package/lib/activities/media/transcribeMediaWithGladia.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/media/transcribeMediaWithGladia.js +26 -21
- package/lib/activities/media/transcribeMediaWithGladia.js.map +1 -0
- package/lib/{types/activities → activities}/mergeChildArtifacts.d.ts +1 -1
- package/lib/activities/mergeChildArtifacts.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/mergeChildArtifacts.js +27 -26
- package/lib/activities/mergeChildArtifacts.js.map +1 -0
- package/lib/{types/activities → activities}/notifyWebhook.d.ts +6 -5
- package/lib/activities/notifyWebhook.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/notifyWebhook.js +20 -17
- package/lib/activities/notifyWebhook.js.map +1 -0
- package/lib/{types/activities → activities}/rateLimiter.d.ts +1 -1
- package/lib/activities/rateLimiter.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/rateLimiter.js +4 -3
- package/lib/activities/rateLimiter.js.map +1 -0
- package/lib/{types/activities → activities}/renditions/generateImageRendition.d.ts +3 -3
- package/lib/activities/renditions/generateImageRendition.d.ts.map +1 -0
- package/lib/activities/renditions/generateImageRendition.js +75 -0
- package/lib/activities/renditions/generateImageRendition.js.map +1 -0
- package/lib/{types/activities → activities}/renditions/generateVideoRendition.d.ts +3 -3
- package/lib/activities/renditions/generateVideoRendition.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/renditions/generateVideoRendition.js +51 -54
- package/lib/activities/renditions/generateVideoRendition.js.map +1 -0
- package/lib/{types/activities → activities}/resolveRemoteActivities.d.ts +3 -4
- package/lib/activities/resolveRemoteActivities.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/resolveRemoteActivities.js +16 -15
- package/lib/activities/resolveRemoteActivities.js.map +1 -0
- package/lib/{types/activities → activities}/setDocumentStatus.d.ts +1 -1
- package/lib/activities/setDocumentStatus.d.ts.map +1 -0
- package/lib/{esm/activities → activities}/setDocumentStatus.js +5 -3
- package/lib/activities/setDocumentStatus.js.map +1 -0
- package/lib/{types/bulk-import.d.ts → bulk-import.d.ts} +10 -1
- package/lib/bulk-import.d.ts.map +1 -0
- package/lib/bulk-import.js.map +1 -0
- package/lib/{types/conversion → conversion}/TextractProcessor.d.ts +7 -4
- package/lib/conversion/TextractProcessor.d.ts.map +1 -0
- package/lib/{esm/conversion → conversion}/TextractProcessor.js +38 -38
- package/lib/conversion/TextractProcessor.js.map +1 -0
- package/lib/conversion/image.d.ts.map +1 -0
- package/lib/{esm/conversion → conversion}/image.js +35 -35
- package/lib/conversion/image.js.map +1 -0
- package/lib/conversion/markitdown.d.ts.map +1 -0
- package/lib/{esm/conversion → conversion}/markitdown.js +11 -11
- package/lib/conversion/markitdown.js.map +1 -0
- package/lib/conversion/mutool.d.ts.map +1 -0
- package/lib/{esm/conversion → conversion}/mutool.js +19 -24
- package/lib/conversion/mutool.js.map +1 -0
- package/lib/conversion/pandoc.d.ts.map +1 -0
- package/lib/{esm/conversion → conversion}/pandoc.js +11 -11
- package/lib/conversion/pandoc.js.map +1 -0
- package/lib/dsl/conditions.d.ts +2 -0
- package/lib/dsl/conditions.d.ts.map +1 -0
- package/lib/dsl/conditions.js +90 -0
- package/lib/dsl/conditions.js.map +1 -0
- package/lib/{types/dsl → dsl}/dsl-workflow.d.ts +2 -2
- package/lib/dsl/dsl-workflow.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/dsl-workflow.js +93 -65
- package/lib/dsl/dsl-workflow.js.map +1 -0
- package/lib/dsl/dslProxyActivities.d.ts +7 -0
- package/lib/dsl/dslProxyActivities.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/dslProxyActivities.js +10 -1
- package/lib/dsl/dslProxyActivities.js.map +1 -0
- package/lib/dsl/projections.d.ts +4 -0
- package/lib/dsl/projections.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/projections.js +22 -8
- package/lib/dsl/projections.js.map +1 -0
- package/lib/{types/dsl → dsl}/setup/ActivityContext.d.ts +4 -4
- package/lib/dsl/setup/ActivityContext.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/setup/ActivityContext.js +22 -25
- package/lib/dsl/setup/ActivityContext.js.map +1 -0
- package/lib/{types/dsl → dsl}/setup/fetch/DataProvider.d.ts +3 -3
- package/lib/dsl/setup/fetch/DataProvider.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/setup/fetch/DataProvider.js +2 -1
- package/lib/dsl/setup/fetch/DataProvider.js.map +1 -0
- package/lib/dsl/setup/fetch/index.d.ts +6 -0
- package/lib/dsl/setup/fetch/index.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/setup/fetch/index.js +1 -1
- package/lib/dsl/setup/fetch/index.js.map +1 -0
- package/lib/{types/dsl → dsl}/setup/fetch/providers.d.ts +6 -6
- package/lib/dsl/setup/fetch/providers.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/setup/fetch/providers.js +30 -16
- package/lib/dsl/setup/fetch/providers.js.map +1 -0
- package/lib/dsl/test/test-child-workflow.d.ts +4 -0
- package/lib/dsl/test/test-child-workflow.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/test/test-child-workflow.js +1 -1
- package/lib/dsl/test/test-child-workflow.js.map +1 -0
- package/lib/{types/dsl → dsl}/validation.d.ts +1 -1
- package/lib/dsl/validation.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/validation.js +8 -8
- package/lib/dsl/validation.js.map +1 -0
- package/lib/{types/dsl → dsl}/vars.d.ts +16 -16
- package/lib/dsl/vars.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/vars.js +20 -15
- package/lib/dsl/vars.js.map +1 -0
- package/lib/dsl/walk.d.ts +18 -0
- package/lib/dsl/walk.d.ts.map +1 -0
- package/lib/{esm/dsl → dsl}/walk.js +37 -16
- package/lib/dsl/walk.js.map +1 -0
- package/lib/dsl.d.ts +4 -0
- package/lib/dsl.d.ts.map +1 -0
- package/lib/dsl.js +4 -0
- package/lib/dsl.js.map +1 -0
- package/lib/{types/errors.d.ts → errors.d.ts} +2 -2
- package/lib/errors.d.ts.map +1 -0
- package/lib/{esm/errors.js → errors.js} +22 -17
- package/lib/errors.js.map +1 -0
- package/lib/index.d.ts +36 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +37 -0
- package/lib/index.js.map +1 -0
- package/lib/result-types.d.ts.map +1 -0
- package/lib/result-types.js.map +1 -0
- package/lib/security/ssrf.d.ts.map +1 -0
- package/lib/security/ssrf.js.map +1 -0
- package/lib/system/notifyWebhookWorkflow.d.ts +8 -0
- package/lib/system/notifyWebhookWorkflow.d.ts.map +1 -0
- package/lib/{esm/system → system}/notifyWebhookWorkflow.js +13 -12
- package/lib/system/notifyWebhookWorkflow.js.map +1 -0
- package/lib/{types/system → system}/recalculateEmbeddingsWorkflow.d.ts +1 -1
- package/lib/system/recalculateEmbeddingsWorkflow.d.ts.map +1 -0
- package/lib/{esm/system → system}/recalculateEmbeddingsWorkflow.js +7 -7
- package/lib/system/recalculateEmbeddingsWorkflow.js.map +1 -0
- package/lib/utils/activity-info.d.ts +12 -0
- package/lib/utils/activity-info.d.ts.map +1 -0
- package/lib/utils/activity-info.js +15 -0
- package/lib/utils/activity-info.js.map +1 -0
- package/lib/{types/utils → utils}/auth.d.ts +1 -1
- package/lib/utils/auth.d.ts.map +1 -0
- package/lib/utils/auth.js.map +1 -0
- package/lib/{types/utils → utils}/blobs.d.ts +1 -1
- package/lib/utils/blobs.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/blobs.js +17 -16
- package/lib/utils/blobs.js.map +1 -0
- package/lib/utils/chunks.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/chunks.js +1 -1
- package/lib/utils/chunks.js.map +1 -0
- package/lib/utils/client.d.ts +8 -0
- package/lib/utils/client.d.ts.map +1 -0
- package/lib/utils/client.js +64 -0
- package/lib/utils/client.js.map +1 -0
- package/lib/{types/utils → utils}/expand-vars.d.ts +1 -1
- package/lib/utils/expand-vars.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/expand-vars.js +4 -1
- package/lib/utils/expand-vars.js.map +1 -0
- package/lib/{types/utils → utils}/renditions.d.ts +2 -2
- package/lib/utils/renditions.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/renditions.js +29 -18
- package/lib/utils/renditions.js.map +1 -0
- package/lib/{types/utils → utils}/storage.d.ts +2 -2
- package/lib/utils/storage.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/storage.js +13 -12
- package/lib/utils/storage.js.map +1 -0
- package/lib/{types/utils → utils}/text-preview-utils.d.ts +2 -2
- package/lib/utils/text-preview-utils.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/text-preview-utils.js +4 -4
- package/lib/utils/text-preview-utils.js.map +1 -0
- package/lib/{types/utils → utils}/tokens.d.ts +1 -1
- package/lib/utils/tokens.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/tokens.js +3 -3
- package/lib/utils/tokens.js.map +1 -0
- package/lib/vars.d.ts +3 -0
- package/lib/vars.d.ts.map +1 -0
- package/lib/vars.js +4 -0
- package/lib/vars.js.map +1 -0
- package/lib/workflows-bundle.js +5735 -2815
- package/lib/workflows.d.ts +7 -0
- package/lib/workflows.d.ts.map +1 -0
- package/lib/workflows.js +7 -0
- package/lib/workflows.js.map +1 -0
- package/package.json +48 -89
- package/src/activities/advanced/createDocumentTypeFromInteractionRun.ts +30 -17
- package/src/activities/advanced/createOrUpdateDocumentFromInteractionRun.ts +51 -37
- package/src/activities/advanced/updateDocumentFromInteractionRun.ts +12 -11
- package/src/activities/chunkDocument.ts +87 -77
- package/src/activities/createDocumentFromOther.ts +19 -25
- package/src/activities/executeInteraction.test.ts +81 -8
- package/src/activities/executeInteraction.ts +147 -102
- package/src/activities/executeRemoteActivity.test.ts +61 -67
- package/src/activities/executeRemoteActivity.ts +56 -29
- package/src/activities/extractDocumentText.ts +75 -64
- package/src/activities/generateDocumentProperties.ts +69 -50
- package/src/activities/generateEmbeddings.test.ts +114 -0
- package/src/activities/generateEmbeddings.ts +113 -141
- package/src/activities/generateOrAssignContentType.ts +219 -231
- package/src/activities/getObjectFromStore.ts +11 -10
- package/src/activities/handleError.ts +23 -11
- package/src/activities/index-dsl.ts +30 -30
- package/src/activities/index.ts +1 -1
- package/src/activities/loadChildWorkflowSpec.ts +8 -3
- package/src/activities/media/prepareAudio.ts +47 -56
- package/src/activities/media/prepareVideo.ts +107 -122
- package/src/activities/media/probeMediaStreams.test.ts +11 -13
- package/src/activities/media/probeMediaStreams.ts +13 -15
- package/src/activities/media/processPdfWithTextract.ts +65 -46
- package/src/activities/media/saveGladiaTranscription.test.ts +122 -121
- package/src/activities/media/saveGladiaTranscription.ts +52 -26
- package/src/activities/media/transcribeMediaWithGladia.test.ts +173 -165
- package/src/activities/media/transcribeMediaWithGladia.ts +44 -28
- package/src/activities/mergeChildArtifacts.ts +36 -38
- package/src/activities/notifyWebhook.test.ts +223 -217
- package/src/activities/notifyWebhook.ts +67 -40
- package/src/activities/rateLimiter.ts +31 -30
- package/src/activities/renditions/generateImageRendition.ts +54 -64
- package/src/activities/renditions/generateVideoRendition.ts +87 -141
- package/src/activities/resolveRemoteActivities.test.ts +96 -88
- package/src/activities/resolveRemoteActivities.ts +32 -23
- package/src/activities/setDocumentStatus.ts +11 -7
- package/src/bulk-import.ts +11 -5
- package/src/conversion/TextractProcessor.ts +69 -71
- package/src/conversion/image.test.ts +31 -31
- package/src/conversion/image.ts +41 -38
- package/src/conversion/markitdown.ts +11 -11
- package/src/conversion/mutool.test.ts +77 -62
- package/src/conversion/mutool.ts +27 -49
- package/src/conversion/pandoc.test.ts +5 -6
- package/src/conversion/pandoc.ts +11 -11
- package/src/dsl/conditions.ts +35 -17
- package/src/dsl/dsl-workflow.test.ts +49 -39
- package/src/dsl/dsl-workflow.ts +200 -112
- package/src/dsl/dslProxyActivities.test.ts +23 -0
- package/src/dsl/dslProxyActivities.ts +46 -26
- package/src/dsl/ms.d.ts +34 -3
- package/src/dsl/projections.test.ts +108 -100
- package/src/dsl/projections.ts +46 -26
- package/src/dsl/setup/ActivityContext.test.ts +22 -23
- package/src/dsl/setup/ActivityContext.ts +39 -82
- package/src/dsl/setup/fetch/DataProvider.ts +11 -8
- package/src/dsl/setup/fetch/index.ts +6 -8
- package/src/dsl/setup/fetch/providers.ts +38 -24
- package/src/dsl/test/test-child-workflow.ts +3 -2
- package/src/dsl/validation.test.ts +232 -213
- package/src/dsl/validation.ts +17 -12
- package/src/dsl/vars.test.ts +143 -140
- package/src/dsl/vars.ts +61 -54
- package/src/dsl/walk.test.ts +61 -56
- package/src/dsl/walk.ts +61 -35
- package/src/dsl/workflow-exec-child.test.ts +77 -61
- package/src/dsl/workflow-fetch.test.ts +40 -38
- package/src/dsl/workflow-import.test.ts +27 -27
- package/src/dsl/workflow.test.ts +34 -33
- package/src/dsl.ts +3 -4
- package/src/errors.ts +31 -23
- package/src/index.ts +28 -33
- package/src/result-types.ts +6 -9
- package/src/system/notifyWebhookWorkflow.ts +23 -23
- package/src/system/recalculateEmbeddingsWorkflow.ts +14 -17
- package/src/utils/activity-info.ts +15 -0
- package/src/utils/auth.ts +1 -1
- package/src/utils/blobs.ts +19 -18
- package/src/utils/chunks.ts +7 -8
- package/src/utils/client.ts +57 -17
- package/src/utils/expand-vars.ts +9 -6
- package/src/utils/renditions.ts +68 -72
- package/src/utils/storage.ts +18 -22
- package/src/utils/text-preview-utils.ts +9 -19
- package/src/utils/tokens.ts +9 -11
- package/src/vars.ts +2 -2
- package/src/workflows.ts +3 -4
- package/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js +0 -33
- package/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js.map +0 -1
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +0 -73
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +0 -1
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js +0 -19
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js.map +0 -1
- package/lib/cjs/activities/chunkDocument.js +0 -111
- package/lib/cjs/activities/chunkDocument.js.map +0 -1
- package/lib/cjs/activities/createDocumentFromOther.js +0 -64
- package/lib/cjs/activities/createDocumentFromOther.js.map +0 -1
- package/lib/cjs/activities/executeInteraction.js +0 -241
- package/lib/cjs/activities/executeInteraction.js.map +0 -1
- package/lib/cjs/activities/executeRemoteActivity.js +0 -126
- package/lib/cjs/activities/executeRemoteActivity.js.map +0 -1
- package/lib/cjs/activities/extractDocumentText.js +0 -196
- package/lib/cjs/activities/extractDocumentText.js.map +0 -1
- package/lib/cjs/activities/generateDocumentProperties.js +0 -109
- package/lib/cjs/activities/generateDocumentProperties.js.map +0 -1
- package/lib/cjs/activities/generateEmbeddings.js +0 -269
- package/lib/cjs/activities/generateEmbeddings.js.map +0 -1
- package/lib/cjs/activities/generateOrAssignContentType.js +0 -173
- package/lib/cjs/activities/generateOrAssignContentType.js.map +0 -1
- package/lib/cjs/activities/getObjectFromStore.js +0 -31
- package/lib/cjs/activities/getObjectFromStore.js.map +0 -1
- package/lib/cjs/activities/handleError.js +0 -29
- package/lib/cjs/activities/handleError.js.map +0 -1
- package/lib/cjs/activities/index-dsl.js +0 -59
- package/lib/cjs/activities/index-dsl.js.map +0 -1
- package/lib/cjs/activities/index.js +0 -21
- package/lib/cjs/activities/index.js.map +0 -1
- package/lib/cjs/activities/loadChildWorkflowSpec.js +0 -15
- package/lib/cjs/activities/loadChildWorkflowSpec.js.map +0 -1
- package/lib/cjs/activities/media/prepareAudio.js +0 -240
- package/lib/cjs/activities/media/prepareAudio.js.map +0 -1
- package/lib/cjs/activities/media/prepareVideo.js +0 -432
- package/lib/cjs/activities/media/prepareVideo.js.map +0 -1
- package/lib/cjs/activities/media/probeMediaStreams.js +0 -49
- package/lib/cjs/activities/media/probeMediaStreams.js.map +0 -1
- package/lib/cjs/activities/media/processPdfWithTextract.js +0 -103
- package/lib/cjs/activities/media/processPdfWithTextract.js.map +0 -1
- package/lib/cjs/activities/media/saveGladiaTranscription.js +0 -103
- package/lib/cjs/activities/media/saveGladiaTranscription.js.map +0 -1
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js +0 -107
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js.map +0 -1
- package/lib/cjs/activities/mergeChildArtifacts.js +0 -150
- package/lib/cjs/activities/mergeChildArtifacts.js.map +0 -1
- package/lib/cjs/activities/notifyWebhook.js +0 -167
- package/lib/cjs/activities/notifyWebhook.js.map +0 -1
- package/lib/cjs/activities/rateLimiter.js +0 -30
- package/lib/cjs/activities/rateLimiter.js.map +0 -1
- package/lib/cjs/activities/renditions/generateImageRendition.js +0 -66
- package/lib/cjs/activities/renditions/generateImageRendition.js.map +0 -1
- package/lib/cjs/activities/renditions/generateVideoRendition.js +0 -200
- package/lib/cjs/activities/renditions/generateVideoRendition.js.map +0 -1
- package/lib/cjs/activities/resolveRemoteActivities.js +0 -133
- package/lib/cjs/activities/resolveRemoteActivities.js.map +0 -1
- package/lib/cjs/activities/setDocumentStatus.js +0 -26
- package/lib/cjs/activities/setDocumentStatus.js.map +0 -1
- package/lib/cjs/bulk-import.js +0 -12
- package/lib/cjs/bulk-import.js.map +0 -1
- package/lib/cjs/conversion/TextractProcessor.js +0 -417
- package/lib/cjs/conversion/TextractProcessor.js.map +0 -1
- package/lib/cjs/conversion/image.js +0 -149
- package/lib/cjs/conversion/image.js.map +0 -1
- package/lib/cjs/conversion/markitdown.js +0 -42
- package/lib/cjs/conversion/markitdown.js.map +0 -1
- package/lib/cjs/conversion/mutool.js +0 -147
- package/lib/cjs/conversion/mutool.js.map +0 -1
- package/lib/cjs/conversion/pandoc.js +0 -39
- package/lib/cjs/conversion/pandoc.js.map +0 -1
- package/lib/cjs/dsl/conditions.js +0 -81
- package/lib/cjs/dsl/conditions.js.map +0 -1
- package/lib/cjs/dsl/dsl-workflow.js +0 -458
- package/lib/cjs/dsl/dsl-workflow.js.map +0 -1
- package/lib/cjs/dsl/dslProxyActivities.js +0 -23
- package/lib/cjs/dsl/dslProxyActivities.js.map +0 -1
- package/lib/cjs/dsl/projections.js +0 -59
- package/lib/cjs/dsl/projections.js.map +0 -1
- package/lib/cjs/dsl/setup/ActivityContext.js +0 -188
- package/lib/cjs/dsl/setup/ActivityContext.js.map +0 -1
- package/lib/cjs/dsl/setup/fetch/DataProvider.js +0 -51
- package/lib/cjs/dsl/setup/fetch/DataProvider.js.map +0 -1
- package/lib/cjs/dsl/setup/fetch/index.js +0 -16
- package/lib/cjs/dsl/setup/fetch/index.js.map +0 -1
- package/lib/cjs/dsl/setup/fetch/providers.js +0 -67
- package/lib/cjs/dsl/setup/fetch/providers.js.map +0 -1
- package/lib/cjs/dsl/test/test-child-workflow.js +0 -10
- package/lib/cjs/dsl/test/test-child-workflow.js.map +0 -1
- package/lib/cjs/dsl/validation.js +0 -122
- package/lib/cjs/dsl/validation.js.map +0 -1
- package/lib/cjs/dsl/vars.js +0 -341
- package/lib/cjs/dsl/vars.js.map +0 -1
- package/lib/cjs/dsl/walk.js +0 -100
- package/lib/cjs/dsl/walk.js.map +0 -1
- package/lib/cjs/dsl.js +0 -20
- package/lib/cjs/dsl.js.map +0 -1
- package/lib/cjs/errors.js +0 -89
- package/lib/cjs/errors.js.map +0 -1
- package/lib/cjs/index.js +0 -57
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/extractToc.js +0 -47
- package/lib/cjs/iterative-generation/activities/extractToc.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js +0 -72
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/generatePart.js +0 -78
- package/lib/cjs/iterative-generation/activities/generatePart.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/generateToc.js +0 -86
- package/lib/cjs/iterative-generation/activities/generateToc.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/index.js +0 -12
- package/lib/cjs/iterative-generation/activities/index.js.map +0 -1
- package/lib/cjs/iterative-generation/iterativeGenerationWorkflow.js +0 -56
- package/lib/cjs/iterative-generation/iterativeGenerationWorkflow.js.map +0 -1
- package/lib/cjs/iterative-generation/types.js +0 -5
- package/lib/cjs/iterative-generation/types.js.map +0 -1
- package/lib/cjs/iterative-generation/utils.js +0 -121
- package/lib/cjs/iterative-generation/utils.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/result-types.js +0 -10
- package/lib/cjs/result-types.js.map +0 -1
- package/lib/cjs/security/ssrf.js +0 -34
- package/lib/cjs/security/ssrf.js.map +0 -1
- package/lib/cjs/system/notifyWebhookWorkflow.js +0 -53
- package/lib/cjs/system/notifyWebhookWorkflow.js.map +0 -1
- package/lib/cjs/system/recalculateEmbeddingsWorkflow.js +0 -33
- package/lib/cjs/system/recalculateEmbeddingsWorkflow.js.map +0 -1
- package/lib/cjs/utils/auth.js +0 -15
- package/lib/cjs/utils/auth.js.map +0 -1
- package/lib/cjs/utils/blobs.js +0 -64
- package/lib/cjs/utils/blobs.js.map +0 -1
- package/lib/cjs/utils/chunks.js +0 -14
- package/lib/cjs/utils/chunks.js.map +0 -1
- package/lib/cjs/utils/client.js +0 -31
- package/lib/cjs/utils/client.js.map +0 -1
- package/lib/cjs/utils/expand-vars.js +0 -33
- package/lib/cjs/utils/expand-vars.js.map +0 -1
- package/lib/cjs/utils/memory.js +0 -65
- package/lib/cjs/utils/memory.js.map +0 -1
- package/lib/cjs/utils/renditions.js +0 -92
- package/lib/cjs/utils/renditions.js.map +0 -1
- package/lib/cjs/utils/storage.js +0 -54
- package/lib/cjs/utils/storage.js.map +0 -1
- package/lib/cjs/utils/text-preview-utils.js +0 -43
- package/lib/cjs/utils/text-preview-utils.js.map +0 -1
- package/lib/cjs/utils/tokens.js +0 -38
- package/lib/cjs/utils/tokens.js.map +0 -1
- package/lib/cjs/vars.js +0 -20
- package/lib/cjs/vars.js.map +0 -1
- package/lib/cjs/workflows.js +0 -15
- package/lib/cjs/workflows.js.map +0 -1
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js.map +0 -1
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +0 -1
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js +0 -16
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js.map +0 -1
- package/lib/esm/activities/chunkDocument.js.map +0 -1
- package/lib/esm/activities/createDocumentFromOther.js.map +0 -1
- package/lib/esm/activities/executeInteraction.js.map +0 -1
- package/lib/esm/activities/executeRemoteActivity.js.map +0 -1
- package/lib/esm/activities/extractDocumentText.js.map +0 -1
- package/lib/esm/activities/generateDocumentProperties.js.map +0 -1
- package/lib/esm/activities/generateEmbeddings.js.map +0 -1
- package/lib/esm/activities/generateOrAssignContentType.js.map +0 -1
- package/lib/esm/activities/getObjectFromStore.js.map +0 -1
- package/lib/esm/activities/handleError.js +0 -26
- package/lib/esm/activities/handleError.js.map +0 -1
- package/lib/esm/activities/index-dsl.js +0 -29
- package/lib/esm/activities/index-dsl.js.map +0 -1
- package/lib/esm/activities/index.js.map +0 -1
- package/lib/esm/activities/loadChildWorkflowSpec.js.map +0 -1
- package/lib/esm/activities/media/prepareAudio.js.map +0 -1
- package/lib/esm/activities/media/prepareVideo.js.map +0 -1
- package/lib/esm/activities/media/probeMediaStreams.js.map +0 -1
- package/lib/esm/activities/media/processPdfWithTextract.js.map +0 -1
- package/lib/esm/activities/media/saveGladiaTranscription.js.map +0 -1
- package/lib/esm/activities/media/transcribeMediaWithGladia.js.map +0 -1
- package/lib/esm/activities/mergeChildArtifacts.js.map +0 -1
- package/lib/esm/activities/notifyWebhook.js.map +0 -1
- package/lib/esm/activities/rateLimiter.js.map +0 -1
- package/lib/esm/activities/renditions/generateImageRendition.js +0 -63
- package/lib/esm/activities/renditions/generateImageRendition.js.map +0 -1
- package/lib/esm/activities/renditions/generateVideoRendition.js.map +0 -1
- package/lib/esm/activities/resolveRemoteActivities.js.map +0 -1
- package/lib/esm/activities/setDocumentStatus.js.map +0 -1
- package/lib/esm/bulk-import.js.map +0 -1
- package/lib/esm/conversion/TextractProcessor.js.map +0 -1
- package/lib/esm/conversion/image.js.map +0 -1
- package/lib/esm/conversion/markitdown.js.map +0 -1
- package/lib/esm/conversion/mutool.js.map +0 -1
- package/lib/esm/conversion/pandoc.js.map +0 -1
- package/lib/esm/dsl/conditions.js +0 -75
- package/lib/esm/dsl/conditions.js.map +0 -1
- package/lib/esm/dsl/dsl-workflow.js.map +0 -1
- package/lib/esm/dsl/dslProxyActivities.js.map +0 -1
- package/lib/esm/dsl/projections.js.map +0 -1
- package/lib/esm/dsl/setup/ActivityContext.js.map +0 -1
- package/lib/esm/dsl/setup/fetch/DataProvider.js.map +0 -1
- package/lib/esm/dsl/setup/fetch/index.js.map +0 -1
- package/lib/esm/dsl/setup/fetch/providers.js.map +0 -1
- package/lib/esm/dsl/test/test-child-workflow.js.map +0 -1
- package/lib/esm/dsl/validation.js.map +0 -1
- package/lib/esm/dsl/vars.js.map +0 -1
- package/lib/esm/dsl/walk.js.map +0 -1
- package/lib/esm/dsl.js +0 -4
- package/lib/esm/dsl.js.map +0 -1
- package/lib/esm/errors.js.map +0 -1
- package/lib/esm/index.js +0 -39
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/iterative-generation/activities/extractToc.js +0 -44
- package/lib/esm/iterative-generation/activities/extractToc.js.map +0 -1
- package/lib/esm/iterative-generation/activities/finalizeOutput.js +0 -69
- package/lib/esm/iterative-generation/activities/finalizeOutput.js.map +0 -1
- package/lib/esm/iterative-generation/activities/generatePart.js +0 -75
- package/lib/esm/iterative-generation/activities/generatePart.js.map +0 -1
- package/lib/esm/iterative-generation/activities/generateToc.js +0 -83
- package/lib/esm/iterative-generation/activities/generateToc.js.map +0 -1
- package/lib/esm/iterative-generation/activities/index.js +0 -5
- package/lib/esm/iterative-generation/activities/index.js.map +0 -1
- package/lib/esm/iterative-generation/iterativeGenerationWorkflow.js +0 -53
- package/lib/esm/iterative-generation/iterativeGenerationWorkflow.js.map +0 -1
- package/lib/esm/iterative-generation/types.js +0 -2
- package/lib/esm/iterative-generation/types.js.map +0 -1
- package/lib/esm/iterative-generation/utils.js +0 -112
- package/lib/esm/iterative-generation/utils.js.map +0 -1
- package/lib/esm/result-types.js.map +0 -1
- package/lib/esm/security/ssrf.js.map +0 -1
- package/lib/esm/system/notifyWebhookWorkflow.js.map +0 -1
- package/lib/esm/system/recalculateEmbeddingsWorkflow.js.map +0 -1
- package/lib/esm/utils/auth.js.map +0 -1
- package/lib/esm/utils/blobs.js.map +0 -1
- package/lib/esm/utils/chunks.js.map +0 -1
- package/lib/esm/utils/client.js +0 -27
- package/lib/esm/utils/client.js.map +0 -1
- package/lib/esm/utils/expand-vars.js.map +0 -1
- package/lib/esm/utils/memory.js +0 -55
- package/lib/esm/utils/memory.js.map +0 -1
- package/lib/esm/utils/renditions.js.map +0 -1
- package/lib/esm/utils/storage.js.map +0 -1
- package/lib/esm/utils/text-preview-utils.js.map +0 -1
- package/lib/esm/utils/tokens.js.map +0 -1
- package/lib/esm/vars.js +0 -4
- package/lib/esm/vars.js.map +0 -1
- package/lib/esm/workflows.js +0 -8
- package/lib/esm/workflows.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types/activities/advanced/createDocumentTypeFromInteractionRun.d.ts.map +0 -1
- package/lib/types/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts.map +0 -1
- package/lib/types/activities/advanced/updateDocumentFromInteractionRun.d.ts.map +0 -1
- package/lib/types/activities/chunkDocument.d.ts.map +0 -1
- package/lib/types/activities/createDocumentFromOther.d.ts.map +0 -1
- package/lib/types/activities/executeInteraction.d.ts.map +0 -1
- package/lib/types/activities/executeRemoteActivity.d.ts.map +0 -1
- package/lib/types/activities/extractDocumentText.d.ts.map +0 -1
- package/lib/types/activities/generateDocumentProperties.d.ts.map +0 -1
- package/lib/types/activities/generateEmbeddings.d.ts.map +0 -1
- package/lib/types/activities/generateOrAssignContentType.d.ts.map +0 -1
- package/lib/types/activities/getObjectFromStore.d.ts.map +0 -1
- package/lib/types/activities/handleError.d.ts.map +0 -1
- package/lib/types/activities/index-dsl.d.ts +0 -31
- package/lib/types/activities/index-dsl.d.ts.map +0 -1
- package/lib/types/activities/index.d.ts.map +0 -1
- package/lib/types/activities/loadChildWorkflowSpec.d.ts.map +0 -1
- package/lib/types/activities/media/prepareAudio.d.ts.map +0 -1
- package/lib/types/activities/media/prepareVideo.d.ts.map +0 -1
- package/lib/types/activities/media/probeMediaStreams.d.ts.map +0 -1
- package/lib/types/activities/media/processPdfWithTextract.d.ts.map +0 -1
- package/lib/types/activities/media/saveGladiaTranscription.d.ts.map +0 -1
- package/lib/types/activities/media/transcribeMediaWithGladia.d.ts.map +0 -1
- package/lib/types/activities/mergeChildArtifacts.d.ts.map +0 -1
- package/lib/types/activities/notifyWebhook.d.ts.map +0 -1
- package/lib/types/activities/rateLimiter.d.ts.map +0 -1
- package/lib/types/activities/renditions/generateImageRendition.d.ts.map +0 -1
- package/lib/types/activities/renditions/generateVideoRendition.d.ts.map +0 -1
- package/lib/types/activities/resolveRemoteActivities.d.ts.map +0 -1
- package/lib/types/activities/setDocumentStatus.d.ts.map +0 -1
- package/lib/types/bulk-import.d.ts.map +0 -1
- package/lib/types/conversion/TextractProcessor.d.ts.map +0 -1
- package/lib/types/conversion/image.d.ts.map +0 -1
- package/lib/types/conversion/markitdown.d.ts.map +0 -1
- package/lib/types/conversion/mutool.d.ts.map +0 -1
- package/lib/types/conversion/pandoc.d.ts.map +0 -1
- package/lib/types/dsl/conditions.d.ts +0 -2
- package/lib/types/dsl/conditions.d.ts.map +0 -1
- package/lib/types/dsl/dsl-workflow.d.ts.map +0 -1
- package/lib/types/dsl/dslProxyActivities.d.ts +0 -10
- package/lib/types/dsl/dslProxyActivities.d.ts.map +0 -1
- package/lib/types/dsl/projections.d.ts +0 -4
- package/lib/types/dsl/projections.d.ts.map +0 -1
- package/lib/types/dsl/setup/ActivityContext.d.ts.map +0 -1
- package/lib/types/dsl/setup/fetch/DataProvider.d.ts.map +0 -1
- package/lib/types/dsl/setup/fetch/index.d.ts +0 -6
- package/lib/types/dsl/setup/fetch/index.d.ts.map +0 -1
- package/lib/types/dsl/setup/fetch/providers.d.ts.map +0 -1
- package/lib/types/dsl/test/test-child-workflow.d.ts +0 -4
- package/lib/types/dsl/test/test-child-workflow.d.ts.map +0 -1
- package/lib/types/dsl/validation.d.ts.map +0 -1
- package/lib/types/dsl/vars.d.ts.map +0 -1
- package/lib/types/dsl/walk.d.ts +0 -18
- package/lib/types/dsl/walk.d.ts.map +0 -1
- package/lib/types/dsl.d.ts +0 -4
- package/lib/types/dsl.d.ts.map +0 -1
- package/lib/types/errors.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -38
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/extractToc.d.ts +0 -10
- package/lib/types/iterative-generation/activities/extractToc.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/finalizeOutput.d.ts +0 -3
- package/lib/types/iterative-generation/activities/finalizeOutput.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/generatePart.d.ts +0 -3
- package/lib/types/iterative-generation/activities/generatePart.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/generateToc.d.ts +0 -4
- package/lib/types/iterative-generation/activities/generateToc.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/index.d.ts +0 -5
- package/lib/types/iterative-generation/activities/index.d.ts.map +0 -1
- package/lib/types/iterative-generation/iterativeGenerationWorkflow.d.ts +0 -3
- package/lib/types/iterative-generation/iterativeGenerationWorkflow.d.ts.map +0 -1
- package/lib/types/iterative-generation/types.d.ts +0 -79
- package/lib/types/iterative-generation/types.d.ts.map +0 -1
- package/lib/types/iterative-generation/utils.d.ts +0 -26
- package/lib/types/iterative-generation/utils.d.ts.map +0 -1
- package/lib/types/result-types.d.ts.map +0 -1
- package/lib/types/security/ssrf.d.ts.map +0 -1
- package/lib/types/system/notifyWebhookWorkflow.d.ts +0 -8
- package/lib/types/system/notifyWebhookWorkflow.d.ts.map +0 -1
- package/lib/types/system/recalculateEmbeddingsWorkflow.d.ts.map +0 -1
- package/lib/types/utils/auth.d.ts.map +0 -1
- package/lib/types/utils/blobs.d.ts.map +0 -1
- package/lib/types/utils/chunks.d.ts.map +0 -1
- package/lib/types/utils/client.d.ts +0 -8
- package/lib/types/utils/client.d.ts.map +0 -1
- package/lib/types/utils/expand-vars.d.ts.map +0 -1
- package/lib/types/utils/memory.d.ts +0 -8
- package/lib/types/utils/memory.d.ts.map +0 -1
- package/lib/types/utils/renditions.d.ts.map +0 -1
- package/lib/types/utils/storage.d.ts.map +0 -1
- package/lib/types/utils/text-preview-utils.d.ts.map +0 -1
- package/lib/types/utils/tokens.d.ts.map +0 -1
- package/lib/types/vars.d.ts +0 -3
- package/lib/types/vars.d.ts.map +0 -1
- package/lib/types/workflows.d.ts +0 -8
- package/lib/types/workflows.d.ts.map +0 -1
- package/src/iterative-generation/activities/extractToc.ts +0 -63
- package/src/iterative-generation/activities/finalizeOutput.ts +0 -100
- package/src/iterative-generation/activities/generatePart.ts +0 -123
- package/src/iterative-generation/activities/generateToc.ts +0 -116
- package/src/iterative-generation/activities/index.ts +0 -4
- package/src/iterative-generation/iterativeGenerationWorkflow.ts +0 -68
- package/src/iterative-generation/types.ts +0 -99
- package/src/iterative-generation/utils.ts +0 -126
- package/src/utils/memory.ts +0 -61
- /package/lib/{esm/bulk-import.js → bulk-import.js} +0 -0
- /package/lib/{types/conversion → conversion}/image.d.ts +0 -0
- /package/lib/{types/conversion → conversion}/markitdown.d.ts +0 -0
- /package/lib/{types/conversion → conversion}/mutool.d.ts +0 -0
- /package/lib/{types/conversion → conversion}/pandoc.d.ts +0 -0
- /package/lib/{types/result-types.d.ts → result-types.d.ts} +0 -0
- /package/lib/{esm/result-types.js → result-types.js} +0 -0
- /package/lib/{types/security → security}/ssrf.d.ts +0 -0
- /package/lib/{esm/security → security}/ssrf.js +0 -0
- /package/lib/{esm/utils → utils}/auth.js +0 -0
- /package/lib/{types/utils → utils}/chunks.d.ts +0 -0
package/src/errors.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { ApplicationFailure } from
|
|
2
|
-
import { DSLActivitySpec, DSLWorkflowSpec } from
|
|
1
|
+
import { ApplicationFailure } from '@temporalio/workflow';
|
|
2
|
+
import type { DSLActivitySpec, DSLWorkflowSpec } from '@vertesia/common';
|
|
3
3
|
|
|
4
4
|
export class DocumentNotFoundError extends ApplicationFailure {
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(
|
|
6
|
+
message: string,
|
|
7
|
+
public ids?: string[],
|
|
8
|
+
) {
|
|
6
9
|
super(
|
|
7
10
|
message,
|
|
8
|
-
|
|
11
|
+
'DocumentNotFoundError',
|
|
9
12
|
true, // non-retryable
|
|
10
|
-
)
|
|
13
|
+
);
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
16
|
|
|
@@ -18,7 +21,7 @@ export class ActivityParamNotFoundError extends ApplicationFailure {
|
|
|
18
21
|
) {
|
|
19
22
|
super(
|
|
20
23
|
`Required parameter ${paramName} not found in activity ${activity.name}`,
|
|
21
|
-
|
|
24
|
+
'ActivityParamNotFoundError',
|
|
22
25
|
true, // non-retryable
|
|
23
26
|
);
|
|
24
27
|
}
|
|
@@ -31,8 +34,8 @@ export class ActivityParamInvalidError extends ApplicationFailure {
|
|
|
31
34
|
reason?: string,
|
|
32
35
|
) {
|
|
33
36
|
super(
|
|
34
|
-
`${paramName} in activity ${activity.name} is invalid${reason ? ` ${reason}` :
|
|
35
|
-
|
|
37
|
+
`${paramName} in activity ${activity.name} is invalid${reason ? ` ${reason}` : ''}`,
|
|
38
|
+
'ActivityParamInvalidError',
|
|
36
39
|
true, // non-retryable
|
|
37
40
|
);
|
|
38
41
|
}
|
|
@@ -45,7 +48,7 @@ export class WorkflowParamNotFoundError extends ApplicationFailure {
|
|
|
45
48
|
) {
|
|
46
49
|
super(
|
|
47
50
|
`Required parameter ${paramName} not found in workflow ${workflow?.name}`,
|
|
48
|
-
|
|
51
|
+
'WorkflowParamNotFoundError',
|
|
49
52
|
true, // non-retryable
|
|
50
53
|
);
|
|
51
54
|
}
|
|
@@ -57,8 +60,8 @@ export class ResourceExhaustedError extends ApplicationFailure {
|
|
|
57
60
|
message?: string,
|
|
58
61
|
) {
|
|
59
62
|
super(
|
|
60
|
-
message ||
|
|
61
|
-
|
|
63
|
+
message || 'Resource exhausted - rate limit exceeded',
|
|
64
|
+
'ResourceExhaustedError',
|
|
62
65
|
true, // non-retryable
|
|
63
66
|
);
|
|
64
67
|
}
|
|
@@ -72,7 +75,7 @@ export class InvalidContentTypeError extends ApplicationFailure {
|
|
|
72
75
|
) {
|
|
73
76
|
super(
|
|
74
77
|
`Document ${objectId} has invalid content type. Expected ${expectedType}, got ${actualType}`,
|
|
75
|
-
|
|
78
|
+
'InvalidContentTypeError',
|
|
76
79
|
true, // non-retryable
|
|
77
80
|
);
|
|
78
81
|
}
|
|
@@ -84,8 +87,8 @@ export class TokenExpiredError extends ApplicationFailure {
|
|
|
84
87
|
message?: string,
|
|
85
88
|
) {
|
|
86
89
|
super(
|
|
87
|
-
message ||
|
|
88
|
-
|
|
90
|
+
message || 'Token expired: Authentication required',
|
|
91
|
+
'TokenExpiredError',
|
|
89
92
|
true, // non-retryable
|
|
90
93
|
);
|
|
91
94
|
}
|
|
@@ -98,19 +101,24 @@ export class WorkflowExecutionError extends ApplicationFailure {
|
|
|
98
101
|
) {
|
|
99
102
|
super(
|
|
100
103
|
message,
|
|
101
|
-
|
|
104
|
+
'WorkflowExecutionError',
|
|
102
105
|
true, // non-retryable
|
|
103
106
|
);
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
export const WF_NON_RETRYABLE_ERRORS = [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
'DocumentNotFoundError',
|
|
112
|
+
'ActivityParamInvalidError',
|
|
113
|
+
'ActivityParamNotFoundError',
|
|
114
|
+
'WorkflowParamNotFoundError',
|
|
115
|
+
'InvalidContentTypeError',
|
|
116
|
+
'TokenExpiredError',
|
|
117
|
+
'ZenoClientNotFoundError',
|
|
118
|
+
'WorkflowExecutionError',
|
|
119
|
+
// Temporal raises NotFoundError when an activity isn't registered on the worker
|
|
120
|
+
// (e.g. a new tool whose activity barrel export was missed). Retrying can never
|
|
121
|
+
// make it appear within a worker version, and the retried failure carries the
|
|
122
|
+
// full activity list which blows the payload size limit — so fail fast.
|
|
123
|
+
'NotFoundError',
|
|
116
124
|
];
|
package/src/index.ts
CHANGED
|
@@ -6,37 +6,32 @@
|
|
|
6
6
|
* 3. Here we export the API to be used to validate workflows and the types required to create workflow TS definitions.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
export * from './activities/advanced/createDocumentTypeFromInteractionRun.js';
|
|
10
|
+
export * from './activities/advanced/createOrUpdateDocumentFromInteractionRun.js';
|
|
11
|
+
export * from './activities/advanced/updateDocumentFromInteractionRun.js';
|
|
12
|
+
export * from './activities/chunkDocument.js';
|
|
13
|
+
export * from './activities/executeInteraction.js';
|
|
14
|
+
export * from './activities/extractDocumentText.js';
|
|
15
|
+
export * from './activities/generateDocumentProperties.js';
|
|
16
|
+
export * from './activities/generateEmbeddings.js';
|
|
17
|
+
export * from './activities/generateOrAssignContentType.js';
|
|
18
|
+
export * from './activities/media/prepareAudio.js';
|
|
19
|
+
export * from './activities/media/prepareVideo.js';
|
|
20
|
+
export * from './activities/notifyWebhook.js';
|
|
21
|
+
export * from './activities/rateLimiter.js';
|
|
22
|
+
export * from './activities/renditions/generateImageRendition.js';
|
|
23
|
+
export * from './activities/renditions/generateVideoRendition.js';
|
|
24
|
+
export * from './activities/setDocumentStatus.js';
|
|
25
|
+
export * from './conversion/image.js';
|
|
9
26
|
//TODO remove this - it is only for backward compat - iot is used from old workflows
|
|
10
|
-
export { dslWorkflow } from
|
|
11
|
-
export * from
|
|
12
|
-
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from "./activities/generateOrAssignContentType.js";
|
|
22
|
-
export * from "./activities/media/prepareAudio.js";
|
|
23
|
-
export * from "./activities/media/prepareVideo.js";
|
|
24
|
-
export * from "./activities/notifyWebhook.js";
|
|
25
|
-
export * from "./activities/rateLimiter.js";
|
|
26
|
-
export * from "./activities/renditions/generateImageRendition.js";
|
|
27
|
-
export * from "./activities/renditions/generateVideoRendition.js";
|
|
28
|
-
export * from "./activities/setDocumentStatus.js";
|
|
29
|
-
export * from "./iterative-generation/activities/index.js";
|
|
30
|
-
|
|
31
|
-
export * from "./dsl/setup/ActivityContext.js";
|
|
32
|
-
export * from "./errors.js";
|
|
33
|
-
export * from "./result-types.js";
|
|
34
|
-
export * from "./utils/blobs.js";
|
|
35
|
-
export * from "./utils/client.js";
|
|
36
|
-
export * from "./utils/memory.js";
|
|
37
|
-
export * from "./utils/renditions.js";
|
|
38
|
-
export * from "./utils/storage.js";
|
|
39
|
-
export * from "./utils/text-preview-utils.js";
|
|
40
|
-
export * from "./utils/tokens.js";
|
|
41
|
-
|
|
42
|
-
export * from "./conversion/image.js";
|
|
27
|
+
export { dslWorkflow } from './dsl/dsl-workflow.js';
|
|
28
|
+
export * from './dsl/setup/ActivityContext.js';
|
|
29
|
+
export * from './errors.js';
|
|
30
|
+
export * from './result-types.js';
|
|
31
|
+
export * from './utils/activity-info.js';
|
|
32
|
+
export * from './utils/blobs.js';
|
|
33
|
+
export * from './utils/client.js';
|
|
34
|
+
export * from './utils/renditions.js';
|
|
35
|
+
export * from './utils/storage.js';
|
|
36
|
+
export * from './utils/text-preview-utils.js';
|
|
37
|
+
export * from './utils/tokens.js';
|
package/src/result-types.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* The result of a text extraction operation.
|
|
6
3
|
*/
|
|
7
4
|
export interface TextExtractionResult {
|
|
8
5
|
objectId?: string;
|
|
9
|
-
file?: {
|
|
6
|
+
file?: {
|
|
10
7
|
source_url: string;
|
|
11
8
|
result_url?: string;
|
|
12
|
-
}
|
|
9
|
+
};
|
|
13
10
|
status: TextExtractionStatus;
|
|
14
11
|
hasText: boolean;
|
|
15
12
|
message?: string;
|
|
@@ -23,7 +20,7 @@ export interface TextExtractionResult {
|
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
export enum TextExtractionStatus {
|
|
26
|
-
skipped =
|
|
27
|
-
success =
|
|
28
|
-
error =
|
|
29
|
-
}
|
|
23
|
+
skipped = 'skipped',
|
|
24
|
+
success = 'success',
|
|
25
|
+
error = 'error',
|
|
26
|
+
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
+
import { log, workflowInfo } from '@temporalio/workflow';
|
|
2
|
+
import type { WebHookSpec, WorkflowExecutionPayload } from '@vertesia/common';
|
|
3
|
+
import type * as activities from '../activities/notifyWebhook.js';
|
|
4
|
+
import { dslProxyActivities } from '../dsl/dslProxyActivities.js';
|
|
5
|
+
import { WF_NON_RETRYABLE_ERRORS } from '../errors.js';
|
|
1
6
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import * as activities from "../activities/notifyWebhook.js";
|
|
5
|
-
import { dslProxyActivities } from "../dsl/dslProxyActivities.js";
|
|
6
|
-
import { WF_NON_RETRYABLE_ERRORS } from "../errors.js";
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
notifyWebhook
|
|
10
|
-
} = dslProxyActivities<typeof activities>("notifyWebhookWorkflow", {
|
|
11
|
-
startToCloseTimeout: "5 minute",
|
|
7
|
+
const { notifyWebhook } = dslProxyActivities<typeof activities>('notifyWebhookWorkflow', {
|
|
8
|
+
startToCloseTimeout: '5 minute',
|
|
12
9
|
retry: {
|
|
13
10
|
initialInterval: '5s',
|
|
14
11
|
backoffCoefficient: 2,
|
|
@@ -20,18 +17,22 @@ const {
|
|
|
20
17
|
|
|
21
18
|
export interface NotifyWebhookWorfklowParams {
|
|
22
19
|
workflow_type: string;
|
|
23
|
-
endpoints: (string | WebHookSpec)[]
|
|
24
|
-
data: Record<string,
|
|
20
|
+
endpoints: (string | WebHookSpec)[];
|
|
21
|
+
data: Record<string, unknown>;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
export async function notifyWebhookWorkflow(
|
|
25
|
+
payload: WorkflowExecutionPayload<NotifyWebhookWorfklowParams>,
|
|
26
|
+
): Promise<unknown> {
|
|
30
27
|
const info = workflowInfo();
|
|
31
28
|
const { objectIds, vars } = payload;
|
|
32
29
|
const notifications = [];
|
|
33
|
-
const
|
|
34
|
-
|
|
30
|
+
const legacyVars = vars as NotifyWebhookWorfklowParams & {
|
|
31
|
+
webhooks?: (string | WebHookSpec)[];
|
|
32
|
+
webhook_data?: Record<string, unknown>;
|
|
33
|
+
};
|
|
34
|
+
const endpoints = legacyVars.endpoints ?? legacyVars.webhooks ?? [];
|
|
35
|
+
const data = legacyVars.data ?? legacyVars.webhook_data ?? undefined;
|
|
35
36
|
const workflow_type = vars.workflow_type ?? info.workflowType;
|
|
36
37
|
const eventName = payload.event;
|
|
37
38
|
|
|
@@ -40,7 +41,7 @@ export async function notifyWebhookWorkflow(payload: WorkflowExecutionPayload<No
|
|
|
40
41
|
|
|
41
42
|
if (!endpoints.length) {
|
|
42
43
|
log.info(`No webhooks to notify`);
|
|
43
|
-
return { notifications: [], message:
|
|
44
|
+
return { notifications: [], message: 'No webhooks to notify' };
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
for (const ep of endpoints) {
|
|
@@ -53,9 +54,9 @@ export async function notifyWebhookWorkflow(payload: WorkflowExecutionPayload<No
|
|
|
53
54
|
event_name: eventName,
|
|
54
55
|
detail: {
|
|
55
56
|
object_ids: objectIds,
|
|
56
|
-
data
|
|
57
|
-
}
|
|
58
|
-
}).then(res => {
|
|
57
|
+
data,
|
|
58
|
+
},
|
|
59
|
+
}).then((res) => {
|
|
59
60
|
log.info(`Webhook notified at ${ep} with response code: ${res.status}`, { res });
|
|
60
61
|
return res;
|
|
61
62
|
});
|
|
@@ -65,6 +66,5 @@ export async function notifyWebhookWorkflow(payload: WorkflowExecutionPayload<No
|
|
|
65
66
|
const res = await Promise.all(notifications);
|
|
66
67
|
log.info(`Webhooks notified`);
|
|
67
68
|
|
|
68
|
-
return { notifications: res, message:
|
|
69
|
-
|
|
69
|
+
return { notifications: res, message: 'Webhooks notified' };
|
|
70
70
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { SupportedEmbeddingTypes, type WorkflowExecutionPayload } from '@vertesia/common';
|
|
2
|
+
import type * as activities from '../activities/index-dsl.js';
|
|
3
|
+
import { dslProxyActivities } from '../dsl/dslProxyActivities.js';
|
|
4
|
+
import { WF_NON_RETRYABLE_ERRORS } from '../errors.js';
|
|
1
5
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { dslProxyActivities } from "../dsl/dslProxyActivities.js";
|
|
5
|
-
import { WF_NON_RETRYABLE_ERRORS } from "../errors.js";
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
generateEmbeddings,
|
|
9
|
-
} = dslProxyActivities<typeof activities>("recalculateEmbeddingsWorkflow", {
|
|
10
|
-
startToCloseTimeout: "5 minute",
|
|
6
|
+
const { generateEmbeddings } = dslProxyActivities<typeof activities>('recalculateEmbeddingsWorkflow', {
|
|
7
|
+
startToCloseTimeout: '5 minute',
|
|
11
8
|
retry: {
|
|
12
9
|
initialInterval: '10s',
|
|
13
10
|
backoffCoefficient: 2,
|
|
@@ -18,24 +15,24 @@ const {
|
|
|
18
15
|
});
|
|
19
16
|
|
|
20
17
|
export async function recalculateEmbeddingsWorkflow(payload: WorkflowExecutionPayload) {
|
|
21
|
-
|
|
22
18
|
const embeddings = [];
|
|
23
19
|
const payloadType = payload.vars?.type as SupportedEmbeddingTypes;
|
|
24
20
|
|
|
25
21
|
if (payloadType && !Object.values(SupportedEmbeddingTypes).includes(payloadType)) {
|
|
26
|
-
throw new Error(
|
|
22
|
+
throw new Error('Embedding type must be text, image, or properties');
|
|
27
23
|
}
|
|
28
24
|
const types = payloadType ? [payloadType] : Object.values(SupportedEmbeddingTypes);
|
|
29
25
|
|
|
30
26
|
for (const type of types) {
|
|
31
|
-
embeddings.push(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
embeddings.push(
|
|
28
|
+
generateEmbeddings(payload, {
|
|
29
|
+
force: true,
|
|
30
|
+
type,
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
const res = await Promise.all(embeddings);
|
|
38
36
|
|
|
39
37
|
return res;
|
|
40
|
-
|
|
41
|
-
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { activityInfo, type Info } from '@temporalio/activity';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Temporal SDK 1.17 changed {@link Info.workflowExecution} to be optional.
|
|
5
|
+
* Inside an activity it is always populated, so this asserts its presence and
|
|
6
|
+
* returns it, letting callers read `runId` / `workflowId` without unsafe access
|
|
7
|
+
* on a possibly-undefined value.
|
|
8
|
+
*/
|
|
9
|
+
export function activityWorkflowExecution(info: Info = activityInfo()) {
|
|
10
|
+
const execution = info.workflowExecution;
|
|
11
|
+
if (!execution) {
|
|
12
|
+
throw new Error('Activity is running without workflowExecution info');
|
|
13
|
+
}
|
|
14
|
+
return execution;
|
|
15
|
+
}
|
package/src/utils/auth.ts
CHANGED
package/src/utils/blobs.ts
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import tmp from
|
|
7
|
-
import { DocumentNotFoundError } from
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import { createWriteStream } from 'node:fs';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
4
|
+
import { pipeline } from 'node:stream/promises';
|
|
5
|
+
import type { VertesiaClient } from '@vertesia/client';
|
|
6
|
+
import tmp from 'tmp';
|
|
7
|
+
import { DocumentNotFoundError } from '../errors.js';
|
|
8
8
|
|
|
9
9
|
tmp.setGracefulCleanup();
|
|
10
10
|
|
|
11
11
|
export async function fetchBlobAsStream(client: VertesiaClient, blobUri: string): Promise<ReadableStream<Uint8Array>> {
|
|
12
12
|
try {
|
|
13
13
|
return await client.files.downloadFile(blobUri);
|
|
14
|
-
} catch (err:
|
|
15
|
-
|
|
14
|
+
} catch (err: unknown) {
|
|
15
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
16
|
+
if (message.includes('not found')) {
|
|
16
17
|
//TODO improve error handling with a fetch fail error class in the client
|
|
17
|
-
throw new DocumentNotFoundError(`Not found at ${blobUri}: ${
|
|
18
|
-
} else if (
|
|
19
|
-
throw new DocumentNotFoundError(`Forbidden at ${blobUri}: ${
|
|
18
|
+
throw new DocumentNotFoundError(`Not found at ${blobUri}: ${message}`, []);
|
|
19
|
+
} else if (message.includes('forbidden')) {
|
|
20
|
+
throw new DocumentNotFoundError(`Forbidden at ${blobUri}: ${message}`);
|
|
20
21
|
} else {
|
|
21
|
-
throw new Error(`Failed to download blob ${blobUri}: ${
|
|
22
|
+
throw new Error(`Failed to download blob ${blobUri}: ${message}`);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
export async function fetchBlobAsBuffer(client: VertesiaClient, blobUri: string): Promise<Buffer> {
|
|
26
|
-
|
|
27
|
+
const stream = await fetchBlobAsStream(client, blobUri);
|
|
27
28
|
const buffers: Uint8Array[] = [];
|
|
28
29
|
for await (const data of stream) {
|
|
29
30
|
buffers.push(data);
|
|
@@ -33,7 +34,7 @@ export async function fetchBlobAsBuffer(client: VertesiaClient, blobUri: string)
|
|
|
33
34
|
|
|
34
35
|
export async function fetchBlobAsBase64(client: VertesiaClient, blobUri: string): Promise<string> {
|
|
35
36
|
const buffer = await fetchBlobAsBuffer(client, blobUri);
|
|
36
|
-
return buffer.toString(
|
|
37
|
+
return buffer.toString('base64');
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
async function saveBlobToFile(client: VertesiaClient, blobUri: string, toFile: string): Promise<void> {
|
|
@@ -47,13 +48,13 @@ async function saveBlobToFile(client: VertesiaClient, blobUri: string, toFile: s
|
|
|
47
48
|
|
|
48
49
|
export async function saveBlobToTempFile(client: VertesiaClient, blobUri: string, fileExt?: string): Promise<string> {
|
|
49
50
|
const tmpFile = tmp.fileSync({
|
|
50
|
-
prefix:
|
|
51
|
-
postfix: fileExt ?
|
|
51
|
+
prefix: 'vertesia-activity-',
|
|
52
|
+
postfix: fileExt ? `.${fileExt}` : '',
|
|
52
53
|
});
|
|
53
54
|
await saveBlobToFile(client, blobUri, tmpFile.name);
|
|
54
55
|
return tmpFile.name;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
export function md5(contents: string) {
|
|
58
|
-
return crypto.createHash(
|
|
59
|
+
return crypto.createHash('md5').update(contents).digest('hex');
|
|
59
60
|
}
|
package/src/utils/chunks.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
1
|
export interface DocPart {
|
|
3
|
-
line_number_start: number
|
|
4
|
-
line_number_end: number
|
|
5
|
-
name: string
|
|
6
|
-
type: string
|
|
2
|
+
line_number_start: number;
|
|
3
|
+
line_number_end: number;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
export const getContentPart = (content: string, part: DocPart): string => {
|
|
10
9
|
const lines = content.split('\n');
|
|
11
10
|
const text = lines.filter((_l, i) => i >= part.line_number_start && i <= part.line_number_end).join('\n');
|
|
12
11
|
return text;
|
|
13
|
-
}
|
|
12
|
+
};
|
|
14
13
|
|
|
15
14
|
export const getContentParts = (content: string, parts: DocPart[]): string[] => {
|
|
16
|
-
return parts.map(part => getContentPart(content, part));
|
|
17
|
-
}
|
|
15
|
+
return parts.map((part) => getContentPart(content, part));
|
|
16
|
+
};
|
package/src/utils/client.ts
CHANGED
|
@@ -2,36 +2,35 @@
|
|
|
2
2
|
* get a zeno client for a given token
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import type { FETCH_FN } from '@vertesia/api-fetch-client';
|
|
6
|
+
import { decodeJWT, VertesiaClient, type VertesiaClientProps } from '@vertesia/client';
|
|
7
|
+
import type { WorkflowExecutionBaseParams } from '@vertesia/common';
|
|
8
|
+
import { Agent } from 'undici';
|
|
9
|
+
import { WorkflowParamNotFoundError } from '../errors.js';
|
|
10
|
+
|
|
11
|
+
const DEFAULT_WORKFLOW_FETCH_TIMEOUT_MS = 30 * 60 * 1000;
|
|
12
|
+
const WORKFLOW_FETCH_TIMEOUT_ENV = 'VERTESIA_WORKFLOW_FETCH_TIMEOUT_MS';
|
|
13
|
+
|
|
14
|
+
let workflowFetch: Promise<FETCH_FN> | undefined;
|
|
15
|
+
|
|
16
|
+
export function getVertesiaClient(payload: WorkflowExecutionBaseParams<unknown>) {
|
|
14
17
|
return new VertesiaClient(getVertesiaClientOptions(payload));
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
export function getVertesiaClientOptions(
|
|
18
|
-
payload: WorkflowExecutionBaseParams,
|
|
19
|
-
): VertesiaClientProps {
|
|
20
|
+
export function getVertesiaClientOptions(payload: WorkflowExecutionBaseParams<unknown>): VertesiaClientProps {
|
|
20
21
|
if (!payload.auth_token) {
|
|
21
|
-
throw new WorkflowParamNotFoundError(
|
|
22
|
-
"Authentication Token is missing from WorkflowExecutionPayload.authToken",
|
|
23
|
-
);
|
|
22
|
+
throw new WorkflowParamNotFoundError('Authentication Token is missing from WorkflowExecutionPayload.authToken');
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
if (!payload.config?.studio_url) {
|
|
27
26
|
throw new WorkflowParamNotFoundError(
|
|
28
|
-
|
|
27
|
+
'Content Store URL is missing from WorkflowExecutionPayload.servers.storeUrl',
|
|
29
28
|
);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
if (!payload.config?.store_url) {
|
|
33
32
|
throw new WorkflowParamNotFoundError(
|
|
34
|
-
|
|
33
|
+
'Content Store URL is missing from WorkflowExecutionPayload.servers.storeUrl',
|
|
35
34
|
);
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -42,5 +41,46 @@ export function getVertesiaClientOptions(
|
|
|
42
41
|
storeUrl: payload.config.store_url,
|
|
43
42
|
tokenServerUrl: token.iss,
|
|
44
43
|
apikey: payload.auth_token,
|
|
44
|
+
fetch: getWorkflowFetch(),
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
function getWorkflowFetch(): Promise<FETCH_FN> {
|
|
49
|
+
workflowFetch ??= createWorkflowFetch();
|
|
50
|
+
return workflowFetch;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function createWorkflowFetch(): Promise<FETCH_FN> {
|
|
54
|
+
if (typeof globalThis.fetch !== 'function') {
|
|
55
|
+
throw new Error('No Fetch implementation found');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const timeoutMs = parseWorkflowFetchTimeoutMs();
|
|
59
|
+
if (timeoutMs === 0) {
|
|
60
|
+
return globalThis.fetch.bind(globalThis);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const dispatcher = new Agent({
|
|
64
|
+
headersTimeout: timeoutMs,
|
|
65
|
+
bodyTimeout: timeoutMs,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return (input, init) =>
|
|
69
|
+
globalThis.fetch(input, {
|
|
70
|
+
...init,
|
|
71
|
+
dispatcher,
|
|
72
|
+
} as unknown as RequestInit);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function parseWorkflowFetchTimeoutMs(): number {
|
|
76
|
+
const raw = process.env[WORKFLOW_FETCH_TIMEOUT_ENV];
|
|
77
|
+
if (!raw) {
|
|
78
|
+
return DEFAULT_WORKFLOW_FETCH_TIMEOUT_MS;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const parsed = Number.parseInt(raw, 10);
|
|
82
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
83
|
+
return DEFAULT_WORKFLOW_FETCH_TIMEOUT_MS;
|
|
84
|
+
}
|
|
85
|
+
return parsed;
|
|
86
|
+
}
|
package/src/utils/expand-vars.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
const VARS_RX = /\${\s*([^}]+)\s*}/g;
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -7,7 +6,7 @@ const VARS_RX = /\${\s*([^}]+)\s*}/g;
|
|
|
7
6
|
* @param expr
|
|
8
7
|
* @param vars
|
|
9
8
|
*/
|
|
10
|
-
export function expandVars(expr: string, vars: Record<string,
|
|
9
|
+
export function expandVars(expr: string, vars: Record<string, unknown>) {
|
|
11
10
|
return expr.replace(VARS_RX, (_: string, name: string) => {
|
|
12
11
|
const path = name.split('.');
|
|
13
12
|
const value = resolveProp(vars, path);
|
|
@@ -19,13 +18,17 @@ export function expandVars(expr: string, vars: Record<string, any>) {
|
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
function
|
|
23
|
-
|
|
21
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
22
|
+
return !!value && typeof value === 'object';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function resolveProp(object: Record<string, unknown>, path: string[]) {
|
|
26
|
+
let value: unknown = object;
|
|
24
27
|
for (const part of path) {
|
|
25
|
-
if (value
|
|
28
|
+
if (!isRecord(value)) {
|
|
26
29
|
return undefined;
|
|
27
30
|
}
|
|
28
31
|
value = value[part];
|
|
29
32
|
}
|
|
30
33
|
return value;
|
|
31
|
-
}
|
|
34
|
+
}
|