@apollo-deploy/tesseract 1.7.0 → 1.9.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.
- package/dist/collector.d.ts +82 -0
- package/dist/collector.d.ts.map +1 -1
- package/dist/collector.js +221 -5
- package/dist/collector.js.map +1 -1
- package/dist/fastify.d.ts +1 -9
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +73 -151
- package/dist/fastify.js.map +1 -1
- package/package.json +1 -1
package/dist/collector.d.ts
CHANGED
|
@@ -29,6 +29,17 @@
|
|
|
29
29
|
import type { BackendManifest, ManifestRouteSchema } from './types/manifest.js';
|
|
30
30
|
import type { SDKModuleConfig, SDKRouteConfig } from './types/sdk-module.js';
|
|
31
31
|
import type { TargetLanguage } from './types/ir.js';
|
|
32
|
+
/**
|
|
33
|
+
* Minimal interface for Zod v4's global registry — only what Tesseract needs.
|
|
34
|
+
* Declared here so adapters don't need a hard dependency on `zod`.
|
|
35
|
+
*/
|
|
36
|
+
export interface ZodGlobalRegistry {
|
|
37
|
+
get(schema: unknown): {
|
|
38
|
+
id?: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
/** Internal id→schema map present in Zod v4 registries. */
|
|
41
|
+
_idmap?: Map<string, unknown>;
|
|
42
|
+
}
|
|
32
43
|
export interface CollectorOptions {
|
|
33
44
|
/** API metadata written into the generated package.json and README. */
|
|
34
45
|
info: {
|
|
@@ -50,6 +61,33 @@ export interface CollectorOptions {
|
|
|
50
61
|
version?: string;
|
|
51
62
|
importPath?: string;
|
|
52
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Function to convert framework-specific schema objects (e.g. raw Zod schemas)
|
|
66
|
+
* to JSON Schema at generation time.
|
|
67
|
+
*
|
|
68
|
+
* Required when using `fastify-type-provider-zod` or passing raw Zod schemas
|
|
69
|
+
* directly to route/collector configs. Pass `toJSONSchema` from `zod` v4.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { toJSONSchema } from 'zod';
|
|
74
|
+
* new SDKCollector({ ..., schemaConverter: toJSONSchema });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
schemaConverter?: (schema: unknown) => unknown;
|
|
78
|
+
/**
|
|
79
|
+
* Zod v4 global registry — controls how registered schemas are resolved
|
|
80
|
+
* when `schemaConverter` is set.
|
|
81
|
+
*
|
|
82
|
+
* - With `schemaPackage`: registered schemas emit a bare `$ref: 'Id'` so
|
|
83
|
+
* intake creates external import stubs.
|
|
84
|
+
* - Without `schemaPackage` (or when a target sets `schemaPackage: null`):
|
|
85
|
+
* registered schemas are expanded and wrapped in `$defs` so intake
|
|
86
|
+
* generates named data classes (e.g. Kotlin `data class`).
|
|
87
|
+
*
|
|
88
|
+
* Pass `z.globalRegistry` from your app.
|
|
89
|
+
*/
|
|
90
|
+
zodGlobalRegistry?: ZodGlobalRegistry;
|
|
53
91
|
/** `'functional'` (default) or `'class'` (Resend-style `new MySDK('key')`). */
|
|
54
92
|
sdkStyle?: 'functional' | 'class';
|
|
55
93
|
/** `'internal'` (default) or `'public'` (auth key only, baseUrl baked in). */
|
|
@@ -88,6 +126,24 @@ export interface CollectorOptions {
|
|
|
88
126
|
packageVersion?: string;
|
|
89
127
|
clientType?: 'internal' | 'public';
|
|
90
128
|
sdkStyle?: 'functional' | 'class';
|
|
129
|
+
/**
|
|
130
|
+
* Override the schema package for this target.
|
|
131
|
+
*
|
|
132
|
+
* Set to `null` to disable external type imports for this target, causing
|
|
133
|
+
* all types to be generated inline. Useful when the primary output imports
|
|
134
|
+
* from a shared TypeScript package but an additional target (e.g. Kotlin)
|
|
135
|
+
* needs self-contained inline types.
|
|
136
|
+
*
|
|
137
|
+
* Omit to inherit the primary `schemaPackage`.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* additionalTargets: [
|
|
142
|
+
* { language: 'kotlin', output: './sdk/java', schemaPackage: null },
|
|
143
|
+
* ]
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
schemaPackage?: CollectorOptions['schemaPackage'] | null;
|
|
91
147
|
}>;
|
|
92
148
|
}
|
|
93
149
|
export interface CollectorRouteConfig {
|
|
@@ -151,6 +207,32 @@ export declare class SDKCollector {
|
|
|
151
207
|
*/
|
|
152
208
|
tryGenerate(): Promise<boolean>;
|
|
153
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Post-process a JSON Schema produced by `toJSONSchema` so that any `$defs`
|
|
212
|
+
* entry whose key matches a registered global id is lifted to a bare `$ref`.
|
|
213
|
+
* Used in the external-target path so intake treats them as import stubs.
|
|
214
|
+
*/
|
|
215
|
+
export declare function liftRegisteredRefs(schema: unknown, registeredIds: Set<string>): unknown;
|
|
216
|
+
/**
|
|
217
|
+
* Convert a single raw schema value to JSON Schema.
|
|
218
|
+
*
|
|
219
|
+
* - `isExternalTarget: true` — registered schema → bare `$ref: 'Id'` (external import stub)
|
|
220
|
+
* - `isExternalTarget: false` — registered schema → `{ $defs: { Id: <expanded> }, $ref: '#/$defs/Id' }`
|
|
221
|
+
* so `buildManifestFromRoutes` can extract it as a named local definition.
|
|
222
|
+
* - No registry — calls `toJSONSchema` directly; nested `$defs` are extracted by
|
|
223
|
+
* `buildManifestFromRoutes`.
|
|
224
|
+
*/
|
|
225
|
+
export declare function convertSchemaValue(value: unknown, toJSONSchema: (s: unknown) => unknown, zodRegistry?: ZodGlobalRegistry, isExternalTarget?: boolean): unknown;
|
|
226
|
+
/**
|
|
227
|
+
* Convert all schema fields on a single route schema, applying the correct
|
|
228
|
+
* Zod→JSON Schema conversion strategy for the target.
|
|
229
|
+
*/
|
|
230
|
+
export declare function convertRouteSchema(schema: ManifestRouteSchema | undefined, toJSONSchema: (s: unknown) => unknown, zodRegistry?: ZodGlobalRegistry, isExternalTarget?: boolean): ManifestRouteSchema | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* Resolve the `toJSONSchema` converter: use the explicit one if provided,
|
|
233
|
+
* otherwise attempt auto-detection from the host app's `zod` package.
|
|
234
|
+
*/
|
|
235
|
+
export declare function resolveSchemaConverter(explicit?: (s: unknown) => unknown): Promise<((s: unknown) => unknown) | undefined>;
|
|
154
236
|
/**
|
|
155
237
|
* Builds a `BackendManifest` from a flat list of collected routes and a domain
|
|
156
238
|
* registry. Exported so framework adapters (including the Fastify plugin) can
|
package/dist/collector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../src/collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAiB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../src/collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAiB,mBAAmB,EAAc,MAAM,qBAAqB,CAAC;AAC3G,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAClD,2DAA2D;IAC3D,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,8CAA8C;IAC9C,MA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G,SAAS,EACvC,YAAY,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,EACrC,WAAW,CAAC,EAAE,iBAAiB,EAC/B,gBAAgB,CAAC,EAAE,OAAO,GACzB,mBAAmB,GAAG,SAAS,CAiBjC;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,GACjC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC,CAUhD;AAID;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC,EACF,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,EAC9C,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAC9B,aAAa,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,GAChD,eAAe,CAwCjB"}
|
package/dist/collector.js
CHANGED
|
@@ -78,9 +78,27 @@ export class SDKCollector {
|
|
|
78
78
|
/** Generate the SDK from accumulated routes and domains. */
|
|
79
79
|
async generate() {
|
|
80
80
|
const { generate } = await import('./index.js');
|
|
81
|
-
const
|
|
81
|
+
const toJSONSchema = await resolveSchemaConverter(this.opts.schemaConverter);
|
|
82
|
+
/**
|
|
83
|
+
* Build a manifest for a specific schemaPackage context.
|
|
84
|
+
* When `toJSONSchema` is available, routes are re-converted with the
|
|
85
|
+
* correct `isExternalTarget` flag before the manifest is built.
|
|
86
|
+
*/
|
|
87
|
+
const buildManifestFor = (schemaPackage) => {
|
|
88
|
+
if (!toJSONSchema) {
|
|
89
|
+
return buildManifestFromRoutes(this._routes, this._registry, this.opts.info, schemaPackage);
|
|
90
|
+
}
|
|
91
|
+
const isExternal = !!schemaPackage;
|
|
92
|
+
const registry = schemaPackage ? this.opts.zodGlobalRegistry : undefined;
|
|
93
|
+
const converted = this._routes.map((r) => ({
|
|
94
|
+
...r,
|
|
95
|
+
schema: convertRouteSchema(r.schema, toJSONSchema, registry, isExternal),
|
|
96
|
+
}));
|
|
97
|
+
return buildManifestFromRoutes(converted, this._registry, this.opts.info, schemaPackage);
|
|
98
|
+
};
|
|
99
|
+
const primaryManifest = buildManifestFor(this.opts.schemaPackage);
|
|
82
100
|
const primary = await generate({
|
|
83
|
-
manifest,
|
|
101
|
+
manifest: primaryManifest,
|
|
84
102
|
output: this.opts.output,
|
|
85
103
|
language: this.opts.language,
|
|
86
104
|
clientType: this.opts.clientType,
|
|
@@ -89,8 +107,15 @@ export class SDKCollector {
|
|
|
89
107
|
sdkStyle: this.opts.sdkStyle,
|
|
90
108
|
});
|
|
91
109
|
for (const target of this.opts.additionalTargets ?? []) {
|
|
110
|
+
const hasSchemaPackageOverride = Object.prototype.hasOwnProperty.call(target, 'schemaPackage');
|
|
111
|
+
const targetSchemaPackage = hasSchemaPackageOverride
|
|
112
|
+
? (target.schemaPackage ?? undefined)
|
|
113
|
+
: this.opts.schemaPackage;
|
|
114
|
+
const targetManifest = hasSchemaPackageOverride || targetSchemaPackage !== this.opts.schemaPackage
|
|
115
|
+
? buildManifestFor(targetSchemaPackage)
|
|
116
|
+
: primaryManifest;
|
|
92
117
|
const extra = await generate({
|
|
93
|
-
manifest,
|
|
118
|
+
manifest: targetManifest,
|
|
94
119
|
output: target.output,
|
|
95
120
|
language: target.language,
|
|
96
121
|
clientType: target.clientType ?? this.opts.clientType,
|
|
@@ -98,8 +123,6 @@ export class SDKCollector {
|
|
|
98
123
|
packageVersion: target.packageVersion ?? this.opts.packageVersion,
|
|
99
124
|
sdkStyle: target.sdkStyle ?? this.opts.sdkStyle,
|
|
100
125
|
});
|
|
101
|
-
// Merge warnings and counts back into the primary result so callers
|
|
102
|
-
// get a single aggregated result regardless of target count.
|
|
103
126
|
primary.filesWritten += extra.filesWritten;
|
|
104
127
|
primary.filesSkipped += extra.filesSkipped;
|
|
105
128
|
primary.warnings.push(...extra.warnings);
|
|
@@ -131,6 +154,131 @@ export class SDKCollector {
|
|
|
131
154
|
return true;
|
|
132
155
|
}
|
|
133
156
|
}
|
|
157
|
+
// ── Zod schema conversion ─────────────────────────────────────────────────────
|
|
158
|
+
/** Returns true when `value` is a Zod v4 schema instance. */
|
|
159
|
+
function isZodSchema(value) {
|
|
160
|
+
return !!value && typeof value === 'object' && '_zod' in value;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Post-process a JSON Schema produced by `toJSONSchema` so that any `$defs`
|
|
164
|
+
* entry whose key matches a registered global id is lifted to a bare `$ref`.
|
|
165
|
+
* Used in the external-target path so intake treats them as import stubs.
|
|
166
|
+
*/
|
|
167
|
+
export function liftRegisteredRefs(schema, registeredIds) {
|
|
168
|
+
if (!schema || typeof schema !== 'object')
|
|
169
|
+
return schema;
|
|
170
|
+
if (Array.isArray(schema)) {
|
|
171
|
+
return schema.map((item) => liftRegisteredRefs(item, registeredIds));
|
|
172
|
+
}
|
|
173
|
+
const s = schema;
|
|
174
|
+
if (typeof s.$ref === 'string' && s.$ref.startsWith('#/$defs/')) {
|
|
175
|
+
const id = s.$ref.slice('#/$defs/'.length);
|
|
176
|
+
if (registeredIds.has(id))
|
|
177
|
+
return { $ref: id };
|
|
178
|
+
}
|
|
179
|
+
const result = {};
|
|
180
|
+
for (const [key, val] of Object.entries(s)) {
|
|
181
|
+
if (key === '$defs')
|
|
182
|
+
continue;
|
|
183
|
+
result[key] = liftRegisteredRefs(val, registeredIds);
|
|
184
|
+
}
|
|
185
|
+
if (s.$defs && typeof s.$defs === 'object' && !Array.isArray(s.$defs)) {
|
|
186
|
+
const remainingDefs = {};
|
|
187
|
+
for (const [defKey, defVal] of Object.entries(s.$defs)) {
|
|
188
|
+
if (!registeredIds.has(defKey)) {
|
|
189
|
+
remainingDefs[defKey] = liftRegisteredRefs(defVal, registeredIds);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (Object.keys(remainingDefs).length > 0)
|
|
193
|
+
result.$defs = remainingDefs;
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Convert a single raw schema value to JSON Schema.
|
|
199
|
+
*
|
|
200
|
+
* - `isExternalTarget: true` — registered schema → bare `$ref: 'Id'` (external import stub)
|
|
201
|
+
* - `isExternalTarget: false` — registered schema → `{ $defs: { Id: <expanded> }, $ref: '#/$defs/Id' }`
|
|
202
|
+
* so `buildManifestFromRoutes` can extract it as a named local definition.
|
|
203
|
+
* - No registry — calls `toJSONSchema` directly; nested `$defs` are extracted by
|
|
204
|
+
* `buildManifestFromRoutes`.
|
|
205
|
+
*/
|
|
206
|
+
export function convertSchemaValue(value, toJSONSchema, zodRegistry, isExternalTarget) {
|
|
207
|
+
if (isZodSchema(value)) {
|
|
208
|
+
if (zodRegistry) {
|
|
209
|
+
const entry = zodRegistry.get(value);
|
|
210
|
+
if (entry?.id) {
|
|
211
|
+
if (isExternalTarget) {
|
|
212
|
+
return { $ref: entry.id };
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
const expanded = toJSONSchema(value);
|
|
216
|
+
return { $defs: { [entry.id]: expanded }, $ref: `#/$defs/${entry.id}` };
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
return { $ref: entry.id };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
const jsonSchema = toJSONSchema(value);
|
|
225
|
+
if (zodRegistry?._idmap && jsonSchema && typeof jsonSchema === 'object') {
|
|
226
|
+
const registeredIds = new Set(zodRegistry._idmap.keys());
|
|
227
|
+
return liftRegisteredRefs(jsonSchema, registeredIds);
|
|
228
|
+
}
|
|
229
|
+
return jsonSchema;
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
return value;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return value;
|
|
236
|
+
}
|
|
237
|
+
// Schema fields eligible for registry-based $ref replacement.
|
|
238
|
+
// headers are always expanded inline since they're rarely top-level registered schemas.
|
|
239
|
+
const REGISTRY_ELIGIBLE_FIELDS = new Set(['body', 'querystring', 'query', 'params']);
|
|
240
|
+
/**
|
|
241
|
+
* Convert all schema fields on a single route schema, applying the correct
|
|
242
|
+
* Zod→JSON Schema conversion strategy for the target.
|
|
243
|
+
*/
|
|
244
|
+
export function convertRouteSchema(schema, toJSONSchema, zodRegistry, isExternalTarget) {
|
|
245
|
+
if (!schema)
|
|
246
|
+
return schema;
|
|
247
|
+
const result = {};
|
|
248
|
+
for (const [key, val] of Object.entries(schema)) {
|
|
249
|
+
if (key === 'response' && val && typeof val === 'object') {
|
|
250
|
+
const serialized = {};
|
|
251
|
+
for (const [status, responseSchema] of Object.entries(val)) {
|
|
252
|
+
serialized[status] = convertSchemaValue(responseSchema, toJSONSchema, zodRegistry, isExternalTarget);
|
|
253
|
+
}
|
|
254
|
+
result[key] = serialized;
|
|
255
|
+
}
|
|
256
|
+
else if (REGISTRY_ELIGIBLE_FIELDS.has(key)) {
|
|
257
|
+
result[key] = convertSchemaValue(val, toJSONSchema, zodRegistry, isExternalTarget);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
result[key] = convertSchemaValue(val, toJSONSchema);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Resolve the `toJSONSchema` converter: use the explicit one if provided,
|
|
267
|
+
* otherwise attempt auto-detection from the host app's `zod` package.
|
|
268
|
+
*/
|
|
269
|
+
export async function resolveSchemaConverter(explicit) {
|
|
270
|
+
if (typeof explicit === 'function')
|
|
271
|
+
return explicit;
|
|
272
|
+
try {
|
|
273
|
+
const zodPkg = 'zod';
|
|
274
|
+
const zodModule = await import(zodPkg);
|
|
275
|
+
const converter = zodModule.toJSONSchema;
|
|
276
|
+
return typeof converter === 'function' ? converter : undefined;
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
134
282
|
// ── Shared manifest builder ───────────────────────────────────────────────────
|
|
135
283
|
/**
|
|
136
284
|
* Builds a `BackendManifest` from a flat list of collected routes and a domain
|
|
@@ -169,6 +317,7 @@ export function buildManifestFromRoutes(routes, registry, info, schemaPackage) {
|
|
|
169
317
|
},
|
|
170
318
|
...(schemaPackage && { schemaPackage }),
|
|
171
319
|
domains: [...domainMap.values()].map(({ config, routes }) => ({ ...config, routes })),
|
|
320
|
+
...buildDefinitionsFromDefs(routes),
|
|
172
321
|
};
|
|
173
322
|
}
|
|
174
323
|
/** Derives a domain prefix from the first non-parameter URL segment. */
|
|
@@ -176,4 +325,71 @@ function derivePrefix(url) {
|
|
|
176
325
|
const first = url.split('/').find((s) => s.length > 0 && !s.startsWith(':'));
|
|
177
326
|
return first ? '/' + first : '/';
|
|
178
327
|
}
|
|
328
|
+
// ── $defs extraction ──────────────────────────────────────────────────────────
|
|
329
|
+
/**
|
|
330
|
+
* Walk every schema value in every route and collect all `$defs` blocks.
|
|
331
|
+
* When `toJSONSchema` (e.g. Zod v4) produces a schema with `$defs`, those
|
|
332
|
+
* named definitions are lifted into `manifest.definitions` so that intake
|
|
333
|
+
* can generate named data classes (e.g. Kotlin `data class`) rather than
|
|
334
|
+
* expanding every reference inline.
|
|
335
|
+
*
|
|
336
|
+
* Returns `{ definitions }` only when at least one def is found, so the
|
|
337
|
+
* spread into the manifest is a no-op for manifests that have none.
|
|
338
|
+
*/
|
|
339
|
+
function buildDefinitionsFromDefs(routes) {
|
|
340
|
+
const defs = {};
|
|
341
|
+
for (const route of routes) {
|
|
342
|
+
const s = route.schema;
|
|
343
|
+
if (!s)
|
|
344
|
+
continue;
|
|
345
|
+
const fields = [
|
|
346
|
+
s.params,
|
|
347
|
+
s.querystring,
|
|
348
|
+
s.query,
|
|
349
|
+
s.body,
|
|
350
|
+
s.headers,
|
|
351
|
+
...(s.response ? Object.values(s.response) : []),
|
|
352
|
+
];
|
|
353
|
+
for (const field of fields) {
|
|
354
|
+
if (field)
|
|
355
|
+
collectDefs(field, defs);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return Object.keys(defs).length > 0 ? { definitions: defs } : {};
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Recursively collect all `$defs` entries found anywhere in a JSON Schema
|
|
362
|
+
* object into the `out` accumulator. Entries already present are not
|
|
363
|
+
* overwritten (first-write wins, matching JSON Schema semantics).
|
|
364
|
+
*/
|
|
365
|
+
function collectDefs(schema, out) {
|
|
366
|
+
if (!schema || typeof schema !== 'object')
|
|
367
|
+
return;
|
|
368
|
+
if (schema.$defs && typeof schema.$defs === 'object' && !Array.isArray(schema.$defs)) {
|
|
369
|
+
for (const [key, val] of Object.entries(schema.$defs)) {
|
|
370
|
+
if (!(key in out))
|
|
371
|
+
out[key] = val;
|
|
372
|
+
// Recurse into the def itself — it may contain nested $defs
|
|
373
|
+
if (val && typeof val === 'object')
|
|
374
|
+
collectDefs(val, out);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
// Recurse into all schema fields that may contain nested schemas
|
|
378
|
+
for (const key of Object.keys(schema)) {
|
|
379
|
+
if (key === '$defs')
|
|
380
|
+
continue;
|
|
381
|
+
const val = schema[key];
|
|
382
|
+
if (!val || typeof val !== 'object')
|
|
383
|
+
continue;
|
|
384
|
+
if (Array.isArray(val)) {
|
|
385
|
+
for (const item of val) {
|
|
386
|
+
if (item && typeof item === 'object')
|
|
387
|
+
collectDefs(item, out);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
collectDefs(val, out);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
179
395
|
//# sourceMappingURL=collector.js.map
|
package/dist/collector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../src/collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAqFH;;;;;;GAMG;AACH,MAAM,OAAO,YAAY;IACJ,OAAO,GAAoB,EAAE,CAAC;IAC9B,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAC;IACzD,IAAI,CAA6B;IAE1C,YAAY,IAAsB;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAc,EAAE,MAAwC;QAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,GAAW,EAAE,MAAc,EAAE,MAA4B;QAC7D,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO;YAAE,OAAO,IAAI,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,GAAG;YACH,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE;YAC5B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,GAAG,EAAE,MAAM,CAAC,GAAG;SAChB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sFAAsF;IACtF,aAAa;QACX,OAAO,uBAAuB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACxG,CAAC;IAED,4DAA4D;IAC5D,KAAK,CAAC,QAAQ;QACZ,MAAM,EAAE,QAAQ,EAAE,GAAG,MA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CAAC;QACxB,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,SAAS;QAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;gBACvB,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;oBAAE,WAAW,CAAC,IAA+B,EAAE,GAAG,CAAC,CAAC;YAC1F,CAAC;QACH,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,GAA8B,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/fastify.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import type { FastifyInstance, FastifyPluginAsync } from 'fastify';
|
|
|
21
21
|
import type { SDKModuleConfig, SDKRouteConfig } from './types/sdk-module.js';
|
|
22
22
|
import type { TargetLanguage } from './types/ir.js';
|
|
23
23
|
import type { CollectorOptions } from './collector.js';
|
|
24
|
+
import { type ZodGlobalRegistry } from './collector.js';
|
|
24
25
|
declare module 'fastify' {
|
|
25
26
|
interface RouteOptions {
|
|
26
27
|
/** SDK generation configuration for this route. Sibling to `schema`. */
|
|
@@ -156,14 +157,6 @@ export interface TesseractPluginOptions {
|
|
|
156
157
|
export declare function sdkDomain(fastify: FastifyInstance, config: Omit<SDKModuleConfig, 'prefix'> & {
|
|
157
158
|
prefix?: string;
|
|
158
159
|
}): void;
|
|
159
|
-
/** Minimal interface for z.globalRegistry — only what we need. */
|
|
160
|
-
interface ZodGlobalRegistry {
|
|
161
|
-
get(schema: unknown): {
|
|
162
|
-
id?: string;
|
|
163
|
-
} | undefined;
|
|
164
|
-
/** Internal id→schema map present in Zod v4 registries. */
|
|
165
|
-
_idmap?: Map<string, unknown>;
|
|
166
|
-
}
|
|
167
160
|
/**
|
|
168
161
|
* Fastify plugin that collects SDK-annotated routes and generates an SDK
|
|
169
162
|
* when `TESSERACT_GENERATE=1` is set in the environment.
|
|
@@ -184,5 +177,4 @@ interface ZodGlobalRegistry {
|
|
|
184
177
|
* ```
|
|
185
178
|
*/
|
|
186
179
|
export declare const tesseractPlugin: FastifyPluginAsync<TesseractPluginOptions>;
|
|
187
|
-
export {};
|
|
188
180
|
//# sourceMappingURL=fastify.d.ts.map
|
package/dist/fastify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,YAAY;QACpB,wEAAwE;QACxE,GAAG,CAAC,EAAE,cAAc,CAAC;KACtB;IACD,UAAU,qBAAqB;QAC7B,wEAAwE;QACxE,GAAG,CAAC,EAAE,cAAc,CAAC;KACtB;CACF;AAYD,MAAM,WAAW,s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GED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* Or via CLI: `tesseract run dist/app.js`
|
|
19
19
|
*/
|
|
20
20
|
import fp from 'fastify-plugin';
|
|
21
|
+
import { SDKCollector, convertRouteSchema, resolveSchemaConverter, } from './collector.js';
|
|
21
22
|
import { _domainRegistry } from './types/sdk-module.js';
|
|
22
23
|
// ── Domain registration helper ────────────────────────────────────────────────
|
|
23
24
|
/**
|
|
@@ -48,114 +49,6 @@ export function sdkDomain(fastify, config) {
|
|
|
48
49
|
_domainRegistry.set(prefix, { prefix, ...config });
|
|
49
50
|
}
|
|
50
51
|
// ── Plugin ────────────────────────────────────────────────────────────────────
|
|
51
|
-
/** Returns true if `value` is a Zod v4 schema instance. */
|
|
52
|
-
function isZodSchema(value) {
|
|
53
|
-
return !!value && typeof value === 'object' && '_zod' in value;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Post-process a JSON Schema produced by `toJSONSchema` so that any `$defs`
|
|
57
|
-
* entry whose key matches a registered global id is lifted to a bare `$ref`.
|
|
58
|
-
*
|
|
59
|
-
* Zod v4's `toJSONSchema` always emits `$ref: '#/$defs/<id>'` for sub-schemas
|
|
60
|
-
* that have a registry id. Those `#/...` refs are treated as local by
|
|
61
|
-
* `intake.ts` and would be inlined instead of resolved as external imports.
|
|
62
|
-
* This function replaces them with bare `$ref: '<id>'` so `intake.ts` detects
|
|
63
|
-
* them as external type stubs from the configured `schemaPackage`.
|
|
64
|
-
*/
|
|
65
|
-
function liftRegisteredRefs(schema, registeredIds) {
|
|
66
|
-
if (!schema || typeof schema !== 'object')
|
|
67
|
-
return schema;
|
|
68
|
-
if (Array.isArray(schema)) {
|
|
69
|
-
return schema.map((item) => liftRegisteredRefs(item, registeredIds));
|
|
70
|
-
}
|
|
71
|
-
const s = schema;
|
|
72
|
-
// If this node is a local $ref pointing at a registered id, lift it.
|
|
73
|
-
if (typeof s.$ref === 'string' && s.$ref.startsWith('#/$defs/')) {
|
|
74
|
-
const id = s.$ref.slice('#/$defs/'.length);
|
|
75
|
-
if (registeredIds.has(id))
|
|
76
|
-
return { $ref: id };
|
|
77
|
-
}
|
|
78
|
-
// Recurse into all values, skipping $defs (handled separately below).
|
|
79
|
-
const result = {};
|
|
80
|
-
for (const [key, val] of Object.entries(s)) {
|
|
81
|
-
if (key === '$defs')
|
|
82
|
-
continue;
|
|
83
|
-
result[key] = liftRegisteredRefs(val, registeredIds);
|
|
84
|
-
}
|
|
85
|
-
// Re-add only $defs entries that are NOT lifted (i.e. not registered ids).
|
|
86
|
-
if (s.$defs && typeof s.$defs === 'object' && !Array.isArray(s.$defs)) {
|
|
87
|
-
const remainingDefs = {};
|
|
88
|
-
for (const [defKey, defVal] of Object.entries(s.$defs)) {
|
|
89
|
-
if (!registeredIds.has(defKey)) {
|
|
90
|
-
remainingDefs[defKey] = liftRegisteredRefs(defVal, registeredIds);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (Object.keys(remainingDefs).length > 0)
|
|
94
|
-
result.$defs = remainingDefs;
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Convert a single schema value. When `zodRegistry` is provided and the schema
|
|
100
|
-
* has a registered global id, emit a bare `$ref` to that id instead of
|
|
101
|
-
* expanding inline. This lets `intake.ts` treat it as an external type from
|
|
102
|
-
* the configured `schemaPackage`.
|
|
103
|
-
*
|
|
104
|
-
* For schemas that are NOT directly registered but reference registered
|
|
105
|
-
* sub-schemas, `toJSONSchema` is called and then `liftRegisteredRefs`
|
|
106
|
-
* replaces any `$ref: '#/$defs/<id>'` with bare `$ref: '<id>'` for known ids.
|
|
107
|
-
*/
|
|
108
|
-
function convertSchemaValue(value, toJSONSchema, zodRegistry) {
|
|
109
|
-
if (isZodSchema(value)) {
|
|
110
|
-
if (zodRegistry) {
|
|
111
|
-
const entry = zodRegistry.get(value);
|
|
112
|
-
if (entry?.id)
|
|
113
|
-
return { $ref: entry.id };
|
|
114
|
-
}
|
|
115
|
-
try {
|
|
116
|
-
const jsonSchema = toJSONSchema(value);
|
|
117
|
-
if (zodRegistry?._idmap && jsonSchema && typeof jsonSchema === 'object') {
|
|
118
|
-
const registeredIds = new Set(zodRegistry._idmap.keys());
|
|
119
|
-
return liftRegisteredRefs(jsonSchema, registeredIds);
|
|
120
|
-
}
|
|
121
|
-
return jsonSchema;
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
return value;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return value;
|
|
128
|
-
}
|
|
129
|
-
// Schema fields whose values should be treated as typed payloads — eligible for
|
|
130
|
-
// registry-based $ref replacement. All registered Zod schemas in these fields
|
|
131
|
-
// are replaced with a bare $ref so intake.ts can create external type stubs and
|
|
132
|
-
// emit specific named imports instead of wildcard re-exports.
|
|
133
|
-
//
|
|
134
|
-
// Note: headers are always expanded inline since they are rarely modelled as
|
|
135
|
-
// top-level registered schemas and Tesseract reads individual header names.
|
|
136
|
-
const REGISTRY_ELIGIBLE_FIELDS = new Set(['body', 'querystring', 'query', 'params']);
|
|
137
|
-
function convertRouteSchema(schema, toJSONSchema, zodRegistry) {
|
|
138
|
-
if (!schema)
|
|
139
|
-
return schema;
|
|
140
|
-
const result = {};
|
|
141
|
-
for (const [key, val] of Object.entries(schema)) {
|
|
142
|
-
if (key === 'response' && val && typeof val === 'object') {
|
|
143
|
-
const serialized = {};
|
|
144
|
-
for (const [status, responseSchema] of Object.entries(val)) {
|
|
145
|
-
serialized[status] = convertSchemaValue(responseSchema, toJSONSchema, zodRegistry);
|
|
146
|
-
}
|
|
147
|
-
result[key] = serialized;
|
|
148
|
-
}
|
|
149
|
-
else if (REGISTRY_ELIGIBLE_FIELDS.has(key)) {
|
|
150
|
-
result[key] = convertSchemaValue(val, toJSONSchema, zodRegistry);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
// headers — always expand inline
|
|
154
|
-
result[key] = convertSchemaValue(val, toJSONSchema);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return result;
|
|
158
|
-
}
|
|
159
52
|
const _tesseractPlugin = async (fastify, opts) => {
|
|
160
53
|
if (!process.env.TESSERACT_GENERATE)
|
|
161
54
|
return;
|
|
@@ -183,42 +76,25 @@ const _tesseractPlugin = async (fastify, opts) => {
|
|
|
183
76
|
console.error('\n[tesseract] No SDK routes found. Add `sdk: { ... }` to routes or use `@SDKModule` + `sdkDomain()`.');
|
|
184
77
|
process.exit(1);
|
|
185
78
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
resolvedRoutes = collectedRoutes.map((r) => ({
|
|
79
|
+
const toJSONSchema = await resolveSchemaConverter(opts.schemaConverter);
|
|
80
|
+
/**
|
|
81
|
+
* Convert collected routes for a specific schemaPackage context.
|
|
82
|
+
* isExternalTarget true → bare $ref (external import stub)
|
|
83
|
+
* isExternalTarget false → $defs-wrapped (named local definition)
|
|
84
|
+
*/
|
|
85
|
+
const convertRoutes = (zodRegistry, isExternalTarget) => {
|
|
86
|
+
if (!toJSONSchema)
|
|
87
|
+
return collectedRoutes;
|
|
88
|
+
return collectedRoutes.map((r) => ({
|
|
197
89
|
...r,
|
|
198
|
-
schema: convertRouteSchema(r.schema, toJSONSchema, zodRegistry),
|
|
90
|
+
schema: convertRouteSchema(r.schema, toJSONSchema, zodRegistry, isExternalTarget),
|
|
199
91
|
}));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const zodConverter = zodModule.toJSONSchema;
|
|
207
|
-
if (typeof zodConverter === 'function') {
|
|
208
|
-
resolvedRoutes = collectedRoutes.map((r) => ({
|
|
209
|
-
...r,
|
|
210
|
-
schema: convertRouteSchema(r.schema, zodConverter, zodRegistry),
|
|
211
|
-
}));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
catch {
|
|
215
|
-
// zod not available — schemas stay as-is (JSON Schema passed directly)
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
// Build a collector from the resolved routes so we can delegate to
|
|
219
|
-
// collector.generate() — this gives us additionalTargets support for free.
|
|
220
|
-
const { SDKCollector } = await import('./collector.js');
|
|
221
|
-
const collector = new SDKCollector({
|
|
92
|
+
};
|
|
93
|
+
const { generate } = await import('./index.js');
|
|
94
|
+
// ── Primary target ──────────────────────────────────────────────────────
|
|
95
|
+
const primaryRegistry = opts.schemaPackage ? opts.zodGlobalRegistry : undefined;
|
|
96
|
+
const primaryRoutes = convertRoutes(primaryRegistry, !!opts.schemaPackage);
|
|
97
|
+
const primaryCollector = new SDKCollector({
|
|
222
98
|
info: opts.info,
|
|
223
99
|
output: opts.output,
|
|
224
100
|
language: opts.language,
|
|
@@ -227,22 +103,68 @@ const _tesseractPlugin = async (fastify, opts) => {
|
|
|
227
103
|
packageName: opts.packageName,
|
|
228
104
|
packageVersion: opts.packageVersion,
|
|
229
105
|
sdkStyle: opts.sdkStyle,
|
|
230
|
-
additionalTargets: opts.additionalTargets,
|
|
231
106
|
});
|
|
232
107
|
for (const [prefix, domainConfig] of _domainRegistry) {
|
|
233
|
-
|
|
108
|
+
primaryCollector.domain(prefix, domainConfig);
|
|
234
109
|
}
|
|
235
|
-
for (const r of
|
|
236
|
-
|
|
110
|
+
for (const r of primaryRoutes) {
|
|
111
|
+
primaryCollector.route(r.url, r.method, { sdk: r.sdk, schema: r.schema, sse: r.sse });
|
|
237
112
|
}
|
|
238
|
-
const
|
|
239
|
-
console.log(`\n[tesseract] ${
|
|
113
|
+
const primaryManifest = primaryCollector.buildManifest();
|
|
114
|
+
console.log(`\n[tesseract] ${primaryManifest.domains.length} domain(s), ${collectedRoutes.length} route(s) → ${opts.output}`);
|
|
240
115
|
try {
|
|
241
|
-
const
|
|
242
|
-
|
|
116
|
+
const primary = await generate({
|
|
117
|
+
manifest: primaryManifest,
|
|
118
|
+
output: opts.output,
|
|
119
|
+
language: opts.language,
|
|
120
|
+
clientType: opts.clientType,
|
|
121
|
+
packageName: opts.packageName,
|
|
122
|
+
packageVersion: opts.packageVersion,
|
|
123
|
+
sdkStyle: opts.sdkStyle,
|
|
124
|
+
});
|
|
125
|
+
for (const w of primary.warnings)
|
|
243
126
|
console.warn(` ⚠ ${w}`);
|
|
127
|
+
console.log(`[tesseract] ✓ ${primary.filesWritten} files written\n`);
|
|
128
|
+
// ── Additional targets ────────────────────────────────────────────────
|
|
129
|
+
for (const target of opts.additionalTargets ?? []) {
|
|
130
|
+
const hasSchemaPackageOverride = Object.prototype.hasOwnProperty.call(target, 'schemaPackage');
|
|
131
|
+
const targetSchemaPackage = hasSchemaPackageOverride
|
|
132
|
+
? (target.schemaPackage ?? undefined)
|
|
133
|
+
: opts.schemaPackage;
|
|
134
|
+
const targetRegistry = targetSchemaPackage ? opts.zodGlobalRegistry : undefined;
|
|
135
|
+
const targetRoutes = hasSchemaPackageOverride || targetSchemaPackage !== opts.schemaPackage
|
|
136
|
+
? convertRoutes(targetRegistry, !!targetSchemaPackage)
|
|
137
|
+
: primaryRoutes;
|
|
138
|
+
const targetCollector = new SDKCollector({
|
|
139
|
+
info: opts.info,
|
|
140
|
+
output: target.output,
|
|
141
|
+
language: target.language,
|
|
142
|
+
schemaPackage: targetSchemaPackage,
|
|
143
|
+
clientType: target.clientType ?? opts.clientType,
|
|
144
|
+
packageName: target.packageName ?? opts.packageName,
|
|
145
|
+
packageVersion: target.packageVersion ?? opts.packageVersion,
|
|
146
|
+
sdkStyle: target.sdkStyle ?? opts.sdkStyle,
|
|
147
|
+
});
|
|
148
|
+
for (const [prefix, domainConfig] of _domainRegistry) {
|
|
149
|
+
targetCollector.domain(prefix, domainConfig);
|
|
150
|
+
}
|
|
151
|
+
for (const r of targetRoutes) {
|
|
152
|
+
targetCollector.route(r.url, r.method, { sdk: r.sdk, schema: r.schema, sse: r.sse });
|
|
153
|
+
}
|
|
154
|
+
console.log(`[tesseract] generating ${target.language} → ${target.output}`);
|
|
155
|
+
const extra = await generate({
|
|
156
|
+
manifest: targetCollector.buildManifest(),
|
|
157
|
+
output: target.output,
|
|
158
|
+
language: target.language,
|
|
159
|
+
clientType: target.clientType ?? opts.clientType,
|
|
160
|
+
packageName: target.packageName ?? opts.packageName,
|
|
161
|
+
packageVersion: target.packageVersion ?? opts.packageVersion,
|
|
162
|
+
sdkStyle: target.sdkStyle ?? opts.sdkStyle,
|
|
163
|
+
});
|
|
164
|
+
for (const w of extra.warnings)
|
|
165
|
+
console.warn(` ⚠ ${w}`);
|
|
166
|
+
console.log(`[tesseract] ✓ ${extra.filesWritten} files written\n`);
|
|
244
167
|
}
|
|
245
|
-
console.log(`[tesseract] ✓ ${result.filesWritten} files written\n`);
|
|
246
168
|
process.exit(0);
|
|
247
169
|
}
|
|
248
170
|
catch (err) {
|
package/dist/fastify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.js","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAMhC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA+HxD,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,SAAS,CACvB,OAAwB,EACxB,MAA6D;IAE7D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC;IACtD,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,iFAAiF;AAEjF,
|
|
1
|
+
{"version":3,"file":"fastify.js","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkB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