@executor-js/sdk 1.4.28 → 1.4.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blob.d.ts +2 -1
- package/dist/blob.d.ts.map +1 -1
- package/dist/chunk-2LU3SC64.js +7 -0
- package/dist/chunk-2LU3SC64.js.map +1 -0
- package/dist/chunk-7D4SUZUM.js +38 -0
- package/dist/chunk-7D4SUZUM.js.map +1 -0
- package/dist/chunk-B4YGTZF6.js +22 -0
- package/dist/chunk-B4YGTZF6.js.map +1 -0
- package/dist/chunk-BZNIRSMG.js +7873 -0
- package/dist/chunk-BZNIRSMG.js.map +1 -0
- package/dist/chunk-ECMCGZYE.js +5814 -0
- package/dist/chunk-ECMCGZYE.js.map +1 -0
- package/dist/{chunk-6SQWMOM4.js → chunk-MLNVNVRI.js} +2 -6
- package/dist/chunk-MLNVNVRI.js.map +1 -0
- package/dist/chunk-P2WKYAC5.js +1 -0
- package/dist/chunk-P2WKYAC5.js.map +1 -0
- package/dist/chunk-ZANQD7E2.js +1035 -0
- package/dist/chunk-ZANQD7E2.js.map +1 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +3 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/core-schema.d.ts +283 -408
- package/dist/core-schema.d.ts.map +1 -1
- package/dist/core-tools.d.ts +6 -0
- package/dist/core-tools.d.ts.map +1 -0
- package/dist/core.js +120 -168
- package/dist/core.js.map +1 -1
- package/dist/credential-bindings.d.ts +86 -24
- package/dist/credential-bindings.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/executor.d.ts +46 -12
- package/dist/executor.d.ts.map +1 -1
- package/dist/fuma-runtime.d.ts +50 -0
- package/dist/fuma-runtime.d.ts.map +1 -0
- package/dist/http-source.d.ts +109 -0
- package/dist/http-source.d.ts.map +1 -0
- package/dist/http-source.js +155 -0
- package/dist/http-source.js.map +1 -0
- package/dist/index.d.ts +17 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -21
- package/dist/index.js.map +1 -1
- package/dist/oauth-service.d.ts +2 -10
- package/dist/oauth-service.d.ts.map +1 -1
- package/dist/oauth.d.ts +9 -1
- package/dist/oauth.d.ts.map +1 -1
- package/dist/plugin-storage.d.ts +40 -0
- package/dist/plugin-storage.d.ts.map +1 -0
- package/dist/plugin.d.ts +110 -34
- package/dist/plugin.d.ts.map +1 -1
- package/dist/promise-executor.d.ts +33 -8
- package/dist/promise-executor.d.ts.map +1 -1
- package/dist/promise.d.ts +3 -3
- package/dist/promise.d.ts.map +1 -1
- package/dist/schema-refs.d.ts +1 -0
- package/dist/schema-refs.d.ts.map +1 -1
- package/dist/schema-refs.test.d.ts +2 -0
- package/dist/schema-refs.test.d.ts.map +1 -0
- package/dist/schema-types.d.ts +22 -8
- package/dist/schema-types.d.ts.map +1 -1
- package/dist/scope-policy.d.ts +23 -0
- package/dist/scope-policy.d.ts.map +1 -0
- package/dist/scope-policy.test.d.ts +2 -0
- package/dist/scope-policy.test.d.ts.map +1 -0
- package/dist/scope.d.ts +10 -0
- package/dist/scope.d.ts.map +1 -1
- package/dist/secrets.d.ts +1 -1
- package/dist/secrets.d.ts.map +1 -1
- package/dist/shared.d.ts +13 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +103 -0
- package/dist/shared.js.map +1 -0
- package/dist/sqlite-test-db-OK2WQNR5.js +8 -0
- package/dist/sqlite-test-db-OK2WQNR5.js.map +1 -0
- package/dist/sqlite-test-db.d.ts +22 -0
- package/dist/sqlite-test-db.d.ts.map +1 -0
- package/dist/test-config.d.ts +45 -4
- package/dist/test-config.d.ts.map +1 -1
- package/dist/testing/oauth-test-server.d.ts +80 -0
- package/dist/testing/oauth-test-server.d.ts.map +1 -0
- package/dist/testing.d.ts +4 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +706 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.test.d.ts +2 -0
- package/dist/testing.test.d.ts.map +1 -0
- package/dist/tool-result.d.ts +22 -0
- package/dist/tool-result.d.ts.map +1 -0
- package/dist/tool-result.test.d.ts +2 -0
- package/dist/tool-result.test.d.ts.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vendor/json-schema-to-typescript/applySchemaTyping.d.ts +3 -0
- package/dist/vendor/json-schema-to-typescript/applySchemaTyping.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/compat.d.ts +10 -0
- package/dist/vendor/json-schema-to-typescript/compat.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/formatter.d.ts +3 -0
- package/dist/vendor/json-schema-to-typescript/formatter.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/generator.d.ts +7 -0
- package/dist/vendor/json-schema-to-typescript/generator.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/index.d.ts +93 -0
- package/dist/vendor/json-schema-to-typescript/index.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/linker.d.ts +8 -0
- package/dist/vendor/json-schema-to-typescript/linker.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/normalizer.d.ts +5 -0
- package/dist/vendor/json-schema-to-typescript/normalizer.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/optimizer.d.ts +4 -0
- package/dist/vendor/json-schema-to-typescript/optimizer.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/optionValidator.d.ts +3 -0
- package/dist/vendor/json-schema-to-typescript/optionValidator.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/parser.d.ts +8 -0
- package/dist/vendor/json-schema-to-typescript/parser.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/resolver.d.ts +7 -0
- package/dist/vendor/json-schema-to-typescript/resolver.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/types/AST.d.ts +108 -0
- package/dist/vendor/json-schema-to-typescript/types/AST.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/types/JSONSchema.d.ts +103 -0
- package/dist/vendor/json-schema-to-typescript/types/JSONSchema.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/types/json-schema.d.ts +34 -0
- package/dist/vendor/json-schema-to-typescript/types/json-schema.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/typesOfSchema.d.ts +11 -0
- package/dist/vendor/json-schema-to-typescript/typesOfSchema.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/utils.d.ts +30 -0
- package/dist/vendor/json-schema-to-typescript/utils.d.ts.map +1 -0
- package/dist/vendor/json-schema-to-typescript/validator.d.ts +3 -0
- package/dist/vendor/json-schema-to-typescript/validator.d.ts.map +1 -0
- package/package.json +17 -2
- package/dist/chunk-6SQWMOM4.js.map +0 -1
- package/dist/chunk-I2OEQ2GJ.js +0 -103
- package/dist/chunk-I2OEQ2GJ.js.map +0 -1
- package/dist/chunk-OIJL6F6M.js +0 -5507
- package/dist/chunk-OIJL6F6M.js.map +0 -1
- package/dist/error-handling.test.d.ts +0 -2
- package/dist/error-handling.test.d.ts.map +0 -1
- package/dist/scoped-adapter.d.ts +0 -28
- package/dist/scoped-adapter.d.ts.map +0 -1
- package/dist/scoped-adapter.test.d.ts +0 -2
- package/dist/scoped-adapter.test.d.ts.map +0 -1
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/testing.ts"],"sourcesContent":["import * as NodeHttpServer from \"@effect/platform-node/NodeHttpServer\";\nimport { Context, Data, Effect, Layer, Predicate, Scope as EffectScope } from \"effect\";\nimport {\n HttpClient,\n HttpRouter,\n HttpServer,\n HttpServerRequest,\n HttpServerResponse,\n} from \"effect/unstable/http\";\n\nexport { makeTestConfig, memorySecretsPlugin } from \"./test-config\";\n\nexport class TestHttpServerAddressError extends Data.TaggedError(\"TestHttpServerAddressError\")<{\n readonly address: unknown;\n}> {}\n\nexport class TestHttpServerServeError extends Data.TaggedError(\"TestHttpServerServeError\")<{\n readonly cause: unknown;\n}> {}\n\nexport interface TestHttpServerShape {\n readonly baseUrl: string;\n readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient>;\n readonly url: (path?: string) => string;\n}\n\nexport type TestHttpRoute = HttpRouter.Route<any, any>;\nexport type TestHttpRequest = HttpServerRequest.HttpServerRequest;\nexport type TestHttpResponse = HttpServerResponse.HttpServerResponse;\n\nexport const testHttpRoute = HttpRouter.route;\n\nexport const serveTestHttpRoutes = (\n routes: readonly TestHttpRoute[],\n): Effect.Effect<\n TestHttpServerShape,\n TestHttpServerAddressError | TestHttpServerServeError,\n EffectScope.Scope\n> =>\n makeTestHttpServer(\n HttpRouter.serve(HttpRouter.addAll(routes), {\n disableListenLog: true,\n disableLogger: true,\n }),\n );\n\nexport const serveTestHttpApp = (\n handler: (request: TestHttpRequest) => Effect.Effect<TestHttpResponse>,\n): Effect.Effect<\n TestHttpServerShape,\n TestHttpServerAddressError | TestHttpServerServeError,\n EffectScope.Scope\n> =>\n makeTestHttpServer(\n HttpServer.serve(HttpServerRequest.HttpServerRequest.asEffect().pipe(Effect.flatMap(handler))),\n );\n\nconst makeTestHttpServer = (\n serverLayer: Layer.Layer<never, never, HttpServer.HttpServer>,\n): Effect.Effect<\n TestHttpServerShape,\n TestHttpServerAddressError | TestHttpServerServeError,\n EffectScope.Scope\n> =>\n Effect.gen(function* () {\n const context = yield* Layer.build(\n Layer.fresh(serverLayer.pipe(Layer.provideMerge(NodeHttpServer.layerTest))),\n ).pipe(Effect.mapError((cause) => new TestHttpServerServeError({ cause })));\n const server = Context.get(context, HttpServer.HttpServer);\n const address = server.address;\n if (!Predicate.isTagged(address, \"TcpAddress\")) {\n return yield* new TestHttpServerAddressError({ address });\n }\n const client = Context.get(context, HttpClient.HttpClient);\n const baseUrl = `http://127.0.0.1:${address.port}`;\n return {\n baseUrl,\n htt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,MAAM;AAAA,IAC5D,KAAK,CAAC,OAAO,OAAO,IAAI,IAAI,MAAM,OAAO,EAAE,SAAS;AAAA,EACtD;AACF,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/testing.ts","../src/test-config.ts","../src/testing/oauth-test-server.ts"],"sourcesContent":["import * as NodeHttpServer from \"@effect/platform-node/NodeHttpServer\";\nimport { Context, Data, Effect, Layer, Predicate, Scope as EffectScope } from \"effect\";\nimport {\n HttpClient,\n HttpRouter,\n HttpServer,\n HttpServerRequest,\n HttpServerResponse,\n} from \"effect/unstable/http\";\n\nexport {\n makeTestConfig,\n makeTestExecutor,\n makeTestWorkspaceHarness,\n makeTestWorkspaceLayer,\n memorySecretsPlugin,\n TestWorkspace,\n type TestConfigOptions,\n type TestDatabaseBackend,\n type TestFumaDb,\n type TestWorkspaceHarness,\n} from \"./test-config\";\nexport {\n OAuthTestServer,\n serveOAuthTestServer,\n OAuthTestServerAddressError,\n OAuthTestServerFlowError,\n type OAuthAuthorizationCompletion,\n type OAuthTokenSet,\n type OAuthTestServerOptions,\n type OAuthTestServerRequest,\n type OAuthTestServerShape,\n} from \"./testing/oauth-test-server\";\nexport { createSqliteTestFumaDb, type SqliteTestFumaDb } from \"./sqlite-test-db\";\n\nexport class TestHttpServerAddressError extends Data.TaggedError(\"TestHttpServerAddressError\")<{\n readonly address: unknown;\n}> {}\n\nexport class TestHttpServerServeError extends Data.TaggedError(\"TestHttpServerServeError\")<{\n readonly cause: unknown;\n}> {}\n\nexport interface TestHttpServerShape {\n readonly baseUrl: string;\n readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient>;\n readonly url: (path?: string) => string;\n}\n\nexport type TestHttpRoute = HttpRouter.Route<any, any>;\nexport type TestHttpRequest = HttpServerRequest.HttpServerRequest;\nexport type TestHttpResponse = HttpServerResponse.HttpServerResponse;\n\nexport const testHttpRoute = HttpRouter.route;\n\nexport const serveTestHttpRoutes = (\n routes: readonly TestHttpRoute[],\n): Effect.Effect<\n TestHttpServerShape,\n TestHttpServerAddressError | TestHttpServerServeError,\n EffectScope.Scope\n> =>\n makeTestHttpServer(\n HttpRouter.serve(HttpRouter.addAll(routes), {\n disableListenLog: true,\n disableLogger: true,\n }),\n );\n\nexport const serveTestHttpApp = (\n handler: (request: TestHttpRequest) => Effect.Effect<TestHttpResponse>,\n): Effect.Effect<\n TestHttpServerShape,\n TestHttpServerAddressError | TestHttpServerServeError,\n EffectScope.Scope\n> =>\n makeTestHttpServer(\n HttpServer.serve(HttpServerRequest.HttpServerRequest.asEffect().pipe(Effect.flatMap(handler))),\n );\n\nexport const serveTestHttpServerLayer = (\n serverLayer: Layer.Layer<never, any, any>,\n): Effect.Effect<\n TestHttpServerShape,\n TestHttpServerAddressError | TestHttpServerServeError,\n EffectScope.Scope\n> => makeTestHttpServer(serverLayer);\n\nconst makeTestHttpServer = (\n serverLayer: Layer.Layer<never, any, any>,\n): Effect.Effect<\n TestHttpServerShape,\n TestHttpServerAddressError | TestHttpServerServeError,\n EffectScope.Scope\n> =>\n Effect.gen(function* () {\n const context = yield* Layer.build(\n Layer.fresh(serverLayer.pipe(Layer.provideMerge(NodeHttpServer.layerTest))),\n ).pipe(Effect.mapError((cause) => new TestHttpServerServeError({ cause })));\n const server = Context.get(context, HttpServer.HttpServer);\n const address = server.address;\n if (!Predicate.isTagged(address, \"TcpAddress\")) {\n return yield* new TestHttpServerAddressError({ address });\n }\n const client = Context.get(context, HttpClient.HttpClient);\n const baseUrl = `http://127.0.0.1:${address.port}`;\n return {\n baseUrl,\n httpClientLayer: Layer.succeed(HttpClient.HttpClient, client),\n url: (path = \"\") => new URL(path, baseUrl).toString(),\n };\n });\n","import { Context, Effect, Layer } from \"effect\";\nimport { withQueryContext } from \"fumadb/query\";\nimport { collectTables, createExecutor, type Executor, type ExecutorConfig } from \"./executor\";\nimport type { FumaDb } from \"./fuma-runtime\";\nimport { ScopeId } from \"./ids\";\nimport { definePlugin, type AnyPlugin } from \"./plugin\";\nimport { Scope } from \"./scope\";\nimport type { ExecutorScopePolicyContext } from \"./scope-policy\";\nimport type { SecretProvider } from \"./secrets\";\nimport type { SqliteTestFumaDb } from \"./sqlite-test-db\";\n\n// ---------------------------------------------------------------------------\n// makeTestConfig — build an ExecutorConfig backed by an in-memory FumaDB.\n// For unit tests, plugin authors validating their plugin, REPL experimentation.\n// No persistence unless a caller supplies `dataDir`.\n//\n// Defaults to a single-element scope stack (\"test-scope\") — tests that\n// need multi-scope behavior can pass `scopes` explicitly.\n// ---------------------------------------------------------------------------\n\nexport type TestDatabaseBackend = \"sqlite\";\n\nexport type TestFumaDb = Pick<SqliteTestFumaDb, \"db\" | \"close\"> & {\n readonly warm: () => Promise<void>;\n};\n\nconst makeLazyTestFumaDb = (options: {\n readonly tables: ReturnType<typeof collectTables>;\n readonly backend: TestDatabaseBackend;\n readonly dataDir?: string;\n}): TestFumaDb => {\n let started: Promise<SqliteTestFumaDb> | undefined;\n const start = () => {\n if (!started) {\n started = import(\"./sqlite-test-db\").then(({ createSqliteTestFumaDb }) =>\n createSqliteTestFumaDb({\n tables: options.tables,\n namespace: \"executor_test\",\n path: options.dataDir ? `${options.dataDir}/test.db` : undefined,\n }),\n );\n }\n return started;\n };\n\n const internal: FumaDb[\"internal\"] = {\n tables: options.tables,\n count: async (table, value) => (await start()).db.internal.count(table, value),\n create: async (table, values) => (await start()).db.internal.create(table, values),\n createMany: async (table, values) => (await start()).db.internal.createMany(table, values),\n deleteMany: async (table, value) => (await start()).db.internal.deleteMany(table, value),\n findFirst: async (table, value) => (await start()).db.internal.findFirst(table, value),\n findMany: async (table, value) => (await start()).db.internal.findMany(table, value),\n transaction: async (run) => (await start()).db.internal.transaction(run),\n updateMany: async (table, value) => (await start()).db.internal.updateMany(table, value),\n upsert: async (table, value) => (await start()).db.internal.upsert(table, value),\n };\n\n const queryMethods = new Set<PropertyKey>([\n \"count\",\n \"create\",\n \"createMany\",\n \"deleteMany\",\n \"findFirst\",\n \"findMany\",\n \"transaction\",\n \"updateMany\",\n \"upsert\",\n ]);\n\n const makeDb = (context?: ExecutorScopePolicyContext): FumaDb =>\n new Proxy(\n { internal: context === undefined ? internal : { ...internal, context } },\n {\n get(target, prop) {\n if (prop === \"internal\") return target.internal;\n if (prop === \"withContext\") {\n return (nextContext: ExecutorScopePolicyContext) => makeDb(nextContext);\n }\n if (!queryMethods.has(prop)) return undefined;\n\n return async (...args: unknown[]) => {\n const actual = await start();\n const actualDb =\n context === undefined ? actual.db : withQueryContext(actual.db, context);\n const method = Reflect.get(actualDb, prop) as (...innerArgs: unknown[]) => unknown;\n return method.apply(actualDb, args);\n };\n },\n },\n ) as FumaDb;\n\n const db = makeDb();\n\n return {\n db,\n warm: async () => {\n await start();\n },\n close: async () => {\n if (!started) return;\n await (await started).close();\n },\n };\n};\n\nexport type TestConfigOptions<TPlugins extends readonly AnyPlugin[] = readonly []> = {\n readonly scopeName?: string;\n readonly scopes?: readonly Scope[];\n readonly plugins?: TPlugins;\n readonly backend?: TestDatabaseBackend;\n readonly dataDir?: string;\n};\n\nexport const makeTestConfig = <const TPlugins extends readonly AnyPlugin[] = readonly []>(\n options?: TestConfigOptions<TPlugins>,\n): Omit<ExecutorConfig<TPlugins>, \"db\"> & {\n readonly db: FumaDb;\n readonly testDb: TestFumaDb;\n} => {\n const scopes = options?.scopes ?? [\n Scope.make({\n id: ScopeId.make(\"test-scope\"),\n name: options?.scopeName ?? \"test\",\n createdAt: new Date(),\n }),\n ];\n\n const tables = collectTables(options?.plugins ?? []);\n const testDb = makeLazyTestFumaDb({\n tables,\n backend: options?.backend ?? \"sqlite\",\n dataDir: options?.dataDir,\n });\n const db = withQueryContext(testDb.db, {\n allowedScopeIds: new Set(scopes.map((scope) => String(scope.id))),\n } satisfies ExecutorScopePolicyContext);\n\n return {\n scopes,\n db,\n plugins: options?.plugins,\n testDb,\n // Tests default to auto-accepting elicitation prompts. Override via\n // a wrapping spread if a test exercises a real handler:\n // { ...makeTestConfig(...), onElicitation: customHandler }\n onElicitation: \"accept-all\",\n };\n};\n\nexport interface TestWorkspaceHarness<\n TPlugins extends readonly AnyPlugin[] = readonly AnyPlugin[],\n> {\n readonly config: ExecutorConfig<TPlugins> & { readonly testDb: TestFumaDb };\n readonly executor: Executor<TPlugins>;\n readonly testDb: TestFumaDb;\n readonly scopes: readonly Scope[];\n}\n\nexport class TestWorkspace extends Context.Service<TestWorkspace, TestWorkspaceHarness>()(\n \"executor-sdk/TestWorkspace\",\n) {\n static readonly current = <\n const TPlugins extends readonly AnyPlugin[] = readonly AnyPlugin[],\n >() =>\n Effect.gen(function* () {\n const workspace = yield* TestWorkspace;\n return workspace as TestWorkspaceHarness<TPlugins>;\n });\n}\n\nexport const makeTestWorkspaceHarness = <const TPlugins extends readonly AnyPlugin[] = readonly []>(\n options?: TestConfigOptions<TPlugins>,\n) =>\n Effect.acquireRelease(\n Effect.gen(function* () {\n const config = makeTestConfig(options);\n const executor = yield* createExecutor(config);\n return {\n config,\n executor,\n testDb: config.testDb,\n scopes: config.scopes,\n } as const;\n }),\n ({ executor, testDb }) =>\n executor\n .close()\n .pipe(\n Effect.ignore,\n Effect.andThen(Effect.promise(() => testDb.close()).pipe(Effect.ignore)),\n ),\n );\n\nexport const makeTestWorkspaceLayer = <const TPlugins extends readonly AnyPlugin[] = readonly []>(\n options?: TestConfigOptions<TPlugins>,\n) =>\n Layer.effect(TestWorkspace)(\n makeTestWorkspaceHarness(options).pipe(\n Effect.tap(({ testDb }) => Effect.promise(() => testDb.warm())),\n ),\n );\n\nexport const makeTestExecutor = <const TPlugins extends readonly AnyPlugin[] = readonly []>(\n options?: TestConfigOptions<TPlugins>,\n) => makeTestWorkspaceHarness(options).pipe(Effect.map(({ executor }) => executor));\n\nexport const memorySecretsPlugin = definePlugin(() => {\n const store = new Map<string, string>();\n\n const provider: SecretProvider = {\n key: \"memory\",\n writable: true,\n get: (id, scope) => Effect.sync(() => store.get(`${scope}\\u0000${id}`) ?? null),\n set: (id, value, scope) =>\n Effect.sync(() => {\n store.set(`${scope}\\u0000${id}`, value);\n }),\n delete: (id, scope) => Effect.sync(() => store.delete(`${scope}\\u0000${id}`)),\n list: () =>\n Effect.sync(() =>\n Array.from(store.keys()).map((key) => {\n const name = key.split(\"\\u0000\", 2)[1] ?? key;\n return { id: name, name };\n }),\n ),\n };\n\n return {\n id: \"memory-secrets\" as const,\n storage: () => ({}),\n secretProviders: [provider],\n };\n});\n","import * as NodeHttpServer from \"@effect/platform-node/NodeHttpServer\";\nimport { Context, Data, Effect, Layer, Option, Predicate, Ref, Schema, Scope } from \"effect\";\nimport { createHash, randomUUID } from \"node:crypto\";\nimport {\n FetchHttpClient,\n HttpClient,\n HttpClientRequest,\n HttpClientResponse,\n HttpServer,\n HttpServerRequest,\n HttpServerResponse,\n} from \"effect/unstable/http\";\n\nexport class OAuthTestServerAddressError extends Data.TaggedError(\"OAuthTestServerAddressError\")<{\n readonly address: unknown;\n}> {}\n\nexport class OAuthTestServerFlowError extends Data.TaggedError(\"OAuthTestServerFlowError\")<{\n readonly message: string;\n readonly cause?: unknown;\n}> {}\n\nexport interface OAuthAuthorizationCompletion {\n readonly callbackUrl: string;\n readonly code: string;\n readonly state: string;\n}\n\nexport interface OAuthTokenSet {\n readonly accessToken: string;\n readonly refreshToken?: string;\n readonly tokenType: string;\n readonly expiresIn?: number;\n readonly scope?: string;\n}\n\nexport interface OAuthTestServerRequest {\n readonly method: string;\n readonly url: string;\n readonly path: string;\n readonly headers: Readonly<Record<string, string>>;\n readonly body: string;\n}\n\nexport interface OAuthTestServerOptions {\n readonly users?: Readonly<Record<string, string>>;\n readonly defaultUsername?: string;\n readonly defaultPassword?: string;\n readonly defaultClientId?: string;\n readonly defaultClientSecret?: string;\n readonly clients?: Readonly<Record<string, string | null>>;\n readonly scopes?: readonly string[];\n readonly supportRefresh?: boolean;\n}\n\nexport interface OAuthTestServerShape {\n readonly issuerUrl: string;\n readonly authorizationEndpoint: string;\n readonly tokenEndpoint: string;\n readonly registrationEndpoint: string;\n readonly protectedResourceMetadataUrl: string;\n readonly resourceUrl: string;\n readonly mcpResourceUrl: string;\n readonly completeAuthorizationCodeFlow: (input: {\n readonly authorizationUrl: string;\n readonly username?: string;\n readonly password?: string;\n }) => Effect.Effect<OAuthAuthorizationCompletion, OAuthTestServerFlowError>;\n readonly completeAuthorizationCodeTokenFlow: (input?: {\n readonly username?: string;\n readonly password?: string;\n readonly clientId?: string;\n readonly clientSecret?: string;\n readonly redirectUrl?: string;\n readonly scopes?: readonly string[];\n readonly resource?: string;\n }) => Effect.Effect<OAuthTokenSet, OAuthTestServerFlowError>;\n readonly requests: Effect.Effect<readonly OAuthTestServerRequest[]>;\n readonly clearRequests: Effect.Effect<void>;\n readonly issuedAccessTokens: Effect.Effect<readonly string[]>;\n readonly acceptsAccessToken: (token: string) => Effect.Effect<boolean>;\n readonly acceptsAuthorizationHeader: (\n authorization: string | null | undefined,\n ) => Effect.Effect<boolean>;\n}\n\ninterface ClientRecord {\n readonly clientSecret: string | null;\n readonly redirectUris: ReadonlySet<string>;\n readonly tokenEndpointAuthMethod: string;\n}\n\ninterface AuthorizationTransaction {\n readonly clientId: string;\n readonly redirectUri: string;\n readonly state: string;\n readonly codeChallenge: string;\n readonly scope: string | null;\n readonly resource: string | null;\n}\n\ninterface AuthorizationCodeRecord extends AuthorizationTransaction {\n readonly username: string;\n}\n\ninterface RefreshTokenRecord {\n readonly clientId: string;\n readonly username: string;\n readonly scope: string | null;\n readonly resource: string | null;\n}\n\nconst JsonObject = Schema.Record(Schema.String, Schema.Unknown);\nconst decodeJsonObject = Schema.decodeUnknownOption(Schema.fromJsonString(JsonObject));\nconst TokenResponse = Schema.Struct({\n access_token: Schema.String,\n refresh_token: Schema.optional(Schema.String),\n token_type: Schema.String,\n expires_in: Schema.optional(Schema.Number),\n scope: Schema.optional(Schema.String),\n});\nconst decodeTokenResponse = Schema.decodeUnknownEffect(TokenResponse);\n\nconst defaultScopes = [\"read\", \"write\"] as const;\n\nconst jsonResponse = (\n status: number,\n body: Readonly<Record<string, unknown>>,\n headers: Readonly<Record<string, string>> = {},\n): HttpServerResponse.HttpServerResponse =>\n HttpServerResponse.jsonUnsafe(body, { status, headers });\n\nconst textResponse = (\n status: number,\n body: string,\n headers: Readonly<Record<string, string>> = {},\n): HttpServerResponse.HttpServerResponse =>\n HttpServerResponse.text(body, {\n status,\n headers,\n contentType: \"text/plain; charset=utf-8\",\n });\n\nconst redirectResponse = (location: string): HttpServerResponse.HttpServerResponse =>\n HttpServerResponse.redirect(location);\n\nconst parseJsonObject = (body: string): Readonly<Record<string, unknown>> | null => {\n const result = decodeJsonObject(body);\n return Option.isSome(result) ? result.value : null;\n};\n\nconst arrayOfStrings = (value: unknown): readonly string[] =>\n Array.isArray(value) ? value.filter((item): item is string => typeof item === \"string\") : [];\n\nconst decodeBasicAuthorization = (\n value: string | undefined,\n): { readonly username: string; readonly password: string } | null => {\n if (!value) return null;\n const match = /^Basic\\s+(.+)$/i.exec(value);\n if (!match) return null;\n const decoded = Buffer.from(match[1]!, \"base64\").toString(\"utf8\");\n const separator = decoded.indexOf(\":\");\n if (separator < 0) return null;\n return {\n username: decoded.slice(0, separator),\n password: decoded.slice(separator + 1),\n };\n};\n\nconst codeChallengeForVerifier = (verifier: string): string =>\n createHash(\"sha256\").update(verifier).digest(\"base64url\");\n\nconst oauthError = (status: number, error: string, errorDescription: string) =>\n jsonResponse(\n status,\n {\n error,\n error_description: errorDescription,\n },\n status === 401 ? { \"www-authenticate\": 'Basic realm=\"OAuth test server\"' } : {},\n );\n\nconst manualRedirectHttpClientLayer = FetchHttpClient.layer.pipe(\n Layer.provide(Layer.succeed(FetchHttpClient.RequestInit, { redirect: \"manual\" })),\n);\n\nconst executeManualRedirect = (\n request: HttpClientRequest.HttpClientRequest,\n requestUrl: string,\n): Effect.Effect<HttpClientResponse.HttpClientResponse, OAuthTestServerFlowError> =>\n HttpClient.execute(request).pipe(\n Effect.mapError(\n (cause) =>\n new OAuthTestServerFlowError({\n message: `OAuth test flow request failed for ${requestUrl}`,\n cause,\n }),\n ),\n Effect.provide(manualRedirectHttpClientLayer),\n );\n\nconst executeOAuthHttp = (\n request: HttpClientRequest.HttpClientRequest,\n requestUrl: string,\n): Effect.Effect<HttpClientResponse.HttpClientResponse, OAuthTestServerFlowError> =>\n HttpClient.execute(request).pipe(\n Effect.mapError(\n (cause) =>\n new OAuthTestServerFlowError({\n message: `OAuth test flow request failed for ${requestUrl}`,\n cause,\n }),\n ),\n Effect.provide(FetchHttpClient.layer),\n );\n\nconst requiredRedirectLocation = (\n response: HttpClientResponse.HttpClientResponse,\n requestUrl: string,\n): Effect.Effect<string, OAuthTestServerFlowError> =>\n Effect.gen(function* () {\n if (response.status < 300 || response.status >= 400) {\n return yield* new OAuthTestServerFlowError({\n message: `Expected redirect from ${requestUrl}, got HTTP ${response.status}`,\n });\n }\n const location = response.headers.location;\n if (!location) {\n return yield* new OAuthTestServerFlowError({\n message: `Expected Location header from ${requestUrl}`,\n });\n }\n return new URL(location, requestUrl).toString();\n });\n\nconst serveOAuthTestHttpApp = (\n handler: (\n request: HttpServerRequest.HttpServerRequest,\n ) => Effect.Effect<HttpServerResponse.HttpServerResponse>,\n): Effect.Effect<{ readonly baseUrl: string }, OAuthTestServerAddressError, Scope.Scope> =>\n Effect.gen(function* () {\n const context = yield* Layer.build(\n Layer.fresh(\n HttpServer.serve(\n HttpServerRequest.HttpServerRequest.asEffect().pipe(Effect.flatMap(handler)),\n ).pipe(Layer.provideMerge(NodeHttpServer.layerTest)),\n ),\n ).pipe(Effect.mapError((address) => new OAuthTestServerAddressError({ address })));\n const server = Context.get(context, HttpServer.HttpServer);\n const address = server.address;\n if (!Predicate.isTagged(address, \"TcpAddress\")) {\n return yield* new OAuthTestServerAddressError({ address });\n }\n return { baseUrl: `http://127.0.0.1:${address.port}` };\n });\n\nconst requestBodyText = (request: HttpServerRequest.HttpServerRequest): Effect.Effect<string> =>\n request.text.pipe(Effect.catch(() => Effect.succeed(\"\")));\n\nconst completeAuthorizationCodeFlow =\n (defaults: { readonly username: string; readonly password: string }) =>\n (input: {\n readonly authorizationUrl: string;\n readonly username?: string;\n readonly password?: string;\n }): Effect.Effect<OAuthAuthorizationCompletion, OAuthTestServerFlowError> =>\n Effect.gen(function* () {\n const loginResponse = yield* executeManualRedirect(\n HttpClientRequest.get(input.authorizationUrl),\n input.authorizationUrl,\n );\n const loginUrl = yield* requiredRedirectLocation(loginResponse, input.authorizationUrl);\n const credentials = Buffer.from(\n `${input.username ?? defaults.username}:${input.password ?? defaults.password}`,\n ).toString(\"base64\");\n const callbackResponse = yield* executeManualRedirect(\n HttpClientRequest.post(loginUrl).pipe(\n HttpClientRequest.setHeader(\"authorization\", `Basic ${credentials}`),\n ),\n loginUrl,\n );\n const callbackUrl = yield* requiredRedirectLocation(callbackResponse, loginUrl);\n const parsed = new URL(callbackUrl);\n const state = parsed.searchParams.get(\"state\");\n const code = parsed.searchParams.get(\"code\");\n if (!state || !code) {\n return yield* new OAuthTestServerFlowError({\n message: \"OAuth callback did not include both state and code\",\n });\n }\n return { callbackUrl, state, code };\n });\n\nconst completeAuthorizationCodeTokenFlow =\n (defaults: {\n readonly username: string;\n readonly password: string;\n readonly clientId: string;\n readonly clientSecret: string;\n readonly authorizationEndpoint: string;\n readonly tokenEndpoint: string;\n }) =>\n (\n input: {\n readonly username?: string;\n readonly password?: string;\n readonly clientId?: string;\n readonly clientSecret?: string;\n readonly redirectUrl?: string;\n readonly scopes?: readonly string[];\n readonly resource?: string;\n } = {},\n ): Effect.Effect<OAuthTokenSet, OAuthTestServerFlowError> =>\n Effect.gen(function* () {\n const clientId = input.clientId ?? defaults.clientId;\n const clientSecret = input.clientSecret ?? defaults.clientSecret;\n const redirectUrl = input.redirectUrl ?? \"http://127.0.0.1/callback\";\n const codeVerifier = `verifier_${randomUUID()}`;\n const state = `state_${randomUUID()}`;\n const authorizationUrl = new URL(defaults.authorizationEndpoint);\n authorizationUrl.searchParams.set(\"response_type\", \"code\");\n authorizationUrl.searchParams.set(\"client_id\", clientId);\n authorizationUrl.searchParams.set(\"redirect_uri\", redirectUrl);\n authorizationUrl.searchParams.set(\"state\", state);\n authorizationUrl.searchParams.set(\"code_challenge\", codeChallengeForVerifier(codeVerifier));\n authorizationUrl.searchParams.set(\"code_challenge_method\", \"S256\");\n if (input.scopes && input.scopes.length > 0) {\n authorizationUrl.searchParams.set(\"scope\", input.scopes.join(\" \"));\n }\n if (input.resource) {\n authorizationUrl.searchParams.set(\"resource\", input.resource);\n }\n\n const callback = yield* completeAuthorizationCodeFlow({\n username: defaults.username,\n password: defaults.password,\n })({\n authorizationUrl: authorizationUrl.toString(),\n username: input.username,\n password: input.password,\n });\n const tokenResponse = yield* executeOAuthHttp(\n HttpClientRequest.post(defaults.tokenEndpoint).pipe(\n HttpClientRequest.bodyUrlParams({\n grant_type: \"authorization_code\",\n code: callback.code,\n redirect_uri: redirectUrl,\n client_id: clientId,\n client_secret: clientSecret,\n code_verifier: codeVerifier,\n }),\n ),\n defaults.tokenEndpoint,\n );\n if (tokenResponse.status !== 200) {\n const body = yield* tokenResponse.text.pipe(\n Effect.catch(() => Effect.succeed(\"<unavailable>\")),\n );\n return yield* new OAuthTestServerFlowError({\n message: `Expected token response HTTP 200, got HTTP ${tokenResponse.status}: ${body}`,\n });\n }\n const raw = yield* tokenResponse.json.pipe(\n Effect.mapError(\n (cause) =>\n new OAuthTestServerFlowError({\n message: \"OAuth token response was not valid JSON\",\n cause,\n }),\n ),\n );\n const token = yield* decodeTokenResponse(raw).pipe(\n Effect.mapError(\n (cause) =>\n new OAuthTestServerFlowError({\n message: \"OAuth token response did not match the expected shape\",\n cause,\n }),\n ),\n );\n return {\n accessToken: token.access_token,\n refreshToken: token.refresh_token,\n tokenType: token.token_type,\n expiresIn: token.expires_in,\n scope: token.scope,\n };\n });\n\nexport const serveOAuthTestServer = (\n options: OAuthTestServerOptions = {},\n): Effect.Effect<OAuthTestServerShape, OAuthTestServerAddressError, Scope.Scope> =>\n Effect.gen(function* () {\n const requests = yield* Ref.make<readonly OAuthTestServerRequest[]>([]);\n const issuedAccessTokens = yield* Ref.make<ReadonlySet<string>>(new Set());\n const users = {\n [options.defaultUsername ?? \"alice\"]: options.defaultPassword ?? \"password\",\n ...(options.users ?? {}),\n };\n const supportRefresh = options.supportRefresh ?? true;\n const scopes = options.scopes ?? defaultScopes;\n const clients = new Map<string, ClientRecord>();\n const transactions = new Map<string, AuthorizationTransaction>();\n const authorizationCodes = new Map<string, AuthorizationCodeRecord>();\n const refreshTokens = new Map<string, RefreshTokenRecord>();\n const defaultClientId = options.defaultClientId ?? \"test-client\";\n const defaultClientSecret = options.defaultClientSecret ?? \"test-secret\";\n\n clients.set(defaultClientId, {\n clientSecret: defaultClientSecret,\n redirectUris: new Set(),\n tokenEndpointAuthMethod: \"client_secret_post\",\n });\n for (const [clientId, clientSecret] of Object.entries(options.clients ?? {})) {\n clients.set(clientId, {\n clientSecret,\n redirectUris: new Set(),\n tokenEndpointAuthMethod: clientSecret === null ? \"none\" : \"client_secret_post\",\n });\n }\n\n let issuerUrl = \"\";\n const server = yield* serveOAuthTestHttpApp((request) =>\n Effect.gen(function* () {\n const currentIssuerUrl = issuerUrl || \"http://127.0.0.1\";\n const requestUrl = new URL(request.url, currentIssuerUrl);\n const body = yield* requestBodyText(request);\n const headers = request.headers;\n\n yield* Ref.update(requests, (all) => [\n ...all,\n {\n method: request.method,\n url: requestUrl.toString(),\n path: requestUrl.pathname,\n headers,\n body,\n },\n ]);\n\n if (requestUrl.pathname.startsWith(\"/.well-known/oauth-protected-resource\")) {\n const suffix = requestUrl.pathname.slice(\"/.well-known/oauth-protected-resource\".length);\n const resource = `${currentIssuerUrl}${suffix}`;\n return jsonResponse(200, {\n resource,\n authorization_servers: [currentIssuerUrl],\n bearer_methods_supported: [\"header\"],\n scopes_supported: scopes,\n });\n }\n\n if (\n requestUrl.pathname === \"/.well-known/oauth-authorization-server\" ||\n requestUrl.pathname === \"/.well-known/openid-configuration\"\n ) {\n return jsonResponse(200, {\n issuer: currentIssuerUrl,\n authorization_endpoint: `${currentIssuerUrl}/authorize`,\n token_endpoint: `${currentIssuerUrl}/token`,\n registration_endpoint: `${currentIssuerUrl}/register`,\n response_types_supported: [\"code\"],\n grant_types_supported: [\"authorization_code\", \"refresh_token\", \"client_credentials\"],\n code_challenge_methods_supported: [\"S256\"],\n token_endpoint_auth_methods_supported: [\n \"none\",\n \"client_secret_post\",\n \"client_secret_basic\",\n ],\n scopes_supported: scopes,\n });\n }\n\n if (requestUrl.pathname === \"/register\" && request.method === \"POST\") {\n const json = parseJsonObject(body);\n if (!json) {\n return oauthError(400, \"invalid_client_metadata\", \"Expected JSON body\");\n }\n const requestedMethod =\n typeof json.token_endpoint_auth_method === \"string\"\n ? json.token_endpoint_auth_method\n : \"none\";\n const clientId = `client_${randomUUID()}`;\n const clientSecret =\n requestedMethod === \"client_secret_basic\" || requestedMethod === \"client_secret_post\"\n ? `secret_${randomUUID()}`\n : null;\n const redirectUris = new Set(arrayOfStrings(json.redirect_uris));\n clients.set(clientId, {\n clientSecret,\n redirectUris,\n tokenEndpointAuthMethod: requestedMethod,\n });\n return jsonResponse(\n 201,\n {\n client_id: clientId,\n ...(clientSecret ? { client_secret: clientSecret } : {}),\n client_id_issued_at: Math.floor(Date.now() / 1000),\n token_endpoint_auth_method: requestedMethod,\n redirect_uris: [...redirectUris],\n grant_types: arrayOfStrings(json.grant_types),\n response_types: arrayOfStrings(json.response_types),\n scope: typeof json.scope === \"string\" ? json.scope : scopes.join(\" \"),\n },\n { \"cache-control\": \"no-store\" },\n );\n }\n\n if (requestUrl.pathname === \"/authorize\" && request.method === \"GET\") {\n const clientId = requestUrl.searchParams.get(\"client_id\");\n const redirectUri = requestUrl.searchParams.get(\"redirect_uri\");\n const state = requestUrl.searchParams.get(\"state\");\n const codeChallenge = requestUrl.searchParams.get(\"code_challenge\");\n const responseType = requestUrl.searchParams.get(\"response_type\");\n if (!clientId || !redirectUri || !state || !codeChallenge || responseType !== \"code\") {\n return oauthError(400, \"invalid_request\", \"Missing authorization parameters\");\n }\n const client = clients.get(clientId);\n if (client && client.redirectUris.size > 0 && !client.redirectUris.has(redirectUri)) {\n return oauthError(400, \"invalid_request\", \"redirect_uri is not registered\");\n }\n if (!client) {\n clients.set(clientId, {\n clientSecret: null,\n redirectUris: new Set([redirectUri]),\n tokenEndpointAuthMethod: \"none\",\n });\n }\n const transaction = `txn_${randomUUID()}`;\n transactions.set(transaction, {\n clientId,\n redirectUri,\n state,\n codeChallenge,\n scope: requestUrl.searchParams.get(\"scope\"),\n resource: requestUrl.searchParams.get(\"resource\"),\n });\n return redirectResponse(\n `${currentIssuerUrl}/login?transaction=${encodeURIComponent(transaction)}`,\n );\n }\n\n if (requestUrl.pathname === \"/login\") {\n const transactionId = requestUrl.searchParams.get(\"transaction\");\n const transaction = transactionId ? transactions.get(transactionId) : undefined;\n if (!transactionId || !transaction) {\n return oauthError(400, \"invalid_request\", \"Unknown login transaction\");\n }\n if (request.method === \"GET\") {\n return textResponse(200, \"OAuth test login\");\n }\n const basic = decodeBasicAuthorization(headers.authorization);\n if (!basic || users[basic.username] !== basic.password) {\n return jsonResponse(\n 401,\n { error: \"access_denied\" },\n { \"www-authenticate\": 'Basic realm=\"OAuth test server\"' },\n );\n }\n const code = `code_${randomUUID()}`;\n transactions.delete(transactionId);\n authorizationCodes.set(code, { ...transaction, username: basic.username });\n const callbackUrl = new URL(transaction.redirectUri);\n callbackUrl.searchParams.set(\"code\", code);\n callbackUrl.searchParams.set(\"state\", transaction.state);\n return redirectResponse(callbackUrl.toString());\n }\n\n if (requestUrl.pathname === \"/token\" && request.method === \"POST\") {\n const params = new URLSearchParams(body);\n const basic = decodeBasicAuthorization(headers.authorization);\n const clientId = basic?.username ?? params.get(\"client_id\");\n const clientSecret = basic?.password ?? params.get(\"client_secret\");\n const client = clientId ? clients.get(clientId) : undefined;\n if (!clientId || !client) {\n return oauthError(401, \"invalid_client\", \"Unknown client\");\n }\n if (client.clientSecret !== null && client.clientSecret !== clientSecret) {\n return oauthError(401, \"invalid_client\", \"Invalid client secret\");\n }\n\n const grantType = params.get(\"grant_type\");\n if (grantType === \"authorization_code\") {\n const code = params.get(\"code\");\n const redirectUri = params.get(\"redirect_uri\");\n const codeVerifier = params.get(\"code_verifier\");\n const record = code ? authorizationCodes.get(code) : undefined;\n if (!code || !redirectUri || !codeVerifier || !record) {\n return oauthError(400, \"invalid_grant\", \"Unknown authorization code\");\n }\n if (\n record.clientId !== clientId ||\n record.redirectUri !== redirectUri ||\n record.codeChallenge !== codeChallengeForVerifier(codeVerifier)\n ) {\n return oauthError(400, \"invalid_grant\", \"Authorization code validation failed\");\n }\n authorizationCodes.delete(code);\n const accessToken = `at_${randomUUID()}`;\n const refreshToken = `rt_${randomUUID()}`;\n yield* Ref.update(issuedAccessTokens, (tokens) => new Set([...tokens, accessToken]));\n refreshTokens.set(refreshToken, {\n clientId,\n username: record.username,\n scope: record.scope,\n resource: record.resource,\n });\n return jsonResponse(\n 200,\n {\n access_token: accessToken,\n refresh_token: refreshToken,\n token_type: \"Bearer\",\n expires_in: 3600,\n ...(record.scope ? { scope: record.scope } : {}),\n },\n { \"cache-control\": \"no-store\" },\n );\n }\n\n if (grantType === \"refresh_token\") {\n const refreshToken = params.get(\"refresh_token\");\n const record = refreshToken ? refreshTokens.get(refreshToken) : undefined;\n if (!supportRefresh || !refreshToken || !record || record.clientId !== clientId) {\n return oauthError(400, \"invalid_grant\", \"Unknown refresh token\");\n }\n const nextAccessToken = `at_${randomUUID()}`;\n const nextRefreshToken = `rt_${randomUUID()}`;\n refreshTokens.delete(refreshToken);\n refreshTokens.set(nextRefreshToken, record);\n yield* Ref.update(\n issuedAccessTokens,\n (tokens) => new Set([...tokens, nextAccessToken]),\n );\n return jsonResponse(\n 200,\n {\n access_token: nextAccessToken,\n refresh_token: nextRefreshToken,\n token_type: \"Bearer\",\n expires_in: 3600,\n ...(record.scope ? { scope: record.scope } : {}),\n },\n { \"cache-control\": \"no-store\" },\n );\n }\n\n if (grantType === \"client_credentials\") {\n const accessToken = `at_${randomUUID()}`;\n yield* Ref.update(issuedAccessTokens, (tokens) => new Set([...tokens, accessToken]));\n return jsonResponse(\n 200,\n {\n access_token: accessToken,\n token_type: \"Bearer\",\n expires_in: 3600,\n scope: params.get(\"scope\") ?? scopes.join(\" \"),\n },\n { \"cache-control\": \"no-store\" },\n );\n }\n\n return oauthError(400, \"unsupported_grant_type\", \"Unsupported grant type\");\n }\n\n if (requestUrl.pathname === \"/mcp\") {\n const authorization = headers.authorization;\n const token = authorization?.replace(/^Bearer\\s+/i, \"\");\n const valid = token\n ? yield* Ref.get(issuedAccessTokens).pipe(Effect.map((tokens) => tokens.has(token)))\n : false;\n if (!valid) {\n return jsonResponse(\n 401,\n { error: \"invalid_token\" },\n {\n \"www-authenticate\": `Bearer resource_metadata=\"${currentIssuerUrl}/.well-known/oauth-protected-resource/mcp\", error=\"invalid_token\"`,\n },\n );\n }\n return jsonResponse(200, {\n jsonrpc: \"2.0\",\n id: 1,\n result: { protocolVersion: \"2025-06-18\", capabilities: {} },\n });\n }\n\n return jsonResponse(404, { error: \"not_found\" });\n }),\n );\n\n issuerUrl = server.baseUrl;\n const accessTokenSet = Ref.get(issuedAccessTokens);\n\n return {\n issuerUrl,\n authorizationEndpoint: `${issuerUrl}/authorize`,\n tokenEndpoint: `${issuerUrl}/token`,\n registrationEndpoint: `${issuerUrl}/register`,\n protectedResourceMetadataUrl: `${issuerUrl}/.well-known/oauth-protected-resource`,\n resourceUrl: issuerUrl,\n mcpResourceUrl: `${issuerUrl}/mcp`,\n completeAuthorizationCodeFlow: completeAuthorizationCodeFlow({\n username: options.defaultUsername ?? \"alice\",\n password: options.defaultPassword ?? \"password\",\n }),\n completeAuthorizationCodeTokenFlow: completeAuthorizationCodeTokenFlow({\n username: options.defaultUsername ?? \"alice\",\n password: options.defaultPassword ?? \"password\",\n clientId: defaultClientId,\n clientSecret: defaultClientSecret,\n authorizationEndpoint: `${issuerUrl}/authorize`,\n tokenEndpoint: `${issuerUrl}/token`,\n }),\n requests: Ref.get(requests),\n clearRequests: Ref.set(requests, []),\n issuedAccessTokens: accessTokenSet.pipe(Effect.map((tokens) => [...tokens])),\n acceptsAccessToken: (token) => accessTokenSet.pipe(Effect.map((tokens) => tokens.has(token))),\n acceptsAuthorizationHeader: (authorization) => {\n const token = authorization?.replace(/^Bearer\\s+/i, \"\");\n return token\n ? accessTokenSet.pipe(Effect.map((tokens) => tokens.has(token)))\n : Effect.succeed(false);\n },\n };\n });\n\nexport class OAuthTestServer extends Context.Service<OAuthTestServer, OAuthTestServerShape>()(\n \"@executor-js/sdk/testing/OAuthTestServer\",\n) {\n static readonly layer = (options?: OAuthTestServerOptions) =>\n Layer.effect(OAuthTestServer, serveOAuthTestServer(options));\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,YAAYA,qBAAoB;AAChC,SAAS,WAAAC,UAAS,QAAAC,OAAM,UAAAC,SAAQ,SAAAC,QAAO,aAAAC,kBAAuC;AAC9E;AAAA,EACE,cAAAC;AAAA,EACA;AAAA,EACA,cAAAC;AAAA,EACA,qBAAAC;AAAA,OAEK;;;ACRP,SAAS,SAAS,QAAQ,aAAa;AACvC,SAAS,wBAAwB;AAyBjC,IAAM,qBAAqB,CAAC,YAIV;AAChB,MAAI;AACJ,QAAM,QAAQ,MAAM;AAClB,QAAI,CAAC,SAAS;AACZ,gBAAU,OAAO,8BAAkB,EAAE;AAAA,QAAK,CAAC,EAAE,wBAAAC,wBAAuB,MAClEA,wBAAuB;AAAA,UACrB,QAAQ,QAAQ;AAAA,UAChB,WAAW;AAAA,UACX,MAAM,QAAQ,UAAU,GAAG,QAAQ,OAAO,aAAa;AAAA,QACzD,CAAC;AAAA,MACH;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,QAAM,WAA+B;AAAA,IACnC,QAAQ,QAAQ;AAAA,IAChB,OAAO,OAAO,OAAO,WAAW,MAAM,MAAM,GAAG,GAAG,SAAS,MAAM,OAAO,KAAK;AAAA,IAC7E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A,EACtD;AACF,CAAC;","names":["NodeHttpServer","Context","Data","Effect","Layer","Predicate","HttpClient","HttpServer","HttpServerRequest","createSqliteTestFumaDb","Context","Effect","Layer","address","Data","HttpServer","HttpServerRequest","Effect","Layer","Context","Predicate","HttpClient"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.test.d.ts","sourceRoot":"","sources":["../src/testing.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const ToolErrorSchema: Schema.Struct<{
|
|
3
|
+
readonly code: Schema.String;
|
|
4
|
+
readonly message: Schema.String;
|
|
5
|
+
readonly status: Schema.optional<Schema.Number>;
|
|
6
|
+
readonly details: Schema.optional<Schema.Unknown>;
|
|
7
|
+
readonly retryable: Schema.optional<Schema.Boolean>;
|
|
8
|
+
}>;
|
|
9
|
+
export type ToolError = typeof ToolErrorSchema.Type;
|
|
10
|
+
export type ToolResult<T> = {
|
|
11
|
+
readonly ok: true;
|
|
12
|
+
readonly data: T;
|
|
13
|
+
} | {
|
|
14
|
+
readonly ok: false;
|
|
15
|
+
readonly error: ToolError;
|
|
16
|
+
};
|
|
17
|
+
export declare const ToolResult: {
|
|
18
|
+
readonly ok: <T>(data: T) => ToolResult<T>;
|
|
19
|
+
readonly fail: <T = never>(error: ToolError) => ToolResult<T>;
|
|
20
|
+
};
|
|
21
|
+
export declare const isToolResult: (value: unknown) => value is ToolResult<unknown>;
|
|
22
|
+
//# sourceMappingURL=tool-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result.d.ts","sourceRoot":"","sources":["../src/tool-result.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAEpD,MAAM,MAAM,UAAU,CAAC,CAAC,IACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GACvC;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEtD,eAAO,MAAM,UAAU;kBAChB,CAAC,QAAQ,CAAC,KAAG,UAAU,CAAC,CAAC,CAAC;oBACxB,CAAC,iBAAiB,SAAS,KAAG,UAAU,CAAC,CAAC,CAAC;CAC1C,CAAC;AASX,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,UAAU,CAAC,OAAO,CAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result.test.d.ts","sourceRoot":"","sources":["../src/tool-result.test.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare const ToolSchema: Schema.Struct<{
|
|
|
52
52
|
readonly description: Schema.optional<Schema.String>;
|
|
53
53
|
readonly inputSchema: Schema.optional<Schema.Unknown>;
|
|
54
54
|
readonly outputSchema: Schema.optional<Schema.Unknown>;
|
|
55
|
+
readonly schemaDefinitions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
55
56
|
readonly inputTypeScript: Schema.optional<Schema.String>;
|
|
56
57
|
readonly outputTypeScript: Schema.optional<Schema.String>;
|
|
57
58
|
readonly typeScriptDefinitions: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA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AW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC;CACxC;AASD,eAAO,MAAM,UAAU;;;;;;;;;;EAUrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAUhD,eAAO,MAAM,qBAAqB;IAChC,qEAAqE;;IAErE;+BAC2B;;IAE3B,8DAA8D;;IAE9D;2BACuB;;IAEvB;+BAC2B;;EAE3B,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAC;AAMtE,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC;;;8EAG0E;IAC1E,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applySchemaTyping.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/applySchemaTyping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,QA8CzD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
2
|
+
export declare const cloneDeep: <T>(value: T) => T;
|
|
3
|
+
export declare const merge: <T extends object>(target: T, ...sources: ReadonlyArray<object | undefined>) => T;
|
|
4
|
+
export declare const findKey: <T>(object: Record<string, T> | undefined, predicate: (value: T, key: string) => boolean) => string | undefined;
|
|
5
|
+
export declare const memoize: <F extends (arg: any, ...rest: any[]) => any>(fn: F) => F;
|
|
6
|
+
export declare const omit: <T extends object, K extends keyof T>(object: T, ...keys: K[]) => Omit<T, K>;
|
|
7
|
+
export declare const uniqBy: <T>(items: ReadonlyArray<T>, iteratee: (value: T) => string) => T[];
|
|
8
|
+
export declare const deburr: (value: string) => string;
|
|
9
|
+
export declare const upperFirst: (value: string) => string;
|
|
10
|
+
//# sourceMappingURL=compat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/compat.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAI7E,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,CAA2B,CAAC;AAEpE,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,MAAM,EACpC,QAAQ,CAAC,EACT,GAAG,SAAS,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,KAC5C,CAaF,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,EACvB,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,EACrC,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,KAC5C,MAAM,GAAG,SAMX,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,IAAI,CAAC,KAAG,CAQ5E,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,KAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAClE,CAAC;AAE5B,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,OAAO,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,KAAG,CAAC,EAUpF,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,KAAG,MACiB,CAAC;AAEzD,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MAC4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAElC,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAG7D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Options } from "./index";
|
|
2
|
+
import type { AST } from "./types/AST";
|
|
3
|
+
export declare function generate(ast: AST, options?: Options): string;
|
|
4
|
+
declare function generateTypeUnmemoized(ast: AST, options: Options): string;
|
|
5
|
+
export declare const generateType: typeof generateTypeUnmemoized;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/generator.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,KAAK,EACV,GAAG,EAQJ,MAAM,aAAa,CAAC;AAGrB,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,UAAkB,GAAG,MAAM,CAWpE;AAwID,iBAAS,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAQlE;AACD,eAAO,MAAM,YAAY,+BAAkC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { JSONSchema4 } from "./types/json-schema";
|
|
2
|
+
import type { JSONSchema as LinkedJSONSchema } from "./types/JSONSchema";
|
|
3
|
+
export type { EnumJSONSchema, JSONSchema, NamedEnumJSONSchema, CustomTypeJSONSchema, } from "./types/JSONSchema";
|
|
4
|
+
export interface FormatOptions {
|
|
5
|
+
bracketSpacing?: boolean;
|
|
6
|
+
printWidth?: number;
|
|
7
|
+
semi?: boolean;
|
|
8
|
+
singleQuote?: boolean;
|
|
9
|
+
tabWidth?: number;
|
|
10
|
+
trailingComma?: "none" | "es5" | "all";
|
|
11
|
+
useTabs?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type RefOptions = Record<string, unknown>;
|
|
14
|
+
export interface Options {
|
|
15
|
+
/**
|
|
16
|
+
* Preserved for upstream API compatibility.
|
|
17
|
+
*
|
|
18
|
+
* Executor's vendored compiler only resolves same-document JSON Pointer
|
|
19
|
+
* `$ref`s and never fetches or reads external references, so this option is
|
|
20
|
+
* accepted but ignored.
|
|
21
|
+
*/
|
|
22
|
+
$refOptions: RefOptions;
|
|
23
|
+
/**
|
|
24
|
+
* Default value for additionalProperties, when it is not explicitly set.
|
|
25
|
+
*/
|
|
26
|
+
additionalProperties: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Disclaimer comment prepended to the top of each generated file.
|
|
29
|
+
*/
|
|
30
|
+
bannerComment: string;
|
|
31
|
+
/**
|
|
32
|
+
* Custom function to provide a type name for a given schema
|
|
33
|
+
*/
|
|
34
|
+
customName?: (schema: LinkedJSONSchema, keyNameFromDefinition: string | undefined) => string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Preserved for upstream API compatibility. External refs are not resolved,
|
|
37
|
+
* so this option is accepted but ignored.
|
|
38
|
+
*/
|
|
39
|
+
cwd: string;
|
|
40
|
+
/**
|
|
41
|
+
* Declare external schemas referenced via `$ref`?
|
|
42
|
+
*/
|
|
43
|
+
declareExternallyReferenced: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Prepend enums with [`const`](https://www.typescriptlang.org/docs/handbook/enums.html#computed-and-constant-members)?
|
|
46
|
+
*/
|
|
47
|
+
enableConstEnums: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Create enums from JSON enums with eponymous keys
|
|
50
|
+
*/
|
|
51
|
+
inferStringEnumKeysFromValues: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Format code? Preserved for upstream API compatibility.
|
|
54
|
+
*
|
|
55
|
+
* Executor's vendored compiler does not bundle a formatter, so this option is
|
|
56
|
+
* accepted but does not change output.
|
|
57
|
+
*/
|
|
58
|
+
format: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Ignore maxItems and minItems for `array` types, preventing tuples being generated.
|
|
61
|
+
*/
|
|
62
|
+
ignoreMinAndMaxItems: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Maximum number of unioned tuples to emit when representing bounded-size array types,
|
|
65
|
+
* before falling back to emitting unbounded arrays. Increase this to improve precision
|
|
66
|
+
* of emitted types, decrease it to improve performance, or set it to `-1` to ignore
|
|
67
|
+
* `minItems` and `maxItems`.
|
|
68
|
+
*/
|
|
69
|
+
maxItems: number;
|
|
70
|
+
/**
|
|
71
|
+
* Append all index signatures with `| undefined` so that they are strictly typed.
|
|
72
|
+
*
|
|
73
|
+
* This is required to be compatible with `strictNullChecks`.
|
|
74
|
+
*/
|
|
75
|
+
strictIndexSignatures: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Formatting configuration. Preserved for upstream API compatibility.
|
|
78
|
+
*/
|
|
79
|
+
style: FormatOptions;
|
|
80
|
+
/**
|
|
81
|
+
* Generate code for `definitions` that aren't referenced by the schema?
|
|
82
|
+
*/
|
|
83
|
+
unreachableDefinitions: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Generate unknown type instead of any
|
|
86
|
+
*/
|
|
87
|
+
unknownAny: boolean;
|
|
88
|
+
}
|
|
89
|
+
export declare const DEFAULT_OPTIONS: Options;
|
|
90
|
+
export declare function compile(schema: JSONSchema4, name: string, options?: Partial<Options>): string;
|
|
91
|
+
export declare class ValidationError extends Error {
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAWvD,OAAO,KAAK,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEzE,YAAY,EACV,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,WAAW,OAAO;IACtB;;;;;;OAMG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,CACX,MAAM,EAAE,gBAAgB,EACxB,qBAAqB,EAAE,MAAM,GAAG,SAAS,KACtC,MAAM,GAAG,SAAS,CAAC;IACxB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,2BAA2B,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,6BAA6B,EAAE,OAAO,CAAC;IACvC;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,EAAE,OA4B7B,CAAC;AAEF,wBAAgB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,OAAO,CAAM,GAAG,MAAM,CAsBjG;AAED,qBAAa,eAAgB,SAAQ,KAAK;CAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JSONSchema, LinkedJSONSchema } from "./types/JSONSchema";
|
|
2
|
+
import type { JSONSchema4Type } from "./types/json-schema";
|
|
3
|
+
/**
|
|
4
|
+
* Traverses over the schema, giving each node a reference to its
|
|
5
|
+
* parent node. We need this for downstream operations.
|
|
6
|
+
*/
|
|
7
|
+
export declare function link(schema: JSONSchema4Type | JSONSchema, parent?: JSONSchema4Type | null): LinkedJSONSchema;
|
|
8
|
+
//# sourceMappingURL=linker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/linker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,IAAI,CAClB,MAAM,EAAE,eAAe,GAAG,UAAU,EACpC,MAAM,GAAE,eAAe,GAAG,IAAW,GACpC,gBAAgB,CA4BlB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LinkedJSONSchema, NormalizedJSONSchema } from "./types/JSONSchema";
|
|
2
|
+
import type { Options } from "./";
|
|
3
|
+
import type { DereferencedPaths } from "./resolver";
|
|
4
|
+
export declare function normalize(rootSchema: LinkedJSONSchema, dereferencedPaths: DereferencedPaths, filename: string, options: Options): NormalizedJSONSchema;
|
|
5
|
+
//# sourceMappingURL=normalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/normalizer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAuRpD,wBAAgB,SAAS,CACvB,UAAU,EAAE,gBAAgB,EAC5B,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GACf,oBAAoB,CAKtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizer.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/optimizer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAGjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvC,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,WAAiB,GAAG,GAAG,CA2DpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionValidator.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/optionValidator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAEjC,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAIpE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JSONSchema4Type } from "./types/json-schema";
|
|
2
|
+
import type { Options } from "./";
|
|
3
|
+
import type { AST } from "./types/AST";
|
|
4
|
+
import type { NormalizedJSONSchema, SchemaType } from "./types/JSONSchema";
|
|
5
|
+
export type Processed = Map<NormalizedJSONSchema, Map<SchemaType, AST>>;
|
|
6
|
+
export type UsedNames = Set<string>;
|
|
7
|
+
export declare function parse(schema: NormalizedJSONSchema | JSONSchema4Type, options: Options, keyName?: string, processed?: Processed, usedNames?: Set<string>): AST;
|
|
8
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,qBAAqB,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,KAAK,EACV,GAAG,EAMJ,MAAM,aAAa,CAAC;AAOrB,OAAO,KAAK,EAIV,oBAAoB,EAEpB,UAAU,EACX,MAAM,oBAAoB,CAAC;AAI5B,MAAM,MAAM,SAAS,GAAG,GAAG,CAAC,oBAAoB,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;AAExE,MAAM,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AAEpC,wBAAgB,KAAK,CACnB,MAAM,EAAE,oBAAoB,GAAG,eAAe,EAC9C,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,GAAE,SAAqB,EAChC,SAAS,cAAoB,GAC5B,GAAG,CA8CL"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JSONSchema } from "./types/JSONSchema";
|
|
2
|
+
export type DereferencedPaths = WeakMap<JSONSchema, string>;
|
|
3
|
+
export declare function dereference(schema: JSONSchema): {
|
|
4
|
+
dereferencedPaths: DereferencedPaths;
|
|
5
|
+
dereferencedSchema: JSONSchema;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/vendor/json-schema-to-typescript/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAiI5D,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG;IAC/C,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,EAAE,UAAU,CAAC;CAChC,CAWA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { JSONSchema4Type } from "./json-schema";
|
|
2
|
+
export type AST_TYPE = AST["type"];
|
|
3
|
+
export type AST = TAny | TArray | TBoolean | TEnum | TInterface | TNamedInterface | TIntersection | TLiteral | TNever | TNumber | TNull | TObject | TReference | TString | TTuple | TUnion | TUnknown | TCustomType;
|
|
4
|
+
export interface AbstractAST {
|
|
5
|
+
comment?: string;
|
|
6
|
+
keyName?: string;
|
|
7
|
+
standaloneName?: string;
|
|
8
|
+
type: AST_TYPE;
|
|
9
|
+
deprecated?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type ASTWithComment = AST & {
|
|
12
|
+
comment: string;
|
|
13
|
+
};
|
|
14
|
+
export type ASTWithName = AST & {
|
|
15
|
+
keyName: string;
|
|
16
|
+
};
|
|
17
|
+
export type ASTWithStandaloneName = AST & {
|
|
18
|
+
standaloneName: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function hasComment(ast: AST): ast is ASTWithComment;
|
|
21
|
+
export declare function hasStandaloneName(ast: AST): ast is ASTWithStandaloneName;
|
|
22
|
+
export interface TAny extends AbstractAST {
|
|
23
|
+
type: "ANY";
|
|
24
|
+
}
|
|
25
|
+
export interface TArray extends AbstractAST {
|
|
26
|
+
type: "ARRAY";
|
|
27
|
+
params: AST;
|
|
28
|
+
}
|
|
29
|
+
export interface TBoolean extends AbstractAST {
|
|
30
|
+
type: "BOOLEAN";
|
|
31
|
+
}
|
|
32
|
+
export interface TEnum extends AbstractAST {
|
|
33
|
+
standaloneName: string;
|
|
34
|
+
type: "ENUM";
|
|
35
|
+
params: TEnumParam[];
|
|
36
|
+
}
|
|
37
|
+
export interface TEnumParam {
|
|
38
|
+
ast: AST;
|
|
39
|
+
keyName: string;
|
|
40
|
+
}
|
|
41
|
+
export interface TInterface extends AbstractAST {
|
|
42
|
+
type: "INTERFACE";
|
|
43
|
+
params: TInterfaceParam[];
|
|
44
|
+
superTypes: TNamedInterface[];
|
|
45
|
+
}
|
|
46
|
+
export interface TNamedInterface extends AbstractAST {
|
|
47
|
+
standaloneName: string;
|
|
48
|
+
type: "INTERFACE";
|
|
49
|
+
params: TInterfaceParam[];
|
|
50
|
+
superTypes: TNamedInterface[];
|
|
51
|
+
}
|
|
52
|
+
export interface TNever extends AbstractAST {
|
|
53
|
+
type: "NEVER";
|
|
54
|
+
}
|
|
55
|
+
export interface TInterfaceParam {
|
|
56
|
+
ast: AST;
|
|
57
|
+
keyName: string;
|
|
58
|
+
isRequired: boolean;
|
|
59
|
+
isPatternProperty: boolean;
|
|
60
|
+
isUnreachableDefinition: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface TIntersection extends AbstractAST {
|
|
63
|
+
type: "INTERSECTION";
|
|
64
|
+
params: AST[];
|
|
65
|
+
}
|
|
66
|
+
export interface TLiteral extends AbstractAST {
|
|
67
|
+
params: JSONSchema4Type;
|
|
68
|
+
type: "LITERAL";
|
|
69
|
+
}
|
|
70
|
+
export interface TNumber extends AbstractAST {
|
|
71
|
+
type: "NUMBER";
|
|
72
|
+
}
|
|
73
|
+
export interface TNull extends AbstractAST {
|
|
74
|
+
type: "NULL";
|
|
75
|
+
}
|
|
76
|
+
export interface TObject extends AbstractAST {
|
|
77
|
+
type: "OBJECT";
|
|
78
|
+
}
|
|
79
|
+
export interface TReference extends AbstractAST {
|
|
80
|
+
type: "REFERENCE";
|
|
81
|
+
params: string;
|
|
82
|
+
}
|
|
83
|
+
export interface TString extends AbstractAST {
|
|
84
|
+
type: "STRING";
|
|
85
|
+
}
|
|
86
|
+
export interface TTuple extends AbstractAST {
|
|
87
|
+
type: "TUPLE";
|
|
88
|
+
params: AST[];
|
|
89
|
+
spreadParam?: AST;
|
|
90
|
+
minItems: number;
|
|
91
|
+
maxItems?: number;
|
|
92
|
+
}
|
|
93
|
+
export interface TUnion extends AbstractAST {
|
|
94
|
+
type: "UNION";
|
|
95
|
+
params: AST[];
|
|
96
|
+
}
|
|
97
|
+
export interface TUnknown extends AbstractAST {
|
|
98
|
+
type: "UNKNOWN";
|
|
99
|
+
}
|
|
100
|
+
export interface TCustomType extends AbstractAST {
|
|
101
|
+
type: "CUSTOM_TYPE";
|
|
102
|
+
params: string;
|
|
103
|
+
}
|
|
104
|
+
export declare const T_ANY: TAny;
|
|
105
|
+
export declare const T_ANY_ADDITIONAL_PROPERTIES: TAny & ASTWithName;
|
|
106
|
+
export declare const T_UNKNOWN: TUnknown;
|
|
107
|
+
export declare const T_UNKNOWN_ADDITIONAL_PROPERTIES: TUnknown & ASTWithName;
|
|
108
|
+
//# sourceMappingURL=AST.d.ts.map
|
|
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