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