@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
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
import { Ajv2020 } from 'ajv/dist/2020.js';
|
|
2
|
+
import ajvFormats from 'ajv-formats';
|
|
3
|
+
import { findUnprunablePaths, isPlainObject, pruneToSchema } from '../api-schemas/adapter.js';
|
|
4
|
+
import { normalizeParameters, } from '../api-schemas/parameters.js';
|
|
5
|
+
import API_SCHEMA_COMPONENTS from './components.generated.json' with { type: 'json' };
|
|
6
|
+
// ajv-formats is CommonJS with an ESM-style declaration file. Node's interop makes the default
|
|
7
|
+
// import the whole `module.exports` (itself callable), while TypeScript sees the namespace — and
|
|
8
|
+
// `.default` is the plugin function in both shapes.
|
|
9
|
+
const addFormats = ajvFormats.default;
|
|
10
|
+
/**
|
|
11
|
+
* The canonical `components.schemas` for all documented endpoints.
|
|
12
|
+
*
|
|
13
|
+
* This exact object is what the OpenAPI spec publishes AND what AJV compiles, so the published
|
|
14
|
+
* contract and the enforced contract cannot diverge. It is the prebuilt emission of the Zod
|
|
15
|
+
* registry rather than a live conversion of it — see the module comment.
|
|
16
|
+
*
|
|
17
|
+
* Widened on import on purpose: `resolveJsonModule` would otherwise infer the literal type of a
|
|
18
|
+
* 1187-key document and bake it into this package's `.d.ts`.
|
|
19
|
+
*/
|
|
20
|
+
export const ApiSchemaComponents = API_SCHEMA_COMPONENTS;
|
|
21
|
+
/**
|
|
22
|
+
* A canonical component as a SELF-CONTAINED JSON Schema, for consumers that compile it directly.
|
|
23
|
+
*
|
|
24
|
+
* `components` defaults to the generated artifact, which is what a server wants. A GENERATOR must
|
|
25
|
+
* pass `buildApiSchemaComponents()` instead: the artifact on disk is the previous run's output, so
|
|
26
|
+
* bundling from it would emit an artifact derived from the last contract rather than the current Zod
|
|
27
|
+
* schemas — and, run in the wrong order, would leave the two generated files describing different
|
|
28
|
+
* shapes. Passing the fresh emission makes each generator independent of the others' ordering.
|
|
29
|
+
*
|
|
30
|
+
* The published component `$ref`s its neighbours through `#/components/schemas/...`, which resolves
|
|
31
|
+
* only inside the OpenAPI document. AJV and the Monaco editor need a document they can compile on
|
|
32
|
+
* its own, so the transitive closure is inlined under `$defs` and the pointers rewritten. Nothing
|
|
33
|
+
* about the shapes changes — this is a re-rooting of the same objects, plus the removal of the
|
|
34
|
+
* OpenAPI-only discriminator keywords described below, which is what lets a generated artifact be
|
|
35
|
+
* compared with the component it came from.
|
|
36
|
+
*/
|
|
37
|
+
export function bundleCanonicalComponent(name, components = ApiSchemaComponents) {
|
|
38
|
+
const seen = new Set();
|
|
39
|
+
const queue = [name];
|
|
40
|
+
while (queue.length > 0) {
|
|
41
|
+
const current = queue.shift();
|
|
42
|
+
if (seen.has(current))
|
|
43
|
+
continue;
|
|
44
|
+
seen.add(current);
|
|
45
|
+
for (const referenced of collectComponentRefs(components[current])) {
|
|
46
|
+
if (!seen.has(referenced))
|
|
47
|
+
queue.push(referenced);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
seen.delete(name);
|
|
51
|
+
const defs = {};
|
|
52
|
+
for (const dependency of [...seen].sort()) {
|
|
53
|
+
defs[dependency] = toPlainJsonSchema(components[dependency]);
|
|
54
|
+
}
|
|
55
|
+
const root = toPlainJsonSchema(components[name]);
|
|
56
|
+
return seen.size > 0 ? { ...root, $defs: defs } : root;
|
|
57
|
+
}
|
|
58
|
+
const COMPONENT_REF_PREFIX = '#/components/schemas/';
|
|
59
|
+
/**
|
|
60
|
+
* Re-roots the component pointers AND drops the discriminator keywords, which are OpenAPI's, not
|
|
61
|
+
* JSON Schema's.
|
|
62
|
+
*
|
|
63
|
+
* `synthesizeDiscriminator` in the adapter gives a discriminated union a `discriminator` plus a
|
|
64
|
+
* restated `type: 'object'` and `required: [propertyName]` ON THE UNION NODE, so a generated
|
|
65
|
+
* Java/Go client can pick a subtype from the union rather than the branches. That restatement is a
|
|
66
|
+
* codegen hint: the node carries no `properties`, so it says "an object that must have
|
|
67
|
+
* `_option_id`" while declaring nothing that could be one.
|
|
68
|
+
*
|
|
69
|
+
* A JSON Schema validator does not mind — `required` needs no matching `properties`, and each
|
|
70
|
+
* branch requires the same key anyway, so removing all three is validation-neutral. Gemini's
|
|
71
|
+
* function-declaration validator does mind, and rejects the whole tool:
|
|
72
|
+
*
|
|
73
|
+
* schema at properties.intake.properties.extraction.properties.config.properties.model_options
|
|
74
|
+
* requires unspecified property '_option_id'
|
|
75
|
+
*
|
|
76
|
+
* That was a 400 on every agent turn offering `create_or_update_type`, because the intake-policy
|
|
77
|
+
* artifact reaches Vertex inside that tool's input schema. Stripping here rather than at the tool
|
|
78
|
+
* keeps the next component someone bundles from reintroducing it. The OpenAPI document is untouched
|
|
79
|
+
* — `ApiSchemaComponents` still carries the hint, and the generated clients still read it.
|
|
80
|
+
*/
|
|
81
|
+
function toPlainJsonSchema(value) {
|
|
82
|
+
const rerooted = rerootComponentRefs(value);
|
|
83
|
+
return stripDiscriminators(rerooted);
|
|
84
|
+
}
|
|
85
|
+
function stripDiscriminators(value) {
|
|
86
|
+
if (Array.isArray(value))
|
|
87
|
+
return value.map(stripDiscriminators);
|
|
88
|
+
if (!value || typeof value !== 'object')
|
|
89
|
+
return value;
|
|
90
|
+
const node = value;
|
|
91
|
+
// `properties` present means the node describes an object in its own right, so its `type` and
|
|
92
|
+
// `required` are the schema's own rather than the restatement — only the OpenAPI keyword goes.
|
|
93
|
+
const restated = node.discriminator !== undefined && node.properties === undefined;
|
|
94
|
+
const out = {};
|
|
95
|
+
for (const [key, item] of Object.entries(node)) {
|
|
96
|
+
if (key === 'discriminator')
|
|
97
|
+
continue;
|
|
98
|
+
if (restated && (key === 'type' || key === 'required'))
|
|
99
|
+
continue;
|
|
100
|
+
out[key] = stripDiscriminators(item);
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
function collectComponentRefs(value, out = new Set()) {
|
|
105
|
+
if (Array.isArray(value)) {
|
|
106
|
+
for (const item of value)
|
|
107
|
+
collectComponentRefs(item, out);
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
if (!value || typeof value !== 'object')
|
|
111
|
+
return out;
|
|
112
|
+
for (const [key, item] of Object.entries(value)) {
|
|
113
|
+
if (key === '$ref' && typeof item === 'string' && item.startsWith(COMPONENT_REF_PREFIX)) {
|
|
114
|
+
out.add(item.slice(COMPONENT_REF_PREFIX.length));
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
collectComponentRefs(item, out);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
function rerootComponentRefs(value) {
|
|
123
|
+
if (Array.isArray(value))
|
|
124
|
+
return value.map(rerootComponentRefs);
|
|
125
|
+
if (!value || typeof value !== 'object')
|
|
126
|
+
return value;
|
|
127
|
+
const out = {};
|
|
128
|
+
for (const [key, item] of Object.entries(value)) {
|
|
129
|
+
out[key] =
|
|
130
|
+
key === '$ref' && typeof item === 'string' && item.startsWith(COMPONENT_REF_PREFIX)
|
|
131
|
+
? `#/$defs/${item.slice(COMPONENT_REF_PREFIX.length)}`
|
|
132
|
+
: rerootComponentRefs(item);
|
|
133
|
+
}
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
/** The `$ref` pointer for a component, in the same spelling the spec publishes. */
|
|
137
|
+
export function apiComponentRef(name) {
|
|
138
|
+
return `#/components/schemas/${name}`;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Validators compiled against the published components, through an envelope so the pointer AJV
|
|
142
|
+
* resolves is the exact pointer the spec publishes. `strictSchema: false` tolerates the
|
|
143
|
+
* `components` wrapper while leaving type and tuple checks active.
|
|
144
|
+
*
|
|
145
|
+
* Compiled lazily and cached: AJV compilation is the expensive step, and most components are
|
|
146
|
+
* never validated in a given process.
|
|
147
|
+
*/
|
|
148
|
+
const validators = new Map();
|
|
149
|
+
/**
|
|
150
|
+
* One instance for the process, built on first validation.
|
|
151
|
+
*
|
|
152
|
+
* Per-component instances meant re-registering the whole thousand-component envelope for every
|
|
153
|
+
* component ever validated, and AJV walks a schema when it is added. Sharing one instance also lets
|
|
154
|
+
* it reuse the compiled form of a component that two others reference.
|
|
155
|
+
*/
|
|
156
|
+
let ajvInstance;
|
|
157
|
+
/**
|
|
158
|
+
* The published components as AJV can consume them: the same schemas, with the two adjustments
|
|
159
|
+
* AJV's discriminator support requires and the OpenAPI document must not have.
|
|
160
|
+
*
|
|
161
|
+
* `discriminator: true` below is what makes AJV validate a discriminated union through the branch
|
|
162
|
+
* its tag names, instead of trying every branch and reporting all of their failures at once. The
|
|
163
|
+
* difference is not cosmetic — a legacy MCP tool collection missing `id` used to report the real
|
|
164
|
+
* error alongside two impossible ones from the branch it was never meant to match:
|
|
165
|
+
*
|
|
166
|
+
* / must have required property 'id' <- the real one
|
|
167
|
+
* / must NOT have additional properties: oauth_app <- vertesia_sdk branch
|
|
168
|
+
* /type must be equal to constant <- vertesia_sdk branch
|
|
169
|
+
* / must match exactly one schema in oneOf
|
|
170
|
+
*
|
|
171
|
+
* AJV rejects `mapping` outright ("discriminator: mapping is not supported"), because it derives
|
|
172
|
+
* the tag-to-branch map from each branch's own `const`/`enum` instead. The OpenAPI document still
|
|
173
|
+
* needs the mapping — a generated Java or Go client reads it to pick a concrete subtype — so both
|
|
174
|
+
* fixups here apply to AJV's copy only, and `ApiSchemaComponents` is published exactly as built.
|
|
175
|
+
*
|
|
176
|
+
* AJV's remaining requirements — the tag required in every branch, carrying `const` or a
|
|
177
|
+
* single-valued `enum`, with the union node typed as an object — are what `synthesizeDiscriminator`
|
|
178
|
+
* in the adapter already checks before it emits a discriminator at all, and what the hand-written
|
|
179
|
+
* `.meta({ discriminator })` declarations restate. `api-discriminators.test.ts` compiles every
|
|
180
|
+
* registered component so a union satisfying neither fails the build rather than the request.
|
|
181
|
+
*/
|
|
182
|
+
function toAjvComponents() {
|
|
183
|
+
const schemas = structuredClone(ApiSchemaComponents);
|
|
184
|
+
const resolve = (value) => {
|
|
185
|
+
if (!isPlainObject(value))
|
|
186
|
+
return undefined;
|
|
187
|
+
const ref = value.$ref;
|
|
188
|
+
if (typeof ref !== 'string' || !ref.startsWith(COMPONENT_REF_PREFIX))
|
|
189
|
+
return value;
|
|
190
|
+
return schemas[ref.slice(COMPONENT_REF_PREFIX.length)];
|
|
191
|
+
};
|
|
192
|
+
visitSchemaNodes(schemas, (node) => {
|
|
193
|
+
const discriminator = node.discriminator;
|
|
194
|
+
if (!isPlainObject(discriminator) || !Array.isArray(node.oneOf))
|
|
195
|
+
return;
|
|
196
|
+
// AJV derives the tag-to-branch map from each branch's own literal, so `mapping` is both
|
|
197
|
+
// redundant and rejected.
|
|
198
|
+
delete discriminator.mapping;
|
|
199
|
+
const tag = discriminator.propertyName;
|
|
200
|
+
if (typeof tag !== 'string')
|
|
201
|
+
return;
|
|
202
|
+
for (const member of node.oneOf) {
|
|
203
|
+
const branch = resolve(member);
|
|
204
|
+
const properties = branch && isPlainObject(branch.properties) ? branch.properties : undefined;
|
|
205
|
+
const tagSchema = properties?.[tag];
|
|
206
|
+
if (!isPlainObject(tagSchema) || tagSchema.const !== undefined || tagSchema.enum !== undefined)
|
|
207
|
+
continue;
|
|
208
|
+
// The tag is a `$ref` to a named literal component — `TaskType_ACTIVITY`,
|
|
209
|
+
// `SupportedIntegrations_gladia` — because the literal carries its own `.meta({ id })`.
|
|
210
|
+
// AJV reads `properties/<tag>` looking for `const` or `enum` and does not follow a
|
|
211
|
+
// `$ref` to find one, so it refuses to compile the union at all. Restating the resolved
|
|
212
|
+
// literal ALONGSIDE the `$ref` is validation-neutral: `$ref` has no special precedence
|
|
213
|
+
// in 2020-12, both keywords apply, and they carry the same value by construction.
|
|
214
|
+
const target = resolve(tagSchema);
|
|
215
|
+
if (!target)
|
|
216
|
+
continue;
|
|
217
|
+
if (target.const !== undefined)
|
|
218
|
+
tagSchema.const = target.const;
|
|
219
|
+
else if (Array.isArray(target.enum))
|
|
220
|
+
tagSchema.enum = target.enum;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return schemas;
|
|
224
|
+
}
|
|
225
|
+
/** Every object node in the component graph, parents before children. */
|
|
226
|
+
function visitSchemaNodes(value, visit) {
|
|
227
|
+
if (Array.isArray(value)) {
|
|
228
|
+
for (const item of value)
|
|
229
|
+
visitSchemaNodes(item, visit);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (!isPlainObject(value))
|
|
233
|
+
return;
|
|
234
|
+
visit(value);
|
|
235
|
+
for (const item of Object.values(value))
|
|
236
|
+
visitSchemaNodes(item, visit);
|
|
237
|
+
}
|
|
238
|
+
/** The `$id` the whole component envelope is registered under, and the base of every `$ref` to it. */
|
|
239
|
+
const AJV_SCHEMA_ID = 'vertesia://openapi';
|
|
240
|
+
function getAjv() {
|
|
241
|
+
if (ajvInstance)
|
|
242
|
+
return ajvInstance;
|
|
243
|
+
// `verbose` carries two things {@link collectIssues} needs and nothing else supplies: the schema
|
|
244
|
+
// object that raised each error, which is the only unambiguous way to tell one union candidate
|
|
245
|
+
// from another, and the value under evaluation, which is what a failed union is re-checked
|
|
246
|
+
// against. Both are populated only when validation fails, and both are references rather than
|
|
247
|
+
// copies.
|
|
248
|
+
// `allowUnionTypes` because a few published components declare `type: [...]` on purpose:
|
|
249
|
+
// `DurationValue` is `['string', 'number']` specifically so the generated Java client gets one
|
|
250
|
+
// writable property instead of the unusable `AnyOfnumber` an `anyOf` produces. AJV's
|
|
251
|
+
// `strictTypes` default of "log" reported that deliberate choice to its logger on every startup.
|
|
252
|
+
// The default logger is `console`, so the notice left on stderr, where log collectors routinely
|
|
253
|
+
// classify it as an error — turning a healthy design decision into recurring server error noise.
|
|
254
|
+
const ajv = new Ajv2020({
|
|
255
|
+
strictSchema: false,
|
|
256
|
+
allErrors: true,
|
|
257
|
+
discriminator: true,
|
|
258
|
+
verbose: true,
|
|
259
|
+
allowUnionTypes: true,
|
|
260
|
+
});
|
|
261
|
+
// Without this, AJV treats `format` as an annotation and ignores it, so a `date-time` property
|
|
262
|
+
// would document a constraint nothing checks — the exact spec/enforcement gap this design is
|
|
263
|
+
// meant to close.
|
|
264
|
+
addFormats(ajv);
|
|
265
|
+
ajv.addSchema({ $id: AJV_SCHEMA_ID, components: { schemas: toAjvComponents() } });
|
|
266
|
+
ajvInstance = ajv;
|
|
267
|
+
return ajv;
|
|
268
|
+
}
|
|
269
|
+
function getValidator(name) {
|
|
270
|
+
const cached = validators.get(name);
|
|
271
|
+
if (cached)
|
|
272
|
+
return cached;
|
|
273
|
+
const validate = getAjv().compile({ $ref: `${AJV_SCHEMA_ID}${apiComponentRef(name)}` });
|
|
274
|
+
validators.set(name, validate);
|
|
275
|
+
return validate;
|
|
276
|
+
}
|
|
277
|
+
function additionalProperty(error) {
|
|
278
|
+
// AJV writes "must NOT have additional properties" and puts the offending key in `params`,
|
|
279
|
+
// so the message alone says a body is wrong without saying which property made it wrong.
|
|
280
|
+
// Every other keyword names its subject already — `required` quotes the missing property,
|
|
281
|
+
// `enum` and `type` describe the value in place — and this is the one a caller most often
|
|
282
|
+
// trips, so it is the one worth spelling out rather than reformatting all of them.
|
|
283
|
+
return error.params?.additionalProperty;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* The failures, with the undeclared properties a SINGLE schema reported at a given path gathered
|
|
287
|
+
* into one issue, and each failed untagged union expanded per candidate.
|
|
288
|
+
*
|
|
289
|
+
* AJV reports `additionalProperties` per property, so a value carrying a whole foreign object — a
|
|
290
|
+
* Mongoose document that reached the response mapper unmapped, say — produces one error per own key
|
|
291
|
+
* and buries every other failure in the payload. Gathering is lossless: every name is kept, in the
|
|
292
|
+
* order AJV found it. It is keyed by the schema that raised the error as well as the path, so two
|
|
293
|
+
* candidates complaining at one path never merge into a single line. `schemaPath` will not do: a
|
|
294
|
+
* `$ref`'d candidate resets it to `#/additionalProperties`, identical for every candidate. The
|
|
295
|
+
* schema object itself is unambiguous, and `verbose: true` supplies it.
|
|
296
|
+
*
|
|
297
|
+
* `discriminator: true` narrows a TAGGED union to the one branch its tag names, so nothing below
|
|
298
|
+
* applies to those. What is left is the unions with no tag: AJV runs the value against every
|
|
299
|
+
* candidate and reports all of their failures, flat and unattributed. Read as facts they are
|
|
300
|
+
* nonsense — for a condition branch `{ to, when }` with a malformed `when`, raw AJV says
|
|
301
|
+
*
|
|
302
|
+
* /nodes/a/branches/0/when must be object <- BranchDefinition
|
|
303
|
+
* /nodes/a/branches/0 must have required property 'id' <- BranchNodeBranchDefinition
|
|
304
|
+
* /nodes/a/branches/0 must NOT have additional properties: to, when <- BranchNodeBranchDefinition
|
|
305
|
+
* /nodes/a/branches/0 must match exactly one schema in oneOf
|
|
306
|
+
*
|
|
307
|
+
* where `to` and `when` are declared on `BranchDefinition` and only wrong for a candidate the value
|
|
308
|
+
* never meant. Nothing in the error list says which claim belongs to which candidate, and the
|
|
309
|
+
* candidates fail at DIFFERENT paths, so no rule based on the path can recover it.
|
|
310
|
+
*
|
|
311
|
+
* So the union is re-validated candidate by candidate, and each candidate's own failures are
|
|
312
|
+
* attributed to it by name. That is exact rather than inferred, at the cost of one extra validation
|
|
313
|
+
* per candidate — paid only on a response that is already failing:
|
|
314
|
+
*
|
|
315
|
+
* /nodes/a/branches/0 must match exactly one schema in oneOf
|
|
316
|
+
* /nodes/a/branches/0/when as BranchDefinition: must be object
|
|
317
|
+
* /nodes/a/branches/0 as BranchNodeBranchDefinition: must have required property 'id'
|
|
318
|
+
* /nodes/a/branches/0 as BranchNodeBranchDefinition: must NOT have additional properties: to, when
|
|
319
|
+
*
|
|
320
|
+
* Expansion goes ONE level deep: a candidate's own errors are collected without expanding any union
|
|
321
|
+
* nested inside it, which bounds the work and keeps the output readable.
|
|
322
|
+
*/
|
|
323
|
+
function collectIssues(validate) {
|
|
324
|
+
return toIssues(validate.errors ?? [], true);
|
|
325
|
+
}
|
|
326
|
+
function toIssues(errors, expandUnions) {
|
|
327
|
+
const expansions = new Map();
|
|
328
|
+
if (expandUnions) {
|
|
329
|
+
for (const error of errors) {
|
|
330
|
+
if (error.keyword !== 'oneOf' && error.keyword !== 'anyOf')
|
|
331
|
+
continue;
|
|
332
|
+
const expanded = expandUnion(error);
|
|
333
|
+
if (expanded)
|
|
334
|
+
expansions.set(error.instancePath, expanded);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
/** Whether an expanded union already accounts for this error, making the raw form redundant. */
|
|
338
|
+
const superseded = (error) => {
|
|
339
|
+
for (const base of expansions.keys()) {
|
|
340
|
+
if (error.instancePath === base || error.instancePath.startsWith(`${base}/`))
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
return false;
|
|
344
|
+
};
|
|
345
|
+
const issues = [];
|
|
346
|
+
// Keyed by the raising schema, then by path: two candidates at one path stay separate, and one
|
|
347
|
+
// schema's repeats at one path merge.
|
|
348
|
+
const gathered = new Map();
|
|
349
|
+
for (const error of errors) {
|
|
350
|
+
const path = error.instancePath || '/';
|
|
351
|
+
const message = error.message ?? 'is invalid';
|
|
352
|
+
const expanded = expansions.get(error.instancePath);
|
|
353
|
+
if (expanded && (error.keyword === 'oneOf' || error.keyword === 'anyOf')) {
|
|
354
|
+
// The union's own line frames the candidates that follow it.
|
|
355
|
+
issues.push({ path, message });
|
|
356
|
+
issues.push(...expanded);
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (superseded(error))
|
|
360
|
+
continue;
|
|
361
|
+
const additional = additionalProperty(error);
|
|
362
|
+
if (additional === undefined) {
|
|
363
|
+
issues.push({ path, message });
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
let byPath = gathered.get(error.parentSchema);
|
|
367
|
+
if (!byPath) {
|
|
368
|
+
byPath = new Map();
|
|
369
|
+
gathered.set(error.parentSchema, byPath);
|
|
370
|
+
}
|
|
371
|
+
const existing = byPath.get(path);
|
|
372
|
+
if (existing) {
|
|
373
|
+
// One schema reporting the same name twice is not a second fact.
|
|
374
|
+
if (!existing.names.has(additional)) {
|
|
375
|
+
existing.names.add(additional);
|
|
376
|
+
existing.issue.undeclared?.push(additional);
|
|
377
|
+
}
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
const issue = { path, message, undeclared: [additional] };
|
|
381
|
+
byPath.set(path, { issue, names: new Set([additional]) });
|
|
382
|
+
issues.push(issue);
|
|
383
|
+
}
|
|
384
|
+
return issues;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* One failed union, re-stated as what each candidate objected to.
|
|
388
|
+
*
|
|
389
|
+
* `undefined` when the union cannot be attributed exactly — a candidate that is not a `$ref` to a
|
|
390
|
+
* registered component has no name to report it under, and a partly-named expansion would read as
|
|
391
|
+
* though the unnamed candidate had no objection. The raw errors are kept in that case, which is what
|
|
392
|
+
* AJV would have produced anyway.
|
|
393
|
+
*/
|
|
394
|
+
function expandUnion(error) {
|
|
395
|
+
const parent = error.parentSchema;
|
|
396
|
+
if (!isPlainObject(parent))
|
|
397
|
+
return undefined;
|
|
398
|
+
const members = Array.isArray(parent.oneOf) ? parent.oneOf : Array.isArray(parent.anyOf) ? parent.anyOf : undefined;
|
|
399
|
+
if (!members?.length)
|
|
400
|
+
return undefined;
|
|
401
|
+
const issues = [];
|
|
402
|
+
for (const member of members) {
|
|
403
|
+
const ref = isPlainObject(member) && typeof member.$ref === 'string' ? member.$ref : undefined;
|
|
404
|
+
if (!ref?.startsWith(COMPONENT_REF_PREFIX))
|
|
405
|
+
return undefined;
|
|
406
|
+
const validateMember = getAjv().getSchema(`${AJV_SCHEMA_ID}${ref}`);
|
|
407
|
+
if (!validateMember)
|
|
408
|
+
return undefined;
|
|
409
|
+
// `verbose: true` puts the value under evaluation on the error, so the candidates are run
|
|
410
|
+
// against exactly what the union saw.
|
|
411
|
+
if (validateMember(error.data))
|
|
412
|
+
continue;
|
|
413
|
+
const component = ref.slice(COMPONENT_REF_PREFIX.length);
|
|
414
|
+
for (const issue of toIssues(validateMember.errors ?? [], false)) {
|
|
415
|
+
issues.push({ ...issue, path: joinInstancePath(error.instancePath, issue.path), component });
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return issues.length > 0 ? issues : undefined;
|
|
419
|
+
}
|
|
420
|
+
/** Re-roots a candidate-relative path under the union's own path. */
|
|
421
|
+
function joinInstancePath(base, relative) {
|
|
422
|
+
if (relative === '/')
|
|
423
|
+
return base || '/';
|
|
424
|
+
return `${base}${relative}`;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* The complete rendering of one issue — every name, no budget.
|
|
428
|
+
*
|
|
429
|
+
* This is what gets logged. A caller-facing message renders from {@link ApiValidationIssue} itself
|
|
430
|
+
* with a length limit rather than shortening this string; see `reportableErrors` in the enforcer.
|
|
431
|
+
*/
|
|
432
|
+
export function renderApiValidationIssue(issue) {
|
|
433
|
+
const head = renderApiValidationIssueHead(issue);
|
|
434
|
+
return issue.undeclared?.length ? `${head}: ${issue.undeclared.join(', ')}` : head;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Everything in a rendered issue except the property names: `<path> [as <component>]: <message>`.
|
|
438
|
+
*
|
|
439
|
+
* Exported because it is not the only renderer. A caller that has to bound the length of a message
|
|
440
|
+
* cannot use {@link renderApiValidationIssue} — it emits every name — and has to rebuild the line
|
|
441
|
+
* from {@link ApiValidationIssue} with its own budget for the names. Rebuilding the HEAD too is what
|
|
442
|
+
* lets the two drift: when `component` was added, the bounded renderer at the HTTP boundary went on
|
|
443
|
+
* concatenating path and message and silently dropped it, so callers were told
|
|
444
|
+
* `must NOT have additional properties: to, when` with no sign it was one candidate's claim. There is
|
|
445
|
+
* one definition of the head so that cannot happen again.
|
|
446
|
+
*/
|
|
447
|
+
export function renderApiValidationIssueHead(issue) {
|
|
448
|
+
return issue.component ? `${issue.path} as ${issue.component}: ${issue.message}` : `${issue.path} ${issue.message}`;
|
|
449
|
+
}
|
|
450
|
+
/** The failed branch of every validator here, so the two views cannot be built inconsistently. */
|
|
451
|
+
function invalidResult(validate) {
|
|
452
|
+
const issues = collectIssues(validate);
|
|
453
|
+
return { valid: false, errors: issues.map(renderApiValidationIssue), issues };
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Validates an untyped request body against the component the endpoint publishes.
|
|
457
|
+
*
|
|
458
|
+
* Non-mutating by design. AJV's removal modes are never used here: the server would then accept a
|
|
459
|
+
* body the published schema declares invalid, silently disagreeing with its own spec — and
|
|
460
|
+
* `removeAdditional: 'all'` additionally empties freeform maps. An undeclared property is reported,
|
|
461
|
+
* not deleted.
|
|
462
|
+
*
|
|
463
|
+
* The component type is handed back only on the `valid` branch, so a body missing required fields
|
|
464
|
+
* cannot be typed as complete. What the caller does with a failure — reject, or log and continue —
|
|
465
|
+
* is the endpoint's policy, not this function's.
|
|
466
|
+
*/
|
|
467
|
+
export function validateApiRequest(name, value) {
|
|
468
|
+
const validate = getValidator(name);
|
|
469
|
+
if (validate(value)) {
|
|
470
|
+
return { valid: true, data: value };
|
|
471
|
+
}
|
|
472
|
+
return invalidResult(validate);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Validates an already-mapped response against the component it is published as.
|
|
476
|
+
*
|
|
477
|
+
* Separate from {@link pruneAndValidateApiResponse} because a resource mapper has already produced
|
|
478
|
+
* the wire shape: there is nothing to prune, and pruning would only mask a mapper bug. Use this at
|
|
479
|
+
* the response boundary to detect drift between what the mapper builds and what the spec promises.
|
|
480
|
+
*/
|
|
481
|
+
export function validateApiResponse(name, value) {
|
|
482
|
+
const validate = getValidator(name);
|
|
483
|
+
if (validate(value)) {
|
|
484
|
+
return { valid: true, data: value };
|
|
485
|
+
}
|
|
486
|
+
return invalidResult(validate);
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Best-effort normalization of a response payload towards the fields its published component
|
|
490
|
+
* declares. Use this on the response path INSTEAD of an AJV removal mode, which would empty
|
|
491
|
+
* freeform maps such as `Account.feature_flags`.
|
|
492
|
+
*
|
|
493
|
+
* NOT a secret-removal boundary. Ambiguous schema shapes pass values through untouched — see
|
|
494
|
+
* {@link pruneToSchema} and check a component with {@link findUnprunablePaths} before treating its
|
|
495
|
+
* output as closed. Fields that must never ship still need an explicit response mapper.
|
|
496
|
+
*
|
|
497
|
+
* Never throws and never rejects: an undocumented field is server-side drift, and failing the
|
|
498
|
+
* response would punish the caller for it.
|
|
499
|
+
*
|
|
500
|
+
* Takes a value the caller has already typed as the component. Pruning only REMOVES undeclared
|
|
501
|
+
* extras, so a conforming input yields a conforming output and the return type is honest. It does
|
|
502
|
+
* NOT validate, which is why it cannot accept `unknown` — narrowing a payload that is missing
|
|
503
|
+
* required fields would hand TypeScript a complete `Account` that does not exist at runtime. Use
|
|
504
|
+
* {@link pruneAndValidateApiResponse} when the payload's shape is not already established.
|
|
505
|
+
*
|
|
506
|
+
* Request validation stays separate and non-mutating — pruning a request would make the server
|
|
507
|
+
* silently disagree with the permissive schema it publishes.
|
|
508
|
+
*/
|
|
509
|
+
export function pruneApiResponse(name, value) {
|
|
510
|
+
return pruneToSchema(value, { $ref: apiComponentRef(name) }, ApiSchemaComponents);
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Prunes an untyped payload and validates the result against the published component.
|
|
514
|
+
*
|
|
515
|
+
* The only sound entry point for a payload of unknown shape: the component type is handed back
|
|
516
|
+
* exclusively on the `valid` branch, so a document missing required fields cannot be typed as
|
|
517
|
+
* complete. On failure the pruned value is still returned — the caller decides whether to ship it
|
|
518
|
+
* and log, or fail — which keeps the "never turn drift into a 500" property a policy choice rather
|
|
519
|
+
* than something baked in here.
|
|
520
|
+
*
|
|
521
|
+
*/
|
|
522
|
+
export function pruneAndValidateApiResponse(name, value) {
|
|
523
|
+
const pruned = pruneToSchema(value, { $ref: apiComponentRef(name) }, ApiSchemaComponents);
|
|
524
|
+
const validate = getValidator(name);
|
|
525
|
+
if (validate(pruned)) {
|
|
526
|
+
return { valid: true, data: pruned };
|
|
527
|
+
}
|
|
528
|
+
return { ...invalidResult(validate), data: pruned };
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Paths inside a component where pruning cannot narrow. Empty means no STRUCTURAL gaps for
|
|
532
|
+
* schema-conforming input — see {@link findUnprunablePaths} for why that is weaker than "nothing
|
|
533
|
+
* can escape". Anything listed needs an explicit response mapper.
|
|
534
|
+
*/
|
|
535
|
+
export function findUnprunableApiPaths(name) {
|
|
536
|
+
return findUnprunablePaths({ $ref: apiComponentRef(name) }, ApiSchemaComponents);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Normalizes raw query or header text into the value a component describes.
|
|
540
|
+
*
|
|
541
|
+
* Binds {@link normalizeParameters} to {@link ApiSchemaComponents} — the same objects the OpenAPI
|
|
542
|
+
* document publishes and {@link validateApiRequest} compiles. That is what keeps the published
|
|
543
|
+
* parameter and the enforced one the same declaration: the scanner expands this component's
|
|
544
|
+
* properties into `in: query` parameters, and the coercion below is decided by those same property
|
|
545
|
+
* schemas, so neither can be changed without changing the other.
|
|
546
|
+
*
|
|
547
|
+
* Validate the result with {@link validateApiRequest}, which is non-coercing: everything type-related
|
|
548
|
+
* has already happened here, so a value this could not coerce is reported against the published
|
|
549
|
+
* schema rather than by a second rule.
|
|
550
|
+
*/
|
|
551
|
+
export function normalizeApiParameters(name, raw, location) {
|
|
552
|
+
return normalizeParameters(name, raw, location, ApiSchemaComponents[name], ApiSchemaComponents);
|
|
553
|
+
}
|
|
554
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api-contract/index.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAmB,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/G,OAAO,EAGH,mBAAmB,GAEtB,MAAM,8BAA8B,CAAC;AAKtC,OAAO,qBAAqB,MAAM,6BAA6B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEtF,+FAA+F;AAC/F,iGAAiG;AACjG,oDAAoD;AACpD,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC;AAEtC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAA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