@vertesia/common 1.5.0-dev.20260725.083715Z → 1.5.0-dev.20260804.124748Z
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-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 +3781 -0
- package/lib/api-schemas/agent-runs.d.ts.map +1 -0
- package/lib/api-schemas/agent-runs.js +991 -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 +1114 -0
- package/lib/api-schemas/app-lifecycle.d.ts.map +1 -0
- package/lib/api-schemas/app-lifecycle.js +750 -0
- package/lib/api-schemas/app-lifecycle.js.map +1 -0
- package/lib/api-schemas/app-runtime.d.ts +9056 -0
- package/lib/api-schemas/app-runtime.d.ts.map +1 -0
- package/lib/api-schemas/app-runtime.js +782 -0
- package/lib/api-schemas/app-runtime.js.map +1 -0
- package/lib/api-schemas/apps.d.ts +247 -0
- package/lib/api-schemas/apps.d.ts.map +1 -0
- package/lib/api-schemas/apps.js +366 -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 +3561 -0
- package/lib/api-schemas/content.d.ts.map +1 -0
- package/lib/api-schemas/content.js +842 -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 +4880 -0
- package/lib/api-schemas/events.d.ts.map +1 -0
- package/lib/api-schemas/events.js +832 -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 +22454 -0
- package/lib/api-schemas/interaction.d.ts.map +1 -0
- package/lib/api-schemas/interaction.js +2065 -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 +97458 -0
- package/lib/api-schemas/registry.d.ts.map +1 -0
- package/lib/api-schemas/registry.js +2586 -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 +156 -0
- package/lib/api-schemas/sts.d.ts.map +1 -0
- package/lib/api-schemas/sts.js +96 -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 +2209 -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 +107 -1151
- package/lib/apps.d.ts.map +1 -1
- 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 +17 -128
- 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 +19 -115
- 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 +7 -0
- package/lib/index.d.ts.map +1 -1
- 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.d.ts +49 -462
- 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 +55 -503
- 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/secrets.d.ts +20 -105
- package/lib/secrets.d.ts.map +1 -1
- package/lib/store/agent-approval.d.ts +5 -14
- 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 +80 -0
- 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/store.d.ts +98 -700
- 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 +54 -518
- package/lib/store/workflow.d.ts.map +1 -1
- package/lib/store/workflow.js +23 -11
- package/lib/store/workflow.js.map +1 -1
- package/lib/sts-token-types.d.ts +12 -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 +54 -155
- package/lib/user.d.ts.map +1 -1
- package/lib/user.js +1 -78
- package/lib/user.js.map +1 -1
- package/lib/versions.d.ts +24 -1
- package/lib/versions.d.ts.map +1 -1
- package/lib/versions.js +23 -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/views-schema.d.ts +4 -4
- package/lib/views.d.ts +56 -312
- package/lib/views.d.ts.map +1 -1
- package/lib/views.js.map +1 -1
- package/package.json +13 -4
- 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 +1081 -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-lifecycle.ts +841 -0
- package/src/api-schemas/app-runtime.ts +919 -0
- package/src/api-schemas/apps.ts +415 -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 +939 -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 +921 -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.ts +2357 -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/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 +3487 -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 +450 -0
- package/src/api-schemas/store.ts +604 -0
- package/src/api-schemas/sts.contract.test.ts +80 -0
- package/src/api-schemas/sts.ts +110 -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.ts +234 -1213
- 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 +11 -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.ts +98 -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 +97 -557
- package/src/sts-token-types.ts +24 -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 +74 -214
- package/src/versions.ts +24 -0
- package/src/views-schema.test.ts +9 -1
- package/src/views.ts +106 -329
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library-neutral JSON Schema -> OpenAPI 3.1 `components.schemas` adapter.
|
|
3
|
+
*
|
|
4
|
+
* Input is plain JSON Schema, so this works for any authoring library. It normalizes the three
|
|
5
|
+
* ways a schema library expresses a named reference into the one form OpenAPI needs:
|
|
6
|
+
*
|
|
7
|
+
* - zod `$defs` + `{"$ref": "#/$defs/X"}` (and `{"$ref": "#"}` for self-recursion)
|
|
8
|
+
* - typebox a nested subschema carrying `$id` (hoisted here, per the same contract)
|
|
9
|
+
* - either a bare `{"$ref": "X"}` id pointer
|
|
10
|
+
*
|
|
11
|
+
* All three become `{"$ref": "#/components/schemas/X"}` with the target hoisted into components,
|
|
12
|
+
* so the pointer that is published is byte-identical to the pointer AJV compiles. That identity
|
|
13
|
+
* is the whole point: the spec cannot drift from the enforced contract because they are the same
|
|
14
|
+
* object.
|
|
15
|
+
*
|
|
16
|
+
* The input is never mutated.
|
|
17
|
+
*/
|
|
18
|
+
export class SchemaAdapterError extends Error {
|
|
19
|
+
}
|
|
20
|
+
const REF = '$ref';
|
|
21
|
+
const COMPONENT_PREFIX = '#/components/schemas/';
|
|
22
|
+
function isPlainObject(value) {
|
|
23
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
/** Resolve any of the supported reference spellings to a component name. */
|
|
26
|
+
function refTargetName(ref, rootName) {
|
|
27
|
+
if (ref === '#')
|
|
28
|
+
return rootName;
|
|
29
|
+
if (ref.startsWith('#/$defs/'))
|
|
30
|
+
return ref.slice('#/$defs/'.length);
|
|
31
|
+
if (ref.startsWith('#/definitions/'))
|
|
32
|
+
return ref.slice('#/definitions/'.length);
|
|
33
|
+
if (ref.startsWith(COMPONENT_PREFIX))
|
|
34
|
+
return ref.slice(COMPONENT_PREFIX.length);
|
|
35
|
+
if (ref.startsWith('#')) {
|
|
36
|
+
throw new SchemaAdapterError(`Unsupported internal pointer '${ref}' in component '${rootName}'. Only '#', '#/$defs/*' ` +
|
|
37
|
+
`and '#/components/schemas/*' can be hoisted to OpenAPI components.`);
|
|
38
|
+
}
|
|
39
|
+
return ref;
|
|
40
|
+
}
|
|
41
|
+
function componentRef(name) {
|
|
42
|
+
return { [REF]: `${COMPONENT_PREFIX}${name}` };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Adds `discriminator` to a union whose members are all component references and which share a
|
|
46
|
+
* required single-valued property. Generated Java/Go clients need this to pick a concrete
|
|
47
|
+
* subtype; without it they fall back to a loose map or fail to deserialize.
|
|
48
|
+
*
|
|
49
|
+
* The property must be REQUIRED in every branch — OpenAPI treats a discriminator as always
|
|
50
|
+
* present, so promoting an optional property would publish a contract the schema does not
|
|
51
|
+
* guarantee.
|
|
52
|
+
*/
|
|
53
|
+
function synthesizeDiscriminator(node, ctx) {
|
|
54
|
+
const members = node.oneOf ?? node.anyOf;
|
|
55
|
+
if (!Array.isArray(members) || members.length < 2 || node.discriminator)
|
|
56
|
+
return;
|
|
57
|
+
const targets = [];
|
|
58
|
+
for (const member of members) {
|
|
59
|
+
if (!isPlainObject(member) || typeof member[REF] !== 'string')
|
|
60
|
+
return;
|
|
61
|
+
const name = member[REF].slice(COMPONENT_PREFIX.length);
|
|
62
|
+
// Hoisted components shadow the already-published ones, which is what a root redefining a
|
|
63
|
+
// reference component means. Looked up rather than merged into one map: this runs for every
|
|
64
|
+
// union node, and building a 1000-entry object per node was most of the adaptation's cost.
|
|
65
|
+
const schema = ctx.components[name] ?? ctx.referenceComponents[name];
|
|
66
|
+
if (!schema)
|
|
67
|
+
return;
|
|
68
|
+
targets.push({ name, schema });
|
|
69
|
+
}
|
|
70
|
+
const candidates = new Map();
|
|
71
|
+
const disqualified = new Set();
|
|
72
|
+
for (const { name, schema } of targets) {
|
|
73
|
+
const properties = isPlainObject(schema.properties) ? schema.properties : undefined;
|
|
74
|
+
if (!properties)
|
|
75
|
+
return;
|
|
76
|
+
const required = Array.isArray(schema.required) ? schema.required : [];
|
|
77
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
78
|
+
if (!isPlainObject(value))
|
|
79
|
+
continue;
|
|
80
|
+
if (!required.includes(key)) {
|
|
81
|
+
disqualified.add(key);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const literal = typeof value.const === 'string'
|
|
85
|
+
? value.const
|
|
86
|
+
: Array.isArray(value.enum) && value.enum.length === 1 && typeof value.enum[0] === 'string'
|
|
87
|
+
? value.enum[0]
|
|
88
|
+
: undefined;
|
|
89
|
+
if (literal === undefined)
|
|
90
|
+
continue;
|
|
91
|
+
const mapping = candidates.get(key) ?? {};
|
|
92
|
+
// Two members claiming the same literal means it does not discriminate.
|
|
93
|
+
if (mapping[literal]) {
|
|
94
|
+
disqualified.add(key);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
mapping[literal] = `${COMPONENT_PREFIX}${name}`;
|
|
98
|
+
candidates.set(key, mapping);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
for (const [propertyName, mapping] of candidates) {
|
|
102
|
+
if (disqualified.has(propertyName))
|
|
103
|
+
continue;
|
|
104
|
+
if (Object.keys(mapping).length !== targets.length)
|
|
105
|
+
continue;
|
|
106
|
+
node.discriminator = { propertyName, mapping };
|
|
107
|
+
// OpenAPI requires oneOf for a discriminated union; anyOf is not enough for codegen.
|
|
108
|
+
if (node.anyOf && !node.oneOf) {
|
|
109
|
+
node.oneOf = node.anyOf;
|
|
110
|
+
delete node.anyOf;
|
|
111
|
+
}
|
|
112
|
+
// Restated on the union itself, matching what the OpenAPI scanner emits for the unions it
|
|
113
|
+
// derives. Both are already true of every branch, so validation is unchanged — but a
|
|
114
|
+
// generated Java/Go client reads the union node, not the branches, and needs to be told
|
|
115
|
+
// the value is an object whose discriminator is always present.
|
|
116
|
+
node.type = 'object';
|
|
117
|
+
const required = Array.isArray(node.required)
|
|
118
|
+
? node.required.filter((item) => typeof item === 'string')
|
|
119
|
+
: [];
|
|
120
|
+
node.required = [...new Set([...required, propertyName])];
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Definition entries in an order that lets a discriminator be synthesized.
|
|
126
|
+
*
|
|
127
|
+
* A union's `discriminator` is read off its MEMBERS, so a union hoisted before them registers
|
|
128
|
+
* without one. That is invisible until the same union is registered twice — once as a root, where
|
|
129
|
+
* Zod happens to emit its members first, and once inside a component that references it, where it
|
|
130
|
+
* does not — at which point the two shapes disagree and `register` reports a conflict on a
|
|
131
|
+
* component nobody wrote twice.
|
|
132
|
+
*
|
|
133
|
+
* A discriminated union's branches are objects, never unions themselves, so hoisting non-unions
|
|
134
|
+
* first is enough to make the result independent of the order Zod emitted `$defs` in.
|
|
135
|
+
*/
|
|
136
|
+
function inHoistOrder(block) {
|
|
137
|
+
const entries = Object.entries(block);
|
|
138
|
+
const isUnion = (schema) => isPlainObject(schema) && (Array.isArray(schema.oneOf) || Array.isArray(schema.anyOf));
|
|
139
|
+
return [...entries.filter(([, schema]) => !isUnion(schema)), ...entries.filter(([, schema]) => isUnion(schema))];
|
|
140
|
+
}
|
|
141
|
+
function walk(value, ctx, isRoot) {
|
|
142
|
+
if (Array.isArray(value))
|
|
143
|
+
return value.map((item) => walk(item, ctx, false));
|
|
144
|
+
if (!isPlainObject(value))
|
|
145
|
+
return value;
|
|
146
|
+
const { $schema: _schema, $id, $defs, definitions, ...rest } = value;
|
|
147
|
+
// A nested $id opens a new reference scope: `{"$ref": "#"}` inside it means *this* schema,
|
|
148
|
+
// not the enclosing root.
|
|
149
|
+
const scopeName = typeof $id === 'string' && !isRoot ? $id : ctx.rootName;
|
|
150
|
+
const previousRoot = ctx.rootName;
|
|
151
|
+
ctx.rootName = scopeName;
|
|
152
|
+
try {
|
|
153
|
+
// Hoist sibling definition blocks first so members can reference each other — and before the
|
|
154
|
+
// `$ref` branch below, which returns without descending. A node that is ONLY a reference can
|
|
155
|
+
// still carry the definitions that reference points at: that is exactly the shape Zod emits
|
|
156
|
+
// for an alias schema adapted on its own, and skipping its `$defs` left the reference dangling.
|
|
157
|
+
for (const block of [$defs, definitions]) {
|
|
158
|
+
if (!isPlainObject(block))
|
|
159
|
+
continue;
|
|
160
|
+
for (const [name, schema] of inHoistOrder(block)) {
|
|
161
|
+
hoist(name, schema, ctx);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (typeof rest[REF] === 'string') {
|
|
165
|
+
const rewritten = componentRef(refTargetName(rest[REF], ctx.rootName));
|
|
166
|
+
// In 2020-12 a reference may carry sibling keywords and annotations; keep them.
|
|
167
|
+
const siblings = Object.entries(rest).filter(([key]) => key !== REF);
|
|
168
|
+
if (siblings.length === 0)
|
|
169
|
+
return rewritten;
|
|
170
|
+
const out = {};
|
|
171
|
+
for (const [key, child] of siblings)
|
|
172
|
+
out[key] = walk(child, ctx, false);
|
|
173
|
+
return { ...out, ...rewritten };
|
|
174
|
+
}
|
|
175
|
+
const out = {};
|
|
176
|
+
for (const [key, child] of Object.entries(rest)) {
|
|
177
|
+
// An empty `properties` map constrains nothing, and Zod emits one for the catchall-only
|
|
178
|
+
// object that a `Record<string, T>` index signature has to be written as — `z.record`
|
|
179
|
+
// additionally emits a `propertyNames`, which the TypeScript-derived generator never did.
|
|
180
|
+
// Dropping it is what lets such a component be byte-identical to its derived counterpart.
|
|
181
|
+
if (key === 'properties' && isPlainObject(child) && Object.keys(child).length === 0)
|
|
182
|
+
continue;
|
|
183
|
+
// `properties` keys are user data, not schema keywords — never treat them as refs.
|
|
184
|
+
out[key] =
|
|
185
|
+
key === 'properties' && isPlainObject(child)
|
|
186
|
+
? Object.fromEntries(Object.entries(child).map(([p, s]) => [p, walk(s, ctx, false)]))
|
|
187
|
+
: walk(child, ctx, false);
|
|
188
|
+
}
|
|
189
|
+
synthesizeDiscriminator(out, ctx);
|
|
190
|
+
// A nested schema carrying its own $id is a named component: hoist it and leave a reference.
|
|
191
|
+
if (typeof $id === 'string' && !isRoot) {
|
|
192
|
+
register($id, out, ctx);
|
|
193
|
+
return componentRef($id);
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
finally {
|
|
198
|
+
ctx.rootName = previousRoot;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function register(name, schema, ctx) {
|
|
202
|
+
const fingerprint = JSON.stringify(schema);
|
|
203
|
+
const previous = ctx.seen.get(name);
|
|
204
|
+
if (previous !== undefined && previous !== fingerprint) {
|
|
205
|
+
throw new SchemaAdapterError(`Component '${name}' is defined twice with different shapes (seen while adapting ` +
|
|
206
|
+
`'${ctx.rootName}'). Component names must be globally unique.`);
|
|
207
|
+
}
|
|
208
|
+
ctx.seen.set(name, fingerprint);
|
|
209
|
+
ctx.components[name] = schema;
|
|
210
|
+
}
|
|
211
|
+
function hoist(name, schema, ctx) {
|
|
212
|
+
if (!isPlainObject(schema))
|
|
213
|
+
return;
|
|
214
|
+
// Already being walked higher up the stack — the reference will resolve once it lands.
|
|
215
|
+
if (ctx.pending.has(name))
|
|
216
|
+
return;
|
|
217
|
+
ctx.pending.add(name);
|
|
218
|
+
const previousRoot = ctx.rootName;
|
|
219
|
+
// A `$defs` entry does NOT open a new reference scope — only an `$id` does. `{"$ref": "#"}`
|
|
220
|
+
// inside one still points at the DOCUMENT root, so the enclosing root name has to stay in place.
|
|
221
|
+
// Naming the entry here instead was invisible until the first recursive schema: Zod writes
|
|
222
|
+
// `JSONSchemaProperties.additionalProperties` as a bare `#`, meaning the enclosing `JSONSchema`,
|
|
223
|
+
// and rewriting it to `JSONSchemaProperties` turned a property map into a map of property maps.
|
|
224
|
+
if (typeof schema.$id === 'string')
|
|
225
|
+
ctx.rootName = schema.$id;
|
|
226
|
+
try {
|
|
227
|
+
// Every root carries its own inlined copy of the whole `$defs` closure it reaches, so a shared
|
|
228
|
+
// definition arrives here once per referencing root — 7069 times for 671 names on the full
|
|
229
|
+
// registry. The repeats are what feed `register`'s shape comparison, and they cannot be short-
|
|
230
|
+
// circuited on the INPUT: two copies of the same definition are not textually equal, because a
|
|
231
|
+
// `$ref` inside one is spelled relative to whichever root inlined it. Only the walked form is
|
|
232
|
+
// comparable, so every copy is walked.
|
|
233
|
+
register(name, walk(schema, ctx, true), ctx);
|
|
234
|
+
}
|
|
235
|
+
finally {
|
|
236
|
+
ctx.rootName = previousRoot;
|
|
237
|
+
ctx.pending.delete(name);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** Every `$ref` must land on a component that exists, or the spec ships a dangling pointer. */
|
|
241
|
+
function assertReferencesResolve(components, referenceComponents) {
|
|
242
|
+
const visit = (node, owner) => {
|
|
243
|
+
if (Array.isArray(node)) {
|
|
244
|
+
for (const item of node)
|
|
245
|
+
visit(item, owner);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (!isPlainObject(node))
|
|
249
|
+
return;
|
|
250
|
+
const ref = node[REF];
|
|
251
|
+
if (typeof ref === 'string') {
|
|
252
|
+
const name = ref.startsWith(COMPONENT_PREFIX) ? ref.slice(COMPONENT_PREFIX.length) : undefined;
|
|
253
|
+
if (name === undefined || (!components[name] && !referenceComponents[name])) {
|
|
254
|
+
throw new SchemaAdapterError(`Component '${owner}' references '${ref}', which is not a known component.`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
for (const child of Object.values(node))
|
|
258
|
+
visit(child, owner);
|
|
259
|
+
};
|
|
260
|
+
for (const [name, schema] of Object.entries(components))
|
|
261
|
+
visit(schema, name);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Converts a map of named JSON Schemas into OpenAPI `components.schemas`.
|
|
265
|
+
*
|
|
266
|
+
* @param roots component name -> plain JSON Schema
|
|
267
|
+
*/
|
|
268
|
+
export function toOpenApiComponents(roots, options = {}) {
|
|
269
|
+
const ctx = {
|
|
270
|
+
components: {},
|
|
271
|
+
referenceComponents: options.referenceComponents ?? {},
|
|
272
|
+
rootName: '',
|
|
273
|
+
seen: new Map(),
|
|
274
|
+
pending: new Set(),
|
|
275
|
+
};
|
|
276
|
+
for (const [name, schema] of Object.entries(roots)) {
|
|
277
|
+
if (!isPlainObject(schema)) {
|
|
278
|
+
throw new SchemaAdapterError(`Component '${name}' is not an object schema.`);
|
|
279
|
+
}
|
|
280
|
+
ctx.rootName = name;
|
|
281
|
+
register(name, walk(structuredClone(schema), ctx, true), ctx);
|
|
282
|
+
}
|
|
283
|
+
const strict = options.strictComponents;
|
|
284
|
+
if (strict) {
|
|
285
|
+
for (const name of strict) {
|
|
286
|
+
const schema = ctx.components[name];
|
|
287
|
+
if (!schema) {
|
|
288
|
+
throw new SchemaAdapterError(`Cannot apply a strict policy to unknown component '${name}'.`);
|
|
289
|
+
}
|
|
290
|
+
closeObjects(schema);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
for (const [name, schema] of Object.entries(ctx.components)) {
|
|
294
|
+
if (strict?.has(name))
|
|
295
|
+
continue;
|
|
296
|
+
// Open the component by removing an inherited `false`. A `true` or a subschema is a
|
|
297
|
+
// deliberate constraint on the extras (e.g. a Record<string, string> value type) and must
|
|
298
|
+
// survive — deleting it would silently widen the contract to accept anything.
|
|
299
|
+
if (schema.additionalProperties === false)
|
|
300
|
+
delete schema.additionalProperties;
|
|
301
|
+
// The one subschema that is NOT a constraint: `{}` accepts every extra, which is exactly what
|
|
302
|
+
// an absent `additionalProperties` means. Zod emits it for `looseObject`, and the
|
|
303
|
+
// TypeScript-derived generator emits nothing for the index signature that models the same
|
|
304
|
+
// thing, so dropping it is what lets an intentionally-open component be byte-identical to its
|
|
305
|
+
// derived counterpart. Unlike the `false` above, this changes no meaning at all.
|
|
306
|
+
if (isPlainObject(schema.additionalProperties) && Object.keys(schema.additionalProperties).length === 0) {
|
|
307
|
+
delete schema.additionalProperties;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
for (const schema of Object.values(ctx.components)) {
|
|
311
|
+
normalizeOpenMaps(schema);
|
|
312
|
+
}
|
|
313
|
+
for (const schema of Object.values(ctx.components)) {
|
|
314
|
+
moveDescriptionsLast(schema);
|
|
315
|
+
}
|
|
316
|
+
assertReferencesResolve(ctx.components, ctx.referenceComponents);
|
|
317
|
+
return ctx.components;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Visits every SUBSCHEMA of a node, and nothing else.
|
|
321
|
+
*
|
|
322
|
+
* The distinction is load-bearing rather than pedantic: `properties` is a map from property NAME to
|
|
323
|
+
* subschema, so its keys are user data. A generic "walk every object" pass would treat a property
|
|
324
|
+
* literally named `description` — which `Project`, `ICreateProjectPayload` and three other published
|
|
325
|
+
* components have — as the `description` keyword, and reordering it would change the published
|
|
326
|
+
* property order. Enumerating the structural keywords is what makes that impossible.
|
|
327
|
+
*/
|
|
328
|
+
function eachSubschema(node, visit) {
|
|
329
|
+
for (const keyword of ['items', 'additionalProperties', 'propertyNames', 'contains', 'not', 'if', 'then', 'else']) {
|
|
330
|
+
const child = node[keyword];
|
|
331
|
+
if (isPlainObject(child))
|
|
332
|
+
visit(child);
|
|
333
|
+
}
|
|
334
|
+
for (const keyword of ['properties', 'patternProperties', '$defs', 'definitions', 'dependentSchemas']) {
|
|
335
|
+
const map = node[keyword];
|
|
336
|
+
if (!isPlainObject(map))
|
|
337
|
+
continue;
|
|
338
|
+
for (const child of Object.values(map)) {
|
|
339
|
+
if (isPlainObject(child))
|
|
340
|
+
visit(child);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
for (const keyword of ['anyOf', 'oneOf', 'allOf', 'prefixItems']) {
|
|
344
|
+
const list = node[keyword];
|
|
345
|
+
if (!Array.isArray(list))
|
|
346
|
+
continue;
|
|
347
|
+
for (const child of list) {
|
|
348
|
+
if (isPlainObject(child))
|
|
349
|
+
visit(child);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Spells an unconstrained map the way the document already spelled it, everywhere below a component
|
|
355
|
+
* root.
|
|
356
|
+
*
|
|
357
|
+
* Zod writes a `Record<string, T>` with an unconstrained value as `additionalProperties: {}` plus
|
|
358
|
+
* `propertyNames: {type: 'string'}`. Neither constrains anything — the empty schema accepts every
|
|
359
|
+
* value, and a JSON object's keys are strings by definition — so both are equivalent to what the
|
|
360
|
+
* TypeScript-derived generator emitted, which was `additionalProperties: true` and no
|
|
361
|
+
* `propertyNames` at all.
|
|
362
|
+
*
|
|
363
|
+
* Equivalent to a validator, but NOT to a code generator: openapi-generator renders the two
|
|
364
|
+
* `additionalProperties` spellings as different Go types (`map[string]interface{}` against
|
|
365
|
+
* `map[string]*interface{}`), so publishing the Zod spelling silently changed the generated Go
|
|
366
|
+
* client's map element type at 109 sites. That is a source break for SDK consumers bought for
|
|
367
|
+
* nothing, which is why the published form is normalized rather than left as emitted.
|
|
368
|
+
*
|
|
369
|
+
* Runs after the component-root pass above, which DELETES a root's empty `additionalProperties`
|
|
370
|
+
* outright. Roots therefore never reach here still carrying one, and the two rules do not fight.
|
|
371
|
+
*/
|
|
372
|
+
function normalizeOpenMaps(node) {
|
|
373
|
+
if (isPlainObject(node.additionalProperties) && Object.keys(node.additionalProperties).length === 0) {
|
|
374
|
+
node.additionalProperties = true;
|
|
375
|
+
}
|
|
376
|
+
// `{type: 'string'}` is the only no-op form; a pattern or a length bound is a real constraint on
|
|
377
|
+
// the keys and has to survive.
|
|
378
|
+
const names = node.propertyNames;
|
|
379
|
+
if (isPlainObject(names) && (Object.keys(names).length === 0 || isOnlyStringType(names))) {
|
|
380
|
+
delete node.propertyNames;
|
|
381
|
+
}
|
|
382
|
+
eachSubschema(node, normalizeOpenMaps);
|
|
383
|
+
}
|
|
384
|
+
function isOnlyStringType(schema) {
|
|
385
|
+
const keys = Object.keys(schema);
|
|
386
|
+
return keys.length === 1 && keys[0] === 'type' && schema.type === 'string';
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Closes a strict component and every anonymous object inside it.
|
|
390
|
+
*
|
|
391
|
+
* Strictness is declared per component, but an object nested inline in one is not a component — it has
|
|
392
|
+
* no name to list — so without this it stayed open while its parent closed. The TypeScript-derived
|
|
393
|
+
* generator closed every object it emitted, so the document already publishes those inline objects
|
|
394
|
+
* closed, and leaving them open would loosen the published contract.
|
|
395
|
+
*
|
|
396
|
+
* An existing `additionalProperties` is never overwritten: `true` or a subschema is a deliberate
|
|
397
|
+
* statement about the extras — a `Record<string, string>` value type, say — and replacing it with
|
|
398
|
+
* `false` would reject data the schema explicitly allows. A nested `$ref` is left alone too; it points
|
|
399
|
+
* at another component, which is governed by its own listing.
|
|
400
|
+
*/
|
|
401
|
+
function closeObjects(node) {
|
|
402
|
+
if (typeof node[REF] !== 'string' && node.type === 'object' && node.additionalProperties === undefined) {
|
|
403
|
+
node.additionalProperties = false;
|
|
404
|
+
}
|
|
405
|
+
eachSubschema(node, closeObjects);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Puts `description` last on every subschema, which is where the published document has it.
|
|
409
|
+
*
|
|
410
|
+
* Key order carries no meaning to consumers, but stable ordering keeps generated artifacts readable.
|
|
411
|
+
* The scanner's TypeScript-derived output puts `description` last, while Zod emits it wherever
|
|
412
|
+
* `.meta()` happened to land, and
|
|
413
|
+
* the strict policy above appends `additionalProperties` after that, so without this pass a described
|
|
414
|
+
* `$ref` property emitted `{description, $ref}` against the document's `{$ref, description}` and every
|
|
415
|
+
* closed component with a description emitted `{description, additionalProperties}`.
|
|
416
|
+
*/
|
|
417
|
+
function moveDescriptionsLast(node) {
|
|
418
|
+
eachSubschema(node, moveDescriptionsLast);
|
|
419
|
+
if (!('description' in node))
|
|
420
|
+
return;
|
|
421
|
+
const keys = Object.keys(node);
|
|
422
|
+
if (keys[keys.length - 1] === 'description')
|
|
423
|
+
return;
|
|
424
|
+
const { description } = node;
|
|
425
|
+
delete node.description;
|
|
426
|
+
node.description = description;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Sibling keywords next to a `$ref` that compose conjunctively in a way pruning can honour: both
|
|
430
|
+
* schemas' declared properties count as declared, and required is the union.
|
|
431
|
+
*/
|
|
432
|
+
const COMPOSABLE_SIBLINGS = new Set(['properties', 'required']);
|
|
433
|
+
/** Siblings that annotate rather than constrain, so they cannot affect which fields survive. */
|
|
434
|
+
const ANNOTATION_SIBLINGS = new Set([
|
|
435
|
+
'title',
|
|
436
|
+
'description',
|
|
437
|
+
'deprecated',
|
|
438
|
+
'examples',
|
|
439
|
+
'example',
|
|
440
|
+
'default',
|
|
441
|
+
'readOnly',
|
|
442
|
+
'writeOnly',
|
|
443
|
+
'format',
|
|
444
|
+
'$comment',
|
|
445
|
+
]);
|
|
446
|
+
/**
|
|
447
|
+
* Applicator keywords whose interaction with pruning is not sound to guess.
|
|
448
|
+
*
|
|
449
|
+
* `patternProperties` and `dependentSchemas` declare fields that are absent from `properties`, so
|
|
450
|
+
* pruning would delete legitimate data. `prefixItems` gives array positions their own schemas,
|
|
451
|
+
* which the single-`items` path would apply wrongly. `not`/`if` are conditional, and `allOf`
|
|
452
|
+
* needs the union of every branch's properties.
|
|
453
|
+
*/
|
|
454
|
+
const UNSUPPORTED_APPLICATORS = [
|
|
455
|
+
'allOf',
|
|
456
|
+
'patternProperties',
|
|
457
|
+
'prefixItems',
|
|
458
|
+
'dependentSchemas',
|
|
459
|
+
'unevaluatedProperties',
|
|
460
|
+
'not',
|
|
461
|
+
'if',
|
|
462
|
+
];
|
|
463
|
+
/** Sibling keywords beside a `$ref` that cannot be composed safely. */
|
|
464
|
+
function unsupportedSiblings(schema) {
|
|
465
|
+
return Object.keys(schema).filter((key) => key !== REF && !COMPOSABLE_SIBLINGS.has(key) && !ANNOTATION_SIBLINGS.has(key));
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Fully resolves a reference chain, composing the sibling keywords that can be composed.
|
|
469
|
+
*
|
|
470
|
+
* Follows references until a non-reference schema is reached. A component whose body is itself a
|
|
471
|
+
* `$ref` — or one carrying `properties` beside a `$ref` — is an alias, and stopping after one hop
|
|
472
|
+
* would hand the caller a node that still has a `$ref`. Pruning would then read that node's own
|
|
473
|
+
* `properties` as the whole shape and drop everything the target declares, while
|
|
474
|
+
* {@link findUnprunablePaths} kept recursing and reported nothing wrong. Both paths call this, so
|
|
475
|
+
* they always see the same terminal schema.
|
|
476
|
+
*
|
|
477
|
+
* In JSON Schema 2020-12 a `$ref` and its siblings apply CONJUNCTIVELY — both must hold. Merging
|
|
478
|
+
* by overwriting would be wrong in the widening direction: a sibling `additionalProperties: true`
|
|
479
|
+
* beside a closed target does not open it. Rather than reimplement intersection semantics (whose
|
|
480
|
+
* `additionalProperties` interaction is famously counterintuitive), anything beyond a union of
|
|
481
|
+
* `properties`/`required` and pure annotations is declined — the caller then passes the value
|
|
482
|
+
* through untouched.
|
|
483
|
+
*
|
|
484
|
+
* Returns a reason instead of a schema when a target is unknown, a link carries siblings that
|
|
485
|
+
* cannot be composed, or the chain cycles.
|
|
486
|
+
*/
|
|
487
|
+
function resolveChain(schema, components) {
|
|
488
|
+
let current = schema;
|
|
489
|
+
const visited = new Set();
|
|
490
|
+
// Sibling contributions accumulated along the chain, applied to the terminal schema.
|
|
491
|
+
const extraProperties = {};
|
|
492
|
+
const extraRequired = [];
|
|
493
|
+
while (typeof current[REF] === 'string') {
|
|
494
|
+
const unsupported = unsupportedSiblings(current);
|
|
495
|
+
if (unsupported.length > 0) {
|
|
496
|
+
return { reason: `$ref with unsupported sibling: ${unsupported.sort().join(', ')}` };
|
|
497
|
+
}
|
|
498
|
+
const name = current[REF].slice(COMPONENT_PREFIX.length);
|
|
499
|
+
// An alias cycle has no terminal schema to prune against.
|
|
500
|
+
if (visited.has(name))
|
|
501
|
+
return { reason: 'circular $ref' };
|
|
502
|
+
visited.add(name);
|
|
503
|
+
const properties = current.properties;
|
|
504
|
+
if (isPlainObject(properties))
|
|
505
|
+
Object.assign(extraProperties, properties);
|
|
506
|
+
if (Array.isArray(current.required))
|
|
507
|
+
extraRequired.push(...current.required);
|
|
508
|
+
const target = components[name];
|
|
509
|
+
if (!target)
|
|
510
|
+
return { reason: 'unresolved $ref' };
|
|
511
|
+
current = target;
|
|
512
|
+
}
|
|
513
|
+
if (Object.keys(extraProperties).length === 0 && extraRequired.length === 0)
|
|
514
|
+
return { schema: current };
|
|
515
|
+
const merged = { ...current };
|
|
516
|
+
merged.properties = { ...(isPlainObject(current.properties) ? current.properties : {}), ...extraProperties };
|
|
517
|
+
if (extraRequired.length > 0) {
|
|
518
|
+
const existing = Array.isArray(current.required) ? current.required : [];
|
|
519
|
+
merged.required = [...new Set([...existing, ...extraRequired])];
|
|
520
|
+
}
|
|
521
|
+
return { schema: merged };
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* {@link resolveChain} for callers that only need to know whether resolution succeeded.
|
|
525
|
+
*
|
|
526
|
+
* Exported so parameter normalization follows the same reference semantics as pruning rather than
|
|
527
|
+
* carrying a second, subtly different resolver. A query parameter typed by a hoisted enum is reached
|
|
528
|
+
* through exactly the chain walked here, so what the normalizer coerces towards and what the spec
|
|
529
|
+
* publishes are read off the same node.
|
|
530
|
+
*/
|
|
531
|
+
export function resolveSchemaRef(schema, components) {
|
|
532
|
+
const resolution = resolveChain(schema, components);
|
|
533
|
+
return 'schema' in resolution ? resolution.schema : undefined;
|
|
534
|
+
}
|
|
535
|
+
function resolve(schema, components) {
|
|
536
|
+
return resolveSchemaRef(schema, components);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Whether a subschema could describe an object, i.e. whether pruning it would do anything.
|
|
540
|
+
* References are resolved first — a `$ref` to a scalar enum is not object-bearing, and treating
|
|
541
|
+
* every reference as one makes scalar unions look ambiguous when they are not.
|
|
542
|
+
*/
|
|
543
|
+
function couldHoldProperties(node, components) {
|
|
544
|
+
if (!isPlainObject(node))
|
|
545
|
+
return false;
|
|
546
|
+
const resolved = typeof node[REF] === 'string' ? resolve(node, components) : node;
|
|
547
|
+
// An unresolvable reference is opaque, so assume the worst.
|
|
548
|
+
if (!resolved)
|
|
549
|
+
return true;
|
|
550
|
+
return (resolved.type === 'object' ||
|
|
551
|
+
isPlainObject(resolved.properties) ||
|
|
552
|
+
resolved.additionalProperties !== undefined ||
|
|
553
|
+
resolved.patternProperties !== undefined ||
|
|
554
|
+
resolved.allOf !== undefined ||
|
|
555
|
+
resolved.oneOf !== undefined ||
|
|
556
|
+
resolved.anyOf !== undefined);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Why this node cannot be narrowed, or undefined if it can.
|
|
560
|
+
*
|
|
561
|
+
* Shared by {@link pruneToSchema} and {@link findUnprunablePaths} so the pruner and the report of
|
|
562
|
+
* its own limitations cannot drift apart.
|
|
563
|
+
*/
|
|
564
|
+
function unprunableReason(node, components) {
|
|
565
|
+
for (const keyword of UNSUPPORTED_APPLICATORS) {
|
|
566
|
+
if (node[keyword] !== undefined)
|
|
567
|
+
return keyword;
|
|
568
|
+
}
|
|
569
|
+
const branches = node.oneOf ?? node.anyOf;
|
|
570
|
+
if (Array.isArray(branches)) {
|
|
571
|
+
// A union of scalars (a nullable enum, say) has no properties to narrow, so an absent
|
|
572
|
+
// discriminator costs nothing.
|
|
573
|
+
if (!branches.some((branch) => couldHoldProperties(branch, components)))
|
|
574
|
+
return undefined;
|
|
575
|
+
if (!isPlainObject(node.discriminator))
|
|
576
|
+
return 'union without discriminator';
|
|
577
|
+
}
|
|
578
|
+
return undefined;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Reports the paths within a component where {@link pruneToSchema} cannot narrow. Values at those
|
|
582
|
+
* paths pass through untouched, extras included.
|
|
583
|
+
*
|
|
584
|
+
* An empty report means every path is structurally prunable FOR SCHEMA-CONFORMING INPUT. It is not
|
|
585
|
+
* a guarantee about arbitrary payloads: a discriminated union whose discriminator carries a value
|
|
586
|
+
* with no mapping entry still passes through, because no branch describes it. Treat an empty
|
|
587
|
+
* report as "no structural gaps", not as "nothing can escape".
|
|
588
|
+
*/
|
|
589
|
+
export function findUnprunablePaths(schema, components) {
|
|
590
|
+
const found = [];
|
|
591
|
+
const visiting = new Set();
|
|
592
|
+
const visit = (node, path) => {
|
|
593
|
+
const ref = node[REF];
|
|
594
|
+
if (typeof ref === 'string') {
|
|
595
|
+
const name = ref.slice(COMPONENT_PREFIX.length);
|
|
596
|
+
if (visiting.has(name))
|
|
597
|
+
return; // cycle — already accounted for
|
|
598
|
+
// The same resolution the pruner performs, chain included, so a defect in an alias
|
|
599
|
+
// hop is reported here rather than discovered when a response comes back malformed.
|
|
600
|
+
const resolution = resolveChain(node, components);
|
|
601
|
+
if ('reason' in resolution) {
|
|
602
|
+
found.push(`${path} (${resolution.reason})`);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
visiting.add(name);
|
|
606
|
+
visit(resolution.schema, path);
|
|
607
|
+
visiting.delete(name);
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
const reason = unprunableReason(node, components);
|
|
611
|
+
if (reason) {
|
|
612
|
+
found.push(`${path} (${reason})`);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
const branches = node.oneOf ?? node.anyOf;
|
|
616
|
+
if (Array.isArray(branches)) {
|
|
617
|
+
if (!branches.some((branch) => couldHoldProperties(branch, components)))
|
|
618
|
+
return;
|
|
619
|
+
for (const [index, branch] of branches.entries()) {
|
|
620
|
+
if (isPlainObject(branch))
|
|
621
|
+
visit(branch, `${path}/${index}`);
|
|
622
|
+
}
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
if (isPlainObject(node.properties)) {
|
|
626
|
+
for (const [key, child] of Object.entries(node.properties)) {
|
|
627
|
+
if (isPlainObject(child))
|
|
628
|
+
visit(child, `${path}/${key}`);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
// A map's values are pruned through this subschema, so its limitations count too.
|
|
632
|
+
if (isPlainObject(node.additionalProperties) && Object.keys(node.additionalProperties).length > 0) {
|
|
633
|
+
visit(node.additionalProperties, `${path}{}`);
|
|
634
|
+
}
|
|
635
|
+
if (isPlainObject(node.items))
|
|
636
|
+
visit(node.items, `${path}[]`);
|
|
637
|
+
};
|
|
638
|
+
visit(schema, '');
|
|
639
|
+
return found;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Whether an object schema describes a fixed shape (prunable) or a freeform map (must be left
|
|
643
|
+
* alone).
|
|
644
|
+
*
|
|
645
|
+
* The distinction is what makes this safe. AJV's `removeAdditional: 'all'` strips keys from
|
|
646
|
+
* freeform objects too — that is how `launch_workstream`'s `data` was silently emptied and
|
|
647
|
+
* `sys:AppDeveloper` lost `user_prompt` (see `packages/workflows/src/tools/validation.ts`).
|
|
648
|
+
* `Account.feature_flags` is exactly such a map: `{additionalProperties: {}}` with no
|
|
649
|
+
* `properties`. Pruning it would delete every operator flag.
|
|
650
|
+
*/
|
|
651
|
+
function declaresFixedShape(schema) {
|
|
652
|
+
const additional = schema.additionalProperties;
|
|
653
|
+
if (additional === false)
|
|
654
|
+
return true;
|
|
655
|
+
// Explicitly extensible (`true` or a subschema) — the extras are part of the contract.
|
|
656
|
+
if (additional !== undefined)
|
|
657
|
+
return false;
|
|
658
|
+
return isPlainObject(schema.properties);
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Best-effort narrowing of a response payload to the properties its published schema declares.
|
|
662
|
+
*
|
|
663
|
+
* NOT A SECURITY BOUNDARY. Where the schema is ambiguous — an `allOf` intersection, a union with
|
|
664
|
+
* no discriminator, a discriminator value with no mapping entry, or an unresolvable `$ref` — the
|
|
665
|
+
* value passes through UNTOUCHED, extras included. Losing data is worse than guessing, so the
|
|
666
|
+
* pruner declines rather than improvises. Anything that must never reach a client (secrets,
|
|
667
|
+
* internal identifiers) still needs an explicit response mapper or a request/response type split;
|
|
668
|
+
* this must not be relied on to remove it. {@link findUnprunablePaths} reports where a given
|
|
669
|
+
* component falls into those gaps.
|
|
670
|
+
*
|
|
671
|
+
* Responses are pruned rather than rejected: a document carrying an undocumented field is the
|
|
672
|
+
* server's problem, not the caller's, and failing would turn drift into a 500.
|
|
673
|
+
*
|
|
674
|
+
* The input is never mutated.
|
|
675
|
+
*/
|
|
676
|
+
export function pruneToSchema(value, schema, components) {
|
|
677
|
+
const resolved = resolve(schema, components);
|
|
678
|
+
if (!resolved)
|
|
679
|
+
return value;
|
|
680
|
+
// Declines on any shape whose narrowing would be a guess. Shared with findUnprunablePaths so
|
|
681
|
+
// the report always describes what the pruner actually does.
|
|
682
|
+
if (unprunableReason(resolved, components))
|
|
683
|
+
return value;
|
|
684
|
+
const branches = resolved.oneOf ?? resolved.anyOf;
|
|
685
|
+
if (Array.isArray(branches)) {
|
|
686
|
+
const discriminator = resolved.discriminator;
|
|
687
|
+
if (!isPlainObject(discriminator) || !isPlainObject(value))
|
|
688
|
+
return value;
|
|
689
|
+
const key = discriminator.propertyName;
|
|
690
|
+
const mapping = discriminator.mapping;
|
|
691
|
+
if (typeof key !== 'string' || !isPlainObject(mapping))
|
|
692
|
+
return value;
|
|
693
|
+
const target = mapping[String(value[key])];
|
|
694
|
+
if (typeof target !== 'string')
|
|
695
|
+
return value;
|
|
696
|
+
return pruneToSchema(value, { [REF]: target }, components);
|
|
697
|
+
}
|
|
698
|
+
if (Array.isArray(value)) {
|
|
699
|
+
const items = resolved.items;
|
|
700
|
+
if (!isPlainObject(items))
|
|
701
|
+
return value;
|
|
702
|
+
return value.map((item) => pruneToSchema(item, items, components));
|
|
703
|
+
}
|
|
704
|
+
if (!isPlainObject(value))
|
|
705
|
+
return value;
|
|
706
|
+
const properties = isPlainObject(resolved.properties) ? resolved.properties : undefined;
|
|
707
|
+
const additional = resolved.additionalProperties;
|
|
708
|
+
const fixed = declaresFixedShape(resolved);
|
|
709
|
+
const out = {};
|
|
710
|
+
for (const [key, child] of Object.entries(value)) {
|
|
711
|
+
const propertySchema = properties?.[key];
|
|
712
|
+
if (isPlainObject(propertySchema)) {
|
|
713
|
+
out[key] = pruneToSchema(child, propertySchema, components);
|
|
714
|
+
continue;
|
|
715
|
+
}
|
|
716
|
+
if (fixed)
|
|
717
|
+
continue; // undeclared on a fixed shape — drop it
|
|
718
|
+
// Freeform: keep the value, narrowing it only if a subschema describes the extras.
|
|
719
|
+
out[key] =
|
|
720
|
+
isPlainObject(additional) && Object.keys(additional).length > 0
|
|
721
|
+
? pruneToSchema(child, additional, components)
|
|
722
|
+
: child;
|
|
723
|
+
}
|
|
724
|
+
return out;
|
|
725
|
+
}
|
|
726
|
+
//# sourceMappingURL=adapter.js.map
|