@nestbridge/core 2.0.4 → 2.1.1

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
@@ -77,6 +77,52 @@ import { generateControllerDeclaration } from '@nestbridge/core';
77
77
  const source = generateControllerDeclaration(controller, outputPath);
78
78
  ```
79
79
 
80
+ ### `detectResponseWrapper(bootstrapFilePath)`
81
+
82
+ Statically detects `app.useGlobalInterceptors(...)` registrations in the
83
+ bootstrap file whose `intercept()` method reshapes every response through a
84
+ single recognized `next.handle().pipe(map(...))` call, composing multiple
85
+ chained interceptors in registration order, and returns the resulting
86
+ wrapped-response type source. Returns `undefined` when no interceptor is
87
+ registered, or the shape isn't exactly recognized — see the [repository
88
+ README](../../README.md#auto-detected-global-response-wrapper) for the full
89
+ rules.
90
+
91
+ ```ts
92
+ import { detectResponseWrapper } from '@nestbridge/core';
93
+
94
+ const responseWrapper = detectResponseWrapper('src/main.ts');
95
+ ```
96
+
97
+ ### `detectErrorResponseShape(bootstrapFilePath)`
98
+
99
+ Statically detects a single global `@Catch(...)` exception filter —
100
+ registered via `app.useGlobalFilters(...)` or an `APP_FILTER` provider on the
101
+ root module — whose `catch()` method reshapes the error through a single
102
+ recognized `.json(...)`/`.send(...)` call, and returns the resulting error
103
+ body type source. Returns `undefined` when no filter is registered, or the
104
+ shape isn't exactly recognized — see the [repository
105
+ README](../../README.md#auto-detected-exception-filter-error-body) for the
106
+ full rules.
107
+
108
+ ```ts
109
+ import { detectErrorResponseShape } from '@nestbridge/core';
110
+
111
+ const errorResponseShape = detectErrorResponseShape('src/main.ts');
112
+ ```
113
+
114
+ ### `generateErrorBodyDeclaration(errorBodyTypeSource)`
115
+
116
+ Turns the `errorBodyTypeSource` from `detectErrorResponseShape` into the text
117
+ of the fixed `nestbridge-error-body.d.ts` declaration file, exporting a
118
+ `NestBridgeErrorBody` type.
119
+
120
+ ```ts
121
+ import { generateErrorBodyDeclaration } from '@nestbridge/core';
122
+
123
+ const source = generateErrorBodyDeclaration(errorResponseShape.errorBodyTypeSource);
124
+ ```
125
+
80
126
  ### Diagnostics
81
127
 
82
128
  ```ts
@@ -93,7 +139,8 @@ more diagnostics as a thrown `Error`.
93
139
  `ControllerParameterDefinition`, `HttpMethod`, `ParameterSourceKind`,
94
140
  `ResolverDefinition`, `ResolverMethodDefinition`,
95
141
  `ResolverArgumentDefinition`, `SelectionField`, `GraphqlOperationKind`,
96
- `NestBridgeDiagnostic`, `NestBridgeDiagnosticCode`.
142
+ `NestBridgeDiagnostic`, `NestBridgeDiagnosticCode`, `ResponseWrapperDetection`,
143
+ `ErrorResponseShapeDetection`.
97
144
 
98
145
  ## License
99
146
 
@@ -67,6 +67,17 @@ interface ControllerDefinition {
67
67
  methods: ControllerMethodDefinition[];
68
68
  }
69
69
  //#endregion
70
+ //#region src/models/controller-analysis-result.d.ts
71
+ interface ControllerAnalysisResult {
72
+ controllers: ControllerDefinition[];
73
+ diagnostics: NestBridgeDiagnostic[];
74
+ }
75
+ //#endregion
76
+ //#region src/models/error-response-shape-detection.d.ts
77
+ interface ErrorResponseShapeDetection {
78
+ errorBodyTypeSource: string;
79
+ }
80
+ //#endregion
70
81
  //#region src/models/graphql-operation-kind.d.ts
71
82
  type GraphqlOperationKind = "query" | "mutation";
72
83
  //#endregion
@@ -102,17 +113,33 @@ interface ResolverDefinition {
102
113
  methods: ResolverMethodDefinition[];
103
114
  }
104
115
  //#endregion
105
- //#region src/analysis/analyze-controllers.d.ts
106
- export declare const analyzeControllers: (filePaths: readonly string[]) => {
107
- controllers: ControllerDefinition[];
116
+ //#region src/models/resolver-analysis-result.d.ts
117
+ interface ResolverAnalysisResult {
118
+ resolvers: ResolverDefinition[];
108
119
  diagnostics: NestBridgeDiagnostic[];
109
- };
120
+ }
121
+ //#endregion
122
+ //#region src/models/response-wrapper-detection.d.ts
123
+ interface ResponseWrapperDetection {
124
+ wrappedResultTypeSource: string;
125
+ }
126
+ //#endregion
127
+ //#region src/analysis/analyze-controllers.d.ts
128
+ export declare const analyzeControllers: (filePaths: readonly string[]) => ControllerAnalysisResult;
110
129
  //#endregion
111
130
  //#region src/analysis/analyze-resolvers.d.ts
112
- export declare const analyzeResolvers: (filePaths: readonly string[]) => {
113
- resolvers: ResolverDefinition[];
114
- diagnostics: NestBridgeDiagnostic[];
115
- };
131
+ export declare const analyzeResolvers: (filePaths: readonly string[]) => ResolverAnalysisResult;
132
+ //#endregion
133
+ //#region src/analysis/detect-error-response-shape.d.ts
134
+ export declare const detectErrorResponseShape: (bootstrapFilePath: string) => ErrorResponseShapeDetection | undefined;
135
+ //#endregion
136
+ //#region src/analysis/detect-response-wrapper.d.ts
137
+ /**
138
+ * Interceptors registered first wrap those registered after them, so the
139
+ * composed type is built from the last-registered interceptor (closest to the
140
+ * raw handler result) outward to the first-registered one.
141
+ */
142
+ export declare const detectResponseWrapper: (bootstrapFilePath: string) => ResponseWrapperDetection | undefined;
116
143
  //#endregion
117
144
  //#region src/declarations/generate-controller-declaration.d.ts
118
145
  interface ClientDeclarationSource {
@@ -123,10 +150,13 @@ interface ClientDeclarationSource {
123
150
  responseKind?: ResponseKind;
124
151
  }[];
125
152
  }
126
- export declare const generateControllerDeclaration: (controller: ClientDeclarationSource, outputFilePath: string) => string;
153
+ export declare const generateControllerDeclaration: (controller: ClientDeclarationSource, outputFilePath: string, responseWrapper?: ResponseWrapperDetection) => string;
154
+ //#endregion
155
+ //#region src/declarations/generate-error-body-declaration.d.ts
156
+ export declare const generateErrorBodyDeclaration: (errorBodyTypeSource: string) => string;
127
157
  //#endregion
128
158
  //#region src/version.d.ts
129
159
  export declare const VERSION: string;
130
160
  //#endregion
131
- export type { ControllerDefinition, ControllerMethodDefinition, ControllerParameterDefinition, GraphqlOperationKind, HttpMethod, NestBridgeDiagnostic, NestBridgeDiagnosticCode, ParameterSourceKind, ResolverArgumentDefinition, ResolverDefinition, ResolverMethodDefinition, ResponseKind, SelectionField };
161
+ export type { ControllerAnalysisResult, ControllerDefinition, ControllerMethodDefinition, ControllerParameterDefinition, ErrorResponseShapeDetection, GraphqlOperationKind, HttpMethod, NestBridgeDiagnostic, NestBridgeDiagnosticCode, ParameterSourceKind, ResolverAnalysisResult, ResolverArgumentDefinition, ResolverDefinition, ResolverMethodDefinition, ResponseKind, ResponseWrapperDetection, SelectionField };
132
162
  //# sourceMappingURL=nestbridge.core.d.ts.map
@@ -1,4 +1,4 @@
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";
1
+ import { SyntaxKind, isArrayLiteralExpression, isArrayTypeNode, isArrowFunction, isBlock, isCallExpression, isClassDeclaration, isDecorator, isExportDeclaration, isExpressionStatement, isFalseLiteral, isFunctionExpression, isIdentifier, isImportDeclaration, isMethodDeclaration, isNamedExports, isNamedImports, isNewExpression, isNullLiteral, isNumericLiteral, isObjectLiteralExpression, isParenthesizedExpression, isPropertyAccessExpression, isPropertyAssignment, isPropertyDeclaration, isReturnStatement, isSpreadElement, isStringLiteral, isStringLiteralLikeNode, isTrueLiteral, isTypeReferenceNode, isUnionTypeNode, isVariableStatement } from "typescript/unstable/ast";
2
2
  import { API } from "typescript/unstable/sync";
