nestjs-trpc 1.1.0 → 1.2.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 (297) hide show
  1. package/dist/decorators/context.decorator.d.ts.map +1 -0
  2. package/dist/decorators/context.decorator.js +2 -5
  3. package/dist/decorators/index.d.ts.map +1 -0
  4. package/dist/decorators/index.js +13 -25
  5. package/dist/decorators/input.decorator.d.ts.map +1 -0
  6. package/dist/decorators/input.decorator.js +10 -3
  7. package/dist/decorators/middlewares.decorator.d.ts.map +1 -0
  8. package/dist/decorators/middlewares.decorator.js +20 -3
  9. package/dist/decorators/mutation.decorator.d.ts +17 -1
  10. package/dist/decorators/mutation.decorator.d.ts.map +1 -0
  11. package/dist/decorators/mutation.decorator.js +16 -3
  12. package/dist/decorators/options.decorator.d.ts.map +1 -0
  13. package/dist/decorators/options.decorator.js +8 -3
  14. package/dist/decorators/path.decorator.d.ts.map +1 -0
  15. package/dist/decorators/path.decorator.js +8 -3
  16. package/dist/decorators/query.decorator.d.ts +17 -1
  17. package/dist/decorators/query.decorator.d.ts.map +1 -0
  18. package/dist/decorators/query.decorator.js +16 -3
  19. package/dist/decorators/raw-input.decorator.d.ts.map +1 -0
  20. package/dist/decorators/raw-input.decorator.js +8 -3
  21. package/dist/decorators/router.decorator.d.ts +18 -1
  22. package/dist/decorators/router.decorator.d.ts.map +1 -0
  23. package/dist/decorators/router.decorator.js +18 -4
  24. package/dist/decorators/type.decorator.d.ts.map +1 -0
  25. package/dist/decorators/type.decorator.js +8 -3
  26. package/dist/factories/middleware.factory.d.ts.map +1 -0
  27. package/dist/factories/middleware.factory.js +8 -16
  28. package/dist/factories/procedure.factory.d.ts.map +1 -0
  29. package/dist/factories/procedure.factory.js +16 -23
  30. package/dist/factories/router.factory.d.ts.map +1 -0
  31. package/dist/factories/router.factory.js +18 -23
  32. package/dist/factories/trpc.factory.d.ts.map +1 -0
  33. package/dist/factories/trpc.factory.js +9 -18
  34. package/dist/generators/context.generator.d.ts.map +1 -0
  35. package/dist/generators/context.generator.js +34 -48
  36. package/dist/generators/decorator.generator.d.ts.map +1 -0
  37. package/dist/generators/decorator.generator.js +10 -15
  38. package/dist/generators/middleware.generator.d.ts.map +1 -0
  39. package/dist/generators/middleware.generator.js +36 -50
  40. package/dist/generators/router.generator.d.ts.map +1 -0
  41. package/dist/generators/router.generator.js +35 -57
  42. package/dist/generators/trpc.generator.d.ts.map +1 -0
  43. package/dist/generators/trpc.generator.js +63 -84
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +4 -18
  46. package/dist/interfaces/context.interface.d.ts.map +1 -0
  47. package/dist/interfaces/context.interface.js +0 -1
  48. package/dist/interfaces/factory.interface.d.ts.map +1 -0
  49. package/dist/interfaces/factory.interface.js +1 -2
  50. package/dist/interfaces/generator.interface.d.ts.map +1 -0
  51. package/dist/interfaces/generator.interface.js +0 -1
  52. package/dist/interfaces/index.d.ts.map +1 -0
  53. package/dist/interfaces/index.js +5 -19
  54. package/dist/interfaces/middleware.interface.d.ts.map +1 -0
  55. package/dist/interfaces/middleware.interface.js +0 -1
  56. package/dist/interfaces/module-options.interface.d.ts.map +1 -0
  57. package/dist/interfaces/module-options.interface.js +0 -1
  58. package/dist/interfaces/procedure-options.interface.d.ts.map +1 -0
  59. package/dist/interfaces/procedure-options.interface.js +0 -1
  60. package/dist/trpc.constants.d.ts.map +1 -0
  61. package/dist/trpc.constants.js +1 -1
  62. package/dist/trpc.driver.d.ts.map +1 -0
  63. package/dist/trpc.driver.js +45 -55
  64. package/dist/trpc.enum.d.ts.map +1 -0
  65. package/dist/trpc.enum.js +1 -2
  66. package/dist/trpc.module.d.ts.map +1 -0
  67. package/dist/trpc.module.js +20 -40
  68. package/dist/utils/file.util.d.ts.map +1 -0
  69. package/dist/utils/file.util.js +6 -19
  70. package/dist/utils/type.util.d.ts.map +1 -0
  71. package/dist/utils/type.util.js +3 -5
  72. package/dist/utils/validate-each.util.d.ts.map +1 -0
  73. package/dist/utils/validate-each.util.js +2 -3
  74. package/lib/decorators/__tests__/context.decorator.spec.ts +56 -0
  75. package/lib/decorators/__tests__/input.decorator.spec.ts +54 -0
  76. package/lib/decorators/__tests__/middlewares.decorator.spec.ts +56 -0
  77. package/lib/decorators/__tests__/mutation.decorator.spec.ts +64 -0
  78. package/lib/decorators/__tests__/options.decorator.spec.ts +51 -0
  79. package/lib/decorators/__tests__/path.decorator.spec.ts +51 -0
  80. package/lib/decorators/__tests__/query.decorator.spec.ts +64 -0
  81. package/lib/decorators/__tests__/raw-input.decorator.spec.ts +51 -0
  82. package/lib/decorators/__tests__/router.decorator.spec.ts +47 -0
  83. package/lib/decorators/__tests__/type.decorator.spec.ts +51 -0
  84. package/lib/decorators/context.decorator.ts +34 -0
  85. package/{dist/decorators/index.d.ts → lib/decorators/index.ts} +4 -0
  86. package/lib/decorators/input.decorator.ts +41 -0
  87. package/lib/decorators/middlewares.decorator.ts +61 -0
  88. package/lib/decorators/mutation.decorator.ts +28 -0
  89. package/lib/decorators/options.decorator.ts +38 -0
  90. package/lib/decorators/path.decorator.ts +38 -0
  91. package/lib/decorators/query.decorator.ts +28 -0
  92. package/lib/decorators/raw-input.decorator.ts +38 -0
  93. package/lib/decorators/router.decorator.ts +24 -0
  94. package/lib/decorators/type.decorator.ts +38 -0
  95. package/lib/factories/__tests__/middleware.factory.spec.ts +65 -0
  96. package/lib/factories/__tests__/procedure.factory.spec.ts +175 -0
  97. package/lib/factories/__tests__/router.factory.spec.ts +221 -0
  98. package/lib/factories/__tests__/trpc.factory.spec.ts +39 -0
  99. package/lib/factories/middleware.factory.ts +34 -0
  100. package/lib/factories/procedure.factory.ts +190 -0
  101. package/lib/factories/router.factory.ts +100 -0
  102. package/lib/factories/trpc.factory.ts +23 -0
  103. package/lib/generators/__tests__/context.generator.spec.ts +79 -0
  104. package/lib/generators/__tests__/decorator.generator.spec.ts +105 -0
  105. package/lib/generators/__tests__/middleware.generator.spec.ts +74 -0
  106. package/lib/generators/__tests__/router.generator.spec.ts +165 -0
  107. package/lib/generators/__tests__/trpc.generator.spec.ts +192 -0
  108. package/lib/generators/context.generator.ts +108 -0
  109. package/lib/generators/decorator.generator.ts +99 -0
  110. package/lib/generators/middleware.generator.ts +138 -0
  111. package/lib/generators/router.generator.ts +97 -0
  112. package/lib/generators/trpc.generator.ts +168 -0
  113. package/{dist/interfaces/context.interface.d.ts → lib/interfaces/context.interface.ts} +5 -1
  114. package/lib/interfaces/factory.interface.ts +92 -0
  115. package/lib/interfaces/generator.interface.ts +25 -0
  116. package/lib/interfaces/middleware.interface.ts +30 -0
  117. package/lib/interfaces/module-options.interface.ts +44 -0
  118. package/{dist/interfaces/procedure-options.interface.d.ts → lib/interfaces/procedure-options.interface.ts} +3 -2
  119. package/lib/trpc.constants.ts +15 -0
  120. package/lib/trpc.driver.ts +84 -0
  121. package/lib/trpc.enum.ts +4 -0
  122. package/lib/trpc.module.ts +75 -0
  123. package/lib/utils/__tests__/file.util.spec.ts +81 -0
  124. package/lib/utils/file.util.ts +58 -0
  125. package/lib/utils/type.util.ts +110 -0
  126. package/lib/utils/validate-each.util.ts +31 -0
  127. package/package.json +40 -63
  128. package/LICENSE +0 -22
  129. package/README.md +0 -93
  130. package/dist/decorators/__tests__/context.decorator.spec.d.ts +0 -1
  131. package/dist/decorators/__tests__/context.decorator.spec.js +0 -72
  132. package/dist/decorators/__tests__/context.decorator.spec.js.map +0 -1
  133. package/dist/decorators/__tests__/input.decorator.spec.d.ts +0 -1
  134. package/dist/decorators/__tests__/input.decorator.spec.js +0 -71
  135. package/dist/decorators/__tests__/input.decorator.spec.js.map +0 -1
  136. package/dist/decorators/__tests__/middlewares.decorator.spec.d.ts +0 -1
  137. package/dist/decorators/__tests__/middlewares.decorator.spec.js +0 -76
  138. package/dist/decorators/__tests__/middlewares.decorator.spec.js.map +0 -1
  139. package/dist/decorators/__tests__/mutation.decorator.spec.d.ts +0 -1
  140. package/dist/decorators/__tests__/mutation.decorator.spec.js +0 -88
  141. package/dist/decorators/__tests__/mutation.decorator.spec.js.map +0 -1
  142. package/dist/decorators/__tests__/options.decorator.spec.d.ts +0 -1
  143. package/dist/decorators/__tests__/options.decorator.spec.js +0 -68
  144. package/dist/decorators/__tests__/options.decorator.spec.js.map +0 -1
  145. package/dist/decorators/__tests__/path.decorator.spec.d.ts +0 -1
  146. package/dist/decorators/__tests__/path.decorator.spec.js +0 -68
  147. package/dist/decorators/__tests__/path.decorator.spec.js.map +0 -1
  148. package/dist/decorators/__tests__/query.decorator.spec.d.ts +0 -1
  149. package/dist/decorators/__tests__/query.decorator.spec.js +0 -88
  150. package/dist/decorators/__tests__/query.decorator.spec.js.map +0 -1
  151. package/dist/decorators/__tests__/raw-input.decorator.spec.d.ts +0 -1
  152. package/dist/decorators/__tests__/raw-input.decorator.spec.js +0 -68
  153. package/dist/decorators/__tests__/raw-input.decorator.spec.js.map +0 -1
  154. package/dist/decorators/__tests__/router.decorator.spec.d.ts +0 -1
  155. package/dist/decorators/__tests__/router.decorator.spec.js +0 -59
  156. package/dist/decorators/__tests__/router.decorator.spec.js.map +0 -1
  157. package/dist/decorators/__tests__/type.decorator.spec.d.ts +0 -1
  158. package/dist/decorators/__tests__/type.decorator.spec.js +0 -68
  159. package/dist/decorators/__tests__/type.decorator.spec.js.map +0 -1
  160. package/dist/decorators/context.decorator.d.ts +0 -1
  161. package/dist/decorators/context.decorator.js.map +0 -1
  162. package/dist/decorators/context.decorator.spec.d.ts +0 -1
  163. package/dist/decorators/context.decorator.spec.js +0 -73
  164. package/dist/decorators/context.decorator.spec.js.map +0 -1
  165. package/dist/decorators/index.js.map +0 -1
  166. package/dist/decorators/input.decorator.d.ts +0 -1
  167. package/dist/decorators/input.decorator.js.map +0 -1
  168. package/dist/decorators/input.decorator.spec.d.ts +0 -1
  169. package/dist/decorators/input.decorator.spec.js +0 -71
  170. package/dist/decorators/input.decorator.spec.js.map +0 -1
  171. package/dist/decorators/middlewares.decorator.d.ts +0 -2
  172. package/dist/decorators/middlewares.decorator.js.map +0 -1
  173. package/dist/decorators/middlewares.decorator.spec.d.ts +0 -1
  174. package/dist/decorators/middlewares.decorator.spec.js +0 -76
  175. package/dist/decorators/middlewares.decorator.spec.js.map +0 -1
  176. package/dist/decorators/mutation.decorator.js.map +0 -1
  177. package/dist/decorators/mutation.decorator.spec.d.ts +0 -1
  178. package/dist/decorators/mutation.decorator.spec.js +0 -88
  179. package/dist/decorators/mutation.decorator.spec.js.map +0 -1
  180. package/dist/decorators/options.decorator.d.ts +0 -1
  181. package/dist/decorators/options.decorator.js.map +0 -1
  182. package/dist/decorators/options.decorator.spec.d.ts +0 -1
  183. package/dist/decorators/options.decorator.spec.js +0 -68
  184. package/dist/decorators/options.decorator.spec.js.map +0 -1
  185. package/dist/decorators/path.decorator.d.ts +0 -1
  186. package/dist/decorators/path.decorator.js.map +0 -1
  187. package/dist/decorators/query.decorator.js.map +0 -1
  188. package/dist/decorators/raw-input.decorator.d.ts +0 -1
  189. package/dist/decorators/raw-input.decorator.js.map +0 -1
  190. package/dist/decorators/router.decorator.js.map +0 -1
  191. package/dist/decorators/type.decorator.d.ts +0 -1
  192. package/dist/decorators/type.decorator.js.map +0 -1
  193. package/dist/factories/__tests__/middleware.factory.spec.d.ts +0 -1
  194. package/dist/factories/__tests__/middleware.factory.spec.js +0 -66
  195. package/dist/factories/__tests__/middleware.factory.spec.js.map +0 -1
  196. package/dist/factories/__tests__/procedure.factory.spec.d.ts +0 -1
  197. package/dist/factories/__tests__/procedure.factory.spec.js +0 -179
  198. package/dist/factories/__tests__/procedure.factory.spec.js.map +0 -1
  199. package/dist/factories/__tests__/router.factory.spec.d.ts +0 -1
  200. package/dist/factories/__tests__/router.factory.spec.js +0 -223
  201. package/dist/factories/__tests__/router.factory.spec.js.map +0 -1
  202. package/dist/factories/__tests__/trpc.factory.spec.d.ts +0 -1
  203. package/dist/factories/__tests__/trpc.factory.spec.js +0 -60
  204. package/dist/factories/__tests__/trpc.factory.spec.js.map +0 -1
  205. package/dist/factories/middleware.factory.d.ts +0 -7
  206. package/dist/factories/middleware.factory.js.map +0 -1
  207. package/dist/factories/procedure.factory.d.ts +0 -17
  208. package/dist/factories/procedure.factory.js.map +0 -1
  209. package/dist/factories/router.factory.d.ts +0 -9
  210. package/dist/factories/router.factory.js.map +0 -1
  211. package/dist/factories/trpc.factory.d.ts +0 -10
  212. package/dist/factories/trpc.factory.js.map +0 -1
  213. package/dist/generators/__tests__/context.generator.spec.d.ts +0 -1
  214. package/dist/generators/__tests__/context.generator.spec.js +0 -70
  215. package/dist/generators/__tests__/context.generator.spec.js.map +0 -1
  216. package/dist/generators/__tests__/decorator.generator.spec.d.ts +0 -1
  217. package/dist/generators/__tests__/decorator.generator.spec.js +0 -84
  218. package/dist/generators/__tests__/decorator.generator.spec.js.map +0 -1
  219. package/dist/generators/__tests__/middleware.generator.spec.d.ts +0 -1
  220. package/dist/generators/__tests__/middleware.generator.spec.js +0 -71
  221. package/dist/generators/__tests__/middleware.generator.spec.js.map +0 -1
  222. package/dist/generators/__tests__/router.generator.spec.d.ts +0 -1
  223. package/dist/generators/__tests__/router.generator.spec.js +0 -172
  224. package/dist/generators/__tests__/router.generator.spec.js.map +0 -1
  225. package/dist/generators/__tests__/trpc.generator.spec.d.ts +0 -1
  226. package/dist/generators/__tests__/trpc.generator.spec.js +0 -170
  227. package/dist/generators/__tests__/trpc.generator.spec.js.map +0 -1
  228. package/dist/generators/context.generator.d.ts +0 -9
  229. package/dist/generators/context.generator.js.map +0 -1
  230. package/dist/generators/context.handler.d.ts +0 -9
  231. package/dist/generators/context.handler.js +0 -89
  232. package/dist/generators/context.handler.js.map +0 -1
  233. package/dist/generators/decorator.generator.d.ts +0 -7
  234. package/dist/generators/decorator.generator.js.map +0 -1
  235. package/dist/generators/decorator.handler.d.ts +0 -11
  236. package/dist/generators/decorator.handler.js +0 -80
  237. package/dist/generators/decorator.handler.js.map +0 -1
  238. package/dist/generators/middleware.generator.d.ts +0 -12
  239. package/dist/generators/middleware.generator.js.map +0 -1
  240. package/dist/generators/middleware.handler.d.ts +0 -12
  241. package/dist/generators/middleware.handler.js +0 -105
  242. package/dist/generators/middleware.handler.js.map +0 -1
  243. package/dist/generators/router.generator.d.ts +0 -9
  244. package/dist/generators/router.generator.js.map +0 -1
  245. package/dist/generators/serializer.handler.d.ts +0 -11
  246. package/dist/generators/serializer.handler.js +0 -87
  247. package/dist/generators/serializer.handler.js.map +0 -1
  248. package/dist/generators/trpc.generator.d.ts +0 -19
  249. package/dist/generators/trpc.generator.js.map +0 -1
  250. package/dist/generators/types/index.ts +0 -1
  251. package/dist/handlers/context.handler.d.ts +0 -9
  252. package/dist/handlers/context.handler.js +0 -89
  253. package/dist/handlers/context.handler.js.map +0 -1
  254. package/dist/handlers/decorator.handler.d.ts +0 -11
  255. package/dist/handlers/decorator.handler.js +0 -80
  256. package/dist/handlers/decorator.handler.js.map +0 -1
  257. package/dist/handlers/middleware.handler.d.ts +0 -12
  258. package/dist/handlers/middleware.handler.js +0 -105
  259. package/dist/handlers/middleware.handler.js.map +0 -1
  260. package/dist/handlers/serializer.handler.d.ts +0 -11
  261. package/dist/handlers/serializer.handler.js +0 -87
  262. package/dist/handlers/serializer.handler.js.map +0 -1
  263. package/dist/index.js.map +0 -1
  264. package/dist/interfaces/context.interface.js.map +0 -1
  265. package/dist/interfaces/factory.interface.d.ts +0 -59
  266. package/dist/interfaces/factory.interface.js.map +0 -1
  267. package/dist/interfaces/generator.interface.d.ts +0 -21
  268. package/dist/interfaces/generator.interface.js.map +0 -1
  269. package/dist/interfaces/index.js.map +0 -1
  270. package/dist/interfaces/middleware.interface.d.ts +0 -19
  271. package/dist/interfaces/middleware.interface.js.map +0 -1
  272. package/dist/interfaces/module-options.interface.d.ts +0 -14
  273. package/dist/interfaces/module-options.interface.js.map +0 -1
  274. package/dist/interfaces/procedure-options.interface.js.map +0 -1
  275. package/dist/trpc.constants.d.ts +0 -7
  276. package/dist/trpc.constants.js.map +0 -1
  277. package/dist/trpc.driver.d.ts +0 -14
  278. package/dist/trpc.driver.js.map +0 -1
  279. package/dist/trpc.enum.d.ts +0 -4
  280. package/dist/trpc.enum.js.map +0 -1
  281. package/dist/trpc.generator.d.ts +0 -24
  282. package/dist/trpc.generator.js +0 -114
  283. package/dist/trpc.generator.js.map +0 -1
  284. package/dist/trpc.module.d.ts +0 -10
  285. package/dist/trpc.module.js.map +0 -1
  286. package/dist/types/index.ts +0 -5
  287. package/dist/utils/__tests__/file.util.spec.d.ts +0 -1
  288. package/dist/utils/__tests__/file.util.spec.js +0 -73
  289. package/dist/utils/__tests__/file.util.spec.js.map +0 -1
  290. package/dist/utils/file.util.d.ts +0 -5
  291. package/dist/utils/file.util.js.map +0 -1
  292. package/dist/utils/type.util.d.ts +0 -5
  293. package/dist/utils/type.util.js.map +0 -1
  294. package/dist/utils/validate-each.util.d.ts +0 -8
  295. package/dist/utils/validate-each.util.js.map +0 -1
  296. /package/{dist/index.d.ts → lib/index.ts} +0 -0
  297. /package/{dist/interfaces/index.d.ts → lib/interfaces/index.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/context.decorator.ts"],"names":[],"mappings":"AAMA,wBAAgB,GAAG,IAAI,kBAAkB,CA2BxC"}
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Ctx = void 0;
3
+ exports.Ctx = Ctx;
4
4
  const factory_interface_1 = require("../interfaces/factory.interface");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
6
  function Ctx() {
7
7
  return (target, propertyKey, parameterIndex) => {
8
8
  if (propertyKey != null && typeof parameterIndex === 'number') {
9
- const existingParams = Reflect.getMetadata(trpc_constants_1.PROCEDURE_PARAM_METADATA_KEY, target, propertyKey) ||
10
- [];
9
+ const existingParams = Reflect.getMetadata(trpc_constants_1.PROCEDURE_PARAM_METADATA_KEY, target, propertyKey) || [];
11
10
  const procedureParamMetadata = {
12
11
  type: factory_interface_1.ProcedureParamDecoratorType.Ctx,
13
12
  index: parameterIndex,
@@ -17,5 +16,3 @@ function Ctx() {
17
16
  }
18
17
  };
19
18
  }
20
- exports.Ctx = Ctx;
21
- //# sourceMappingURL=context.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AAGnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
@@ -1,27 +1,15 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./router.decorator"), exports);
18
- __exportStar(require("./middlewares.decorator"), exports);
19
- __exportStar(require("./mutation.decorator"), exports);
20
- __exportStar(require("./query.decorator"), exports);
21
- __exportStar(require("./options.decorator"), exports);
22
- __exportStar(require("./context.decorator"), exports);
23
- __exportStar(require("./input.decorator"), exports);
24
- __exportStar(require("./raw-input.decorator"), exports);
25
- __exportStar(require("./type.decorator"), exports);
26
- __exportStar(require("./path.decorator"), exports);
27
- //# sourceMappingURL=index.js.map
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./router.decorator"), exports);
5
+ // Procedure Decorators
6
+ tslib_1.__exportStar(require("./middlewares.decorator"), exports);
7
+ tslib_1.__exportStar(require("./mutation.decorator"), exports);
8
+ tslib_1.__exportStar(require("./query.decorator"), exports);
9
+ // Procedure Param Decorators
10
+ tslib_1.__exportStar(require("./options.decorator"), exports);
11
+ tslib_1.__exportStar(require("./context.decorator"), exports);
12
+ tslib_1.__exportStar(require("./input.decorator"), exports);
13
+ tslib_1.__exportStar(require("./raw-input.decorator"), exports);
14
+ tslib_1.__exportStar(require("./type.decorator"), exports);
15
+ tslib_1.__exportStar(require("./path.decorator"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/input.decorator.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAyBtD"}
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Input = void 0;
3
+ exports.Input = Input;
4
4
  const factory_interface_1 = require("../interfaces/factory.interface");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
+ /**
7
+ * Input procedure parameter decorator. Extracts the `input` parameter out of the procedure `opts`.
8
+ *
9
+ * @param key string to be used extracting a specific input key - `input[key]`.
10
+ *
11
+ * @see [Parameter Decorators](https://www.nestjs-trpc.io/docs/routers#parameter-decorators)
12
+ *
13
+ * @publicApi
14
+ */
6
15
  function Input(key) {
7
16
  return (target, propertyKey, parameterIndex) => {
8
17
  if (propertyKey != null && typeof parameterIndex === 'number') {
@@ -18,5 +27,3 @@ function Input(key) {
18
27
  }
19
28
  };
20
29
  }
21
- exports.Input = Input;
22
- //# sourceMappingURL=input.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middlewares.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/middlewares.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CACzB,UAAU,CAAC,EAAE,cAAc,GAAG,QAAQ,GACrC,eAAe,GAAG,cAAc,CAkClC"}
@@ -1,9 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Middlewares = void 0;
3
+ exports.Middlewares = Middlewares;
4
4
  const trpc_constants_1 = require("../trpc.constants");
5
5
  const lodash_1 = require("lodash");
6
6
  const validate_each_util_1 = require("../utils/validate-each.util");
7
+ /**
8
+ * TODO: Generate Return Context Type.
9
+ *
10
+ * Decorator that binds middlewares to the scope of the router or a procedure,
11
+ * depending on its context.
12
+ *
13
+ * When `@Middlewares` is used at the router level, the middleware will be
14
+ * applied to every handler (method) in the router.
15
+ *
16
+ * When `@Middlewares` is used at the individual handler level, the middleware
17
+ * will apply only to that specific method.
18
+ *
19
+ * @param middleware a single middleware instance or class, or a list of middleware instances
20
+ * or classes.
21
+ *
22
+ * @see [Middlewares](https://nestjs-trpc.io/docs/middlewares)
23
+ *
24
+ * @publicApi
25
+ */
7
26
  function Middlewares(middleware) {
8
27
  return (target, key, descriptor) => {
9
28
  const isMiddlewareValid = (middleware) => middleware &&
@@ -19,5 +38,3 @@ function Middlewares(middleware) {
19
38
  return target;
20
39
  };
21
40
  }
22
- exports.Middlewares = Middlewares;
23
- //# sourceMappingURL=middlewares.decorator.js.map
@@ -1,5 +1,21 @@
1
1
  import { ZodSchema } from 'zod';
2
+ /**
3
+ * Decorator that marks a router class method as a TRPC mutation procedure that can receive inbound
4
+ * requests and produce responses.
5
+ *
6
+ * An TRPC query procedure is mainly responsible for actions that modify or creates server-side data.
7
+ * for example `Mutation /trpc/userRouter.createUser`.
8
+ *
9
+ * @param {object} args configuration object specifying:
10
+ * - `input` - defines a `ZodSchema` validation logic for the input.
11
+ * - `output` - defines a `ZodSchema` validation logic for the output.
12
+ *
13
+ * @see [Method Decorators](https://nestjs-trpc.io/docs/routers#procedures)
14
+ *
15
+ * @publicApi
16
+ */
2
17
  export declare function Mutation(args?: {
3
18
  input?: ZodSchema;
4
19
  output?: ZodSchema;
5
- }): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol | undefined, descriptor?: TypedPropertyDescriptor<Y> | undefined) => void;
20
+ }): any;
21
+ //# sourceMappingURL=mutation.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/mutation.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAKhC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,OAOxE"}
@@ -1,14 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mutation = void 0;
3
+ exports.Mutation = Mutation;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
6
  const trpc_enum_1 = require("../trpc.enum");
7
+ /**
8
+ * Decorator that marks a router class method as a TRPC mutation procedure that can receive inbound
9
+ * requests and produce responses.
10
+ *
11
+ * An TRPC query procedure is mainly responsible for actions that modify or creates server-side data.
12
+ * for example `Mutation /trpc/userRouter.createUser`.
13
+ *
14
+ * @param {object} args configuration object specifying:
15
+ * - `input` - defines a `ZodSchema` validation logic for the input.
16
+ * - `output` - defines a `ZodSchema` validation logic for the output.
17
+ *
18
+ * @see [Method Decorators](https://nestjs-trpc.io/docs/routers#procedures)
19
+ *
20
+ * @publicApi
21
+ */
7
22
  function Mutation(args) {
8
23
  return (0, common_1.applyDecorators)(...[
9
24
  (0, common_1.SetMetadata)(trpc_constants_1.PROCEDURE_TYPE_KEY, trpc_enum_1.ProcedureType.Mutation),
10
25
  (0, common_1.SetMetadata)(trpc_constants_1.PROCEDURE_METADATA_KEY, args),
11
26
  ]);
12
27
  }
13
- exports.Mutation = Mutation;
14
- //# sourceMappingURL=mutation.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/options.decorator.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,kBAAkB,CAwB5C"}
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Options = void 0;
3
+ exports.Options = Options;
4
4
  const factory_interface_1 = require("../interfaces/factory.interface");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
+ /**
7
+ * Options procedure parameter decorator. Extracts the root `opts` parameter out of the procedure.
8
+ *
9
+ * @see [Parameter Decorators](https://www.nestjs-trpc.io/docs/routers#parameter-decorators)
10
+ *
11
+ * @publicApi
12
+ */
6
13
  function Options() {
7
14
  return (target, propertyKey, parameterIndex) => {
8
15
  if (propertyKey != null) {
@@ -17,5 +24,3 @@ function Options() {
17
24
  }
18
25
  };
19
26
  }
20
- exports.Options = Options;
21
- //# sourceMappingURL=options.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/path.decorator.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAgB,IAAI,IAAI,kBAAkB,CAwBzC"}
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Path = void 0;
3
+ exports.Path = Path;
4
4
  const factory_interface_1 = require("../interfaces/factory.interface");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
+ /**
7
+ * Path procedure parameter decorator. Extracts the `path` parameter out of the procedure `opts`.
8
+ *
9
+ * @see [Parameter Decorators](https://www.nestjs-trpc.io/docs/routers#parameter-decorators)
10
+ *
11
+ * @publicApi
12
+ */
6
13
  function Path() {
7
14
  return (target, propertyKey, parameterIndex) => {
8
15
  if (propertyKey != null) {
@@ -17,5 +24,3 @@ function Path() {
17
24
  }
18
25
  };
19
26
  }
20
- exports.Path = Path;
21
- //# sourceMappingURL=path.decorator.js.map
@@ -1,5 +1,21 @@
1
1
  import { ZodSchema } from 'zod';
2
+ /**
3
+ * Decorator that marks a router class method as a TRPC query procedure that can receive inbound
4
+ * requests and produce responses.
5
+ *
6
+ * An TRPC query procedure is mainly responsible for actions that retrieve data.
7
+ * for example `Query /trpc/userRouter.getUsers`.
8
+ *
9
+ * @param {object} args configuration object specifying:
10
+ * - `input` - defines a `ZodSchema` validation logic for the input.
11
+ * - `output` - defines a `ZodSchema` validation logic for the output.
12
+ *
13
+ * @see [Method Decorators](https://nestjs-trpc.io/docs/routers#procedures)
14
+ *
15
+ * @publicApi
16
+ */
2
17
  export declare function Query(args?: {
3
18
  input?: ZodSchema;
4
19
  output?: ZodSchema;
5
- }): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol | undefined, descriptor?: TypedPropertyDescriptor<Y> | undefined) => void;
20
+ }): any;
21
+ //# sourceMappingURL=query.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/query.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAKhC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,OAOrE"}
@@ -1,14 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Query = void 0;
3
+ exports.Query = Query;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
6
  const trpc_enum_1 = require("../trpc.enum");
7
+ /**
8
+ * Decorator that marks a router class method as a TRPC query procedure that can receive inbound
9
+ * requests and produce responses.
10
+ *
11
+ * An TRPC query procedure is mainly responsible for actions that retrieve data.
12
+ * for example `Query /trpc/userRouter.getUsers`.
13
+ *
14
+ * @param {object} args configuration object specifying:
15
+ * - `input` - defines a `ZodSchema` validation logic for the input.
16
+ * - `output` - defines a `ZodSchema` validation logic for the output.
17
+ *
18
+ * @see [Method Decorators](https://nestjs-trpc.io/docs/routers#procedures)
19
+ *
20
+ * @publicApi
21
+ */
7
22
  function Query(args) {
8
23
  return (0, common_1.applyDecorators)(...[
9
24
  (0, common_1.SetMetadata)(trpc_constants_1.PROCEDURE_TYPE_KEY, trpc_enum_1.ProcedureType.Query),
10
25
  (0, common_1.SetMetadata)(trpc_constants_1.PROCEDURE_METADATA_KEY, args),
11
26
  ]);
12
27
  }
13
- exports.Query = Query;
14
- //# sourceMappingURL=query.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-input.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/raw-input.decorator.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAgB,QAAQ,IAAI,kBAAkB,CAwB7C"}
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RawInput = void 0;
3
+ exports.RawInput = RawInput;
4
4
  const factory_interface_1 = require("../interfaces/factory.interface");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
+ /**
7
+ * Raw Input procedure parameter decorator. Extracts the `rawInput` parameter out of the procedure `opts`.
8
+ *
9
+ * @see [Parameter Decorators](https://www.nestjs-trpc.io/docs/routers#parameter-decorators)
10
+ *
11
+ * @publicApi
12
+ */
6
13
  function RawInput() {
7
14
  return (target, propertyKey, parameterIndex) => {
8
15
  if (propertyKey != null) {
@@ -17,5 +24,3 @@ function RawInput() {
17
24
  }
18
25
  };
19
26
  }
20
- exports.RawInput = RawInput;
21
- //# sourceMappingURL=raw-input.decorator.js.map
@@ -1,3 +1,20 @@
1
+ /**
2
+ * Decorator that marks a class as a TRPC router that can receive inbound
3
+ * requests and produce responses.
4
+ *
5
+ * An TRPC Router responds to inbound HTTP Requests and produces HTTP Responses.
6
+ * It defines a class that provides the context for one or more related procedures that correspond to HTTP request methods and associated routes
7
+ * for example `Query /trpc/userRouter.getUsers`, `Mutation /trpc/userRouter.createUser`.
8
+ *
9
+ *
10
+ * @param {object} args configuration object specifying:
11
+ * - `alias` - string that defines a router alias. The alias is used both in the auto schema file generation, and for the actual api access.
12
+ *
13
+ * @see [Routers](https://nestjs-trpc.io/docs/routers)
14
+ *
15
+ * @publicApi
16
+ */
1
17
  export declare function Router(args?: {
2
18
  alias?: string;
3
- }): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol | undefined, descriptor?: TypedPropertyDescriptor<Y> | undefined) => void;
19
+ }): any;
20
+ //# sourceMappingURL=router.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/router.decorator.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,OAI/C"}
@@ -1,10 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Router = void 0;
3
+ exports.Router = Router;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
+ /**
7
+ * Decorator that marks a class as a TRPC router that can receive inbound
8
+ * requests and produce responses.
9
+ *
10
+ * An TRPC Router responds to inbound HTTP Requests and produces HTTP Responses.
11
+ * It defines a class that provides the context for one or more related procedures that correspond to HTTP request methods and associated routes
12
+ * for example `Query /trpc/userRouter.getUsers`, `Mutation /trpc/userRouter.createUser`.
13
+ *
14
+ *
15
+ * @param {object} args configuration object specifying:
16
+ * - `alias` - string that defines a router alias. The alias is used both in the auto schema file generation, and for the actual api access.
17
+ *
18
+ * @see [Routers](https://nestjs-trpc.io/docs/routers)
19
+ *
20
+ * @publicApi
21
+ */
6
22
  function Router(args) {
7
- return (0, common_1.applyDecorators)(...[(0, common_1.SetMetadata)(trpc_constants_1.ROUTER_METADATA_KEY, { alias: args === null || args === void 0 ? void 0 : args.alias })]);
23
+ return (0, common_1.applyDecorators)(...[(0, common_1.SetMetadata)(trpc_constants_1.ROUTER_METADATA_KEY, { alias: args?.alias })]);
8
24
  }
9
- exports.Router = Router;
10
- //# sourceMappingURL=router.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.decorator.d.ts","sourceRoot":"","sources":["../../lib/decorators/type.decorator.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAgB,IAAI,IAAI,kBAAkB,CAwBzC"}
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Type = void 0;
3
+ exports.Type = Type;
4
4
  const factory_interface_1 = require("../interfaces/factory.interface");
5
5
  const trpc_constants_1 = require("../trpc.constants");
6
+ /**
7
+ * Type procedure parameter decorator. Extracts the `type` parameter out of the procedure `opts`.
8
+ *
9
+ * @see [Parameter Decorators](https://www.nestjs-trpc.io/docs/routers#parameter-decorators)
10
+ *
11
+ * @publicApi
12
+ */
6
13
  function Type() {
7
14
  return (target, propertyKey, parameterIndex) => {
8
15
  if (propertyKey != null) {
@@ -17,5 +24,3 @@ function Type() {
17
24
  }
18
25
  };
19
26
  }
20
- exports.Type = Type;
21
- //# sourceMappingURL=type.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.factory.d.ts","sourceRoot":"","sources":["../../lib/factories/middleware.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,qBACa,iBAAiB;IAE5B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAG/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoB;IAErD,cAAc,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;CAmB/C"}
@@ -1,15 +1,7 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.MiddlewareFactory = void 0;
4
+ const tslib_1 = require("tslib");
13
5
  const common_1 = require("@nestjs/common");
14
6
  const router_factory_1 = require("./router.factory");
15
7
  const procedure_factory_1 = require("./procedure.factory");
@@ -24,19 +16,19 @@ let MiddlewareFactory = class MiddlewareFactory {
24
16
  return procedure.middlewares != null ? procedure.middlewares : [];
25
17
  });
26
18
  });
