nestjs-trpc 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +93 -0
  3. package/dist/decorators/__tests__/context.decorator.spec.d.ts +1 -0
  4. package/dist/decorators/__tests__/context.decorator.spec.js +72 -0
  5. package/dist/decorators/__tests__/context.decorator.spec.js.map +1 -0
  6. package/dist/decorators/__tests__/input.decorator.spec.d.ts +1 -0
  7. package/dist/decorators/__tests__/input.decorator.spec.js +71 -0
  8. package/dist/decorators/__tests__/input.decorator.spec.js.map +1 -0
  9. package/dist/decorators/__tests__/middlewares.decorator.spec.d.ts +1 -0
  10. package/dist/decorators/__tests__/middlewares.decorator.spec.js +76 -0
  11. package/dist/decorators/__tests__/middlewares.decorator.spec.js.map +1 -0
  12. package/dist/decorators/__tests__/mutation.decorator.spec.d.ts +1 -0
  13. package/dist/decorators/__tests__/mutation.decorator.spec.js +88 -0
  14. package/dist/decorators/__tests__/mutation.decorator.spec.js.map +1 -0
  15. package/dist/decorators/__tests__/options.decorator.spec.d.ts +1 -0
  16. package/dist/decorators/__tests__/options.decorator.spec.js +68 -0
  17. package/dist/decorators/__tests__/options.decorator.spec.js.map +1 -0
  18. package/dist/decorators/__tests__/path.decorator.spec.d.ts +1 -0
  19. package/dist/decorators/__tests__/path.decorator.spec.js +68 -0
  20. package/dist/decorators/__tests__/path.decorator.spec.js.map +1 -0
  21. package/dist/decorators/__tests__/query.decorator.spec.d.ts +1 -0
  22. package/dist/decorators/__tests__/query.decorator.spec.js +88 -0
  23. package/dist/decorators/__tests__/query.decorator.spec.js.map +1 -0
  24. package/dist/decorators/__tests__/raw-input.decorator.spec.d.ts +1 -0
  25. package/dist/decorators/__tests__/raw-input.decorator.spec.js +68 -0
  26. package/dist/decorators/__tests__/raw-input.decorator.spec.js.map +1 -0
  27. package/dist/decorators/__tests__/router.decorator.spec.d.ts +1 -0
  28. package/dist/decorators/__tests__/router.decorator.spec.js +59 -0
  29. package/dist/decorators/__tests__/router.decorator.spec.js.map +1 -0
  30. package/dist/decorators/__tests__/type.decorator.spec.d.ts +1 -0
  31. package/dist/decorators/__tests__/type.decorator.spec.js +68 -0
  32. package/dist/decorators/__tests__/type.decorator.spec.js.map +1 -0
  33. package/dist/decorators/context.decorator.d.ts +1 -0
  34. package/dist/decorators/context.decorator.js +21 -0
  35. package/dist/decorators/context.decorator.js.map +1 -0
  36. package/dist/decorators/context.decorator.spec.d.ts +1 -0
  37. package/dist/decorators/context.decorator.spec.js +73 -0
  38. package/dist/decorators/context.decorator.spec.js.map +1 -0
  39. package/dist/decorators/index.d.ts +10 -0
  40. package/dist/decorators/index.js +27 -0
  41. package/dist/decorators/index.js.map +1 -0
  42. package/dist/decorators/input.decorator.d.ts +1 -0
  43. package/dist/decorators/input.decorator.js +22 -0
  44. package/dist/decorators/input.decorator.js.map +1 -0
  45. package/dist/decorators/input.decorator.spec.d.ts +1 -0
  46. package/dist/decorators/input.decorator.spec.js +71 -0
  47. package/dist/decorators/input.decorator.spec.js.map +1 -0
  48. package/dist/decorators/middlewares.decorator.d.ts +2 -0
  49. package/dist/decorators/middlewares.decorator.js +23 -0
  50. package/dist/decorators/middlewares.decorator.js.map +1 -0
  51. package/dist/decorators/middlewares.decorator.spec.d.ts +1 -0
  52. package/dist/decorators/middlewares.decorator.spec.js +76 -0
  53. package/dist/decorators/middlewares.decorator.spec.js.map +1 -0
  54. package/dist/decorators/mutation.decorator.d.ts +5 -0
  55. package/dist/decorators/mutation.decorator.js +14 -0
  56. package/dist/decorators/mutation.decorator.js.map +1 -0
  57. package/dist/decorators/mutation.decorator.spec.d.ts +1 -0
  58. package/dist/decorators/mutation.decorator.spec.js +88 -0
  59. package/dist/decorators/mutation.decorator.spec.js.map +1 -0
  60. package/dist/decorators/options.decorator.d.ts +1 -0
  61. package/dist/decorators/options.decorator.js +21 -0
  62. package/dist/decorators/options.decorator.js.map +1 -0
  63. package/dist/decorators/options.decorator.spec.d.ts +1 -0
  64. package/dist/decorators/options.decorator.spec.js +68 -0
  65. package/dist/decorators/options.decorator.spec.js.map +1 -0
  66. package/dist/decorators/path.decorator.d.ts +1 -0
  67. package/dist/decorators/path.decorator.js +21 -0
  68. package/dist/decorators/path.decorator.js.map +1 -0
  69. package/dist/decorators/query.decorator.d.ts +5 -0
  70. package/dist/decorators/query.decorator.js +14 -0
  71. package/dist/decorators/query.decorator.js.map +1 -0
  72. package/dist/decorators/raw-input.decorator.d.ts +1 -0
  73. package/dist/decorators/raw-input.decorator.js +21 -0
  74. package/dist/decorators/raw-input.decorator.js.map +1 -0
  75. package/dist/decorators/router.decorator.d.ts +3 -0
  76. package/dist/decorators/router.decorator.js +10 -0
  77. package/dist/decorators/router.decorator.js.map +1 -0
  78. package/dist/decorators/type.decorator.d.ts +1 -0
  79. package/dist/decorators/type.decorator.js +21 -0
  80. package/dist/decorators/type.decorator.js.map +1 -0
  81. package/dist/factories/__tests__/middleware.factory.spec.d.ts +1 -0
  82. package/dist/factories/__tests__/middleware.factory.spec.js +66 -0
  83. package/dist/factories/__tests__/middleware.factory.spec.js.map +1 -0
  84. package/dist/factories/__tests__/procedure.factory.spec.d.ts +1 -0
  85. package/dist/factories/__tests__/procedure.factory.spec.js +179 -0
  86. package/dist/factories/__tests__/procedure.factory.spec.js.map +1 -0
  87. package/dist/factories/__tests__/router.factory.spec.d.ts +1 -0
  88. package/dist/factories/__tests__/router.factory.spec.js +223 -0
  89. package/dist/factories/__tests__/router.factory.spec.js.map +1 -0
  90. package/dist/factories/__tests__/trpc.factory.spec.d.ts +1 -0
  91. package/dist/factories/__tests__/trpc.factory.spec.js +60 -0
  92. package/dist/factories/__tests__/trpc.factory.spec.js.map +1 -0
  93. package/dist/factories/middleware.factory.d.ts +7 -0
  94. package/dist/factories/middleware.factory.js +42 -0
  95. package/dist/factories/middleware.factory.js.map +1 -0
  96. package/dist/factories/procedure.factory.d.ts +17 -0
  97. package/dist/factories/procedure.factory.js +123 -0
  98. package/dist/factories/procedure.factory.js.map +1 -0
  99. package/dist/factories/router.factory.d.ts +9 -0
  100. package/dist/factories/router.factory.js +71 -0
  101. package/dist/factories/router.factory.js.map +1 -0
  102. package/dist/factories/trpc.factory.d.ts +10 -0
  103. package/dist/factories/trpc.factory.js +39 -0
  104. package/dist/factories/trpc.factory.js.map +1 -0
  105. package/dist/generators/__tests__/context.generator.spec.d.ts +1 -0
  106. package/dist/generators/__tests__/context.generator.spec.js +70 -0
  107. package/dist/generators/__tests__/context.generator.spec.js.map +1 -0
  108. package/dist/generators/__tests__/decorator.generator.spec.d.ts +1 -0
  109. package/dist/generators/__tests__/decorator.generator.spec.js +84 -0
  110. package/dist/generators/__tests__/decorator.generator.spec.js.map +1 -0
  111. package/dist/generators/__tests__/middleware.generator.spec.d.ts +1 -0
  112. package/dist/generators/__tests__/middleware.generator.spec.js +71 -0
  113. package/dist/generators/__tests__/middleware.generator.spec.js.map +1 -0
  114. package/dist/generators/__tests__/router.generator.spec.d.ts +1 -0
  115. package/dist/generators/__tests__/router.generator.spec.js +172 -0
  116. package/dist/generators/__tests__/router.generator.spec.js.map +1 -0
  117. package/dist/generators/__tests__/trpc.generator.spec.d.ts +1 -0
  118. package/dist/generators/__tests__/trpc.generator.spec.js +170 -0
  119. package/dist/generators/__tests__/trpc.generator.spec.js.map +1 -0
  120. package/dist/generators/context.generator.d.ts +9 -0
  121. package/dist/generators/context.generator.js +89 -0
  122. package/dist/generators/context.generator.js.map +1 -0
  123. package/dist/generators/context.handler.d.ts +9 -0
  124. package/dist/generators/context.handler.js +89 -0
  125. package/dist/generators/context.handler.js.map +1 -0
  126. package/dist/generators/decorator.generator.d.ts +7 -0
  127. package/dist/generators/decorator.generator.js +74 -0
  128. package/dist/generators/decorator.generator.js.map +1 -0
  129. package/dist/generators/decorator.handler.d.ts +11 -0
  130. package/dist/generators/decorator.handler.js +80 -0
  131. package/dist/generators/decorator.handler.js.map +1 -0
  132. package/dist/generators/middleware.generator.d.ts +12 -0
  133. package/dist/generators/middleware.generator.js +108 -0
  134. package/dist/generators/middleware.generator.js.map +1 -0
  135. package/dist/generators/middleware.handler.d.ts +12 -0
  136. package/dist/generators/middleware.handler.js +105 -0
  137. package/dist/generators/middleware.handler.js.map +1 -0
  138. package/dist/generators/router.generator.d.ts +9 -0
  139. package/dist/generators/router.generator.js +84 -0
  140. package/dist/generators/router.generator.js.map +1 -0
  141. package/dist/generators/serializer.handler.d.ts +11 -0
  142. package/dist/generators/serializer.handler.js +87 -0
  143. package/dist/generators/serializer.handler.js.map +1 -0
  144. package/dist/generators/trpc.generator.d.ts +19 -0
  145. package/dist/generators/trpc.generator.js +139 -0
  146. package/dist/generators/trpc.generator.js.map +1 -0
  147. package/dist/generators/types/index.ts +1 -0
  148. package/dist/handlers/context.handler.d.ts +9 -0
  149. package/dist/handlers/context.handler.js +89 -0
  150. package/dist/handlers/context.handler.js.map +1 -0
  151. package/dist/handlers/decorator.handler.d.ts +11 -0
  152. package/dist/handlers/decorator.handler.js +80 -0
  153. package/dist/handlers/decorator.handler.js.map +1 -0
  154. package/dist/handlers/middleware.handler.d.ts +12 -0
  155. package/dist/handlers/middleware.handler.js +105 -0
  156. package/dist/handlers/middleware.handler.js.map +1 -0
  157. package/dist/handlers/serializer.handler.d.ts +11 -0
  158. package/dist/handlers/serializer.handler.js +87 -0
  159. package/dist/handlers/serializer.handler.js.map +1 -0
  160. package/dist/index.d.ts +3 -0
  161. package/dist/index.js +20 -0
  162. package/dist/index.js.map +1 -0
  163. package/dist/interfaces/context.interface.d.ts +5 -0
  164. package/dist/interfaces/context.interface.js +3 -0
  165. package/dist/interfaces/context.interface.js.map +1 -0
  166. package/dist/interfaces/factory.interface.d.ts +59 -0
  167. package/dist/interfaces/factory.interface.js +13 -0
  168. package/dist/interfaces/factory.interface.js.map +1 -0
  169. package/dist/interfaces/generator.interface.d.ts +21 -0
  170. package/dist/interfaces/generator.interface.js +3 -0
  171. package/dist/interfaces/generator.interface.js.map +1 -0
  172. package/dist/interfaces/index.d.ts +4 -0
  173. package/dist/interfaces/index.js +21 -0
  174. package/dist/interfaces/index.js.map +1 -0
  175. package/dist/interfaces/middleware.interface.d.ts +19 -0
  176. package/dist/interfaces/middleware.interface.js +3 -0
  177. package/dist/interfaces/middleware.interface.js.map +1 -0
  178. package/dist/interfaces/module-options.interface.d.ts +14 -0
  179. package/dist/interfaces/module-options.interface.js +3 -0
  180. package/dist/interfaces/module-options.interface.js.map +1 -0
  181. package/dist/interfaces/procedure-options.interface.d.ts +7 -0
  182. package/dist/interfaces/procedure-options.interface.js +3 -0
  183. package/dist/interfaces/procedure-options.interface.js.map +1 -0
  184. package/dist/trpc.constants.d.ts +7 -0
  185. package/dist/trpc.constants.js +11 -0
  186. package/dist/trpc.constants.js.map +1 -0
  187. package/dist/trpc.driver.d.ts +14 -0
  188. package/dist/trpc.driver.js +85 -0
  189. package/dist/trpc.driver.js.map +1 -0
  190. package/dist/trpc.enum.d.ts +4 -0
  191. package/dist/trpc.enum.js +9 -0
  192. package/dist/trpc.enum.js.map +1 -0
  193. package/dist/trpc.generator.d.ts +24 -0
  194. package/dist/trpc.generator.js +114 -0
  195. package/dist/trpc.generator.js.map +1 -0
  196. package/dist/trpc.module.d.ts +10 -0
  197. package/dist/trpc.module.js +93 -0
  198. package/dist/trpc.module.js.map +1 -0
  199. package/dist/types/index.ts +5 -0
  200. package/dist/utils/__tests__/file.util.spec.d.ts +1 -0
  201. package/dist/utils/__tests__/file.util.spec.js +73 -0
  202. package/dist/utils/__tests__/file.util.spec.js.map +1 -0
  203. package/dist/utils/file.util.d.ts +5 -0
  204. package/dist/utils/file.util.js +61 -0
  205. package/dist/utils/file.util.js.map +1 -0
  206. package/dist/utils/type.util.d.ts +5 -0
  207. package/dist/utils/type.util.js +72 -0
  208. package/dist/utils/type.util.js.map +1 -0
  209. package/dist/utils/validate-each.util.d.ts +8 -0
  210. package/dist/utils/validate-each.util.js +26 -0
  211. package/dist/utils/validate-each.util.js.map +1 -0
  212. package/package.json +103 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trpc.module.js","sourceRoot":"","sources":["../src/trpc.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+D;AAE/D,uCAAgE;AAEhE,qDAAuE;AAIvE,+CAA2C;AAE3C,2DAAuD;AACvD,+DAA2D;AAC3D,qEAAiE;AACjE,uEAAmE;AAEnE,gEAA4D;AAC5D,0EAAsE;AACtE,oEAAgE;AAChE,4EAAwE;AACxE,sEAAkE;AAoBlE,IAAa,UAAU,kBAAvB,MAAa,UAAU;IAarB,MAAM,CAAC,OAAO,CACZ,UAAoB,EAAc;QAElC,OAAO;YACL,MAAM,EAAE,YAAU;YAClB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,oCAAmB,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;SACjE,CAAC;IACJ,CAAC;IAEK,YAAY;;;YAChB,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,eAAe,0CAAE,WAAW,CAAC;YACtD,IAAI,CAAC,WAAW,EAAE;gBAChB,OAAO;aACR;YAED,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,+BAAc,CAAC,CAAC;YAC9C,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC1C,IAAI,CAAC,aAAa,CAAC,GAAG,CACpB,2CAA2C,EAC3C,aAAa,CACd,CAAC;;KACH;CACF,CAAA;AAjCkB;IADhB,IAAA,eAAM,EAAC,oCAAmB,CAAC;;2CACiB;AAG5B;IADhB,IAAA,eAAM,EAAC,sBAAa,CAAC;8BACW,sBAAa;iDAAC;AAG9B;IADhB,IAAA,eAAM,EAAC,sBAAe,CAAC;8BACW,sBAAe;mDAAC;AAGlC;IADhB,IAAA,eAAM,EAAC,wBAAU,CAAC;8BACW,wBAAU;8CAAC;AAX9B,UAAU;IAlBtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,EAAE;QACX,SAAS,EAAE;YACT,sBAAa;YACb,wBAAU;YACV,0BAAW;YACX,sBAAe;YACf,8BAAa;YACb,oCAAgB;YAChB,sCAAiB;YACjB,wCAAkB;YAClB,0CAAmB;YACnB,oCAAgB;YAChB,kCAAe;YACf,8BAAa;SACd;QACD,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,UAAU,CAmCtB;AAnCY,gCAAU"}
