@vertesia/common 1.5.0-dev.20260807.073259Z → 1.5.0-dev.20260901.005903Z
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/lib/access-control.d.ts +0 -14
- package/lib/access-control.d.ts.map +1 -1
- package/lib/access-control.js +0 -23
- package/lib/access-control.js.map +1 -1
- package/lib/account-values.d.ts +0 -10
- package/lib/account-values.d.ts.map +1 -1
- package/lib/account-values.js +0 -44
- package/lib/account-values.js.map +1 -1
- package/lib/api-contract/components.generated.json +40405 -0
- package/lib/api-contract/index.d.ts +186 -0
- package/lib/api-contract/index.d.ts.map +1 -0
- package/lib/api-contract/index.js +554 -0
- package/lib/api-contract/index.js.map +1 -0
- package/lib/api-schemas/agent-communication.d.ts +199 -0
- package/lib/api-schemas/agent-communication.d.ts.map +1 -0
- package/lib/api-schemas/agent-communication.js +150 -0
- package/lib/api-schemas/agent-communication.js.map +1 -0
- package/lib/api-schemas/agent-runs.d.ts +593 -0
- package/lib/api-schemas/agent-runs.d.ts.map +1 -1
- package/lib/api-schemas/agent-runs.js +44 -2
- package/lib/api-schemas/agent-runs.js.map +1 -1
- package/lib/api-schemas/app-lifecycle.d.ts +19 -0
- package/lib/api-schemas/app-lifecycle.d.ts.map +1 -1
- package/lib/api-schemas/app-lifecycle.js +34 -4
- package/lib/api-schemas/app-lifecycle.js.map +1 -1
- package/lib/api-schemas/app-runtime.d.ts +9871 -9257
- package/lib/api-schemas/app-runtime.d.ts.map +1 -1
- package/lib/api-schemas/app-runtime.js +7 -0
- package/lib/api-schemas/app-runtime.js.map +1 -1
- package/lib/api-schemas/apps.d.ts +1 -0
- package/lib/api-schemas/apps.d.ts.map +1 -1
- package/lib/api-schemas/apps.js +4 -3
- package/lib/api-schemas/apps.js.map +1 -1
- package/lib/api-schemas/content-query.d.ts +39 -0
- package/lib/api-schemas/content-query.d.ts.map +1 -0
- package/lib/api-schemas/content-query.js +30 -0
- package/lib/api-schemas/content-query.js.map +1 -0
- package/lib/api-schemas/content.d.ts +835 -29
- package/lib/api-schemas/content.d.ts.map +1 -1
- package/lib/api-schemas/content.js +82 -15
- package/lib/api-schemas/content.js.map +1 -1
- package/lib/api-schemas/dashboard.d.ts +4 -0
- package/lib/api-schemas/dashboard.d.ts.map +1 -1
- package/lib/api-schemas/dashboard.js +3 -0
- package/lib/api-schemas/dashboard.js.map +1 -1
- package/lib/api-schemas/document-processing.d.ts +333 -0
- package/lib/api-schemas/document-processing.d.ts.map +1 -1
- package/lib/api-schemas/events.d.ts +1007 -4
- package/lib/api-schemas/events.d.ts.map +1 -1
- package/lib/api-schemas/events.js +4 -1
- package/lib/api-schemas/events.js.map +1 -1
- package/lib/api-schemas/files.d.ts +17 -0
- package/lib/api-schemas/files.d.ts.map +1 -1
- package/lib/api-schemas/files.js +23 -0
- package/lib/api-schemas/files.js.map +1 -1
- package/lib/api-schemas/group.d.ts +7 -0
- package/lib/api-schemas/group.d.ts.map +1 -1
- package/lib/api-schemas/group.js +9 -0
- package/lib/api-schemas/group.js.map +1 -1
- package/lib/api-schemas/index.d.ts +4 -0
- package/lib/api-schemas/index.d.ts.map +1 -1
- package/lib/api-schemas/index.js +4 -0
- package/lib/api-schemas/index.js.map +1 -1
- package/lib/api-schemas/integrations.d.ts +19 -5
- package/lib/api-schemas/integrations.d.ts.map +1 -1
- package/lib/api-schemas/integrations.js +25 -2
- package/lib/api-schemas/integrations.js.map +1 -1
- package/lib/api-schemas/interaction.d.ts +8399 -1076
- package/lib/api-schemas/interaction.d.ts.map +1 -1
- package/lib/api-schemas/interaction.js +161 -9
- package/lib/api-schemas/interaction.js.map +1 -1
- package/lib/api-schemas/oauth-server.d.ts +131 -3
- package/lib/api-schemas/oauth-server.d.ts.map +1 -1
- package/lib/api-schemas/oauth-server.js +137 -3
- package/lib/api-schemas/oauth-server.js.map +1 -1
- package/lib/api-schemas/process.d.ts +1295 -0
- package/lib/api-schemas/process.d.ts.map +1 -1
- package/lib/api-schemas/process.js +318 -2
- package/lib/api-schemas/process.js.map +1 -1
- package/lib/api-schemas/project-configuration.d.ts +1118 -1
- package/lib/api-schemas/project-configuration.d.ts.map +1 -1
- package/lib/api-schemas/project-configuration.js +6 -2
- package/lib/api-schemas/project-configuration.js.map +1 -1
- package/lib/api-schemas/project.d.ts +1680 -6
- package/lib/api-schemas/project.d.ts.map +1 -1
- package/lib/api-schemas/registry.d.ts +87529 -69142
- package/lib/api-schemas/registry.d.ts.map +1 -1
- package/lib/api-schemas/registry.js +234 -413
- package/lib/api-schemas/registry.js.map +1 -1
- package/lib/api-schemas/schema-primitives.d.ts +4 -0
- package/lib/api-schemas/schema-primitives.d.ts.map +1 -1
- package/lib/api-schemas/schema-primitives.js +10 -0
- package/lib/api-schemas/schema-primitives.js.map +1 -1
- package/lib/api-schemas/store.d.ts +5596 -37
- package/lib/api-schemas/store.d.ts.map +1 -1
- package/lib/api-schemas/store.js +53 -8
- package/lib/api-schemas/store.js.map +1 -1
- package/lib/api-schemas/tools.d.ts +115 -0
- package/lib/api-schemas/tools.d.ts.map +1 -1
- package/lib/api-schemas/tools.js +55 -0
- package/lib/api-schemas/tools.js.map +1 -1
- package/lib/api-schemas/view-execution.d.ts +330 -854
- package/lib/api-schemas/view-execution.d.ts.map +1 -1
- package/lib/api-schemas/view-execution.js +26 -2
- package/lib/api-schemas/view-execution.js.map +1 -1
- package/lib/api-schemas/views.d.ts +452 -2562
- package/lib/api-schemas/views.d.ts.map +1 -1
- package/lib/api-schemas/views.js +119 -3
- package/lib/api-schemas/views.js.map +1 -1
- package/lib/api-schemas/workflow-runs.d.ts +344 -5
- package/lib/api-schemas/workflow-runs.d.ts.map +1 -1
- package/lib/api-schemas/workflow-runs.js +9 -7
- package/lib/api-schemas/workflow-runs.js.map +1 -1
- package/lib/apps.d.ts +8 -145
- package/lib/apps.d.ts.map +1 -1
- package/lib/apps.js +1 -54
- package/lib/apps.js.map +1 -1
- package/lib/ask-user.d.ts +2 -1
- package/lib/ask-user.d.ts.map +1 -1
- package/lib/audit-trail.d.ts +2 -2
- package/lib/audit-trail.d.ts.map +1 -1
- package/lib/audit-trail.js +2 -2
- package/lib/audit-trail.js.map +1 -1
- package/lib/browser-credentials.d.ts +2 -7
- package/lib/browser-credentials.d.ts.map +1 -1
- package/lib/common.d.ts +4 -1
- package/lib/common.d.ts.map +1 -1
- package/lib/content-query.d.ts +5 -0
- package/lib/content-query.d.ts.map +1 -0
- package/lib/content-query.js +2 -0
- package/lib/content-query.js.map +1 -0
- package/lib/data-platform.d.ts +4 -46
- package/lib/data-platform.d.ts.map +1 -1
- package/lib/data-platform.js.map +1 -1
- package/lib/email.d.ts +12 -18
- package/lib/email.d.ts.map +1 -1
- package/lib/email.js.map +1 -1
- package/lib/environment.d.ts +0 -10
- package/lib/environment.d.ts.map +1 -1
- package/lib/environment.js +1 -12
- package/lib/environment.js.map +1 -1
- package/lib/facets.d.ts +0 -4
- package/lib/facets.d.ts.map +1 -1
- package/lib/group.d.ts +2 -12
- package/lib/group.d.ts.map +1 -1
- package/lib/group.js.map +1 -1
- package/lib/index.d.ts +3 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -10
- package/lib/index.js.map +1 -1
- package/lib/integrations.d.ts +1 -27
- package/lib/integrations.d.ts.map +1 -1
- package/lib/integrations.js +0 -6
- package/lib/integrations.js.map +1 -1
- package/lib/interaction.d.ts +10 -222
- package/lib/interaction.d.ts.map +1 -1
- package/lib/interaction.js +0 -31
- package/lib/interaction.js.map +1 -1
- package/lib/meters.d.ts +5 -10
- package/lib/meters.d.ts.map +1 -1
- package/lib/meters.js +1 -9
- package/lib/meters.js.map +1 -1
- package/lib/oauth-scopes.d.ts +2 -16
- package/lib/oauth-scopes.d.ts.map +1 -1
- package/lib/oauth-scopes.js +9 -49
- package/lib/oauth-scopes.js.map +1 -1
- package/lib/oauth-server.d.ts +16 -195
- package/lib/oauth-server.d.ts.map +1 -1
- package/lib/payload.d.ts +2 -5
- package/lib/payload.d.ts.map +1 -1
- package/lib/pending-asks.d.ts +9 -41
- package/lib/pending-asks.d.ts.map +1 -1
- package/lib/platform-event.d.ts +4 -142
- package/lib/platform-event.d.ts.map +1 -1
- package/lib/platform-event.js.map +1 -1
- package/lib/project.d.ts +7 -46
- package/lib/project.d.ts.map +1 -1
- package/lib/project.js +2 -132
- package/lib/project.js.map +1 -1
- package/lib/prompt.d.ts +4 -7
- package/lib/prompt.d.ts.map +1 -1
- package/lib/prompt.js.map +1 -1
- package/lib/query.d.ts +0 -8
- package/lib/query.d.ts.map +1 -1
- package/lib/rate-limiter.d.ts +4 -3
- package/lib/rate-limiter.d.ts.map +1 -1
- package/lib/runs.d.ts +5 -1
- package/lib/runs.d.ts.map +1 -1
- package/lib/schema-for-extraction.d.ts +0 -1
- package/lib/schema-for-extraction.d.ts.map +1 -1
- package/lib/schema-for-extraction.js +1 -1
- package/lib/schema-for-extraction.js.map +1 -1
- package/lib/secrets.d.ts +2 -1
- package/lib/secrets.d.ts.map +1 -1
- package/lib/skill.d.ts +0 -13
- package/lib/skill.d.ts.map +1 -1
- package/lib/store/activity-catalog.d.ts +2 -0
- package/lib/store/activity-catalog.d.ts.map +1 -1
- package/lib/store/agent-approval.d.ts +0 -1
- package/lib/store/agent-approval.d.ts.map +1 -1
- package/lib/store/agent-approval.js +0 -3
- package/lib/store/agent-approval.js.map +1 -1
- package/lib/store/agent-run.d.ts +32 -69
- package/lib/store/agent-run.d.ts.map +1 -1
- package/lib/store/collections.d.ts +2 -6
- package/lib/store/collections.d.ts.map +1 -1
- package/lib/store/collections.js.map +1 -1
- package/lib/store/conversation-state.d.ts +11 -12
- package/lib/store/conversation-state.d.ts.map +1 -1
- package/lib/store/conversation-state.js +0 -18
- package/lib/store/conversation-state.js.map +1 -1
- package/lib/store/doc-analyzer.d.ts +0 -22
- package/lib/store/doc-analyzer.d.ts.map +1 -1
- package/lib/store/dsl-workflow.d.ts +22 -5
- package/lib/store/dsl-workflow.d.ts.map +1 -1
- package/lib/store/dsl-workflow.js.map +1 -1
- package/lib/store/grounded-extraction.d.ts +0 -14
- package/lib/store/grounded-extraction.d.ts.map +1 -1
- package/lib/store/grounded-extraction.js +1 -7
- package/lib/store/grounded-extraction.js.map +1 -1
- package/lib/store/index.d.ts +0 -5
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +0 -6
- package/lib/store/index.js.map +1 -1
- package/lib/store/intake-policy-schema.generated.d.ts.map +1 -1
- package/lib/store/intake-policy-schema.generated.js +279 -1
- package/lib/store/intake-policy-schema.generated.js.map +1 -1
- package/lib/store/process.d.ts +43 -1
- package/lib/store/process.d.ts.map +1 -1
- package/lib/store/process.js.map +1 -1
- package/lib/store/rendering.d.ts +3 -5
- package/lib/store/rendering.d.ts.map +1 -1
- package/lib/store/rendering.js +0 -4
- package/lib/store/rendering.js.map +1 -1
- package/lib/store/schedule.d.ts +0 -16
- package/lib/store/schedule.d.ts.map +1 -1
- package/lib/store/schedule.js.map +1 -1
- package/lib/store/signals.d.ts +12 -0
- package/lib/store/signals.d.ts.map +1 -1
- package/lib/store/store.d.ts +80 -94
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +5 -25
- package/lib/store/store.js.map +1 -1
- package/lib/store/workflow.d.ts +35 -86
- package/lib/store/workflow.d.ts.map +1 -1
- package/lib/store/workflow.js +0 -47
- package/lib/store/workflow.js.map +1 -1
- package/lib/sts-errors.d.ts +0 -1
- package/lib/sts-errors.d.ts.map +1 -1
- package/lib/sts-token-types.d.ts +2 -8
- package/lib/sts-token-types.d.ts.map +1 -1
- package/lib/sts-token-types.js +1 -19
- package/lib/sts-token-types.js.map +1 -1
- package/lib/tools.d.ts +6 -1
- package/lib/tools.d.ts.map +1 -1
- package/lib/transient-tokens.d.ts +0 -2
- package/lib/transient-tokens.d.ts.map +1 -1
- package/lib/user.d.ts +0 -17
- package/lib/user.d.ts.map +1 -1
- package/lib/user.js.map +1 -1
- package/lib/utils/schemas.d.ts +2 -24
- package/lib/utils/schemas.d.ts.map +1 -1
- package/lib/utils/schemas.js +0 -151
- package/lib/utils/schemas.js.map +1 -1
- package/lib/vertesia-common.js +3 -4
- package/lib/vertesia-common.js.map +1 -1
- package/lib/views.d.ts +23 -27
- package/lib/views.d.ts.map +1 -1
- package/lib/views.js +5 -26
- package/lib/views.js.map +1 -1
- package/lib/workflow-analytics.d.ts +12 -34
- package/lib/workflow-analytics.d.ts.map +1 -1
- package/package.json +12 -6
- package/src/access-control.ts +0 -26
- package/src/account-values.ts +0 -49
- package/src/agent-resources.test.ts +1 -12
- package/src/api-contract/components.contract.test.ts +99 -0
- package/src/api-contract/components.generated.json +40405 -0
- package/src/api-contract/index.ts +664 -0
- package/src/api-schemas/agent-communication.contract.test.ts +90 -0
- package/src/api-schemas/agent-communication.ts +169 -0
- package/src/api-schemas/agent-runs.ts +46 -1
- package/src/api-schemas/api-discriminators.test.ts +101 -0
- package/src/api-schemas/app-lifecycle.ts +39 -4
- package/src/api-schemas/app-runtime.ts +8 -0
- package/src/api-schemas/apps.ts +4 -3
- package/src/api-schemas/content-query.ts +31 -0
- package/src/api-schemas/content.ts +88 -15
- package/src/api-schemas/dashboard.contract.test.ts +16 -5
- package/src/api-schemas/dashboard.ts +3 -0
- package/src/api-schemas/events.ts +9 -1
- package/src/api-schemas/files.ts +27 -0
- package/src/api-schemas/group.ts +10 -0
- package/src/api-schemas/index.ts +4 -0
- package/src/api-schemas/integrations.ts +27 -2
- package/src/api-schemas/interaction.contract.test.ts +204 -1
- package/src/api-schemas/interaction.ts +176 -8
- package/src/api-schemas/llumiverse.contract.test.ts +33 -2
- package/src/api-schemas/oauth-server.ts +152 -3
- package/src/api-schemas/oauth.contract.test.ts +64 -1
- package/src/api-schemas/process.ts +352 -2
- package/src/api-schemas/project-configuration.ts +11 -7
- package/src/api-schemas/project.contract.test.ts +83 -6
- package/src/api-schemas/registry.ts +290 -457
- package/src/api-schemas/schema-primitives.ts +13 -0
- package/src/api-schemas/store.contract.test.ts +30 -1
- package/src/api-schemas/store.ts +58 -11
- package/src/api-schemas/tools.ts +62 -0
- package/src/api-schemas/view-execution.ts +28 -2
- package/src/api-schemas/views.contract.test.ts +119 -0
- package/src/api-schemas/views.ts +142 -3
- package/src/api-schemas/workflow-runs.ts +9 -7
- package/src/api-schemas/zeno-response-contracts.test.ts +344 -0
- package/src/apps.test.ts +2 -40
- package/src/apps.ts +14 -181
- package/src/ask-user.ts +1 -1
- package/src/audit-trail.ts +3 -3
- package/src/browser-credentials.ts +3 -7
- package/src/common.ts +13 -1
- package/src/content-query.ts +5 -0
- package/src/data-platform.ts +4 -51
- package/src/email.ts +24 -18
- package/src/environment.ts +1 -14
- package/src/facets.ts +0 -6
- package/src/group.ts +2 -12
- package/src/index.ts +3 -15
- package/src/integrations.ts +1 -52
- package/src/interaction.ts +12 -271
- package/src/meters.ts +10 -11
- package/src/oauth-scopes.test.ts +15 -0
- package/src/oauth-scopes.ts +10 -64
- package/src/oauth-server.ts +28 -215
- package/src/payload.ts +1 -6
- package/src/pending-asks.ts +17 -42
- package/src/platform-event.ts +3 -156
- package/src/project.ts +12 -160
- package/src/prompt.ts +9 -8
- package/src/query.ts +0 -9
- package/src/rate-limiter.ts +3 -3
- package/src/runs.ts +8 -0
- package/src/schema-for-extraction.ts +1 -1
- package/src/secrets.ts +3 -0
- package/src/skill.ts +0 -15
- package/src/store/activity-catalog.ts +3 -0
- package/src/store/agent-approval.ts +0 -4
- package/src/store/agent-run.ts +39 -93
- package/src/store/collections.ts +3 -6
- package/src/store/conversation-state.ts +12 -25
- package/src/store/doc-analyzer.ts +0 -26
- package/src/store/dsl-workflow.ts +28 -5
- package/src/store/grounded-extraction.ts +0 -18
- package/src/store/index.ts +0 -6
- package/src/store/intake-policy-schema.generated.ts +293 -1
- package/src/store/process.ts +84 -0
- package/src/store/rendering.ts +3 -8
- package/src/store/schedule.ts +0 -19
- package/src/store/signals.ts +14 -0
- package/src/store/store.ts +118 -127
- package/src/store/workflow.ts +32 -120
- package/src/sts-errors.ts +0 -2
- package/src/sts-token-types.ts +3 -28
- package/src/tools.ts +15 -0
- package/src/transient-tokens.ts +0 -2
- package/src/user.ts +0 -20
- package/src/utils/schemas.ts +2 -159
- package/src/views.ts +50 -47
- package/src/workflow-analytics.ts +12 -40
- package/tsconfig.dist.json +4 -1
- package/lib/Progress.d.ts +0 -22
- package/lib/Progress.d.ts.map +0 -1
- package/lib/Progress.js +0 -57
- package/lib/Progress.js.map +0 -1
- package/lib/agent-request-template.d.ts +0 -4
- package/lib/agent-request-template.d.ts.map +0 -1
- package/lib/agent-request-template.js +0 -46
- package/lib/agent-request-template.js.map +0 -1
- package/lib/channels.d.ts +0 -22
- package/lib/channels.d.ts.map +0 -1
- package/lib/channels.js +0 -57
- package/lib/channels.js.map +0 -1
- package/lib/host-utils.d.ts +0 -8
- package/lib/host-utils.d.ts.map +0 -1
- package/lib/host-utils.js +0 -84
- package/lib/host-utils.js.map +0 -1
- package/lib/platform-event-validation.d.ts +0 -45
- package/lib/platform-event-validation.d.ts.map +0 -1
- package/lib/platform-event-validation.js +0 -336
- package/lib/platform-event-validation.js.map +0 -1
- package/lib/store/hive-memory.d.ts +0 -117
- package/lib/store/hive-memory.d.ts.map +0 -1
- package/lib/store/hive-memory.js +0 -2
- package/lib/store/hive-memory.js.map +0 -1
- package/lib/store/object-types.d.ts +0 -24
- package/lib/store/object-types.d.ts.map +0 -1
- package/lib/store/object-types.js +0 -95
- package/lib/store/object-types.js.map +0 -1
- package/lib/store/process-schema.d.ts +0 -561
- package/lib/store/process-schema.d.ts.map +0 -1
- package/lib/store/process-schema.js +0 -561
- package/lib/store/process-schema.js.map +0 -1
- package/lib/store/process-validation.d.ts +0 -17
- package/lib/store/process-validation.d.ts.map +0 -1
- package/lib/store/process-validation.js +0 -515
- package/lib/store/process-validation.js.map +0 -1
- package/lib/store/temporalio.d.ts +0 -17
- package/lib/store/temporalio.d.ts.map +0 -1
- package/lib/store/temporalio.js +0 -41
- package/lib/store/temporalio.js.map +0 -1
- package/lib/view-configuration-validation.d.ts +0 -15
- package/lib/view-configuration-validation.d.ts.map +0 -1
- package/lib/view-configuration-validation.js +0 -63
- package/lib/view-configuration-validation.js.map +0 -1
- package/lib/view-query-validation.d.ts +0 -13
- package/lib/view-query-validation.d.ts.map +0 -1
- package/lib/view-query-validation.js +0 -266
- package/lib/view-query-validation.js.map +0 -1
- package/lib/view-validation-helpers.d.ts +0 -15
- package/lib/view-validation-helpers.d.ts.map +0 -1
- package/lib/view-validation-helpers.js +0 -25
- package/lib/view-validation-helpers.js.map +0 -1
- package/lib/views-schema.d.ts +0 -1992
- package/lib/views-schema.d.ts.map +0 -1
- package/lib/views-schema.js +0 -674
- package/lib/views-schema.js.map +0 -1
- package/lib/views-validation.d.ts +0 -21
- package/lib/views-validation.d.ts.map +0 -1
- package/lib/views-validation.js +0 -164
- package/lib/views-validation.js.map +0 -1
- package/src/Progress.ts +0 -59
- package/src/agent-request-template.test.ts +0 -40
- package/src/agent-request-template.ts +0 -45
- package/src/channels.ts +0 -70
- package/src/host-utils.test.ts +0 -61
- package/src/host-utils.ts +0 -93
- package/src/platform-event-validation.test.ts +0 -251
- package/src/platform-event-validation.ts +0 -372
- package/src/project.test.ts +0 -44
- package/src/store/hive-memory.ts +0 -167
- package/src/store/object-types.ts +0 -123
- package/src/store/process-schema.test.ts +0 -149
- package/src/store/process-schema.ts +0 -564
- package/src/store/process-validation.test.ts +0 -635
- package/src/store/process-validation.ts +0 -646
- package/src/store/temporalio.ts +0 -54
- package/src/view-configuration-validation.ts +0 -74
- package/src/view-query-validation.test.ts +0 -21
- package/src/view-query-validation.ts +0 -319
- package/src/view-validation-helpers.ts +0 -28
- package/src/views-schema.test.ts +0 -372
- package/src/views-schema.ts +0 -689
- package/src/views-validation.ts +0 -234
|
@@ -1,635 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { PROCESS_DEFINITION_FORMAT_VERSION, type ProcessDefinitionBody } from './process.js';
|
|
3
|
-
import {
|
|
4
|
-
getProcessDefinitionValidationResult,
|
|
5
|
-
getProcessInteractionValidationSelectors,
|
|
6
|
-
MAX_PROCESS_GUARD_DEPTH,
|
|
7
|
-
MAX_PROCESS_GUARD_NODES,
|
|
8
|
-
validateProcessDefinitionBody,
|
|
9
|
-
} from './process-validation.js';
|
|
10
|
-
|
|
11
|
-
function validDefinition(): ProcessDefinitionBody {
|
|
12
|
-
return {
|
|
13
|
-
format_version: PROCESS_DEFINITION_FORMAT_VERSION,
|
|
14
|
-
process: 'approval',
|
|
15
|
-
initial: 'review',
|
|
16
|
-
metadata: {
|
|
17
|
-
provenance: {
|
|
18
|
-
bpmn: {
|
|
19
|
-
process_id: 'ApprovalProcess',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
context: {
|
|
24
|
-
schema: {
|
|
25
|
-
type: 'object',
|
|
26
|
-
properties: {
|
|
27
|
-
approved: { type: 'boolean' },
|
|
28
|
-
},
|
|
29
|
-
required: ['approved'],
|
|
30
|
-
additionalProperties: false,
|
|
31
|
-
},
|
|
32
|
-
initial: { approved: false },
|
|
33
|
-
},
|
|
34
|
-
nodes: {
|
|
35
|
-
review: {
|
|
36
|
-
type: 'human_task',
|
|
37
|
-
task: {
|
|
38
|
-
title: 'Review',
|
|
39
|
-
fields: [{ name: 'approved', type: 'boolean', required: true }],
|
|
40
|
-
},
|
|
41
|
-
transitions: [{ to: 'approved', trigger: 'user', metadata: { edge_kind: 'default' } }],
|
|
42
|
-
},
|
|
43
|
-
approved: {
|
|
44
|
-
type: 'final',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
describe('process definition validation', () => {
|
|
51
|
-
it('accepts a structurally valid definition', () => {
|
|
52
|
-
expect(() => validateProcessDefinitionBody(validDefinition())).not.toThrow();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('accepts inline script sources and script fanout children', () => {
|
|
56
|
-
const definition = validDefinition();
|
|
57
|
-
definition.resources = {
|
|
58
|
-
scripts: {
|
|
59
|
-
score_contract: {
|
|
60
|
-
language: 'python',
|
|
61
|
-
entrypoint: 'main.py',
|
|
62
|
-
source: {
|
|
63
|
-
type: 'inline',
|
|
64
|
-
files: {
|
|
65
|
-
'main.py': 'print("ok")',
|
|
66
|
-
'lib/helpers.py': 'def score(value): return value',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
packages: ['pandas>=2.0'],
|
|
70
|
-
},
|
|
71
|
-
normalize_json: {
|
|
72
|
-
language: 'javascript',
|
|
73
|
-
entrypoint: 'main.js',
|
|
74
|
-
source: {
|
|
75
|
-
type: 'inline',
|
|
76
|
-
files: { 'main.js': 'console.log("ok")' },
|
|
77
|
-
},
|
|
78
|
-
packages: ['zod@4.0.0'],
|
|
79
|
-
},
|
|
80
|
-
reshape_types: {
|
|
81
|
-
language: 'typescript',
|
|
82
|
-
entrypoint: 'main.ts',
|
|
83
|
-
source: {
|
|
84
|
-
type: 'inline',
|
|
85
|
-
files: { 'main.ts': 'console.log("ok")' },
|
|
86
|
-
},
|
|
87
|
-
packages: ['@types/node', '@vertesia/client@latest'],
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
definition.initial = 'score';
|
|
92
|
-
definition.nodes.score = {
|
|
93
|
-
type: 'script',
|
|
94
|
-
script: 'score_contract',
|
|
95
|
-
timeout: 60,
|
|
96
|
-
writes: ['approved'],
|
|
97
|
-
transitions: [{ to: 'approved' }],
|
|
98
|
-
};
|
|
99
|
-
definition.nodes.fanout = {
|
|
100
|
-
type: 'foreach',
|
|
101
|
-
foreach: 'items',
|
|
102
|
-
node: {
|
|
103
|
-
type: 'script',
|
|
104
|
-
script: 'score_contract',
|
|
105
|
-
},
|
|
106
|
-
transitions: [{ to: 'approved' }],
|
|
107
|
-
};
|
|
108
|
-
definition.nodes.parallel = {
|
|
109
|
-
type: 'branch',
|
|
110
|
-
branches: [
|
|
111
|
-
{
|
|
112
|
-
id: 'normalize',
|
|
113
|
-
node: {
|
|
114
|
-
type: 'script',
|
|
115
|
-
script: 'normalize_json',
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
transitions: [{ to: 'approved' }],
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
expect(() => validateProcessDefinitionBody(definition)).not.toThrow();
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('rejects invalid script resources and references', () => {
|
|
126
|
-
const definition = validDefinition();
|
|
127
|
-
definition.resources = {
|
|
128
|
-
scripts: {
|
|
129
|
-
'bad resource': {
|
|
130
|
-
language: 'python',
|
|
131
|
-
entrypoint: 'missing.py',
|
|
132
|
-
source: {
|
|
133
|
-
type: 'inline',
|
|
134
|
-
files: {
|
|
135
|
-
'../escape.py': 'print("no")',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
packages: ['--index-url=evil', 'zod@latest`whoami`'],
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
definition.nodes.review = {
|
|
143
|
-
type: 'script',
|
|
144
|
-
script: 'missing',
|
|
145
|
-
timeout: 601,
|
|
146
|
-
transitions: [{ to: 'approved' }],
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
150
|
-
|
|
151
|
-
expect(result.errors).toContain('script resource "bad resource" has an invalid name');
|
|
152
|
-
expect(result.errors).toContain('script resource "bad resource" has unsafe file path "../escape.py"');
|
|
153
|
-
expect(result.errors).toContain(
|
|
154
|
-
'script resource "bad resource" entrypoint "missing.py" is not present in files',
|
|
155
|
-
);
|
|
156
|
-
expect(result.errors).toContain(
|
|
157
|
-
'script resource "bad resource" has unsafe package specification "--index-url=evil"',
|
|
158
|
-
);
|
|
159
|
-
expect(result.errors).toContain(
|
|
160
|
-
'script resource "bad resource" has unsafe package specification "zod@latest`whoami`"',
|
|
161
|
-
);
|
|
162
|
-
expect(result.errors).toContain('script node "review" references unknown script resource "missing"');
|
|
163
|
-
expect(result.errors).toContain('script node "review" timeout must be an integer between 1 and 600');
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('rejects script-only fields on other node types', () => {
|
|
167
|
-
const definition = validDefinition();
|
|
168
|
-
Object.assign(definition.nodes.review, { script: 'score', timeout: 30 });
|
|
169
|
-
|
|
170
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
171
|
-
|
|
172
|
-
expect(result.errors).toContain('node "review" defines script but has type "human_task"');
|
|
173
|
-
expect(result.errors).toContain('node "review" defines timeout but has type "human_task"');
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('counts inline script sources against the process definition size cap', () => {
|
|
177
|
-
const definition = validDefinition();
|
|
178
|
-
definition.resources = {
|
|
179
|
-
scripts: {
|
|
180
|
-
oversized: {
|
|
181
|
-
language: 'typescript',
|
|
182
|
-
entrypoint: 'main.ts',
|
|
183
|
-
source: {
|
|
184
|
-
type: 'inline',
|
|
185
|
-
files: { 'main.ts': 'x'.repeat(1024 * 1024) },
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
192
|
-
'process definition, including embedded resources, exceeds',
|
|
193
|
-
);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
it('rejects missing transition targets', () => {
|
|
197
|
-
const definition = validDefinition();
|
|
198
|
-
definition.nodes.review.transitions = [{ to: 'missing' }];
|
|
199
|
-
|
|
200
|
-
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
201
|
-
'node "review" has transition to "missing" which does not exist',
|
|
202
|
-
);
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it('rejects missing branch targets', () => {
|
|
206
|
-
const definition = validDefinition();
|
|
207
|
-
definition.nodes.review.type = 'condition';
|
|
208
|
-
definition.nodes.review.task = undefined;
|
|
209
|
-
definition.nodes.review.transitions = undefined;
|
|
210
|
-
definition.nodes.review.branches = [{ to: 'missing', default: true }];
|
|
211
|
-
|
|
212
|
-
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
213
|
-
'node "review" has branch to "missing" which does not exist',
|
|
214
|
-
);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('rejects unsupported foreach child node types', () => {
|
|
218
|
-
const definition = validDefinition();
|
|
219
|
-
definition.initial = 'fanout';
|
|
220
|
-
definition.context.schema = {
|
|
221
|
-
type: 'object',
|
|
222
|
-
properties: {
|
|
223
|
-
items: { type: 'array', items: { type: 'string' } },
|
|
224
|
-
},
|
|
225
|
-
additionalProperties: true,
|
|
226
|
-
};
|
|
227
|
-
definition.context.initial = { items: [] };
|
|
228
|
-
definition.nodes = {
|
|
229
|
-
fanout: {
|
|
230
|
-
type: 'foreach',
|
|
231
|
-
foreach: 'items',
|
|
232
|
-
node: {
|
|
233
|
-
type: 'human_task',
|
|
234
|
-
task: {
|
|
235
|
-
title: 'Review',
|
|
236
|
-
fields: [],
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
transitions: [{ to: 'approved' }],
|
|
240
|
-
},
|
|
241
|
-
approved: {
|
|
242
|
-
type: 'final',
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
247
|
-
'foreach node "fanout" has unsupported child node type "human_task"',
|
|
248
|
-
);
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('accepts process nodes as standalone nodes and foreach children', () => {
|
|
252
|
-
const child = validDefinition();
|
|
253
|
-
child.process = 'child_approval';
|
|
254
|
-
|
|
255
|
-
const definition = validDefinition();
|
|
256
|
-
definition.initial = 'fanout';
|
|
257
|
-
definition.context.schema = {
|
|
258
|
-
type: 'object',
|
|
259
|
-
properties: {
|
|
260
|
-
items: { type: 'array', items: { type: 'object' } },
|
|
261
|
-
results: { type: 'array' },
|
|
262
|
-
},
|
|
263
|
-
additionalProperties: true,
|
|
264
|
-
};
|
|
265
|
-
definition.context.initial = { items: [] };
|
|
266
|
-
definition.nodes = {
|
|
267
|
-
fanout: {
|
|
268
|
-
type: 'foreach',
|
|
269
|
-
foreach: 'items',
|
|
270
|
-
as: 'item',
|
|
271
|
-
item_id: '{{item.id}}',
|
|
272
|
-
max_concurrency: 10,
|
|
273
|
-
collect: {
|
|
274
|
-
into: 'results',
|
|
275
|
-
include: ['status', 'index', 'item_id', 'output', 'child_run_id'],
|
|
276
|
-
},
|
|
277
|
-
node: {
|
|
278
|
-
type: 'process',
|
|
279
|
-
process_definition: child,
|
|
280
|
-
input: { invoice: '{{item}}' },
|
|
281
|
-
returns: { from: 'context.approved' },
|
|
282
|
-
},
|
|
283
|
-
transitions: [{ to: 'approved' }],
|
|
284
|
-
},
|
|
285
|
-
approved: {
|
|
286
|
-
type: 'final',
|
|
287
|
-
},
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
expect(() => validateProcessDefinitionBody(definition)).not.toThrow();
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it('rejects fanout child nodes that define their own transitions', () => {
|
|
294
|
-
const child = validDefinition();
|
|
295
|
-
child.process = 'child_approval';
|
|
296
|
-
|
|
297
|
-
const definition = validDefinition();
|
|
298
|
-
definition.initial = 'fanout';
|
|
299
|
-
definition.context.schema = {
|
|
300
|
-
type: 'object',
|
|
301
|
-
properties: {
|
|
302
|
-
items: { type: 'array', items: { type: 'object' } },
|
|
303
|
-
},
|
|
304
|
-
additionalProperties: true,
|
|
305
|
-
};
|
|
306
|
-
definition.context.initial = { items: [] };
|
|
307
|
-
definition.nodes = {
|
|
308
|
-
fanout: {
|
|
309
|
-
type: 'foreach',
|
|
310
|
-
foreach: 'items',
|
|
311
|
-
node: {
|
|
312
|
-
type: 'process',
|
|
313
|
-
process_definition: child,
|
|
314
|
-
transitions: [{ to: 'approved' }],
|
|
315
|
-
},
|
|
316
|
-
transitions: [{ to: 'approved' }],
|
|
317
|
-
},
|
|
318
|
-
approved: {
|
|
319
|
-
type: 'final',
|
|
320
|
-
},
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
324
|
-
'foreach node "fanout" child node must not define transitions',
|
|
325
|
-
);
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
it('rejects process nodes without a referenced or inline process', () => {
|
|
329
|
-
const definition = validDefinition();
|
|
330
|
-
definition.nodes.review = {
|
|
331
|
-
type: 'process',
|
|
332
|
-
transitions: [{ to: 'approved' }],
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
336
|
-
'process node "review" is missing process or process_definition',
|
|
337
|
-
);
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
it('rejects set_context nodes that omit the updates envelope', () => {
|
|
341
|
-
const definition = validDefinition();
|
|
342
|
-
definition.nodes.review = {
|
|
343
|
-
type: 'tool',
|
|
344
|
-
tool: 'set_context',
|
|
345
|
-
input: {
|
|
346
|
-
approved: true,
|
|
347
|
-
},
|
|
348
|
-
writes: ['approved'],
|
|
349
|
-
transitions: [{ to: 'approved' }],
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
353
|
-
|
|
354
|
-
expect(result.valid).toBe(false);
|
|
355
|
-
expect(result.errors).toContain('tool node "review" set_context input has unsupported property "approved"');
|
|
356
|
-
expect(result.errors).toContain('tool node "review" set_context input.updates must be an object');
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
it('accepts set_context nodes with the updates envelope', () => {
|
|
360
|
-
const definition = validDefinition();
|
|
361
|
-
definition.nodes.review = {
|
|
362
|
-
type: 'tool',
|
|
363
|
-
tool: 'set_context',
|
|
364
|
-
input: {
|
|
365
|
-
updates: {
|
|
366
|
-
approved: true,
|
|
367
|
-
},
|
|
368
|
-
reason: 'mark approved in validation test',
|
|
369
|
-
},
|
|
370
|
-
writes: ['approved'],
|
|
371
|
-
transitions: [{ to: 'approved' }],
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
expect(() => validateProcessDefinitionBody(definition)).not.toThrow();
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
it('rejects set_context nodes that write undeclared or internal fields', () => {
|
|
378
|
-
const definition = validDefinition();
|
|
379
|
-
definition.nodes.review = {
|
|
380
|
-
type: 'tool',
|
|
381
|
-
tool: 'set_context',
|
|
382
|
-
input: {
|
|
383
|
-
updates: {
|
|
384
|
-
approved: true,
|
|
385
|
-
_current_node: 'approved',
|
|
386
|
-
},
|
|
387
|
-
},
|
|
388
|
-
writes: ['decision'],
|
|
389
|
-
transitions: [{ to: 'approved' }],
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
393
|
-
|
|
394
|
-
expect(result.valid).toBe(false);
|
|
395
|
-
expect(result.errors).toContain(
|
|
396
|
-
'tool node "review" set_context updates "approved" but writes does not allow it',
|
|
397
|
-
);
|
|
398
|
-
expect(result.errors).toContain(
|
|
399
|
-
'tool node "review" set_context cannot write reserved context field "_current_node"',
|
|
400
|
-
);
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
it('rejects unknown tools when a runtime tool catalog is provided', () => {
|
|
404
|
-
const definition = validDefinition();
|
|
405
|
-
definition.nodes.review = {
|
|
406
|
-
type: 'tool',
|
|
407
|
-
tool: 'missing_tool',
|
|
408
|
-
input: {},
|
|
409
|
-
transitions: [{ to: 'approved' }],
|
|
410
|
-
};
|
|
411
|
-
|
|
412
|
-
const result = getProcessDefinitionValidationResult(definition, { knownTools: ['set_context'] });
|
|
413
|
-
|
|
414
|
-
expect(result.valid).toBe(false);
|
|
415
|
-
expect(result.errors).toContain('tool node "review" references unknown tool "missing_tool"');
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
it('rejects unknown interactions when a runtime interaction catalog is provided', () => {
|
|
419
|
-
const definition = validDefinition();
|
|
420
|
-
definition.nodes.review = {
|
|
421
|
-
type: 'interaction',
|
|
422
|
-
interaction: 'sys:MissingInteraction',
|
|
423
|
-
writes: ['approved'],
|
|
424
|
-
transitions: [{ to: 'approved' }],
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
const result = getProcessDefinitionValidationResult(definition, { knownInteractions: ['sys:GeneralAgent'] });
|
|
428
|
-
|
|
429
|
-
expect(result.valid).toBe(false);
|
|
430
|
-
expect(result.errors).toContain(
|
|
431
|
-
'interaction node "review" references unknown interaction "sys:MissingInteraction"',
|
|
432
|
-
);
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
it('rejects non-object result_schema on agent and interaction nodes', () => {
|
|
436
|
-
const definition = validDefinition();
|
|
437
|
-
definition.nodes.review = {
|
|
438
|
-
type: 'agent',
|
|
439
|
-
interaction: 'sys:GeneralAgent',
|
|
440
|
-
writes: ['approved'],
|
|
441
|
-
transitions: [{ to: 'approved' }],
|
|
442
|
-
};
|
|
443
|
-
Object.assign(definition.nodes.review, { result_schema: 'not a schema' });
|
|
444
|
-
|
|
445
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
446
|
-
|
|
447
|
-
expect(result.valid).toBe(false);
|
|
448
|
-
expect(result.errors).toContain('agent node "review" result_schema must be a JSON Schema object');
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
it('builds interaction selectors used by process validation', () => {
|
|
452
|
-
const selectors = getProcessInteractionValidationSelectors([
|
|
453
|
-
{ type: 'sys', id: 'sys:GeneralAgent', name: 'GeneralAgent', title: 'General agent', tags: [] },
|
|
454
|
-
{
|
|
455
|
-
type: 'stored',
|
|
456
|
-
id: '65f000000000000000000001',
|
|
457
|
-
name: 'contract-risk',
|
|
458
|
-
version: 3,
|
|
459
|
-
title: 'Contract risk',
|
|
460
|
-
tags: [],
|
|
461
|
-
},
|
|
462
|
-
{ type: 'app', id: 'claims/score', name: 'score_claim', title: 'Score claim', tags: [] },
|
|
463
|
-
]);
|
|
464
|
-
|
|
465
|
-
expect(selectors).toContain('sys:GeneralAgent');
|
|
466
|
-
expect(selectors).toContain('GeneralAgent');
|
|
467
|
-
expect(selectors).toContain('contract-risk@draft');
|
|
468
|
-
expect(selectors).toContain('65f000000000000000000001@3');
|
|
469
|
-
expect(selectors).toContain('app:claims/score');
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
it('rejects string branch conditions so broken definitions do not save', () => {
|
|
473
|
-
const definition = validDefinition();
|
|
474
|
-
const branchWithStringCondition = {
|
|
475
|
-
to: 'approved',
|
|
476
|
-
condition: 'context.approved == true',
|
|
477
|
-
};
|
|
478
|
-
definition.nodes.review.type = 'condition';
|
|
479
|
-
definition.nodes.review.task = undefined;
|
|
480
|
-
definition.nodes.review.transitions = undefined;
|
|
481
|
-
definition.nodes.review.branches = [branchWithStringCondition];
|
|
482
|
-
|
|
483
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
484
|
-
|
|
485
|
-
expect(result.valid).toBe(false);
|
|
486
|
-
expect(result.errors).toContain(
|
|
487
|
-
'node "review" branch at index 0 uses string condition; use JSON Logic in "when" instead',
|
|
488
|
-
);
|
|
489
|
-
});
|
|
490
|
-
|
|
491
|
-
it('rejects invalid foreach fanout controls', () => {
|
|
492
|
-
const definition = validDefinition();
|
|
493
|
-
definition.initial = 'fanout';
|
|
494
|
-
definition.context.schema = {
|
|
495
|
-
type: 'object',
|
|
496
|
-
properties: {
|
|
497
|
-
items: { type: 'array' },
|
|
498
|
-
},
|
|
499
|
-
additionalProperties: true,
|
|
500
|
-
};
|
|
501
|
-
definition.context.initial = { items: [] };
|
|
502
|
-
definition.nodes = {
|
|
503
|
-
fanout: {
|
|
504
|
-
type: 'foreach',
|
|
505
|
-
foreach: 'items',
|
|
506
|
-
max_concurrency: 0,
|
|
507
|
-
collect: {
|
|
508
|
-
into: '',
|
|
509
|
-
include: ['status'],
|
|
510
|
-
},
|
|
511
|
-
node: {
|
|
512
|
-
type: 'process',
|
|
513
|
-
process: '64f000000000000000000000',
|
|
514
|
-
},
|
|
515
|
-
transitions: [{ to: 'approved' }],
|
|
516
|
-
},
|
|
517
|
-
approved: {
|
|
518
|
-
type: 'final',
|
|
519
|
-
},
|
|
520
|
-
};
|
|
521
|
-
Object.assign(definition.nodes.fanout.collect ?? {}, { include: ['bogus'] });
|
|
522
|
-
|
|
523
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
524
|
-
|
|
525
|
-
expect(result.valid).toBe(false);
|
|
526
|
-
expect(result.errors).toContain('foreach node "fanout" max_concurrency must be a positive integer');
|
|
527
|
-
expect(result.errors).toContain('foreach node "fanout" collect.into is required');
|
|
528
|
-
expect(result.errors).toContain('foreach node "fanout" collect.include has invalid field "bogus"');
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
it('reports all structural errors without importing runtime schema validators', () => {
|
|
532
|
-
const definition = {
|
|
533
|
-
format_version: PROCESS_DEFINITION_FORMAT_VERSION,
|
|
534
|
-
process: '',
|
|
535
|
-
initial: 'missing',
|
|
536
|
-
context: {
|
|
537
|
-
schema: {},
|
|
538
|
-
initial: {},
|
|
539
|
-
},
|
|
540
|
-
nodes: {
|
|
541
|
-
review: {
|
|
542
|
-
type: 'human_task',
|
|
543
|
-
},
|
|
544
|
-
},
|
|
545
|
-
} satisfies ProcessDefinitionBody;
|
|
546
|
-
|
|
547
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
548
|
-
|
|
549
|
-
expect(result.valid).toBe(false);
|
|
550
|
-
expect(result.errors).toContain('initial node "missing" does not exist');
|
|
551
|
-
expect(result.errors).toContain('human_task node "review" is missing task');
|
|
552
|
-
});
|
|
553
|
-
|
|
554
|
-
it('rejects human_task fields that use "id" instead of "name"', () => {
|
|
555
|
-
const definition = validDefinition();
|
|
556
|
-
definition.nodes.review.task = {
|
|
557
|
-
title: 'Review',
|
|
558
|
-
fields: [{ id: 'approved', type: 'boolean' } as unknown as { name: string; type: 'boolean' }],
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
562
|
-
|
|
563
|
-
expect(result.valid).toBe(false);
|
|
564
|
-
expect(result.errors).toContain(
|
|
565
|
-
'human_task node "review" task.fields[0].name must be a non-empty string (not "id")',
|
|
566
|
-
);
|
|
567
|
-
});
|
|
568
|
-
|
|
569
|
-
it('rejects human_task fields with an unsupported type', () => {
|
|
570
|
-
const definition = validDefinition();
|
|
571
|
-
definition.nodes.review.task = {
|
|
572
|
-
title: 'Review',
|
|
573
|
-
fields: [{ name: 'approved', type: 'date' } as unknown as { name: string; type: 'string' }],
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
577
|
-
|
|
578
|
-
expect(result.valid).toBe(false);
|
|
579
|
-
expect(result.errors).toContain(
|
|
580
|
-
'human_task node "review" task.fields[0].type must be one of string, number, boolean, select, text',
|
|
581
|
-
);
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
it('rejects select fields without options', () => {
|
|
585
|
-
const definition = validDefinition();
|
|
586
|
-
definition.nodes.review.task = {
|
|
587
|
-
title: 'Review',
|
|
588
|
-
fields: [{ name: 'decision', type: 'select' }],
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
const result = getProcessDefinitionValidationResult(definition);
|
|
592
|
-
|
|
593
|
-
expect(result.valid).toBe(false);
|
|
594
|
-
expect(result.errors).toContain(
|
|
595
|
-
'human_task node "review" task.fields[0] of type "select" requires a non-empty options[] array',
|
|
596
|
-
);
|
|
597
|
-
});
|
|
598
|
-
|
|
599
|
-
it('accepts human_task select fields with options', () => {
|
|
600
|
-
const definition = validDefinition();
|
|
601
|
-
definition.nodes.review.task = {
|
|
602
|
-
title: 'Review',
|
|
603
|
-
fields: [
|
|
604
|
-
{
|
|
605
|
-
name: 'decision',
|
|
606
|
-
type: 'select',
|
|
607
|
-
options: ['approved', 'rejected'],
|
|
608
|
-
required: true,
|
|
609
|
-
},
|
|
610
|
-
],
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
expect(() => validateProcessDefinitionBody(definition)).not.toThrow();
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
it('rejects overly deep guard rules', () => {
|
|
617
|
-
const definition = validDefinition();
|
|
618
|
-
let guard: Record<string, unknown> = { var: 'approved' };
|
|
619
|
-
for (let index = 0; index < MAX_PROCESS_GUARD_DEPTH; index += 1) {
|
|
620
|
-
guard = { '!': [guard] };
|
|
621
|
-
}
|
|
622
|
-
definition.nodes.review.transitions = [{ to: 'approved', guard }];
|
|
623
|
-
|
|
624
|
-
expect(() => validateProcessDefinitionBody(definition)).toThrow('exceeds maximum depth');
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
it('rejects overly large guard rules', () => {
|
|
628
|
-
const definition = validDefinition();
|
|
629
|
-
definition.nodes.review.transitions = [
|
|
630
|
-
{ to: 'approved', guard: { and: Array.from({ length: MAX_PROCESS_GUARD_NODES + 1 }, () => true) } },
|
|
631
|
-
];
|
|
632
|
-
|
|
633
|
-
expect(() => validateProcessDefinitionBody(definition)).toThrow('exceeds maximum node count');
|
|
634
|
-
});
|
|
635
|
-
});
|