19
+ // Returns a unique middleware array since we need to generate types only one time.
27
20
  return [...new Set(middlewares)];
28
21
  }
29
22
  };
30
- __decorate([
23
+ exports.MiddlewareFactory = MiddlewareFactory;
24
+ tslib_1.__decorate([
31
25
  (0, common_1.Inject)(router_factory_1.RouterFactory),
32
- __metadata("design:type", router_factory_1.RouterFactory)
26
+ tslib_1.__metadata("design:type", router_factory_1.RouterFactory)
33
27
  ], MiddlewareFactory.prototype, "routerFactory", void 0);
34
- __decorate([
28
+ tslib_1.__decorate([
35
29
  (0, common_1.Inject)(procedure_factory_1.ProcedureFactory),
36
- __metadata("design:type", procedure_factory_1.ProcedureFactory)
30
+ tslib_1.__metadata("design:type", procedure_factory_1.ProcedureFactory)
37
31
  ], MiddlewareFactory.prototype, "procedureFactory", void 0);
38
- MiddlewareFactory = __decorate([
32
+ exports.MiddlewareFactory = MiddlewareFactory = tslib_1.__decorate([
39
33
  (0, common_1.Injectable)()
40
34
  ], MiddlewareFactory);
41
- exports.MiddlewareFactory = MiddlewareFactory;
42
- //# sourceMappingURL=middleware.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"procedure.factory.d.ts","sourceRoot":"","sources":["../../lib/factories/procedure.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,SAAS,EAAE,MAAM,cAAc,CAAC;AAO1D,OAAO,EACL,wBAAwB,EAGxB,mBAAmB,EAEpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,cAAc,EAAoB,MAAM,eAAe,CAAC;AAGjE,qBACa,gBAAgB;IAOf,OAAO,CAAC,SAAS;IAL7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAG/C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmB;gBAE/B,SAAS,EAAE,SAAS;IAExC,aAAa,CACX,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAClC,KAAK,CAAC,wBAAwB,CAAC;IAMlC,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,wBAAwB;IAuBhC,mBAAmB,CACjB,UAAU,EAAE,KAAK,CAAC,wBAAwB,CAAC,EAC3C,QAAQ,EAAE,GAAG,EACb,oBAAoB,EAAE,MAAM,EAC5B,gBAAgB,EAAE,mBAAmB,EACrC,iBAAiB,EAAE,cAAc,GAAG,SAAS,GAC5C,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAiCtB,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,6BAA6B;IAYrC,OAAO,CAAC,wBAAwB;IA2BhC,OAAO,CAAC,yBAAyB;CA4BlC"}
@@ -1,15 +1,8 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
2
+ var _a, _b, _c;
11
3
  Object.defineProperty(exports, "__esModule", { value: true });
12
4
  exports.ProcedureFactory = void 0;
5
+ const tslib_1 = require("tslib");
13
6
  const common_1 = require("@nestjs/common");
14
7
  const core_1 = require("@nestjs/core");
15
8
  const trpc_constants_1 = require("../trpc.constants");
@@ -30,8 +23,8 @@ let ProcedureFactory = class ProcedureFactory {
30
23
  const metadata = Reflect.getMetadata(trpc_constants_1.PROCEDURE_METADATA_KEY, callback);
31
24
  const middlewares = Reflect.getMetadata(trpc_constants_1.MIDDLEWARE_KEY, callback);
32
25
  return {
33
- input: metadata === null || metadata === void 0 ? void 0 : metadata.input,
34
- output: metadata === null || metadata === void 0 ? void 0 : metadata.output,
26
+ input: metadata?.input,
27
+ output: metadata?.output,
35
28
  middlewares,
36
29
  type,
37
30
  name: callback.name,
@@ -64,6 +57,7 @@ let ProcedureFactory = class ProcedureFactory {
64
57
  createCustomProcedureInstance(procedure, def) {
65
58
  const customProcedureInstance = this.moduleRef.get(def, { strict: false });
66
59
  if (typeof customProcedureInstance.use === 'function') {
60
+ //@ts-ignore
67
61
  return procedure.use((opts) => customProcedureInstance.use(opts));
68
62
  }
69
63
  return procedure;
@@ -75,13 +69,13 @@ let ProcedureFactory = class ProcedureFactory {
75
69
  const args = new Array(Math.max(...params.map((val) => val.index)) + 1)
76
70
  .fill(undefined)
77
71
  .map((_val, idx) => {
78
- var _a;
79
72
  const param = params.find((param) => param.index === idx);
80
73
  if (param == null) {
81
74
  return undefined;
82
75
  }
83
76
  if (param.type === factory_interface_1.ProcedureParamDecoratorType.Input) {
84
- return param.key != null ? (_a = opts[param.type]) === null || _a === void 0 ? void 0 : _a[param.key] : opts[param.type];
77
+ //@ts-ignore
78
+ return param.key != null ? opts[param.type]?.[param.key] : opts[param.type];
85
79
  }
86
80
  if (param.type === factory_interface_1.ProcedureParamDecoratorType.Options) {
87
81
  return opts;
@@ -101,23 +95,22 @@ let ProcedureFactory = class ProcedureFactory {
101
95
  return routerInstance[procedureName](...this.serializeProcedureParams(opts, params));
102
96
  };
103
97
  return type === 'mutation'
104
- ?
98
+ ? //@ts-ignore
105
99
  procedureWithOutput.mutation(procedureInvocation)
106
- :
100
+ : //@ts-ignore
107
101
  procedureWithOutput.query(procedureInvocation);
108
102
  }
109
103
  };
110
- __decorate([
104
+ exports.ProcedureFactory = ProcedureFactory;
105
+ tslib_1.__decorate([
111
106
  (0, common_1.Inject)(common_1.ConsoleLogger),
112
- __metadata("design:type", common_1.ConsoleLogger)
107
+ tslib_1.__metadata("design:type", typeof (_b = typeof common_1.ConsoleLogger !== "undefined" && common_1.ConsoleLogger) === "function" ? _b : Object)
113
108
  ], ProcedureFactory.prototype, "consoleLogger", void 0);
114
- __decorate([
109
+ tslib_1.__decorate([
115
110
  (0, common_1.Inject)(core_1.MetadataScanner),
116
- __metadata("design:type", core_1.MetadataScanner)
111
+ tslib_1.__metadata("design:type", typeof (_c = typeof core_1.MetadataScanner !== "undefined" && core_1.MetadataScanner) === "function" ? _c : Object)
117
112
  ], ProcedureFactory.prototype, "metadataScanner", void 0);
118
- ProcedureFactory = __decorate([
113
+ exports.ProcedureFactory = ProcedureFactory = tslib_1.__decorate([
119
114
  (0, common_1.Injectable)(),
120
- __metadata("design:paramtypes", [core_1.ModuleRef])
115
+ tslib_1.__metadata("design:paramtypes", [typeof (_a = typeof core_1.ModuleRef !== "undefined" && core_1.ModuleRef) === "function" ? _a : Object])
121
116
  ], ProcedureFactory);
122
- exports.ProcedureFactory = ProcedureFactory;
123
- //# sourceMappingURL=procedure.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.factory.d.ts","sourceRoot":"","sources":["../../lib/factories/router.factory.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,cAAc,EACd,mBAAmB,EAEpB,MAAM,iCAAiC,CAAC;AAIzC,qBACa,aAAa;IAExB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAG/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoB;IAGrD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoB;IAErD,UAAU,IAAI,KAAK,CAAC,cAAc,CAAC;IAenC,OAAO,CAAC,wBAAwB;IA0BhC,eAAe,CAAC,SAAS,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CA+BrE"}
@@ -1,15 +1,8 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
2
+ var _a, _b;
11
3
  Object.defineProperty(exports, "__esModule", { value: true });
12
4
  exports.RouterFactory = void 0;
5
+ const tslib_1 = require("tslib");
13
6
  const common_1 = require("@nestjs/common");
14
7
  const core_1 = require("@nestjs/core");
15
8
  const lodash_1 = require("lodash");
@@ -30,19 +23,22 @@ let RouterFactory = class RouterFactory {
30
23
  }
31
24
  extractRouterFromWrapper(wrapper) {
32
25
  const { instance, name } = wrapper;
26
+ if (instance == null) {
27
+ return null;
28
+ }
33
29
  const router = Reflect.getMetadata(trpc_constants_1.ROUTER_METADATA_KEY, instance.constructor);
34
- const middlewares = Reflect.getMetadata(trpc_constants_1.MIDDLEWARE_KEY, instance.constructor);
35
- if (router != null) {
36
- return { name, instance, alias: router.alias, middlewares };
30
+ if (router == null) {
31
+ return null;
37
32
  }
38
- return undefined;
33
+ const middlewares = Reflect.getMetadata(trpc_constants_1.MIDDLEWARE_KEY, instance.constructor);
34
+ return { name, instance, alias: router.alias, middlewares };
39
35
  }
40
36
  serializeRoutes(procedure) {
41
37
  const routers = this.getRouters();
42
38
  const routerSchema = Object.create({});
43
39
  routers.forEach((route) => {
44
40
  const { instance, name, middlewares, alias } = route;
45
- const camelCasedRouterName = (0, lodash_1.camelCase)(alias !== null && alias !== void 0 ? alias : name);
41
+ const camelCasedRouterName = (0, lodash_1.camelCase)(alias ?? name);
46
42
  const prototype = Object.getPrototypeOf(instance);
47
43
  const procedures = this.procedureFactory.getProcedures(instance, prototype);
48
44
  this.consoleLogger.log(`Router ${name} as ${camelCasedRouterName}.`, 'Router Factory');
@@ -52,20 +48,19 @@ let RouterFactory = class RouterFactory {
52
48
  return routerSchema;
53
49
  }
54
50
  };
55
- __decorate([
51
+ exports.RouterFactory = RouterFactory;
52
+ tslib_1.__decorate([
56
53
  (0, common_1.Inject)(common_1.ConsoleLogger),
57
- __metadata("design:type", common_1.ConsoleLogger)
54
+ tslib_1.__metadata("design:type", typeof (_a = typeof common_1.ConsoleLogger !== "undefined" && common_1.ConsoleLogger) === "function" ? _a : Object)
58
55
  ], RouterFactory.prototype, "consoleLogger", void 0);
59
- __decorate([
56
+ tslib_1.__decorate([
60
57
  (0, common_1.Inject)(core_1.ModulesContainer),
61
- __metadata("design:type", core_1.ModulesContainer)
58
+ tslib_1.__metadata("design:type", typeof (_b = typeof core_1.ModulesContainer !== "undefined" && core_1.ModulesContainer) === "function" ? _b : Object)
62
59
  ], RouterFactory.prototype, "modulesContainer", void 0);
63
- __decorate([
60
+ tslib_1.__decorate([
64
61
  (0, common_1.Inject)(procedure_factory_1.ProcedureFactory),
65
- __metadata("design:type", procedure_factory_1.ProcedureFactory)
62
+ tslib_1.__metadata("design:type", procedure_factory_1.ProcedureFactory)
66
63
  ], RouterFactory.prototype, "procedureFactory", void 0);
67
- RouterFactory = __decorate([
64
+ exports.RouterFactory = RouterFactory = tslib_1.__decorate([
68
65
  (0, common_1.Injectable)()
69
66
  ], RouterFactory);
70
- exports.RouterFactory = RouterFactory;
71
- //# sourceMappingURL=router.factory.js.map