@@ -0,0 +1,5 @@
1
+ export type Context = { req: import("/Users/kevin/Documents/GitHub/nestjs-trpc/node_modules/.pnpm/@types+express@4.17.17/node_modules/@types/express/index").Request<import("/Users/kevin/Documents/GitHub/nestjs-trpc/node_modules/.pnpm/@types+express-serve-static-core@4.17.33/node_modules/@types/express-serve-static-core/index").ParamsDictionary, any, any, qs.ParsedQs, Record<string, any>>; auth: { user: string; }; };
2
+
3
+ export interface ProtectedMiddlewareContext extends Context {
4
+ ben: number;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const ts_morph_1 = require("ts-morph");
13
+ const file_util_1 = require("../file.util");
14
+ const typeUtil = require("../type.util");
15
+ describe('File Util', () => {
16
+ let project;
17
+ let sourceFile;
18
+ beforeEach(() => {
19
+ project = new ts_morph_1.Project();
20
+ sourceFile = project.createSourceFile('test.ts', '');
21
+ });
22
+ describe('generateStaticDeclaration', () => {
23
+ it('should add correct import declarations and variable statements', () => {
24
+ (0, file_util_1.generateStaticDeclaration)(sourceFile);
25
+ const imports = sourceFile.getImportDeclarations();
26
+ expect(imports).toHaveLength(2);
27
+ expect(imports[0].getModuleSpecifierValue()).toBe('@trpc/server');
28
+ expect(imports[1].getModuleSpecifierValue()).toBe('zod');
29
+ const variables = sourceFile.getVariableStatements();
30
+ expect(variables).toHaveLength(2);
31
+ expect(variables[0].getDeclarations()[0].getName()).toBe('t');
32
+ expect(variables[1].getDeclarations()[0].getName()).toBe('publicProcedure');
33
+ });
34
+ });
35
+ describe('saveOrOverrideFile', () => {
36
+ it('should format and save the file', () => __awaiter(void 0, void 0, void 0, function* () {
37
+ const formatSpy = jest.spyOn(sourceFile, 'formatText');
38
+ const saveSpy = jest.spyOn(sourceFile, 'save').mockResolvedValue();
39
+ yield (0, file_util_1.saveOrOverrideFile)(sourceFile);
40
+ expect(formatSpy).toHaveBeenCalledWith({ indentSize: 2 });
41
+ expect(saveSpy).toHaveBeenCalled();
42
+ }));
43
+ });
44
+ describe('getDecoratorPropertyValue', () => {
45
+ it('should return property value from decorator', () => {
46
+ sourceFile.addStatements(`
47
+ import { z } from 'zod';
48
+ const MyDecorator = (options: { input: z.ZodType }) => {};
49
+ @MyDecorator({ input: z.string() })
50
+ class TestClass {}
51
+ `);
52
+ const testClass = sourceFile.getClassOrThrow('TestClass');
53
+ const decorator = testClass.getDecorators()[0];
54
+ const importsMap = new Map();
55
+ jest.spyOn(typeUtil, 'flattenZodSchema').mockReturnValue('z.string()');
56
+ const result = (0, file_util_1.getDecoratorPropertyValue)(decorator, 'input', sourceFile, importsMap);
57
+ expect(result).toBe('z.string()');
58
+ });
59
+ it('should return null if property is not found', () => {
60
+ sourceFile.addStatements(`
61
+ const MyDecorator = () => {};
62
+ @MyDecorator()
63
+ class TestClass {}
64
+ `);
65
+ const testClass = sourceFile.getClassOrThrow('TestClass');
66
+ const decorator = testClass.getDecorators()[0];
67
+ const importsMap = new Map();
68
+ const result = (0, file_util_1.getDecoratorPropertyValue)(decorator, 'input', sourceFile, importsMap);
69
+ expect(result).toBeNull();
70
+ });
71
+ });
72
+ });
73
+ //# sourceMappingURL=file.util.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.util.spec.js","sourceRoot":"","sources":["../../../src/utils/__tests__/file.util.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,uCAAsE;AACtE,4CAAwG;AAExG,yCAAyC;AAEzC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,OAAgB,CAAC;IACrB,IAAI,UAAsB,CAAC;IAE3B,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,IAAI,kBAAO,EAAE,CAAC;QACxB,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACzC,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;YACxE,IAAA,qCAAyB,EAAC,UAAU,CAAC,CAAC;YAEtC,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;YACnD,MAAM,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,uBAAuB,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAClE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,uBAAuB,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEzD,MAAM,SAAS,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;YACrD,MAAM,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAClC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,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AAS,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;YACrF,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACrD,UAAU,CAAC,aAAa,CAAC;;;;OAIxB,CAAC,CAAC;YAEH,MAAM,SAAS,GAAG,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;YAC1D,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;YAE/C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAgC,CAAC;YAE3D,MAAM,MAAM,GAAG,IAAA,qCAAyB,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;YACrF,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { SourceFile, Decorator } from 'ts-morph';
2
+ import { SourceFileImportsMap } from '../interfaces/generator.interface';
3
+ export declare function generateStaticDeclaration(sourceFile: SourceFile): void;
4
+ export declare function saveOrOverrideFile(sourceFile: SourceFile): Promise<void>;
5
+ export declare function getDecoratorPropertyValue(decorator: Decorator, propertyName: string, sourceFile: SourceFile, importsMap: Map<string, SourceFileImportsMap>): string | null;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getDecoratorPropertyValue = exports.saveOrOverrideFile = exports.generateStaticDeclaration = void 0;
13
+ const ts_morph_1 = require("ts-morph");
14
+ const type_util_1 = require("./type.util");
15
+ function generateStaticDeclaration(sourceFile) {
16
+ sourceFile.addImportDeclaration({
17
+ kind: ts_morph_1.StructureKind.ImportDeclaration,
18
+ moduleSpecifier: '@trpc/server',
19
+ namedImports: ['initTRPC'],
20
+ });
21
+ sourceFile.addImportDeclaration({
22
+ kind: ts_morph_1.StructureKind.ImportDeclaration,
23
+ moduleSpecifier: 'zod',
24
+ namedImports: ['z'],
25
+ });
26
+ sourceFile.addVariableStatements([
27
+ {
28
+ declarationKind: ts_morph_1.VariableDeclarationKind.Const,
29
+ declarations: [{ name: 't', initializer: 'initTRPC.create()' }],
30
+ },
31
+ {
32
+ declarationKind: ts_morph_1.VariableDeclarationKind.Const,
33
+ declarations: [{ name: 'publicProcedure', initializer: 't.procedure' }],
34
+ },
35
+ ]);
36
+ }
37
+ exports.generateStaticDeclaration = generateStaticDeclaration;
38
+ function saveOrOverrideFile(sourceFile) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ sourceFile.formatText({ indentSize: 2 });
41
+ yield sourceFile.save();
42
+ });
43
+ }
44
+ exports.saveOrOverrideFile = saveOrOverrideFile;
45
+ function getDecoratorPropertyValue(decorator, propertyName, sourceFile, importsMap) {
46
+ const args = decorator.getArguments();
47
+ for (const arg of args) {
48
+ if (arg.getKind() === ts_morph_1.SyntaxKind.ObjectLiteralExpression) {
49
+ const properties = arg.getProperties();
50
+ const property = properties.find((p) => p.getName() === propertyName);
51
+ if (!property) {
52
+ return null;
53
+ }
54
+ const propertyInitializer = property.getInitializer();
55
+ return (0, type_util_1.flattenZodSchema)(propertyInitializer, importsMap, sourceFile, propertyInitializer.getText());
56
+ }
57
+ }
58
+ return null;
59
+ }
60
+ exports.getDecoratorPropertyValue = getDecoratorPropertyValue;
61
+ //# sourceMappingURL=file.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.util.js","sourceRoot":"","sources":["../../src/utils/file.util.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAuH;AAGvH,2CAA+C;AAE/C,SAAgB,yBAAyB,CAAC,UAAsB;IAC9D,UAAU,CAAC,oBAAoB,CAAC;QAC9B,IAAI,EAAE,wBAAa,CAAC,iBAAiB;QACrC,eAAe,EAAE,cAAc;QAC/B,YAAY,EAAE,CAAC,UAAU,CAAC;KAC3B,CAAC,CAAC;IACH,UAAU,CAAC,oBAAoB,CAAC;QAC9B,IAAI,EAAE,wBAAa,CAAC,iBAAiB;QACrC,eAAe,EAAE,KAAK;QACtB,YAAY,EAAE,CAAC,GAAG,CAAC;KACpB,CAAC,CAAC;IAEH,UAAU,CAAC,qBAAqB,CAAC;QAC/B;YACE,eAAe,EAAE,kCAAuB,CAAC,KAAK;YAC9C,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;SAChE;QACD;YACE,eAAe,EAAE,kCAAuB,CAAC,KAAK;YAC9C,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;SACxE;KACF,CAAC,CAAC;AACL,CAAC;AAtBD,8DAsBC;AAED,SAAsB,kBAAkB,CAAC,UAAsB;;QAC7D,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;QACzC,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;CAAA;AAHD,gDAGC;AAED,SAAgB,yBAAyB,CACvC,SAAoB,EACpB,YAAoB,EACpB,UAAsB,EACtB,UAA6C;IAE7C,MAAM,IAAI,GAAG,SAAS,CAAC,YAAY,EAAE,CAAC;IAEtC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,qBAAU,CAAC,uBAAuB,EAAE;YACxD,MAAM,UAAU,GAAI,GAAW,CAAC,aAAa,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,YAAY,CAAC,CAAC;YAE3E,IAAI,CAAC,QAAQ,EAAE;gBACb,OAAO,IAAI,CAAC;aACb;YAED,MAAM,mBAAmB,GAAe,QAAQ,CAAC,cAAc,EAAE,CAAC;YAClE,OAAO,IAAA,4BAAgB,EAAC,mBAAmB,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAC;SACrG;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAvBD,8DAuBC"}
@@ -0,0 +1,5 @@
1
+ import { Node, SourceFile, Type } from 'ts-morph';
2
+ import { ProcedureGeneratorMetadata, SourceFileImportsMap } from '../interfaces/generator.interface';
3
+ export declare function findCtxOutProperty(type: Type): string | undefined;
4
+ export declare function generateProcedureString(procedure: ProcedureGeneratorMetadata): string;
5
+ export declare function flattenZodSchema(node: Node, importsMap: Map<string, SourceFileImportsMap>, sourceFile: SourceFile, schema: string): string;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flattenZodSchema = exports.generateProcedureString = exports.findCtxOutProperty = void 0;
4
+ const ts_morph_1 = require("ts-morph");
5
+ function findCtxOutProperty(type) {
6
+ const typeText = type.getText();
7
+ const ctxOutMatch = typeText.match(/_ctx_out:\s*{([^}]*)}/);
8
+ return ctxOutMatch ? ctxOutMatch[1].trim() : undefined;
9
+ }
10
+ exports.findCtxOutProperty = findCtxOutProperty;
11
+ function generateProcedureString(procedure) {
12
+ const { name, decorators } = procedure;
13
+ const decorator = decorators.find(d => d.name === 'Mutation' || d.name === 'Query');
14
+ if (!decorator) {
15
+ return '';
16
+ }
17
+ const decoratorArgumentsArray = Object.entries(decorator.arguments)
18
+ .map(([key, value]) => `.${key}(${value})`)
19
+ .join('');
20
+ return `${name}: publicProcedure${decoratorArgumentsArray}.${decorator.name.toLowerCase()}(async () => "PLACEHOLDER_DO_NOT_REMOVE" as any )`;
21
+ }
22
+ exports.generateProcedureString = generateProcedureString;
23
+ function flattenZodSchema(node, importsMap, sourceFile, schema) {
24
+ if (ts_morph_1.Node.isIdentifier(node)) {
25
+ const identifierName = node.getText();
26
+ const identifierDeclaration = sourceFile.getVariableDeclaration(identifierName);
27
+ if (identifierDeclaration) {
28
+ const identifierInitializer = identifierDeclaration.getInitializer();
29
+ if (identifierInitializer != null) {
30
+ const identifierSchema = flattenZodSchema(identifierInitializer, importsMap, sourceFile, identifierInitializer.getText());
31
+ schema = schema.replace(identifierName, identifierSchema);
32
+ }
33
+ }
34
+ else if (importsMap.has(identifierName)) {
35
+ const importedIdentifier = importsMap.get(identifierName);
36
+ if (importedIdentifier != null) {
37
+ const { initializer } = importedIdentifier;
38
+ const identifierSchema = flattenZodSchema(initializer, importsMap, importedIdentifier.sourceFile, initializer.getText());
39
+ schema = schema.replace(identifierName, identifierSchema);
40
+ }
41
+ }
42
+ }
43
+ else if (ts_morph_1.Node.isObjectLiteralExpression(node)) {
44
+ for (const property of node.getProperties()) {
45
+ if (ts_morph_1.Node.isPropertyAssignment(property)) {
46
+ const propertyText = property.getText();
47
+ const propertyInitializer = property.getInitializer();
48
+ if (propertyInitializer != null) {
49
+ schema = schema.replace(propertyText, flattenZodSchema(propertyInitializer, importsMap, sourceFile, propertyText));
50
+ }
51
+ }
52
+ }
53
+ }
54
+ else if (ts_morph_1.Node.isArrayLiteralExpression(node)) {
55
+ for (const element of node.getElements()) {
56
+ const elementText = element.getText();
57
+ schema = schema.replace(elementText, flattenZodSchema(element, importsMap, sourceFile, elementText));
58
+ }
59
+ }
60
+ else if (ts_morph_1.Node.isCallExpression(node)) {
61
+ for (const arg of node.getArguments()) {
62
+ const argText = arg.getText();
63
+ schema = schema.replace(argText, flattenZodSchema(arg, importsMap, sourceFile, argText));
64
+ }
65
+ }
66
+ else if (ts_morph_1.Node.isPropertyAccessExpression(node)) {
67
+ schema = flattenZodSchema(node.getExpression(), importsMap, sourceFile, node.getExpression().getText());
68
+ }
69
+ return schema;
70
+ }
71
+ exports.flattenZodSchema = flattenZodSchema;
72
+ //# sourceMappingURL=type.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.util.js","sourceRoot":"","sources":["../../src/utils/type.util.ts"],"names":[],"mappings":";;;AAAA,uCAAkD;AAGlD,SAAgB,kBAAkB,CAAC,IAAU;IAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAChC,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE5D,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC;AALD,gDAKC;AAED,SAAgB,uBAAuB,CAAC,SAAqC;IAC3E,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;IACvC,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAEpF,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,EAAE,CAAC;KACX;IAED,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;SAChE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,KAAK,GAAG,CAAC;SAC1C,IAAI,CAAC,EAAE,CAAC,CAAC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M,CAAC;AAChB,CAAC;AApFD,4CAoFC"}
@@ -0,0 +1,8 @@
1
+ export declare class InvalidDecoratorItemException extends Error {
2
+ private readonly msg;
3
+ constructor(decorator: string, item: string, context: string);
4
+ what(): string;
5
+ }
6
+ export declare function validateEach(context: {
7
+ name: string;
8
+ }, arr: any[], predicate: Function, decorator: string, item: string): boolean;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateEach = exports.InvalidDecoratorItemException = void 0;
4
+ class InvalidDecoratorItemException extends Error {
5
+ constructor(decorator, item, context) {
6
+ const message = `Invalid ${item} passed to ${decorator}() decorator (${context}).`;
7
+ super(message);
8
+ this.msg = message;
9
+ }
10
+ what() {
11
+ return this.msg;
12
+ }
13
+ }
14
+ exports.InvalidDecoratorItemException = InvalidDecoratorItemException;
15
+ function validateEach(context, arr, predicate, decorator, item) {
16
+ if (!context || !context.name) {
17
+ return true;
18
+ }
19
+ const errors = arr.some(str => !predicate(str));
20
+ if (errors) {
21
+ throw new InvalidDecoratorItemException(decorator, item, context.name);
22
+ }
23
+ return true;
24
+ }
25
+ exports.validateEach = validateEach;
26
+ //# sourceMappingURL=validate-each.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-each.util.js","sourceRoot":"","sources":["../../src/utils/validate-each.util.ts"],"names":[],"mappings":";;;AAAA,MAAa,6BAA8B,SAAQ,KAAK;IAGtD,YAAY,SAAiB,EAAE,IAAY,EAAE,OAAe;QAC1D,MAAM,OAAO,GAAG,WAAW,IAAI,cAAc,SAAS,iBAAiB,OAAO,IAAI,CAAC;QACnF,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC;IACrB,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF;AAbD,sEAaC;AAED,SAAgB,YAAY,CAC1B,OAAyB,EACzB,GAAU,EACV,SAAmB,EACnB,SAAiB,EACjB,IAAY;IAEZ,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QAC7B,OAAO,IAAI,CAAC;KACb;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,6BAA6B,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;KACxE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAfD,oCAeC"}
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "nestjs-trpc",
3
+ "version": "1.1.0",
4
+ "homepage": "https://nestjs-trpc.io",
5
+ "main": "./dist/index.js",
6
+ "types": "./src/index.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./types": {
17
+ "import": "./dist/types/index.js",
18
+ "require": "./dist/types/index.js",
19
+ "types": "./dist/types/index.d.ts"
20
+ }
21
+ },
22
+ "scripts": {
23
+ "lint": "tslint -p tsconfig.json -c tslint.json --fix",
24
+ "build": "tsc -b -v",
25
+ "start:dev": "tsc -w",
26
+ "debug:dev": "ts-node --inspect-brk lib/index.ts",
27
+ "format": "prettier \"src/**/*.ts\" --ignore-path ./.prettierignore --write",
28
+ "clean": "tsc -b --clean",
29
+ "test": "export TS_JEST_DISABLE_VER_CHECKER=true && jest --no-watchman --coverage",
30
+ "prepare": "husky install & pnpm run build",
31
+ "release": "release-it"
32
+ },
33
+ "keywords": [],
34
+ "author": {
35
+ "name": "Kevin Edry",
36
+ "email": "kevin.edry@gmail.com",
37
+ "url": "https://kevin-edry.com"
38
+ },
39
+ "license": "MIT",
40
+ "engines": {
41
+ "node": "14 || 15 || 16 || 17 || 18 || 19 || 20",
42
+ "pnpm": ">=8.0.0"
43
+ },
44
+ "packageManager": "pnpm@8.12.1",
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "peerDependencies": {
49
+ "@nestjs/common": "^9.0.0",
50
+ "@nestjs/core": "^9.0.0",
51
+ "@trpc/server": "^10.18.0",
52
+ "reflect-metadata": "^0.1.13",
53
+ "ts-morph": ">= 22.0.0",
54
+ "zod": ">= 3.14.3"
55
+ },
56
+ "peerDevDependencies": {
57
+ "@types/node": "20.14.10"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "ts-morph": {
61
+ "optional": true
62
+ },
63
+ "zod": {
64
+ "optional": true
65
+ }
66
+ },
67
+ "devDependencies": {
68
+ "@commitlint/cli": "^17.5.1",
69
+ "@commitlint/config-angular": "^17.4.4",
70
+ "@eslint/js": "^9.6.0",
71
+ "@nestjs/cli": "^9.3.0",
72
+ "@nestjs/testing": "^9.0.0",
73
+ "@types/express": "^4.17.17",
74
+ "@types/jest": "29.2.4",
75
+ "@types/lodash": "^4.17.5",
76
+ "eslint": "^8.37.0",
77
+ "husky": "^8.0.3",
78
+ "jest": "^29.5.0",
79
+ "lint-staged": "^13.2.0",
80
+ "release-it": "^15.10.0",
81
+ "rimraf": "^4.4.1",
82
+ "ts-jest": "29.0.3",
83
+ "ts-node": "^10.9.1",
84
+ "tsconfig-paths": "^4.2.0",
85
+ "tslib": "^2.5.0",
86
+ "type-fest": "^4.21.0",
87
+ "typescript": "^5.0.3"
88
+ },
89
+ "lint-staged": {
90
+ "*.ts": [
91
+ "prettier --write",
92
+ "eslint --fix"
93
+ ]
94
+ },
95
+ "dependencies": {
96
+ "func-loc": "^0.1.16",
97
+ "lodash": "^4.17.21"
98
+ },
99
+ "repository": {
100
+ "type": "git",
101
+ "url": "https://github.com/KevinEdry/nestjs-trpc"
102
+ }
103
+ }