hono-apcore 0.1.0

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.
Files changed (139) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +426 -0
  3. package/dist/a2a/apcore-a2a.service.d.ts +44 -0
  4. package/dist/a2a/apcore-a2a.service.d.ts.map +1 -0
  5. package/dist/a2a/apcore-a2a.service.js +82 -0
  6. package/dist/a2a/apcore-a2a.service.js.map +1 -0
  7. package/dist/a2a/index.d.ts +2 -0
  8. package/dist/a2a/index.d.ts.map +1 -0
  9. package/dist/a2a/index.js +2 -0
  10. package/dist/a2a/index.js.map +1 -0
  11. package/dist/bridge/binding-loader.d.ts +45 -0
  12. package/dist/bridge/binding-loader.d.ts.map +1 -0
  13. package/dist/bridge/binding-loader.js +84 -0
  14. package/dist/bridge/binding-loader.js.map +1 -0
  15. package/dist/bridge/index.d.ts +3 -0
  16. package/dist/bridge/index.d.ts.map +1 -0
  17. package/dist/bridge/index.js +2 -0
  18. package/dist/bridge/index.js.map +1 -0
  19. package/dist/cli/apcore-cli.service.d.ts +50 -0
  20. package/dist/cli/apcore-cli.service.d.ts.map +1 -0
  21. package/dist/cli/apcore-cli.service.js +76 -0
  22. package/dist/cli/apcore-cli.service.js.map +1 -0
  23. package/dist/cli/index.d.ts +2 -0
  24. package/dist/cli/index.d.ts.map +1 -0
  25. package/dist/cli/index.js +2 -0
  26. package/dist/cli/index.js.map +1 -0
  27. package/dist/cli.d.ts +4 -0
  28. package/dist/cli.d.ts.map +1 -0
  29. package/dist/cli.js +247 -0
  30. package/dist/cli.js.map +1 -0
  31. package/dist/config.d.ts +55 -0
  32. package/dist/config.d.ts.map +1 -0
  33. package/dist/config.js +86 -0
  34. package/dist/config.js.map +1 -0
  35. package/dist/constants.d.ts +27 -0
  36. package/dist/constants.d.ts.map +1 -0
  37. package/dist/constants.js +27 -0
  38. package/dist/constants.js.map +1 -0
  39. package/dist/context/hono-context.factory.d.ts +61 -0
  40. package/dist/context/hono-context.factory.d.ts.map +1 -0
  41. package/dist/context/hono-context.factory.js +117 -0
  42. package/dist/context/hono-context.factory.js.map +1 -0
  43. package/dist/context/index.d.ts +3 -0
  44. package/dist/context/index.d.ts.map +1 -0
  45. package/dist/context/index.js +2 -0
  46. package/dist/context/index.js.map +1 -0
  47. package/dist/core/apcore.d.ts +135 -0
  48. package/dist/core/apcore.d.ts.map +1 -0
  49. package/dist/core/apcore.js +257 -0
  50. package/dist/core/apcore.js.map +1 -0
  51. package/dist/core/executor.d.ts +32 -0
  52. package/dist/core/executor.d.ts.map +1 -0
  53. package/dist/core/executor.js +41 -0
  54. package/dist/core/executor.js.map +1 -0
  55. package/dist/core/middleware.d.ts +61 -0
  56. package/dist/core/middleware.d.ts.map +1 -0
  57. package/dist/core/middleware.js +51 -0
  58. package/dist/core/middleware.js.map +1 -0
  59. package/dist/core/registry.d.ts +79 -0
  60. package/dist/core/registry.d.ts.map +1 -0
  61. package/dist/core/registry.js +218 -0
  62. package/dist/core/registry.js.map +1 -0
  63. package/dist/index.d.ts +33 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +71 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/mcp/apcore-mcp.service.d.ts +83 -0
  68. package/dist/mcp/apcore-mcp.service.d.ts.map +1 -0
  69. package/dist/mcp/apcore-mcp.service.js +189 -0
  70. package/dist/mcp/apcore-mcp.service.js.map +1 -0
  71. package/dist/mcp/index.d.ts +5 -0
  72. package/dist/mcp/index.d.ts.map +1 -0
  73. package/dist/mcp/index.js +3 -0
  74. package/dist/mcp/index.js.map +1 -0
  75. package/dist/mcp/mount.d.ts +51 -0
  76. package/dist/mcp/mount.d.ts.map +1 -0
  77. package/dist/mcp/mount.js +95 -0
  78. package/dist/mcp/mount.js.map +1 -0
  79. package/dist/output/index.d.ts +3 -0
  80. package/dist/output/index.d.ts.map +1 -0
  81. package/dist/output/index.js +2 -0
  82. package/dist/output/index.js.map +1 -0
  83. package/dist/output/yaml-writer.d.ts +31 -0
  84. package/dist/output/yaml-writer.d.ts.map +1 -0
  85. package/dist/output/yaml-writer.js +49 -0
  86. package/dist/output/yaml-writer.js.map +1 -0
  87. package/dist/scanners/hono-route-scanner.d.ts +60 -0
  88. package/dist/scanners/hono-route-scanner.d.ts.map +1 -0
  89. package/dist/scanners/hono-route-scanner.js +217 -0
  90. package/dist/scanners/hono-route-scanner.js.map +1 -0
  91. package/dist/scanners/index.d.ts +3 -0
  92. package/dist/scanners/index.d.ts.map +1 -0
  93. package/dist/scanners/index.js +2 -0
  94. package/dist/scanners/index.js.map +1 -0
  95. package/dist/schema/adapters/json-schema.adapter.d.ts +23 -0
  96. package/dist/schema/adapters/json-schema.adapter.d.ts.map +1 -0
  97. package/dist/schema/adapters/json-schema.adapter.js +40 -0
  98. package/dist/schema/adapters/json-schema.adapter.js.map +1 -0
  99. package/dist/schema/adapters/schema-adapter.interface.d.ts +24 -0
  100. package/dist/schema/adapters/schema-adapter.interface.d.ts.map +1 -0
  101. package/dist/schema/adapters/schema-adapter.interface.js +2 -0
  102. package/dist/schema/adapters/schema-adapter.interface.js.map +1 -0
  103. package/dist/schema/adapters/typebox.adapter.d.ts +26 -0
  104. package/dist/schema/adapters/typebox.adapter.d.ts.map +1 -0
  105. package/dist/schema/adapters/typebox.adapter.js +39 -0
  106. package/dist/schema/adapters/typebox.adapter.js.map +1 -0
  107. package/dist/schema/adapters/zod.adapter.d.ts +17 -0
  108. package/dist/schema/adapters/zod.adapter.d.ts.map +1 -0
  109. package/dist/schema/adapters/zod.adapter.js +372 -0
  110. package/dist/schema/adapters/zod.adapter.js.map +1 -0
  111. package/dist/schema/index.d.ts +6 -0
  112. package/dist/schema/index.d.ts.map +1 -0
  113. package/dist/schema/index.js +5 -0
  114. package/dist/schema/index.js.map +1 -0
  115. package/dist/schema/schema-extractor.d.ts +51 -0
  116. package/dist/schema/schema-extractor.d.ts.map +1 -0
  117. package/dist/schema/schema-extractor.js +89 -0
  118. package/dist/schema/schema-extractor.js.map +1 -0
  119. package/dist/tools/define-tool.d.ts +68 -0
  120. package/dist/tools/define-tool.d.ts.map +1 -0
  121. package/dist/tools/define-tool.js +122 -0
  122. package/dist/tools/define-tool.js.map +1 -0
  123. package/dist/tools/index.d.ts +3 -0
  124. package/dist/tools/index.d.ts.map +1 -0
  125. package/dist/tools/index.js +2 -0
  126. package/dist/tools/index.js.map +1 -0
  127. package/dist/types.d.ts +246 -0
  128. package/dist/types.d.ts.map +1 -0
  129. package/dist/types.js +2 -0
  130. package/dist/types.js.map +1 -0
  131. package/dist/utils/id-generator.d.ts +52 -0
  132. package/dist/utils/id-generator.d.ts.map +1 -0
  133. package/dist/utils/id-generator.js +87 -0
  134. package/dist/utils/id-generator.js.map +1 -0
  135. package/dist/utils/module-factory.d.ts +34 -0
  136. package/dist/utils/module-factory.d.ts.map +1 -0
  137. package/dist/utils/module-factory.js +59 -0
  138. package/dist/utils/module-factory.js.map +1 -0
  139. package/package.json +109 -0
