@vertesia/common 1.5.0-dev.20260725.083715Z → 1.5.0-dev.20260806.125520Z
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/Progress.d.ts.map +1 -1
- package/lib/Progress.js.map +1 -1
- package/lib/access-control-values.d.ts +98 -0
- package/lib/access-control-values.d.ts.map +1 -0
- package/lib/access-control-values.js +101 -0
- package/lib/access-control-values.js.map +1 -0
- package/lib/access-control.d.ts +22 -119
- package/lib/access-control.d.ts.map +1 -1
- package/lib/access-control.js +6 -78
- package/lib/access-control.js.map +1 -1
- package/lib/account-values.d.ts +53 -0
- package/lib/account-values.d.ts.map +1 -0
- package/lib/account-values.js +91 -0
- package/lib/account-values.js.map +1 -0
- package/lib/analytics.d.ts +12 -38
- package/lib/analytics.d.ts.map +1 -1
- package/lib/api-schemas/access-control.d.ts +215 -0
- package/lib/api-schemas/access-control.d.ts.map +1 -0
- package/lib/api-schemas/access-control.js +165 -0
- package/lib/api-schemas/access-control.js.map +1 -0
- package/lib/api-schemas/account.d.ts +101 -0
- package/lib/api-schemas/account.d.ts.map +1 -0
- package/lib/api-schemas/account.js +136 -0
- package/lib/api-schemas/account.js.map +1 -0
- package/lib/api-schemas/adapter.d.ts +80 -0
- package/lib/api-schemas/adapter.d.ts.map +1 -0
- package/lib/api-schemas/adapter.js +726 -0
- package/lib/api-schemas/adapter.js.map +1 -0
- package/lib/api-schemas/agent-runs.d.ts +3786 -0
- package/lib/api-schemas/agent-runs.d.ts.map +1 -0
- package/lib/api-schemas/agent-runs.js +1000 -0
- package/lib/api-schemas/agent-runs.js.map +1 -0
- package/lib/api-schemas/analytics.d.ts +86 -0
- package/lib/api-schemas/analytics.d.ts.map +1 -0
- package/lib/api-schemas/analytics.js +58 -0
- package/lib/api-schemas/analytics.js.map +1 -0
- package/lib/api-schemas/apikey.d.ts +231 -0
- package/lib/api-schemas/apikey.d.ts.map +1 -0
- package/lib/api-schemas/apikey.js +172 -0
- package/lib/api-schemas/apikey.js.map +1 -0
- package/lib/api-schemas/app-lifecycle.d.ts +1148 -0
- package/lib/api-schemas/app-lifecycle.d.ts.map +1 -0
- package/lib/api-schemas/app-lifecycle.js +801 -0
- package/lib/api-schemas/app-lifecycle.js.map +1 -0
- package/lib/api-schemas/app-runtime.d.ts +10951 -0
- package/lib/api-schemas/app-runtime.d.ts.map +1 -0
- package/lib/api-schemas/app-runtime.js +874 -0
- package/lib/api-schemas/app-runtime.js.map +1 -0
- package/lib/api-schemas/apps.d.ts +271 -0
- package/lib/api-schemas/apps.d.ts.map +1 -0
- package/lib/api-schemas/apps.js +426 -0
- package/lib/api-schemas/apps.js.map +1 -0
- package/lib/api-schemas/audit-trail.d.ts +465 -0
- package/lib/api-schemas/audit-trail.d.ts.map +1 -0
- package/lib/api-schemas/audit-trail.js +218 -0
- package/lib/api-schemas/audit-trail.js.map +1 -0
- package/lib/api-schemas/bulk-operation.d.ts +104 -0
- package/lib/api-schemas/bulk-operation.d.ts.map +1 -0
- package/lib/api-schemas/bulk-operation.js +66 -0
- package/lib/api-schemas/bulk-operation.js.map +1 -0
- package/lib/api-schemas/commands.d.ts +50 -0
- package/lib/api-schemas/commands.d.ts.map +1 -0
- package/lib/api-schemas/commands.js +58 -0
- package/lib/api-schemas/commands.js.map +1 -0
- package/lib/api-schemas/content.d.ts +3565 -0
- package/lib/api-schemas/content.d.ts.map +1 -0
- package/lib/api-schemas/content.js +854 -0
- package/lib/api-schemas/content.js.map +1 -0
- package/lib/api-schemas/cost-analytics.d.ts +300 -0
- package/lib/api-schemas/cost-analytics.d.ts.map +1 -0
- package/lib/api-schemas/cost-analytics.js +218 -0
- package/lib/api-schemas/cost-analytics.js.map +1 -0
- package/lib/api-schemas/dashboard.d.ts +408 -0
- package/lib/api-schemas/dashboard.d.ts.map +1 -0
- package/lib/api-schemas/dashboard.js +311 -0
- package/lib/api-schemas/dashboard.js.map +1 -0
- package/lib/api-schemas/data-store.d.ts +1650 -0
- package/lib/api-schemas/data-store.d.ts.map +1 -0
- package/lib/api-schemas/data-store.js +504 -0
- package/lib/api-schemas/data-store.js.map +1 -0
- package/lib/api-schemas/document-processing.d.ts +1501 -0
- package/lib/api-schemas/document-processing.d.ts.map +1 -0
- package/lib/api-schemas/document-processing.js +312 -0
- package/lib/api-schemas/document-processing.js.map +1 -0
- package/lib/api-schemas/embeddings.d.ts +184 -0
- package/lib/api-schemas/embeddings.d.ts.map +1 -0
- package/lib/api-schemas/embeddings.js +102 -0
- package/lib/api-schemas/embeddings.js.map +1 -0
- package/lib/api-schemas/environment.d.ts +412 -0
- package/lib/api-schemas/environment.d.ts.map +1 -0
- package/lib/api-schemas/environment.js +170 -0
- package/lib/api-schemas/environment.js.map +1 -0
- package/lib/api-schemas/events.d.ts +4918 -0
- package/lib/api-schemas/events.d.ts.map +1 -0
- package/lib/api-schemas/events.js +888 -0
- package/lib/api-schemas/events.js.map +1 -0
- package/lib/api-schemas/files.d.ts +107 -0
- package/lib/api-schemas/files.d.ts.map +1 -0
- package/lib/api-schemas/files.js +137 -0
- package/lib/api-schemas/files.js.map +1 -0
- package/lib/api-schemas/group.d.ts +122 -0
- package/lib/api-schemas/group.d.ts.map +1 -0
- package/lib/api-schemas/group.js +142 -0
- package/lib/api-schemas/group.js.map +1 -0
- package/lib/api-schemas/index.d.ts +36 -0
- package/lib/api-schemas/index.d.ts.map +1 -0
- package/lib/api-schemas/index.js +36 -0
- package/lib/api-schemas/index.js.map +1 -0
- package/lib/api-schemas/indexing.d.ts +144 -0
- package/lib/api-schemas/indexing.d.ts.map +1 -0
- package/lib/api-schemas/indexing.js +217 -0
- package/lib/api-schemas/indexing.js.map +1 -0
- package/lib/api-schemas/integrations.d.ts +269 -0
- package/lib/api-schemas/integrations.d.ts.map +1 -0
- package/lib/api-schemas/integrations.js +335 -0
- package/lib/api-schemas/integrations.js.map +1 -0
- package/lib/api-schemas/interaction.d.ts +22456 -0
- package/lib/api-schemas/interaction.d.ts.map +1 -0
- package/lib/api-schemas/interaction.js +2071 -0
- package/lib/api-schemas/interaction.js.map +1 -0
- package/lib/api-schemas/invites.d.ts +162 -0
- package/lib/api-schemas/invites.d.ts.map +1 -0
- package/lib/api-schemas/invites.js +106 -0
- package/lib/api-schemas/invites.js.map +1 -0
- package/lib/api-schemas/oauth-server.d.ts +415 -0
- package/lib/api-schemas/oauth-server.d.ts.map +1 -0
- package/lib/api-schemas/oauth-server.js +193 -0
- package/lib/api-schemas/oauth-server.js.map +1 -0
- package/lib/api-schemas/oauth.d.ts +150 -0
- package/lib/api-schemas/oauth.d.ts.map +1 -0
- package/lib/api-schemas/oauth.js +148 -0
- package/lib/api-schemas/oauth.js.map +1 -0
- package/lib/api-schemas/parameters.d.ts +64 -0
- package/lib/api-schemas/parameters.d.ts.map +1 -0
- package/lib/api-schemas/parameters.js +246 -0
- package/lib/api-schemas/parameters.js.map +1 -0
- package/lib/api-schemas/process.d.ts +499 -0
- package/lib/api-schemas/process.d.ts.map +1 -0
- package/lib/api-schemas/process.js +817 -0
- package/lib/api-schemas/process.js.map +1 -0
- package/lib/api-schemas/project-configuration.d.ts +4900 -0
- package/lib/api-schemas/project-configuration.d.ts.map +1 -0
- package/lib/api-schemas/project-configuration.js +425 -0
- package/lib/api-schemas/project-configuration.js.map +1 -0
- package/lib/api-schemas/project.d.ts +7247 -0
- package/lib/api-schemas/project.d.ts.map +1 -0
- package/lib/api-schemas/project.js +185 -0
- package/lib/api-schemas/project.js.map +1 -0
- package/lib/api-schemas/prompt.d.ts +70 -0
- package/lib/api-schemas/prompt.d.ts.map +1 -0
- package/lib/api-schemas/prompt.js +77 -0
- package/lib/api-schemas/prompt.js.map +1 -0
- package/lib/api-schemas/quota.d.ts +90 -0
- package/lib/api-schemas/quota.d.ts.map +1 -0
- package/lib/api-schemas/quota.js +95 -0
- package/lib/api-schemas/quota.js.map +1 -0
- package/lib/api-schemas/registry.d.ts +98506 -0
- package/lib/api-schemas/registry.d.ts.map +1 -0
- package/lib/api-schemas/registry.js +2606 -0
- package/lib/api-schemas/registry.js.map +1 -0
- package/lib/api-schemas/schema-primitives.d.ts +5 -0
- package/lib/api-schemas/schema-primitives.d.ts.map +1 -0
- package/lib/api-schemas/schema-primitives.js +11 -0
- package/lib/api-schemas/schema-primitives.js.map +1 -0
- package/lib/api-schemas/secrets.d.ts +497 -0
- package/lib/api-schemas/secrets.d.ts.map +1 -0
- package/lib/api-schemas/secrets.js +298 -0
- package/lib/api-schemas/secrets.js.map +1 -0
- package/lib/api-schemas/store.d.ts +22140 -0
- package/lib/api-schemas/store.d.ts.map +1 -0
- package/lib/api-schemas/store.js +557 -0
- package/lib/api-schemas/store.js.map +1 -0
- package/lib/api-schemas/sts.d.ts +166 -0
- package/lib/api-schemas/sts.d.ts.map +1 -0
- package/lib/api-schemas/sts.js +107 -0
- package/lib/api-schemas/sts.js.map +1 -0
- package/lib/api-schemas/task.d.ts +215 -0
- package/lib/api-schemas/task.d.ts.map +1 -0
- package/lib/api-schemas/task.js +95 -0
- package/lib/api-schemas/task.js.map +1 -0
- package/lib/api-schemas/tools.d.ts +111 -0
- package/lib/api-schemas/tools.d.ts.map +1 -0
- package/lib/api-schemas/tools.js +122 -0
- package/lib/api-schemas/tools.js.map +1 -0
- package/lib/api-schemas/user.d.ts +208 -0
- package/lib/api-schemas/user.d.ts.map +1 -0
- package/lib/api-schemas/user.js +180 -0
- package/lib/api-schemas/user.js.map +1 -0
- package/lib/api-schemas/view-execution.d.ts +3163 -0
- package/lib/api-schemas/view-execution.d.ts.map +1 -0
- package/lib/api-schemas/view-execution.js +172 -0
- package/lib/api-schemas/view-execution.js.map +1 -0
- package/lib/api-schemas/views.d.ts +5990 -0
- package/lib/api-schemas/views.d.ts.map +1 -0
- package/lib/api-schemas/views.js +396 -0
- package/lib/api-schemas/views.js.map +1 -0
- package/lib/api-schemas/workflow-runs.d.ts +2210 -0
- package/lib/api-schemas/workflow-runs.d.ts.map +1 -0
- package/lib/api-schemas/workflow-runs.js +589 -0
- package/lib/api-schemas/workflow-runs.js.map +1 -0
- package/lib/apikey-values.d.ts +10 -0
- package/lib/apikey-values.d.ts.map +1 -0
- package/lib/apikey-values.js +11 -0
- package/lib/apikey-values.js.map +1 -0
- package/lib/apikey.d.ts +37 -36
- package/lib/apikey.d.ts.map +1 -1
- package/lib/apikey.js +5 -4
- package/lib/apikey.js.map +1 -1
- package/lib/apps.d.ts +142 -1172
- package/lib/apps.d.ts.map +1 -1
- package/lib/apps.js +4 -0
- package/lib/apps.js.map +1 -1
- package/lib/ask-user.d.ts +8 -1
- package/lib/ask-user.d.ts.map +1 -1
- package/lib/audit-trail.d.ts +20 -131
- package/lib/audit-trail.d.ts.map +1 -1
- package/lib/audit-trail.js.map +1 -1
- package/lib/browser-credentials.d.ts +11 -106
- package/lib/browser-credentials.d.ts.map +1 -1
- package/lib/common.d.ts +59 -81
- package/lib/common.d.ts.map +1 -1
- package/lib/cost-analytics.d.ts +14 -167
- package/lib/cost-analytics.d.ts.map +1 -1
- package/lib/cost-analytics.js.map +1 -1
- package/lib/data-platform.d.ts +122 -786
- package/lib/data-platform.d.ts.map +1 -1
- package/lib/data-platform.js +41 -61
- package/lib/data-platform.js.map +1 -1
- package/lib/email.d.ts +5 -17
- package/lib/email.d.ts.map +1 -1
- package/lib/email.js +0 -3
- package/lib/email.js.map +1 -1
- package/lib/embeddings.d.ts +14 -56
- package/lib/embeddings.d.ts.map +1 -1
- package/lib/environment.d.ts +22 -118
- package/lib/environment.d.ts.map +1 -1
- package/lib/environment.js +3 -0
- package/lib/environment.js.map +1 -1
- package/lib/facets.d.ts +4 -7
- package/lib/facets.d.ts.map +1 -1
- package/lib/group.d.ts +33 -39
- package/lib/group.d.ts.map +1 -1
- package/lib/group.js +0 -1
- package/lib/group.js.map +1 -1
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/integrations.d.ts +20 -108
- package/lib/integrations.d.ts.map +1 -1
- package/lib/integrations.js.map +1 -1
- package/lib/interaction-values.d.ts +11 -0
- package/lib/interaction-values.d.ts.map +1 -0
- package/lib/interaction-values.js +24 -0
- package/lib/interaction-values.js.map +1 -0
- package/lib/interaction.d.ts +88 -778
- package/lib/interaction.d.ts.map +1 -1
- package/lib/interaction.js +8 -12
- package/lib/interaction.js.map +1 -1
- package/lib/meters.d.ts +11 -7
- package/lib/meters.d.ts.map +1 -1
- package/lib/meters.js.map +1 -1
- package/lib/oauth-server.d.ts +33 -119
- package/lib/oauth-server.d.ts.map +1 -1
- package/lib/oauth.d.ts +14 -96
- package/lib/oauth.d.ts.map +1 -1
- package/lib/oauth.js +0 -4
- package/lib/oauth.js.map +1 -1
- package/lib/payload.d.ts +15 -38
- package/lib/payload.d.ts.map +1 -1
- package/lib/platform-event-validation.d.ts.map +1 -1
- package/lib/platform-event-validation.js +15 -2
- package/lib/platform-event-validation.js.map +1 -1
- package/lib/platform-event.d.ts +79 -464
- package/lib/platform-event.d.ts.map +1 -1
- package/lib/platform-event.js.map +1 -1
- package/lib/principal-context.d.ts +10 -15
- package/lib/principal-context.d.ts.map +1 -1
- package/lib/project-values.d.ts +24 -0
- package/lib/project-values.d.ts.map +1 -0
- package/lib/project-values.js +42 -0
- package/lib/project-values.js.map +1 -0
- package/lib/project.d.ts +56 -504
- package/lib/project.d.ts.map +1 -1
- package/lib/project.js +6 -76
- package/lib/project.js.map +1 -1
- package/lib/prompt.d.ts +20 -51
- package/lib/prompt.d.ts.map +1 -1
- package/lib/prompt.js.map +1 -1
- package/lib/query.d.ts +27 -88
- package/lib/query.d.ts.map +1 -1
- package/lib/rate-limiter.d.ts +19 -70
- package/lib/rate-limiter.d.ts.map +1 -1
- package/lib/rate-limiter.js +0 -3
- package/lib/rate-limiter.js.map +1 -1
- package/lib/refs.d.ts +3 -11
- package/lib/refs.d.ts.map +1 -1
- package/lib/refs.js.map +1 -1
- package/lib/roles/types.d.ts +14 -20
- package/lib/roles/types.d.ts.map +1 -1
- package/lib/roles/types.js +5 -9
- package/lib/roles/types.js.map +1 -1
- package/lib/runs.d.ts +6 -25
- package/lib/runs.d.ts.map +1 -1
- package/lib/schema-for-extraction.js.map +1 -1
- package/lib/secrets.d.ts +20 -105
- package/lib/secrets.d.ts.map +1 -1
- package/lib/store/agent-approval.d.ts +6 -15
- package/lib/store/agent-approval.d.ts.map +1 -1
- package/lib/store/agent-approval.js.map +1 -1
- package/lib/store/agent-run.d.ts +57 -358
- package/lib/store/agent-run.d.ts.map +1 -1
- package/lib/store/collections.d.ts +11 -63
- package/lib/store/collections.d.ts.map +1 -1
- package/lib/store/collections.js.map +1 -1
- package/lib/store/conversation-state.d.ts +61 -61
- package/lib/store/conversation-state.d.ts.map +1 -1
- package/lib/store/conversation-state.js +2 -0
- package/lib/store/conversation-state.js.map +1 -1
- package/lib/store/doc-analyzer.d.ts +9 -32
- package/lib/store/doc-analyzer.d.ts.map +1 -1
- package/lib/store/dsl-workflow.d.ts +37 -151
- package/lib/store/dsl-workflow.d.ts.map +1 -1
- package/lib/store/dsl-workflow.js.map +1 -1
- package/lib/store/editing-policy-schema.generated.d.ts +3 -0
- package/lib/store/editing-policy-schema.generated.d.ts.map +1 -0
- package/lib/store/editing-policy-schema.generated.js +28 -0
- package/lib/store/editing-policy-schema.generated.js.map +1 -0
- package/lib/store/grounded-extraction.d.ts +7 -104
- package/lib/store/grounded-extraction.d.ts.map +1 -1
- package/lib/store/grounded-extraction.js.map +1 -1
- package/lib/store/index.d.ts +2 -0
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +3 -0
- package/lib/store/index.js.map +1 -1
- package/lib/store/intake-policy-schema.generated.d.ts +3 -0
- package/lib/store/intake-policy-schema.generated.d.ts.map +1 -0
- package/lib/store/intake-policy-schema.generated.js +1425 -0
- package/lib/store/intake-policy-schema.generated.js.map +1 -0
- package/lib/store/process-schema.d.ts +81 -1
- package/lib/store/process-schema.d.ts.map +1 -1
- package/lib/store/process-schema.js +79 -0
- package/lib/store/process-schema.js.map +1 -1
- package/lib/store/process-validation.d.ts.map +1 -1
- package/lib/store/process-validation.js +70 -2
- package/lib/store/process-validation.js.map +1 -1
- package/lib/store/process.d.ts +36 -125
- package/lib/store/process.d.ts.map +1 -1
- package/lib/store/process.js.map +1 -1
- package/lib/store/rendering.d.ts +9 -64
- package/lib/store/rendering.d.ts.map +1 -1
- package/lib/store/rendering.js.map +1 -1
- package/lib/store/schedule.d.ts +6 -6
- package/lib/store/schedule.d.ts.map +1 -1
- package/lib/store/store.d.ts +99 -701
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +4 -456
- package/lib/store/store.js.map +1 -1
- package/lib/store/task.d.ts +15 -59
- package/lib/store/task.d.ts.map +1 -1
- package/lib/store/task.js +0 -3
- package/lib/store/task.js.map +1 -1
- package/lib/store/workflow.d.ts +58 -516
- package/lib/store/workflow.d.ts.map +1 -1
- package/lib/store/workflow.js +31 -11
- package/lib/store/workflow.js.map +1 -1
- package/lib/sts-errors.d.ts +7 -0
- package/lib/sts-errors.d.ts.map +1 -0
- package/lib/sts-errors.js +11 -0
- package/lib/sts-errors.js.map +1 -0
- package/lib/sts-token-types.d.ts +13 -66
- package/lib/sts-token-types.d.ts.map +1 -1
- package/lib/sts-token-types.js.map +1 -1
- package/lib/tools.d.ts +8 -100
- package/lib/tools.d.ts.map +1 -1
- package/lib/transient-tokens-values.d.ts +11 -0
- package/lib/transient-tokens-values.d.ts.map +1 -0
- package/lib/transient-tokens-values.js +12 -0
- package/lib/transient-tokens-values.js.map +1 -0
- package/lib/transient-tokens.d.ts +15 -13
- package/lib/transient-tokens.d.ts.map +1 -1
- package/lib/transient-tokens.js +5 -5
- package/lib/transient-tokens.js.map +1 -1
- package/lib/user.d.ts +55 -156
- package/lib/user.d.ts.map +1 -1
- package/lib/user.js +2 -79
- package/lib/user.js.map +1 -1
- package/lib/versions.d.ts +34 -1
- package/lib/versions.d.ts.map +1 -1
- package/lib/versions.js +33 -0
- package/lib/versions.js.map +1 -1
- package/lib/vertesia-common.js +6 -2
- package/lib/vertesia-common.js.map +1 -1
- package/lib/view-configuration-validation.js.map +1 -1
- package/lib/view-query-validation.js.map +1 -1
- package/lib/view-validation-helpers.d.ts +1 -1
- package/lib/view-validation-helpers.d.ts.map +1 -1
- package/lib/views-schema.d.ts +51 -51
- package/lib/views-schema.d.ts.map +1 -1
- package/lib/views-validation.js.map +1 -1
- package/lib/views.d.ts +58 -314
- package/lib/views.d.ts.map +1 -1
- package/lib/views.js.map +1 -1
- package/lib/workflow-analytics.d.ts +10 -3
- package/lib/workflow-analytics.d.ts.map +1 -1
- package/package.json +14 -5
- package/src/access-control-values.ts +113 -0
- package/src/access-control.ts +33 -138
- package/src/account-values.ts +95 -0
- package/src/analytics.ts +18 -42
- package/src/api-schemas/access-control.contract.test.ts +209 -0
- package/src/api-schemas/access-control.ts +208 -0
- package/src/api-schemas/account.contract.test.ts +318 -0
- package/src/api-schemas/account.ts +150 -0
- package/src/api-schemas/adapter-edge-cases.test.ts +480 -0
- package/src/api-schemas/adapter.ts +778 -0
- package/src/api-schemas/agent-runs.ts +1091 -0
- package/src/api-schemas/analytics.ts +65 -0
- package/src/api-schemas/apikey.contract.test.ts +270 -0
- package/src/api-schemas/apikey.ts +199 -0
- package/src/api-schemas/app-delete-summary.contract.test.ts +67 -0
- package/src/api-schemas/app-lifecycle.ts +900 -0
- package/src/api-schemas/app-runtime.ts +1022 -0
- package/src/api-schemas/apps.ts +484 -0
- package/src/api-schemas/audit-trail.ts +243 -0
- package/src/api-schemas/bulk-operation.contract.test.ts +39 -0
- package/src/api-schemas/bulk-operation.ts +75 -0
- package/src/api-schemas/bundle-isolation.test.ts +80 -0
- package/src/api-schemas/commands.contract.test.ts +51 -0
- package/src/api-schemas/commands.ts +62 -0
- package/src/api-schemas/content.ts +952 -0
- package/src/api-schemas/cost-analytics.contract.test.ts +64 -0
- package/src/api-schemas/cost-analytics.ts +235 -0
- package/src/api-schemas/dashboard.contract.test.ts +127 -0
- package/src/api-schemas/dashboard.ts +351 -0
- package/src/api-schemas/data-store.contract.test.ts +91 -0
- package/src/api-schemas/data-store.ts +571 -0
- package/src/api-schemas/document-processing.contract.test.ts +76 -0
- package/src/api-schemas/document-processing.ts +344 -0
- package/src/api-schemas/embeddings.ts +113 -0
- package/src/api-schemas/environment.contract.test.ts +184 -0
- package/src/api-schemas/environment.ts +190 -0
- package/src/api-schemas/events.ts +981 -0
- package/src/api-schemas/files.ts +159 -0
- package/src/api-schemas/group.contract.test.ts +205 -0
- package/src/api-schemas/group.ts +155 -0
- package/src/api-schemas/index.ts +35 -0
- package/src/api-schemas/indexing.contract.test.ts +83 -0
- package/src/api-schemas/indexing.ts +234 -0
- package/src/api-schemas/integrations.ts +369 -0
- package/src/api-schemas/interaction.contract.test.ts +27 -0
- package/src/api-schemas/interaction.ts +2364 -0
- package/src/api-schemas/invites.contract.test.ts +268 -0
- package/src/api-schemas/invites.ts +127 -0
- package/src/api-schemas/llumiverse.contract.test.ts +108 -0
- package/src/api-schemas/mcp-api-key.contract.test.ts +86 -0
- package/src/api-schemas/oauth-server.ts +219 -0
- package/src/api-schemas/oauth.contract.test.ts +118 -0
- package/src/api-schemas/oauth.ts +166 -0
- package/src/api-schemas/parameters.test.ts +402 -0
- package/src/api-schemas/parameters.ts +310 -0
- package/src/api-schemas/process.ts +929 -0
- package/src/api-schemas/project-configuration.ts +478 -0
- package/src/api-schemas/project.contract.test.ts +365 -0
- package/src/api-schemas/project.ts +214 -0
- package/src/api-schemas/prompt.ts +88 -0
- package/src/api-schemas/pruning-limits.test.ts +189 -0
- package/src/api-schemas/quota.contract.test.ts +147 -0
- package/src/api-schemas/quota.ts +122 -0
- package/src/api-schemas/registry-groups.test.ts +91 -0
- package/src/api-schemas/registry.ts +3512 -0
- package/src/api-schemas/response-pruning.test.ts +260 -0
- package/src/api-schemas/schema-primitives.ts +12 -0
- package/src/api-schemas/secrets.ts +332 -0
- package/src/api-schemas/store.contract.test.ts +471 -0
- package/src/api-schemas/store.ts +604 -0
- package/src/api-schemas/sts.contract.test.ts +112 -0
- package/src/api-schemas/sts.ts +123 -0
- package/src/api-schemas/task.ts +104 -0
- package/src/api-schemas/tools.ts +140 -0
- package/src/api-schemas/user.contract.test.ts +191 -0
- package/src/api-schemas/user.ts +204 -0
- package/src/api-schemas/view-execution.ts +200 -0
- package/src/api-schemas/views.ts +437 -0
- package/src/api-schemas/workflow-runs.ts +653 -0
- package/src/apikey-values.ts +10 -0
- package/src/apikey.ts +49 -40
- package/src/apps.test.ts +82 -0
- package/src/apps.ts +283 -1228
- package/src/ask-user.ts +9 -1
- package/src/audit-trail.ts +45 -137
- package/src/browser-credentials.ts +21 -106
- package/src/common.ts +67 -78
- package/src/cost-analytics.ts +37 -176
- package/src/data-platform.ts +205 -776
- package/src/email.ts +5 -17
- package/src/embeddings.ts +22 -60
- package/src/environment.ts +52 -126
- package/src/facets.ts +4 -7
- package/src/group.ts +38 -42
- package/src/index.ts +12 -0
- package/src/integrations.ts +39 -129
- package/src/interaction-values.ts +23 -0
- package/src/interaction.ts +162 -902
- package/src/meters.ts +11 -7
- package/src/oauth-server.ts +58 -127
- package/src/oauth.ts +24 -108
- package/src/payload.ts +25 -40
- package/src/platform-event-validation.test.ts +26 -0
- package/src/platform-event-validation.ts +15 -2
- package/src/platform-event.ts +141 -484
- package/src/principal-context.ts +11 -15
- package/src/project-values.ts +41 -0
- package/src/project.ts +116 -588
- package/src/prompt.ts +34 -61
- package/src/query.ts +34 -93
- package/src/rate-limiter.ts +27 -75
- package/src/refs.ts +4 -11
- package/src/roles/types.ts +20 -20
- package/src/runs.ts +11 -24
- package/src/secrets.ts +38 -117
- package/src/store/agent-approval.ts +9 -14
- package/src/store/agent-run.ts +93 -450
- package/src/store/collections.ts +21 -63
- package/src/store/content-type-editing.test.ts +1 -1
- package/src/store/conversation-state.ts +75 -64
- package/src/store/doc-analyzer.ts +17 -33
- package/src/store/dsl-workflow.ts +62 -158
- package/src/store/editing-policy-schema.generated.ts +30 -0
- package/src/store/grounded-extraction.ts +13 -104
- package/src/store/index.ts +3 -0
- package/src/store/intake-policy-schema.generated.ts +1442 -0
- package/src/store/process-schema.test.ts +43 -0
- package/src/store/process-schema.ts +79 -0
- package/src/store/process-validation.test.ts +141 -0
- package/src/store/process-validation.ts +82 -2
- package/src/store/process.ts +70 -146
- package/src/store/rendering.ts +15 -64
- package/src/store/store.ts +197 -1204
- package/src/store/task.ts +25 -59
- package/src/store/workflow.ts +103 -554
- package/src/sts-errors.ts +13 -0
- package/src/sts-token-types.ts +26 -75
- package/src/tools.ts +18 -97
- package/src/transient-tokens-values.ts +11 -0
- package/src/transient-tokens.ts +16 -13
- package/src/user.ts +75 -215
- package/src/versions.test.ts +13 -0
- package/src/versions.ts +36 -0
- package/src/views-schema.test.ts +9 -1
- package/src/views.ts +106 -329
- package/src/workflow-analytics.ts +10 -3
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The OAuth *provider* contracts: Vertesia acting as an OAuth CLIENT against a third-party
|
|
4
|
+
* authorization server.
|
|
5
|
+
*
|
|
6
|
+
* The other direction — clients registered against Vertesia's own OAuth server, and the grants they
|
|
7
|
+
* hold — is `./oauth-server.js`. The split mirrors the one the TypeScript declarations already had,
|
|
8
|
+
* so each schema sits in the module its type came from and the canonical-alias map stays readable.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The success acknowledgement four provider endpoints and the client delete return.
|
|
12
|
+
*
|
|
13
|
+
* Here rather than in a module of its own because these five slots are its only callers, which is
|
|
14
|
+
* the same reason `DeleteOperationResult` lives in `./apikey.js`. `common.ts` aliases the type so
|
|
15
|
+
* `SuccessResponse` keeps being imported from where it always was.
|
|
16
|
+
*
|
|
17
|
+
* `z.boolean()`, not `z.literal(true)`, and that is what the document has always published: the
|
|
18
|
+
* scanner widened the declared `success: true` to `type: boolean` on the way out. Publishing the
|
|
19
|
+
* literal would newly forbid `{ success: false }` for every existing client, while the handlers
|
|
20
|
+
* return `true` either way.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SuccessResponseSchema: z.ZodObject<{
|
|
23
|
+
success: z.ZodBoolean;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
/**
|
|
26
|
+
* A provider's stored configuration, without its id.
|
|
27
|
+
*
|
|
28
|
+
* Split from {@link OAuthProviderSchema} because `OAuthProvider extends OAuthProviderData` in the
|
|
29
|
+
* published types and both names are exported from the package. It carries no `id` in its meta, so
|
|
30
|
+
* it is never a component of its own: the document has only ever published `OAuthProvider`, with
|
|
31
|
+
* these properties inline and `id` last.
|
|
32
|
+
*/
|
|
33
|
+
export declare const OAuthProviderDataSchema: z.ZodObject<{
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
display_name: z.ZodString;
|
|
36
|
+
project: z.ZodString;
|
|
37
|
+
grant_type: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
authorization_code: "authorization_code";
|
|
39
|
+
client_credentials: "client_credentials";
|
|
40
|
+
}>>;
|
|
41
|
+
authorization_endpoint: z.ZodOptional<z.ZodString>;
|
|
42
|
+
token_endpoint: z.ZodOptional<z.ZodString>;
|
|
43
|
+
client_id: z.ZodString;
|
|
44
|
+
has_client_secret: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
default_scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
|
+
use_pkce: z.ZodBoolean;
|
|
47
|
+
revocation_endpoint: z.ZodOptional<z.ZodString>;
|
|
48
|
+
created_at: z.ZodString;
|
|
49
|
+
updated_at: z.ZodString;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export declare const OAuthProviderSchema: z.ZodObject<{
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
display_name: z.ZodString;
|
|
54
|
+
project: z.ZodString;
|
|
55
|
+
grant_type: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
authorization_code: "authorization_code";
|
|
57
|
+
client_credentials: "client_credentials";
|
|
58
|
+
}>>;
|
|
59
|
+
authorization_endpoint: z.ZodOptional<z.ZodString>;
|
|
60
|
+
token_endpoint: z.ZodOptional<z.ZodString>;
|
|
61
|
+
client_id: z.ZodString;
|
|
62
|
+
has_client_secret: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
default_scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
64
|
+
use_pkce: z.ZodBoolean;
|
|
65
|
+
revocation_endpoint: z.ZodOptional<z.ZodString>;
|
|
66
|
+
created_at: z.ZodString;
|
|
67
|
+
updated_at: z.ZodString;
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export declare const OAuthProviderArraySchema: z.ZodArray<z.ZodObject<{
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
display_name: z.ZodString;
|
|
73
|
+
project: z.ZodString;
|
|
74
|
+
grant_type: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
authorization_code: "authorization_code";
|
|
76
|
+
client_credentials: "client_credentials";
|
|
77
|
+
}>>;
|
|
78
|
+
authorization_endpoint: z.ZodOptional<z.ZodString>;
|
|
79
|
+
token_endpoint: z.ZodOptional<z.ZodString>;
|
|
80
|
+
client_id: z.ZodString;
|
|
81
|
+
has_client_secret: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
default_scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
use_pkce: z.ZodBoolean;
|
|
84
|
+
revocation_endpoint: z.ZodOptional<z.ZodString>;
|
|
85
|
+
created_at: z.ZodString;
|
|
86
|
+
updated_at: z.ZodString;
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
/**
|
|
90
|
+
* What a create accepts, which is deliberately not what a read returns.
|
|
91
|
+
*
|
|
92
|
+
* `client_secret` goes IN and never comes back out: the read shape carries `has_client_secret`
|
|
93
|
+
* instead. That request/response split is the rule for any component holding a credential, and
|
|
94
|
+
* keeping the two schemas separate is what makes it structural rather than a convention the next
|
|
95
|
+
* handler has to remember.
|
|
96
|
+
*/
|
|
97
|
+
export declare const CreateOAuthProviderPayloadSchema: z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
display_name: z.ZodString;
|
|
100
|
+
grant_type: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
authorization_code: "authorization_code";
|
|
102
|
+
client_credentials: "client_credentials";
|
|
103
|
+
}>>;
|
|
104
|
+
authorization_endpoint: z.ZodOptional<z.ZodString>;
|
|
105
|
+
token_endpoint: z.ZodOptional<z.ZodString>;
|
|
106
|
+
client_id: z.ZodString;
|
|
107
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
108
|
+
default_scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
+
use_pkce: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
revocation_endpoint: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
/**
|
|
113
|
+
* The update contract shares the create fields but makes each optional; the handler writes only the
|
|
114
|
+
* fields present in the request.
|
|
115
|
+
*/
|
|
116
|
+
export declare const UpdateOAuthProviderPayloadSchema: z.ZodObject<{
|
|
117
|
+
name: z.ZodOptional<z.ZodString>;
|
|
118
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
119
|
+
grant_type: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
|
|
120
|
+
authorization_code: "authorization_code";
|
|
121
|
+
client_credentials: "client_credentials";
|
|
122
|
+
}>>>;
|
|
123
|
+
authorization_endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
124
|
+
token_endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
125
|
+
client_id: z.ZodOptional<z.ZodString>;
|
|
126
|
+
client_secret: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
127
|
+
default_scopes: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
128
|
+
use_pkce: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
129
|
+
revocation_endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
export declare const OAuthProviderAuthStatusSchema: z.ZodObject<{
|
|
132
|
+
oauth_provider_id: z.ZodString;
|
|
133
|
+
oauth_provider_name: z.ZodString;
|
|
134
|
+
authenticated: z.ZodBoolean;
|
|
135
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
136
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
137
|
+
}, z.core.$strict>;
|
|
138
|
+
export declare const OAuthProviderAuthorizeResponseSchema: z.ZodObject<{
|
|
139
|
+
authorization_url: z.ZodOptional<z.ZodString>;
|
|
140
|
+
state: z.ZodOptional<z.ZodString>;
|
|
141
|
+
connected: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
export declare const OAuthProviderAccessTokenResponseSchema: z.ZodObject<{
|
|
144
|
+
access_token: z.ZodString;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
export declare const OAuthProviderExchangePayloadSchema: z.ZodObject<{
|
|
147
|
+
code: z.ZodString;
|
|
148
|
+
state: z.ZodString;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/api-schemas/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB;;kBAIE,CAAC;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;kBAyClC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;kBAEiE,CAAC;AAElG,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;mBAAkE,CAAC;AAExG;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;kBAuBvC,CAAC;AAEP;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;kBAI3C,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;kBAWpC,CAAC;AAEP,eAAO,MAAM,oCAAoC;;;;kBAU3C,CAAC;AAEP,eAAO,MAAM,sCAAsC;;kBAIE,CAAC;AAEtD,eAAO,MAAM,kCAAkC;;;kBAKE,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The OAuth *provider* contracts: Vertesia acting as an OAuth CLIENT against a third-party
|
|
4
|
+
* authorization server.
|
|
5
|
+
*
|
|
6
|
+
* The other direction — clients registered against Vertesia's own OAuth server, and the grants they
|
|
7
|
+
* hold — is `./oauth-server.js`. The split mirrors the one the TypeScript declarations already had,
|
|
8
|
+
* so each schema sits in the module its type came from and the canonical-alias map stays readable.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The success acknowledgement four provider endpoints and the client delete return.
|
|
12
|
+
*
|
|
13
|
+
* Here rather than in a module of its own because these five slots are its only callers, which is
|
|
14
|
+
* the same reason `DeleteOperationResult` lives in `./apikey.js`. `common.ts` aliases the type so
|
|
15
|
+
* `SuccessResponse` keeps being imported from where it always was.
|
|
16
|
+
*
|
|
17
|
+
* `z.boolean()`, not `z.literal(true)`, and that is what the document has always published: the
|
|
18
|
+
* scanner widened the declared `success: true` to `type: boolean` on the way out. Publishing the
|
|
19
|
+
* literal would newly forbid `{ success: false }` for every existing client, while the handlers
|
|
20
|
+
* return `true` either way.
|
|
21
|
+
*/
|
|
22
|
+
export const SuccessResponseSchema = z
|
|
23
|
+
.strictObject({
|
|
24
|
+
success: z.boolean(),
|
|
25
|
+
})
|
|
26
|
+
.meta({ id: 'SuccessResponse' });
|
|
27
|
+
/**
|
|
28
|
+
* A provider's stored configuration, without its id.
|
|
29
|
+
*
|
|
30
|
+
* Split from {@link OAuthProviderSchema} because `OAuthProvider extends OAuthProviderData` in the
|
|
31
|
+
* published types and both names are exported from the package. It carries no `id` in its meta, so
|
|
32
|
+
* it is never a component of its own: the document has only ever published `OAuthProvider`, with
|
|
33
|
+
* these properties inline and `id` last.
|
|
34
|
+
*/
|
|
35
|
+
export const OAuthProviderDataSchema = z.strictObject({
|
|
36
|
+
name: z.string().meta({ description: 'Unique name within the project (kebab-case identifier).' }),
|
|
37
|
+
display_name: z.string().meta({ description: 'Human-readable display name.' }),
|
|
38
|
+
project: z.string().meta({ description: 'The project this OAuth provider belongs to.' }),
|
|
39
|
+
grant_type: z
|
|
40
|
+
.enum(['authorization_code', 'client_credentials'])
|
|
41
|
+
.meta({
|
|
42
|
+
description: "The OAuth 2.0 grant type to use.\n- 'authorization_code': 3-legged flow requiring user authorization (default).\n- 'client_credentials': 2-legged server-to-server flow using client_id + client_secret.",
|
|
43
|
+
})
|
|
44
|
+
.optional(),
|
|
45
|
+
authorization_endpoint: z
|
|
46
|
+
.string()
|
|
47
|
+
.meta({
|
|
48
|
+
description: 'The OAuth 2.0 authorization endpoint URL. Only used for authorization_code flow. Optional when endpoints are discovered via .well-known (e.g. MCP servers).',
|
|
49
|
+
})
|
|
50
|
+
.optional(),
|
|
51
|
+
token_endpoint: z
|
|
52
|
+
.string()
|
|
53
|
+
.meta({
|
|
54
|
+
description: 'The OAuth 2.0 token endpoint URL. Optional when endpoints are discovered via .well-known (e.g. MCP servers).',
|
|
55
|
+
})
|
|
56
|
+
.optional(),
|
|
57
|
+
client_id: z.string().meta({ description: 'The OAuth client ID (always required).' }),
|
|
58
|
+
has_client_secret: z
|
|
59
|
+
.boolean()
|
|
60
|
+
.meta({ description: 'Whether a client_secret is configured (never exposes the actual secret).' })
|
|
61
|
+
.optional(),
|
|
62
|
+
default_scopes: z
|
|
63
|
+
.array(z.string())
|
|
64
|
+
.meta({ description: 'Default scopes to request during authorization.' })
|
|
65
|
+
.optional(),
|
|
66
|
+
use_pkce: z.boolean().meta({
|
|
67
|
+
description: 'Whether to use PKCE (Proof Key for Code Exchange) in the authorization flow. Only applies to authorization_code flow. Defaults to true.',
|
|
68
|
+
}),
|
|
69
|
+
revocation_endpoint: z.string().meta({ description: 'Optional OAuth 2.0 revocation endpoint URL.' }).optional(),
|
|
70
|
+
created_at: z.string(),
|
|
71
|
+
updated_at: z.string(),
|
|
72
|
+
});
|
|
73
|
+
export const OAuthProviderSchema = OAuthProviderDataSchema.extend({
|
|
74
|
+
id: z.string(),
|
|
75
|
+
}).meta({ id: 'OAuthProvider', description: 'OAuth Provider as returned by the API (with id).' });
|
|
76
|
+
export const OAuthProviderArraySchema = z.array(OAuthProviderSchema).meta({ id: 'OAuthProviderArray' });
|
|
77
|
+
/**
|
|
78
|
+
* What a create accepts, which is deliberately not what a read returns.
|
|
79
|
+
*
|
|
80
|
+
* `client_secret` goes IN and never comes back out: the read shape carries `has_client_secret`
|
|
81
|
+
* instead. That request/response split is the rule for any component holding a credential, and
|
|
82
|
+
* keeping the two schemas separate is what makes it structural rather than a convention the next
|
|
83
|
+
* handler has to remember.
|
|
84
|
+
*/
|
|
85
|
+
export const CreateOAuthProviderPayloadSchema = z
|
|
86
|
+
.strictObject({
|
|
87
|
+
name: z.string(),
|
|
88
|
+
display_name: z.string(),
|
|
89
|
+
grant_type: z.enum(['authorization_code', 'client_credentials']).optional(),
|
|
90
|
+
authorization_endpoint: z.string().optional(),
|
|
91
|
+
token_endpoint: z.string().optional(),
|
|
92
|
+
client_id: z.string(),
|
|
93
|
+
client_secret: z
|
|
94
|
+
.string()
|
|
95
|
+
.meta({
|
|
96
|
+
description: 'Optional client secret for confidential clients. Will be encrypted at rest and never returned in API responses.',
|
|
97
|
+
})
|
|
98
|
+
.optional(),
|
|
99
|
+
default_scopes: z.array(z.string()).optional(),
|
|
100
|
+
use_pkce: z.boolean().optional(),
|
|
101
|
+
revocation_endpoint: z.string().optional(),
|
|
102
|
+
})
|
|
103
|
+
.meta({
|
|
104
|
+
id: 'CreateOAuthProviderPayload',
|
|
105
|
+
description: 'Payload for creating an OAuth Provider. The client_secret is accepted as plaintext on create and stored encrypted.',
|
|
106
|
+
});
|
|
107
|
+
/**
|
|
108
|
+
* The update contract shares the create fields but makes each optional; the handler writes only the
|
|
109
|
+
* fields present in the request.
|
|
110
|
+
*/
|
|
111
|
+
export const UpdateOAuthProviderPayloadSchema = CreateOAuthProviderPayloadSchema.partial().meta({
|
|
112
|
+
id: 'UpdateOAuthProviderPayload',
|
|
113
|
+
description: 'Payload for updating an OAuth Provider. All fields are optional — only provided fields are updated. To clear the client_secret, set it to an empty string.',
|
|
114
|
+
});
|
|
115
|
+
export const OAuthProviderAuthStatusSchema = z
|
|
116
|
+
.strictObject({
|
|
117
|
+
oauth_provider_id: z.string(),
|
|
118
|
+
oauth_provider_name: z.string(),
|
|
119
|
+
authenticated: z.boolean(),
|
|
120
|
+
expires_at: z.string().optional(),
|
|
121
|
+
scope: z.string().optional(),
|
|
122
|
+
})
|
|
123
|
+
.meta({
|
|
124
|
+
id: 'OAuthProviderAuthStatus',
|
|
125
|
+
description: 'OAuth authentication status for a user against an OAuth Provider.',
|
|
126
|
+
});
|
|
127
|
+
export const OAuthProviderAuthorizeResponseSchema = z
|
|
128
|
+
.strictObject({
|
|
129
|
+
authorization_url: z.string().optional(),
|
|
130
|
+
state: z.string().optional(),
|
|
131
|
+
connected: z.boolean().optional(),
|
|
132
|
+
})
|
|
133
|
+
.meta({
|
|
134
|
+
id: 'OAuthProviderAuthorizeResponse',
|
|
135
|
+
description: 'Response from the OAuth authorize endpoint. For authorization_code flow: contains authorization_url and state for browser redirect. For client_credentials flow: contains connected=true (token was fetched server-side, no redirect needed).',
|
|
136
|
+
});
|
|
137
|
+
export const OAuthProviderAccessTokenResponseSchema = z
|
|
138
|
+
.strictObject({
|
|
139
|
+
access_token: z.string(),
|
|
140
|
+
})
|
|
141
|
+
.meta({ id: 'OAuthProviderAccessTokenResponse' });
|
|
142
|
+
export const OAuthProviderExchangePayloadSchema = z
|
|
143
|
+
.strictObject({
|
|
144
|
+
code: z.string(),
|
|
145
|
+
state: z.string(),
|
|
146
|
+
})
|
|
147
|
+
.meta({ id: 'OAuthProviderExchangePayload' });
|
|
148
|
+
//# sourceMappingURL=oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/api-schemas/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACjC,YAAY,CAAC;IACV,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IAClD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;IACjG,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAC9E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC;IACxF,UAAU,EAAE,CAAC;SACR,IAAI,CAAC,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;SAClD,IAAI,CAAC;QACF,WAAW,EACP,0MAA0M;KACjN,CAAC;SACD,QAAQ,EAAE;IACf,sBAAsB,EAAE,CAAC;SACpB,MAAM,EAAE;SACR,IAAI,CAAC;QACF,WAAW,EACP,6JAA6J;KACpK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KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC;KACD,IAAI,CAAC;IACF,EAAE,EAAE,yBAAyB;IAC7B,WAAW,EAAE,mEAAmE;CACnF,CAAC,CAAC;AAEP,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC;KAChD,YAAY,CAAC;IACV,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC;KACD,IAAI,CAAC;IACF,EAAE,EAAE,gCAAgC;IACpC,WAAW,EACP,+OAA+O;CACtP,CAAC,CAAC;AAEP,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC;KAClD,YAAY,CAAC;IACV,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CAC3B,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,kCAAkC,EAAE,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC;KAC9C,YAAY,CAAC;IACV,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,8BAA8B,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query and header normalization, driven by the same component the spec publishes.
|
|
3
|
+
*
|
|
4
|
+
* Bodies arrive as JSON, so a body validates against its component directly and coercion is
|
|
5
|
+
* forbidden — the server must not accept a payload its own schema calls invalid. Parameters have no
|
|
6
|
+
* such luxury: a query string carries only text, so `?limit=25` is the string `'25'` where the
|
|
7
|
+
* published parameter says `type: integer`. Something has to map one to the other, and the only
|
|
8
|
+
* honest source for that mapping is the schema being published.
|
|
9
|
+
*
|
|
10
|
+
* So this module reads the component, decides what each declared parameter should become, and builds
|
|
11
|
+
* a NEW object. Two properties follow from that and both matter:
|
|
12
|
+
*
|
|
13
|
+
* - The request is never mutated. Koa memoizes `ctx.query` per query string and hands every later
|
|
14
|
+
* reader the same object, so coercing in place would silently retype values for middleware and
|
|
15
|
+
* handlers that never opted in — and `ctx.headers` is Node's own object.
|
|
16
|
+
* - Coercion is explicit rather than AJV's `coerceTypes`. The registry compiles one AJV
|
|
17
|
+
* configuration for bodies and parameters alike, so turning coercion on for parameters would have
|
|
18
|
+
* changed body policy too; and `coerceTypes` has its own rules (`''` becomes 0, `[]` becomes
|
|
19
|
+
* `null`) that are neither published nor easy to predict. Everything below is a stated rule with a
|
|
20
|
+
* test.
|
|
21
|
+
*
|
|
22
|
+
* What is NOT done here is validation. This produces a value; the caller validates it against the
|
|
23
|
+
* same component with the same validator a body uses, so a value that cannot be coerced is reported
|
|
24
|
+
* by the component's own schema rather than by a second error message that could disagree with it.
|
|
25
|
+
*/
|
|
26
|
+
import { type JsonObject } from './adapter.js';
|
|
27
|
+
/** Where a parameter arrives. Decides name matching, and nothing else. */
|
|
28
|
+
export type ApiParameterLocation = 'query' | 'header';
|
|
29
|
+
/**
|
|
30
|
+
* Parameters as the transport presents them: text, possibly repeated, possibly absent.
|
|
31
|
+
*
|
|
32
|
+
* Matches both `ctx.query` (Koa parses with `URLSearchParams`, so a repeated key is an array and a
|
|
33
|
+
* single one is a string) and `ctx.headers` (Node lowercases names, joins most duplicates with
|
|
34
|
+
* `, `, and arrays only `set-cookie`).
|
|
35
|
+
*/
|
|
36
|
+
export interface RawApiParameters {
|
|
37
|
+
readonly [name: string]: string | string[] | undefined;
|
|
38
|
+
}
|
|
39
|
+
export interface NormalizedApiParameters {
|
|
40
|
+
/**
|
|
41
|
+
* The copy to validate: declared parameters only, coerced towards their published types, with
|
|
42
|
+
* absent ones omitted so the component's own `required` decides whether that is allowed.
|
|
43
|
+
*/
|
|
44
|
+
value: Record<string, unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Query keys the component does not declare, in arrival order.
|
|
47
|
+
*
|
|
48
|
+
* Always empty for headers, structurally rather than by convention: every request carries headers
|
|
49
|
+
* no endpoint declares — `accept`, `user-agent`, tracing — so "undeclared" describes nothing
|
|
50
|
+
* there, and a caller that rejected on this list could never reject a standard header by mistake.
|
|
51
|
+
*/
|
|
52
|
+
undeclared: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Builds the value to validate for one parameter slot.
|
|
56
|
+
*
|
|
57
|
+
* Header names match case-insensitively, which is not a nicety: HTTP field names are
|
|
58
|
+
* case-insensitive by RFC 9110 and Node has already lowercased everything on the way in, so a
|
|
59
|
+
* component declaring `X-Request-Id` would never match a real request without this. The output is
|
|
60
|
+
* keyed by the DECLARED spelling, because that is the name the component validates and the spec
|
|
61
|
+
* publishes.
|
|
62
|
+
*/
|
|
63
|
+
export declare function normalizeParameters(component: string, raw: RawApiParameters, location: ApiParameterLocation, schema: JsonObject | undefined, components: Readonly<Record<string, JsonObject>>): NormalizedApiParameters;
|
|
64
|
+
//# sourceMappingURL=parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/api-schemas/parameters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,cAAc,CAAC;AAEjE,0EAA0E;AAC1E,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;CAC1D;AAED,MAAM,WAAW,uBAAuB;IACpC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAqND;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,gBAAgB,EACrB,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GACjD,uBAAuB,CAyBzB"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query and header normalization, driven by the same component the spec publishes.
|
|
3
|
+
*
|
|
4
|
+
* Bodies arrive as JSON, so a body validates against its component directly and coercion is
|
|
5
|
+
* forbidden — the server must not accept a payload its own schema calls invalid. Parameters have no
|
|
6
|
+
* such luxury: a query string carries only text, so `?limit=25` is the string `'25'` where the
|
|
7
|
+
* published parameter says `type: integer`. Something has to map one to the other, and the only
|
|
8
|
+
* honest source for that mapping is the schema being published.
|
|
9
|
+
*
|
|
10
|
+
* So this module reads the component, decides what each declared parameter should become, and builds
|
|
11
|
+
* a NEW object. Two properties follow from that and both matter:
|
|
12
|
+
*
|
|
13
|
+
* - The request is never mutated. Koa memoizes `ctx.query` per query string and hands every later
|
|
14
|
+
* reader the same object, so coercing in place would silently retype values for middleware and
|
|
15
|
+
* handlers that never opted in — and `ctx.headers` is Node's own object.
|
|
16
|
+
* - Coercion is explicit rather than AJV's `coerceTypes`. The registry compiles one AJV
|
|
17
|
+
* configuration for bodies and parameters alike, so turning coercion on for parameters would have
|
|
18
|
+
* changed body policy too; and `coerceTypes` has its own rules (`''` becomes 0, `[]` becomes
|
|
19
|
+
* `null`) that are neither published nor easy to predict. Everything below is a stated rule with a
|
|
20
|
+
* test.
|
|
21
|
+
*
|
|
22
|
+
* What is NOT done here is validation. This produces a value; the caller validates it against the
|
|
23
|
+
* same component with the same validator a body uses, so a value that cannot be coerced is reported
|
|
24
|
+
* by the component's own schema rather than by a second error message that could disagree with it.
|
|
25
|
+
*/
|
|
26
|
+
import { resolveSchemaRef } from './adapter.js';
|
|
27
|
+
/**
|
|
28
|
+
* Depth cap for target resolution.
|
|
29
|
+
*
|
|
30
|
+
* `resolveSchemaRef` detects a cycle within one chain, but `items` starts a fresh chain each time, so
|
|
31
|
+
* a component whose array items reference it back would recurse forever. Parameters are flat text;
|
|
32
|
+
* anything approaching this depth is a declaration mistake, and stopping at `opaque` leaves the value
|
|
33
|
+
* untouched for the component to reject.
|
|
34
|
+
*/
|
|
35
|
+
const MAX_TARGET_DEPTH = 8;
|
|
36
|
+
/**
|
|
37
|
+
* Text this module maps to a JSON number.
|
|
38
|
+
*
|
|
39
|
+
* Deliberately narrower than `Number()`, which accepts several strings that are not numbers in any
|
|
40
|
+
* useful sense: `''` becomes 0, `' 1'` and `'\n1'` become 1, `'0x10'` becomes 16, `'Infinity'`
|
|
41
|
+
* becomes a value no JSON Schema `number` can hold. Each of those would let the server read a
|
|
42
|
+
* parameter as a value the published schema never describes.
|
|
43
|
+
*
|
|
44
|
+
* Deliberately WIDER than JSON's own number grammar, which rejects `'01'`, `'+1'`, `'1.'` and
|
|
45
|
+
* `'.5'`. Those denote one number unambiguously and match the handlers' existing `parseInt`/`Number`
|
|
46
|
+
* behavior; the remaining strictness applies only where the text is genuinely not a number.
|
|
47
|
+
*
|
|
48
|
+
* Anything rejected here is left as the original string, which the component then reports as a type
|
|
49
|
+
* error naming the parameter.
|
|
50
|
+
*/
|
|
51
|
+
const NUMERIC_TEXT = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
52
|
+
function isPlainObject(value) {
|
|
53
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The declared type of a schema node, ignoring `null`.
|
|
57
|
+
*
|
|
58
|
+
* `type` may be a list — zod emits `['string', 'null']` for some nullable shapes — and nullability is
|
|
59
|
+
* not a coercion target: what a nullable string parameter needs is the string mapping, with the
|
|
60
|
+
* component deciding whether `null` is also allowed.
|
|
61
|
+
*/
|
|
62
|
+
function declaredType(schema) {
|
|
63
|
+
const type = schema.type;
|
|
64
|
+
if (typeof type === 'string')
|
|
65
|
+
return type;
|
|
66
|
+
if (Array.isArray(type)) {
|
|
67
|
+
return type.find((entry) => typeof entry === 'string' && entry !== 'null');
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
function unionVariants(schema) {
|
|
72
|
+
for (const keyword of ['anyOf', 'oneOf']) {
|
|
73
|
+
const variants = schema[keyword];
|
|
74
|
+
if (Array.isArray(variants)) {
|
|
75
|
+
const objects = variants.filter(isPlainObject);
|
|
76
|
+
if (objects.length > 0)
|
|
77
|
+
return objects;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* What one declared parameter's text should be coerced to.
|
|
84
|
+
*
|
|
85
|
+
* The union rule is the one worth explaining. A `string | string[]` parameter — which this API has 29
|
|
86
|
+
* of — is published by the scanner as a single `type: array` parameter with `explode: true`, because
|
|
87
|
+
* that is the only serialization OpenAPI has for repeated values. Preferring the array variant here
|
|
88
|
+
* makes the runtime agree with that published shape: one occurrence normalizes to a one-element
|
|
89
|
+
* array, exactly as `explode: true` describes. Reading the scalar variant instead would mean the spec
|
|
90
|
+
* promised an array and the handler received a bare string.
|
|
91
|
+
*/
|
|
92
|
+
function parameterTarget(schema, components, depth = 0) {
|
|
93
|
+
if (!isPlainObject(schema) || depth >= MAX_TARGET_DEPTH)
|
|
94
|
+
return { kind: 'opaque' };
|
|
95
|
+
const resolved = resolveSchemaRef(schema, components) ?? schema;
|
|
96
|
+
const variants = unionVariants(resolved);
|
|
97
|
+
if (variants) {
|
|
98
|
+
const arrayVariant = variants.find((variant) => {
|
|
99
|
+
const target = parameterTarget(variant, components, depth + 1);
|
|
100
|
+
return target.kind === 'array';
|
|
101
|
+
});
|
|
102
|
+
if (arrayVariant)
|
|
103
|
+
return parameterTarget(arrayVariant, components, depth + 1);
|
|
104
|
+
// No array variant, so the parameter carries a single value. `null` is not a coercion target,
|
|
105
|
+
// so the first variant that names a real type decides — a nullable enum coerces as its enum.
|
|
106
|
+
for (const variant of variants) {
|
|
107
|
+
const target = parameterTarget(variant, components, depth + 1);
|
|
108
|
+
if (target.kind !== 'opaque')
|
|
109
|
+
return target;
|
|
110
|
+
}
|
|
111
|
+
return { kind: 'opaque' };
|
|
112
|
+
}
|
|
113
|
+
const type = declaredType(resolved);
|
|
114
|
+
if (type === 'array') {
|
|
115
|
+
return {
|
|
116
|
+
kind: 'array',
|
|
117
|
+
items: parameterTarget(resolved.items, components, depth + 1),
|
|
118
|
+
commaDelimited: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (type === 'number' || type === 'integer' || type === 'boolean' || type === 'string') {
|
|
122
|
+
return { kind: type };
|
|
123
|
+
}
|
|
124
|
+
// An enum with no `type`, a bare `{}`, an unresolvable `$ref`: nothing to coerce towards, so the
|
|
125
|
+
// text passes through and the component decides.
|
|
126
|
+
return { kind: 'opaque' };
|
|
127
|
+
}
|
|
128
|
+
function coerceScalar(text, target) {
|
|
129
|
+
switch (target.kind) {
|
|
130
|
+
case 'number':
|
|
131
|
+
case 'integer': {
|
|
132
|
+
// `integer` coerces to a number and stops. AJV then reports a non-integral value against
|
|
133
|
+
// the published `type: integer`, so `?limit=1.5` is rejected by the schema rather than
|
|
134
|
+
// silently truncated to 1 the way `parseInt` would.
|
|
135
|
+
if (!NUMERIC_TEXT.test(text))
|
|
136
|
+
return text;
|
|
137
|
+
const value = Number(text);
|
|
138
|
+
return Number.isFinite(value) ? value : text;
|
|
139
|
+
}
|
|
140
|
+
case 'boolean':
|
|
141
|
+
// The two spellings a JSON Schema `boolean` can hold, plus the numeric pair. `'1'` is not
|
|
142
|
+
// an invention: the client SDK emits it (`getArtifactUrl` sends `url=1`) and the endpoint
|
|
143
|
+
// descriptions document it, so rejecting it would reject our own published usage. `'yes'`
|
|
144
|
+
// and a bare `?flag=` stay text and are rejected by the component — those really would be
|
|
145
|
+
// guesses about what the caller meant.
|
|
146
|
+
if (text === 'true' || text === '1')
|
|
147
|
+
return true;
|
|
148
|
+
if (text === 'false' || text === '0')
|
|
149
|
+
return false;
|
|
150
|
+
return text;
|
|
151
|
+
default:
|
|
152
|
+
return text;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Maps one parameter's raw text to the value its published schema describes.
|
|
157
|
+
*
|
|
158
|
+
* The scalar-with-repeats case is a deliberate rejection rather than a pick. `?level=account&level=project`
|
|
159
|
+
* on a parameter published as a single string arrives as an array, and it is handed on as an array so
|
|
160
|
+
* the component reports a type error. Choosing last-wins — what several ad-hoc handlers do today —
|
|
161
|
+
* would make the server accept a request its own contract does not describe, and nothing published
|
|
162
|
+
* says which occurrence wins.
|
|
163
|
+
*/
|
|
164
|
+
function coerceParameter(raw, target) {
|
|
165
|
+
if (target.kind === 'array') {
|
|
166
|
+
// `explode: true`: one occurrence is a one-element array.
|
|
167
|
+
const occurrences = Array.isArray(raw) ? raw : [raw];
|
|
168
|
+
// An occurrence carrying commas is several values. The document publishes `explode: true`,
|
|
169
|
+
// which describes repeated keys and says nothing about commas, so this is something the
|
|
170
|
+
// server accepts BEYOND what it promises — deliberately, because `@vertesia/client` joins
|
|
171
|
+
// every array parameter with `,`. Every SDK in the field therefore sends the comma form, and
|
|
172
|
+
// every hand-written reader this layer replaced read it: `readArray`, `parseTagsFilter` and
|
|
173
|
+
// `parseSourcesQuery` all spelled it `Array.isArray(v) ? v : String(v).split(',')`, and the
|
|
174
|
+
// agent-run search split `sort`, `tags` and `categories` the same way.
|
|
175
|
+
//
|
|
176
|
+
// The cost is that a value containing a literal comma cannot be expressed, with no escape.
|
|
177
|
+
// That is not a new limit — it is what every one of those readers already did — and it is
|
|
178
|
+
// why a parameter whose values may legitimately contain commas must not be published as an
|
|
179
|
+
// array of plain strings.
|
|
180
|
+
//
|
|
181
|
+
// Split per occurrence rather than after joining, so the two spellings compose:
|
|
182
|
+
// `?status=pending,completed&status=cancelled` is the same three values as three keys.
|
|
183
|
+
const items = target.commaDelimited ? occurrences.flatMap((item) => item.split(',')) : occurrences;
|
|
184
|
+
return items.map((item) => coerceScalar(item, target.items));
|
|
185
|
+
}
|
|
186
|
+
if (Array.isArray(raw))
|
|
187
|
+
return raw;
|
|
188
|
+
return coerceScalar(raw, target);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The object schema a parameter component must be, resolved through any reference chain.
|
|
192
|
+
*
|
|
193
|
+
* A component that is not an object cannot be expanded into named parameters — the scanner would not
|
|
194
|
+
* publish one either — so this is a declaration bug, and it throws rather than degrading to "validate
|
|
195
|
+
* nothing". Reaching the handler with an unchecked query while the spec advertised a checked one is
|
|
196
|
+
* the failure the whole arrangement exists to prevent.
|
|
197
|
+
*/
|
|
198
|
+
function parameterObjectSchema(component, schema, components) {
|
|
199
|
+
const resolved = schema ? resolveSchemaRef(schema, components) : undefined;
|
|
200
|
+
const properties = resolved?.properties;
|
|
201
|
+
if (!resolved || declaredType(resolved) !== 'object' || !isPlainObject(properties)) {
|
|
202
|
+
throw new Error(`Component '${component}' is declared as a query or header contract, but it is not an object ` +
|
|
203
|
+
'schema with properties, so it cannot be expanded into named parameters. Declare it as an ' +
|
|
204
|
+
'object whose properties are the parameters.');
|
|
205
|
+
}
|
|
206
|
+
const required = new Set(Array.isArray(resolved.required)
|
|
207
|
+
? resolved.required.filter((name) => typeof name === 'string')
|
|
208
|
+
: []);
|
|
209
|
+
return { properties, required };
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Builds the value to validate for one parameter slot.
|
|
213
|
+
*
|
|
214
|
+
* Header names match case-insensitively, which is not a nicety: HTTP field names are
|
|
215
|
+
* case-insensitive by RFC 9110 and Node has already lowercased everything on the way in, so a
|
|
216
|
+
* component declaring `X-Request-Id` would never match a real request without this. The output is
|
|
217
|
+
* keyed by the DECLARED spelling, because that is the name the component validates and the spec
|
|
218
|
+
* publishes.
|
|
219
|
+
*/
|
|
220
|
+
export function normalizeParameters(component, raw, location, schema, components) {
|
|
221
|
+
const { properties } = parameterObjectSchema(component, schema, components);
|
|
222
|
+
const caseInsensitive = location === 'header';
|
|
223
|
+
const entries = [];
|
|
224
|
+
const matched = new Set();
|
|
225
|
+
for (const [name, propertySchema] of Object.entries(properties)) {
|
|
226
|
+
const key = caseInsensitive ? name.toLowerCase() : name;
|
|
227
|
+
// `hasOwn` rather than a truthiness check: an inherited member would otherwise be read as a
|
|
228
|
+
// parameter, so a component declaring `constructor` or `toString` would receive a function.
|
|
229
|
+
if (!Object.hasOwn(raw, key))
|
|
230
|
+
continue;
|
|
231
|
+
const value = raw[key];
|
|
232
|
+
matched.add(key);
|
|
233
|
+
// An explicitly `undefined` value is the transport saying the parameter never arrived. Omitting
|
|
234
|
+
// it leaves requiredness to the component instead of validating `undefined` against a type.
|
|
235
|
+
if (value === undefined)
|
|
236
|
+
continue;
|
|
237
|
+
entries.push([name, coerceParameter(value, parameterTarget(propertySchema, components))]);
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
// `fromEntries` rather than assignment, so a component that declares `__proto__` gets an own
|
|
241
|
+
// property instead of reassigning the copy's prototype.
|
|
242
|
+
value: Object.fromEntries(entries),
|
|
243
|
+
undeclared: caseInsensitive ? [] : Object.keys(raw).filter((key) => !matched.has(key)),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/api-schemas/parameters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AA6CjE;;;;;;;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