3
3
  import { existsSync } from "node:fs";
4
4
  import { dirname, extname, relative, resolve } from "node:path";
@@ -352,7 +352,11 @@ var findControllerClasses = (sourceFile) => {
352
352
  var sharedApi;
353
353
  var parseSourceFile = (filePath) => {
354
354
  sharedApi ??= new API();
355
- const sourceFile = sharedApi.updateSnapshot({ openFiles: [filePath] }).getDefaultProjectForFile(filePath)?.program.getSourceFile(filePath);
355
+ sharedApi.updateSnapshot({ closeFiles: [filePath] });
356
+ const sourceFile = sharedApi.updateSnapshot({
357
+ openFiles: [filePath],
358
+ fileChanges: { changed: [filePath] }
359
+ }).getDefaultProjectForFile(filePath)?.program.getSourceFile(filePath);
356
360
  if (sourceFile === void 0) throw new Error(`Unable to parse source file: ${filePath}`);
357
361
  return sourceFile;
358
362
  };
@@ -836,12 +840,328 @@ var analyzeResolvers = (filePaths) => {
836
840
  };
837
841
  };
838
842
  //#endregion
843
+ //#region src/analysis/find-app-filter-provider-class-name.ts
844
+ var MODULE_DECORATOR_NAME = "Module";
845
+ var PROVIDERS_PROPERTY_NAME = "providers";
846
+ var PROVIDE_PROPERTY_NAME = "provide";
847
+ var USE_CLASS_PROPERTY_NAME = "useClass";
848
+ var APP_FILTER_LOCAL_NAME = "APP_FILTER";
849
+ var NEST_CORE_MODULE_SPECIFIER$1 = "@nestjs/core";
850
+ var findAppFilterProviderClassName = (moduleClassDeclaration, moduleSourceFile) => {
851
+ const moduleDecorator = findDecorator(moduleClassDeclaration, MODULE_DECORATOR_NAME);
852
+ if (moduleDecorator === void 0 || !isCallExpression(moduleDecorator.expression)) return;
853
+ const [moduleOptions] = moduleDecorator.expression.arguments;
854
+ if (moduleOptions === void 0 || !isObjectLiteralExpression(moduleOptions)) return;
855
+ const providersProperty = moduleOptions.properties.find((property) => isPropertyAssignment(property) && isIdentifier(property.name) && property.name.text === PROVIDERS_PROPERTY_NAME);
856
+ if (providersProperty === void 0 || !isArrayLiteralExpression(providersProperty.initializer)) return;
857
+ const appFilterImportSource = findImportSource(moduleSourceFile, APP_FILTER_LOCAL_NAME);
858
+ if (appFilterImportSource === void 0 || appFilterImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER$1) return;
859
+ const classNames = /* @__PURE__ */ new Set();
860
+ for (const element of providersProperty.initializer.elements) {
861
+ if (isSpreadElement(element)) return;
862
+ if (!isObjectLiteralExpression(element)) continue;
863
+ const provideProperty = element.properties.find((property) => isPropertyAssignment(property) && isIdentifier(property.name) && property.name.text === PROVIDE_PROPERTY_NAME);
864
+ if (provideProperty === void 0 || !isIdentifier(provideProperty.initializer) || provideProperty.initializer.text !== APP_FILTER_LOCAL_NAME) continue;
865
+ const useClassProperty = element.properties.find((property) => isPropertyAssignment(property) && isIdentifier(property.name) && property.name.text === USE_CLASS_PROPERTY_NAME);
866
+ if (useClassProperty === void 0 || !isIdentifier(useClassProperty.initializer)) return;
867
+ classNames.add(useClassProperty.initializer.text);
868
+ }
869
+ return classNames.size === 1 ? [...classNames][0] : void 0;
870
+ };
871
+ //#endregion
872
+ //#region src/analysis/find-global-filter-class-name.ts
873
+ var USE_GLOBAL_FILTERS_METHOD_NAME = "useGlobalFilters";
874
+ var collectUseGlobalFiltersCalls = (node, calls) => {
875
+ if (isCallExpression(node) && isPropertyAccessExpression(node.expression) && node.expression.name.text === USE_GLOBAL_FILTERS_METHOD_NAME) calls.push(node);
876
+ node.forEachChild((child) => {
877
+ collectUseGlobalFiltersCalls(child, calls);
878
+ });
879
+ };
880
+ var findGlobalFilterClassName = (sourceFile) => {
881
+ const calls = [];
882
+ collectUseGlobalFiltersCalls(sourceFile, calls);
883
+ if (calls.length === 0) return;
884
+ const classNames = /* @__PURE__ */ new Set();
885
+ for (const call of calls) for (const argument of call.arguments) {
886
+ if (!isNewExpression(argument) || !isIdentifier(argument.expression)) return;
887
+ classNames.add(argument.expression.text);
888
+ }
889
+ return classNames.size === 1 ? [...classNames][0] : void 0;
890
+ };
891
+ //#endregion
892
+ //#region src/analysis/find-root-module-class-name.ts
893
+ var NEST_FACTORY_LOCAL_NAME = "NestFactory";
894
+ var NEST_FACTORY_CREATE_METHOD_NAME = "create";
895
+ var NEST_CORE_MODULE_SPECIFIER = "@nestjs/core";
896
+ var collectNestFactoryCreateCalls = (node, calls) => {
897
+ if (isCallExpression(node) && isPropertyAccessExpression(node.expression) && isIdentifier(node.expression.expression) && node.expression.expression.text === NEST_FACTORY_LOCAL_NAME && node.expression.name.text === NEST_FACTORY_CREATE_METHOD_NAME) calls.push(node);
898
+ node.forEachChild((child) => {
899
+ collectNestFactoryCreateCalls(child, calls);
900
+ });
901
+ };
902
+ var findRootModuleClassName = (sourceFile) => {
903
+ const nestFactoryImportSource = findImportSource(sourceFile, NEST_FACTORY_LOCAL_NAME);
904
+ if (nestFactoryImportSource === void 0 || nestFactoryImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER) return;
905
+ const calls = [];
906
+ collectNestFactoryCreateCalls(sourceFile, calls);
907
+ if (calls.length !== 1) return;
908
+ const [call] = calls;
909
+ if (call === void 0) return;
910
+ const [moduleArgument] = call.arguments;
911
+ return moduleArgument !== void 0 && isIdentifier(moduleArgument) ? moduleArgument.text : void 0;
912
+ };
913
+ //#endregion
914
+ //#region src/analysis/resolve-catch-method-body.ts
915
+ var RESPONSE_BODY_CALL_NAMES = /* @__PURE__ */ new Set(["json", "send"]);
916
+ var matchResponseBodyArgument = (expression) => {
917
+ if (!isCallExpression(expression) || !isPropertyAccessExpression(expression.expression) || !RESPONSE_BODY_CALL_NAMES.has(expression.expression.name.text) || expression.arguments.length !== 1) return;
918
+ const [argument] = expression.arguments;
919
+ return argument;
920
+ };
921
+ var resolveCatchMethodBody = (catchMethod) => {
922
+ const [exceptionParameter] = catchMethod.parameters;
923
+ if (exceptionParameter === void 0 || !isIdentifier(exceptionParameter.name)) return;
924
+ const body = catchMethod.body;
925
+ if (body === void 0) return;
926
+ const localDeclarations = /* @__PURE__ */ new Map();
927
+ let responseBodyArgument;
928
+ let sawResponseCall = false;
929
+ let sawTrailingReturn = false;
930
+ for (const statement of body.statements) {
931
+ if (sawTrailingReturn) return;
932
+ if (!sawResponseCall && isVariableStatement(statement)) {
933
+ for (const declaration of statement.declarationList.declarations) {
934
+ if (!isIdentifier(declaration.name) || declaration.initializer === void 0) return;
935
+ localDeclarations.set(declaration.name.text, declaration.initializer);
936
+ }
937
+ continue;
938
+ }
939
+ if (!sawResponseCall && isExpressionStatement(statement)) {
940
+ const argument = matchResponseBodyArgument(statement.expression);
941
+ if (argument === void 0) return;
942
+ responseBodyArgument = argument;
943
+ sawResponseCall = true;
944
+ continue;
945
+ }
946
+ if (sawResponseCall && isReturnStatement(statement) && statement.expression === void 0) {
947
+ sawTrailingReturn = true;
948
+ continue;
949
+ }
950
+ return;
951
+ }
952
+ if (!sawResponseCall || responseBodyArgument === void 0) return;
953
+ return {
954
+ exceptionParameterName: exceptionParameter.name.text,
955
+ localDeclarations,
956
+ responseBodyArgument
957
+ };
958
+ };
959
+ //#endregion
960
+ //#region src/analysis/synthesize-error-body-type.ts
961
+ var EXCEPTION_MESSAGE_MEMBER_NAME = "message";
962
+ var EXCEPTION_STATUS_METHOD_NAME = "getStatus";
963
+ var resolvesToExceptionParameter = (expression, exceptionParameterName, localDeclarations, visited) => {
964
+ if (!isIdentifier(expression)) return false;
965
+ if (expression.text === exceptionParameterName) return true;
966
+ if (visited.has(expression.text)) return false;
967
+ visited.add(expression.text);
968
+ const aliasedExpression = localDeclarations.get(expression.text);
969
+ return aliasedExpression !== void 0 ? resolvesToExceptionParameter(aliasedExpression, exceptionParameterName, localDeclarations, visited) : false;
970
+ };
971
+ var synthesizeErrorValueType = (expression, exceptionParameterName, localDeclarations) => {
972
+ if (isPropertyAccessExpression(expression) && expression.name.text === EXCEPTION_MESSAGE_MEMBER_NAME && resolvesToExceptionParameter(expression.expression, exceptionParameterName, localDeclarations, /* @__PURE__ */ new Set())) return "string";
973
+ if (isCallExpression(expression) && expression.arguments.length === 0 && isPropertyAccessExpression(expression.expression) && expression.expression.name.text === EXCEPTION_STATUS_METHOD_NAME && resolvesToExceptionParameter(expression.expression.expression, exceptionParameterName, localDeclarations, /* @__PURE__ */ new Set())) return "number";
974
+ if (isObjectLiteralExpression(expression)) {
975
+ const memberTypes = [];
976
+ for (const property of expression.properties) {
977
+ if (!isPropertyAssignment(property) || !(isIdentifier(property.name) || isStringLiteral(property.name))) return;
978
+ const valueType = synthesizeErrorValueType(property.initializer, exceptionParameterName, localDeclarations);
979
+ if (valueType === void 0) return;
980
+ memberTypes.push(`${property.name.text}: ${valueType}`);
981
+ }
982
+ return `{ ${memberTypes.join("; ")} }`;
983
+ }
984
+ if (isStringLiteral(expression)) return "string";
985
+ if (isNumericLiteral(expression)) return "number";
986
+ if (isTrueLiteral(expression) || isFalseLiteral(expression)) return "boolean";
987
+ if (isNullLiteral(expression)) return "null";
988
+ if (isIdentifier(expression)) {
989
+ const aliasedExpression = localDeclarations.get(expression.text);
990
+ return aliasedExpression !== void 0 ? synthesizeErrorValueType(aliasedExpression, exceptionParameterName, localDeclarations) : void 0;
991
+ }
992
+ };
993
+ var synthesizeErrorBodyType = (objectLiteral, exceptionParameterName, localDeclarations) => synthesizeErrorValueType(objectLiteral, exceptionParameterName, localDeclarations);
994
+ //#endregion
995
+ //#region src/analysis/detect-error-response-shape.ts
996
+ var CATCH_DECORATOR_NAME = "Catch";
997
+ var CATCH_METHOD_NAME = "catch";
998
+ var findCatchMethod = (members) => members.find((member) => isMethodDeclaration(member) && isIdentifier(member.name) && member.name.text === CATCH_METHOD_NAME);
999
+ var resolveViaGlobalFilters = (bootstrapSourceFile, bootstrapFilePath) => {
1000
+ const filterClassName = findGlobalFilterClassName(bootstrapSourceFile);
1001
+ return filterClassName === void 0 ? void 0 : resolveClassDeclaration(filterClassName, bootstrapSourceFile, bootstrapFilePath);
1002
+ };
1003
+ var resolveViaAppFilterProvider = (bootstrapSourceFile, bootstrapFilePath) => {
1004
+ const rootModuleClassName = findRootModuleClassName(bootstrapSourceFile);
1005
+ if (rootModuleClassName === void 0) return;
1006
+ const resolvedModule = resolveClassDeclaration(rootModuleClassName, bootstrapSourceFile, bootstrapFilePath);
1007
+ if (resolvedModule === void 0) return;
1008
+ const filterClassName = findAppFilterProviderClassName(resolvedModule.classDeclaration, resolvedModule.sourceFile);
1009
+ return filterClassName === void 0 ? void 0 : resolveClassDeclaration(filterClassName, resolvedModule.sourceFile, resolvedModule.filePath);
1010
+ };
1011
+ var isSameDeclaration = (a, b) => a.filePath === b.filePath && a.classDeclaration.name?.text === b.classDeclaration.name?.text;
1012
+ var reconcileResolvedFilter = (viaGlobalFilters, viaAppFilterProvider) => {
1013
+ if (viaGlobalFilters !== void 0 && viaAppFilterProvider !== void 0) return isSameDeclaration(viaGlobalFilters, viaAppFilterProvider) ? viaGlobalFilters : void 0;
1014
+ return viaGlobalFilters ?? viaAppFilterProvider;
1015
+ };
1016
+ var detectErrorResponseShape = (bootstrapFilePath) => {
1017
+ const bootstrapSourceFile = parseSourceFile(bootstrapFilePath);
1018
+ const resolved = reconcileResolvedFilter(resolveViaGlobalFilters(bootstrapSourceFile, bootstrapFilePath), resolveViaAppFilterProvider(bootstrapSourceFile, bootstrapFilePath));
1019
+ if (resolved === void 0 || findDecorator(resolved.classDeclaration, CATCH_DECORATOR_NAME) === void 0) return;
1020
+ const catchMethod = findCatchMethod(resolved.classDeclaration.members);
1021
+ if (catchMethod?.body === void 0) return;
1022
+ const bodyResolution = resolveCatchMethodBody(catchMethod);
1023
+ if (bodyResolution === void 0 || !isObjectLiteralExpression(bodyResolution.responseBodyArgument)) return;
1024
+ const errorBodyTypeSource = synthesizeErrorBodyType(bodyResolution.responseBodyArgument, bodyResolution.exceptionParameterName, bodyResolution.localDeclarations);
1025
+ return errorBodyTypeSource === void 0 ? void 0 : { errorBodyTypeSource };
1026
+ };
1027
+ //#endregion
1028
+ //#region src/analysis/find-global-interceptor-class-names.ts
1029
+ var USE_GLOBAL_INTERCEPTORS_METHOD_NAME = "useGlobalInterceptors";
1030
+ var collectUseGlobalInterceptorsCalls = (node, calls) => {
1031
+ if (isCallExpression(node) && isPropertyAccessExpression(node.expression) && node.expression.name.text === USE_GLOBAL_INTERCEPTORS_METHOD_NAME) calls.push(node);
1032
+ node.forEachChild((child) => {
1033
+ collectUseGlobalInterceptorsCalls(child, calls);
1034
+ });
1035
+ };
1036
+ /**
1037
+ * Returned in registration order: `useGlobalInterceptors` concatenates onto a
1038
+ * single global list, so a later call (or a later argument within one call)
1039
+ * always registers an interceptor that wraps closer to the raw handler result.
1040
+ */
1041
+ var findGlobalInterceptorClassNames = (sourceFile) => {
1042
+ const calls = [];
1043
+ collectUseGlobalInterceptorsCalls(sourceFile, calls);
1044
+ if (calls.length === 0) return;
1045
+ const classNames = [];
1046
+ for (const call of calls) for (const argument of call.arguments) {
1047
+ if (!isNewExpression(argument) || !isIdentifier(argument.expression)) return;
1048
+ classNames.push(argument.expression.text);
1049
+ }
1050
+ return classNames.length === 0 ? void 0 : classNames;
1051
+ };
1052
+ //#endregion
1053
+ //#region src/analysis/synthesize-generic-object-type.ts
1054
+ var synthesizeExpressionType = (expression, parameterName, substitution, state) => {
1055
+ if (isIdentifier(expression) && expression.text === parameterName) {
1056
+ state.substitutionCount += 1;
1057
+ return substitution;
1058
+ }
1059
+ if (isObjectLiteralExpression(expression)) {
1060
+ const memberTypes = [];
1061
+ for (const property of expression.properties) {
1062
+ if (!isPropertyAssignment(property) || !(isIdentifier(property.name) || isStringLiteral(property.name))) return;
1063
+ const valueType = synthesizeExpressionType(property.initializer, parameterName, substitution, state);
1064
+ if (valueType === void 0) return;
1065
+ memberTypes.push(`${property.name.text}: ${valueType}`);
1066
+ }
1067
+ return `{ ${memberTypes.join("; ")} }`;
1068
+ }
1069
+ if (isStringLiteral(expression)) return "string";
1070
+ if (isNumericLiteral(expression)) return "number";
1071
+ if (isTrueLiteral(expression) || isFalseLiteral(expression)) return "boolean";
1072
+ if (isNullLiteral(expression)) return "null";
1073
+ };
1074
+ var synthesizeGenericObjectType = (objectLiteral, parameterName, substitution) => {
1075
+ const state = { substitutionCount: 0 };
1076
+ const objectType = synthesizeExpressionType(objectLiteral, parameterName, substitution, state);
1077
+ return objectType !== void 0 && state.substitutionCount === 1 ? objectType : void 0;
1078
+ };
1079
+ //#endregion
1080
+ //#region src/analysis/detect-response-wrapper.ts
1081
+ var INTERCEPT_METHOD_NAME = "intercept";
1082
+ var PIPE_MEMBER_NAME = "pipe";
1083
+ var MAP_OPERATOR_NAME = "map";
1084
+ var RXJS_MODULE_SPECIFIER = "rxjs";
1085
+ var WRAPPED_RESULT_SUBSTITUTION = "Awaited<Result>";
1086
+ var unwrapParenthesizedExpression = (expression) => {
1087
+ let unwrapped = expression;
1088
+ while (isParenthesizedExpression(unwrapped)) unwrapped = unwrapped.expression;
1089
+ return unwrapped;
1090
+ };
1091
+ var resolveSoleReturnExpression = (body) => {
1092
+ if (!isBlock(body)) return unwrapParenthesizedExpression(body);
1093
+ const localDeclarations = /* @__PURE__ */ new Map();
1094
+ let returnExpression;
1095
+ let sawReturn = false;
1096
+ for (const statement of body.statements) {
1097
+ if (sawReturn) return;
1098
+ if (isVariableStatement(statement)) {
1099
+ for (const declaration of statement.declarationList.declarations) {
1100
+ if (!isIdentifier(declaration.name) || declaration.initializer === void 0) return;
1101
+ localDeclarations.set(declaration.name.text, declaration.initializer);
1102
+ }
1103
+ continue;
1104
+ }
1105
+ if (isReturnStatement(statement)) {
1106
+ sawReturn = true;
1107
+ returnExpression = statement.expression;
1108
+ continue;
1109
+ }
1110
+ return;
1111
+ }
1112
+ if (returnExpression === void 0) return;
1113
+ return isIdentifier(returnExpression) ? localDeclarations.get(returnExpression.text) : returnExpression;
1114
+ };
1115
+ var matchPipedMapCallback = (expression, interceptorSourceFile) => {
1116
+ if (!isCallExpression(expression) || !isPropertyAccessExpression(expression.expression) || expression.expression.name.text !== PIPE_MEMBER_NAME || expression.arguments.length !== 1) return;
1117
+ const [operator] = expression.arguments;
1118
+ if (operator === void 0 || !isCallExpression(operator) || !isIdentifier(operator.expression) || operator.expression.text !== MAP_OPERATOR_NAME || operator.arguments.length !== 1) return;
1119
+ const mapImportSource = findImportSource(interceptorSourceFile, operator.expression.text);
1120
+ if (mapImportSource === void 0 || mapImportSource.moduleSpecifierText !== RXJS_MODULE_SPECIFIER) return;
1121
+ const [callback] = operator.arguments;
1122
+ return callback !== void 0 && (isArrowFunction(callback) || isFunctionExpression(callback)) ? callback : void 0;
1123
+ };
1124
+ var findInterceptMethod = (members) => members.find((member) => isMethodDeclaration(member) && isIdentifier(member.name) && member.name.text === INTERCEPT_METHOD_NAME);
1125
+ var synthesizeInterceptorWrapperType = (interceptorClassName, bootstrapSourceFile, bootstrapFilePath, innerTypeSource) => {
1126
+ const resolved = resolveClassDeclaration(interceptorClassName, bootstrapSourceFile, bootstrapFilePath);
1127
+ if (resolved === void 0) return;
1128
+ const interceptMethod = findInterceptMethod(resolved.classDeclaration.members);
1129
+ if (interceptMethod?.body === void 0) return;
1130
+ const returnExpression = resolveSoleReturnExpression(interceptMethod.body);
1131
+ if (returnExpression === void 0) return;
1132
+ const mapCallback = matchPipedMapCallback(returnExpression, resolved.sourceFile);
1133
+ if (mapCallback === void 0 || mapCallback.parameters.length !== 1) return;
1134
+ const [callbackParameter] = mapCallback.parameters;
1135
+ if (callbackParameter === void 0 || !isIdentifier(callbackParameter.name)) return;
1136
+ const callbackReturnExpression = resolveSoleReturnExpression(mapCallback.body);
1137
+ if (callbackReturnExpression === void 0 || !isObjectLiteralExpression(callbackReturnExpression)) return;
1138
+ return synthesizeGenericObjectType(callbackReturnExpression, callbackParameter.name.text, innerTypeSource);
1139
+ };
1140
+ /**
1141
+ * Interceptors registered first wrap those registered after them, so the
1142
+ * composed type is built from the last-registered interceptor (closest to the
1143
+ * raw handler result) outward to the first-registered one.
1144
+ */
1145
+ var detectResponseWrapper = (bootstrapFilePath) => {
1146
+ const bootstrapSourceFile = parseSourceFile(bootstrapFilePath);
1147
+ const interceptorClassNames = findGlobalInterceptorClassNames(bootstrapSourceFile);
1148
+ if (interceptorClassNames === void 0) return;
1149
+ let composedTypeSource = WRAPPED_RESULT_SUBSTITUTION;
1150
+ for (const interceptorClassName of [...interceptorClassNames].reverse()) {
1151
+ const wrapperTypeSource = synthesizeInterceptorWrapperType(interceptorClassName, bootstrapSourceFile, bootstrapFilePath, composedTypeSource);
1152
+ if (wrapperTypeSource === void 0) return;
1153
+ composedTypeSource = wrapperTypeSource;
1154
+ }
1155
+ return { wrappedResultTypeSource: composedTypeSource };
1156
+ };
1157
+ //#endregion
839
1158
  //#region src/declarations/generate-controller-declaration.ts
