@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,46 +0,0 @@
|
|
|
1
|
-
function isRecordValue(value) {
|
|
2
|
-
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
3
|
-
}
|
|
4
|
-
function getTemplatePathValue(data, path) {
|
|
5
|
-
if (path === '.' || path === 'json')
|
|
6
|
-
return data;
|
|
7
|
-
return path.split('.').reduce((current, part) => {
|
|
8
|
-
if (Array.isArray(current) && /^\d+$/.test(part))
|
|
9
|
-
return current[Number(part)];
|
|
10
|
-
if (!isRecordValue(current))
|
|
11
|
-
return undefined;
|
|
12
|
-
return current[part];
|
|
13
|
-
}, data);
|
|
14
|
-
}
|
|
15
|
-
function stringifyTemplateValue(value) {
|
|
16
|
-
if (value === null || value === undefined)
|
|
17
|
-
return '';
|
|
18
|
-
if (typeof value === 'string')
|
|
19
|
-
return value;
|
|
20
|
-
if (typeof value === 'number' || typeof value === 'boolean')
|
|
21
|
-
return String(value);
|
|
22
|
-
try {
|
|
23
|
-
return JSON.stringify(value, null, 2);
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return String(value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export function renderAgentRequestTemplate(template, data) {
|
|
30
|
-
return template.replace(/\{\{\s*([\w.-]+|\.)\s*\}\}/g, (_match, path) => stringifyTemplateValue(getTemplatePathValue(data, path)));
|
|
31
|
-
}
|
|
32
|
-
export function renderAgentRequestFallback(data) {
|
|
33
|
-
if (typeof data === 'string')
|
|
34
|
-
return data;
|
|
35
|
-
if (data === null || data === undefined)
|
|
36
|
-
return '';
|
|
37
|
-
return stringifyTemplateValue(data);
|
|
38
|
-
}
|
|
39
|
-
export function renderAgentRequestMessage(template, data) {
|
|
40
|
-
const trimmedTemplate = template?.trim();
|
|
41
|
-
if (!trimmedTemplate)
|
|
42
|
-
return renderAgentRequestFallback(data);
|
|
43
|
-
const rendered = renderAgentRequestTemplate(trimmedTemplate, data).trim();
|
|
44
|
-
return rendered;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=agent-request-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-request-template.js","sourceRoot":"","sources":["../src/agent-request-template.ts"],"names":[],"mappings":"AAAA,SAAS,aAAa,CAAC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A6B,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE,CAC5E,sBAAsB,CAAC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAC3D,CAAC;AACN,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,IAAa;IACpD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,QAA4B,EAAE,IAAa;IACjF,MAAM,eAAe,GAAG,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzC,IAAI,CAAC,eAAe;QAAE,OAAO,0BAA0B,CAAC,IAAI,CAAC,CAAC;IAE9D,MAAM,QAAQ,GAAG,0BAA0B,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1E,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
package/lib/channels.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type EmailChannel, type UserChannel } from './interaction.js';
|
|
2
|
-
/**
|
|
3
|
-
* Find the email channel from a list of channels.
|
|
4
|
-
* @returns The email channel if found, undefined otherwise
|
|
5
|
-
*/
|
|
6
|
-
export declare function findEmailChannel(channels?: UserChannel[]): EmailChannel | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Check if email channel is enabled in the channels list.
|
|
9
|
-
*/
|
|
10
|
-
export declare function hasEmailChannel(channels?: UserChannel[]): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Update the email channel in a channels array (immutable).
|
|
13
|
-
* Returns a new array with the updated channel.
|
|
14
|
-
* If no email channel exists and to_email is provided, creates one.
|
|
15
|
-
*/
|
|
16
|
-
export declare function updateEmailChannel(channels: UserChannel[] | undefined, updates: Partial<Omit<EmailChannel, 'type'>>): UserChannel[];
|
|
17
|
-
/**
|
|
18
|
-
* Update email threading info after sending or receiving an email.
|
|
19
|
-
* Adds the new messageId to references and updates in_reply_to.
|
|
20
|
-
*/
|
|
21
|
-
export declare function updateEmailThreading(channels: UserChannel[] | undefined, messageId: string, subject?: string): UserChannel[];
|
|
22
|
-
//# sourceMappingURL=channels.d.ts.map
|
package/lib/channels.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../src/channels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAkB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEvF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,GAAG,YAAY,GAAG,SAAS,CAEnF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,WAAW,EAAE,GAAG,SAAS,EACnC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,GAC7C,WAAW,EAAE,CAoBf;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,WAAW,EAAE,GAAG,SAAS,EACnC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACjB,WAAW,EAAE,CAcf"}
|
package/lib/channels.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { isEmailChannel } from './interaction.js';
|
|
2
|
-
/**
|
|
3
|
-
* Find the email channel from a list of channels.
|
|
4
|
-
* @returns The email channel if found, undefined otherwise
|
|
5
|
-
*/
|
|
6
|
-
export function findEmailChannel(channels) {
|
|
7
|
-
return channels?.find(isEmailChannel);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Check if email channel is enabled in the channels list.
|
|
11
|
-
*/
|
|
12
|
-
export function hasEmailChannel(channels) {
|
|
13
|
-
return !!findEmailChannel(channels);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Update the email channel in a channels array (immutable).
|
|
17
|
-
* Returns a new array with the updated channel.
|
|
18
|
-
* If no email channel exists and to_email is provided, creates one.
|
|
19
|
-
*/
|
|
20
|
-
export function updateEmailChannel(channels, updates) {
|
|
21
|
-
const existing = channels || [];
|
|
22
|
-
const emailIndex = existing.findIndex(isEmailChannel);
|
|
23
|
-
if (emailIndex === -1) {
|
|
24
|
-
// No email channel exists, create one if we have required fields
|
|
25
|
-
if (updates.to_email) {
|
|
26
|
-
return [...existing, { type: 'email', ...updates }];
|
|
27
|
-
}
|
|
28
|
-
return existing;
|
|
29
|
-
}
|
|
30
|
-
// Update existing email channel
|
|
31
|
-
const updated = [...existing];
|
|
32
|
-
updated[emailIndex] = {
|
|
33
|
-
...updated[emailIndex],
|
|
34
|
-
...updates,
|
|
35
|
-
type: 'email',
|
|
36
|
-
};
|
|
37
|
-
return updated;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Update email threading info after sending or receiving an email.
|
|
41
|
-
* Adds the new messageId to references and updates in_reply_to.
|
|
42
|
-
*/
|
|
43
|
-
export function updateEmailThreading(channels, messageId, subject) {
|
|
44
|
-
const emailChannel = findEmailChannel(channels);
|
|
45
|
-
if (!emailChannel)
|
|
46
|
-
return channels || [];
|
|
47
|
-
const newReferences = emailChannel.references ? [...emailChannel.references] : [];
|
|
48
|
-
if (!newReferences.includes(messageId)) {
|
|
49
|
-
newReferences.push(messageId);
|
|
50
|
-
}
|
|
51
|
-
return updateEmailChannel(channels, {
|
|
52
|
-
in_reply_to: messageId,
|
|
53
|
-
references: newReferences,
|
|
54
|
-
thread_subject: subject || emailChannel.thread_subject,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=channels.js.map
|
package/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AY;QAAE,OAAO,QAAQ,IAAI,EAAE,CAAC;IAEzC,MAAM,aAAa,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACrC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,kBAAkB,CAAC,QAAQ,EAAE;QAChC,WAAW,EAAE,SAAS;QACtB,UAAU,EAAE,aAAa;QACzB,cAAc,EAAE,OAAO,IAAI,YAAY,CAAC,cAAc;KACzD,CAAC,CAAC;AACP,CAAC"}
|
package/lib/host-utils.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function normalizeHost(value: unknown): string | undefined;
|
|
2
|
-
export declare function hostFromUrl(value: string, baseUrl?: string): string | undefined;
|
|
3
|
-
export declare function normalizeHostList(value: unknown): string[];
|
|
4
|
-
export declare function hostMatchesAny(host: string, allowlist: readonly string[] | undefined): boolean;
|
|
5
|
-
export declare function urlMatchesAnyHost(url: string, allowlist: readonly string[] | undefined, baseUrl?: string): boolean;
|
|
6
|
-
export declare function isLocalhostOrVertesiaHost(value: string | undefined): boolean;
|
|
7
|
-
export declare function isLocalhostOrVertesiaUrl(value: string): boolean;
|
|
8
|
-
//# sourceMappingURL=host-utils.d.ts.map
|
package/lib/host-utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"host-utils.d.ts","sourceRoot":"","sources":["../src/host-utils.ts"],"names":[],"mappings":"AAwBA,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAmBhE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO/E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAG1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAU9F;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAIlH;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAU5E;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG/D"}
|
package/lib/host-utils.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
function stripLeadingWildcard(host) {
|
|
2
|
-
return host.startsWith('*.') ? host.slice(2) : host;
|
|
3
|
-
}
|
|
4
|
-
function stripIPv6Brackets(host) {
|
|
5
|
-
return host.startsWith('[') && host.endsWith(']') ? host.slice(1, -1) : host;
|
|
6
|
-
}
|
|
7
|
-
function looksLikeBareIpv6(host) {
|
|
8
|
-
const firstColon = host.indexOf(':');
|
|
9
|
-
return firstColon >= 0 && host.indexOf(':', firstColon + 1) >= 0 && !host.startsWith('[');
|
|
10
|
-
}
|
|
11
|
-
function hasWhitespace(host) {
|
|
12
|
-
return (host.includes(' ') ||
|
|
13
|
-
host.includes('\t') ||
|
|
14
|
-
host.includes('\n') ||
|
|
15
|
-
host.includes('\r') ||
|
|
16
|
-
host.includes('\f') ||
|
|
17
|
-
host.includes('\v'));
|
|
18
|
-
}
|
|
19
|
-
export function normalizeHost(value) {
|
|
20
|
-
if (typeof value !== 'string')
|
|
21
|
-
return undefined;
|
|
22
|
-
let input = value.trim().toLowerCase();
|
|
23
|
-
if (!input)
|
|
24
|
-
return undefined;
|
|
25
|
-
input = stripLeadingWildcard(input);
|
|
26
|
-
input = input.endsWith('.') ? input.slice(0, -1) : input;
|
|
27
|
-
if (!input.includes('://')) {
|
|
28
|
-
input = looksLikeBareIpv6(input) ? `https://[${input}]` : `https://${input}`;
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
const url = new URL(input);
|
|
32
|
-
let host = stripLeadingWildcard(stripIPv6Brackets(url.hostname.toLowerCase()));
|
|
33
|
-
host = host.endsWith('.') ? host.slice(0, -1) : host;
|
|
34
|
-
return host && !hasWhitespace(host) ? host : undefined;
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export function hostFromUrl(value, baseUrl) {
|
|
41
|
-
try {
|
|
42
|
-
const url = baseUrl ? new URL(value, baseUrl) : new URL(value);
|
|
43
|
-
return normalizeHost(url.hostname);
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export function normalizeHostList(value) {
|
|
50
|
-
if (!Array.isArray(value))
|
|
51
|
-
return [];
|
|
52
|
-
return Array.from(new Set(value.map((entry) => normalizeHost(entry)).filter((entry) => !!entry)));
|
|
53
|
-
}
|
|
54
|
-
export function hostMatchesAny(host, allowlist) {
|
|
55
|
-
if (!allowlist || allowlist.length === 0)
|
|
56
|
-
return true;
|
|
57
|
-
const normalizedHost = normalizeHost(host);
|
|
58
|
-
if (!normalizedHost)
|
|
59
|
-
return false;
|
|
60
|
-
return allowlist.some((entry) => {
|
|
61
|
-
const normalizedEntry = normalizeHost(entry);
|
|
62
|
-
return (!!normalizedEntry && (normalizedHost === normalizedEntry || normalizedHost.endsWith(`.${normalizedEntry}`)));
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
export function urlMatchesAnyHost(url, allowlist, baseUrl) {
|
|
66
|
-
if (!allowlist || allowlist.length === 0)
|
|
67
|
-
return true;
|
|
68
|
-
const host = hostFromUrl(url, baseUrl);
|
|
69
|
-
return !!host && hostMatchesAny(host, allowlist);
|
|
70
|
-
}
|
|
71
|
-
export function isLocalhostOrVertesiaHost(value) {
|
|
72
|
-
const host = normalizeHost(value);
|
|
73
|
-
return (!!host &&
|
|
74
|
-
(host === 'localhost' ||
|
|
75
|
-
host === '127.0.0.1' ||
|
|
76
|
-
host === '::1' ||
|
|
77
|
-
host === 'vertesia.io' ||
|
|
78
|
-
host.endsWith('.vertesia.io')));
|
|
79
|
-
}
|
|
80
|
-
export function isLocalhostOrVertesiaUrl(value) {
|
|
81
|
-
const host = hostFromUrl(value);
|
|
82
|
-
return isLocalhostOrVertesiaHost(host);
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=host-utils.js.map
|
package/lib/host-utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"host-utils.js","sourceRoot":"","sources":["../src/host-utils.ts"],"names":[],"mappings":"AAAA,SAAS,oBAAoB,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjF,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACnC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,UAAU,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;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AC,CAAC,KAAK,EAAE,EAAE;QAC5B,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO,CACH,CAAC,CAAC,eAAe,IAAI,CAAC,cAAc,KAAK,eAAe,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC,CAC9G,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,SAAwC,EAAE,OAAgB;IACrG,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,CAAC,IAAI,IAAI,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,KAAyB;IAC/D,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,CACH,CAAC,CAAC,IAAI;QACN,CAAC,IAAI,KAAK,WAAW;YACjB,IAAI,KAAK,WAAW;YACpB,IAAI,KAAK,KAAK;YACd,IAAI,KAAK,aAAa;YACtB,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CACrC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,KAAa;IAClD,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { CreateEventSubscriptionPayload, EventCategory, EventPriority, UpdateEventSubscriptionPayload } from './platform-event.js';
|
|
2
|
-
import { SystemRoles } from './project.js';
|
|
3
|
-
export declare const DEFAULT_WEBHOOK_TIMEOUT_MS = 30000;
|
|
4
|
-
export declare const MAX_WEBHOOK_TIMEOUT_MS = 50000;
|
|
5
|
-
export declare const EVENT_CATEGORIES: readonly EventCategory[];
|
|
6
|
-
export declare const EVENT_PRIORITIES: readonly EventPriority[];
|
|
7
|
-
/** Default agent-evaluator iteration budget for a semantic condition. */
|
|
8
|
-
export declare const DEFAULT_SEMANTIC_AGENT_MAX_ITERATIONS = 10;
|
|
9
|
-
/** Maximum agent-evaluator iteration budget a user may request. */
|
|
10
|
-
export declare const MAX_SEMANTIC_AGENT_MAX_ITERATIONS = 30;
|
|
11
|
-
/** Default content-excerpt size (chars) included in the interaction classifier prompt. */
|
|
12
|
-
export declare const DEFAULT_SEMANTIC_MAX_CONTENT_CHARS = 4000;
|
|
13
|
-
/** Maximum content-excerpt size (chars) a user may request. */
|
|
14
|
-
export declare const MAX_SEMANTIC_MAX_CONTENT_CHARS = 20000;
|
|
15
|
-
/** Maximum length of a semantic condition instruction. */
|
|
16
|
-
export declare const MAX_SEMANTIC_CONDITION_INSTRUCTION_LENGTH = 2000;
|
|
17
|
-
/** Default action stamped on an ingested external event when none is provided/mapped. */
|
|
18
|
-
export declare const DEFAULT_EXTERNAL_EVENT_ACTION = "received";
|
|
19
|
-
/** Default resource_type stamped on an ingested external event when none is provided/mapped. */
|
|
20
|
-
export declare const DEFAULT_EXTERNAL_EVENT_RESOURCE_TYPE = "external_event";
|
|
21
|
-
/** Prefix combined with a channel `source` to form the event `source` (`external:<source>`). */
|
|
22
|
-
export declare const EXTERNAL_EVENT_SOURCE_PREFIX = "external:";
|
|
23
|
-
/** Role an event subscription runs as when none is specified. */
|
|
24
|
-
export declare const DEFAULT_EVENT_SUBSCRIPTION_RUN_AS_ROLE = SystemRoles.automation;
|
|
25
|
-
/**
|
|
26
|
-
* Roles a user may select for an event subscription's run_as_role. System subscriptions may use
|
|
27
|
-
* additional roles (e.g. content_processor); this list gates user input in the API, agent tools,
|
|
28
|
-
* and UI — keep all three consuming this constant.
|
|
29
|
-
*/
|
|
30
|
-
export declare const EVENT_SUBSCRIPTION_RUN_AS_ROLES: readonly SystemRoles[];
|
|
31
|
-
/**
|
|
32
|
-
* JSONLogic operators accepted in event subscription filter conditions. The event-bus evaluator
|
|
33
|
-
* rejects any operator not in this list (fail closed); the UI condition editor uses it for
|
|
34
|
-
* completion and validation.
|
|
35
|
-
*/
|
|
36
|
-
export declare const EVENT_CONDITION_JSON_LOGIC_OPERATORS: readonly string[];
|
|
37
|
-
export interface EventSubscriptionValidationResult {
|
|
38
|
-
valid: boolean;
|
|
39
|
-
errors: string[];
|
|
40
|
-
}
|
|
41
|
-
export declare function getCreateEventSubscriptionValidationResult(payload: CreateEventSubscriptionPayload): EventSubscriptionValidationResult;
|
|
42
|
-
export declare function getUpdateEventSubscriptionValidationResult(payload: UpdateEventSubscriptionPayload): EventSubscriptionValidationResult;
|
|
43
|
-
export declare function validateCreateEventSubscriptionInput(payload: CreateEventSubscriptionPayload): void;
|
|
44
|
-
export declare function validateUpdateEventSubscriptionInput(payload: UpdateEventSubscriptionPayload): void;
|
|
45
|
-
//# sourceMappingURL=platform-event-validation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-event-validation.d.ts","sourceRoot":"","sources":["../src/platform-event-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,8BAA8B,EAC9B,aAAa,EAEb,aAAa,EAEb,8BAA8B,EACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAY3C,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAE7C,eAAO,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAOpD,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAA8B,CAAC;AAEpF,yEAAyE;AACzE,eAAO,MAAM,qCAAqC,KAAK,CAAC;AACxD,mEAAmE;AACnE,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,0FAA0F;AAC1F,eAAO,MAAM,kCAAkC,OAAO,CAAC;AACvD,+DAA+D;AAC/D,eAAO,MAAM,8BAA8B,QAAS,CAAC;AACrD,0DAA0D;AAC1D,eAAO,MAAM,yCAAyC,OAAO,CAAC;AAE9D,yFAAyF;AACzF,eAAO,MAAM,6BAA6B,aAAa,CAAC;AACxD,gGAAgG;AAChG,eAAO,MAAM,oCAAoC,mBAAmB,CAAC;AACrE,gGAAgG;AAChG,eAAO,MAAM,4BAA4B,cAAc,CAAC;AAExD,iEAAiE;AACjE,eAAO,MAAM,sCAAsC,yBAAyB,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,WAAW,EAIjE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,EAAE,SAAS,MAAM,EAmCjE,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAC9C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CACpB;AAuMD,wBAAgB,0CAA0C,CACtD,OAAO,EAAE,8BAA8B,GACxC,iCAAiC,CA0BnC;AAED,wBAAgB,0CAA0C,CACtD,OAAO,EAAE,8BAA8B,GACxC,iCAAiC,CAgBnC;AAED,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,8BAA8B,GAAG,IAAI,CAKlG;AAED,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,8BAA8B,GAAG,IAAI,CAKlG"}
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import { SystemRoles } from './project.js';
|
|
2
|
-
/**
|
|
3
|
-
* Statuses an `agent_signal` target may list in `statuses` — the run statuses that can be **directly
|
|
4
|
-
* signalled**. Only a live (`running`, possibly idle) run has an active Temporal workflow that accepts a
|
|
5
|
-
* signal; `created` runs have no workflow bound yet, and terminal runs are handled separately by
|
|
6
|
-
* `on_terminal` (`restart` re-activates the newest terminal run, then signals). Restricting the set keeps
|
|
7
|
-
* config from silently trying to signal a closed workflow.
|
|
8
|
-
*/
|
|
9
|
-
const SIGNALABLE_AGENT_RUN_STATUS_VALUES = ['running'];
|
|
10
|
-
export const DEFAULT_WEBHOOK_TIMEOUT_MS = 30_000;
|
|
11
|
-
export const MAX_WEBHOOK_TIMEOUT_MS = 50_000;
|
|
12
|
-
export const EVENT_CATEGORIES = [
|
|
13
|
-
'content',
|
|
14
|
-
'workflow',
|
|
15
|
-
'security',
|
|
16
|
-
'billing',
|
|
17
|
-
'system',
|
|
18
|
-
'external',
|
|
19
|
-
];
|
|
20
|
-
export const EVENT_PRIORITIES = ['high', 'normal', 'low'];
|
|
21
|
-
/** Default agent-evaluator iteration budget for a semantic condition. */
|
|
22
|
-
export const DEFAULT_SEMANTIC_AGENT_MAX_ITERATIONS = 10;
|
|
23
|
-
/** Maximum agent-evaluator iteration budget a user may request. */
|
|
24
|
-
export const MAX_SEMANTIC_AGENT_MAX_ITERATIONS = 30;
|
|
25
|
-
/** Default content-excerpt size (chars) included in the interaction classifier prompt. */
|
|
26
|
-
export const DEFAULT_SEMANTIC_MAX_CONTENT_CHARS = 4000;
|
|
27
|
-
/** Maximum content-excerpt size (chars) a user may request. */
|
|
28
|
-
export const MAX_SEMANTIC_MAX_CONTENT_CHARS = 20_000;
|
|
29
|
-
/** Maximum length of a semantic condition instruction. */
|
|
30
|
-
export const MAX_SEMANTIC_CONDITION_INSTRUCTION_LENGTH = 2000;
|
|
31
|
-
/** Default action stamped on an ingested external event when none is provided/mapped. */
|
|
32
|
-
export const DEFAULT_EXTERNAL_EVENT_ACTION = 'received';
|
|
33
|
-
/** Default resource_type stamped on an ingested external event when none is provided/mapped. */
|
|
34
|
-
export const DEFAULT_EXTERNAL_EVENT_RESOURCE_TYPE = 'external_event';
|
|
35
|
-
/** Prefix combined with a channel `source` to form the event `source` (`external:<source>`). */
|
|
36
|
-
export const EXTERNAL_EVENT_SOURCE_PREFIX = 'external:';
|
|
37
|
-
/** Role an event subscription runs as when none is specified. */
|
|
38
|
-
export const DEFAULT_EVENT_SUBSCRIPTION_RUN_AS_ROLE = SystemRoles.automation;
|
|
39
|
-
/**
|
|
40
|
-
* Roles a user may select for an event subscription's run_as_role. System subscriptions may use
|
|
41
|
-
* additional roles (e.g. content_processor); this list gates user input in the API, agent tools,
|
|
42
|
-
* and UI — keep all three consuming this constant.
|
|
43
|
-
*/
|
|
44
|
-
export const EVENT_SUBSCRIPTION_RUN_AS_ROLES = [
|
|
45
|
-
SystemRoles.automation,
|
|
46
|
-
SystemRoles.executor,
|
|
47
|
-
SystemRoles.reader,
|
|
48
|
-
];
|
|
49
|
-
/**
|
|
50
|
-
* JSONLogic operators accepted in event subscription filter conditions. The event-bus evaluator
|
|
51
|
-
* rejects any operator not in this list (fail closed); the UI condition editor uses it for
|
|
52
|
-
* completion and validation.
|
|
53
|
-
*/
|
|
54
|
-
export const EVENT_CONDITION_JSON_LOGIC_OPERATORS = [
|
|
55
|
-
'!',
|
|
56
|
-
'!!',
|
|
57
|
-
'!=',
|
|
58
|
-
'!==',
|
|
59
|
-
'%',
|
|
60
|
-
'*',
|
|
61
|
-
'+',
|
|
62
|
-
'-',
|
|
63
|
-
'/',
|
|
64
|
-
'<',
|
|
65
|
-
'<=',
|
|
66
|
-
'==',
|
|
67
|
-
'===',
|
|
68
|
-
'>',
|
|
69
|
-
'>=',
|
|
70
|
-
'?:',
|
|
71
|
-
'all',
|
|
72
|
-
'and',
|
|
73
|
-
'cat',
|
|
74
|
-
'filter',
|
|
75
|
-
'if',
|
|
76
|
-
'in',
|
|
77
|
-
'map',
|
|
78
|
-
'max',
|
|
79
|
-
'merge',
|
|
80
|
-
'min',
|
|
81
|
-
'missing',
|
|
82
|
-
'missing_some',
|
|
83
|
-
'none',
|
|
84
|
-
'or',
|
|
85
|
-
'reduce',
|
|
86
|
-
'some',
|
|
87
|
-
'substr',
|
|
88
|
-
'var',
|
|
89
|
-
];
|
|
90
|
-
function isRecord(value) {
|
|
91
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
92
|
-
}
|
|
93
|
-
function isStringArray(value) {
|
|
94
|
-
return Array.isArray(value) && value.every((item) => typeof item === 'string');
|
|
95
|
-
}
|
|
96
|
-
function validateFilter(filter, errors) {
|
|
97
|
-
if (!isRecord(filter)) {
|
|
98
|
-
errors.push('filter must be an object');
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
const f = filter;
|
|
102
|
-
if (f.event_category !== undefined) {
|
|
103
|
-
if (!isStringArray(f.event_category)) {
|
|
104
|
-
errors.push('filter.event_category must be an array of strings');
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
for (const c of f.event_category) {
|
|
108
|
-
if (c !== '*' && !EVENT_CATEGORIES.includes(c)) {
|
|
109
|
-
errors.push(`filter.event_category contains unsupported value: ${c}`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (f.exclude_event_category !== undefined) {
|
|
115
|
-
if (!isStringArray(f.exclude_event_category)) {
|
|
116
|
-
errors.push('filter.exclude_event_category must be an array of strings');
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
for (const c of f.exclude_event_category) {
|
|
120
|
-
if (!EVENT_CATEGORIES.includes(c)) {
|
|
121
|
-
errors.push(`filter.exclude_event_category contains unsupported value: ${c}`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (f.action !== undefined && !isStringArray(f.action)) {
|
|
127
|
-
errors.push('filter.action must be an array of strings');
|
|
128
|
-
}
|
|
129
|
-
if (f.resource_type !== undefined && !isStringArray(f.resource_type)) {
|
|
130
|
-
errors.push('filter.resource_type must be an array of strings');
|
|
131
|
-
}
|
|
132
|
-
if (f.condition !== undefined && !isRecord(f.condition)) {
|
|
133
|
-
errors.push('filter.condition must be a JSON Logic object');
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
function validateTarget(target, errors) {
|
|
137
|
-
if (!isRecord(target)) {
|
|
138
|
-
errors.push('target must be an object');
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const type = target.type;
|
|
142
|
-
if (type !== 'workflow' && type !== 'webhook' && type !== 'app' && type !== 'agent' && type !== 'process') {
|
|
143
|
-
errors.push('target.type must be one of workflow, webhook, app, agent, process');
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const t = target;
|
|
147
|
-
switch (t.type) {
|
|
148
|
-
case 'workflow':
|
|
149
|
-
if (typeof t.endpoint !== 'string' || t.endpoint.length === 0) {
|
|
150
|
-
errors.push('workflow target requires a non-empty "endpoint"');
|
|
151
|
-
}
|
|
152
|
-
break;
|
|
153
|
-
case 'webhook': {
|
|
154
|
-
if (typeof t.url !== 'string' || t.url.length === 0) {
|
|
155
|
-
errors.push('webhook target requires a non-empty "url"');
|
|
156
|
-
}
|
|
157
|
-
if (t.timeout_ms !== undefined) {
|
|
158
|
-
if (!Number.isInteger(t.timeout_ms) || t.timeout_ms <= 0 || t.timeout_ms > MAX_WEBHOOK_TIMEOUT_MS) {
|
|
159
|
-
errors.push(`webhook target.timeout_ms must be an integer between 1 and ${MAX_WEBHOOK_TIMEOUT_MS}`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (t.signing_mode !== undefined && t.signing_mode !== 'signed' && t.signing_mode !== 'legacy_unsigned') {
|
|
163
|
-
errors.push('webhook target.signing_mode must be "signed" or "legacy_unsigned"');
|
|
164
|
-
}
|
|
165
|
-
if (t.payload_mode !== undefined &&
|
|
166
|
-
t.payload_mode !== 'event_envelope' &&
|
|
167
|
-
t.payload_mode !== 'legacy_notify_endpoint' &&
|
|
168
|
-
t.payload_mode !== 'workflow_notification') {
|
|
169
|
-
errors.push('webhook target.payload_mode must be "event_envelope", "legacy_notify_endpoint" or "workflow_notification"');
|
|
170
|
-
}
|
|
171
|
-
if (t.encrypted_headers === true) {
|
|
172
|
-
errors.push('webhook target.encrypted_headers is not supported');
|
|
173
|
-
}
|
|
174
|
-
if (t.headers !== undefined && !isRecord(t.headers)) {
|
|
175
|
-
errors.push('webhook target.headers must be an object of strings');
|
|
176
|
-
}
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
case 'app': {
|
|
180
|
-
for (const field of ['app_id', 'installation_id', 'hook', 'url']) {
|
|
181
|
-
if (typeof t[field] !== 'string' || t[field].length === 0) {
|
|
182
|
-
errors.push(`app target requires a non-empty "${field}"`);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (t.timeout_ms !== undefined) {
|
|
186
|
-
if (!Number.isInteger(t.timeout_ms) || t.timeout_ms <= 0 || t.timeout_ms > MAX_WEBHOOK_TIMEOUT_MS) {
|
|
187
|
-
errors.push(`app target.timeout_ms must be an integer between 1 and ${MAX_WEBHOOK_TIMEOUT_MS}`);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
case 'process':
|
|
193
|
-
if ((typeof t.process_ref !== 'string' || t.process_ref.length === 0) && !isRecord(t.process_definition)) {
|
|
194
|
-
errors.push('process target requires "process_ref" or an inline "process_definition"');
|
|
195
|
-
}
|
|
196
|
-
break;
|
|
197
|
-
case 'agent': {
|
|
198
|
-
// One target with three behaviors selected by `on_match` (default `start`): start a run,
|
|
199
|
-
// signal an existing run, or ensure (signal-or-start). `signal`/`ensure` need `message_path`
|
|
200
|
-
// and use the gate/signal fields; `missing_thread` is only meaningful for `signal`.
|
|
201
|
-
const onMatch = t.on_match ?? 'start';
|
|
202
|
-
if (onMatch !== 'start' && onMatch !== 'signal' && onMatch !== 'ensure') {
|
|
203
|
-
errors.push('agent target.on_match must be "start", "signal", or "ensure"');
|
|
204
|
-
}
|
|
205
|
-
const needsMessage = onMatch === 'signal' || onMatch === 'ensure';
|
|
206
|
-
if (needsMessage && (typeof t.message_path !== 'string' || t.message_path.length === 0)) {
|
|
207
|
-
errors.push(`agent target.message_path is required when on_match is "${onMatch}"`);
|
|
208
|
-
}
|
|
209
|
-
// Only the UserInput signal is implemented (the dispatcher always sends a UserInput-shaped
|
|
210
|
-
// payload), so reject other names rather than silently mis-deliver.
|
|
211
|
-
if (t.signal_name !== undefined && t.signal_name !== 'UserInput') {
|
|
212
|
-
errors.push('agent target.signal_name must be "UserInput"');
|
|
213
|
-
}
|
|
214
|
-
// Optional dot-path / ref fields are read dynamically at runtime — reject non-strings early.
|
|
215
|
-
for (const field of [
|
|
216
|
-
'interaction_ref',
|
|
217
|
-
'message_path',
|
|
218
|
-
'client_message_id_path',
|
|
219
|
-
'skip_if_path_exists',
|
|
220
|
-
'author_path',
|
|
221
|
-
]) {
|
|
222
|
-
const value = t[field];
|
|
223
|
-
if (value !== undefined && typeof value !== 'string') {
|
|
224
|
-
errors.push(`agent target.${field} must be a string`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (t.metadata !== undefined && !isRecord(t.metadata)) {
|
|
228
|
-
errors.push('agent target.metadata must be an object');
|
|
229
|
-
}
|
|
230
|
-
if (t.statuses !== undefined) {
|
|
231
|
-
if (!isStringArray(t.statuses)) {
|
|
232
|
-
errors.push('agent target.statuses must be an array of strings');
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
const invalid = t.statuses.filter((s) => !SIGNALABLE_AGENT_RUN_STATUS_VALUES.includes(s));
|
|
236
|
-
if (invalid.length > 0) {
|
|
237
|
-
errors.push(`agent target.statuses may only contain signalable statuses: ${invalid.join(', ')} ` +
|
|
238
|
-
`not allowed. Allowed: ${SIGNALABLE_AGENT_RUN_STATUS_VALUES.join(', ')} ` +
|
|
239
|
-
`(terminal runs are handled by on_terminal).`);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
for (const field of ['ignore_author_patterns', 'require_command_prefixes', 'require_mentions']) {
|
|
244
|
-
const value = t[field];
|
|
245
|
-
if (value !== undefined && !isStringArray(value)) {
|
|
246
|
-
errors.push(`agent target.${field} must be an array of strings`);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
if (t.missing_thread !== undefined) {
|
|
250
|
-
if (onMatch !== 'signal') {
|
|
251
|
-
errors.push('agent target.missing_thread is only valid when on_match is "signal"');
|
|
252
|
-
}
|
|
253
|
-
else if (t.missing_thread !== 'retry' && t.missing_thread !== 'skip') {
|
|
254
|
-
errors.push('agent target.missing_thread must be "retry" or "skip"');
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
if (t.on_terminal !== undefined && t.on_terminal !== 'skip' && t.on_terminal !== 'restart') {
|
|
258
|
-
errors.push('agent target.on_terminal must be "skip" or "restart"');
|
|
259
|
-
}
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
function validateCommonFields(payload, errors) {
|
|
265
|
-
if (payload.description !== undefined && typeof payload.description !== 'string') {
|
|
266
|
-
errors.push('description must be a string');
|
|
267
|
-
}
|
|
268
|
-
if (payload.run_as_role !== undefined && !Object.values(SystemRoles).includes(payload.run_as_role)) {
|
|
269
|
-
errors.push(`run_as_role contains unsupported value: ${payload.run_as_role}`);
|
|
270
|
-
}
|
|
271
|
-
if (payload.enabled !== undefined && typeof payload.enabled !== 'boolean') {
|
|
272
|
-
errors.push('enabled must be a boolean');
|
|
273
|
-
}
|
|
274
|
-
if (payload.priority !== undefined && !EVENT_PRIORITIES.includes(payload.priority)) {
|
|
275
|
-
errors.push(`priority must be one of ${EVENT_PRIORITIES.join(', ')}`);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
export function getCreateEventSubscriptionValidationResult(payload) {
|
|
279
|
-
const errors = [];
|
|
280
|
-
if (typeof payload?.name !== 'string' || payload.name.trim().length === 0) {
|
|
281
|
-
errors.push('name is required');
|
|
282
|
-
}
|
|
283
|
-
if (payload?.scope !== undefined && payload.scope !== 'account' && payload.scope !== 'project') {
|
|
284
|
-
errors.push('scope must be "account" or "project"');
|
|
285
|
-
}
|
|
286
|
-
if (payload?.filter === undefined) {
|
|
287
|
-
errors.push('filter is required');
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
validateFilter(payload.filter, errors);
|
|
291
|
-
}
|
|
292
|
-
if (payload?.target === undefined) {
|
|
293
|
-
errors.push('target is required');
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
validateTarget(payload.target, errors);
|
|
297
|
-
}
|
|
298
|
-
// run_as_role is required at creation: every subscription must declare an explicit run-as
|
|
299
|
-
// identity so its delivery never falls back to running as the originating (possibly deleted)
|
|
300
|
-
// user. validateCommonFields validates the value when present; this enforces presence.
|
|
301
|
-
if (payload?.run_as_role === undefined) {
|
|
302
|
-
errors.push('run_as_role is required');
|
|
303
|
-
}
|
|
304
|
-
validateCommonFields(payload ?? {}, errors);
|
|
305
|
-
return { valid: errors.length === 0, errors };
|
|
306
|
-
}
|
|
307
|
-
export function getUpdateEventSubscriptionValidationResult(payload) {
|
|
308
|
-
const errors = [];
|
|
309
|
-
if (!isRecord(payload)) {
|
|
310
|
-
return { valid: false, errors: ['update payload must be an object'] };
|
|
311
|
-
}
|
|
312
|
-
if (payload.name !== undefined && (typeof payload.name !== 'string' || payload.name.trim().length === 0)) {
|
|
313
|
-
errors.push('name must be a non-empty string');
|
|
314
|
-
}
|
|
315
|
-
if (payload.filter !== undefined) {
|
|
316
|
-
validateFilter(payload.filter, errors);
|
|
317
|
-
}
|
|
318
|
-
if (payload.target !== undefined) {
|
|
319
|
-
validateTarget(payload.target, errors);
|
|
320
|
-
}
|
|
321
|
-
validateCommonFields(payload, errors);
|
|
322
|
-
return { valid: errors.length === 0, errors };
|
|
323
|
-
}
|
|
324
|
-
export function validateCreateEventSubscriptionInput(payload) {
|
|
325
|
-
const result = getCreateEventSubscriptionValidationResult(payload);
|
|
326
|
-
if (!result.valid) {
|
|
327
|
-
throw new Error(result.errors.join('; '));
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
export function validateUpdateEventSubscriptionInput(payload) {
|
|
331
|
-
const result = getUpdateEventSubscriptionValidationResult(payload);
|
|
332
|
-
if (!result.valid) {
|
|
333
|
-
throw new Error(result.errors.join('; '));
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
//# sourceMappingURL=platform-event-validation.js.map
|