* Use compiler-backed schema previews * Keep schema compiler off browser path * Vendor schema TypeScript compiler * Fix vendored compiler runtime imports * Fix schema compiler CI failures * Fold schema compiler into SDK * Document vendored schema compiler attribution * Simplify tool schema TypeScript loading * Always include schema TypeScript previews * Use raw schema compiler previews * Revert "Use raw schema compiler previews" This reverts commit 1b69bc7c8d0340365d0136df7756034696285fd8. * Restore tool metadata responses * Remove vendored compiler lodash dependency * Clean up vendored schema compiler helpers * Treat vendored schema compiler as internal code * Add real OpenAPI schema preview baselines * Resolve schema refs without external loading * Fix schema compiler format and typecheck * Remove vendored compiler debug logging
Unified · Split
| @@ -119,6 +119,7 @@ · 118 unmodified lines | |||
| 119 | "integrationsdotsh/", | 119 | "integrationsdotsh/", |
| 120 | "node_modules/", | 120 | "node_modules/", |
| 121 | "packages/core/fumadb/", | 121 | "packages/core/fumadb/", |
| 122 | "packages/core/sdk/src/vendor/json-schema-to-typescript/", | ||
| 122 | "bun.lock", | 123 | "bun.lock", |
| 123 | "*.tsbuildinfo", | 124 | "*.tsbuildinfo", |
| 124 | "executor-*.tgz", | 125 | "executor-*.tgz", |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | "type": "module", | 5 | "type": "module", |
| 6 | "exports": { | 6 | "exports": { |
| 7 | ".": "./src/index.ts", | 7 | ".": "./src/index.ts", |
| 8 | "./client": "./src/client.ts", | ||
| 8 | "./server": "./src/server.ts" | 9 | "./server": "./src/server.ts" |
| 9 | }, | 10 | }, |
| 10 | "scripts": { | 11 | "scripts": { |
| @@ -0,0 +1,9 @@ | |||
| 1 | export { ExecutorApi, CoreExecutorApi } from "./api"; | ||
| 2 | export { ToolsApi } from "./tools/api"; | ||
| 3 | export { SourcesApi } from "./sources/api"; | ||
| 4 | export { SecretsApi } from "./secrets/api"; | ||
| 5 | export { ConnectionsApi } from "./connections/api"; | ||
| 6 | export { ExecutionsApi } from "./executions/api"; | ||
| 7 | export { ScopeApi } from "./scope/api"; | ||
| 8 | export { OAuthApi } from "./oauth/api"; | ||
| 9 | export { PoliciesApi } from "./policies/api"; | ||
| @@ -1,9 +1,13 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | 3 | ||
| 4 | import { ConnectionId, ConnectionInUseError, ScopeId, Usage } from "@executor-js/sdk"; | 4 | import { |
| 5 | 5 | ConnectionId, | |
| 6 | import { InternalError } from "../observability"; | 6 | ConnectionInUseError, |
| 7 | InternalError, | ||
| 8 | ScopeId, | ||
| 9 | Usage, | ||
| 10 | } from "@executor-js/sdk/shared"; | ||
| 7 | 11 | ||
| 8 | // --------------------------------------------------------------------------- | 12 | // --------------------------------------------------------------------------- |
| 9 | // Params | 13 | // Params |
| @@ -1,7 +1,7 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | 3 | ||
| 4 | import { InternalError } from "../observability"; | 4 | import { InternalError } from "@executor-js/sdk/shared"; |
| 5 | 5 | ||
| 6 | // --------------------------------------------------------------------------- | 6 | // --------------------------------------------------------------------------- |
| 7 | // Schemas | 7 | // Schemas |
| @@ -11,6 +11,7 @@ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/ht · 10 unmodified lines | |||
| 11 | import { Schema } from "effect"; | 11 | import { Schema } from "effect"; |
| 12 | 12 | ||
| 13 | import { | 13 | import { |
| 14 | InternalError, | ||
| 14 | OAuthCompleteError, | 15 | OAuthCompleteError, |
| 15 | OAuthProbeError, | 16 | OAuthProbeError, |
| 16 | OAuthSessionNotFoundError, | 17 | OAuthSessionNotFoundError, |
| @@ -18,9 +19,7 @@ import { · 1 unmodified line | |||
| 18 | OAuthStrategySchema, | 19 | OAuthStrategySchema, |
| 19 | ScopeId, | 20 | ScopeId, |
| 20 | SecretBackedMap, | 21 | SecretBackedMap, |
| 21 | } from "@executor-js/sdk"; | 22 | } from "@executor-js/sdk/shared"; |
| 22 | |||
| 23 | import { InternalError } from "../observability"; | ||
| 24 | 23 | ||
| 25 | const ScopeParams = { scopeId: ScopeId }; | 24 | const ScopeParams = { scopeId: ScopeId }; |
| 26 | // --------------------------------------------------------------------------- | 25 | // --------------------------------------------------------------------------- |
| @@ -1,8 +1,6 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { PolicyId, ScopeId, ToolPolicyActionSchema } from "@executor-js/sdk"; | 3 | import { InternalError, PolicyId, ScopeId, ToolPolicyActionSchema } from "@executor-js/sdk/shared"; |
| 4 | |||
| 5 | import { InternalError } from "../observability"; | ||
| 6 | 4 | ||
| 7 | // --------------------------------------------------------------------------- | 5 | // --------------------------------------------------------------------------- |
| 8 | // Params | 6 | // Params |
| @@ -1,8 +1,6 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { ScopeId } from "@executor-js/sdk"; | 3 | import { InternalError, ScopeId } from "@executor-js/sdk/shared"; |
| 4 | |||
| 5 | import { InternalError } from "../observability"; | ||
| 6 | 4 | ||
| 7 | // --------------------------------------------------------------------------- | 5 | // --------------------------------------------------------------------------- |
| 8 | // Response schemas | 6 | // Response schemas |
| @@ -1,6 +1,7 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { | 3 | import { |
| 4 | InternalError, | ||
| 4 | ScopeId, | 5 | ScopeId, |
| 5 | SecretId, | 6 | SecretId, |
| 6 | SecretInUseError, | 7 | SecretInUseError, |
| @@ -8,9 +9,7 @@ import { · 1 unmodified line | |||
| 8 | SecretOwnedByConnectionError, | 9 | SecretOwnedByConnectionError, |
| 9 | SecretResolutionError, | 10 | SecretResolutionError, |
| 10 | Usage, | 11 | Usage, |
| 11 | } from "@executor-js/sdk"; | 12 | } from "@executor-js/sdk/shared"; |
| 12 | |||
| 13 | import { InternalError } from "../observability"; | ||
| 14 | 13 | ||
| 15 | // --------------------------------------------------------------------------- | 14 | // --------------------------------------------------------------------------- |
| 16 | // Params | 15 | // Params |
| @@ -1,8 +1,11 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { ScopeId, SourceRemovalNotAllowedError, ToolId } from "@executor-js/sdk"; | 3 | import { |
| 4 | 4 | InternalError, | |
| 5 | import { InternalError } from "../observability"; | 5 | ScopeId, |
| 6 | SourceRemovalNotAllowedError, | ||
| 7 | ToolId, | ||
| 8 | } from "@executor-js/sdk/shared"; | ||
| 6 | 9 | ||
| 7 | // --------------------------------------------------------------------------- | 10 | // --------------------------------------------------------------------------- |
| 8 | // Params | 11 | // Params |
| @@ -1,8 +1,6 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { ScopeId, ToolId, ToolNotFoundError } from "@executor-js/sdk"; | 3 | import { InternalError, ScopeId, ToolId, ToolNotFoundError } from "@executor-js/sdk/shared"; |
| 4 | |||
| 5 | import { InternalError } from "../observability"; | ||
| 6 | 4 | ||
| 7 | // --------------------------------------------------------------------------- | 5 | // --------------------------------------------------------------------------- |
| 8 | // Params | 6 | // Params |
| @@ -29,11 +27,14 @@ const ToolMetadataResponse = Schema.Struct({ · 20 unmodified lines | |||
| 29 | 27 | ||
| 30 | const ToolSchemaResponse = Schema.Struct({ | 28 | const ToolSchemaResponse = Schema.Struct({ |
| 31 | id: ToolId, | 29 | id: ToolId, |
| 30 | name: Schema.optional(Schema.String), | ||
| 31 | description: Schema.optional(Schema.String), | ||
| 32 | inputTypeScript: Schema.optional(Schema.String), | 32 | inputTypeScript: Schema.optional(Schema.String), |
| 33 | outputTypeScript: Schema.optional(Schema.String), | 33 | outputTypeScript: Schema.optional(Schema.String), |
| 34 | typeScriptDefinitions: Schema.optional(Schema.Record(Schema.String, Schema.String)), | 34 | typeScriptDefinitions: Schema.optional(Schema.Record(Schema.String, Schema.String)), |
| 35 | inputSchema: Schema.optional(Schema.Unknown), | 35 | inputSchema: Schema.optional(Schema.Unknown), |
| 36 | outputSchema: Schema.optional(Schema.Unknown), | 36 | outputSchema: Schema.optional(Schema.Unknown), |
| 37 | schemaDefinitions: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)), | ||
| 37 | }); | 38 | }); |
| 38 | 39 | ||
| 39 | // --------------------------------------------------------------------------- | 40 | // --------------------------------------------------------------------------- |
| @@ -341,7 +341,7 @@ describe("tool discovery", () => { · 340 unmodified lines | |||
| 341 | expect(described.path).toBe("github.listRepositoryIssues"); | 341 | expect(described.path).toBe("github.listRepositoryIssues"); |
| 342 | expect(described.name).toBe("listRepositoryIssues"); | 342 | expect(described.name).toBe("listRepositoryIssues"); |
| 343 | expect(described.description).toBe("List issues for a repository"); | 343 | expect(described.description).toBe("List issues for a repository"); |
| 344 | expect(described.inputTypeScript).toBe("{ owner: string; repo: string }"); | 344 | expect(described.inputTypeScript).toBe("{ owner: string; repo: string; }"); |
| 345 | expect(described.outputTypeScript).toBeUndefined(); | 345 | expect(described.outputTypeScript).toBeUndefined(); |
| 346 | expect(described.typeScriptDefinitions).toBeUndefined(); | 346 | expect(described.typeScriptDefinitions).toBeUndefined(); |
| 347 | }), | 347 | }), |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | |||
| 18 | "exports": { | 18 | "exports": { |
| 19 | ".": "./src/index.ts", | 19 | ".": "./src/index.ts", |
| 20 | "./core": "./src/index.ts", | 20 | "./core": "./src/index.ts", |
| 21 | "./shared": "./src/shared.ts", | ||
| 21 | "./promise": "./src/promise.ts", | 22 | "./promise": "./src/promise.ts", |
| 22 | "./client": "./src/client.ts", | 23 | "./client": "./src/client.ts", |
| 23 | "./testing": "./src/testing.ts" | 24 | "./testing": "./src/testing.ts" |
| @@ -37,6 +38,12 @@ · 13 unmodified lines | |||
| 37 | "default": "./dist/core.js" | 38 | "default": "./dist/core.js" |
| 38 | } | 39 | } |
| 39 | }, | 40 | }, |
| 41 | "./shared": { | ||
| 42 | "import": { | ||
| 43 | "types": "./dist/shared.d.ts", | ||
| 44 | "default": "./dist/shared.js" | ||
| 45 | } | ||
| 46 | }, | ||
| 40 | "./client": { | 47 | "./client": { |
| 41 | "import": { | 48 | "import": { |
| 42 | "types": "./dist/client.d.ts", | 49 | "types": "./dist/client.d.ts", |
| @@ -99,6 +99,78 @@ const detector = (id: string, confidence: SourceDetectionResult["confidence"]) = · 98 unmodified lines | |||
| 99 | ), | 99 | ), |
| 100 | }))(); | 100 | }))(); |
| 101 | 101 | ||
| 102 | const schemaProbePlugin = definePlugin(() => ({ | ||
| 103 | id: "schemaProbe" as const, | ||
| 104 | storage: () => ({}), | ||
| 105 | extension: (ctx) => ({ | ||
| 106 | registerSource: () => | ||
| 107 | ctx.transaction( | ||
| 108 | Effect.gen(function* () { | ||
| 109 | const scope = String(ctx.scopes[0]!.id); | ||
| 110 | yield* ctx.core.sources.register({ | ||
| 111 | id: "schema-source", | ||
| 112 | scope, | ||
| 113 | kind: "schema", | ||
| 114 | name: "Schema Source", | ||
| 115 | tools: [ | ||
| 116 | { | ||
| 117 | name: "inspect", | ||
| 118 | description: "inspect", | ||
| 119 | inputSchema: { | ||
| 120 | type: "object", | ||
| 121 | properties: { | ||
| 122 | pet: { $ref: "#/$defs/Pet" }, | ||
| 123 | }, | ||
| 124 | required: ["pet"], | ||
| 125 | }, | ||
| 126 | outputSchema: { $ref: "#/$defs/Owner" }, | ||
| 127 | }, | ||
| 128 | ], | ||
| 129 | }); | ||
| 130 | yield* ctx.core.definitions.register({ | ||
| 131 | sourceId: "schema-source", | ||
| 132 | scope, | ||
| 133 | definitions: { | ||
| 134 | Pet: { | ||
| 135 | anyOf: [{ $ref: "#/$defs/Dog" }, { $ref: "#/$defs/Cat" }], | ||
| 136 | }, | ||
| 137 | Dog: { | ||
| 138 | type: "object", | ||
| 139 | properties: { | ||
| 140 | collar: { $ref: "#/$defs/Collar" }, | ||
| 141 | }, | ||
| 142 | }, | ||
| 143 | Cat: { | ||
| 144 | type: "object", | ||
| 145 | properties: { | ||
| 146 | lives: { type: "number" }, | ||
| 147 | }, | ||
| 148 | }, | ||
| 149 | Collar: { | ||
| 150 | type: "object", | ||
| 151 | properties: { | ||
| 152 | id: { type: "string" }, | ||
| 153 | }, | ||
| 154 | }, | ||
| 155 | Owner: { | ||
| 156 | type: "object", | ||
| 157 | properties: { | ||
| 158 | pet: { $ref: "#/$defs/Pet" }, | ||
| 159 | }, | ||
| 160 | }, | ||
| 161 | Unused: { | ||
| 162 | type: "object", | ||
| 163 | properties: { | ||
| 164 | value: { type: "string" }, | ||
| 165 | }, | ||
| 166 | }, | ||
| 167 | }, | ||
| 168 | }); | ||
| 169 | }), | ||
| 170 | ), | ||
| 171 | }), | ||
| 172 | }))(); | ||
| 173 | |||
| 102 | describe("createExecutor", () => { | 174 | describe("createExecutor", () => { |
| 103 | it.effect("rolls back plugin and core writes from ctx.transaction failures", () => | 175 | it.effect("rolls back plugin and core writes from ctx.transaction failures", () => |
| 104 | Effect.gen(function* () { | 176 | Effect.gen(function* () { |
| @@ -204,4 +276,39 @@ describe("createExecutor", () => { · 99 unmodified lines | |||
| 204 | expect(called).toBe(false); | 276 | expect(called).toBe(false); |
| 205 | }), | 277 | }), |
| 206 | ); | 278 | ); |
| 279 | |||
| 280 | it.effect("returns schema roots with shared reachable definitions", () => | ||
| 281 | Effect.gen(function* () { | ||
| 282 | const executor = yield* makeTestExecutor({ plugins: [schemaProbePlugin] as const }); | ||
| 283 | |||
| 284 | yield* executor.schemaProbe.registerSource(); | ||
| 285 | |||
| 286 | const schema = yield* executor.tools.schema("schema-source.inspect"); | ||
| 287 | |||
| 288 | expect(schema?.inputSchema).toEqual({ | ||
| 289 | type: "object", | ||
| 290 | properties: { | ||
| 291 | pet: { $ref: "#/$defs/Pet" }, | ||
| 292 | }, | ||
| 293 | required: ["pet"], | ||
| 294 | }); | ||
| 295 | expect(schema?.outputSchema).toEqual({ $ref: "#/$defs/Owner" }); | ||
| 296 | expect(schema?.schemaDefinitions).toEqual({ | ||
| 297 | Cat: expect.any(Object), | ||
| 298 | Collar: expect.any(Object), | ||
| 299 | Dog: expect.any(Object), | ||
| 300 | Owner: expect.any(Object), | ||
| 301 | Pet: expect.any(Object), | ||
| 302 | }); | ||
| 303 | expect(schema?.schemaDefinitions).not.toHaveProperty("Unused"); | ||
| 304 | expect(schema?.inputTypeScript).toContain("pet: Pet"); | ||
| 305 | expect(schema?.outputTypeScript).toBe("Owner"); | ||
| 306 | expect(schema?.typeScriptDefinitions).toEqual( | ||
| 307 | expect.objectContaining({ | ||
| 308 | Pet: expect.any(String), | ||
| 309 | Owner: expect.any(String), | ||
| 310 | }), | ||
| 311 | ); | ||
| 312 | }), | ||
| 313 | ); | ||
| 207 | }); | 314 | }); |
| @@ -122,7 +122,8 @@ import { · 121 unmodified lines | |||
| 122 | type Tool, | 122 | type Tool, |
| 123 | type ToolListFilter, | 123 | type ToolListFilter, |
| 124 | } from "./types"; | 124 | } from "./types"; |
| 125 | import { buildToolTypeScriptPreview } from "./schema-types"; | 125 | import { buildToolTypeScriptPreview, type ToolTypeScriptPreview } from "./schema-types"; |
| 126 | import { collectReferencedDefinitions } from "./schema-refs"; | ||
| 126 | import { assertExecutorScopePolicyTable, type ExecutorScopePolicyContext } from "./scope-policy"; | 127 | import { assertExecutorScopePolicyTable, type ExecutorScopePolicyContext } from "./scope-policy"; |
| 127 | import { validateHostedOutboundUrl } from "./hosted-http-client"; | 128 | import { validateHostedOutboundUrl } from "./hosted-http-client"; |
| 128 | 129 | ||
| @@ -179,10 +180,9 @@ export type Executor<TPlugins extends readonly AnyPlugin[] = readonly []> = { · 50 unmodified lines | |||
| 179 | 180 | ||
| 180 | readonly tools: { | 181 | readonly tools: { |
| 181 | readonly list: (filter?: ToolListFilter) => Effect.Effect<readonly Tool[], StorageFailure>; | 182 | readonly list: (filter?: ToolListFilter) => Effect.Effect<readonly Tool[], StorageFailure>; |
| 182 | /** Fetch a tool's full schema view: JSON schemas with `$defs` | 183 | /** Fetch a tool's schema view: JSON schemas with `$defs` |
| 183 | * attached from the core `definition` table, plus TypeScript | 184 | * attached from the core `definition` table, plus TypeScript |
| 184 | * preview strings rendered from them. Returns `null` for unknown | 185 | * preview strings. Returns `null` for unknown tool ids. */ |
| 185 | * tool ids. */ | ||
| 186 | readonly schema: (toolId: string) => Effect.Effect<ToolSchema | null, StorageFailure>; | 186 | readonly schema: (toolId: string) => Effect.Effect<ToolSchema | null, StorageFailure>; |
| 187 | /** Every `$defs` entry across every source, grouped by source id. | 187 | /** Every `$defs` entry across every source, grouped by source id. |
| 188 | * Used for bulk schema export and downstream TypeScript rendering. */ | 188 | * Used for bulk schema export and downstream TypeScript rendering. */ |
| @@ -2970,9 +2970,9 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = rea · 2781 unmodified lines | |||
| 2970 | return out; | 2970 | return out; |
| 2971 | }); | 2971 | }); |
| 2972 | 2972 | ||
| 2973 | // Render the ToolSchema view for a tool — wraps the raw JSON schemas | 2973 | // Render the ToolSchema view for a tool. Raw JSON schema roots stay small, |
| 2974 | // with attached `$defs` and runs them through the TypeScript preview | 2974 | // while source-level definitions are returned once for the UI schema |
| 2975 | // helpers so the UI gets ready-to-display code samples. | 2975 | // explorer and passed separately to the TypeScript preview compiler. |
| 2976 | const buildToolSchemaView = (opts: { | 2976 | const buildToolSchemaView = (opts: { |
| 2977 | toolId: string; | 2977 | toolId: string; |
| 2978 | name?: string; | 2978 | name?: string; |
| @@ -2988,29 +2988,26 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = rea · 9 unmodified lines | |||
| 2988 | ) | 2988 | ) |
| 2989 | : {}; | 2989 | : {}; |
| 2990 | 2990 | ||
| 2991 | const attachDefs = (schema: unknown): unknown => { | 2991 | const sourceDefsMap = new Map<string, unknown>(Object.entries(defs)); |
| 2992 | if (schema == null || typeof schema !== "object") return schema; | 2992 | const schemaDefinitions = collectReferencedDefinitions( |
| 2993 | if (Object.keys(defs).length === 0) return schema; | 2993 | [opts.rawInput, opts.rawOutput], |
| 2994 | return { ...(schema as Record<string, unknown>), $defs: defs }; | 2994 | sourceDefsMap, |
| 2995 | }; | 2995 | ); |
| 2996 | 2996 | const schemaDefsMap = new Map<string, unknown>(Object.entries(schemaDefinitions)); | |
| 2997 | const inputSchema = attachDefs(opts.rawInput); | 2997 | const preview: ToolTypeScriptPreview = yield* Effect.promise(() => |
| 2998 | const outputSchema = attachDefs(opts.rawOutput); | ||
| 2999 | |||
| 3000 | const defsMap = new Map<string, unknown>(Object.entries(defs)); | ||
| 3001 | const preview = yield* Effect.sync(() => | ||
| 3002 | buildToolTypeScriptPreview({ | 2998 | buildToolTypeScriptPreview({ |
| 3003 | inputSchema, | 2999 | inputSchema: opts.rawInput, |
| 3004 | outputSchema, | 3000 | outputSchema: opts.rawOutput, |
| 3005 | defs: defsMap, | 3001 | defs: schemaDefsMap, |
| 3006 | }), | 3002 | }), |
| 3007 | ).pipe( | 3003 | ).pipe( |
| 3008 | Effect.withSpan("schema.compile.preview", { | 3004 | Effect.withSpan("schema.compile.preview", { |
| 3009 | attributes: { | 3005 | attributes: { |
| 3010 | "schema.kind": "tool.preview", | 3006 | "schema.kind": "tool.preview", |
| 3011 | "schema.has_input": inputSchema !== undefined, | 3007 | "schema.has_input": opts.rawInput !== undefined, |
| 3012 | "schema.has_output": outputSchema !== undefined, | 3008 | "schema.has_output": opts.rawOutput !== undefined, |
| 3013 | "schema.def_count": defsMap.size, | 3009 | "schema.def_count": schemaDefsMap.size, |
| 3010 | "schema.source_def_count": sourceDefsMap.size, | ||
| 3014 | }, | 3011 | }, |
| 3015 | }), | 3012 | }), |
| 3016 | ); | 3013 | ); |
| @@ -3019,8 +3016,10 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = rea · 2 unmodified lines | |||
| 3019 | id: ToolId.make(opts.toolId), | 3016 | id: ToolId.make(opts.toolId), |
| 3020 | name: opts.name, | 3017 | name: opts.name, |
| 3021 | description: opts.description, | 3018 | description: opts.description, |
| 3022 | inputSchema, | 3019 | inputSchema: opts.rawInput, |
| 3023 | outputSchema, | 3020 | outputSchema: opts.rawOutput, |
| 3021 | schemaDefinitions: | ||
| 3022 | Object.keys(schemaDefinitions).length > 0 ? schemaDefinitions : undefined, | ||
| 3024 | inputTypeScript: preview.inputTypeScript ?? undefined, | 3023 | inputTypeScript: preview.inputTypeScript ?? undefined, |
| 3025 | outputTypeScript: preview.outputTypeScript ?? undefined, | 3024 | outputTypeScript: preview.outputTypeScript ?? undefined, |
| 3026 | typeScriptDefinitions: preview.typeScriptDefinitions ?? undefined, | 3025 | typeScriptDefinitions: preview.typeScriptDefinitions ?? undefined, |
| @@ -100,8 +100,8 @@ export interface PluginCtx<TStore = unknown> { · 99 unmodified lines | |||
| 100 | /** Register shared JSON-schema `$defs` for a source. Tool | 100 | /** Register shared JSON-schema `$defs` for a source. Tool |
| 101 | * input/output schemas registered via `sources.register` can carry | 101 | * input/output schemas registered via `sources.register` can carry |
| 102 | * `$ref: "#/$defs/X"` pointers; `executor.tools.schema(toolId)` | 102 | * `$ref: "#/$defs/X"` pointers; `executor.tools.schema(toolId)` |
| 103 | * attaches matching defs to the returned schema. Call inside the | 103 | * returns matching reachable defs alongside the schema roots. Call |
| 104 | * same `ctx.transaction` as `sources.register` for atomicity. | 104 | * inside the same `ctx.transaction` as `sources.register` for atomicity. |
| 105 | * Replaces any existing defs for the given sourceId. */ | 105 | * Replaces any existing defs for the given sourceId. */ |
| 106 | readonly definitions: { | 106 | readonly definitions: { |
| 107 | readonly register: (input: DefinitionsInput) => Effect.Effect<void, StorageFailure>; | 107 | readonly register: (input: DefinitionsInput) => Effect.Effect<void, StorageFailure>; |
| @@ -0,0 +1,59 @@ | |||
| 1 | import { describe, expect, it } from "@effect/vitest"; | ||
| 2 | |||
| 3 | import { collectReferencedDefinitions } from "./schema-refs"; | ||
| 4 | |||
| 5 | describe("schema-refs", () => { | ||
| 6 | it("collects only transitive definitions reachable from schema roots", () => { | ||
| 7 | const defs = new Map<string, unknown>([ | ||
| 8 | [ | ||
| 9 | "Pet", | ||
| 10 | { | ||
| 11 | anyOf: [{ $ref: "#/$defs/Dog" }, { $ref: "#/$defs/Cat" }], | ||
| 12 | }, | ||
| 13 | ], | ||
| 14 | [ | ||
| 15 | "Dog", | ||
| 16 | { | ||
| 17 | type: "object", | ||
| 18 | properties: { | ||
| 19 | collar: { $ref: "#/$defs/Collar" }, | ||
| 20 | }, | ||
| 21 | }, | ||
| 22 | ], | ||
| 23 | [ | ||
| 24 | "Cat", | ||
| 25 | { | ||
| 26 | type: "object", | ||
| 27 | properties: { | ||
| 28 | lives: { type: "number" }, | ||
| 29 | }, | ||
| 30 | }, | ||
| 31 | ], | ||
| 32 | [ | ||
| 33 | "Collar", | ||
| 34 | { | ||
| 35 | type: "object", | ||
| 36 | properties: { | ||
| 37 | id: { type: "string" }, | ||
| 38 | }, | ||
| 39 | }, | ||
| 40 | ], | ||
| 41 | [ | ||
| 42 | "Unused", | ||
| 43 | { | ||
| 44 | type: "object", | ||
| 45 | properties: { | ||
| 46 | value: { type: "string" }, | ||
| 47 | }, | ||
| 48 | }, | ||
| 49 | ], | ||
| 50 | ]); | ||
| 51 | |||
| 52 | expect(collectReferencedDefinitions([{ $ref: "#/$defs/Pet" }], defs)).toEqual({ | ||
| 53 | Cat: defs.get("Cat"), | ||
| 54 | Collar: defs.get("Collar"), | ||
| 55 | Dog: defs.get("Dog"), | ||
| 56 | Pet: defs.get("Pet"), | ||
| 57 | }); | ||
| 58 | }); | ||
| 59 | }); | ||
| @@ -118,6 +118,23 @@ export const collectRefs = ( · 117 unmodified lines | |||
| 118 | return found; | 118 | return found; |
| 119 | }; | 119 | }; |
| 120 | 120 | ||
| 121 | export const collectReferencedDefinitions = ( | ||
| 122 | roots: readonly unknown[], | ||
| 123 | defs: ReadonlyMap<string, unknown>, | ||
| 124 | ): Record<string, unknown> => { | ||
| 125 | const refs = new Set<string>(); | ||
| 126 | for (const root of roots) { | ||
| 127 | collectRefs(root, defs, refs); | ||
| 128 | } | ||
| 129 | |||
| 130 | const referenced: Record<string, unknown> = {}; | ||
| 131 | for (const name of refs) { | ||
| 132 | const def = defs.get(name); | ||
| 133 | if (def) referenced[name] = def; | ||
| 134 | } | ||
| 135 | return referenced; | ||
| 136 | }; | ||
| 137 | |||
| 121 | /** | 138 | /** |
| 122 | * Re-attach only the referenced shared definitions into a schema, | 139 | * Re-attach only the referenced shared definitions into a schema, |
| 123 | * so the caller gets a self-contained, usable JSON Schema. | 140 | * so the caller gets a self-contained, usable JSON Schema. |
| @@ -127,14 +144,8 @@ export const collectRefs = ( · 3 unmodified lines | |||
| 127 | */ | 144 | */ |
| 128 | export const reattachDefs = (schema: unknown, defs: ReadonlyMap<string, unknown>): unknown => { | 145 | export const reattachDefs = (schema: unknown, defs: ReadonlyMap<string, unknown>): unknown => { |
| 129 | if (schema == null || typeof schema !== "object") return schema; | 146 | if (schema == null || typeof schema !== "object") return schema; |
| 130 | const refs = collectRefs(schema, defs); | 147 | const attached = collectReferencedDefinitions([schema], defs); |
| 131 | if (refs.size === 0) return schema; | 148 | if (Object.keys(attached).length === 0) return schema; |
| 132 | |||
| 133 | const attached: Record<string, unknown> = {}; | ||
| 134 | for (const name of refs) { | ||
| 135 | const def = defs.get(name); | ||
| 136 | if (def) attached[name] = def; | ||
| 137 | } | ||
| 138 | 149 | ||
| 139 | return { ...(schema as Record<string, unknown>), $defs: attached }; | 150 | return { ...(schema as Record<string, unknown>), $defs: attached }; |
| 140 | }; | 151 | }; |
| @@ -7,6 +7,7 @@ import { · 6 unmodified lines | |||
| 7 | schemaToTypeScriptPreview, | 7 | schemaToTypeScriptPreview, |
| 8 | schemaToTypeScriptPreviewWithDefs, | 8 | schemaToTypeScriptPreviewWithDefs, |
| 9 | } from "./schema-types"; | 9 | } from "./schema-types"; |
| 10 | import { compile } from "./vendor/json-schema-to-typescript"; | ||
| 10 | 11 | ||
| 11 | const StripeBalanceTransactionsFixture = Schema.Struct({ | 12 | const StripeBalanceTransactionsFixture = Schema.Struct({ |
| 12 | schema: Schema.Unknown, | 13 | schema: Schema.Unknown, |
| @@ -23,7 +24,7 @@ const stripeBalanceTransactionsFixture = Schema.decodeUnknownSync( · 10 unmodified lines | |||
| 23 | ); | 24 | ); |
| 24 | 25 | ||
| 25 | describe("schema-types", () => { | 26 | describe("schema-types", () => { |
| 26 | it("reuses referenced definitions instead of inlining them", () => { | 27 | it("reuses referenced definitions instead of inlining them", async () => { |
| 27 | const schema = { | 28 | const schema = { |
| 28 | type: "object", | 29 | type: "object", |
| 29 | properties: { | 30 | properties: { |
| @@ -46,15 +47,15 @@ describe("schema-types", () => { · 16 unmodified lines | |||
| 46 | }, | 47 | }, |
| 47 | }; | 48 | }; |
| 48 | 49 | ||
| 49 | expect(schemaToTypeScriptPreview(schema)).toEqual({ | 50 | expect(await schemaToTypeScriptPreview(schema)).toEqual({ |
| 50 | type: "{ homeAddress: Address; workAddress: Address }", | 51 | type: "{ homeAddress: Address; workAddress: Address; }", |
| 51 | definitions: { | 52 | definitions: { |
| 52 | Address: "{ street: string; city: string; zip: string }", | 53 | Address: "{ street: string; city: string; zip: string; }", |
| 53 | }, | 54 | }, |
| 54 | }); | 55 | }); |
| 55 | }); | 56 | }); |
| 56 | 57 | ||
| 57 | it("can render against shared definitions provided externally", () => { | 58 | it("can render against shared definitions provided externally", async () => { |
| 58 | const schema = { | 59 | const schema = { |
| 59 | type: "object", | 60 | type: "object", |
| 60 | properties: { | 61 | properties: { |
| @@ -78,15 +79,15 @@ describe("schema-types", () => { · 17 unmodified lines | |||
| 78 | ], | 79 | ], |
| 79 | ]); | 80 | ]); |
| 80 | 81 | ||
| 81 | expect(schemaToTypeScriptPreviewWithDefs(schema, defs)).toEqual({ | 82 | expect(await schemaToTypeScriptPreviewWithDefs(schema, defs)).toEqual({ |
| 82 | type: "{ headquarters: Address }", | 83 | type: "{ headquarters: Address; }", |
| 83 | definitions: { | 84 | definitions: { |
| 84 | Address: "{ city: string }", | 85 | Address: "{ city: string; }", |
| 85 | }, | 86 | }, |
| 86 | }); | 87 | }); |
| 87 | }); | 88 | }); |
| 88 | 89 | ||
| 89 | it("limits referenced definitions to 3 levels and marks deeper refs as omitted", () => { | 90 | it("renders transitive referenced definitions", async () => { |
| 90 | const defs = new Map<string, unknown>([ | 91 | const defs = new Map<string, unknown>([ |
| 91 | [ | 92 | [ |
| 92 | "LevelOne", | 93 | "LevelOne", |
| @@ -135,7 +136,7 @@ describe("schema-types", () => { · 42 unmodified lines | |||
| 135 | ]); | 136 | ]); |
| 136 | 137 | ||
| 137 | expect( | 138 | expect( |
| 138 | schemaToTypeScriptPreviewWithDefs( | 139 | await schemaToTypeScriptPreviewWithDefs( |
| 139 | { | 140 | { |
| 140 | $ref: "#/$defs/LevelOne", | 141 | $ref: "#/$defs/LevelOne", |
| 141 | }, | 142 | }, |
| @@ -144,14 +145,15 @@ describe("schema-types", () => { · 2 unmodified lines | |||
| 144 | ).toEqual({ | 145 | ).toEqual({ |
| 145 | type: "LevelOne", | 146 | type: "LevelOne", |
| 146 | definitions: { | 147 | definitions: { |
| 147 | LevelOne: "{ next: LevelTwo }", | 148 | LevelFour: "{ value: string; }", |
| 148 | LevelTwo: "{ next: LevelThree }", | 149 | LevelOne: "{ next: LevelTwo; }", |
| 149 | LevelThree: "{ next: unknown /* LevelFour omitted */ }", | 150 | LevelThree: "{ next: LevelFour; }", |
| 151 | LevelTwo: "{ next: LevelThree; }", | ||
| 150 | }, | 152 | }, |
| 151 | }); | 153 | }); |
| 152 | }); | 154 | }); |
| 153 | 155 | ||
| 154 | it("keeps ordinary unions expanded when they stay under the composite threshold", () => { | 156 | it("keeps ordinary unions expanded", async () => { |
| 155 | const defs = new Map<string, unknown>([ | 157 | const defs = new Map<string, unknown>([ |
| 156 | [ | 158 | [ |
| 157 | "Pet", | 159 | "Pet", |
| @@ -195,7 +197,7 @@ describe("schema-types", () => { · 37 unmodified lines | |||
| 195 | ]); | 197 | ]); |
| 196 | 198 | ||
| 197 | expect( | 199 | expect( |
| 198 | schemaToTypeScriptPreviewWithDefs( | 200 | await schemaToTypeScriptPreviewWithDefs( |
| 199 | { | 201 | { |
| 200 | $ref: "#/$defs/Pet", | 202 | $ref: "#/$defs/Pet", |
| 201 | }, | 203 | }, |
| @@ -204,30 +206,134 @@ describe("schema-types", () => { · 2 unmodified lines | |||
| 204 | ).toEqual({ | 206 | ).toEqual({ |
| 205 | type: "Pet", | 207 | type: "Pet", |
| 206 | definitions: { | 208 | definitions: { |
| 207 | Cat: "{ meow: boolean }", | 209 | Cat: "{ meow: boolean; }", |
| 208 | Dog: "{ bark: boolean }", | 210 | Dog: "{ bark: boolean; }", |
| 209 | Lizard: "{ scales: boolean }", | 211 | Lizard: "{ scales: boolean; }", |
| 210 | Pet: "Dog | Cat | Lizard", | 212 | Pet: "Dog | Cat | Lizard", |
| 211 | }, | 213 | }, |
| 212 | }); | 214 | }); |
| 213 | }); | 215 | }); |
| 214 | 216 | ||
| 215 | it("summarizes large unions from real Stripe fixtures without pulling in the whole schema graph", () => { | 217 | it("renders large unions from real Stripe fixtures", async () => { |
| 216 | const defs = new Map(Object.entries(stripeBalanceTransactionsFixture.defs)); | 218 | const defs = new Map(Object.entries(stripeBalanceTransactionsFixture.defs)); |
| 217 | 219 | ||
| 218 | expect( | 220 | const preview = await schemaToTypeScriptPreviewWithDefs( |
| 219 | schemaToTypeScriptPreviewWithDefs(stripeBalanceTransactionsFixture.schema, defs), | 221 | stripeBalanceTransactionsFixture.schema, |
| 220 | ).toEqual({ | 222 | defs, |
| 221 | type: "balance_transaction", | 223 | ); |
| 224 | |||
| 225 | expect(preview.type).toBe("BalanceTransaction"); | ||
| 226 | expect(preview.definitions.BalanceTransaction).toContain("fee_details: Fee[]"); | ||
| 227 | expect(preview.definitions.BalanceTransaction).toContain("source: string | Polymorphic | null"); | ||
| 228 | expect(preview.definitions.Fee).toBe( | ||
| 229 | "{ amount: number; application: string | null; currency: string; description: string | null; type: string; }", | ||
| 230 | ); | ||
| 231 | expect(preview.definitions.Polymorphic).toContain("Charge"); | ||
| 232 | expect(preview.definitions.Polymorphic).toContain("Refund"); | ||
| 233 | expect(preview.definitions.Polymorphic).toContain("Payout"); | ||
| 234 | expect(preview.definitions.Polymorphic).not.toContain("unknown"); | ||
| 235 | expect(Object.keys(preview.definitions).length).toBeGreaterThan(100); | ||
| 236 | }); | ||
| 237 | |||
| 238 | it("sanitizes dashed definition names and quotes dashed property keys", async () => { | ||
| 239 | const preview = await schemaToTypeScriptPreview({ | ||
| 240 | type: "object", | ||
| 241 | properties: { | ||
| 242 | "dash-prop": { type: ["string", "null"] }, | ||
| 243 | child: { $ref: "#/$defs/foo-bar" }, | ||
| 244 | }, | ||
| 245 | required: ["dash-prop", "child"], | ||
| 246 | additionalProperties: false, | ||
| 247 | $defs: { | ||
| 248 | "foo-bar": { | ||
| 249 | type: "object", | ||
| 250 | properties: { | ||
| 251 | id: { type: "string" }, | ||
| 252 | }, | ||
| 253 | required: ["id"], | ||
| 254 | additionalProperties: false, | ||
| 255 | }, | ||
| 256 | }, | ||
| 257 | }); | ||
| 258 | |||
| 259 | expect(preview).toEqual({ | ||
| 260 | type: '{ "dash-prop": string | null; child: FooBar; }', | ||
| 261 | definitions: { | ||
| 262 | FooBar: "{ id: string; }", | ||
| 263 | }, | ||
| 264 | }); | ||
| 265 | expect(preview.definitions).not.toHaveProperty("foo-bar"); | ||
| 266 | }); | ||
| 267 | |||
| 268 | it("normalizes OpenAPI nullable schemas before compiling", async () => { | ||
| 269 | const preview = await schemaToTypeScriptPreview({ | ||
| 270 | type: "object", | ||
| 271 | properties: { | ||
| 272 | maybeObject: { | ||
| 273 | type: "object", | ||
| 274 | nullable: true, | ||
| 275 | properties: { | ||
| 276 | id: { type: "string" }, | ||
| 277 | }, | ||
| 278 | required: ["id"], | ||
| 279 | additionalProperties: false, | ||
| 280 | }, | ||
| 281 | maybeEnum: { | ||
| 282 | enum: ["created", "updated"], | ||
| 283 | nullable: true, | ||
| 284 | }, | ||
| 285 | maybeConst: { | ||
| 286 | const: "ok", | ||
| 287 | nullable: true, | ||
| 288 | }, | ||
| 289 | }, | ||
| 290 | required: ["maybeObject", "maybeEnum", "maybeConst"], | ||
| 291 | additionalProperties: false, | ||
| 292 | }); | ||
| 293 | |||
| 294 | expect(preview.type).toBe( | ||
| 295 | '{ maybeObject: { id: string; } | null; maybeEnum: "created" | "updated" | null; maybeConst: "ok" | null; }', | ||
| 296 | ); | ||
| 297 | }); | ||
| 298 | |||
| 299 | it("handles recursive refs through the compiler wrapper", async () => { | ||
| 300 | const preview = await schemaToTypeScriptPreview({ | ||
| 301 | $ref: "#/$defs/IssueFilter", | ||
| 302 | $defs: { | ||
| 303 | IssueFilter: { | ||
| 304 | type: "object", | ||
| 305 | properties: { | ||
| 306 | and: { | ||
| 307 | type: "array", | ||
| 308 | items: { $ref: "#/$defs/IssueFilter" }, | ||
| 309 | }, | ||
| 310 | }, | ||
| 311 | additionalProperties: false, | ||
| 312 | }, | ||
| 313 | }, | ||
| 314 | }); | ||
| 315 | |||
| 316 | expect(preview).toEqual({ | ||
| 317 | type: "IssueFilter", | ||
| 222 | definitions: { | 318 | definitions: { |
| 223 | balance_transaction: expect.stringContaining("fee_details: fee[]"), | 319 | IssueFilter: "{ and?: IssueFilter[]; }", |
| 224 | balance_transaction_source: "unknown /* 16-way anyOf omitted */", | ||
| 225 | fee: "{ amount: number; application: string | null; currency: string; description: string | null; type: string }", | ||
| 226 | }, | 320 | }, |
| 227 | }); | 321 | }); |
| 228 | }); | 322 | }); |
| 229 | 323 | ||
| 230 | it("merges input and output TypeScript definitions", () => { | 324 | it("rejects external refs instead of loading them", () => { |
| 325 | expect(() => | ||
| 326 | compile( | ||
| 327 | { | ||
| 328 | $ref: "file:///tmp/executor-schema-ref-should-not-load.json", | ||
| 329 | }, | ||
| 330 | "ExternalRef", | ||
| 331 | { bannerComment: "", format: false }, | ||
| 332 | ), | ||
| 333 | ).toThrow(/Only same-document JSON Pointer refs are supported/); | ||
| 334 | }); | ||
| 335 | |||
| 336 | it("merges input and output TypeScript definitions", async () => { | ||
| 231 | const defs = new Map<string, unknown>([ | 337 | const defs = new Map<string, unknown>([ |
| 232 | [ | 338 | [ |
| 233 | "Address", | 339 | "Address", |
| @@ -255,7 +361,7 @@ describe("schema-types", () => { · 21 unmodified lines | |||
| 255 | ]); | 361 | ]); |
| 256 | 362 | ||
| 257 | expect( | 363 | expect( |
| 258 | buildToolTypeScriptPreview({ | 364 | await buildToolTypeScriptPreview({ |
| 259 | inputSchema: { | 365 | inputSchema: { |
| 260 | type: "object", | 366 | type: "object", |
| 261 | properties: { | 367 | properties: { |
| @@ -270,12 +376,33 @@ describe("schema-types", () => { · 8 unmodified lines | |||
| 270 | defs, | 376 | defs, |
| 271 | }), | 377 | }), |
| 272 | ).toEqual({ | 378 | ).toEqual({ |
| 273 | inputTypeScript: "{ address: Address }", | 379 | inputTypeScript: "{ address: Address; }", |
| 274 | outputTypeScript: "Contact", | 380 | outputTypeScript: "Contact", |
| 275 | typeScriptDefinitions: { | 381 | typeScriptDefinitions: { |
| 276 | Address: "{ city: string }", | 382 | Address: "{ city: string; }", |
| 277 | Contact: "{ id: string; address: Address }", | 383 | Contact: "{ id: string; address: Address; }", |
| 278 | }, | 384 | }, |
| 279 | }); | 385 | }); |
| 280 | }); | 386 | }); |
| 387 | |||
| 388 | it("renders unconstrained schemas as unknown", async () => { | ||
| 389 | await expect( | ||
| 390 | buildToolTypeScriptPreview({ | ||
| 391 | inputSchema: { | ||
| 392 | type: "object", | ||
| 393 | properties: { | ||
| 394 | account_id: { type: "string" }, | ||
| 395 | body: {}, | ||
| 396 | }, | ||
| 397 | required: ["account_id", "body"], | ||
| 398 | additionalProperties: false, | ||
| 399 | }, | ||
| 400 | outputSchema: {}, | ||
| 401 | defs: new Map(), | ||
| 402 | }), | ||
| 403 | ).resolves.toEqual({ | ||
| 404 | inputTypeScript: "{ account_id: string; body: unknown; }", | ||
| 405 | outputTypeScript: "unknown", | ||
| 406 | }); | ||
| 407 | }); | ||
| 281 | }); | 408 | }); |
| @@ -1,13 +1,28 @@ | |||
| 1 | import { Match, Option } from "effect"; | 1 | import { hoistDefinitions, normalizeRefs } from "./schema-refs"; |
| 2 | import { compile } from "./vendor/json-schema-to-typescript"; | ||
| 2 | 3 | ||
| 3 | type JsonSchemaRecord = Record<string, unknown>; | 4 | type JsonSchemaRecord = Record<string, unknown>; |
| 5 | type CompilerJsonSchema = JsonSchemaRecord | boolean; | ||
| 6 | type CompilerFormatOptions = { | ||
| 7 | [key: string]: unknown; | ||
| 8 | printWidth?: number; | ||
| 9 | semi?: boolean; | ||
| 10 | singleQuote?: boolean; | ||
| 11 | trailingComma?: "none" | "es5" | "all"; | ||
| 12 | }; | ||
| 13 | type SchemaCompilerOptions = { | ||
| 14 | [key: string]: unknown; | ||
| 15 | additionalProperties?: boolean; | ||
| 16 | bannerComment?: string; | ||
| 17 | enableConstEnums?: boolean; | ||
| 18 | format?: boolean; | ||
| 19 | style?: CompilerFormatOptions; | ||
| 20 | unknownAny?: boolean; | ||
| 21 | unreachableDefinitions?: boolean; | ||
| 22 | }; | ||
| 4 | 23 | ||
| 5 | export type TypeScriptRenderOptions = { | 24 | export type TypeScriptRenderOptions = { |
| 6 | maxLength?: number; | 25 | compilerOptions?: Partial<SchemaCompilerOptions>; |
| 7 | maxDepth?: number; | ||
| 8 | maxProperties?: number; | ||
| 9 | maxRefDepth?: number; | ||
| 10 | maxCompositeMembers?: number; | ||
| 11 | }; | 26 | }; |
| 12 | 27 | ||
| 13 | export type TypeScriptSchemaPreview = { | 28 | export type TypeScriptSchemaPreview = { |
| @@ -15,380 +30,782 @@ export type TypeScriptSchemaPreview = { · 1 unmodified line | |||
| 15 | readonly definitions: Record<string, string>; | 30 | readonly definitions: Record<string, string>; |
| 16 | }; | 31 | }; |
| 17 | 32 | ||
| 18 | const VALID_IDENTIFIER_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]*$/; | 33 | const ROOT_WRAPPER_NAME = "SchemaPreview"; |
| 19 | const REF_PATTERN = /^#\/(?:\$defs|definitions)\/(.+)$/; | 34 | const ROOT_PROPERTY_NAME = "__root"; |
| 35 | const TOOL_INPUT_PROPERTY_NAME = "__input"; | ||
| 36 | const TOOL_OUTPUT_PROPERTY_NAME = "__output"; | ||
| 37 | |||
| 38 | const DEFAULT_COMPILER_OPTIONS = { | ||
| 39 | additionalProperties: false, | ||
| 40 | bannerComment: "", | ||
| 41 | enableConstEnums: false, | ||
| 42 | format: false, | ||
| 43 | unknownAny: true, | ||
| 44 | unreachableDefinitions: false, | ||
| 45 | style: { | ||
| 46 | printWidth: 120, | ||
| 47 | semi: true, | ||
| 48 | singleQuote: false, | ||
| 49 | trailingComma: "none", | ||
| 50 | }, | ||
| 51 | } satisfies Partial<SchemaCompilerOptions>; | ||
| 52 | |||
| 53 | const DEFINITION_REF_PATTERN = /^#\/definitions\/(.+)$/; | ||
| 54 | const IDENTIFIER_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]*$/; | ||
| 20 | 55 | ||
| 21 | const asRecord = (value: unknown): JsonSchemaRecord => | 56 | const asRecord = (value: unknown): JsonSchemaRecord => |
| 22 | typeof value === "object" && value !== null && !Array.isArray(value) | 57 | typeof value === "object" && value !== null && !Array.isArray(value) |
| 23 | ? (value as JsonSchemaRecord) | 58 | ? (value as JsonSchemaRecord) |
| 24 | : {}; | 59 | : {}; |
| 25 | 60 | ||
| 26 | const asStringArray = (value: unknown): Array<string> => | 61 | const asCompilerSchema = (value: unknown): CompilerJsonSchema => { |
| 27 | Array.isArray(value) ? value.filter((item): item is string => typeof item === "string") : []; | 62 | if (typeof value === "boolean") { |
| 63 | return value; | ||
| 64 | } | ||
| 28 | 65 | ||
| 29 | const truncate = (value: string, maxLength: number): string => | 66 | if (value !== null && typeof value === "object") { |
| 30 | value.length <= maxLength ? value : `${value.slice(0, Math.max(0, maxLength - 4))} ...`; | 67 | return value as JsonSchemaRecord; |
| 68 | } | ||
| 31 | 69 | ||
| 32 | const formatPropertyKey = (value: string): string => | 70 | return {}; |
| 33 | VALID_IDENTIFIER_PATTERN.test(value) ? value : JSON.stringify(value); | 71 | }; |
| 34 | 72 | ||
| 35 | const refNameFromPointer = (ref: string): string | undefined => ref.match(REF_PATTERN)?.[1]; | 73 | const isNullSchema = (value: unknown): boolean => { |
| 74 | if (value === false) { | ||
| 75 | return false; | ||
| 76 | } | ||
| 36 | 77 | ||
| 37 | const refFallbackLabel = (ref: string): string => | 78 | const schema = asRecord(value); |
| 38 | refNameFromPointer(ref) ?? ref.split("/").at(-1) ?? ref; | 79 | return schema.type === "null" || schema.const === null; |
| 80 | }; | ||
| 39 | 81 | ||
| 40 | const summarizeLargeComposite = ( | 82 | const appendNullSchema = (schemas: ReadonlyArray<unknown>): Array<unknown> => |
| 41 | schema: JsonSchemaRecord, | 83 | schemas.some(isNullSchema) ? [...schemas] : [...schemas, { type: "null" }]; |
| 42 | maxCompositeMembers: number, | 84 | |
| 43 | ): { kind: "oneOf" | "anyOf"; count: number } | null => { | 85 | const schemaAlreadyAllowsNull = (schema: JsonSchemaRecord): boolean => { |
| 44 | for (const kind of ["oneOf", "anyOf"] as const) { | 86 | if (schema.type === "null" || schema.const === null) { |
| 45 | const items = schema[kind]; | 87 | return true; |
| 46 | if (Array.isArray(items) && items.length > maxCompositeMembers) { | 88 | } |
| 47 | return { kind, count: items.length }; | 89 | |
| 48 | } | 90 | if (Array.isArray(schema.type) && schema.type.includes("null")) { |
| 91 | return true; | ||
| 92 | } | ||
| 93 | |||
| 94 | if (Array.isArray(schema.enum) && schema.enum.includes(null)) { | ||
| 95 | return true; | ||
| 49 | } | 96 | } |
| 50 | 97 | ||
| 51 | return null; | 98 | const compositeSchemas = [ |
| 99 | ...(Array.isArray(schema.anyOf) ? schema.anyOf : []), | ||
| 100 | ...(Array.isArray(schema.oneOf) ? schema.oneOf : []), | ||
| 101 | ]; | ||
| 102 | return compositeSchemas.some(isNullSchema); | ||
| 52 | }; | 103 | }; |
| 53 | 104 | ||
| 54 | const primitiveTypeName = (value: string): string => | 105 | const normalizeNullable = (schema: JsonSchemaRecord): JsonSchemaRecord => { |
| 55 | Match.value(value).pipe( | 106 | if (schema.nullable !== true) { |
| 56 | Match.whenOr("integer", "number", () => "number"), | 107 | return schema; |
| 57 | Match.whenOr("string", "boolean", "null", (v) => v), | 108 | } |
| 58 | Match.when("array", () => "unknown[]"), | ||
| 59 | Match.when("object", () => "Record<string, unknown>"), | ||
| 60 | Match.option, | ||
| 61 | Option.getOrElse(() => "unknown"), | ||
| 62 | ); | ||
| 63 | 109 | ||
| 64 | const renderComposite = (input: { | 110 | const { nullable: _nullable, ...base } = schema; |
| 65 | key: "oneOf" | "anyOf" | "allOf"; | 111 | if (schemaAlreadyAllowsNull(base)) { |
| 66 | schema: JsonSchemaRecord; | 112 | return base; |
| 67 | render: (value: unknown, depthRemaining: number) => string; | ||
| 68 | depthRemaining: number; | ||
| 69 | }): string | null => { | ||
| 70 | const rawItems = input.schema[input.key]; | ||
| 71 | const items: JsonSchemaRecord[] = Array.isArray(rawItems) | ||
| 72 | ? rawItems.map((item: unknown) => asRecord(item)) | ||
| 73 | : []; | ||
| 74 | if (items.length === 0) { | ||
| 75 | return null; | ||
| 76 | } | 113 | } |
| 77 | 114 | ||
| 78 | const labels = items | 115 | if ("const" in base) { |
| 79 | .map((item: JsonSchemaRecord) => input.render(item, input.depthRemaining - 1)) | 116 | const { const: constValue, type: _type, ...rest } = base; |
| 80 | .filter((label: string) => label.length > 0); | 117 | return { ...rest, enum: [constValue, null] }; |
| 118 | } | ||
| 81 | 119 | ||
| 82 | if (labels.length === 0) { | 120 | if (Array.isArray(base.enum)) { |
| 83 | return null; | 121 | return { ...base, enum: [...base.enum, null] }; |
| 122 | } | ||
| 123 | |||
| 124 | if (typeof base.type === "string") { | ||
| 125 | return { ...base, type: [base.type, "null"] }; | ||
| 126 | } | ||
| 127 | |||
| 128 | if (Array.isArray(base.type)) { | ||
| 129 | const types = base.type.filter((value): value is string => typeof value === "string"); | ||
| 130 | return types.length > 0 | ||
| 131 | ? { ...base, type: [...types, "null"] } | ||
| 132 | : { anyOf: [base, { type: "null" }] }; | ||
| 133 | } | ||
| 134 | |||
| 135 | if (Array.isArray(base.oneOf)) { | ||
| 136 | return { ...base, oneOf: appendNullSchema(base.oneOf) }; | ||
| 137 | } | ||
| 138 | |||
| 139 | if (Array.isArray(base.anyOf)) { | ||
| 140 | return { ...base, anyOf: appendNullSchema(base.anyOf) }; | ||
| 84 | } | 141 | } |
| 85 | 142 | ||
| 86 | return labels.join(input.key === "allOf" ? " & " : " | "); | 143 | return { anyOf: [base, { type: "null" }] }; |
| 87 | }; | 144 | }; |
| 88 | 145 | ||
| 89 | const localDefinitionsFromSchema = (schema: unknown): Map<string, unknown> => { | 146 | const normalizeSchema = (node: unknown): unknown => { |
| 90 | const root = asRecord(schema); | 147 | if (node === null || typeof node !== "object") { |
| 91 | const defs = new Map<string, unknown>(); | 148 | return node; |
| 149 | } | ||
| 92 | 150 | ||
| 93 | for (const [key, value] of Object.entries(asRecord(root.$defs))) { | 151 | if (Array.isArray(node)) { |
| 94 | defs.set(key, value); | 152 | return node.map((item) => normalizeSchema(item)); |
| 95 | } | 153 | } |
| 96 | 154 | ||
| 97 | for (const [key, value] of Object.entries(asRecord(root.definitions))) { | 155 | const schema = node as JsonSchemaRecord; |
| 98 | defs.set(key, value); | 156 | const normalized: JsonSchemaRecord = {}; |
| 157 | |||
| 158 | for (const [key, value] of Object.entries(schema)) { | ||
| 159 | if (key === "$ref" && typeof value === "string") { | ||
| 160 | const definitionName = value.match(DEFINITION_REF_PATTERN)?.[1]; | ||
| 161 | normalized[key] = definitionName ? `#/$defs/${definitionName}` : value; | ||
| 162 | continue; | ||
| 163 | } | ||
| 164 | |||
| 165 | normalized[key] = normalizeSchema(value); | ||
| 99 | } | 166 | } |
| 100 | 167 | ||
| 101 | return defs; | 168 | return normalizeNullable(normalized); |
| 102 | }; | 169 | }; |
| 103 | 170 | ||
| 104 | export const schemaToTypeScriptPreview = ( | 171 | const mergeDefinitions = ( |
| 105 | schema: unknown, | 172 | externalDefs: ReadonlyMap<string, unknown>, |
| 106 | options: TypeScriptRenderOptions = {}, | 173 | localDefs: Record<string, unknown>, |
| 107 | ): TypeScriptSchemaPreview => { | 174 | ): Record<string, unknown> => { |
| 108 | const localDefs = localDefinitionsFromSchema(schema); | 175 | const merged: Record<string, unknown> = {}; |
| 109 | return schemaToTypeScriptPreviewWithDefs(schema, localDefs, options); | 176 | |
| 177 | for (const [name, schema] of externalDefs) { | ||
| 178 | merged[name] = normalizeSchema(normalizeRefs(asCompilerSchema(schema))); | ||
| 179 | } | ||
| 180 | |||
| 181 | for (const [name, schema] of Object.entries(localDefs)) { | ||
| 182 | merged[name] = normalizeSchema(normalizeRefs(asCompilerSchema(schema))); | ||
| 183 | } | ||
| 184 | |||
| 185 | return merged; | ||
| 110 | }; | 186 | }; |
| 111 | 187 | ||
| 112 | export const schemaToTypeScriptPreviewWithDefs = ( | 188 | const buildWrappedObjectSchema = ( |
| 189 | properties: ReadonlyArray<readonly [string, unknown]>, | ||
| 190 | defs: ReadonlyMap<string, unknown>, | ||
| 191 | ): JsonSchemaRecord => { | ||
| 192 | const normalizedProperties: Record<string, unknown> = {}; | ||
| 193 | const localDefs: Record<string, unknown> = {}; | ||
| 194 | |||
| 195 | for (const [name, schema] of properties) { | ||
| 196 | const normalizedSchema = normalizeSchema(normalizeRefs(asCompilerSchema(schema))); | ||
| 197 | const { stripped, defs: schemaDefs } = hoistDefinitions(normalizedSchema); | ||
| 198 | normalizedProperties[name] = asCompilerSchema(stripped); | ||
| 199 | Object.assign(localDefs, schemaDefs); | ||
| 200 | } | ||
| 201 | |||
| 202 | const mergedDefs = mergeDefinitions(defs, localDefs); | ||
| 203 | const wrappedSchema: JsonSchemaRecord = { | ||
| 204 | type: "object", | ||
| 205 | properties: normalizedProperties, | ||
| 206 | required: properties.map(([name]) => name), | ||
| 207 | additionalProperties: false, | ||
| 208 | }; | ||
| 209 | |||
| 210 | if (Object.keys(mergedDefs).length > 0) { | ||
| 211 | wrappedSchema.$defs = mergedDefs; | ||
| 212 | } | ||
| 213 | |||
| 214 | return wrappedSchema; | ||
| 215 | }; | ||
| 216 | |||
| 217 | const buildWrappedSchema = ( | ||
| 113 | schema: unknown, | 218 | schema: unknown, |
| 114 | defs: ReadonlyMap<string, unknown>, | 219 | defs: ReadonlyMap<string, unknown>, |
| 115 | options: TypeScriptRenderOptions = {}, | 220 | ): JsonSchemaRecord => buildWrappedObjectSchema([[ROOT_PROPERTY_NAME, schema]], defs); |
| 116 | ): TypeScriptSchemaPreview => { | 221 | |
| 117 | const maxLength = options.maxLength ?? 400; | 222 | const compilerOptionsFrom = (options: TypeScriptRenderOptions): Partial<SchemaCompilerOptions> => ({ |
| 118 | const maxDepth = options.maxDepth ?? 6; | 223 | ...DEFAULT_COMPILER_OPTIONS, |
| 119 | const maxProperties = options.maxProperties ?? 12; | 224 | ...options.compilerOptions, |
| 120 | const maxRefDepth = options.maxRefDepth ?? 3; | 225 | bannerComment: "", |
| 121 | const maxCompositeMembers = options.maxCompositeMembers ?? 8; | 226 | format: false, |
| 122 | 227 | style: { | |
| 123 | const render = (input: { | 228 | ...DEFAULT_COMPILER_OPTIONS.style, |
| 124 | currentInput: unknown; | 229 | ...options.compilerOptions?.style, |
| 125 | depthRemaining: number; | 230 | }, |
| 126 | refDepthRemaining: number; | 231 | }); |
| 127 | }): string => { | 232 | |
| 128 | const current = asRecord(input.currentInput); | 233 | type GeneratedDeclaration = { |
| 129 | 234 | readonly kind: "interface" | "type"; | |
| 130 | if (input.depthRemaining <= 0) { | 235 | readonly name: string; |
| 131 | if (typeof current.title === "string" && current.title.length > 0) { | 236 | readonly body: string; |
| 132 | return current.title; | 237 | }; |
| 133 | } | ||
| 134 | 238 | ||
| 135 | if (current.type === "array") { | 239 | type ScanState = { |
| 136 | return "unknown[]"; | 240 | quote: '"' | "'" | "`" | null; |
| 137 | } | 241 | escaping: boolean; |
| 242 | lineComment: boolean; | ||
| 243 | blockComment: boolean; | ||
| 244 | }; | ||
| 138 | 245 | ||
| 139 | if (current.type === "object" || current.properties) { | 246 | const emptyScanState = (): ScanState => ({ |
| 140 | return "Record<string, unknown>"; | 247 | quote: null, |
| 141 | } | 248 | escaping: false, |
| 249 | lineComment: false, | ||
| 250 | blockComment: false, | ||
| 251 | }); | ||
| 252 | |||
| 253 | const stepScanState = (state: ScanState, current: string, next: string): { skipNext: boolean } => { | ||
| 254 | if (state.lineComment) { | ||
| 255 | if (current === "\n" || current === "\r") { | ||
| 256 | state.lineComment = false; | ||
| 257 | } | ||
| 258 | return { skipNext: false }; | ||
| 259 | } | ||
| 142 | 260 | ||
| 143 | return "unknown"; | 261 | if (state.blockComment) { |
| 262 | if (current === "*" && next === "/") { | ||
| 263 | state.blockComment = false; | ||
| 264 | return { skipNext: true }; | ||
| 144 | } | 265 | } |
| 266 | return { skipNext: false }; | ||
| 267 | } | ||
| 145 | 268 | ||
| 146 | if (typeof current.$ref === "string") { | 269 | if (state.quote) { |
| 147 | const refLabel = refFallbackLabel(current.$ref); | 270 | if (state.escaping) { |
| 148 | return input.refDepthRemaining > 0 ? refLabel : `unknown /* ${refLabel} omitted */`; | 271 | state.escaping = false; |
| 272 | return { skipNext: false }; | ||
| 149 | } | 273 | } |
| 150 | 274 | ||
| 151 | if ("const" in current) { | 275 | if (current === "\\") { |
| 152 | return JSON.stringify(current.const); | 276 | state.escaping = true; |
| 277 | return { skipNext: false }; | ||
| 153 | } | 278 | } |
| 154 | 279 | ||
| 155 | const enumValues = Array.isArray(current.enum) ? current.enum : []; | 280 | if (current === state.quote) { |
| 156 | if (enumValues.length > 0) { | 281 | state.quote = null; |
| 157 | return truncate(enumValues.map((value) => JSON.stringify(value)).join(" | "), maxLength); | 282 | } |
| 283 | return { skipNext: false }; | ||
| 284 | } | ||
| 285 | |||
| 286 | if (current === "/" && next === "/") { | ||
| 287 | state.lineComment = true; | ||
| 288 | return { skipNext: true }; | ||
| 289 | } | ||
| 290 | |||
| 291 | if (current === "/" && next === "*") { | ||
| 292 | state.blockComment = true; | ||
| 293 | return { skipNext: true }; | ||
| 294 | } | ||
| 295 | |||
| 296 | if (current === '"' || current === "'" || current === "`") { | ||
| 297 | state.quote = current; | ||
| 298 | } | ||
| 299 | |||
| 300 | return { skipNext: false }; | ||
| 301 | }; | ||
| 302 | |||
| 303 | const findMatchingBrace = (source: string, start: number): number => { | ||
| 304 | const state = emptyScanState(); | ||
| 305 | let depth = 0; | ||
| 306 | |||
| 307 | for (let index = start; index < source.length; index += 1) { | ||
| 308 | const current = source[index] ?? ""; | ||
| 309 | const next = source[index + 1] ?? ""; | ||
| 310 | const wasCode = !state.quote && !state.lineComment && !state.blockComment; | ||
| 311 | const { skipNext } = stepScanState(state, current, next); | ||
| 312 | |||
| 313 | if (wasCode && !state.quote && !state.lineComment && !state.blockComment) { | ||
| 314 | if (current === "{") { | ||
| 315 | depth += 1; | ||
| 316 | } else if (current === "}") { | ||
| 317 | depth -= 1; | ||
| 318 | if (depth === 0) { | ||
| 319 | return index; | ||
| 320 | } | ||
| 321 | } | ||
| 158 | } | 322 | } |
| 159 | 323 | ||
| 160 | const largeComposite = summarizeLargeComposite(current, maxCompositeMembers); | 324 | if (skipNext) { |
| 161 | if (largeComposite) { | 325 | index += 1; |
| 162 | return `unknown /* ${largeComposite.count}-way ${largeComposite.kind} omitted */`; | ||
| 163 | } | 326 | } |
| 327 | } | ||
| 164 | 328 | ||
| 165 | const renderNested = (value: unknown): string => | 329 | return -1; |
| 166 | render({ | 330 | }; |
| 167 | currentInput: value, | ||
| 168 | depthRemaining: input.depthRemaining - 1, | ||
| 169 | refDepthRemaining: input.refDepthRemaining, | ||
| 170 | }); | ||
| 171 | 331 | ||
| 172 | const composite = | 332 | const findMatchingParen = (source: string, start: number): number => { |
| 173 | renderComposite({ | 333 | const state = emptyScanState(); |
| 174 | key: "oneOf", | 334 | let depth = 0; |
| 175 | schema: current, | 335 | |
| 176 | render: (value) => renderNested(value), | 336 | for (let index = start; index < source.length; index += 1) { |
| 177 | depthRemaining: input.depthRemaining, | 337 | const current = source[index] ?? ""; |
| 178 | }) ?? | 338 | const next = source[index + 1] ?? ""; |
| 179 | renderComposite({ | 339 | const wasCode = !state.quote && !state.lineComment && !state.blockComment; |
| 180 | key: "anyOf", | 340 | const { skipNext } = stepScanState(state, current, next); |
| 181 | schema: current, | 341 | |
| 182 | render: (value) => renderNested(value), | 342 | if (wasCode && !state.quote && !state.lineComment && !state.blockComment) { |
| 183 | depthRemaining: input.depthRemaining, | 343 | if (current === "(") { |
| 184 | }) ?? | 344 | depth += 1; |
| 185 | renderComposite({ | 345 | } else if (current === ")") { |
| 186 | key: "allOf", | 346 | depth -= 1; |
| 187 | schema: current, | 347 | if (depth === 0) { |
| 188 | render: (value) => renderNested(value), | 348 | return index; |
| 189 | depthRemaining: input.depthRemaining, | ||
| 190 | }); | ||
| 191 | if (composite) { | ||
| 192 | return truncate(composite, maxLength); | ||
| 193 | } | ||
| 194 | |||
| 195 | if (current.nullable === true) { | ||
| 196 | const { nullable: _nullable, ...rest } = current; | ||
| 197 | return truncate( | ||
| 198 | `${render({ | ||
| 199 | currentInput: rest, | ||
| 200 | depthRemaining: input.depthRemaining, | ||
| 201 | refDepthRemaining: input.refDepthRemaining, | ||
| 202 | })} | null`, | ||
| 203 | maxLength, | ||
| 204 | ); | ||
| 205 | } | ||
| 206 | |||
| 207 | if (current.type === "array") { | ||
| 208 | const itemLabel = current.items | ||
| 209 | ? render({ | ||
| 210 | currentInput: current.items, | ||
| 211 | depthRemaining: input.depthRemaining - 1, | ||
| 212 | refDepthRemaining: input.refDepthRemaining, | ||
| 213 | }) | ||
| 214 | : "unknown"; | ||
| 215 | return truncate(`${itemLabel}[]`, maxLength); | ||
| 216 | } | ||
| 217 | |||
| 218 | if (current.type === "object" || current.properties) { | ||
| 219 | const properties = asRecord(current.properties); | ||
| 220 | const propertyKeys = Object.keys(properties); | ||
| 221 | const required = new Set(asStringArray(current.required)); | ||
| 222 | |||
| 223 | const additionalProperties = current.additionalProperties; | ||
| 224 | const additionalPropertiesLabel = | ||
| 225 | additionalProperties && typeof additionalProperties === "object" | ||
| 226 | ? render({ | ||
| 227 | currentInput: additionalProperties, | ||
| 228 | depthRemaining: input.depthRemaining - 1, | ||
| 229 | refDepthRemaining: input.refDepthRemaining, | ||
| 230 | }) | ||
| 231 | : additionalProperties === true | ||
| 232 | ? "unknown" | ||
| 233 | : null; | ||
| 234 | |||
| 235 | if (propertyKeys.length === 0) { | ||
| 236 | if (additionalPropertiesLabel) { | ||
| 237 | return truncate(`Record<string, ${additionalPropertiesLabel}>`, maxLength); | ||
| 238 | } | 349 | } |
| 350 | } | ||
| 351 | } | ||
| 352 | |||
| 353 | if (skipNext) { | ||
| 354 | index += 1; | ||
| 355 | } | ||
| 356 | } | ||
| 357 | |||
| 358 | return -1; | ||
| 359 | }; | ||
| 239 | 360 | ||
| 240 | return "Record<string, unknown>"; | 361 | const findTypeAliasEnd = (source: string, start: number): number => { |
| 362 | const state = emptyScanState(); | ||
| 363 | let braceDepth = 0; | ||
| 364 | let bracketDepth = 0; | ||
| 365 | let parenDepth = 0; | ||
| 366 | let seenToken = false; | ||
| 367 | |||
| 368 | for (let index = start; index < source.length; index += 1) { | ||
| 369 | const current = source[index] ?? ""; | ||
| 370 | const next = source[index + 1] ?? ""; | ||
| 371 | const wasCode = !state.quote && !state.lineComment && !state.blockComment; | ||
| 372 | const { skipNext } = stepScanState(state, current, next); | ||
| 373 | |||
| 374 | if (wasCode && !state.quote && !state.lineComment && !state.blockComment) { | ||
| 375 | if (current === "{") { | ||
| 376 | braceDepth += 1; | ||
| 377 | } else if (current === "}") { | ||
| 378 | braceDepth = Math.max(0, braceDepth - 1); | ||
| 379 | } else if (current === "[") { | ||
| 380 | bracketDepth += 1; | ||
| 381 | } else if (current === "]") { | ||
| 382 | bracketDepth = Math.max(0, bracketDepth - 1); | ||
| 383 | } else if (current === "(") { | ||
| 384 | parenDepth += 1; | ||
| 385 | } else if (current === ")") { | ||
| 386 | parenDepth = Math.max(0, parenDepth - 1); | ||
| 241 | } | 387 | } |
| 242 | 388 | ||
| 243 | const visibleKeys = propertyKeys.slice(0, maxProperties); | 389 | if (!/\s/.test(current)) { |
| 244 | const parts = visibleKeys.map( | 390 | seenToken = true; |
| 245 | (key) => | 391 | } |
| 246 | `${formatPropertyKey(key)}${required.has(key) ? "" : "?"}: ${render({ | 392 | |
| 247 | currentInput: properties[key], | 393 | if ( |
| 248 | depthRemaining: input.depthRemaining - 1, | 394 | seenToken && |
| 249 | refDepthRemaining: input.refDepthRemaining, | 395 | (current === ";" || current === "\n" || current === "\r") && |
| 250 | })}`, | 396 | braceDepth === 0 && |
| 251 | ); | 397 | bracketDepth === 0 && |
| 252 | 398 | parenDepth === 0 | |
| 253 | if (visibleKeys.length < propertyKeys.length) { | 399 | ) { |
| 254 | parts.push("..."); | 400 | return index; |
| 401 | } | ||
| 402 | } | ||
| 403 | |||
| 404 | if (skipNext) { | ||
| 405 | index += 1; | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 409 | return -1; | ||
| 410 | }; | ||
| 411 | |||
| 412 | const parseGeneratedDeclarations = (source: string): Array<GeneratedDeclaration> => { | ||
| 413 | const declarations: Array<GeneratedDeclaration> = []; | ||
| 414 | const pattern = /export\s+(interface|type)\s+([A-Za-z_$][A-Za-z0-9_$]*)/g; | ||
| 415 | |||
| 416 | for (let match = pattern.exec(source); match; match = pattern.exec(source)) { | ||
| 417 | const kind = match[1] as "interface" | "type"; | ||
| 418 | const name = match[2] ?? ""; | ||
| 419 | |||
| 420 | if (!IDENTIFIER_PATTERN.test(name)) { | ||
| 421 | continue; | ||
| 422 | } | ||
| 423 | |||
| 424 | if (kind === "interface") { | ||
| 425 | const braceStart = source.indexOf("{", pattern.lastIndex); | ||
| 426 | if (braceStart < 0) { | ||
| 427 | continue; | ||
| 255 | } | 428 | } |
| 256 | 429 | ||
| 257 | if (additionalPropertiesLabel) { | 430 | const braceEnd = findMatchingBrace(source, braceStart); |
| 258 | parts.push(`[key: string]: ${additionalPropertiesLabel}`); | 431 | if (braceEnd < 0) { |
| 432 | continue; | ||
| 259 | } | 433 | } |
| 260 | 434 | ||
| 261 | return truncate(`{ ${parts.join("; ")} }`, maxLength); | 435 | declarations.push({ |
| 436 | kind, | ||
| 437 | name, | ||
| 438 | body: source.slice(braceStart, braceEnd + 1), | ||
| 439 | }); | ||
| 440 | pattern.lastIndex = braceEnd + 1; | ||
| 441 | continue; | ||
| 262 | } | 442 | } |
| 263 | 443 | ||
| 264 | if (Array.isArray(current.type)) { | 444 | const equalsIndex = source.indexOf("=", pattern.lastIndex); |
| 265 | return truncate( | 445 | if (equalsIndex < 0) { |
| 266 | current.type | 446 | continue; |
| 267 | .filter((value): value is string => typeof value === "string") | ||
| 268 | .map(primitiveTypeName) | ||
| 269 | .join(" | "), | ||
| 270 | maxLength, | ||
| 271 | ); | ||
| 272 | } | 447 | } |
| 273 | 448 | ||
| 274 | if (typeof current.type === "string") { | 449 | const end = findTypeAliasEnd(source, equalsIndex + 1); |
| 275 | return primitiveTypeName(current.type); | 450 | if (end < 0) { |
| 451 | continue; | ||
| 276 | } | 452 | } |
| 277 | 453 | ||
| 278 | return "unknown"; | 454 | declarations.push({ |
| 455 | kind, | ||
| 456 | name, | ||
| 457 | body: source.slice(equalsIndex + 1, end).trim(), | ||
| 458 | }); | ||
| 459 | pattern.lastIndex = end + 1; | ||
| 460 | } | ||
| 461 | |||
| 462 | return declarations; | ||
| 463 | }; | ||
| 464 | |||
| 465 | const extractPropertyType = (interfaceBody: string, propertyName: string): string | null => { | ||
| 466 | const propertyIndex = interfaceBody.indexOf(propertyName); | ||
| 467 | if (propertyIndex < 0) { | ||
| 468 | return null; | ||
| 469 | } | ||
| 470 | |||
| 471 | const colonIndex = interfaceBody.indexOf(":", propertyIndex + propertyName.length); | ||
| 472 | if (colonIndex < 0) { | ||
| 473 | return null; | ||
| 474 | } | ||
| 475 | |||
| 476 | const end = findTypeAliasEnd(interfaceBody, colonIndex + 1); | ||
| 477 | if (end < 0) { | ||
| 478 | return null; | ||
| 479 | } | ||
| 480 | |||
| 481 | return interfaceBody.slice(colonIndex + 1, end).trim(); | ||
| 482 | }; | ||
| 483 | |||
| 484 | const containsTopLevelUnion = (source: string): boolean => { | ||
| 485 | const state = emptyScanState(); | ||
| 486 | let braceDepth = 0; | ||
| 487 | let bracketDepth = 0; | ||
| 488 | let parenDepth = 0; | ||
| 489 | |||
| 490 | for (let index = 0; index < source.length; index += 1) { | ||
| 491 | const current = source[index] ?? ""; | ||
| 492 | const next = source[index + 1] ?? ""; | ||
| 493 | const wasCode = !state.quote && !state.lineComment && !state.blockComment; | ||
| 494 | const { skipNext } = stepScanState(state, current, next); | ||
| 495 | |||
| 496 | if (wasCode && !state.quote && !state.lineComment && !state.blockComment) { | ||
| 497 | if (current === "{") { | ||
| 498 | braceDepth += 1; | ||
| 499 | } else if (current === "}") { | ||
| 500 | braceDepth = Math.max(0, braceDepth - 1); | ||
| 501 | } else if (current === "[") { | ||
| 502 | bracketDepth += 1; | ||
| 503 | } else if (current === "]") { | ||
| 504 | bracketDepth = Math.max(0, bracketDepth - 1); | ||
| 505 | } else if (current === "(") { | ||
| 506 | parenDepth += 1; | ||
| 507 | } else if (current === ")") { | ||
| 508 | parenDepth = Math.max(0, parenDepth - 1); | ||
| 509 | } else if (current === "|" && braceDepth === 0 && bracketDepth === 0 && parenDepth === 0) { | ||
| 510 | return true; | ||
| 511 | } | ||
| 512 | } | ||
| 513 | |||
| 514 | if (skipNext) { | ||
| 515 | index += 1; | ||
| 516 | } | ||
| 517 | } | ||
| 518 | |||
| 519 | return false; | ||
| 520 | }; | ||
| 521 | |||
| 522 | const significantBefore = (source: string, start: number): string => { | ||
| 523 | for (let index = start; index >= 0; index -= 1) { | ||
| 524 | const char = source[index] ?? ""; | ||
| 525 | if (!/\s/.test(char)) { | ||
| 526 | return char; | ||
| 527 | } | ||
| 528 | } | ||
| 529 | return ""; | ||
| 530 | }; | ||
| 531 | |||
| 532 | const significantAfter = (source: string, start: number): string => { | ||
| 533 | for (let index = start; index < source.length; index += 1) { | ||
| 534 | const char = source[index] ?? ""; | ||
| 535 | if (!/\s/.test(char)) { | ||
| 536 | return char; | ||
| 537 | } | ||
| 538 | } | ||
| 539 | return ""; | ||
| 540 | }; | ||
| 541 | |||
| 542 | const stripRedundantUnionParens = (source: string): string => { | ||
| 543 | let output = ""; | ||
| 544 | |||
| 545 | for (let index = 0; index < source.length; index += 1) { | ||
| 546 | const current = source[index] ?? ""; | ||
| 547 | if (current !== "(") { | ||
| 548 | output += current; | ||
| 549 | continue; | ||
| 550 | } | ||
| 551 | |||
| 552 | const end = findMatchingParen(source, index); | ||
| 553 | if (end < 0) { | ||
| 554 | output += current; | ||
| 555 | continue; | ||
| 556 | } | ||
| 557 | |||
| 558 | const previous = significantBefore(source, index - 1); | ||
| 559 | const next = significantAfter(source, end + 1); | ||
| 560 | const inner = source.slice(index + 1, end); | ||
| 561 | const keepParens = | ||
| 562 | !containsTopLevelUnion(inner) || | ||
| 563 | /[A-Za-z0-9_$]/.test(previous) || | ||
| 564 | next === "[" || | ||
| 565 | next === "." || | ||
| 566 | next === "<"; | ||
| 567 | |||
| 568 | if (keepParens) { | ||
| 569 | output += source.slice(index, end + 1); | ||
| 570 | } else { | ||
| 571 | output += stripRedundantUnionParens(inner); | ||
| 572 | } | ||
| 573 | index = end; | ||
| 574 | } | ||
| 575 | |||
| 576 | return output; | ||
| 577 | }; | ||
| 578 | |||
| 579 | const compactTypeScript = (value: string): string => { | ||
| 580 | const state = emptyScanState(); | ||
| 581 | let output = ""; | ||
| 582 | let pendingWhitespace = false; | ||
| 583 | let braceDepth = 0; | ||
| 584 | |||
| 585 | const emitWhitespace = () => { | ||
| 586 | if (output.length > 0) { | ||
| 587 | pendingWhitespace = true; | ||
| 588 | } | ||
| 589 | }; | ||
| 590 | |||
| 591 | const previousSignificant = (): string => output.trimEnd().at(-1) ?? ""; | ||
| 592 | |||
| 593 | const nextSignificant = (start: number): string => { | ||
| 594 | for (let index = start; index < value.length; index += 1) { | ||
| 595 | const char = value[index] ?? ""; | ||
| 596 | if (!/\s/.test(char)) { | ||
| 597 | return char; | ||
| 598 | } | ||
| 599 | } | ||
| 600 | return ""; | ||
| 279 | }; | 601 | }; |
| 280 | 602 | ||
| 281 | const referencedDepths = new Map<string, number>(); | 603 | const terminateMemberAtNewline = (index: number): void => { |
| 604 | if (braceDepth <= 0) { | ||
| 605 | return; | ||
| 606 | } | ||
| 282 | 607 | ||
| 283 | const collectPreviewRefs = (currentInput: unknown, refDepth: number): void => { | 608 | const previous = previousSignificant(); |
| 284 | const current = asRecord(currentInput); | 609 | if (!previous || previous === "{" || previous === ";" || previous === "|" || previous === "&") { |
| 610 | return; | ||
| 611 | } | ||
| 285 | 612 | ||
| 286 | if (summarizeLargeComposite(current, maxCompositeMembers)) { | 613 | const next = nextSignificant(index + 1); |
| 614 | if (!next || next === "|" || next === "&" || next === ")" || next === "]" || next === ",") { | ||
| 287 | return; | 615 | return; |
| 288 | } | 616 | } |
| 289 | 617 | ||
| 290 | if (typeof current.$ref === "string") { | 618 | output = output.trimEnd() + ";"; |
| 291 | const name = refNameFromPointer(current.$ref); | 619 | pendingWhitespace = true; |
| 292 | if (!name) { | 620 | }; |
| 293 | return; | 621 | |
| 622 | for (let index = 0; index < value.length; index += 1) { | ||
| 623 | const current = value[index] ?? ""; | ||
| 624 | const next = value[index + 1] ?? ""; | ||
| 625 | |||
| 626 | if (!state.quote && !state.lineComment && !state.blockComment) { | ||
| 627 | if (current === "/" && next === "/") { | ||
| 628 | emitWhitespace(); | ||
| 629 | index += 1; | ||
| 630 | state.lineComment = true; | ||
| 631 | continue; | ||
| 294 | } | 632 | } |
| 295 | 633 | ||
| 296 | const existingDepth = referencedDepths.get(name); | 634 | if (current === "/" && next === "*") { |
| 297 | if (existingDepth !== undefined && existingDepth <= refDepth) { | 635 | emitWhitespace(); |
| 298 | return; | 636 | index += 1; |
| 637 | state.blockComment = true; | ||
| 638 | continue; | ||
| 299 | } | 639 | } |
| 300 | 640 | ||
| 301 | referencedDepths.set(name, refDepth); | 641 | if (/\s/.test(current)) { |
| 642 | if (current === "\n" || current === "\r") { | ||
| 643 | terminateMemberAtNewline(index); | ||
| 644 | } | ||
| 645 | emitWhitespace(); | ||
| 646 | continue; | ||
| 647 | } | ||
| 648 | } | ||
| 302 | 649 | ||
| 303 | if (refDepth >= maxRefDepth) { | 650 | if (state.lineComment) { |
| 304 | return; | 651 | if (current === "\n" || current === "\r") { |
| 652 | state.lineComment = false; | ||
| 305 | } | 653 | } |
| 654 | continue; | ||
| 655 | } | ||
| 306 | 656 | ||
| 307 | const target = defs.get(name); | 657 | if (state.blockComment) { |
| 308 | if (target !== undefined) { | 658 | if (current === "*" && next === "/") { |
| 309 | collectPreviewRefs(target, refDepth + 1); | 659 | state.blockComment = false; |
| 660 | index += 1; | ||
| 310 | } | 661 | } |
| 311 | return; | 662 | continue; |
| 312 | } | 663 | } |
| 313 | 664 | ||
| 314 | for (const value of Object.values(current)) { | 665 | if (pendingWhitespace && output.length > 0) { |
| 315 | if (value && typeof value === "object") { | 666 | output += " "; |
| 316 | if (Array.isArray(value)) { | 667 | } |
| 317 | for (const item of value) { | 668 | pendingWhitespace = false; |
| 318 | collectPreviewRefs(item, refDepth); | 669 | output += current; |
| 319 | } | 670 | |
| 320 | } else { | 671 | if (state.quote) { |
| 321 | collectPreviewRefs(value, refDepth); | 672 | if (state.escaping) { |
| 322 | } | 673 | state.escaping = false; |
| 674 | } else if (current === "\\") { | ||
| 675 | state.escaping = true; | ||
| 676 | } else if (current === state.quote) { | ||
| 677 | state.quote = null; | ||
| 323 | } | 678 | } |
| 679 | continue; | ||
| 324 | } | 680 | } |
| 325 | }; | ||
| 326 | 681 | ||
| 327 | collectPreviewRefs(schema, 1); | 682 | if (current === '"' || current === "'" || current === "`") { |
| 683 | state.quote = current; | ||
| 684 | continue; | ||
| 685 | } | ||
| 328 | 686 | ||
| 329 | const definitions = Object.fromEntries( | 687 | if (current === "{") { |
| 330 | [...referencedDepths.entries()] | 688 | braceDepth += 1; |
| 331 | .sort(([left], [right]) => left.localeCompare(right)) | 689 | } else if (current === "}") { |
| 332 | .flatMap(([name, refDepth]) => { | 690 | braceDepth = Math.max(0, braceDepth - 1); |
| 333 | const target = defs.get(name); | 691 | } |
| 334 | if (target === undefined) { | 692 | } |
| 335 | return []; | ||
| 336 | } | ||
| 337 | 693 | ||
| 338 | return [ | 694 | return stripRedundantUnionParens(output.trim()); |
| 339 | [ | 695 | }; |
| 340 | name, | 696 | |
| 341 | render({ | 697 | const getDefinitionsFromDeclarations = ( |
| 342 | currentInput: target, | 698 | declarations: ReadonlyArray<GeneratedDeclaration>, |
| 343 | depthRemaining: maxDepth, | 699 | ): Record<string, string> => |
| 344 | refDepthRemaining: Math.max(0, maxRefDepth - refDepth), | 700 | Object.fromEntries( |
| 345 | }), | 701 | declarations |
| 346 | ], | 702 | .filter((declaration) => declaration.name !== ROOT_WRAPPER_NAME) |
| 347 | ] as const; | 703 | .map((declaration) => [declaration.name, compactTypeScript(declaration.body)]) |
| 348 | }), | 704 | .sort(([left], [right]) => left.localeCompare(right)), |
| 705 | ); | ||
| 706 | |||
| 707 | const previewFromCompiledTypeScript = (source: string): TypeScriptSchemaPreview => { | ||
| 708 | const declarations = parseGeneratedDeclarations(source); | ||
| 709 | const rootDeclaration = declarations.find( | ||
| 710 | (declaration) => declaration.name === ROOT_WRAPPER_NAME, | ||
| 349 | ); | 711 | ); |
| 712 | const rootType = | ||
| 713 | rootDeclaration?.kind === "interface" | ||
| 714 | ? extractPropertyType(rootDeclaration.body, ROOT_PROPERTY_NAME) | ||
| 715 | : null; | ||
| 350 | 716 | ||
| 351 | return { | 717 | return { |
| 352 | type: render({ | 718 | type: compactTypeScript(rootType ?? "unknown"), |
| 353 | currentInput: schema, | 719 | definitions: getDefinitionsFromDeclarations(declarations), |
| 354 | depthRemaining: maxDepth, | ||
| 355 | refDepthRemaining: maxRefDepth, | ||
| 356 | }), | ||
| 357 | definitions, | ||
| 358 | }; | 720 | }; |
| 359 | }; | 721 | }; |
| 360 | 722 | ||
| 723 | const previewToolFromCompiledTypeScript = (source: string): ToolTypeScriptPreview => { | ||
| 724 | const declarations = parseGeneratedDeclarations(source); | ||
| 725 | const rootDeclaration = declarations.find( | ||
| 726 | (declaration) => declaration.name === ROOT_WRAPPER_NAME, | ||
| 727 | ); | ||
| 728 | const inputType = | ||
| 729 | rootDeclaration?.kind === "interface" | ||
| 730 | ? extractPropertyType(rootDeclaration.body, TOOL_INPUT_PROPERTY_NAME) | ||
| 731 | : null; | ||
| 732 | const outputType = | ||
| 733 | rootDeclaration?.kind === "interface" | ||
| 734 | ? extractPropertyType(rootDeclaration.body, TOOL_OUTPUT_PROPERTY_NAME) | ||
| 735 | : null; | ||
| 736 | const definitions = getDefinitionsFromDeclarations(declarations); | ||
| 737 | |||
| 738 | return { | ||
| 739 | ...(inputType ? { inputTypeScript: compactTypeScript(inputType) } : {}), | ||
| 740 | ...(outputType ? { outputTypeScript: compactTypeScript(outputType) } : {}), | ||
| 741 | ...(Object.keys(definitions).length > 0 ? { typeScriptDefinitions: definitions } : {}), | ||
| 742 | }; | ||
| 743 | }; | ||
| 744 | |||
| 745 | const compileSchemaPreview = async ( | ||
| 746 | schema: unknown, | ||
| 747 | defs: ReadonlyMap<string, unknown>, | ||
| 748 | options: TypeScriptRenderOptions, | ||
| 749 | ): Promise<TypeScriptSchemaPreview> => { | ||
| 750 | const wrappedSchema = buildWrappedSchema(schema, defs); | ||
| 751 | const source = compile(wrappedSchema, ROOT_WRAPPER_NAME, compilerOptionsFrom(options)); | ||
| 752 | return previewFromCompiledTypeScript(source); | ||
| 753 | }; | ||
| 754 | |||
| 755 | export const schemaToTypeScriptPreview = ( | ||
| 756 | schema: unknown, | ||
| 757 | options: TypeScriptRenderOptions = {}, | ||
| 758 | ): Promise<TypeScriptSchemaPreview> => { | ||
| 759 | const localDefs = new Map<string, unknown>( | ||
| 760 | Object.entries(hoistDefinitions(asCompilerSchema(schema)).defs), | ||
| 761 | ); | ||
| 762 | return schemaToTypeScriptPreviewWithDefs(schema, localDefs, options); | ||
| 763 | }; | ||
| 764 | |||
| 765 | export const schemaToTypeScriptPreviewWithDefs = ( | ||
| 766 | schema: unknown, | ||
| 767 | defs: ReadonlyMap<string, unknown>, | ||
| 768 | options: TypeScriptRenderOptions = {}, | ||
| 769 | ): Promise<TypeScriptSchemaPreview> => | ||
| 770 | compileSchemaPreview(schema, defs, options).then( | ||
| 771 | (preview) => preview, | ||
| 772 | () => ({ | ||
| 773 | type: "unknown", | ||
| 774 | definitions: {}, | ||
| 775 | }), | ||
| 776 | ); | ||
| 777 | |||
| 361 | export type ToolTypeScriptPreview = { | 778 | export type ToolTypeScriptPreview = { |
| 362 | inputTypeScript?: string; | 779 | inputTypeScript?: string; |
| 363 | outputTypeScript?: string; | 780 | outputTypeScript?: string; |
| 364 | typeScriptDefinitions?: Record<string, string>; | 781 | typeScriptDefinitions?: Record<string, string>; |
| 365 | }; | 782 | }; |
| 366 | 783 | ||
| 367 | export const buildToolTypeScriptPreview = (input: { | 784 | export const buildToolTypeScriptPreview = async (input: { |
| 368 | inputSchema?: unknown; | 785 | inputSchema?: unknown; |
| 369 | outputSchema?: unknown; | 786 | outputSchema?: unknown; |
| 370 | defs: ReadonlyMap<string, unknown>; | 787 | defs: ReadonlyMap<string, unknown>; |
| 371 | options?: TypeScriptRenderOptions; | 788 | options?: TypeScriptRenderOptions; |
| 372 | }): ToolTypeScriptPreview => { | 789 | }): Promise<ToolTypeScriptPreview> => { |
| 373 | const inputPreview = | 790 | const properties: Array<readonly [string, unknown]> = []; |
| 374 | input.inputSchema !== undefined | 791 | if (input.inputSchema !== undefined) { |
| 375 | ? schemaToTypeScriptPreviewWithDefs(input.inputSchema, input.defs, input.options) | 792 | properties.push([TOOL_INPUT_PROPERTY_NAME, input.inputSchema]); |
| 376 | : null; | 793 | } |
| 377 | const outputPreview = | 794 | if (input.outputSchema !== undefined) { |
| 378 | input.outputSchema !== undefined | 795 | properties.push([TOOL_OUTPUT_PROPERTY_NAME, input.outputSchema]); |
| 379 | ? schemaToTypeScriptPreviewWithDefs(input.outputSchema, input.defs, input.options) | 796 | } |
| 380 | : null; | 797 | if (properties.length === 0) { |
| 381 | 798 | return {}; | |
| 382 | const mergedDefinitions = { | 799 | } |
| 383 | ...inputPreview?.definitions, | ||
| 384 | ...outputPreview?.definitions, | ||
| 385 | }; | ||
| 386 | 800 | ||
| 387 | return { | 801 | const wrappedSchema = buildWrappedObjectSchema(properties, input.defs); |
| 388 | ...(inputPreview ? { inputTypeScript: inputPreview.type } : {}), | 802 | return Promise.resolve() |
| 389 | ...(outputPreview ? { outputTypeScript: outputPreview.type } : {}), | 803 | .then(() => compile(wrappedSchema, ROOT_WRAPPER_NAME, compilerOptionsFrom(input.options ?? {}))) |
| 390 | ...(Object.keys(mergedDefinitions).length > 0 | 804 | .then( |
| 391 | ? { typeScriptDefinitions: mergedDefinitions } | 805 | (source) => previewToolFromCompiledTypeScript(source), |
| 392 | : {}), | 806 | () => ({ |
| 393 | }; | 807 | ...(input.inputSchema !== undefined ? { inputTypeScript: "unknown" } : {}), |
| 808 | ...(input.outputSchema !== undefined ? { outputTypeScript: "unknown" } : {}), | ||
| 809 | }), | ||
| 810 | ); | ||
| 394 | }; | 811 | }; |
| @@ -0,0 +1,64 @@ | |||
| 1 | // --------------------------------------------------------------------------- | ||
| 2 | // @executor-js/sdk/shared — browser-safe domain contracts. | ||
| 3 | // | ||
| 4 | // This entry is for React and plugin UI code that needs runtime IDs, | ||
| 5 | // tagged errors, policy helpers, and wire contracts without importing the | ||
| 6 | // server/plugin SDK root. | ||
| 7 | // --------------------------------------------------------------------------- | ||
| 8 | |||
| 9 | export { ScopeId, ToolId, SecretId, PolicyId, ConnectionId, CredentialBindingId } from "./ids"; | ||
| 10 | |||
| 11 | export { | ||
| 12 | ToolNotFoundError, | ||
| 13 | SourceRemovalNotAllowedError, | ||
| 14 | SecretNotFoundError, | ||
| 15 | SecretResolutionError, | ||
| 16 | SecretOwnedByConnectionError, | ||
| 17 | SecretInUseError, | ||
| 18 | ConnectionInUseError, | ||
| 19 | } from "./errors"; | ||
| 20 | |||
| 21 | export { InternalError } from "./api-errors"; | ||
| 22 | |||
| 23 | export { | ||
| 24 | effectivePolicyFromSorted, | ||
| 25 | ToolPolicyActionSchema, | ||
| 26 | type EffectivePolicy, | ||
| 27 | type ToolPolicy, | ||
| 28 | } from "./policies"; | ||
| 29 | |||
| 30 | export type { ToolPolicyAction } from "./core-schema"; | ||
| 31 | |||
| 32 | export { | ||
| 33 | SecretBackedMap, | ||
| 34 | SecretBackedValue, | ||
| 35 | isSecretBackedRef, | ||
| 36 | type ResolveSecretBackedMapOptions, | ||
| 37 | } from "./secret-backed-value"; | ||
| 38 | |||
| 39 | export { | ||
| 40 | ConfiguredCredentialBinding, | ||
| 41 | ConfiguredCredentialValue, | ||
| 42 | CredentialBindingValue, | ||
| 43 | ScopedSecretCredentialInput, | ||
| 44 | credentialSlotKey, | ||
| 45 | } from "./credential-bindings"; | ||
| 46 | |||
| 47 | export { SourceDetectionResult, type Source } from "./types"; | ||
| 48 | |||
| 49 | export { Usage } from "./usages"; | ||
| 50 | |||
| 51 | export { | ||
| 52 | OAUTH_POPUP_MESSAGE_TYPE, | ||
| 53 | isOAuthPopupResult, | ||
| 54 | type OAuthPopupResult, | ||
| 55 | } from "./oauth-popup-types"; | ||
| 56 | |||
| 57 | export { | ||
| 58 | OAuthProbeError, | ||
| 59 | OAuthStartError, | ||
| 60 | OAuthCompleteError, | ||
| 61 | OAuthSessionNotFoundError, | ||
| 62 | OAuthStrategy as OAuthStrategySchema, | ||
| 63 | type OAuthStrategy, | ||
| 64 | } from "./oauth"; | ||
| @@ -49,8 +49,8 @@ export interface RefreshSourceInput { · 48 unmodified lines | |||
| 49 | 49 | ||
| 50 | // `Tool` is the runtime view used across the SDK (with sourceId/pluginId/ | 50 | // `Tool` is the runtime view used across the SDK (with sourceId/pluginId/ |
| 51 | // annotations); `ToolSchema` below is the separate schema-side view that | 51 | // annotations); `ToolSchema` below is the separate schema-side view that |
| 52 | // `executor.tools.schema(toolId)` returns (with TypeScript previews). They | 52 | // `executor.tools.schema(toolId)` returns. It can include TypeScript previews. |
| 53 | // share a name root but are intentionally distinct shapes. | 53 | // These share a name root but are intentionally distinct shapes. |
| 54 | // oxlint-disable-next-line executor/prefer-schema-inferred-types | 54 | // oxlint-disable-next-line executor/prefer-schema-inferred-types |
| 55 | export interface Tool { | 55 | export interface Tool { |
| 56 | readonly id: string; | 56 | readonly id: string; |
| @@ -66,10 +66,9 @@ export interface Tool { · 9 unmodified lines | |||
| 66 | 66 | ||
| 67 | // --------------------------------------------------------------------------- | 67 | // --------------------------------------------------------------------------- |
| 68 | // ToolSchema — the full schema-side view of a tool, returned by | 68 | // ToolSchema — the full schema-side view of a tool, returned by |
| 69 | // `executor.tools.schema(toolId)`. Includes JSON schemas with `$defs` | 69 | // `executor.tools.schema(toolId)`. Includes JSON schema roots plus shared |
| 70 | // attached at read time AND TypeScript preview strings rendered from | 70 | // definitions for schema exploration, and optionally TypeScript preview strings |
| 71 | // them via `schemaToTypeScriptPreview`. The UI uses the TS previews to | 71 | // rendered from them via `schemaToTypeScriptPreview`. |
| 72 | // show "calling this tool looks like this" code samples. | ||
| 73 | // --------------------------------------------------------------------------- | 72 | // --------------------------------------------------------------------------- |
| 74 | 73 | ||
| 75 | export const ToolSchema = Schema.Struct({ | 74 | export const ToolSchema = Schema.Struct({ |
| @@ -78,6 +77,7 @@ export const ToolSchema = Schema.Struct({ · 2 unmodified lines | |||
| 78 | description: Schema.optional(Schema.String), | 77 | description: Schema.optional(Schema.String), |
| 79 | inputSchema: Schema.optional(Schema.Unknown), | 78 | inputSchema: Schema.optional(Schema.Unknown), |
| 80 | outputSchema: Schema.optional(Schema.Unknown), | 79 | outputSchema: Schema.optional(Schema.Unknown), |
| 80 | schemaDefinitions: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)), | ||
| 81 | inputTypeScript: Schema.optional(Schema.String), | 81 | inputTypeScript: Schema.optional(Schema.String), |
| 82 | outputTypeScript: Schema.optional(Schema.String), | 82 | outputTypeScript: Schema.optional(Schema.String), |
| 83 | typeScriptDefinitions: Schema.optional(Schema.Record(Schema.String, Schema.String)), | 83 | typeScriptDefinitions: Schema.optional(Schema.Record(Schema.String, Schema.String)), |
| @@ -0,0 +1,7 @@ | |||
| 1 | Copyright 2022 Boris Cherny | ||
| 2 | |||
| 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
| 4 | |||
| 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
| 6 | |||
| 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| @@ -0,0 +1,14 @@ | |||
| 1 | # Vendored json-schema-to-typescript | ||
| 2 | |||
| 3 | Vendored SDK-internal compiler code based on Boris Cherny's | ||
| 4 | `json-schema-to-typescript@15.0.4`. | ||
| 5 | |||
| 6 | The Executor copy keeps the schema compiler API used by `@executor-js/sdk` and | ||
| 7 | removes the Prettier formatting dependency. Generated output is intentionally | ||
| 8 | left unformatted; callers that display previews should normalize it themselves. | ||
| 9 | It also resolves only same-document JSON Pointer `$ref`s; external file and URL | ||
| 10 | refs are rejected rather than fetched or read. It is not a public package | ||
| 11 | surface. | ||
| 12 | |||
| 13 | The upstream project is MIT licensed; the original copyright notice is included | ||
| 14 | in `LICENCE.md`. | ||
| @@ -0,0 +1,51 @@ | |||
| 1 | import type { LinkedJSONSchema } from "./types/JSONSchema"; | ||
| 2 | import { Intersection, Parent, Types } from "./types/JSONSchema"; | ||
| 3 | import { typesOfSchema } from "./typesOfSchema"; | ||
| 4 | |||
| 5 | export function applySchemaTyping(schema: LinkedJSONSchema) { | ||
| 6 | const types = typesOfSchema(schema); | ||
| 7 | |||
| 8 | Object.defineProperty(schema, Types, { | ||
| 9 | enumerable: false, | ||
| 10 | value: types, | ||
| 11 | writable: false, | ||
| 12 | }); | ||
| 13 | |||
| 14 | if (types.size === 1) { | ||
| 15 | return; | ||
| 16 | } | ||
| 17 | |||
| 18 | // Some schemas can be understood as multiple possible types (see related | ||
| 19 | // comment in `typesOfSchema.ts`). In such cases, we generate an `ALL_OF` | ||
| 20 | // intersection that will ultimately be used to generate a union type. | ||
| 21 | // | ||
| 22 | // The original schema's name, title, and description are hoisted to the | ||
| 23 | // new intersection schema to prevent duplication. | ||
| 24 | // | ||
| 25 | // If the original schema also contained its own `ALL_OF` property, it is | ||
| 26 | // also hoiested to the new intersection schema. | ||
| 27 | const intersection = { | ||
| 28 | [Parent]: schema, | ||
| 29 | [Types]: new Set(["ALL_OF"]), | ||
| 30 | $id: schema.$id, | ||
| 31 | description: schema.description, | ||
| 32 | name: schema.name, | ||
| 33 | title: schema.title, | ||
| 34 | allOf: schema.allOf ?? [], | ||
| 35 | required: [], | ||
| 36 | additionalProperties: false, | ||
| 37 | }; | ||
| 38 | |||
| 39 | types.delete("ALL_OF"); | ||
| 40 | delete schema.allOf; | ||
| 41 | delete schema.$id; | ||
| 42 | delete schema.description; | ||
| 43 | delete schema.name; | ||
| 44 | delete schema.title; | ||
| 45 | |||
| 46 | Object.defineProperty(schema, Intersection, { | ||
| 47 | enumerable: false, | ||
| 48 | value: intersection, | ||
| 49 | writable: false, | ||
| 50 | }); | ||
| 51 | } | ||
| @@ -0,0 +1,71 @@ | |||
| 1 | import { Struct } from "effect"; | ||
| 2 | |||
| 3 | // Keep these helpers deliberately small and local. They preserve only the | ||
| 4 | // upstream helper behavior this vendored compiler actually uses. | ||
| 5 | export const isPlainObject = (value: unknown): value is Record<string, unknown> => { | ||
| 6 | if (value === null || typeof value !== "object") return false; | ||
| 7 | const prototype = Object.getPrototypeOf(value); | ||
| 8 | return prototype === Object.prototype || prototype === null; | ||
| 9 | }; | ||
| 10 | |||
| 11 | export const cloneDeep = <T>(value: T): T => structuredClone(value); | ||
| 12 | |||
| 13 | export const merge = <T extends object>( | ||
| 14 | target: T, | ||
| 15 | ...sources: ReadonlyArray<object | undefined> | ||
| 16 | ): T => { | ||
| 17 | const output = target as Record<string, unknown>; | ||
| 18 | for (const source of sources) { | ||
| 19 | if (!source) continue; | ||
| 20 | for (const [key, value] of Object.entries(source as Record<string, unknown>)) { | ||
| 21 | const current = output[key]; | ||
| 22 | output[key] = | ||
| 23 | isPlainObject(current) && isPlainObject(value) | ||
| 24 | ? merge({ ...current }, value) | ||
| 25 | : cloneDeep(value); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | return target; | ||
| 29 | }; | ||
| 30 | |||
| 31 | export const findKey = <T>( | ||
| 32 | object: Record<string, T> | undefined, | ||
| 33 | predicate: (value: T, key: string) => boolean, | ||
| 34 | ): string | undefined => { | ||
| 35 | if (!object) return undefined; | ||
| 36 | for (const [key, value] of Object.entries(object)) { | ||
| 37 | if (predicate(value, key)) return key; | ||
| 38 | } | ||
| 39 | return undefined; | ||
| 40 | }; | ||
| 41 | |||
| 42 | export const memoize = <F extends (arg: any, ...rest: any[]) => any>(fn: F): F => { | ||
| 43 | const cache = new Map<Parameters<F>[0], ReturnType<F>>(); | ||
| 44 | return ((arg: Parameters<F>[0], ...rest: unknown[]) => { | ||
| 45 | if (cache.has(arg)) return cache.get(arg); | ||
| 46 | const value = fn(arg, ...rest); | ||
| 47 | cache.set(arg, value); | ||
| 48 | return value; | ||
| 49 | }) as F; | ||
| 50 | }; | ||
| 51 | |||
| 52 | export const omit = <T extends object, K extends keyof T>(object: T, ...keys: K[]): Omit<T, K> => | ||
| 53 | Struct.omit(object, keys); | ||
| 54 | |||
| 55 | export const uniqBy = <T>(items: ReadonlyArray<T>, iteratee: (value: T) => string): T[] => { | ||
| 56 | const seen = new Set<string>(); | ||
| 57 | const result: T[] = []; | ||
| 58 | for (const item of items) { | ||
| 59 | const key = iteratee(item); | ||
| 60 | if (seen.has(key)) continue; | ||
| 61 | seen.add(key); | ||
| 62 | result.push(item); | ||
| 63 | } | ||
| 64 | return result; | ||
| 65 | }; | ||
| 66 | |||
| 67 | export const deburr = (value: string): string => | ||
| 68 | value.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); | ||
| 69 | |||
| 70 | export const upperFirst = (value: string): string => | ||
| 71 | value.length === 0 ? value : value[0]!.toUpperCase() + value.slice(1); | ||
| @@ -0,0 +1,6 @@ | |||
| 1 | import type { Options } from "./"; | ||
| 2 | |||
| 3 | export function format(code: string, options: Options): string { | ||
| 4 | void options; | ||
| 5 | return code; | ||
| 6 | } | ||
| @@ -0,0 +1,396 @@ | |||
| 1 | import { memoize, omit } from "./compat"; | ||
| 2 | import { DEFAULT_OPTIONS, type Options } from "./index"; | ||
| 3 | import { hasComment, hasStandaloneName, T_ANY, T_UNKNOWN } from "./types/AST"; | ||
| 4 | import type { | ||
| 5 | AST, | ||
| 6 | ASTWithStandaloneName, | ||
| 7 | TArray, | ||
| 8 | TEnum, | ||
| 9 | TInterface, | ||
| 10 | TIntersection, | ||
| 11 | TNamedInterface, | ||
| 12 | TUnion, | ||
| 13 | } from "./types/AST"; | ||
| 14 | import { toSafeString } from "./utils"; | ||
| 15 | |||
| 16 | export function generate(ast: AST, options = DEFAULT_OPTIONS): string { | ||
| 17 | return ( | ||
| 18 | [ | ||
| 19 | options.bannerComment, | ||
| 20 | declareNamedTypes(ast, options, ast.standaloneName!), | ||
| 21 | declareNamedInterfaces(ast, options, ast.standaloneName!), | ||
| 22 | declareEnums(ast, options), | ||
| 23 | ] | ||
| 24 | .filter(Boolean) | ||
| 25 | .join("\n\n") + "\n" | ||
| 26 | ); // trailing newline | ||
| 27 | } | ||
| 28 | |||
| 29 | function declareEnums(ast: AST, options: Options, processed = new Set<AST>()): string { | ||
| 30 | if (processed.has(ast)) { | ||
| 31 | return ""; | ||
| 32 | } | ||
| 33 | |||
| 34 | processed.add(ast); | ||
| 35 | let type = ""; | ||
| 36 | |||
| 37 | switch (ast.type) { | ||
| 38 | case "ENUM": | ||
| 39 | return generateStandaloneEnum(ast, options) + "\n"; | ||
| 40 | case "ARRAY": | ||
| 41 | return declareEnums(ast.params, options, processed); | ||
| 42 | case "UNION": | ||
| 43 | case "INTERSECTION": | ||
| 44 | return ast.params.reduce((prev, ast) => prev + declareEnums(ast, options, processed), ""); | ||
| 45 | case "TUPLE": | ||
| 46 | type = ast.params.reduce((prev, ast) => prev + declareEnums(ast, options, processed), ""); | ||
| 47 | if (ast.spreadParam) { | ||
| 48 | type += declareEnums(ast.spreadParam, options, processed); | ||
| 49 | } | ||
| 50 | return type; | ||
| 51 | case "INTERFACE": | ||
| 52 | return getSuperTypesAndParams(ast).reduce( | ||
| 53 | (prev, ast) => prev + declareEnums(ast, options, processed), | ||
| 54 | "", | ||
| 55 | ); | ||
| 56 | default: | ||
| 57 | return ""; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | function declareNamedInterfaces( | ||
| 62 | ast: AST, | ||
| 63 | options: Options, | ||
| 64 | rootASTName: string, | ||
| 65 | processed = new Set<AST>(), | ||
| 66 | ): string { | ||
| 67 | if (processed.has(ast)) { | ||
| 68 | return ""; | ||
| 69 | } | ||
| 70 | |||
| 71 | processed.add(ast); | ||
| 72 | let type = ""; | ||
| 73 | |||
| 74 | switch (ast.type) { | ||
| 75 | case "ARRAY": | ||
| 76 | type = declareNamedInterfaces((ast as TArray).params, options, rootASTName, processed); | ||
| 77 | break; | ||
| 78 | case "INTERFACE": | ||
| 79 | type = [ | ||
| 80 | hasStandaloneName(ast) && | ||
| 81 | (ast.standaloneName === rootASTName || options.declareExternallyReferenced) && | ||
| 82 | generateStandaloneInterface(ast, options), | ||
| 83 | getSuperTypesAndParams(ast) | ||
| 84 | .map((ast) => declareNamedInterfaces(ast, options, rootASTName, processed)) | ||
| 85 | .filter(Boolean) | ||
| 86 | .join("\n"), | ||
| 87 | ] | ||
| 88 | .filter(Boolean) | ||
| 89 | .join("\n"); | ||
| 90 | break; | ||
| 91 | case "INTERSECTION": | ||
| 92 | case "TUPLE": | ||
| 93 | case "UNION": | ||
| 94 | type = ast.params | ||
| 95 | .map((_) => declareNamedInterfaces(_, options, rootASTName, processed)) | ||
| 96 | .filter(Boolean) | ||
| 97 | .join("\n"); | ||
| 98 | if (ast.type === "TUPLE" && ast.spreadParam) { | ||
| 99 | type += declareNamedInterfaces(ast.spreadParam, options, rootASTName, processed); | ||
| 100 | } | ||
| 101 | break; | ||
| 102 | default: | ||
| 103 | type = ""; | ||
| 104 | } | ||
| 105 | |||
| 106 | return type; | ||
| 107 | } | ||
| 108 | |||
| 109 | function declareNamedTypes( | ||
| 110 | ast: AST, | ||
| 111 | options: Options, | ||
| 112 | rootASTName: string, | ||
| 113 | processed = new Set<AST>(), | ||
| 114 | ): string { | ||
| 115 | if (processed.has(ast)) { | ||
| 116 | return ""; | ||
| 117 | } | ||
| 118 | |||
| 119 | processed.add(ast); | ||
| 120 | |||
| 121 | switch (ast.type) { | ||
| 122 | case "ARRAY": | ||
| 123 | return [ | ||
| 124 | declareNamedTypes(ast.params, options, rootASTName, processed), | ||
| 125 | hasStandaloneName(ast) ? generateStandaloneType(ast, options) : undefined, | ||
| 126 | ] | ||
| 127 | .filter(Boolean) | ||
| 128 | .join("\n"); | ||
| 129 | case "ENUM": | ||
| 130 | return ""; | ||
| 131 | case "INTERFACE": | ||
| 132 | return getSuperTypesAndParams(ast) | ||
| 133 | .map( | ||
| 134 | (ast) => | ||
| 135 | (ast.standaloneName === rootASTName || options.declareExternallyReferenced) && | ||
| 136 | declareNamedTypes(ast, options, rootASTName, processed), | ||
| 137 | ) | ||
| 138 | .filter(Boolean) | ||
| 139 | .join("\n"); | ||
| 140 | case "INTERSECTION": | ||
| 141 | case "TUPLE": | ||
| 142 | case "UNION": | ||
| 143 | return [ | ||
| 144 | hasStandaloneName(ast) ? generateStandaloneType(ast, options) : undefined, | ||
| 145 | ast.params | ||
| 146 | .map((ast) => declareNamedTypes(ast, options, rootASTName, processed)) | ||
| 147 | .filter(Boolean) | ||
| 148 | .join("\n"), | ||
| 149 | "spreadParam" in ast && ast.spreadParam | ||
| 150 | ? declareNamedTypes(ast.spreadParam, options, rootASTName, processed) | ||
| 151 | : undefined, | ||
| 152 | ] | ||
| 153 | .filter(Boolean) | ||
| 154 | .join("\n"); | ||
| 155 | default: | ||
| 156 | if (hasStandaloneName(ast)) { | ||
| 157 | return generateStandaloneType(ast, options); | ||
| 158 | } | ||
| 159 | return ""; | ||
| 160 | } | ||
| 161 | } | ||
| 162 | |||
| 163 | function generateTypeUnmemoized(ast: AST, options: Options): string { | ||
| 164 | const type = generateRawType(ast, options); | ||
| 165 | |||
| 166 | if (options.strictIndexSignatures && ast.keyName === "[k: string]") { | ||
| 167 | return `${type} | undefined`; | ||
| 168 | } | ||
| 169 | |||
| 170 | return type; | ||
| 171 | } | ||
| 172 | export const generateType = memoize(generateTypeUnmemoized); | ||
| 173 | |||
| 174 | function generateRawType(ast: AST, options: Options): string { | ||
| 175 | if (hasStandaloneName(ast)) { | ||
| 176 | return toSafeString(ast.standaloneName); | ||
| 177 | } | ||
| 178 | |||
| 179 | switch (ast.type) { | ||
| 180 | case "ANY": | ||
| 181 | return "any"; | ||
| 182 | case "ARRAY": | ||
| 183 | return (() => { | ||
| 184 | const type = generateType(ast.params, options); | ||
| 185 | return type.endsWith('"') ? "(" + type + ")[]" : type + "[]"; | ||
| 186 | })(); | ||
| 187 | case "BOOLEAN": | ||
| 188 | return "boolean"; | ||
| 189 | case "INTERFACE": | ||
| 190 | return generateInterface(ast, options); | ||
| 191 | case "INTERSECTION": | ||
| 192 | return generateSetOperation(ast, options); | ||
| 193 | case "LITERAL": | ||
| 194 | return JSON.stringify(ast.params); | ||
| 195 | case "NEVER": | ||
| 196 | return "never"; | ||
| 197 | case "NUMBER": | ||
| 198 | return "number"; | ||
| 199 | case "NULL": | ||
| 200 | return "null"; | ||
| 201 | case "OBJECT": | ||
| 202 | return "object"; | ||
| 203 | case "REFERENCE": | ||
| 204 | return ast.params; | ||
| 205 | case "STRING": | ||
| 206 | return "string"; | ||
| 207 | case "TUPLE": | ||
| 208 | return (() => { | ||
| 209 | const minItems = ast.minItems; | ||
| 210 | const maxItems = ast.maxItems || -1; | ||
| 211 | |||
| 212 | let spreadParam = ast.spreadParam; | ||
| 213 | const astParams = [...ast.params]; | ||
| 214 | if (minItems > 0 && minItems > astParams.length && ast.spreadParam === undefined) { | ||
| 215 | // this is a valid state, and JSONSchema doesn't care about the item type | ||
| 216 | if (maxItems < 0) { | ||
| 217 | // no max items and no spread param, so just spread any | ||
| 218 | spreadParam = options.unknownAny ? T_UNKNOWN : T_ANY; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | if (maxItems > astParams.length && ast.spreadParam === undefined) { | ||
| 222 | // this is a valid state, and JSONSchema doesn't care about the item type | ||
| 223 | // fill the tuple with any elements | ||
| 224 | for (let i = astParams.length; i < maxItems; i += 1) { | ||
| 225 | astParams.push(options.unknownAny ? T_UNKNOWN : T_ANY); | ||
| 226 | } | ||
| 227 | } | ||
| 228 | |||
| 229 | function addSpreadParam(params: string[]): string[] { | ||
| 230 | if (spreadParam) { | ||
| 231 | const spread = "...(" + generateType(spreadParam, options) + ")[]"; | ||
| 232 | params.push(spread); | ||
| 233 | } | ||
| 234 | return params; | ||
| 235 | } | ||
| 236 | |||
| 237 | function paramsToString(params: string[]): string { | ||
| 238 | return "[" + params.join(", ") + "]"; | ||
| 239 | } | ||
| 240 | |||
| 241 | const paramsList = astParams.map((param) => generateType(param, options)); | ||
| 242 | |||
| 243 | if (paramsList.length > minItems) { | ||
| 244 | /* | ||
| 245 | if there are more items than the min, we return a union of tuples instead of | ||
| 246 | using the optional element operator. This is done because it is more typesafe. | ||
| 247 | |||
| 248 | // optional element operator | ||
| 249 | type A = [string, string?, string?] | ||
| 250 | const a: A = ['a', undefined, 'c'] // no error | ||
| 251 | |||
| 252 | // union of tuples | ||
| 253 | type B = [string] | [string, string] | [string, string, string] | ||
| 254 | const b: B = ['a', undefined, 'c'] // TS error | ||
| 255 | */ | ||
| 256 | |||
| 257 | const cumulativeParamsList: string[] = paramsList.slice(0, minItems); | ||
| 258 | const typesToUnion: string[] = []; | ||
| 259 | |||
| 260 | if (cumulativeParamsList.length > 0) { | ||
| 261 | // actually has minItems, so add the initial state | ||
| 262 | typesToUnion.push(paramsToString(cumulativeParamsList)); | ||
| 263 | } else { | ||
| 264 | // no minItems means it's acceptable to have an empty tuple type | ||
| 265 | typesToUnion.push(paramsToString([])); | ||
| 266 | } | ||
| 267 | |||
| 268 | for (let i = minItems; i < paramsList.length; i += 1) { | ||
| 269 | cumulativeParamsList.push(paramsList[i]); | ||
| 270 | |||
| 271 | if (i === paramsList.length - 1) { | ||
| 272 | // only the last item in the union should have the spread parameter | ||
| 273 | addSpreadParam(cumulativeParamsList); | ||
| 274 | } | ||
| 275 | |||
| 276 | typesToUnion.push(paramsToString(cumulativeParamsList)); | ||
| 277 | } | ||
| 278 | |||
| 279 | return typesToUnion.join("|"); | ||
| 280 | } | ||
| 281 | |||
| 282 | // no max items so only need to return one type | ||
| 283 | return paramsToString(addSpreadParam(paramsList)); | ||
| 284 | })(); | ||
| 285 | case "UNION": | ||
| 286 | return generateSetOperation(ast, options); | ||
| 287 | case "UNKNOWN": | ||
| 288 | return "unknown"; | ||
| 289 | case "CUSTOM_TYPE": | ||
| 290 | return ast.params; | ||
| 291 | } | ||
| 292 | } | ||
| 293 | |||
| 294 | /** | ||
| 295 | * Generate a Union or Intersection | ||
| 296 | */ | ||
| 297 | function generateSetOperation(ast: TIntersection | TUnion, options: Options): string { | ||
| 298 | const members = (ast as TUnion).params.map((_) => generateType(_, options)); | ||
| 299 | const separator = ast.type === "UNION" ? "|" : "&"; | ||
| 300 | return members.length === 1 ? members[0] : "(" + members.join(" " + separator + " ") + ")"; | ||
| 301 | } | ||
| 302 | |||
| 303 | function generateInterface(ast: TInterface, options: Options): string { | ||
| 304 | return ( | ||
| 305 | `{` + | ||
| 306 | "\n" + | ||
| 307 | ast.params | ||
| 308 | .filter((_) => !_.isPatternProperty && !_.isUnreachableDefinition) | ||
| 309 | .map( | ||
| 310 | ({ isRequired, keyName, ast }) => | ||
| 311 | [isRequired, keyName, ast, generateType(ast, options)] as [boolean, string, AST, string], | ||
| 312 | ) | ||
| 313 | .map( | ||
| 314 | ([isRequired, keyName, ast, type]) => | ||
| 315 | (hasComment(ast) && !ast.standaloneName | ||
| 316 | ? generateComment(ast.comment, ast.deprecated) + "\n" | ||
| 317 | : "") + | ||
| 318 | escapeKeyName(keyName) + | ||
| 319 | (isRequired ? "" : "?") + | ||
| 320 | ": " + | ||
| 321 | type, | ||
| 322 | ) | ||
| 323 | .join("\n") + | ||
| 324 | "\n" + | ||
| 325 | "}" | ||
| 326 | ); | ||
| 327 | } | ||
| 328 | |||
| 329 | function generateComment(comment?: string, deprecated?: boolean): string { | ||
| 330 | const commentLines = ["/**"]; | ||
| 331 | if (deprecated) { | ||
| 332 | commentLines.push(" * @deprecated"); | ||
| 333 | } | ||
| 334 | if (typeof comment !== "undefined") { | ||
| 335 | commentLines.push(...comment.split("\n").map((_) => " * " + _)); | ||
| 336 | } | ||
| 337 | commentLines.push(" */"); | ||
| 338 | return commentLines.join("\n"); | ||
| 339 | } | ||
| 340 | |||
| 341 | function generateStandaloneEnum(ast: TEnum, options: Options): string { | ||
| 342 | const containsSpecialCharacters = (key: string): boolean => /[^a-zA-Z0-9_]/.test(key); | ||
| 343 | |||
| 344 | return ( | ||
| 345 | (hasComment(ast) ? generateComment(ast.comment, ast.deprecated) + "\n" : "") + | ||
| 346 | "export " + | ||
| 347 | (options.enableConstEnums ? "const " : "") + | ||
| 348 | `enum ${toSafeString(ast.standaloneName)} {` + | ||
| 349 | "\n" + | ||
| 350 | ast.params | ||
| 351 | .map( | ||
| 352 | ({ ast, keyName }) => | ||
| 353 | (containsSpecialCharacters(keyName) ? `"${keyName}"` : keyName) + | ||
| 354 | " = " + | ||
| 355 | generateType(ast, options), | ||
| 356 | ) | ||
| 357 | .join(",\n") + | ||
| 358 | "\n" + | ||
| 359 | "}" | ||
| 360 | ); | ||
| 361 | } | ||
| 362 | |||
| 363 | function generateStandaloneInterface(ast: TNamedInterface, options: Options): string { | ||
| 364 | return ( | ||
| 365 | (hasComment(ast) ? generateComment(ast.comment, ast.deprecated) + "\n" : "") + | ||
| 366 | `export interface ${toSafeString(ast.standaloneName)} ` + | ||
| 367 | (ast.superTypes.length > 0 | ||
| 368 | ? `extends ${ast.superTypes.map((superType) => toSafeString(superType.standaloneName)).join(", ")} ` | ||
| 369 | : "") + | ||
| 370 | generateInterface(ast, options) | ||
| 371 | ); | ||
| 372 | } | ||
| 373 | |||
| 374 | function generateStandaloneType(ast: ASTWithStandaloneName, options: Options): string { | ||
| 375 | return ( | ||
| 376 | (hasComment(ast) ? generateComment(ast.comment) + "\n" : "") + | ||
| 377 | `export type ${toSafeString(ast.standaloneName)} = ${generateType( | ||
| 378 | omit(ast, "standaloneName") as AST /* TODO */, | ||
| 379 | options, | ||
| 380 | )}` | ||
| 381 | ); | ||
| 382 | } | ||
| 383 | |||
| 384 | function escapeKeyName(keyName: string): string { | ||
| 385 | if (keyName.length && /[A-Za-z_$]/.test(keyName.charAt(0)) && /^[\w$]+$/.test(keyName)) { | ||
| 386 | return keyName; | ||
| 387 | } | ||
| 388 | if (keyName === "[k: string]") { | ||
| 389 | return keyName; | ||
| 390 | } | ||
| 391 | return JSON.stringify(keyName); | ||
| 392 | } | ||
| 393 | |||
| 394 | function getSuperTypesAndParams(ast: TInterface): AST[] { | ||
| 395 | return ast.params.map((param) => param.ast).concat(ast.superTypes); | ||
| 396 | } | ||
| @@ -0,0 +1,166 @@ | |||
| 1 | import type { JSONSchema4 } from "./types/json-schema"; | ||
| 2 | import { cloneDeep, merge } from "./compat"; | ||
| 3 | import { format } from "./formatter"; | ||
| 4 | import { generate } from "./generator"; | ||
| 5 | import { normalize } from "./normalizer"; | ||
| 6 | import { optimize } from "./optimizer"; | ||
| 7 | import { parse } from "./parser"; | ||
| 8 | import { dereference } from "./resolver"; | ||
| 9 | import { validate } from "./validator"; | ||
| 10 | import { link } from "./linker"; | ||
| 11 | import { validateOptions } from "./optionValidator"; | ||
| 12 | import type { JSONSchema as LinkedJSONSchema } from "./types/JSONSchema"; | ||
| 13 | |||
| 14 | export type { | ||
| 15 | EnumJSONSchema, | ||
| 16 | JSONSchema, | ||
| 17 | NamedEnumJSONSchema, | ||
| 18 | CustomTypeJSONSchema, | ||
| 19 | } from "./types/JSONSchema"; | ||
| 20 | |||
| 21 | export interface FormatOptions { | ||
| 22 | bracketSpacing?: boolean; | ||
| 23 | printWidth?: number; | ||
| 24 | semi?: boolean; | ||
| 25 | singleQuote?: boolean; | ||
| 26 | tabWidth?: number; | ||
| 27 | trailingComma?: "none" | "es5" | "all"; | ||
| 28 | useTabs?: boolean; | ||
| 29 | } | ||
| 30 | |||
| 31 | export type RefOptions = Record<string, unknown>; | ||
| 32 | |||
| 33 | export interface Options { | ||
| 34 | /** | ||
| 35 | * Preserved for upstream API compatibility. | ||
| 36 | * | ||
| 37 | * Executor's vendored compiler only resolves same-document JSON Pointer | ||
| 38 | * `$ref`s and never fetches or reads external references, so this option is | ||
| 39 | * accepted but ignored. | ||
| 40 | */ | ||
| 41 | $refOptions: RefOptions; | ||
| 42 | /** | ||
| 43 | * Default value for additionalProperties, when it is not explicitly set. | ||
| 44 | */ | ||
| 45 | additionalProperties: boolean; | ||
| 46 | /** | ||
| 47 | * Disclaimer comment prepended to the top of each generated file. | ||
| 48 | */ | ||
| 49 | bannerComment: string; | ||
| 50 | /** | ||
| 51 | * Custom function to provide a type name for a given schema | ||
| 52 | */ | ||
| 53 | customName?: ( | ||
| 54 | schema: LinkedJSONSchema, | ||
| 55 | keyNameFromDefinition: string | undefined, | ||
| 56 | ) => string | undefined; | ||
| 57 | /** | ||
| 58 | * Preserved for upstream API compatibility. External refs are not resolved, | ||
| 59 | * so this option is accepted but ignored. | ||
| 60 | */ | ||
| 61 | cwd: string; | ||
| 62 | /** | ||
| 63 | * Declare external schemas referenced via `$ref`? | ||
| 64 | */ | ||
| 65 | declareExternallyReferenced: boolean; | ||
| 66 | /** | ||
| 67 | * Prepend enums with [`const`](https://www.typescriptlang.org/docs/handbook/enums.html#computed-and-constant-members)? | ||
| 68 | */ | ||
| 69 | enableConstEnums: boolean; | ||
| 70 | /** | ||
| 71 | * Create enums from JSON enums with eponymous keys | ||
| 72 | */ | ||
| 73 | inferStringEnumKeysFromValues: boolean; | ||
| 74 | /** | ||
| 75 | * Format code? Preserved for upstream API compatibility. | ||
| 76 | * | ||
| 77 | * Executor's vendored compiler does not bundle a formatter, so this option is | ||
| 78 | * accepted but does not change output. | ||
| 79 | */ | ||
| 80 | format: boolean; | ||
| 81 | /** | ||
| 82 | * Ignore maxItems and minItems for `array` types, preventing tuples being generated. | ||
| 83 | */ | ||
| 84 | ignoreMinAndMaxItems: boolean; | ||
| 85 | /** | ||
| 86 | * Maximum number of unioned tuples to emit when representing bounded-size array types, | ||
| 87 | * before falling back to emitting unbounded arrays. Increase this to improve precision | ||
| 88 | * of emitted types, decrease it to improve performance, or set it to `-1` to ignore | ||
| 89 | * `minItems` and `maxItems`. | ||
| 90 | */ | ||
| 91 | maxItems: number; | ||
| 92 | /** | ||
| 93 | * Append all index signatures with `| undefined` so that they are strictly typed. | ||
| 94 | * | ||
| 95 | * This is required to be compatible with `strictNullChecks`. | ||
| 96 | */ | ||
| 97 | strictIndexSignatures: boolean; | ||
| 98 | /** | ||
| 99 | * Formatting configuration. Preserved for upstream API compatibility. | ||
| 100 | */ | ||
| 101 | style: FormatOptions; | ||
| 102 | /** | ||
| 103 | * Generate code for `definitions` that aren't referenced by the schema? | ||
| 104 | */ | ||
| 105 | unreachableDefinitions: boolean; | ||
| 106 | /** | ||
| 107 | * Generate unknown type instead of any | ||
| 108 | */ | ||
| 109 | unknownAny: boolean; | ||
| 110 | } | ||
| 111 | |||
| 112 | export const DEFAULT_OPTIONS: Options = { | ||
| 113 | $refOptions: {}, | ||
| 114 | additionalProperties: true, // TODO: default to empty schema (as per spec) instead | ||
| 115 | bannerComment: `/* eslint-disable */ | ||
| 116 | /** | ||
| 117 | * This file was automatically generated by json-schema-to-typescript. | ||
| 118 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, | ||
| 119 | * and run json-schema-to-typescript to regenerate this file. | ||
| 120 | */`, | ||
| 121 | cwd: "", | ||
| 122 | declareExternallyReferenced: true, | ||
| 123 | enableConstEnums: true, | ||
| 124 | inferStringEnumKeysFromValues: false, | ||
| 125 | format: false, | ||
| 126 | ignoreMinAndMaxItems: false, | ||
| 127 | maxItems: 20, | ||
| 128 | strictIndexSignatures: false, | ||
| 129 | style: { | ||
| 130 | bracketSpacing: false, | ||
| 131 | printWidth: 120, | ||
| 132 | semi: true, | ||
| 133 | singleQuote: false, | ||
| 134 | tabWidth: 2, | ||
| 135 | trailingComma: "none", | ||
| 136 | useTabs: false, | ||
| 137 | }, | ||
| 138 | unreachableDefinitions: false, | ||
| 139 | unknownAny: true, | ||
| 140 | }; | ||
| 141 | |||
| 142 | export function compile(schema: JSONSchema4, name: string, options: Partial<Options> = {}): string { | ||
| 143 | validateOptions(options); | ||
| 144 | |||
| 145 | const _options = merge({} as Options, DEFAULT_OPTIONS, options); | ||
| 146 | |||
| 147 | // Initial clone to avoid mutating the input | ||
| 148 | const _schema = cloneDeep(schema); | ||
| 149 | |||
| 150 | const { dereferencedPaths, dereferencedSchema } = dereference(_schema); | ||
| 151 | const linked = link(dereferencedSchema); | ||
| 152 | const errors = validate(linked, name); | ||
| 153 | if (errors.length) { | ||
| 154 | throw new ValidationError(errors.join("\n")); | ||
| 155 | } | ||
| 156 | |||
| 157 | const normalized = normalize(linked, dereferencedPaths, name, _options); | ||
| 158 | const parsed = parse(normalized, _options); | ||
| 159 | const optimized = optimize(parsed, _options); | ||
| 160 | const generated = generate(optimized, _options); | ||
| 161 | const formatted = format(generated, _options); | ||
| 162 | |||
| 163 | return formatted; | ||
| 164 | } | ||
| 165 | |||
| 166 | export class ValidationError extends Error {} | ||
| @@ -0,0 +1,41 @@ | |||
| 1 | import { Parent } from "./types/JSONSchema"; | ||
| 2 | import type { JSONSchema, LinkedJSONSchema } from "./types/JSONSchema"; | ||
| 3 | import { isPlainObject } from "./compat"; | ||
| 4 | import type { JSONSchema4Type } from "./types/json-schema"; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * Traverses over the schema, giving each node a reference to its | ||
| 8 | * parent node. We need this for downstream operations. | ||
| 9 | */ | ||
| 10 | export function link( | ||
| 11 | schema: JSONSchema4Type | JSONSchema, | ||
| 12 | parent: JSONSchema4Type | null = null, | ||
| 13 | ): LinkedJSONSchema { | ||
| 14 | if (!Array.isArray(schema) && !isPlainObject(schema)) { | ||
| 15 | return schema as LinkedJSONSchema; | ||
| 16 | } | ||
| 17 | |||
| 18 | // Handle cycles | ||
| 19 | if ((schema as JSONSchema).hasOwnProperty(Parent)) { | ||
| 20 | return schema as LinkedJSONSchema; | ||
| 21 | } | ||
| 22 | |||
| 23 | // Add a reference to this schema's parent | ||
| 24 | Object.defineProperty(schema, Parent, { | ||
| 25 | enumerable: false, | ||
| 26 | value: parent, | ||
| 27 | writable: false, | ||
| 28 | }); | ||
| 29 | |||
| 30 | // Arrays | ||
| 31 | if (Array.isArray(schema)) { | ||
| 32 | schema.forEach((child) => link(child, schema)); | ||
| 33 | } | ||
| 34 | |||
| 35 | // Objects | ||
| 36 | for (const key in schema as JSONSchema) { | ||
| 37 | link((schema as JSONSchema)[key], schema); | ||
| 38 | } | ||
| 39 | |||
| 40 | return schema as LinkedJSONSchema; | ||
| 41 | } | ||
| @@ -0,0 +1,306 @@ | |||
| 1 | import { Parent } from "./types/JSONSchema"; | ||
| 2 | import type { | ||
| 3 | JSONSchemaTypeName, | ||
| 4 | LinkedJSONSchema, | ||
| 5 | NormalizedJSONSchema, | ||
| 6 | } from "./types/JSONSchema"; | ||
| 7 | import { | ||
| 8 | appendToDescription, | ||
| 9 | escapeBlockComment, | ||
| 10 | isSchemaLike, | ||
| 11 | justName, | ||
| 12 | toSafeString, | ||
| 13 | traverse, | ||
| 14 | } from "./utils"; | ||
| 15 | import type { Options } from "./"; | ||
| 16 | import { applySchemaTyping } from "./applySchemaTyping"; | ||
| 17 | import type { DereferencedPaths } from "./resolver"; | ||
| 18 | |||
| 19 | const isJsonEqual = (left: unknown, right: unknown): boolean => { | ||
| 20 | if (left === right) return true; | ||
| 21 | if (typeof left !== typeof right) return false; | ||
| 22 | if (left === null || right === null) return false; | ||
| 23 | if (typeof left !== "object" || typeof right !== "object") return false; | ||
| 24 | |||
| 25 | if (Array.isArray(left) || Array.isArray(right)) { | ||
| 26 | if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) { | ||
| 27 | return false; | ||
| 28 | } | ||
| 29 | return left.every((value, index) => isJsonEqual(value, right[index])); | ||
| 30 | } | ||
| 31 | |||
| 32 | const leftRecord = left as Record<string, unknown>; | ||
| 33 | const rightRecord = right as Record<string, unknown>; | ||
| 34 | const leftKeys = Object.keys(leftRecord); | ||
| 35 | const rightKeys = Object.keys(rightRecord); | ||
| 36 | if (leftKeys.length !== rightKeys.length) return false; | ||
| 37 | |||
| 38 | return leftKeys.every( | ||
| 39 | (key) => Object.hasOwn(rightRecord, key) && isJsonEqual(leftRecord[key], rightRecord[key]), | ||
| 40 | ); | ||
| 41 | }; | ||
| 42 | |||
| 43 | type Rule = ( | ||
| 44 | schema: LinkedJSONSchema, | ||
| 45 | fileName: string, | ||
| 46 | options: Options, | ||
| 47 | key: string | null, | ||
| 48 | dereferencedPaths: DereferencedPaths, | ||
| 49 | ) => void; | ||
| 50 | const rules = new Map<string, Rule>(); | ||
| 51 | |||
| 52 | function hasType(schema: LinkedJSONSchema, type: JSONSchemaTypeName) { | ||
| 53 | return schema.type === type || (Array.isArray(schema.type) && schema.type.includes(type)); | ||
| 54 | } | ||
| 55 | function isObjectType(schema: LinkedJSONSchema) { | ||
| 56 | return schema.properties !== undefined || hasType(schema, "object") || hasType(schema, "any"); | ||
| 57 | } | ||
| 58 | function isArrayType(schema: LinkedJSONSchema) { | ||
| 59 | return schema.items !== undefined || hasType(schema, "array") || hasType(schema, "any"); | ||
| 60 | } | ||
| 61 | function isEnumTypeWithoutTsEnumNames(schema: LinkedJSONSchema) { | ||
| 62 | return schema.type === "string" && schema.enum !== undefined && schema.tsEnumNames === undefined; | ||
| 63 | } | ||
| 64 | |||
| 65 | rules.set('Remove `type=["null"]` if `enum=[null]`', (schema) => { | ||
| 66 | if ( | ||
| 67 | Array.isArray(schema.enum) && | ||
| 68 | schema.enum.some((e) => e === null) && | ||
| 69 | Array.isArray(schema.type) && | ||
| 70 | schema.type.includes("null") | ||
| 71 | ) { | ||
| 72 | schema.type = schema.type.filter((type) => type !== "null"); | ||
| 73 | } | ||
| 74 | }); | ||
| 75 | |||
| 76 | rules.set("Destructure unary types", (schema) => { | ||
| 77 | if (schema.type && Array.isArray(schema.type) && schema.type.length === 1) { | ||
| 78 | schema.type = schema.type[0]; | ||
| 79 | } | ||
| 80 | }); | ||
| 81 | |||
| 82 | rules.set("Add empty `required` property if none is defined", (schema) => { | ||
| 83 | if (isObjectType(schema) && !("required" in schema)) { | ||
| 84 | schema.required = []; | ||
| 85 | } | ||
| 86 | }); | ||
| 87 | |||
| 88 | rules.set("Transform `required`=false to `required`=[]", (schema) => { | ||
| 89 | if (schema.required === false) { | ||
| 90 | schema.required = []; | ||
| 91 | } | ||
| 92 | }); | ||
| 93 | |||
| 94 | rules.set("Default additionalProperties", (schema, _, options) => { | ||
| 95 | if ( | ||
| 96 | isObjectType(schema) && | ||
| 97 | !("additionalProperties" in schema) && | ||
| 98 | schema.patternProperties === undefined | ||
| 99 | ) { | ||
| 100 | schema.additionalProperties = options.additionalProperties; | ||
| 101 | } | ||
| 102 | }); | ||
| 103 | |||
| 104 | rules.set("Transform id to $id", (schema, fileName) => { | ||
| 105 | if (!isSchemaLike(schema)) { | ||
| 106 | return; | ||
| 107 | } | ||
| 108 | if (schema.id && schema.$id && schema.id !== schema.$id) { | ||
| 109 | throw ReferenceError( | ||
| 110 | `Schema must define either id or $id, not both. Given id=${schema.id}, $id=${schema.$id} in ${fileName}`, | ||
| 111 | ); | ||
| 112 | } | ||
| 113 | if (schema.id) { | ||
| 114 | schema.$id = schema.id; | ||
| 115 | delete schema.id; | ||
| 116 | } | ||
| 117 | }); | ||
| 118 | |||
| 119 | rules.set( | ||
| 120 | "Add an $id to anything that needs it", | ||
| 121 | (schema, fileName, _options, _key, dereferencedPaths) => { | ||
| 122 | if (!isSchemaLike(schema)) { | ||
| 123 | return; | ||
| 124 | } | ||
| 125 | |||
| 126 | // Top-level schema | ||
| 127 | if (!schema.$id && !schema[Parent]) { | ||
| 128 | schema.$id = toSafeString(justName(fileName)); | ||
| 129 | return; | ||
| 130 | } | ||
| 131 | |||
| 132 | // Sub-schemas with references | ||
| 133 | if (!isArrayType(schema) && !isObjectType(schema)) { | ||
| 134 | return; | ||
| 135 | } | ||
| 136 | |||
| 137 | // We'll infer from $id and title downstream | ||
| 138 | // TODO: Normalize upstream | ||
| 139 | const dereferencedName = dereferencedPaths.get(schema); | ||
| 140 | if (!schema.$id && !schema.title && dereferencedName) { | ||
| 141 | schema.$id = toSafeString(justName(dereferencedName)); | ||
| 142 | } | ||
| 143 | |||
| 144 | if (dereferencedName) { | ||
| 145 | dereferencedPaths.delete(schema); | ||
| 146 | } | ||
| 147 | }, | ||
| 148 | ); | ||
| 149 | |||
| 150 | rules.set("Escape closing JSDoc comment", (schema) => { | ||
| 151 | escapeBlockComment(schema); | ||
| 152 | }); | ||
| 153 | |||
| 154 | rules.set("Add JSDoc comments for minItems and maxItems", (schema) => { | ||
| 155 | if (!isArrayType(schema)) { | ||
| 156 | return; | ||
| 157 | } | ||
| 158 | const commentsToAppend = [ | ||
| 159 | "minItems" in schema ? `@minItems ${schema.minItems}` : "", | ||
| 160 | "maxItems" in schema ? `@maxItems ${schema.maxItems}` : "", | ||
| 161 | ].filter(Boolean); | ||
| 162 | if (commentsToAppend.length) { | ||
| 163 | schema.description = appendToDescription(schema.description, ...commentsToAppend); | ||
| 164 | } | ||
| 165 | }); | ||
| 166 | |||
| 167 | rules.set("Optionally remove maxItems and minItems", (schema, _fileName, options) => { | ||
| 168 | if (!isArrayType(schema)) { | ||
| 169 | return; | ||
| 170 | } | ||
| 171 | if ("minItems" in schema && options.ignoreMinAndMaxItems) { | ||
| 172 | delete schema.minItems; | ||
| 173 | } | ||
| 174 | if ("maxItems" in schema && (options.ignoreMinAndMaxItems || options.maxItems === -1)) { | ||
| 175 | delete schema.maxItems; | ||
| 176 | } | ||
| 177 | }); | ||
| 178 | |||
| 179 | rules.set("Normalize schema.minItems", (schema, _fileName, options) => { | ||
| 180 | if (options.ignoreMinAndMaxItems) { | ||
| 181 | return; | ||
| 182 | } | ||
| 183 | // make sure we only add the props onto array types | ||
| 184 | if (!isArrayType(schema)) { | ||
| 185 | return; | ||
| 186 | } | ||
| 187 | const { minItems } = schema; | ||
| 188 | schema.minItems = typeof minItems === "number" ? minItems : 0; | ||
| 189 | // cannot normalize maxItems because maxItems = 0 has an actual meaning | ||
| 190 | }); | ||
| 191 | |||
| 192 | rules.set( | ||
| 193 | "Remove maxItems if it is big enough to likely cause OOMs", | ||
| 194 | (schema, _fileName, options) => { | ||
| 195 | if (options.ignoreMinAndMaxItems || options.maxItems === -1) { | ||
| 196 | return; | ||
| 197 | } | ||
| 198 | if (!isArrayType(schema)) { | ||
| 199 | return; | ||
| 200 | } | ||
| 201 | const { maxItems, minItems } = schema; | ||
| 202 | // minItems is guaranteed to be a number after the previous rule runs | ||
| 203 | if (maxItems !== undefined && maxItems - (minItems as number) > options.maxItems) { | ||
| 204 | delete schema.maxItems; | ||
| 205 | } | ||
| 206 | }, | ||
| 207 | ); | ||
| 208 | |||
| 209 | rules.set("Normalize schema.items", (schema, _fileName, options) => { | ||
| 210 | if (options.ignoreMinAndMaxItems) { | ||
| 211 | return; | ||
| 212 | } | ||
| 213 | const { maxItems, minItems } = schema; | ||
| 214 | const hasMaxItems = typeof maxItems === "number" && maxItems >= 0; | ||
| 215 | const hasMinItems = typeof minItems === "number" && minItems > 0; | ||
| 216 | |||
| 217 | if (schema.items && !Array.isArray(schema.items) && (hasMaxItems || hasMinItems)) { | ||
| 218 | const items = schema.items; | ||
| 219 | // create a tuple of length N | ||
| 220 | const newItems = Array(maxItems || minItems || 0).fill(items); | ||
| 221 | if (!hasMaxItems) { | ||
| 222 | // if there is no maximum, then add a spread item to collect the rest | ||
| 223 | schema.additionalItems = items; | ||
| 224 | } | ||
| 225 | schema.items = newItems; | ||
| 226 | } | ||
| 227 | |||
| 228 | if (Array.isArray(schema.items) && hasMaxItems && maxItems! < schema.items.length) { | ||
| 229 | // it's perfectly valid to provide 5 item defs but require maxItems 1 | ||
| 230 | // obviously we shouldn't emit a type for items that aren't expected | ||
| 231 | schema.items = schema.items.slice(0, maxItems); | ||
| 232 | } | ||
| 233 | |||
| 234 | return schema; | ||
| 235 | }); | ||
| 236 | |||
| 237 | rules.set("Remove extends, if it is empty", (schema) => { | ||
| 238 | if (!schema.hasOwnProperty("extends")) { | ||
| 239 | return; | ||
| 240 | } | ||
| 241 | if (schema.extends == null || (Array.isArray(schema.extends) && schema.extends.length === 0)) { | ||
| 242 | delete schema.extends; | ||
| 243 | } | ||
| 244 | }); | ||
| 245 | |||
| 246 | rules.set("Make extends always an array, if it is defined", (schema) => { | ||
| 247 | if (schema.extends == null) { | ||
| 248 | return; | ||
| 249 | } | ||
| 250 | if (!Array.isArray(schema.extends)) { | ||
| 251 | schema.extends = [schema.extends]; | ||
| 252 | } | ||
| 253 | }); | ||
| 254 | |||
| 255 | rules.set("Transform definitions to $defs", (schema, fileName) => { | ||
| 256 | if (schema.definitions && schema.$defs && !isJsonEqual(schema.definitions, schema.$defs)) { | ||
| 257 | throw ReferenceError( | ||
| 258 | `Schema must define either definitions or $defs, not both. Given id=${schema.id} in ${fileName}`, | ||
| 259 | ); | ||
| 260 | } | ||
| 261 | if (schema.definitions) { | ||
| 262 | schema.$defs = schema.definitions; | ||
| 263 | delete schema.definitions; | ||
| 264 | } | ||
| 265 | }); | ||
| 266 | |||
| 267 | rules.set("Transform const to singleton enum", (schema) => { | ||
| 268 | if (schema.const !== undefined) { | ||
| 269 | schema.enum = [schema.const]; | ||
| 270 | delete schema.const; | ||
| 271 | } | ||
| 272 | }); | ||
| 273 | |||
| 274 | rules.set("Add tsEnumNames to enum types", (schema, _, options) => { | ||
| 275 | if (isEnumTypeWithoutTsEnumNames(schema) && options.inferStringEnumKeysFromValues) { | ||
| 276 | schema.tsEnumNames = schema.enum?.map(String); | ||
| 277 | } | ||
| 278 | }); | ||
| 279 | |||
| 280 | // Precalculation of the schema types is necessary because the ALL_OF type | ||
| 281 | // is implemented in a way that mutates the schema object. Detection of the | ||
| 282 | // NAMED_SCHEMA type relies on the presence of the $id property, which is | ||
| 283 | // hoisted to a parent schema object during the ALL_OF type implementation, | ||
| 284 | // and becomes unavailable if the same schema is used in multiple places. | ||
| 285 | // | ||
| 286 | // Precalculation of the `ALL_OF` intersection schema is necessary because | ||
| 287 | // the intersection schema needs to participate in the schema cache during | ||
| 288 | // the parsing step, so it cannot be re-calculated every time the schema | ||
| 289 | // is encountered. | ||
| 290 | rules.set("Pre-calculate schema types and intersections", (schema) => { | ||
| 291 | if (schema !== null && typeof schema === "object") { | ||
| 292 | applySchemaTyping(schema); | ||
| 293 | } | ||
| 294 | }); | ||
| 295 | |||
| 296 | export function normalize( | ||
| 297 | rootSchema: LinkedJSONSchema, | ||
| 298 | dereferencedPaths: DereferencedPaths, | ||
| 299 | filename: string, | ||
| 300 | options: Options, | ||
| 301 | ): NormalizedJSONSchema { | ||
| 302 | rules.forEach((rule) => | ||
| 303 | traverse(rootSchema, (schema, key) => rule(schema, filename, options, key, dereferencedPaths)), | ||
| 304 | ); | ||
| 305 | return rootSchema as NormalizedJSONSchema; | ||
| 306 | } | ||
| @@ -0,0 +1,76 @@ | |||
| 1 | import { uniqBy } from "./compat"; | ||
| 2 | import type { Options } from "."; | ||
| 3 | import { generateType } from "./generator"; | ||
| 4 | import { T_ANY, T_UNKNOWN } from "./types/AST"; | ||
| 5 | import type { AST } from "./types/AST"; | ||
| 6 | |||
| 7 | export function optimize(ast: AST, options: Options, processed = new Set<AST>()): AST { | ||
| 8 | if (processed.has(ast)) { | ||
| 9 | return ast; | ||
| 10 | } | ||
| 11 | |||
| 12 | processed.add(ast); | ||
| 13 | |||
| 14 | switch (ast.type) { | ||
| 15 | case "ARRAY": | ||
| 16 | return Object.assign(ast, { | ||
| 17 | params: optimize(ast.params, options, processed), | ||
| 18 | }); | ||
| 19 | case "INTERFACE": | ||
| 20 | return Object.assign(ast, { | ||
| 21 | params: ast.params.map((_) => | ||
| 22 | Object.assign(_, { ast: optimize(_.ast, options, processed) }), | ||
| 23 | ), | ||
| 24 | }); | ||
| 25 | case "INTERSECTION": | ||
| 26 | case "UNION": | ||
| 27 | // Start with the leaves... | ||
| 28 | const optimizedAST = Object.assign(ast, { | ||
| 29 | params: ast.params.map((_) => optimize(_, options, processed)), | ||
| 30 | }); | ||
| 31 | |||
| 32 | // [A, B, C, Any] -> Any | ||
| 33 | if (optimizedAST.params.some((_) => _.type === "ANY")) { | ||
| 34 | return T_ANY; | ||
| 35 | } | ||
| 36 | |||
| 37 | // [A, B, C, Unknown] -> Unknown | ||
| 38 | if (optimizedAST.params.some((_) => _.type === "UNKNOWN")) { | ||
| 39 | return T_UNKNOWN; | ||
| 40 | } | ||
| 41 | |||
| 42 | // [A (named), A] -> [A (named)] | ||
| 43 | if ( | ||
| 44 | optimizedAST.params.every((_) => { | ||
| 45 | const a = generateType(omitStandaloneName(_), options); | ||
| 46 | const b = generateType(omitStandaloneName(optimizedAST.params[0]), options); | ||
| 47 | return a === b; | ||
| 48 | }) && | ||
| 49 | optimizedAST.params.some((_) => _.standaloneName !== undefined) | ||
| 50 | ) { | ||
| 51 | optimizedAST.params = optimizedAST.params.filter((_) => _.standaloneName !== undefined); | ||
| 52 | } | ||
| 53 | |||
| 54 | // [A, B, B] -> [A, B] | ||
| 55 | const params = uniqBy(optimizedAST.params, (_) => generateType(_, options)); | ||
| 56 | if (params.length !== optimizedAST.params.length) { | ||
| 57 | optimizedAST.params = params; | ||
| 58 | } | ||
| 59 | |||
| 60 | return Object.assign(optimizedAST, { | ||
| 61 | params: optimizedAST.params.map((_) => optimize(_, options, processed)), | ||
| 62 | }); | ||
| 63 | default: | ||
| 64 | return ast; | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | // TODO: More clearly disambiguate standalone names vs. aliased names instead. | ||
| 69 | function omitStandaloneName<A extends AST>(ast: A): A { | ||
| 70 | switch (ast.type) { | ||
| 71 | case "ENUM": | ||
| 72 | return ast; | ||
| 73 | default: | ||
| 74 | return { ...ast, standaloneName: undefined }; | ||
| 75 | } | ||
| 76 | } | ||
| @@ -0,0 +1,7 @@ | |||
| 1 | import type { Options } from "."; | ||
| 2 | |||
| 3 | export function validateOptions({ maxItems }: Partial<Options>): void { | ||
| 4 | if (maxItems !== undefined && maxItems < -1) { | ||
| 5 | throw RangeError(`Expected options.maxItems to be >= -1, but was given ${maxItems}.`); | ||
| 6 | } | ||
| 7 | } | ||
| @@ -0,0 +1,563 @@ | |||
| 1 | import type { JSONSchema4Type, JSONSchema4TypeName } from "./types/json-schema"; | ||
| 2 | import { findKey, isPlainObject, memoize, omit } from "./compat"; | ||
| 3 | import type { Options } from "./"; | ||
| 4 | import { applySchemaTyping } from "./applySchemaTyping"; | ||
| 5 | import type { | ||
| 6 | AST, | ||
| 7 | TInterface, | ||
| 8 | TInterfaceParam, | ||
| 9 | TIntersection, | ||
| 10 | TNamedInterface, | ||
| 11 | TTuple, | ||
| 12 | } from "./types/AST"; | ||
| 13 | import { | ||
| 14 | T_ANY, | ||
| 15 | T_ANY_ADDITIONAL_PROPERTIES, | ||
| 16 | T_UNKNOWN, | ||
| 17 | T_UNKNOWN_ADDITIONAL_PROPERTIES, | ||
| 18 | } from "./types/AST"; | ||
| 19 | import type { | ||
| 20 | EnumJSONSchema, | ||
| 21 | JSONSchemaWithDefinitions, | ||
| 22 | LinkedJSONSchema, | ||
| 23 | NormalizedJSONSchema, | ||
| 24 | SchemaSchema, | ||
| 25 | SchemaType, | ||
| 26 | } from "./types/JSONSchema"; | ||
| 27 | import { Intersection, Types, getRootSchema, isBoolean, isPrimitive } from "./types/JSONSchema"; | ||
| 28 | import { generateName, maybeStripDefault } from "./utils"; | ||
| 29 | |||
| 30 | export type Processed = Map<NormalizedJSONSchema, Map<SchemaType, AST>>; | ||
| 31 | |||
| 32 | export type UsedNames = Set<string>; | ||
| 33 | |||
| 34 | export function parse( | ||
| 35 | schema: NormalizedJSONSchema | JSONSchema4Type, | ||
| 36 | options: Options, | ||
| 37 | keyName?: string, | ||
| 38 | processed: Processed = new Map(), | ||
| 39 | usedNames = new Set<string>(), | ||
| 40 | ): AST { | ||
| 41 | if (isPrimitive(schema)) { | ||
| 42 | if (isBoolean(schema)) { | ||
| 43 | return parseBooleanSchema(schema, keyName, options); | ||
| 44 | } | ||
| 45 | |||
| 46 | return parseLiteral(schema, keyName); | ||
| 47 | } | ||
| 48 | |||
| 49 | const normalizedSchema = schema as NormalizedJSONSchema; | ||
| 50 | const intersection = normalizedSchema[Intersection]; | ||
| 51 | const types = normalizedSchema[Types]; | ||
| 52 | |||
| 53 | if (intersection) { | ||
| 54 | const ast = parseAsTypeWithCache( | ||
| 55 | intersection, | ||
| 56 | "ALL_OF", | ||
| 57 | options, | ||
| 58 | keyName, | ||
| 59 | processed, | ||
| 60 | usedNames, | ||
| 61 | ) as TIntersection; | ||
| 62 | |||
| 63 | types.forEach((type) => { | ||
| 64 | ast.params.push( | ||
| 65 | parseAsTypeWithCache(normalizedSchema, type, options, keyName, processed, usedNames), | ||
| 66 | ); | ||
| 67 | }); | ||
| 68 | |||
| 69 | return ast; | ||
| 70 | } | ||
| 71 | |||
| 72 | if (types.size === 1) { | ||
| 73 | const type = [...types][0]; | ||
| 74 | const ast = parseAsTypeWithCache( | ||
| 75 | normalizedSchema, | ||
| 76 | type, | ||
| 77 | options, | ||
| 78 | keyName, | ||
| 79 | processed, | ||
| 80 | usedNames, | ||
| 81 | ); | ||
| 82 | return ast; | ||
| 83 | } | ||
| 84 | |||
| 85 | throw new ReferenceError("Expected intersection schema. Please file an issue on GitHub."); | ||
| 86 | } | ||
| 87 | |||
| 88 | function parseAsTypeWithCache( | ||
| 89 | schema: NormalizedJSONSchema, | ||
| 90 | type: SchemaType, | ||
| 91 | options: Options, | ||
| 92 | keyName?: string, | ||
| 93 | processed: Processed = new Map(), | ||
| 94 | usedNames = new Set<string>(), | ||
| 95 | ): AST { | ||
| 96 | // If we've seen this node before, return it. | ||
| 97 | let cachedTypeMap = processed.get(schema); | ||
| 98 | if (!cachedTypeMap) { | ||
| 99 | cachedTypeMap = new Map(); | ||
| 100 | processed.set(schema, cachedTypeMap); | ||
| 101 | } | ||
| 102 | const cachedAST = cachedTypeMap.get(type); | ||
| 103 | if (cachedAST) { | ||
| 104 | return cachedAST; | ||
| 105 | } | ||
| 106 | |||
| 107 | // Cache processed ASTs before they are actually computed, then update | ||
| 108 | // them in place using set(). This is to avoid cycles. | ||
| 109 | // TODO: Investigate alternative approaches (lazy-computing nodes, etc.) | ||
| 110 | const ast = {} as AST; | ||
| 111 | cachedTypeMap.set(type, ast); | ||
| 112 | |||
| 113 | // Update the AST in place. This updates the `processed` cache, as well | ||
| 114 | // as any nodes that directly reference the node. | ||
| 115 | return Object.assign(ast, parseNonLiteral(schema, type, options, keyName, processed, usedNames)); | ||
| 116 | } | ||
| 117 | |||
| 118 | function parseBooleanSchema(schema: boolean, keyName: string | undefined, options: Options): AST { | ||
| 119 | if (schema) { | ||
| 120 | return { | ||
| 121 | keyName, | ||
| 122 | type: options.unknownAny ? "UNKNOWN" : "ANY", | ||
| 123 | }; | ||
| 124 | } | ||
| 125 | |||
| 126 | return { | ||
| 127 | keyName, | ||
| 128 | type: "NEVER", | ||
| 129 | }; | ||
| 130 | } | ||
| 131 | |||
| 132 | function parseLiteral(schema: JSONSchema4Type, keyName: string | undefined): AST { | ||
| 133 | return { | ||
| 134 | keyName, | ||
| 135 | params: schema, | ||
| 136 | type: "LITERAL", | ||
| 137 | }; | ||
| 138 | } | ||
| 139 | |||
| 140 | function parseNonLiteral( | ||
| 141 | schema: NormalizedJSONSchema, | ||
| 142 | type: SchemaType, | ||
| 143 | options: Options, | ||
| 144 | keyName: string | undefined, | ||
| 145 | processed: Processed, | ||
| 146 | usedNames: UsedNames, | ||
| 147 | ): AST { | ||
| 148 | const definitions = getDefinitionsMemoized(getRootSchema(schema as any)); // TODO | ||
| 149 | const keyNameFromDefinition = findKey(definitions, (_) => _ === schema); | ||
| 150 | |||
| 151 | switch (type) { | ||
| 152 | case "ALL_OF": | ||
| 153 | return { | ||
| 154 | comment: schema.description, | ||
| 155 | deprecated: schema.deprecated, | ||
| 156 | keyName, | ||
| 157 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 158 | params: schema.allOf!.map((_) => parse(_, options, undefined, processed, usedNames)), | ||
| 159 | type: "INTERSECTION", | ||
| 160 | }; | ||
| 161 | case "ANY": | ||
| 162 | return { | ||
| 163 | ...(options.unknownAny ? T_UNKNOWN : T_ANY), | ||
| 164 | comment: schema.description, | ||
| 165 | deprecated: schema.deprecated, | ||
| 166 | keyName, | ||
| 167 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 168 | }; | ||
| 169 | case "ANY_OF": | ||
| 170 | return { | ||
| 171 | comment: schema.description, | ||
| 172 | deprecated: schema.deprecated, | ||
| 173 | keyName, | ||
| 174 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 175 | params: schema.anyOf!.map((_) => parse(_, options, undefined, processed, usedNames)), | ||
| 176 | type: "UNION", | ||
| 177 | }; | ||
| 178 | case "BOOLEAN": | ||
| 179 | return { | ||
| 180 | comment: schema.description, | ||
| 181 | deprecated: schema.deprecated, | ||
| 182 | keyName, | ||
| 183 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 184 | type: "BOOLEAN", | ||
| 185 | }; | ||
| 186 | case "CUSTOM_TYPE": | ||
| 187 | return { | ||
| 188 | comment: schema.description, | ||
| 189 | deprecated: schema.deprecated, | ||
| 190 | keyName, | ||
| 191 | params: schema.tsType!, | ||
| 192 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 193 | type: "CUSTOM_TYPE", | ||
| 194 | }; | ||
| 195 | case "NAMED_ENUM": | ||
| 196 | return { | ||
| 197 | comment: schema.description, | ||
| 198 | deprecated: schema.deprecated, | ||
| 199 | keyName, | ||
| 200 | standaloneName: standaloneName( | ||
| 201 | schema, | ||
| 202 | keyNameFromDefinition ?? keyName, | ||
| 203 | usedNames, | ||
| 204 | options, | ||
| 205 | )!, | ||
| 206 | params: (schema as EnumJSONSchema).enum!.map((_, n) => ({ | ||
| 207 | ast: parseLiteral(_, undefined), | ||
| 208 | keyName: schema.tsEnumNames![n], | ||
| 209 | })), | ||
| 210 | type: "ENUM", | ||
| 211 | }; | ||
| 212 | case "NAMED_SCHEMA": | ||
| 213 | return newInterface(schema as SchemaSchema, options, processed, usedNames, keyName); | ||
| 214 | case "NEVER": | ||
| 215 | return { | ||
| 216 | comment: schema.description, | ||
| 217 | deprecated: schema.deprecated, | ||
| 218 | keyName, | ||
| 219 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 220 | type: "NEVER", | ||
| 221 | }; | ||
| 222 | case "NULL": | ||
| 223 | return { | ||
| 224 | comment: schema.description, | ||
| 225 | deprecated: schema.deprecated, | ||
| 226 | keyName, | ||
| 227 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 228 | type: "NULL", | ||
| 229 | }; | ||
| 230 | case "NUMBER": | ||
| 231 | return { | ||
| 232 | comment: schema.description, | ||
| 233 | deprecated: schema.deprecated, | ||
| 234 | keyName, | ||
| 235 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 236 | type: "NUMBER", | ||
| 237 | }; | ||
| 238 | case "OBJECT": | ||
| 239 | return { | ||
| 240 | comment: schema.description, | ||
| 241 | keyName, | ||
| 242 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 243 | type: "OBJECT", | ||
| 244 | deprecated: schema.deprecated, | ||
| 245 | }; | ||
| 246 | case "ONE_OF": | ||
| 247 | return { | ||
| 248 | comment: schema.description, | ||
| 249 | deprecated: schema.deprecated, | ||
| 250 | keyName, | ||
| 251 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 252 | params: schema.oneOf!.map((_) => parse(_, options, undefined, processed, usedNames)), | ||
| 253 | type: "UNION", | ||
| 254 | }; | ||
| 255 | case "REFERENCE": | ||
| 256 | throw Error("Refs should have been resolved by the resolver."); | ||
| 257 | case "STRING": | ||
| 258 | return { | ||
| 259 | comment: schema.description, | ||
| 260 | deprecated: schema.deprecated, | ||
| 261 | keyName, | ||
| 262 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 263 | type: "STRING", | ||
| 264 | }; | ||
| 265 | case "TYPED_ARRAY": | ||
| 266 | if (Array.isArray(schema.items)) { | ||
| 267 | // normalised to not be undefined | ||
| 268 | const minItems = schema.minItems!; | ||
| 269 | const maxItems = schema.maxItems!; | ||
| 270 | const arrayType: TTuple = { | ||
| 271 | comment: schema.description, | ||
| 272 | deprecated: schema.deprecated, | ||
| 273 | keyName, | ||
| 274 | maxItems, | ||
| 275 | minItems, | ||
| 276 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 277 | params: schema.items.map((_) => parse(_, options, undefined, processed, usedNames)), | ||
| 278 | type: "TUPLE", | ||
| 279 | }; | ||
| 280 | if (schema.additionalItems === true) { | ||
| 281 | arrayType.spreadParam = options.unknownAny ? T_UNKNOWN : T_ANY; | ||
| 282 | } else if (schema.additionalItems) { | ||
| 283 | arrayType.spreadParam = parse( | ||
| 284 | schema.additionalItems, | ||
| 285 | options, | ||
| 286 | undefined, | ||
| 287 | processed, | ||
| 288 | usedNames, | ||
| 289 | ); | ||
| 290 | } | ||
| 291 | return arrayType; | ||
| 292 | } else { | ||
| 293 | return { | ||
| 294 | comment: schema.description, | ||
| 295 | deprecated: schema.deprecated, | ||
| 296 | keyName, | ||
| 297 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 298 | params: parse( | ||
| 299 | schema.items!, | ||
| 300 | options, | ||
| 301 | `{keyNameFromDefinition}Items`, | ||
| 302 | processed, | ||
| 303 | usedNames, | ||
| 304 | ), | ||
| 305 | type: "ARRAY", | ||
| 306 | }; | ||
| 307 | } | ||
| 308 | case "UNION": | ||
| 309 | return { | ||
| 310 | comment: schema.description, | ||
| 311 | deprecated: schema.deprecated, | ||
| 312 | keyName, | ||
| 313 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 314 | params: (schema.type as JSONSchema4TypeName[]).map((type) => { | ||
| 315 | const member: LinkedJSONSchema = { ...omit(schema, "$id", "description", "title"), type }; | ||
| 316 | maybeStripDefault(member); | ||
| 317 | applySchemaTyping(member); | ||
| 318 | return parse(member, options, undefined, processed, usedNames); | ||
| 319 | }), | ||
| 320 | type: "UNION", | ||
| 321 | }; | ||
| 322 | case "UNNAMED_ENUM": | ||
| 323 | return { | ||
| 324 | comment: schema.description, | ||
| 325 | deprecated: schema.deprecated, | ||
| 326 | keyName, | ||
| 327 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 328 | params: (schema as EnumJSONSchema).enum!.map((_) => parseLiteral(_, undefined)), | ||
| 329 | type: "UNION", | ||
| 330 | }; | ||
| 331 | case "UNNAMED_SCHEMA": | ||
| 332 | return newInterface( | ||
| 333 | schema as SchemaSchema, | ||
| 334 | options, | ||
| 335 | processed, | ||
| 336 | usedNames, | ||
| 337 | keyName, | ||
| 338 | keyNameFromDefinition, | ||
| 339 | ); | ||
| 340 | case "UNTYPED_ARRAY": | ||
| 341 | // normalised to not be undefined | ||
| 342 | const minItems = schema.minItems!; | ||
| 343 | const maxItems = typeof schema.maxItems === "number" ? schema.maxItems : -1; | ||
| 344 | const params = options.unknownAny ? T_UNKNOWN : T_ANY; | ||
| 345 | if (minItems > 0 || maxItems >= 0) { | ||
| 346 | return { | ||
| 347 | comment: schema.description, | ||
| 348 | deprecated: schema.deprecated, | ||
| 349 | keyName, | ||
| 350 | maxItems: schema.maxItems, | ||
| 351 | minItems, | ||
| 352 | // create a tuple of length N | ||
| 353 | params: Array(Math.max(maxItems, minItems) || 0).fill(params), | ||
| 354 | // if there is no maximum, then add a spread item to collect the rest | ||
| 355 | spreadParam: maxItems >= 0 ? undefined : params, | ||
| 356 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 357 | type: "TUPLE", | ||
| 358 | }; | ||
| 359 | } | ||
| 360 | |||
| 361 | return { | ||
| 362 | comment: schema.description, | ||
| 363 | deprecated: schema.deprecated, | ||
| 364 | keyName, | ||
| 365 | params, | ||
| 366 | standaloneName: standaloneName(schema, keyNameFromDefinition, usedNames, options), | ||
| 367 | type: "ARRAY", | ||
| 368 | }; | ||
| 369 | } | ||
| 370 | } | ||
| 371 | |||
| 372 | /** | ||
| 373 | * Compute a schema name using a series of fallbacks | ||
| 374 | */ | ||
| 375 | function standaloneName( | ||
| 376 | schema: NormalizedJSONSchema, | ||
| 377 | keyNameFromDefinition: string | undefined, | ||
| 378 | usedNames: UsedNames, | ||
| 379 | options: Options, | ||
| 380 | ): string | undefined { | ||
| 381 | const name = | ||
| 382 | options.customName?.(schema, keyNameFromDefinition) || | ||
| 383 | schema.title || | ||
| 384 | schema.$id || | ||
| 385 | keyNameFromDefinition; | ||
| 386 | if (name) { | ||
| 387 | return generateName(name, usedNames); | ||
| 388 | } | ||
| 389 | } | ||
| 390 | |||
| 391 | function newInterface( | ||
| 392 | schema: SchemaSchema, | ||
| 393 | options: Options, | ||
| 394 | processed: Processed, | ||
| 395 | usedNames: UsedNames, | ||
| 396 | keyName?: string, | ||
| 397 | keyNameFromDefinition?: string, | ||
| 398 | ): TInterface { | ||
| 399 | const name = standaloneName(schema, keyNameFromDefinition, usedNames, options)!; | ||
| 400 | return { | ||
| 401 | comment: schema.description, | ||
| 402 | deprecated: schema.deprecated, | ||
| 403 | keyName, | ||
| 404 | params: parseSchema(schema, options, processed, usedNames, name), | ||
| 405 | standaloneName: name, | ||
| 406 | superTypes: parseSuperTypes(schema, options, processed, usedNames), | ||
| 407 | type: "INTERFACE", | ||
| 408 | }; | ||
| 409 | } | ||
| 410 | |||
| 411 | function parseSuperTypes( | ||
| 412 | schema: SchemaSchema, | ||
| 413 | options: Options, | ||
| 414 | processed: Processed, | ||
| 415 | usedNames: UsedNames, | ||
| 416 | ): TNamedInterface[] { | ||
| 417 | // Type assertion needed because of dereferencing step | ||
| 418 | // TODO: Type it upstream | ||
| 419 | const superTypes = schema.extends as SchemaSchema[] | undefined; | ||
| 420 | if (!superTypes) { | ||
| 421 | return []; | ||
| 422 | } | ||
| 423 | return superTypes.map( | ||
| 424 | (_) => parse(_, options, undefined, processed, usedNames) as TNamedInterface, | ||
| 425 | ); | ||
| 426 | } | ||
| 427 | |||
| 428 | /** | ||
| 429 | * Helper to parse schema properties into params on the parent schema's type | ||
| 430 | */ | ||
| 431 | function parseSchema( | ||
| 432 | schema: SchemaSchema, | ||
| 433 | options: Options, | ||
| 434 | processed: Processed, | ||
| 435 | usedNames: UsedNames, | ||
| 436 | parentSchemaName: string, | ||
| 437 | ): TInterfaceParam[] { | ||
| 438 | const required = new Set(schema.required ?? []); | ||
| 439 | let asts: TInterfaceParam[] = Object.entries(schema.properties ?? {}).map(([key, value]) => ({ | ||
| 440 | ast: parse(value, options, key, processed, usedNames), | ||
| 441 | isPatternProperty: false, | ||
| 442 | isRequired: required.has(key), | ||
| 443 | isUnreachableDefinition: false, | ||
| 444 | keyName: key, | ||
| 445 | })); | ||
| 446 | |||
| 447 | let singlePatternProperty = false; | ||
| 448 | if (schema.patternProperties) { | ||
| 449 | // partially support patternProperties. in the case that | ||
| 450 | // additionalProperties is not set, and there is only a single | ||
| 451 | // value definition, we can validate against that. | ||
| 452 | singlePatternProperty = | ||
| 453 | !schema.additionalProperties && Object.keys(schema.patternProperties).length === 1; | ||
| 454 | |||
| 455 | asts = asts.concat( | ||
| 456 | Object.entries(schema.patternProperties).map(([key, value]) => { | ||
| 457 | const ast = parse(value, options, key, processed, usedNames); | ||
| 458 | const comment = `This interface was referenced by \`${parentSchemaName}\`'s JSON-Schema definition | ||
| 459 | via the \`patternProperty\` "${key.replace("*/", "*\\/")}".`; | ||
| 460 | ast.comment = ast.comment ? `${ast.comment}\n\n${comment}` : comment; | ||
| 461 | return { | ||
| 462 | ast, | ||
| 463 | isPatternProperty: !singlePatternProperty, | ||
| 464 | isRequired: singlePatternProperty || required.has(key), | ||
| 465 | isUnreachableDefinition: false, | ||
| 466 | keyName: singlePatternProperty ? "[k: string]" : key, | ||
| 467 | }; | ||
| 468 | }), | ||
| 469 | ); | ||
| 470 | } | ||
| 471 | |||
| 472 | if (options.unreachableDefinitions) { | ||
| 473 | asts = asts.concat( | ||
| 474 | Object.entries(schema.$defs ?? {}).map(([key, value]) => { | ||
| 475 | const ast = parse(value, options, key, processed, usedNames); | ||
| 476 | const comment = `This interface was referenced by \`${parentSchemaName}\`'s JSON-Schema | ||
| 477 | via the \`definition\` "${key}".`; | ||
| 478 | ast.comment = ast.comment ? `${ast.comment}\n\n${comment}` : comment; | ||
| 479 | return { | ||
| 480 | ast, | ||
| 481 | isPatternProperty: false, | ||
| 482 | isRequired: required.has(key), | ||
| 483 | isUnreachableDefinition: true, | ||
| 484 | keyName: key, | ||
| 485 | }; | ||
| 486 | }), | ||
| 487 | ); | ||
| 488 | } | ||
| 489 | |||
| 490 | // handle additionalProperties | ||
| 491 | switch (schema.additionalProperties) { | ||
| 492 | case undefined: | ||
| 493 | case true: | ||
| 494 | if (singlePatternProperty) { | ||
| 495 | return asts; | ||
| 496 | } | ||
| 497 | return asts.concat({ | ||
| 498 | ast: options.unknownAny ? T_UNKNOWN_ADDITIONAL_PROPERTIES : T_ANY_ADDITIONAL_PROPERTIES, | ||
| 499 | isPatternProperty: false, | ||
| 500 | isRequired: true, | ||
| 501 | isUnreachableDefinition: false, | ||
| 502 | keyName: "[k: string]", | ||
| 503 | }); | ||
| 504 | |||
| 505 | case false: | ||
| 506 | return asts; | ||
| 507 | |||
| 508 | // pass "true" as the last param because in TS, properties | ||
| 509 | // defined via index signatures are already optional | ||
| 510 | default: | ||
| 511 | return asts.concat({ | ||
| 512 | ast: parse(schema.additionalProperties, options, "[k: string]", processed, usedNames), | ||
| 513 | isPatternProperty: false, | ||
| 514 | isRequired: true, | ||
| 515 | isUnreachableDefinition: false, | ||
| 516 | keyName: "[k: string]", | ||
| 517 | }); | ||
| 518 | } | ||
| 519 | } | ||
| 520 | |||
| 521 | type Definitions = { [k: string]: NormalizedJSONSchema }; | ||
| 522 | |||
| 523 | function getDefinitions( | ||
| 524 | schema: NormalizedJSONSchema, | ||
| 525 | isSchema = true, | ||
| 526 | processed = new Set<NormalizedJSONSchema>(), | ||
| 527 | ): Definitions { | ||
| 528 | if (processed.has(schema)) { | ||
| 529 | return {}; | ||
| 530 | } | ||
| 531 | processed.add(schema); | ||
| 532 | if (Array.isArray(schema)) { | ||
| 533 | return schema.reduce( | ||
| 534 | (prev, cur) => ({ | ||
| 535 | ...prev, | ||
| 536 | ...getDefinitions(cur, false, processed), | ||
| 537 | }), | ||
| 538 | {}, | ||
| 539 | ); | ||
| 540 | } | ||
| 541 | if (isPlainObject(schema)) { | ||
| 542 | return { | ||
| 543 | ...(isSchema && hasDefinitions(schema) ? schema.$defs : {}), | ||
| 544 | ...Object.keys(schema).reduce<Definitions>( | ||
| 545 | (prev, cur) => ({ | ||
| 546 | ...prev, | ||
| 547 | ...getDefinitions(schema[cur], false, processed), | ||
| 548 | }), | ||
| 549 | {}, | ||
| 550 | ), | ||
| 551 | }; | ||
| 552 | } | ||
| 553 | return {}; | ||
| 554 | } | ||
| 555 | |||
| 556 | const getDefinitionsMemoized = memoize(getDefinitions); | ||
| 557 | |||
| 558 | /** | ||
| 559 | * TODO: Reduce rate of false positives | ||
| 560 | */ | ||
| 561 | function hasDefinitions(schema: NormalizedJSONSchema): schema is JSONSchemaWithDefinitions { | ||
| 562 | return "$defs" in schema; | ||
| 563 | } | ||
| @@ -0,0 +1,146 @@ | |||
| 1 | import type { JSONSchema } from "./types/JSONSchema"; | ||
| 2 | |||
| 3 | export type DereferencedPaths = WeakMap<JSONSchema, string>; | ||
| 4 | |||
| 5 | type RefCache = Map<string, unknown>; | ||
| 6 | type SeenCache = WeakMap<object, unknown>; | ||
| 7 | |||
| 8 | const isObject = (value: unknown): value is Record<string, unknown> => | ||
| 9 | value !== null && typeof value === "object"; | ||
| 10 | |||
| 11 | const decodePointerSegment = (segment: string): string => { | ||
| 12 | try { | ||
| 13 | return decodeURIComponent(segment).replace(/~1/g, "/").replace(/~0/g, "~"); | ||
| 14 | } catch { | ||
| 15 | throw new ReferenceError(`Invalid JSON Pointer segment "${segment}" in $ref`); | ||
| 16 | } | ||
| 17 | }; | ||
| 18 | |||
| 19 | const encodePointerSegment = (segment: string): string => | ||
| 20 | segment.replace(/~/g, "~0").replace(/\//g, "~1"); | ||
| 21 | |||
| 22 | const childPointer = (parent: string, key: string): string => | ||
| 23 | parent === "#" ? `#/${encodePointerSegment(key)}` : `${parent}/${encodePointerSegment(key)}`; | ||
| 24 | |||
| 25 | const normalizeLocalRef = (ref: string): string => { | ||
| 26 | if (ref === "#") return ref; | ||
| 27 | if (!ref.startsWith("#/")) { | ||
| 28 | throw new ReferenceError( | ||
| 29 | `Unsupported $ref "${ref}". Only same-document JSON Pointer refs are supported.`, | ||
| 30 | ); | ||
| 31 | } | ||
| 32 | return `#/${ref | ||
| 33 | .slice(2) | ||
| 34 | .split("/") | ||
| 35 | .map(decodePointerSegment) | ||
| 36 | .map(encodePointerSegment) | ||
| 37 | .join("/")}`; | ||
| 38 | }; | ||
| 39 | |||
| 40 | const resolvePointer = (root: unknown, ref: string): unknown => { | ||
| 41 | const pointer = normalizeLocalRef(ref); | ||
| 42 | if (pointer === "#") return root; | ||
| 43 | |||
| 44 | let current = root; | ||
| 45 | for (const rawSegment of pointer.slice(2).split("/")) { | ||
| 46 | const segment = decodePointerSegment(rawSegment); | ||
| 47 | if (!isObject(current) || !(segment in current)) { | ||
| 48 | throw new ReferenceError(`Unable to resolve $ref "${ref}"`); | ||
| 49 | } | ||
| 50 | current = current[segment]; | ||
| 51 | } | ||
| 52 | return current; | ||
| 53 | }; | ||
| 54 | |||
| 55 | const dereferenceNode = ( | ||
| 56 | root: JSONSchema, | ||
| 57 | node: unknown, | ||
| 58 | pointer: string, | ||
| 59 | dereferencedPaths: DereferencedPaths, | ||
| 60 | refCache: RefCache, | ||
| 61 | seenCache: SeenCache, | ||
| 62 | ): unknown => { | ||
| 63 | if (!isObject(node)) return node; | ||
| 64 | |||
| 65 | if (typeof node.$ref === "string") { | ||
| 66 | const ref = normalizeLocalRef(node.$ref); | ||
| 67 | const cached = refCache.get(ref); | ||
| 68 | if (cached) { | ||
| 69 | if (isObject(cached)) { | ||
| 70 | dereferencedPaths.set(cached as JSONSchema, ref); | ||
| 71 | } | ||
| 72 | return cached; | ||
| 73 | } | ||
| 74 | |||
| 75 | const target = resolvePointer(root, ref); | ||
| 76 | if (!isObject(target)) return target; | ||
| 77 | |||
| 78 | const targetClone: Record<string, unknown> | unknown[] = Array.isArray(target) ? [] : {}; | ||
| 79 | refCache.set(ref, targetClone); | ||
| 80 | seenCache.set(target, targetClone); | ||
| 81 | dereferencedPaths.set(targetClone as JSONSchema, ref); | ||
| 82 | |||
| 83 | const targetPointer = ref; | ||
| 84 | for (const [key, value] of Object.entries(target)) { | ||
| 85 | (targetClone as Record<string, unknown>)[key] = dereferenceNode( | ||
| 86 | root, | ||
| 87 | value, | ||
| 88 | childPointer(targetPointer, key), | ||
| 89 | dereferencedPaths, | ||
| 90 | refCache, | ||
| 91 | seenCache, | ||
| 92 | ); | ||
| 93 | } | ||
| 94 | return targetClone; | ||
| 95 | } | ||
| 96 | |||
| 97 | const seen = seenCache.get(node); | ||
| 98 | if (seen) return seen; | ||
| 99 | |||
| 100 | const clone: Record<string, unknown> | unknown[] = Array.isArray(node) ? [] : {}; | ||
| 101 | seenCache.set(node, clone); | ||
| 102 | refCache.set(pointer, clone); | ||
| 103 | |||
| 104 | if (Array.isArray(node)) { | ||
| 105 | node.forEach((value, index) => { | ||
| 106 | (clone as unknown[])[index] = dereferenceNode( | ||
| 107 | root, | ||
| 108 | value, | ||
| 109 | childPointer(pointer, String(index)), | ||
| 110 | dereferencedPaths, | ||
| 111 | refCache, | ||
| 112 | seenCache, | ||
| 113 | ); | ||
| 114 | }); | ||
| 115 | return clone; | ||
| 116 | } | ||
| 117 | |||
| 118 | for (const [key, value] of Object.entries(node)) { | ||
| 119 | (clone as Record<string, unknown>)[key] = dereferenceNode( | ||
| 120 | root, | ||
| 121 | value, | ||
| 122 | childPointer(pointer, key), | ||
| 123 | dereferencedPaths, | ||
| 124 | refCache, | ||
| 125 | seenCache, | ||
| 126 | ); | ||
| 127 | } | ||
| 128 | |||
| 129 | return clone; | ||
| 130 | }; | ||
| 131 | |||
| 132 | export function dereference(schema: JSONSchema): { | ||
| 133 | dereferencedPaths: DereferencedPaths; | ||
| 134 | dereferencedSchema: JSONSchema; | ||
| 135 | } { | ||
| 136 | const dereferencedPaths: DereferencedPaths = new WeakMap(); | ||
| 137 | const dereferencedSchema = dereferenceNode( | ||
| 138 | schema, | ||
| 139 | schema, | ||
| 140 | "#", | ||
| 141 | dereferencedPaths, | ||
| 142 | new Map(), | ||
| 143 | new WeakMap(), | ||
| 144 | ) as JSONSchema; | ||
| 145 | return { dereferencedPaths, dereferencedSchema }; | ||
| 146 | } | ||
| @@ -0,0 +1,171 @@ | |||
| 1 | import type { JSONSchema4Type } from "./json-schema"; | ||
| 2 | |||
| 3 | export type AST_TYPE = AST["type"]; | ||
| 4 | |||
| 5 | export type AST = | ||
| 6 | | TAny | ||
| 7 | | TArray | ||
| 8 | | TBoolean | ||
| 9 | | TEnum | ||
| 10 | | TInterface | ||
| 11 | | TNamedInterface | ||
| 12 | | TIntersection | ||
| 13 | | TLiteral | ||
| 14 | | TNever | ||
| 15 | | TNumber | ||
| 16 | | TNull | ||
| 17 | | TObject | ||
| 18 | | TReference | ||
| 19 | | TString | ||
| 20 | | TTuple | ||
| 21 | | TUnion | ||
| 22 | | TUnknown | ||
| 23 | | TCustomType; | ||
| 24 | |||
| 25 | export interface AbstractAST { | ||
| 26 | comment?: string; | ||
| 27 | keyName?: string; | ||
| 28 | standaloneName?: string; | ||
| 29 | type: AST_TYPE; | ||
| 30 | deprecated?: boolean; | ||
| 31 | } | ||
| 32 | |||
| 33 | export type ASTWithComment = AST & { comment: string }; | ||
| 34 | export type ASTWithName = AST & { keyName: string }; | ||
| 35 | export type ASTWithStandaloneName = AST & { standaloneName: string }; | ||
| 36 | |||
| 37 | export function hasComment(ast: AST): ast is ASTWithComment { | ||
| 38 | return ( | ||
| 39 | ("comment" in ast && ast.comment != null && ast.comment !== "") || | ||
| 40 | // Compare to true because ast.deprecated might be undefined | ||
| 41 | ("deprecated" in ast && ast.deprecated === true) | ||
| 42 | ); | ||
| 43 | } | ||
| 44 | |||
| 45 | export function hasStandaloneName(ast: AST): ast is ASTWithStandaloneName { | ||
| 46 | return "standaloneName" in ast && ast.standaloneName != null && ast.standaloneName !== ""; | ||
| 47 | } | ||
| 48 | |||
| 49 | //////////////////////////////////////////// types | ||
| 50 | |||
| 51 | export interface TAny extends AbstractAST { | ||
| 52 | type: "ANY"; | ||
| 53 | } | ||
| 54 | |||
| 55 | export interface TArray extends AbstractAST { | ||
| 56 | type: "ARRAY"; | ||
| 57 | params: AST; | ||
| 58 | } | ||
| 59 | |||
| 60 | export interface TBoolean extends AbstractAST { | ||
| 61 | type: "BOOLEAN"; | ||
| 62 | } | ||
| 63 | |||
| 64 | export interface TEnum extends AbstractAST { | ||
| 65 | standaloneName: string; | ||
| 66 | type: "ENUM"; | ||
| 67 | params: TEnumParam[]; | ||
| 68 | } | ||
| 69 | |||
| 70 | export interface TEnumParam { | ||
| 71 | ast: AST; | ||
| 72 | keyName: string; | ||
| 73 | } | ||
| 74 | |||
| 75 | export interface TInterface extends AbstractAST { | ||
| 76 | type: "INTERFACE"; | ||
| 77 | params: TInterfaceParam[]; | ||
| 78 | superTypes: TNamedInterface[]; | ||
| 79 | } | ||
| 80 | |||
| 81 | export interface TNamedInterface extends AbstractAST { | ||
| 82 | standaloneName: string; | ||
| 83 | type: "INTERFACE"; | ||
| 84 | params: TInterfaceParam[]; | ||
| 85 | superTypes: TNamedInterface[]; | ||
| 86 | } | ||
| 87 | |||
| 88 | export interface TNever extends AbstractAST { | ||
| 89 | type: "NEVER"; | ||
| 90 | } | ||
| 91 | |||
| 92 | export interface TInterfaceParam { | ||
| 93 | ast: AST; | ||
| 94 | keyName: string; | ||
| 95 | isRequired: boolean; | ||
| 96 | isPatternProperty: boolean; | ||
| 97 | isUnreachableDefinition: boolean; | ||
| 98 | } | ||
| 99 | |||
| 100 | export interface TIntersection extends AbstractAST { | ||
| 101 | type: "INTERSECTION"; | ||
| 102 | params: AST[]; | ||
| 103 | } | ||
| 104 | |||
| 105 | export interface TLiteral extends AbstractAST { | ||
| 106 | params: JSONSchema4Type; | ||
| 107 | type: "LITERAL"; | ||
| 108 | } | ||
| 109 | |||
| 110 | export interface TNumber extends AbstractAST { | ||
| 111 | type: "NUMBER"; | ||
| 112 | } | ||
| 113 | |||
| 114 | export interface TNull extends AbstractAST { | ||
| 115 | type: "NULL"; | ||
| 116 | } | ||
| 117 | |||
| 118 | export interface TObject extends AbstractAST { | ||
| 119 | type: "OBJECT"; | ||
| 120 | } | ||
| 121 | |||
| 122 | export interface TReference extends AbstractAST { | ||
| 123 | type: "REFERENCE"; | ||
| 124 | params: string; | ||
| 125 | } | ||
| 126 | |||
| 127 | export interface TString extends AbstractAST { | ||
| 128 | type: "STRING"; | ||
| 129 | } | ||
| 130 | |||
| 131 | export interface TTuple extends AbstractAST { | ||
| 132 | type: "TUPLE"; | ||
| 133 | params: AST[]; | ||
| 134 | spreadParam?: AST; | ||
| 135 | minItems: number; | ||
| 136 | maxItems?: number; | ||
| 137 | } | ||
| 138 | |||
| 139 | export interface TUnion extends AbstractAST { | ||
| 140 | type: "UNION"; | ||
| 141 | params: AST[]; | ||
| 142 | } | ||
| 143 | |||
| 144 | export interface TUnknown extends AbstractAST { | ||
| 145 | type: "UNKNOWN"; | ||
| 146 | } | ||
| 147 | |||
| 148 | export interface TCustomType extends AbstractAST { | ||
| 149 | type: "CUSTOM_TYPE"; | ||
| 150 | params: string; | ||
| 151 | } | ||
| 152 | |||
| 153 | //////////////////////////////////////////// literals | ||
| 154 | |||
| 155 | export const T_ANY: TAny = { | ||
| 156 | type: "ANY", | ||
| 157 | }; | ||
| 158 | |||
| 159 | export const T_ANY_ADDITIONAL_PROPERTIES: TAny & ASTWithName = { | ||
| 160 | keyName: "[k: string]", | ||
| 161 | type: "ANY", | ||
| 162 | }; | ||
| 163 | |||
| 164 | export const T_UNKNOWN: TUnknown = { | ||
| 165 | type: "UNKNOWN", | ||
| 166 | }; | ||
| 167 | |||
| 168 | export const T_UNKNOWN_ADDITIONAL_PROPERTIES: TUnknown & ASTWithName = { | ||
| 169 | keyName: "[k: string]", | ||
| 170 | type: "UNKNOWN", | ||
| 171 | }; | ||
| @@ -0,0 +1,152 @@ | |||
| 1 | import type { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName } from "./json-schema"; | ||
| 2 | import { isPlainObject, memoize } from "../compat"; | ||
| 3 | |||
| 4 | export type SchemaType = | ||
| 5 | | "ALL_OF" | ||
| 6 | | "UNNAMED_SCHEMA" | ||
| 7 | | "ANY" | ||
| 8 | | "ANY_OF" | ||
| 9 | | "BOOLEAN" | ||
| 10 | | "NAMED_ENUM" | ||
| 11 | | "NAMED_SCHEMA" | ||
| 12 | | "NEVER" | ||
| 13 | | "NULL" | ||
| 14 | | "NUMBER" | ||
| 15 | | "STRING" | ||
| 16 | | "OBJECT" | ||
| 17 | | "ONE_OF" | ||
| 18 | | "TYPED_ARRAY" | ||
| 19 | | "REFERENCE" | ||
| 20 | | "UNION" | ||
| 21 | | "UNNAMED_ENUM" | ||
| 22 | | "UNTYPED_ARRAY" | ||
| 23 | | "CUSTOM_TYPE"; | ||
| 24 | |||
| 25 | export type JSONSchemaTypeName = JSONSchema4TypeName; | ||
| 26 | export type JSONSchemaType = JSONSchema4Type; | ||
| 27 | |||
| 28 | export interface JSONSchema extends JSONSchema4 { | ||
| 29 | /** | ||
| 30 | * schema extension to support numeric enums | ||
| 31 | */ | ||
| 32 | tsEnumNames?: string[]; | ||
| 33 | /** | ||
| 34 | * schema extension to support custom types | ||
| 35 | */ | ||
| 36 | tsType?: string; | ||
| 37 | /** | ||
| 38 | * property exists at least in https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.3 | ||
| 39 | */ | ||
| 40 | deprecated?: boolean; | ||
| 41 | } | ||
| 42 | |||
| 43 | export const Parent = Symbol("Parent"); | ||
| 44 | |||
| 45 | export interface LinkedJSONSchema extends JSONSchema { | ||
| 46 | /** | ||
| 47 | * A reference to this schema's parent node, for convenience. | ||
| 48 | * `null` when this is the root schema. | ||
| 49 | */ | ||
| 50 | [Parent]: LinkedJSONSchema | null; | ||
| 51 | |||
| 52 | additionalItems?: boolean | LinkedJSONSchema; | ||
| 53 | additionalProperties?: boolean | LinkedJSONSchema; | ||
| 54 | items?: LinkedJSONSchema | LinkedJSONSchema[]; | ||
| 55 | definitions?: { | ||
| 56 | [k: string]: LinkedJSONSchema; | ||
| 57 | }; | ||
| 58 | properties?: { | ||
| 59 | [k: string]: LinkedJSONSchema; | ||
| 60 | }; | ||
| 61 | patternProperties?: { | ||
| 62 | [k: string]: LinkedJSONSchema; | ||
| 63 | }; | ||
| 64 | dependencies?: { | ||
| 65 | [k: string]: LinkedJSONSchema | string[]; | ||
| 66 | }; | ||
| 67 | allOf?: LinkedJSONSchema[]; | ||
| 68 | anyOf?: LinkedJSONSchema[]; | ||
| 69 | oneOf?: LinkedJSONSchema[]; | ||
| 70 | not?: LinkedJSONSchema; | ||
| 71 | } | ||
| 72 | |||
| 73 | export const Types = Symbol("Types"); | ||
| 74 | export const Intersection = Symbol("Intersection"); | ||
| 75 | |||
| 76 | /** | ||
| 77 | * Normalized JSON schema. | ||
| 78 | * | ||
| 79 | * Note: `definitions` and `id` are removed by the normalizer. Use `$defs` and `$id` instead. | ||
| 80 | */ | ||
| 81 | export interface NormalizedJSONSchema extends Omit<LinkedJSONSchema, "definitions" | "id"> { | ||
| 82 | [Intersection]?: NormalizedJSONSchema; | ||
| 83 | [Parent]: NormalizedJSONSchema | null; | ||
| 84 | [Types]: ReadonlySet<SchemaType>; | ||
| 85 | |||
| 86 | additionalItems?: boolean | NormalizedJSONSchema; | ||
| 87 | additionalProperties: boolean | NormalizedJSONSchema; | ||
| 88 | extends?: string[]; | ||
| 89 | items?: NormalizedJSONSchema | NormalizedJSONSchema[]; | ||
| 90 | $defs?: { | ||
| 91 | [k: string]: NormalizedJSONSchema; | ||
| 92 | }; | ||
| 93 | properties?: { | ||
| 94 | [k: string]: NormalizedJSONSchema; | ||
| 95 | }; | ||
| 96 | patternProperties?: { | ||
| 97 | [k: string]: NormalizedJSONSchema; | ||
| 98 | }; | ||
| 99 | dependencies?: { | ||
| 100 | [k: string]: NormalizedJSONSchema | string[]; | ||
| 101 | }; | ||
| 102 | allOf?: NormalizedJSONSchema[]; | ||
| 103 | anyOf?: NormalizedJSONSchema[]; | ||
| 104 | oneOf?: NormalizedJSONSchema[]; | ||
| 105 | not?: NormalizedJSONSchema; | ||
| 106 | required: string[]; | ||
| 107 | } | ||
| 108 | |||
| 109 | export interface EnumJSONSchema extends NormalizedJSONSchema { | ||
| 110 | enum: JSONSchema4Type[]; | ||
| 111 | } | ||
| 112 | |||
| 113 | export interface NamedEnumJSONSchema extends NormalizedJSONSchema { | ||
| 114 | tsEnumNames: string[]; | ||
| 115 | } | ||
| 116 | |||
| 117 | export interface SchemaSchema extends NormalizedJSONSchema { | ||
| 118 | properties: { | ||
| 119 | [k: string]: NormalizedJSONSchema; | ||
| 120 | }; | ||
| 121 | required: string[]; | ||
| 122 | } | ||
| 123 | |||
| 124 | export interface JSONSchemaWithDefinitions extends NormalizedJSONSchema { | ||
| 125 | $defs: { | ||
| 126 | [k: string]: NormalizedJSONSchema; | ||
| 127 | }; | ||
| 128 | } | ||
| 129 | |||
| 130 | export interface CustomTypeJSONSchema extends NormalizedJSONSchema { | ||
| 131 | tsType: string; | ||
| 132 | } | ||
| 133 | |||
| 134 | export const getRootSchema = memoize((schema: NormalizedJSONSchema): NormalizedJSONSchema => { | ||
| 135 | const parent = schema[Parent]; | ||
| 136 | if (!parent) { | ||
| 137 | return schema; | ||
| 138 | } | ||
| 139 | return getRootSchema(parent); | ||
| 140 | }); | ||
| 141 | |||
| 142 | export function isBoolean(schema: LinkedJSONSchema | JSONSchemaType): schema is boolean { | ||
| 143 | return schema === true || schema === false; | ||
| 144 | } | ||
| 145 | |||
| 146 | export function isPrimitive(schema: LinkedJSONSchema | JSONSchemaType): schema is JSONSchemaType { | ||
| 147 | return !isPlainObject(schema); | ||
| 148 | } | ||
| 149 | |||
| 150 | export function isCompound(schema: JSONSchema): boolean { | ||
| 151 | return Array.isArray(schema.type) || "anyOf" in schema || "oneOf" in schema; | ||
| 152 | } | ||
| @@ -0,0 +1,50 @@ | |||
| 1 | export type JSONSchema4TypeName = | ||
| 2 | | "string" | ||
| 3 | | "number" | ||
| 4 | | "integer" | ||
| 5 | | "boolean" | ||
| 6 | | "object" | ||
| 7 | | "array" | ||
| 8 | | "null" | ||
| 9 | | "any"; | ||
| 10 | |||
| 11 | export type JSONSchema4Type = | ||
| 12 | | string | ||
| 13 | | number | ||
| 14 | | boolean | ||
| 15 | | null | ||
| 16 | | JSONSchema4Object | ||
| 17 | | JSONSchema4Type[]; | ||
| 18 | |||
| 19 | export interface JSONSchema4Object { | ||
| 20 | [key: string]: any; | ||
| 21 | } | ||
| 22 | |||
| 23 | export interface JSONSchema4 { | ||
| 24 | [key: string]: any; | ||
| 25 | $id?: string; | ||
| 26 | $ref?: string; | ||
| 27 | $schema?: string; | ||
| 28 | $defs?: Record<string, JSONSchema4>; | ||
| 29 | additionalItems?: boolean | JSONSchema4; | ||
| 30 | additionalProperties?: boolean | JSONSchema4; | ||
| 31 | allOf?: JSONSchema4[]; | ||
| 32 | anyOf?: JSONSchema4[]; | ||
| 33 | default?: JSONSchema4Type; | ||
| 34 | definitions?: Record<string, JSONSchema4>; | ||
| 35 | dependencies?: Record<string, JSONSchema4 | string[]>; | ||
| 36 | description?: string; | ||
| 37 | enum?: JSONSchema4Type[]; | ||
| 38 | extends?: string[]; | ||
| 39 | id?: string; | ||
| 40 | items?: JSONSchema4 | JSONSchema4[]; | ||
| 41 | maxItems?: number; | ||
| 42 | minItems?: number; | ||
| 43 | not?: JSONSchema4; | ||
| 44 | oneOf?: JSONSchema4[]; | ||
| 45 | patternProperties?: Record<string, JSONSchema4>; | ||
| 46 | properties?: Record<string, JSONSchema4>; | ||
| 47 | required?: string[] | false; | ||
| 48 | title?: string; | ||
| 49 | type?: JSONSchema4TypeName | JSONSchema4TypeName[]; | ||
| 50 | } | ||
| @@ -0,0 +1,150 @@ | |||
| 1 | import { isPlainObject } from "./compat"; | ||
| 2 | import { isCompound } from "./types/JSONSchema"; | ||
| 3 | import type { JSONSchema, SchemaType } from "./types/JSONSchema"; | ||
| 4 | |||
| 5 | /** | ||
| 6 | * Duck types a JSONSchema schema or property to determine which kind of AST node to parse it into. | ||
| 7 | * | ||
| 8 | * Due to what some might say is an oversight in the JSON-Schema spec, a given schema may | ||
| 9 | * implicitly be an *intersection* of multiple JSON-Schema directives (ie. multiple TypeScript | ||
| 10 | * types). The spec leaves it up to implementations to decide what to do with this | ||
| 11 | * loosely-defined behavior. | ||
| 12 | */ | ||
| 13 | export function typesOfSchema(schema: JSONSchema): Set<SchemaType> { | ||
| 14 | // tsType is an escape hatch that supercedes all other directives | ||
| 15 | if (schema.tsType) { | ||
| 16 | return new Set(["CUSTOM_TYPE"]); | ||
| 17 | } | ||
| 18 | |||
| 19 | // Collect matched types | ||
| 20 | const matchedTypes = new Set<SchemaType>(); | ||
| 21 | for (const [schemaType, f] of Object.entries(matchers)) { | ||
| 22 | if (f(schema)) { | ||
| 23 | matchedTypes.add(schemaType as SchemaType); | ||
| 24 | } | ||
| 25 | } | ||
| 26 | |||
| 27 | // Default to an unnamed schema | ||
| 28 | if (!matchedTypes.size) { | ||
| 29 | matchedTypes.add("UNNAMED_SCHEMA"); | ||
| 30 | } | ||
| 31 | |||
| 32 | return matchedTypes; | ||
| 33 | } | ||
| 34 | |||
| 35 | const matchers: Record<SchemaType, (schema: JSONSchema) => boolean> = { | ||
| 36 | ALL_OF(schema) { | ||
| 37 | return "allOf" in schema; | ||
| 38 | }, | ||
| 39 | ANY(schema) { | ||
| 40 | if (Object.keys(schema).length === 0) { | ||
| 41 | // The empty schema {} validates any value | ||
| 42 | // @see https://json-schema.org/draft-07/json-schema-core.html#rfc.section.4.3.1 | ||
| 43 | return true; | ||
| 44 | } | ||
| 45 | return schema.type === "any"; | ||
| 46 | }, | ||
| 47 | ANY_OF(schema) { | ||
| 48 | return "anyOf" in schema; | ||
| 49 | }, | ||
| 50 | BOOLEAN(schema) { | ||
| 51 | if ("enum" in schema) { | ||
| 52 | return false; | ||
| 53 | } | ||
| 54 | if (schema.type === "boolean") { | ||
| 55 | return true; | ||
| 56 | } | ||
| 57 | if (!isCompound(schema) && typeof schema.default === "boolean") { | ||
| 58 | return true; | ||
| 59 | } | ||
| 60 | return false; | ||
| 61 | }, | ||
| 62 | CUSTOM_TYPE() { | ||
| 63 | return false; // Explicitly handled before we try to match | ||
| 64 | }, | ||
| 65 | NAMED_ENUM(schema) { | ||
| 66 | return "enum" in schema && "tsEnumNames" in schema; | ||
| 67 | }, | ||
| 68 | NAMED_SCHEMA(schema) { | ||
| 69 | // 8.2.1. The presence of "$id" in a subschema indicates that the subschema constitutes a distinct schema resource within a single schema document. | ||
| 70 | return "$id" in schema && ("patternProperties" in schema || "properties" in schema); | ||
| 71 | }, | ||
| 72 | NEVER(schema: JSONSchema | boolean) { | ||
| 73 | return schema === false; | ||
| 74 | }, | ||
| 75 | NULL(schema) { | ||
| 76 | return schema.type === "null"; | ||
| 77 | }, | ||
| 78 | NUMBER(schema) { | ||
| 79 | if ("enum" in schema) { | ||
| 80 | return false; | ||
| 81 | } | ||
| 82 | if (schema.type === "integer" || schema.type === "number") { | ||
| 83 | return true; | ||
| 84 | } | ||
| 85 | if (!isCompound(schema) && typeof schema.default === "number") { | ||
| 86 | return true; | ||
| 87 | } | ||
| 88 | return false; | ||
| 89 | }, | ||
| 90 | OBJECT(schema) { | ||
| 91 | return ( | ||
| 92 | schema.type === "object" && | ||
| 93 | !isPlainObject(schema.additionalProperties) && | ||
| 94 | !schema.allOf && | ||
| 95 | !schema.anyOf && | ||
| 96 | !schema.oneOf && | ||
| 97 | !schema.patternProperties && | ||
| 98 | !schema.properties && | ||
| 99 | !schema.required | ||
| 100 | ); | ||
| 101 | }, | ||
| 102 | ONE_OF(schema) { | ||
| 103 | return "oneOf" in schema; | ||
| 104 | }, | ||
| 105 | REFERENCE(schema) { | ||
| 106 | return "$ref" in schema; | ||
| 107 | }, | ||
| 108 | STRING(schema) { | ||
| 109 | if ("enum" in schema) { | ||
| 110 | return false; | ||
| 111 | } | ||
| 112 | if (schema.type === "string") { | ||
| 113 | return true; | ||
| 114 | } | ||
| 115 | if (!isCompound(schema) && typeof schema.default === "string") { | ||
| 116 | return true; | ||
| 117 | } | ||
| 118 | return false; | ||
| 119 | }, | ||
| 120 | TYPED_ARRAY(schema) { | ||
| 121 | if (schema.type && schema.type !== "array") { | ||
| 122 | return false; | ||
| 123 | } | ||
| 124 | return "items" in schema; | ||
| 125 | }, | ||
| 126 | UNION(schema) { | ||
| 127 | return Array.isArray(schema.type); | ||
| 128 | }, | ||
| 129 | UNNAMED_ENUM(schema) { | ||
| 130 | if ("tsEnumNames" in schema) { | ||
| 131 | return false; | ||
| 132 | } | ||
| 133 | if ( | ||
| 134 | schema.type && | ||
| 135 | schema.type !== "boolean" && | ||
| 136 | schema.type !== "integer" && | ||
| 137 | schema.type !== "number" && | ||
| 138 | schema.type !== "string" | ||
| 139 | ) { | ||
| 140 | return false; | ||
| 141 | } | ||
| 142 | return "enum" in schema; | ||
| 143 | }, | ||
| 144 | UNNAMED_SCHEMA() { | ||
| 145 | return false; // Explicitly handled as the default case | ||
| 146 | }, | ||
| 147 | UNTYPED_ARRAY(schema) { | ||
| 148 | return schema.type === "array" && !("items" in schema); | ||
| 149 | }, | ||
| 150 | }; | ||
| @@ -0,0 +1,324 @@ | |||
| 1 | import { deburr, isPlainObject, upperFirst } from "./compat"; | ||
| 2 | import { | ||
| 3 | Intersection, | ||
| 4 | type JSONSchema, | ||
| 5 | type LinkedJSONSchema, | ||
| 6 | type NormalizedJSONSchema, | ||
| 7 | Parent, | ||
| 8 | } from "./types/JSONSchema"; | ||
| 9 | |||
| 10 | // keys that shouldn't be traversed by the catchall step | ||
| 11 | const BLACKLISTED_KEYS = new Set([ | ||
| 12 | "id", | ||
| 13 | "$defs", | ||
| 14 | "$id", | ||
| 15 | "$schema", | ||
| 16 | "title", | ||
| 17 | "description", | ||
| 18 | "default", | ||
| 19 | "multipleOf", | ||
| 20 | "maximum", | ||
| 21 | "exclusiveMaximum", | ||
| 22 | "minimum", | ||
| 23 | "exclusiveMinimum", | ||
| 24 | "maxLength", | ||
| 25 | "minLength", | ||
| 26 | "pattern", | ||
| 27 | "additionalItems", | ||
| 28 | "items", | ||
| 29 | "maxItems", | ||
| 30 | "minItems", | ||
| 31 | "uniqueItems", | ||
| 32 | "maxProperties", | ||
| 33 | "minProperties", | ||
| 34 | "required", | ||
| 35 | "additionalProperties", | ||
| 36 | "definitions", | ||
| 37 | "properties", | ||
| 38 | "patternProperties", | ||
| 39 | "dependencies", | ||
| 40 | "enum", | ||
| 41 | "type", | ||
| 42 | "allOf", | ||
| 43 | "anyOf", | ||
| 44 | "oneOf", | ||
| 45 | "not", | ||
| 46 | ]); | ||
| 47 | |||
| 48 | function traverseObjectKeys( | ||
| 49 | obj: Record<string, LinkedJSONSchema>, | ||
| 50 | callback: (schema: LinkedJSONSchema, key: string | null) => void, | ||
| 51 | processed: Set<LinkedJSONSchema>, | ||
| 52 | ) { | ||
| 53 | Object.keys(obj).forEach((k) => { | ||
| 54 | if (obj[k] && typeof obj[k] === "object" && !Array.isArray(obj[k])) { | ||
| 55 | traverse(obj[k], callback, processed, k); | ||
| 56 | } | ||
| 57 | }); | ||
| 58 | } | ||
| 59 | |||
| 60 | function traverseArray( | ||
| 61 | arr: LinkedJSONSchema[], | ||
| 62 | callback: (schema: LinkedJSONSchema, key: string | null) => void, | ||
| 63 | processed: Set<LinkedJSONSchema>, | ||
| 64 | ) { | ||
| 65 | arr.forEach((s, k) => traverse(s, callback, processed, k.toString())); | ||
| 66 | } | ||
| 67 | |||
| 68 | function traverseIntersection( | ||
| 69 | schema: LinkedJSONSchema, | ||
| 70 | callback: (schema: LinkedJSONSchema, key: string | null) => void, | ||
| 71 | processed: Set<LinkedJSONSchema>, | ||
| 72 | ) { | ||
| 73 | if (typeof schema !== "object" || !schema) { | ||
| 74 | return; | ||
| 75 | } | ||
| 76 | |||
| 77 | const r = schema as unknown as Record<string | symbol, unknown>; | ||
| 78 | const intersection = r[Intersection] as NormalizedJSONSchema | undefined; | ||
| 79 | if (!intersection) { | ||
| 80 | return; | ||
| 81 | } | ||
| 82 | |||
| 83 | if (Array.isArray(intersection.allOf)) { | ||
| 84 | traverseArray(intersection.allOf, callback, processed); | ||
| 85 | } | ||
| 86 | } | ||
| 87 | |||
| 88 | export function traverse( | ||
| 89 | schema: LinkedJSONSchema, | ||
| 90 | callback: (schema: LinkedJSONSchema, key: string | null) => void, | ||
| 91 | processed = new Set<LinkedJSONSchema>(), | ||
| 92 | key?: string, | ||
| 93 | ): void { | ||
| 94 | // Handle recursive schemas | ||
| 95 | if (processed.has(schema)) { | ||
| 96 | return; | ||
| 97 | } | ||
| 98 | |||
| 99 | processed.add(schema); | ||
| 100 | callback(schema, key ?? null); | ||
| 101 | |||
| 102 | if (schema.anyOf) { | ||
| 103 | traverseArray(schema.anyOf, callback, processed); | ||
| 104 | } | ||
| 105 | if (schema.allOf) { | ||
| 106 | traverseArray(schema.allOf, callback, processed); | ||
| 107 | } | ||
| 108 | if (schema.oneOf) { | ||
| 109 | traverseArray(schema.oneOf, callback, processed); | ||
| 110 | } | ||
| 111 | if (schema.properties) { | ||
| 112 | traverseObjectKeys(schema.properties, callback, processed); | ||
| 113 | } | ||
| 114 | if (schema.patternProperties) { | ||
| 115 | traverseObjectKeys(schema.patternProperties, callback, processed); | ||
| 116 | } | ||
| 117 | if (schema.additionalProperties && typeof schema.additionalProperties === "object") { | ||
| 118 | traverse(schema.additionalProperties, callback, processed); | ||
| 119 | } | ||
| 120 | if (schema.items) { | ||
| 121 | const { items } = schema; | ||
| 122 | if (Array.isArray(items)) { | ||
| 123 | traverseArray(items, callback, processed); | ||
| 124 | } else { | ||
| 125 | traverse(items, callback, processed); | ||
| 126 | } | ||
| 127 | } | ||
| 128 | if (schema.additionalItems && typeof schema.additionalItems === "object") { | ||
| 129 | traverse(schema.additionalItems, callback, processed); | ||
| 130 | } | ||
| 131 | if (schema.dependencies) { | ||
| 132 | if (Array.isArray(schema.dependencies)) { | ||
| 133 | traverseArray(schema.dependencies, callback, processed); | ||
| 134 | } else { | ||
| 135 | traverseObjectKeys(schema.dependencies as LinkedJSONSchema, callback, processed); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | if (schema.definitions) { | ||
| 139 | traverseObjectKeys(schema.definitions as Record<string, LinkedJSONSchema>, callback, processed); | ||
| 140 | } | ||
| 141 | if (schema.$defs) { | ||
| 142 | traverseObjectKeys(schema.$defs as Record<string, LinkedJSONSchema>, callback, processed); | ||
| 143 | } | ||
| 144 | if (schema.not) { | ||
| 145 | traverse(schema.not, callback, processed); | ||
| 146 | } | ||
| 147 | traverseIntersection(schema, callback, processed); | ||
| 148 | |||
| 149 | // technically you can put definitions on any key | ||
| 150 | Object.keys(schema) | ||
| 151 | .filter((key) => !BLACKLISTED_KEYS.has(key)) | ||
| 152 | .forEach((key) => { | ||
| 153 | const child = schema[key]; | ||
| 154 | if (child && typeof child === "object") { | ||
| 155 | traverseObjectKeys(child, callback, processed); | ||
| 156 | } | ||
| 157 | }); | ||
| 158 | } | ||
| 159 | |||
| 160 | /** | ||
| 161 | * Eg. `foo/bar/baz.json` => `baz` | ||
| 162 | */ | ||
| 163 | export function justName(filename = ""): string { | ||
| 164 | return stripExtension(filename.split(/[\\/]/).pop() ?? ""); | ||
| 165 | } | ||
| 166 | |||
| 167 | /** | ||
| 168 | * Avoid appending "js" to top-level unnamed schemas | ||
| 169 | */ | ||
| 170 | export function stripExtension(filename: string): string { | ||
| 171 | return filename.replace(/\.[^./\\]*$/, ""); | ||
| 172 | } | ||
| 173 | |||
| 174 | /** | ||
| 175 | * Convert a string that might contain spaces or special characters to one that | ||
| 176 | * can safely be used as a TypeScript interface or enum name. | ||
| 177 | */ | ||
| 178 | export function toSafeString(string: string): string { | ||
| 179 | // identifiers in javaScript/ts: | ||
| 180 | // First character: a-zA-Z | _ | $ | ||
| 181 | // Rest: a-zA-Z | _ | $ | 0-9 | ||
| 182 | |||
| 183 | return upperFirst( | ||
| 184 | // remove accents, umlauts, ... by their basic latin letters | ||
| 185 | deburr(string) | ||
| 186 | // replace chars which are not valid for typescript identifiers with whitespace | ||
| 187 | .replace(/(^\s*[^a-zA-Z_$])|([^a-zA-Z_$\d])/g, " ") | ||
| 188 | // uppercase leading underscores followed by lowercase | ||
| 189 | .replace(/^_[a-z]/g, (match) => match.toUpperCase()) | ||
| 190 | // remove non-leading underscores followed by lowercase (convert snake_case) | ||
| 191 | .replace(/_[a-z]/g, (match) => match.substr(1, match.length).toUpperCase()) | ||
| 192 | // uppercase letters after digits, dollars | ||
| 193 | .replace(/([\d$]+[a-zA-Z])/g, (match) => match.toUpperCase()) | ||
| 194 | // uppercase first letter after whitespace | ||
| 195 | .replace(/\s+([a-zA-Z])/g, (match) => match.toUpperCase().trim()) | ||
| 196 | // remove remaining whitespace | ||
| 197 | .replace(/\s/g, ""), | ||
| 198 | ); | ||
| 199 | } | ||
| 200 | |||
| 201 | export function generateName(from: string, usedNames: Set<string>) { | ||
| 202 | let name = toSafeString(from); | ||
| 203 | if (!name) { | ||
| 204 | name = "NoName"; | ||
| 205 | } | ||
| 206 | |||
| 207 | // increment counter until we find a free name | ||
| 208 | if (usedNames.has(name)) { | ||
| 209 | let counter = 1; | ||
| 210 | let nameWithCounter = `${name}${counter}`; | ||
| 211 | while (usedNames.has(nameWithCounter)) { | ||
| 212 | nameWithCounter = `${name}${counter}`; | ||
| 213 | counter++; | ||
| 214 | } | ||
| 215 | name = nameWithCounter; | ||
| 216 | } | ||
| 217 | |||
| 218 | usedNames.add(name); | ||
| 219 | return name; | ||
| 220 | } | ||
| 221 | |||
| 222 | /** | ||
| 223 | * escape block comments in schema descriptions so that they don't unexpectedly close JSDoc comments in generated typescript interfaces | ||
| 224 | */ | ||
| 225 | export function escapeBlockComment(schema: JSONSchema) { | ||
| 226 | const replacer = "* /"; | ||
| 227 | if (schema === null || typeof schema !== "object") { | ||
| 228 | return; | ||
| 229 | } | ||
| 230 | for (const key of Object.keys(schema)) { | ||
| 231 | if (key === "description" && typeof schema[key] === "string") { | ||
| 232 | schema[key] = schema[key]!.replace(/\*\//g, replacer); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | /** | ||
| 238 | * Removes the schema's `default` property if it doesn't match the schema's `type` property. | ||
| 239 | * Useful when parsing unions. | ||
| 240 | * | ||
| 241 | * Mutates `schema`. | ||
| 242 | */ | ||
| 243 | export function maybeStripDefault(schema: LinkedJSONSchema): LinkedJSONSchema { | ||
| 244 | if (!("default" in schema)) { | ||
| 245 | return schema; | ||
| 246 | } | ||
| 247 | |||
| 248 | switch (schema.type) { | ||
| 249 | case "array": | ||
| 250 | if (Array.isArray(schema.default)) { | ||
| 251 | return schema; | ||
| 252 | } | ||
| 253 | break; | ||
| 254 | case "boolean": | ||
| 255 | if (typeof schema.default === "boolean") { | ||
| 256 | return schema; | ||
| 257 | } | ||
| 258 | break; | ||
| 259 | case "integer": | ||
| 260 | case "number": | ||
| 261 | if (typeof schema.default === "number") { | ||
| 262 | return schema; | ||
| 263 | } | ||
| 264 | break; | ||
| 265 | case "string": | ||
| 266 | if (typeof schema.default === "string") { | ||
| 267 | return schema; | ||
| 268 | } | ||
| 269 | break; | ||
| 270 | case "null": | ||
| 271 | if (schema.default === null) { | ||
| 272 | return schema; | ||
| 273 | } | ||
| 274 | break; | ||
| 275 | case "object": | ||
| 276 | if (isPlainObject(schema.default)) { | ||
| 277 | return schema; | ||
| 278 | } | ||
| 279 | break; | ||
| 280 | } | ||
| 281 | delete schema.default; | ||
| 282 | return schema; | ||
| 283 | } | ||
| 284 | |||
| 285 | export function appendToDescription( | ||
| 286 | existingDescription: string | undefined, | ||
| 287 | ...values: string[] | ||
| 288 | ): string { | ||
| 289 | if (existingDescription) { | ||
| 290 | return `${existingDescription}\n\n${values.join("\n")}`; | ||
| 291 | } | ||
| 292 | return values.join("\n"); | ||
| 293 | } | ||
| 294 | |||
| 295 | export function isSchemaLike(schema: any): schema is LinkedJSONSchema { | ||
| 296 | if (!isPlainObject(schema)) { | ||
| 297 | return false; | ||
| 298 | } | ||
| 299 | |||
| 300 | // top-level schema | ||
| 301 | const parent = (schema as LinkedJSONSchema)[Parent] as LinkedJSONSchema | null; | ||
| 302 | if (parent === null) { | ||
| 303 | return true; | ||
| 304 | } | ||
| 305 | |||
| 306 | const JSON_SCHEMA_KEYWORDS = [ | ||
| 307 | "$defs", | ||
| 308 | "allOf", | ||
| 309 | "anyOf", | ||
| 310 | "definitions", | ||
| 311 | "dependencies", | ||
| 312 | "enum", | ||
| 313 | "not", | ||
| 314 | "oneOf", | ||
| 315 | "patternProperties", | ||
| 316 | "properties", | ||
| 317 | "required", | ||
| 318 | ]; | ||
| 319 | if (JSON_SCHEMA_KEYWORDS.some((_) => parent[_] === schema)) { | ||
| 320 | return false; | ||
| 321 | } | ||
| 322 | |||
| 323 | return true; | ||
| 324 | } | ||
| @@ -0,0 +1,56 @@ | |||
| 1 | import type { JSONSchema, LinkedJSONSchema } from "./types/JSONSchema"; | ||
| 2 | import { traverse } from "./utils"; | ||
| 3 | |||
| 4 | type Rule = (schema: JSONSchema) => boolean | void; | ||
| 5 | const rules = new Map<string, Rule>(); | ||
| 6 | |||
| 7 | rules.set("Enum members and tsEnumNames must be of the same length", (schema) => { | ||
| 8 | if (schema.enum && schema.tsEnumNames && schema.enum.length !== schema.tsEnumNames.length) { | ||
| 9 | return false; | ||
| 10 | } | ||
| 11 | }); | ||
| 12 | |||
| 13 | rules.set("tsEnumNames must be an array of strings", (schema) => { | ||
| 14 | if (schema.tsEnumNames && schema.tsEnumNames.some((_) => typeof _ !== "string")) { | ||
| 15 | return false; | ||
| 16 | } | ||
| 17 | }); | ||
| 18 | |||
| 19 | rules.set("When both maxItems and minItems are present, maxItems >= minItems", (schema) => { | ||
| 20 | const { maxItems, minItems } = schema; | ||
| 21 | if (typeof maxItems === "number" && typeof minItems === "number") { | ||
| 22 | return maxItems >= minItems; | ||
| 23 | } | ||
| 24 | }); | ||
| 25 | |||
| 26 | rules.set("When maxItems exists, maxItems >= 0", (schema) => { | ||
| 27 | const { maxItems } = schema; | ||
| 28 | if (typeof maxItems === "number") { | ||
| 29 | return maxItems >= 0; | ||
| 30 | } | ||
| 31 | }); | ||
| 32 | |||
| 33 | rules.set("When minItems exists, minItems >= 0", (schema) => { | ||
| 34 | const { minItems } = schema; | ||
| 35 | if (typeof minItems === "number") { | ||
| 36 | return minItems >= 0; | ||
| 37 | } | ||
| 38 | }); | ||
| 39 | |||
| 40 | rules.set("deprecated must be a boolean", (schema) => { | ||
| 41 | const typeOfDeprecated = typeof schema.deprecated; | ||
| 42 | return typeOfDeprecated === "boolean" || typeOfDeprecated === "undefined"; | ||
| 43 | }); | ||
| 44 | |||
| 45 | export function validate(schema: LinkedJSONSchema, filename: string): string[] { | ||
| 46 | const errors: string[] = []; | ||
| 47 | rules.forEach((rule, ruleName) => { | ||
| 48 | traverse(schema, (schema, key) => { | ||
| 49 | if (rule(schema) === false) { | ||
| 50 | errors.push(`Error at key "${key}" in file "${filename}": ${ruleName}`); | ||
| 51 | } | ||
| 52 | return schema; | ||
| 53 | }); | ||
| 54 | }); | ||
| 55 | return errors; | ||
| 56 | } | ||
| @@ -4,6 +4,7 @@ export default defineConfig({ · 3 unmodified lines | |||
| 4 | entry: { | 4 | entry: { |
| 5 | index: "src/promise.ts", | 5 | index: "src/promise.ts", |
| 6 | core: "src/index.ts", | 6 | core: "src/index.ts", |
| 7 | shared: "src/shared.ts", | ||
| 7 | client: "src/client.ts", | 8 | client: "src/client.ts", |
| 8 | testing: "src/testing.ts", | 9 | testing: "src/testing.ts", |
| 9 | }, | 10 | }, |
| @@ -9,7 +9,8 @@ · 8 unmodified lines | |||
| 9 | // No React or Node imports here — server and client both import this. | 9 | // No React or Node imports here — server and client both import this. |
| 10 | // --------------------------------------------------------------------------- | 10 | // --------------------------------------------------------------------------- |
| 11 | 11 | ||
| 12 | import { HttpApiEndpoint, HttpApiGroup, Schema } from "@executor-js/sdk/core"; | 12 | import { Schema } from "effect"; |
| 13 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | ||
| 13 | 14 | ||
| 14 | export const Greeting = Schema.Struct({ | 15 | export const Greeting = Schema.Struct({ |
| 15 | message: Schema.String, | 16 | message: Schema.String, |
| @@ -1,6 +1,6 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { InternalError, ScopeId, SecretBackedValue } from "@executor-js/sdk/core"; | 3 | import { InternalError, ScopeId, SecretBackedValue } from "@executor-js/sdk/shared"; |
| 4 | import { GoogleDiscoveryParseError, GoogleDiscoverySourceError } from "../sdk/errors"; | 4 | import { GoogleDiscoveryParseError, GoogleDiscoverySourceError } from "../sdk/errors"; |
| 5 | import { GoogleDiscoveryStoredSourceSchema } from "../sdk/stored-source"; | 5 | import { GoogleDiscoveryStoredSourceSchema } from "../sdk/stored-source"; |
| 6 | 6 | ||
| @@ -9,7 +9,7 @@ import { useScope, useUserScope } from "@executor-js/react/api/scope-context"; · 8 unmodified lines | |||
| 9 | import type { SecretPickerSecret } from "@executor-js/react/plugins/secret-picker"; | 9 | import type { SecretPickerSecret } from "@executor-js/react/plugins/secret-picker"; |
| 10 | import { CreatableSecretPicker } from "@executor-js/react/plugins/secret-header-auth"; | 10 | import { CreatableSecretPicker } from "@executor-js/react/plugins/secret-header-auth"; |
| 11 | import { useSecretPickerSecrets } from "@executor-js/react/plugins/use-secret-picker-secrets"; | 11 | import { useSecretPickerSecrets } from "@executor-js/react/plugins/use-secret-picker-secrets"; |
| 12 | import type { ScopeId } from "@executor-js/sdk"; | 12 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 13 | import { Badge } from "@executor-js/react/components/badge"; | 13 | import { Badge } from "@executor-js/react/components/badge"; |
| 14 | import { Button } from "@executor-js/react/components/button"; | 14 | import { Button } from "@executor-js/react/components/button"; |
| 15 | import { | 15 | import { |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { ScopeId } from "@executor-js/sdk/core"; | 1 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 2 | import * as Atom from "effect/unstable/reactivity/Atom"; | 2 | import * as Atom from "effect/unstable/reactivity/Atom"; |
| 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 4 | import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | 4 | import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { OAuthStrategy } from "@executor-js/sdk/core"; | 1 | import type { OAuthStrategy } from "@executor-js/sdk/shared"; |
| 2 | 2 | ||
| 3 | export const GOOGLE_DISCOVERY_OAUTH_POPUP_NAME = "google-discovery-oauth"; | 3 | export const GOOGLE_DISCOVERY_OAUTH_POPUP_NAME = "google-discovery-oauth"; |
| 4 | 4 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | import { Schema } from "effect"; | 1 | import { Schema } from "effect"; |
| 2 | import { SecretBackedValue } from "@executor-js/sdk/core"; | 2 | import { SecretBackedValue } from "@executor-js/sdk/shared"; |
| 3 | 3 | ||
| 4 | export const GoogleDiscoveryHttpMethod = Schema.Literals([ | 4 | export const GoogleDiscoveryHttpMethod = Schema.Literals([ |
| 5 | "get", | 5 | "get", |
| @@ -1,6 +1,6 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { InternalError, ScopeId } from "@executor-js/sdk/core"; | 3 | import { InternalError, ScopeId } from "@executor-js/sdk/shared"; |
| 4 | 4 | ||
| 5 | import { GraphqlIntrospectionError, GraphqlExtractionError } from "../sdk/errors"; | 5 | import { GraphqlIntrospectionError, GraphqlExtractionError } from "../sdk/errors"; |
| 6 | import { | 6 | import { |
| @@ -29,7 +29,7 @@ import { Button } from "@executor-js/react/components/button"; · 28 unmodified lines | |||
| 29 | import { FilterTabs } from "@executor-js/react/components/filter-tabs"; | 29 | import { FilterTabs } from "@executor-js/react/components/filter-tabs"; |
| 30 | import { SourceOAuthConnectionControl } from "@executor-js/react/plugins/source-oauth-connection"; | 30 | import { SourceOAuthConnectionControl } from "@executor-js/react/plugins/source-oauth-connection"; |
| 31 | import { Badge } from "@executor-js/react/components/badge"; | 31 | import { Badge } from "@executor-js/react/components/badge"; |
| 32 | import { ScopeId } from "@executor-js/sdk/core"; | 32 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 33 | import { GraphqlSourceFields } from "./GraphqlSourceFields"; | 33 | import { GraphqlSourceFields } from "./GraphqlSourceFields"; |
| 34 | import { | 34 | import { |
| 35 | GRAPHQL_OAUTH_CONNECTION_SLOT, | 35 | GRAPHQL_OAUTH_CONNECTION_SLOT, |
| @@ -7,7 +7,7 @@ import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/rea · 6 unmodified lines | |||
| 7 | import { SourceOAuthSignInButton } from "@executor-js/react/plugins/oauth-sign-in"; | 7 | import { SourceOAuthSignInButton } from "@executor-js/react/plugins/oauth-sign-in"; |
| 8 | import { slugifyNamespace } from "@executor-js/react/plugins/source-identity"; | 8 | import { slugifyNamespace } from "@executor-js/react/plugins/source-identity"; |
| 9 | import { secretBackedValuesFromConfiguredCredentialBindings } from "@executor-js/react/plugins/credential-bindings"; | 9 | import { secretBackedValuesFromConfiguredCredentialBindings } from "@executor-js/react/plugins/credential-bindings"; |
| 10 | import { ScopeId } from "@executor-js/sdk/core"; | 10 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 11 | 11 | ||
| 12 | import { graphqlSourceAtom, graphqlSourceBindingsAtom, setGraphqlSourceBinding } from "./atoms"; | 12 | import { graphqlSourceAtom, graphqlSourceBindingsAtom, setGraphqlSourceBinding } from "./atoms"; |
| 13 | import { GraphqlSourceBindingInput } from "../sdk/types"; | 13 | import { GraphqlSourceBindingInput } from "../sdk/types"; |
| @@ -9,7 +9,7 @@ import { · 8 unmodified lines | |||
| 9 | missingSourceCredentialLabels, | 9 | missingSourceCredentialLabels, |
| 10 | type SourceCredentialSlot, | 10 | type SourceCredentialSlot, |
| 11 | } from "@executor-js/react/plugins/source-credential-status"; | 11 | } from "@executor-js/react/plugins/source-credential-status"; |
| 12 | import { ScopeId } from "@executor-js/sdk/core"; | 12 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 13 | 13 | ||
| 14 | import { graphqlSourceAtom, graphqlSourceBindingsAtom } from "./atoms"; | 14 | import { graphqlSourceAtom, graphqlSourceBindingsAtom } from "./atoms"; |
| 15 | import type { StoredGraphqlSource } from "../sdk/store"; | 15 | import type { StoredGraphqlSource } from "../sdk/store"; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { ScopeId } from "@executor-js/sdk/core"; | 1 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 2 | import * as Atom from "effect/unstable/reactivity/Atom"; | 2 | import * as Atom from "effect/unstable/reactivity/Atom"; |
| 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 4 | import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | 4 | import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; |
| @@ -6,7 +6,7 @@ import { · 5 unmodified lines | |||
| 6 | ScopedSecretCredentialInput, | 6 | ScopedSecretCredentialInput, |
| 7 | SecretBackedValue, | 7 | SecretBackedValue, |
| 8 | ScopeId, | 8 | ScopeId, |
| 9 | } from "@executor-js/sdk/core"; | 9 | } from "@executor-js/sdk/shared"; |
| 10 | 10 | ||
| 11 | // --------------------------------------------------------------------------- | 11 | // --------------------------------------------------------------------------- |
| 12 | // GraphQL operation kind | 12 | // GraphQL operation kind |
| @@ -1,6 +1,6 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { InternalError, ScopeId, SecretBackedMap } from "@executor-js/sdk/core"; | 3 | import { InternalError, ScopeId, SecretBackedMap } from "@executor-js/sdk/shared"; |
| 4 | 4 | ||
| 5 | import { McpConnectionError, McpToolDiscoveryError } from "../sdk/errors"; | 5 | import { McpConnectionError, McpToolDiscoveryError } from "../sdk/errors"; |
| 6 | import { McpStoredSourceSchema } from "../sdk/stored-source"; | 6 | import { McpStoredSourceSchema } from "../sdk/stored-source"; |
| @@ -28,7 +28,7 @@ import { · 27 unmodified lines | |||
| 28 | import { SourceOAuthConnectionControl } from "@executor-js/react/plugins/source-oauth-connection"; | 28 | import { SourceOAuthConnectionControl } from "@executor-js/react/plugins/source-oauth-connection"; |
| 29 | import { Button } from "@executor-js/react/components/button"; | 29 | import { Button } from "@executor-js/react/components/button"; |
| 30 | import { Badge } from "@executor-js/react/components/badge"; | 30 | import { Badge } from "@executor-js/react/components/badge"; |
| 31 | import { ScopeId } from "@executor-js/sdk/core"; | 31 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 32 | import { McpRemoteSourceFields } from "./McpRemoteSourceFields"; | 32 | import { McpRemoteSourceFields } from "./McpRemoteSourceFields"; |
| 33 | import { | 33 | import { |
| 34 | McpSourceBindingInput, | 34 | McpSourceBindingInput, |
| @@ -1,7 +1,7 @@ | |||
| 1 | import { useAtomSet, useAtomValue } from "@effect/atom-react"; | 1 | import { useAtomSet, useAtomValue } from "@effect/atom-react"; |
| 2 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 2 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 3 | 3 | ||
| 4 | import { ScopeId } from "@executor-js/sdk/core"; | 4 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 5 | import { useScope, useUserScope } from "@executor-js/react/api/scope-context"; | 5 | import { useScope, useUserScope } from "@executor-js/react/api/scope-context"; |
| 6 | import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/reactivity-keys"; | 6 | import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/reactivity-keys"; |
| 7 | import { connectionsAtom } from "@executor-js/react/api/atoms"; | 7 | import { connectionsAtom } from "@executor-js/react/api/atoms"; |
| @@ -9,7 +9,7 @@ import { · 8 unmodified lines | |||
| 9 | missingSourceCredentialLabels, | 9 | missingSourceCredentialLabels, |
| 10 | type SourceCredentialSlot, | 10 | type SourceCredentialSlot, |
| 11 | } from "@executor-js/react/plugins/source-credential-status"; | 11 | } from "@executor-js/react/plugins/source-credential-status"; |
| 12 | import { ScopeId } from "@executor-js/sdk/core"; | 12 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 13 | 13 | ||
| 14 | import { mcpSourceAtom, mcpSourceBindingsAtom } from "./atoms"; | 14 | import { mcpSourceAtom, mcpSourceBindingsAtom } from "./atoms"; |
| 15 | import type { McpStoredSourceSchemaType } from "../sdk/stored-source"; | 15 | import type { McpStoredSourceSchemaType } from "../sdk/stored-source"; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { ScopeId } from "@executor-js/sdk/core"; | 1 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 2 | import * as Atom from "effect/unstable/reactivity/Atom"; | 2 | import * as Atom from "effect/unstable/reactivity/Atom"; |
| 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 4 | import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | 4 | import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import { Schema } from "effect"; | 1 | import { Schema } from "effect"; |
| 2 | import { ScopeId } from "@executor-js/sdk/core"; | 2 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 3 | 3 | ||
| 4 | import { McpStoredSourceData } from "./types"; | 4 | import { McpStoredSourceData } from "./types"; |
| 5 | 5 | ||
| @@ -7,7 +7,7 @@ import { · 6 unmodified lines | |||
| 7 | ScopeId, | 7 | ScopeId, |
| 8 | SecretBackedMap, | 8 | SecretBackedMap, |
| 9 | SecretBackedValue, | 9 | SecretBackedValue, |
| 10 | } from "@executor-js/sdk/core"; | 10 | } from "@executor-js/sdk/shared"; |
| 11 | 11 | ||
| 12 | export { SecretBackedMap, SecretBackedValue }; | 12 | export { SecretBackedMap, SecretBackedValue }; |
| 13 | 13 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | 1 | import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; |
| 2 | import { Schema } from "effect"; | 2 | import { Schema } from "effect"; |
| 3 | import { InternalError, ScopeId } from "@executor-js/sdk/core"; | 3 | import { InternalError, ScopeId } from "@executor-js/sdk/shared"; |
| 4 | 4 | ||
| 5 | import { OnePasswordError } from "../sdk/errors"; | 5 | import { OnePasswordError } from "../sdk/errors"; |
| 6 | import { OnePasswordConfig, Vault, ConnectionStatus } from "../sdk/types"; | 6 | import { OnePasswordConfig, Vault, ConnectionStatus } from "../sdk/types"; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { ScopeId } from "@executor-js/sdk/core"; | 1 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 2 | import { ReactivityKey } from "@executor-js/react/api/reactivity-keys"; | 2 | import { ReactivityKey } from "@executor-js/react/api/reactivity-keys"; |
| 3 | import { OnePasswordClient } from "./client"; | 3 | import { OnePasswordClient } from "./client"; |
| 4 | 4 | ||
| @@ -0,0 +1,145566 @@ | |||
| 1 | { | ||
| 2 | "openapi": "3.0.3", | ||
| 3 | "info": { | ||
| 4 | "title": "Vercel API", | ||
| 5 | "description": "Vercel combines the best developer experience with an obsessive focus on end-user performance. Our platform enables frontend teams to do their best work.", | ||
| 6 | "contact": { | ||
| 7 | "email": "support@vercel.com", | ||
| 8 | "name": "Vercel Support", | ||
| 9 | "url": "https://vercel.com/support" | ||
| 10 | }, | ||
| 11 | "version": "0.0.1" | ||
| 12 | }, | ||
| 13 | "servers": [ | ||
| 14 | { | ||
| 15 | "url": "https://api.vercel.com", | ||
| 16 | "description": "Production API" | ||
| 17 | } | ||
| 18 | ], | ||
| 19 | "paths": { | ||
| 20 | "/v1/access-groups/{idOrName}": { | ||
| 21 | "get": { | ||
| 22 | "description": "Allows to read an access group", | ||
| 23 | "operationId": "readAccessGroup", | ||
| 24 | "security": [ | ||
| 25 | { | ||
| 26 | "bearerToken": [] | ||
| 27 | } | ||
| 28 | ], | ||
| 29 | "summary": "Reads an access group", | ||
| 30 | "tags": ["access-groups"], | ||
| 31 | "responses": { | ||
| 32 | "200": { | ||
| 33 | "description": "", | ||
| 34 | "content": { | ||
| 35 | "application/json": { | ||
| 36 | "schema": { | ||
| 37 | "properties": { | ||
| 38 | "teamPermissions": { | ||
| 39 | "items": { | ||
| 40 | "type": "string", | ||
| 41 | "enum": [ | ||
| 42 | "IntegrationManager", | ||
| 43 | "CreateProject", | ||
| 44 | "FullProductionDeployment", | ||
| 45 | "UsageViewer", | ||
| 46 | "EnvVariableManager", | ||
| 47 | "EnvironmentManager", | ||
| 48 | "V0Builder", | ||
| 49 | "V0Chatter", | ||
| 50 | "V0Viewer" | ||
| 51 | ] | ||
| 52 | }, | ||
| 53 | "type": "array" | ||
| 54 | }, | ||
| 55 | "entitlements": { | ||
| 56 | "items": { | ||
| 57 | "type": "string", | ||
| 58 | "enum": ["v0"] | ||
| 59 | }, | ||
| 60 | "type": "array" | ||
| 61 | }, | ||
| 62 | "isDsyncManaged": { | ||
| 63 | "type": "boolean", | ||
| 64 | "enum": [false, true] | ||
| 65 | }, | ||
| 66 | "name": { | ||
| 67 | "type": "string", | ||
| 68 | "description": "The name of this access group.", | ||
| 69 | "example": "my-access-group" | ||
| 70 | }, | ||
| 71 | "createdAt": { | ||
| 72 | "type": "string", | ||
| 73 | "description": "Timestamp in milliseconds when the access group was created.", | ||
| 74 | "example": 1588720733602 | ||
| 75 | }, | ||
| 76 | "teamId": { | ||
| 77 | "type": "string", | ||
| 78 | "description": "ID of the team that this access group belongs to.", | ||
| 79 | "example": "team_123a6c5209bc3778245d011443644c8d27dc2c50" | ||
| 80 | }, | ||
| 81 | "updatedAt": { | ||
| 82 | "type": "string", | ||
| 83 | "description": "Timestamp in milliseconds when the access group was last updated.", | ||
| 84 | "example": 1588720733602 | ||
| 85 | }, | ||
| 86 | "accessGroupId": { | ||
| 87 | "type": "string", | ||
| 88 | "description": "ID of the access group.", | ||
| 89 | "example": "ag_123a6c5209bc3778245d011443644c8d27dc2c50" | ||
| 90 | }, | ||
| 91 | "membersCount": { | ||
| 92 | "type": "number", | ||
| 93 | "description": "Number of members in the access group.", | ||
| 94 | "example": 5 | ||
| 95 | }, | ||
| 96 | "projectsCount": { | ||
| 97 | "type": "number", | ||
| 98 | "description": "Number of projects in the access group.", | ||
| 99 | "example": 2 | ||
| 100 | }, | ||
| 101 | "teamRoles": { | ||
| 102 | "items": { | ||
| 103 | "type": "string" | ||
| 104 | }, | ||
| 105 | "type": "array", | ||
| 106 | "description": "Roles that the team has in the access group.", | ||
| 107 | "example": ["DEVELOPER", "BILLING"] | ||
| 108 | } | ||
| 109 | }, | ||
| 110 | "required": [ | ||
| 111 | "accessGroupId", | ||
| 112 | "createdAt", | ||
| 113 | "isDsyncManaged", | ||
| 114 | "membersCount", | ||
| 115 | "name", | ||
| 116 | "projectsCount", | ||
| 117 | "teamId", | ||
| 118 | "updatedAt" | ||
| 119 | ], | ||
| 120 | "type": "object" | ||
| 121 | } | ||
| 122 | } | ||
| 123 | } | ||
| 124 | }, | ||
| 125 | "400": { | ||
| 126 | "description": "One of the provided values in the request query is invalid." | ||
| 127 | }, | ||
| 128 | "401": { | ||
| 129 | "description": "The request is not authorized." | ||
| 130 | }, | ||
| 131 | "403": { | ||
| 132 | "description": "You do not have permission to access this resource." | ||
| 133 | } | ||
| 134 | }, | ||
| 135 | "x-vercel-cli": { | ||
| 136 | "supportedSubcommands": true, | ||
| 137 | "supportedProduction": false, | ||
| 138 | "aliases": ["read", "get"] | ||
| 139 | }, | ||
| 140 | "parameters": [ | ||
| 141 | { | ||
| 142 | "name": "idOrName", | ||
| 143 | "in": "path", | ||
| 144 | "required": true, | ||
| 145 | "schema": { | ||
| 146 | "type": "string" | ||
| 147 | }, | ||
| 148 | "x-vercel-cli": { | ||
| 149 | "kind": "argument" | ||
| 150 | }, | ||
| 151 | "examples": { | ||
| 152 | "id": { | ||
| 153 | "summary": "Access group ID", | ||
| 154 | "value": "ag_1a2b3c4d5e6f7g8h9i0j" | ||
| 155 | }, | ||
| 156 | "name": { | ||
| 157 | "summary": "Access group name", | ||
| 158 | "value": "My Access Group" | ||
| 159 | } | ||
| 160 | } | ||
| 161 | }, | ||
| 162 | { | ||
| 163 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 164 | "in": "query", | ||
| 165 | "name": "teamId", | ||
| 166 | "schema": { | ||
| 167 | "type": "string", | ||
| 168 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 169 | } | ||
| 170 | }, | ||
| 171 | { | ||
| 172 | "description": "The Team slug to perform the request on behalf of.", | ||
| 173 | "in": "query", | ||
| 174 | "name": "slug", | ||
| 175 | "schema": { | ||
| 176 | "type": "string", | ||
| 177 | "example": "my-team-url-slug" | ||
| 178 | } | ||
| 179 | } | ||
| 180 | ] | ||
| 181 | }, | ||
| 182 | "post": { | ||
| 183 | "description": "Allows to update an access group metadata", | ||
| 184 | "operationId": "updateAccessGroup", | ||
| 185 | "security": [ | ||
| 186 | { | ||
| 187 | "bearerToken": [] | ||
| 188 | } | ||
| 189 | ], | ||
| 190 | "summary": "Update an access group", | ||
| 191 | "tags": ["access-groups"], | ||
| 192 | "responses": { | ||
| 193 | "200": { | ||
| 194 | "description": "", | ||
| 195 | "content": { | ||
| 196 | "application/json": { | ||
| 197 | "schema": { | ||
| 198 | "properties": { | ||
| 199 | "entitlements": { | ||
| 200 | "items": { | ||
| 201 | "type": "string", | ||
| 202 | "enum": ["v0"] | ||
| 203 | }, | ||
| 204 | "type": "array" | ||
| 205 | }, | ||
| 206 | "name": { | ||
| 207 | "type": "string", | ||
| 208 | "description": "The name of this access group.", | ||
| 209 | "example": "my-access-group" | ||
| 210 | }, | ||
| 211 | "createdAt": { | ||
| 212 | "type": "string", | ||
| 213 | "description": "Timestamp in milliseconds when the access group was created.", | ||
| 214 | "example": 1588720733602 | ||
| 215 | }, | ||
| 216 | "teamId": { | ||
| 217 | "type": "string", | ||
| 218 | "description": "ID of the team that this access group belongs to.", | ||
| 219 | "example": "team_123a6c5209bc3778245d011443644c8d27dc2c50" | ||
| 220 | }, | ||
| 221 | "updatedAt": { | ||
| 222 | "type": "string", | ||
| 223 | "description": "Timestamp in milliseconds when the access group was last updated.", | ||
| 224 | "example": 1588720733602 | ||
| 225 | }, | ||
| 226 | "accessGroupId": { | ||
| 227 | "type": "string", | ||
| 228 | "description": "ID of the access group.", | ||
| 229 | "example": "ag_123a6c5209bc3778245d011443644c8d27dc2c50" | ||
| 230 | }, | ||
| 231 | "membersCount": { | ||
| 232 | "type": "number", | ||
| 233 | "description": "Number of members in the access group.", | ||
| 234 | "example": 5 | ||
| 235 | }, | ||
| 236 | "projectsCount": { | ||
| 237 | "type": "number", | ||
| 238 | "description": "Number of projects in the access group.", | ||
| 239 | "example": 2 | ||
| 240 | }, | ||
| 241 | "teamRoles": { | ||
| 242 | "items": { | ||
| 243 | "type": "string" | ||
| 244 | }, | ||
| 245 | "type": "array", | ||
| 246 | "description": "Roles that the team has in the access group.", | ||
| 247 | "example": ["DEVELOPER", "BILLING"] | ||
| 248 | }, | ||
| 249 | "teamPermissions": { | ||
| 250 | "items": { | ||
| 251 | "type": "string" | ||
| 252 | }, | ||
| 253 | "type": "array", | ||
| 254 | "description": "Permissions that the team has in the access group.", | ||
| 255 | "example": ["CreateProject"] | ||
| 256 | } | ||
| 257 | }, | ||
| 258 | "required": [ | ||
| 259 | "accessGroupId", | ||
| 260 | "createdAt", | ||
| 261 | "entitlements", | ||
| 262 | "membersCount", | ||
| 263 | "name", | ||
| 264 | "projectsCount", | ||
| 265 | "teamId", | ||
| 266 | "updatedAt" | ||
| 267 | ], | ||
| 268 | "type": "object" | ||
| 269 | } | ||
| 270 | } | ||
| 271 | } | ||
| 272 | }, | ||
| 273 | "400": { | ||
| 274 | "description": "One of the provided values in the request body is invalid.\nOne of the provided values in the request query is invalid." | ||
| 275 | }, | ||
| 276 | "401": { | ||
| 277 | "description": "The request is not authorized." | ||
| 278 | }, | ||
| 279 | "403": { | ||
| 280 | "description": "You do not have permission to access this resource." | ||
| 281 | } | ||
| 282 | }, | ||
| 283 | "parameters": [ | ||
| 284 | { | ||
| 285 | "name": "idOrName", | ||
| 286 | "in": "path", | ||
| 287 | "required": true, | ||
| 288 | "schema": { | ||
| 289 | "type": "string" | ||
| 290 | } | ||
| 291 | }, | ||
| 292 | { | ||
| 293 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 294 | "in": "query", | ||
| 295 | "name": "teamId", | ||
| 296 | "schema": { | ||
| 297 | "type": "string", | ||
| 298 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 299 | } | ||
| 300 | }, | ||
| 301 | { | ||
| 302 | "description": "The Team slug to perform the request on behalf of.", | ||
| 303 | "in": "query", | ||
| 304 | "name": "slug", | ||
| 305 | "schema": { | ||
| 306 | "type": "string", | ||
| 307 | "example": "my-team-url-slug" | ||
| 308 | } | ||
| 309 | } | ||
| 310 | ], | ||
| 311 | "requestBody": { | ||
| 312 | "content": { | ||
| 313 | "application/json": { | ||
| 314 | "schema": { | ||
| 315 | "type": "object", | ||
| 316 | "additionalProperties": false, | ||
| 317 | "properties": { | ||
| 318 | "name": { | ||
| 319 | "type": "string", | ||
| 320 | "description": "The name of the access group", | ||
| 321 | "maxLength": 50, | ||
| 322 | "pattern": "^[A-z0-9_ -]+$", | ||
| 323 | "example": "My access group" | ||
| 324 | }, | ||
| 325 | "projects": { | ||
| 326 | "type": "array", | ||
| 327 | "items": { | ||
| 328 | "type": "object", | ||
| 329 | "additionalProperties": false, | ||
| 330 | "required": ["role", "projectId"], | ||
| 331 | "properties": { | ||
| 332 | "projectId": { | ||
| 333 | "type": "string", | ||
| 334 | "maxLength": 256, | ||
| 335 | "example": "prj_ndlgr43fadlPyCtREAqxxdyFK", | ||
| 336 | "description": "The ID of the project." | ||
| 337 | }, | ||
| 338 | "role": { | ||
| 339 | "type": "string", | ||
| 340 | "example": "ADMIN", | ||
| 341 | "description": "The project role that will be added to this Access Group. \"null\" will remove this project level role.", | ||
| 342 | "nullable": true, | ||
| 343 | "enum": ["ADMIN", "PROJECT_VIEWER", "PROJECT_DEVELOPER", null] | ||
| 344 | } | ||
| 345 | } | ||
| 346 | } | ||
| 347 | }, | ||
| 348 | "membersToAdd": { | ||
| 349 | "description": "List of members to add to the access group.", | ||
| 350 | "type": "array", | ||
| 351 | "items": { | ||
| 352 | "type": "string" | ||
| 353 | }, | ||
| 354 | "example": ["usr_1a2b3c4d5e6f7g8h9i0j", "usr_2b3c4d5e6f7g8h9i0j1k"] | ||
| 355 | }, | ||
| 356 | "membersToRemove": { | ||
| 357 | "description": "List of members to remove from the access group.", | ||
| 358 | "type": "array", | ||
| 359 | "items": { | ||
| 360 | "type": "string" | ||
| 361 | }, | ||
| 362 | "example": ["usr_1a2b3c4d5e6f7g8h9i0j", "usr_2b3c4d5e6f7g8h9i0j1k"] | ||
| 363 | } | ||
| 364 | } | ||
| 365 | } | ||
| 366 | } | ||
| 367 | }, | ||
| 368 | "required": true | ||
| 369 | } | ||
| 370 | }, | ||
| 371 | "delete": { | ||
| 372 | "description": "Allows to delete an access group", | ||
| 373 | "operationId": "deleteAccessGroup", | ||
| 374 | "security": [ | ||
| 375 | { | ||
| 376 | "bearerToken": [] | ||
| 377 | } | ||
| 378 | ], | ||
| 379 | "summary": "Deletes an access group", | ||
| 380 | "tags": ["access-groups"], | ||
| 381 | "responses": { | ||
| 382 | "200": { | ||
| 383 | "description": "" | ||
| 384 | }, | ||
| 385 | "400": { | ||
| 386 | "description": "One of the provided values in the request query is invalid." | ||
| 387 | }, | ||
| 388 | "401": { | ||
| 389 | "description": "The request is not authorized." | ||
| 390 | }, | ||
| 391 | "403": { | ||
| 392 | "description": "You do not have permission to access this resource." | ||
| 393 | } | ||
| 394 | }, | ||
| 395 | "parameters": [ | ||
| 396 | { | ||
| 397 | "name": "idOrName", | ||
| 398 | "in": "path", | ||
| 399 | "required": true, | ||
| 400 | "schema": { | ||
| 401 | "type": "string" | ||
| 402 | } | ||
| 403 | }, | ||
| 404 | { | ||
| 405 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 406 | "in": "query", | ||
| 407 | "name": "teamId", | ||
| 408 | "schema": { | ||
| 409 | "type": "string", | ||
| 410 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 411 | } | ||
| 412 | }, | ||
| 413 | { | ||
| 414 | "description": "The Team slug to perform the request on behalf of.", | ||
| 415 | "in": "query", | ||
| 416 | "name": "slug", | ||
| 417 | "schema": { | ||
| 418 | "type": "string", | ||
| 419 | "example": "my-team-url-slug" | ||
| 420 | } | ||
| 421 | } | ||
| 422 | ] | ||
| 423 | } | ||
| 424 | }, | ||
| 425 | "/v1/access-groups/{idOrName}/members": { | ||
| 426 | "get": { | ||
| 427 | "description": "List members of an access group", | ||
| 428 | "operationId": "listAccessGroupMembers", | ||
| 429 | "security": [ | ||
| 430 | { | ||
| 431 | "bearerToken": [] | ||
| 432 | } | ||
| 433 | ], | ||
| 434 | "summary": "List members of an access group", | ||
| 435 | "tags": ["access-groups"], | ||
| 436 | "responses": { | ||
| 437 | "200": { | ||
| 438 | "description": "", | ||
| 439 | "content": { | ||
| 440 | "application/json": { | ||
| 441 | "schema": { | ||
| 442 | "properties": { | ||
| 443 | "members": { | ||
| 444 | "items": { | ||
| 445 | "properties": { | ||
| 446 | "avatar": { | ||
| 447 | "type": "string" | ||
| 448 | }, | ||
| 449 | "email": { | ||
| 450 | "type": "string" | ||
| 451 | }, | ||
| 452 | "uid": { | ||
| 453 | "type": "string" | ||
| 454 | }, | ||
| 455 | "username": { | ||
| 456 | "type": "string" | ||
| 457 | }, | ||
| 458 | "name": { | ||
| 459 | "type": "string" | ||
| 460 | }, | ||
| 461 | "createdAt": { | ||
| 462 | "type": "string" | ||
| 463 | }, | ||
| 464 | "teamRole": { | ||
| 465 | "type": "string", | ||
| 466 | "enum": [ | ||
| 467 | "OWNER", | ||
| 468 | "MEMBER", | ||
| 469 | "DEVELOPER", | ||
| 470 | "SECURITY", | ||
| 471 | "BILLING", | ||
| 472 | "VIEWER", | ||
| 473 | "VIEWER_FOR_PLUS", | ||
| 474 | "CONTRIBUTOR" | ||
| 475 | ] | ||
| 476 | } | ||
| 477 | }, | ||
| 478 | "required": ["email", "teamRole", "uid", "username"], | ||
| 479 | "type": "object" | ||
| 480 | }, | ||
| 481 | "type": "array" | ||
| 482 | }, | ||
| 483 | "pagination": { | ||
| 484 | "properties": { | ||
| 485 | "count": { | ||
| 486 | "type": "number" | ||
| 487 | }, | ||
| 488 | "next": { | ||
| 489 | "nullable": true, | ||
| 490 | "type": "string" | ||
| 491 | } | ||
| 492 | }, | ||
| 493 | "required": ["count", "next"], | ||
| 494 | "type": "object" | ||
| 495 | } | ||
| 496 | }, | ||
| 497 | "required": ["members", "pagination"], | ||
| 498 | "type": "object" | ||
| 499 | } | ||
| 500 | } | ||
| 501 | } | ||
| 502 | }, | ||
| 503 | "400": { | ||
| 504 | "description": "One of the provided values in the request query is invalid." | ||
| 505 | }, | ||
| 506 | "401": { | ||
| 507 | "description": "The request is not authorized." | ||
| 508 | }, | ||
| 509 | "403": { | ||
| 510 | "description": "You do not have permission to access this resource." | ||
| 511 | } | ||
| 512 | }, | ||
| 513 | "parameters": [ | ||
| 514 | { | ||
| 515 | "name": "idOrName", | ||
| 516 | "description": "The ID or name of the Access Group.", | ||
| 517 | "in": "path", | ||
| 518 | "required": true, | ||
| 519 | "schema": { | ||
| 520 | "type": "string", | ||
| 521 | "description": "The ID or name of the Access Group.", | ||
| 522 | "example": "ag_pavWOn1iLObbXLRiwVvzmPrTWyTf" | ||
| 523 | } | ||
| 524 | }, | ||
| 525 | { | ||
| 526 | "name": "limit", | ||
| 527 | "description": "Limit how many access group members should be returned.", | ||
| 528 | "in": "query", | ||
| 529 | "required": false, | ||
| 530 | "schema": { | ||
| 531 | "description": "Limit how many access group members should be returned.", | ||
| 532 | "example": 20, | ||
| 533 | "type": "integer", | ||
| 534 | "minimum": 1, | ||
| 535 | "maximum": 100 | ||
| 536 | } | ||
| 537 | }, | ||
| 538 | { | ||
| 539 | "name": "next", | ||
| 540 | "description": "Continuation cursor to retrieve the next page of results.", | ||
| 541 | "in": "query", | ||
| 542 | "required": false, | ||
| 543 | "schema": { | ||
| 544 | "description": "Continuation cursor to retrieve the next page of results.", | ||
| 545 | "type": "string" | ||
| 546 | } | ||
| 547 | }, | ||
| 548 | { | ||
| 549 | "name": "search", | ||
| 550 | "description": "Search project members by their name, username, and email.", | ||
| 551 | "in": "query", | ||
| 552 | "required": false, | ||
| 553 | "schema": { | ||
| 554 | "description": "Search project members by their name, username, and email.", | ||
| 555 | "type": "string" | ||
| 556 | } | ||
| 557 | }, | ||
| 558 | { | ||
| 559 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 560 | "in": "query", | ||
| 561 | "name": "teamId", | ||
| 562 | "schema": { | ||
| 563 | "type": "string", | ||
| 564 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 565 | } | ||
| 566 | }, | ||
| 567 | { | ||
| 568 | "description": "The Team slug to perform the request on behalf of.", | ||
| 569 | "in": "query", | ||
| 570 | "name": "slug", | ||
| 571 | "schema": { | ||
| 572 | "type": "string", | ||
| 573 | "example": "my-team-url-slug" | ||
| 574 | } | ||
| 575 | } | ||
| 576 | ] | ||
| 577 | } | ||
| 578 | }, | ||
| 579 | "/v1/access-groups": { | ||
| 580 | "get": { | ||
| 581 | "description": "List access groups", | ||
| 582 | "operationId": "listAccessGroups", | ||
| 583 | "security": [ | ||
| 584 | { | ||
| 585 | "bearerToken": [] | ||
| 586 | } | ||
| 587 | ], | ||
| 588 | "summary": "List access groups for a team, project or member", | ||
| 589 | "tags": ["access-groups"], | ||
| 590 | "responses": { | ||
| 591 | "200": { | ||
| 592 | "description": "", | ||
| 593 | "content": { | ||
| 594 | "application/json": { | ||
| 595 | "schema": { | ||
| 596 | "oneOf": [ | ||
| 597 | { | ||
| 598 | "type": "object" | ||
| 599 | }, | ||
| 600 | { | ||
| 601 | "properties": { | ||
| 602 | "accessGroups": { | ||
| 603 | "items": { | ||
| 604 | "properties": { | ||
| 605 | "members": { | ||
| 606 | "items": { | ||
| 607 | "type": "string" | ||
| 608 | }, | ||
| 609 | "type": "array" | ||
| 610 | }, | ||
| 611 | "projects": { | ||
| 612 | "items": { | ||
| 613 | "type": "string" | ||
| 614 | }, | ||
| 615 | "type": "array" | ||
| 616 | }, | ||
| 617 | "entitlements": { | ||
| 618 | "items": { | ||
| 619 | "type": "string" | ||
| 620 | }, | ||
| 621 | "type": "array" | ||
| 622 | }, | ||
| 623 | "teamPermissions": { | ||
| 624 | "items": { | ||
| 625 | "type": "string" | ||
| 626 | }, | ||
| 627 | "type": "array" | ||
| 628 | }, | ||
| 629 | "isDsyncManaged": { | ||
| 630 | "type": "boolean", | ||
| 631 | "enum": [false, true] | ||
| 632 | }, | ||
| 633 | "name": { | ||
| 634 | "type": "string", | ||
| 635 | "description": "The name of this access group.", | ||
| 636 | "example": "my-access-group" | ||
| 637 | }, | ||
| 638 | "createdAt": { | ||
| 639 | "type": "string", | ||
| 640 | "description": "Timestamp in milliseconds when the access group was created.", | ||
| 641 | "example": 1588720733602 | ||
| 642 | }, | ||
| 643 | "teamId": { | ||
| 644 | "type": "string", | ||
| 645 | "description": "ID of the team that this access group belongs to.", | ||
| 646 | "example": "team_123a6c5209bc3778245d011443644c8d27dc2c50" | ||
| 647 | }, | ||
| 648 | "updatedAt": { | ||
| 649 | "type": "string", | ||
| 650 | "description": "Timestamp in milliseconds when the access group was last updated.", | ||
| 651 | "example": 1588720733602 | ||
| 652 | }, | ||
| 653 | "accessGroupId": { | ||
| 654 | "type": "string", | ||
| 655 | "description": "ID of the access group.", | ||
| 656 | "example": "ag_123a6c5209bc3778245d011443644c8d27dc2c50" | ||
| 657 | }, | ||
| 658 | "membersCount": { | ||
| 659 | "type": "number", | ||
| 660 | "description": "Number of members in the access group.", | ||
| 661 | "example": 5 | ||
| 662 | }, | ||
| 663 | "projectsCount": { | ||
| 664 | "type": "number", | ||
| 665 | "description": "Number of projects in the access group.", | ||
| 666 | "example": 2 | ||
| 667 | }, | ||
| 668 | "teamRoles": { | ||
| 669 | "items": { | ||
| 670 | "type": "string" | ||
| 671 | }, | ||
| 672 | "type": "array", | ||
| 673 | "description": "Roles that the team has in the access group.", | ||
| 674 | "example": ["DEVELOPER", "BILLING"] | ||
| 675 | } | ||
| 676 | }, | ||
| 677 | "required": [ | ||
| 678 | "accessGroupId", | ||
| 679 | "createdAt", | ||
| 680 | "isDsyncManaged", | ||
| 681 | "membersCount", | ||
| 682 | "name", | ||
| 683 | "projectsCount", | ||
| 684 | "teamId", | ||
| 685 | "updatedAt" | ||
| 686 | ], | ||
| 687 | "type": "object" | ||
| 688 | }, | ||
| 689 | "type": "array" | ||
| 690 | }, | ||
| 691 | "pagination": { | ||
| 692 | "properties": { | ||
| 693 | "count": { | ||
| 694 | "type": "number" | ||
| 695 | }, | ||
| 696 | "next": { | ||
| 697 | "nullable": true, | ||
| 698 | "type": "string" | ||
| 699 | } | ||
| 700 | }, | ||
| 701 | "required": ["count", "next"], | ||
| 702 | "type": "object" | ||
| 703 | } | ||
| 704 | }, | ||
| 705 | "required": ["accessGroups", "pagination"], | ||
| 706 | "type": "object" | ||
| 707 | } | ||
| 708 | ] | ||
| 709 | } | ||
| 710 | } | ||
| 711 | } | ||
| 712 | }, | ||
| 713 | "400": { | ||
| 714 | "description": "One of the provided values in the request query is invalid." | ||
| 715 | }, | ||
| 716 | "401": { | ||
| 717 | "description": "The request is not authorized." | ||
| 718 | }, | ||
| 719 | "403": { | ||
| 720 | "description": "You do not have permission to access this resource." | ||
| 721 | } | ||
| 722 | }, | ||
| 723 | "x-vercel-cli": { | ||
| 724 | "supportedSubcommands": true, | ||
| 725 | "supportedProduction": false, | ||
| 726 | "aliases": ["list"] | ||
| 727 | }, | ||
| 728 | "parameters": [ | ||
| 729 | { | ||
| 730 | "name": "projectId", | ||
| 731 | "description": "Filter access groups by project.", | ||
| 732 | "in": "query", | ||
| 733 | "schema": { | ||
| 734 | "description": "Filter access groups by project.", | ||
| 735 | "example": "prj_pavWOn1iLObbx3RowVvzmPrTWyTf", | ||
| 736 | "type": "string" | ||
| 737 | } | ||
| 738 | }, | ||
| 739 | { | ||
| 740 | "name": "search", | ||
| 741 | "description": "Search for access groups by name.", | ||
| 742 | "in": "query", | ||
| 743 | "schema": { | ||
| 744 | "description": "Search for access groups by name.", | ||
| 745 | "example": "example", | ||
| 746 | "type": "string" | ||
| 747 | } | ||
| 748 | }, | ||
| 749 | { | ||
| 750 | "name": "membersLimit", | ||
| 751 | "description": "Number of members to include in the response.", | ||
| 752 | "in": "query", | ||
| 753 | "schema": { | ||
| 754 | "description": "Number of members to include in the response.", | ||
| 755 | "example": 20, | ||
| 756 | "type": "integer", | ||
| 757 | "minimum": 1, | ||
| 758 | "maximum": 100 | ||
| 759 | } | ||
| 760 | }, | ||
| 761 | { | ||
| 762 | "name": "projectsLimit", | ||
| 763 | "description": "Number of projects to include in the response.", | ||
| 764 | "in": "query", | ||
| 765 | "schema": { | ||
| 766 | "description": "Number of projects to include in the response.", | ||
| 767 | "example": 20, | ||
| 768 | "type": "integer", | ||
| 769 | "minimum": 1, | ||
| 770 | "maximum": 100 | ||
| 771 | } | ||
| 772 | }, | ||
| 773 | { | ||
| 774 | "name": "limit", | ||
| 775 | "description": "Limit how many access group should be returned.", | ||
| 776 | "in": "query", | ||
| 777 | "schema": { | ||
| 778 | "description": "Limit how many access group should be returned.", | ||
| 779 | "example": 20, | ||
| 780 | "type": "integer", | ||
| 781 | "minimum": 1, | ||
| 782 | "maximum": 100 | ||
| 783 | } | ||
| 784 | }, | ||
| 785 | { | ||
| 786 | "name": "next", | ||
| 787 | "description": "Continuation cursor to retrieve the next page of results.", | ||
| 788 | "in": "query", | ||
| 789 | "schema": { | ||
| 790 | "description": "Continuation cursor to retrieve the next page of results.", | ||
| 791 | "type": "string" | ||
| 792 | } | ||
| 793 | }, | ||
| 794 | { | ||
| 795 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 796 | "in": "query", | ||
| 797 | "name": "teamId", | ||
| 798 | "schema": { | ||
| 799 | "type": "string", | ||
| 800 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 801 | } | ||
| 802 | }, | ||
| 803 | { | ||
| 804 | "description": "The Team slug to perform the request on behalf of.", | ||
| 805 | "in": "query", | ||
| 806 | "name": "slug", | ||
| 807 | "schema": { | ||
| 808 | "type": "string", | ||
| 809 | "example": "my-team-url-slug" | ||
| 810 | } | ||
| 811 | } | ||
| 812 | ] | ||
| 813 | }, | ||
| 814 | "post": { | ||
| 815 | "description": "Allows to create an access group", | ||
| 816 | "operationId": "createAccessGroup", | ||
| 817 | "security": [ | ||
| 818 | { | ||
| 819 | "bearerToken": [] | ||
| 820 | } | ||
| 821 | ], | ||
| 822 | "summary": "Creates an access group", | ||
| 823 | "tags": ["access-groups"], | ||
| 824 | "responses": { | ||
| 825 | "200": { | ||
| 826 | "description": "", | ||
| 827 | "content": { | ||
| 828 | "application/json": { | ||
| 829 | "schema": { | ||
| 830 | "properties": { | ||
| 831 | "entitlements": { | ||
| 832 | "items": { | ||
| 833 | "type": "string", | ||
| 834 | "enum": ["v0"] | ||
| 835 | }, | ||
| 836 | "type": "array" | ||
| 837 | }, | ||
| 838 | "membersCount": { | ||
| 839 | "type": "number" | ||
| 840 | }, | ||
| 841 | "projectsCount": { | ||
| 842 | "type": "number" | ||
| 843 | }, | ||
| 844 | "name": { | ||
| 845 | "type": "string", | ||
| 846 | "description": "The name of this access group.", | ||
| 847 | "example": "my-access-group" | ||
| 848 | }, | ||
| 849 | "createdAt": { | ||
| 850 | "type": "string", | ||
| 851 | "description": "Timestamp in milliseconds when the access group was created.", | ||
| 852 | "example": 1588720733602 | ||
| 853 | }, | ||
| 854 | "teamId": { | ||
| 855 | "type": "string", | ||
| 856 | "description": "ID of the team that this access group belongs to.", | ||
| 857 | "example": "team_123a6c5209bc3778245d011443644c8d27dc2c50" | ||
| 858 | }, | ||
| 859 | "updatedAt": { | ||
| 860 | "type": "string", | ||
| 861 | "description": "Timestamp in milliseconds when the access group was last updated.", | ||
| 862 | "example": 1588720733602 | ||
| 863 | }, | ||
| 864 | "accessGroupId": { | ||
| 865 | "type": "string", | ||
| 866 | "description": "ID of the access group.", | ||
| 867 | "example": "ag_123a6c5209bc3778245d011443644c8d27dc2c50" | ||
| 868 | }, | ||
| 869 | "teamRoles": { | ||
| 870 | "items": { | ||
| 871 | "type": "string" | ||
| 872 | }, | ||
| 873 | "type": "array", | ||
| 874 | "description": "Roles that the team has in the access group.", | ||
| 875 | "example": ["DEVELOPER", "BILLING"] | ||
| 876 | }, | ||
| 877 | "teamPermissions": { | ||
| 878 | "items": { | ||
| 879 | "type": "string" | ||
| 880 | }, | ||
| 881 | "type": "array", | ||
| 882 | "description": "Permissions that the team has in the access group.", | ||
| 883 | "example": ["CreateProject"] | ||
| 884 | } | ||
| 885 | }, | ||
| 886 | "required": [ | ||
| 887 | "accessGroupId", | ||
| 888 | "createdAt", | ||
| 889 | "entitlements", | ||
| 890 | "membersCount", | ||
| 891 | "name", | ||
| 892 | "projectsCount", | ||
| 893 | "teamId", | ||
| 894 | "updatedAt" | ||
| 895 | ], | ||
| 896 | "type": "object" | ||
| 897 | } | ||
| 898 | } | ||
| 899 | } | ||
| 900 | }, | ||
| 901 | "400": { | ||
| 902 | "description": "One of the provided values in the request body is invalid." | ||
| 903 | }, | ||
| 904 | "401": { | ||
| 905 | "description": "The request is not authorized." | ||
| 906 | }, | ||
| 907 | "403": { | ||
| 908 | "description": "You do not have permission to access this resource." | ||
| 909 | } | ||
| 910 | }, | ||
| 911 | "parameters": [ | ||
| 912 | { | ||
| 913 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 914 | "in": "query", | ||
| 915 | "name": "teamId", | ||
| 916 | "schema": { | ||
| 917 | "type": "string", | ||
| 918 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 919 | } | ||
| 920 | }, | ||
| 921 | { | ||
| 922 | "description": "The Team slug to perform the request on behalf of.", | ||
| 923 | "in": "query", | ||
| 924 | "name": "slug", | ||
| 925 | "schema": { | ||
| 926 | "type": "string", | ||
| 927 | "example": "my-team-url-slug" | ||
| 928 | } | ||
| 929 | } | ||
| 930 | ], | ||
| 931 | "requestBody": { | ||
| 932 | "content": { | ||
| 933 | "application/json": { | ||
| 934 | "schema": { | ||
| 935 | "type": "object", | ||
| 936 | "additionalProperties": false, | ||
| 937 | "required": ["name"], | ||
| 938 | "properties": { | ||
| 939 | "name": { | ||
| 940 | "type": "string", | ||
| 941 | "description": "The name of the access group", | ||
| 942 | "maxLength": 50, | ||
| 943 | "pattern": "^[A-z0-9_ -]+$", | ||
| 944 | "example": "My access group" | ||
| 945 | }, | ||
| 946 | "projects": { | ||
| 947 | "type": "array", | ||
| 948 | "items": { | ||
| 949 | "type": "object", | ||
| 950 | "additionalProperties": false, | ||
| 951 | "required": ["role", "projectId"], | ||
| 952 | "properties": { | ||
| 953 | "projectId": { | ||
| 954 | "type": "string", | ||
| 955 | "maxLength": 256, | ||
| 956 | "example": "prj_ndlgr43fadlPyCtREAqxxdyFK", | ||
| 957 | "description": "The ID of the project." | ||
| 958 | }, | ||
| 959 | "role": { | ||
| 960 | "type": "string", | ||
| 961 | "example": "ADMIN", | ||
| 962 | "description": "The project role that will be added to this Access Group. \"null\" will remove this project level role.", | ||
| 963 | "nullable": true, | ||
| 964 | "enum": ["ADMIN", "PROJECT_VIEWER", "PROJECT_DEVELOPER", null] | ||
| 965 | } | ||
| 966 | } | ||
| 967 | } | ||
| 968 | }, | ||
| 969 | "membersToAdd": { | ||
| 970 | "description": "List of members to add to the access group.", | ||
| 971 | "type": "array", | ||
| 972 | "items": { | ||
| 973 | "type": "string" | ||
| 974 | }, | ||
| 975 | "example": ["usr_1a2b3c4d5e6f7g8h9i0j", "usr_2b3c4d5e6f7g8h9i0j1k"] | ||
| 976 | } | ||
| 977 | } | ||
| 978 | } | ||
| 979 | } | ||
| 980 | }, | ||
| 981 | "required": true | ||
| 982 | } | ||
| 983 | } | ||
| 984 | }, | ||
| 985 | "/v1/access-groups/{idOrName}/projects": { | ||
| 986 | "get": { | ||
| 987 | "description": "List projects of an access group", | ||
| 988 | "operationId": "listAccessGroupProjects", | ||
| 989 | "security": [ | ||
| 990 | { | ||
| 991 | "bearerToken": [] | ||
| 992 | } | ||
| 993 | ], | ||
| 994 | "summary": "List projects of an access group", | ||
| 995 | "tags": ["access-groups"], | ||
| 996 | "responses": { | ||
| 997 | "200": { | ||
| 998 | "description": "", | ||
| 999 | "content": { | ||
| 1000 | "application/json": { | ||
| 1001 | "schema": { | ||
| 1002 | "properties": { | ||
| 1003 | "projects": { | ||
| 1004 | "items": { | ||
| 1005 | "properties": { | ||
| 1006 | "projectId": { | ||
| 1007 | "type": "string" | ||
| 1008 | }, | ||
| 1009 | "role": { | ||
| 1010 | "type": "string", | ||
| 1011 | "enum": [ | ||
| 1012 | "ADMIN", | ||
| 1013 | "PROJECT_DEVELOPER", | ||
| 1014 | "PROJECT_VIEWER", | ||
| 1015 | "PROJECT_GUEST" | ||
| 1016 | ] | ||
| 1017 | }, | ||
| 1018 | "createdAt": { | ||
| 1019 | "type": "string" | ||
| 1020 | }, | ||
| 1021 | "updatedAt": { | ||
| 1022 | "type": "string" | ||
| 1023 | }, | ||
| 1024 | "project": { | ||
| 1025 | "properties": { | ||
| 1026 | "name": { | ||
| 1027 | "type": "string" | ||
| 1028 | }, | ||
| 1029 | "framework": { | ||
| 1030 | "nullable": true, | ||
| 1031 | "type": "string" | ||
| 1032 | }, | ||
| 1033 | "latestDeploymentId": { | ||
| 1034 | "type": "string" | ||
| 1035 | } | ||
| 1036 | }, | ||
| 1037 | "type": "object" | ||
| 1038 | } | ||
| 1039 | }, | ||
| 1040 | "required": ["createdAt", "project", "projectId", "role", "updatedAt"], | ||
| 1041 | "type": "object" | ||
| 1042 | }, | ||
| 1043 | "type": "array" | ||
| 1044 | }, | ||
| 1045 | "pagination": { | ||
| 1046 | "properties": { | ||
| 1047 | "count": { | ||
| 1048 | "type": "number" | ||
| 1049 | }, | ||
| 1050 | "next": { | ||
| 1051 | "nullable": true, | ||
| 1052 | "type": "string" | ||
| 1053 | } | ||
| 1054 | }, | ||
| 1055 | "required": ["count", "next"], | ||
| 1056 | "type": "object" | ||
| 1057 | } | ||
| 1058 | }, | ||
| 1059 | "required": ["pagination", "projects"], | ||
| 1060 | "type": "object" | ||
| 1061 | } | ||
| 1062 | } | ||
| 1063 | } | ||
| 1064 | }, | ||
| 1065 | "400": { | ||
| 1066 | "description": "One of the provided values in the request query is invalid." | ||
| 1067 | }, | ||
| 1068 | "401": { | ||
| 1069 | "description": "The request is not authorized." | ||
| 1070 | }, | ||
| 1071 | "403": { | ||
| 1072 | "description": "You do not have permission to access this resource." | ||
| 1073 | } | ||
| 1074 | }, | ||
| 1075 | "parameters": [ | ||
| 1076 | { | ||
| 1077 | "name": "idOrName", | ||
| 1078 | "description": "The ID or name of the Access Group.", | ||
| 1079 | "in": "path", | ||
| 1080 | "required": true, | ||
| 1081 | "schema": { | ||
| 1082 | "type": "string", | ||
| 1083 | "description": "The ID or name of the Access Group.", | ||
| 1084 | "example": "ag_pavWOn1iLObbXLRiwVvzmPrTWyTf" | ||
| 1085 | } | ||
| 1086 | }, | ||
| 1087 | { | ||
| 1088 | "name": "limit", | ||
| 1089 | "description": "Limit how many access group projects should be returned.", | ||
| 1090 | "in": "query", | ||
| 1091 | "required": false, | ||
| 1092 | "schema": { | ||
| 1093 | "description": "Limit how many access group projects should be returned.", | ||
| 1094 | "example": 20, | ||
| 1095 | "type": "integer", | ||
| 1096 | "minimum": 1, | ||
| 1097 | "maximum": 100 | ||
| 1098 | } | ||
| 1099 | }, | ||
| 1100 | { | ||
| 1101 | "name": "next", | ||
| 1102 | "description": "Continuation cursor to retrieve the next page of results.", | ||
| 1103 | "in": "query", | ||
| 1104 | "required": false, | ||
| 1105 | "schema": { | ||
| 1106 | "description": "Continuation cursor to retrieve the next page of results.", | ||
| 1107 | "type": "string" | ||
| 1108 | } | ||
| 1109 | }, | ||
| 1110 | { | ||
| 1111 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1112 | "in": "query", | ||
| 1113 | "name": "teamId", | ||
| 1114 | "schema": { | ||
| 1115 | "type": "string", | ||
| 1116 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 1117 | } | ||
| 1118 | }, | ||
| 1119 | { | ||
| 1120 | "description": "The Team slug to perform the request on behalf of.", | ||
| 1121 | "in": "query", | ||
| 1122 | "name": "slug", | ||
| 1123 | "schema": { | ||
| 1124 | "type": "string", | ||
| 1125 | "example": "my-team-url-slug" | ||
| 1126 | } | ||
| 1127 | } | ||
| 1128 | ] | ||
| 1129 | } | ||
| 1130 | }, | ||
| 1131 | "/v1/access-groups/{accessGroupIdOrName}/projects": { | ||
| 1132 | "post": { | ||
| 1133 | "description": "Allows creation of an access group project", | ||
| 1134 | "operationId": "createAccessGroupProject", | ||
| 1135 | "security": [ | ||
| 1136 | { | ||
| 1137 | "bearerToken": [] | ||
| 1138 | } | ||
| 1139 | ], | ||
| 1140 | "summary": "Create an access group project", | ||
| 1141 | "tags": ["access-groups"], | ||
| 1142 | "responses": { | ||
| 1143 | "200": { | ||
| 1144 | "description": "", | ||
| 1145 | "content": { | ||
| 1146 | "application/json": { | ||
| 1147 | "schema": { | ||
| 1148 | "properties": { | ||
| 1149 | "teamId": { | ||
| 1150 | "type": "string" | ||
| 1151 | }, | ||
| 1152 | "accessGroupId": { | ||
| 1153 | "type": "string" | ||
| 1154 | }, | ||
| 1155 | "projectId": { | ||
| 1156 | "type": "string" | ||
| 1157 | }, | ||
| 1158 | "role": { | ||
| 1159 | "type": "string", | ||
| 1160 | "enum": ["ADMIN", "PROJECT_DEVELOPER", "PROJECT_VIEWER", "PROJECT_GUEST"] | ||
| 1161 | }, | ||
| 1162 | "createdAt": { | ||
| 1163 | "type": "string" | ||
| 1164 | }, | ||
| 1165 | "updatedAt": { | ||
| 1166 | "type": "string" | ||
| 1167 | } | ||
| 1168 | }, | ||
| 1169 | "required": [ | ||
| 1170 | "accessGroupId", | ||
| 1171 | "createdAt", | ||
| 1172 | "projectId", | ||
| 1173 | "role", | ||
| 1174 | "teamId", | ||
| 1175 | "updatedAt" | ||
| 1176 | ], | ||
| 1177 | "type": "object" | ||
| 1178 | } | ||
| 1179 | } | ||
| 1180 | } | ||
| 1181 | }, | ||
| 1182 | "400": { | ||
| 1183 | "description": "One of the provided values in the request body is invalid.\nOne of the provided values in the request query is invalid." | ||
| 1184 | }, | ||
| 1185 | "401": { | ||
| 1186 | "description": "The request is not authorized." | ||
| 1187 | }, | ||
| 1188 | "403": { | ||
| 1189 | "description": "You do not have permission to access this resource." | ||
| 1190 | } | ||
| 1191 | }, | ||
| 1192 | "parameters": [ | ||
| 1193 | { | ||
| 1194 | "name": "accessGroupIdOrName", | ||
| 1195 | "in": "path", | ||
| 1196 | "required": true, | ||
| 1197 | "schema": { | ||
| 1198 | "type": "string" | ||
| 1199 | } | ||
| 1200 | }, | ||
| 1201 | { | ||
| 1202 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1203 | "in": "query", | ||
| 1204 | "name": "teamId", | ||
| 1205 | "schema": { | ||
| 1206 | "type": "string", | ||
| 1207 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 1208 | } | ||
| 1209 | }, | ||
| 1210 | { | ||
| 1211 | "description": "The Team slug to perform the request on behalf of.", | ||
| 1212 | "in": "query", | ||
| 1213 | "name": "slug", | ||
| 1214 | "schema": { | ||
| 1215 | "type": "string", | ||
| 1216 | "example": "my-team-url-slug" | ||
| 1217 | } | ||
| 1218 | } | ||
| 1219 | ], | ||
| 1220 | "requestBody": { | ||
| 1221 | "content": { | ||
| 1222 | "application/json": { | ||
| 1223 | "schema": { | ||
| 1224 | "type": "object", | ||
| 1225 | "additionalProperties": false, | ||
| 1226 | "required": ["role", "projectId"], | ||
| 1227 | "properties": { | ||
| 1228 | "projectId": { | ||
| 1229 | "type": "string", | ||
| 1230 | "maxLength": 256, | ||
| 1231 | "example": "prj_ndlgr43fadlPyCtREAqxxdyFK", | ||
| 1232 | "description": "The ID of the project." | ||
| 1233 | }, | ||
| 1234 | "role": { | ||
| 1235 | "type": "string", | ||
| 1236 | "example": "ADMIN", | ||
| 1237 | "description": "The project role that will be added to this Access Group.", | ||
| 1238 | "enum": ["ADMIN", "PROJECT_VIEWER", "PROJECT_DEVELOPER"] | ||
| 1239 | } | ||
| 1240 | } | ||
| 1241 | } | ||
| 1242 | } | ||
| 1243 | }, | ||
| 1244 | "required": true | ||
| 1245 | } | ||
| 1246 | } | ||
| 1247 | }, | ||
| 1248 | "/v1/access-groups/{accessGroupIdOrName}/projects/{projectId}": { | ||
| 1249 | "get": { | ||
| 1250 | "description": "Allows reading an access group project", | ||
| 1251 | "operationId": "readAccessGroupProject", | ||
| 1252 | "security": [ | ||
| 1253 | { | ||
| 1254 | "bearerToken": [] | ||
| 1255 | } | ||
| 1256 | ], | ||
| 1257 | "summary": "Reads an access group project", | ||
| 1258 | "tags": ["access-groups"], | ||
| 1259 | "responses": { | ||
| 1260 | "200": { | ||
| 1261 | "description": "", | ||
| 1262 | "content": { | ||
| 1263 | "application/json": { | ||
| 1264 | "schema": { | ||
| 1265 | "properties": { | ||
| 1266 | "teamId": { | ||
| 1267 | "type": "string" | ||
| 1268 | }, | ||
| 1269 | "accessGroupId": { | ||
| 1270 | "type": "string" | ||
| 1271 | }, | ||
| 1272 | "projectId": { | ||
| 1273 | "type": "string" | ||
| 1274 | }, | ||
| 1275 | "role": { | ||
| 1276 | "type": "string", | ||
| 1277 | "enum": ["ADMIN", "PROJECT_DEVELOPER", "PROJECT_VIEWER", "PROJECT_GUEST"] | ||
| 1278 | }, | ||
| 1279 | "createdAt": { | ||
| 1280 | "type": "string" | ||
| 1281 | }, | ||
| 1282 | "updatedAt": { | ||
| 1283 | "type": "string" | ||
| 1284 | } | ||
| 1285 | }, | ||
| 1286 | "required": [ | ||
| 1287 | "accessGroupId", | ||
| 1288 | "createdAt", | ||
| 1289 | "projectId", | ||
| 1290 | "role", | ||
| 1291 | "teamId", | ||
| 1292 | "updatedAt" | ||
| 1293 | ], | ||
| 1294 | "type": "object" | ||
| 1295 | } | ||
| 1296 | } | ||
| 1297 | } | ||
| 1298 | }, | ||
| 1299 | "400": { | ||
| 1300 | "description": "One of the provided values in the request query is invalid." | ||
| 1301 | }, | ||
| 1302 | "401": { | ||
| 1303 | "description": "The request is not authorized." | ||
| 1304 | }, | ||
| 1305 | "403": { | ||
| 1306 | "description": "You do not have permission to access this resource." | ||
| 1307 | } | ||
| 1308 | }, | ||
| 1309 | "parameters": [ | ||
| 1310 | { | ||
| 1311 | "name": "accessGroupIdOrName", | ||
| 1312 | "in": "path", | ||
| 1313 | "required": true, | ||
| 1314 | "schema": { | ||
| 1315 | "type": "string" | ||
| 1316 | }, | ||
| 1317 | "examples": { | ||
| 1318 | "id": { | ||
| 1319 | "summary": "Access group ID", | ||
| 1320 | "value": "ag_1a2b3c4d5e6f7g8h9i0j" | ||
| 1321 | }, | ||
| 1322 | "name": { | ||
| 1323 | "summary": "Access group name", | ||
| 1324 | "value": "My Access Group" | ||
| 1325 | } | ||
| 1326 | } | ||
| 1327 | }, | ||
| 1328 | { | ||
| 1329 | "name": "projectId", | ||
| 1330 | "in": "path", | ||
| 1331 | "required": true, | ||
| 1332 | "schema": { | ||
| 1333 | "type": "string" | ||
| 1334 | }, | ||
| 1335 | "example": "prj_ndlgr43fadlPyCtREAqxxdyFK" | ||
| 1336 | }, | ||
| 1337 | { | ||
| 1338 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1339 | "in": "query", | ||
| 1340 | "name": "teamId", | ||
| 1341 | "schema": { | ||
| 1342 | "type": "string", | ||
| 1343 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 1344 | } | ||
| 1345 | }, | ||
| 1346 | { | ||
| 1347 | "description": "The Team slug to perform the request on behalf of.", | ||
| 1348 | "in": "query", | ||
| 1349 | "name": "slug", | ||
| 1350 | "schema": { | ||
| 1351 | "type": "string", | ||
| 1352 | "example": "my-team-url-slug" | ||
| 1353 | } | ||
| 1354 | } | ||
| 1355 | ] | ||
| 1356 | }, | ||
| 1357 | "patch": { | ||
| 1358 | "description": "Allows update of an access group project", | ||
| 1359 | "operationId": "updateAccessGroupProject", | ||
| 1360 | "security": [ | ||
| 1361 | { | ||
| 1362 | "bearerToken": [] | ||
| 1363 | } | ||
| 1364 | ], | ||
| 1365 | "summary": "Update an access group project", | ||
| 1366 | "tags": ["access-groups"], | ||
| 1367 | "responses": { | ||
| 1368 | "200": { | ||
| 1369 | "description": "", | ||
| 1370 | "content": { | ||
| 1371 | "application/json": { | ||
| 1372 | "schema": { | ||
| 1373 | "properties": { | ||
| 1374 | "teamId": { | ||
| 1375 | "type": "string" | ||
| 1376 | }, | ||
| 1377 | "accessGroupId": { | ||
| 1378 | "type": "string" | ||
| 1379 | }, | ||
| 1380 | "projectId": { | ||
| 1381 | "type": "string" | ||
| 1382 | }, | ||
| 1383 | "role": { | ||
| 1384 | "type": "string", | ||
| 1385 | "enum": ["ADMIN", "PROJECT_DEVELOPER", "PROJECT_VIEWER", "PROJECT_GUEST"] | ||
| 1386 | }, | ||
| 1387 | "createdAt": { | ||
| 1388 | "type": "string" | ||
| 1389 | }, | ||
| 1390 | "updatedAt": { | ||
| 1391 | "type": "string" | ||
| 1392 | } | ||
| 1393 | }, | ||
| 1394 | "required": [ | ||
| 1395 | "accessGroupId", | ||
| 1396 | "createdAt", | ||
| 1397 | "projectId", | ||
| 1398 | "role", | ||
| 1399 | "teamId", | ||
| 1400 | "updatedAt" | ||
| 1401 | ], | ||
| 1402 | "type": "object" | ||
| 1403 | } | ||
| 1404 | } | ||
| 1405 | } | ||
| 1406 | }, | ||
| 1407 | "400": { | ||
| 1408 | "description": "One of the provided values in the request body is invalid.\nOne of the provided values in the request query is invalid." | ||
| 1409 | }, | ||
| 1410 | "401": { | ||
| 1411 | "description": "The request is not authorized." | ||
| 1412 | }, | ||
| 1413 | "403": { | ||
| 1414 | "description": "You do not have permission to access this resource." | ||
| 1415 | } | ||
| 1416 | }, | ||
| 1417 | "parameters": [ | ||
| 1418 | { | ||
| 1419 | "name": "accessGroupIdOrName", | ||
| 1420 | "in": "path", | ||
| 1421 | "required": true, | ||
| 1422 | "schema": { | ||
| 1423 | "type": "string" | ||
| 1424 | }, | ||
| 1425 | "examples": { | ||
| 1426 | "id": { | ||
| 1427 | "summary": "Access group ID", | ||
| 1428 | "value": "ag_1a2b3c4d5e6f7g8h9i0j" | ||
| 1429 | }, | ||
| 1430 | "name": { | ||
| 1431 | "summary": "Access group name", | ||
| 1432 | "value": "My Access Group" | ||
| 1433 | } | ||
| 1434 | } | ||
| 1435 | }, | ||
| 1436 | { | ||
| 1437 | "name": "projectId", | ||
| 1438 | "in": "path", | ||
| 1439 | "required": true, | ||
| 1440 | "schema": { | ||
| 1441 | "type": "string" | ||
| 1442 | }, | ||
| 1443 | "example": "prj_ndlgr43fadlPyCtREAqxxdyFK" | ||
| 1444 | }, | ||
| 1445 | { | ||
| 1446 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1447 | "in": "query", | ||
| 1448 | "name": "teamId", | ||
| 1449 | "schema": { | ||
| 1450 | "type": "string", | ||
| 1451 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 1452 | } | ||
| 1453 | }, | ||
| 1454 | { | ||
| 1455 | "description": "The Team slug to perform the request on behalf of.", | ||
| 1456 | "in": "query", | ||
| 1457 | "name": "slug", | ||
| 1458 | "schema": { | ||
| 1459 | "type": "string", | ||
| 1460 | "example": "my-team-url-slug" | ||
| 1461 | } | ||
| 1462 | } | ||
| 1463 | ], | ||
| 1464 | "requestBody": { | ||
| 1465 | "content": { | ||
| 1466 | "application/json": { | ||
| 1467 | "schema": { | ||
| 1468 | "type": "object", | ||
| 1469 | "additionalProperties": false, | ||
| 1470 | "required": ["role"], | ||
| 1471 | "properties": { | ||
| 1472 | "role": { | ||
| 1473 | "type": "string", | ||
| 1474 | "example": "ADMIN", | ||
| 1475 | "description": "The project role that will be added to this Access Group.", | ||
| 1476 | "enum": ["ADMIN", "PROJECT_VIEWER", "PROJECT_DEVELOPER", null] | ||
| 1477 | } | ||
| 1478 | } | ||
| 1479 | } | ||
| 1480 | } | ||
| 1481 | }, | ||
| 1482 | "required": true | ||
| 1483 | } | ||
| 1484 | }, | ||
| 1485 | "delete": { | ||
| 1486 | "description": "Allows deletion of an access group project", | ||
| 1487 | "operationId": "deleteAccessGroupProject", | ||
| 1488 | "security": [ | ||
| 1489 | { | ||
| 1490 | "bearerToken": [] | ||
| 1491 | } | ||
| 1492 | ], | ||
| 1493 | "summary": "Delete an access group project", | ||
| 1494 | "tags": ["access-groups"], | ||
| 1495 | "responses": { | ||
| 1496 | "200": { | ||
| 1497 | "description": "" | ||
| 1498 | }, | ||
| 1499 | "400": { | ||
| 1500 | "description": "One of the provided values in the request query is invalid." | ||
| 1501 | }, | ||
| 1502 | "401": { | ||
| 1503 | "description": "The request is not authorized." | ||
| 1504 | }, | ||
| 1505 | "403": { | ||
| 1506 | "description": "You do not have permission to access this resource." | ||
| 1507 | } | ||
| 1508 | }, | ||
| 1509 | "parameters": [ | ||
| 1510 | { | ||
| 1511 | "name": "accessGroupIdOrName", | ||
| 1512 | "in": "path", | ||
| 1513 | "required": true, | ||
| 1514 | "schema": { | ||
| 1515 | "type": "string" | ||
| 1516 | }, | ||
| 1517 | "examples": { | ||
| 1518 | "id": { | ||
| 1519 | "summary": "Access group ID", | ||
| 1520 | "value": "ag_1a2b3c4d5e6f7g8h9i0j" | ||
| 1521 | }, | ||
| 1522 | "name": { | ||
| 1523 | "summary": "Access group name", | ||
| 1524 | "value": "My Access Group" | ||
| 1525 | } | ||
| 1526 | } | ||
| 1527 | }, | ||
| 1528 | { | ||
| 1529 | "name": "projectId", | ||
| 1530 | "in": "path", | ||
| 1531 | "required": true, | ||
| 1532 | "schema": { | ||
| 1533 | "type": "string" | ||
| 1534 | }, | ||
| 1535 | "example": "prj_ndlgr43fadlPyCtREAqxxdyFK" | ||
| 1536 | }, | ||
| 1537 | { | ||
| 1538 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1539 | "in": "query", | ||
| 1540 | "name": "teamId", | ||
| 1541 | "schema": { | ||
| 1542 | "type": "string", | ||
| 1543 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 1544 | } | ||
| 1545 | }, | ||
| 1546 | { | ||
| 1547 | "description": "The Team slug to perform the request on behalf of.", | ||
| 1548 | "in": "query", | ||
| 1549 | "name": "slug", | ||
| 1550 | "schema": { | ||
| 1551 | "type": "string", | ||
| 1552 | "example": "my-team-url-slug" | ||
| 1553 | } | ||
| 1554 | } | ||
| 1555 | ] | ||
| 1556 | } | ||
| 1557 | }, | ||
| 1558 | "/v8/artifacts/events": { | ||
| 1559 | "post": { | ||
| 1560 | "description": "Records an artifacts cache usage event. The body of this request is an array of cache usage events. The supported event types are `HIT` and `MISS`. The source is either `LOCAL` the cache event was on the users filesystem cache or `REMOTE` if the cache event is for a remote cache. When the event is a `HIT` the request also accepts a number `duration` which is the time taken to generate the artifact in the cache.", | ||
| 1561 | "operationId": "recordEvents", | ||
| 1562 | "security": [ | ||
| 1563 | { | ||
| 1564 | "bearerToken": [] | ||
| 1565 | } | ||
| 1566 | ], | ||
| 1567 | "summary": "Record an artifacts cache usage event", | ||
| 1568 | "tags": ["artifacts"], | ||
| 1569 | "responses": { | ||
| 1570 | "200": { | ||
| 1571 | "description": "Success. Event recorded." | ||
| 1572 | }, | ||
| 1573 | "400": { | ||
| 1574 | "description": "One of the provided values in the request body is invalid.\nOne of the provided values in the headers is invalid" | ||
| 1575 | }, | ||
| 1576 | "401": { | ||
| 1577 | "description": "The request is not authorized." | ||
| 1578 | }, | ||
| 1579 | "402": { | ||
| 1580 | "description": "The account is missing a payment so payment method must be updated" | ||
| 1581 | }, | ||
| 1582 | "403": { | ||
| 1583 | "description": "The customer has reached their spend cap limit and has been paused. An owner can disable the cap or raise the limit in settings.\nThe Remote Caching usage limit has been reached for this account for this billing cycle.\nRemote Caching has been disabled for this team or user. An owner can enable it in the billing settings.\nYou do not have permission to access this resource." | ||
| 1584 | } | ||
| 1585 | }, | ||
| 1586 | "parameters": [ | ||
| 1587 | { | ||
| 1588 | "in": "header", | ||
| 1589 | "description": "The continuous integration or delivery environment where this artifact is downloaded.", | ||
| 1590 | "schema": { | ||
| 1591 | "type": "string", | ||
| 1592 | "description": "The continuous integration or delivery environment where this artifact is downloaded.", | ||
| 1593 | "example": "VERCEL", | ||
| 1594 | "maxLength": 50 | ||
| 1595 | }, | ||
| 1596 | "name": "'x-Artifact-Client-Ci'" | ||
| 1597 | }, | ||
| 1598 | { | ||
| 1599 | "in": "header", | ||
| 1600 | "description": "1 if the client is an interactive shell. Otherwise 0", | ||
| 1601 | "schema": { | ||
| 1602 | "type": "integer", | ||
| 1603 | "description": "1 if the client is an interactive shell. Otherwise 0", | ||
| 1604 | "example": 0, | ||
| 1605 | "minimum": 0, | ||
| 1606 | "maximum": 1 | ||
| 1607 | }, | ||
| 1608 | "name": "'x-Artifact-Client-Interactive'" | ||
| 1609 | }, | ||
| 1610 | { | ||
| 1611 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1612 | "in": "query", | ||
| 1613 | "name": "teamId", | ||
| 1614 | "schema": { | ||
| 1615 | "type": "string", | ||
| 1616 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 1617 | } | ||
| 1618 | }, | ||
| 1619 | { | ||
| 1620 | "description": "The Team slug to perform the request on behalf of.", | ||
| 1621 | "in": "query", | ||
| 1622 | "name": "slug", | ||
| 1623 | "schema": { | ||
| 1624 | "type": "string", | ||
| 1625 | "example": "my-team-url-slug" | ||
| 1626 | } | ||
| 1627 | } | ||
| 1628 | ], | ||
| 1629 | "requestBody": { | ||
| 1630 | "content": { | ||
| 1631 | "application/json": { | ||
| 1632 | "schema": { | ||
| 1633 | "type": "array", | ||
| 1634 | "items": { | ||
| 1635 | "type": "object", | ||
| 1636 | "additionalProperties": false, | ||
| 1637 | "required": ["sessionId", "source", "hash", "event"], | ||
| 1638 | "properties": { | ||
| 1639 | "sessionId": { | ||
| 1640 | "type": "string", | ||
| 1641 | "description": "A UUID (universally unique identifer) for the session that generated this event." | ||
| 1642 | }, | ||
| 1643 | "source": { | ||
| 1644 | "type": "string", | ||
| 1645 | "enum": ["LOCAL", "REMOTE"], | ||
| 1646 | "description": "One of `LOCAL` or `REMOTE`. `LOCAL` specifies that the cache event was from the user's filesystem cache. `REMOTE` specifies that the cache event is from a remote cache." | ||
| 1647 | }, | ||
| 1648 | "event": { | ||
| 1649 | "type": "string", | ||
| 1650 | "enum": ["HIT", "MISS"], | ||
| 1651 | "description": "One of `HIT` or `MISS`. `HIT` specifies that a cached artifact for `hash` was found in the cache. `MISS` specifies that a cached artifact with `hash` was not found." | ||
| 1652 | }, | ||
| 1653 | "hash": { | ||
| 1654 | "type": "string", | ||
| 1655 | "example": "12HKQaOmR5t5Uy6vdcQsNIiZgHGB", | ||
| 1656 | "description": "The artifact hash" | ||
| 1657 | }, | ||
| 1658 | "duration": { | ||
| 1659 | "type": "number", | ||
| 1660 | "description": "The time taken to generate the artifact. This should be sent as a body parameter on `HIT` events.", | ||
| 1661 | "example": 400 | ||
| 1662 | } | ||
| 1663 | } | ||
| 1664 | } | ||
| 1665 | } | ||
| 1666 | } | ||
| 1667 | }, | ||
| 1668 | "required": true | ||
| 1669 | } | ||
| 1670 | } | ||
| 1671 | }, | ||
| 1672 | "/v8/artifacts/status": { | ||
| 1673 | "get": { | ||
| 1674 | "description": "Check the status of Remote Caching for this principal. Returns a JSON-encoded status indicating if Remote Caching is enabled, disabled, or disabled due to usage limits.", | ||
| 1675 | "operationId": "status", | ||
| 1676 | "security": [ | ||
| 1677 | { | ||
| 1678 | "bearerToken": [] | ||
| 1679 | } | ||
| 1680 | ], | ||
| 1681 | "summary": "Get status of Remote Caching for this principal", | ||
| 1682 | "tags": ["artifacts"], | ||
| 1683 | "responses": { | ||
| 1684 | "200": { | ||
| 1685 | "description": "", | ||
| 1686 | "content": { | ||
| 1687 | "application/json": { | ||
| 1688 | "schema": { | ||
| 1689 | "oneOf": [ | ||
| 1690 | { | ||
| 1691 | "properties": { | ||
| 1692 | "status": { | ||
| 1693 | "type": "string" | ||
| 1694 | } | ||
| 1695 | }, | ||
| 1696 | "required": ["status"], | ||
| 1697 | "type": "object" | ||
| 1698 | }, | ||
| 1699 | { | ||
| 1700 | "properties": { | ||
| 1701 | "status": { | ||
| 1702 | "type": "string", | ||
| 1703 | "enum": ["disabled", "enabled", "over_limit", "paused"] | ||
| 1704 | } | ||
| 1705 | }, | ||
| 1706 | "required": ["status"], | ||
| 1707 | "type": "object" | ||
| 1708 | } | ||
| 1709 | ] | ||
| 1710 | } | ||
| 1711 | } | ||
| 1712 | } | ||
| 1713 | }, | ||
| 1714 | "400": { | ||
| 1715 | "description": "" | ||
| 1716 | }, | ||
| 1717 | "401": { | ||
| 1718 | "description": "The request is not authorized." | ||
| 1719 | }, | ||
| 1720 | "402": { | ||
| 1721 | "description": "The account is missing a payment so payment method must be updated" | ||
| 1722 | }, | ||
| 1723 | "403": { | ||
| 1724 | "description": "You do not have permission to access this resource." | ||
| 1725 | } | ||
| 1726 | }, | ||
| 1727 | "parameters": [ | ||
| 1728 | { | ||
| 1729 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1730 | "in": "query", | ||
| 1731 | "name": "teamId", | ||
| 1732 | "schema": { | ||
| 1733 | "type": "string", | ||
| 1734 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 1735 | } | ||
| 1736 | }, | ||
| 1737 | { | ||
| 1738 | "description": "The Team slug to perform the request on behalf of.", | ||
| 1739 | "in": "query", | ||
| 1740 | "name": "slug", | ||
| 1741 | "schema": { | ||
| 1742 | "type": "string", | ||
| 1743 | "example": "my-team-url-slug" | ||
| 1744 | } | ||
| 1745 | } | ||
| 1746 | ] | ||
| 1747 | } | ||
| 1748 | }, | ||
| 1749 | "/v8/artifacts/{hash}": { | ||
| 1750 | "put": { | ||
| 1751 | "description": "Uploads a cache artifact identified by the `hash` specified on the path. The cache artifact can then be downloaded with the provided `hash`.", | ||
| 1752 | "operationId": "uploadArtifact", | ||
| 1753 | "security": [ | ||
| 1754 | { | ||
| 1755 | "bearerToken": [] | ||
| 1756 | } | ||
| 1757 | ], | ||
| 1758 | "summary": "Upload a cache artifact", | ||
| 1759 | "tags": ["artifacts"], | ||
| 1760 | "responses": { | ||
| 1761 | "202": { | ||
| 1762 | "description": "File successfully uploaded", | ||
| 1763 | "content": { | ||
| 1764 | "application/json": { | ||
| 1765 | "schema": { | ||
| 1766 | "properties": { | ||
| 1767 | "urls": { | ||
| 1768 | "items": { | ||
| 1769 | "type": "string" | ||
| 1770 | }, | ||
| 1771 | "type": "array", | ||
| 1772 | "description": "Array of URLs where the artifact was updated", | ||
| 1773 | "example": [ | ||
| 1774 | "https://api.vercel.com/v2/now/artifact/12HKQaOmR5t5Uy6vdcQsNIiZgHGB" | ||
| 1775 | ] | ||
| 1776 | } | ||
| 1777 | }, | ||
| 1778 | "required": ["urls"], | ||
| 1779 | "type": "object" | ||
| 1780 | } | ||
| 1781 | } | ||
| 1782 | } | ||
| 1783 | }, | ||
| 1784 | "400": { | ||
| 1785 | "description": "One of the provided values in the request query is invalid.\nOne of the provided values in the headers is invalid\nFile size is not valid" | ||
| 1786 | }, | ||
| 1787 | "401": { | ||
| 1788 | "description": "The request is not authorized." | ||
| 1789 | }, | ||
| 1790 | "402": { | ||
| 1791 | "description": "The account is missing a payment so payment method must be updated" | ||
| 1792 | }, | ||
| 1793 | "403": { | ||
| 1794 | "description": "The customer has reached their spend cap limit and has been paused. An owner can disable the cap or raise the limit in settings.\nThe Remote Caching usage limit has been reached for this account for this billing cycle.\nRemote Caching has been disabled for this team or user. An owner can enable it in the billing settings.\nYou do not have permission to access this resource." | ||
| 1795 | } | ||
| 1796 | }, | ||
| 1797 | "parameters": [ | ||
| 1798 | { | ||
| 1799 | "in": "header", | ||
| 1800 | "description": "The artifact size in bytes", | ||
| 1801 | "required": false, | ||
| 1802 | "schema": { | ||
| 1803 | "description": "The artifact size in bytes", | ||
| 1804 | "type": "number" | ||
| 1805 | }, | ||
| 1806 | "name": "'content-Length'" | ||
| 1807 | }, | ||
| 1808 | { | ||
| 1809 | "in": "header", | ||
| 1810 | "description": "The time taken to generate the uploaded artifact in milliseconds.", | ||
| 1811 | "required": false, | ||
| 1812 | "schema": { | ||
| 1813 | "type": "number", | ||
| 1814 | "description": "The time taken to generate the uploaded artifact in milliseconds.", | ||
| 1815 | "example": 400 | ||
| 1816 | }, | ||
| 1817 | "name": "'x-Artifact-Duration'" | ||
| 1818 | }, | ||
| 1819 | { | ||
| 1820 | "in": "header", | ||
| 1821 | "description": "The continuous integration or delivery environment where this artifact was generated.", | ||
| 1822 | "required": false, | ||
| 1823 | "schema": { | ||
| 1824 | "type": "string", | ||
| 1825 | "description": "The continuous integration or delivery environment where this artifact was generated.", | ||
| 1826 | "example": "VERCEL", | ||
| 1827 | "maxLength": 50 | ||
| 1828 | }, | ||
| 1829 | "name": "'x-Artifact-Client-Ci'" | ||
| 1830 | }, | ||
| 1831 | { | ||
| 1832 | "in": "header", | ||
| 1833 | "description": "1 if the client is an interactive shell. Otherwise 0", | ||
| 1834 | "required": false, | ||
| 1835 | "schema": { | ||
| 1836 | "type": "integer", | ||
| 1837 | "description": "1 if the client is an interactive shell. Otherwise 0", | ||
| 1838 | "example": 0, | ||
| 1839 | "minimum": 0, | ||
| 1840 | "maximum": 1 | ||
| 1841 | }, | ||
| 1842 | "name": "'x-Artifact-Client-Interactive'" | ||
| 1843 | }, | ||
| 1844 | { | ||
| 1845 | "in": "header", | ||
| 1846 | "description": "The base64 encoded tag for this artifact. The value is sent back to clients when the artifact is downloaded as the header `x-artifact-tag`", | ||
| 1847 | "required": false, | ||
| 1848 | "schema": { | ||
| 1849 | "type": "string", | ||
| 1850 | "description": "The base64 encoded tag for this artifact. The value is sent back to clients when the artifact is downloaded as the header `x-artifact-tag`", | ||
| 1851 | "example": "Tc0BmHvJYMIYJ62/zx87YqO0Flxk+5Ovip25NY825CQ=", | ||
| 1852 | "maxLength": 600 | ||
| 1853 | }, | ||
| 1854 | "name": "'x-Artifact-Tag'" | ||
| 1855 | }, | ||
| 1856 | { | ||
| 1857 | "in": "header", | ||
| 1858 | "description": "The SHA of the source control revision that generated this artifact.", | ||
| 1859 | "required": false, | ||
| 1860 | "schema": { | ||
| 1861 | "type": "string", | ||
| 1862 | "description": "The SHA of the source control revision that generated this artifact.", | ||
| 1863 | "maxLength": 200 | ||
| 1864 | }, | ||
| 1865 | "name": "'x-Artifact-Sha'" | ||
| 1866 | }, | ||
| 1867 | { | ||
| 1868 | "in": "header", | ||
| 1869 | "description": "A hash representing uncommitted changes in the working directory when this artifact was generated.", | ||
| 1870 | "required": false, | ||
| 1871 | "schema": { | ||
| 1872 | "type": "string", | ||
| 1873 | "description": "A hash representing uncommitted changes in the working directory when this artifact was generated.", | ||
| 1874 | "maxLength": 200 | ||
| 1875 | }, | ||
| 1876 | "name": "'x-Artifact-Dirty-Hash'" | ||
| 1877 | }, | ||
| 1878 | { | ||
| 1879 | "name": "hash", | ||
| 1880 | "description": "The artifact hash", | ||
| 1881 | "in": "path", | ||
| 1882 | "required": true, | ||
| 1883 | "schema": { | ||
| 1884 | "example": "12HKQaOmR5t5Uy6vdcQsNIiZgHGB", | ||
| 1885 | "description": "The artifact hash", | ||
| 1886 | "type": "string" | ||
| 1887 | } | ||
| 1888 | }, | ||
| 1889 | { | ||
| 1890 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1891 | "in": "query", | ||
| 1892 | "name": "teamId", | ||
| 1893 | "schema": { | ||
| 1894 | "type": "string", | ||
| 1895 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 1896 | } | ||
| 1897 | }, | ||
| 1898 | { | ||
| 1899 | "description": "The Team slug to perform the request on behalf of.", | ||
| 1900 | "in": "query", | ||
| 1901 | "name": "slug", | ||
| 1902 | "schema": { | ||
| 1903 | "type": "string", | ||
| 1904 | "example": "my-team-url-slug" | ||
| 1905 | } | ||
| 1906 | } | ||
| 1907 | ], | ||
| 1908 | "requestBody": { | ||
| 1909 | "content": { | ||
| 1910 | "application/octet-stream": { | ||
| 1911 | "schema": { | ||
| 1912 | "type": "string", | ||
| 1913 | "format": "binary" | ||
| 1914 | } | ||
| 1915 | } | ||
| 1916 | }, | ||
| 1917 | "required": true | ||
| 1918 | }, | ||
| 1919 | "x-speakeasy-test": false | ||
| 1920 | }, | ||
| 1921 | "get": { | ||
| 1922 | "description": "Downloads a cache artifact indentified by its `hash` specified on the request path. The artifact is downloaded as an octet-stream. The client should verify the content-length header and response body.", | ||
| 1923 | "operationId": "downloadArtifact", | ||
| 1924 | "security": [ | ||
| 1925 | { | ||
| 1926 | "bearerToken": [] | ||
| 1927 | } | ||
| 1928 | ], | ||
| 1929 | "summary": "Download a cache artifact", | ||
| 1930 | "tags": ["artifacts"], | ||
| 1931 | "responses": { | ||
| 1932 | "200": { | ||
| 1933 | "description": "The artifact was found and is downloaded as a stream. Content-Length should be verified.", | ||
| 1934 | "content": { | ||
| 1935 | "application/json": { | ||
| 1936 | "schema": { | ||
| 1937 | "type": "string", | ||
| 1938 | "format": "binary", | ||
| 1939 | "description": "An octet stream response that will be piped to the response stream." | ||
| 1940 | } | ||
| 1941 | } | ||
| 1942 | } | ||
| 1943 | }, | ||
| 1944 | "400": { | ||
| 1945 | "description": "One of the provided values in the request query is invalid.\nOne of the provided values in the headers is invalid" | ||
| 1946 | }, | ||
| 1947 | "401": { | ||
| 1948 | "description": "The request is not authorized." | ||
| 1949 | }, | ||
| 1950 | "402": { | ||
| 1951 | "description": "The account is missing a payment so payment method must be updated" | ||
| 1952 | }, | ||
| 1953 | "403": { | ||
| 1954 | "description": "The customer has reached their spend cap limit and has been paused. An owner can disable the cap or raise the limit in settings.\nThe Remote Caching usage limit has been reached for this account for this billing cycle.\nRemote Caching has been disabled for this team or user. An owner can enable it in the billing settings.\nYou do not have permission to access this resource." | ||
| 1955 | }, | ||
| 1956 | "404": { | ||
| 1957 | "description": "The artifact was not found" | ||
| 1958 | } | ||
| 1959 | }, | ||
| 1960 | "parameters": [ | ||
| 1961 | { | ||
| 1962 | "in": "header", | ||
| 1963 | "description": "The continuous integration or delivery environment where this artifact is downloaded.", | ||
| 1964 | "schema": { | ||
| 1965 | "type": "string", | ||
| 1966 | "description": "The continuous integration or delivery environment where this artifact is downloaded.", | ||
| 1967 | "example": "VERCEL", | ||
| 1968 | "maxLength": 50 | ||
| 1969 | }, | ||
| 1970 | "name": "'x-Artifact-Client-Ci'" | ||
| 1971 | }, | ||
| 1972 | { | ||
| 1973 | "in": "header", | ||
| 1974 | "description": "1 if the client is an interactive shell. Otherwise 0", | ||
| 1975 | "schema": { | ||
| 1976 | "type": "integer", | ||
| 1977 | "description": "1 if the client is an interactive shell. Otherwise 0", | ||
| 1978 | "example": 0, | ||
| 1979 | "minimum": 0, | ||
| 1980 | "maximum": 1 | ||
| 1981 | }, | ||
| 1982 | "name": "'x-Artifact-Client-Interactive'" | ||
| 1983 | }, | ||
| 1984 | { | ||
| 1985 | "name": "hash", | ||
| 1986 | "description": "The artifact hash", | ||
| 1987 | "in": "path", | ||
| 1988 | "required": true, | ||
| 1989 | "schema": { | ||
| 1990 | "example": "12HKQaOmR5t5Uy6vdcQsNIiZgHGB", | ||
| 1991 | "description": "The artifact hash", | ||
| 1992 | "type": "string" | ||
| 1993 | } | ||
| 1994 | }, | ||
| 1995 | { | ||
| 1996 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 1997 | "in": "query", | ||
| 1998 | "name": "teamId", | ||
| 1999 | "schema": { | ||
| 2000 | "type": "string", | ||
| 2001 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 2002 | } | ||
| 2003 | }, | ||
| 2004 | { | ||
| 2005 | "description": "The Team slug to perform the request on behalf of.", | ||
| 2006 | "in": "query", | ||
| 2007 | "name": "slug", | ||
| 2008 | "schema": { | ||
| 2009 | "type": "string", | ||
| 2010 | "example": "my-team-url-slug" | ||
| 2011 | } | ||
| 2012 | } | ||
| 2013 | ] | ||
| 2014 | }, | ||
| 2015 | "head": { | ||
| 2016 | "description": "Check that a cache artifact with the given `hash` exists. This request returns response headers only and is equivalent to a `GET` request to this endpoint where the response contains no body.", | ||
| 2017 | "operationId": "artifactExists", | ||
| 2018 | "security": [ | ||
| 2019 | { | ||
| 2020 | "bearerToken": [] | ||
| 2021 | } | ||
| 2022 | ], | ||
| 2023 | "summary": "Check if a cache artifact exists", | ||
| 2024 | "tags": ["artifacts"], | ||
| 2025 | "responses": { | ||
| 2026 | "200": { | ||
| 2027 | "description": "The artifact was found and headers are returned" | ||
| 2028 | }, | ||
| 2029 | "400": { | ||
| 2030 | "description": "One of the provided values in the request query is invalid." | ||
| 2031 | }, | ||
| 2032 | "401": { | ||
| 2033 | "description": "The request is not authorized." | ||
| 2034 | }, | ||
| 2035 | "402": { | ||
| 2036 | "description": "The account is missing a payment so payment method must be updated" | ||
| 2037 | }, | ||
| 2038 | "403": { | ||
| 2039 | "description": "The customer has reached their spend cap limit and has been paused. An owner can disable the cap or raise the limit in settings.\nThe Remote Caching usage limit has been reached for this account for this billing cycle.\nRemote Caching has been disabled for this team or user. An owner can enable it in the billing settings.\nYou do not have permission to access this resource." | ||
| 2040 | }, | ||
| 2041 | "404": { | ||
| 2042 | "description": "The artifact was not found" | ||
| 2043 | } | ||
| 2044 | }, | ||
| 2045 | "parameters": [ | ||
| 2046 | { | ||
| 2047 | "name": "hash", | ||
| 2048 | "description": "The artifact hash", | ||
| 2049 | "in": "path", | ||
| 2050 | "required": true, | ||
| 2051 | "schema": { | ||
| 2052 | "example": "12HKQaOmR5t5Uy6vdcQsNIiZgHGB", | ||
| 2053 | "description": "The artifact hash", | ||
| 2054 | "type": "string" | ||
| 2055 | } | ||
| 2056 | }, | ||
| 2057 | { | ||
| 2058 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 2059 | "in": "query", | ||
| 2060 | "name": "teamId", | ||
| 2061 | "schema": { | ||
| 2062 | "type": "string", | ||
| 2063 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 2064 | } | ||
| 2065 | }, | ||
| 2066 | { | ||
| 2067 | "description": "The Team slug to perform the request on behalf of.", | ||
| 2068 | "in": "query", | ||
| 2069 | "name": "slug", | ||
| 2070 | "schema": { | ||
| 2071 | "type": "string", | ||
| 2072 | "example": "my-team-url-slug" | ||
| 2073 | } | ||
| 2074 | } | ||
| 2075 | ] | ||
| 2076 | } | ||
| 2077 | }, | ||
| 2078 | "/v8/artifacts": { | ||
| 2079 | "post": { | ||
| 2080 | "description": "Query information about an array of artifacts.", | ||
| 2081 | "operationId": "artifactQuery", | ||
| 2082 | "security": [ | ||
| 2083 | { | ||
| 2084 | "bearerToken": [] | ||
| 2085 | } | ||
| 2086 | ], | ||
| 2087 | "summary": "Query information about an artifact", | ||
| 2088 | "tags": ["artifacts"], | ||
| 2089 | "responses": { | ||
| 2090 | "200": { | ||
| 2091 | "description": "", | ||
| 2092 | "content": { | ||
| 2093 | "application/json": { | ||
| 2094 | "schema": { | ||
| 2095 | "additionalProperties": { | ||
| 2096 | "nullable": true, | ||
| 2097 | "oneOf": [ | ||
| 2098 | { | ||
| 2099 | "properties": { | ||
| 2100 | "size": { | ||
| 2101 | "type": "number" | ||
| 2102 | }, | ||
| 2103 | "taskDurationMs": { | ||
| 2104 | "type": "number" | ||
| 2105 | }, | ||
| 2106 | "tag": { | ||
| 2107 | "type": "string" | ||
| 2108 | }, | ||
| 2109 | "sha": { | ||
| 2110 | "type": "string" | ||
| 2111 | }, | ||
| 2112 | "dirtyHash": { | ||
| 2113 | "type": "string" | ||
| 2114 | } | ||
| 2115 | }, | ||
| 2116 | "required": ["size", "taskDurationMs"], | ||
| 2117 | "type": "object" | ||
| 2118 | }, | ||
| 2119 | { | ||
| 2120 | "properties": { | ||
| 2121 | "error": { | ||
| 2122 | "properties": { | ||
| 2123 | "message": { | ||
| 2124 | "type": "string" | ||
| 2125 | } | ||
| 2126 | }, | ||
| 2127 | "required": ["message"], | ||
| 2128 | "type": "object" | ||
| 2129 | } | ||
| 2130 | }, | ||
| 2131 | "required": ["error"], | ||
| 2132 | "type": "object" | ||
| 2133 | } | ||
| 2134 | ] | ||
| 2135 | }, | ||
| 2136 | "type": "object" | ||
| 2137 | } | ||
| 2138 | } | ||
| 2139 | } | ||
| 2140 | }, | ||
| 2141 | "400": { | ||
| 2142 | "description": "One of the provided values in the request body is invalid." | ||
| 2143 | }, | ||
| 2144 | "401": { | ||
| 2145 | "description": "The request is not authorized." | ||
| 2146 | }, | ||
| 2147 | "402": { | ||
| 2148 | "description": "The account is missing a payment so payment method must be updated" | ||
| 2149 | }, | ||
| 2150 | "403": { | ||
| 2151 | "description": "The customer has reached their spend cap limit and has been paused. An owner can disable the cap or raise the limit in settings.\nThe Remote Caching usage limit has been reached for this account for this billing cycle.\nRemote Caching has been disabled for this team or user. An owner can enable it in the billing settings.\nYou do not have permission to access this resource." | ||
| 2152 | } | ||
| 2153 | }, | ||
| 2154 | "parameters": [ | ||
| 2155 | { | ||
| 2156 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 2157 | "in": "query", | ||
| 2158 | "name": "teamId", | ||
| 2159 | "schema": { | ||
| 2160 | "type": "string", | ||
| 2161 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 2162 | } | ||
| 2163 | }, | ||
| 2164 | { | ||
| 2165 | "description": "The Team slug to perform the request on behalf of.", | ||
| 2166 | "in": "query", | ||
| 2167 | "name": "slug", | ||
| 2168 | "schema": { | ||
| 2169 | "type": "string", | ||
| 2170 | "example": "my-team-url-slug" | ||
| 2171 | } | ||
| 2172 | } | ||
| 2173 | ], | ||
| 2174 | "requestBody": { | ||
| 2175 | "content": { | ||
| 2176 | "application/json": { | ||
| 2177 | "schema": { | ||
| 2178 | "type": "object", | ||
| 2179 | "required": ["hashes"], | ||
| 2180 | "properties": { | ||
| 2181 | "hashes": { | ||
| 2182 | "items": { | ||
| 2183 | "type": "string" | ||
| 2184 | }, | ||
| 2185 | "description": "artifact hashes", | ||
| 2186 | "type": "array", | ||
| 2187 | "example": ["12HKQaOmR5t5Uy6vdcQsNIiZgHGB", "34HKQaOmR5t5Uy6vasdasdasdasd"] | ||
| 2188 | } | ||
| 2189 | } | ||
| 2190 | } | ||
| 2191 | } | ||
| 2192 | }, | ||
| 2193 | "required": true | ||
| 2194 | } | ||
| 2195 | } | ||
| 2196 | }, | ||
| 2197 | "/v1/billing/charges": { | ||
| 2198 | "get": { | ||
| 2199 | "description": "Returns the billing charge data in FOCUS v1.3 JSONL format for a specified Vercel team, within a date range specified by `from` and `to` query parameters. Supports 1-day granularity with a maximum date range of 1 year. The response is streamed as newline-delimited JSON (JSONL) and can be optionally compressed with gzip if the `Accept-Encoding: gzip` header is provided. This is only available for Owner, Member, Developer, Security, Billing, and Enterprise Viewer roles for the supplied team.", | ||
| 2200 | "operationId": "listBillingCharges", | ||
| 2201 | "security": [ | ||
| 2202 | { | ||
| 2203 | "bearerToken": [] | ||
| 2204 | } | ||
| 2205 | ], | ||
| 2206 | "summary": "List FOCUS billing charges", | ||
| 2207 | "tags": ["billing"], | ||
| 2208 | "responses": { | ||
| 2209 | "200": { | ||
| 2210 | "description": "", | ||
| 2211 | "content": { | ||
| 2212 | "application/jsonl": { | ||
| 2213 | "schema": { | ||
| 2214 | "properties": { | ||
| 2215 | "BilledCost": { | ||
| 2216 | "type": "number", | ||
| 2217 | "description": "Charge amount serving as the basis for invoicing" | ||
| 2218 | }, | ||
| 2219 | "BillingCurrency": { | ||
| 2220 | "type": "string", | ||
| 2221 | "enum": ["USD"], | ||
| 2222 | "description": "Currency used for billing (ISO 4217)" | ||
| 2223 | }, | ||
| 2224 | "ChargeCategory": { | ||
| 2225 | "type": "string", | ||
| 2226 | "enum": ["Adjustment", "Credit", "Purchase", "Tax", "Usage"], | ||
| 2227 | "description": "Classification of the charge" | ||
| 2228 | }, | ||
| 2229 | "ChargePeriodStart": { | ||
| 2230 | "type": "string", | ||
| 2231 | "description": "Inclusive start of the charge period (ISO 8601 UTC)" | ||
| 2232 | }, | ||
| 2233 | "ChargePeriodEnd": { | ||
| 2234 | "type": "string", | ||
| 2235 | "description": "Exclusive end of the charge period (ISO 8601 UTC) - Required in v1.3" | ||
| 2236 | }, | ||
| 2237 | "ConsumedQuantity": { | ||
| 2238 | "nullable": true, | ||
| 2239 | "type": "number", | ||
| 2240 | "description": "Volume of resource consumed. Null when a charge does not involve measurable consumption quantity." | ||
| 2241 | }, | ||
| 2242 | "ConsumedUnit": { | ||
| 2243 | "nullable": true, | ||
| 2244 | "type": "string", | ||
| 2245 | "description": "Unit of measurement for consumed quantity. Null when the charge is not measured in units." | ||
| 2246 | }, | ||
| 2247 | "EffectiveCost": { | ||
| 2248 | "type": "number", | ||
| 2249 | "description": "Amortized cost representation including discounts, pre-commitment credit purchase amount, etc." | ||
| 2250 | }, | ||
| 2251 | "RegionId": { | ||
| 2252 | "type": "string", | ||
| 2253 | "description": "Provider-assigned region identifier" | ||
| 2254 | }, | ||
| 2255 | "RegionName": { | ||
| 2256 | "type": "string", | ||
| 2257 | "description": "Display name for the region" | ||
| 2258 | }, | ||
| 2259 | "ServiceName": { | ||
| 2260 | "type": "string", | ||
| 2261 | "description": "Display name for the service/product" | ||
| 2262 | }, | ||
| 2263 | "ServiceCategory": { | ||
| 2264 | "type": "string", | ||
| 2265 | "enum": [ | ||
| 2266 | "AI and Machine Learning", | ||
| 2267 | "Analytics", | ||
| 2268 | "Business Applications", | ||
| 2269 | "Compute", | ||
| 2270 | "Databases", | ||
| 2271 | "Developer Tools", | ||
| 2272 | "Multicloud", | ||
| 2273 | "Identity", | ||
| 2274 | "Integration", | ||
| 2275 | "Internet of Things", | ||
| 2276 | "Management and Governance", | ||
| 2277 | "Media", | ||
| 2278 | "Migration", | ||
| 2279 | "Mobile", | ||
| 2280 | "Networking", | ||
| 2281 | "Security", | ||
| 2282 | "Storage", | ||
| 2283 | "Web", | ||
| 2284 | "Other" | ||
| 2285 | ], | ||
| 2286 | "description": "High-level category of the service" | ||
| 2287 | }, | ||
| 2288 | "ServiceProviderName": { | ||
| 2289 | "type": "string", | ||
| 2290 | "description": "Entity making the resource/service available for purchase (v1.3)" | ||
| 2291 | }, | ||
| 2292 | "Tags": { | ||
| 2293 | "additionalProperties": { | ||
| 2294 | "type": "string" | ||
| 2295 | }, | ||
| 2296 | "type": "object", | ||
| 2297 | "description": "Charge metadata including the Vercel ProjectId and ProjectName information" | ||
| 2298 | }, | ||
| 2299 | "PricingCategory": { | ||
| 2300 | "type": "string", | ||
| 2301 | "enum": ["Other", "Standard", "Dynamic", "Committed"], | ||
| 2302 | "description": "Pricing model used for the charge." | ||
| 2303 | }, | ||
| 2304 | "PricingCurrency": { | ||
| 2305 | "type": "string", | ||
| 2306 | "enum": ["USD"] | ||
| 2307 | }, | ||
| 2308 | "PricingQuantity": { | ||
| 2309 | "type": "number" | ||
| 2310 | }, | ||
| 2311 | "PricingUnit": { | ||
| 2312 | "type": "string" | ||
| 2313 | } | ||
| 2314 | }, | ||
| 2315 | "required": [ | ||
| 2316 | "BilledCost", | ||
| 2317 | "BillingCurrency", | ||
| 2318 | "ChargeCategory", | ||
| 2319 | "ChargePeriodEnd", | ||
| 2320 | "ChargePeriodStart", | ||
| 2321 | "ConsumedQuantity", | ||
| 2322 | "ConsumedUnit", | ||
| 2323 | "EffectiveCost", | ||
| 2324 | "PricingCategory", | ||
| 2325 | "PricingCurrency", | ||
| 2326 | "PricingQuantity", | ||
| 2327 | "PricingUnit", | ||
| 2328 | "ServiceName", | ||
| 2329 | "ServiceProviderName", | ||
| 2330 | "Tags" | ||
| 2331 | ], | ||
| 2332 | "type": "object", | ||
| 2333 | "description": "Extension of the base schema for Focus charges. Includes pricing information for all customers." | ||
| 2334 | } | ||
| 2335 | } | ||
| 2336 | } | ||
| 2337 | }, | ||
| 2338 | "400": { | ||
| 2339 | "description": "One of the provided values in the request query is invalid." | ||
| 2340 | }, | ||
| 2341 | "401": { | ||
| 2342 | "description": "The request is not authorized." | ||
| 2343 | }, | ||
| 2344 | "403": { | ||
| 2345 | "description": "You do not have permission to access this resource." | ||
| 2346 | }, | ||
| 2347 | "404": { | ||
| 2348 | "description": "" | ||
| 2349 | }, | ||
| 2350 | "500": { | ||
| 2351 | "description": "" | ||
| 2352 | }, | ||
| 2353 | "503": { | ||
| 2354 | "description": "" | ||
| 2355 | } | ||
| 2356 | }, | ||
| 2357 | "parameters": [ | ||
| 2358 | { | ||
| 2359 | "name": "from", | ||
| 2360 | "description": "Inclusive start of the date range as an ISO 8601 date-time string in UTC.", | ||
| 2361 | "in": "query", | ||
| 2362 | "required": true, | ||
| 2363 | "schema": { | ||
| 2364 | "type": "string", | ||
| 2365 | "description": "Inclusive start of the date range as an ISO 8601 date-time string in UTC.", | ||
| 2366 | "example": "2025-01-01T00:00:00.000Z" | ||
| 2367 | } | ||
| 2368 | }, | ||
| 2369 | { | ||
| 2370 | "name": "to", | ||
| 2371 | "description": "Exclusive end of the date range as an ISO 8601 date-time string in UTC.", | ||
| 2372 | "in": "query", | ||
| 2373 | "required": true, | ||
| 2374 | "schema": { | ||
| 2375 | "type": "string", | ||
| 2376 | "description": "Exclusive end of the date range as an ISO 8601 date-time string in UTC.", | ||
| 2377 | "example": "2025-01-31T00:00:00.000Z" | ||
| 2378 | } | ||
| 2379 | }, | ||
| 2380 | { | ||
| 2381 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 2382 | "in": "query", | ||
| 2383 | "name": "teamId", | ||
| 2384 | "schema": { | ||
| 2385 | "type": "string", | ||
| 2386 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 2387 | } | ||
| 2388 | }, | ||
| 2389 | { | ||
| 2390 | "description": "The Team slug to perform the request on behalf of.", | ||
| 2391 | "in": "query", | ||
| 2392 | "name": "slug", | ||
| 2393 | "schema": { | ||
| 2394 | "type": "string", | ||
| 2395 | "example": "my-team-url-slug" | ||
| 2396 | } | ||
| 2397 | } | ||
| 2398 | ], | ||
| 2399 | "x-codeSamples": [ | ||
| 2400 | { | ||
| 2401 | "lang": "curl", | ||
| 2402 | "label": "cURL", | ||
| 2403 | "source": "curl -N --request GET \\\n --url 'https://api.vercel.com/v1/billing/charges?teamId=\u003cteam\u003e\u0026from=\u003cfrom_date\u003e\u0026to=\u003cto_date\u003e' \\\n --header 'Authorization: Bearer \u003ctoken\u003e' \\\n --header 'Accept-Encoding: gzip' \\\n --compressed\n" | ||
| 2404 | } | ||
| 2405 | ] | ||
| 2406 | } | ||
| 2407 | }, | ||
| 2408 | "/v1/billing/contract-commitments": { | ||
| 2409 | "get": { | ||
| 2410 | "description": "Returns commitment allocations per contract period in FOCUS v1.3 JSONL format for a specified Vercel team. The response is streamed as newline-delimited JSON (JSONL). This endpoint is only applicable to Enterprise Vercel customers. An empty response is returned for non-Enterprise (Pro/Flex) customers.", | ||
| 2411 | "operationId": "listContractCommitments", | ||
| 2412 | "security": [ | ||
| 2413 | { | ||
| 2414 | "bearerToken": [] | ||
| 2415 | } | ||
| 2416 | ], | ||
| 2417 | "summary": "List FOCUS contract commitments", | ||
| 2418 | "tags": ["billing"], | ||
| 2419 | "responses": { | ||
| 2420 | "200": { | ||
| 2421 | "description": "", | ||
| 2422 | "content": { | ||
| 2423 | "application/jsonl": { | ||
| 2424 | "schema": { | ||
| 2425 | "properties": { | ||
| 2426 | "ContractCommitmentCategory": { | ||
| 2427 | "type": "string", | ||
| 2428 | "enum": ["Usage", "Spend"], | ||
| 2429 | "description": "Highest-level classification of the contract commitment. 'Spend' for Pro ($20/month), 'Usage' for Enterprise (MIU allocation)." | ||
| 2430 | }, | ||
| 2431 | "ContractCommitmentCost": { | ||
| 2432 | "type": "number", | ||
| 2433 | "description": "Monetary value of the contract commitment (in BillingCurrency). Required when ContractCommitmentCategory is 'Spend'. For Pro: 20 (USD)" | ||
| 2434 | }, | ||
| 2435 | "ContractCommitmentDescription": { | ||
| 2436 | "type": "string", | ||
| 2437 | "description": "Self-contained summary of the contract commitment's terms" | ||
| 2438 | }, | ||
| 2439 | "ContractCommitmentId": { | ||
| 2440 | "type": "string", | ||
| 2441 | "description": "Unique identifier for a single contract term within a contract. Maps to specific commitment period or allocation ID." | ||
| 2442 | }, | ||
| 2443 | "ContractCommitmentPeriodStart": { | ||
| 2444 | "type": "string", | ||
| 2445 | "description": "Inclusive start of the commitment term period (ISO 8601 UTC)" | ||
| 2446 | }, | ||
| 2447 | "ContractCommitmentPeriodEnd": { | ||
| 2448 | "type": "string", | ||
| 2449 | "description": "Exclusive end of the commitment term period (ISO 8601 UTC)" | ||
| 2450 | }, | ||
| 2451 | "ContractCommitmentQuantity": { | ||
| 2452 | "type": "number", | ||
| 2453 | "description": "Amount associated with the commitment (in ContractCommitmentUnit). Required when ContractCommitmentCategory is 'Usage'. For Enterprise: MIU allocation amount." | ||
| 2454 | }, | ||
| 2455 | "ContractCommitmentType": { | ||
| 2456 | "type": "string", | ||
| 2457 | "description": "Service-provider-assigned name identifying the commitment type. 'Pro' or 'Enterprise' for Vercel." | ||
| 2458 | }, | ||
| 2459 | "ContractCommitmentUnit": { | ||
| 2460 | "type": "string", | ||
| 2461 | "description": "Measurement unit for ContractCommitmentQuantity. 'MIUs' for Enterprise, 'USD' for Pro spend commitments." | ||
| 2462 | }, | ||
| 2463 | "ContractId": { | ||
| 2464 | "type": "string", | ||
| 2465 | "description": "Service-provider-assigned identifier for a contract. Maps to Orb Subscription ID for Vercel." | ||
| 2466 | }, | ||
| 2467 | "ContractPeriodStart": { | ||
| 2468 | "type": "string", | ||
| 2469 | "description": "Inclusive start of the overall contract period (ISO 8601 UTC)" | ||
| 2470 | }, | ||
| 2471 | "ContractPeriodEnd": { | ||
| 2472 | "type": "string", | ||
| 2473 | "description": "Exclusive end of the overall contract period (ISO 8601 UTC)" | ||
| 2474 | }, | ||
| 2475 | "BillingCurrency": { | ||
| 2476 | "type": "string" | ||
| 2477 | } | ||
| 2478 | }, | ||
| 2479 | "required": [ | ||
| 2480 | "BillingCurrency", | ||
| 2481 | "ContractCommitmentCategory", | ||
| 2482 | "ContractCommitmentId", | ||
| 2483 | "ContractCommitmentPeriodEnd", | ||
| 2484 | "ContractCommitmentPeriodStart", | ||
| 2485 | "ContractCommitmentType", | ||
| 2486 | "ContractCommitmentUnit", | ||
| 2487 | "ContractId", | ||
| 2488 | "ContractPeriodEnd", | ||
| 2489 | "ContractPeriodStart" | ||
| 2490 | ], | ||
| 2491 | "type": "object", | ||
| 2492 | "description": "Contract commitment information describing terms within a contract. New in FOCUS v1.3 - tracks commitment terms separate from cost/usage rows. For Vercel: - Pro: $20 monthly spend commitment - Enterprise: MIU allocation per period (usage commitment)" | ||
| 2493 | } | ||
| 2494 | } | ||
| 2495 | } | ||
| 2496 | }, | ||
| 2497 | "400": { | ||
| 2498 | "description": "" | ||
| 2499 | }, | ||
| 2500 | "401": { | ||
| 2501 | "description": "The request is not authorized." | ||
| 2502 | }, | ||
| 2503 | "403": { | ||
| 2504 | "description": "You do not have permission to access this resource." | ||
| 2505 | }, | ||
| 2506 | "404": { | ||
| 2507 | "description": "" | ||
| 2508 | } | ||
| 2509 | }, | ||
| 2510 | "parameters": [ | ||
| 2511 | { | ||
| 2512 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 2513 | "in": "query", | ||
| 2514 | "name": "teamId", | ||
| 2515 | "schema": { | ||
| 2516 | "type": "string", | ||
| 2517 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 2518 | } | ||
| 2519 | }, | ||
| 2520 | { | ||
| 2521 | "description": "The Team slug to perform the request on behalf of.", | ||
| 2522 | "in": "query", | ||
| 2523 | "name": "slug", | ||
| 2524 | "schema": { | ||
| 2525 | "type": "string", | ||
| 2526 | "example": "my-team-url-slug" | ||
| 2527 | } | ||
| 2528 | } | ||
| 2529 | ] | ||
| 2530 | } | ||
| 2531 | }, | ||
| 2532 | "/v1/billing/buy": { | ||
| 2533 | "post": { | ||
| 2534 | "description": "Purchases credits for a Vercel team using the default payment method on file. The purchase is charged immediately via Stripe invoice. Supported credit types are `v0`, `gateway`, and `agent`. The `amount` field specifies the number of credits to purchase and must be a positive integer. An optional `source` query parameter can be provided to identify the caller. Defaults to `api` if not specified. This is only available for Owner, Member, Developer, Security, and Billing roles for the supplied team.", | ||
| 2535 | "operationId": "buyCredits", | ||
| 2536 | "security": [ | ||
| 2537 | { | ||
| 2538 | "bearerToken": [] | ||
| 2539 | } | ||
| 2540 | ], | ||
| 2541 | "summary": "Purchase credits", | ||
| 2542 | "tags": ["billing"], | ||
| 2543 | "responses": { | ||
| 2544 | "200": { | ||
| 2545 | "description": "", | ||
| 2546 | "content": { | ||
| 2547 | "application/json": { | ||
| 2548 | "schema": { | ||
| 2549 | "oneOf": [ | ||
| 2550 | { | ||
| 2551 | "properties": { | ||
| 2552 | "checkoutSessionId": { | ||
| 2553 | "type": "string" | ||
| 2554 | }, | ||
| 2555 | "checkoutSessionUrl": { | ||
| 2556 | "type": "string" | ||
| 2557 | } | ||
| 2558 | }, | ||
| 2559 | "required": ["checkoutSessionId", "checkoutSessionUrl"], | ||
| 2560 | "type": "object" | ||
| 2561 | }, | ||
| 2562 | { | ||
| 2563 | "properties": { | ||
| 2564 | "purchaseIntent": { | ||
| 2565 | "properties": { | ||
| 2566 | "id": { | ||
| 2567 | "type": "string", | ||
| 2568 | "description": "The unique ID of a Purchase Intent. Uses the format `pur_*`" | ||
| 2569 | }, | ||
| 2570 | "configuration": { | ||
| 2571 | "oneOf": [ | ||
| 2572 | { | ||
| 2573 | "properties": { | ||
| 2574 | "options": { | ||
| 2575 | "properties": { | ||
| 2576 | "amount": { | ||
| 2577 | "type": "string", | ||
| 2578 | "description": "The amount of currency to buy" | ||
| 2579 | }, | ||
| 2580 | "currency": { | ||
| 2581 | "type": "string", | ||
| 2582 | "enum": [ | ||
| 2583 | "copper_test_units", | ||
| 2584 | "ai_credits", | ||
| 2585 | "ai_gateway_credits", | ||
| 2586 | "v0_user_credits", | ||
| 2587 | "vercel_agent_credits" | ||
| 2588 | ], | ||
| 2589 | "description": "The currency being purchased" | ||
| 2590 | }, | ||
| 2591 | "expirationDate": { | ||
| 2592 | "type": "string", | ||
| 2593 | "description": "The expiration date of the credits being purchased" | ||
| 2594 | } | ||
| 2595 | }, | ||
| 2596 | "required": ["amount", "currency"], | ||
| 2597 | "type": "object", | ||
| 2598 | "description": "Purchase configuration specific options" | ||
| 2599 | }, | ||
| 2600 | "output": { | ||
| 2601 | "nullable": true | ||
| 2602 | }, | ||
| 2603 | "type": { | ||
| 2604 | "type": "string", | ||
| 2605 | "enum": ["credit_topup"] | ||
| 2606 | } | ||
| 2607 | }, | ||
| 2608 | "required": ["options", "output", "type"], | ||
| 2609 | "type": "object", | ||
| 2610 | "description": "The configuration for a credit purchase" | ||
| 2611 | }, | ||
| 2612 | { | ||
| 2613 | "properties": { | ||
| 2614 | "options": { | ||
| 2615 | "properties": { | ||
| 2616 | "items": { | ||
| 2617 | "items": { | ||
| 2618 | "properties": { | ||
| 2619 | "name": { | ||
| 2620 | "type": "string" | ||
| 2621 | }, | ||
| 2622 | "subtotal": { | ||
| 2623 | "type": "string", | ||
| 2624 | "description": "The subtotal of the domain name purchase" | ||
| 2625 | }, | ||
| 2626 | "type": { | ||
| 2627 | "type": "string", | ||
| 2628 | "enum": ["purchase", "renewal", "transfer"] | ||
| 2629 | }, | ||
| 2630 | "years": { | ||
| 2631 | "type": "number", | ||
| 2632 | "description": "The number of years to purchase" | ||
| 2633 | } | ||
| 2634 | }, | ||
| 2635 | "required": ["name", "subtotal", "type", "years"], | ||
| 2636 | "type": "object" | ||
| 2637 | }, | ||
| 2638 | "type": "array" | ||
| 2639 | }, | ||
| 2640 | "orderId": { | ||
| 2641 | "type": "string", | ||
| 2642 | "description": "The order ID of the domain name purchase" | ||
| 2643 | } | ||
| 2644 | }, | ||
| 2645 | "required": ["items", "orderId"], | ||
| 2646 | "type": "object" | ||
| 2647 | }, | ||
| 2648 | "output": { | ||
| 2649 | "nullable": true | ||
| 2650 | }, | ||
| 2651 | "type": { | ||
| 2652 | "type": "string", | ||
| 2653 | "enum": ["domain_name"] | ||
| 2654 | } | ||
| 2655 | }, | ||
| 2656 | "required": ["options", "output", "type"], | ||
| 2657 | "type": "object", | ||
| 2658 | "description": "The configuration for a credit purchase" | ||
| 2659 | }, | ||
| 2660 | { | ||
| 2661 | "properties": { | ||
| 2662 | "options": { | ||
| 2663 | "properties": { | ||
| 2664 | "effectiveDate": { | ||
| 2665 | "oneOf": [ | ||
| 2666 | { | ||
| 2667 | "type": "object", | ||
| 2668 | "description": "The effective date of the plan change" | ||
| 2669 | }, | ||
| 2670 | { | ||
| 2671 | "type": "string", | ||
| 2672 | "enum": ["immediate", "end_of_subscription_term"] | ||
| 2673 | } | ||
| 2674 | ] | ||
| 2675 | }, | ||
| 2676 | "orbSubscriptionId": { | ||
| 2677 | "type": "string", | ||
| 2678 | "description": "The ID of the Orb subscription to change" | ||
| 2679 | }, | ||
| 2680 | "alignBillingWithPlanChangeDate": { | ||
| 2681 | "type": "boolean", | ||
| 2682 | "enum": [false, true], | ||
| 2683 | "description": "Whether or not to reset the billing cycle" | ||
| 2684 | }, | ||
| 2685 | "couponRedemptionCode": { | ||
| 2686 | "type": "string", | ||
| 2687 | "description": "The coupon redemption code to apply to the plan change" | ||
| 2688 | }, | ||
| 2689 | "externalPlanId": { | ||
| 2690 | "type": "string", | ||
| 2691 | "description": "The ID of the external plan to change to" | ||
| 2692 | }, | ||
| 2693 | "replacePrices": { | ||
| 2694 | "items": { | ||
| 2695 | "properties": { | ||
| 2696 | "fixedPriceQuantity": { | ||
| 2697 | "type": "number", | ||
| 2698 | "description": "The quantity for the fixed price" | ||
| 2699 | }, | ||
| 2700 | "replacesPriceId": { | ||
| 2701 | "type": "string", | ||
| 2702 | "description": "The ID of the price to replace" | ||
| 2703 | } | ||
| 2704 | }, | ||
| 2705 | "required": ["fixedPriceQuantity", "replacesPriceId"], | ||
| 2706 | "type": "object", | ||
| 2707 | "description": "The prices to replace in the subscription" | ||
| 2708 | }, | ||
| 2709 | "type": "array", | ||
| 2710 | "description": "The prices to replace in the subscription" | ||
| 2711 | } | ||
| 2712 | }, | ||
| 2713 | "required": ["effectiveDate", "orbSubscriptionId"], | ||
| 2714 | "type": "object" | ||
| 2715 | }, | ||
| 2716 | "output": { | ||
| 2717 | "properties": { | ||
| 2718 | "pendingSubscriptionChangeId": { | ||
| 2719 | "type": "string", | ||
| 2720 | "description": "The ID of the pending subscription change" | ||
| 2721 | } | ||
| 2722 | }, | ||
| 2723 | "required": ["pendingSubscriptionChangeId"], | ||
| 2724 | "type": "object" | ||
| 2725 | }, | ||
| 2726 | "type": { | ||
| 2727 | "type": "string", | ||
| 2728 | "enum": ["orb_plan_change"] | ||
| 2729 | } | ||
| 2730 | }, | ||
| 2731 | "required": ["options", "output", "type"], | ||
| 2732 | "type": "object", | ||
| 2733 | "description": "The configuration for a credit purchase" | ||
| 2734 | }, | ||
| 2735 | { | ||
| 2736 | "properties": { | ||
| 2737 | "options": { | ||
| 2738 | "type": "object" | ||
| 2739 | }, | ||
| 2740 | "output": { | ||
| 2741 | "properties": { | ||
| 2742 | "pendingSubscriptionChangeId": { | ||
| 2743 | "type": "string", | ||
| 2744 | "description": "The ID of the pending subscription change" | ||
| 2745 | } | ||
| 2746 | }, | ||
| 2747 | "required": ["pendingSubscriptionChangeId"], | ||
| 2748 | "type": "object" | ||
| 2749 | }, | ||
| 2750 | "type": { | ||
| 2751 | "type": "string", | ||
| 2752 | "enum": ["orb_price_interval"] | ||
| 2753 | } | ||
| 2754 | }, | ||
| 2755 | "required": ["options", "output", "type"], | ||
| 2756 | "type": "object", | ||
| 2757 | "description": "The configuration for a credit purchase" | ||
| 2758 | }, | ||
| 2759 | { | ||
| 2760 | "properties": { | ||
| 2761 | "options": { | ||
| 2762 | "properties": { | ||
| 2763 | "externalPlanId": { | ||
| 2764 | "type": "string", | ||
| 2765 | "description": "The external plan ID of the Orb plan to subscribe to" | ||
| 2766 | }, | ||
| 2767 | "addPrices": { | ||
| 2768 | "items": { | ||
| 2769 | "oneOf": [ | ||
| 2770 | { | ||
| 2771 | "properties": { | ||
| 2772 | "priceId": { | ||
| 2773 | "type": "string", | ||
| 2774 | "description": "The ID of the price to add" | ||
| 2775 | } | ||
| 2776 | }, | ||
| 2777 | "required": ["priceId"], | ||
| 2778 | "type": "object", | ||
| 2779 | "description": "The prices to add to the subscription" | ||
| 2780 | }, | ||
| 2781 | { | ||
| 2782 | "type": "object", | ||
| 2783 | "description": "The prices to add to the subscription" | ||
| 2784 | } | ||
| 2785 | ] | ||
| 2786 | }, | ||
| 2787 | "type": "array", | ||
| 2788 | "description": "The prices to add to the subscription" | ||
| 2789 | }, | ||
| 2790 | "alignBillingWithSubscriptionStartDate": { | ||
| 2791 | "type": "boolean", | ||
| 2792 | "enum": [false, true], | ||
| 2793 | "description": "Whether to align the subscription start date with the billing subscription start date" | ||
| 2794 | }, | ||
| 2795 | "couponRedemptionCode": { | ||
| 2796 | "type": "string", | ||
| 2797 | "description": "The coupon redemption code to apply to the subscription" | ||
| 2798 | }, | ||
| 2799 | "initialPhaseOrder": { | ||
| 2800 | "type": "number", | ||
| 2801 | "description": "The initial phase order to use for the subscription" | ||
| 2802 | }, | ||
| 2803 | "metadata": { | ||
| 2804 | "additionalProperties": { | ||
| 2805 | "nullable": true, | ||
| 2806 | "type": "string", | ||
| 2807 | "description": "Optional metadata to associate with the subscription" | ||
| 2808 | }, | ||
| 2809 | "type": "object", | ||
| 2810 | "description": "Optional metadata to associate with the subscription" | ||
| 2811 | }, | ||
| 2812 | "removePrices": { | ||
| 2813 | "items": { | ||
| 2814 | "properties": { | ||
| 2815 | "priceId": { | ||
| 2816 | "type": "string", | ||
| 2817 | "description": "The ID of the price to remove" | ||
| 2818 | } | ||
| 2819 | }, | ||
| 2820 | "required": ["priceId"], | ||
| 2821 | "type": "object", | ||
| 2822 | "description": "The prices to remove in the subscription" | ||
| 2823 | }, | ||
| 2824 | "type": "array", | ||
| 2825 | "description": "The prices to remove in the subscription" | ||
| 2826 | }, | ||
| 2827 | "replacePrices": { | ||
| 2828 | "items": { | ||
| 2829 | "properties": { | ||
| 2830 | "fixedPriceQuantity": { | ||
| 2831 | "type": "number", | ||
| 2832 | "description": "The quantity for the fixed price" | ||
| 2833 | }, | ||
| 2834 | "replacesPriceId": { | ||
| 2835 | "type": "string", | ||
| 2836 | "description": "The ID of the price to replace" | ||
| 2837 | } | ||
| 2838 | }, | ||
| 2839 | "required": ["fixedPriceQuantity", "replacesPriceId"], | ||
| 2840 | "type": "object", | ||
| 2841 | "description": "The prices to replace in the subscription" | ||
| 2842 | }, | ||
| 2843 | "type": "array", | ||
| 2844 | "description": "The prices to replace in the subscription" | ||
| 2845 | }, | ||
| 2846 | "startDate": { | ||
| 2847 | "type": "string", | ||
| 2848 | "description": "The start date of the subscription" | ||
| 2849 | } | ||
| 2850 | }, | ||
| 2851 | "required": ["externalPlanId"], | ||
| 2852 | "type": "object" | ||
| 2853 | }, | ||
| 2854 | "output": { | ||
| 2855 | "properties": { | ||
| 2856 | "pendingSubscriptionChangeId": { | ||
| 2857 | "type": "string", | ||
| 2858 | "description": "The ID of the pending subscription change" | ||
| 2859 | } | ||
| 2860 | }, | ||
| 2861 | "required": ["pendingSubscriptionChangeId"], | ||
| 2862 | "type": "object" | ||
| 2863 | }, | ||
| 2864 | "type": { | ||
| 2865 | "type": "string", | ||
| 2866 | "enum": ["orb_subscription"] | ||
| 2867 | } | ||
| 2868 | }, | ||
| 2869 | "required": ["options", "output", "type"], | ||
| 2870 | "type": "object", | ||
| 2871 | "description": "The configuration for a credit purchase" | ||
| 2872 | }, | ||
| 2873 | { | ||
| 2874 | "properties": { | ||
| 2875 | "options": { | ||
| 2876 | "properties": { | ||
| 2877 | "orbCustomerId": { | ||
| 2878 | "type": "string", | ||
| 2879 | "description": "The ID of the Orb customer to create" | ||
| 2880 | }, | ||
| 2881 | "orbExternalCustomerId": { | ||
| 2882 | "type": "string", | ||
| 2883 | "description": "The external ID of the Orb customer to create" | ||
| 2884 | }, | ||
| 2885 | "orbExternalPlanId": { | ||
| 2886 | "type": "string", | ||
| 2887 | "description": "The external ID of the Orb plan to create" | ||
| 2888 | }, | ||
| 2889 | "orbPendingSubscriptionChangeId": { | ||
| 2890 | "type": "string", | ||
| 2891 | "description": "The ID of the pending subscription change" | ||
| 2892 | }, | ||
| 2893 | "orbPlanId": { | ||
| 2894 | "type": "string", | ||
| 2895 | "description": "The ID of the Orb plan to create" | ||
| 2896 | }, | ||
| 2897 | "orbSubscriptionId": { | ||
| 2898 | "type": "string", | ||
| 2899 | "description": "The ID of the Orb subscription to create" | ||
| 2900 | }, | ||
| 2901 | "lineItems": { | ||
| 2902 | "items": { | ||
| 2903 | "properties": { | ||
| 2904 | "id": { | ||
| 2905 | "type": "string", | ||
| 2906 | "description": "The ID of the line item" | ||
| 2907 | }, | ||
| 2908 | "description": { | ||
| 2909 | "type": "string", | ||
| 2910 | "description": "The description of the line item" | ||
| 2911 | }, | ||
| 2912 | "name": { | ||
| 2913 | "type": "string", | ||
| 2914 | "description": "The name of the line item" | ||
| 2915 | }, | ||
| 2916 | "productId": { | ||
| 2917 | "type": "string", | ||
| 2918 | "description": "The ID of the product being purchased" | ||
| 2919 | }, | ||
| 2920 | "quantity": { | ||
| 2921 | "type": "string", | ||
| 2922 | "description": "The quantity of the line item" | ||
| 2923 | }, | ||
| 2924 | "unitAmount": { | ||
| 2925 | "type": "string", | ||
| 2926 | "description": "The unit amount of the line item" | ||
| 2927 | }, | ||
| 2928 | "metadata": { | ||
| 2929 | "additionalProperties": { | ||
| 2930 | "type": "string" | ||
| 2931 | }, | ||
| 2932 | "type": "object", | ||
| 2933 | "description": "Optional metadata for the line item" | ||
| 2934 | }, | ||
| 2935 | "productAlias": { | ||
| 2936 | "type": "string", | ||
| 2937 | "description": "The alias of the product being purchased" | ||
| 2938 | }, | ||
| 2939 | "refund": { | ||
| 2940 | "type": "string", | ||
| 2941 | "description": "The amount of the line item that has been refunded" | ||
| 2942 | } | ||
| 2943 | }, | ||
| 2944 | "required": [ | ||
| 2945 | "description", | ||
| 2946 | "id", | ||
| 2947 | "name", | ||
| 2948 | "productId", | ||
| 2949 | "quantity", | ||
| 2950 | "unitAmount" | ||
| 2951 | ], | ||
| 2952 | "type": "object", | ||
| 2953 | "description": "The line items that make up the Purchase Intent." | ||
| 2954 | }, | ||
| 2955 | "type": "array", | ||
| 2956 | "description": "The line items that make up the Purchase Intent." | ||
| 2957 | } | ||
| 2958 | }, | ||
| 2959 | "required": [ | ||
| 2960 | "orbCustomerId", | ||
| 2961 | "orbExternalCustomerId", | ||
| 2962 | "orbExternalPlanId", | ||
| 2963 | "orbPendingSubscriptionChangeId", | ||
| 2964 | "orbPlanId", | ||
| 2965 | "orbSubscriptionId" | ||
| 2966 | ], | ||
| 2967 | "type": "object" | ||
| 2968 | }, | ||
| 2969 | "output": { | ||
| 2970 | "properties": { | ||
| 2971 | "pendingSubscriptionChangeId": { | ||
| 2972 | "type": "string", | ||
| 2973 | "description": "The ID of the pending subscription change" | ||
| 2974 | } | ||
| 2975 | }, | ||
| 2976 | "required": ["pendingSubscriptionChangeId"], | ||
| 2977 | "type": "object" | ||
| 2978 | }, | ||
| 2979 | "type": { | ||
| 2980 | "type": "string", | ||
| 2981 | "enum": ["orb_subscription_intent"] | ||
| 2982 | } | ||
| 2983 | }, | ||
| 2984 | "required": ["options", "output", "type"], | ||
| 2985 | "type": "object", | ||
| 2986 | "description": "The configuration for a credit purchase" | ||
| 2987 | } | ||
| 2988 | ] | ||
| 2989 | }, | ||
| 2990 | "createdAt": { | ||
| 2991 | "type": "string", | ||
| 2992 | "description": "The datetime when the Purchase Intent was created." | ||
| 2993 | }, | ||
| 2994 | "currency": { | ||
| 2995 | "type": "string", | ||
| 2996 | "enum": ["usd", "miu"], | ||
| 2997 | "description": "The currency for the purchase intent" | ||
| 2998 | }, | ||
| 2999 | "ownerId": { | ||
| 3000 | "type": "string", | ||
| 3001 | "description": "The ID of the owner of the Purchase Intent." | ||
| 3002 | }, | ||
| 3003 | "provider": { | ||
| 3004 | "properties": { | ||
| 3005 | "resourceId": { | ||
| 3006 | "type": "string", | ||
| 3007 | "description": "Provider resource id" | ||
| 3008 | }, | ||
| 3009 | "type": { | ||
| 3010 | "type": "string", | ||
| 3011 | "enum": [ | ||
| 3012 | "stripe_elements", | ||
| 3013 | "stripe_hosted", | ||
| 3014 | "stripe_invoice_deferred", | ||
| 3015 | "stripe_invoice_immediate", | ||
| 3016 | "stripe_invoice_elements", | ||
| 3017 | "tackle_aws_marketplace", | ||
| 3018 | "orb_ledger", | ||
| 3019 | "apple_in_app_purchase" | ||
| 3020 | ], | ||
| 3021 | "description": "The type of the purchase provider" | ||
| 3022 | }, | ||
| 3023 | "currencyConversionRate": { | ||
| 3024 | "type": "string", | ||
| 3025 | "description": "The currency conversion rate used by the provider" | ||
| 3026 | }, | ||
| 3027 | "stripeSharedPaymentTokenUsed": { | ||
| 3028 | "type": "boolean", | ||
| 3029 | "enum": [false, true], | ||
| 3030 | "description": "Whether a Stripe Shared Payment Token was used for this purchase. Only applicable when type is stripe_invoice_immediate." | ||
| 3031 | } | ||
| 3032 | }, | ||
| 3033 | "required": ["resourceId", "type"], | ||
| 3034 | "type": "object" | ||
| 3035 | }, | ||
| 3036 | "status": { | ||
| 3037 | "type": "string", | ||
| 3038 | "enum": ["pending", "succeeded", "failed"], | ||
| 3039 | "description": "The status of the Purchase Intent." | ||
| 3040 | }, | ||
| 3041 | "subtotal": { | ||
| 3042 | "type": "string", | ||
| 3043 | "description": "The subtotal of the Purchase Intent." | ||
| 3044 | }, | ||
| 3045 | "tax": { | ||
| 3046 | "type": "string", | ||
| 3047 | "description": "The tax due on the Purchase Intent." | ||
| 3048 | }, | ||
| 3049 | "total": { | ||
| 3050 | "type": "string", | ||
| 3051 | "description": "The total balance due on the Purchase Intent." | ||
| 3052 | }, | ||
| 3053 | "updatedAt": { | ||
| 3054 | "type": "string", | ||
| 3055 | "description": "The datetime when the Purchase Intent was last updated." | ||
| 3056 | }, | ||
| 3057 | "dispute": { | ||
| 3058 | "properties": { | ||
| 3059 | "id": { | ||
| 3060 | "type": "string", | ||
| 3061 | "description": "The unique ID of the dispute entity." | ||
| 3062 | }, | ||
| 3063 | "amount": { | ||
| 3064 | "type": "string", | ||
| 3065 | "description": "The disputed amount." | ||
| 3066 | }, | ||
| 3067 | "createdAt": { | ||
| 3068 | "type": "string", | ||
| 3069 | "description": "When the dispute was first recorded." | ||
| 3070 | }, | ||
| 3071 | "currency": { | ||
| 3072 | "type": "string", | ||
| 3073 | "description": "The dispute currency." | ||
| 3074 | }, | ||
| 3075 | "providerId": { | ||
| 3076 | "type": "string", | ||
| 3077 | "description": "The external provider dispute ID (e.g. Stripe dispute ID)." | ||
| 3078 | }, | ||
| 3079 | "reason": { | ||
| 3080 | "nullable": true, | ||
| 3081 | "type": "string", | ||
| 3082 | "description": "The dispute reason." | ||
| 3083 | }, | ||
| 3084 | "status": { | ||
| 3085 | "type": "string", | ||
| 3086 | "description": "The dispute status." | ||
| 3087 | }, | ||
| 3088 | "updatedAt": { | ||
| 3089 | "type": "string", | ||
| 3090 | "description": "When the dispute was last updated." | ||
| 3091 | } | ||
| 3092 | }, | ||
| 3093 | "required": [ | ||
| 3094 | "amount", | ||
| 3095 | "createdAt", | ||
| 3096 | "currency", | ||
| 3097 | "id", | ||
| 3098 | "providerId", | ||
| 3099 | "reason", | ||
| 3100 | "status", | ||
| 3101 | "updatedAt" | ||
| 3102 | ], | ||
| 3103 | "type": "object", | ||
| 3104 | "description": "The dispute details, if any." | ||
| 3105 | }, | ||
| 3106 | "lineItems": { | ||
| 3107 | "items": { | ||
| 3108 | "properties": { | ||
| 3109 | "id": { | ||
| 3110 | "type": "string", | ||
| 3111 | "description": "The ID of the line item" | ||
| 3112 | }, | ||
| 3113 | "description": { | ||
| 3114 | "type": "string", | ||
| 3115 | "description": "The description of the line item" | ||
| 3116 | }, | ||
| 3117 | "name": { | ||
| 3118 | "type": "string", | ||
| 3119 | "description": "The name of the line item" | ||
| 3120 | }, | ||
| 3121 | "productId": { | ||
| 3122 | "type": "string", | ||
| 3123 | "description": "The ID of the product being purchased" | ||
| 3124 | }, | ||
| 3125 | "quantity": { | ||
| 3126 | "type": "string", | ||
| 3127 | "description": "The quantity of the line item" | ||
| 3128 | }, | ||
| 3129 | "unitAmount": { | ||
| 3130 | "type": "string", | ||
| 3131 | "description": "The unit amount of the line item" | ||
| 3132 | }, | ||
| 3133 | "metadata": { | ||
| 3134 | "additionalProperties": { | ||
| 3135 | "type": "string" | ||
| 3136 | }, | ||
| 3137 | "type": "object", | ||
| 3138 | "description": "Optional metadata for the line item" | ||
| 3139 | }, | ||
| 3140 | "productAlias": { | ||
| 3141 | "type": "string", | ||
| 3142 | "description": "The alias of the product being purchased" | ||
| 3143 | }, | ||
| 3144 | "refund": { | ||
| 3145 | "type": "string", | ||
| 3146 | "description": "The amount of the line item that has been refunded" | ||
| 3147 | } | ||
| 3148 | }, | ||
| 3149 | "required": [ | ||
| 3150 | "description", | ||
| 3151 | "id", | ||
| 3152 | "name", | ||
| 3153 | "productId", | ||
| 3154 | "quantity", | ||
| 3155 | "unitAmount" | ||
| 3156 | ], | ||
| 3157 | "type": "object", | ||
| 3158 | "description": "The line items that make up the Purchase Intent." | ||
| 3159 | }, | ||
| 3160 | "type": "array", | ||
| 3161 | "description": "The line items that make up the Purchase Intent." | ||
| 3162 | }, | ||
| 3163 | "metadata": { | ||
| 3164 | "additionalProperties": { | ||
| 3165 | "type": "string" | ||
| 3166 | }, | ||
| 3167 | "type": "object", | ||
| 3168 | "description": "Optional metadata associated with the purchase intent" | ||
| 3169 | }, | ||
| 3170 | "refund": { | ||
| 3171 | "type": "string", | ||
| 3172 | "description": "The amount of the purchase intent that has been refunded" | ||
| 3173 | }, | ||
| 3174 | "returnUrl": { | ||
| 3175 | "type": "string", | ||
| 3176 | "description": "The URL to redirect to after the purchase is complete" | ||
| 3177 | } | ||
| 3178 | }, | ||
| 3179 | "required": [ | ||
| 3180 | "configuration", | ||
| 3181 | "createdAt", | ||
| 3182 | "currency", | ||
| 3183 | "id", | ||
| 3184 | "ownerId", | ||
| 3185 | "provider", | ||
| 3186 | "status", | ||
| 3187 | "subtotal", | ||
| 3188 | "tax", | ||
| 3189 | "total", | ||
| 3190 | "updatedAt" | ||
| 3191 | ], | ||
| 3192 | "type": "object", | ||
| 3193 | "description": "The created purchase intent" | ||
| 3194 | } | ||
| 3195 | }, | ||
| 3196 | "required": ["purchaseIntent"], | ||
| 3197 | "type": "object" | ||
| 3198 | }, | ||
| 3199 | { | ||
| 3200 | "properties": { | ||
| 3201 | "orbSubscriptionIntent": { | ||
| 3202 | "properties": { | ||
| 3203 | "id": { | ||
| 3204 | "type": "string", | ||
| 3205 | "description": "The ID of the Orb subscription intent with the format `orbsubint_`." | ||
| 3206 | }, | ||
| 3207 | "configuration": { | ||
| 3208 | "oneOf": [ | ||
| 3209 | { | ||
| 3210 | "properties": { | ||
| 3211 | "options": { | ||
| 3212 | "properties": { | ||
| 3213 | "productAlias": { | ||
| 3214 | "type": "string", | ||
| 3215 | "description": "The alias of the product to set quantity for." | ||
| 3216 | }, | ||
| 3217 | "quantity": { | ||
| 3218 | "type": "number", | ||
| 3219 | "description": "The quantity to set for the plan item." | ||
| 3220 | }, | ||
| 3221 | "resourceIds": { | ||
| 3222 | "items": { | ||
| 3223 | "type": "string" | ||
| 3224 | }, | ||
| 3225 | "type": "array", | ||
| 3226 | "description": "The resource IDs for the plan item. Only set if SKU requires resource entitlements." | ||
| 3227 | } | ||
| 3228 | }, | ||
| 3229 | "required": ["productAlias", "quantity"], | ||
| 3230 | "type": "object", | ||
| 3231 | "description": "Configuration input options for setting plan item quantity." | ||
| 3232 | }, | ||
| 3233 | "output": { | ||
| 3234 | "properties": { | ||
| 3235 | "orbPriceId": { | ||
| 3236 | "type": "string", | ||
| 3237 | "description": "The Orb price ID for the subscription item being modified." | ||
| 3238 | }, | ||
| 3239 | "productId": { | ||
| 3240 | "type": "string", | ||
| 3241 | "description": "The product ID associated with this intent." | ||
| 3242 | }, | ||
| 3243 | "changedResources": { | ||
| 3244 | "items": { | ||
| 3245 | "oneOf": [ | ||
| 3246 | { | ||
| 3247 | "properties": { | ||
| 3248 | "productAlias": { | ||
| 3249 | "type": "string", | ||
| 3250 | "description": "The alias of the product that was changed." | ||
| 3251 | }, | ||
| 3252 | "productId": { | ||
| 3253 | "type": "string", | ||
| 3254 | "description": "The ID of the product that was changed." | ||
| 3255 | }, | ||
| 3256 | "quantity": { | ||
| 3257 | "type": "number", | ||
| 3258 | "description": "The resulting quantity after this change." | ||
| 3259 | }, | ||
| 3260 | "type": { | ||
| 3261 | "type": "string", | ||
| 3262 | "enum": ["set_plan_item_quantity"] | ||
| 3263 | }, | ||
| 3264 | "resourceIds": { | ||
| 3265 | "items": { | ||
| 3266 | "type": "string" | ||
| 3267 | }, | ||
| 3268 | "type": "array", | ||
| 3269 | "description": "The full set of resource IDs after the set operation." | ||
| 3270 | } | ||
| 3271 | }, | ||
| 3272 | "required": [ | ||
| 3273 | "productAlias", | ||
| 3274 | "productId", | ||
| 3275 | "quantity", | ||
| 3276 | "type" | ||
| 3277 | ], | ||
| 3278 | "type": "object", | ||
| 3279 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3280 | }, | ||
| 3281 | { | ||
| 3282 | "properties": { | ||
| 3283 | "productAlias": { | ||
| 3284 | "type": "string", | ||
| 3285 | "description": "The alias of the product that was changed." | ||
| 3286 | }, | ||
| 3287 | "productId": { | ||
| 3288 | "type": "string", | ||
| 3289 | "description": "The ID of the product that was changed." | ||
| 3290 | }, | ||
| 3291 | "quantity": { | ||
| 3292 | "type": "number", | ||
| 3293 | "description": "The resulting quantity after this change." | ||
| 3294 | }, | ||
| 3295 | "resourceIds": { | ||
| 3296 | "items": { | ||
| 3297 | "type": "string" | ||
| 3298 | }, | ||
| 3299 | "type": "array", | ||
| 3300 | "description": "Resource IDs that were added." | ||
| 3301 | }, | ||
| 3302 | "type": { | ||
| 3303 | "type": "string", | ||
| 3304 | "enum": ["increase_plan_item_quantity"] | ||
| 3305 | } | ||
| 3306 | }, | ||
| 3307 | "required": [ | ||
| 3308 | "productAlias", | ||
| 3309 | "productId", | ||
| 3310 | "quantity", | ||
| 3311 | "resourceIds", | ||
| 3312 | "type" | ||
| 3313 | ], | ||
| 3314 | "type": "object", | ||
| 3315 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3316 | }, | ||
| 3317 | { | ||
| 3318 | "properties": { | ||
| 3319 | "productAlias": { | ||
| 3320 | "type": "string", | ||
| 3321 | "description": "The alias of the product that was changed." | ||
| 3322 | }, | ||
| 3323 | "productId": { | ||
| 3324 | "type": "string", | ||
| 3325 | "description": "The ID of the product that was changed." | ||
| 3326 | }, | ||
| 3327 | "quantity": { | ||
| 3328 | "type": "number", | ||
| 3329 | "description": "The resulting quantity after this change." | ||
| 3330 | }, | ||
| 3331 | "resourceIds": { | ||
| 3332 | "items": { | ||
| 3333 | "type": "string" | ||
| 3334 | }, | ||
| 3335 | "type": "array", | ||
| 3336 | "description": "Resource IDs that were removed." | ||
| 3337 | }, | ||
| 3338 | "type": { | ||
| 3339 | "type": "string", | ||
| 3340 | "enum": ["decrease_plan_item_quantity"] | ||
| 3341 | } | ||
| 3342 | }, | ||
| 3343 | "required": [ | ||
| 3344 | "productAlias", | ||
| 3345 | "productId", | ||
| 3346 | "quantity", | ||
| 3347 | "resourceIds", | ||
| 3348 | "type" | ||
| 3349 | ], | ||
| 3350 | "type": "object", | ||
| 3351 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3352 | }, | ||
| 3353 | { | ||
| 3354 | "properties": { | ||
| 3355 | "addedResourceIds": { | ||
| 3356 | "items": { | ||
| 3357 | "type": "string" | ||
| 3358 | }, | ||
| 3359 | "type": "array", | ||
| 3360 | "description": "Resource IDs that were added." | ||
| 3361 | }, | ||
| 3362 | "productAlias": { | ||
| 3363 | "type": "string", | ||
| 3364 | "description": "The alias of the product that was changed." | ||
| 3365 | }, | ||
| 3366 | "productId": { | ||
| 3367 | "type": "string", | ||
| 3368 | "description": "The ID of the product that was changed." | ||
| 3369 | }, | ||
| 3370 | "quantity": { | ||
| 3371 | "type": "number", | ||
| 3372 | "description": "The resulting quantity after this change." | ||
| 3373 | }, | ||
| 3374 | "removedResourceIds": { | ||
| 3375 | "items": { | ||
| 3376 | "type": "string" | ||
| 3377 | }, | ||
| 3378 | "type": "array", | ||
| 3379 | "description": "Resource IDs that were removed." | ||
| 3380 | }, | ||
| 3381 | "type": { | ||
| 3382 | "type": "string", | ||
| 3383 | "enum": ["adjust_plan_item_quantity"] | ||
| 3384 | } | ||
| 3385 | }, | ||
| 3386 | "required": [ | ||
| 3387 | "addedResourceIds", | ||
| 3388 | "productAlias", | ||
| 3389 | "productId", | ||
| 3390 | "quantity", | ||
| 3391 | "removedResourceIds", | ||
| 3392 | "type" | ||
| 3393 | ], | ||
| 3394 | "type": "object", | ||
| 3395 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3396 | } | ||
| 3397 | ] | ||
| 3398 | }, | ||
| 3399 | "type": "array", | ||
| 3400 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3401 | }, | ||
| 3402 | "metadata": { | ||
| 3403 | "additionalProperties": { | ||
| 3404 | "type": "string" | ||
| 3405 | }, | ||
| 3406 | "type": "object", | ||
| 3407 | "description": "Optional metadata associated with the intent to update the Orb subscription with." | ||
| 3408 | }, | ||
| 3409 | "pendingSubscriptionChangeId": { | ||
| 3410 | "type": "string", | ||
| 3411 | "description": "The ID of the pending subscription change if there is one." | ||
| 3412 | } | ||
| 3413 | }, | ||
| 3414 | "required": ["orbPriceId", "productId"], | ||
| 3415 | "type": "object", | ||
| 3416 | "description": "Output returned after configuring an OrbSubscriptionIntent." | ||
| 3417 | }, | ||
| 3418 | "type": { | ||
| 3419 | "type": "string", | ||
| 3420 | "enum": ["set_plan_item_quantity"] | ||
| 3421 | } | ||
| 3422 | }, | ||
| 3423 | "required": ["options", "output", "type"], | ||
| 3424 | "type": "object", | ||
| 3425 | "description": "Configuration for the Orb subscription intent." | ||
| 3426 | }, | ||
| 3427 | { | ||
| 3428 | "properties": { | ||
| 3429 | "options": { | ||
| 3430 | "properties": { | ||
| 3431 | "productAlias": { | ||
| 3432 | "type": "string", | ||
| 3433 | "description": "The alias of the product to increase quantity for." | ||
| 3434 | }, | ||
| 3435 | "resourceIds": { | ||
| 3436 | "items": { | ||
| 3437 | "type": "string" | ||
| 3438 | }, | ||
| 3439 | "type": "array", | ||
| 3440 | "description": "The resource IDs to incrementally add. The quantity of the plan item will be increased by the number of resource IDs." | ||
| 3441 | } | ||
| 3442 | }, | ||
| 3443 | "required": ["productAlias", "resourceIds"], | ||
| 3444 | "type": "object", | ||
| 3445 | "description": "Configuration input options for increasing plan item quantity." | ||
| 3446 | }, | ||
| 3447 | "output": { | ||
| 3448 | "properties": { | ||
| 3449 | "orbPriceId": { | ||
| 3450 | "type": "string", | ||
| 3451 | "description": "The Orb price ID for the subscription item being modified." | ||
| 3452 | }, | ||
| 3453 | "productId": { | ||
| 3454 | "type": "string", | ||
| 3455 | "description": "The product ID associated with this intent." | ||
| 3456 | }, | ||
| 3457 | "changedResources": { | ||
| 3458 | "items": { | ||
| 3459 | "oneOf": [ | ||
| 3460 | { | ||
| 3461 | "properties": { | ||
| 3462 | "productAlias": { | ||
| 3463 | "type": "string", | ||
| 3464 | "description": "The alias of the product that was changed." | ||
| 3465 | }, | ||
| 3466 | "productId": { | ||
| 3467 | "type": "string", | ||
| 3468 | "description": "The ID of the product that was changed." | ||
| 3469 | }, | ||
| 3470 | "quantity": { | ||
| 3471 | "type": "number", | ||
| 3472 | "description": "The resulting quantity after this change." | ||
| 3473 | }, | ||
| 3474 | "type": { | ||
| 3475 | "type": "string", | ||
| 3476 | "enum": ["set_plan_item_quantity"] | ||
| 3477 | }, | ||
| 3478 | "resourceIds": { | ||
| 3479 | "items": { | ||
| 3480 | "type": "string" | ||
| 3481 | }, | ||
| 3482 | "type": "array", | ||
| 3483 | "description": "The full set of resource IDs after the set operation." | ||
| 3484 | } | ||
| 3485 | }, | ||
| 3486 | "required": [ | ||
| 3487 | "productAlias", | ||
| 3488 | "productId", | ||
| 3489 | "quantity", | ||
| 3490 | "type" | ||
| 3491 | ], | ||
| 3492 | "type": "object", | ||
| 3493 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3494 | }, | ||
| 3495 | { | ||
| 3496 | "properties": { | ||
| 3497 | "productAlias": { | ||
| 3498 | "type": "string", | ||
| 3499 | "description": "The alias of the product that was changed." | ||
| 3500 | }, | ||
| 3501 | "productId": { | ||
| 3502 | "type": "string", | ||
| 3503 | "description": "The ID of the product that was changed." | ||
| 3504 | }, | ||
| 3505 | "quantity": { | ||
| 3506 | "type": "number", | ||
| 3507 | "description": "The resulting quantity after this change." | ||
| 3508 | }, | ||
| 3509 | "resourceIds": { | ||
| 3510 | "items": { | ||
| 3511 | "type": "string" | ||
| 3512 | }, | ||
| 3513 | "type": "array", | ||
| 3514 | "description": "Resource IDs that were added." | ||
| 3515 | }, | ||
| 3516 | "type": { | ||
| 3517 | "type": "string", | ||
| 3518 | "enum": ["increase_plan_item_quantity"] | ||
| 3519 | } | ||
| 3520 | }, | ||
| 3521 | "required": [ | ||
| 3522 | "productAlias", | ||
| 3523 | "productId", | ||
| 3524 | "quantity", | ||
| 3525 | "resourceIds", | ||
| 3526 | "type" | ||
| 3527 | ], | ||
| 3528 | "type": "object", | ||
| 3529 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3530 | }, | ||
| 3531 | { | ||
| 3532 | "properties": { | ||
| 3533 | "productAlias": { | ||
| 3534 | "type": "string", | ||
| 3535 | "description": "The alias of the product that was changed." | ||
| 3536 | }, | ||
| 3537 | "productId": { | ||
| 3538 | "type": "string", | ||
| 3539 | "description": "The ID of the product that was changed." | ||
| 3540 | }, | ||
| 3541 | "quantity": { | ||
| 3542 | "type": "number", | ||
| 3543 | "description": "The resulting quantity after this change." | ||
| 3544 | }, | ||
| 3545 | "resourceIds": { | ||
| 3546 | "items": { | ||
| 3547 | "type": "string" | ||
| 3548 | }, | ||
| 3549 | "type": "array", | ||
| 3550 | "description": "Resource IDs that were removed." | ||
| 3551 | }, | ||
| 3552 | "type": { | ||
| 3553 | "type": "string", | ||
| 3554 | "enum": ["decrease_plan_item_quantity"] | ||
| 3555 | } | ||
| 3556 | }, | ||
| 3557 | "required": [ | ||
| 3558 | "productAlias", | ||
| 3559 | "productId", | ||
| 3560 | "quantity", | ||
| 3561 | "resourceIds", | ||
| 3562 | "type" | ||
| 3563 | ], | ||
| 3564 | "type": "object", | ||
| 3565 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3566 | }, | ||
| 3567 | { | ||
| 3568 | "properties": { | ||
| 3569 | "addedResourceIds": { | ||
| 3570 | "items": { | ||
| 3571 | "type": "string" | ||
| 3572 | }, | ||
| 3573 | "type": "array", | ||
| 3574 | "description": "Resource IDs that were added." | ||
| 3575 | }, | ||
| 3576 | "productAlias": { | ||
| 3577 | "type": "string", | ||
| 3578 | "description": "The alias of the product that was changed." | ||
| 3579 | }, | ||
| 3580 | "productId": { | ||
| 3581 | "type": "string", | ||
| 3582 | "description": "The ID of the product that was changed." | ||
| 3583 | }, | ||
| 3584 | "quantity": { | ||
| 3585 | "type": "number", | ||
| 3586 | "description": "The resulting quantity after this change." | ||
| 3587 | }, | ||
| 3588 | "removedResourceIds": { | ||
| 3589 | "items": { | ||
| 3590 | "type": "string" | ||
| 3591 | }, | ||
| 3592 | "type": "array", | ||
| 3593 | "description": "Resource IDs that were removed." | ||
| 3594 | }, | ||
| 3595 | "type": { | ||
| 3596 | "type": "string", | ||
| 3597 | "enum": ["adjust_plan_item_quantity"] | ||
| 3598 | } | ||
| 3599 | }, | ||
| 3600 | "required": [ | ||
| 3601 | "addedResourceIds", | ||
| 3602 | "productAlias", | ||
| 3603 | "productId", | ||
| 3604 | "quantity", | ||
| 3605 | "removedResourceIds", | ||
| 3606 | "type" | ||
| 3607 | ], | ||
| 3608 | "type": "object", | ||
| 3609 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3610 | } | ||
| 3611 | ] | ||
| 3612 | }, | ||
| 3613 | "type": "array", | ||
| 3614 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3615 | }, | ||
| 3616 | "metadata": { | ||
| 3617 | "additionalProperties": { | ||
| 3618 | "type": "string" | ||
| 3619 | }, | ||
| 3620 | "type": "object", | ||
| 3621 | "description": "Optional metadata associated with the intent to update the Orb subscription with." | ||
| 3622 | }, | ||
| 3623 | "pendingSubscriptionChangeId": { | ||
| 3624 | "type": "string", | ||
| 3625 | "description": "The ID of the pending subscription change if there is one." | ||
| 3626 | } | ||
| 3627 | }, | ||
| 3628 | "required": ["orbPriceId", "productId"], | ||
| 3629 | "type": "object", | ||
| 3630 | "description": "Output returned after configuring an OrbSubscriptionIntent." | ||
| 3631 | }, | ||
| 3632 | "type": { | ||
| 3633 | "type": "string", | ||
| 3634 | "enum": ["increase_plan_item_quantity"] | ||
| 3635 | } | ||
| 3636 | }, | ||
| 3637 | "required": ["options", "output", "type"], | ||
| 3638 | "type": "object", | ||
| 3639 | "description": "Configuration for the Orb subscription intent." | ||
| 3640 | }, | ||
| 3641 | { | ||
| 3642 | "properties": { | ||
| 3643 | "options": { | ||
| 3644 | "properties": { | ||
| 3645 | "productAlias": { | ||
| 3646 | "type": "string", | ||
| 3647 | "description": "The alias of the product to decrease quantity for." | ||
| 3648 | }, | ||
| 3649 | "resourceIds": { | ||
| 3650 | "items": { | ||
| 3651 | "type": "string" | ||
| 3652 | }, | ||
| 3653 | "type": "array", | ||
| 3654 | "description": "The resource IDs to decrementally remove. The quantity of the plan item will be decreased by the number of resource IDs." | ||
| 3655 | } | ||
| 3656 | }, | ||
| 3657 | "required": ["productAlias", "resourceIds"], | ||
| 3658 | "type": "object", | ||
| 3659 | "description": "Configuration input options for decreasing plan item quantity." | ||
| 3660 | }, | ||
| 3661 | "output": { | ||
| 3662 | "properties": { | ||
| 3663 | "orbPriceId": { | ||
| 3664 | "type": "string", | ||
| 3665 | "description": "The Orb price ID for the subscription item being modified." | ||
| 3666 | }, | ||
| 3667 | "productId": { | ||
| 3668 | "type": "string", | ||
| 3669 | "description": "The product ID associated with this intent." | ||
| 3670 | }, | ||
| 3671 | "changedResources": { | ||
| 3672 | "items": { | ||
| 3673 | "oneOf": [ | ||
| 3674 | { | ||
| 3675 | "properties": { | ||
| 3676 | "productAlias": { | ||
| 3677 | "type": "string", | ||
| 3678 | "description": "The alias of the product that was changed." | ||
| 3679 | }, | ||
| 3680 | "productId": { | ||
| 3681 | "type": "string", | ||
| 3682 | "description": "The ID of the product that was changed." | ||
| 3683 | }, | ||
| 3684 | "quantity": { | ||
| 3685 | "type": "number", | ||
| 3686 | "description": "The resulting quantity after this change." | ||
| 3687 | }, | ||
| 3688 | "type": { | ||
| 3689 | "type": "string", | ||
| 3690 | "enum": ["set_plan_item_quantity"] | ||
| 3691 | }, | ||
| 3692 | "resourceIds": { | ||
| 3693 | "items": { | ||
| 3694 | "type": "string" | ||
| 3695 | }, | ||
| 3696 | "type": "array", | ||
| 3697 | "description": "The full set of resource IDs after the set operation." | ||
| 3698 | } | ||
| 3699 | }, | ||
| 3700 | "required": [ | ||
| 3701 | "productAlias", | ||
| 3702 | "productId", | ||
| 3703 | "quantity", | ||
| 3704 | "type" | ||
| 3705 | ], | ||
| 3706 | "type": "object", | ||
| 3707 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3708 | }, | ||
| 3709 | { | ||
| 3710 | "properties": { | ||
| 3711 | "productAlias": { | ||
| 3712 | "type": "string", | ||
| 3713 | "description": "The alias of the product that was changed." | ||
| 3714 | }, | ||
| 3715 | "productId": { | ||
| 3716 | "type": "string", | ||
| 3717 | "description": "The ID of the product that was changed." | ||
| 3718 | }, | ||
| 3719 | "quantity": { | ||
| 3720 | "type": "number", | ||
| 3721 | "description": "The resulting quantity after this change." | ||
| 3722 | }, | ||
| 3723 | "resourceIds": { | ||
| 3724 | "items": { | ||
| 3725 | "type": "string" | ||
| 3726 | }, | ||
| 3727 | "type": "array", | ||
| 3728 | "description": "Resource IDs that were added." | ||
| 3729 | }, | ||
| 3730 | "type": { | ||
| 3731 | "type": "string", | ||
| 3732 | "enum": ["increase_plan_item_quantity"] | ||
| 3733 | } | ||
| 3734 | }, | ||
| 3735 | "required": [ | ||
| 3736 | "productAlias", | ||
| 3737 | "productId", | ||
| 3738 | "quantity", | ||
| 3739 | "resourceIds", | ||
| 3740 | "type" | ||
| 3741 | ], | ||
| 3742 | "type": "object", | ||
| 3743 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3744 | }, | ||
| 3745 | { | ||
| 3746 | "properties": { | ||
| 3747 | "productAlias": { | ||
| 3748 | "type": "string", | ||
| 3749 | "description": "The alias of the product that was changed." | ||
| 3750 | }, | ||
| 3751 | "productId": { | ||
| 3752 | "type": "string", | ||
| 3753 | "description": "The ID of the product that was changed." | ||
| 3754 | }, | ||
| 3755 | "quantity": { | ||
| 3756 | "type": "number", | ||
| 3757 | "description": "The resulting quantity after this change." | ||
| 3758 | }, | ||
| 3759 | "resourceIds": { | ||
| 3760 | "items": { | ||
| 3761 | "type": "string" | ||
| 3762 | }, | ||
| 3763 | "type": "array", | ||
| 3764 | "description": "Resource IDs that were removed." | ||
| 3765 | }, | ||
| 3766 | "type": { | ||
| 3767 | "type": "string", | ||
| 3768 | "enum": ["decrease_plan_item_quantity"] | ||
| 3769 | } | ||
| 3770 | }, | ||
| 3771 | "required": [ | ||
| 3772 | "productAlias", | ||
| 3773 | "productId", | ||
| 3774 | "quantity", | ||
| 3775 | "resourceIds", | ||
| 3776 | "type" | ||
| 3777 | ], | ||
| 3778 | "type": "object", | ||
| 3779 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3780 | }, | ||
| 3781 | { | ||
| 3782 | "properties": { | ||
| 3783 | "addedResourceIds": { | ||
| 3784 | "items": { | ||
| 3785 | "type": "string" | ||
| 3786 | }, | ||
| 3787 | "type": "array", | ||
| 3788 | "description": "Resource IDs that were added." | ||
| 3789 | }, | ||
| 3790 | "productAlias": { | ||
| 3791 | "type": "string", | ||
| 3792 | "description": "The alias of the product that was changed." | ||
| 3793 | }, | ||
| 3794 | "productId": { | ||
| 3795 | "type": "string", | ||
| 3796 | "description": "The ID of the product that was changed." | ||
| 3797 | }, | ||
| 3798 | "quantity": { | ||
| 3799 | "type": "number", | ||
| 3800 | "description": "The resulting quantity after this change." | ||
| 3801 | }, | ||
| 3802 | "removedResourceIds": { | ||
| 3803 | "items": { | ||
| 3804 | "type": "string" | ||
| 3805 | }, | ||
| 3806 | "type": "array", | ||
| 3807 | "description": "Resource IDs that were removed." | ||
| 3808 | }, | ||
| 3809 | "type": { | ||
| 3810 | "type": "string", | ||
| 3811 | "enum": ["adjust_plan_item_quantity"] | ||
| 3812 | } | ||
| 3813 | }, | ||
| 3814 | "required": [ | ||
| 3815 | "addedResourceIds", | ||
| 3816 | "productAlias", | ||
| 3817 | "productId", | ||
| 3818 | "quantity", | ||
| 3819 | "removedResourceIds", | ||
| 3820 | "type" | ||
| 3821 | ], | ||
| 3822 | "type": "object", | ||
| 3823 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3824 | } | ||
| 3825 | ] | ||
| 3826 | }, | ||
| 3827 | "type": "array", | ||
| 3828 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3829 | }, | ||
| 3830 | "metadata": { | ||
| 3831 | "additionalProperties": { | ||
| 3832 | "type": "string" | ||
| 3833 | }, | ||
| 3834 | "type": "object", | ||
| 3835 | "description": "Optional metadata associated with the intent to update the Orb subscription with." | ||
| 3836 | }, | ||
| 3837 | "pendingSubscriptionChangeId": { | ||
| 3838 | "type": "string", | ||
| 3839 | "description": "The ID of the pending subscription change if there is one." | ||
| 3840 | } | ||
| 3841 | }, | ||
| 3842 | "required": ["orbPriceId", "productId"], | ||
| 3843 | "type": "object", | ||
| 3844 | "description": "Output returned after configuring an OrbSubscriptionIntent." | ||
| 3845 | }, | ||
| 3846 | "type": { | ||
| 3847 | "type": "string", | ||
| 3848 | "enum": ["decrease_plan_item_quantity"] | ||
| 3849 | } | ||
| 3850 | }, | ||
| 3851 | "required": ["options", "output", "type"], | ||
| 3852 | "type": "object", | ||
| 3853 | "description": "Configuration for the Orb subscription intent." | ||
| 3854 | }, | ||
| 3855 | { | ||
| 3856 | "properties": { | ||
| 3857 | "options": { | ||
| 3858 | "properties": { | ||
| 3859 | "addedResourceIds": { | ||
| 3860 | "items": { | ||
| 3861 | "type": "string" | ||
| 3862 | }, | ||
| 3863 | "type": "array", | ||
| 3864 | "description": "The resource IDs to incrementally add. The quantity of the plan item will be increased by the number of resource IDs." | ||
| 3865 | }, | ||
| 3866 | "productAlias": { | ||
| 3867 | "type": "string", | ||
| 3868 | "description": "The alias of the product to adjust quantity for." | ||
| 3869 | }, | ||
| 3870 | "removedResourceIds": { | ||
| 3871 | "items": { | ||
| 3872 | "type": "string" | ||
| 3873 | }, | ||
| 3874 | "type": "array", | ||
| 3875 | "description": "The resource IDs to incrementally remove. The quantity of the plan item will be decreased by the number of resource IDs." | ||
| 3876 | } | ||
| 3877 | }, | ||
| 3878 | "required": [ | ||
| 3879 | "addedResourceIds", | ||
| 3880 | "productAlias", | ||
| 3881 | "removedResourceIds" | ||
| 3882 | ], | ||
| 3883 | "type": "object", | ||
| 3884 | "description": "Configuration input options for adjusting plan item quantity." | ||
| 3885 | }, | ||
| 3886 | "output": { | ||
| 3887 | "properties": { | ||
| 3888 | "orbPriceId": { | ||
| 3889 | "type": "string", | ||
| 3890 | "description": "The Orb price ID for the subscription item being modified." | ||
| 3891 | }, | ||
| 3892 | "productId": { | ||
| 3893 | "type": "string", | ||
| 3894 | "description": "The product ID associated with this intent." | ||
| 3895 | }, | ||
| 3896 | "changedResources": { | ||
| 3897 | "items": { | ||
| 3898 | "oneOf": [ | ||
| 3899 | { | ||
| 3900 | "properties": { | ||
| 3901 | "productAlias": { | ||
| 3902 | "type": "string", | ||
| 3903 | "description": "The alias of the product that was changed." | ||
| 3904 | }, | ||
| 3905 | "productId": { | ||
| 3906 | "type": "string", | ||
| 3907 | "description": "The ID of the product that was changed." | ||
| 3908 | }, | ||
| 3909 | "quantity": { | ||
| 3910 | "type": "number", | ||
| 3911 | "description": "The resulting quantity after this change." | ||
| 3912 | }, | ||
| 3913 | "type": { | ||
| 3914 | "type": "string", | ||
| 3915 | "enum": ["set_plan_item_quantity"] | ||
| 3916 | }, | ||
| 3917 | "resourceIds": { | ||
| 3918 | "items": { | ||
| 3919 | "type": "string" | ||
| 3920 | }, | ||
| 3921 | "type": "array", | ||
| 3922 | "description": "The full set of resource IDs after the set operation." | ||
| 3923 | } | ||
| 3924 | }, | ||
| 3925 | "required": [ | ||
| 3926 | "productAlias", | ||
| 3927 | "productId", | ||
| 3928 | "quantity", | ||
| 3929 | "type" | ||
| 3930 | ], | ||
| 3931 | "type": "object", | ||
| 3932 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3933 | }, | ||
| 3934 | { | ||
| 3935 | "properties": { | ||
| 3936 | "productAlias": { | ||
| 3937 | "type": "string", | ||
| 3938 | "description": "The alias of the product that was changed." | ||
| 3939 | }, | ||
| 3940 | "productId": { | ||
| 3941 | "type": "string", | ||
| 3942 | "description": "The ID of the product that was changed." | ||
| 3943 | }, | ||
| 3944 | "quantity": { | ||
| 3945 | "type": "number", | ||
| 3946 | "description": "The resulting quantity after this change." | ||
| 3947 | }, | ||
| 3948 | "resourceIds": { | ||
| 3949 | "items": { | ||
| 3950 | "type": "string" | ||
| 3951 | }, | ||
| 3952 | "type": "array", | ||
| 3953 | "description": "Resource IDs that were added." | ||
| 3954 | }, | ||
| 3955 | "type": { | ||
| 3956 | "type": "string", | ||
| 3957 | "enum": ["increase_plan_item_quantity"] | ||
| 3958 | } | ||
| 3959 | }, | ||
| 3960 | "required": [ | ||
| 3961 | "productAlias", | ||
| 3962 | "productId", | ||
| 3963 | "quantity", | ||
| 3964 | "resourceIds", | ||
| 3965 | "type" | ||
| 3966 | ], | ||
| 3967 | "type": "object", | ||
| 3968 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 3969 | }, | ||
| 3970 | { | ||
| 3971 | "properties": { | ||
| 3972 | "productAlias": { | ||
| 3973 | "type": "string", | ||
| 3974 | "description": "The alias of the product that was changed." | ||
| 3975 | }, | ||
| 3976 | "productId": { | ||
| 3977 | "type": "string", | ||
| 3978 | "description": "The ID of the product that was changed." | ||
| 3979 | }, | ||
| 3980 | "quantity": { | ||
| 3981 | "type": "number", | ||
| 3982 | "description": "The resulting quantity after this change." | ||
| 3983 | }, | ||
| 3984 | "resourceIds": { | ||
| 3985 | "items": { | ||
| 3986 | "type": "string" | ||
| 3987 | }, | ||
| 3988 | "type": "array", | ||
| 3989 | "description": "Resource IDs that were removed." | ||
| 3990 | }, | ||
| 3991 | "type": { | ||
| 3992 | "type": "string", | ||
| 3993 | "enum": ["decrease_plan_item_quantity"] | ||
| 3994 | } | ||
| 3995 | }, | ||
| 3996 | "required": [ | ||
| 3997 | "productAlias", | ||
| 3998 | "productId", | ||
| 3999 | "quantity", | ||
| 4000 | "resourceIds", | ||
| 4001 | "type" | ||
| 4002 | ], | ||
| 4003 | "type": "object", | ||
| 4004 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 4005 | }, | ||
| 4006 | { | ||
| 4007 | "properties": { | ||
| 4008 | "addedResourceIds": { | ||
| 4009 | "items": { | ||
| 4010 | "type": "string" | ||
| 4011 | }, | ||
| 4012 | "type": "array", | ||
| 4013 | "description": "Resource IDs that were added." | ||
| 4014 | }, | ||
| 4015 | "productAlias": { | ||
| 4016 | "type": "string", | ||
| 4017 | "description": "The alias of the product that was changed." | ||
| 4018 | }, | ||
| 4019 | "productId": { | ||
| 4020 | "type": "string", | ||
| 4021 | "description": "The ID of the product that was changed." | ||
| 4022 | }, | ||
| 4023 | "quantity": { | ||
| 4024 | "type": "number", | ||
| 4025 | "description": "The resulting quantity after this change." | ||
| 4026 | }, | ||
| 4027 | "removedResourceIds": { | ||
| 4028 | "items": { | ||
| 4029 | "type": "string" | ||
| 4030 | }, | ||
| 4031 | "type": "array", | ||
| 4032 | "description": "Resource IDs that were removed." | ||
| 4033 | }, | ||
| 4034 | "type": { | ||
| 4035 | "type": "string", | ||
| 4036 | "enum": ["adjust_plan_item_quantity"] | ||
| 4037 | } | ||
| 4038 | }, | ||
| 4039 | "required": [ | ||
| 4040 | "addedResourceIds", | ||
| 4041 | "productAlias", | ||
| 4042 | "productId", | ||
| 4043 | "quantity", | ||
| 4044 | "removedResourceIds", | ||
| 4045 | "type" | ||
| 4046 | ], | ||
| 4047 | "type": "object", | ||
| 4048 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 4049 | } | ||
| 4050 | ] | ||
| 4051 | }, | ||
| 4052 | "type": "array", | ||
| 4053 | "description": "Resources that were changed as part of this intent. Tracks all logical changes including the primary change and any side effects." | ||
| 4054 | }, | ||
| 4055 | "metadata": { | ||
| 4056 | "additionalProperties": { | ||
| 4057 | "type": "string" | ||
| 4058 | }, | ||
| 4059 | "type": "object", | ||
| 4060 | "description": "Optional metadata associated with the intent to update the Orb subscription with." | ||
| 4061 | }, | ||
| 4062 | "pendingSubscriptionChangeId": { | ||
| 4063 | "type": "string", | ||
| 4064 | "description": "The ID of the pending subscription change if there is one." | ||
| 4065 | } | ||
| 4066 | }, | ||
| 4067 | "required": ["orbPriceId", "productId"], | ||
| 4068 | "type": "object", | ||
| 4069 | "description": "Output returned after configuring an OrbSubscriptionIntent." | ||
| 4070 | }, | ||
| 4071 | "type": { | ||
| 4072 | "type": "string", | ||
| 4073 | "enum": ["adjust_plan_item_quantity"] | ||
| 4074 | } | ||
| 4075 | }, | ||
| 4076 | "required": ["options", "output", "type"], | ||
| 4077 | "type": "object", | ||
| 4078 | "description": "Configuration for the Orb subscription intent." | ||
| 4079 | } | ||
| 4080 | ] | ||
| 4081 | }, | ||
| 4082 | "createdAt": { | ||
| 4083 | "type": "string", | ||
| 4084 | "description": "The ISO 8601 date-time that the intent was created." | ||
| 4085 | }, | ||
| 4086 | "orbSubscriptionId": { | ||
| 4087 | "type": "string", | ||
| 4088 | "description": "The Orb subscription ID this intent is associated with." | ||
| 4089 | }, | ||
| 4090 | "ownerId": { | ||
| 4091 | "type": "string", | ||
| 4092 | "description": "The owner ID for this intent (e.g., team or user ID)." | ||
| 4093 | }, | ||
| 4094 | "status": { | ||
| 4095 | "type": "string", | ||
| 4096 | "enum": ["pending", "succeeded", "failed"], | ||
| 4097 | "description": "The status of the Orb subscription intent." | ||
| 4098 | }, | ||
| 4099 | "updatedAt": { | ||
| 4100 | "type": "string", | ||
| 4101 | "description": "The ISO 8601 date-time that the intent was last updated." | ||
| 4102 | }, | ||
| 4103 | "purchaseIntentId": { | ||
| 4104 | "type": "string", | ||
| 4105 | "description": "Optional purchase intent ID if this is associated with a purchase." | ||
| 4106 | } | ||
| 4107 | }, | ||
| 4108 | "required": [ | ||
| 4109 | "configuration", | ||
| 4110 | "createdAt", | ||
| 4111 | "id", | ||
| 4112 | "orbSubscriptionId", | ||
| 4113 | "ownerId", | ||
| 4114 | "status", | ||
| 4115 | "updatedAt" | ||
| 4116 | ], | ||
| 4117 | "type": "object" | ||
| 4118 | } | ||
| 4119 | }, | ||
| 4120 | "required": ["orbSubscriptionIntent"], | ||
| 4121 | "type": "object" | ||
| 4122 | } | ||
| 4123 | ] | ||
| 4124 | } | ||
| 4125 | } | ||
| 4126 | } | ||
| 4127 | }, | ||
| 4128 | "400": { | ||
| 4129 | "description": "One of the provided values in the request query is invalid." | ||
| 4130 | }, | ||
| 4131 | "401": { | ||
| 4132 | "description": "The request is not authorized." | ||
| 4133 | }, | ||
| 4134 | "402": { | ||
| 4135 | "description": "" | ||
| 4136 | }, | ||
| 4137 | "403": { | ||
| 4138 | "description": "You do not have permission to access this resource." | ||
| 4139 | }, | ||
| 4140 | "404": { | ||
| 4141 | "description": "" | ||
| 4142 | }, | ||
| 4143 | "500": { | ||
| 4144 | "description": "" | ||
| 4145 | } | ||
| 4146 | }, | ||
| 4147 | "parameters": [ | ||
| 4148 | { | ||
| 4149 | "name": "source", | ||
| 4150 | "description": "The source of the purchase request. Defaults to `api` if not specified.", | ||
| 4151 | "in": "query", | ||
| 4152 | "schema": { | ||
| 4153 | "type": "string", | ||
| 4154 | "description": "The source of the purchase request. Defaults to `api` if not specified." | ||
| 4155 | } | ||
| 4156 | }, | ||
| 4157 | { | ||
| 4158 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 4159 | "in": "query", | ||
| 4160 | "name": "teamId", | ||
| 4161 | "schema": { | ||
| 4162 | "type": "string", | ||
| 4163 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 4164 | } | ||
| 4165 | }, | ||
| 4166 | { | ||
| 4167 | "description": "The Team slug to perform the request on behalf of.", | ||
| 4168 | "in": "query", | ||
| 4169 | "name": "slug", | ||
| 4170 | "schema": { | ||
| 4171 | "type": "string", | ||
| 4172 | "example": "my-team-url-slug" | ||
| 4173 | } | ||
| 4174 | } | ||
| 4175 | ], | ||
| 4176 | "requestBody": { | ||
| 4177 | "required": true, | ||
| 4178 | "content": { | ||
| 4179 | "application/json": { | ||
| 4180 | "schema": { | ||
| 4181 | "type": "object", | ||
| 4182 | "required": ["item"], | ||
| 4183 | "properties": { | ||
| 4184 | "item": { | ||
| 4185 | "type": "object", | ||
| 4186 | "required": ["type", "creditType", "amount"], | ||
| 4187 | "properties": { | ||
| 4188 | "type": { | ||
| 4189 | "type": "string", | ||
| 4190 | "enum": ["credits"], | ||
| 4191 | "description": "The type of item to purchase." | ||
| 4192 | }, | ||
| 4193 | "creditType": { | ||
| 4194 | "type": "string", | ||
| 4195 | "enum": ["v0", "gateway", "agent"], | ||
| 4196 | "description": "The type of credits to purchase." | ||
| 4197 | }, | ||
| 4198 | "amount": { | ||
| 4199 | "type": "integer", | ||
| 4200 | "minimum": 1, | ||
| 4201 | "description": "The amount of credits to purchase." | ||
| 4202 | } | ||
| 4203 | } | ||
| 4204 | } | ||
| 4205 | } | ||
| 4206 | } | ||
| 4207 | } | ||
| 4208 | } | ||
| 4209 | }, | ||
| 4210 | "x-codeSamples": [ | ||
| 4211 | { | ||
| 4212 | "lang": "curl", | ||
| 4213 | "label": "cURL", | ||
| 4214 | "source": "curl --request POST \\\n --url 'https://api.vercel.com/v1/billing/buy?teamId=\u003cteam\u003e' \\\n --header 'Authorization: Bearer \u003ctoken\u003e' \\\n --header 'Content-Type: application/json' \\\n --data '{\"item\":{\"type\":\"credits\",\"creditType\":\"v0\",\"amount\":100}}'\n" | ||
| 4215 | } | ||
| 4216 | ] | ||
| 4217 | } | ||
| 4218 | }, | ||
| 4219 | "/v1/bulk-redirects": { | ||
| 4220 | "put": { | ||
| 4221 | "description": "Stages new redirects for a project and returns the new version.", | ||
| 4222 | "operationId": "stageRedirects", | ||
| 4223 | "security": [ | ||
| 4224 | { | ||
| 4225 | "bearerToken": [] | ||
| 4226 | } | ||
| 4227 | ], | ||
| 4228 | "summary": "Stages new redirects for a project.", | ||
| 4229 | "tags": ["bulk-redirects"], | ||
| 4230 | "responses": { | ||
| 4231 | "200": { | ||
| 4232 | "description": "", | ||
| 4233 | "content": { | ||
| 4234 | "application/json": { | ||
| 4235 | "schema": { | ||
| 4236 | "properties": { | ||
| 4237 | "alias": { | ||
| 4238 | "nullable": true, | ||
| 4239 | "type": "string" | ||
| 4240 | }, | ||
| 4241 | "version": { | ||
| 4242 | "properties": { | ||
| 4243 | "id": { | ||
| 4244 | "type": "string", | ||
| 4245 | "description": "The unique identifier for the version." | ||
| 4246 | }, | ||
| 4247 | "key": { | ||
| 4248 | "type": "string", | ||
| 4249 | "description": "The key of the version. The key may be duplicated across versions if the contents are the same as a different version." | ||
| 4250 | }, | ||
| 4251 | "lastModified": { | ||
| 4252 | "type": "number" | ||
| 4253 | }, | ||
| 4254 | "createdBy": { | ||
| 4255 | "type": "string" | ||
| 4256 | }, | ||
| 4257 | "name": { | ||
| 4258 | "type": "string", | ||
| 4259 | "description": "Optional name for the version. If not provided, defaults to an ISO timestamp string." | ||
| 4260 | }, | ||
| 4261 | "isStaging": { | ||
| 4262 | "type": "boolean", | ||
| 4263 | "enum": [false, true], | ||
| 4264 | "description": "Whether this version has not been promoted to production yet and is not serving end users." | ||
| 4265 | }, | ||
| 4266 | "isLive": { | ||
| 4267 | "type": "boolean", | ||
| 4268 | "enum": [false, true], | ||
| 4269 | "description": "Whether this version is currently live in production." | ||
| 4270 | }, | ||
| 4271 | "redirectCount": { | ||
| 4272 | "type": "number", | ||
| 4273 | "description": "The number of redirects in this version." | ||
| 4274 | }, | ||
| 4275 | "alias": { | ||
| 4276 | "type": "string", | ||
| 4277 | "description": "The staging link for previewing redirects in this version." | ||
| 4278 | } | ||
| 4279 | }, | ||
| 4280 | "required": ["createdBy", "id", "key", "lastModified"], | ||
| 4281 | "type": "object" | ||
| 4282 | } | ||
| 4283 | }, | ||
| 4284 | "required": ["alias", "version"], | ||
| 4285 | "type": "object" | ||
| 4286 | } | ||
| 4287 | } | ||
| 4288 | } | ||
| 4289 | }, | ||
| 4290 | "400": { | ||
| 4291 | "description": "One of the provided values in the request body is invalid." | ||
| 4292 | }, | ||
| 4293 | "401": { | ||
| 4294 | "description": "The request is not authorized." | ||
| 4295 | }, | ||
| 4296 | "403": { | ||
| 4297 | "description": "You do not have permission to access this resource." | ||
| 4298 | }, | ||
| 4299 | "500": { | ||
| 4300 | "description": "" | ||
| 4301 | } | ||
| 4302 | }, | ||
| 4303 | "parameters": [ | ||
| 4304 | { | ||
| 4305 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 4306 | "in": "query", | ||
| 4307 | "name": "teamId", | ||
| 4308 | "schema": { | ||
| 4309 | "type": "string", | ||
| 4310 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 4311 | } | ||
| 4312 | }, | ||
| 4313 | { | ||
| 4314 | "description": "The Team slug to perform the request on behalf of.", | ||
| 4315 | "in": "query", | ||
| 4316 | "name": "slug", | ||
| 4317 | "schema": { | ||
| 4318 | "type": "string", | ||
| 4319 | "example": "my-team-url-slug" | ||
| 4320 | } | ||
| 4321 | } | ||
| 4322 | ], | ||
| 4323 | "requestBody": { | ||
| 4324 | "content": { | ||
| 4325 | "application/json": { | ||
| 4326 | "schema": { | ||
| 4327 | "type": "object", | ||
| 4328 | "required": ["projectId", "teamId"], | ||
| 4329 | "properties": { | ||
| 4330 | "projectId": { | ||
| 4331 | "type": "string" | ||
| 4332 | }, | ||
| 4333 | "teamId": { | ||
| 4334 | "type": "string" | ||
| 4335 | }, | ||
| 4336 | "overwrite": { | ||
| 4337 | "type": "boolean" | ||
| 4338 | }, | ||
| 4339 | "name": { | ||
| 4340 | "type": "string", | ||
| 4341 | "maxLength": 256 | ||
| 4342 | }, | ||
| 4343 | "redirects": { | ||
| 4344 | "type": "array", | ||
| 4345 | "default": [], | ||
| 4346 | "items": { | ||
| 4347 | "type": "object", | ||
| 4348 | "required": ["source", "destination"], | ||
| 4349 | "properties": { | ||
| 4350 | "source": { | ||
| 4351 | "type": "string", | ||
| 4352 | "maxLength": 2048 | ||
| 4353 | }, | ||
| 4354 | "destination": { | ||
| 4355 | "type": "string", | ||
| 4356 | "maxLength": 2048 | ||
| 4357 | }, | ||
| 4358 | "statusCode": { | ||
| 4359 | "oneOf": [ | ||
| 4360 | { | ||
| 4361 | "type": "number" | ||
| 4362 | }, | ||
| 4363 | { | ||
| 4364 | "type": "string" | ||
| 4365 | } | ||
| 4366 | ] | ||
| 4367 | }, | ||
| 4368 | "permanent": { | ||
| 4369 | "type": "boolean" | ||
| 4370 | }, | ||
| 4371 | "caseSensitive": { | ||
| 4372 | "type": "boolean" | ||
| 4373 | }, | ||
| 4374 | "query": { | ||
| 4375 | "type": "boolean" | ||
| 4376 | }, | ||
| 4377 | "preserveQueryParams": { | ||
| 4378 | "type": "boolean" | ||
| 4379 | } | ||
| 4380 | } | ||
| 4381 | } | ||
| 4382 | } | ||
| 4383 | } | ||
| 4384 | } | ||
| 4385 | } | ||
| 4386 | } | ||
| 4387 | } | ||
| 4388 | }, | ||
| 4389 | "get": { | ||
| 4390 | "description": "Get the version history for a project's bulk redirects", | ||
| 4391 | "operationId": "getRedirects", | ||
| 4392 | "security": [ | ||
| 4393 | { | ||
| 4394 | "bearerToken": [] | ||
| 4395 | } | ||
| 4396 | ], | ||
| 4397 | "summary": "Gets project-level redirects.", | ||
| 4398 | "tags": ["bulk-redirects"], | ||
| 4399 | "responses": { | ||
| 4400 | "200": { | ||
| 4401 | "description": "", | ||
| 4402 | "content": { | ||
| 4403 | "application/json": { | ||
| 4404 | "schema": { | ||
| 4405 | "oneOf": [ | ||
| 4406 | { | ||
| 4407 | "type": "object", | ||
| 4408 | "additionalProperties": true | ||
| 4409 | }, | ||
| 4410 | { | ||
| 4411 | "properties": { | ||
| 4412 | "version": { | ||
| 4413 | "properties": { | ||
| 4414 | "id": { | ||
| 4415 | "type": "string", | ||
| 4416 | "description": "The unique identifier for the version." | ||
| 4417 | }, | ||
| 4418 | "key": { | ||
| 4419 | "type": "string", | ||
| 4420 | "description": "The key of the version. The key may be duplicated across versions if the contents are the same as a different version." | ||
| 4421 | }, | ||
| 4422 | "lastModified": { | ||
| 4423 | "type": "number" | ||
| 4424 | }, | ||
| 4425 | "createdBy": { | ||
| 4426 | "type": "string" | ||
| 4427 | }, | ||
| 4428 | "name": { | ||
| 4429 | "type": "string", | ||
| 4430 | "description": "Optional name for the version. If not provided, defaults to an ISO timestamp string." | ||
| 4431 | }, | ||
| 4432 | "isStaging": { | ||
| 4433 | "type": "boolean", | ||
| 4434 | "enum": [false, true], | ||
| 4435 | "description": "Whether this version has not been promoted to production yet and is not serving end users." | ||
| 4436 | }, | ||
| 4437 | "isLive": { | ||
| 4438 | "type": "boolean", | ||
| 4439 | "enum": [false, true], | ||
| 4440 | "description": "Whether this version is currently live in production." | ||
| 4441 | }, | ||
| 4442 | "redirectCount": { | ||
| 4443 | "type": "number", | ||
| 4444 | "description": "The number of redirects in this version." | ||
| 4445 | }, | ||
| 4446 | "alias": { | ||
| 4447 | "type": "string", | ||
| 4448 | "description": "The staging link for previewing redirects in this version." | ||
| 4449 | } | ||
| 4450 | }, | ||
| 4451 | "required": ["createdBy", "id", "key", "lastModified"], | ||
| 4452 | "type": "object" | ||
| 4453 | }, | ||
| 4454 | "redirects": { | ||
| 4455 | "items": { | ||
| 4456 | "properties": { | ||
| 4457 | "statusCode": { | ||
| 4458 | "type": "number" | ||
| 4459 | }, | ||
| 4460 | "permanent": { | ||
| 4461 | "type": "boolean", | ||
| 4462 | "enum": [false, true] | ||
| 4463 | }, | ||
| 4464 | "sensitive": { | ||
| 4465 | "type": "boolean", | ||
| 4466 | "enum": [false, true] | ||
| 4467 | }, | ||
| 4468 | "caseSensitive": { | ||
| 4469 | "type": "boolean", | ||
| 4470 | "enum": [false, true] | ||
| 4471 | }, | ||
| 4472 | "query": { | ||
| 4473 | "type": "boolean", | ||
| 4474 | "enum": [false, true] | ||
| 4475 | }, | ||
| 4476 | "preserveQueryParams": { | ||
| 4477 | "type": "boolean", | ||
| 4478 | "enum": [false, true] | ||
| 4479 | }, | ||
| 4480 | "destination": { | ||
| 4481 | "type": "string" | ||
| 4482 | }, | ||
| 4483 | "source": { | ||
| 4484 | "type": "string" | ||
| 4485 | } | ||
| 4486 | }, | ||
| 4487 | "required": ["destination", "source"], | ||
| 4488 | "type": "object" | ||
| 4489 | }, | ||
| 4490 | "type": "array" | ||
| 4491 | }, | ||
| 4492 | "pagination": { | ||
| 4493 | "properties": { | ||
| 4494 | "page": { | ||
| 4495 | "type": "number" | ||
| 4496 | }, | ||
| 4497 | "per_page": { | ||
| 4498 | "type": "number" | ||
| 4499 | }, | ||
| 4500 | "numPages": { | ||
| 4501 | "type": "number" | ||
| 4502 | } | ||
| 4503 | }, | ||
| 4504 | "required": ["numPages", "page", "per_page"], | ||
| 4505 | "type": "object" | ||
| 4506 | } | ||
| 4507 | }, | ||
| 4508 | "required": ["pagination", "redirects", "version"], | ||
| 4509 | "type": "object" | ||
| 4510 | }, | ||
| 4511 | { | ||
| 4512 | "properties": { | ||
| 4513 | "redirects": { | ||
| 4514 | "items": { | ||
| 4515 | "properties": { | ||
| 4516 | "statusCode": { | ||
| 4517 | "type": "number" | ||
| 4518 | }, | ||
| 4519 | "permanent": { | ||
| 4520 | "type": "boolean", | ||
| 4521 | "enum": [false, true] | ||
| 4522 | }, | ||
| 4523 | "sensitive": { | ||
| 4524 | "type": "boolean", | ||
| 4525 | "enum": [false, true] | ||
| 4526 | }, | ||
| 4527 | "caseSensitive": { | ||
| 4528 | "type": "boolean", | ||
| 4529 | "enum": [false, true] | ||
| 4530 | }, | ||
| 4531 | "query": { | ||
| 4532 | "type": "boolean", | ||
| 4533 | "enum": [false, true] | ||
| 4534 | }, | ||
| 4535 | "preserveQueryParams": { | ||
| 4536 | "type": "boolean", | ||
| 4537 | "enum": [false, true] | ||
| 4538 | }, | ||
| 4539 | "destination": { | ||
| 4540 | "type": "string" | ||
| 4541 | }, | ||
| 4542 | "source": { | ||
| 4543 | "type": "string" | ||
| 4544 | } | ||
| 4545 | }, | ||
| 4546 | "required": ["destination", "source"], | ||
| 4547 | "type": "object" | ||
| 4548 | }, | ||
| 4549 | "type": "array" | ||
| 4550 | }, | ||
| 4551 | "version": { | ||
| 4552 | "properties": { | ||
| 4553 | "id": { | ||
| 4554 | "type": "string", | ||
| 4555 | "description": "The unique identifier for the version." | ||
| 4556 | }, | ||
| 4557 | "key": { | ||
| 4558 | "type": "string", | ||
| 4559 | "description": "The key of the version. The key may be duplicated across versions if the contents are the same as a different version." | ||
| 4560 | }, | ||
| 4561 | "lastModified": { | ||
| 4562 | "type": "number" | ||
| 4563 | }, | ||
| 4564 | "createdBy": { | ||
| 4565 | "type": "string" | ||
| 4566 | }, | ||
| 4567 | "name": { | ||
| 4568 | "type": "string", | ||
| 4569 | "description": "Optional name for the version. If not provided, defaults to an ISO timestamp string." | ||
| 4570 | }, | ||
| 4571 | "isStaging": { | ||
| 4572 | "type": "boolean", | ||
| 4573 | "enum": [false, true], | ||
| 4574 | "description": "Whether this version has not been promoted to production yet and is not serving end users." | ||
| 4575 | }, | ||
| 4576 | "isLive": { | ||
| 4577 | "type": "boolean", | ||
| 4578 | "enum": [false, true], | ||
| 4579 | "description": "Whether this version is currently live in production." | ||
| 4580 | }, | ||
| 4581 | "redirectCount": { | ||
| 4582 | "type": "number", | ||
| 4583 | "description": "The number of redirects in this version." | ||
| 4584 | }, | ||
| 4585 | "alias": { | ||
| 4586 | "type": "string", | ||
| 4587 | "description": "The staging link for previewing redirects in this version." | ||
| 4588 | } | ||
| 4589 | }, | ||
| 4590 | "required": ["createdBy", "id", "key", "lastModified"], | ||
| 4591 | "type": "object" | ||
| 4592 | }, | ||
| 4593 | "pagination": { | ||
| 4594 | "properties": { | ||
| 4595 | "page": { | ||
| 4596 | "type": "number" | ||
| 4597 | }, | ||
| 4598 | "per_page": { | ||
| 4599 | "type": "number" | ||
| 4600 | }, | ||
| 4601 | "numPages": { | ||
| 4602 | "type": "number" | ||
| 4603 | } | ||
| 4604 | }, | ||
| 4605 | "required": ["numPages", "page", "per_page"], | ||
| 4606 | "type": "object" | ||
| 4607 | } | ||
| 4608 | }, | ||
| 4609 | "required": ["pagination", "redirects"], | ||
| 4610 | "type": "object" | ||
| 4611 | } | ||
| 4612 | ] | ||
| 4613 | } | ||
| 4614 | } | ||
| 4615 | } | ||
| 4616 | }, | ||
| 4617 | "400": { | ||
| 4618 | "description": "One of the provided values in the request query is invalid." | ||
| 4619 | }, | ||
| 4620 | "401": { | ||
| 4621 | "description": "The request is not authorized." | ||
| 4622 | }, | ||
| 4623 | "403": { | ||
| 4624 | "description": "You do not have permission to access this resource." | ||
| 4625 | }, | ||
| 4626 | "404": { | ||
| 4627 | "description": "" | ||
| 4628 | } | ||
| 4629 | }, | ||
| 4630 | "parameters": [ | ||
| 4631 | { | ||
| 4632 | "name": "projectId", | ||
| 4633 | "in": "query", | ||
| 4634 | "required": true, | ||
| 4635 | "schema": { | ||
| 4636 | "type": "string" | ||
| 4637 | } | ||
| 4638 | }, | ||
| 4639 | { | ||
| 4640 | "name": "versionId", | ||
| 4641 | "in": "query", | ||
| 4642 | "required": false, | ||
| 4643 | "schema": { | ||
| 4644 | "type": "string" | ||
| 4645 | } | ||
| 4646 | }, | ||
| 4647 | { | ||
| 4648 | "name": "q", | ||
| 4649 | "in": "query", | ||
| 4650 | "required": false, | ||
| 4651 | "schema": { | ||
| 4652 | "type": "string" | ||
| 4653 | } | ||
| 4654 | }, | ||
| 4655 | { | ||
| 4656 | "name": "diff", | ||
| 4657 | "in": "query", | ||
| 4658 | "required": false, | ||
| 4659 | "schema": { | ||
| 4660 | "oneOf": [ | ||
| 4661 | { | ||
| 4662 | "type": "boolean" | ||
| 4663 | }, | ||
| 4664 | { | ||
| 4665 | "type": "string", | ||
| 4666 | "enum": ["only"] | ||
| 4667 | } | ||
| 4668 | ] | ||
| 4669 | } | ||
| 4670 | }, | ||
| 4671 | { | ||
| 4672 | "name": "page", | ||
| 4673 | "in": "query", | ||
| 4674 | "required": false, | ||
| 4675 | "schema": { | ||
| 4676 | "type": "integer", | ||
| 4677 | "minimum": 1 | ||
| 4678 | } | ||
| 4679 | }, | ||
| 4680 | { | ||
| 4681 | "name": "per_page", | ||
| 4682 | "in": "query", | ||
| 4683 | "required": false, | ||
| 4684 | "schema": { | ||
| 4685 | "type": "integer", | ||
| 4686 | "minimum": 10, | ||
| 4687 | "maximum": 250 | ||
| 4688 | } | ||
| 4689 | }, | ||
| 4690 | { | ||
| 4691 | "name": "sort_by", | ||
| 4692 | "in": "query", | ||
| 4693 | "required": false, | ||
| 4694 | "schema": { | ||
| 4695 | "type": "string", | ||
| 4696 | "enum": ["source", "destination", "statusCode"] | ||
| 4697 | } | ||
| 4698 | }, | ||
| 4699 | { | ||
| 4700 | "name": "sort_order", | ||
| 4701 | "in": "query", | ||
| 4702 | "required": false, | ||
| 4703 | "schema": { | ||
| 4704 | "type": "string", | ||
| 4705 | "enum": ["asc", "desc"] | ||
| 4706 | } | ||
| 4707 | }, | ||
| 4708 | { | ||
| 4709 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 4710 | "in": "query", | ||
| 4711 | "name": "teamId", | ||
| 4712 | "schema": { | ||
| 4713 | "type": "string", | ||
| 4714 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 4715 | } | ||
| 4716 | }, | ||
| 4717 | { | ||
| 4718 | "description": "The Team slug to perform the request on behalf of.", | ||
| 4719 | "in": "query", | ||
| 4720 | "name": "slug", | ||
| 4721 | "schema": { | ||
| 4722 | "type": "string", | ||
| 4723 | "example": "my-team-url-slug" | ||
| 4724 | } | ||
| 4725 | } | ||
| 4726 | ] | ||
| 4727 | }, | ||
| 4728 | "delete": { | ||
| 4729 | "description": "Deletes the provided redirects from the latest version of the projects' bulk redirects. Stages a new change with the new redirects and returns the alias for the new version in the response.", | ||
| 4730 | "operationId": "deleteRedirects", | ||
| 4731 | "security": [ | ||
| 4732 | { | ||
| 4733 | "bearerToken": [] | ||
| 4734 | } | ||
| 4735 | ], | ||
| 4736 | "summary": "Delete project-level redirects.", | ||
| 4737 | "tags": ["bulk-redirects"], | ||
| 4738 | "responses": { | ||
| 4739 | "200": { | ||
| 4740 | "description": "", | ||
| 4741 | "content": { | ||
| 4742 | "application/json": { | ||
| 4743 | "schema": { | ||
| 4744 | "oneOf": [ | ||
| 4745 | { | ||
| 4746 | "properties": { | ||
| 4747 | "alias": { | ||
| 4748 | "type": "string" | ||
| 4749 | }, | ||
| 4750 | "version": { | ||
| 4751 | "properties": { | ||
| 4752 | "id": { | ||
| 4753 | "type": "string", | ||
| 4754 | "description": "The unique identifier for the version." | ||
| 4755 | }, | ||
| 4756 | "key": { | ||
| 4757 | "type": "string", | ||
| 4758 | "description": "The key of the version. The key may be duplicated across versions if the contents are the same as a different version." | ||
| 4759 | }, | ||
| 4760 | "lastModified": { | ||
| 4761 | "type": "number" | ||
| 4762 | }, | ||
| 4763 | "createdBy": { | ||
| 4764 | "type": "string" | ||
| 4765 | }, | ||
| 4766 | "name": { | ||
| 4767 | "type": "string", | ||
| 4768 | "description": "Optional name for the version. If not provided, defaults to an ISO timestamp string." | ||
| 4769 | }, | ||
| 4770 | "isStaging": { | ||
| 4771 | "type": "boolean", | ||
| 4772 | "enum": [false, true], | ||
| 4773 | "description": "Whether this version has not been promoted to production yet and is not serving end users." | ||
| 4774 | }, | ||
| 4775 | "isLive": { | ||
| 4776 | "type": "boolean", | ||
| 4777 | "enum": [false, true], | ||
| 4778 | "description": "Whether this version is currently live in production." | ||
| 4779 | }, | ||
| 4780 | "redirectCount": { | ||
| 4781 | "type": "number", | ||
| 4782 | "description": "The number of redirects in this version." | ||
| 4783 | }, | ||
| 4784 | "alias": { | ||
| 4785 | "type": "string", | ||
| 4786 | "description": "The staging link for previewing redirects in this version." | ||
| 4787 | } | ||
| 4788 | }, | ||
| 4789 | "required": ["createdBy", "id", "key", "lastModified"], | ||
| 4790 | "type": "object" | ||
| 4791 | } | ||
| 4792 | }, | ||
| 4793 | "required": ["version"], | ||
| 4794 | "type": "object" | ||
| 4795 | }, | ||
| 4796 | { | ||
| 4797 | "properties": { | ||
| 4798 | "alias": { | ||
| 4799 | "nullable": true | ||
| 4800 | }, | ||
| 4801 | "version": { | ||
| 4802 | "properties": { | ||
| 4803 | "id": { | ||
| 4804 | "type": "string", | ||
| 4805 | "description": "The unique identifier for the version." | ||
| 4806 | }, | ||
| 4807 | "key": { | ||
| 4808 | "type": "string", | ||
| 4809 | "description": "The key of the version. The key may be duplicated across versions if the contents are the same as a different version." | ||
| 4810 | }, | ||
| 4811 | "lastModified": { | ||
| 4812 | "type": "number" | ||
| 4813 | }, | ||
| 4814 | "createdBy": { | ||
| 4815 | "type": "string" | ||
| 4816 | }, | ||
| 4817 | "name": { | ||
| 4818 | "type": "string", | ||
| 4819 | "description": "Optional name for the version. If not provided, defaults to an ISO timestamp string." | ||
| 4820 | }, | ||
| 4821 | "isStaging": { | ||
| 4822 | "type": "boolean", | ||
| 4823 | "enum": [false, true], | ||
| 4824 | "description": "Whether this version has not been promoted to production yet and is not serving end users." | ||
| 4825 | }, | ||
| 4826 | "isLive": { | ||
| 4827 | "type": "boolean", | ||
| 4828 | "enum": [false, true], | ||
| 4829 | "description": "Whether this version is currently live in production." | ||
| 4830 | }, | ||
| 4831 | "redirectCount": { | ||
| 4832 | "type": "number", | ||
| 4833 | "description": "The number of redirects in this version." | ||
| 4834 | }, | ||
| 4835 | "alias": { | ||
| 4836 | "type": "string", | ||
| 4837 | "description": "The staging link for previewing redirects in this version." | ||
| 4838 | } | ||
| 4839 | }, | ||
| 4840 | "required": ["createdBy", "id", "key", "lastModified"], | ||
| 4841 | "type": "object" | ||
| 4842 | } | ||
| 4843 | }, | ||
| 4844 | "required": ["alias", "version"], | ||
| 4845 | "type": "object" | ||
| 4846 | }, | ||
| 4847 | { | ||
| 4848 | "properties": { | ||
| 4849 | "alias": { | ||
| 4850 | "nullable": true, | ||
| 4851 | "type": "string" | ||
| 4852 | }, | ||
| 4853 | "version": { | ||
| 4854 | "properties": { | ||
| 4855 | "id": { | ||
| 4856 | "type": "string", | ||
| 4857 | "description": "The unique identifier for the version." | ||
| 4858 | }, | ||
| 4859 | "key": { | ||
| 4860 | "type": "string", | ||
| 4861 | "description": "The key of the version. The key may be duplicated across versions if the contents are the same as a different version." | ||
| 4862 | }, | ||
| 4863 | "lastModified": { | ||
| 4864 | "type": "number" | ||
| 4865 | }, | ||
| 4866 | "createdBy": { | ||
| 4867 | "type": "string" | ||
| 4868 | }, | ||
| 4869 | "name": { | ||
| 4870 | "type": "string", | ||
| 4871 | "description": "Optional name for the version. If not provided, defaults to an ISO timestamp string." | ||
| 4872 | }, | ||
| 4873 | "isStaging": { | ||
| 4874 | "type": "boolean", | ||
| 4875 | "enum": [false, true], | ||
| 4876 | "description": "Whether this version has not been promoted to production yet and is not serving end users." | ||
| 4877 | }, | ||
| 4878 | "isLive": { | ||
| 4879 | "type": "boolean", | ||
| 4880 | "enum": [false, true], | ||
| 4881 | "description": "Whether this version is currently live in production." | ||
| 4882 | }, | ||
| 4883 | "redirectCount": { | ||
| 4884 | "type": "number", | ||
| 4885 | "description": "The number of redirects in this version." | ||
| 4886 | }, | ||
| 4887 | "alias": { | ||
| 4888 | "type": "string", | ||
| 4889 | "description": "The staging link for previewing redirects in this version." | ||
| 4890 | } | ||
| 4891 | }, | ||
| 4892 | "required": ["createdBy", "id", "key", "lastModified"], | ||
| 4893 | "type": "object" | ||
| 4894 | } | ||
| 4895 | }, | ||
| 4896 | "required": ["alias", "version"], | ||
| 4897 | "type": "object" | ||
| 4898 | } | ||
| 4899 | ] | ||
| 4900 | } | ||
| 4901 | } | ||
| 4902 | } | ||
| 4903 | }, | ||
| 4904 | "400": { | ||
| 4905 | "description": "One of the provided values in the request body is invalid.\nOne of the provided values in the request query is invalid." | ||
| 4906 | }, | ||
| 4907 | "401": { | ||
| 4908 | "description": "The request is not authorized." | ||
| 4909 | }, | ||
| 4910 | "403": { | ||
| 4911 | "description": "You do not have permission to access this resource." | ||
| 4912 | }, | ||
| 4913 | "404": { | ||
| 4914 | "description": "" | ||
| 4915 | }, | ||
| 4916 | "500": { | ||
| 4917 | "description": "" | ||
| 4918 | } | ||
| 4919 | }, | ||
| 4920 | "parameters": [ | ||
| 4921 | { | ||
| 4922 | "name": "projectId", | ||
| 4923 | "in": "query", | ||
| 4924 | "required": true, | ||
| 4925 | "schema": { | ||
| 4926 | "type": "string" | ||
| 4927 | } | ||
| 4928 | }, | ||
| 4929 | { | ||
| 4930 | "description": "The Team identifier to perform the request on behalf of.", | ||
| 4931 | "in": "query", | ||
| 4932 | "name": "teamId", | ||
| 4933 | "schema": { | ||
| 4934 | "type": "string", | ||
| 4935 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l" | ||
| 4936 | } | ||
| 4937 | }, | ||
| 4938 | { | ||
| 4939 | "description": "The Team slug to perform the request on behalf of.", | ||
| 4940 | "in": "query", | ||
| 4941 | "name": "slug", | ||
| 4942 | "schema": { | ||
| 4943 | "type": "string", | ||
| 4944 | "example": "my-team-url-slug" | ||
| 4945 | } | ||
| 4946 | } | ||
| 4947 | ], | ||
| 4948 | "requestBody": { | ||
| 4949 | "content": { | ||
| 4950 | "application/json": { | ||
| 4951 | "schema": { | ||
| 4952 | "type": "object", | ||
| 4953 | "properties": { | ||
| 4954 | "name": { | ||
| 4955 | "type": "string", | ||
| 4956 | "maxLength": 256 | ||
| 4957 | }, | ||
| 4958 | "redirects": { | ||
| 4959 | "description": "The redirects to delete. The source of the redirect is used to match the redirect to delete.", | ||
| 4960 | "type": "array", | ||
| 4961 | "minItems": 1, | ||
| 4962 | "items": { | ||
| 4963 | "type": "string" | ||
| 4964 | } | ||
| 4965 | } | ||
| 4966 | }, | ||
| 4967 | "required": ["redirects"] | ||
| 4968 | } | ||
| 4969 | } | ||
| 4970 | } | ||
| 4971 | } | ||
| 4972 | }, | ||
| 4973 | "patch": { | ||
| 4974 | "description": "Edits a single redirect identified by its source path. Stages a new change with the modified redirect and returns the alias for the new version in the response.", | ||
| 4975 | "operationId": "editRedirect", | ||
| 4976 | "security": [ | ||
| 4977 | { | ||
| 4978 | "bearerToken": [] | ||
| 4979 | } | ||
| 4980 | ], | ||
| 4981 | "summary": "Edit a project-level redirect.", | ||
| 4982 | "tags": ["bulk-redirects"], | ||
| 4983 | "responses": { | ||
| 4984 | "200": { | ||
| 4985 | "description": "", | ||
| 4986 | "content": { | ||
| 4987 | "application/json": { | ||
| 4988 | "schema": { | ||
| 4989 | "properties": { | ||
| 4990 | "alias": { | ||
| 4991 | "nullable": true, | ||
| 4992 | "type": "string" | ||
| 4993 | }, | ||
| 4994 | "version": { | ||
| 4995 | "properties": { | ||
| 4996 | "id": { | ||
| 4997 | "type": "string", | ||
| 4998 | "description": "The unique identifier for the version." | ||
| 4999 | }, | ||
140567 more lines aren’t shown here.
| @@ -5,11 +5,11 @@ import { · 4 unmodified lines | |||
| 5 | ScopeId, | 5 | ScopeId, |
| 6 | ScopedSecretCredentialInput, | 6 | ScopedSecretCredentialInput, |
| 7 | SecretBackedValue, | 7 | SecretBackedValue, |
| 8 | } from "@executor-js/sdk/core"; | 8 | } from "@executor-js/sdk/shared"; |
| 9 | 9 | ||
| 10 | import { OpenApiParseError, OpenApiExtractionError, OpenApiOAuthError } from "../sdk/errors"; | 10 | import { OpenApiParseError, OpenApiExtractionError, OpenApiOAuthError } from "../sdk/errors"; |
| 11 | import { SpecPreview } from "../sdk/preview"; | 11 | import { SpecPreview } from "../sdk/preview"; |
| 12 | import { StoredSourceSchema } from "../sdk/store"; | 12 | import { StoredSourceSchema } from "../sdk/source-contracts"; |
| 13 | import { | 13 | import { |
| 14 | OAuth2SourceConfig, | 14 | OAuth2SourceConfig, |
| 15 | OpenApiSourceBindingInput, | 15 | OpenApiSourceBindingInput, |
| @@ -98,7 +98,15 @@ export const OpenApiHandlers = HttpApiBuilder.group(ExecutorApiWithOpenApi, "ope · 97 unmodified lines | |||
| 98 | namespace: source.namespace, | 98 | namespace: source.namespace, |
| 99 | scope: source.scope, | 99 | scope: source.scope, |
| 100 | name: source.name, | 100 | name: source.name, |
| 101 | config: source.config, | 101 | config: { |
| 102 | sourceUrl: source.config.sourceUrl, | ||
| 103 | baseUrl: source.config.baseUrl, | ||
| 104 | namespace: source.config.namespace, | ||
| 105 | headers: source.config.headers, | ||
| 106 | queryParams: source.config.queryParams, | ||
| 107 | specFetchCredentials: source.config.specFetchCredentials, | ||
| 108 | oauth2: source.config.oauth2, | ||
| 109 | }, | ||
| 102 | }) | 110 | }) |
| 103 | : null; | 111 | : null; |
| 104 | }), | 112 | }), |
| @@ -5,7 +5,7 @@ import * as Match from "effect/Match"; · 4 unmodified lines | |||
| 5 | import * as Option from "effect/Option"; | 5 | import * as Option from "effect/Option"; |
| 6 | import * as Schema from "effect/Schema"; | 6 | import * as Schema from "effect/Schema"; |
| 7 | 7 | ||
| 8 | import { ConnectionId, ScopeId, SecretId } from "@executor-js/sdk/core"; | 8 | import { ConnectionId, ScopeId, SecretId } from "@executor-js/sdk/shared"; |
| 9 | import { startOAuth } from "@executor-js/react/api/atoms"; | 9 | import { startOAuth } from "@executor-js/react/api/atoms"; |
| 10 | import { useScope, useScopeStack } from "@executor-js/react/api/scope-context"; | 10 | import { useScope, useScopeStack } from "@executor-js/react/api/scope-context"; |
| 11 | import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/reactivity-keys"; | 11 | import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/reactivity-keys"; |
| @@ -66,7 +66,7 @@ import { · 54 unmodified lines | |||
| 66 | oauth2ClientSecretSlot, | 66 | oauth2ClientSecretSlot, |
| 67 | oauth2ConnectionSlot, | 67 | oauth2ConnectionSlot, |
| 68 | queryParamBindingSlot, | 68 | queryParamBindingSlot, |
| 69 | } from "../sdk/store"; | 69 | } from "../sdk/source-contracts"; |
| 70 | import { | 70 | import { |
| 71 | ConfiguredHeaderBinding, | 71 | ConfiguredHeaderBinding, |
| 72 | OAuth2SourceConfig, | 72 | OAuth2SourceConfig, |
| @@ -22,7 +22,7 @@ import { · 21 unmodified lines | |||
| 22 | import { FilterTabs } from "@executor-js/react/components/filter-tabs"; | 22 | import { FilterTabs } from "@executor-js/react/components/filter-tabs"; |
| 23 | import { Input } from "@executor-js/react/components/input"; | 23 | import { Input } from "@executor-js/react/components/input"; |
| 24 | import { sourceWriteKeys as openApiWriteKeys } from "@executor-js/react/api/reactivity-keys"; | 24 | import { sourceWriteKeys as openApiWriteKeys } from "@executor-js/react/api/reactivity-keys"; |
| 25 | import { ConnectionId, ScopeId, SecretId } from "@executor-js/sdk/core"; | 25 | import { ConnectionId, ScopeId, SecretId } from "@executor-js/sdk/shared"; |
| 26 | import { useSecretPickerSecrets } from "@executor-js/react/plugins/use-secret-picker-secrets"; | 26 | import { useSecretPickerSecrets } from "@executor-js/react/plugins/use-secret-picker-secrets"; |
| 27 | import { | 27 | import { |
| 28 | oauthCallbackUrl, | 28 | oauthCallbackUrl, |
| @@ -51,7 +51,7 @@ import { · 22 unmodified lines | |||
| 51 | inferOAuthIssuerUrl, | 51 | inferOAuthIssuerUrl, |
| 52 | resolveOAuthUrl, | 52 | resolveOAuthUrl, |
| 53 | } from "./AddOpenApiSource"; | 53 | } from "./AddOpenApiSource"; |
| 54 | import { oauth2ClientSecretSlot } from "../sdk/store"; | 54 | import { oauth2ClientSecretSlot } from "../sdk/source-contracts"; |
| 55 | import { | 55 | import { |
| 56 | OAuth2SourceConfig, | 56 | OAuth2SourceConfig, |
| 57 | OpenApiSourceBindingInput, | 57 | OpenApiSourceBindingInput, |
| @@ -4,7 +4,7 @@ import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; · 3 unmodified lines | |||
| 4 | import { connectionsAtom, sourceAtom } from "@executor-js/react/api/atoms"; | 4 | import { connectionsAtom, sourceAtom } from "@executor-js/react/api/atoms"; |
| 5 | import { Badge } from "@executor-js/react/components/badge"; | 5 | import { Badge } from "@executor-js/react/components/badge"; |
| 6 | import { useScope, useScopeStack, useUserScope } from "@executor-js/react/api/scope-context"; | 6 | import { useScope, useScopeStack, useUserScope } from "@executor-js/react/api/scope-context"; |
| 7 | import { ScopeId } from "@executor-js/sdk/core"; | 7 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 8 | import { | 8 | import { |
| 9 | SourceCredentialNotice, | 9 | SourceCredentialNotice, |
| 10 | SourceCredentialStatusBadge, | 10 | SourceCredentialStatusBadge, |
| @@ -14,7 +14,7 @@ import { · 3 unmodified lines | |||
| 14 | 14 | ||
| 15 | import { openApiSourceAtom, openApiSourceBindingsAtom } from "./atoms"; | 15 | import { openApiSourceAtom, openApiSourceBindingsAtom } from "./atoms"; |
| 16 | import { effectiveBindingForScope } from "../sdk/credential-status"; | 16 | import { effectiveBindingForScope } from "../sdk/credential-status"; |
| 17 | import { oauth2ClientSecretSlot, type StoredSourceSchemaType } from "../sdk/store"; | 17 | import { oauth2ClientSecretSlot, type StoredSourceSchemaType } from "../sdk/source-contracts"; |
| 18 | 18 | ||
| 19 | function OAuthBadge() { | 19 | function OAuthBadge() { |
| 20 | return <Badge variant="secondary">OAuth</Badge>; | 20 | return <Badge variant="secondary">OAuth</Badge>; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { ScopeId } from "@executor-js/sdk/core"; | 1 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 2 | import * as Atom from "effect/unstable/reactivity/Atom"; | 2 | import * as Atom from "effect/unstable/reactivity/Atom"; |
| 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 4 | import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | 4 | import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; |
| @@ -0,0 +1,4341 @@ | |||
| 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
| 2 | |||
| 3 | exports[`Real specs: Cloudflare API > preserves extraction baseline for representative operations 1`] = ` | ||
| 4 | { | ||
| 5 | "inputSchemaOperationCount": 2715, | ||
| 6 | "operationCount": 2726, | ||
| 7 | "outputSchemaOperationCount": 2669, | ||
| 8 | "selectedOperations": [ | ||
| 9 | { | ||
| 10 | "hasInputSchema": true, | ||
| 11 | "hasOutputSchema": true, | ||
| 12 | "method": "post", | ||
| 13 | "operationId": "access-applications-add-an-application", | ||
| 14 | "pathTemplate": "/accounts/{account_id}/access/apps", | ||
| 15 | "tags": [ | ||
| 16 | "Access applications", | ||
| 17 | ], | ||
| 18 | }, | ||
| 19 | { | ||
| 20 | "hasInputSchema": true, | ||
| 21 | "hasOutputSchema": true, | ||
| 22 | "method": "post", | ||
| 23 | "operationId": "dns-records-for-a-zone-create-dns-record", | ||
| 24 | "pathTemplate": "/zones/{zone_id}/dns_records", | ||
| 25 | "tags": [ | ||
| 26 | "DNS Records for a Zone", | ||
| 27 | ], | ||
| 28 | }, | ||
| 29 | { | ||
| 30 | "hasInputSchema": true, | ||
| 31 | "hasOutputSchema": true, | ||
| 32 | "method": "put", | ||
| 33 | "operationId": "worker-script-upload-worker-module", | ||
| 34 | "pathTemplate": "/accounts/{account_id}/workers/scripts/{script_name}", | ||
| 35 | "tags": [ | ||
| 36 | "Worker Script", | ||
| 37 | ], | ||
| 38 | }, | ||
| 39 | ], | ||
| 40 | "title": "Cloudflare API", | ||
| 41 | "version": "4.0.0", | ||
| 42 | } | ||
| 43 | `; | ||
| 44 | |||
| 45 | exports[`Real specs: Cloudflare API > preserves registered tool schema and TypeScript output for Access app creation 1`] = ` | ||
| 46 | { | ||
| 47 | "inputSchema": { | ||
| 48 | "additionalProperties": false, | ||
| 49 | "properties": { | ||
| 50 | "account_id": { | ||
| 51 | "$ref": "#/$defs/access_identifier", | ||
| 52 | }, | ||
| 53 | "body": { | ||
| 54 | "$ref": "#/$defs/access_app_request", | ||
| 55 | }, | ||
| 56 | }, | ||
| 57 | "required": [ | ||
| 58 | "account_id", | ||
| 59 | "body", | ||
| 60 | ], | ||
| 61 | "type": "object", | ||
| 62 | }, | ||
| 63 | "inputTypeScript": "{ account_id: AccessIdentifier; body: AccessAppRequest; }", | ||
| 64 | "outputSchema": { | ||
| 65 | "allOf": [ | ||
| 66 | { | ||
| 67 | "$ref": "#/$defs/access_apps_components-schemas-single_response", | ||
| 68 | }, | ||
| 69 | { | ||
| 70 | "properties": { | ||
| 71 | "result": { | ||
| 72 | "$ref": "#/$defs/access_app_response", | ||
| 73 | }, | ||
| 74 | }, | ||
| 75 | }, | ||
| 76 | ], | ||
| 77 | }, | ||
| 78 | "outputTypeScript": "(AccessAppsComponentsSchemasSingleResponse & { result?: AccessAppResponse; })", | ||
| 79 | "schemaDefinitionCount": 157, | ||
| 80 | "schemaDefinitionNames": [ | ||
| 81 | "access_access_group_rule", | ||
| 82 | "access_allow_all_headers", | ||
| 83 | "access_allow_all_methods", | ||
| 84 | "access_allow_all_origins", | ||
| 85 | "access_allow_credentials", | ||
| 86 | "access_allow_email_alias", | ||
| 87 | "access_allow_iframe", | ||
| 88 | "access_allowed_clipboard_local_to_remote_formats", | ||
| 89 | "access_allowed_clipboard_remote_to_local_formats", | ||
| 90 | "access_allowed_headers", | ||
| 91 | "access_allowed_idps", | ||
| 92 | "access_allowed_methods", | ||
| 93 | "access_allowed_origins", | ||
| 94 | "access_any_valid_service_token_rule", | ||
| 95 | "access_api-response-common", | ||
| 96 | "access_api-response-single", | ||
| 97 | "access_app_launcher_logo_url", | ||
| 98 | "access_app_launcher_props", | ||
| 99 | "access_app_launcher_visible", | ||
| 100 | "access_app_policy_link", | ||
| 101 | "access_app_policy_request", | ||
| 102 | "access_app_policy_response", | ||
| 103 | "access_app_req_embedded_policies", | ||
| 104 | "access_app_req_embedded_scim_config", | ||
| 105 | "access_app_request", | ||
| 106 | "access_app_resp_embedded_policies", | ||
| 107 | "access_app_resp_embedded_target_criteria_infra", | ||
| 108 | "access_app_resp_embedded_target_criteria_self_hosted", | ||
| 109 | "access_app_response", | ||
| 110 | "access_approval_group", | ||
| 111 | "access_approval_groups", | ||
| 112 | "access_approval_required", | ||
| 113 | "access_apps_components-schemas-name", | ||
| 114 | "access_apps_components-schemas-single_response", | ||
| 115 | "access_auth_context_rule", | ||
| 116 | "access_authentication_method_rule", | ||
| 117 | "access_azure_group_rule", | ||
| 118 | "access_base_policy_req", | ||
| 119 | "access_base_policy_resp", | ||
| 120 | "access_basic_app_response_props", | ||
| 121 | "access_bg_color", | ||
| 122 | "access_biso_props", | ||
| 123 | "access_bookmark_props", | ||
| 124 | "access_button_color", | ||
| 125 | "access_button_text_color", | ||
| 126 | "access_certificate_rule", | ||
| 127 | "access_common_name_rule", | ||
| 128 | "access_components-schemas-session_duration", | ||
| 129 | "access_connection_rules", | ||
| 130 | "access_connection_rules_infra", | ||
| 131 | "access_connection_rules_rdp", | ||
| 132 | "access_connection_rules_ssh", | ||
| 133 | "access_cors_headers", | ||
| 134 | "access_country_rule", | ||
| 135 | "access_created_at", | ||
| 136 | "access_custom_deny_message", | ||
| 137 | "access_custom_deny_url", | ||
| 138 | "access_custom_non_identity_deny_url", | ||
| 139 | "access_decision", | ||
| 140 | "access_destinations", | ||
| 141 | "access_device_posture_rule", | ||
| 142 | "access_domain", | ||
| 143 | "access_domain_rule", | ||
| 144 | "access_email_list_rule", | ||
| 145 | "access_email_rule", | ||
| 146 | "access_enable_binding_cookie", | ||
| 147 | "access_everyone_rule", | ||
| 148 | "access_external_evaluation_rule", | ||
| 149 | "access_feature_app_props", | ||
| 150 | "access_footer_links", | ||
| 151 | "access_github_organization_rule", | ||
| 152 | "access_gsuite_group_rule", | ||
| 153 | "access_header_bg_color", | ||
| 154 | "access_http_only_cookie_attribute", | ||
| 155 | "access_identifier", | ||
| 156 | "access_image_url", | ||
| 157 | "access_infra_app_req_embedded_policies", | ||
| 158 | "access_infra_app_resp_embedded_policies", | ||
| 159 | "access_infra_policy_req", | ||
| 160 | "access_infra_policy_resp", | ||
| 161 | "access_infra_props", | ||
| 162 | "access_ip_list_rule", | ||
| 163 | "access_ip_rule", | ||
| 164 | "access_isolation_required", | ||
| 165 | "access_landing_page_design", | ||
| 166 | "access_linked_app_token_rule", | ||
| 167 | "access_login_method_rule", | ||
| 168 | "access_logo_url", | ||
| 169 | "access_max_age", | ||
| 170 | "access_mcp_portal_props", | ||
| 171 | "access_mcp_props", | ||
| 172 | "access_message", | ||
| 173 | "access_messages", | ||
| 174 | "access_mfa_config", | ||
| 175 | "access_oauth_configuration", | ||
| 176 | "access_oidc_claim_rule", | ||
| 177 | "access_oidc_saas_app", | ||
| 178 | "access_okta_group_rule", | ||
| 179 | "access_options_preflight_bypass", | ||
| 180 | "access_path_cookie_attribute", | ||
| 181 | "access_policy_components-schemas-name", | ||
| 182 | "access_policy_req", | ||
| 183 | "access_policy_resp", | ||
| 184 | "access_port", | ||
| 185 | "access_precedence", | ||
| 186 | "access_protocol_infra_app", | ||
| 187 | "access_protocol_self_hosted_app", | ||
| 188 | "access_proxy_endpoint_props", | ||
| 189 | "access_purpose_justification_prompt", | ||
| 190 | "access_purpose_justification_required", | ||
| 191 | "access_rdp_clipboard_format", | ||
| 192 | "access_rdp_props", | ||
| 193 | "access_read_service_tokens_from_header", | ||
| 194 | "access_rule", | ||
| 195 | "access_saas_props", | ||
| 196 | "access_same_site_cookie_attribute", | ||
| 197 | "access_saml_group_rule", | ||
| 198 | "access_saml_saas_app", | ||
| 199 | "access_schemas-allow_authenticate_via_warp", | ||
| 200 | "access_schemas-aud", | ||
| 201 | "access_schemas-auto_redirect_to_identity", | ||
| 202 | "access_schemas-custom_pages", | ||
| 203 | "access_schemas-exclude", | ||
| 204 | "access_schemas-include", | ||
| 205 | "access_schemas-require", | ||
| 206 | "access_schemas-session_duration", | ||
| 207 | "access_schemas-uuid", | ||
| 208 | "access_scim_config", | ||
| 209 | "access_scim_config_authentication_access_service_token", | ||
| 210 | "access_scim_config_authentication_http_basic", | ||
| 211 | "access_scim_config_authentication_oauth2", | ||
| 212 | "access_scim_config_authentication_oauth_bearer_token", | ||
| 213 | "access_scim_config_mapping", | ||
| 214 | "access_scim_config_multi_authentication", | ||
| 215 | "access_scim_config_single_authentication", | ||
| 216 | "access_self_hosted_domains", | ||
| 217 | "access_self_hosted_props", | ||
| 218 | "access_service_auth_401_redirect", | ||
| 219 | "access_service_token_rule", | ||
| 220 | "access_skip_app_launcher_login_page", | ||
| 221 | "access_skip_interstitial", | ||
| 222 | "access_ssh_props", | ||
| 223 | "access_tags", | ||
| 224 | "access_target_attributes", | ||
| 225 | "access_target_criteria_base", | ||
| 226 | "access_target_criteria_infra_app", | ||
| 227 | "access_target_criteria_self_hosted_app", | ||
| 228 | "access_timestamp", | ||
| 229 | "access_title", | ||
| 230 | "access_type", | ||
| 231 | "access_updated_at", | ||
| 232 | "access_use_clientless_isolation_app_launcher_url", | ||
| 233 | "access_user_risk_score_rule", | ||
| 234 | "access_usernames", | ||
| 235 | "access_uuid", | ||
| 236 | "access_vnc_props", | ||
| 237 | "access_warp_props", | ||
| 238 | ], | ||
| 239 | "toolId": "cloudflare_api.accessApplications.accessApplicationsAddAnApplication", | ||
| 240 | "typeScriptDefinitionCount": 183, | ||
| 241 | "typeScriptDefinitions": { | ||
| 242 | "AccessAllowAllHeaders": "boolean", | ||
| 243 | "AccessAllowAllMethods": "boolean", | ||
| 244 | "AccessAllowAllOrigins": "boolean", | ||
| 245 | "AccessAllowCredentials": "boolean", | ||
| 246 | "AccessAllowEmailAlias": "boolean", | ||
| 247 | "AccessAllowIframe": "boolean", | ||
| 248 | "AccessAllowedClipboardRemoteToLocalFormats": "AccessRdpClipboardFormat[]", | ||
| 249 | "AccessAllowedHeaders": "string[]", | ||
| 250 | "AccessAllowedIdps": "string[]", | ||
| 251 | "AccessAllowedMethods": "("GET" | "POST" | "HEAD" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH")[]", | ||
| 252 | "AccessAllowedOrigins": "string[]", | ||
| 253 | "AccessApiResponseCommon": "{ errors: AccessMessages; messages: AccessMessages; success: true; }", | ||
| 254 | "AccessApiResponseSingle": "AccessApiResponseCommon", | ||
| 255 | "AccessAppLauncherLogoUrl": "string", | ||
| 256 | "AccessAppLauncherProps": "(AccessFeatureAppProps & { app_launcher_logo_url?: AccessAppLauncherLogoUrl; bg_color?: AccessBgColor; domain?: { [k: string]: unknown; }; footer_links?: AccessFooterLinks; header_bg_color?: AccessHeaderBgColor; landing_page_design?: AccessLandingPageDesign; name?: string; skip_app_launcher_login_page?: AccessSkipAppLauncherLoginPage; type?: (AccessType & { [k: string]: unknown; }); })", | ||
| 257 | "AccessAppLauncherVisible": "boolean", | ||
| 258 | "AccessAppPolicyLink": "{ id?: AccessSchemasUuid; precedence?: AccessPrecedence; }", | ||
| 259 | "AccessAppPolicyRequest": "({ precedence?: AccessPrecedence; } & AccessPolicyReq)", | ||
| 260 | "AccessAppPolicyResponse": "(AccessPolicyResp & { precedence?: AccessPrecedence; })", | ||
| 261 | "AccessAppReqEmbeddedPolicies": "{ policies?: (AccessAppPolicyLink | ({ [k: string]: unknown; } & AccessSchemasUuid) | ({ } & { id?: AccessSchemasUuid; } & AccessAppPolicyRequest))[]; }", | ||
| 262 | "AccessAppReqEmbeddedScimConfig": "{ scim_config?: AccessScimConfig; }", | ||
| 263 | "AccessAppRequest": "SelfHostedApplication | SaaSApplication | BrowserSSHApplication | BrowserVNCApplication | AppLauncherApplication | DeviceEnrollmentPermissionsApplication | BrowserIsolationPermissionsApplication | GatewayIdentityProxyEndpointApplication | BookmarkApplication | InfrastructureApplication | BrowserRDPApplication | MCPServerApplication | MCPServerPortalApplication", | ||
| 264 | "AccessAppRespEmbeddedPolicies": "{ policies?: AccessAppPolicyResponse[]; }", | ||
| 265 | "AccessAppRespEmbeddedTargetCriteriaInfra": "{ target_criteria?: AccessTargetCriteriaInfraApp[]; }", | ||
| 266 | "AccessAppRespEmbeddedTargetCriteriaSelfHosted": "{ target_criteria?: AccessTargetCriteriaSelfHostedApp[]; }", | ||
| 267 | "AccessAppResponse": "SelfHostedApplication2 | SaaSApplication2 | BrowserSSHApplication1 | BrowserVNCApplication1 | AppLauncherApplication1 | DeviceEnrollmentPermissionsApplication1 | BrowserIsolationPermissionsApplication1 | GatewayIdentityProxyEndpointApplication1 | BookmarkApplication2 | InfrastructureApplication2 | BrowserRDPApplication1 | MCPServerApplication2 | MCPServerPortalApplication2", | ||
| 268 | "AccessApprovalGroup": "{ approvals_needed: number; email_addresses?: string[]; email_list_uuid?: string; }", | ||
| 269 | "AccessApprovalGroups": "AccessApprovalGroup[]", | ||
| 270 | "AccessApprovalRequired": "boolean", | ||
| 271 | "AccessAppsComponentsSchemasName": "string", | ||
| 272 | "AccessAppsComponentsSchemasSingleResponse": "(AccessApiResponseSingle & { result?: AccessAppResponse; })", | ||
| 273 | "AccessBasePolicyReq": "{ decision: AccessDecision; exclude?: AccessSchemasExclude; include: AccessSchemasInclude; name: AccessPolicyComponentsSchemasName; require?: AccessSchemasRequire; }", | ||
| 274 | "AccessBasePolicyResp": "{ created_at?: AccessTimestamp; decision?: AccessDecision; exclude?: AccessSchemasExclude; id?: AccessSchemasUuid; include?: AccessSchemasInclude; name?: AccessPolicyComponentsSchemasName; require?: AccessSchemasRequire; updated_at?: AccessTimestamp; }", | ||
| 275 | "AccessBasicAppResponseProps": "{ aud?: AccessSchemasAud; created_at?: AccessCreatedAt; id?: AccessUuid; updated_at?: AccessUpdatedAt; }", | ||
| 276 | "AccessBgColor": "string", | ||
| 277 | "AccessBisoProps": "(AccessFeatureAppProps & { domain?: { [k: string]: unknown; }; name?: string; type?: (AccessType & { [k: string]: unknown; }); })", | ||
| 278 | "AccessButtonColor": "string", | ||
| 279 | "AccessButtonTextColor": "string", | ||
| 280 | "AccessComponentsSchemasSessionDuration": "string", | ||
| 281 | "AccessCorsHeaders": "{ allow_all_headers?: AccessAllowAllHeaders; allow_all_methods?: AccessAllowAllMethods; allow_all_origins?: AccessAllowAllOrigins; allow_credentials?: AccessAllowCredentials; allowed_headers?: AccessAllowedHeaders; allowed_methods?: AccessAllowedMethods; allowed_origins?: AccessAllowedOrigins; max_age?: AccessMaxAge; }", | ||
| 282 | "AccessCreatedAt": "({ [k: string]: unknown; } & AccessTimestamp)", | ||
| 283 | "AccessCustomDenyMessage": "string", | ||
| 284 | "AccessCustomDenyUrl": "string", | ||
| 285 | "AccessCustomNonIdentityDenyUrl": "string", | ||
| 286 | "AccessDecision": ""allow" | "deny" | "non_identity" | "bypass"", | ||
| 287 | "AccessDestinations": "(PublicDestination | PrivateDestination | ViaMCPServerPortalDestination)[]", | ||
| 288 | "AccessDomain": "string", | ||
| 289 | "AccessEnableBindingCookie": "boolean", | ||
| 290 | "AccessFeatureAppProps": "{ allowed_idps?: AccessAllowedIdps; auto_redirect_to_identity?: AccessSchemasAutoRedirectToIdentity; custom_deny_url?: AccessCustomDenyUrl; custom_non_identity_deny_url?: AccessCustomNonIdentityDenyUrl; custom_pages?: AccessSchemasCustomPages; domain?: AccessDomain; name?: AccessAppsComponentsSchemasName; session_duration?: AccessSchemasSessionDuration; type: AccessType; }", | ||
| 291 | "AccessFooterLinks": "{ name: string; url: string; }[]", | ||
| 292 | "AccessGroups": "{ group: { id: string; }; }", | ||
| 293 | "AccessHeaderBgColor": "string", | ||
| 294 | "AccessHttpOnlyCookieAttribute": "boolean", | ||
| 295 | "AccessIdentifier": "string", | ||
| 296 | "AccessImageUrl": "string", | ||
| 297 | "AccessInfraAppReqEmbeddedPolicies": "{ policies?: AccessInfraPolicyReq[]; }", | ||
| 298 | "AccessInfraAppRespEmbeddedPolicies": "{ policies?: AccessInfraPolicyResp[]; }", | ||
| 299 | "AccessInfraPolicyResp": "(AccessBasePolicyResp & { connection_rules?: ConnectionRules1; })", | ||
| 300 | "AccessIsolationRequired": "boolean", | ||
| 301 | "AccessLandingPageDesign": "{ button_color?: AccessButtonColor; button_text_color?: AccessButtonTextColor; image_url?: AccessImageUrl; message?: AccessMessage; title?: AccessTitle; }", | ||
| 302 | "AccessLogoUrl": "string", | ||
| 303 | "AccessMaxAge": "number", | ||
| 304 | "AccessMessage": "string", | ||
| 305 | "AccessMessages": "{ code: number; documentation_url?: string; message: string; source?: { pointer?: string; }; }[]", | ||
| 306 | "AccessMfaConfig": "{ allowed_authenticators?: ("totp" | "biometrics" | "security_key")[]; mfa_disabled?: boolean; session_duration?: string; }", | ||
| 307 | "AccessOauthConfiguration": "{ dynamic_client_registration?: { allow_any_on_localhost?: boolean; allow_any_on_loopback?: boolean; allowed_uris?: string[]; enabled?: boolean; }; enabled?: boolean; grant?: { access_token_lifetime?: string; session_duration?: string; }; }", | ||
| 308 | "AccessOptionsPreflightBypass": "boolean", | ||
| 309 | "AccessPathCookieAttribute": "boolean", | ||
| 310 | "AccessPolicyComponentsSchemasName": "string", | ||
| 311 | "AccessPolicyReq": "(AccessBasePolicyReq & { approval_groups?: AccessApprovalGroups; approval_required?: AccessApprovalRequired; connection_rules?: ConnectionRules; isolation_required?: AccessIsolationRequired; mfa_config?: AccessMfaConfig; purpose_justification_prompt?: AccessPurposeJustificationPrompt; purpose_justification_required?: AccessPurposeJustificationRequired; session_duration?: AccessComponentsSchemasSessionDuration; })", | ||
| 312 | "AccessPolicyResp": "(AccessBasePolicyResp & { approval_groups?: AccessApprovalGroups; approval_required?: AccessApprovalRequired; connection_rules?: ConnectionRules; isolation_required?: AccessIsolationRequired; mfa_config?: AccessMfaConfig; purpose_justification_prompt?: AccessPurposeJustificationPrompt; purpose_justification_required?: AccessPurposeJustificationRequired; session_duration?: AccessComponentsSchemasSessionDuration; })", | ||
| 313 | "AccessPort": "number", | ||
| 314 | "AccessPrecedence": "number", | ||
| 315 | "AccessProtocolInfraApp": ""SSH" export type AccessInfraPolicyReq = (AccessBasePolicyReq & { connection_rules?: ConnectionRules1; })", | ||
| 316 | "AccessProtocolSelfHostedApp": ""RDP" export type MCPServerApplication = (MCPServerApplication1 & AccessAppReqEmbeddedPolicies)", | ||
| 317 | "AccessProxyEndpointProps": "(AccessFeatureAppProps & { domain?: { [k: string]: unknown; }; name?: string; type?: (AccessType & { [k: string]: unknown; }); })", | ||
| 318 | "AccessPurposeJustificationPrompt": "string", | ||
| 319 | "AccessPurposeJustificationRequired": "boolean", | ||
| 320 | "AccessRdpClipboardFormat": ""text" export type AccessAllowedClipboardLocalToRemoteFormats = AccessRdpClipboardFormat[]", | ||
| 321 | "AccessRdpProps": "(AccessAppRespEmbeddedTargetCriteriaSelfHosted & SelfHostedApplication1 & { type?: (AccessType & { [k: string]: unknown; }); })", | ||
| 322 | "AccessReadServiceTokensFromHeader": "string", | ||
| 323 | "AccessRule": "AccessGroups | AnyValidServiceToken | AuthenticationContext | AuthenticationMethod | AzureGroup | ValidCertificate | CommonName | Country | DevicePosture | EmailDomain | EmailList | Email | Everyone | ExternalEvaluation | GithubOrganization | GoogleWorkspaceGroup | LoginMethod | IPList | IPRanges | OktaGroup | SAMLGroup | OIDCClaim | ServiceToken | LinkedAppToken | UserRiskScore", | ||
| 324 | "AccessSameSiteCookieAttribute": "string", | ||
| 325 | "AccessSchemasAllowAuthenticateViaWarp": "boolean", | ||
| 326 | "AccessSchemasAud": "string", | ||
| 327 | "AccessSchemasAutoRedirectToIdentity": "boolean", | ||
| 328 | "AccessSchemasCustomPages": "string[]", | ||
| 329 | "AccessSchemasExclude": "AccessRule[]", | ||
| 330 | "AccessSchemasInclude": "AccessRule[]", | ||
| 331 | "AccessSchemasRequire": "AccessRule[]", | ||
| 332 | "AccessSchemasSessionDuration": "string", | ||
| 333 | "AccessSchemasUuid": "string", | ||
| 334 | "AccessScimConfig": "{ authentication?: AccessScimConfigSingleAuthentication | AccessScimConfigMultiAuthentication; deactivate_on_delete?: boolean; enabled?: boolean; idp_uid: string; mappings?: AccessScimConfigMapping[]; remote_uri: string; }", | ||
| 335 | "AccessScimConfigMapping": "{ enabled?: boolean; filter?: string; operations?: { create?: boolean; delete?: boolean; update?: boolean; }; schema: string; strictness?: "strict" | "passthrough"; transform_jsonata?: string; }", | ||
| 336 | "AccessScimConfigMultiAuthentication": "AccessScimConfigSingleAuthentication[]", | ||
| 337 | "AccessScimConfigSingleAuthentication": "HTTPBasic | OAuthBearerToken | OAuth2 | AccessServiceToken", | ||
| 338 | "AccessSelfHostedDomains": "string[]", | ||
| 339 | "AccessServiceAuth_401Redirect": "boolean", | ||
| 340 | "AccessServiceToken": "{ client_id: string; client_secret: string; scheme: "access_service_token"; }", | ||
| 341 | "AccessSkipAppLauncherLoginPage": "boolean", | ||
| 342 | "AccessSkipInterstitial": "boolean", | ||
| 343 | "AccessSshProps": "(SelfHostedApplication1 & { type?: (AccessType & { [k: string]: unknown; }); })", | ||
| 344 | "AccessTags": "string[]", | ||
| 345 | "AccessTargetAttributes": "{ [k: string]: string[]; }", | ||
| 346 | "AccessTargetCriteriaInfraApp": "(TargetCriteria & { protocol?: AccessProtocolInfraApp; })", | ||
| 347 | "AccessTargetCriteriaSelfHostedApp": "(TargetCriteria & { protocol?: AccessProtocolSelfHostedApp; })", | ||
| 348 | "AccessTimestamp": "string", | ||
| 349 | "AccessTitle": "string", | ||
| 350 | "AccessType": ""self_hosted" | "saas" | "ssh" | "vnc" | "app_launcher" | "warp" | "biso" | "bookmark" | "dash_sso" | "infrastructure" | "rdp" | "mcp" | "mcp_portal" | "proxy_endpoint"", | ||
| 351 | "AccessUpdatedAt": "({ [k: string]: unknown; } & AccessTimestamp)", | ||
| 352 | "AccessUseClientlessIsolationAppLauncherUrl": "boolean", | ||
| 353 | "AccessUsernames": "string[]", | ||
| 354 | "AccessUuid": "string", | ||
| 355 | "AccessVncProps": "(SelfHostedApplication1 & { type?: (AccessType & { [k: string]: unknown; }); })", | ||
| 356 | "AccessWarpProps": "(AccessFeatureAppProps & { domain?: { [k: string]: unknown; }; name?: string; type?: (AccessType & { [k: string]: unknown; }); })", | ||
| 357 | "AnyValidServiceToken": "{ any_valid_service_token: { }; }", | ||
| 358 | "AppLauncherApplication": "(AccessAppLauncherProps & AccessAppReqEmbeddedPolicies)", | ||
| 359 | "AppLauncherApplication1": "(AccessBasicAppResponseProps & AccessAppLauncherProps & AccessAppRespEmbeddedPolicies)", | ||
| 360 | "AuthenticationContext": "{ auth_context: { ac_id: string; id: string; identity_provider_id: string; }; }", | ||
| 361 | "AuthenticationMethod": "{ auth_method: { auth_method: string; }; }", | ||
| 362 | "AzureGroup": "{ azureAD: { id: string; identity_provider_id: string; }; }", | ||
| 363 | "BookmarkApplication": "(BookmarkApplication1 & AccessAppReqEmbeddedPolicies)", | ||
| 364 | "BookmarkApplication1": "{ app_launcher_visible?: AccessAppLauncherVisible; domain?: string; logo_url?: AccessLogoUrl; name?: AccessAppsComponentsSchemasName; tags?: AccessTags; type?: (AccessType & { [k: string]: unknown; }); }", | ||
| 365 | "BookmarkApplication2": "(AccessBasicAppResponseProps & BookmarkApplication1 & AccessAppRespEmbeddedPolicies)", | ||
| 366 | "BrowserIsolationPermissionsApplication": "(AccessBisoProps & AccessAppReqEmbeddedPolicies)", | ||
| 367 | "BrowserIsolationPermissionsApplication1": "(AccessBasicAppResponseProps & AccessBisoProps & AccessAppRespEmbeddedPolicies)", | ||
| 368 | "BrowserRDPApplication": "(AccessRdpProps & AccessAppReqEmbeddedPolicies)", | ||
| 369 | "BrowserRDPApplication1": "(AccessBasicAppResponseProps & AccessRdpProps & AccessAppRespEmbeddedPolicies)", | ||
| 370 | "BrowserSSHApplication": "(AccessSshProps & AccessAppReqEmbeddedPolicies & AccessAppReqEmbeddedScimConfig)", | ||
| 371 | "BrowserSSHApplication1": "(AccessBasicAppResponseProps & AccessSshProps & AccessAppRespEmbeddedPolicies)", | ||
| 372 | "BrowserVNCApplication": "(AccessVncProps & AccessAppReqEmbeddedPolicies & AccessAppReqEmbeddedScimConfig)", | ||
| 373 | "BrowserVNCApplication1": "(AccessBasicAppResponseProps & AccessVncProps & AccessAppRespEmbeddedPolicies)", | ||
| 374 | "CommonName": "{ common_name: { common_name: string; }; }", | ||
| 375 | "ConnectionRules": "{ rdp?: RDPConnectionRules; }", | ||
| 376 | "ConnectionRules1": "{ ssh?: SSHConnectionRules; }", | ||
| 377 | "Country": "{ geo: { country_code: string; }; }", | ||
| 378 | "DeviceEnrollmentPermissionsApplication": "(AccessWarpProps & AccessAppReqEmbeddedPolicies)", | ||
| 379 | "DeviceEnrollmentPermissionsApplication1": "(AccessBasicAppResponseProps & AccessWarpProps & AccessAppRespEmbeddedPolicies)", | ||
| 380 | "DevicePosture": "{ device_posture: { integration_uid: string; }; }", | ||
| 381 | "Email": "{ email: { email: string; }; }", | ||
| 382 | "EmailDomain": "{ email_domain: { domain: string; }; }", | ||
| 383 | "EmailList": "{ email_list: { id: string; }; }", | ||
| 384 | "Everyone": "{ everyone: { }; }", | ||
| 385 | "ExternalEvaluation": "{ external_evaluation: { evaluate_url: string; keys_url: string; }; }", | ||
| 386 | "GatewayIdentityProxyEndpointApplication": "(AccessProxyEndpointProps & AccessAppReqEmbeddedPolicies)", | ||
| 387 | "GatewayIdentityProxyEndpointApplication1": "(AccessBasicAppResponseProps & AccessProxyEndpointProps & AccessAppRespEmbeddedPolicies)", | ||
| 388 | "GithubOrganization": "{ "github-organization": { identity_provider_id: string; name: string; team?: string; }; }", | ||
| 389 | "GoogleWorkspaceGroup": "{ gsuite: { email: string; identity_provider_id: string; }; }", | ||
| 390 | "HTTPBasic": "{ password: string; scheme: "httpbasic"; user: string; }", | ||
| 391 | "IPList": "{ ip_list: { id: string; }; }", | ||
| 392 | "IPRanges": "{ ip: { ip: string; }; }", | ||
| 393 | "InfrastructureApplication": "(InfrastructureApplication1 & AccessInfraAppReqEmbeddedPolicies)", | ||
| 394 | "InfrastructureApplication1": "({ name?: AccessAppsComponentsSchemasName; type?: (AccessType & { [k: string]: unknown; }); } & AccessAppRespEmbeddedTargetCriteriaInfra)", | ||
| 395 | "InfrastructureApplication2": "(AccessBasicAppResponseProps & InfrastructureApplication1 & AccessInfraAppRespEmbeddedPolicies)", | ||
| 396 | "LinkedAppToken": "{ linked_app_token: { app_uid: string; }; }", | ||
| 397 | "LoginMethod": "{ login_method: { id: string; }; }", | ||
| 398 | "MCPServerApplication1": "{ allow_authenticate_via_warp?: AccessSchemasAllowAuthenticateViaWarp; allowed_idps?: AccessAllowedIdps; auto_redirect_to_identity?: AccessSchemasAutoRedirectToIdentity; custom_deny_message?: AccessCustomDenyMessage; custom_deny_url?: AccessCustomDenyUrl; custom_non_identity_deny_url?: AccessCustomNonIdentityDenyUrl; custom_pages?: AccessSchemasCustomPages; destinations?: AccessDestinations; http_only_cookie_attribute?: AccessHttpOnlyCookieAttribute; logo_url?: AccessLogoUrl; name?: AccessAppsComponentsSchemasName; oauth_configuration?: AccessOauthConfiguration; options_preflight_bypass?: AccessOptionsPreflightBypass; same_site_cookie_attribute?: AccessSameSiteCookieAttribute; scim_config?: AccessScimConfig; session_duration?: AccessSchemasSessionDuration; tags?: AccessTags; type: (AccessType & { [k: string]: unknown; }); }", | ||
| 399 | "MCPServerApplication2": "(AccessBasicAppResponseProps & MCPServerApplication1 & AccessAppRespEmbeddedPolicies)", | ||
| 400 | "MCPServerPortalApplication": "(MCPServerPortalApplication1 & AccessAppReqEmbeddedPolicies)", | ||
| 401 | "MCPServerPortalApplication1": "{ allow_authenticate_via_warp?: AccessSchemasAllowAuthenticateViaWarp; allowed_idps?: AccessAllowedIdps; auto_redirect_to_identity?: AccessSchemasAutoRedirectToIdentity; custom_deny_message?: AccessCustomDenyMessage; custom_deny_url?: AccessCustomDenyUrl; custom_non_identity_deny_url?: AccessCustomNonIdentityDenyUrl; custom_pages?: AccessSchemasCustomPages; destinations?: AccessDestinations; domain?: AccessDomain; http_only_cookie_attribute?: AccessHttpOnlyCookieAttribute; logo_url?: AccessLogoUrl; name?: AccessAppsComponentsSchemasName; oauth_configuration?: AccessOauthConfiguration; options_preflight_bypass?: AccessOptionsPreflightBypass; same_site_cookie_attribute?: AccessSameSiteCookieAttribute; scim_config?: AccessScimConfig; session_duration?: AccessSchemasSessionDuration; tags?: AccessTags; type: (AccessType & { [k: string]: unknown; }); }", | ||
| 402 | "MCPServerPortalApplication2": "(AccessBasicAppResponseProps & MCPServerPortalApplication1 & AccessAppRespEmbeddedPolicies)", | ||
| 403 | "OAuth2": "{ authorization_url: string; client_id: string; client_secret: string; scheme: "oauth2"; scopes?: string[]; token_url: string; }", | ||
| 404 | "OAuthBearerToken": "{ scheme: "oauthbearertoken"; token: string; }", | ||
| 405 | "OIDCClaim": "{ oidc: { claim_name: string; claim_value: string; identity_provider_id: string; }; }", | ||
| 406 | "OIDCSaaSApp": "{ access_token_lifetime?: string; allow_pkce_without_client_secret?: boolean; app_launcher_url?: string; auth_type?: "saml" | "oidc"; client_id?: string; client_secret?: string; created_at?: AccessCreatedAt; custom_claims?: { name?: string; required?: boolean; scope?: "groups" | "profile" | "email" | "openid"; source?: { name?: string; name_by_idp?: { [k: string]: string; }; }; }[]; grant_types?: ("authorization_code" | "authorization_code_with_pkce" | "refresh_tokens" | "hybrid" | "implicit")[]; group_filter_regex?: string; hybrid_and_implicit_options?: { return_access_token_from_authorization_endpoint?: boolean; return_id_token_from_authorization_endpoint?: boolean; }; public_key?: string; redirect_uris?: string[]; refresh_token_options?: { lifetime?: string; }; scopes?: ("openid" | "groups" | "email" | "profile")[]; updated_at?: AccessUpdatedAt; }", | ||
| 407 | "OktaGroup": "{ okta: { identity_provider_id: string; name: string; }; }", | ||
| 408 | "PrivateDestination": "{ cidr?: string; hostname?: string; l4_protocol?: "tcp" | "udp"; port_range?: string; type?: "private"; vnet_id?: string; }", | ||
| 409 | "PublicDestination": "{ type?: "public"; uri?: string; }", | ||
| 410 | "RDPConnectionRules": "{ allowed_clipboard_local_to_remote_formats?: AccessAllowedClipboardLocalToRemoteFormats; allowed_clipboard_remote_to_local_formats?: AccessAllowedClipboardRemoteToLocalFormats; }", | ||
| 411 | "SAMLGroup": "{ saml: { attribute_name: string; attribute_value: string; identity_provider_id: string; }; }", | ||
| 412 | "SAMLSaaSApp": "{ auth_type?: "saml" | "oidc"; consumer_service_url?: string; created_at?: AccessCreatedAt; custom_attributes?: { friendly_name?: string; name?: string; name_format?: "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" | "urn:oasis:names:tc:SAML:2.0:attrname-format:basic" | "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"; required?: boolean; source?: { name?: string; name_by_idp?: { idp_id?: string; source_name?: string; }[]; }; }[]; default_relay_state?: string; idp_entity_id?: string; name_id_format?: "id" | "email"; name_id_transform_jsonata?: string; public_key?: string; saml_attribute_transform_jsonata?: string; sp_entity_id?: string; sso_endpoint?: string; updated_at?: AccessUpdatedAt; }", | ||
| 413 | "SSHConnectionRules": "{ allow_email_alias?: AccessAllowEmailAlias; usernames: AccessUsernames; }", | ||
| 414 | "SaaSApplication": "(SaaSApplication1 & AccessAppReqEmbeddedPolicies & AccessAppReqEmbeddedScimConfig)", | ||
| 415 | "SaaSApplication1": "{ allowed_idps?: AccessAllowedIdps; app_launcher_visible?: AccessAppLauncherVisible; auto_redirect_to_identity?: AccessSchemasAutoRedirectToIdentity; custom_pages?: AccessSchemasCustomPages; logo_url?: AccessLogoUrl; name?: AccessAppsComponentsSchemasName; saas_app?: SAMLSaaSApp | OIDCSaaSApp; scim_config?: AccessScimConfig; tags?: AccessTags; type?: (AccessType & { [k: string]: unknown; }); }", | ||
| 416 | "SaaSApplication2": "(AccessBasicAppResponseProps & SaaSApplication1 & AccessAppRespEmbeddedPolicies)", | ||
| 417 | "SelfHostedApplication": "(SelfHostedApplication1 & AccessAppReqEmbeddedPolicies & AccessAppReqEmbeddedScimConfig)", | ||
| 418 | "SelfHostedApplication1": "{ allow_authenticate_via_warp?: AccessSchemasAllowAuthenticateViaWarp; allow_iframe?: AccessAllowIframe; allowed_idps?: AccessAllowedIdps; app_launcher_visible?: AccessAppLauncherVisible; auto_redirect_to_identity?: AccessSchemasAutoRedirectToIdentity; cors_headers?: AccessCorsHeaders; custom_deny_message?: AccessCustomDenyMessage; custom_deny_url?: AccessCustomDenyUrl; custom_non_identity_deny_url?: AccessCustomNonIdentityDenyUrl; custom_pages?: AccessSchemasCustomPages; destinations?: AccessDestinations; domain: AccessDomain; enable_binding_cookie?: AccessEnableBindingCookie; http_only_cookie_attribute?: AccessHttpOnlyCookieAttribute; logo_url?: AccessLogoUrl; mfa_config?: AccessMfaConfig; name?: AccessAppsComponentsSchemasName; oauth_configuration?: AccessOauthConfiguration; options_preflight_bypass?: AccessOptionsPreflightBypass; path_cookie_attribute?: AccessPathCookieAttribute; read_service_tokens_from_header?: AccessReadServiceTokensFromHeader; same_site_cookie_attribute?: AccessSameSiteCookieAttribute; scim_config?: AccessScimConfig; self_hosted_domains?: AccessSelfHostedDomains; service_auth_401_redirect?: AccessServiceAuth_401Redirect; session_duration?: AccessSchemasSessionDuration; skip_interstitial?: AccessSkipInterstitial; tags?: AccessTags; type: (AccessType & { [k: string]: unknown; }); use_clientless_isolation_app_launcher_url?: AccessUseClientlessIsolationAppLauncherUrl; }", | ||
| 419 | "SelfHostedApplication2": "(AccessBasicAppResponseProps & SelfHostedApplication1 & AccessAppRespEmbeddedPolicies)", | ||
| 420 | "ServiceToken": "{ service_token: { token_id: string; }; }", | ||
| 421 | "TargetCriteria": "{ port: AccessPort; target_attributes: AccessTargetAttributes; }", | ||
| 422 | "UserRiskScore": "{ user_risk_score: { user_risk_score: ["low" | "medium" | "high" | "unscored", ...(("low" | "medium" | "high" | "unscored"))[]]; }; }", | ||
| 423 | "ValidCertificate": "{ certificate: { }; }", | ||
| 424 | "ViaMCPServerPortalDestination": "{ mcp_server_id?: string; type?: "via_mcp_server_portal"; }", | ||
| 425 | }, | ||
| 426 | } | ||
| 427 | `; | ||
| 428 | |||
| 429 | exports[`Real specs: Vercel API > preserves extraction baseline for representative operations 1`] = ` | ||
| 430 | { | ||
| 431 | "inputSchemaOperationCount": 320, | ||
| 432 | "operationCount": 322, | ||
| 433 | "outputSchemaOperationCount": 279, | ||
| 434 | "selectedOperations": [ | ||
| 435 | { | ||
| 436 | "hasInputSchema": true, | ||
| 437 | "hasOutputSchema": true, | ||
| 438 | "method": "post", | ||
| 439 | "operationId": "createDeployment", | ||
| 440 | "pathTemplate": "/v13/deployments", | ||
| 441 | "tags": [ | ||
| 442 | "deployments", | ||
| 443 | ], | ||
| 444 | }, | ||
| 445 | { | ||
| 446 | "hasInputSchema": true, | ||
| 447 | "hasOutputSchema": true, | ||
| 448 | "method": "post", | ||
| 449 | "operationId": "createProject", | ||
| 450 | "pathTemplate": "/v11/projects", | ||
| 451 | "tags": [ | ||
| 452 | "projects", | ||
| 453 | ], | ||
| 454 | }, | ||
| 455 | { | ||
| 456 | "hasInputSchema": true, | ||
| 457 | "hasOutputSchema": true, | ||
| 458 | "method": "patch", | ||
| 459 | "operationId": "updateProject", | ||
| 460 | "pathTemplate": "/v9/projects/{idOrName}", | ||
| 461 | "tags": [ | ||
| 462 | "projects", | ||
| 463 | ], | ||
| 464 | }, | ||
| 465 | ], | ||
| 466 | "title": "Vercel API", | ||
| 467 | "version": "0.0.1", | ||
| 468 | } | ||
| 469 | `; | ||
| 470 | |||
| 471 | exports[`Real specs: Vercel API > preserves registered tool schema and TypeScript output for deployment creation 1`] = ` | ||
| 472 | { | ||
| 473 | "inputSchema": { | ||
| 474 | "additionalProperties": false, | ||
| 475 | "properties": { | ||
| 476 | "body": { | ||
| 477 | "additionalProperties": false, | ||
| 478 | "properties": { | ||
| 479 | "customEnvironmentSlugOrId": { | ||
| 480 | "description": "Deploy to a custom environment, which will override the default environment", | ||
| 481 | "type": "string", | ||
| 482 | }, | ||
| 483 | "deploymentId": { | ||
| 484 | "description": "An deployment id for an existing deployment to redeploy", | ||
| 485 | "example": "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6", | ||
| 486 | "type": "string", | ||
| 487 | }, | ||
| 488 | "files": { | ||
| 489 | "description": "A list of objects with the files to be deployed", | ||
| 490 | "items": { | ||
| 491 | "oneOf": [ | ||
| 492 | { | ||
| 493 | "additionalProperties": false, | ||
| 494 | "description": "Used in the case you want to inline a file inside the request", | ||
| 495 | "properties": { | ||
| 496 | "data": { | ||
| 497 | "description": "The file content, it could be either a \`base64\` (useful for images, etc.) of the files or the plain content for source code", | ||
| 498 | "type": "string", | ||
| 499 | }, | ||
| 500 | "encoding": { | ||
| 501 | "description": "The file content encoding, it could be either a base64 (useful for images, etc.) of the files or the plain text for source code.", | ||
| 502 | "enum": [ | ||
| 503 | "base64", | ||
| 504 | "utf-8", | ||
| 505 | ], | ||
| 506 | }, | ||
| 507 | "file": { | ||
| 508 | "description": "The file name including the whole path", | ||
| 509 | "example": "folder/file.js", | ||
| 510 | "type": "string", | ||
| 511 | }, | ||
| 512 | }, | ||
| 513 | "required": [ | ||
| 514 | "file", | ||
| 515 | "data", | ||
| 516 | ], | ||
| 517 | "title": "InlinedFile", | ||
| 518 | "type": "object", | ||
| 519 | }, | ||
| 520 | { | ||
| 521 | "additionalProperties": false, | ||
| 522 | "description": "Used in the case you want to reference a file that was already uploaded", | ||
| 523 | "properties": { | ||
| 524 | "file": { | ||
| 525 | "description": "The file path relative to the project root", | ||
| 526 | "example": "folder/file.js", | ||
| 527 | "type": "string", | ||
| 528 | }, | ||
| 529 | "sha": { | ||
| 530 | "description": "The file contents hashed with SHA1, used to check the integrity", | ||
| 531 | "type": "string", | ||
| 532 | }, | ||
| 533 | "size": { | ||
| 534 | "description": "The file size in bytes", | ||
| 535 | "type": "integer", | ||
| 536 | }, | ||
| 537 | }, | ||
| 538 | "required": [ | ||
| 539 | "file", | ||
| 540 | ], | ||
| 541 | "title": "UploadedFile", | ||
| 542 | "type": "object", | ||
| 543 | }, | ||
| 544 | ], | ||
| 545 | }, | ||
| 546 | "type": "array", | ||
| 547 | }, | ||
| 548 | "gitMetadata": { | ||
| 549 | "additionalProperties": false, | ||
| 550 | "description": "Populates initial git metadata for different git providers.", | ||
| 551 | "properties": { | ||
| 552 | "ci": { | ||
| 553 | "description": "True if process.env.CI was set when deploying", | ||
| 554 | "example": true, | ||
| 555 | "type": "boolean", | ||
| 556 | }, | ||
| 557 | "ciGitProviderUsername": { | ||
| 558 | "description": "The username used for the Git Provider (e.g. GitHub) if their CI (e.g. GitHub Actions) was used, if available", | ||
| 559 | "example": "rauchg", | ||
| 560 | "type": "string", | ||
| 561 | }, | ||
| 562 | "ciGitRepoVisibility": { | ||
| 563 | "description": "The visibility of the Git repository if their CI (e.g. GitHub Actions) was used, if available", | ||
| 564 | "example": "private", | ||
| 565 | "type": "string", | ||
| 566 | }, | ||
| 567 | "ciType": { | ||
| 568 | "description": "The type of CI system used", | ||
| 569 | "example": "github-actions", | ||
| 570 | "type": "string", | ||
| 571 | }, | ||
| 572 | "commitAuthorEmail": { | ||
| 573 | "description": "The email of the author of the commit", | ||
| 574 | "example": "kyliau@example.com", | ||
| 575 | "type": "string", | ||
| 576 | }, | ||
| 577 | "commitAuthorName": { | ||
| 578 | "description": "The name of the author of the commit", | ||
| 579 | "example": "kyliau", | ||
| 580 | "type": "string", | ||
| 581 | }, | ||
| 582 | "commitMessage": { | ||
| 583 | "description": "The commit message", | ||
| 584 | "example": "add method to measure Interaction to Next Paint (INP) (#36490)", | ||
| 585 | "type": "string", | ||
| 586 | }, | ||
| 587 | "commitRef": { | ||
| 588 | "description": "The branch on which the commit was made", | ||
| 589 | "example": "main", | ||
| 590 | "type": "string", | ||
| 591 | }, | ||
| 592 | "commitSha": { | ||
| 593 | "description": "The hash of the commit", | ||
| 594 | "example": "dc36199b2234c6586ebe05ec94078a895c707e29", | ||
| 595 | "type": "string", | ||
| 596 | }, | ||
| 597 | "dirty": { | ||
| 598 | "description": "Whether or not there have been modifications to the working tree since the latest commit", | ||
| 599 | "example": true, | ||
| 600 | "type": "boolean", | ||
| 601 | }, | ||
| 602 | "remoteUrl": { | ||
| 603 | "description": "The git repository's remote origin url", | ||
| 604 | "example": "https://github.com/vercel/next.js", | ||
| 605 | "type": "string", | ||
| 606 | }, | ||
| 607 | }, | ||
| 608 | "type": "object", | ||
| 609 | }, | ||
| 610 | "gitSource": { | ||
| 611 | "anyOf": [ | ||
| 612 | { | ||
| 613 | "properties": { | ||
| 614 | "sha": { | ||
| 615 | "example": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0", | ||
| 616 | "type": "string", | ||
| 617 | }, | ||
| 618 | "type": { | ||
| 619 | "enum": [ | ||
| 620 | "vercel", | ||
| 621 | ], | ||
| 622 | "type": "string", | ||
| 623 | }, | ||
| 624 | }, | ||
| 625 | "required": [ | ||
| 626 | "type", | ||
| 627 | "sha", | ||
| 628 | ], | ||
| 629 | "type": "object", | ||
| 630 | }, | ||
| 631 | { | ||
| 632 | "properties": { | ||
| 633 | "ref": { | ||
| 634 | "example": "main", | ||
| 635 | "type": "string", | ||
| 636 | }, | ||
| 637 | "repoId": { | ||
| 638 | "example": 123456789, | ||
| 639 | "oneOf": [ | ||
| 640 | { | ||
| 641 | "type": "number", | ||
| 642 | }, | ||
| 643 | { | ||
| 644 | "type": "string", | ||
| 645 | }, | ||
| 646 | ], | ||
| 647 | }, | ||
| 648 | "sha": { | ||
| 649 | "example": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0", | ||
| 650 | "type": "string", | ||
| 651 | }, | ||
| 652 | "type": { | ||
| 653 | "enum": [ | ||
| 654 | "github", | ||
| 655 | ], | ||
| 656 | "type": "string", | ||
| 657 | }, | ||
| 658 | }, | ||
| 659 | "required": [ | ||
| 660 | "type", | ||
| 661 | "ref", | ||
| 662 | "repoId", | ||
| 663 | ], | ||
| 664 | "type": "object", | ||
| 665 | }, | ||
| 666 | { | ||
| 667 | "properties": { | ||
| 668 | "org": { | ||
| 669 | "example": "vercel", | ||
| 670 | "type": "string", | ||
| 671 | }, | ||
| 672 | "ref": { | ||
| 673 | "example": "main", | ||
| 674 | "type": "string", | ||
| 675 | }, | ||
| 676 | "repo": { | ||
| 677 | "example": "next.js", | ||
| 678 | "type": "string", | ||
| 679 | }, | ||
| 680 | "sha": { | ||
| 681 | "example": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0", | ||
| 682 | "type": "string", | ||
| 683 | }, | ||
| 684 | "type": { | ||
| 685 | "enum": [ | ||
| 686 | "github", | ||
| 687 | ], | ||
| 688 | "type": "string", | ||
| 689 | }, | ||
| 690 | }, | ||
| 691 | "required": [ | ||
| 692 | "type", | ||
| 693 | "ref", | ||
| 694 | "org", | ||
| 695 | "repo", | ||
| 696 | ], | ||
| 697 | "type": "object", | ||
| 698 | }, | ||
| 699 | { | ||
| 700 | "properties": { | ||
| 701 | "ref": { | ||
| 702 | "example": "main", | ||
| 703 | "type": "string", | ||
| 704 | }, | ||
| 705 | "repoId": { | ||
| 706 | "example": 123456789, | ||
| 707 | "oneOf": [ | ||
| 708 | { | ||
| 709 | "type": "number", | ||
| 710 | }, | ||
| 711 | { | ||
| 712 | "type": "string", | ||
| 713 | }, | ||
| 714 | ], | ||
| 715 | }, | ||
| 716 | "sha": { | ||
| 717 | "example": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0", | ||
| 718 | "type": "string", | ||
| 719 | }, | ||
| 720 | "type": { | ||
| 721 | "enum": [ | ||
| 722 | "github-limited", | ||
| 723 | ], | ||
| 724 | "type": "string", | ||
| 725 | }, | ||
| 726 | }, | ||
| 727 | "required": [ | ||
| 728 | "type", | ||
| 729 | "ref", | ||
| 730 | "repoId", | ||
| 731 | ], | ||
| 732 | "type": "object", | ||
| 733 | }, | ||
| 734 | { | ||
| 735 | "properties": { | ||
| 736 | "org": { | ||
| 737 | "example": "vercel", | ||
| 738 | "type": "string", | ||
| 739 | }, | ||
| 740 | "ref": { | ||
| 741 | "example": "main", | ||
| 742 | "type": "string", | ||
| 743 | }, | ||
| 744 | "repo": { | ||
| 745 | "example": "next.js", | ||
| 746 | "type": "string", | ||
| 747 | }, | ||
| 748 | "sha": { | ||
| 749 | "example": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0", | ||
| 750 | "type": "string", | ||
| 751 | }, | ||
| 752 | "type": { | ||
| 753 | "enum": [ | ||
| 754 | "github-limited", | ||
| 755 | ], | ||
| 756 | "type": "string", | ||
| 757 | }, | ||
| 758 | }, | ||
| 759 | "required": [ | ||
| 760 | "type", | ||
| 761 | "ref", | ||
| 762 | "org", | ||
| 763 | "repo", | ||
| 764 | ], | ||
| 765 | "type": "object", | ||
| 766 | }, | ||
| 767 | { | ||
| 768 | "properties": { | ||
| 769 | "projectId": { | ||
| 770 | "example": 987654321, | ||
| 771 | "oneOf": [ | ||
| 772 | { | ||
| 773 | "type": "number", | ||
| 774 | }, | ||
| 775 | { | ||
| 776 | "type": "string", | ||
| 777 | }, | ||
| 778 | ], | ||
| 779 | }, | ||
| 780 | "ref": { | ||
| 781 | "example": "main", | ||
| 782 | "type": "string", | ||
| 783 | }, | ||
| 784 | "sha": { | ||
| 785 | "example": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0", | ||
| 786 | "type": "string", | ||
| 787 | }, | ||
| 788 | "type": { | ||
| 789 | "enum": [ | ||
| 790 | "gitlab", | ||
| 791 | ], | ||
| 792 | "type": "string", | ||
| 793 | }, | ||
| 794 | }, | ||
| 795 | "required": [ | ||
| 796 | "type", | ||
| 797 | "ref", | ||
| 798 | "projectId", | ||
| 799 | ], | ||
| 800 | "type": "object", | ||
| 801 | }, | ||
| 802 | { | ||
| 803 | "properties": { | ||
| 804 | "ref": { | ||
| 805 | "example": "main", | ||
| 806 | "type": "string", | ||
| 807 | }, | ||
| 808 | "repoUuid": { | ||
| 809 | "example": "123e4567-e89b-12d3-a456-426614174000", | ||
| 810 | "type": "string", | ||
| 811 | }, | ||
| 812 | "sha": { | ||
| 813 | "example": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0", | ||
| 814 | "type": "string", | ||
| 815 | }, | ||
| 816 | "type": { | ||
| 817 | "enum": [ | ||
| 818 | "bitbucket", | ||
| 819 | ], | ||
| 820 | "type": "string", | ||
| 821 | }, | ||
| 822 | "workspaceUuid": { | ||
| 823 | "example": "987e6543-e21b-12d3-a456-426614174000", | ||
| 824 | "type": "string", | ||
| 825 | }, | ||
| 826 | }, | ||
| 827 | "required": [ | ||
| 828 | "type", | ||
| 829 | "ref", | ||
| 830 | "repoUuid", | ||
| 831 | ], | ||
| 832 | "type": "object", | ||
| 833 | }, | ||
| 834 | { | ||
| 835 | "properties": { | ||
| 836 | "owner": { | ||
| 837 | "example": "bitbucket_user", | ||
| 838 | "type": "string", | ||
| 839 | }, | ||
| 840 | "ref": { | ||
| 841 | "example": "main", | ||
| 842 | "type": "string", | ||
| 843 | }, | ||
| 844 | "sha": { | ||
| 845 | "example": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0", | ||
| 846 | "type": "string", | ||
| 847 | }, | ||
| 848 | "slug": { | ||
| 849 | "example": "my-awesome-project", | ||
| 850 | "type": "string", | ||
| 851 | }, | ||
| 852 | "type": { | ||
| 853 | "enum": [ | ||
| 854 | "bitbucket", | ||
| 855 | ], | ||
| 856 | "type": "string", | ||
| 857 | }, | ||
| 858 | }, | ||
| 859 | "required": [ | ||
| 860 | "type", | ||
| 861 | "ref", | ||
| 862 | "owner", | ||
| 863 | "slug", | ||
| 864 | ], | ||
| 865 | "type": "object", | ||
| 866 | }, | ||
| 867 | ], | ||
| 868 | "description": "Defines the Git Repository source to be deployed. This property can not be used in combination with \`files\`.", | ||
| 869 | }, | ||
| 870 | "meta": { | ||
| 871 | "additionalProperties": { | ||
| 872 | "maxLength": 65536, | ||
| 873 | "type": "string", | ||
| 874 | }, | ||
| 875 | "description": "An object containing the deployment's metadata. Multiple key-value pairs can be attached to a deployment", | ||
| 876 | "example": { | ||
| 877 | "foo": "bar", | ||
| 878 | }, | ||
| 879 | "maxProperties": 100, | ||
| 880 | "type": "object", | ||
| 881 | }, | ||
| 882 | "monorepoManager": { | ||
| 883 | "description": "The monorepo manager that is being used for this deployment. When \`null\` is used no monorepo manager is selected", | ||
| 884 | "nullable": true, | ||
| 885 | "type": "string", | ||
| 886 | }, | ||
| 887 | "name": { | ||
| 888 | "description": "A string with the project name used in the deployment URL", | ||
| 889 | "example": "my-instant-deployment", | ||
| 890 | "type": "string", | ||
| 891 | }, | ||
| 892 | "project": { | ||
| 893 | "description": "The target project identifier in which the deployment will be created. When defined, this parameter overrides name", | ||
| 894 | "example": "my-deployment-project", | ||
| 895 | "type": "string", | ||
| 896 | }, | ||
| 897 | "projectSettings": { | ||
| 898 | "additionalProperties": false, | ||
| 899 | "description": "Project settings that will be applied to the deployment. It is required for the first deployment of a project and will be saved for any following deployments", | ||
| 900 | "properties": { | ||
| 901 | "buildCommand": { | ||
| 902 | "description": "The build command for this project. When \`null\` is used this value will be automatically detected", | ||
| 903 | "example": "next build", | ||
| 904 | "maxLength": 256, | ||
| 905 | "nullable": true, | ||
| 906 | "type": "string", | ||
| 907 | }, | ||
| 908 | "commandForIgnoringBuildStep": { | ||
| 909 | "maxLength": 256, | ||
| 910 | "nullable": true, | ||
| 911 | "type": "string", | ||
| 912 | }, | ||
| 913 | "devCommand": { | ||
| 914 | "description": "The dev command for this project. When \`null\` is used this value will be automatically detected", | ||
| 915 | "maxLength": 256, | ||
| 916 | "nullable": true, | ||
| 917 | "type": "string", | ||
| 918 | }, | ||
| 919 | "framework": { | ||
| 920 | "description": "The framework that is being used for this project. When \`null\` is used no framework is selected", | ||
| 921 | "enum": [ | ||
| 922 | null, | ||
| 923 | "blitzjs", | ||
| 924 | "nextjs", | ||
| 925 | "gatsby", | ||
| 926 | "remix", | ||
| 927 | "react-router", | ||
| 928 | "astro", | ||
| 929 | "hexo", | ||
| 930 | "eleventy", | ||
| 931 | "docusaurus-2", | ||
| 932 | "docusaurus", | ||
| 933 | "preact", | ||
| 934 | "solidstart-1", | ||
| 935 | "solidstart", | ||
| 936 | "dojo", | ||
| 937 | "ember", | ||
| 938 | "vue", | ||
| 939 | "scully", | ||
| 940 | "ionic-angular", | ||
| 941 | "angular", | ||
| 942 | "polymer", | ||
| 943 | "svelte", | ||
| 944 | "sveltekit", | ||
| 945 | "sveltekit-1", | ||
| 946 | "ionic-react", | ||
| 947 | "create-react-app", | ||
| 948 | "gridsome", | ||
| 949 | "umijs", | ||
| 950 | "sapper", | ||
| 951 | "saber", | ||
| 952 | "stencil", | ||
| 953 | "nuxtjs", | ||
| 954 | "redwoodjs", | ||
| 955 | "hugo", | ||
| 956 | "jekyll", | ||
| 957 | "brunch", | ||
| 958 | "middleman", | ||
| 959 | "zola", | ||
| 960 | "hydrogen", | ||
| 961 | "vite", | ||
| 962 | "tanstack-start", | ||
| 963 | "vitepress", | ||
| 964 | "vuepress", | ||
| 965 | "parcel", | ||
| 966 | "fastapi", | ||
| 967 | "flask", | ||
| 968 | "fasthtml", | ||
| 969 | "django", | ||
| 970 | "ash", | ||
| 971 | "sanity-v3", | ||
| 972 | "sanity", | ||
| 973 | "storybook", | ||
| 974 | "nitro", | ||
| 975 | "hono", | ||
| 976 | "express", | ||
| 977 | "h3", | ||
| 978 | "koa", | ||
| 979 | "nestjs", | ||
| 980 | "elysia", | ||
| 981 | "fastify", | ||
| 982 | "xmcp", | ||
| 983 | "python", | ||
| 984 | "ruby", | ||
| 985 | "rust", | ||
| 986 | "axum", | ||
| 987 | "actix-web", | ||
| 988 | "node", | ||
| 989 | "go", | ||
| 990 | "services", | ||
| 991 | "mastra", | ||
| 992 | ], | ||
| 993 | "nullable": true, | ||
| 994 | "type": "string", | ||
| 995 | }, | ||
| 996 | "installCommand": { | ||
| 997 | "description": "The install command for this project. When \`null\` is used this value will be automatically detected", | ||
| 998 | "example": "pnpm install", | ||
| 999 | "maxLength": 256, | ||
| 1000 | "nullable": true, | ||
| 1001 | "type": "string", | ||
| 1002 | }, | ||
| 1003 | "nodeVersion": { | ||
| 1004 | "description": "Override the Node.js version that should be used for this deployment", | ||
| 1005 | "enum": [ | ||
| 1006 | "24.x", | ||
| 1007 | "22.x", | ||
| 1008 | "20.x", | ||
| 1009 | "18.x", | ||
| 1010 | "16.x", | ||
| 1011 | "14.x", | ||
| 1012 | "12.x", | ||
| 1013 | "10.x", | ||
| 1014 | "8.10.x", | ||
| 1015 | ], | ||
| 1016 | "type": "string", | ||
| 1017 | }, | ||
| 1018 | "outputDirectory": { | ||
| 1019 | "description": "The output directory of the project. When \`null\` is used this value will be automatically detected", | ||
| 1020 | "maxLength": 256, | ||
| 1021 | "nullable": true, | ||
| 1022 | "type": "string", | ||
| 1023 | }, | ||
| 1024 | "rootDirectory": { | ||
| 1025 | "description": "The name of a directory or relative path to the source code of your project. When \`null\` is used it will default to the project root", | ||
| 1026 | "maxLength": 256, | ||
| 1027 | "nullable": true, | ||
| 1028 | "type": "string", | ||
| 1029 | }, | ||
| 1030 | "serverlessFunctionRegion": { | ||
| 1031 | "description": "The region to deploy Serverless Functions in this project", | ||
| 1032 | "maxLength": 4, | ||
| 1033 | "nullable": true, | ||
| 1034 | "type": "string", | ||
| 1035 | }, | ||
| 1036 | "skipGitConnectDuringLink": { | ||
| 1037 | "deprecated": true, | ||
| 1038 | "description": "Opts-out of the message prompting a CLI user to connect a Git repository in \`vercel link\`.", | ||
| 1039 | "type": "boolean", | ||
| 1040 | }, | ||
| 1041 | "sourceFilesOutsideRootDirectory": { | ||
| 1042 | "description": "Indicates if there are source files outside of the root directory, typically used for monorepos", | ||
| 1043 | "type": "boolean", | ||
| 1044 | }, | ||
| 1045 | }, | ||
| 1046 | "type": "object", | ||
| 1047 | }, | ||
| 1048 | "target": { | ||
| 1049 | "description": "Either not defined, \`staging\`, \`production\`, or a custom environment identifier. If \`staging\`, a staging alias in the format \`<project>-<team>.vercel.app\` will be assigned. If \`production\`, any aliases defined in \`alias\` will be assigned. If omitted, the target will be \`preview\`.", | ||
| 1050 | "example": "production", | ||
| 1051 | "type": "string", | ||
| 1052 | }, | ||
| 1053 | "withLatestCommit": { | ||
| 1054 | "description": "When \`true\` and \`deploymentId\` is passed in, the sha from the previous deployment's \`gitSource\` is removed forcing the latest commit to be used.", | ||
| 1055 | "type": "boolean", | ||
| 1056 | }, | ||
| 1057 | }, | ||
| 1058 | "required": [ | ||
| 1059 | "name", | ||
| 1060 | ], | ||
| 1061 | "type": "object", | ||
| 1062 | }, | ||
| 1063 | "forceNew": { | ||
| 1064 | "description": "Forces a new deployment even if there is a previous similar deployment", | ||
| 1065 | "enum": [ | ||
| 1066 | "0", | ||
| 1067 | "1", | ||
| 1068 | ], | ||
| 1069 | }, | ||
| 1070 | "skipAutoDetectionConfirmation": { | ||
| 1071 | "description": "Allows to skip framework detection so the API would not fail to ask for confirmation", | ||
| 1072 | "enum": [ | ||
| 1073 | "0", | ||
| 1074 | "1", | ||
| 1075 | ], | ||
| 1076 | }, | ||
| 1077 | "slug": { | ||
| 1078 | "example": "my-team-url-slug", | ||
| 1079 | "type": "string", | ||
| 1080 | }, | ||
| 1081 | "teamId": { | ||
| 1082 | "example": "team_1a2b3c4d5e6f7g8h9i0j1k2l", | ||
| 1083 | "type": "string", | ||
| 1084 | }, | ||
| 1085 | }, | ||
| 1086 | "required": [ | ||
| 1087 | "body", | ||
| 1088 | ], | ||
| 1089 | "type": "object", | ||
| 1090 | }, | ||
| 1091 | "inputTypeScript": "{ forceNew?: "0" | "1"; skipAutoDetectionConfirmation?: "0" | "1"; teamId?: string; slug?: string; body: { customEnvironmentSlugOrId?: string; deploymentId?: string; files?: (InlinedFile | UploadedFile)[]; gitMetadata?: { remoteUrl?: string; commitAuthorName?: string; commitAuthorEmail?: string; commitMessage?: string; commitRef?: string; commitSha?: string; dirty?: boolean; ci?: boolean; ciType?: string; ciGitProviderUsername?: string; ciGitRepoVisibility?: string; }; gitSource?: { type: "vercel"; sha: string; } | { ref: string; repoId: number | string; sha?: string; type: "github"; } | { org: string; ref: string; repo: string; sha?: string; type: "github"; } | { ref: string; repoId: number | string; sha?: string; type: "github-limited"; } | { org: string; ref: string; repo: string; sha?: string; type: "github-limited"; } | { projectId: number | string; ref: string; sha?: string; type: "gitlab"; } | { ref: string; repoUuid: string; sha?: string; type: "bitbucket"; workspaceUuid?: string; } | { owner: string; ref: string; sha?: string; slug: string; type: "bitbucket"; }; meta?: { [k: string]: string; }; monorepoManager?: string | null; name: string; project?: string; projectSettings?: { buildCommand?: string | null; commandForIgnoringBuildStep?: string | null; devCommand?: string | null; framework?: null | "blitzjs" | "nextjs" | "gatsby" | "remix" | "react-router" | "astro" | "hexo" | "eleventy" | "docusaurus-2" | "docusaurus" | "preact" | "solidstart-1" | "solidstart" | "dojo" | "ember" | "vue" | "scully" | "ionic-angular" | "angular" | "polymer" | "svelte" | "sveltekit" | "sveltekit-1" | "ionic-react" | "create-react-app" | "gridsome" | "umijs" | "sapper" | "saber" | "stencil" | "nuxtjs" | "redwoodjs" | "hugo" | "jekyll" | "brunch" | "middleman" | "zola" | "hydrogen" | "vite" | "tanstack-start" | "vitepress" | "vuepress" | "parcel" | "fastapi" | "flask" | "fasthtml" | "django" | "ash" | "sanity-v3" | "sanity" | "storybook" | "nitro" | "hono" | "express" | "h3" | "koa" | "nestjs" | "elysia" | "fastify" | "xmcp" | "python" | "ruby" | "rust" | "axum" | "actix-web" | "node" | "go" | "services" | "mastra"; installCommand?: string | null; nodeVersion?: "24.x" | "22.x" | "20.x" | "18.x" | "16.x" | "14.x" | "12.x" | "10.x" | "8.10.x"; outputDirectory?: string | null; rootDirectory?: string | null; serverlessFunctionRegion?: string | null; skipGitConnectDuringLink?: boolean; sourceFilesOutsideRootDirectory?: boolean; }; target?: string; withLatestCommit?: boolean; }; }", | ||
| 1092 | "outputSchema": { | ||
| 1093 | "description": "The successfully created deployment", | ||
| 1094 | "properties": { | ||
| 1095 | "alias": { | ||
| 1096 | "description": "A list of all the aliases (default aliases, staging aliases and production aliases) that were assigned upon deployment creation", | ||
| 1097 | "example": [], | ||
| 1098 | "items": { | ||
| 1099 | "type": "string", | ||
| 1100 | }, | ||
| 1101 | "type": "array", | ||
| 1102 | }, | ||
| 1103 | "aliasAssigned": { | ||
| 1104 | "description": "A boolean that will be true when the aliases from the alias property were assigned successfully", | ||
| 1105 | "enum": [ | ||
| 1106 | false, | ||
| 1107 | true, | ||
| 1108 | ], | ||
| 1109 | "example": true, | ||
| 1110 | "type": "boolean", | ||
| 1111 | }, | ||
| 1112 | "aliasAssignedAt": { | ||
| 1113 | "nullable": true, | ||
| 1114 | "oneOf": [ | ||
| 1115 | { | ||
| 1116 | "type": "number", | ||
| 1117 | }, | ||
| 1118 | { | ||
| 1119 | "enum": [ | ||
| 1120 | false, | ||
| 1121 | true, | ||
| 1122 | ], | ||
| 1123 | "type": "boolean", | ||
| 1124 | }, | ||
| 1125 | ], | ||
| 1126 | }, | ||
| 1127 | "aliasError": { | ||
| 1128 | "description": "An object that will contain a \`code\` and a \`message\` when the aliasing fails, otherwise the value will be \`null\`", | ||
| 1129 | "example": null, | ||
| 1130 | "nullable": true, | ||
| 1131 | "properties": { | ||
| 1132 | "code": { | ||
| 1133 | "type": "string", | ||
| 1134 | }, | ||
| 1135 | "message": { | ||
| 1136 | "type": "string", | ||
| 1137 | }, | ||
| 1138 | }, | ||
| 1139 | "required": [ | ||
| 1140 | "code", | ||
| 1141 | "message", | ||
| 1142 | ], | ||
| 1143 | "type": "object", | ||
| 1144 | }, | ||
| 1145 | "aliasFinal": { | ||
| 1146 | "nullable": true, | ||
| 1147 | "type": "string", | ||
| 1148 | }, | ||
| 1149 | "aliasWarning": { | ||
| 1150 | "nullable": true, | ||
| 1151 | "properties": { | ||
| 1152 | "action": { | ||
| 1153 | "type": "string", | ||
| 1154 | }, | ||
| 1155 | "code": { | ||
| 1156 | "type": "string", | ||
| 1157 | }, | ||
| 1158 | "link": { | ||
| 1159 | "type": "string", | ||
| 1160 | }, | ||
| 1161 | "message": { | ||
| 1162 | "type": "string", | ||
| 1163 | }, | ||
| 1164 | }, | ||
| 1165 | "required": [ | ||
| 1166 | "code", | ||
| 1167 | "message", | ||
| 1168 | ], | ||
| 1169 | "type": "object", | ||
| 1170 | }, | ||
| 1171 | "alwaysRefuseToBuild": { | ||
| 1172 | "enum": [ | ||
| 1173 | false, | ||
| 1174 | true, | ||
| 1175 | ], | ||
| 1176 | "type": "boolean", | ||
| 1177 | }, | ||
| 1178 | "attribution": { | ||
| 1179 | "description": "Attribution metadata for the deployment, linking commit author to git and Vercel users. Only populated when the \`enable-deployment-attribution\` flag is enabled.", | ||
| 1180 | "properties": { | ||
| 1181 | "commitMeta": { | ||
| 1182 | "description": "Commit metadata from the git commit author", | ||
| 1183 | "properties": { | ||
| 1184 | "email": { | ||
| 1185 | "description": "Email from git commit author", | ||
| 1186 | "type": "string", | ||
| 1187 | }, | ||
| 1188 | "isVerified": { | ||
| 1189 | "description": "Whether the commit was signed/verified (GitHub only, others return undefined)", | ||
| 1190 | "enum": [ | ||
| 1191 | false, | ||
| 1192 | true, | ||
| 1193 | ], | ||
| 1194 | "type": "boolean", | ||
| 1195 | }, | ||
| 1196 | "name": { | ||
| 1197 | "description": "Name from git commit author", | ||
| 1198 | "type": "string", | ||
| 1199 | }, | ||
| 1200 | }, | ||
| 1201 | "type": "object", | ||
| 1202 | }, | ||
| 1203 | "gitUser": { | ||
| 1204 | "description": "Git provider user associated with the commit author email (only set if resolved)", | ||
| 1205 | "properties": { | ||
| 1206 | "id": { | ||
| 1207 | "oneOf": [ | ||
| 1208 | { | ||
| 1209 | "type": "string", | ||
| 1210 | }, | ||
| 1211 | { | ||
| 1212 | "type": "number", | ||
| 1213 | }, | ||
| 1214 | ], | ||
| 1215 | }, | ||
| 1216 | "login": { | ||
| 1217 | "description": "Git provider username/login", | ||
| 1218 | "type": "string", | ||
| 1219 | }, | ||
| 1220 | "provider": { | ||
| 1221 | "description": "The git provider (github, gitlab, bitbucket)", | ||
| 1222 | "type": "string", | ||
| 1223 | }, | ||
| 1224 | "type": { | ||
| 1225 | "description": "User type", | ||
| 1226 | "type": "string", | ||
| 1227 | }, | ||
| 1228 | }, | ||
| 1229 | "required": [ | ||
| 1230 | "id", | ||
| 1231 | "login", | ||
| 1232 | ], | ||
| 1233 | "type": "object", | ||
| 1234 | }, | ||
| 1235 | "vercelUser": { | ||
| 1236 | "description": "Vercel user linked to the git provider account (only set if resolved)", | ||
| 1237 | "properties": { | ||
| 1238 | "id": { | ||
| 1239 | "description": "Vercel user ID", | ||
| 1240 | "type": "string", | ||
| 1241 | }, | ||
| 1242 | "teamRoles": { | ||
| 1243 | "description": "Team roles at time of deployment", | ||
| 1244 | "items": { | ||
| 1245 | "type": "string", | ||
| 1246 | }, | ||
| 1247 | "type": "array", | ||
| 1248 | }, | ||
| 1249 | "username": { | ||
| 1250 | "description": "Vercel username", | ||
| 1251 | "type": "string", | ||
| 1252 | }, | ||
| 1253 | }, | ||
| 1254 | "required": [ | ||
| 1255 | "id", | ||
| 1256 | "username", | ||
| 1257 | ], | ||
| 1258 | "type": "object", | ||
| 1259 | }, | ||
| 1260 | }, | ||
| 1261 | "type": "object", | ||
| 1262 | }, | ||
| 1263 | "autoAssignCustomDomains": { | ||
| 1264 | "description": "applies to custom domains only, defaults to \`true\`", | ||
| 1265 | "enum": [ | ||
| 1266 | false, | ||
| 1267 | true, | ||
| 1268 | ], | ||
| 1269 | "type": "boolean", | ||
| 1270 | }, | ||
| 1271 | "automaticAliases": { | ||
| 1272 | "items": { | ||
| 1273 | "type": "string", | ||
| 1274 | }, | ||
| 1275 | "type": "array", | ||
| 1276 | }, | ||
| 1277 | "bootedAt": { | ||
| 1278 | "type": "number", | ||
| 1279 | }, | ||
| 1280 | "build": { | ||
| 1281 | "properties": { | ||
| 1282 | "env": { | ||
| 1283 | "items": { | ||
| 1284 | "type": "string", | ||
| 1285 | }, | ||
| 1286 | "type": "array", | ||
| 1287 | }, | ||
| 1288 | }, | ||
| 1289 | "required": [ | ||
| 1290 | "env", | ||
| 1291 | ], | ||
| 1292 | "type": "object", | ||
| 1293 | }, | ||
| 1294 | "buildArtifactUrls": { | ||
| 1295 | "items": { | ||
| 1296 | "type": "string", | ||
| 1297 | }, | ||
| 1298 | "type": "array", | ||
| 1299 | }, | ||
| 1300 | "buildContainerFinishedAt": { | ||
| 1301 | "description": "Since April 2025 it necessary for On-Demand Concurrency Minutes calculation", | ||
| 1302 | "type": "number", | ||
| 1303 | }, | ||
| 1304 | "buildErrorAt": { | ||
| 1305 | "type": "number", | ||
| 1306 | }, | ||
| 1307 | "buildSkipped": { | ||
| 1308 | "enum": [ | ||
| 1309 | false, | ||
| 1310 | true, | ||
| 1311 | ], | ||
| 1312 | "type": "boolean", | ||
| 1313 | }, | ||
| 1314 | "buildingAt": { | ||
| 1315 | "type": "number", | ||
| 1316 | }, | ||
| 1317 | "builds": { | ||
| 1318 | "items": { | ||
| 1319 | "properties": { | ||
| 1320 | "config": { | ||
| 1321 | "additionalProperties": true, | ||
| 1322 | "type": "object", | ||
| 1323 | }, | ||
| 1324 | "src": { | ||
| 1325 | "type": "string", | ||
| 1326 | }, | ||
| 1327 | "use": { | ||
| 1328 | "type": "string", | ||
| 1329 | }, | ||
| 1330 | }, | ||
| 1331 | "required": [ | ||
| 1332 | "use", | ||
| 1333 | ], | ||
| 1334 | "type": "object", | ||
| 1335 | }, | ||
| 1336 | "type": "array", | ||
| 1337 | }, | ||
| 1338 | "canceledAt": { | ||
| 1339 | "type": "number", | ||
| 1340 | }, | ||
| 1341 | "checks": { | ||
| 1342 | "properties": { | ||
| 1343 | "deployment-alias": { | ||
| 1344 | "description": "Condensed check data. Retrieve individual check and check run data using api-checks v2 routes.", | ||
| 1345 | "properties": { | ||
| 1346 | "completedAt": { | ||
| 1347 | "type": "number", | ||
| 1348 | }, | ||
| 1349 | "startedAt": { | ||
| 1350 | "type": "number", | ||
| 1351 | }, | ||
| 1352 | "state": { | ||
| 1353 | "enum": [ | ||
| 1354 | "succeeded", | ||
| 1355 | "failed", | ||
| 1356 | "pending", | ||
| 1357 | ], | ||
| 1358 | "type": "string", | ||
| 1359 | }, | ||
| 1360 | }, | ||
| 1361 | "required": [ | ||
| 1362 | "startedAt", | ||
| 1363 | "state", | ||
| 1364 | ], | ||
| 1365 | "type": "object", | ||
| 1366 | }, | ||
| 1367 | }, | ||
| 1368 | "required": [ | ||
| 1369 | "deployment-alias", | ||
| 1370 | ], | ||
| 1371 | "type": "object", | ||
| 1372 | }, | ||
| 1373 | "checksConclusion": { | ||
| 1374 | "enum": [ | ||
| 1375 | "succeeded", | ||
| 1376 | "failed", | ||
| 1377 | "skipped", | ||
| 1378 | "canceled", | ||
| 1379 | ], | ||
| 1380 | "type": "string", | ||
| 1381 | }, | ||
| 1382 | "checksState": { | ||
| 1383 | "enum": [ | ||
| 1384 | "registered", | ||
| 1385 | "running", | ||
| 1386 | "completed", | ||
| 1387 | ], | ||
| 1388 | "type": "string", | ||
| 1389 | }, | ||
| 1390 | "config": { | ||
| 1391 | "description": "Since February 2025 the configuration must include snapshot data at the time of deployment creation to capture properties for the /deployments/:id/config endpoint utilized for displaying Deployment Configuration on the frontend This is optional because older deployments may not have this data captured", | ||
| 1392 | "properties": { | ||
| 1393 | "functionMemoryType": { | ||
| 1394 | "enum": [ | ||
| 1395 | "standard", | ||
| 1396 | "standard_legacy", | ||
| 1397 | "performance", | ||
| 1398 | ], | ||
| 1399 | "type": "string", | ||
| 1400 | }, | ||
| 1401 | "functionTimeout": { | ||
| 1402 | "nullable": true, | ||
| 1403 | "type": "number", | ||
| 1404 | }, | ||
| 1405 | "functionType": { | ||
| 1406 | "enum": [ | ||
| 1407 | "standard", | ||
| 1408 | "fluid", | ||
| 1409 | ], | ||
| 1410 | "type": "string", | ||
| 1411 | }, | ||
| 1412 | "isUsingActiveCPU": { | ||
| 1413 | "enum": [ | ||
| 1414 | false, | ||
| 1415 | true, | ||
| 1416 | ], | ||
| 1417 | "type": "boolean", | ||
| 1418 | }, | ||
| 1419 | "resourceConfig": { | ||
| 1420 | "description": "Build resource configuration snapshot for this deployment.", | ||
| 1421 | "properties": { | ||
| 1422 | "buildMachine": { | ||
| 1423 | "properties": { | ||
| 1424 | "purchaseType": { | ||
| 1425 | "description": "Machine type that was used for the build.", | ||
| 1426 | "enum": [ | ||
| 1427 | "enhanced", | ||
| 1428 | "turbo", | ||
| 1429 | "standard", | ||
| 1430 | null, | ||
| 1431 | ], | ||
| 1432 | "nullable": true, | ||
| 1433 | "type": "string", | ||
| 1434 | }, | ||
| 1435 | }, | ||
| 1436 | "type": "object", | ||
| 1437 | }, | ||
| 1438 | "buildQueue": { | ||
| 1439 | "description": "Build resource configuration snapshot for this deployment.", | ||
| 1440 | "properties": { | ||
| 1441 | "configuration": { | ||
| 1442 | "description": "Build resource configuration snapshot for this deployment.", | ||
| 1443 | "enum": [ | ||
| 1444 | "SKIP_NAMESPACE_QUEUE", | ||
| 1445 | "WAIT_FOR_NAMESPACE_QUEUE", | ||
| 1446 | ], | ||
| 1447 | "type": "string", | ||
| 1448 | }, | ||
| 1449 | }, | ||
| 1450 | "type": "object", | ||
| 1451 | }, | ||
| 1452 | "elasticConcurrency": { | ||
| 1453 | "description": "When elastic concurrency is used for this deployment, a value is set. The value tells the reason where the setting was coming from. - TEAM_SETTING: Inherited from team settings - PROJECT_SETTING: Inherited from project settings - SKIP_QUEUE: Manually triggered by user to skip the queues", | ||
| 1454 | "enum": [ | ||
| 1455 | "TEAM_SETTING", | ||
| 1456 | "PROJECT_SETTING", | ||
| 1457 | "SKIP_QUEUE", | ||
| 1458 | ], | ||
| 1459 | "type": "string", | ||
| 1460 | }, | ||
| 1461 | }, | ||
| 1462 | "type": "object", | ||
| 1463 | }, | ||
| 1464 | "secureComputeFallbackRegion": { | ||
| 1465 | "nullable": true, | ||
| 1466 | "type": "string", | ||
| 1467 | }, | ||
| 1468 | "secureComputePrimaryRegion": { | ||
| 1469 | "nullable": true, | ||
| 1470 | "type": "string", | ||
| 1471 | }, | ||
| 1472 | "version": { | ||
| 1473 | "type": "number", | ||
| 1474 | }, | ||
| 1475 | }, | ||
| 1476 | "required": [ | ||
| 1477 | "functionMemoryType", | ||
| 1478 | "functionTimeout", | ||
| 1479 | "functionType", | ||
| 1480 | "secureComputeFallbackRegion", | ||
| 1481 | "secureComputePrimaryRegion", | ||
| 1482 | ], | ||
| 1483 | "type": "object", | ||
| 1484 | }, | ||
| 1485 | "connectBuildsEnabled": { | ||
| 1486 | "enum": [ | ||
| 1487 | false, | ||
| 1488 | true, | ||
| 1489 | ], | ||
| 1490 | "type": "boolean", | ||
| 1491 | }, | ||
| 1492 | "connectConfigurationId": { | ||
| 1493 | "type": "string", | ||
| 1494 | }, | ||
| 1495 | "createdAt": { | ||
| 1496 | "description": "A number containing the date when the deployment was created in milliseconds", | ||
| 1497 | "example": 1540257589405, | ||
| 1498 | "type": "number", | ||
| 1499 | }, | ||
| 1500 | "createdIn": { | ||
| 1501 | "type": "string", | ||
| 1502 | }, | ||
| 1503 | "creator": { | ||
| 1504 | "description": "Information about the deployment creator", | ||
| 1505 | "properties": { | ||
| 1506 | "avatar": { | ||
| 1507 | "description": "The avatar of the user that created the deployment", | ||
| 1508 | "type": "string", | ||
| 1509 | }, | ||
| 1510 | "uid": { | ||
| 1511 | "description": "The ID of the user that created the deployment", | ||
| 1512 | "example": "96SnxkFiMyVKsK3pnoHfx3Hz", | ||
| 1513 | "type": "string", | ||
| 1514 | }, | ||
| 1515 | "username": { | ||
| 1516 | "description": "The username of the user that created the deployment", | ||
| 1517 | "example": "john-doe", | ||
| 1518 | "type": "string", | ||
| 1519 | }, | ||
| 1520 | }, | ||
| 1521 | "required": [ | ||
| 1522 | "uid", | ||
| 1523 | ], | ||
| 1524 | "type": "object", | ||
| 1525 | }, | ||
| 1526 | "crons": { | ||
| 1527 | "items": { | ||
| 1528 | "properties": { | ||
| 1529 | "path": { | ||
| 1530 | "type": "string", | ||
| 1531 | }, | ||
| 1532 | "schedule": { | ||
| 1533 | "type": "string", | ||
| 1534 | }, | ||
| 1535 | }, | ||
| 1536 | "required": [ | ||
| 1537 | "path", | ||
| 1538 | "schedule", | ||
| 1539 | ], | ||
| 1540 | "type": "object", | ||
| 1541 | }, | ||
| 1542 | "type": "array", | ||
| 1543 | }, | ||
| 1544 | "customEnvironment": { | ||
| 1545 | "oneOf": [ | ||
| 1546 | { | ||
| 1547 | "description": "If the deployment was created using a Custom Environment, then this property contains information regarding the environment used.", | ||
| 1548 | "properties": { | ||
| 1549 | "branchMatcher": { | ||
| 1550 | "description": "Configuration for matching git branches to this environment", | ||
| 1551 | "properties": { | ||
| 1552 | "pattern": { | ||
| 1553 | "description": "The pattern to match against branch names", | ||
| 1554 | "type": "string", | ||
| 1555 | }, | ||
| 1556 | "type": { | ||
| 1557 | "description": "The type of matching to perform", | ||
| 1558 | "enum": [ | ||
| 1559 | "endsWith", | ||
| 1560 | "startsWith", | ||
| 1561 | "equals", | ||
| 1562 | ], | ||
| 1563 | "type": "string", | ||
| 1564 | }, | ||
| 1565 | }, | ||
| 1566 | "required": [ | ||
| 1567 | "pattern", | ||
| 1568 | "type", | ||
| 1569 | ], | ||
| 1570 | "type": "object", | ||
| 1571 | }, | ||
| 1572 | "createdAt": { | ||
| 1573 | "description": "Timestamp when the environment was created", | ||
| 1574 | "type": "number", | ||
| 1575 | }, | ||
| 1576 | "currentDeploymentAliases": { | ||
| 1577 | "description": "List of aliases for the current deployment", | ||
| 1578 | "items": { | ||
| 1579 | "type": "string", | ||
| 1580 | }, | ||
| 1581 | "type": "array", | ||
| 1582 | }, | ||
| 1583 | "description": { | ||
| 1584 | "description": "Optional description of the environment's purpose", | ||
| 1585 | "type": "string", | ||
| 1586 | }, | ||
| 1587 | "domains": { | ||
| 1588 | "description": "List of domains associated with this environment", | ||
| 1589 | "items": { | ||
| 1590 | "description": "List of domains associated with this environment", | ||
| 1591 | "properties": { | ||
| 1592 | "apexName": { | ||
| 1593 | "type": "string", | ||
| 1594 | }, | ||
| 1595 | "createdAt": { | ||
| 1596 | "type": "number", | ||
| 1597 | }, | ||
| 1598 | "customEnvironmentId": { | ||
| 1599 | "nullable": true, | ||
| 1600 | "type": "string", | ||
| 1601 | }, | ||
| 1602 | "gitBranch": { | ||
| 1603 | "nullable": true, | ||
| 1604 | "type": "string", | ||
| 1605 | }, | ||
| 1606 | "name": { | ||
| 1607 | "type": "string", | ||
| 1608 | }, | ||
| 1609 | "projectId": { | ||
| 1610 | "type": "string", | ||
| 1611 | }, | ||
| 1612 | "redirect": { | ||
| 1613 | "nullable": true, | ||
| 1614 | "type": "string", | ||
| 1615 | }, | ||
| 1616 | "redirectStatusCode": { | ||
| 1617 | "enum": [ | ||
| 1618 | 307, | ||
| 1619 | 301, | ||
| 1620 | 302, | ||
| 1621 | 308, | ||
| 1622 | null, | ||
| 1623 | ], | ||
| 1624 | "nullable": true, | ||
| 1625 | "type": "number", | ||
| 1626 | }, | ||
| 1627 | "updatedAt": { | ||
| 1628 | "type": "number", | ||
| 1629 | }, | ||
| 1630 | "verification": { | ||
| 1631 | "description": "A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete \`POST /projects/:idOrName/domains/:domain/verify\` to verify the domain. Possible challenges: - If \`verification.type = TXT\` the \`verification.domain\` will be checked for a TXT record matching \`verification.value\`.", | ||
| 1632 | "items": { | ||
| 1633 | "description": "A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete \`POST /projects/:idOrName/domains/:domain/verify\` to verify the domain. Possible challenges: - If \`verification.type = TXT\` the \`verification.domain\` will be checked for a TXT record matching \`verification.value\`.", | ||
| 1634 | "properties": { | ||
| 1635 | "domain": { | ||
| 1636 | "type": "string", | ||
| 1637 | }, | ||
| 1638 | "reason": { | ||
| 1639 | "type": "string", | ||
| 1640 | }, | ||
| 1641 | "type": { | ||
| 1642 | "type": "string", | ||
| 1643 | }, | ||
| 1644 | "value": { | ||
| 1645 | "type": "string", | ||
| 1646 | }, | ||
| 1647 | }, | ||
| 1648 | "required": [ | ||
| 1649 | "domain", | ||
| 1650 | "reason", | ||
| 1651 | "type", | ||
| 1652 | "value", | ||
| 1653 | ], | ||
| 1654 | "type": "object", | ||
| 1655 | }, | ||
| 1656 | "type": "array", | ||
| 1657 | }, | ||
| 1658 | "verified": { | ||
| 1659 | "description": "\`true\` if the domain is verified for use with the project. If \`false\` it will not be used as an alias on this project until the challenge in \`verification\` is completed.", | ||
| 1660 | "enum": [ | ||
| 1661 | false, | ||
| 1662 | true, | ||
| 1663 | ], | ||
| 1664 | "type": "boolean", | ||
| 1665 | }, | ||
| 1666 | }, | ||
| 1667 | "required": [ | ||
| 1668 | "apexName", | ||
| 1669 | "name", | ||
| 1670 | "projectId", | ||
| 1671 | "verified", | ||
| 1672 | ], | ||
| 1673 | "type": "object", | ||
| 1674 | }, | ||
| 1675 | "type": "array", | ||
| 1676 | }, | ||
| 1677 | "id": { | ||
| 1678 | "description": "Unique identifier for the custom environment (format: env_*)", | ||
| 1679 | "type": "string", | ||
| 1680 | }, | ||
| 1681 | "slug": { | ||
| 1682 | "description": "URL-friendly name of the environment", | ||
| 1683 | "type": "string", | ||
| 1684 | }, | ||
| 1685 | "type": { | ||
| 1686 | "description": "The type of environment (production, preview, or development)", | ||
| 1687 | "enum": [ | ||
| 1688 | "production", | ||
| 1689 | "preview", | ||
| 1690 | "development", | ||
| 1691 | ], | ||
| 1692 | "type": "string", | ||
| 1693 | }, | ||
| 1694 | "updatedAt": { | ||
| 1695 | "description": "Timestamp when the environment was last updated", | ||
| 1696 | "type": "number", | ||
| 1697 | }, | ||
| 1698 | }, | ||
| 1699 | "required": [ | ||
| 1700 | "createdAt", | ||
| 1701 | "id", | ||
| 1702 | "slug", | ||
| 1703 | "type", | ||
| 1704 | "updatedAt", | ||
| 1705 | ], | ||
| 1706 | "type": "object", | ||
| 1707 | }, | ||
| 1708 | { | ||
| 1709 | "description": "If the deployment was created using a Custom Environment, then this property contains information regarding the environment used.", | ||
| 1710 | "properties": { | ||
| 1711 | "id": { | ||
| 1712 | "type": "string", | ||
| 1713 | }, | ||
| 1714 | }, | ||
| 1715 | "required": [ | ||
| 1716 | "id", | ||
| 1717 | ], | ||
| 1718 | "type": "object", | ||
| 1719 | }, | ||
| 1720 | ], | ||
| 1721 | }, | ||
| 1722 | "defaultRoute": { | ||
| 1723 | "description": "Computed field that is only available for deployments with a microfrontend configuration.", | ||
| 1724 | "type": "string", | ||
| 1725 | }, | ||
| 1726 | "deletedAt": { | ||
| 1727 | "description": "A number containing the date when the deployment was deleted at milliseconds", | ||
| 1728 | "example": 1540257589405, | ||
| 1729 | "nullable": true, | ||
| 1730 | "type": "number", | ||
| 1731 | }, | ||
| 1732 | "env": { | ||
| 1733 | "items": { | ||
| 1734 | "type": "string", | ||
| 1735 | }, | ||
| 1736 | "type": "array", | ||
| 1737 | }, | ||
| 1738 | "errorCode": { | ||
| 1739 | "type": "string", | ||
| 1740 | }, | ||
| 1741 | "errorLink": { | ||
| 1742 | "type": "string", | ||
| 1743 | }, | ||
| 1744 | "errorMessage": { | ||
| 1745 | "nullable": true, | ||
| 1746 | "type": "string", | ||
| 1747 | }, | ||
| 1748 | "errorStep": { | ||
| 1749 | "type": "string", | ||
| 1750 | }, | ||
| 1751 | "flags": { | ||
| 1752 | "oneOf": [ | ||
| 1753 | { | ||
| 1754 | "description": "Flags defined in the Build Output API, used by this deployment. Primarily used by the Toolbar to know about the used flags.", | ||
| 1755 | "properties": { | ||
| 1756 | "definitions": { | ||
| 1757 | "additionalProperties": { | ||
| 1758 | "properties": { | ||
| 1759 | "description": { | ||
| 1760 | "type": "string", | ||
| 1761 | }, | ||
| 1762 | "options": { | ||
| 1763 | "items": { | ||
| 1764 | "properties": { | ||
| 1765 | "label": { | ||
| 1766 | "type": "string", | ||
| 1767 | }, | ||
| 1768 | "value": { | ||
| 1769 | "$ref": "#/$defs/FlagJSONValue", | ||
| 1770 | }, | ||
| 1771 | }, | ||
| 1772 | "required": [ | ||
| 1773 | "value", | ||
| 1774 | ], | ||
| 1775 | "type": "object", | ||
| 1776 | }, | ||
| 1777 | "type": "array", | ||
| 1778 | }, | ||
| 1779 | "url": { | ||
| 1780 | "type": "string", | ||
| 1781 | }, | ||
| 1782 | }, | ||
| 1783 | "type": "object", | ||
| 1784 | }, | ||
| 1785 | "type": "object", | ||
| 1786 | }, | ||
| 1787 | }, | ||
| 1788 | "required": [ | ||
| 1789 | "definitions", | ||
| 1790 | ], | ||
| 1791 | "type": "object", | ||
| 1792 | }, | ||
| 1793 | { | ||
| 1794 | "description": "Flags defined in the Build Output API, used by this deployment. Primarily used by the Toolbar to know about the used flags.", | ||
| 1795 | "items": { | ||
| 1796 | "description": "Flags defined in the Build Output API, used by this deployment. Primarily used by the Toolbar to know about the used flags.", | ||
| 1797 | "type": "object", | ||
| 1798 | }, | ||
| 1799 | "type": "array", | ||
| 1800 | }, | ||
| 1801 | ], | ||
| 1802 | }, | ||
| 1803 | "functions": { | ||
| 1804 | "additionalProperties": { | ||
| 1805 | "properties": { | ||
| 1806 | "architecture": { | ||
| 1807 | "enum": [ | ||
| 1808 | "x86_64", | ||
| 1809 | "arm64", | ||
| 1810 | ], | ||
| 1811 | "type": "string", | ||
| 1812 | }, | ||
| 1813 | "excludeFiles": { | ||
| 1814 | "type": "string", | ||
| 1815 | }, | ||
| 1816 | "experimentalTriggers": { | ||
| 1817 | "items": { | ||
| 1818 | "oneOf": [ | ||
| 1819 | { | ||
| 1820 | "description": "Queue trigger input event for v1beta (from vercel.json config). Requires explicit consumer name.", | ||
| 1821 | "properties": { | ||
| 1822 | "consumer": { | ||
| 1823 | "description": "Name of the consumer group for this trigger (REQUIRED)", | ||
| 1824 | "type": "string", | ||
| 1825 | }, | ||
| 1826 | "initialDelaySeconds": { | ||
| 1827 | "description": "Initial delay in seconds before first execution attempt (OPTIONAL) Must be 0 or greater. Use 0 for no initial delay. Behavior when not specified depends on the server's default configuration.", | ||
| 1828 | "type": "number", | ||
| 1829 | }, | ||
| 1830 | "maxConcurrency": { | ||
| 1831 | "description": "Maximum number of concurrent executions for this consumer (OPTIONAL) Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.", | ||
| 1832 | "type": "number", | ||
| 1833 | }, | ||
| 1834 | "maxDeliveries": { | ||
| 1835 | "description": "Maximum number of delivery attempts for message processing (OPTIONAL) This represents the total number of times a message can be delivered, not the number of retries. Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.", | ||
| 1836 | "type": "number", | ||
| 1837 | }, | ||
| 1838 | "retryAfterSeconds": { | ||
| 1839 | "description": "Delay in seconds before retrying failed executions (OPTIONAL) Behavior when not specified depends on the server's default configuration.", | ||
| 1840 | "type": "number", | ||
| 1841 | }, | ||
| 1842 | "topic": { | ||
| 1843 | "description": "Name of the queue topic to consume from (REQUIRED)", | ||
| 1844 | "type": "string", | ||
| 1845 | }, | ||
| 1846 | "type": { | ||
| 1847 | "description": "Event type - must be "queue/v1beta" (REQUIRED)", | ||
| 1848 | "enum": [ | ||
| 1849 | "queue/v1beta", | ||
| 1850 | ], | ||
| 1851 | "type": "string", | ||
| 1852 | }, | ||
| 1853 | }, | ||
| 1854 | "required": [ | ||
| 1855 | "consumer", | ||
| 1856 | "topic", | ||
| 1857 | "type", | ||
| 1858 | ], | ||
| 1859 | "type": "object", | ||
| 1860 | }, | ||
| 1861 | { | ||
| 1862 | "description": "Queue trigger input event for v2beta (from vercel.json config). Consumer name is implicitly derived from the function path. Only one trigger per function is allowed.", | ||
| 1863 | "properties": { | ||
| 1864 | "initialDelaySeconds": { | ||
| 1865 | "description": "Initial delay in seconds before first execution attempt (OPTIONAL) Must be 0 or greater. Use 0 for no initial delay. Behavior when not specified depends on the server's default configuration.", | ||
| 1866 | "type": "number", | ||
| 1867 | }, | ||
| 1868 | "maxConcurrency": { | ||
| 1869 | "description": "Maximum number of concurrent executions for this consumer (OPTIONAL) Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.", | ||
| 1870 | "type": "number", | ||
| 1871 | }, | ||
| 1872 | "maxDeliveries": { | ||
| 1873 | "description": "Maximum number of delivery attempts for message processing (OPTIONAL) This represents the total number of times a message can be delivered, not the number of retries. Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.", | ||
| 1874 | "type": "number", | ||
| 1875 | }, | ||
| 1876 | "retryAfterSeconds": { | ||
| 1877 | "description": "Delay in seconds before retrying failed executions (OPTIONAL) Behavior when not specified depends on the server's default configuration.", | ||
| 1878 | "type": "number", | ||
| 1879 | }, | ||
| 1880 | "topic": { | ||
| 1881 | "description": "Name of the queue topic to consume from (REQUIRED)", | ||
| 1882 | "type": "string", | ||
| 1883 | }, | ||
| 1884 | "type": { | ||
| 1885 | "description": "Event type - must be "queue/v2beta" (REQUIRED)", | ||
| 1886 | "enum": [ | ||
| 1887 | "queue/v2beta", | ||
| 1888 | ], | ||
| 1889 | "type": "string", | ||
| 1890 | }, | ||
| 1891 | }, | ||
| 1892 | "required": [ | ||
| 1893 | "topic", | ||
| 1894 | "type", | ||
| 1895 | ], | ||
| 1896 | "type": "object", | ||
| 1897 | }, | ||
| 1898 | ], | ||
| 1899 | }, | ||
| 1900 | "type": "array", | ||
| 1901 | }, | ||
| 1902 | "functionFailoverRegions": { | ||
| 1903 | "items": { | ||
| 1904 | "type": "string", | ||
| 1905 | }, | ||
| 1906 | "type": "array", | ||
| 1907 | }, | ||
| 1908 | "includeFiles": { | ||
| 1909 | "type": "string", | ||
| 1910 | }, | ||
| 1911 | "maxDuration": { | ||
| 1912 | "oneOf": [ | ||
| 1913 | { | ||
| 1914 | "type": "number", | ||
| 1915 | }, | ||
| 1916 | { | ||
| 1917 | "enum": [ | ||
| 1918 | "max", | ||
| 1919 | ], | ||
| 1920 | "type": "string", | ||
| 1921 | }, | ||
| 1922 | ], | ||
| 1923 | }, | ||
| 1924 | "memory": { | ||
| 1925 | "type": "number", | ||
| 1926 | }, | ||
| 1927 | "regions": { | ||
| 1928 | "items": { | ||
| 1929 | "type": "string", | ||
| 1930 | }, | ||
| 1931 | "type": "array", | ||
| 1932 | }, | ||
| 1933 | "runtime": { | ||
| 1934 | "type": "string", | ||
| 1935 | }, | ||
| 1936 | "supportsCancellation": { | ||
| 1937 | "enum": [ | ||
| 1938 | false, | ||
| 1939 | true, | ||
| 1940 | ], | ||
| 1941 | "type": "boolean", | ||
| 1942 | }, | ||
| 1943 | }, | ||
| 1944 | "type": "object", | ||
| 1945 | }, | ||
| 1946 | "nullable": true, | ||
| 1947 | "type": "object", | ||
| 1948 | }, | ||
| 1949 | "gitRepo": { | ||
| 1950 | "nullable": true, | ||
| 1951 | "oneOf": [ | ||
| 1952 | { | ||
| 1953 | "properties": { | ||
| 1954 | "defaultBranch": { | ||
| 1955 | "type": "string", | ||
| 1956 | }, | ||
| 1957 | "name": { | ||
| 1958 | "type": "string", | ||
| 1959 | }, | ||
| 1960 | "namespace": { | ||
| 1961 | "type": "string", | ||
| 1962 | }, | ||
| 1963 | "ownerType": { | ||
| 1964 | "enum": [ | ||
| 1965 | "team", | ||
| 1966 | "user", | ||
| 1967 | ], | ||
| 1968 | "type": "string", | ||
| 1969 | }, | ||
| 1970 | "path": { | ||
| 1971 | "type": "string", | ||
| 1972 | }, | ||
| 1973 | "private": { | ||
| 1974 | "enum": [ | ||
| 1975 | false, | ||
| 1976 | true, | ||
| 1977 | ], | ||
| 1978 | "type": "boolean", | ||
| 1979 | }, | ||
| 1980 | "projectId": { | ||
| 1981 | "type": "number", | ||
| 1982 | }, | ||
| 1983 | "type": { | ||
| 1984 | "enum": [ | ||
| 1985 | "gitlab", | ||
| 1986 | ], | ||
| 1987 | "type": "string", | ||
| 1988 | }, | ||
| 1989 | "url": { | ||
| 1990 | "type": "string", | ||
| 1991 | }, | ||
| 1992 | }, | ||
| 1993 | "required": [ | ||
| 1994 | "defaultBranch", | ||
| 1995 | "name", | ||
| 1996 | "namespace", | ||
| 1997 | "ownerType", | ||
| 1998 | "path", | ||
| 1999 | "private", | ||
| 2000 | "projectId", | ||
| 2001 | "type", | ||
| 2002 | "url", | ||
| 2003 | ], | ||
| 2004 | "type": "object", | ||
| 2005 | }, | ||
| 2006 | { | ||
| 2007 | "properties": { | ||
| 2008 | "defaultBranch": { | ||
| 2009 | "type": "string", | ||
| 2010 | }, | ||
| 2011 | "name": { | ||
| 2012 | "type": "string", | ||
| 2013 | }, | ||
| 2014 | "org": { | ||
| 2015 | "type": "string", | ||
| 2016 | }, | ||
| 2017 | "ownerType": { | ||
| 2018 | "enum": [ | ||
| 2019 | "team", | ||
| 2020 | "user", | ||
| 2021 | ], | ||
| 2022 | "type": "string", | ||
| 2023 | }, | ||
| 2024 | "path": { | ||
| 2025 | "type": "string", | ||
| 2026 | }, | ||
| 2027 | "private": { | ||
| 2028 | "enum": [ | ||
| 2029 | false, | ||
| 2030 | true, | ||
| 2031 | ], | ||
| 2032 | "type": "boolean", | ||
| 2033 | }, | ||
| 2034 | "repo": { | ||
| 2035 | "type": "string", | ||
| 2036 | }, | ||
| 2037 | "repoId": { | ||
| 2038 | "type": "number", | ||
| 2039 | }, | ||
| 2040 | "repoOwnerId": { | ||
| 2041 | "type": "number", | ||
| 2042 | }, | ||
| 2043 | "type": { | ||
| 2044 | "enum": [ | ||
| 2045 | "github", | ||
| 2046 | ], | ||
| 2047 | "type": "string", | ||
| 2048 | }, | ||
| 2049 | }, | ||
| 2050 | "required": [ | ||
| 2051 | "defaultBranch", | ||
| 2052 | "name", | ||
| 2053 | "org", | ||
| 2054 | "ownerType", | ||
| 2055 | "path", | ||
| 2056 | "private", | ||
| 2057 | "repo", | ||
| 2058 | "repoId", | ||
| 2059 | "repoOwnerId", | ||
| 2060 | "type", | ||
| 2061 | ], | ||
| 2062 | "type": "object", | ||
| 2063 | }, | ||
| 2064 | { | ||
| 2065 | "properties": { | ||
| 2066 | "defaultBranch": { | ||
| 2067 | "type": "string", | ||
| 2068 | }, | ||
| 2069 | "name": { | ||
| 2070 | "type": "string", | ||
| 2071 | }, | ||
| 2072 | "owner": { | ||
| 2073 | "type": "string", | ||
| 2074 | }, | ||
| 2075 | "ownerType": { | ||
| 2076 | "enum": [ | ||
| 2077 | "team", | ||
| 2078 | "user", | ||
| 2079 | ], | ||
| 2080 | "type": "string", | ||
| 2081 | }, | ||
| 2082 | "path": { | ||
| 2083 | "type": "string", | ||
| 2084 | }, | ||
| 2085 | "private": { | ||
| 2086 | "enum": [ | ||
| 2087 | false, | ||
| 2088 | true, | ||
| 2089 | ], | ||
| 2090 | "type": "boolean", | ||
| 2091 | }, | ||
| 2092 | "repoUuid": { | ||
| 2093 | "type": "string", | ||
| 2094 | }, | ||
| 2095 | "slug": { | ||
| 2096 | "type": "string", | ||
| 2097 | }, | ||
| 2098 | "type": { | ||
| 2099 | "enum": [ | ||
| 2100 | "bitbucket", | ||
| 2101 | ], | ||
| 2102 | "type": "string", | ||
| 2103 | }, | ||
| 2104 | "workspaceUuid": { | ||
| 2105 | "type": "string", | ||
| 2106 | }, | ||
| 2107 | }, | ||
| 2108 | "required": [ | ||
| 2109 | "defaultBranch", | ||
| 2110 | "name", | ||
| 2111 | "owner", | ||
| 2112 | "ownerType", | ||
| 2113 | "path", | ||
| 2114 | "private", | ||
| 2115 | "repoUuid", | ||
| 2116 | "slug", | ||
| 2117 | "type", | ||
| 2118 | "workspaceUuid", | ||
| 2119 | ], | ||
| 2120 | "type": "object", | ||
| 2121 | }, | ||
| 2122 | { | ||
| 2123 | "properties": { | ||
| 2124 | "defaultBranch": { | ||
| 2125 | "type": "string", | ||
| 2126 | }, | ||
| 2127 | "name": { | ||
| 2128 | "type": "string", | ||
| 2129 | }, | ||
| 2130 | "org": { | ||
| 2131 | "type": "string", | ||
| 2132 | }, | ||
| 2133 | "ownerType": { | ||
| 2134 | "enum": [ | ||
| 2135 | "team", | ||
| 2136 | "user", | ||
| 2137 | ], | ||
| 2138 | "type": "string", | ||
| 2139 | }, | ||
| 2140 | "path": { | ||
| 2141 | "type": "string", | ||
| 2142 | }, | ||
| 2143 | "private": { | ||
| 2144 | "enum": [ | ||
| 2145 | false, | ||
| 2146 | true, | ||
| 2147 | ], | ||
| 2148 | "type": "boolean", | ||
| 2149 | }, | ||
| 2150 | "repo": { | ||
| 2151 | "type": "string", | ||
| 2152 | }, | ||
| 2153 | "type": { | ||
| 2154 | "enum": [ | ||
| 2155 | "vercel", | ||
| 2156 | ], | ||
| 2157 | "type": "string", | ||
| 2158 | }, | ||
| 2159 | }, | ||
| 2160 | "required": [ | ||
| 2161 | "defaultBranch", | ||
| 2162 | "name", | ||
| 2163 | "org", | ||
| 2164 | "ownerType", | ||
| 2165 | "path", | ||
| 2166 | "private", | ||
| 2167 | "repo", | ||
| 2168 | "type", | ||
| 2169 | ], | ||
| 2170 | "type": "object", | ||
| 2171 | }, | ||
| 2172 | ], | ||
| 2173 | }, | ||
| 2174 | "gitSource": { | ||
| 2175 | "oneOf": [ | ||
| 2176 | { | ||
| 2177 | "properties": { | ||
| 2178 | "prId": { | ||
| 2179 | "nullable": true, | ||
| 2180 | "type": "number", | ||
| 2181 | }, | ||
| 2182 | "ref": { | ||
| 2183 | "nullable": true, | ||
| 2184 | "type": "string", | ||
| 2185 | }, | ||
| 2186 | "repoId": { | ||
| 2187 | "oneOf": [ | ||
| 2188 | { | ||
| 2189 | "type": "string", | ||
| 2190 | }, | ||
| 2191 | { | ||
| 2192 | "type": "number", | ||
| 2193 | }, | ||
| 2194 | ], | ||
| 2195 | }, | ||
| 2196 | "sha": { | ||
| 2197 | "type": "string", | ||
| 2198 | }, | ||
| 2199 | "type": { | ||
| 2200 | "enum": [ | ||
| 2201 | "github", | ||
| 2202 | ], | ||
| 2203 | "type": "string", | ||
| 2204 | }, | ||
| 2205 | }, | ||
| 2206 | "required": [ | ||
| 2207 | "repoId", | ||
| 2208 | "type", | ||
| 2209 | ], | ||
| 2210 | "type": "object", | ||
| 2211 | }, | ||
| 2212 | { | ||
| 2213 | "properties": { | ||
| 2214 | "org": { | ||
| 2215 | "type": "string", | ||
| 2216 | }, | ||
| 2217 | "prId": { | ||
| 2218 | "nullable": true, | ||
| 2219 | "type": "number", | ||
| 2220 | }, | ||
| 2221 | "ref": { | ||
| 2222 | "nullable": true, | ||
| 2223 | "type": "string", | ||
| 2224 | }, | ||
| 2225 | "repo": { | ||
| 2226 | "type": "string", | ||
| 2227 | }, | ||
| 2228 | "sha": { | ||
| 2229 | "type": "string", | ||
| 2230 | }, | ||
| 2231 | "type": { | ||
| 2232 | "enum": [ | ||
| 2233 | "github", | ||
| 2234 | ], | ||
| 2235 | "type": "string", | ||
| 2236 | }, | ||
| 2237 | }, | ||
| 2238 | "required": [ | ||
| 2239 | "org", | ||
| 2240 | "repo", | ||
| 2241 | "type", | ||
| 2242 | ], | ||
| 2243 | "type": "object", | ||
| 2244 | }, | ||
| 2245 | { | ||
| 2246 | "properties": { | ||
| 2247 | "host": { | ||
| 2248 | "type": "string", | ||
| 2249 | }, | ||
| 2250 | "prId": { | ||
| 2251 | "nullable": true, | ||
| 2252 | "type": "number", | ||
| 2253 | }, | ||
| 2254 | "ref": { | ||
| 2255 | "nullable": true, | ||
| 2256 | "type": "string", | ||
| 2257 | }, | ||
| 2258 | "repoId": { | ||
| 2259 | "oneOf": [ | ||
| 2260 | { | ||
| 2261 | "type": "string", | ||
| 2262 | }, | ||
| 2263 | { | ||
| 2264 | "type": "number", | ||
| 2265 | }, | ||
| 2266 | ], | ||
| 2267 | }, | ||
| 2268 | "sha": { | ||
| 2269 | "type": "string", | ||
| 2270 | }, | ||
| 2271 | "type": { | ||
| 2272 | "enum": [ | ||
| 2273 | "github-custom-host", | ||
| 2274 | ], | ||
| 2275 | "type": "string", | ||
| 2276 | }, | ||
| 2277 | }, | ||
| 2278 | "required": [ | ||
| 2279 | "host", | ||
| 2280 | "repoId", | ||
| 2281 | "type", | ||
| 2282 | ], | ||
| 2283 | "type": "object", | ||
| 2284 | }, | ||
| 2285 | { | ||
| 2286 | "properties": { | ||
| 2287 | "host": { | ||
| 2288 | "type": "string", | ||
| 2289 | }, | ||
| 2290 | "org": { | ||
| 2291 | "type": "string", | ||
| 2292 | }, | ||
| 2293 | "prId": { | ||
| 2294 | "nullable": true, | ||
| 2295 | "type": "number", | ||
| 2296 | }, | ||
| 2297 | "ref": { | ||
| 2298 | "nullable": true, | ||
| 2299 | "type": "string", | ||
| 2300 | }, | ||
| 2301 | "repo": { | ||
| 2302 | "type": "string", | ||
| 2303 | }, | ||
| 2304 | "sha": { | ||
| 2305 | "type": "string", | ||
| 2306 | }, | ||
| 2307 | "type": { | ||
| 2308 | "enum": [ | ||
| 2309 | "github-custom-host", | ||
| 2310 | ], | ||
| 2311 | "type": "string", | ||
| 2312 | }, | ||
| 2313 | }, | ||
| 2314 | "required": [ | ||
| 2315 | "host", | ||
| 2316 | "org", | ||
| 2317 | "repo", | ||
| 2318 | "type", | ||
| 2319 | ], | ||
| 2320 | "type": "object", | ||
| 2321 | }, | ||
| 2322 | { | ||
| 2323 | "properties": { | ||
| 2324 | "prId": { | ||
| 2325 | "nullable": true, | ||
| 2326 | "type": "number", | ||
| 2327 | }, | ||
| 2328 | "ref": { | ||
| 2329 | "nullable": true, | ||
| 2330 | "type": "string", | ||
| 2331 | }, | ||
| 2332 | "repoId": { | ||
| 2333 | "oneOf": [ | ||
| 2334 | { | ||
| 2335 | "type": "string", | ||
| 2336 | }, | ||
| 2337 | { | ||
| 2338 | "type": "number", | ||
| 2339 | }, | ||
| 2340 | ], | ||
| 2341 | }, | ||
| 2342 | "sha": { | ||
| 2343 | "type": "string", | ||
| 2344 | }, | ||
| 2345 | "type": { | ||
| 2346 | "enum": [ | ||
| 2347 | "github-limited", | ||
| 2348 | ], | ||
| 2349 | "type": "string", | ||
| 2350 | }, | ||
| 2351 | }, | ||
| 2352 | "required": [ | ||
| 2353 | "repoId", | ||
| 2354 | "type", | ||
| 2355 | ], | ||
| 2356 | "type": "object", | ||
| 2357 | }, | ||
| 2358 | { | ||
| 2359 | "properties": { | ||
| 2360 | "org": { | ||
| 2361 | "type": "string", | ||
| 2362 | }, | ||
| 2363 | "prId": { | ||
| 2364 | "nullable": true, | ||
| 2365 | "type": "number", | ||
| 2366 | }, | ||
| 2367 | "ref": { | ||
| 2368 | "nullable": true, | ||
| 2369 | "type": "string", | ||
| 2370 | }, | ||
| 2371 | "repo": { | ||
| 2372 | "type": "string", | ||
| 2373 | }, | ||
| 2374 | "sha": { | ||
| 2375 | "type": "string", | ||
| 2376 | }, | ||
| 2377 | "type": { | ||
| 2378 | "enum": [ | ||
| 2379 | "github-limited", | ||
| 2380 | ], | ||
| 2381 | "type": "string", | ||
| 2382 | }, | ||
| 2383 | }, | ||
| 2384 | "required": [ | ||
| 2385 | "org", | ||
| 2386 | "repo", | ||
| 2387 | "type", | ||
| 2388 | ], | ||
| 2389 | "type": "object", | ||
| 2390 | }, | ||
| 2391 | { | ||
| 2392 | "properties": { | ||
| 2393 | "prId": { | ||
| 2394 | "nullable": true, | ||
| 2395 | "type": "number", | ||
| 2396 | }, | ||
| 2397 | "projectId": { | ||
| 2398 | "oneOf": [ | ||
| 2399 | { | ||
| 2400 | "type": "string", | ||
| 2401 | }, | ||
| 2402 | { | ||
| 2403 | "type": "number", | ||
| 2404 | }, | ||
| 2405 | ], | ||
| 2406 | }, | ||
| 2407 | "ref": { | ||
| 2408 | "nullable": true, | ||
| 2409 | "type": "string", | ||
| 2410 | }, | ||
| 2411 | "sha": { | ||
| 2412 | "type": "string", | ||
| 2413 | }, | ||
| 2414 | "type": { | ||
| 2415 | "enum": [ | ||
| 2416 | "gitlab", | ||
| 2417 | ], | ||
| 2418 | "type": "string", | ||
| 2419 | }, | ||
| 2420 | }, | ||
| 2421 | "required": [ | ||
| 2422 | "projectId", | ||
| 2423 | "type", | ||
| 2424 | ], | ||
| 2425 | "type": "object", | ||
| 2426 | }, | ||
| 2427 | { | ||
| 2428 | "properties": { | ||
| 2429 | "prId": { | ||
| 2430 | "nullable": true, | ||
| 2431 | "type": "number", | ||
| 2432 | }, | ||
| 2433 | "ref": { | ||
| 2434 | "nullable": true, | ||
| 2435 | "type": "string", | ||
| 2436 | }, | ||
| 2437 | "repoUuid": { | ||
| 2438 | "type": "string", | ||
| 2439 | }, | ||
| 2440 | "sha": { | ||
| 2441 | "type": "string", | ||
| 2442 | }, | ||
| 2443 | "type": { | ||
| 2444 | "enum": [ | ||
| 2445 | "bitbucket", | ||
| 2446 | ], | ||
| 2447 | "type": "string", | ||
| 2448 | }, | ||
| 2449 | "workspaceUuid": { | ||
| 2450 | "type": "string", | ||
| 2451 | }, | ||
| 2452 | }, | ||
| 2453 | "required": [ | ||
| 2454 | "repoUuid", | ||
| 2455 | "type", | ||
| 2456 | ], | ||
| 2457 | "type": "object", | ||
| 2458 | }, | ||
| 2459 | { | ||
| 2460 | "properties": { | ||
| 2461 | "owner": { | ||
| 2462 | "type": "string", | ||
| 2463 | }, | ||
| 2464 | "prId": { | ||
| 2465 | "nullable": true, | ||
| 2466 | "type": "number", | ||
| 2467 | }, | ||
| 2468 | "ref": { | ||
| 2469 | "nullable": true, | ||
| 2470 | "type": "string", | ||
| 2471 | }, | ||
| 2472 | "sha": { | ||
| 2473 | "type": "string", | ||
| 2474 | }, | ||
| 2475 | "slug": { | ||
| 2476 | "type": "string", | ||
| 2477 | }, | ||
| 2478 | "type": { | ||
| 2479 | "enum": [ | ||
| 2480 | "bitbucket", | ||
| 2481 | ], | ||
| 2482 | "type": "string", | ||
| 2483 | }, | ||
| 2484 | }, | ||
| 2485 | "required": [ | ||
| 2486 | "owner", | ||
| 2487 | "slug", | ||
| 2488 | "type", | ||
| 2489 | ], | ||
| 2490 | "type": "object", | ||
| 2491 | }, | ||
| 2492 | { | ||
| 2493 | "properties": { | ||
| 2494 | "org": { | ||
| 2495 | "type": "string", | ||
| 2496 | }, | ||
| 2497 | "prId": { | ||
| 2498 | "nullable": true, | ||
| 2499 | "type": "number", | ||
| 2500 | }, | ||
| 2501 | "ref": { | ||
| 2502 | "nullable": true, | ||
| 2503 | "type": "string", | ||
| 2504 | }, | ||
| 2505 | "repo": { | ||
| 2506 | "type": "string", | ||
| 2507 | }, | ||
| 2508 | "repoPushedAt": { | ||
| 2509 | "type": "number", | ||
| 2510 | }, | ||
| 2511 | "sha": { | ||
| 2512 | "type": "string", | ||
| 2513 | }, | ||
| 2514 | "type": { | ||
| 2515 | "enum": [ | ||
| 2516 | "vercel", | ||
| 2517 | ], | ||
| 2518 | "type": "string", | ||
| 2519 | }, | ||
| 2520 | }, | ||
| 2521 | "required": [ | ||
| 2522 | "sha", | ||
| 2523 | "type", | ||
| 2524 | ], | ||
| 2525 | "type": "object", | ||
| 2526 | }, | ||
| 2527 | { | ||
| 2528 | "description": "Allows custom git sources (local folder mounted to the container) in test mode", | ||
| 2529 | "properties": { | ||
| 2530 | "gitUrl": { | ||
| 2531 | "type": "string", | ||
| 2532 | }, | ||
| 2533 | "ref": { | ||
| 2534 | "type": "string", | ||
| 2535 | }, | ||
| 2536 | "sha": { | ||
| 2537 | "type": "string", | ||
| 2538 | }, | ||
| 2539 | "type": { | ||
| 2540 | "enum": [ | ||
| 2541 | "custom", | ||
| 2542 | ], | ||
| 2543 | "type": "string", | ||
| 2544 | }, | ||
| 2545 | }, | ||
| 2546 | "required": [ | ||
| 2547 | "gitUrl", | ||
| 2548 | "ref", | ||
| 2549 | "sha", | ||
| 2550 | "type", | ||
| 2551 | ], | ||
| 2552 | "type": "object", | ||
| 2553 | }, | ||
| 2554 | { | ||
| 2555 | "properties": { | ||
| 2556 | "org": { | ||
| 2557 | "type": "string", | ||
| 2558 | }, | ||
| 2559 | "ref": { | ||
| 2560 | "type": "string", | ||
| 2561 | }, | ||
| 2562 | "repo": { | ||
| 2563 | "type": "string", | ||
| 2564 | }, | ||
| 2565 | "repoId": { | ||
| 2566 | "type": "number", | ||
| 2567 | }, | ||
| 2568 | "sha": { | ||
| 2569 | "type": "string", | ||
| 2570 | }, | ||
| 2571 | "type": { | ||
| 2572 | "enum": [ | ||
| 2573 | "github", | ||
| 2574 | ], | ||
| 2575 | "type": "string", | ||
| 2576 | }, | ||
| 2577 | }, | ||
| 2578 | "required": [ | ||
| 2579 | "ref", | ||
| 2580 | "repoId", | ||
| 2581 | "sha", | ||
| 2582 | "type", | ||
| 2583 | ], | ||
| 2584 | "type": "object", | ||
| 2585 | }, | ||
| 2586 | { | ||
| 2587 | "properties": { | ||
| 2588 | "host": { | ||
| 2589 | "type": "string", | ||
| 2590 | }, | ||
| 2591 | "org": { | ||
| 2592 | "type": "string", | ||
| 2593 | }, | ||
| 2594 | "ref": { | ||
| 2595 | "type": "string", | ||
| 2596 | }, | ||
| 2597 | "repo": { | ||
| 2598 | "type": "string", | ||
| 2599 | }, | ||
| 2600 | "repoId": { | ||
| 2601 | "type": "number", | ||
| 2602 | }, | ||
| 2603 | "sha": { | ||
| 2604 | "type": "string", | ||
| 2605 | }, | ||
| 2606 | "type": { | ||
| 2607 | "enum": [ | ||
| 2608 | "github-custom-host", | ||
| 2609 | ], | ||
| 2610 | "type": "string", | ||
| 2611 | }, | ||
| 2612 | }, | ||
| 2613 | "required": [ | ||
| 2614 | "host", | ||
| 2615 | "ref", | ||
| 2616 | "repoId", | ||
| 2617 | "sha", | ||
| 2618 | "type", | ||
| 2619 | ], | ||
| 2620 | "type": "object", | ||
| 2621 | }, | ||
| 2622 | { | ||
| 2623 | "properties": { | ||
| 2624 | "org": { | ||
| 2625 | "type": "string", | ||
| 2626 | }, | ||
| 2627 | "ref": { | ||
| 2628 | "type": "string", | ||
| 2629 | }, | ||
| 2630 | "repo": { | ||
| 2631 | "type": "string", | ||
| 2632 | }, | ||
| 2633 | "repoId": { | ||
| 2634 | "type": "number", | ||
| 2635 | }, | ||
| 2636 | "sha": { | ||
| 2637 | "type": "string", | ||
| 2638 | }, | ||
| 2639 | "type": { | ||
| 2640 | "enum": [ | ||
| 2641 | "github-limited", | ||
| 2642 | ], | ||
| 2643 | "type": "string", | ||
| 2644 | }, | ||
| 2645 | }, | ||
| 2646 | "required": [ | ||
| 2647 | "ref", | ||
| 2648 | "repoId", | ||
| 2649 | "sha", | ||
| 2650 | "type", | ||
| 2651 | ], | ||
| 2652 | "type": "object", | ||
| 2653 | }, | ||
| 2654 | { | ||
| 2655 | "properties": { | ||
| 2656 | "projectId": { | ||
| 2657 | "type": "number", | ||
| 2658 | }, | ||
| 2659 | "ref": { | ||
| 2660 | "type": "string", | ||
| 2661 | }, | ||
| 2662 | "sha": { | ||
| 2663 | "type": "string", | ||
| 2664 | }, | ||
| 2665 | "type": { | ||
| 2666 | "enum": [ | ||
| 2667 | "gitlab", | ||
| 2668 | ], | ||
| 2669 | "type": "string", | ||
| 2670 | }, | ||
| 2671 | }, | ||
| 2672 | "required": [ | ||
| 2673 | "projectId", | ||
| 2674 | "ref", | ||
| 2675 | "sha", | ||
| 2676 | "type", | ||
| 2677 | ], | ||
| 2678 | "type": "object", | ||
| 2679 | }, | ||
| 2680 | { | ||
| 2681 | "properties": { | ||
| 2682 | "owner": { | ||
| 2683 | "type": "string", | ||
| 2684 | }, | ||
| 2685 | "ref": { | ||
| 2686 | "type": "string", | ||
| 2687 | }, | ||
| 2688 | "repoUuid": { | ||
| 2689 | "type": "string", | ||
| 2690 | }, | ||
| 2691 | "sha": { | ||
| 2692 | "type": "string", | ||
| 2693 | }, | ||
| 2694 | "slug": { | ||
| 2695 | "type": "string", | ||
| 2696 | }, | ||
| 2697 | "type": { | ||
| 2698 | "enum": [ | ||
| 2699 | "bitbucket", | ||
| 2700 | ], | ||
| 2701 | "type": "string", | ||
| 2702 | }, | ||
| 2703 | "workspaceUuid": { | ||
| 2704 | "type": "string", | ||
| 2705 | }, | ||
| 2706 | }, | ||
| 2707 | "required": [ | ||
| 2708 | "ref", | ||
| 2709 | "repoUuid", | ||
| 2710 | "sha", | ||
| 2711 | "type", | ||
| 2712 | "workspaceUuid", | ||
| 2713 | ], | ||
| 2714 | "type": "object", | ||
| 2715 | }, | ||
| 2716 | { | ||
| 2717 | "properties": { | ||
| 2718 | "org": { | ||
| 2719 | "type": "string", | ||
| 2720 | }, | ||
| 2721 | "ref": { | ||
| 2722 | "type": "string", | ||
| 2723 | }, | ||
| 2724 | "repo": { | ||
| 2725 | "type": "string", | ||
| 2726 | }, | ||
| 2727 | "repoPushedAt": { | ||
| 2728 | "type": "number", | ||
| 2729 | }, | ||
| 2730 | "sha": { | ||
| 2731 | "type": "string", | ||
| 2732 | }, | ||
| 2733 | "type": { | ||
| 2734 | "enum": [ | ||
| 2735 | "vercel", | ||
| 2736 | ], | ||
| 2737 | "type": "string", | ||
| 2738 | }, | ||
| 2739 | }, | ||
| 2740 | "required": [ | ||
| 2741 | "org", | ||
| 2742 | "ref", | ||
| 2743 | "repo", | ||
| 2744 | "sha", | ||
| 2745 | "type", | ||
| 2746 | ], | ||
| 2747 | "type": "object", | ||
| 2748 | }, | ||
| 2749 | ], | ||
| 2750 | }, | ||
| 2751 | "id": { | ||
| 2752 | "description": "A string holding the unique ID of the deployment", | ||
| 2753 | "example": "dpl_89qyp1cskzkLrVicDaZoDbjyHuDJ", | ||
| 2754 | "type": "string", | ||
| 2755 | }, | ||
| 2756 | "images": { | ||
| 2757 | "properties": { | ||
| 2758 | "contentDispositionType": { | ||
| 2759 | "enum": [ | ||
| 2760 | "inline", | ||
| 2761 | "attachment", | ||
| 2762 | ], | ||
| 2763 | "type": "string", | ||
| 2764 | }, | ||
| 2765 | "contentSecurityPolicy": { | ||
| 2766 | "type": "string", | ||
| 2767 | }, | ||
| 2768 | "dangerouslyAllowSVG": { | ||
| 2769 | "enum": [ | ||
| 2770 | false, | ||
| 2771 | true, | ||
| 2772 | ], | ||
| 2773 | "type": "boolean", | ||
| 2774 | }, | ||
| 2775 | "domains": { | ||
| 2776 | "items": { | ||
| 2777 | "type": "string", | ||
| 2778 | }, | ||
| 2779 | "type": "array", | ||
| 2780 | }, | ||
| 2781 | "formats": { | ||
| 2782 | "items": { | ||
| 2783 | "enum": [ | ||
| 2784 | "image/avif", | ||
| 2785 | "image/webp", | ||
| 2786 | ], | ||
| 2787 | "type": "string", | ||
| 2788 | }, | ||
| 2789 | "type": "array", | ||
| 2790 | }, | ||
| 2791 | "localPatterns": { | ||
| 2792 | "items": { | ||
| 2793 | "properties": { | ||
| 2794 | "pathname": { | ||
| 2795 | "description": "Can be literal or wildcard. Single \`*\` matches a single path segment. Double \`**\` matches any number of path segments.", | ||
| 2796 | "type": "string", | ||
| 2797 | }, | ||
| 2798 | "search": { | ||
| 2799 | "description": "Can be literal query string such as \`?v=1\` or empty string meaning no query string.", | ||
| 2800 | "type": "string", | ||
| 2801 | }, | ||
| 2802 | }, | ||
| 2803 | "type": "object", | ||
| 2804 | }, | ||
| 2805 | "type": "array", | ||
| 2806 | }, | ||
| 2807 | "minimumCacheTTL": { | ||
| 2808 | "type": "number", | ||
| 2809 | }, | ||
| 2810 | "qualities": { | ||
| 2811 | "items": { | ||
| 2812 | "type": "number", | ||
| 2813 | }, | ||
| 2814 | "type": "array", | ||
| 2815 | }, | ||
| 2816 | "remotePatterns": { | ||
| 2817 | "items": { | ||
| 2818 | "properties": { | ||
| 2819 | "hostname": { | ||
| 2820 | "description": "Can be literal or wildcard. Single \`*\` matches a single subdomain. Double \`**\` matches any number of subdomains.", | ||
| 2821 | "type": "string", | ||
| 2822 | }, | ||
| 2823 | "pathname": { | ||
| 2824 | "description": "Can be literal or wildcard. Single \`*\` matches a single path segment. Double \`**\` matches any number of path segments.", | ||
| 2825 | "type": "string", | ||
| 2826 | }, | ||
| 2827 | "port": { | ||
| 2828 | "description": "Can be literal port such as \`8080\` or empty string meaning no port.", | ||
| 2829 | "type": "string", | ||
| 2830 | }, | ||
| 2831 | "protocol": { | ||
| 2832 | "description": "Must be \`http\` or \`https\`.", | ||
| 2833 | "enum": [ | ||
| 2834 | "http", | ||
| 2835 | "https", | ||
| 2836 | ], | ||
| 2837 | "type": "string", | ||
| 2838 | }, | ||
| 2839 | "search": { | ||
| 2840 | "description": "Can be literal query string such as \`?v=1\` or empty string meaning no query string.", | ||
| 2841 | "type": "string", | ||
| 2842 | }, | ||
| 2843 | }, | ||
| 2844 | "required": [ | ||
| 2845 | "hostname", | ||
| 2846 | ], | ||
| 2847 | "type": "object", | ||
| 2848 | }, | ||
| 2849 | "type": "array", | ||
| 2850 | }, | ||
| 2851 | "sizes": { | ||
| 2852 | "items": { | ||
| 2853 | "type": "number", | ||
| 2854 | }, | ||
| 2855 | "type": "array", | ||
| 2856 | }, | ||
| 2857 | }, | ||
| 2858 | "type": "object", | ||
| 2859 | }, | ||
| 2860 | "initReadyAt": { | ||
| 2861 | "type": "number", | ||
| 2862 | }, | ||
| 2863 | "inspectorUrl": { | ||
| 2864 | "nullable": true, | ||
| 2865 | "type": "string", | ||
| 2866 | }, | ||
| 2867 | "integrations": { | ||
| 2868 | "properties": { | ||
| 2869 | "claimedAt": { | ||
| 2870 | "type": "number", | ||
| 2871 | }, | ||
| 2872 | "completedAt": { | ||
| 2873 | "type": "number", | ||
| 2874 | }, | ||
| 2875 | "skippedAt": { | ||
| 2876 | "type": "number", | ||
| 2877 | }, | ||
| 2878 | "skippedBy": { | ||
| 2879 | "type": "string", | ||
| 2880 | }, | ||
| 2881 | "startedAt": { | ||
| 2882 | "type": "number", | ||
| 2883 | }, | ||
| 2884 | "status": { | ||
| 2885 | "enum": [ | ||
| 2886 | "skipped", | ||
| 2887 | "pending", | ||
| 2888 | "ready", | ||
| 2889 | "error", | ||
| 2890 | "timeout", | ||
| 2891 | ], | ||
| 2892 | "type": "string", | ||
| 2893 | }, | ||
| 2894 | }, | ||
| 2895 | "required": [ | ||
| 2896 | "startedAt", | ||
| 2897 | "status", | ||
| 2898 | ], | ||
| 2899 | "type": "object", | ||
| 2900 | }, | ||
| 2901 | "isFirstBranchDeployment": { | ||
| 2902 | "enum": [ | ||
| 2903 | false, | ||
| 2904 | true, | ||
| 2905 | ], | ||
| 2906 | "type": "boolean", | ||
| 2907 | }, | ||
| 2908 | "isInConcurrentBuildsQueue": { | ||
| 2909 | "enum": [ | ||
| 2910 | false, | ||
| 2911 | true, | ||
| 2912 | ], | ||
| 2913 | "type": "boolean", | ||
| 2914 | }, | ||
| 2915 | "isInSystemBuildsQueue": { | ||
| 2916 | "enum": [ | ||
| 2917 | false, | ||
| 2918 | true, | ||
| 2919 | ], | ||
| 2920 | "type": "boolean", | ||
| 2921 | }, | ||
| 2922 | "lambdas": { | ||
| 2923 | "items": { | ||
| 2924 | "description": "A partial representation of a Build used by the deployment endpoint.", | ||
| 2925 | "properties": { | ||
| 2926 | "createdAt": { | ||
| 2927 | "type": "number", | ||
| 2928 | }, | ||
| 2929 | "entrypoint": { | ||
| 2930 | "nullable": true, | ||
| 2931 | "type": "string", | ||
| 2932 | }, | ||
| 2933 | "id": { | ||
| 2934 | "type": "string", | ||
| 2935 | }, | ||
| 2936 | "output": { | ||
| 2937 | "items": { | ||
| 2938 | "properties": { | ||
| 2939 | "functionName": { | ||
| 2940 | "type": "string", | ||
| 2941 | }, | ||
| 2942 | "path": { | ||
| 2943 | "type": "string", | ||
| 2944 | }, | ||
| 2945 | }, | ||
| 2946 | "required": [ | ||
| 2947 | "functionName", | ||
| 2948 | "path", | ||
| 2949 | ], | ||
| 2950 | "type": "object", | ||
| 2951 | }, | ||
| 2952 | "type": "array", | ||
| 2953 | }, | ||
| 2954 | "readyState": { | ||
| 2955 | "enum": [ | ||
| 2956 | "BUILDING", | ||
| 2957 | "ERROR", | ||
| 2958 | "INITIALIZING", | ||
| 2959 | "READY", | ||
| 2960 | ], | ||
| 2961 | "type": "string", | ||
| 2962 | }, | ||
| 2963 | "readyStateAt": { | ||
| 2964 | "type": "number", | ||
| 2965 | }, | ||
| 2966 | }, | ||
| 2967 | "required": [ | ||
| 2968 | "id", | ||
| 2969 | "output", | ||
| 2970 | ], | ||
| 2971 | "type": "object", | ||
| 2972 | }, | ||
| 2973 | "type": "array", | ||
| 2974 | }, | ||
| 2975 | "manualProvisioning": { | ||
| 2976 | "description": "Present when deployment was created with manual provisioning enabled, either explicitly or via the experimental BYOC git flow. The deployment stays in INITIALIZING until /continue is called.", | ||
| 2977 | "properties": { | ||
| 2978 | "completedAt": { | ||
| 2979 | "description": "Timestamp when manual provisioning completed", | ||
| 2980 | "type": "number", | ||
| 2981 | }, | ||
| 2982 | "state": { | ||
| 2983 | "description": "Current provisioning state", | ||
| 2984 | "enum": [ | ||
| 2985 | "PENDING", | ||
| 2986 | "COMPLETE", | ||
| 2987 | "TIMEOUT", | ||
| 2988 | ], | ||
| 2989 | "type": "string", | ||
| 2990 | }, | ||
| 2991 | }, | ||
| 2992 | "required": [ | ||
| 2993 | "state", | ||
| 2994 | ], | ||
| 2995 | "type": "object", | ||
| 2996 | }, | ||
| 2997 | "meta": { | ||
| 2998 | "additionalProperties": { | ||
| 2999 | "type": "string", | ||
| 3000 | }, | ||
| 3001 | "type": "object", | ||
| 3002 | }, | ||
| 3003 | "microfrontends": { | ||
| 3004 | "oneOf": [ | ||
| 3005 | { | ||
| 3006 | "properties": { | ||
| 3007 | "defaultAppProjectName": { | ||
| 3008 | "description": "The project name of the default app of this deployment's microfrontends group.", | ||
| 3009 | "type": "string", | ||
| 3010 | }, | ||
| 3011 | "defaultRoute": { | ||
| 3012 | "description": "A path that is used to take screenshots and as the default path in preview links when a domain for this microfrontend is shown in the UI.", | ||
| 3013 | "type": "string", | ||
| 3014 | }, | ||
| 3015 | "groupIds": { | ||
| 3016 | "description": "The group of microfrontends that this project belongs to. Each microfrontend project must belong to a microfrontends group that is the set of microfrontends that are used together.", | ||
| 3017 | "items": { | ||
| 3018 | "type": "string", | ||
| 3019 | }, | ||
| 3020 | "minItems": 1, | ||
| 3021 | "type": "array", | ||
| 3022 | }, | ||
| 3023 | "isDefaultApp": { | ||
| 3024 | "enum": [ | ||
| 3025 | false, | ||
| 3026 | ], | ||
| 3027 | "type": "boolean", | ||
| 3028 | }, | ||
| 3029 | }, | ||
| 3030 | "required": [ | ||
| 3031 | "defaultAppProjectName", | ||
| 3032 | "groupIds", | ||
| 3033 | ], | ||
| 3034 | "type": "object", | ||
| 3035 | }, | ||
| 3036 | { | ||
| 3037 | "properties": { | ||
| 3038 | "defaultAppProjectName": { | ||
| 3039 | "description": "The project name of the default app of this deployment's microfrontends group.", | ||
| 3040 | "type": "string", | ||
| 3041 | }, | ||
| 3042 | "defaultRoute": { | ||
| 3043 | "description": "A path that is used to take screenshots and as the default path in preview links when a domain for this microfrontend is shown in the UI.", | ||
| 3044 | "type": "string", | ||
| 3045 | }, | ||
| 3046 | "groupIds": { | ||
| 3047 | "description": "The group of microfrontends that this project belongs to. Each microfrontend project must belong to a microfrontends group that is the set of microfrontends that are used together.", | ||
| 3048 | "items": { | ||
| 3049 | "type": "string", | ||
| 3050 | }, | ||
| 3051 | "minItems": 1, | ||
| 3052 | "type": "array", | ||
| 3053 | }, | ||
| 3054 | "isDefaultApp": { | ||
| 3055 | "enum": [ | ||
| 3056 | true, | ||
| 3057 | ], | ||
| 3058 | "type": "boolean", | ||
| 3059 | }, | ||
| 3060 | "mfeConfigUploadState": { | ||
| 3061 | "description": "The result of the microfrontends config upload during deployment creation / build. Only set for default app deployments. The config upload is attempted during deployment create, and then again during the build. If the config is not in the root directory, or the deployment is prebuilt, the config cannot be uploaded during deployment create. The upload during deployment build finds the config even if it's not in the root directory, as it has access to all files. Uploading the config during create is ideal, as then all child deployments are guaranteed to have access to the default app deployment config even if the default app has not yet started building. If the config is not uploaded, the child app will show as building until the config has been uploaded during the default app build. - \`success\` - The config was uploaded successfully, either when the deployment was created or during the build. - \`waiting_on_build\` - The config could not be uploaded during deployment create, will be attempted again during the build. - \`no_config\` - No config was found. Only set once the build has not found the config in any of the deployment's files. - \`undefined\` - Legacy deployments, or there was an error uploading the config during deployment create.", | ||
| 3062 | "enum": [ | ||
| 3063 | "success", | ||
| 3064 | "waiting_on_build", | ||
| 3065 | "no_config", | ||
| 3066 | ], | ||
| 3067 | "type": "string", | ||
| 3068 | }, | ||
| 3069 | }, | ||
| 3070 | "required": [ | ||
| 3071 | "defaultAppProjectName", | ||
| 3072 | "groupIds", | ||
| 3073 | "isDefaultApp", | ||
| 3074 | ], | ||
| 3075 | "type": "object", | ||
| 3076 | }, | ||
| 3077 | ], | ||
| 3078 | }, | ||
| 3079 | "monorepoManager": { | ||
| 3080 | "nullable": true, | ||
| 3081 | "type": "string", | ||
| 3082 | }, | ||
| 3083 | "name": { | ||
| 3084 | "description": "The name of the project associated with the deployment at the time that the deployment was created", | ||
| 3085 | "example": "my-project", | ||
| 3086 | "type": "string", | ||
| 3087 | }, | ||
| 3088 | "nodeVersion": { | ||
| 3089 | "description": "If set it overrides the \`projectSettings.nodeVersion\` for this deployment.", | ||
| 3090 | "enum": [ | ||
| 3091 | "24.x", | ||
| 3092 | "22.x", | ||
| 3093 | "20.x", | ||
| 3094 | "18.x", | ||
| 3095 | "16.x", | ||
| 3096 | "14.x", | ||
| 3097 | "12.x", | ||
| 3098 | "10.x", | ||
| 3099 | "8.10.x", | ||
| 3100 | ], | ||
| 3101 | "type": "string", | ||
| 3102 | }, | ||
| 3103 | "oidcTokenClaims": { | ||
| 3104 | "properties": { | ||
| 3105 | "aud": { | ||
| 3106 | "type": "string", | ||
| 3107 | }, | ||
| 3108 | "custom_environment_id": { | ||
| 3109 | "type": "string", | ||
| 3110 | }, | ||
| 3111 | "environment": { | ||
| 3112 | "type": "string", | ||
| 3113 | }, | ||
| 3114 | "iss": { | ||
| 3115 | "type": "string", | ||
| 3116 | }, | ||
| 3117 | "owner": { | ||
| 3118 | "type": "string", | ||
| 3119 | }, | ||
| 3120 | "owner_id": { | ||
| 3121 | "type": "string", | ||
| 3122 | }, | ||
| 3123 | "plan": { | ||
| 3124 | "type": "string", | ||
| 3125 | }, | ||
| 3126 | "project": { | ||
| 3127 | "type": "string", | ||
| 3128 | }, | ||
| 3129 | "project_id": { | ||
| 3130 | "type": "string", | ||
| 3131 | }, | ||
| 3132 | "scope": { | ||
| 3133 | "type": "string", | ||
| 3134 | }, | ||
| 3135 | "sub": { | ||
| 3136 | "type": "string", | ||
| 3137 | }, | ||
| 3138 | }, | ||
| 3139 | "required": [ | ||
| 3140 | "aud", | ||
| 3141 | "environment", | ||
| 3142 | "iss", | ||
| 3143 | "owner", | ||
| 3144 | "owner_id", | ||
| 3145 | "project", | ||
| 3146 | "project_id", | ||
| 3147 | "scope", | ||
| 3148 | "sub", | ||
| 3149 | ], | ||
| 3150 | "type": "object", | ||
| 3151 | }, | ||
| 3152 | "oomReport": { | ||
| 3153 | "enum": [ | ||
| 3154 | "out-of-memory", | ||
| 3155 | ], | ||
| 3156 | "type": "string", | ||
| 3157 | }, | ||
| 3158 | "originCacheRegion": { | ||
| 3159 | "type": "string", | ||
| 3160 | }, | ||
| 3161 | "ownerId": { | ||
| 3162 | "type": "string", | ||
| 3163 | }, | ||
| 3164 | "passiveConnectConfigurationId": { | ||
| 3165 | "description": "Since November 2023 this field defines a Secure Compute network that will only be used to deploy passive lambdas to (as in passiveRegions)", | ||
| 3166 | "type": "string", | ||
| 3167 | }, | ||
| 3168 | "passiveRegions": { | ||
| 3169 | "description": "Since November 2023 this field defines a set of regions that we will deploy the lambda to passively Lambdas will be deployed to these regions but only invoked if all of the primary \`regions\` are marked as out of service", | ||
| 3170 | "items": { | ||
| 3171 | "type": "string", | ||
| 3172 | }, | ||
| 3173 | "type": "array", | ||
| 3174 | }, | ||
| 3175 | "plan": { | ||
| 3176 | "enum": [ | ||
| 3177 | "pro", | ||
| 3178 | "enterprise", | ||
| 3179 | "hobby", | ||
| 3180 | ], | ||
| 3181 | "type": "string", | ||
| 3182 | }, | ||
| 3183 | "platform": { | ||
| 3184 | "description": "Metadata about the source platform that triggered the deployment. Allows us to map a deployment back to a platform (e.g. the chat that created it)", | ||
| 3185 | "properties": { | ||
| 3186 | "creator": { | ||
| 3187 | "description": "The user on the external platform who triggered the deployment.", | ||
| 3188 | "properties": { | ||
| 3189 | "avatar": { | ||
| 3190 | "description": "URL of the platform user's avatar image.", | ||
| 3191 | "type": "string", | ||
| 3192 | }, | ||
| 3193 | "name": { | ||
| 3194 | "description": "Display name of the platform user.", | ||
| 3195 | "type": "string", | ||
| 3196 | }, | ||
| 3197 | }, | ||
| 3198 | "required": [ | ||
| 3199 | "name", | ||
| 3200 | ], | ||
| 3201 | "type": "object", | ||
| 3202 | }, | ||
| 3203 | "meta": { | ||
| 3204 | "additionalProperties": { | ||
| 3205 | "type": "string", | ||
| 3206 | }, | ||
| 3207 | "description": "Arbitrary key-value metadata provided by the platform.", | ||
| 3208 | "type": "object", | ||
| 3209 | }, | ||
| 3210 | "origin": { | ||
| 3211 | "description": "Reference back to the entity on the platform that initiated the deployment.", | ||
| 3212 | "properties": { | ||
| 3213 | "type": { | ||
| 3214 | "description": "Whether the value is an opaque identifier or a URL.", | ||
| 3215 | "enum": [ | ||
| 3216 | "id", | ||
| 3217 | "url", | ||
| 3218 | ], | ||
| 3219 | "type": "string", | ||
| 3220 | }, | ||
| 3221 | "value": { | ||
| 3222 | "description": "The identifier or URL pointing to the originating entity.", | ||
| 3223 | "type": "string", | ||
| 3224 | }, | ||
| 3225 | }, | ||
| 3226 | "required": [ | ||
| 3227 | "type", | ||
| 3228 | "value", | ||
| 3229 | ], | ||
| 3230 | "type": "object", | ||
| 3231 | }, | ||
| 3232 | "source": { | ||
| 3233 | "description": "The external platform that created the deployment (e.g. its display name).", | ||
| 3234 | "properties": { | ||
| 3235 | "name": { | ||
| 3236 | "description": "Display name of the platform.", | ||
| 3237 | "type": "string", | ||
| 3238 | }, | ||
| 3239 | }, | ||
| 3240 | "required": [ | ||
| 3241 | "name", | ||
| 3242 | ], | ||
| 3243 | "type": "object", | ||
| 3244 | }, | ||
| 3245 | }, | ||
| 3246 | "required": [ | ||
| 3247 | "creator", | ||
| 3248 | "origin", | ||
| 3249 | "source", | ||
| 3250 | ], | ||
| 3251 | "type": "object", | ||
| 3252 | }, | ||
| 3253 | "prebuilt": { | ||
| 3254 | "enum": [ | ||
| 3255 | false, | ||
| 3256 | true, | ||
| 3257 | ], | ||
| 3258 | "type": "boolean", | ||
| 3259 | }, | ||
| 3260 | "previewCommentsEnabled": { | ||
| 3261 | "description": "Whether or not preview comments are enabled for the deployment", | ||
| 3262 | "enum": [ | ||
| 3263 | false, | ||
| 3264 | true, | ||
| 3265 | ], | ||
| 3266 | "example": false, | ||
| 3267 | "type": "boolean", | ||
| 3268 | }, | ||
| 3269 | "project": { | ||
| 3270 | "description": "The public project information associated with the deployment.", | ||
| 3271 | "properties": { | ||
| 3272 | "framework": { | ||
| 3273 | "nullable": true, | ||
| 3274 | "type": "string", | ||
| 3275 | }, | ||
| 3276 | "id": { | ||
| 3277 | "type": "string", | ||
| 3278 | }, | ||
| 3279 | "name": { | ||
| 3280 | "type": "string", | ||
| 3281 | }, | ||
| 3282 | }, | ||
| 3283 | "required": [ | ||
| 3284 | "id", | ||
| 3285 | "name", | ||
| 3286 | ], | ||
| 3287 | "type": "object", | ||
| 3288 | }, | ||
| 3289 | "projectId": { | ||
| 3290 | "type": "string", | ||
| 3291 | }, | ||
| 3292 | "projectSettings": { | ||
| 3293 | "properties": { | ||
| 3294 | "buildCommand": { | ||
| 3295 | "nullable": true, | ||
| 3296 | "type": "string", | ||
| 3297 | }, | ||
| 3298 | "commandForIgnoringBuildStep": { | ||
| 3299 | "nullable": true, | ||
| 3300 | "type": "string", | ||
| 3301 | }, | ||
| 3302 | "devCommand": { | ||
| 3303 | "nullable": true, | ||
| 3304 | "type": "string", | ||
| 3305 | }, | ||
| 3306 | "framework": { | ||
| 3307 | "enum": [ | ||
| 3308 | "blitzjs", | ||
| 3309 | "nextjs", | ||
| 3310 | "gatsby", | ||
| 3311 | "remix", | ||
| 3312 | "react-router", | ||
| 3313 | "astro", | ||
| 3314 | "hexo", | ||
| 3315 | "eleventy", | ||
| 3316 | "docusaurus-2", | ||
| 3317 | "docusaurus", | ||
| 3318 | "preact", | ||
| 3319 | "solidstart-1", | ||
| 3320 | "solidstart", | ||
| 3321 | "dojo", | ||
| 3322 | "ember", | ||
| 3323 | "vue", | ||
| 3324 | "scully", | ||
| 3325 | "ionic-angular", | ||
| 3326 | "angular", | ||
| 3327 | "polymer", | ||
| 3328 | "svelte", | ||
| 3329 | "sveltekit", | ||
| 3330 | "sveltekit-1", | ||
| 3331 | "ionic-react", | ||
| 3332 | "create-react-app", | ||
| 3333 | "gridsome", | ||
| 3334 | "umijs", | ||
| 3335 | "sapper", | ||
| 3336 | "saber", | ||
| 3337 | "stencil", | ||
| 3338 | "nuxtjs", | ||
| 3339 | "redwoodjs", | ||
| 3340 | "hugo", | ||
| 3341 | "jekyll", | ||
| 3342 | "brunch", | ||
| 3343 | "middleman", | ||
| 3344 | "zola", | ||
| 3345 | "hydrogen", | ||
| 3346 | "vite", | ||
| 3347 | "tanstack-start", | ||
| 3348 | "vitepress", | ||
| 3349 | "vuepress", | ||
| 3350 | "parcel", | ||
| 3351 | "fastapi", | ||
| 3352 | "flask", | ||
| 3353 | "fasthtml", | ||
| 3354 | "django", | ||
| 3355 | "ash", | ||
| 3356 | "sanity-v3", | ||
| 3357 | "sanity", | ||
| 3358 | "storybook", | ||
| 3359 | "nitro", | ||
| 3360 | "hono", | ||
| 3361 | "express", | ||
| 3362 | "h3", | ||
| 3363 | "koa", | ||
| 3364 | "nestjs", | ||
| 3365 | "elysia", | ||
| 3366 | "fastify", | ||
| 3367 | "xmcp", | ||
| 3368 | "python", | ||
| 3369 | "ruby", | ||
| 3370 | "rust", | ||
| 3371 | "axum", | ||
| 3372 | "actix-web", | ||
| 3373 | "node", | ||
| 3374 | "go", | ||
| 3375 | "services", | ||
| 3376 | "mastra", | ||
| 3377 | null, | ||
| 3378 | ], | ||
| 3379 | "nullable": true, | ||
| 3380 | "type": "string", | ||
| 3381 | }, | ||
| 3382 | "installCommand": { | ||
| 3383 | "nullable": true, | ||
| 3384 | "type": "string", | ||
| 3385 | }, | ||
| 3386 | "nodeVersion": { | ||
| 3387 | "enum": [ | ||
| 3388 | "24.x", | ||
| 3389 | "22.x", | ||
| 3390 | "20.x", | ||
| 3391 | "18.x", | ||
| 3392 | "16.x", | ||
| 3393 | "14.x", | ||
| 3394 | "12.x", | ||
| 3395 | "10.x", | ||
| 3396 | "8.10.x", | ||
| 3397 | ], | ||
| 3398 | "type": "string", | ||
| 3399 | }, | ||
| 3400 | "outputDirectory": { | ||
| 3401 | "nullable": true, | ||
| 3402 | "type": "string", | ||
| 3403 | }, | ||
| 3404 | "speedInsights": { | ||
| 3405 | "properties": { | ||
| 3406 | "canceledAt": { | ||
| 3407 | "type": "number", | ||
| 3408 | }, | ||
| 3409 | "disabledAt": { | ||
| 3410 | "type": "number", | ||
| 3411 | }, | ||
| 3412 | "enabledAt": { | ||
| 3413 | "type": "number", | ||
| 3414 | }, | ||
| 3415 | "hasData": { | ||
| 3416 | "enum": [ | ||
| 3417 | false, | ||
| 3418 | true, | ||
| 3419 | ], | ||
| 3420 | "type": "boolean", | ||
| 3421 | }, | ||
| 3422 | "id": { | ||
| 3423 | "type": "string", | ||
| 3424 | }, | ||
| 3425 | "paidAt": { | ||
| 3426 | "type": "number", | ||
| 3427 | }, | ||
| 3428 | }, | ||
| 3429 | "required": [ | ||
| 3430 | "id", | ||
| 3431 | ], | ||
| 3432 | "type": "object", | ||
| 3433 | }, | ||
| 3434 | "webAnalytics": { | ||
| 3435 | "properties": { | ||
| 3436 | "canceledAt": { | ||
| 3437 | "type": "number", | ||
| 3438 | }, | ||
| 3439 | "disabledAt": { | ||
| 3440 | "type": "number", | ||
| 3441 | }, | ||
| 3442 | "enabledAt": { | ||
| 3443 | "type": "number", | ||
| 3444 | }, | ||
| 3445 | "hasData": { | ||
| 3446 | "enum": [ | ||
| 3447 | true, | ||
| 3448 | ], | ||
| 3449 | "type": "boolean", | ||
| 3450 | }, | ||
| 3451 | "id": { | ||
| 3452 | "type": "string", | ||
| 3453 | }, | ||
| 3454 | }, | ||
| 3455 | "required": [ | ||
| 3456 | "id", | ||
| 3457 | ], | ||
| 3458 | "type": "object", | ||
| 3459 | }, | ||
| 3460 | }, | ||
| 3461 | "type": "object", | ||
| 3462 | }, | ||
| 3463 | "public": { | ||
| 3464 | "description": "A boolean representing if the deployment is public or not. By default this is \`false\`", | ||
| 3465 | "enum": [ | ||
| 3466 | false, | ||
| 3467 | true, | ||
| 3468 | ], | ||
| 3469 | "example": false, | ||
| 3470 | "type": "boolean", | ||
| 3471 | }, | ||
| 3472 | "ready": { | ||
| 3473 | "type": "number", | ||
| 3474 | }, | ||
| 3475 | "readyState": { | ||
| 3476 | "description": "The state of the deployment depending on the process of deploying, or if it is ready or in an error state", | ||
| 3477 | "enum": [ | ||
| 3478 | "QUEUED", | ||
| 3479 | "BUILDING", | ||
| 3480 | "ERROR", | ||
| 3481 | "BLOCKED", | ||
| 3482 | "INITIALIZING", | ||
| 3483 | "READY", | ||
| 3484 | "CANCELED", | ||
| 3485 | ], | ||
| 3486 | "example": "READY", | ||
| 3487 | "type": "string", | ||
| 3488 | }, | ||
| 3489 | "readyStateReason": { | ||
| 3490 | "type": "string", | ||
| 3491 | }, | ||
| 3492 | "readySubstate": { | ||
| 3493 | "description": "Substate of deployment when readyState is 'READY' Tracks whether or not deployment has seen production traffic: - STAGED: never seen production traffic - ROLLING: in the process of having production traffic gradually transitioned. - PROMOTED: has seen production traffic", | ||
| 3494 | "enum": [ | ||
| 3495 | "STAGED", | ||
| 3496 | "ROLLING", | ||
| 3497 | "PROMOTED", | ||
| 3498 | ], | ||
| 3499 | "type": "string", | ||
| 3500 | }, | ||
| 3501 | "regions": { | ||
| 3502 | "description": "The regions the deployment exists in", | ||
| 3503 | "example": [ | ||
| 3504 | "sfo1", | ||
| 3505 | ], | ||
| 3506 | "items": { | ||
| 3507 | "type": "string", | ||
| 3508 | }, | ||
| 3509 | "type": "array", | ||
| 3510 | }, | ||
| 3511 | "routes": { | ||
| 3512 | "items": { | ||
| 3513 | "oneOf": [ | ||
| 3514 | { | ||
| 3515 | "properties": { | ||
| 3516 | "caseSensitive": { | ||
| 3517 | "enum": [ | ||
| 3518 | false, | ||
| 3519 | true, | ||
| 3520 | ], | ||
| 3521 | "type": "boolean", | ||
| 3522 | }, | ||
| 3523 | "check": { | ||
| 3524 | "enum": [ | ||
| 3525 | false, | ||
| 3526 | true, | ||
| 3527 | ], | ||
| 3528 | "type": "boolean", | ||
| 3529 | }, | ||
| 3530 | "continue": { | ||
| 3531 | "enum": [ | ||
| 3532 | false, | ||
| 3533 | true, | ||
| 3534 | ], | ||
| 3535 | "type": "boolean", | ||
| 3536 | }, | ||
| 3537 | "dest": { | ||
| 3538 | "type": "string", | ||
| 3539 | }, | ||
| 3540 | "destination": { | ||
| 3541 | "type": "string", | ||
| 3542 | }, | ||
| 3543 | "env": { | ||
| 3544 | "items": { | ||
| 3545 | "type": "string", | ||
| 3546 | }, | ||
| 3547 | "type": "array", | ||
| 3548 | }, | ||
| 3549 | "has": { | ||
| 3550 | "items": { | ||
| 3551 | "oneOf": [ | ||
| 3552 | { | ||
| 3553 | "properties": { | ||
| 3554 | "type": { | ||
| 3555 | "enum": [ | ||
| 3556 | "host", | ||
| 3557 | ], | ||
| 3558 | "type": "string", | ||
| 3559 | }, | ||
| 3560 | "value": { | ||
| 3561 | "oneOf": [ | ||
| 3562 | { | ||
| 3563 | "type": "string", | ||
| 3564 | }, | ||
| 3565 | { | ||
| 3566 | "properties": { | ||
| 3567 | "eq": { | ||
| 3568 | "oneOf": [ | ||
| 3569 | { | ||
| 3570 | "type": "string", | ||
| 3571 | }, | ||
| 3572 | { | ||
| 3573 | "type": "number", | ||
| 3574 | }, | ||
| 3575 | ], | ||
| 3576 | }, | ||
| 3577 | "gt": { | ||
| 3578 | "type": "number", | ||
| 3579 | }, | ||
| 3580 | "gte": { | ||
| 3581 | "type": "number", | ||
| 3582 | }, | ||
| 3583 | "inc": { | ||
| 3584 | "items": { | ||
| 3585 | "type": "string", | ||
| 3586 | }, | ||
| 3587 | "type": "array", | ||
| 3588 | }, | ||
| 3589 | "lt": { | ||
| 3590 | "type": "number", | ||
| 3591 | }, | ||
| 3592 | "lte": { | ||
| 3593 | "type": "number", | ||
| 3594 | }, | ||
| 3595 | "neq": { | ||
| 3596 | "type": "string", | ||
| 3597 | }, | ||
| 3598 | "ninc": { | ||
| 3599 | "items": { | ||
| 3600 | "type": "string", | ||
| 3601 | }, | ||
| 3602 | "type": "array", | ||
| 3603 | }, | ||
| 3604 | "pre": { | ||
| 3605 | "type": "string", | ||
| 3606 | }, | ||
| 3607 | "re": { | ||
| 3608 | "type": "string", | ||
| 3609 | }, | ||
| 3610 | "suf": { | ||
| 3611 | "type": "string", | ||
| 3612 | }, | ||
| 3613 | }, | ||
| 3614 | "type": "object", | ||
| 3615 | }, | ||
| 3616 | ], | ||
| 3617 | }, | ||
| 3618 | }, | ||
| 3619 | "required": [ | ||
| 3620 | "type", | ||
| 3621 | "value", | ||
| 3622 | ], | ||
| 3623 | "type": "object", | ||
| 3624 | }, | ||
| 3625 | { | ||
| 3626 | "properties": { | ||
| 3627 | "key": { | ||
| 3628 | "type": "string", | ||
| 3629 | }, | ||
| 3630 | "type": { | ||
| 3631 | "enum": [ | ||
| 3632 | "header", | ||
| 3633 | "cookie", | ||
| 3634 | "query", | ||
| 3635 | ], | ||
| 3636 | "type": "string", | ||
| 3637 | }, | ||
| 3638 | "value": { | ||
| 3639 | "oneOf": [ | ||
| 3640 | { | ||
| 3641 | "type": "string", | ||
| 3642 | }, | ||
| 3643 | { | ||
| 3644 | "properties": { | ||
| 3645 | "eq": { | ||
| 3646 | "oneOf": [ | ||
| 3647 | { | ||
| 3648 | "type": "string", | ||
| 3649 | }, | ||
| 3650 | { | ||
| 3651 | "type": "number", | ||
| 3652 | }, | ||
| 3653 | ], | ||
| 3654 | }, | ||
| 3655 | "gt": { | ||
| 3656 | "type": "number", | ||
| 3657 | }, | ||
| 3658 | "gte": { | ||
| 3659 | "type": "number", | ||
| 3660 | }, | ||
| 3661 | "inc": { | ||
| 3662 | "items": { | ||
| 3663 | "type": "string", | ||
| 3664 | }, | ||
| 3665 | "type": "array", | ||
| 3666 | }, | ||
| 3667 | "lt": { | ||
| 3668 | "type": "number", | ||
| 3669 | }, | ||
| 3670 | "lte": { | ||
| 3671 | "type": "number", | ||
| 3672 | }, | ||
| 3673 | "neq": { | ||
| 3674 | "type": "string", | ||
| 3675 | }, | ||
| 3676 | "ninc": { | ||
| 3677 | "items": { | ||
| 3678 | "type": "string", | ||
| 3679 | }, | ||
| 3680 | "type": "array", | ||
| 3681 | }, | ||
| 3682 | "pre": { | ||
| 3683 | "type": "string", | ||
| 3684 | }, | ||
| 3685 | "re": { | ||
| 3686 | "type": "string", | ||
| 3687 | }, | ||
| 3688 | "suf": { | ||
| 3689 | "type": "string", | ||
| 3690 | }, | ||
| 3691 | }, | ||
| 3692 | "type": "object", | ||
| 3693 | }, | ||
| 3694 | ], | ||
| 3695 | }, | ||
| 3696 | }, | ||
| 3697 | "required": [ | ||
| 3698 | "key", | ||
| 3699 | "type", | ||
| 3700 | ], | ||
| 3701 | "type": "object", | ||
| 3702 | }, | ||
| 3703 | ], | ||
| 3704 | }, | ||
| 3705 | "type": "array", | ||
| 3706 | }, | ||
| 3707 | "headers": { | ||
| 3708 | "additionalProperties": { | ||
| 3709 | "type": "string", | ||
| 3710 | }, | ||
| 3711 | "type": "object", | ||
| 3712 | }, | ||
| 3713 | "important": { | ||
| 3714 | "enum": [ | ||
| 3715 | false, | ||
| 3716 | true, | ||
| 3717 | ], | ||
| 3718 | "type": "boolean", | ||
| 3719 | }, | ||
| 3720 | "locale": { | ||
| 3721 | "properties": { | ||
| 3722 | "cookie": { | ||
| 3723 | "type": "string", | ||
| 3724 | }, | ||
| 3725 | "redirect": { | ||
| 3726 | "additionalProperties": { | ||
| 3727 | "type": "string", | ||
| 3728 | }, | ||
| 3729 | "type": "object", | ||
| 3730 | }, | ||
| 3731 | }, | ||
| 3732 | "type": "object", | ||
| 3733 | }, | ||
| 3734 | "methods": { | ||
| 3735 | "items": { | ||
| 3736 | "type": "string", | ||
| 3737 | }, | ||
| 3738 | "type": "array", | ||
| 3739 | }, | ||
| 3740 | "middleware": { | ||
| 3741 | "description": "A middleware index in the \`middleware\` key under the build result", | ||
| 3742 | "type": "number", | ||
| 3743 | }, | ||
| 3744 | "middlewarePath": { | ||
| 3745 | "description": "A middleware key within the \`output\` key under the build result. Overrides a \`middleware\` definition.", | ||
| 3746 | "type": "string", | ||
| 3747 | }, | ||
| 3748 | "middlewareRawSrc": { | ||
| 3749 | "description": "The original middleware matchers.", | ||
| 3750 | "items": { | ||
| 3751 | "type": "string", | ||
| 3752 | }, | ||
| 3753 | "type": "array", | ||
| 3754 | }, | ||
| 3755 | "missing": { | ||
| 3756 | "items": { | ||
| 3757 | "oneOf": [ | ||
| 3758 | { | ||
| 3759 | "properties": { | ||
| 3760 | "type": { | ||
| 3761 | "enum": [ | ||
| 3762 | "host", | ||
| 3763 | ], | ||
| 3764 | "type": "string", | ||
| 3765 | }, | ||
| 3766 | "value": { | ||
| 3767 | "oneOf": [ | ||
| 3768 | { | ||
| 3769 | "type": "string", | ||
| 3770 | }, | ||
| 3771 | { | ||
| 3772 | "properties": { | ||
| 3773 | "eq": { | ||
| 3774 | "oneOf": [ | ||
| 3775 | { | ||
| 3776 | "type": "string", | ||
| 3777 | }, | ||
| 3778 | { | ||
| 3779 | "type": "number", | ||
| 3780 | }, | ||
| 3781 | ], | ||
| 3782 | }, | ||
| 3783 | "gt": { | ||
| 3784 | "type": "number", | ||
| 3785 | }, | ||
| 3786 | "gte": { | ||
| 3787 | "type": "number", | ||
| 3788 | }, | ||
| 3789 | "inc": { | ||
| 3790 | "items": { | ||
| 3791 | "type": "string", | ||
| 3792 | }, | ||
| 3793 | "type": "array", | ||
| 3794 | }, | ||
| 3795 | "lt": { | ||
| 3796 | "type": "number", | ||
| 3797 | }, | ||
| 3798 | "lte": { | ||
| 3799 | "type": "number", | ||
| 3800 | }, | ||
| 3801 | "neq": { | ||
| 3802 | "type": "string", | ||
| 3803 | }, | ||
| 3804 | "ninc": { | ||
| 3805 | "items": { | ||
| 3806 | "type": "string", | ||
| 3807 | }, | ||
| 3808 | "type": "array", | ||
| 3809 | }, | ||
| 3810 | "pre": { | ||
| 3811 | "type": "string", | ||
| 3812 | }, | ||
| 3813 | "re": { | ||
| 3814 | "type": "string", | ||
| 3815 | }, | ||
| 3816 | "suf": { | ||
| 3817 | "type": "string", | ||
| 3818 | }, | ||
| 3819 | }, | ||
| 3820 | "type": "object", | ||
| 3821 | }, | ||
| 3822 | ], | ||
| 3823 | }, | ||
| 3824 | }, | ||
| 3825 | "required": [ | ||
| 3826 | "type", | ||
| 3827 | "value", | ||
| 3828 | ], | ||
| 3829 | "type": "object", | ||
| 3830 | }, | ||
| 3831 | { | ||
| 3832 | "properties": { | ||
| 3833 | "key": { | ||
| 3834 | "type": "string", | ||
| 3835 | }, | ||
| 3836 | "type": { | ||
| 3837 | "enum": [ | ||
| 3838 | "header", | ||
| 3839 | "cookie", | ||
| 3840 | "query", | ||
| 3841 | ], | ||
| 3842 | "type": "string", | ||
| 3843 | }, | ||
| 3844 | "value": { | ||
| 3845 | "oneOf": [ | ||
| 3846 | { | ||
| 3847 | "type": "string", | ||
| 3848 | }, | ||
| 3849 | { | ||
| 3850 | "properties": { | ||
| 3851 | "eq": { | ||
| 3852 | "oneOf": [ | ||
| 3853 | { | ||
| 3854 | "type": "string", | ||
| 3855 | }, | ||
| 3856 | { | ||
| 3857 | "type": "number", | ||
| 3858 | }, | ||
| 3859 | ], | ||
| 3860 | }, | ||
| 3861 | "gt": { | ||
| 3862 | "type": "number", | ||
| 3863 | }, | ||
| 3864 | "gte": { | ||
| 3865 | "type": "number", | ||
| 3866 | }, | ||
| 3867 | "inc": { | ||
| 3868 | "items": { | ||
| 3869 | "type": "string", | ||
| 3870 | }, | ||
| 3871 | "type": "array", | ||
| 3872 | }, | ||
| 3873 | "lt": { | ||
| 3874 | "type": "number", | ||
| 3875 | }, | ||
| 3876 | "lte": { | ||
| 3877 | "type": "number", | ||
| 3878 | }, | ||
| 3879 | "neq": { | ||
| 3880 | "type": "string", | ||
| 3881 | }, | ||
| 3882 | "ninc": { | ||
| 3883 | "items": { | ||
| 3884 | "type": "string", | ||
| 3885 | }, | ||
| 3886 | "type": "array", | ||
| 3887 | }, | ||
| 3888 | "pre": { | ||
| 3889 | "type": "string", | ||
| 3890 | }, | ||
| 3891 | "re": { | ||
| 3892 | "type": "string", | ||
| 3893 | }, | ||
| 3894 | "suf": { | ||
| 3895 | "type": "string", | ||
| 3896 | }, | ||
| 3897 | }, | ||
| 3898 | "type": "object", | ||
| 3899 | }, | ||
| 3900 | ], | ||
| 3901 | }, | ||
| 3902 | }, | ||
| 3903 | "required": [ | ||
| 3904 | "key", | ||
| 3905 | "type", | ||
| 3906 | ], | ||
| 3907 | "type": "object", | ||
| 3908 | }, | ||
| 3909 | ], | ||
| 3910 | }, | ||
| 3911 | "type": "array", | ||
| 3912 | }, | ||
| 3913 | "mitigate": { | ||
| 3914 | "properties": { | ||
| 3915 | "action": { | ||
| 3916 | "enum": [ | ||
| 3917 | "challenge", | ||
| 3918 | "deny", | ||
| 3919 | ], | ||
| 3920 | "type": "string", | ||
| 3921 | }, | ||
| 3922 | }, | ||
| 3923 | "required": [ | ||
| 3924 | "action", | ||
| 3925 | ], | ||
| 3926 | "type": "object", | ||
| 3927 | }, | ||
| 3928 | "override": { | ||
| 3929 | "enum": [ | ||
| 3930 | false, | ||
| 3931 | true, | ||
| 3932 | ], | ||
| 3933 | "type": "boolean", | ||
| 3934 | }, | ||
| 3935 | "respectOriginCacheControl": { | ||
| 3936 | "enum": [ | ||
| 3937 | false, | ||
| 3938 | true, | ||
| 3939 | ], | ||
| 3940 | "type": "boolean", | ||
| 3941 | }, | ||
| 3942 | "source": { | ||
| 3943 | "description": "Aliases for \`src\`, \`dest\`, and \`status\`. These provide consistency with the \`rewrites\`, \`redirects\`, and \`headers\` fields which use \`source\`, \`destination\`, and \`statusCode\`. During normalization, these are converted to their canonical forms (\`src\`, \`dest\`, \`status\`) and stripped from the route object.", | ||
| 3944 | "type": "string", | ||
| 3945 | }, | ||
| 3946 | "src": { | ||
| 3947 | "type": "string", | ||
| 3948 | }, | ||
| 3949 | "status": { | ||
| 3950 | "type": "number", | ||
| 3951 | }, | ||
| 3952 | "statusCode": { | ||
| 3953 | "type": "number", | ||
| 3954 | }, | ||
| 3955 | "transforms": { | ||
| 3956 | "items": { | ||
| 3957 | "properties": { | ||
| 3958 | "args": { | ||
| 3959 | "oneOf": [ | ||
| 3960 | { | ||
| 3961 | "type": "string", | ||
| 3962 | }, | ||
| 3963 | { | ||
| 3964 | "items": { | ||
| 3965 | "type": "string", | ||
| 3966 | }, | ||
| 3967 | "type": "array", | ||
| 3968 | }, | ||
| 3969 | ], | ||
| 3970 | }, | ||
| 3971 | "env": { | ||
| 3972 | "items": { | ||
| 3973 | "type": "string", | ||
| 3974 | }, | ||
| 3975 | "type": "array", | ||
| 3976 | }, | ||
| 3977 | "op": { | ||
| 3978 | "enum": [ | ||
| 3979 | "append", | ||
| 3980 | "set", | ||
| 3981 | "delete", | ||
| 3982 | ], | ||
| 3983 | "type": "string", | ||
| 3984 | }, | ||
| 3985 | "target": { | ||
| 3986 | "properties": { | ||
| 3987 | "key": { | ||
| 3988 | "oneOf": [ | ||
| 3989 | { | ||
| 3990 | "type": "string", | ||
| 3991 | }, | ||
| 3992 | { | ||
| 3993 | "properties": { | ||
| 3994 | "eq": { | ||
| 3995 | "oneOf": [ | ||
| 3996 | { | ||
| 3997 | "type": "string", | ||
| 3998 | }, | ||
| 3999 | { | ||
| 4000 | "type": "number", | ||
| 4001 | }, | ||
| 4002 | ], | ||
| 4003 | }, | ||
| 4004 | "gt": { | ||
| 4005 | "type": "number", | ||
| 4006 | }, | ||
| 4007 | "gte": { | ||
| 4008 | "type": "number", | ||
| 4009 | }, | ||
| 4010 | "inc": { | ||
| 4011 | "items": { | ||
| 4012 | "type": "string", | ||
| 4013 | }, | ||
| 4014 | "type": "array", | ||
| 4015 | }, | ||
| 4016 | "lt": { | ||
| 4017 | "type": "number", | ||
| 4018 | }, | ||
| 4019 | "lte": { | ||
| 4020 | "type": "number", | ||
| 4021 | }, | ||
| 4022 | "neq": { | ||
| 4023 | "type": "string", | ||
| 4024 | }, | ||
| 4025 | "ninc": { | ||
| 4026 | "items": { | ||
| 4027 | "type": "string", | ||
| 4028 | }, | ||
| 4029 | "type": "array", | ||
| 4030 | }, | ||
| 4031 | "pre": { | ||
| 4032 | "type": "string", | ||
| 4033 | }, | ||
| 4034 | "suf": { | ||
| 4035 | "type": "string", | ||
| 4036 | }, | ||
| 4037 | }, | ||
| 4038 | "type": "object", | ||
| 4039 | }, | ||
| 4040 | ], | ||
| 4041 | }, | ||
| 4042 | }, | ||
| 4043 | "required": [ | ||
| 4044 | "key", | ||
| 4045 | ], | ||
| 4046 | "type": "object", | ||
| 4047 | }, | ||
| 4048 | "type": { | ||
| 4049 | "enum": [ | ||
| 4050 | "request.headers", | ||
| 4051 | "request.query", | ||
| 4052 | "response.headers", | ||
| 4053 | ], | ||
| 4054 | "type": "string", | ||
| 4055 | }, | ||
| 4056 | }, | ||
| 4057 | "required": [ | ||
| 4058 | "op", | ||
| 4059 | "target", | ||
| 4060 | "type", | ||
| 4061 | ], | ||
| 4062 | "type": "object", | ||
| 4063 | }, | ||
| 4064 | "type": "array", | ||
| 4065 | }, | ||
| 4066 | }, | ||
| 4067 | "required": [ | ||
| 4068 | "src", | ||
| 4069 | ], | ||
| 4070 | "type": "object", | ||
| 4071 | }, | ||
| 4072 | { | ||
| 4073 | "properties": { | ||
| 4074 | "dest": { | ||
| 4075 | "type": "string", | ||
| 4076 | }, | ||
| 4077 | "handle": { | ||
| 4078 | "enum": [ | ||
| 4079 | "error", | ||
| 4080 | "filesystem", | ||
| 4081 | "hit", | ||
| 4082 | "miss", | ||
| 4083 | "rewrite", | ||
| 4084 | "resource", | ||
| 4085 | ], | ||
| 4086 | "type": "string", | ||
| 4087 | }, | ||
| 4088 | "src": { | ||
| 4089 | "type": "string", | ||
| 4090 | }, | ||
| 4091 | "status": { | ||
| 4092 | "type": "number", | ||
| 4093 | }, | ||
| 4094 | }, | ||
| 4095 | "required": [ | ||
| 4096 | "handle", | ||
| 4097 | ], | ||
| 4098 | "type": "object", | ||
| 4099 | }, | ||
| 4100 | { | ||
| 4101 | "properties": { | ||
| 4102 | "continue": { | ||
| 4103 | "enum": [ | ||
| 4104 | false, | ||
| 4105 | true, | ||
| 4106 | ], | ||
| 4107 | "type": "boolean", | ||
| 4108 | }, | ||
| 4109 | "middleware": { | ||
| 4110 | "enum": [ | ||
| 4111 | 0, | ||
| 4112 | ], | ||
| 4113 | "type": "number", | ||
| 4114 | }, | ||
| 4115 | "src": { | ||
| 4116 | "type": "string", | ||
| 4117 | }, | ||
| 4118 | }, | ||
| 4119 | "required": [ | ||
| 4120 | "continue", | ||
| 4121 | "middleware", | ||
| 4122 | "src", | ||
| 4123 | ], | ||
| 4124 | "type": "object", | ||
| 4125 | }, | ||
| 4126 | ], | ||
| 4127 | }, | ||
| 4128 | "nullable": true, | ||
| 4129 | "type": "array", | ||
| 4130 | }, | ||
| 4131 | "seatBlock": { | ||
| 4132 | "description": "NSNB Blocked metadata", | ||
| 4133 | "properties": { | ||
| 4134 | "blockCode": { | ||
| 4135 | "description": "The NSNB decision code for the seat block. TODO: We should consolidate block types.", | ||
| 4136 | "enum": [ | ||
| 4137 | "TEAM_ACCESS_REQUIRED", | ||
| 4138 | "COMMIT_AUTHOR_REQUIRED", | ||
| 4139 | ], | ||
| 4140 | "type": "string", | ||
| 4141 | }, | ||
| 4142 | "gitProvider": { | ||
| 4143 | "description": "The git provider type associated with gitUserId.", | ||
| 4144 | "enum": [ | ||
| 4145 | "gitlab", | ||
| 4146 | "bitbucket", | ||
| 4147 | "github", | ||
| 4148 | ], | ||
| 4149 | "type": "string", | ||
| 4150 | }, | ||
| 4151 | "gitUserId": { | ||
| 4152 | "oneOf": [ | ||
| 4153 | { | ||
| 4154 | "type": "string", | ||
| 4155 | }, | ||
| 4156 | { | ||
| 4157 | "type": "number", | ||
| 4158 | }, | ||
| 4159 | ], | ||
| 4160 | }, | ||
| 4161 | "isVerified": { | ||
| 4162 | "description": "Determines if the user was verified during the block. In the git integration case, the commit sender was the author.", | ||
| 4163 | "enum": [ | ||
| 4164 | false, | ||
| 4165 | true, | ||
| 4166 | ], | ||
| 4167 | "type": "boolean", | ||
| 4168 | }, | ||
| 4169 | "userId": { | ||
| 4170 | "description": "The blocked vercel user ID.", | ||
| 4171 | "type": "string", | ||
| 4172 | }, | ||
| 4173 | }, | ||
| 4174 | "required": [ | ||
| 4175 | "blockCode", | ||
| 4176 | ], | ||
| 4177 | "type": "object", | ||
| 4178 | }, | ||
| 4179 | "softDeletedByRetention": { | ||
| 4180 | "description": "flag to indicate if the deployment was deleted by retention policy", | ||
| 4181 | "enum": [ | ||
| 4182 | false, | ||
| 4183 | true, | ||
| 4184 | ], | ||
| 4185 | "example": "true", | ||
| 4186 | "type": "boolean", | ||
| 4187 | }, | ||
| 4188 | "source": { | ||
| 4189 | "description": "Where was the deployment created from", | ||
| 4190 | "enum": [ | ||
| 4191 | "api-trigger-git-deploy", | ||
| 4192 | "cli", | ||
| 4193 | "clone/repo", | ||
| 4194 | "git", | ||
| 4195 | "import", | ||
| 4196 | "import/repo", | ||
| 4197 | "redeploy", | ||
| 4198 | "v0-web", | ||
| 4199 | ], | ||
| 4200 | "example": "cli", | ||
| 4201 | "type": "string", | ||
| 4202 | }, | ||
| 4203 | "status": { | ||
| 4204 | "enum": [ | ||
| 4205 | "QUEUED", | ||
| 4206 | "BUILDING", | ||
| 4207 | "ERROR", | ||
| 4208 | "BLOCKED", | ||
| 4209 | "INITIALIZING", | ||
| 4210 | "READY", | ||
| 4211 | "CANCELED", | ||
| 4212 | ], | ||
| 4213 | "type": "string", | ||
| 4214 | }, | ||
| 4215 | "target": { | ||
| 4216 | "description": "If defined, either \`staging\` if a staging alias in the format \`<project>.<team>.now.sh\` was assigned upon creation, or \`production\` if the aliases from \`alias\` were assigned. \`null\` value indicates the "preview" deployment.", | ||
| 4217 | "enum": [ | ||
| 4218 | "staging", | ||
| 4219 | "production", | ||
| 4220 | null, | ||
| 4221 | ], | ||
| 4222 | "example": null, | ||
| 4223 | "nullable": true, | ||
| 4224 | "type": "string", | ||
| 4225 | }, | ||
| 4226 | "team": { | ||
| 4227 | "description": "The team that owns the deployment if any", | ||
| 4228 | "properties": { | ||
| 4229 | "avatar": { | ||
| 4230 | "type": "string", | ||
| 4231 | }, | ||
| 4232 | "id": { | ||
| 4233 | "type": "string", | ||
| 4234 | }, | ||
| 4235 | "name": { | ||
| 4236 | "type": "string", | ||
| 4237 | }, | ||
| 4238 | "slug": { | ||
| 4239 | "type": "string", | ||
| 4240 | }, | ||
| 4241 | }, | ||
| 4242 | "required": [ | ||
| 4243 | "id", | ||
| 4244 | "name", | ||
| 4245 | "slug", | ||
| 4246 | ], | ||
| 4247 | "type": "object", | ||
| 4248 | }, | ||
| 4249 | "ttyBuildLogs": { | ||
| 4250 | "enum": [ | ||
| 4251 | false, | ||
| 4252 | true, | ||
| 4253 | ], | ||
| 4254 | "type": "boolean", | ||
| 4255 | }, | ||
| 4256 | "type": { | ||
| 4257 | "enum": [ | ||
| 4258 | "LAMBDAS", | ||
| 4259 | ], | ||
| 4260 | "type": "string", | ||
| 4261 | }, | ||
| 4262 | "undeletedAt": { | ||
| 4263 | "description": "A number containing the date when the deployment was undeleted at milliseconds", | ||
| 4264 | "example": 1540257589405, | ||
| 4265 | "type": "number", | ||
| 4266 | }, | ||
| 4267 | "url": { | ||
| 4268 | "description": "A string with the unique URL of the deployment", | ||
| 4269 | "example": "my-instant-deployment-3ij3cxz9qr.now.sh", | ||
| 4270 | "type": "string", | ||
| 4271 | }, | ||
| 4272 | "userAliases": { | ||
| 4273 | "description": "An array of domains that were provided by the user when creating the Deployment.", | ||
| 4274 | "example": [ | ||
| 4275 | "sub1.example.com", | ||
| 4276 | "sub2.example.com", | ||
| 4277 | ], | ||
| 4278 | "items": { | ||
| 4279 | "type": "string", | ||
| 4280 | }, | ||
| 4281 | "type": "array", | ||
| 4282 | }, | ||
| 4283 | "userConfiguredDeploymentId": { | ||
| 4284 | "description": "Since January 2025 User-configured deployment ID for skew protection with pre-built deployments. This is set when users configure a custom deploymentId in their next.config.js file. This allows Next.js to use skew protection even when deployments are pre-built outside of Vercel's build system.", | ||
| 4285 | "example": "abc123", | ||
| 4286 | "type": "string", | ||
| 4287 | }, | ||
| 4288 | "version": { | ||
| 4289 | "description": "The platform version that was used to create the deployment.", | ||
| 4290 | "enum": [ | ||
| 4291 | 2, | ||
| 4292 | ], | ||
| 4293 | "example": 2, | ||
| 4294 | "type": "number", | ||
| 4295 | }, | ||
| 4296 | }, | ||
| 4297 | "required": [ | ||
| 4298 | "aliasAssigned", | ||
| 4299 | "bootedAt", | ||
| 4300 | "build", | ||
| 4301 | "buildSkipped", | ||
| 4302 | "buildingAt", | ||
| 4303 | "createdAt", | ||
| 4304 | "createdIn", | ||
| 4305 | "creator", | ||
| 4306 | "env", | ||
| 4307 | "id", | ||
| 4308 | "inspectorUrl", | ||
| 4309 | "isInConcurrentBuildsQueue", | ||
| 4310 | "isInSystemBuildsQueue", | ||
| 4311 | "meta", | ||
| 4312 | "name", | ||
| 4313 | "ownerId", | ||
| 4314 | "plan", | ||
| 4315 | "projectId", | ||
| 4316 | "projectSettings", | ||
| 4317 | "public", | ||
| 4318 | "readyState", | ||
| 4319 | "regions", | ||
| 4320 | "routes", | ||
| 4321 | "status", | ||
| 4322 | "type", | ||
| 4323 | "url", | ||
| 4324 | "version", | ||
| 4325 | ], | ||
| 4326 | "type": "object", | ||
| 4327 | }, | ||
| 4328 | "outputTypeScript": "{ aliasAssignedAt?: number | false | true | null; alwaysRefuseToBuild?: false | true; build: { env: string[]; }; buildArtifactUrls?: string[]; builds?: { use: string; src?: string; config?: { [k: string]: unknown; }; }[]; env: string[]; inspectorUrl: string | null; isInConcurrentBuildsQueue: false | true; isInSystemBuildsQueue: false | true; projectSettings: { nodeVersion?: "24.x" | "22.x" | "20.x" | "18.x" | "16.x" | "14.x" | "12.x" | "10.x" | "8.10.x"; buildCommand?: string | null; devCommand?: string | null; framework?: "blitzjs" | "nextjs" | "gatsby" | "remix" | "react-router" | "astro" | "hexo" | "eleventy" | "docusaurus-2" | "docusaurus" | "preact" | "solidstart-1" | "solidstart" | "dojo" | "ember" | "vue" | "scully" | "ionic-angular" | "angular" | "polymer" | "svelte" | "sveltekit" | "sveltekit-1" | "ionic-react" | "create-react-app" | "gridsome" | "umijs" | "sapper" | "saber" | "stencil" | "nuxtjs" | "redwoodjs" | "hugo" | "jekyll" | "brunch" | "middleman" | "zola" | "hydrogen" | "vite" | "tanstack-start" | "vitepress" | "vuepress" | "parcel" | "fastapi" | "flask" | "fasthtml" | "django" | "ash" | "sanity-v3" | "sanity" | "storybook" | "nitro" | "hono" | "express" | "h3" | "koa" | "nestjs" | "elysia" | "fastify" | "xmcp" | "python" | "ruby" | "rust" | "axum" | "actix-web" | "node" | "go" | "services" | "mastra" | null; commandForIgnoringBuildStep?: string | null; installCommand?: string | null; outputDirectory?: string | null; speedInsights?: { id: string; enabledAt?: number; disabledAt?: number; canceledAt?: number; hasData?: false | true; paidAt?: number; }; webAnalytics?: { id: string; disabledAt?: number; canceledAt?: number; enabledAt?: number; hasData?: true; }; }; integrations?: { status: "skipped" | "pending" | "ready" | "error" | "timeout"; startedAt: number; claimedAt?: number; completedAt?: number; skippedAt?: number; skippedBy?: string; }; images?: { sizes?: number[]; qualities?: number[]; domains?: string[]; remotePatterns?: { protocol?: "http" | "https"; hostname: string; port?: string; pathname?: string; search?: string; }[]; localPatterns?: { pathname?: string; search?: string; }[]; minimumCacheTTL?: number; formats?: ("image/avif" | "image/webp")[]; dangerouslyAllowSVG?: false | true; contentSecurityPolicy?: string; contentDispositionType?: "inline" | "attachment"; }; alias?: string[]; aliasAssigned: false | true; bootedAt: number; buildingAt: number; buildContainerFinishedAt?: number; buildSkipped: false | true; creator: { uid: string; username?: string; avatar?: string; }; initReadyAt?: number; isFirstBranchDeployment?: false | true; lambdas?: { id: string; createdAt?: number; readyState?: "BUILDING" | "ERROR" | "INITIALIZING" | "READY"; entrypoint?: string | null; readyStateAt?: number; output: { path: string; functionName: string; }[]; }[]; public: false | true; ready?: number; status: "QUEUED" | "BUILDING" | "ERROR" | "BLOCKED" | "INITIALIZING" | "READY" | "CANCELED"; team?: { id: string; name: string; slug: string; avatar?: string; }; userAliases?: string[]; previewCommentsEnabled?: false | true; ttyBuildLogs?: false | true; customEnvironment?: { id: string; slug: string; type: "production" | "preview" | "development"; description?: string; branchMatcher?: { type: "endsWith" | "startsWith" | "equals"; pattern: string; }; domains?: { name: string; apexName: string; projectId: string; redirect?: string | null; redirectStatusCode?: 307 | 301 | 302 | 308 | null; gitBranch?: string | null; customEnvironmentId?: string | null; updatedAt?: number; createdAt?: number; verified: false | true; verification?: { type: string; domain: string; value: string; reason: string; }[]; }[]; currentDeploymentAliases?: string[]; createdAt: number; updatedAt: number; } | { id: string; }; oomReport?: "out-of-memory"; readyStateReason?: string; aliasWarning?: { code: string; message: string; link?: string; action?: string; } | null; id: string; createdAt: number; readyState: "QUEUED" | "BUILDING" | "ERROR" | "BLOCKED" | "INITIALIZING" | "READY" | "CANCELED"; name: string; type: "LAMBDAS"; aliasError?: { code: string; message: string; } | null; aliasFinal?: string | null; autoAssignCustomDomains?: false | true; automaticAliases?: string[]; buildErrorAt?: number; checksState?: "registered" | "running" | "completed"; checksConclusion?: "succeeded" | "failed" | "skipped" | "canceled"; deletedAt?: number | null; defaultRoute?: string; canceledAt?: number; errorCode?: string; errorLink?: string; errorMessage?: string | null; errorStep?: string; passiveRegions?: string[]; gitSource?: { type: "github"; repoId: string | number; ref?: string | null; sha?: string; prId?: number | null; } | { type: "github"; org: string; repo: string; ref?: string | null; sha?: string; prId?: number | null; } | { type: "github-custom-host"; host: string; repoId: string | number; ref?: string | null; sha?: string; prId?: number | null; } | { type: "github-custom-host"; host: string; org: string; repo: string; ref?: string | null; sha?: string; prId?: number | null; } | { type: "github-limited"; repoId: string | number; ref?: string | null; sha?: string; prId?: number | null; } | { type: "github-limited"; org: string; repo: string; ref?: string | null; sha?: string; prId?: number | null; } | { type: "gitlab"; projectId: string | number; ref?: string | null; sha?: string; prId?: number | null; } | { type: "bitbucket"; workspaceUuid?: string; repoUuid: string; ref?: string | null; sha?: string; prId?: number | null; } | { type: "bitbucket"; owner: string; slug: string; ref?: string | null; sha?: string; prId?: number | null; } | { type: "vercel"; org?: string; repo?: string; sha: string; repoPushedAt?: number; ref?: string | null; prId?: number | null; } | { type: "custom"; ref: string; sha: string; gitUrl: string; } | { type: "github"; ref: string; sha: string; repoId: number; org?: string; repo?: string; } | { type: "github-custom-host"; host: string; ref: string; sha: string; repoId: number; org?: string; repo?: string; } | { type: "github-limited"; ref: string; sha: string; repoId: number; org?: string; repo?: string; } | { type: "gitlab"; ref: string; sha: string; projectId: number; } | { type: "bitbucket"; ref: string; sha: string; owner?: string; slug?: string; workspaceUuid: string; repoUuid: string; } | { type: "vercel"; ref: string; sha: string; org: string; repo: string; repoPushedAt?: number; }; manualProvisioning?: { state: "PENDING" | "COMPLETE" | "TIMEOUT"; completedAt?: number; }; meta: { [k: string]: string; }; originCacheRegion?: string; nodeVersion?: "24.x" | "22.x" | "20.x" | "18.x" | "16.x" | "14.x" | "12.x" | "10.x" | "8.10.x"; project?: { id: string; name: string; framework?: string | null; }; prebuilt?: false | true; readySubstate?: "STAGED" | "ROLLING" | "PROMOTED"; regions: string[]; softDeletedByRetention?: false | true; source?: "api-trigger-git-deploy" | "cli" | "clone/repo" | "git" | "import" | "import/repo" | "redeploy" | "v0-web"; target?: "staging" | "production" | null; undeletedAt?: number; url: string; userConfiguredDeploymentId?: string; version: 2; oidcTokenClaims?: { iss: string; sub: string; scope: string; aud: string; owner: string; owner_id: string; project: string; project_id: string; environment: string; custom_environment_id?: string; plan?: string; }; projectId: string; plan: "pro" | "enterprise" | "hobby"; platform?: { source: { name: string; }; origin: { type: "id" | "url"; value: string; }; creator: { name: string; avatar?: string; }; meta?: { [k: string]: string; }; }; connectBuildsEnabled?: false | true; connectConfigurationId?: string; createdIn: string; crons?: { schedule: string; path: string; }[]; functions?: { [k: string]: { architecture?: "x86_64" | "arm64"; memory?: number; maxDuration?: number | "max"; regions?: string[]; functionFailoverRegions?: string[]; runtime?: string; includeFiles?: string; excludeFiles?: string; experimentalTriggers?: ({ type: "queue/v1beta"; consumer: string; topic: string; maxDeliveries?: number; retryAfterSeconds?: number; initialDelaySeconds?: number; maxConcurrency?: number; } | { type: "queue/v2beta"; topic: string; maxDeliveries?: number; retryAfterSeconds?: number; initialDelaySeconds?: number; maxConcurrency?: number; })[]; supportsCancellation?: false | true; }; } | null; monorepoManager?: string | null; ownerId: string; passiveConnectConfigurationId?: string; routes: ({ src: string; dest?: string; headers?: { [k: string]: string; }; methods?: string[]; continue?: (false | true); override?: (false | true); caseSensitive?: (false | true); check?: (false | true); important?: (false | true); status?: number; has?: ({ type: "host"; value: (string | { eq?: (string | number); neq?: string; inc?: string[]; ninc?: string[]; pre?: string; suf?: string; re?: string; gt?: number; gte?: number; lt?: number; lte?: number; }); } | { type: ("header" | "cookie" | "query"); key: string; value?: (string | { eq?: (string | number); neq?: string; inc?: string[]; ninc?: string[]; pre?: string; suf?: string; re?: string; gt?: number; gte?: number; lt?: number; lte?: number; }); })[]; missing?: ({ type: "host"; value: (string | { eq?: (string | number); neq?: string; inc?: string[]; ninc?: string[]; pre?: string; suf?: string; re?: string; gt?: number; gte?: number; lt?: number; lte?: number; }); } | { type: ("header" | "cookie" | "query"); key: string; value?: (string | { eq?: (string | number); neq?: string; inc?: string[]; ninc?: string[]; pre?: string; suf?: string; re?: string; gt?: number; gte?: number; lt?: number; lte?: number; }); })[]; mitigate?: { action: ("challenge" | "deny"); }; transforms?: { type: ("request.headers" | "request.query" | "response.headers"); op: ("append" | "set" | "delete"); target: { key: (string | { eq?: (string | number); neq?: string; inc?: string[]; ninc?: string[]; pre?: string; suf?: string; gt?: number; gte?: number; lt?: number; lte?: number; }); }; args?: (string | string[]); env?: string[]; }[]; env?: string[]; locale?: { redirect?: { [k: string]: string; }; cookie?: string; }; source?: string; destination?: string; statusCode?: number; middlewarePath?: string; middlewareRawSrc?: string[]; middleware?: number; respectOriginCacheControl?: (false | true); } | { handle: ("error" | "filesystem" | "hit" | "miss" | "rewrite" | "resource"); src?: string; dest?: string; status?: number; } | { src: string; continue: (false | true); middleware: 0; })[] | null; gitRepo?: { namespace: string; projectId: number; type: "gitlab"; url: string; path: string; defaultBranch: string; name: string; private: false | true; ownerType: "team" | "user"; } | { org: string; repo: string; repoId: number; type: "github"; repoOwnerId: number; path: string; defaultBranch: string; name: string; private: false | true; ownerType: "team" | "user"; } | { owner: string; repoUuid: string; slug: string; type: "bitbucket"; workspaceUuid: string; path: string; defaultBranch: string; name: string; private: false | true; ownerType: "team" | "user"; } | { org: string; repo: string; type: "vercel"; path: string; defaultBranch: string; name: string; private: false | true; ownerType: "team" | "user"; } | null; flags?: { definitions: { [k: string]: { options?: { value: FlagJSONValue; label?: string; }[]; url?: string; description?: string; }; }; } | { }[]; microfrontends?: { isDefaultApp?: false; defaultAppProjectName: string; defaultRoute?: string; groupIds: [string, ...(string)[]]; } | { isDefaultApp: true; mfeConfigUploadState?: "success" | "waiting_on_build" | "no_config"; defaultAppProjectName: string; defaultRoute?: string; groupIds: [string, ...(string)[]]; }; config?: { version?: number; functionType: "standard" | "fluid"; functionMemoryType: "standard" | "standard_legacy" | "performance"; functionTimeout: number | null; secureComputePrimaryRegion: string | null; secureComputeFallbackRegion: string | null; isUsingActiveCPU?: false | true; resourceConfig?: { buildQueue?: { configuration?: "SKIP_NAMESPACE_QUEUE" | "WAIT_FOR_NAMESPACE_QUEUE"; }; elasticConcurrency?: "TEAM_SETTING" | "PROJECT_SETTING" | "SKIP_QUEUE"; buildMachine?: { purchaseType?: "enhanced" | "turbo" | "standard" | null; }; }; }; checks?: { "deployment-alias": { state: "succeeded" | "failed" | "pending"; startedAt: number; completedAt?: number; }; }; seatBlock?: { blockCode: "TEAM_ACCESS_REQUIRED" | "COMMIT_AUTHOR_REQUIRED"; userId?: string; isVerified?: false | true; gitUserId?: string | number; gitProvider?: "gitlab" | "bitbucket" | "github"; }; attribution?: { commitMeta?: { email?: string; name?: string; isVerified?: false | true; }; gitUser?: { id: string | number; login: string; type?: string; provider?: string; }; vercelUser?: { id: string; username: string; teamRoles?: string[]; }; }; }", | ||
| 4329 | "schemaDefinitionCount": 1, | ||
| 4330 | "schemaDefinitionNames": [ | ||
| 4331 | "FlagJSONValue", | ||
| 4332 | ], | ||
| 4333 | "toolId": "vercel_api.deployments.createDeployment", | ||
| 4334 | "typeScriptDefinitionCount": 3, | ||
| 4335 | "typeScriptDefinitions": { | ||
| 4336 | "FlagJSONValue": "string | number | FlagJSONValue[] | { [k: string]: FlagJSONValue; } | false | true | null", | ||
| 4337 | "InlinedFile": "{ data: string; encoding?: "base64" | "utf-8"; file: string; }", | ||
| 4338 | "UploadedFile": "{ file: string; sha?: string; size?: number; }", | ||
| 4339 | }, | ||
| 4340 | } | ||
| 4341 | `; | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | import type { ConnectionId, ScopeId } from "@executor-js/sdk/core"; | 1 | import type { ConnectionId, ScopeId } from "@executor-js/sdk/shared"; |
| 2 | 2 | ||
| 3 | import { oauth2ClientSecretSlot } from "./store"; | 3 | import { oauth2ClientSecretSlot } from "./source-contracts"; |
| 4 | import type { ConfiguredHeaderValue, OpenApiSourceBindingValue } from "./types"; | 4 | import type { ConfiguredHeaderValue, OpenApiSourceBindingValue } from "./types"; |
| 5 | 5 | ||
| 6 | export type BindingRowForCredentialStatus = { | 6 | export type BindingRowForCredentialStatus = { |
| @@ -18,9 +18,8 @@ class OpenApiExtractionErrorFromParse extends OpenApiExtractionError {} · 17 unmodified lines | |||
| 18 | /** | 18 | /** |
| 19 | * Fetch an OpenAPI spec URL and return its body text. Uses the Effect | 19 | * Fetch an OpenAPI spec URL and return its body text. Uses the Effect |
| 20 | * HttpClient so the caller chooses the transport via layer — in Cloudflare | 20 | * HttpClient so the caller chooses the transport via layer — in Cloudflare |
| 21 | * Workers, `FetchHttpClient.layer` binds to the Workers-native `fetch` and | 21 | * Workers, `FetchHttpClient.layer` binds to the Workers-native `fetch`. |
| 22 | * avoids json-schema-ref-parser's Node-polyfill http resolver, which hangs | 22 | * Bounded by a 60s timeout. |
| 23 | * in production. Bounded by a 60s timeout. | ||
| 24 | */ | 23 | */ |
| 25 | export const fetchSpecText = Effect.fn("OpenApi.fetchSpecText")(function* ( | 24 | export const fetchSpecText = Effect.fn("OpenApi.fetchSpecText")(function* ( |
| 26 | url: string, | 25 | url: string, |
| @@ -11,9 +11,14 @@ import { FetchHttpClient } from "effect/unstable/http"; · 10 unmodified lines | |||
| 11 | import { readFileSync } from "node:fs"; | 11 | import { readFileSync } from "node:fs"; |
| 12 | import { resolve } from "node:path"; | 12 | import { resolve } from "node:path"; |
| 13 | 13 | ||
| 14 | import { createExecutor, Scope, ScopeId } from "@executor-js/sdk"; | ||
| 15 | import type { ToolSchema } from "@executor-js/sdk/core"; | ||
| 16 | import { makeTestConfig, memorySecretsPlugin } from "@executor-js/sdk/testing"; | ||
| 17 | |||
| 14 | import type { ParsedDocument } from "./parse"; | 18 | import type { ParsedDocument } from "./parse"; |
| 15 | import { parse } from "./parse"; | 19 | import { parse } from "./parse"; |
| 16 | import { extract } from "./extract"; | 20 | import { extract } from "./extract"; |
| 21 | import { openApiPlugin } from "./plugin"; | ||
| 17 | import { previewSpec as previewSpecRaw } from "./preview"; | 22 | import { previewSpec as previewSpecRaw } from "./preview"; |
| 18 | import type { ExtractionResult } from "./types"; | 23 | import type { ExtractionResult } from "./types"; |
| 19 | 24 | ||
| @@ -24,15 +29,19 @@ const previewSpec = (input: string) => · 4 unmodified lines | |||
| 24 | // Load + parse once, share across tests | 29 | // Load + parse once, share across tests |
| 25 | // --------------------------------------------------------------------------- | 30 | // --------------------------------------------------------------------------- |
| 26 | 31 | ||
| 27 | const specPath = resolve(__dirname, "../../fixtures/cloudflare.json"); | 32 | const cloudflareSpecPath = resolve(__dirname, "../../fixtures/cloudflare.json"); |
| 28 | const specText = readFileSync(specPath, "utf-8"); | 33 | const cloudflareSpecText = readFileSync(cloudflareSpecPath, "utf-8"); |
| 34 | const vercelSpecPath = resolve(__dirname, "../../fixtures/vercel.json"); | ||
| 35 | const vercelSpecText = readFileSync(vercelSpecPath, "utf-8"); | ||
| 29 | 36 | ||
| 30 | let cachedDoc: ParsedDocument | null = null; | 37 | let cachedDoc: ParsedDocument | null = null; |
| 31 | let cachedResult: ExtractionResult | null = null; | 38 | let cachedResult: ExtractionResult | null = null; |
| 39 | let cachedVercelDoc: ParsedDocument | null = null; | ||
| 40 | let cachedVercelResult: ExtractionResult | null = null; | ||
| 32 | 41 | ||
| 33 | const getDoc = () => | 42 | const getDoc = () => |
| 34 | Effect.gen(function* () { | 43 | Effect.gen(function* () { |
| 35 | if (!cachedDoc) cachedDoc = yield* parse(specText); | 44 | if (!cachedDoc) cachedDoc = yield* parse(cloudflareSpecText); |
| 36 | return cachedDoc; | 45 | return cachedDoc; |
| 37 | }); | 46 | }); |
| 38 | 47 | ||
| @@ -45,6 +54,95 @@ const getResult = () => · 6 unmodified lines | |||
| 45 | return cachedResult; | 54 | return cachedResult; |
| 46 | }); | 55 | }); |
| 47 | 56 | ||
| 57 | const getVercelDoc = () => | ||
| 58 | Effect.gen(function* () { | ||
| 59 | if (!cachedVercelDoc) cachedVercelDoc = yield* parse(vercelSpecText); | ||
| 60 | return cachedVercelDoc; | ||
| 61 | }); | ||
| 62 | |||
| 63 | const getVercelResult = () => | ||
| 64 | Effect.gen(function* () { | ||
| 65 | if (!cachedVercelResult) { | ||
| 66 | const doc = yield* getVercelDoc(); | ||
| 67 | cachedVercelResult = yield* extract(doc); | ||
| 68 | } | ||
| 69 | return cachedVercelResult; | ||
| 70 | }); | ||
| 71 | |||
| 72 | const TEST_SCOPE = "real-spec-baseline"; | ||
| 73 | const testScope = Scope.make({ | ||
| 74 | id: ScopeId.make(TEST_SCOPE), | ||
| 75 | name: "Real spec baseline", | ||
| 76 | createdAt: new Date(0), | ||
| 77 | }); | ||
| 78 | const schemaCache = new Map<string, ToolSchema>(); | ||
| 79 | |||
| 80 | const getRegisteredToolSchema = (namespace: string, specText: string, toolId: string) => | ||
| 81 | Effect.gen(function* () { | ||
| 82 | const cached = schemaCache.get(toolId); | ||
| 83 | if (cached) return cached; | ||
| 84 | |||
| 85 | const executor = yield* createExecutor( | ||
| 86 | makeTestConfig({ | ||
| 87 | scopes: [testScope], | ||
| 88 | plugins: [openApiPlugin(), memorySecretsPlugin()] as const, | ||
| 89 | }), | ||
| 90 | ); | ||
| 91 | |||
| 92 | yield* executor.openapi.addSpec({ | ||
| 93 | spec: specText, | ||
| 94 | scope: TEST_SCOPE, | ||
| 95 | namespace, | ||
| 96 | baseUrl: "", | ||
| 97 | }); | ||
| 98 | |||
| 99 | const schema = yield* executor.tools.schema(toolId); | ||
| 100 | expect(schema).not.toBeNull(); | ||
| 101 | schemaCache.set(toolId, schema!); | ||
| 102 | return schema!; | ||
| 103 | }); | ||
| 104 | |||
| 105 | const operationSummary = (result: ExtractionResult, operationId: string) => { | ||
| 106 | const op = result.operations.find((candidate) => candidate.operationId === operationId); | ||
| 107 | expect(op).toBeDefined(); | ||
| 108 | return { | ||
| 109 | operationId: op!.operationId, | ||
| 110 | method: op!.method, | ||
| 111 | pathTemplate: op!.pathTemplate, | ||
| 112 | tags: op!.tags, | ||
| 113 | hasInputSchema: Option.isSome(op!.inputSchema), | ||
| 114 | hasOutputSchema: Option.isSome(op!.outputSchema), | ||
| 115 | }; | ||
| 116 | }; | ||
| 117 | |||
| 118 | const extractionSummary = (result: ExtractionResult, selectedOperationIds: readonly string[]) => ({ | ||
| 119 | title: Option.getOrUndefined(result.title), | ||
| 120 | version: Option.getOrUndefined(result.version), | ||
| 121 | operationCount: result.operations.length, | ||
| 122 | inputSchemaOperationCount: result.operations.filter((op) => Option.isSome(op.inputSchema)).length, | ||
| 123 | outputSchemaOperationCount: result.operations.filter((op) => Option.isSome(op.outputSchema)) | ||
| 124 | .length, | ||
| 125 | selectedOperations: selectedOperationIds.map((operationId) => | ||
| 126 | operationSummary(result, operationId), | ||
| 127 | ), | ||
| 128 | }); | ||
| 129 | |||
| 130 | const schemaPreviewSummary = (schema: ToolSchema) => { | ||
| 131 | const schemaDefinitions = schema.schemaDefinitions ?? {}; | ||
| 132 | const typeScriptDefinitions = schema.typeScriptDefinitions ?? {}; | ||
| 133 | return { | ||
| 134 | toolId: schema.id, | ||
| 135 | inputSchema: schema.inputSchema, | ||
| 136 | outputSchema: schema.outputSchema, | ||
| 137 | inputTypeScript: schema.inputTypeScript, | ||
| 138 | outputTypeScript: schema.outputTypeScript, | ||
| 139 | schemaDefinitionCount: Object.keys(schemaDefinitions).length, | ||
| 140 | schemaDefinitionNames: Object.keys(schemaDefinitions).sort(), | ||
| 141 | typeScriptDefinitionCount: Object.keys(typeScriptDefinitions).length, | ||
| 142 | typeScriptDefinitions, | ||
| 143 | }; | ||
| 144 | }; | ||
| 145 | |||
| 48 | describe("Real specs: Cloudflare API", { timeout: 60_000 }, () => { | 146 | describe("Real specs: Cloudflare API", { timeout: 60_000 }, () => { |
| 49 | it.effect("parses the full Cloudflare spec", () => | 147 | it.effect("parses the full Cloudflare spec", () => |
| 50 | Effect.gen(function* () { | 148 | Effect.gen(function* () { |
| @@ -108,7 +206,7 @@ describe("Real specs: Cloudflare API", { timeout: 60_000 }, () => { · 57 unmodified lines | |||
| 108 | 206 | ||
| 109 | it.effect("previewSpec returns security schemes and header presets", () => | 207 | it.effect("previewSpec returns security schemes and header presets", () => |
| 110 | Effect.gen(function* () { | 208 | Effect.gen(function* () { |
| 111 | const preview = yield* previewSpec(specText); | 209 | const preview = yield* previewSpec(cloudflareSpecText); |
| 112 | 210 | ||
| 113 | expect(preview.operationCount).toBeGreaterThan(1000); | 211 | expect(preview.operationCount).toBeGreaterThan(1000); |
| 114 | expect(Option.isSome(preview.title)).toBe(true); | 212 | expect(Option.isSome(preview.title)).toBe(true); |
| @@ -133,4 +231,54 @@ describe("Real specs: Cloudflare API", { timeout: 60_000 }, () => { · 18 unmodified lines | |||
| 133 | expect(keyEmailPreset!.headers["X-Auth-Key"]).toBeNull(); | 231 | expect(keyEmailPreset!.headers["X-Auth-Key"]).toBeNull(); |
| 134 | }), | 232 | }), |
| 135 | ); | 233 | ); |
| 234 | |||
| 235 | it.effect("preserves extraction baseline for representative operations", () => | ||
| 236 | Effect.gen(function* () { | ||
| 237 | const result = yield* getResult(); | ||
| 238 | |||
| 239 | expect( | ||
| 240 | extractionSummary(result, [ | ||
| 241 | "access-applications-add-an-application", | ||
| 242 | "dns-records-for-a-zone-create-dns-record", | ||
| 243 | "worker-script-upload-worker-module", | ||
| 244 | ]), | ||
| 245 | ).toMatchSnapshot(); | ||
| 246 | }), | ||
| 247 | ); | ||
| 248 | |||
| 249 | it.effect("preserves registered tool schema and TypeScript output for Access app creation", () => | ||
| 250 | Effect.gen(function* () { | ||
| 251 | const schema = yield* getRegisteredToolSchema( | ||
| 252 | "cloudflare_api", | ||
| 253 | cloudflareSpecText, | ||
| 254 | "cloudflare_api.accessApplications.accessApplicationsAddAnApplication", | ||
| 255 | ); | ||
| 256 | |||
| 257 | expect(schemaPreviewSummary(schema)).toMatchSnapshot(); | ||
| 258 | }), | ||
| 259 | ); | ||
| 260 | }); | ||
| 261 | |||
| 262 | describe("Real specs: Vercel API", { timeout: 60_000 }, () => { | ||
| 263 | it.effect("preserves extraction baseline for representative operations", () => | ||
| 264 | Effect.gen(function* () { | ||
| 265 | const result = yield* getVercelResult(); | ||
| 266 | |||
| 267 | expect( | ||
| 268 | extractionSummary(result, ["createDeployment", "createProject", "updateProject"]), | ||
| 269 | ).toMatchSnapshot(); | ||
| 270 | }), | ||
| 271 | ); | ||
| 272 | |||
| 273 | it.effect("preserves registered tool schema and TypeScript output for deployment creation", () => | ||
| 274 | Effect.gen(function* () { | ||
| 275 | const schema = yield* getRegisteredToolSchema( | ||
| 276 | "vercel_api", | ||
| 277 | vercelSpecText, | ||
| 278 | "vercel_api.deployments.createDeployment", | ||
| 279 | ); | ||
| 280 | |||
| 281 | expect(schemaPreviewSummary(schema)).toMatchSnapshot(); | ||
| 282 | }), | ||
| 283 | ); | ||
| 136 | }); | 284 | }); |
| @@ -0,0 +1,51 @@ | |||
| 1 | import { Schema } from "effect"; | ||
| 2 | |||
| 3 | import { ConfiguredHeaderValue, OAuth2SourceConfig } from "./types"; | ||
| 4 | |||
| 5 | export const StoredSourceSchema = Schema.Struct({ | ||
| 6 | namespace: Schema.String, | ||
| 7 | scope: Schema.String, | ||
| 8 | name: Schema.String, | ||
| 9 | config: Schema.Struct({ | ||
| 10 | spec: Schema.optional(Schema.String), | ||
| 11 | sourceUrl: Schema.optional(Schema.String), | ||
| 12 | baseUrl: Schema.optional(Schema.String), | ||
| 13 | namespace: Schema.optional(Schema.String), | ||
| 14 | headers: Schema.optional(Schema.Record(Schema.String, ConfiguredHeaderValue)), | ||
| 15 | queryParams: Schema.optional(Schema.Record(Schema.String, ConfiguredHeaderValue)), | ||
| 16 | specFetchCredentials: Schema.optional( | ||
| 17 | Schema.Struct({ | ||
| 18 | headers: Schema.optional(Schema.Record(Schema.String, ConfiguredHeaderValue)), | ||
| 19 | queryParams: Schema.optional(Schema.Record(Schema.String, ConfiguredHeaderValue)), | ||
| 20 | }), | ||
| 21 | ), | ||
| 22 | // Canonical source-owned OAuth config. Concrete client credentials | ||
| 23 | // and connection ids live in OpenAPI-owned scoped binding rows. | ||
| 24 | oauth2: Schema.optional(OAuth2SourceConfig), | ||
| 25 | }), | ||
| 26 | }).annotate({ identifier: "OpenApiStoredSource" }); | ||
| 27 | export type StoredSourceSchema = typeof StoredSourceSchema.Type; | ||
| 28 | |||
| 29 | export type StoredSourceSchemaType = typeof StoredSourceSchema.Type; | ||
| 30 | |||
| 31 | const slugifySlotPart = (value: string): string => | ||
| 32 | value | ||
| 33 | .trim() | ||
| 34 | .toLowerCase() | ||
| 35 | .replace(/[^a-z0-9]+/g, "-") | ||
| 36 | .replace(/^-+|-+$/g, "") || "default"; | ||
| 37 | |||
| 38 | export const headerBindingSlot = (headerName: string): string => | ||
| 39 | `header:${slugifySlotPart(headerName)}`; | ||
| 40 | |||
| 41 | export const queryParamBindingSlot = (name: string): string => | ||
| 42 | `query_param:${slugifySlotPart(name)}`; | ||
| 43 | |||
| 44 | export const oauth2ClientIdSlot = (securitySchemeName: string): string => | ||
| 45 | `oauth2:${slugifySlotPart(securitySchemeName)}:client-id`; | ||
| 46 | |||
| 47 | export const oauth2ClientSecretSlot = (securitySchemeName: string): string => | ||
| 48 | `oauth2:${slugifySlotPart(securitySchemeName)}:client-secret`; | ||
| 49 | |||
| 50 | export const oauth2ConnectionSlot = (securitySchemeName: string): string => | ||
| 51 | `oauth2:${slugifySlotPart(securitySchemeName)}:connection`; | ||
| @@ -18,6 +18,15 @@ import { · 17 unmodified lines | |||
| 18 | OAuth2SourceConfig, | 18 | OAuth2SourceConfig, |
| 19 | OperationBinding, | 19 | OperationBinding, |
| 20 | } from "./types"; | 20 | } from "./types"; |
| 21 | export { | ||
| 22 | StoredSourceSchema, | ||
| 23 | type StoredSourceSchemaType, | ||
| 24 | headerBindingSlot, | ||
| 25 | oauth2ClientIdSlot, | ||
| 26 | oauth2ClientSecretSlot, | ||
| 27 | oauth2ConnectionSlot, | ||
| 28 | queryParamBindingSlot, | ||
| 29 | } from "./source-contracts"; | ||
| 21 | 30 | ||
| 22 | // --------------------------------------------------------------------------- | 31 | // --------------------------------------------------------------------------- |
| 23 | // Schema: | 32 | // Schema: |
| @@ -123,37 +132,6 @@ export interface StoredSource { · 99 unmodified lines | |||
| 123 | readonly config: SourceConfig; | 132 | readonly config: SourceConfig; |
| 124 | } | 133 | } |
| 125 | 134 | ||
| 126 | // --------------------------------------------------------------------------- | ||
| 127 | // Schema-class mirror of StoredSource for the API layer, where we need | ||
| 128 | // an encodable/decodable shape for HTTP responses. | ||
| 129 | // --------------------------------------------------------------------------- | ||
| 130 | |||
| 131 | export const StoredSourceSchema = Schema.Struct({ | ||
| 132 | namespace: Schema.String, | ||
| 133 | scope: Schema.String, | ||
| 134 | name: Schema.String, | ||
| 135 | config: Schema.Struct({ | ||
| 136 | spec: Schema.String, | ||
| 137 | sourceUrl: Schema.optional(Schema.String), | ||
| 138 | baseUrl: Schema.optional(Schema.String), | ||
| 139 | namespace: Schema.optional(Schema.String), | ||
| 140 | headers: Schema.optional(Schema.Record(Schema.String, ConfiguredHeaderValue)), | ||
| 141 | queryParams: Schema.optional(Schema.Record(Schema.String, ConfiguredHeaderValue)), | ||
| 142 | specFetchCredentials: Schema.optional( | ||
| 143 | Schema.Struct({ | ||
| 144 | headers: Schema.optional(Schema.Record(Schema.String, ConfiguredHeaderValue)), | ||
| 145 | queryParams: Schema.optional(Schema.Record(Schema.String, ConfiguredHeaderValue)), | ||
| 146 | }), | ||
| 147 | ), | ||
| 148 | // Canonical source-owned OAuth config. Concrete client credentials | ||
| 149 | // and connection ids live in OpenAPI-owned scoped binding rows. | ||
| 150 | oauth2: Schema.optional(OAuth2SourceConfig), | ||
| 151 | }), | ||
| 152 | }).annotate({ identifier: "OpenApiStoredSource" }); | ||
| 153 | export type StoredSourceSchema = typeof StoredSourceSchema.Type; | ||
| 154 | |||
| 155 | export type StoredSourceSchemaType = typeof StoredSourceSchema.Type; | ||
| 156 | |||
| 157 | export interface StoredOperation { | 135 | export interface StoredOperation { |
| 158 | readonly toolId: string; | 136 | readonly toolId: string; |
| 159 | readonly sourceId: string; | 137 | readonly sourceId: string; |
| @@ -281,28 +259,6 @@ const childRowsToValueMap = ( · 121 unmodified lines | |||
| 281 | 259 | ||
| 282 | const toJsonRecord = (value: unknown): Record<string, unknown> => value as Record<string, unknown>; | 260 | const toJsonRecord = (value: unknown): Record<string, unknown> => value as Record<string, unknown>; |
| 283 | 261 | ||
| 284 | const slugifySlotPart = (value: string): string => | ||
| 285 | value | ||
| 286 | .trim() | ||
| 287 | .toLowerCase() | ||
| 288 | .replace(/[^a-z0-9]+/g, "-") | ||
| 289 | .replace(/^-+|-+$/g, "") || "default"; | ||
| 290 | |||
| 291 | export const headerBindingSlot = (headerName: string): string => | ||
| 292 | `header:${slugifySlotPart(headerName)}`; | ||
| 293 | |||
| 294 | export const queryParamBindingSlot = (name: string): string => | ||
| 295 | `query_param:${slugifySlotPart(name)}`; | ||
| 296 | |||
| 297 | export const oauth2ClientIdSlot = (securitySchemeName: string): string => | ||
| 298 | `oauth2:${slugifySlotPart(securitySchemeName)}:client-id`; | ||
| 299 | |||
| 300 | export const oauth2ClientSecretSlot = (securitySchemeName: string): string => | ||
| 301 | `oauth2:${slugifySlotPart(securitySchemeName)}:client-secret`; | ||
| 302 | |||
| 303 | export const oauth2ConnectionSlot = (securitySchemeName: string): string => | ||
| 304 | `oauth2:${slugifySlotPart(securitySchemeName)}:connection`; | ||
| 305 | |||
| 306 | const normalizeStoredOAuth2 = (value: unknown): OAuth2SourceConfig | undefined => { | 262 | const normalizeStoredOAuth2 = (value: unknown): OAuth2SourceConfig | undefined => { |
| 307 | if (value == null) return undefined; | 263 | if (value == null) return undefined; |
| 308 | const sourceConfig = | 264 | const sourceConfig = |
| @@ -5,7 +5,7 @@ import { · 4 unmodified lines | |||
| 5 | ScopedSecretCredentialInput, | 5 | ScopedSecretCredentialInput, |
| 6 | SecretBackedValue, | 6 | SecretBackedValue, |
| 7 | SecretId, | 7 | SecretId, |
| 8 | } from "@executor-js/sdk/core"; | 8 | } from "@executor-js/sdk/shared"; |
| 9 | 9 | ||
| 10 | // --------------------------------------------------------------------------- | 10 | // --------------------------------------------------------------------------- |
| 11 | // Branded IDs | 11 | // Branded IDs |
| @@ -4,7 +4,7 @@ import { · 3 unmodified lines | |||
| 4 | type ScopeId, | 4 | type ScopeId, |
| 5 | type SecretId, | 5 | type SecretId, |
| 6 | type ToolId, | 6 | type ToolId, |
| 7 | } from "@executor-js/sdk"; | 7 | } from "@executor-js/sdk/shared"; |
| 8 | import * as Atom from "effect/unstable/reactivity/Atom"; | 8 | import * as Atom from "effect/unstable/reactivity/Atom"; |
| 9 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 9 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 10 | 10 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | import * as AtomHttpApi from "effect/unstable/reactivity/AtomHttpApi"; | 1 | import * as AtomHttpApi from "effect/unstable/reactivity/AtomHttpApi"; |
| 2 | import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http"; | 2 | import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http"; |
| 3 | import * as HttpClientError from "effect/unstable/http/HttpClientError"; | 3 | import * as HttpClientError from "effect/unstable/http/HttpClientError"; |
| 4 | import { ExecutorApi } from "@executor-js/api"; | 4 | import { ExecutorApi } from "@executor-js/api/client"; |
| 5 | import * as Cause from "effect/Cause"; | 5 | import * as Cause from "effect/Cause"; |
| 6 | import * as Effect from "effect/Effect"; | 6 | import * as Effect from "effect/Effect"; |
| 7 | import * as Option from "effect/Option"; | 7 | import * as Option from "effect/Option"; |
| @@ -11,10 +11,10 @@ · 10 unmodified lines | |||
| 11 | import { | 11 | import { |
| 12 | isOAuthPopupResult as sharedIsOAuthPopupResult, | 12 | isOAuthPopupResult as sharedIsOAuthPopupResult, |
| 13 | type OAuthPopupResult, | 13 | type OAuthPopupResult, |
| 14 | } from "@executor-js/sdk"; | 14 | } from "@executor-js/sdk/shared"; |
| 15 | 15 | ||
| 16 | export { OAUTH_POPUP_MESSAGE_TYPE } from "@executor-js/sdk"; | 16 | export { OAUTH_POPUP_MESSAGE_TYPE } from "@executor-js/sdk/shared"; |
| 17 | export type { OAuthPopupResult } from "@executor-js/sdk"; | 17 | export type { OAuthPopupResult } from "@executor-js/sdk/shared"; |
| 18 | 18 | ||
| 19 | export const isOAuthPopupResult = sharedIsOAuthPopupResult; | 19 | export const isOAuthPopupResult = sharedIsOAuthPopupResult; |
| 20 | 20 | ||
| @@ -2,7 +2,7 @@ import * as React from "react"; · 1 unmodified line | |||
| 2 | import { useAtomValue } from "@effect/atom-react"; | 2 | import { useAtomValue } from "@effect/atom-react"; |
| 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 4 | 4 | ||
| 5 | import type { ScopeId } from "@executor-js/sdk"; | 5 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 6 | import { scopeAtom } from "./atoms"; | 6 | import { scopeAtom } from "./atoms"; |
| 7 | 7 | ||
| 8 | export interface ScopeStackEntry { | 8 | export interface ScopeStackEntry { |
| @@ -1,4 +1,4 @@ | |||
| 1 | import { useState, useCallback } from "react"; | 1 | import { useState, useCallback, useMemo } from "react"; |
| 2 | import { ChevronRight } from "lucide-react"; | 2 | import { ChevronRight } from "lucide-react"; |
| 3 | import { CardStack, CardStackHeader, CardStackContent } from "./card-stack"; | 3 | import { CardStack, CardStackHeader, CardStackContent } from "./card-stack"; |
| 4 | 4 | ||
| @@ -422,15 +422,36 @@ const countTopLevelFields = (schema: JsonSchema): number => { · 417 unmodified lines | |||
| 422 | // SchemaExplorer — main export | 422 | // SchemaExplorer — main export |
| 423 | // --------------------------------------------------------------------------- | 423 | // --------------------------------------------------------------------------- |
| 424 | 424 | ||
| 425 | export function SchemaExplorer(props: { schema: unknown; title?: string }) { | 425 | const asSchemaDefinitions = (value: unknown): Record<string, JsonSchema> | undefined => |
| 426 | const schema = props.schema as JsonSchema | undefined; | 426 | value && typeof value === "object" && !Array.isArray(value) |
| 427 | if (!schema) return null; | 427 | ? (value as Record<string, JsonSchema>) |
| 428 | : undefined; | ||
| 428 | 429 | ||
| 429 | const hasContent = isExpandable(schema, schema); | 430 | export function SchemaExplorer(props: { |
| 431 | schema: unknown; | ||
| 432 | schemaDefinitions?: unknown; | ||
| 433 | title?: string; | ||
| 434 | }) { | ||
| 435 | const schema = props.schema as JsonSchema | undefined; | ||
| 436 | const root = useMemo(() => { | ||
| 437 | if (!schema) return undefined; | ||
| 438 | const sharedDefs = asSchemaDefinitions(props.schemaDefinitions); | ||
| 439 | if (!sharedDefs && !schema.$defs) return schema; | ||
| 440 | return { | ||
| 441 | ...schema, | ||
| 442 | $defs: { | ||
| 443 | ...sharedDefs, | ||
| 444 | ...schema.$defs, | ||
| 445 | }, | ||
| 446 | }; | ||
| 447 | }, [schema, props.schemaDefinitions]); | ||
| 448 | if (!schema || !root) return null; | ||
| 449 | |||
| 450 | const hasContent = isExpandable(schema, root); | ||
| 430 | const title = props.title; | 451 | const title = props.title; |
| 431 | 452 | ||
| 432 | if (!hasContent) { | 453 | if (!hasContent) { |
| 433 | const typeLabel = getTypeLabel(schema, schema); | 454 | const typeLabel = getTypeLabel(schema, root); |
| 434 | return ( | 455 | return ( |
| 435 | <CardStack> | 456 | <CardStack> |
| 436 | {title && <CardStackHeader>{title}</CardStackHeader>} | 457 | {title && <CardStackHeader>{title}</CardStackHeader>} |
| @@ -443,7 +464,7 @@ export function SchemaExplorer(props: { schema: unknown; title?: string }) { · 6 unmodified lines | |||
| 443 | ); | 464 | ); |
| 444 | } | 465 | } |
| 445 | 466 | ||
| 446 | const fieldCount = countTopLevelFields(schema); | 467 | const fieldCount = countTopLevelFields(root); |
| 447 | const countLabel = | 468 | const countLabel = |
| 448 | fieldCount > 0 ? `${fieldCount} ${fieldCount === 1 ? "field" : "fields"}` : null; | 469 | fieldCount > 0 ? `${fieldCount} ${fieldCount === 1 ? "field" : "fields"}` : null; |
| 449 | 470 | ||
| @@ -463,7 +484,7 @@ export function SchemaExplorer(props: { schema: unknown; title?: string }) { · 13 unmodified lines | |||
| 463 | </CardStackHeader> | 484 | </CardStackHeader> |
| 464 | )} | 485 | )} |
| 465 | <CardStackContent> | 486 | <CardStackContent> |
| 466 | <PropertyChildren schema={schema} root={schema} depth={0} /> | 487 | <PropertyChildren schema={schema} root={root} depth={0} /> |
| 467 | </CardStackContent> | 488 | </CardStackContent> |
| 468 | </CardStack> | 489 | </CardStack> |
| 469 | ); | 490 | ); |
| @@ -2,7 +2,12 @@ import { useMemo, useState } from "react"; · 1 unmodified line | |||
| 2 | import { useAtomValue } from "@effect/atom-react"; | 2 | import { useAtomValue } from "@effect/atom-react"; |
| 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 4 | import { toolSchemaAtom } from "../api/atoms"; | 4 | import { toolSchemaAtom } from "../api/atoms"; |
| 5 | import { ScopeId, ToolId, type EffectivePolicy, type ToolPolicyAction } from "@executor-js/sdk"; | 5 | import { |
| 6 | ScopeId, | ||
| 7 | ToolId, | ||
| 8 | type EffectivePolicy, | ||
| 9 | type ToolPolicyAction, | ||
| 10 | } from "@executor-js/sdk/shared"; | ||
| 6 | import { Badge } from "./badge"; | 11 | import { Badge } from "./badge"; |
| 7 | import { Button } from "./button"; | 12 | import { Button } from "./button"; |
| 8 | import { | 13 | import { |
| @@ -89,7 +94,6 @@ const breadcrumbParts = (name: string): string[] => · 80 unmodified lines | |||
| 89 | export function ToolDetail(props: { | 94 | export function ToolDetail(props: { |
| 90 | toolId: string; | 95 | toolId: string; |
| 91 | toolName: string; | 96 | toolName: string; |
| 92 | toolDescription?: string; | ||
| 93 | scopeId: ScopeId; | 97 | scopeId: ScopeId; |
| 94 | /** Resolved effective policy — user-authored or plugin-default, | 98 | /** Resolved effective policy — user-authored or plugin-default, |
| 95 | * unified into one shape. Surfaces in the header. */ | 99 | * unified into one shape. Surfaces in the header. */ |
| @@ -111,8 +115,10 @@ export function ToolDetail(props: { · 15 unmodified lines | |||
| 111 | })); | 115 | })); |
| 112 | 116 | ||
| 113 | return { | 117 | return { |
| 118 | description: v.description, | ||
| 114 | inputSchema: v.inputSchema, | 119 | inputSchema: v.inputSchema, |
| 115 | outputSchema: v.outputSchema, | 120 | outputSchema: v.outputSchema, |
| 121 | schemaDefinitions: v.schemaDefinitions, | ||
| 116 | inputTypeScript: v.inputTypeScript ? `type Input = ${v.inputTypeScript}` : null, | 122 | inputTypeScript: v.inputTypeScript ? `type Input = ${v.inputTypeScript}` : null, |
| 117 | outputTypeScript: v.outputTypeScript ? `type Output = ${v.outputTypeScript}` : null, | 123 | outputTypeScript: v.outputTypeScript ? `type Output = ${v.outputTypeScript}` : null, |
| 118 | definitions, | 124 | definitions, |
| @@ -147,9 +153,9 @@ export function ToolDetail(props: { · 28 unmodified lines | |||
| 147 | onClearPolicy={props.onClearPolicy} | 153 | onClearPolicy={props.onClearPolicy} |
| 148 | /> | 154 | /> |
| 149 | </div> | 155 | </div> |
| 150 | {props.toolDescription && ( | 156 | {data?.description && ( |
| 151 | <div className="mt-1.5 max-w-lg text-sm text-muted-foreground line-clamp-2"> | 157 | <div className="mt-1.5 max-w-lg text-sm text-muted-foreground line-clamp-2"> |
| 152 | <Markdown>{props.toolDescription}</Markdown> | 158 | <Markdown>{data.description}</Markdown> |
| 153 | </div> | 159 | </div> |
| 154 | )} | 160 | )} |
| 155 | 161 | ||
| @@ -196,47 +202,30 @@ export function ToolDetail(props: { · 40 unmodified lines | |||
| 196 | tab === "schema" ? ( | 202 | tab === "schema" ? ( |
| 197 | <div className="px-5 py-5 space-y-5"> | 203 | <div className="px-5 py-5 space-y-5"> |
| 198 | {data?.inputSchema ? ( | 204 | {data?.inputSchema ? ( |
| 199 | <SchemaExplorer schema={data.inputSchema} title="Parameters" /> | 205 | <SchemaExplorer |
| 206 | schema={data.inputSchema} | ||
| 207 | schemaDefinitions={data.schemaDefinitions} | ||
| 208 | title="Parameters" | ||
| 209 | /> | ||
| 200 | ) : ( | 210 | ) : ( |
| 201 | <EmptySection title="Parameters" message="None" /> | 211 | <EmptySection title="Parameters" message="None" /> |
| 202 | )} | 212 | )} |
| 203 | {data?.outputSchema ? ( | 213 | {data?.outputSchema ? ( |
| 204 | <SchemaExplorer schema={data.outputSchema} title="Response" /> | 214 | <SchemaExplorer |
| 215 | schema={data.outputSchema} | ||
| 216 | schemaDefinitions={data.schemaDefinitions} | ||
| 217 | title="Response" | ||
| 218 | /> | ||
| 205 | ) : ( | 219 | ) : ( |
| 206 | <EmptySection title="Response" message="None" /> | 220 | <EmptySection title="Response" message="None" /> |
| 207 | )} | 221 | )} |
| 208 | </div> | 222 | </div> |
| 209 | ) : ( | 223 | ) : ( |
| 210 | <div className="px-5 py-5 space-y-5"> | 224 | <ToolTypeScriptPanel |
| 211 | {data?.inputTypeScript ? ( | 225 | inputTypeScript={data?.inputTypeScript ?? null} |
| 212 | <CardStack> | 226 | outputTypeScript={data?.outputTypeScript ?? null} |
| 213 | <CardStackHeader>Input</CardStackHeader> | 227 | definitions={data?.definitions ?? []} |
| 214 | <CardStackContent> | 228 | /> |
| 215 | <ExpandableCodeBlock | ||
| 216 | code={data.inputTypeScript} | ||
| 217 | definitions={data.definitions} | ||
| 218 | className="rounded-none border-0" | ||
| 219 | /> | ||
| 220 | </CardStackContent> | ||
| 221 | </CardStack> | ||
| 222 | ) : ( | ||
| 223 | <EmptySection title="Input" message="void" /> | ||
| 224 | )} | ||
| 225 | {data?.outputTypeScript ? ( | ||
| 226 | <CardStack> | ||
| 227 | <CardStackHeader>Output</CardStackHeader> | ||
| 228 | <CardStackContent> | ||
| 229 | <ExpandableCodeBlock | ||
| 230 | code={data.outputTypeScript} | ||
| 231 | definitions={data.definitions} | ||
| 232 | className="rounded-none border-0" | ||
| 233 | /> | ||
| 234 | </CardStackContent> | ||
| 235 | </CardStack> | ||
| 236 | ) : ( | ||
| 237 | <EmptySection title="Output" message="void" /> | ||
| 238 | )} | ||
| 239 | </div> | ||
| 240 | ), | 229 | ), |
| 241 | })} | 230 | })} |
| 242 | </div> | 231 | </div> |
| @@ -244,6 +233,45 @@ export function ToolDetail(props: { · 1 unmodified line | |||
| 244 | ); | 233 | ); |
| 245 | } | 234 | } |
| 246 | 235 | ||
| 236 | function ToolTypeScriptPanel(props: { | ||
| 237 | inputTypeScript: string | null; | ||
| 238 | outputTypeScript: string | null; | ||
| 239 | definitions: ReadonlyArray<{ name: string; code: string }>; | ||
| 240 | }) { | ||
| 241 | return ( | ||
| 242 | <div className="px-5 py-5 space-y-5"> | ||
| 243 | {props.inputTypeScript ? ( | ||
| 244 | <CardStack> | ||
| 245 | <CardStackHeader>Input</CardStackHeader> | ||
| 246 | <CardStackContent> | ||
| 247 | <ExpandableCodeBlock | ||
| 248 | code={props.inputTypeScript} | ||
| 249 | definitions={props.definitions} | ||
| 250 | className="rounded-none border-0" | ||
| 251 | /> | ||
| 252 | </CardStackContent> | ||
| 253 | </CardStack> | ||
| 254 | ) : ( | ||
| 255 | <EmptySection title="Input" message="void" /> | ||
| 256 | )} | ||
| 257 | {props.outputTypeScript ? ( | ||
| 258 | <CardStack> | ||
| 259 | <CardStackHeader>Output</CardStackHeader> | ||
| 260 | <CardStackContent> | ||
| 261 | <ExpandableCodeBlock | ||
| 262 | code={props.outputTypeScript} | ||
| 263 | definitions={props.definitions} | ||
| 264 | className="rounded-none border-0" | ||
| 265 | /> | ||
| 266 | </CardStackContent> | ||
| 267 | </CardStack> | ||
| 268 | ) : ( | ||
| 269 | <EmptySection title="Output" message="void" /> | ||
| 270 | )} | ||
| 271 | </div> | ||
| 272 | ); | ||
| 273 | } | ||
| 274 | |||
| 247 | // --------------------------------------------------------------------------- | 275 | // --------------------------------------------------------------------------- |
| 248 | // PolicyBadgeMenu — clickable header badge that opens the same | 276 | // PolicyBadgeMenu — clickable header badge that opens the same |
| 249 | // Always run / Require approval / Block / Clear menu the tree row uses. | 277 | // Always run / Require approval / Block / Clear menu the tree row uses. |
| @@ -1,6 +1,6 @@ | |||
| 1 | import { useEffect, useMemo, useRef, useState } from "react"; | 1 | import { useEffect, useMemo, useRef, useState } from "react"; |
| 2 | import { ChevronRightIcon, MoreHorizontalIcon, SearchIcon, XIcon } from "lucide-react"; | 2 | import { ChevronRightIcon, MoreHorizontalIcon, SearchIcon, XIcon } from "lucide-react"; |
| 3 | import type { EffectivePolicy, ToolPolicyAction } from "@executor-js/sdk"; | 3 | import type { EffectivePolicy, ToolPolicyAction } from "@executor-js/sdk/shared"; |
| 4 | import { Button } from "./button"; | 4 | import { Button } from "./button"; |
| 5 | import { Input } from "./input"; | 5 | import { Input } from "./input"; |
| 6 | import { | 6 | import { |
| @@ -26,7 +26,6 @@ import { · 19 unmodified lines | |||
| 26 | export interface ToolSummary { | 26 | export interface ToolSummary { |
| 27 | readonly id: string; | 27 | readonly id: string; |
| 28 | readonly name: string; | 28 | readonly name: string; |
| 29 | readonly pluginKey: string; | ||
| 30 | readonly description?: string; | 29 | readonly description?: string; |
| 31 | /** Resolved policy for this tool — combines user-authored rules and | 30 | /** Resolved policy for this tool — combines user-authored rules and |
| 32 | * plugin defaults into one answer. Always present. UI distinguishes | 31 | * plugin defaults into one answer. Always present. UI distinguishes |
| @@ -2,7 +2,7 @@ import { useCallback, useMemo } from "react"; · 1 unmodified line | |||
| 2 | import { useAtomSet, useAtomValue } from "@effect/atom-react"; | 2 | import { useAtomSet, useAtomValue } from "@effect/atom-react"; |
| 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 4 | import { generateKeyBetween } from "fractional-indexing"; | 4 | import { generateKeyBetween } from "fractional-indexing"; |
| 5 | import { PolicyId, type ScopeId, type ToolPolicyAction } from "@executor-js/sdk"; | 5 | import { PolicyId, type ScopeId, type ToolPolicyAction } from "@executor-js/sdk/shared"; |
| 6 | 6 | ||
| 7 | import { | 7 | import { |
| 8 | createPolicyOptimistic, | 8 | createPolicyOptimistic, |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | // one place. Splitting `state` vs `action` labels because `block` reads | 5 | // one place. Splitting `state` vs `action` labels because `block` reads |
| 6 | // as "Blocked" when describing current state, "Block" as a verb in menus. | 6 | // as "Blocked" when describing current state, "Block" as a verb in menus. |
| 7 | 7 | ||
| 8 | import type { ToolPolicyAction } from "@executor-js/sdk"; | 8 | import type { ToolPolicyAction } from "@executor-js/sdk/shared"; |
| 9 | 9 | ||
| 10 | /** Verb form — menus, select items, "what should this rule do". */ | 10 | /** Verb form — menus, select items, "what should this rule do". */ |
| 11 | export const POLICY_ACTION_LABEL: Record<ToolPolicyAction, string> = { | 11 | export const POLICY_ACTION_LABEL: Record<ToolPolicyAction, string> = { |
| @@ -4,7 +4,7 @@ import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; · 3 unmodified lines | |||
| 4 | import * as Exit from "effect/Exit"; | 4 | import * as Exit from "effect/Exit"; |
| 5 | import * as Option from "effect/Option"; | 5 | import * as Option from "effect/Option"; |
| 6 | import * as Schema from "effect/Schema"; | 6 | import * as Schema from "effect/Schema"; |
| 7 | import { ConnectionId, ConnectionInUseError, ScopeId } from "@executor-js/sdk"; | 7 | import { ConnectionId, ConnectionInUseError, ScopeId } from "@executor-js/sdk/shared"; |
| 8 | import { toast } from "sonner"; | 8 | import { toast } from "sonner"; |
| 9 | 9 | ||
| 10 | import { | 10 | import { |
| @@ -4,7 +4,7 @@ import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; · 3 unmodified lines | |||
| 4 | import * as Exit from "effect/Exit"; | 4 | import * as Exit from "effect/Exit"; |
| 5 | import { generateKeyBetween } from "fractional-indexing"; | 5 | import { generateKeyBetween } from "fractional-indexing"; |
| 6 | import { ChevronDownIcon } from "lucide-react"; | 6 | import { ChevronDownIcon } from "lucide-react"; |
| 7 | import { PolicyId, ScopeId, type ToolPolicyAction } from "@executor-js/sdk"; | 7 | import { PolicyId, ScopeId, type ToolPolicyAction } from "@executor-js/sdk/shared"; |
| 8 | 8 | ||
| 9 | import { | 9 | import { |
| 10 | createPolicyOptimistic, | 10 | createPolicyOptimistic, |
| @@ -8,7 +8,7 @@ import { toast } from "sonner"; · 7 unmodified lines | |||
| 8 | import { removeSecretOptimistic, secretsOptimisticAtom, secretUsagesAtom } from "../api/atoms"; | 8 | import { removeSecretOptimistic, secretsOptimisticAtom, secretUsagesAtom } from "../api/atoms"; |
| 9 | import { secretWriteKeys } from "../api/reactivity-keys"; | 9 | import { secretWriteKeys } from "../api/reactivity-keys"; |
| 10 | import { useSecretProviderPlugins } from "@executor-js/sdk/client"; | 10 | import { useSecretProviderPlugins } from "@executor-js/sdk/client"; |
| 11 | import { SecretId, SecretInUseError, type ScopeId } from "@executor-js/sdk"; | 11 | import { SecretId, SecretInUseError, type ScopeId } from "@executor-js/sdk/shared"; |
| 12 | import { SecretForm } from "../plugins/secret-form"; | 12 | import { SecretForm } from "../plugins/secret-form"; |
| 13 | import { useScope } from "../hooks/use-scope"; | 13 | import { useScope } from "../hooks/use-scope"; |
| 14 | import { useScopeStack } from "../api/scope-context"; | 14 | import { useScopeStack } from "../api/scope-context"; |
| @@ -3,7 +3,7 @@ import { useNavigate } from "@tanstack/react-router"; · 2 unmodified lines | |||
| 3 | import { useAtomValue, useAtomSet, useAtomRefresh } from "@effect/atom-react"; | 3 | import { useAtomValue, useAtomSet, useAtomRefresh } from "@effect/atom-react"; |
| 4 | import * as Exit from "effect/Exit"; | 4 | import * as Exit from "effect/Exit"; |
| 5 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 5 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 6 | import { effectivePolicyFromSorted } from "@executor-js/sdk"; | 6 | import { effectivePolicyFromSorted } from "@executor-js/sdk/shared"; |
| 7 | import { | 7 | import { |
| 8 | policiesOptimisticAtom, | 8 | policiesOptimisticAtom, |
| 9 | sourceToolsAtom, | 9 | sourceToolsAtom, |
| @@ -92,24 +92,14 @@ export function SourceDetailPage(props: { namespace: string }) { · 82 unmodified lines | |||
| 92 | 92 | ||
| 93 | const sourceTools: ToolSummary[] = useMemo(() => { | 93 | const sourceTools: ToolSummary[] = useMemo(() => { |
| 94 | if (!AsyncResult.isSuccess(tools)) return []; | 94 | if (!AsyncResult.isSuccess(tools)) return []; |
| 95 | return tools.value.map( | 95 | return tools.value.map((t: { readonly id: string; readonly requiresApproval?: boolean }) => ({ |
| 96 | (t: { | 96 | id: t.id, |
| 97 | readonly id: string; | 97 | // Tree path + saved pattern must be the canonical tool id, so |
| 98 | readonly name: string; | 98 | // policy rules created from the row actually match at resolve |
| 99 | readonly pluginId: string; | 99 | // time. The leaf label is still the short last segment. |
| 100 | readonly description?: string; | 100 | name: t.id, |
| 101 | readonly requiresApproval?: boolean; | 101 | policy: effectivePolicyFromSorted(t.id, policyList, t.requiresApproval), |
| 102 | }) => ({ | 102 | })); |
| 103 | id: t.id, | ||
| 104 | // Tree path + saved pattern must be the canonical tool id, so | ||
| 105 | // policy rules created from the row actually match at resolve | ||
| 106 | // time. The leaf label is still the short last segment. | ||
| 107 | name: t.id, | ||
| 108 | pluginKey: t.pluginId, | ||
| 109 | description: t.description, | ||
| 110 | policy: effectivePolicyFromSorted(t.id, policyList, t.requiresApproval), | ||
| 111 | }), | ||
| 112 | ); | ||
| 113 | }, [tools, policyList]); | 103 | }, [tools, policyList]); |
| 114 | 104 | ||
| 115 | const selectedTool = useMemo( | 105 | const selectedTool = useMemo( |
| @@ -272,7 +262,6 @@ export function SourceDetailPage(props: { namespace: string }) { · 156 unmodified lines | |||
| 272 | <ToolDetail | 262 | <ToolDetail |
| 273 | toolId={selectedTool.id} | 263 | toolId={selectedTool.id} |
| 274 | toolName={selectedTool.name} | 264 | toolName={selectedTool.name} |
| 275 | toolDescription={selectedTool.description} | ||
| 276 | scopeId={scopeId} | 265 | scopeId={scopeId} |
| 277 | policy={selectedTool.policy} | 266 | policy={selectedTool.policy} |
| 278 | onSetPolicy={(pattern, action) => void policyActions.set(pattern, action)} | 267 | onSetPolicy={(pattern, action) => void policyActions.set(pattern, action)} |
| @@ -4,7 +4,7 @@ import { useAtomSet, useAtomValue } from "@effect/atom-react"; · 3 unmodified lines | |||
| 4 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 4 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 5 | import * as Exit from "effect/Exit"; | 5 | import * as Exit from "effect/Exit"; |
| 6 | import { PlusIcon } from "lucide-react"; | 6 | import { PlusIcon } from "lucide-react"; |
| 7 | import type { SourceDetectionResult } from "@executor-js/sdk"; | 7 | import type { SourceDetectionResult } from "@executor-js/sdk/shared"; |
| 8 | import { useSourcePlugins, type SourcePlugin, type SourcePreset } from "@executor-js/sdk/client"; | 8 | import { useSourcePlugins, type SourcePlugin, type SourcePreset } from "@executor-js/sdk/client"; |
| 9 | import { detectSource, sourcesOptimisticAtom } from "../api/atoms"; | 9 | import { detectSource, sourcesOptimisticAtom } from "../api/atoms"; |
| 10 | import { useScope } from "../hooks/use-scope"; | 10 | import { useScope } from "../hooks/use-scope"; |
| @@ -2,7 +2,7 @@ import { useMemo, useState } from "react"; · 1 unmodified line | |||
| 2 | import { Link } from "@tanstack/react-router"; | 2 | import { Link } from "@tanstack/react-router"; |
| 3 | import { useAtomValue } from "@effect/atom-react"; | 3 | import { useAtomValue } from "@effect/atom-react"; |
| 4 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | 4 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 5 | import { effectivePolicyFromSorted } from "@executor-js/sdk"; | 5 | import { effectivePolicyFromSorted } from "@executor-js/sdk/shared"; |
| 6 | 6 | ||
| 7 | import { policiesOptimisticAtom, toolsAtom } from "../api/atoms"; | 7 | import { policiesOptimisticAtom, toolsAtom } from "../api/atoms"; |
| 8 | import { useScope } from "../hooks/use-scope"; | 8 | import { useScope } from "../hooks/use-scope"; |
| @@ -37,25 +37,15 @@ export function ToolsPage() { · 28 unmodified lines | |||
| 37 | 37 | ||
| 38 | const summaries: ToolSummary[] = useMemo(() => { | 38 | const summaries: ToolSummary[] = useMemo(() => { |
| 39 | if (!AsyncResult.isSuccess(tools)) return []; | 39 | if (!AsyncResult.isSuccess(tools)) return []; |
| 40 | return tools.value.map( | 40 | return tools.value.map((t: { readonly id: string; readonly requiresApproval?: boolean }) => ({ |
| 41 | (t: { | 41 | id: t.id, |
| 42 | readonly id: string; | 42 | // Tree path + saved pattern must be the canonical tool id |
| 43 | readonly name: string; | 43 | // (`stripe_api.account.getAccount`), not the short `t.name` |
| 44 | readonly pluginId: string; | 44 | // which strips the source prefix and would never match at |
| 45 | readonly description?: string; | 45 | // resolution time. |
| 46 | readonly requiresApproval?: boolean; | 46 | name: t.id, |
| 47 | }) => ({ | 47 | policy: effectivePolicyFromSorted(t.id, sortedPolicies, t.requiresApproval), |
| 48 | id: t.id, | 48 | })); |
| 49 | // Tree path + saved pattern must be the canonical tool id | ||
| 50 | // (`stripe_api.account.getAccount`), not the short `t.name` | ||
| 51 | // which strips the source prefix and would never match at | ||
| 52 | // resolution time. | ||
| 53 | name: t.id, | ||
| 54 | pluginKey: t.pluginId, | ||
| 55 | description: t.description, | ||
| 56 | policy: effectivePolicyFromSorted(t.id, sortedPolicies, t.requiresApproval), | ||
| 57 | }), | ||
| 58 | ); | ||
| 59 | }, [tools, sortedPolicies]); | 49 | }, [tools, sortedPolicies]); |
| 60 | 50 | ||
| 61 | const selectedTool = useMemo( | 51 | const selectedTool = useMemo( |
| @@ -112,7 +102,6 @@ export function ToolsPage() { · 50 unmodified lines | |||
| 112 | <ToolDetail | 102 | <ToolDetail |
| 113 | toolId={selectedTool.id} | 103 | toolId={selectedTool.id} |
| 114 | toolName={selectedTool.name} | 104 | toolName={selectedTool.name} |
| 115 | toolDescription={selectedTool.description} | ||
| 116 | scopeId={scopeId} | 105 | scopeId={scopeId} |
| 117 | policy={selectedTool.policy} | 106 | policy={selectedTool.policy} |
| 118 | onSetPolicy={(pattern, action) => void policyActions.set(pattern, action)} | 107 | onSetPolicy={(pattern, action) => void policyActions.set(pattern, action)} |
| @@ -1,5 +1,5 @@ | |||
| 1 | import { describe, expect, it } from "@effect/vitest"; | 1 | import { describe, expect, it } from "@effect/vitest"; |
| 2 | import { ScopeId, SecretId } from "@executor-js/sdk"; | 2 | import { ScopeId, SecretId } from "@executor-js/sdk/shared"; |
| 3 | 3 | ||
| 4 | import { | 4 | import { |
| 5 | httpCredentialsFromConfiguredCredentialBindings, | 5 | httpCredentialsFromConfiguredCredentialBindings, |
| @@ -1,4 +1,8 @@ | |||
| 1 | import { ScopeId, type CredentialBindingValue, type SecretBackedValue } from "@executor-js/sdk"; | 1 | import { |
| 2 | ScopeId, | ||
| 3 | type CredentialBindingValue, | ||
| 4 | type SecretBackedValue, | ||
| 5 | } from "@executor-js/sdk/shared"; | ||
| 2 | 6 | ||
| 3 | import type { HttpCredentialsState, QueryParamState } from "./http-credentials"; | 7 | import type { HttpCredentialsState, QueryParamState } from "./http-credentials"; |
| 4 | import { headerValueToState, type HeaderState } from "./secret-header-auth"; | 8 | import { headerValueToState, type HeaderState } from "./secret-header-auth"; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import { ScopeId, type CredentialBindingValue } from "@executor-js/sdk"; | 1 | import { ScopeId, type CredentialBindingValue } from "@executor-js/sdk/shared"; |
| 2 | 2 | ||
| 3 | import { Button } from "../components/button"; | 3 | import { Button } from "../components/button"; |
| 4 | import { CardStackEntryField } from "../components/card-stack"; | 4 | import { CardStackEntryField } from "../components/card-stack"; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import { describe, expect, it } from "@effect/vitest"; | 1 | import { describe, expect, it } from "@effect/vitest"; |
| 2 | import { ScopeId } from "@executor-js/sdk"; | 2 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 3 | 3 | ||
| 4 | import { | 4 | import { |
| 5 | credentialTargetScopeOptions, | 5 | credentialTargetScopeOptions, |
| @@ -1,7 +1,7 @@ | |||
| 1 | import { useEffect, useMemo, useState } from "react"; | 1 | import { useEffect, useMemo, useState } from "react"; |
| 2 | import type { ReactNode } from "react"; | 2 | import type { ReactNode } from "react"; |
| 3 | 3 | ||
| 4 | import { ScopeId } from "@executor-js/sdk"; | 4 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 5 | 5 | ||
| 6 | import { useScope, useUserScope } from "../api/scope-context"; | 6 | import { useScope, useUserScope } from "../api/scope-context"; |
| 7 | import { | 7 | import { |
| @@ -1,6 +1,6 @@ | |||
| 1 | import { useState, type ReactNode } from "react"; | 1 | import { useState, type ReactNode } from "react"; |
| 2 | import { PlusIcon } from "lucide-react"; | 2 | import { PlusIcon } from "lucide-react"; |
| 3 | import type { ScopeId } from "@executor-js/sdk"; | 3 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 4 | 4 | ||
| 5 | import { Button } from "../components/button"; | 5 | import { Button } from "../components/button"; |
| 6 | import { | 6 | import { |
| @@ -1,4 +1,8 @@ | |||
| 1 | import type { ScopeId, ScopedSecretCredentialInput, SecretBackedValue } from "@executor-js/sdk"; | 1 | import type { |
| 2 | ScopeId, | ||
| 3 | ScopedSecretCredentialInput, | ||
| 4 | SecretBackedValue, | ||
| 5 | } from "@executor-js/sdk/shared"; | ||
| 2 | 6 | ||
| 3 | import { FieldLabel } from "../components/field"; | 7 | import { FieldLabel } from "../components/field"; |
| 4 | import { HeadersList } from "./headers-list"; | 8 | import { HeadersList } from "./headers-list"; |
| @@ -32,7 +32,7 @@ import { · 31 unmodified lines | |||
| 32 | ScopeId, | 32 | ScopeId, |
| 33 | type OAuthStrategy, | 33 | type OAuthStrategy, |
| 34 | type SecretBackedValue, | 34 | type SecretBackedValue, |
| 35 | } from "@executor-js/sdk"; | 35 | } from "@executor-js/sdk/shared"; |
| 36 | 36 | ||
| 37 | export type OAuthCompletionPayload = { | 37 | export type OAuthCompletionPayload = { |
| 38 | readonly connectionId: string; | 38 | readonly connectionId: string; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { ScopeId } from "@executor-js/sdk"; | 1 | import type { ScopeId } from "@executor-js/sdk/shared"; |
| 2 | 2 | ||
| 3 | import type { SecretPickerSecret } from "./secret-picker"; | 3 | import type { SecretPickerSecret } from "./secret-picker"; |
| 4 | 4 | ||
| @@ -12,7 +12,7 @@ import * as Exit from "effect/Exit"; · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | import { setSecret } from "../api/atoms"; | 13 | import { setSecret } from "../api/atoms"; |
| 14 | import { secretWriteKeys } from "../api/reactivity-keys"; | 14 | import { secretWriteKeys } from "../api/reactivity-keys"; |
| 15 | import { SecretId, type ScopeId } from "@executor-js/sdk"; | 15 | import { SecretId, type ScopeId } from "@executor-js/sdk/shared"; |
| 16 | import { Button, type buttonVariants } from "../components/button"; | 16 | import { Button, type buttonVariants } from "../components/button"; |
| 17 | import { Field, FieldError, FieldLabel } from "../components/field"; | 17 | import { Field, FieldError, FieldLabel } from "../components/field"; |
| 18 | import { Input } from "../components/input"; | 18 | import { Input } from "../components/input"; |
| @@ -1,5 +1,5 @@ | |||
| 1 | import { describe, expect, it } from "@effect/vitest"; | 1 | import { describe, expect, it } from "@effect/vitest"; |
| 2 | import { ScopeId } from "@executor-js/sdk"; | 2 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 3 | 3 | ||
| 4 | import { secretsForCredentialTarget } from "./secret-credential-scope"; | 4 | import { secretsForCredentialTarget } from "./secret-credential-scope"; |
| 5 | import { secretValueInputType } from "./secret-input"; | 5 | import { secretValueInputType } from "./secret-input"; |
| @@ -1,6 +1,6 @@ | |||
| 1 | import { useId, useState, type ReactNode } from "react"; | 1 | import { useId, useState, type ReactNode } from "react"; |
| 2 | 2 | ||
| 3 | import { ScopeId } from "@executor-js/sdk"; | 3 | import { ScopeId } from "@executor-js/sdk/shared"; |
| 4 | import { Button } from "../components/button"; | 4 | import { Button } from "../components/button"; |
| 5 | import { Field, FieldGroup, FieldLabel } from "../components/field"; | 5 | import { Field, FieldGroup, FieldLabel } from "../components/field"; |
| 6 | import { HelpTooltip } from "../components/help-tooltip"; | 6 | import { HelpTooltip } from "../components/help-tooltip"; |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { ConnectionId, CredentialBindingValue, ScopeId } from "@executor-js/sdk"; | 1 | import type { ConnectionId, CredentialBindingValue, ScopeId } from "@executor-js/sdk/shared"; |
| 2 | 2 | ||
| 3 | export type SourceCredentialSlot = | 3 | export type SourceCredentialSlot = |
| 4 | | { | 4 | | { |
| @@ -1,5 +1,5 @@ | |||
| 1 | import { describe, expect, it } from "@effect/vitest"; | 1 | import { describe, expect, it } from "@effect/vitest"; |
| 2 | import { ConnectionId, ScopeId, SecretId } from "@executor-js/sdk"; | 2 | import { ConnectionId, ScopeId, SecretId } from "@executor-js/sdk/shared"; |
| 3 | 3 | ||
| 4 | import { | 4 | import { |
| 5 | effectiveSourceCredentialBinding, | 5 | effectiveSourceCredentialBinding, |
| @@ -1,4 +1,4 @@ | |||
| 1 | import type { ConnectionId, ScopeId, SecretBackedValue } from "@executor-js/sdk"; | 1 | import type { ConnectionId, ScopeId, SecretBackedValue } from "@executor-js/sdk/shared"; |
| 2 | 2 | ||
| 3 | import { | 3 | import { |
| 4 | CredentialControlField, | 4 | CredentialControlField, |