@@ -0,0 +1,217 @@
1
+ import { ModuleExecuteError, TraceContext, matchPattern } from 'apcore-js';
2
+ import { BaseScanner, createScannedModule, extractPathParamNames, generateSuggestedAlias, substitutePathParams, } from 'apcore-toolkit';
3
+ import { defaultSchemaExtractor } from '../schema/schema-extractor.js';
4
+ import { applyModulePrefix } from '../utils/id-generator.js';
5
+ import { normalizeResult, toModuleAnnotations } from '../utils/module-factory.js';
6
+ /** Methods skipped unless the caller opts back in. */
7
+ const DEFAULT_EXCLUDED_METHODS = ['HEAD', 'OPTIONS'];
8
+ /** Methods whose inputs are carried in a request body rather than the query. */
9
+ const BODY_METHODS = new Set(['POST', 'PUT', 'PATCH']);
10
+ /** Base URL used when replaying a route through `app.request()`. */
11
+ const DEFAULT_BASE_URL = 'http://localhost';
12
+ function methodKey(method, path) {
13
+ return `${method.toUpperCase()} ${path}`;
14
+ }
15
+ function matchesAny(path, patterns) {
16
+ return patterns.some((pattern) => matchPattern(pattern, path));
17
+ }
18
+ /**
19
+ * Build the JSON Schema for a route: one required string property per path
20
+ * parameter, plus a free-form `query` or `body` object depending on method.
21
+ */
22
+ function buildRouteInputSchema(method, path) {
23
+ const properties = {};
24
+ const required = [];
25
+ for (const name of extractPathParamNames(path)) {
26
+ properties[name] = {
27
+ type: 'string',
28
+ description: `Path parameter "${name}" of ${path}`,
29
+ };
30
+ required.push(name);
31
+ }
32
+ if (BODY_METHODS.has(method.toUpperCase())) {
33
+ properties['body'] = {
34
+ type: 'object',
35
+ description: 'JSON request body.',
36
+ additionalProperties: true,
37
+ };
38
+ }
39
+ else {
40
+ properties['query'] = {
41
+ type: 'object',
42
+ description: 'Query-string parameters.',
43
+ additionalProperties: { type: 'string' },
44
+ };
45
+ }
46
+ const schema = { type: 'object', properties };
47
+ if (required.length > 0)
48
+ schema['required'] = required;
49
+ return schema;
50
+ }
51
+ /**
52
+ * Propagate identity and W3C trace headers from the apcore `Context` onto the
53
+ * replayed request, so route-level auth and ACL see the original caller.
54
+ */
55
+ function contextHeaders(context) {
56
+ const headers = {};
57
+ const ctx = context;
58
+ if (!ctx)
59
+ return headers;
60
+ const identity = ctx.identity;
61
+ if (identity) {
62
+ if (identity.id)
63
+ headers['x-user-id'] = identity.id;
64
+ if (identity.roles?.length)
65
+ headers['x-roles'] = identity.roles.join(',');
66
+ }
67
+ try {
68
+ Object.assign(headers, TraceContext.inject(ctx));
69
+ }
70
+ catch {
71
+ // A context without a usable trace id simply carries no trace headers.
72
+ }
73
+ return headers;
74
+ }
75
+ /** Turn a Response into the plain object a module must return. */
76
+ async function responseToResult(response, moduleId) {
77
+ const contentType = response.headers.get('content-type') ?? '';
78
+ const isJson = contentType.includes('json');
79
+ const payload = isJson ? await response.json() : await response.text();
80
+ if (!response.ok) {
81
+ const detail = typeof payload === 'string' ? payload : JSON.stringify(payload);
82
+ throw new ModuleExecuteError(moduleId, `route responded ${response.status} ${response.statusText}: ${detail}`);
83
+ }
84
+ return normalizeResult(payload);
85
+ }
86
+ /**
87
+ * Scans a Hono app's route table and turns each route into an apcore module.
88
+ *
89
+ * Registered modules replay the route in-process through `app.request()`, so
90
+ * middleware, validators, and error handlers all run exactly as they do for a
91
+ * real HTTP request — no duplicated business logic, no second code path.
92
+ *
93
+ * Behavioural annotations are inferred from the HTTP method per RFC 9110
94
+ * safe-method semantics (`GET` → readonly + cacheable, `DELETE` →
95
+ * destructive, `PUT` → idempotent).
96
+ */
97
+ export class HonoRouteScanner extends BaseScanner {
98
+ getSourceName() {
99
+ return 'hono-routes';
100
+ }
101
+ /**
102
+ * Scan the app's routes into toolkit `ScannedModule` intermediates.
103
+ *
104
+ * Use {@link scanWithExecutors} when you also need the bound execute
105
+ * functions — `scan()` returns serialisable metadata only, which is what
106
+ * the `scan` CLI command and YAML binding export want.
107
+ */
108
+ scan(app, options = {}) {
109
+ return this.scanWithExecutors(app, options).map((entry) => entry.module);
110
+ }
111
+ /**
112
+ * Scan the app's routes, returning each module together with the execute
113
+ * function that replays it through `app.request()`.
114
+ */
115
+ scanWithExecutors(app, options = {}) {
116
+ const { modulePrefix, includePaths = [], excludePaths = [], excludeMethods = DEFAULT_EXCLUDED_METHODS, include, exclude, tags = ['http'], overrides = {}, baseUrl = DEFAULT_BASE_URL, } = options;
117
+ const excludedMethods = new Set(excludeMethods.map((m) => m.toUpperCase()));
118
+ const entries = [];
119
+ const seen = new Set();
120
+ for (const route of app.routes) {
121
+ const method = route.method.toUpperCase();
122
+ const path = route.path;
123
+ // `app.use()` registers middleware as method `ALL`; it is not a callable
124
+ // endpoint, and duplicate (method, path) pairs are the same endpoint
125
+ // wrapped by several handlers.
126
+ if (method === 'ALL')
127
+ continue;
128
+ if (excludedMethods.has(method))
129
+ continue;
130
+ const key = methodKey(method, path);
131
+ if (seen.has(key))
132
+ continue;
133
+ seen.add(key);
134
+ if (includePaths.length > 0 && !matchesAny(path, includePaths))
135
+ continue;
136
+ if (excludePaths.length > 0 && matchesAny(path, excludePaths))
137
+ continue;
138
+ const override = overrides[key] ?? {};
139
+ if (override.skip)
140
+ continue;
141
+ entries.push(this.buildEntry(app, method, path, override, {
142
+ modulePrefix,
143
+ tags,
144
+ baseUrl,
145
+ }));
146
+ }
147
+ // Deduplicate and filter while keeping each module paired with its
148
+ // executor. `deduplicateIds` maps 1:1 and preserves order, so index
149
+ // alignment with `entries` still holds after it renames a collision.
150
+ const deduped = this.deduplicateIds(entries.map((entry) => entry.module));
151
+ let paired = deduped.map((module, index) => ({
152
+ module,
153
+ execute: entries[index].execute,
154
+ }));
155
+ if (include || exclude) {
156
+ const kept = new Set(this.filterModules(deduped, include, exclude).map((module) => module.moduleId));
157
+ paired = paired.filter((entry) => kept.has(entry.module.moduleId));
158
+ }
159
+ return paired;
160
+ }
161
+ buildEntry(app, method, path, override, config) {
162
+ const alias = generateSuggestedAlias(path, method);
163
+ const moduleId = applyModulePrefix(override.id ?? alias, config.modulePrefix);
164
+ const inputSchema = override.inputSchema
165
+ ? defaultSchemaExtractor.extractJsonSchema(override.inputSchema)
166
+ : buildRouteInputSchema(method, path);
167
+ const outputSchema = override.outputSchema
168
+ ? defaultSchemaExtractor.extractJsonSchema(override.outputSchema)
169
+ : { type: 'object', properties: {}, additionalProperties: true };
170
+ const module = createScannedModule({
171
+ moduleId,
172
+ description: override.description ?? `${method} ${path}`,
173
+ inputSchema,
174
+ outputSchema,
175
+ tags: [...new Set([...config.tags, ...(override.tags ?? [])])],
176
+ target: methodKey(method, path),
177
+ annotations: toModuleAnnotations(override.annotations) ??
178
+ BaseScanner.inferAnnotationsFromMethod(method),
179
+ documentation: override.documentation ?? null,
180
+ suggestedAlias: alias,
181
+ examples: override.examples ?? [],
182
+ metadata: { http_method: method, http_path: path },
183
+ });
184
+ const execute = async (inputs, context) => {
185
+ const url = buildRequestUrl(path, method, inputs, config.baseUrl);
186
+ const headers = contextHeaders(context);
187
+ const init = { method, headers };
188
+ if (BODY_METHODS.has(method)) {
189
+ headers['content-type'] = 'application/json';
190
+ init.body = JSON.stringify(inputs['body'] ?? {});
191
+ }
192
+ const response = await app.request(url, init);
193
+ return responseToResult(response, moduleId);
194
+ };
195
+ return { module, execute };
196
+ }
197
+ }
198
+ /**
199
+ * Substitute path parameters and append the query string, producing the URL
200
+ * handed to `app.request()`.
201
+ */
202
+ export function buildRequestUrl(path, method, inputs, baseUrl) {
203
+ const concrete = substitutePathParams(path, inputs);
204
+ const url = new URL(concrete, baseUrl);
205
+ if (!BODY_METHODS.has(method.toUpperCase())) {
206
+ const query = inputs['query'];
207
+ if (query !== null && typeof query === 'object' && !Array.isArray(query)) {
208
+ for (const [key, value] of Object.entries(query)) {
209
+ if (value !== undefined && value !== null) {
210
+ url.searchParams.set(key, String(value));
211
+ }
212
+ }
213
+ }
214
+ }
215
+ return url.toString();
216
+ }
217
+ //# sourceMappingURL=hono-route-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hono-route-scanner.js","sourceRoot":"","sources":["../../src/scanners/hono-route-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE3E,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAoBlF,sDAAsD;AACtD,MAAM,wBAAwB,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAErD,gFAAgF;AAChF,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvD,oEAAoE;AACpE,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,SAAS,SAAS,CAAC,MAAc,EAAE,IAAY;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Ae,CAC7B,IAAY,EACZ,MAAc,EACd,MAA+B,EAC/B,OAAe;IAEf,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEvC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;gBAC5E,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBAC1C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { HonoRouteScanner, buildRequestUrl } from './hono-route-scanner.js';
2
+ export type { HonoAppLike } from './hono-route-scanner.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scanners/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { HonoRouteScanner, buildRequestUrl } from './hono-route-scanner.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scanners/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { TSchema } from '@sinclair/typebox';
2
+ import type { SchemaAdapter } from './schema-adapter.interface.js';
3
+ /**
4
+ * Schema adapter for plain JSON Schema objects.
5
+ *
6
+ * JSON Schema is structurally compatible with TypeBox's `TSchema`, so
7
+ * conversion is a deep clone via JSON round-trip.
8
+ */
9
+ export declare class JsonSchemaAdapter implements SchemaAdapter {
10
+ readonly name: "json-schema";
11
+ readonly priority = 30;
12
+ /**
13
+ * Returns `true` for a non-null, non-array object that carries a `type`,
14
+ * `properties`, `anyOf`, `oneOf`, or `$ref` key and is not already a
15
+ * TypeBox schema (those belong to {@link TypeBoxAdapter}).
16
+ */
17
+ detect(input: unknown): boolean;
18
+ /** Deep-clone the JSON Schema; it doubles as a structurally valid TSchema. */
19
+ extract(input: unknown): TSchema;
20
+ /** Deep-clone the JSON Schema. */
21
+ extractJsonSchema(input: unknown): Record<string, unknown>;
22
+ }
23
+ //# sourceMappingURL=json-schema.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema.adapter.d.ts","sourceRoot":"","sources":["../../../src/schema/adapters/json-schema.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAKnE;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IACrD,QAAQ,CAAC,IAAI,EAAG,aAAa,CAAU;IACvC,QAAQ,CAAC,QAAQ,MAAM;IAEvB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAoB/B,8EAA8E;IAC9E,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIhC,kCAAkC;IAClC,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG3D"}
@@ -0,0 +1,40 @@
1
+ /** Well-known symbol used by @sinclair/typebox to tag its schema objects. */
2
+ const TYPEBOX_KIND = Symbol.for('TypeBox.Kind');
3
+ /**
4
+ * Schema adapter for plain JSON Schema objects.
5
+ *
6
+ * JSON Schema is structurally compatible with TypeBox's `TSchema`, so
7
+ * conversion is a deep clone via JSON round-trip.
8
+ */
9
+ export class JsonSchemaAdapter {
10
+ name = 'json-schema';
11
+ priority = 30;
12
+ /**
13
+ * Returns `true` for a non-null, non-array object that carries a `type`,
14
+ * `properties`, `anyOf`, `oneOf`, or `$ref` key and is not already a
15
+ * TypeBox schema (those belong to {@link TypeBoxAdapter}).
16
+ */
17
+ detect(input) {
18
+ if (input === null || typeof input !== 'object' || Array.isArray(input)) {
19
+ return false;
20
+ }
21
+ const obj = input;
22
+ if (TYPEBOX_KIND in obj) {
23
+ return false;
24
+ }
25
+ return ('type' in obj ||
26
+ 'properties' in obj ||
27
+ 'anyOf' in obj ||
28
+ 'oneOf' in obj ||
29
+ '$ref' in obj);
30
+ }
31
+ /** Deep-clone the JSON Schema; it doubles as a structurally valid TSchema. */
32
+ extract(input) {
33
+ return JSON.parse(JSON.stringify(input));
34
+ }
35
+ /** Deep-clone the JSON Schema. */
36
+ extractJsonSchema(input) {
37
+ return JSON.parse(JSON.stringify(input));
38
+ }
39
+ }
40
+ //# sourceMappingURL=json-schema.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema.adapter.js","sourceRoot":"","sources":["../../../src/schema/adapters/json-schema.adapter.ts"],"names":[],"mappings":"AAGA,6EAA6E;AAC7E,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IACnB,IAAI,GAAG,aAAsB,CAAC;IAC9B,QAAQ,GAAG,EAAE,CAAC;IAEvB;;;;OAIG;IACH,MAAM,CAAC,KAAc;QACnB,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACxE,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,GAAG,GAAG,KAAyC,CAAC;QAEtD,IAAI,YAAY,IAAI,GAAG,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,CACL,MAAM,IAAI,GAAG;YACb,YAAY,IAAI,GAAG;YACnB,OAAO,IAAI,GAAG;YACd,OAAO,IAAI,GAAG;YACd,MAAM,IAAI,GAAG,CACd,CAAC;IACJ,CAAC;IAED,8EAA8E;IAC9E,OAAO,CAAC,KAAc;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAY,CAAC;IACtD,CAAC;IAED,kCAAkC;IAClC,iBAAiB,CAAC,KAAc;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAA4B,CAAC;IACtE,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ import type { TSchema } from '@sinclair/typebox';
2
+ /**
3
+ * Contract for pluggable schema adapters.
4
+ *
5
+ * Each adapter knows how to detect one schema dialect (TypeBox, Zod, plain
6
+ * JSON Schema, ...) and convert it into the two canonical representations
7
+ * apcore consumes.
8
+ */
9
+ export interface SchemaAdapter {
10
+ /** Human-readable adapter name, e.g. `'typebox'` or `'json-schema'`. */
11
+ readonly name: string;
12
+ /**
13
+ * Selection weight. Adapters are tried in **descending** priority order,
14
+ * so a higher number wins when two adapters both claim an input.
15
+ */
16
+ readonly priority: number;
17
+ /** Return `true` when `input` is a schema this adapter can handle. */
18
+ detect(input: unknown): boolean;
19
+ /** Convert `input` into a TypeBox-compatible `TSchema` object. */
20
+ extract(input: unknown): TSchema;
21
+ /** Convert `input` into a plain JSON Schema object. */
22
+ extractJsonSchema(input: unknown): Record<string, unknown>;
23
+ }
24
+ //# sourceMappingURL=schema-adapter.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-adapter.interface.d.ts","sourceRoot":"","sources":["../../../src/schema/adapters/schema-adapter.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,sEAAsE;IACtE,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IAEhC,kEAAkE;IAClE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IAEjC,uDAAuD;IACvD,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema-adapter.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-adapter.interface.js","sourceRoot":"","sources":["../../../src/schema/adapters/schema-adapter.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import type { TSchema } from '@sinclair/typebox';
2
+ import type { SchemaAdapter } from './schema-adapter.interface.js';
3
+ /**
4
+ * Schema adapter for `@sinclair/typebox` schemas.
5
+ *
6
+ * TypeBox schemas are already valid JSON Schema objects decorated with extra
7
+ * `Symbol` properties that the TypeBox runtime (`Value.Check()`) relies on.
8
+ */
9
+ export declare class TypeBoxAdapter implements SchemaAdapter {
10
+ readonly name: "typebox";
11
+ readonly priority = 100;
12
+ /** Returns `true` when `input` carries `Symbol.for('TypeBox.Kind')`. */
13
+ detect(input: unknown): boolean;
14
+ /**
15
+ * Return the TypeBox schema as-is — its `Symbol` keys must survive for
16
+ * runtime validation to work.
17
+ */
18
+ extract(input: unknown): TSchema;
19
+ /**
20
+ * Convert a TypeBox schema to plain JSON Schema. Because TypeBox *is* JSON
21
+ * Schema with extra symbol decorations, a JSON round-trip drops the symbols
22
+ * and leaves a standards-compliant document.
23
+ */
24
+ extractJsonSchema(input: unknown): Record<string, unknown>;
25
+ }
26
+ //# sourceMappingURL=typebox.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typebox.adapter.d.ts","sourceRoot":"","sources":["../../../src/schema/adapters/typebox.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAQnE;;;;;GAKG;AACH,qBAAa,cAAe,YAAW,aAAa;IAClD,QAAQ,CAAC,IAAI,EAAG,SAAS,CAAU;IACnC,QAAQ,CAAC,QAAQ,OAAO;IAExB,wEAAwE;IACxE,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAM/B;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIhC;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG3D"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Well-known TypeBox symbol tagging every schema node. Looking it up lets
3
+ * detection work without importing TypeBox at runtime.
4
+ */
5
+ const KIND = Symbol.for('TypeBox.Kind');
6
+ /**
7
+ * Schema adapter for `@sinclair/typebox` schemas.
8
+ *
9
+ * TypeBox schemas are already valid JSON Schema objects decorated with extra
10
+ * `Symbol` properties that the TypeBox runtime (`Value.Check()`) relies on.
11
+ */
12
+ export class TypeBoxAdapter {
13
+ name = 'typebox';
14
+ priority = 100;
15
+ /** Returns `true` when `input` carries `Symbol.for('TypeBox.Kind')`. */
16
+ detect(input) {
17
+ if (input === null || input === undefined)
18
+ return false;
19
+ if (typeof input !== 'object')
20
+ return false;
21
+ return KIND in input;
22
+ }
23
+ /**
24
+ * Return the TypeBox schema as-is — its `Symbol` keys must survive for
25
+ * runtime validation to work.
26
+ */
27
+ extract(input) {
28
+ return input;
29
+ }
30
+ /**
31
+ * Convert a TypeBox schema to plain JSON Schema. Because TypeBox *is* JSON
32
+ * Schema with extra symbol decorations, a JSON round-trip drops the symbols
33
+ * and leaves a standards-compliant document.
34
+ */
35
+ extractJsonSchema(input) {
36
+ return JSON.parse(JSON.stringify(input));
37
+ }
38
+ }
39
+ //# sourceMappingURL=typebox.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typebox.adapter.js","sourceRoot":"","sources":["../../../src/schema/adapters/typebox.adapter.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAExC;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IAChB,IAAI,GAAG,SAAkB,CAAC;IAC1B,QAAQ,GAAG,GAAG,CAAC;IAExB,wEAAwE;IACxE,MAAM,CAAC,KAAc;QACnB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACxD,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,OAAO,IAAI,IAAK,KAAgB,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,KAAc;QACpB,OAAO,KAAgB,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,KAAc;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAA4B,CAAC;IACtE,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import type { TSchema } from '@sinclair/typebox';
2
+ import type { SchemaAdapter } from './schema-adapter.interface.js';
3
+ /**
4
+ * Schema adapter for Zod, supporting both Zod 3 and Zod 4.
5
+ *
6
+ * Detection and conversion are structural — Zod is never imported — so the
7
+ * adapter works whichever major version (if any) the host app installs.
8
+ * Zod 3 is recognised by `_def.typeName`, Zod 4 by `_zod.def.type`.
9
+ */
10
+ export declare class ZodAdapter implements SchemaAdapter {
11
+ readonly name: "zod";
12
+ readonly priority = 50;
13
+ detect(input: unknown): boolean;
14
+ extract(input: unknown): TSchema;
15
+ extractJsonSchema(input: unknown): Record<string, unknown>;
16
+ }
17
+ //# sourceMappingURL=zod.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.adapter.d.ts","sourceRoot":"","sources":["../../../src/schema/adapters/zod.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA4bnE;;;;;;GAMG;AACH,qBAAa,UAAW,YAAW,aAAa;IAC9C,QAAQ,CAAC,IAAI,EAAG,KAAK,CAAU;IAC/B,QAAQ,CAAC,QAAQ,MAAM;IAEvB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAI/B,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIhC,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAK3D"}