@nestbridge/core 2.0.3 → 2.0.4

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.
@@ -0,0 +1,132 @@
1
+ //#region src/diagnostics/nestbridge-diagnostic.d.ts
2
+ type NestBridgeDiagnosticCode = "unsupported-route" | "unsupported-parameter" | "unsupported-argument" | "unsupported-return-type" | "circular-type";
3
+ interface NestBridgeDiagnostic {
4
+ code: NestBridgeDiagnosticCode;
5
+ title: string;
6
+ controllerName: string;
7
+ memberName: string;
8
+ detail: string;
9
+ found?: string;
10
+ expected?: string;
11
+ filePath: string;
12
+ line: number;
13
+ column: number;
14
+ }
15
+ //#endregion
16
+ //#region src/diagnostics/format-diagnostic.d.ts
17
+ export declare const formatDiagnostic: (diagnostic: NestBridgeDiagnostic) => string;
18
+ //#endregion
19
+ //#region src/diagnostics/nestbridge-diagnostic-error.d.ts
20
+ export declare class NestBridgeDiagnosticError extends Error {
21
+ readonly diagnostic: NestBridgeDiagnostic;
22
+ constructor(diagnostic: NestBridgeDiagnostic);
23
+ }
24
+ //#endregion
25
+ //#region src/models/controller-parameter-definition.d.ts
26
+ type ParameterSourceKind = "param" | "query" | "body" | "header";
27
+ interface ControllerParameterBase {
28
+ index: number;
29
+ parameterName: string;
30
+ }
31
+ type ControllerParameterDefinition = (ControllerParameterBase & {
32
+ kind: "param";
33
+ name: string;
34
+ }) | (ControllerParameterBase & {
35
+ kind: "query";
36
+ name?: string;
37
+ }) | (ControllerParameterBase & {
38
+ kind: "body";
39
+ name?: string;
40
+ }) | (ControllerParameterBase & {
41
+ kind: "header";
42
+ name: string;
43
+ });
44
+ //#endregion
45
+ //#region src/models/http-method.d.ts
46
+ type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
47
+ //#endregion
48
+ //#region src/models/response-kind.d.ts
49
+ type ResponseKind = "json" | "observable" | "stream";
50
+ //#endregion
51
+ //#region src/models/controller-method-definition.d.ts
52
+ interface ControllerMethodDefinition {
53
+ name: string;
54
+ httpMethod: HttpMethod;
55
+ path: string;
56
+ parameters: ControllerParameterDefinition[];
57
+ responseKind: ResponseKind;
58
+ line: number;
59
+ column: number;
60
+ }
61
+ //#endregion
62
+ //#region src/models/controller-definition.d.ts
63
+ interface ControllerDefinition {
64
+ name: string;
65
+ path: string;
66
+ sourceFile: string;
67
+ methods: ControllerMethodDefinition[];
68
+ }
69
+ //#endregion
70
+ //#region src/models/graphql-operation-kind.d.ts
71
+ type GraphqlOperationKind = "query" | "mutation";
72
+ //#endregion
73
+ //#region src/models/resolver-argument-definition.d.ts
74
+ interface ResolverArgumentDefinition {
75
+ index: number;
76
+ parameterName: string;
77
+ name: string;
78
+ graphqlType: string;
79
+ }
80
+ //#endregion
81
+ //#region src/models/selection-field.d.ts
82
+ interface SelectionField {
83
+ name: string;
84
+ children?: SelectionField[];
85
+ }
86
+ //#endregion
87
+ //#region src/models/resolver-method-definition.d.ts
88
+ interface ResolverMethodDefinition {
89
+ name: string;
90
+ operationKind: GraphqlOperationKind;
91
+ operationName: string;
92
+ arguments: ResolverArgumentDefinition[];
93
+ selection: SelectionField[];
94
+ line: number;
95
+ column: number;
96
+ }
97
+ //#endregion
98
+ //#region src/models/resolver-definition.d.ts
99
+ interface ResolverDefinition {
100
+ name: string;
101
+ sourceFile: string;
102
+ methods: ResolverMethodDefinition[];
103
+ }
104
+ //#endregion
105
+ //#region src/analysis/analyze-controllers.d.ts
106
+ export declare const analyzeControllers: (filePaths: readonly string[]) => {
107
+ controllers: ControllerDefinition[];
108
+ diagnostics: NestBridgeDiagnostic[];
109
+ };
110
+ //#endregion
111
+ //#region src/analysis/analyze-resolvers.d.ts
112
+ export declare const analyzeResolvers: (filePaths: readonly string[]) => {
113
+ resolvers: ResolverDefinition[];
114
+ diagnostics: NestBridgeDiagnostic[];
115
+ };
116
+ //#endregion
117
+ //#region src/declarations/generate-controller-declaration.d.ts
118
+ interface ClientDeclarationSource {
119
+ name: string;
120
+ sourceFile: string;
121
+ methods: readonly {
122
+ name: string;
123
+ responseKind?: ResponseKind;
124
+ }[];
125
+ }
126
+ export declare const generateControllerDeclaration: (controller: ClientDeclarationSource, outputFilePath: string) => string;
127
+ //#endregion
128
+ //#region src/version.d.ts
129
+ export declare const VERSION: string;
130
+ //#endregion
131
+ export type { ControllerDefinition, ControllerMethodDefinition, ControllerParameterDefinition, GraphqlOperationKind, HttpMethod, NestBridgeDiagnostic, NestBridgeDiagnosticCode, ParameterSourceKind, ResolverArgumentDefinition, ResolverDefinition, ResolverMethodDefinition, ResponseKind, SelectionField };
132
+ //# sourceMappingURL=nestbridge.core.d.ts.map
@@ -0,0 +1,915 @@
1
+ import { SyntaxKind, isArrayLiteralExpression, isArrayTypeNode, isArrowFunction, isBlock, isCallExpression, isClassDeclaration, isDecorator, isExportDeclaration, isFunctionExpression, isIdentifier, isImportDeclaration, isMethodDeclaration, isNamedExports, isNamedImports, isObjectLiteralExpression, isPropertyAssignment, isPropertyDeclaration, isReturnStatement, isStringLiteralLikeNode, isTypeReferenceNode, isUnionTypeNode } from "typescript/unstable/ast";
2
+ import { API } from "typescript/unstable/sync";
3
+ import { existsSync } from "node:fs";
4
+ import { dirname, extname, relative, resolve } from "node:path";
5
+ //#region src/analysis/decorator-inspection.ts
6
+ var getDecorators = (node) => {
7
+ const decorators = node.modifiers?.filter(isDecorator);
8
+ return decorators === void 0 || decorators.length === 0 ? void 0 : decorators;
9
+ };
10
+ var findDecorator = (node, decoratorName) => {
11
+ const decorators = getDecorators(node);
12
+ if (decorators === void 0) return;
13
+ return decorators.find((decorator) => decoratorNameOf(decorator) === decoratorName);
14
+ };
15
+ var findAnyDecorator = (node, decoratorNames) => {
16
+ const decorators = getDecorators(node);
17
+ if (decorators === void 0) return;
18
+ return decorators.find((decorator) => decoratorNames.includes(decoratorNameOf(decorator) ?? ""));
19
+ };
20
+ var decoratorNameOf = (decorator) => {
21
+ const expression = decorator.expression;
22
+ if (isCallExpression(expression) && isIdentifier(expression.expression)) return expression.expression.text;
23
+ if (isIdentifier(expression)) return expression.text;
24
+ };
25
+ var readStaticStringArgument = (decorator) => {
26
+ const expression = decorator.expression;
27
+ if (!isCallExpression(expression)) return {
28
+ ok: true,
29
+ value: void 0
30
+ };
31
+ const [firstArgument] = expression.arguments;
32
+ if (firstArgument === void 0) return {
33
+ ok: true,
34
+ value: void 0
35
+ };
36
+ if (isStringLiteralLikeNode(firstArgument)) return {
37
+ ok: true,
38
+ value: firstArgument.text
39
+ };
40
+ return {
41
+ ok: false,
42
+ argumentText: firstArgument.getText()
43
+ };
44
+ };
45
+ //#endregion
46
+ //#region src/models/http-method.ts
47
+ var HTTP_METHOD_DECORATOR_NAMES = {
48
+ Get: "GET",
49
+ Post: "POST",
50
+ Put: "PUT",
51
+ Patch: "PATCH",
52
+ Delete: "DELETE"
53
+ };
54
+ //#endregion
55
+ //#region src/analysis/node-location.ts
56
+ var locationOf = (sourceFile, node) => {
57
+ const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
58
+ return {
59
+ line: line + 1,
60
+ column: character + 1
61
+ };
62
+ };
63
+ //#endregion
64
+ //#region src/analysis/extract-parameter-definition.ts
65
+ var SUPPORTED_PARAMETER_DECORATORS = [
66
+ "Param",
67
+ "Query",
68
+ "Body",
69
+ "Headers"
70
+ ];
71
+ var KNOWN_UNSUPPORTED_PARAMETER_DECORATORS = [
72
+ "Req",
73
+ "Res",
74
+ "Request",
75
+ "Response"
76
+ ];
77
+ var extractParameterDefinition = (parameter, index, context) => {
78
+ const decorator = findAnyDecorator(parameter, [...SUPPORTED_PARAMETER_DECORATORS, ...KNOWN_UNSUPPORTED_PARAMETER_DECORATORS]);
79
+ const location = locationOf(context.sourceFile, parameter);
80
+ if (decorator === void 0) {
81
+ context.diagnostics.push({
82
+ code: "unsupported-parameter",
83
+ title: "Unsupported parameter.",
84
+ controllerName: context.controllerName,
85
+ memberName: context.methodName,
86
+ detail: `Parameter "${parameter.name.getText()}" must be decorated with one of @Param, @Query, @Body, or @Headers to be transported through a NestBridge HTTP client.`,
87
+ filePath: context.filePath,
88
+ line: location.line,
89
+ column: location.column
90
+ });
91
+ return;
92
+ }
93
+ const decoratorName = decoratorNameOf(decorator);
94
+ if (decoratorName !== void 0 && KNOWN_UNSUPPORTED_PARAMETER_DECORATORS.includes(decoratorName)) {
95
+ context.diagnostics.push({
96
+ code: "unsupported-parameter",
97
+ title: "Unsupported parameter.",
98
+ controllerName: context.controllerName,
99
+ memberName: context.methodName,
100
+ detail: `@${decoratorName}() cannot be transported through a NestBridge HTTP client.`,
101
+ filePath: context.filePath,
102
+ line: location.line,
103
+ column: location.column
104
+ });
105
+ return;
106
+ }
107
+ if (!isIdentifier(parameter.name)) {
108
+ context.diagnostics.push({
109
+ code: "unsupported-parameter",
110
+ title: "Unsupported parameter.",
111
+ controllerName: context.controllerName,
112
+ memberName: context.methodName,
113
+ detail: "Destructured parameters cannot be transported through a NestBridge HTTP client.",
114
+ filePath: context.filePath,
115
+ line: location.line,
116
+ column: location.column
117
+ });
118
+ return;
119
+ }
120
+ const argument = readStaticStringArgument(decorator);
121
+ if (!argument.ok) {
122
+ context.diagnostics.push({
123
+ code: "unsupported-parameter",
124
+ title: "Unsupported parameter.",
125
+ controllerName: context.controllerName,
126
+ memberName: context.methodName,
127
+ detail: `@${decoratorName}() arguments must be statically analyzable string literals.`,
128
+ found: `@${decoratorName}(${argument.argumentText})`,
129
+ filePath: context.filePath,
130
+ line: location.line,
131
+ column: location.column
132
+ });
133
+ return;
134
+ }
135
+ const base = {
136
+ index,
137
+ parameterName: parameter.name.text
138
+ };
139
+ if (decoratorName === "Param") {
140
+ if (argument.value === void 0) {
141
+ context.diagnostics.push({
142
+ code: "unsupported-parameter",
143
+ title: "Unsupported parameter.",
144
+ controllerName: context.controllerName,
145
+ memberName: context.methodName,
146
+ detail: "A whole @Param() is not supported; provide a route parameter name such as @Param('id').",
147
+ filePath: context.filePath,
148
+ line: location.line,
149
+ column: location.column
150
+ });
151
+ return;
152
+ }
153
+ return {
154
+ ...base,
155
+ kind: "param",
156
+ name: argument.value
157
+ };
158
+ }
159
+ if (decoratorName === "Headers") {
160
+ if (argument.value === void 0) {
161
+ context.diagnostics.push({
162
+ code: "unsupported-parameter",
163
+ title: "Unsupported parameter.",
164
+ controllerName: context.controllerName,
165
+ memberName: context.methodName,
166
+ detail: "A whole @Headers() is not supported; provide a header name such as @Headers('x-example').",
167
+ filePath: context.filePath,
168
+ line: location.line,
169
+ column: location.column
170
+ });
171
+ return;
172
+ }
173
+ return {
174
+ ...base,
175
+ kind: "header",
176
+ name: argument.value
177
+ };
178
+ }
179
+ if (decoratorName === "Query") return {
180
+ ...base,
181
+ kind: "query",
182
+ name: argument.value
183
+ };
184
+ return {
185
+ ...base,
186
+ kind: "body",
187
+ name: argument.value
188
+ };
189
+ };
190
+ //#endregion
191
+ //#region src/analysis/graphql-scalar-type.ts
192
+ var PRIMITIVE_SCALAR_TYPES = {
193
+ string: "String",
194
+ number: "Float",
195
+ boolean: "Boolean"
196
+ };
197
+ var unwrapPromise = (typeNode) => {
198
+ if (isTypeReferenceNode(typeNode) && isIdentifier(typeNode.typeName) && typeNode.typeName.text === "Promise" && typeNode.typeArguments?.[0] !== void 0) return unwrapPromise(typeNode.typeArguments[0]);
199
+ return typeNode;
200
+ };
201
+ var unwrapNullable = (typeNode) => {
202
+ if (!isUnionTypeNode(typeNode)) return {
203
+ inner: typeNode,
204
+ isNullable: false
205
+ };
206
+ const nonNullMembers = typeNode.types.filter((member) => member.kind !== SyntaxKind.NullKeyword && member.kind !== SyntaxKind.UndefinedKeyword);
207
+ const [onlyMember] = nonNullMembers;
208
+ if (nonNullMembers.length !== 1 || onlyMember === void 0) return {
209
+ inner: typeNode,
210
+ isNullable: nonNullMembers.length !== typeNode.types.length
211
+ };
212
+ return {
213
+ inner: onlyMember,
214
+ isNullable: true
215
+ };
216
+ };
217
+ var unwrapArrayElement = (typeNode) => {
218
+ if (isArrayTypeNode(typeNode)) return typeNode.elementType;
219
+ if (isTypeReferenceNode(typeNode) && isIdentifier(typeNode.typeName) && typeNode.typeName.text === "Array" && typeNode.typeArguments?.[0] !== void 0) return typeNode.typeArguments[0];
220
+ };
221
+ var identifierTextOf = (typeNode) => {
222
+ if (isTypeReferenceNode(typeNode) && isIdentifier(typeNode.typeName)) return typeNode.typeName.text;
223
+ switch (typeNode.kind) {
224
+ case SyntaxKind.StringKeyword: return "string";
225
+ case SyntaxKind.NumberKeyword: return "number";
226
+ case SyntaxKind.BooleanKeyword: return "boolean";
227
+ default: return;
228
+ }
229
+ };
230
+ var unwrapTypeNode = (typeNode) => {
231
+ const { inner: withoutNullable, isNullable } = unwrapNullable(unwrapPromise(typeNode));
232
+ const arrayElement = unwrapArrayElement(withoutNullable);
233
+ const identifierText = identifierTextOf(arrayElement === void 0 ? withoutNullable : unwrapNullable(arrayElement).inner);
234
+ if (identifierText === void 0) return;
235
+ return {
236
+ identifierText,
237
+ isArray: arrayElement !== void 0,
238
+ isNullable
239
+ };
240
+ };
241
+ var graphqlScalarNameFor = (identifierText) => PRIMITIVE_SCALAR_TYPES[identifierText] ?? identifierText;
242
+ var graphqlTypeStringFor = (unwrapped, explicitTypeName) => {
243
+ const baseName = explicitTypeName ?? graphqlScalarNameFor(unwrapped.identifierText);
244
+ const wrapped = unwrapped.isArray ? `[${baseName}!]` : baseName;
245
+ return unwrapped.isNullable ? wrapped : `${wrapped}!`;
246
+ };
247
+ //#endregion
248
+ //#region src/analysis/read-response-kind.ts
249
+ var OBSERVABLE_TYPE_NAME = "Observable";
250
+ var STREAMABLE_FILE_TYPE_NAME = "StreamableFile";
251
+ var readResponseKind = (returnType) => {
252
+ if (returnType === void 0) return "json";
253
+ const unwrapped = unwrapPromise(returnType);
254
+ if (!isTypeReferenceNode(unwrapped) || !isIdentifier(unwrapped.typeName)) return "json";
255
+ if (unwrapped.typeName.text === OBSERVABLE_TYPE_NAME) return "observable";
256
+ if (unwrapped.typeName.text === STREAMABLE_FILE_TYPE_NAME) return "stream";
257
+ return "json";
258
+ };
259
+ //#endregion
260
+ //#region src/analysis/route-path.ts
261
+ var trimSlashes = (segment) => segment.replace(/^\/+/, "").replace(/\/+$/, "");
262
+ var joinRoutePath = (controllerPath, methodPath) => {
263
+ return `/${[trimSlashes(controllerPath), trimSlashes(methodPath ?? "")].filter((segment) => segment.length > 0).join("/")}`;
264
+ };
265
+ //#endregion
266
+ //#region src/analysis/extract-method-definition.ts
267
+ var extractMethodDefinition = (method, context) => {
268
+ const decorator = findAnyDecorator(method, Object.keys(HTTP_METHOD_DECORATOR_NAMES));
269
+ if (decorator === void 0) return;
270
+ const methodName = method.name.getText();
271
+ const decoratorName = decoratorNameOf(decorator);
272
+ const location = locationOf(context.sourceFile, method);
273
+ if (decoratorName === void 0) return;
274
+ const httpMethod = HTTP_METHOD_DECORATOR_NAMES[decoratorName];
275
+ if (httpMethod === void 0) return;
276
+ const routeArgument = readStaticStringArgument(decorator);
277
+ if (!routeArgument.ok) {
278
+ context.diagnostics.push({
279
+ code: "unsupported-route",
280
+ title: "Unsupported route.",
281
+ controllerName: context.controllerName,
282
+ memberName: methodName,
283
+ detail: "Route paths must be statically analyzable.",
284
+ found: `@${decoratorName}(${routeArgument.argumentText})`,
285
+ filePath: context.filePath,
286
+ line: location.line,
287
+ column: location.column
288
+ });
289
+ return;
290
+ }
291
+ const parameters = method.parameters.map((parameter, index) => extractParameterDefinition(parameter, index, {
292
+ sourceFile: context.sourceFile,
293
+ filePath: context.filePath,
294
+ controllerName: context.controllerName,
295
+ methodName,
296
+ diagnostics: context.diagnostics
297
+ }));
298
+ if (parameters.some((parameter) => parameter === void 0)) return;
299
+ return {
300
+ name: methodName,
301
+ httpMethod,
302
+ path: joinRoutePath(context.controllerPath, routeArgument.value),
303
+ parameters: parameters.filter((parameter) => parameter !== void 0),
304
+ responseKind: readResponseKind(method.type),
305
+ line: location.line,
306
+ column: location.column
307
+ };
308
+ };
309
+ //#endregion
310
+ //#region src/analysis/extract-controller-definition.ts
311
+ var extractControllerDefinition = (classDeclaration, sourceFile, filePath, diagnostics) => {
312
+ const controllerName = classDeclaration.name?.text ?? "(anonymous controller)";
313
+ const decorator = findDecorator(classDeclaration, "Controller");
314
+ if (decorator === void 0) return;
315
+ const location = locationOf(sourceFile, classDeclaration);
316
+ const argument = readStaticStringArgument(decorator);
317
+ if (!argument.ok) {
318
+ diagnostics.push({
319
+ code: "unsupported-route",
320
+ title: "Unsupported route.",
321
+ controllerName,
322
+ memberName: "",
323
+ detail: "Controller paths must be statically analyzable.",
324
+ found: `@Controller(${argument.argumentText})`,
325
+ filePath,
326
+ line: location.line,
327
+ column: location.column
328
+ });
329
+ return;
330
+ }
331
+ const methods = classDeclaration.members.filter((member) => isMethodDeclaration(member)).map((method) => extractMethodDefinition(method, {
332
+ sourceFile,
333
+ filePath,
334
+ controllerName,
335
+ controllerPath: argument.value ?? "",
336
+ diagnostics
337
+ })).filter((method) => method !== void 0);
338
+ return {
339
+ name: controllerName,
340
+ path: argument.value ?? "",
341
+ sourceFile: filePath,
342
+ methods
343
+ };
344
+ };
345
+ //#endregion
346
+ //#region src/analysis/find-controller-classes.ts
347
+ var findControllerClasses = (sourceFile) => {
348
+ return sourceFile.statements.filter((statement) => isClassDeclaration(statement) && findDecorator(statement, "Controller") !== void 0);
349
+ };
350
+ //#endregion
351
+ //#region src/analysis/parse-source-file.ts
352
+ var sharedApi;
353
+ var parseSourceFile = (filePath) => {
354
+ sharedApi ??= new API();
355
+ const sourceFile = sharedApi.updateSnapshot({ openFiles: [filePath] }).getDefaultProjectForFile(filePath)?.program.getSourceFile(filePath);
356
+ if (sourceFile === void 0) throw new Error(`Unable to parse source file: ${filePath}`);
357
+ return sourceFile;
358
+ };
359
+ //#endregion
360
+ //#region src/analysis/analyze-controllers.ts
361
+ var analyzeControllers = (filePaths) => {
362
+ const diagnostics = [];
363
+ const controllers = [];
364
+ for (const filePath of filePaths) {
365
+ const sourceFile = parseSourceFile(filePath);
366
+ for (const classDeclaration of findControllerClasses(sourceFile)) {
367
+ const controller = extractControllerDefinition(classDeclaration, sourceFile, filePath, diagnostics);
368
+ if (controller !== void 0) controllers.push(controller);
369
+ }
370
+ }
371
+ return {
372
+ controllers,
373
+ diagnostics
374
+ };
375
+ };
376
+ //#endregion
377
+ //#region src/models/graphql-operation-kind.ts
378
+ var GRAPHQL_OPERATION_DECORATOR_NAMES = {
379
+ Query: "query",
380
+ Mutation: "mutation"
381
+ };
382
+ //#endregion
383
+ //#region src/analysis/read-type-thunk-expression.ts
384
+ var readTypeThunkExpression = (thunk) => {
385
+ if (!isBlock(thunk.body)) return thunk.body;
386
+ return thunk.body.statements.find(isReturnStatement)?.expression;
387
+ };
388
+ //#endregion
389
+ //#region src/analysis/read-args-type-option.ts
390
+ var readArgsTypeOption = (decorator) => {
391
+ if (!isCallExpression(decorator.expression)) return;
392
+ const optionsArgument = decorator.expression.arguments.find(isObjectLiteralExpression);
393
+ if (optionsArgument === void 0) return;
394
+ const typeProperty = optionsArgument.properties.find((property) => isPropertyAssignment(property) && isIdentifier(property.name) && property.name.text === "type");
395
+ if (typeProperty === void 0) return;
396
+ const thunk = typeProperty.initializer;
397
+ if (!isArrowFunction(thunk) && !isFunctionExpression(thunk)) return;
398
+ const returnedExpression = readTypeThunkExpression(thunk);
399
+ if (returnedExpression === void 0) return;
400
+ if (isArrayLiteralExpression(returnedExpression)) {
401
+ const element = returnedExpression.elements[0];
402
+ return element !== void 0 && isIdentifier(element) ? {
403
+ typeName: element.text,
404
+ isArray: true
405
+ } : void 0;
406
+ }
407
+ return isIdentifier(returnedExpression) ? {
408
+ typeName: returnedExpression.text,
409
+ isArray: false
410
+ } : void 0;
411
+ };
412
+ //#endregion
413
+ //#region src/analysis/extract-resolver-argument-definition.ts
414
+ var extractResolverArgumentDefinition = (parameter, index, context) => {
415
+ const decorator = findAnyDecorator(parameter, ["Args"]);
416
+ const location = locationOf(context.sourceFile, parameter);
417
+ if (decorator === void 0) {
418
+ context.diagnostics.push({
419
+ code: "unsupported-argument",
420
+ title: "Unsupported argument.",
421
+ controllerName: context.resolverName,
422
+ memberName: context.methodName,
423
+ detail: `Parameter "${parameter.name.getText()}" must be decorated with @Args to be transported through a NestBridge GraphQL client.`,
424
+ filePath: context.filePath,
425
+ line: location.line,
426
+ column: location.column
427
+ });
428
+ return;
429
+ }
430
+ if (!isIdentifier(parameter.name)) {
431
+ context.diagnostics.push({
432
+ code: "unsupported-argument",
433
+ title: "Unsupported argument.",
434
+ controllerName: context.resolverName,
435
+ memberName: context.methodName,
436
+ detail: "Destructured parameters cannot be transported through a NestBridge GraphQL client.",
437
+ filePath: context.filePath,
438
+ line: location.line,
439
+ column: location.column
440
+ });
441
+ return;
442
+ }
443
+ const nameArgument = readStaticStringArgument(decorator);
444
+ if (!nameArgument.ok) {
445
+ context.diagnostics.push({
446
+ code: "unsupported-argument",
447
+ title: "Unsupported argument.",
448
+ controllerName: context.resolverName,
449
+ memberName: context.methodName,
450
+ detail: "@Args() name must be a statically analyzable string literal.",
451
+ found: `@Args(${nameArgument.argumentText})`,
452
+ filePath: context.filePath,
453
+ line: location.line,
454
+ column: location.column
455
+ });
456
+ return;
457
+ }
458
+ if (nameArgument.value === void 0) {
459
+ context.diagnostics.push({
460
+ code: "unsupported-argument",
461
+ title: "Unsupported argument.",
462
+ controllerName: context.resolverName,
463
+ memberName: context.methodName,
464
+ detail: "A whole @Args() is not supported; provide an argument name such as @Args('id').",
465
+ filePath: context.filePath,
466
+ line: location.line,
467
+ column: location.column
468
+ });
469
+ return;
470
+ }
471
+ if (parameter.type === void 0) {
472
+ context.diagnostics.push({
473
+ code: "unsupported-argument",
474
+ title: "Unsupported argument.",
475
+ controllerName: context.resolverName,
476
+ memberName: context.methodName,
477
+ detail: `@Args() parameter "${parameter.name.text}" needs an explicit type annotation.`,
478
+ filePath: context.filePath,
479
+ line: location.line,
480
+ column: location.column
481
+ });
482
+ return;
483
+ }
484
+ const unwrapped = unwrapTypeNode(parameter.type);
485
+ if (unwrapped === void 0) {
486
+ context.diagnostics.push({
487
+ code: "unsupported-argument",
488
+ title: "Unsupported argument.",
489
+ controllerName: context.resolverName,
490
+ memberName: context.methodName,
491
+ detail: `@Args() parameter "${parameter.name.text}" has a type NestBridge cannot statically resolve to a GraphQL type.`,
492
+ found: parameter.type.getText(),
493
+ filePath: context.filePath,
494
+ line: location.line,
495
+ column: location.column
496
+ });
497
+ return;
498
+ }
499
+ const explicitType = readArgsTypeOption(decorator);
500
+ return {
501
+ index,
502
+ parameterName: parameter.name.text,
503
+ name: nameArgument.value,
504
+ graphqlType: graphqlTypeStringFor(unwrapped, explicitType?.typeName)
505
+ };
506
+ };
507
+ //#endregion
508
+ //#region src/analysis/resolve-type-declaration.ts
509
+ var parsedFilesByPath = /* @__PURE__ */ new Map();
510
+ var parseFile = (filePath) => {
511
+ const cached = parsedFilesByPath.get(filePath);
512
+ if (cached !== void 0) return cached;
513
+ const sourceFile = parseSourceFile(filePath);
514
+ parsedFilesByPath.set(filePath, sourceFile);
515
+ return sourceFile;
516
+ };
517
+ var resolveModuleFile = (fromFilePath, moduleSpecifierText) => {
518
+ if (!moduleSpecifierText.startsWith(".")) return;
519
+ const base = resolve(dirname(fromFilePath), moduleSpecifierText);
520
+ return [
521
+ `${base}.ts`,
522
+ `${base}.tsx`,
523
+ resolve(base, "index.ts")
524
+ ].find((candidate) => existsSync(candidate));
525
+ };
526
+ var findExportedDeclaration = (sourceFile, name) => sourceFile.statements.find((statement) => isClassDeclaration(statement) && statement.name?.text === name);
527
+ var findImportSource = (sourceFile, localName) => {
528
+ for (const statement of sourceFile.statements) {
529
+ if (!isImportDeclaration(statement) || !isStringLiteralLikeNode(statement.moduleSpecifier)) continue;
530
+ const namedBindings = statement.importClause?.namedBindings;
531
+ if (namedBindings === void 0 || !isNamedImports(namedBindings)) continue;
532
+ const element = namedBindings.elements.find((candidate) => candidate.name.text === localName);
533
+ if (element !== void 0) return {
534
+ moduleSpecifierText: statement.moduleSpecifier.text,
535
+ importedName: element.propertyName?.text ?? element.name.text
536
+ };
537
+ }
538
+ };
539
+ var findReExportSource = (sourceFile, name) => {
540
+ for (const statement of sourceFile.statements) {
541
+ if (!isExportDeclaration(statement) || statement.moduleSpecifier === void 0 || !isStringLiteralLikeNode(statement.moduleSpecifier)) continue;
542
+ if (statement.exportClause === void 0) return statement.moduleSpecifier.text;
543
+ if (isNamedExports(statement.exportClause) && statement.exportClause.elements.some((element) => (element.propertyName?.text ?? element.name.text) === name)) return statement.moduleSpecifier.text;
544
+ }
545
+ };
546
+ var resolveClassDeclaration = (name, fromSourceFile, fromFilePath, visited = /* @__PURE__ */ new Set()) => {
547
+ if (visited.has(fromFilePath)) return;
548
+ visited.add(fromFilePath);
549
+ const direct = findExportedDeclaration(fromSourceFile, name);
550
+ if (direct !== void 0) return {
551
+ classDeclaration: direct,
552
+ sourceFile: fromSourceFile,
553
+ filePath: fromFilePath
554
+ };
555
+ const importSource = findImportSource(fromSourceFile, name);
556
+ if (importSource !== void 0) {
557
+ const resolvedPath = resolveModuleFile(fromFilePath, importSource.moduleSpecifierText);
558
+ if (resolvedPath !== void 0) {
559
+ const nextSourceFile = parseFile(resolvedPath);
560
+ const result = resolveClassDeclaration(importSource.importedName, nextSourceFile, resolvedPath, visited);
561
+ if (result !== void 0) return result;
562
+ }
563
+ }
564
+ const reExportModuleSpecifierText = findReExportSource(fromSourceFile, name);
565
+ if (reExportModuleSpecifierText !== void 0) {
566
+ const resolvedPath = resolveModuleFile(fromFilePath, reExportModuleSpecifierText);
567
+ if (resolvedPath !== void 0) return resolveClassDeclaration(name, parseFile(resolvedPath), resolvedPath, visited);
568
+ }
569
+ };
570
+ //#endregion
571
+ //#region src/analysis/extract-selection-fields.ts
572
+ var PRIMITIVE_SCALAR_NAMES$1 = /* @__PURE__ */ new Set([
573
+ "string",
574
+ "number",
575
+ "boolean"
576
+ ]);
577
+ var extractSelectionFields = (classDeclaration, sourceFile, filePath, context) => {
578
+ const typeName = classDeclaration.name?.text ?? "(anonymous type)";
579
+ const location = locationOf(sourceFile, classDeclaration);
580
+ if (context.visitedTypeNames.has(typeName)) {
581
+ context.diagnostics.push({
582
+ code: "circular-type",
583
+ title: "Circular type.",
584
+ controllerName: context.resolverName,
585
+ memberName: context.methodName,
586
+ detail: `Type "${typeName}" references itself, directly or indirectly. NestBridge cannot build a finite GraphQL selection set for it.`,
587
+ filePath,
588
+ line: location.line,
589
+ column: location.column
590
+ });
591
+ return;
592
+ }
593
+ const nextVisited = new Set(context.visitedTypeNames).add(typeName);
594
+ const properties = classDeclaration.members.filter((member) => isPropertyDeclaration(member) && findDecorator(member, "Field") !== void 0);
595
+ const fields = [];
596
+ for (const property of properties) {
597
+ if (!isIdentifier(property.name)) continue;
598
+ const fieldName = property.name.text;
599
+ const fieldLocation = locationOf(sourceFile, property);
600
+ if (property.type === void 0) {
601
+ context.diagnostics.push({
602
+ code: "unsupported-return-type",
603
+ title: "Unsupported field type.",
604
+ controllerName: context.resolverName,
605
+ memberName: context.methodName,
606
+ detail: `Field "${fieldName}" on "${typeName}" needs an explicit type annotation.`,
607
+ filePath,
608
+ line: fieldLocation.line,
609
+ column: fieldLocation.column
610
+ });
611
+ return;
612
+ }
613
+ const unwrapped = unwrapTypeNode(property.type);
614
+ if (unwrapped === void 0) {
615
+ context.diagnostics.push({
616
+ code: "unsupported-return-type",
617
+ title: "Unsupported field type.",
618
+ controllerName: context.resolverName,
619
+ memberName: context.methodName,
620
+ detail: `Field "${fieldName}" on "${typeName}" has a type NestBridge cannot statically resolve.`,
621
+ found: property.type.getText(),
622
+ filePath,
623
+ line: fieldLocation.line,
624
+ column: fieldLocation.column
625
+ });
626
+ return;
627
+ }
628
+ if (PRIMITIVE_SCALAR_NAMES$1.has(unwrapped.identifierText)) {
629
+ fields.push({ name: fieldName });
630
+ continue;
631
+ }
632
+ const resolved = resolveClassDeclaration(unwrapped.identifierText, sourceFile, filePath);
633
+ if (resolved === void 0) {
634
+ fields.push({ name: fieldName });
635
+ continue;
636
+ }
637
+ if (findDecorator(resolved.classDeclaration, "ObjectType") === void 0) {
638
+ context.diagnostics.push({
639
+ code: "unsupported-return-type",
640
+ title: "Unsupported field type.",
641
+ controllerName: context.resolverName,
642
+ memberName: context.methodName,
643
+ detail: `Field "${fieldName}" on "${typeName}" resolves to class "${unwrapped.identifierText}", which is not decorated with @ObjectType(). NestBridge cannot build a GraphQL selection set for it.`,
644
+ filePath,
645
+ line: fieldLocation.line,
646
+ column: fieldLocation.column
647
+ });
648
+ return;
649
+ }
650
+ const children = extractSelectionFields(resolved.classDeclaration, resolved.sourceFile, resolved.filePath, {
651
+ ...context,
652
+ visitedTypeNames: nextVisited
653
+ });
654
+ if (children === void 0) return;
655
+ fields.push({
656
+ name: fieldName,
657
+ children
658
+ });
659
+ }
660
+ return fields;
661
+ };
662
+ //#endregion
663
+ //#region src/analysis/read-graphql-operation-name.ts
664
+ var readNameFromOptions = (optionsArgument) => {
665
+ const nameProperty = optionsArgument.properties.find((property) => isPropertyAssignment(property) && isIdentifier(property.name) && property.name.text === "name");
666
+ if (nameProperty === void 0 || !isStringLiteralLikeNode(nameProperty.initializer)) return;
667
+ return nameProperty.initializer.text;
668
+ };
669
+ var readGraphqlOperationName = (decorator) => {
670
+ const expression = decorator.expression;
671
+ if (!isCallExpression(expression)) return {
672
+ ok: true,
673
+ value: void 0
674
+ };
675
+ let value;
676
+ for (const argument of expression.arguments) {
677
+ if (isArrowFunction(argument) || isFunctionExpression(argument)) continue;
678
+ if (isStringLiteralLikeNode(argument)) {
679
+ value = argument.text;
680
+ continue;
681
+ }
682
+ if (isObjectLiteralExpression(argument)) {
683
+ value = readNameFromOptions(argument) ?? value;
684
+ continue;
685
+ }
686
+ return {
687
+ ok: false,
688
+ argumentText: argument.getText()
689
+ };
690
+ }
691
+ return {
692
+ ok: true,
693
+ value
694
+ };
695
+ };
696
+ //#endregion
697
+ //#region src/analysis/read-graphql-return-type-option.ts
698
+ var readGraphqlReturnTypeOption = (decorator) => {
699
+ if (!isCallExpression(decorator.expression)) return;
700
+ const thunk = decorator.expression.arguments.find((argument) => isArrowFunction(argument) || isFunctionExpression(argument));
701
+ if (thunk === void 0) return;
702
+ const returnedExpression = readTypeThunkExpression(thunk);
703
+ if (returnedExpression === void 0) return;
704
+ if (isArrayLiteralExpression(returnedExpression)) {
705
+ const element = returnedExpression.elements[0];
706
+ return element !== void 0 && isIdentifier(element) ? element.text : void 0;
707
+ }
708
+ return isIdentifier(returnedExpression) ? returnedExpression.text : void 0;
709
+ };
710
+ //#endregion
711
+ //#region src/analysis/extract-resolver-method-definition.ts
712
+ var PRIMITIVE_SCALAR_NAMES = /* @__PURE__ */ new Set([
713
+ "string",
714
+ "number",
715
+ "boolean"
716
+ ]);
717
+ var extractResolverMethodDefinition = (method, context) => {
718
+ const decorator = findAnyDecorator(method, Object.keys(GRAPHQL_OPERATION_DECORATOR_NAMES));
719
+ if (decorator === void 0) return;
720
+ const methodName = method.name.getText();
721
+ const decoratorName = decoratorNameOf(decorator);
722
+ const location = locationOf(context.sourceFile, method);
723
+ if (decoratorName === void 0) return;
724
+ const operationKind = GRAPHQL_OPERATION_DECORATOR_NAMES[decoratorName];
725
+ if (operationKind === void 0) return;
726
+ const nameArgument = readGraphqlOperationName(decorator);
727
+ if (!nameArgument.ok) {
728
+ context.diagnostics.push({
729
+ code: "unsupported-route",
730
+ title: "Unsupported operation name.",
731
+ controllerName: context.resolverName,
732
+ memberName: methodName,
733
+ detail: "GraphQL operation names must be statically analyzable string literals.",
734
+ found: `@${decoratorName}(${nameArgument.argumentText})`,
735
+ filePath: context.filePath,
736
+ line: location.line,
737
+ column: location.column
738
+ });
739
+ return;
740
+ }
741
+ const decoratorReturnType = readGraphqlReturnTypeOption(decorator);
742
+ const identifierText = decoratorReturnType ?? (method.type === void 0 ? void 0 : unwrapTypeNode(method.type)?.identifierText);
743
+ if (identifierText === void 0) {
744
+ context.diagnostics.push({
745
+ code: "unsupported-return-type",
746
+ title: "Unsupported return type.",
747
+ controllerName: context.resolverName,
748
+ memberName: methodName,
749
+ detail: "GraphQL resolver methods need a type thunk on @Query()/@Mutation() (e.g. \"() => UserType\") or an explicit return type annotation so NestBridge can build a selection set.",
750
+ filePath: context.filePath,
751
+ line: location.line,
752
+ column: location.column
753
+ });
754
+ return;
755
+ }
756
+ let selection = [];
757
+ if (!PRIMITIVE_SCALAR_NAMES.has(identifierText.toLowerCase())) {
758
+ const resolved = resolveClassDeclaration(identifierText, context.sourceFile, context.filePath);
759
+ if (resolved === void 0 && decoratorReturnType === void 0) {
760
+ context.diagnostics.push({
761
+ code: "unsupported-return-type",
762
+ title: "Unsupported return type.",
763
+ controllerName: context.resolverName,
764
+ memberName: methodName,
765
+ detail: `NestBridge could not locate the declaration of type "${identifierText}".`,
766
+ filePath: context.filePath,
767
+ line: location.line,
768
+ column: location.column
769
+ });
770
+ return;
771
+ }
772
+ if (resolved !== void 0) {
773
+ const fields = extractSelectionFields(resolved.classDeclaration, resolved.sourceFile, resolved.filePath, {
774
+ resolverName: context.resolverName,
775
+ methodName,
776
+ diagnostics: context.diagnostics,
777
+ visitedTypeNames: /* @__PURE__ */ new Set()
778
+ });
779
+ if (fields === void 0) return;
780
+ selection = fields;
781
+ }
782
+ }
783
+ const args = method.parameters.map((parameter, index) => extractResolverArgumentDefinition(parameter, index, {
784
+ sourceFile: context.sourceFile,
785
+ filePath: context.filePath,
786
+ resolverName: context.resolverName,
787
+ methodName,
788
+ diagnostics: context.diagnostics
789
+ }));
790
+ if (args.some((argument) => argument === void 0)) return;
791
+ return {
792
+ name: methodName,
793
+ operationKind,
794
+ operationName: nameArgument.value ?? methodName,
795
+ arguments: args.filter((argument) => argument !== void 0),
796
+ selection,
797
+ line: location.line,
798
+ column: location.column
799
+ };
800
+ };
801
+ //#endregion
802
+ //#region src/analysis/extract-resolver-definition.ts
803
+ var extractResolverDefinition = (classDeclaration, sourceFile, filePath, diagnostics) => {
804
+ const resolverName = classDeclaration.name?.text ?? "(anonymous resolver)";
805
+ return {
806
+ name: resolverName,
807
+ sourceFile: filePath,
808
+ methods: classDeclaration.members.filter((member) => isMethodDeclaration(member)).map((method) => extractResolverMethodDefinition(method, {
809
+ sourceFile,
810
+ filePath,
811
+ resolverName,
812
+ diagnostics
813
+ })).filter((method) => method !== void 0)
814
+ };
815
+ };
816
+ //#endregion
817
+ //#region src/analysis/find-resolver-classes.ts
818
+ var findResolverClasses = (sourceFile) => {
819
+ return sourceFile.statements.filter((statement) => isClassDeclaration(statement) && findDecorator(statement, "Resolver") !== void 0);
820
+ };
821
+ //#endregion
822
+ //#region src/analysis/analyze-resolvers.ts
823
+ var analyzeResolvers = (filePaths) => {
824
+ const diagnostics = [];
825
+ const resolvers = [];
826
+ for (const filePath of filePaths) {
827
+ const sourceFile = parseSourceFile(filePath);
828
+ for (const classDeclaration of findResolverClasses(sourceFile)) {
829
+ const resolver = extractResolverDefinition(classDeclaration, sourceFile, filePath, diagnostics);
830
+ if (resolver !== void 0) resolvers.push(resolver);
831
+ }
832
+ }
833
+ return {
834
+ resolvers,
835
+ diagnostics
836
+ };
837
+ };
838
+ //#endregion
839
+ //#region src/declarations/generate-controller-declaration.ts
840
+ var REMOTE_RESULT_HELPERS = {
841
+ json: "RemoteResult",
842
+ observable: "RemoteObservableResult",
843
+ stream: "RemoteStreamResult"
844
+ };
845
+ var toPosixPath = (filePath) => filePath.replace(/\\/g, "/");
846
+ var importSpecifierFor = (sourceFile, outputFilePath) => {
847
+ if (!sourceFile.startsWith(".") && !/^[A-Za-z]:[\\/]/.test(sourceFile) && !sourceFile.startsWith("/")) return sourceFile;
848
+ const relativePath = toPosixPath(relative(dirname(outputFilePath), sourceFile));
849
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
850
+ };
851
+ var stripExtension = (filePath) => {
852
+ const extension = extname(filePath);
853
+ return extension.length > 0 ? filePath.slice(0, -extension.length) : filePath;
854
+ };
855
+ var generateControllerDeclaration = (controller, outputFilePath) => {
856
+ const sourceFileSpecifier = importSpecifierFor(controller.sourceFile, outputFilePath);
857
+ const importSpecifier = stripExtension(sourceFileSpecifier);
858
+ const serverAlias = `__Server${controller.name}`;
859
+ const classBody = [
860
+ " constructor();",
861
+ "",
862
+ ...controller.methods.map((method) => {
863
+ const helperName = REMOTE_RESULT_HELPERS[method.responseKind ?? "json"];
864
+ return ` ${method.name}(...args: Parameters<${serverAlias}['${method.name}']>): ${helperName}<${serverAlias}['${method.name}']>;`;
865
+ })
866
+ ].join("\n");
867
+ const usedHelperNames = new Set(controller.methods.map((method) => REMOTE_RESULT_HELPERS[method.responseKind ?? "json"]));
868
+ const helperImports = Array.from(usedHelperNames.size > 0 ? usedHelperNames : ["RemoteResult"]).sort();
869
+ return [
870
+ `import type { ${controller.name} as ${serverAlias} } from '${importSpecifier}';`,
871
+ `import type { ${helperImports.join(", ")} } from 'nestbridge';`,
872
+ "",
873
+ "/**",
874
+ " * Generated by NestBridge — client-facing methods only.",
875
+ ` * @see {@link ${sourceFileSpecifier}} for the real controller implementation.`,
876
+ " */",
877
+ `export declare class ${controller.name} {`,
878
+ classBody,
879
+ "}",
880
+ ""
881
+ ].join("\n");
882
+ };
883
+ //#endregion
884
+ //#region src/diagnostics/format-diagnostic.ts
885
+ var formatDiagnostic = (diagnostic) => {
886
+ const subject = diagnostic.memberName.length > 0 ? `${diagnostic.controllerName}.${diagnostic.memberName}` : diagnostic.controllerName;
887
+ const lines = [
888
+ `[NestBridge] ${diagnostic.title}`,
889
+ "",
890
+ subject,
891
+ "",
892
+ diagnostic.detail
893
+ ];
894
+ if (diagnostic.found !== void 0) lines.push("", "Found:", diagnostic.found);
895
+ if (diagnostic.expected !== void 0) lines.push("", "Expected:", diagnostic.expected);
896
+ lines.push("", `${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}`);
897
+ return lines.join("\n");
898
+ };
899
+ //#endregion
900
+ //#region src/diagnostics/nestbridge-diagnostic-error.ts
901
+ var NestBridgeDiagnosticError = class extends Error {
902
+ diagnostic;
903
+ constructor(diagnostic) {
904
+ super(formatDiagnostic(diagnostic));
905
+ this.name = "NestBridgeDiagnosticError";
906
+ this.diagnostic = diagnostic;
907
+ }
908
+ };
909
+ //#endregion
910
+ //#region src/version.ts
911
+ var VERSION = "2.0.4";
912
+ //#endregion
913
+ export { NestBridgeDiagnosticError, VERSION, analyzeControllers, analyzeResolvers, formatDiagnostic, generateControllerDeclaration };
914
+
915
+ //# sourceMappingURL=nestbridge.core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nestbridge.core.js","names":[],"sources":["../src/analysis/decorator-inspection.ts","../src/models/http-method.ts","../src/analysis/node-location.ts","../src/analysis/extract-parameter-definition.ts","../src/analysis/graphql-scalar-type.ts","../src/analysis/read-response-kind.ts","../src/analysis/route-path.ts","../src/analysis/extract-method-definition.ts","../src/analysis/extract-controller-definition.ts","../src/analysis/find-controller-classes.ts","../src/analysis/parse-source-file.ts","../src/analysis/analyze-controllers.ts","../src/models/graphql-operation-kind.ts","../src/analysis/read-type-thunk-expression.ts","../src/analysis/read-args-type-option.ts","../src/analysis/extract-resolver-argument-definition.ts","../src/analysis/resolve-type-declaration.ts","../src/analysis/extract-selection-fields.ts","../src/analysis/read-graphql-operation-name.ts","../src/analysis/read-graphql-return-type-option.ts","../src/analysis/extract-resolver-method-definition.ts","../src/analysis/extract-resolver-definition.ts","../src/analysis/find-resolver-classes.ts","../src/analysis/analyze-resolvers.ts","../src/declarations/generate-controller-declaration.ts","../src/diagnostics/format-diagnostic.ts","../src/diagnostics/nestbridge-diagnostic-error.ts","../package.json","../src/version.ts"],"sourcesContent":["import type {\n ClassDeclaration,\n Decorator,\n MethodDeclaration,\n ParameterDeclaration,\n PropertyDeclaration,\n} from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isDecorator,\n isIdentifier,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\n\nconst getDecorators = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n) => {\n const decorators = node.modifiers?.filter(isDecorator);\n return decorators === undefined || decorators.length === 0 ? undefined : decorators;\n};\n\nexport const findDecorator = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n decoratorName: string,\n) => {\n const decorators = getDecorators(node);\n\n if (decorators === undefined) {\n return undefined;\n }\n\n return decorators.find((decorator) => decoratorNameOf(decorator) === decoratorName);\n};\n\nexport const findAnyDecorator = (\n node: ClassDeclaration | MethodDeclaration | ParameterDeclaration | PropertyDeclaration,\n decoratorNames: readonly string[],\n) => {\n const decorators = getDecorators(node);\n\n if (decorators === undefined) {\n return undefined;\n }\n\n return decorators.find((decorator) => decoratorNames.includes(decoratorNameOf(decorator) ?? ''));\n};\n\nexport const decoratorNameOf = (decorator: Decorator) => {\n const expression = decorator.expression;\n\n if (isCallExpression(expression) && isIdentifier(expression.expression)) {\n return expression.expression.text;\n }\n\n if (isIdentifier(expression)) {\n return expression.text;\n }\n\n return undefined;\n};\n\nexport const readStaticStringArgument = (decorator: Decorator) => {\n const expression = decorator.expression;\n\n if (!isCallExpression(expression)) {\n return { ok: true, value: undefined };\n }\n\n const [firstArgument] = expression.arguments;\n\n if (firstArgument === undefined) {\n return { ok: true, value: undefined };\n }\n\n if (isStringLiteralLikeNode(firstArgument)) {\n return { ok: true, value: firstArgument.text };\n }\n\n return { ok: false, argumentText: firstArgument.getText() };\n};\n","export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport const HTTP_METHOD_DECORATOR_NAMES: Record<string, HttpMethod> = {\n Get: 'GET',\n Post: 'POST',\n Put: 'PUT',\n Patch: 'PATCH',\n Delete: 'DELETE',\n};\n","import type { Node, SourceFile } from 'typescript/unstable/ast';\n\nexport const locationOf = (sourceFile: SourceFile, node: Node) => {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));\n return { line: line + 1, column: character + 1 };\n};\n","import type { ParameterDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { ControllerParameterDefinition } from '../models/controller-parameter-definition';\nimport {\n decoratorNameOf,\n findAnyDecorator,\n readStaticStringArgument,\n} from './decorator-inspection';\nimport { locationOf } from './node-location';\n\nconst SUPPORTED_PARAMETER_DECORATORS = ['Param', 'Query', 'Body', 'Headers'] as const;\nconst KNOWN_UNSUPPORTED_PARAMETER_DECORATORS = ['Req', 'Res', 'Request', 'Response'] as const;\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n controllerName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractParameterDefinition = (\n parameter: ParameterDeclaration,\n index: number,\n context: ExtractionContext,\n): ControllerParameterDefinition | undefined => {\n const decorator = findAnyDecorator(parameter, [\n ...SUPPORTED_PARAMETER_DECORATORS,\n ...KNOWN_UNSUPPORTED_PARAMETER_DECORATORS,\n ]);\n const location = locationOf(context.sourceFile, parameter);\n\n if (decorator === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `Parameter \"${parameter.name.getText()}\" must be decorated with one of @Param, @Query, @Body, or @Headers to be transported through a NestBridge HTTP client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const decoratorName = decoratorNameOf(decorator);\n\n if (\n decoratorName !== undefined &&\n (KNOWN_UNSUPPORTED_PARAMETER_DECORATORS as readonly string[]).includes(decoratorName)\n ) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `@${decoratorName}() cannot be transported through a NestBridge HTTP client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (!isIdentifier(parameter.name)) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: 'Destructured parameters cannot be transported through a NestBridge HTTP client.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const argument = readStaticStringArgument(decorator);\n\n if (!argument.ok) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `@${decoratorName}() arguments must be statically analyzable string literals.`,\n found: `@${decoratorName}(${argument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const base = {\n index,\n parameterName: parameter.name.text,\n };\n\n if (decoratorName === 'Param') {\n if (argument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail:\n \"A whole @Param() is not supported; provide a route parameter name such as @Param('id').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n return { ...base, kind: 'param', name: argument.value };\n }\n\n if (decoratorName === 'Headers') {\n if (argument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail:\n \"A whole @Headers() is not supported; provide a header name such as @Headers('x-example').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n return { ...base, kind: 'header', name: argument.value };\n }\n\n if (decoratorName === 'Query') {\n return { ...base, kind: 'query', name: argument.value };\n }\n\n return { ...base, kind: 'body', name: argument.value };\n};\n","import type { TypeNode } from 'typescript/unstable/ast';\nimport {\n isArrayTypeNode,\n isIdentifier,\n isTypeReferenceNode,\n isUnionTypeNode,\n SyntaxKind,\n} from 'typescript/unstable/ast';\n\nconst PRIMITIVE_SCALAR_TYPES: Record<string, string> = {\n string: 'String',\n number: 'Float',\n boolean: 'Boolean',\n};\n\nexport interface UnwrappedTypeNode {\n identifierText: string;\n isArray: boolean;\n isNullable: boolean;\n}\n\nexport const unwrapPromise = (typeNode: TypeNode): TypeNode => {\n if (\n isTypeReferenceNode(typeNode) &&\n isIdentifier(typeNode.typeName) &&\n typeNode.typeName.text === 'Promise' &&\n typeNode.typeArguments?.[0] !== undefined\n ) {\n return unwrapPromise(typeNode.typeArguments[0]);\n }\n\n return typeNode;\n};\n\nconst unwrapNullable = (typeNode: TypeNode) => {\n if (!isUnionTypeNode(typeNode)) {\n return { inner: typeNode, isNullable: false };\n }\n\n const nonNullMembers = typeNode.types.filter(\n (member) =>\n member.kind !== SyntaxKind.NullKeyword && member.kind !== SyntaxKind.UndefinedKeyword,\n );\n const [onlyMember] = nonNullMembers;\n\n if (nonNullMembers.length !== 1 || onlyMember === undefined) {\n return { inner: typeNode, isNullable: nonNullMembers.length !== typeNode.types.length };\n }\n\n return { inner: onlyMember, isNullable: true };\n};\n\nconst unwrapArrayElement = (typeNode: TypeNode): TypeNode | undefined => {\n if (isArrayTypeNode(typeNode)) {\n return typeNode.elementType;\n }\n\n if (\n isTypeReferenceNode(typeNode) &&\n isIdentifier(typeNode.typeName) &&\n typeNode.typeName.text === 'Array' &&\n typeNode.typeArguments?.[0] !== undefined\n ) {\n return typeNode.typeArguments[0];\n }\n\n return undefined;\n};\n\nconst identifierTextOf = (typeNode: TypeNode): string | undefined => {\n if (isTypeReferenceNode(typeNode) && isIdentifier(typeNode.typeName)) {\n return typeNode.typeName.text;\n }\n\n switch (typeNode.kind) {\n case SyntaxKind.StringKeyword:\n return 'string';\n case SyntaxKind.NumberKeyword:\n return 'number';\n case SyntaxKind.BooleanKeyword:\n return 'boolean';\n default:\n return undefined;\n }\n};\n\nexport const unwrapTypeNode = (typeNode: TypeNode): UnwrappedTypeNode | undefined => {\n const withoutPromise = unwrapPromise(typeNode);\n const { inner: withoutNullable, isNullable } = unwrapNullable(withoutPromise);\n const arrayElement = unwrapArrayElement(withoutNullable);\n const element = arrayElement === undefined ? withoutNullable : unwrapNullable(arrayElement).inner;\n const identifierText = identifierTextOf(element);\n\n if (identifierText === undefined) {\n return undefined;\n }\n\n return { identifierText, isArray: arrayElement !== undefined, isNullable };\n};\n\nexport const graphqlScalarNameFor = (identifierText: string) =>\n PRIMITIVE_SCALAR_TYPES[identifierText] ?? identifierText;\n\nexport const graphqlTypeStringFor = (unwrapped: UnwrappedTypeNode, explicitTypeName?: string) => {\n const baseName = explicitTypeName ?? graphqlScalarNameFor(unwrapped.identifierText);\n const wrapped = unwrapped.isArray ? `[${baseName}!]` : baseName;\n return unwrapped.isNullable ? wrapped : `${wrapped}!`;\n};\n","import type { TypeNode } from 'typescript/unstable/ast';\nimport { isIdentifier, isTypeReferenceNode } from 'typescript/unstable/ast';\nimport type { ResponseKind } from '../models/response-kind';\nimport { unwrapPromise } from './graphql-scalar-type';\n\nconst OBSERVABLE_TYPE_NAME = 'Observable';\nconst STREAMABLE_FILE_TYPE_NAME = 'StreamableFile';\n\nexport const readResponseKind = (returnType: TypeNode | undefined): ResponseKind => {\n if (returnType === undefined) {\n return 'json';\n }\n\n const unwrapped = unwrapPromise(returnType);\n\n if (!isTypeReferenceNode(unwrapped) || !isIdentifier(unwrapped.typeName)) {\n return 'json';\n }\n\n if (unwrapped.typeName.text === OBSERVABLE_TYPE_NAME) {\n return 'observable';\n }\n\n if (unwrapped.typeName.text === STREAMABLE_FILE_TYPE_NAME) {\n return 'stream';\n }\n\n return 'json';\n};\n","const trimSlashes = (segment: string) => segment.replace(/^\\/+/, '').replace(/\\/+$/, '');\n\nexport const joinRoutePath = (controllerPath: string, methodPath: string | undefined) => {\n const segments = [trimSlashes(controllerPath), trimSlashes(methodPath ?? '')].filter(\n (segment) => segment.length > 0,\n );\n\n return `/${segments.join('/')}`;\n};\n","import type { MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { HTTP_METHOD_DECORATOR_NAMES } from '../models/http-method';\nimport {\n decoratorNameOf,\n findAnyDecorator,\n readStaticStringArgument,\n} from './decorator-inspection';\nimport { extractParameterDefinition } from './extract-parameter-definition';\nimport { locationOf } from './node-location';\nimport { readResponseKind } from './read-response-kind';\nimport { joinRoutePath } from './route-path';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n controllerName: string;\n controllerPath: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractMethodDefinition = (method: MethodDeclaration, context: ExtractionContext) => {\n const decorator = findAnyDecorator(method, Object.keys(HTTP_METHOD_DECORATOR_NAMES));\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const decoratorName = decoratorNameOf(decorator);\n const location = locationOf(context.sourceFile, method);\n\n if (decoratorName === undefined) {\n return undefined;\n }\n\n const httpMethod = HTTP_METHOD_DECORATOR_NAMES[decoratorName];\n\n if (httpMethod === undefined) {\n return undefined;\n }\n\n const routeArgument = readStaticStringArgument(decorator);\n\n if (!routeArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName: context.controllerName,\n memberName: methodName,\n detail: 'Route paths must be statically analyzable.',\n found: `@${decoratorName}(${routeArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const parameters = method.parameters.map((parameter, index) =>\n extractParameterDefinition(parameter, index, {\n sourceFile: context.sourceFile,\n filePath: context.filePath,\n controllerName: context.controllerName,\n methodName,\n diagnostics: context.diagnostics,\n }),\n );\n\n if (parameters.some((parameter) => parameter === undefined)) {\n return undefined;\n }\n\n return {\n name: methodName,\n httpMethod,\n path: joinRoutePath(context.controllerPath, routeArgument.value),\n parameters: parameters.filter((parameter) => parameter !== undefined),\n responseKind: readResponseKind(method.type),\n line: location.line,\n column: location.column,\n };\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isMethodDeclaration } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { findDecorator, readStaticStringArgument } from './decorator-inspection';\nimport { extractMethodDefinition } from './extract-method-definition';\nimport { locationOf } from './node-location';\n\nexport const extractControllerDefinition = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n diagnostics: NestBridgeDiagnostic[],\n) => {\n const controllerName = classDeclaration.name?.text ?? '(anonymous controller)';\n const decorator = findDecorator(classDeclaration, 'Controller');\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const location = locationOf(sourceFile, classDeclaration);\n const argument = readStaticStringArgument(decorator);\n\n if (!argument.ok) {\n diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName,\n memberName: '',\n detail: 'Controller paths must be statically analyzable.',\n found: `@Controller(${argument.argumentText})`,\n filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const methods = classDeclaration.members\n .filter((member): member is MethodDeclaration => isMethodDeclaration(member))\n .map((method) =>\n extractMethodDefinition(method, {\n sourceFile,\n filePath,\n controllerName,\n controllerPath: argument.value ?? '',\n diagnostics,\n }),\n )\n .filter((method) => method !== undefined);\n\n return {\n name: controllerName,\n path: argument.value ?? '',\n sourceFile: filePath,\n methods,\n };\n};\n","import type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isClassDeclaration } from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\n\nexport const findControllerClasses = (sourceFile: SourceFile) => {\n return sourceFile.statements.filter(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && findDecorator(statement, 'Controller') !== undefined,\n );\n};\n","import { API } from 'typescript/unstable/sync';\n\nlet sharedApi: API | undefined;\n\nexport const parseSourceFile = (filePath: string) => {\n sharedApi ??= new API();\n\n const snapshot = sharedApi.updateSnapshot({ openFiles: [filePath] });\n const project = snapshot.getDefaultProjectForFile(filePath);\n const sourceFile = project?.program.getSourceFile(filePath);\n\n if (sourceFile === undefined) {\n throw new Error(`Unable to parse source file: ${filePath}`);\n }\n\n return sourceFile;\n};\n","import type { NestBridgeDiagnostic } from '../diagnostics';\nimport type { ControllerDefinition } from '../models';\nimport { extractControllerDefinition } from './extract-controller-definition';\nimport { findControllerClasses } from './find-controller-classes';\nimport { parseSourceFile } from './parse-source-file';\n\nexport const analyzeControllers = (\n filePaths: readonly string[],\n): { controllers: ControllerDefinition[]; diagnostics: NestBridgeDiagnostic[] } => {\n const diagnostics: NestBridgeDiagnostic[] = [];\n const controllers: ControllerDefinition[] = [];\n\n for (const filePath of filePaths) {\n const sourceFile = parseSourceFile(filePath);\n\n for (const classDeclaration of findControllerClasses(sourceFile)) {\n const controller = extractControllerDefinition(\n classDeclaration,\n sourceFile,\n filePath,\n diagnostics,\n );\n\n if (controller !== undefined) {\n controllers.push(controller);\n }\n }\n }\n\n return { controllers, diagnostics };\n};\n","export type GraphqlOperationKind = 'query' | 'mutation';\n\nexport const GRAPHQL_OPERATION_DECORATOR_NAMES: Record<string, GraphqlOperationKind> = {\n Query: 'query',\n Mutation: 'mutation',\n};\n","import type { ArrowFunction, Expression, FunctionExpression } from 'typescript/unstable/ast';\nimport { isBlock, isReturnStatement } from 'typescript/unstable/ast';\n\nexport const readTypeThunkExpression = (\n thunk: ArrowFunction | FunctionExpression,\n): Expression | undefined => {\n if (!isBlock(thunk.body)) {\n return thunk.body;\n }\n\n const returnStatement = thunk.body.statements.find(isReturnStatement);\n return returnStatement?.expression;\n};\n","import type { Decorator, PropertyAssignment } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n} from 'typescript/unstable/ast';\nimport { readTypeThunkExpression } from './read-type-thunk-expression';\n\nexport interface ArgsTypeOption {\n typeName: string;\n isArray: boolean;\n}\n\nexport const readArgsTypeOption = (decorator: Decorator): ArgsTypeOption | undefined => {\n if (!isCallExpression(decorator.expression)) {\n return undefined;\n }\n\n const optionsArgument = decorator.expression.arguments.find(isObjectLiteralExpression);\n\n if (optionsArgument === undefined) {\n return undefined;\n }\n\n const typeProperty = optionsArgument.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === 'type',\n );\n\n if (typeProperty === undefined) {\n return undefined;\n }\n\n const thunk = typeProperty.initializer;\n\n if (!isArrowFunction(thunk) && !isFunctionExpression(thunk)) {\n return undefined;\n }\n\n const returnedExpression = readTypeThunkExpression(thunk);\n\n if (returnedExpression === undefined) {\n return undefined;\n }\n\n if (isArrayLiteralExpression(returnedExpression)) {\n const element = returnedExpression.elements[0];\n return element !== undefined && isIdentifier(element)\n ? { typeName: element.text, isArray: true }\n : undefined;\n }\n\n return isIdentifier(returnedExpression)\n ? { typeName: returnedExpression.text, isArray: false }\n : undefined;\n};\n","import type { ParameterDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { ResolverArgumentDefinition } from '../models/resolver-argument-definition';\nimport { findAnyDecorator, readStaticStringArgument } from './decorator-inspection';\nimport { graphqlTypeStringFor, unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { readArgsTypeOption } from './read-args-type-option';\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n resolverName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractResolverArgumentDefinition = (\n parameter: ParameterDeclaration,\n index: number,\n context: ExtractionContext,\n): ResolverArgumentDefinition | undefined => {\n const decorator = findAnyDecorator(parameter, ['Args']);\n const location = locationOf(context.sourceFile, parameter);\n\n if (decorator === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Parameter \"${parameter.name.getText()}\" must be decorated with @Args to be transported through a NestBridge GraphQL client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (!isIdentifier(parameter.name)) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: 'Destructured parameters cannot be transported through a NestBridge GraphQL client.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const nameArgument = readStaticStringArgument(decorator);\n\n if (!nameArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: '@Args() name must be a statically analyzable string literal.',\n found: `@Args(${nameArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (nameArgument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: \"A whole @Args() is not supported; provide an argument name such as @Args('id').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (parameter.type === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `@Args() parameter \"${parameter.name.text}\" needs an explicit type annotation.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const unwrapped = unwrapTypeNode(parameter.type);\n\n if (unwrapped === undefined) {\n context.diagnostics.push({\n code: 'unsupported-argument',\n title: 'Unsupported argument.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `@Args() parameter \"${parameter.name.text}\" has a type NestBridge cannot statically resolve to a GraphQL type.`,\n found: parameter.type.getText(),\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const explicitType = readArgsTypeOption(decorator);\n\n return {\n index,\n parameterName: parameter.name.text,\n name: nameArgument.value,\n graphqlType: graphqlTypeStringFor(unwrapped, explicitType?.typeName),\n };\n};\n","import { existsSync } from 'node:fs';\nimport { dirname, resolve as resolvePath } from 'node:path';\nimport type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport {\n isClassDeclaration,\n isExportDeclaration,\n isImportDeclaration,\n isNamedExports,\n isNamedImports,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\nimport { parseSourceFile } from './parse-source-file';\n\nexport interface ResolvedTypeDeclaration {\n classDeclaration: ClassDeclaration;\n sourceFile: SourceFile;\n filePath: string;\n}\n\ninterface ImportSource {\n moduleSpecifierText: string;\n importedName: string;\n}\n\nconst parsedFilesByPath = new Map<string, SourceFile>();\n\nconst parseFile = (filePath: string): SourceFile => {\n const cached = parsedFilesByPath.get(filePath);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const sourceFile = parseSourceFile(filePath);\n parsedFilesByPath.set(filePath, sourceFile);\n return sourceFile;\n};\n\nconst resolveModuleFile = (\n fromFilePath: string,\n moduleSpecifierText: string,\n): string | undefined => {\n if (!moduleSpecifierText.startsWith('.')) {\n return undefined;\n }\n\n const base = resolvePath(dirname(fromFilePath), moduleSpecifierText);\n const candidates = [`${base}.ts`, `${base}.tsx`, resolvePath(base, 'index.ts')];\n\n return candidates.find((candidate) => existsSync(candidate));\n};\n\nconst findExportedDeclaration = (\n sourceFile: SourceFile,\n name: string,\n): ClassDeclaration | undefined =>\n sourceFile.statements.find(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && statement.name?.text === name,\n );\n\nconst findImportSource = (sourceFile: SourceFile, localName: string): ImportSource | undefined => {\n for (const statement of sourceFile.statements) {\n if (!isImportDeclaration(statement) || !isStringLiteralLikeNode(statement.moduleSpecifier)) {\n continue;\n }\n\n const namedBindings = statement.importClause?.namedBindings;\n\n if (namedBindings === undefined || !isNamedImports(namedBindings)) {\n continue;\n }\n\n const element = namedBindings.elements.find((candidate) => candidate.name.text === localName);\n\n if (element !== undefined) {\n return {\n moduleSpecifierText: statement.moduleSpecifier.text,\n importedName: element.propertyName?.text ?? element.name.text,\n };\n }\n }\n\n return undefined;\n};\n\nconst findReExportSource = (sourceFile: SourceFile, name: string): string | undefined => {\n for (const statement of sourceFile.statements) {\n if (\n !isExportDeclaration(statement) ||\n statement.moduleSpecifier === undefined ||\n !isStringLiteralLikeNode(statement.moduleSpecifier)\n ) {\n continue;\n }\n\n if (statement.exportClause === undefined) {\n return statement.moduleSpecifier.text;\n }\n\n if (\n isNamedExports(statement.exportClause) &&\n statement.exportClause.elements.some(\n (element) => (element.propertyName?.text ?? element.name.text) === name,\n )\n ) {\n return statement.moduleSpecifier.text;\n }\n }\n\n return undefined;\n};\n\nexport const resolveClassDeclaration = (\n name: string,\n fromSourceFile: SourceFile,\n fromFilePath: string,\n visited: Set<string> = new Set(),\n): ResolvedTypeDeclaration | undefined => {\n if (visited.has(fromFilePath)) {\n return undefined;\n }\n\n visited.add(fromFilePath);\n\n const direct = findExportedDeclaration(fromSourceFile, name);\n\n if (direct !== undefined) {\n return { classDeclaration: direct, sourceFile: fromSourceFile, filePath: fromFilePath };\n }\n\n const importSource = findImportSource(fromSourceFile, name);\n\n if (importSource !== undefined) {\n const resolvedPath = resolveModuleFile(fromFilePath, importSource.moduleSpecifierText);\n\n if (resolvedPath !== undefined) {\n const nextSourceFile = parseFile(resolvedPath);\n const result = resolveClassDeclaration(\n importSource.importedName,\n nextSourceFile,\n resolvedPath,\n visited,\n );\n\n if (result !== undefined) {\n return result;\n }\n }\n }\n\n const reExportModuleSpecifierText = findReExportSource(fromSourceFile, name);\n\n if (reExportModuleSpecifierText !== undefined) {\n const resolvedPath = resolveModuleFile(fromFilePath, reExportModuleSpecifierText);\n\n if (resolvedPath !== undefined) {\n const nextSourceFile = parseFile(resolvedPath);\n return resolveClassDeclaration(name, nextSourceFile, resolvedPath, visited);\n }\n }\n\n return undefined;\n};\n","import type { ClassDeclaration, PropertyDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isIdentifier, isPropertyDeclaration } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { SelectionField } from '../models/selection-field';\nimport { findDecorator } from './decorator-inspection';\nimport { unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\nconst PRIMITIVE_SCALAR_NAMES = new Set(['string', 'number', 'boolean']);\n\ninterface SelectionContext {\n resolverName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n visitedTypeNames: Set<string>;\n}\n\nexport const extractSelectionFields = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n context: SelectionContext,\n): SelectionField[] | undefined => {\n const typeName = classDeclaration.name?.text ?? '(anonymous type)';\n const location = locationOf(sourceFile, classDeclaration);\n\n if (context.visitedTypeNames.has(typeName)) {\n context.diagnostics.push({\n code: 'circular-type',\n title: 'Circular type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Type \"${typeName}\" references itself, directly or indirectly. NestBridge cannot build a finite GraphQL selection set for it.`,\n filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const nextVisited = new Set(context.visitedTypeNames).add(typeName);\n\n const properties = classDeclaration.members.filter(\n (member): member is PropertyDeclaration =>\n isPropertyDeclaration(member) && findDecorator(member, 'Field') !== undefined,\n );\n\n const fields: SelectionField[] = [];\n\n for (const property of properties) {\n if (!isIdentifier(property.name)) {\n continue;\n }\n\n const fieldName = property.name.text;\n const fieldLocation = locationOf(sourceFile, property);\n\n if (property.type === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" needs an explicit type annotation.`,\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n const unwrapped = unwrapTypeNode(property.type);\n\n if (unwrapped === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" has a type NestBridge cannot statically resolve.`,\n found: property.type.getText(),\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n if (PRIMITIVE_SCALAR_NAMES.has(unwrapped.identifierText)) {\n fields.push({ name: fieldName });\n continue;\n }\n\n const resolved = resolveClassDeclaration(unwrapped.identifierText, sourceFile, filePath);\n\n if (resolved === undefined) {\n fields.push({ name: fieldName });\n continue;\n }\n\n if (findDecorator(resolved.classDeclaration, 'ObjectType') === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported field type.',\n controllerName: context.resolverName,\n memberName: context.methodName,\n detail: `Field \"${fieldName}\" on \"${typeName}\" resolves to class \"${unwrapped.identifierText}\", which is not decorated with @ObjectType(). NestBridge cannot build a GraphQL selection set for it.`,\n filePath,\n line: fieldLocation.line,\n column: fieldLocation.column,\n });\n return undefined;\n }\n\n const children = extractSelectionFields(\n resolved.classDeclaration,\n resolved.sourceFile,\n resolved.filePath,\n {\n ...context,\n visitedTypeNames: nextVisited,\n },\n );\n\n if (children === undefined) {\n return undefined;\n }\n\n fields.push({ name: fieldName, children });\n }\n\n return fields;\n};\n","import type {\n Decorator,\n ObjectLiteralExpression,\n PropertyAssignment,\n} from 'typescript/unstable/ast';\nimport {\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteralLikeNode,\n} from 'typescript/unstable/ast';\n\nexport interface ReadGraphqlOperationNameResult {\n ok: boolean;\n value?: string;\n argumentText?: string;\n}\n\nconst readNameFromOptions = (optionsArgument: ObjectLiteralExpression) => {\n const nameProperty = optionsArgument.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === 'name',\n );\n\n if (nameProperty === undefined || !isStringLiteralLikeNode(nameProperty.initializer)) {\n return undefined;\n }\n\n return nameProperty.initializer.text;\n};\n\nexport const readGraphqlOperationName = (decorator: Decorator): ReadGraphqlOperationNameResult => {\n const expression = decorator.expression;\n\n if (!isCallExpression(expression)) {\n return { ok: true, value: undefined };\n }\n\n let value: string | undefined;\n\n for (const argument of expression.arguments) {\n if (isArrowFunction(argument) || isFunctionExpression(argument)) {\n continue;\n }\n\n if (isStringLiteralLikeNode(argument)) {\n value = argument.text;\n continue;\n }\n\n if (isObjectLiteralExpression(argument)) {\n value = readNameFromOptions(argument) ?? value;\n continue;\n }\n\n return { ok: false, argumentText: argument.getText() };\n }\n\n return { ok: true, value };\n};\n","import type { ArrowFunction, Decorator, FunctionExpression } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isArrowFunction,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n} from 'typescript/unstable/ast';\nimport { readTypeThunkExpression } from './read-type-thunk-expression';\n\nexport const readGraphqlReturnTypeOption = (decorator: Decorator): string | undefined => {\n if (!isCallExpression(decorator.expression)) {\n return undefined;\n }\n\n const thunk = decorator.expression.arguments.find(\n (argument): argument is ArrowFunction | FunctionExpression =>\n isArrowFunction(argument) || isFunctionExpression(argument),\n );\n\n if (thunk === undefined) {\n return undefined;\n }\n\n const returnedExpression = readTypeThunkExpression(thunk);\n\n if (returnedExpression === undefined) {\n return undefined;\n }\n\n if (isArrayLiteralExpression(returnedExpression)) {\n const element = returnedExpression.elements[0];\n return element !== undefined && isIdentifier(element) ? element.text : undefined;\n }\n\n return isIdentifier(returnedExpression) ? returnedExpression.text : undefined;\n};\n","import type { MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { GRAPHQL_OPERATION_DECORATOR_NAMES } from '../models/graphql-operation-kind';\nimport type { SelectionField } from '../models/selection-field';\nimport { decoratorNameOf, findAnyDecorator } from './decorator-inspection';\nimport { extractResolverArgumentDefinition } from './extract-resolver-argument-definition';\nimport { extractSelectionFields } from './extract-selection-fields';\nimport { unwrapTypeNode } from './graphql-scalar-type';\nimport { locationOf } from './node-location';\nimport { readGraphqlOperationName } from './read-graphql-operation-name';\nimport { readGraphqlReturnTypeOption } from './read-graphql-return-type-option';\nimport { resolveClassDeclaration } from './resolve-type-declaration';\n\nconst PRIMITIVE_SCALAR_NAMES = new Set(['string', 'number', 'boolean']);\n\ninterface ExtractionContext {\n sourceFile: SourceFile;\n filePath: string;\n resolverName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractResolverMethodDefinition = (\n method: MethodDeclaration,\n context: ExtractionContext,\n) => {\n const decorator = findAnyDecorator(method, Object.keys(GRAPHQL_OPERATION_DECORATOR_NAMES));\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const decoratorName = decoratorNameOf(decorator);\n const location = locationOf(context.sourceFile, method);\n\n if (decoratorName === undefined) {\n return undefined;\n }\n\n const operationKind = GRAPHQL_OPERATION_DECORATOR_NAMES[decoratorName];\n\n if (operationKind === undefined) {\n return undefined;\n }\n\n const nameArgument = readGraphqlOperationName(decorator);\n\n if (!nameArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported operation name.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail: 'GraphQL operation names must be statically analyzable string literals.',\n found: `@${decoratorName}(${nameArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const decoratorReturnType = readGraphqlReturnTypeOption(decorator);\n const identifierText =\n decoratorReturnType ??\n (method.type === undefined ? undefined : unwrapTypeNode(method.type)?.identifierText);\n\n if (identifierText === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported return type.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail:\n 'GraphQL resolver methods need a type thunk on @Query()/@Mutation() (e.g. \"() => UserType\") or an explicit return type annotation so NestBridge can build a selection set.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n let selection: SelectionField[] = [];\n\n if (!PRIMITIVE_SCALAR_NAMES.has(identifierText.toLowerCase())) {\n const resolved = resolveClassDeclaration(identifierText, context.sourceFile, context.filePath);\n\n if (resolved === undefined && decoratorReturnType === undefined) {\n context.diagnostics.push({\n code: 'unsupported-return-type',\n title: 'Unsupported return type.',\n controllerName: context.resolverName,\n memberName: methodName,\n detail: `NestBridge could not locate the declaration of type \"${identifierText}\".`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (resolved !== undefined) {\n const fields = extractSelectionFields(\n resolved.classDeclaration,\n resolved.sourceFile,\n resolved.filePath,\n {\n resolverName: context.resolverName,\n methodName,\n diagnostics: context.diagnostics,\n visitedTypeNames: new Set(),\n },\n );\n\n if (fields === undefined) {\n return undefined;\n }\n\n selection = fields;\n }\n }\n\n const args = method.parameters.map((parameter, index) =>\n extractResolverArgumentDefinition(parameter, index, {\n sourceFile: context.sourceFile,\n filePath: context.filePath,\n resolverName: context.resolverName,\n methodName,\n diagnostics: context.diagnostics,\n }),\n );\n\n if (args.some((argument) => argument === undefined)) {\n return undefined;\n }\n\n return {\n name: methodName,\n operationKind,\n operationName: nameArgument.value ?? methodName,\n arguments: args.filter((argument) => argument !== undefined),\n selection,\n line: location.line,\n column: location.column,\n };\n};\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isMethodDeclaration } from 'typescript/unstable/ast';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { extractResolverMethodDefinition } from './extract-resolver-method-definition';\n\nexport const extractResolverDefinition = (\n classDeclaration: ClassDeclaration,\n sourceFile: SourceFile,\n filePath: string,\n diagnostics: NestBridgeDiagnostic[],\n) => {\n const resolverName = classDeclaration.name?.text ?? '(anonymous resolver)';\n\n const methods = classDeclaration.members\n .filter((member): member is MethodDeclaration => isMethodDeclaration(member))\n .map((method) =>\n extractResolverMethodDefinition(method, {\n sourceFile,\n filePath,\n resolverName,\n diagnostics,\n }),\n )\n .filter((method) => method !== undefined);\n\n return {\n name: resolverName,\n sourceFile: filePath,\n methods,\n };\n};\n","import type { ClassDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport { isClassDeclaration } from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\n\nexport const findResolverClasses = (sourceFile: SourceFile) => {\n return sourceFile.statements.filter(\n (statement): statement is ClassDeclaration =>\n isClassDeclaration(statement) && findDecorator(statement, 'Resolver') !== undefined,\n );\n};\n","import type { NestBridgeDiagnostic } from '../diagnostics';\nimport type { ResolverDefinition } from '../models';\nimport { extractResolverDefinition } from './extract-resolver-definition';\nimport { findResolverClasses } from './find-resolver-classes';\nimport { parseSourceFile } from './parse-source-file';\n\nexport const analyzeResolvers = (\n filePaths: readonly string[],\n): { resolvers: ResolverDefinition[]; diagnostics: NestBridgeDiagnostic[] } => {\n const diagnostics: NestBridgeDiagnostic[] = [];\n const resolvers: ResolverDefinition[] = [];\n\n for (const filePath of filePaths) {\n const sourceFile = parseSourceFile(filePath);\n\n for (const classDeclaration of findResolverClasses(sourceFile)) {\n const resolver = extractResolverDefinition(\n classDeclaration,\n sourceFile,\n filePath,\n diagnostics,\n );\n\n if (resolver !== undefined) {\n resolvers.push(resolver);\n }\n }\n }\n\n return { resolvers, diagnostics };\n};\n","import { dirname, extname, relative } from 'node:path';\nimport type { ResponseKind } from '../models/response-kind';\n\ninterface ClientDeclarationSource {\n name: string;\n sourceFile: string;\n methods: readonly { name: string; responseKind?: ResponseKind }[];\n}\n\nconst REMOTE_RESULT_HELPERS: Record<ResponseKind, string> = {\n json: 'RemoteResult',\n observable: 'RemoteObservableResult',\n stream: 'RemoteStreamResult',\n};\n\nconst toPosixPath = (filePath: string) => filePath.replace(/\\\\/g, '/');\n\nconst importSpecifierFor = (sourceFile: string, outputFilePath: string) => {\n if (\n !sourceFile.startsWith('.') &&\n !/^[A-Za-z]:[\\\\/]/.test(sourceFile) &&\n !sourceFile.startsWith('/')\n ) {\n return sourceFile;\n }\n\n const relativePath = toPosixPath(relative(dirname(outputFilePath), sourceFile));\n return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n};\n\nconst stripExtension = (filePath: string) => {\n const extension = extname(filePath);\n return extension.length > 0 ? filePath.slice(0, -extension.length) : filePath;\n};\n\nexport const generateControllerDeclaration = (\n controller: ClientDeclarationSource,\n outputFilePath: string,\n): string => {\n const sourceFileSpecifier = importSpecifierFor(controller.sourceFile, outputFilePath);\n const importSpecifier = stripExtension(sourceFileSpecifier);\n const serverAlias = `__Server${controller.name}`;\n const methodDeclarations = controller.methods.map((method) => {\n const helperName = REMOTE_RESULT_HELPERS[method.responseKind ?? 'json'];\n return ` ${method.name}(...args: Parameters<${serverAlias}['${method.name}']>): ${helperName}<${serverAlias}['${method.name}']>;`;\n });\n\n const classBody = [' constructor();', '', ...methodDeclarations].join('\\n');\n\n const usedHelperNames = new Set(\n controller.methods.map((method) => REMOTE_RESULT_HELPERS[method.responseKind ?? 'json']),\n );\n const helperImports = Array.from(\n usedHelperNames.size > 0 ? usedHelperNames : ['RemoteResult'],\n ).sort();\n\n return [\n `import type { ${controller.name} as ${serverAlias} } from '${importSpecifier}';`,\n `import type { ${helperImports.join(', ')} } from 'nestbridge';`,\n '',\n '/**',\n ' * Generated by NestBridge — client-facing methods only.',\n ` * @see {@link ${sourceFileSpecifier}} for the real controller implementation.`,\n ' */',\n `export declare class ${controller.name} {`,\n classBody,\n '}',\n '',\n ].join('\\n');\n};\n","import type { NestBridgeDiagnostic } from './nestbridge-diagnostic';\n\nexport const formatDiagnostic = (diagnostic: NestBridgeDiagnostic): string => {\n const subject =\n diagnostic.memberName.length > 0\n ? `${diagnostic.controllerName}.${diagnostic.memberName}`\n : diagnostic.controllerName;\n\n const lines = [`[NestBridge] ${diagnostic.title}`, '', subject, '', diagnostic.detail];\n\n if (diagnostic.found !== undefined) {\n lines.push('', 'Found:', diagnostic.found);\n }\n\n if (diagnostic.expected !== undefined) {\n lines.push('', 'Expected:', diagnostic.expected);\n }\n\n lines.push('', `${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}`);\n\n return lines.join('\\n');\n};\n","import { formatDiagnostic } from './format-diagnostic';\nimport type { NestBridgeDiagnostic } from './nestbridge-diagnostic';\n\nexport class NestBridgeDiagnosticError extends Error {\n readonly diagnostic: NestBridgeDiagnostic;\n\n constructor(diagnostic: NestBridgeDiagnostic) {\n super(formatDiagnostic(diagnostic));\n this.name = 'NestBridgeDiagnosticError';\n this.diagnostic = diagnostic;\n }\n}\n","{\n \"name\": \"@nestbridge/core\",\n \"version\": \"2.0.4\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/MDReal32/nestbridge.git\",\n \"directory\": \"packages/core\"\n },\n \"main\": \"./build/nestbridge.core.js\",\n \"types\": \"./build/nestbridge.core.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./build/nestbridge.core.d.ts\",\n \"import\": \"./build/nestbridge.core.js\"\n }\n },\n \"files\": [\n \"build\"\n ],\n \"scripts\": {\n \"build\": \"vite build\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc -p tsconfig.json --noEmit\",\n \"lint\": \"biome check .\"\n },\n \"dependencies\": {\n \"typescript\": \"^7.0.2\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^26.4.1\",\n \"rolldown-plugin-dts\": \"^0.28.5\",\n \"vite\": \"^8.2.2\",\n \"vitest\": \"^5.0.0\"\n }\n}\n","import { version } from '../package.json';\n\nexport const VERSION: string = version;\n"],"mappings":";;;;;AAcA,IAAM,iBACJ,SACG;CACH,MAAM,aAAa,KAAK,WAAW,OAAO,WAAW;CACrD,OAAO,eAAe,KAAA,KAAa,WAAW,WAAW,IAAI,KAAA,IAAY;AAC3E;AAEA,IAAa,iBACX,MACA,kBACG;CACH,MAAM,aAAa,cAAc,IAAI;CAErC,IAAI,eAAe,KAAA,G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gB,OAAO,IAAI,kBAAkB,CAAC,cAAc,CAC9D,CAAC,CAAC,KAAK;CAEP,OAAO;EACL,iBAAiB,WAAW,KAAK,MAAM,YAAY,WAAW,gBAAgB;EAC9E,iBAAiB,cAAc,KAAK,IAAI,EAAE;EAC1C;EACA;EACA;EACA,kBAAkB,oBAAoB;EACtC;EACA,wBAAwB,WAAW,KAAK;EACxC;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;AACb;;;ACnEA,IAAa,oBAAoB,eAA6C;CAC5E,MAAM,UACJ,WAAW,WAAW,SAAS,IAC3B,GAAG,WAAW,eAAe,GAAG,WAAW,eAC3C,WAAW;CAEjB,MAAM,QAAQ;EAAC,gBAAgB,WAAW;EAAS;EAAI;EAAS;EAAI,WAAW;CAAM;CAErF,IAAI,WAAW,UAAU,KAAA,GACvB,MAAM,KAAK,IAAI,UAAU,WAAW,KAAK;CAG3C,IAAI,WAAW,aAAa,KAAA,GAC1B,MAAM,KAAK,IAAI,aAAa,WAAW,QAAQ;CAGjD,MAAM,KAAK,IAAI,GAAG,WAAW,SAAS,GAAG,WAAW,KAAK,GAAG,WAAW,QAAQ;CAE/E,OAAO,MAAM,KAAK,IAAI;AACxB;;;AClBA,IAAa,4BAAb,cAA+C,MAAM;CACnD;CAEA,YAAY,YAAkC;EAC5C,MAAM,iBAAiB,UAAU,CAAC;EAClC,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF;;;AETA,IAAa,UAAkB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestbridge/core",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {