@apollo-deploy/tesseract 1.9.0 → 2.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.
- package/README.md +218 -110
- package/dist/adapters/csharp/index.d.ts +5 -8
- package/dist/adapters/csharp/index.d.ts.map +1 -1
- package/dist/adapters/csharp/index.js +314 -74
- package/dist/adapters/csharp/index.js.map +1 -1
- package/dist/adapters/documentation.d.ts +17 -0
- package/dist/adapters/documentation.d.ts.map +1 -0
- package/dist/adapters/documentation.js +268 -0
- package/dist/adapters/documentation.js.map +1 -0
- package/dist/adapters/go/index.d.ts +5 -8
- package/dist/adapters/go/index.d.ts.map +1 -1
- package/dist/adapters/go/index.js +197 -101
- package/dist/adapters/go/index.js.map +1 -1
- package/dist/adapters/kotlin/index.d.ts +5 -9
- package/dist/adapters/kotlin/index.d.ts.map +1 -1
- package/dist/adapters/kotlin/index.js +280 -212
- package/dist/adapters/kotlin/index.js.map +1 -1
- package/dist/adapters/php/index.d.ts +5 -15
- package/dist/adapters/php/index.d.ts.map +1 -1
- package/dist/adapters/php/index.js +362 -90
- package/dist/adapters/php/index.js.map +1 -1
- package/dist/adapters/python/index.d.ts +5 -8
- package/dist/adapters/python/index.d.ts.map +1 -1
- package/dist/adapters/python/index.js +240 -109
- package/dist/adapters/python/index.js.map +1 -1
- package/dist/adapters/ruby/index.d.ts +3 -3
- package/dist/adapters/ruby/index.d.ts.map +1 -1
- package/dist/adapters/ruby/index.js +235 -46
- package/dist/adapters/ruby/index.js.map +1 -1
- package/dist/adapters/rust/index.d.ts +5 -9
- package/dist/adapters/rust/index.d.ts.map +1 -1
- package/dist/adapters/rust/index.js +237 -169
- package/dist/adapters/rust/index.js.map +1 -1
- package/dist/adapters/shared.d.ts +7 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/adapters/shared.js +68 -0
- package/dist/adapters/shared.js.map +1 -0
- package/dist/adapters/type-utils.d.ts +13 -0
- package/dist/adapters/type-utils.d.ts.map +1 -0
- package/dist/adapters/type-utils.js +105 -0
- package/dist/adapters/type-utils.js.map +1 -0
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/typescript/emitter/emitSchema.d.ts +2 -2
- package/dist/adapters/typescript/emitter/emitSchema.js +39 -27
- package/dist/adapters/typescript/emitter/emitSchema.js.map +1 -1
- package/dist/adapters/typescript/emitter/emitTypeScriptModels.d.ts +2 -2
- package/dist/adapters/typescript/emitter/emitTypeScriptModels.js +15 -15
- package/dist/adapters/typescript/emitter/importCollector.d.ts +2 -4
- package/dist/adapters/typescript/emitter/importCollector.d.ts.map +1 -1
- package/dist/adapters/typescript/emitter/importCollector.js +40 -50
- package/dist/adapters/typescript/emitter/importCollector.js.map +1 -1
- package/dist/adapters/typescript/emitter/parsers.d.ts +1 -1
- package/dist/adapters/typescript/emitter/parsers.js +13 -13
- package/dist/adapters/typescript/emitter/typeHoister.d.ts +1 -1
- package/dist/adapters/typescript/emitter/typeHoister.d.ts.map +1 -1
- package/dist/adapters/typescript/emitter/typeHoister.js +12 -20
- package/dist/adapters/typescript/emitter/typeHoister.js.map +1 -1
- package/dist/adapters/typescript/index.d.ts +3 -3
- package/dist/adapters/typescript/index.d.ts.map +1 -1
- package/dist/adapters/typescript/index.js +148 -166
- package/dist/adapters/typescript/index.js.map +1 -1
- package/dist/adapters/typescript/shared.d.ts +2 -2
- package/dist/adapters/typescript/shared.js +12 -12
- package/dist/cli.js +50 -37
- package/dist/cli.js.map +1 -1
- package/dist/collector.d.ts +32 -7
- package/dist/collector.d.ts.map +1 -1
- package/dist/collector.js +149 -49
- package/dist/collector.js.map +1 -1
- package/dist/elysia.js +2 -2
- package/dist/elysia.js.map +1 -1
- package/dist/express.d.ts.map +1 -1
- package/dist/express.js.map +1 -1
- package/dist/fastify.d.ts +9 -2
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +40 -21
- package/dist/fastify.js.map +1 -1
- package/dist/helpers/handlebars.d.ts +7 -16
- package/dist/helpers/handlebars.d.ts.map +1 -1
- package/dist/helpers/handlebars.js +127 -177
- package/dist/helpers/handlebars.js.map +1 -1
- package/dist/hono.d.ts.map +1 -1
- package/dist/hono.js.map +1 -1
- package/dist/index.d.ts +14 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -30
- package/dist/index.js.map +1 -1
- package/dist/koa.d.ts.map +1 -1
- package/dist/koa.js.map +1 -1
- package/dist/nestjs.d.ts.map +1 -1
- package/dist/nestjs.js +41 -14
- package/dist/nestjs.js.map +1 -1
- package/dist/pipeline/enrich.d.ts +2 -13
- package/dist/pipeline/enrich.d.ts.map +1 -1
- package/dist/pipeline/enrich.js +157 -212
- package/dist/pipeline/enrich.js.map +1 -1
- package/dist/pipeline/intake.d.ts +3 -3
- package/dist/pipeline/intake.d.ts.map +1 -1
- package/dist/pipeline/intake.js +342 -238
- package/dist/pipeline/intake.js.map +1 -1
- package/dist/pipeline/write.d.ts +1 -14
- package/dist/pipeline/write.d.ts.map +1 -1
- package/dist/pipeline/write.js +73 -113
- package/dist/pipeline/write.js.map +1 -1
- package/dist/types/config.d.ts +14 -26
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +16 -12
- package/dist/types/config.js.map +1 -1
- package/dist/types/ir.d.ts +12 -8
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/manifest.d.ts +10 -11
- package/dist/types/manifest.d.ts.map +1 -1
- package/dist/types/manifest.js +54 -14
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/sdk-module.d.ts +2 -2
- package/dist/types/sdk-module.js +1 -1
- package/dist/utils/format.d.ts +1 -3
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +3 -10
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/naming.d.ts.map +1 -1
- package/dist/utils/naming.js +174 -184
- package/dist/utils/naming.js.map +1 -1
- package/dist/utils/npm-token.d.ts +1 -17
- package/dist/utils/npm-token.d.ts.map +1 -1
- package/dist/utils/npm-token.js +27 -76
- package/dist/utils/npm-token.js.map +1 -1
- package/dist/utils/version.d.ts +14 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +60 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +4 -3
- package/templates/csharp/client.hbs +26 -49
- package/templates/csharp/csproj.hbs +7 -0
- package/templates/csharp/domain.hbs +48 -130
- package/templates/csharp/errors.hbs +17 -25
- package/templates/csharp/readme.hbs +31 -44
- package/templates/csharp/transport.hbs +238 -136
- package/templates/csharp/types.hbs +30 -76
- package/templates/go/client.hbs +44 -109
- package/templates/go/domain.hbs +83 -25
- package/templates/go/go-mod.hbs +1 -4
- package/templates/go/readme.hbs +32 -29
- package/templates/go/transport.hbs +174 -173
- package/templates/go/types.hbs +17 -53
- package/templates/go/utils.hbs +3 -2
- package/templates/kotlin/build-gradle.hbs +1 -1
- package/templates/kotlin/client.hbs +18 -15
- package/templates/kotlin/domain.hbs +54 -51
- package/templates/kotlin/errors.hbs +1 -1
- package/templates/kotlin/readme.hbs +35 -137
- package/templates/kotlin/transport.hbs +140 -123
- package/templates/kotlin/types.hbs +30 -81
- package/templates/php/client.hbs +8 -46
- package/templates/php/composer.hbs +2 -1
- package/templates/php/domain.hbs +86 -117
- package/templates/php/errors.hbs +1 -1
- package/templates/php/readme.hbs +42 -49
- package/templates/php/transport.hbs +192 -145
- package/templates/php/types.hbs +63 -60
- package/templates/python/client.hbs +15 -2
- package/templates/python/domain.hbs +50 -108
- package/templates/python/pyproject.hbs +5 -0
- package/templates/python/readme.hbs +47 -30
- package/templates/python/resources-init.hbs +1 -1
- package/templates/python/transport.hbs +167 -53
- package/templates/python/types.hbs +22 -58
- package/templates/ruby/client.hbs +10 -6
- package/templates/ruby/domain.hbs +48 -67
- package/templates/ruby/errors.hbs +3 -3
- package/templates/ruby/gemspec.hbs +3 -10
- package/templates/ruby/index.hbs +3 -3
- package/templates/ruby/readme.hbs +33 -70
- package/templates/ruby/transport.hbs +129 -103
- package/templates/ruby/types.hbs +11 -16
- package/templates/ruby/version.hbs +1 -1
- package/templates/rust/cargo.hbs +2 -0
- package/templates/rust/client.hbs +10 -1
- package/templates/rust/domain.hbs +69 -52
- package/templates/rust/error.hbs +3 -1
- package/templates/rust/lib.hbs +4 -5
- package/templates/rust/readme.hbs +33 -46
- package/templates/rust/transport.hbs +170 -159
- package/templates/rust/types.hbs +34 -111
- package/templates/typescript/domain-class.hbs +14 -6
- package/templates/typescript/domain.hbs +13 -5
- package/templates/typescript/package-json.hbs +3 -1
- package/templates/typescript/readme.hbs +42 -42
- package/templates/typescript/transport.hbs +46 -8
- package/templates/typescript/types-errors.hbs +1 -1
- package/dist/adapters/typescript/model-emitter.d.ts +0 -13
- package/dist/adapters/typescript/model-emitter.d.ts.map +0 -1
- package/dist/adapters/typescript/model-emitter.js +0 -415
- package/dist/adapters/typescript/model-emitter.js.map +0 -1
package/dist/koa.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koa.d.ts","sourceRoot":"","sources":["../src/koa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,+EAA+E;AAC/E,KAAK,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"koa.d.ts","sourceRoot":"","sources":["../src/koa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,+EAA+E;AAC/E,KAAK,aAAa,GAAG,CACnB,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KACtB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE1B;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C;;;;;;;;;OASG;IACH,aAAa,CACX,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,oBAAoB,GAC3B,aAAa;CAIjB"}
|
package/dist/koa.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koa.js","sourceRoot":"","sources":["../src/koa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"koa.js","sourceRoot":"","sources":["../src/koa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/C;;;;;;;;;OASG;IACH,aAAa,CACX,GAAW,EACX,MAAc,EACd,MAA4B;QAE5B,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;CACF"}
|
package/dist/nestjs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../src/nestjs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAKH,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,OAAO,CAAC;QAChB,SAAS,cAAc,
|
|
1
|
+
{"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../src/nestjs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAKH,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,OAAO,CAAC;QAChB,SAAS,cAAc,CACrB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAC5B,IAAI,CAAC;QACR,SAAS,WAAW,CAClB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAC5B,OAAO,CAAC;KACZ;CACF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAyB7E,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,0FAA0F;IAC1F,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CASlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,GACtC,cAAc,CAIhB;AAID;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,QAAQ,EAAE,EACvB,SAAS,EAAE,YAAY,GACtB,IAAI,CAiDN"}
|
package/dist/nestjs.js
CHANGED
|
@@ -86,8 +86,14 @@ const NEST_HTTP_METHODS = {
|
|
|
86
86
|
* ```
|
|
87
87
|
*/
|
|
88
88
|
export function SDKMethod(config) {
|
|
89
|
-
return (target, propertyKey) => {
|
|
90
|
-
|
|
89
|
+
return (target, propertyKey, descriptor) => {
|
|
90
|
+
const handler = descriptor?.value;
|
|
91
|
+
if (typeof handler === 'function') {
|
|
92
|
+
Reflect.defineMetadata(SDK_METHOD_META, config, handler);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
Reflect.defineMetadata(SDK_METHOD_META, config, target, propertyKey);
|
|
96
|
+
}
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
99
|
/**
|
|
@@ -117,27 +123,48 @@ export function SDKDomain(config) {
|
|
|
117
123
|
*/
|
|
118
124
|
export function collectFromNestControllers(controllers, collector) {
|
|
119
125
|
for (const ControllerClass of controllers) {
|
|
120
|
-
|
|
121
|
-
const rawPrefix = (Reflect.getMetadata(NEST_PATH_META, ControllerClass) ?? '');
|
|
122
|
-
const prefix = rawPrefix.startsWith('/') ? rawPrefix : '/' + rawPrefix;
|
|
126
|
+
const controllerPaths = toPaths(Reflect.getMetadata(NEST_PATH_META, ControllerClass));
|
|
123
127
|
const domainMeta = Reflect.getMetadata(SDK_DOMAIN_META, ControllerClass);
|
|
124
|
-
collector.domain(prefix, domainMeta);
|
|
125
128
|
const prototype = ControllerClass.prototype;
|
|
129
|
+
for (const controllerPath of controllerPaths) {
|
|
130
|
+
collector.domain(controllerPath, domainMeta);
|
|
131
|
+
}
|
|
126
132
|
for (const key of Object.getOwnPropertyNames(prototype)) {
|
|
127
133
|
if (key === 'constructor')
|
|
128
134
|
continue;
|
|
129
|
-
const
|
|
135
|
+
const handler = prototype[key];
|
|
136
|
+
if (typeof handler !== 'function')
|
|
137
|
+
continue;
|
|
138
|
+
const sdkConfig = Reflect.getMetadata(SDK_METHOD_META, handler);
|
|
130
139
|
if (!sdkConfig || sdkConfig.exclude)
|
|
131
140
|
continue;
|
|
132
|
-
const nestMethod = Reflect.getMetadata(NEST_METHOD_META,
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
const nestMethod = Reflect.getMetadata(NEST_METHOD_META, handler);
|
|
142
|
+
const method = nestMethod === undefined ? 'GET' : NEST_HTTP_METHODS[nestMethod];
|
|
143
|
+
if (!method || method === 'ALL') {
|
|
144
|
+
throw new Error(`Unsupported NestJS request method on ${ControllerClass.name}.${key}`);
|
|
145
|
+
}
|
|
146
|
+
const methodPaths = toPaths(Reflect.getMetadata(NEST_PATH_META, handler));
|
|
137
147
|
const { schema, ...routeSdk } = sdkConfig;
|
|
138
|
-
const
|
|
139
|
-
|
|
148
|
+
for (const controllerPath of controllerPaths) {
|
|
149
|
+
for (const methodPath of methodPaths) {
|
|
150
|
+
collector.route(joinPaths(controllerPath, methodPath), method, {
|
|
151
|
+
sdk: routeSdk,
|
|
152
|
+
schema,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
140
156
|
}
|
|
141
157
|
}
|
|
142
158
|
}
|
|
159
|
+
function toPaths(value) {
|
|
160
|
+
const values = Array.isArray(value) ? value : [value ?? ''];
|
|
161
|
+
return values.map((path) => joinPaths(String(path)));
|
|
162
|
+
}
|
|
163
|
+
function joinPaths(...parts) {
|
|
164
|
+
const path = parts
|
|
165
|
+
.flatMap((part) => part.split('/'))
|
|
166
|
+
.filter(Boolean)
|
|
167
|
+
.join('/');
|
|
168
|
+
return path ? `/${path}` : '/';
|
|
169
|
+
}
|
|
143
170
|
//# sourceMappingURL=nestjs.js.map
|
package/dist/nestjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestjs.js","sourceRoot":"","sources":["../src/nestjs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;
|
|
1
|
+
{"version":3,"file":"nestjs.js","sourceRoot":"","sources":["../src/nestjs.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* Responsibilities:
|
|
4
|
-
* - Symbol resolution
|
|
5
|
-
* - Import graph construction
|
|
6
|
-
* - Topological schema ordering
|
|
7
|
-
* - Domain allocation
|
|
8
|
-
* - Render + serialization decisions
|
|
9
|
-
* - Method normalization (dedupe)
|
|
10
|
-
* - Operation signatures
|
|
11
|
-
* - Documentation blocks
|
|
12
|
-
*/
|
|
13
|
-
import type { SDKIR, EnrichedSDKIR } from "../types/ir.js";
|
|
1
|
+
/** Transforms raw SDK IR into the compiler-ready representation. */
|
|
2
|
+
import type { SDKIR, EnrichedSDKIR } from '../types/ir.js';
|
|
14
3
|
export declare function enrich(ir: SDKIR): EnrichedSDKIR;
|
|
15
4
|
//# sourceMappingURL=enrich.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrich.d.ts","sourceRoot":"","sources":["../../src/pipeline/enrich.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"enrich.d.ts","sourceRoot":"","sources":["../../src/pipeline/enrich.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EAWd,MAAM,gBAAgB,CAAC;AAKxB,wBAAgB,MAAM,CAAC,EAAE,EAAE,KAAK,GAAG,aAAa,CAiB/C"}
|
package/dist/pipeline/enrich.js
CHANGED
|
@@ -1,303 +1,248 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* - Symbol resolution
|
|
5
|
-
* - Import graph construction
|
|
6
|
-
* - Topological schema ordering
|
|
7
|
-
* - Domain allocation
|
|
8
|
-
* - Render + serialization decisions
|
|
9
|
-
* - Method normalization (dedupe)
|
|
10
|
-
* - Operation signatures
|
|
11
|
-
* - Documentation blocks
|
|
12
|
-
*/
|
|
13
|
-
import { deduplicateMethodNames } from "../utils/naming.js";
|
|
14
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
15
|
-
// Entry Point
|
|
16
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
1
|
+
/** Transforms raw SDK IR into the compiler-ready representation. */
|
|
2
|
+
import { deduplicateMethodNames } from '../utils/naming.js';
|
|
3
|
+
const TYPE_IDENTIFIER = /\b[A-Z][A-Za-z0-9_]*\b/g;
|
|
17
4
|
export function enrich(ir) {
|
|
18
5
|
const symbolTable = createSymbolTable(ir.schemas);
|
|
19
6
|
const importGraph = createImportGraph(ir.schemas, symbolTable);
|
|
20
|
-
const schemaOrder = topoSortSchemas(ir.schemas, importGraph);
|
|
21
|
-
const renderDecisions = createRenderDecisions(ir.schemas);
|
|
22
|
-
const serialization = createSerializationHints(ir.schemas);
|
|
23
7
|
const groups = normalizeOperations(ir.groups);
|
|
24
|
-
const signatures = createSignatures(groups);
|
|
25
|
-
const docBlocks = createDocBlocks(groups);
|
|
26
8
|
return {
|
|
27
9
|
...ir,
|
|
28
10
|
groups,
|
|
29
11
|
symbolTable,
|
|
30
12
|
importGraph,
|
|
31
|
-
schemaOrder,
|
|
32
|
-
domainAllocations: createDomainAllocations(groups, ir.schemas),
|
|
33
|
-
signatures,
|
|
34
|
-
docBlocks,
|
|
35
|
-
renderDecisions,
|
|
36
|
-
serialization,
|
|
13
|
+
schemaOrder: topoSortSchemas(ir.schemas, importGraph),
|
|
14
|
+
domainAllocations: createDomainAllocations(groups, ir.schemas, symbolTable),
|
|
15
|
+
signatures: createSignatures(groups),
|
|
16
|
+
docBlocks: createDocBlocks(groups),
|
|
17
|
+
renderDecisions: createRenderDecisions(ir.schemas),
|
|
18
|
+
serialization: createSerializationHints(ir.schemas),
|
|
37
19
|
};
|
|
38
20
|
}
|
|
39
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
40
|
-
// Symbol Table
|
|
41
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
42
21
|
function createSymbolTable(schemas) {
|
|
43
22
|
const table = {};
|
|
44
23
|
for (const schema of schemas) {
|
|
45
|
-
const
|
|
24
|
+
const ownership = schema.ownership?.kind;
|
|
46
25
|
table[schema.name] = {
|
|
47
|
-
definedIn:
|
|
48
|
-
kind: schema.isEnum
|
|
49
|
-
|
|
26
|
+
definedIn: ownership === 'external' ? 'external' : 'types',
|
|
27
|
+
kind: schema.isEnum
|
|
28
|
+
? 'enum'
|
|
29
|
+
: schema.isUnionType
|
|
30
|
+
? 'union'
|
|
31
|
+
: schema.isTypeAlias
|
|
32
|
+
? 'alias'
|
|
33
|
+
: 'interface',
|
|
34
|
+
isExternal: ownership === 'external',
|
|
50
35
|
importPath: schema.ownership?.externalImport?.importPath,
|
|
51
36
|
};
|
|
52
37
|
}
|
|
53
38
|
return table;
|
|
54
39
|
}
|
|
55
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
56
|
-
// Import Graph
|
|
57
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
58
40
|
function createImportGraph(schemas, symbolTable) {
|
|
59
41
|
const graph = {};
|
|
60
|
-
const schemaNames = new Set(schemas.map((s) => s.name));
|
|
61
42
|
for (const schema of schemas) {
|
|
62
|
-
const
|
|
63
|
-
collectSchemaDependencies(schema, symbolTable,
|
|
64
|
-
|
|
43
|
+
const dependencies = new Set();
|
|
44
|
+
collectSchemaDependencies(schema, symbolTable, dependencies);
|
|
45
|
+
dependencies.delete(schema.name);
|
|
46
|
+
graph[schema.name] = [...dependencies].sort();
|
|
65
47
|
}
|
|
66
48
|
return graph;
|
|
67
49
|
}
|
|
68
|
-
function collectSchemaDependencies(schema, symbolTable, out
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
for (const prop of schema.properties) {
|
|
76
|
-
collectTypeDependencies(prop.type, symbolTable, out, self);
|
|
77
|
-
}
|
|
78
|
-
if (schema.unionMembers) {
|
|
79
|
-
for (const t of schema.unionMembers) {
|
|
80
|
-
collectTypeDependencies(t, symbolTable, out, self);
|
|
81
|
-
}
|
|
50
|
+
function collectSchemaDependencies(schema, symbolTable, out) {
|
|
51
|
+
collectTypeDependencies(schema.extends, symbolTable, out);
|
|
52
|
+
collectTypeDependencies(schema.aliasType, symbolTable, out);
|
|
53
|
+
collectTypeDependencies(schema.additionalPropertiesType, symbolTable, out);
|
|
54
|
+
for (const property of schema.properties) {
|
|
55
|
+
collectTypeDependencies(property.type, symbolTable, out);
|
|
82
56
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
collectTypeDependencies(t, symbolTable, out, self);
|
|
86
|
-
}
|
|
57
|
+
for (const member of schema.unionMembers ?? []) {
|
|
58
|
+
collectTypeDependencies(member, symbolTable, out);
|
|
87
59
|
}
|
|
88
|
-
|
|
89
|
-
collectTypeDependencies(
|
|
60
|
+
for (const member of schema.intersectionMembers ?? []) {
|
|
61
|
+
collectTypeDependencies(member, symbolTable, out);
|
|
90
62
|
}
|
|
91
63
|
}
|
|
92
|
-
function collectTypeDependencies(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
out.add(ref);
|
|
100
|
-
}
|
|
64
|
+
function collectTypeDependencies(type, symbolTable, out) {
|
|
65
|
+
if (!type)
|
|
66
|
+
return;
|
|
67
|
+
const unquoted = type.replace(/(["'`])(?:\\.|(?!\1).)*\1/g, '');
|
|
68
|
+
for (const name of unquoted.match(TYPE_IDENTIFIER) ?? []) {
|
|
69
|
+
if (symbolTable[name])
|
|
70
|
+
out.add(name);
|
|
101
71
|
}
|
|
102
72
|
}
|
|
103
|
-
function extractSimpleRef(typeStr) {
|
|
104
|
-
const match = /^([A-Z][a-zA-Z0-9]+)$/.exec(typeStr);
|
|
105
|
-
return match?.[1];
|
|
106
|
-
}
|
|
107
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
108
|
-
// Topological Sort
|
|
109
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
110
73
|
function topoSortSchemas(schemas, graph) {
|
|
111
74
|
const visited = new Set();
|
|
112
75
|
const visiting = new Set();
|
|
113
76
|
const order = [];
|
|
114
|
-
|
|
115
|
-
if (visited.has(name))
|
|
116
|
-
return;
|
|
117
|
-
if (visiting.has(name))
|
|
77
|
+
const visit = (name) => {
|
|
78
|
+
if (visited.has(name) || visiting.has(name))
|
|
118
79
|
return;
|
|
119
80
|
visiting.add(name);
|
|
120
|
-
for (const
|
|
121
|
-
visit(
|
|
122
|
-
}
|
|
81
|
+
for (const dependency of graph[name] ?? [])
|
|
82
|
+
visit(dependency);
|
|
123
83
|
visiting.delete(name);
|
|
124
84
|
visited.add(name);
|
|
125
85
|
order.push(name);
|
|
126
|
-
}
|
|
127
|
-
for (const
|
|
128
|
-
visit(
|
|
129
|
-
}
|
|
86
|
+
};
|
|
87
|
+
for (const schema of schemas)
|
|
88
|
+
visit(schema.name);
|
|
130
89
|
return order;
|
|
131
90
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
135
|
-
function createDomainAllocations(groups, schemas) {
|
|
136
|
-
const map = new Map();
|
|
137
|
-
// Schema ownership-based grouping
|
|
91
|
+
function createDomainAllocations(groups, schemas, symbolTable) {
|
|
92
|
+
const allocations = new Map();
|
|
138
93
|
for (const schema of schemas) {
|
|
139
|
-
|
|
140
|
-
|
|
94
|
+
const fileName = schema.ownership?.domainFile;
|
|
95
|
+
if (schema.ownership?.kind === 'generated' && fileName) {
|
|
96
|
+
getOrCreate(allocations, fileName).add(schema.name);
|
|
141
97
|
}
|
|
142
98
|
}
|
|
143
|
-
// Operation-driven grouping
|
|
144
99
|
for (const group of groups) {
|
|
145
|
-
const
|
|
146
|
-
for (const
|
|
147
|
-
collectOperationRefs(
|
|
100
|
+
const names = getOrCreate(allocations, group.fileName);
|
|
101
|
+
for (const operation of group.operations) {
|
|
102
|
+
collectOperationRefs(operation, symbolTable, names);
|
|
148
103
|
}
|
|
149
104
|
}
|
|
150
|
-
return [...
|
|
105
|
+
return [...allocations]
|
|
106
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
107
|
+
.map(([fileName, names]) => ({
|
|
151
108
|
fileName,
|
|
152
|
-
schemas: [...
|
|
109
|
+
schemas: [...names].sort(),
|
|
153
110
|
}));
|
|
154
111
|
}
|
|
155
|
-
function
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
112
|
+
function getOrCreate(map, key) {
|
|
113
|
+
let value = map.get(key);
|
|
114
|
+
if (!value) {
|
|
115
|
+
value = new Set();
|
|
116
|
+
map.set(key, value);
|
|
117
|
+
}
|
|
118
|
+
return value;
|
|
159
119
|
}
|
|
160
|
-
function collectOperationRefs(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
120
|
+
function collectOperationRefs(operation, symbolTable, out) {
|
|
121
|
+
collectTypeDependencies(operation.responseType, symbolTable, out);
|
|
122
|
+
collectTypeDependencies(operation.eventSchema, symbolTable, out);
|
|
123
|
+
collectTypeDependencies(operation.sseReturnType, symbolTable, out);
|
|
124
|
+
collectTypeDependencies(operation.requestBody?.type, symbolTable, out);
|
|
125
|
+
collectTypeDependencies(operation.queryType, symbolTable, out);
|
|
126
|
+
collectTypeDependencies(operation.headerType, symbolTable, out);
|
|
127
|
+
collectTypeDependencies(operation.cookieType, symbolTable, out);
|
|
128
|
+
for (const parameter of [
|
|
129
|
+
...operation.pathParams,
|
|
130
|
+
...operation.queryParams,
|
|
131
|
+
...operation.headerParams,
|
|
132
|
+
...operation.cookieParams,
|
|
133
|
+
]) {
|
|
134
|
+
collectTypeDependencies(parameter.type, symbolTable, out);
|
|
175
135
|
}
|
|
176
136
|
}
|
|
177
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
178
|
-
// Render Decisions
|
|
179
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
180
137
|
function createRenderDecisions(schemas) {
|
|
181
|
-
const
|
|
182
|
-
for (const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
return
|
|
138
|
+
const decisions = {};
|
|
139
|
+
for (const schema of schemas) {
|
|
140
|
+
decisions[schema.name] =
|
|
141
|
+
schema.ownership?.kind === 'external'
|
|
142
|
+
? 'skip'
|
|
143
|
+
: schema.isEnum
|
|
144
|
+
? 'enum'
|
|
145
|
+
: schema.isUnionType
|
|
146
|
+
? 'union'
|
|
147
|
+
: schema.isTypeAlias
|
|
148
|
+
? 'type-alias'
|
|
149
|
+
: 'interface';
|
|
150
|
+
}
|
|
151
|
+
return decisions;
|
|
195
152
|
}
|
|
196
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
197
|
-
// Serialization Hints
|
|
198
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
199
153
|
function createSerializationHints(schemas) {
|
|
200
154
|
const hints = {};
|
|
201
155
|
for (const schema of schemas) {
|
|
202
|
-
const
|
|
203
|
-
.filter((
|
|
204
|
-
.map((
|
|
205
|
-
if (
|
|
206
|
-
hints[schema.name] = { dateProperties
|
|
207
|
-
}
|
|
156
|
+
const dateProperties = schema.properties
|
|
157
|
+
.filter(({ format }) => format === 'date' || format === 'date-time')
|
|
158
|
+
.map(({ name }) => name);
|
|
159
|
+
if (dateProperties.length)
|
|
160
|
+
hints[schema.name] = { dateProperties };
|
|
208
161
|
}
|
|
209
162
|
return hints;
|
|
210
163
|
}
|
|
211
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
212
|
-
// Operation Normalization
|
|
213
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
214
164
|
function normalizeOperations(groups) {
|
|
215
165
|
return groups.map((group) => {
|
|
216
|
-
const
|
|
166
|
+
const names = deduplicateMethodNames(group.operations.map(({ name }) => name));
|
|
217
167
|
return {
|
|
218
168
|
...group,
|
|
219
|
-
operations: group.operations.map((
|
|
220
|
-
...
|
|
221
|
-
name:
|
|
169
|
+
operations: group.operations.map((operation, index) => ({
|
|
170
|
+
...operation,
|
|
171
|
+
name: names[index],
|
|
222
172
|
})),
|
|
223
173
|
};
|
|
224
174
|
});
|
|
225
175
|
}
|
|
226
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
227
|
-
// Signatures
|
|
228
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
229
176
|
function createSignatures(groups) {
|
|
230
|
-
const
|
|
177
|
+
const signatures = {};
|
|
231
178
|
for (const group of groups) {
|
|
232
|
-
for (const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (op.queryType) {
|
|
241
|
-
params.push(`query: ${op.queryType}`);
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
const req = op.queryParams
|
|
245
|
-
.filter((p) => p.required)
|
|
246
|
-
.map((p) => `${p.name}: ${p.type}`);
|
|
247
|
-
const opt = op.queryParams
|
|
248
|
-
.filter((p) => !p.required)
|
|
249
|
-
.map((p) => `${p.name}?: ${p.type}`);
|
|
250
|
-
if (req.length)
|
|
251
|
-
params.push(req.join(", "));
|
|
252
|
-
if (opt.length)
|
|
253
|
-
params.push(opt.join(", "));
|
|
254
|
-
}
|
|
255
|
-
for (const h of op.headerParams) {
|
|
256
|
-
params.push(`${h.name}${h.required ? "" : "?"}: ${h.type}`);
|
|
257
|
-
}
|
|
258
|
-
const returnType = op.isEventStream
|
|
259
|
-
? `AsyncIterable<${op.responseType}>`
|
|
260
|
-
: op.responseType;
|
|
261
|
-
out[`${group.name}.${op.name}`] = {
|
|
262
|
-
params: params.join(", "),
|
|
263
|
-
returnType,
|
|
179
|
+
for (const operation of group.operations) {
|
|
180
|
+
signatures[`${group.name}.${operation.name}`] = {
|
|
181
|
+
params: buildOperationParams(operation).join(', '),
|
|
182
|
+
returnType: operation.isEventStream
|
|
183
|
+
? operation.sseReturnType
|
|
184
|
+
? `AsyncIterable<${operation.sseReturnType}>`
|
|
185
|
+
: `AsyncIterable<SSEEvent<${operation.eventSchema ?? operation.responseType}>>`
|
|
186
|
+
: operation.responseType,
|
|
264
187
|
isAsync: true,
|
|
265
188
|
};
|
|
266
189
|
}
|
|
267
190
|
}
|
|
268
|
-
return
|
|
191
|
+
return signatures;
|
|
192
|
+
}
|
|
193
|
+
function buildOperationParams(operation) {
|
|
194
|
+
const params = operation.pathParams.map(({ name, type }) => `${name}: ${type}`);
|
|
195
|
+
if (operation.requestBody) {
|
|
196
|
+
params.push(`input${operation.requestBody.required ? '' : '?'}: ${operation.requestBody.type}`);
|
|
197
|
+
}
|
|
198
|
+
if (operation.queryType) {
|
|
199
|
+
params.push(`query${hasRequired(operation.queryParams) ? '' : '?'}: ${operation.queryType}`);
|
|
200
|
+
}
|
|
201
|
+
if (operation.headerType) {
|
|
202
|
+
params.push(`headerOptions${hasRequired(operation.headerParams) ? '' : '?'}: ${operation.headerType}`);
|
|
203
|
+
}
|
|
204
|
+
if (operation.cookieType) {
|
|
205
|
+
params.push(`cookies${hasRequired(operation.cookieParams) ? '' : '?'}: ${operation.cookieType}`);
|
|
206
|
+
}
|
|
207
|
+
return params;
|
|
208
|
+
}
|
|
209
|
+
function hasRequired(parameters) {
|
|
210
|
+
return parameters.some(({ required }) => required);
|
|
269
211
|
}
|
|
270
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
271
|
-
// Doc Blocks
|
|
272
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
273
212
|
function createDocBlocks(groups) {
|
|
274
|
-
const
|
|
213
|
+
const blocks = {};
|
|
275
214
|
for (const group of groups) {
|
|
276
|
-
for (const
|
|
215
|
+
for (const operation of group.operations) {
|
|
277
216
|
const lines = [];
|
|
278
|
-
if (
|
|
279
|
-
lines.push(
|
|
280
|
-
if (
|
|
217
|
+
if (operation.summary)
|
|
218
|
+
lines.push(operation.summary);
|
|
219
|
+
if (operation.description &&
|
|
220
|
+
operation.description !== operation.summary) {
|
|
281
221
|
if (lines.length)
|
|
282
|
-
lines.push(
|
|
283
|
-
lines.push(
|
|
284
|
-
}
|
|
285
|
-
for (const p of op.pathParams) {
|
|
286
|
-
lines.push(`@param ${p.name} ${p.description ?? ""}`);
|
|
222
|
+
lines.push('');
|
|
223
|
+
lines.push(operation.description);
|
|
287
224
|
}
|
|
288
|
-
|
|
289
|
-
lines.push(`@param
|
|
225
|
+
for (const parameter of operation.pathParams) {
|
|
226
|
+
lines.push(`@param ${parameter.name}${parameter.description ? ` ${parameter.description}` : ''}`);
|
|
290
227
|
}
|
|
291
|
-
if (
|
|
292
|
-
lines.push(
|
|
228
|
+
if (operation.requestBody)
|
|
229
|
+
lines.push('@param input Request body');
|
|
230
|
+
if (operation.queryType)
|
|
231
|
+
lines.push('@param query Query parameters');
|
|
232
|
+
if (operation.headerType)
|
|
233
|
+
lines.push('@param headerOptions Request headers');
|
|
234
|
+
if (operation.deprecated) {
|
|
235
|
+
lines.push(operation.deprecationMessage
|
|
236
|
+
? `@deprecated ${operation.deprecationMessage}`
|
|
237
|
+
: '@deprecated');
|
|
293
238
|
}
|
|
294
|
-
|
|
295
|
-
summary:
|
|
296
|
-
description:
|
|
239
|
+
blocks[`${group.name}.${operation.name}`] = {
|
|
240
|
+
summary: operation.summary,
|
|
241
|
+
description: operation.description,
|
|
297
242
|
lines,
|
|
298
243
|
};
|
|
299
244
|
}
|
|
300
245
|
}
|
|
301
|
-
return
|
|
246
|
+
return blocks;
|
|
302
247
|
}
|
|
303
248
|
//# sourceMappingURL=enrich.js.map
|