840
1159
  var REMOTE_RESULT_HELPERS = {
841
1160
  json: "RemoteResult",
842
1161
  observable: "RemoteObservableResult",
843
1162
  stream: "RemoteStreamResult"
844
1163
  };
1164
+ var WRAPPED_RESULT_HELPER = "__NestBridgeWrapped";
845
1165
  var toPosixPath = (filePath) => filePath.replace(/\\/g, "/");
846
1166
  var importSpecifierFor = (sourceFile, outputFilePath) => {
847
1167
  if (!sourceFile.startsWith(".") && !/^[A-Za-z]:[\\/]/.test(sourceFile) && !sourceFile.startsWith("/")) return sourceFile;
@@ -852,28 +1172,32 @@ var stripExtension = (filePath) => {
852
1172
  const extension = extname(filePath);
853
1173
  return extension.length > 0 ? filePath.slice(0, -extension.length) : filePath;
854
1174
  };
855
- var generateControllerDeclaration = (controller, outputFilePath) => {
1175
+ var generateControllerDeclaration = (controller, outputFilePath, responseWrapper) => {
856
1176
  const sourceFileSpecifier = importSpecifierFor(controller.sourceFile, outputFilePath);
857
1177
  const importSpecifier = stripExtension(sourceFileSpecifier);
858
1178
  const serverAlias = `__Server${controller.name}`;
1179
+ const helperNameFor = (method) => responseWrapper !== void 0 && (method.responseKind ?? "json") === "json" ? WRAPPED_RESULT_HELPER : REMOTE_RESULT_HELPERS[method.responseKind ?? "json"];
859
1180
  const classBody = [
860
1181
  " constructor();",
861
1182
  "",
862
1183
  ...controller.methods.map((method) => {
863
- const helperName = REMOTE_RESULT_HELPERS[method.responseKind ?? "json"];
1184
+ const helperName = helperNameFor(method);
864
1185
  return ` ${method.name}(...args: Parameters<${serverAlias}['${method.name}']>): ${helperName}<${serverAlias}['${method.name}']>;`;
865
1186
  })
866
1187
  ].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();
1188
+ const rawHelperNames = controller.methods.map((method) => helperNameFor(method));
1189
+ const hasWrappedMethod = rawHelperNames.includes(WRAPPED_RESULT_HELPER);
1190
+ const helperImports = rawHelperNames.length === 0 ? ["RemoteResult"] : Array.from(new Set(rawHelperNames.filter((name) => name !== WRAPPED_RESULT_HELPER))).sort();
1191
+ const wrappedResultTypeAliasLines = responseWrapper !== void 0 && hasWrappedMethod ? [`type ${WRAPPED_RESULT_HELPER}<T> = T extends (...args: never[]) => infer Result ? Promise<${responseWrapper.wrappedResultTypeSource}> : never;`, ""] : [];
869
1192
  return [
870
1193
  `import type { ${controller.name} as ${serverAlias} } from '${importSpecifier}';`,
871
- `import type { ${helperImports.join(", ")} } from 'nestbridge';`,
1194
+ ...helperImports.length > 0 ? [`import type { ${helperImports.join(", ")} } from 'nestbridge';`] : [],
872
1195
  "",
873
1196
  "/**",
874
1197
  " * Generated by NestBridge — client-facing methods only.",
875
1198
  ` * @see {@link ${sourceFileSpecifier}} for the real controller implementation.`,
876
1199
  " */",
1200
+ ...wrappedResultTypeAliasLines,
877
1201
  `export declare class ${controller.name} {`,
878
1202
  classBody,
879
1203
  "}",
@@ -881,6 +1205,16 @@ var generateControllerDeclaration = (controller, outputFilePath) => {
881
1205
  ].join("\n");
882
1206
  };
883
1207
  //#endregion
1208
+ //#region src/declarations/generate-error-body-declaration.ts
1209
+ var ERROR_BODY_TYPE_NAME = "NestBridgeErrorBody";
1210
+ var generateErrorBodyDeclaration = (errorBodyTypeSource) => [
1211
+ "/**",
1212
+ " * Generated by NestBridge — inferred shape of the global exception filter's response body.",
1213
+ " */",
1214
+ `export type ${ERROR_BODY_TYPE_NAME} = ${errorBodyTypeSource};`,
1215
+ ""
1216
+ ].join("\n");
1217
+ //#endregion
884
1218
  //#region src/diagnostics/format-diagnostic.ts
885
1219
  var formatDiagnostic = (diagnostic) => {
886
1220
  const subject = diagnostic.memberName.length > 0 ? `${diagnostic.controllerName}.${diagnostic.memberName}` : diagnostic.controllerName;
@@ -908,8 +1242,8 @@ var NestBridgeDiagnosticError = class extends Error {
908
1242
  };
909
1243
  //#endregion
910
1244
  //#region src/version.ts
911
- var VERSION = "2.0.4";
1245
+ var VERSION = "2.1.1";
912
1246
  //#endregion
913
- export { NestBridgeDiagnosticError, VERSION, analyzeControllers, analyzeResolvers, formatDiagnostic, generateControllerDeclaration };
1247
+ export { NestBridgeDiagnosticError, VERSION, analyzeControllers, analyzeResolvers, detectErrorResponseShape, detectResponseWrapper, formatDiagnostic, generateControllerDeclaration, generateErrorBodyDeclaration };
914
1248
 
915
1249
  //# sourceMappingURL=nestbridge.core.js.map
@@ -1 +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,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C1B,WAAW,QAAQ,KAAK,WAAW,sBAAsB,OAAO,gBAAgB,OAAO,CACzF;CACA,MAAM,gBAAgB,MAAM,KAC1B,gBAAgB,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"}
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/analysis/find-app-filter-provider-class-name.ts","../src/analysis/find-global-filter-class-name.ts","../src/analysis/find-root-module-class-name.ts","../src/analysis/resolve-catch-method-body.ts","../src/analysis/synthesize-error-body-type.ts","../src/analysis/detect-error-response-shape.ts","../src/analysis/find-global-interceptor-class-names.ts","../src/analysis/synthesize-generic-object-type.ts","../src/analysis/detect-response-wrapper.ts","../src/declarations/generate-controller-declaration.ts","../src/declarations/generate-error-body-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 sharedApi.updateSnapshot({ closeFiles: [filePath] });\n const snapshot = sharedApi.updateSnapshot({\n openFiles: [filePath],\n fileChanges: { changed: [filePath] },\n });\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 { ControllerAnalysisResult, 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 = (filePaths: readonly string[]): ControllerAnalysisResult => {\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\nexport const findImportSource = (\n sourceFile: SourceFile,\n localName: string,\n): 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 { ResolverAnalysisResult, 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 = (filePaths: readonly string[]): ResolverAnalysisResult => {\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 type { ClassDeclaration, PropertyAssignment, SourceFile } from 'typescript/unstable/ast';\nimport {\n isArrayLiteralExpression,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isSpreadElement,\n} from 'typescript/unstable/ast';\nimport { findDecorator } from './decorator-inspection';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst MODULE_DECORATOR_NAME = 'Module';\nconst PROVIDERS_PROPERTY_NAME = 'providers';\nconst PROVIDE_PROPERTY_NAME = 'provide';\nconst USE_CLASS_PROPERTY_NAME = 'useClass';\nconst APP_FILTER_LOCAL_NAME = 'APP_FILTER';\nconst NEST_CORE_MODULE_SPECIFIER = '@nestjs/core';\n\nexport const findAppFilterProviderClassName = (\n moduleClassDeclaration: ClassDeclaration,\n moduleSourceFile: SourceFile,\n) => {\n const moduleDecorator = findDecorator(moduleClassDeclaration, MODULE_DECORATOR_NAME);\n\n if (moduleDecorator === undefined || !isCallExpression(moduleDecorator.expression)) {\n return undefined;\n }\n\n const [moduleOptions] = moduleDecorator.expression.arguments;\n\n if (moduleOptions === undefined || !isObjectLiteralExpression(moduleOptions)) {\n return undefined;\n }\n\n const providersProperty = moduleOptions.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === PROVIDERS_PROPERTY_NAME,\n );\n\n if (providersProperty === undefined || !isArrayLiteralExpression(providersProperty.initializer)) {\n return undefined;\n }\n\n const appFilterImportSource = findImportSource(moduleSourceFile, APP_FILTER_LOCAL_NAME);\n\n if (\n appFilterImportSource === undefined ||\n appFilterImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER\n ) {\n return undefined;\n }\n\n const classNames = new Set<string>();\n\n for (const element of providersProperty.initializer.elements) {\n if (isSpreadElement(element)) {\n return undefined;\n }\n\n if (!isObjectLiteralExpression(element)) {\n continue;\n }\n\n const provideProperty = element.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === PROVIDE_PROPERTY_NAME,\n );\n\n if (\n provideProperty === undefined ||\n !isIdentifier(provideProperty.initializer) ||\n provideProperty.initializer.text !== APP_FILTER_LOCAL_NAME\n ) {\n continue;\n }\n\n const useClassProperty = element.properties.find(\n (property): property is PropertyAssignment =>\n isPropertyAssignment(property) &&\n isIdentifier(property.name) &&\n property.name.text === USE_CLASS_PROPERTY_NAME,\n );\n\n if (useClassProperty === undefined || !isIdentifier(useClassProperty.initializer)) {\n return undefined;\n }\n\n classNames.add(useClassProperty.initializer.text);\n }\n\n return classNames.size === 1 ? [...classNames][0] : undefined;\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isNewExpression,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\n\nconst USE_GLOBAL_FILTERS_METHOD_NAME = 'useGlobalFilters';\n\nconst collectUseGlobalFiltersCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === USE_GLOBAL_FILTERS_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectUseGlobalFiltersCalls(child, calls);\n return undefined;\n });\n};\n\nexport const findGlobalFilterClassName = (sourceFile: SourceFile) => {\n const calls: CallExpression[] = [];\n collectUseGlobalFiltersCalls(sourceFile, calls);\n\n if (calls.length === 0) {\n return undefined;\n }\n\n const classNames = new Set<string>();\n\n for (const call of calls) {\n for (const argument of call.arguments) {\n if (!isNewExpression(argument) || !isIdentifier(argument.expression)) {\n return undefined;\n }\n\n classNames.add(argument.expression.text);\n }\n }\n\n return classNames.size === 1 ? [...classNames][0] : undefined;\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\nimport { findImportSource } from './resolve-type-declaration';\n\nconst NEST_FACTORY_LOCAL_NAME = 'NestFactory';\nconst NEST_FACTORY_CREATE_METHOD_NAME = 'create';\nconst NEST_CORE_MODULE_SPECIFIER = '@nestjs/core';\n\nconst collectNestFactoryCreateCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n isIdentifier(node.expression.expression) &&\n node.expression.expression.text === NEST_FACTORY_LOCAL_NAME &&\n node.expression.name.text === NEST_FACTORY_CREATE_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectNestFactoryCreateCalls(child, calls);\n return undefined;\n });\n};\n\nexport const findRootModuleClassName = (sourceFile: SourceFile) => {\n const nestFactoryImportSource = findImportSource(sourceFile, NEST_FACTORY_LOCAL_NAME);\n\n if (\n nestFactoryImportSource === undefined ||\n nestFactoryImportSource.moduleSpecifierText !== NEST_CORE_MODULE_SPECIFIER\n ) {\n return undefined;\n }\n\n const calls: CallExpression[] = [];\n collectNestFactoryCreateCalls(sourceFile, calls);\n\n if (calls.length !== 1) {\n return undefined;\n }\n\n const [call] = calls;\n\n if (call === undefined) {\n return undefined;\n }\n\n const [moduleArgument] = call.arguments;\n\n return moduleArgument !== undefined && isIdentifier(moduleArgument)\n ? moduleArgument.text\n : undefined;\n};\n","import type { Expression, MethodDeclaration } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isExpressionStatement,\n isIdentifier,\n isPropertyAccessExpression,\n isReturnStatement,\n isVariableStatement,\n} from 'typescript/unstable/ast';\n\nexport interface CatchMethodBodyResolution {\n exceptionParameterName: string;\n localDeclarations: Map<string, Expression>;\n responseBodyArgument: Expression;\n}\n\nconst RESPONSE_BODY_CALL_NAMES = new Set(['json', 'send']);\n\nconst matchResponseBodyArgument = (expression: Expression) => {\n if (\n !isCallExpression(expression) ||\n !isPropertyAccessExpression(expression.expression) ||\n !RESPONSE_BODY_CALL_NAMES.has(expression.expression.name.text) ||\n expression.arguments.length !== 1\n ) {\n return undefined;\n }\n\n const [argument] = expression.arguments;\n return argument;\n};\n\nexport const resolveCatchMethodBody = (\n catchMethod: MethodDeclaration,\n): CatchMethodBodyResolution | undefined => {\n const [exceptionParameter] = catchMethod.parameters;\n\n if (exceptionParameter === undefined || !isIdentifier(exceptionParameter.name)) {\n return undefined;\n }\n\n const body = catchMethod.body;\n\n if (body === undefined) {\n return undefined;\n }\n\n const localDeclarations = new Map<string, Expression>();\n let responseBodyArgument: Expression | undefined;\n let sawResponseCall = false;\n let sawTrailingReturn = false;\n\n for (const statement of body.statements) {\n if (sawTrailingReturn) {\n return undefined;\n }\n\n if (!sawResponseCall && isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (!isIdentifier(declaration.name) || declaration.initializer === undefined) {\n return undefined;\n }\n\n localDeclarations.set(declaration.name.text, declaration.initializer);\n }\n\n continue;\n }\n\n if (!sawResponseCall && isExpressionStatement(statement)) {\n const argument = matchResponseBodyArgument(statement.expression);\n\n if (argument === undefined) {\n return undefined;\n }\n\n responseBodyArgument = argument;\n sawResponseCall = true;\n continue;\n }\n\n if (sawResponseCall && isReturnStatement(statement) && statement.expression === undefined) {\n sawTrailingReturn = true;\n continue;\n }\n\n return undefined;\n }\n\n if (!sawResponseCall || responseBodyArgument === undefined) {\n return undefined;\n }\n\n return {\n exceptionParameterName: exceptionParameter.name.text,\n localDeclarations,\n responseBodyArgument,\n };\n};\n","import type { Expression, ObjectLiteralExpression } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isFalseLiteral,\n isIdentifier,\n isNullLiteral,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isStringLiteral,\n isTrueLiteral,\n} from 'typescript/unstable/ast';\n\nconst EXCEPTION_MESSAGE_MEMBER_NAME = 'message';\nconst EXCEPTION_STATUS_METHOD_NAME = 'getStatus';\n\nconst resolvesToExceptionParameter = (\n expression: Expression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n visited: Set<string>,\n): boolean => {\n if (!isIdentifier(expression)) {\n return false;\n }\n\n if (expression.text === exceptionParameterName) {\n return true;\n }\n\n if (visited.has(expression.text)) {\n return false;\n }\n\n visited.add(expression.text);\n\n const aliasedExpression = localDeclarations.get(expression.text);\n\n return aliasedExpression !== undefined\n ? resolvesToExceptionParameter(\n aliasedExpression,\n exceptionParameterName,\n localDeclarations,\n visited,\n )\n : false;\n};\n\nconst synthesizeErrorValueType = (\n expression: Expression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n): string | undefined => {\n if (\n isPropertyAccessExpression(expression) &&\n expression.name.text === EXCEPTION_MESSAGE_MEMBER_NAME &&\n resolvesToExceptionParameter(\n expression.expression,\n exceptionParameterName,\n localDeclarations,\n new Set(),\n )\n ) {\n return 'string';\n }\n\n if (\n isCallExpression(expression) &&\n expression.arguments.length === 0 &&\n isPropertyAccessExpression(expression.expression) &&\n expression.expression.name.text === EXCEPTION_STATUS_METHOD_NAME &&\n resolvesToExceptionParameter(\n expression.expression.expression,\n exceptionParameterName,\n localDeclarations,\n new Set(),\n )\n ) {\n return 'number';\n }\n\n if (isObjectLiteralExpression(expression)) {\n const memberTypes: string[] = [];\n\n for (const property of expression.properties) {\n if (\n !isPropertyAssignment(property) ||\n !(isIdentifier(property.name) || isStringLiteral(property.name))\n ) {\n return undefined;\n }\n\n const valueType = synthesizeErrorValueType(\n property.initializer,\n exceptionParameterName,\n localDeclarations,\n );\n\n if (valueType === undefined) {\n return undefined;\n }\n\n memberTypes.push(`${property.name.text}: ${valueType}`);\n }\n\n return `{ ${memberTypes.join('; ')} }`;\n }\n\n if (isStringLiteral(expression)) {\n return 'string';\n }\n\n if (isNumericLiteral(expression)) {\n return 'number';\n }\n\n if (isTrueLiteral(expression) || isFalseLiteral(expression)) {\n return 'boolean';\n }\n\n if (isNullLiteral(expression)) {\n return 'null';\n }\n\n if (isIdentifier(expression)) {\n const aliasedExpression = localDeclarations.get(expression.text);\n\n return aliasedExpression !== undefined\n ? synthesizeErrorValueType(aliasedExpression, exceptionParameterName, localDeclarations)\n : undefined;\n }\n\n return undefined;\n};\n\nexport const synthesizeErrorBodyType = (\n objectLiteral: ObjectLiteralExpression,\n exceptionParameterName: string,\n localDeclarations: ReadonlyMap<string, Expression>,\n) => synthesizeErrorValueType(objectLiteral, exceptionParameterName, localDeclarations);\n","import type { ClassDeclaration, MethodDeclaration, SourceFile } from 'typescript/unstable/ast';\nimport {\n isIdentifier,\n isMethodDeclaration,\n isObjectLiteralExpression,\n} from 'typescript/unstable/ast';\nimport type { ErrorResponseShapeDetection } from '../models/error-response-shape-detection';\nimport { findDecorator } from './decorator-inspection';\nimport { findAppFilterProviderClassName } from './find-app-filter-provider-class-name';\nimport { findGlobalFilterClassName } from './find-global-filter-class-name';\nimport { findRootModuleClassName } from './find-root-module-class-name';\nimport { parseSourceFile } from './parse-source-file';\nimport { resolveCatchMethodBody } from './resolve-catch-method-body';\nimport { type ResolvedTypeDeclaration, resolveClassDeclaration } from './resolve-type-declaration';\nimport { synthesizeErrorBodyType } from './synthesize-error-body-type';\n\nconst CATCH_DECORATOR_NAME = 'Catch';\nconst CATCH_METHOD_NAME = 'catch';\n\nconst findCatchMethod = (members: ClassDeclaration['members']) =>\n members.find(\n (member): member is MethodDeclaration =>\n isMethodDeclaration(member) &&\n isIdentifier(member.name) &&\n member.name.text === CATCH_METHOD_NAME,\n );\n\nconst resolveViaGlobalFilters = (bootstrapSourceFile: SourceFile, bootstrapFilePath: string) => {\n const filterClassName = findGlobalFilterClassName(bootstrapSourceFile);\n\n return filterClassName === undefined\n ? undefined\n : resolveClassDeclaration(filterClassName, bootstrapSourceFile, bootstrapFilePath);\n};\n\nconst resolveViaAppFilterProvider = (\n bootstrapSourceFile: SourceFile,\n bootstrapFilePath: string,\n) => {\n const rootModuleClassName = findRootModuleClassName(bootstrapSourceFile);\n\n if (rootModuleClassName === undefined) {\n return undefined;\n }\n\n const resolvedModule = resolveClassDeclaration(\n rootModuleClassName,\n bootstrapSourceFile,\n bootstrapFilePath,\n );\n\n if (resolvedModule === undefined) {\n return undefined;\n }\n\n const filterClassName = findAppFilterProviderClassName(\n resolvedModule.classDeclaration,\n resolvedModule.sourceFile,\n );\n\n return filterClassName === undefined\n ? undefined\n : resolveClassDeclaration(filterClassName, resolvedModule.sourceFile, resolvedModule.filePath);\n};\n\nconst isSameDeclaration = (a: ResolvedTypeDeclaration, b: ResolvedTypeDeclaration) =>\n a.filePath === b.filePath && a.classDeclaration.name?.text === b.classDeclaration.name?.text;\n\nconst reconcileResolvedFilter = (\n viaGlobalFilters: ResolvedTypeDeclaration | undefined,\n viaAppFilterProvider: ResolvedTypeDeclaration | undefined,\n) => {\n if (viaGlobalFilters !== undefined && viaAppFilterProvider !== undefined) {\n return isSameDeclaration(viaGlobalFilters, viaAppFilterProvider) ? viaGlobalFilters : undefined;\n }\n\n return viaGlobalFilters ?? viaAppFilterProvider;\n};\n\nexport const detectErrorResponseShape = (\n bootstrapFilePath: string,\n): ErrorResponseShapeDetection | undefined => {\n const bootstrapSourceFile = parseSourceFile(bootstrapFilePath);\n\n const resolved = reconcileResolvedFilter(\n resolveViaGlobalFilters(bootstrapSourceFile, bootstrapFilePath),\n resolveViaAppFilterProvider(bootstrapSourceFile, bootstrapFilePath),\n );\n\n if (\n resolved === undefined ||\n findDecorator(resolved.classDeclaration, CATCH_DECORATOR_NAME) === undefined\n ) {\n return undefined;\n }\n\n const catchMethod = findCatchMethod(resolved.classDeclaration.members);\n\n if (catchMethod?.body === undefined) {\n return undefined;\n }\n\n const bodyResolution = resolveCatchMethodBody(catchMethod);\n\n if (\n bodyResolution === undefined ||\n !isObjectLiteralExpression(bodyResolution.responseBodyArgument)\n ) {\n return undefined;\n }\n\n const errorBodyTypeSource = synthesizeErrorBodyType(\n bodyResolution.responseBodyArgument,\n bodyResolution.exceptionParameterName,\n bodyResolution.localDeclarations,\n );\n\n return errorBodyTypeSource === undefined ? undefined : { errorBodyTypeSource };\n};\n","import type { CallExpression, Node, SourceFile } from 'typescript/unstable/ast';\nimport {\n isCallExpression,\n isIdentifier,\n isNewExpression,\n isPropertyAccessExpression,\n} from 'typescript/unstable/ast';\n\nconst USE_GLOBAL_INTERCEPTORS_METHOD_NAME = 'useGlobalInterceptors';\n\nconst collectUseGlobalInterceptorsCalls = (node: Node, calls: CallExpression[]) => {\n if (\n isCallExpression(node) &&\n isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === USE_GLOBAL_INTERCEPTORS_METHOD_NAME\n ) {\n calls.push(node);\n }\n\n node.forEachChild((child) => {\n collectUseGlobalInterceptorsCalls(child, calls);\n return undefined;\n });\n};\n\n/**\n * Returned in registration order: `useGlobalInterceptors` concatenates onto a\n * single global list, so a later call (or a later argument within one call)\n * always registers an interceptor that wraps closer to the raw handler result.\n */\nexport const findGlobalInterceptorClassNames = (sourceFile: SourceFile) => {\n const calls: CallExpression[] = [];\n collectUseGlobalInterceptorsCalls(sourceFile, calls);\n\n if (calls.length === 0) {\n return undefined;\n }\n\n const classNames: string[] = [];\n\n for (const call of calls) {\n for (const argument of call.arguments) {\n if (!isNewExpression(argument) || !isIdentifier(argument.expression)) {\n return undefined;\n }\n\n classNames.push(argument.expression.text);\n }\n }\n\n return classNames.length === 0 ? undefined : classNames;\n};\n","import type { Expression, ObjectLiteralExpression } from 'typescript/unstable/ast';\nimport {\n isFalseLiteral,\n isIdentifier,\n isNullLiteral,\n isNumericLiteral,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteral,\n isTrueLiteral,\n} from 'typescript/unstable/ast';\n\ninterface SynthesisState {\n substitutionCount: number;\n}\n\nconst synthesizeExpressionType = (\n expression: Expression,\n parameterName: string,\n substitution: string,\n state: SynthesisState,\n) => {\n if (isIdentifier(expression) && expression.text === parameterName) {\n state.substitutionCount += 1;\n return substitution;\n }\n\n if (isObjectLiteralExpression(expression)) {\n const memberTypes: string[] = [];\n\n for (const property of expression.properties) {\n if (\n !isPropertyAssignment(property) ||\n !(isIdentifier(property.name) || isStringLiteral(property.name))\n ) {\n return undefined;\n }\n\n const valueType = synthesizeExpressionType(\n property.initializer,\n parameterName,\n substitution,\n state,\n );\n\n if (valueType === undefined) {\n return undefined;\n }\n\n memberTypes.push(`${property.name.text}: ${valueType}`);\n }\n\n return `{ ${memberTypes.join('; ')} }`;\n }\n\n if (isStringLiteral(expression)) {\n return 'string';\n }\n\n if (isNumericLiteral(expression)) {\n return 'number';\n }\n\n if (isTrueLiteral(expression) || isFalseLiteral(expression)) {\n return 'boolean';\n }\n\n if (isNullLiteral(expression)) {\n return 'null';\n }\n\n return undefined;\n};\n\nexport const synthesizeGenericObjectType = (\n objectLiteral: ObjectLiteralExpression,\n parameterName: string,\n substitution: string,\n) => {\n const state: SynthesisState = { substitutionCount: 0 };\n const objectType = synthesizeExpressionType(objectLiteral, parameterName, substitution, state);\n\n return objectType !== undefined && state.substitutionCount === 1 ? objectType : undefined;\n};\n","import type {\n Block,\n ClassDeclaration,\n Expression,\n MethodDeclaration,\n SourceFile,\n} from 'typescript/unstable/ast';\nimport {\n isArrowFunction,\n isBlock,\n isCallExpression,\n isFunctionExpression,\n isIdentifier,\n isMethodDeclaration,\n isObjectLiteralExpression,\n isParenthesizedExpression,\n isPropertyAccessExpression,\n isReturnStatement,\n isVariableStatement,\n} from 'typescript/unstable/ast';\nimport type { ResponseWrapperDetection } from '../models/response-wrapper-detection';\nimport { findGlobalInterceptorClassNames } from './find-global-interceptor-class-names';\nimport { parseSourceFile } from './parse-source-file';\nimport { findImportSource, resolveClassDeclaration } from './resolve-type-declaration';\nimport { synthesizeGenericObjectType } from './synthesize-generic-object-type';\n\nconst INTERCEPT_METHOD_NAME = 'intercept';\nconst PIPE_MEMBER_NAME = 'pipe';\nconst MAP_OPERATOR_NAME = 'map';\nconst RXJS_MODULE_SPECIFIER = 'rxjs';\nconst WRAPPED_RESULT_SUBSTITUTION = 'Awaited<Result>';\n\nconst unwrapParenthesizedExpression = (expression: Expression) => {\n let unwrapped = expression;\n\n while (isParenthesizedExpression(unwrapped)) {\n unwrapped = unwrapped.expression;\n }\n\n return unwrapped;\n};\n\nconst resolveSoleReturnExpression = (body: Block | Expression) => {\n if (!isBlock(body)) {\n return unwrapParenthesizedExpression(body);\n }\n\n const localDeclarations = new Map<string, Expression>();\n let returnExpression: Expression | undefined;\n let sawReturn = false;\n\n for (const statement of body.statements) {\n if (sawReturn) {\n return undefined;\n }\n\n if (isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (!isIdentifier(declaration.name) || declaration.initializer === undefined) {\n return undefined;\n }\n\n localDeclarations.set(declaration.name.text, declaration.initializer);\n }\n\n continue;\n }\n\n if (isReturnStatement(statement)) {\n sawReturn = true;\n returnExpression = statement.expression;\n continue;\n }\n\n return undefined;\n }\n\n if (returnExpression === undefined) {\n return undefined;\n }\n\n return isIdentifier(returnExpression)\n ? localDeclarations.get(returnExpression.text)\n : returnExpression;\n};\n\nconst matchPipedMapCallback = (expression: Expression, interceptorSourceFile: SourceFile) => {\n if (\n !isCallExpression(expression) ||\n !isPropertyAccessExpression(expression.expression) ||\n expression.expression.name.text !== PIPE_MEMBER_NAME ||\n expression.arguments.length !== 1\n ) {\n return undefined;\n }\n\n const [operator] = expression.arguments;\n\n if (\n operator === undefined ||\n !isCallExpression(operator) ||\n !isIdentifier(operator.expression) ||\n operator.expression.text !== MAP_OPERATOR_NAME ||\n operator.arguments.length !== 1\n ) {\n return undefined;\n }\n\n const mapImportSource = findImportSource(interceptorSourceFile, operator.expression.text);\n\n if (\n mapImportSource === undefined ||\n mapImportSource.moduleSpecifierText !== RXJS_MODULE_SPECIFIER\n ) {\n return undefined;\n }\n\n const [callback] = operator.arguments;\n\n return callback !== undefined && (isArrowFunction(callback) || isFunctionExpression(callback))\n ? callback\n : undefined;\n};\n\nconst findInterceptMethod = (members: ClassDeclaration['members']) =>\n members.find(\n (member): member is MethodDeclaration =>\n isMethodDeclaration(member) &&\n isIdentifier(member.name) &&\n member.name.text === INTERCEPT_METHOD_NAME,\n );\n\nconst synthesizeInterceptorWrapperType = (\n interceptorClassName: string,\n bootstrapSourceFile: SourceFile,\n bootstrapFilePath: string,\n innerTypeSource: string,\n) => {\n const resolved = resolveClassDeclaration(\n interceptorClassName,\n bootstrapSourceFile,\n bootstrapFilePath,\n );\n\n if (resolved === undefined) {\n return undefined;\n }\n\n const interceptMethod = findInterceptMethod(resolved.classDeclaration.members);\n\n if (interceptMethod?.body === undefined) {\n return undefined;\n }\n\n const returnExpression = resolveSoleReturnExpression(interceptMethod.body);\n\n if (returnExpression === undefined) {\n return undefined;\n }\n\n const mapCallback = matchPipedMapCallback(returnExpression, resolved.sourceFile);\n\n if (mapCallback === undefined || mapCallback.parameters.length !== 1) {\n return undefined;\n }\n\n const [callbackParameter] = mapCallback.parameters;\n\n if (callbackParameter === undefined || !isIdentifier(callbackParameter.name)) {\n return undefined;\n }\n\n const callbackReturnExpression = resolveSoleReturnExpression(mapCallback.body);\n\n if (\n callbackReturnExpression === undefined ||\n !isObjectLiteralExpression(callbackReturnExpression)\n ) {\n return undefined;\n }\n\n return synthesizeGenericObjectType(\n callbackReturnExpression,\n callbackParameter.name.text,\n innerTypeSource,\n );\n};\n\n/**\n * Interceptors registered first wrap those registered after them, so the\n * composed type is built from the last-registered interceptor (closest to the\n * raw handler result) outward to the first-registered one.\n */\nexport const detectResponseWrapper = (\n bootstrapFilePath: string,\n): ResponseWrapperDetection | undefined => {\n const bootstrapSourceFile = parseSourceFile(bootstrapFilePath);\n const interceptorClassNames = findGlobalInterceptorClassNames(bootstrapSourceFile);\n\n if (interceptorClassNames === undefined) {\n return undefined;\n }\n\n let composedTypeSource = WRAPPED_RESULT_SUBSTITUTION;\n\n for (const interceptorClassName of [...interceptorClassNames].reverse()) {\n const wrapperTypeSource = synthesizeInterceptorWrapperType(\n interceptorClassName,\n bootstrapSourceFile,\n bootstrapFilePath,\n composedTypeSource,\n );\n\n if (wrapperTypeSource === undefined) {\n return undefined;\n }\n\n composedTypeSource = wrapperTypeSource;\n }\n\n return { wrappedResultTypeSource: composedTypeSource };\n};\n","import { dirname, extname, relative } from 'node:path';\nimport type { ResponseKind } from '../models/response-kind';\nimport type { ResponseWrapperDetection } from '../models/response-wrapper-detection';\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 WRAPPED_RESULT_HELPER = '__NestBridgeWrapped';\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 responseWrapper?: ResponseWrapperDetection,\n): string => {\n const sourceFileSpecifier = importSpecifierFor(controller.sourceFile, outputFilePath);\n const importSpecifier = stripExtension(sourceFileSpecifier);\n const serverAlias = `__Server${controller.name}`;\n\n const helperNameFor = (method: ClientDeclarationSource['methods'][number]) =>\n responseWrapper !== undefined && (method.responseKind ?? 'json') === 'json'\n ? WRAPPED_RESULT_HELPER\n : REMOTE_RESULT_HELPERS[method.responseKind ?? 'json'];\n\n const methodDeclarations = controller.methods.map((method) => {\n const helperName = helperNameFor(method);\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 rawHelperNames = controller.methods.map((method) => helperNameFor(method));\n const hasWrappedMethod = rawHelperNames.includes(WRAPPED_RESULT_HELPER);\n const helperImports =\n rawHelperNames.length === 0\n ? ['RemoteResult']\n : Array.from(new Set(rawHelperNames.filter((name) => name !== WRAPPED_RESULT_HELPER))).sort();\n\n const wrappedResultTypeAliasLines =\n responseWrapper !== undefined && hasWrappedMethod\n ? [\n `type ${WRAPPED_RESULT_HELPER}<T> = T extends (...args: never[]) => infer Result ? Promise<${responseWrapper.wrappedResultTypeSource}> : never;`,\n '',\n ]\n : [];\n\n return [\n `import type { ${controller.name} as ${serverAlias} } from '${importSpecifier}';`,\n ...(helperImports.length > 0\n ? [`import type { ${helperImports.join(', ')} } from 'nestbridge';`]\n : []),\n '',\n '/**',\n ' * Generated by NestBridge — client-facing methods only.',\n ` * @see {@link ${sourceFileSpecifier}} for the real controller implementation.`,\n ' */',\n ...wrappedResultTypeAliasLines,\n `export declare class ${controller.name} {`,\n classBody,\n '}',\n '',\n ].join('\\n');\n};\n","export const ERROR_BODY_TYPE_NAME = 'NestBridgeErrorBody';\n\nexport const generateErrorBodyDeclaration = (errorBodyTypeSource: string): string =>\n [\n '/**',\n \" * Generated by NestBridge — inferred shape of the global exception filter's response body.\",\n ' */',\n `export type ${ERROR_BODY_TYPE_NAME} = ${errorBodyTypeSource};`,\n '',\n ].join('\\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.1.1\",\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,GACjB;CAGF,OAAO,WAAW,MAAM,cAAc,gBAAgB,SAAS,MAAM,aAAa;AACpF;AAEA,IAAa,oBACX,MACA,mBACG;CACH,MAAM,aAAa,cAAc,IAAI;CAErC,IAAI,eAAe,KAAA,GACjB;CAGF,OAAO,WAAW,MAAM,cAAc,eAAe,SAAS,gBAAgB,SAAS,KAAK,EAAE,CAAC;AACjG;AAEA,IAAa,mBAAmB,cAAyB;CACvD,MAAM,aAAa,UAAU;CAE7B,IAAI,iBAAiB,UAAU,KAAK,aAAa,WAAW,UAAU,GACpE,OAAO,WAAW,WAAW;CAG/B,IAAI,aAAa,UAAU,GACzB,OAAO,WAAW;AAItB;AAEA,IAAa,4BAA4B,cAAyB;CAChE,MAAM,aAAa,UAAU;CAE7B,IAAI,CAAC,iBAAiB,UAAU,GAC9B,OAAO;EAAE,IAAI;EAAM,OAAO,KAAA;CAAU;CAGtC,MAAM,CAAC,iBAAiB,WAAW;CAEnC,IAAI,kBAAkB,KAAA,GACpB,OAAO;EAAE,IAAI;EAAM,OAAO,KAAA;CAAU;CAGtC,IAAI,wBAAwB,aAA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AM,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.4",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {