type-graphql 2.0.0-beta.2 → 2.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +42 -39
  3. package/{dist → build/cjs}/decorators/Arg.js +2 -3
  4. package/{dist → build/cjs}/decorators/Args.js +2 -3
  5. package/{dist → build/cjs}/decorators/ArgsType.js +0 -1
  6. package/{dist → build/cjs}/decorators/Authorized.js +2 -3
  7. package/{dist → build/cjs}/decorators/Ctx.js +1 -2
  8. package/build/cjs/decorators/Directive.js +37 -0
  9. package/{dist → build/cjs}/decorators/Extensions.js +1 -2
  10. package/{dist → build/cjs}/decorators/Field.js +3 -4
  11. package/{dist → build/cjs}/decorators/FieldResolver.js +1 -4
  12. package/{dist → build/cjs}/decorators/Info.js +1 -2
  13. package/{dist → build/cjs}/decorators/InputType.js +1 -2
  14. package/{dist → build/cjs}/decorators/InterfaceType.js +1 -2
  15. package/{dist → build/cjs}/decorators/Mutation.js +2 -3
  16. package/{dist → build/cjs}/decorators/ObjectType.js +1 -2
  17. package/{dist → build/cjs}/decorators/Query.js +2 -3
  18. package/{dist → build/cjs}/decorators/Resolver.js +0 -1
  19. package/{dist → build/cjs}/decorators/Root.js +2 -4
  20. package/{dist → build/cjs}/decorators/Subscription.js +4 -4
  21. package/{dist → build/cjs}/decorators/UseMiddleware.js +2 -3
  22. package/{dist → build/cjs}/decorators/createMethodDecorator.js +0 -1
  23. package/{dist → build/cjs}/decorators/createParamDecorator.js +1 -2
  24. package/{dist → build/cjs}/decorators/enums.js +0 -1
  25. package/{dist → build/cjs}/decorators/index.js +1 -4
  26. package/{dist → build/cjs}/decorators/types.js +0 -1
  27. package/{dist → build/cjs}/decorators/unions.js +0 -1
  28. package/{dist → build/cjs}/errors/CannotDetermineGraphQLTypeError.js +0 -1
  29. package/{dist → build/cjs}/errors/ConflictingDefaultValuesError.js +0 -1
  30. package/{dist → build/cjs}/errors/GeneratingSchemaError.js +0 -1
  31. package/{dist → build/cjs}/errors/InterfaceResolveTypeError.js +0 -1
  32. package/{dist → build/cjs}/errors/InvalidDirectiveError.js +0 -1
  33. package/build/cjs/errors/MissingPubSubError.js +11 -0
  34. package/{dist → build/cjs}/errors/MissingSubscriptionTopicsError.js +0 -1
  35. package/{dist → build/cjs}/errors/NoExplicitTypeError.js +0 -1
  36. package/{dist → build/cjs}/errors/ReflectMetadataMissingError.js +0 -1
  37. package/{dist → build/cjs}/errors/SymbolKeysNotSupportedError.js +0 -1
  38. package/{dist → build/cjs}/errors/UnionResolveTypeError.js +0 -1
  39. package/{dist → build/cjs}/errors/UnmetGraphQLPeerDependencyError.js +3 -5
  40. package/{dist → build/cjs}/errors/WrongNullableListOptionError.js +0 -1
  41. package/{dist/errors → build/cjs/errors/graphql}/ArgumentValidationError.js +8 -4
  42. package/build/cjs/errors/graphql/AuthenticationError.js +15 -0
  43. package/build/cjs/errors/graphql/AuthorizationError.js +15 -0
  44. package/build/cjs/errors/graphql/index.js +6 -0
  45. package/{dist → build/cjs}/errors/index.js +2 -4
  46. package/{dist → build/cjs}/helpers/auth-middleware.js +2 -3
  47. package/{dist → build/cjs}/helpers/decorators.js +6 -11
  48. package/build/cjs/helpers/filesystem.js +33 -0
  49. package/{dist → build/cjs}/helpers/findType.js +9 -12
  50. package/{dist → build/cjs}/helpers/isThrowing.js +0 -1
  51. package/{dist → build/cjs}/helpers/params.js +3 -3
  52. package/{dist → build/cjs}/helpers/resolver-metadata.js +1 -2
  53. package/{dist → build/cjs}/helpers/returnTypes.js +0 -1
  54. package/{dist → build/cjs}/helpers/types.js +11 -18
  55. package/{dist → build/cjs}/helpers/utils.js +0 -1
  56. package/{dist → build/cjs}/index.js +1 -5
  57. package/build/cjs/metadata/definitions/authorized-metadata.js +2 -0
  58. package/build/cjs/metadata/definitions/class-metadata.js +2 -0
  59. package/build/cjs/metadata/definitions/directive-metadata.js +2 -0
  60. package/build/cjs/metadata/definitions/enum-metadata.js +2 -0
  61. package/build/cjs/metadata/definitions/extensions-metadata.js +2 -0
  62. package/build/cjs/metadata/definitions/field-metadata.js +2 -0
  63. package/{dist → build/cjs}/metadata/definitions/index.js +0 -1
  64. package/build/cjs/metadata/definitions/interface-class-metadata.js +2 -0
  65. package/build/cjs/metadata/definitions/middleware-metadata.js +2 -0
  66. package/build/cjs/metadata/definitions/object-class-metadata.js +2 -0
  67. package/build/cjs/metadata/definitions/param-metadata.js +2 -0
  68. package/build/cjs/metadata/definitions/resolver-metadata.js +2 -0
  69. package/build/cjs/metadata/definitions/union-metadata.js +2 -0
  70. package/build/cjs/metadata/getMetadataStorage.js +11 -0
  71. package/{dist → build/cjs}/metadata/index.js +0 -1
  72. package/{dist → build/cjs}/metadata/metadata-storage.js +11 -7
  73. package/{dist → build/cjs}/metadata/utils.js +16 -21
  74. package/{dist → build/cjs}/resolvers/convert-args.js +0 -8
  75. package/{dist → build/cjs}/resolvers/create.js +15 -25
  76. package/{dist → build/cjs}/resolvers/helpers.js +10 -19
  77. package/{dist → build/cjs}/resolvers/validate-arg.js +10 -8
  78. package/{dist → build/cjs}/scalars/aliases.js +0 -1
  79. package/build/cjs/scalars/index.js +8 -0
  80. package/{dist → build/cjs}/schema/build-context.js +2 -20
  81. package/{dist → build/cjs}/schema/definition-node.js +46 -50
  82. package/{dist → build/cjs}/schema/schema-generator.js +89 -84
  83. package/{dist → build/cjs}/schema/utils.js +0 -1
  84. package/build/cjs/shim.js +38 -0
  85. package/build/cjs/typings/Complexity.js +2 -0
  86. package/build/cjs/typings/ResolverInterface.js +2 -0
  87. package/build/cjs/typings/SubscribeResolverData.js +2 -0
  88. package/build/cjs/typings/SubscriptionHandlerData.js +2 -0
  89. package/build/cjs/typings/TypeResolver.js +2 -0
  90. package/build/cjs/typings/ValidatorFn.js +2 -0
  91. package/build/cjs/typings/auth-checker.js +2 -0
  92. package/build/cjs/typings/index.js +15 -0
  93. package/build/cjs/typings/legacy-decorators.js +2 -0
  94. package/build/cjs/typings/middleware.js +2 -0
  95. package/build/cjs/typings/resolver-data.js +2 -0
  96. package/build/cjs/typings/resolvers-map.js +2 -0
  97. package/build/cjs/typings/subscriptions.js +2 -0
  98. package/{dist/interfaces → build/cjs/typings/utils}/ClassType.js +0 -1
  99. package/build/cjs/typings/utils/Constructor.js +2 -0
  100. package/build/cjs/typings/utils/Except.js +2 -0
  101. package/build/cjs/typings/utils/IsEqual.js +2 -0
  102. package/{dist/interfaces → build/cjs/typings/utils}/Maybe.js +0 -1
  103. package/build/cjs/typings/utils/MaybePromise.js +2 -0
  104. package/build/cjs/typings/utils/MergeExclusive.js +2 -0
  105. package/build/cjs/typings/utils/NonEmptyArray.js +2 -0
  106. package/build/cjs/typings/utils/SetRequired.js +2 -0
  107. package/build/cjs/typings/utils/Simplify.js +2 -0
  108. package/build/cjs/typings/utils/index.js +13 -0
  109. package/{dist → build/cjs}/utils/buildSchema.js +20 -22
  110. package/{dist → build/cjs}/utils/buildTypeDefsAndResolvers.js +5 -6
  111. package/{dist → build/cjs}/utils/container.js +0 -6
  112. package/{dist → build/cjs}/utils/createResolversMap.js +29 -30
  113. package/{dist → build/cjs}/utils/emitSchemaDefinitionFile.js +5 -6
  114. package/build/cjs/utils/graphql-version.js +14 -0
  115. package/{dist → build/cjs}/utils/index.js +2 -1
  116. package/{dist → build/cjs}/utils/isPromiseLike.js +2 -2
  117. package/build/esm/decorators/Arg.js +26 -0
  118. package/build/esm/decorators/Args.js +16 -0
  119. package/build/esm/decorators/ArgsType.js +13 -0
  120. package/build/esm/decorators/Authorized.js +20 -0
  121. package/{dist/decorators/PubSub.js → build/esm/decorators/Ctx.js} +6 -7
  122. package/build/esm/decorators/Directive.js +37 -0
  123. package/{dist/decorators/Directive.js → build/esm/decorators/Extensions.js} +7 -9
  124. package/build/esm/decorators/Field.js +45 -0
  125. package/build/esm/decorators/FieldResolver.js +42 -0
  126. package/build/esm/decorators/Info.js +19 -0
  127. package/build/esm/decorators/InputType.js +16 -0
  128. package/build/esm/decorators/InterfaceType.js +19 -0
  129. package/build/esm/decorators/Mutation.js +14 -0
  130. package/build/esm/decorators/ObjectType.js +19 -0
  131. package/build/esm/decorators/Query.js +14 -0
  132. package/build/esm/decorators/Resolver.js +20 -0
  133. package/build/esm/decorators/Root.js +34 -0
  134. package/build/esm/decorators/Subscription.js +25 -0
  135. package/build/esm/decorators/UseMiddleware.js +20 -0
  136. package/build/esm/decorators/createMethodDecorator.js +8 -0
  137. package/build/esm/decorators/createParamDecorator.js +20 -0
  138. package/build/esm/decorators/enums.js +13 -0
  139. package/build/esm/decorators/index.js +49 -0
  140. package/build/esm/decorators/types.js +2 -0
  141. package/build/esm/decorators/unions.js +14 -0
  142. package/build/esm/errors/CannotDetermineGraphQLTypeError.js +21 -0
  143. package/build/esm/errors/ConflictingDefaultValuesError.js +12 -0
  144. package/build/esm/errors/GeneratingSchemaError.js +14 -0
  145. package/build/esm/errors/InterfaceResolveTypeError.js +11 -0
  146. package/build/esm/errors/InvalidDirectiveError.js +10 -0
  147. package/build/esm/errors/MissingPubSubError.js +11 -0
  148. package/build/esm/errors/MissingSubscriptionTopicsError.js +10 -0
  149. package/build/esm/errors/NoExplicitTypeError.js +19 -0
  150. package/build/esm/errors/ReflectMetadataMissingError.js +11 -0
  151. package/build/esm/errors/SymbolKeysNotSupportedError.js +10 -0
  152. package/build/esm/errors/UnionResolveTypeError.js +11 -0
  153. package/build/esm/errors/UnmetGraphQLPeerDependencyError.js +12 -0
  154. package/build/esm/errors/WrongNullableListOptionError.js +11 -0
  155. package/build/esm/errors/graphql/ArgumentValidationError.js +16 -0
  156. package/build/esm/errors/graphql/AuthenticationError.js +15 -0
  157. package/build/esm/errors/graphql/AuthorizationError.js +15 -0
  158. package/build/esm/errors/graphql/index.js +6 -0
  159. package/build/esm/errors/index.js +17 -0
  160. package/build/esm/helpers/auth-middleware.js +26 -0
  161. package/build/esm/helpers/decorators.js +38 -0
  162. package/build/esm/helpers/filesystem.js +33 -0
  163. package/build/esm/helpers/findType.js +51 -0
  164. package/build/esm/helpers/isThrowing.js +13 -0
  165. package/build/esm/helpers/params.js +29 -0
  166. package/build/esm/helpers/resolver-metadata.js +29 -0
  167. package/build/esm/helpers/returnTypes.js +5 -0
  168. package/build/esm/helpers/types.js +85 -0
  169. package/build/esm/helpers/utils.js +2 -0
  170. package/build/esm/index.js +9 -0
  171. package/build/esm/metadata/definitions/authorized-metadata.js +2 -0
  172. package/build/esm/metadata/definitions/class-metadata.js +2 -0
  173. package/build/esm/metadata/definitions/directive-metadata.js +2 -0
  174. package/build/esm/metadata/definitions/enum-metadata.js +2 -0
  175. package/build/esm/metadata/definitions/extensions-metadata.js +2 -0
  176. package/build/esm/metadata/definitions/field-metadata.js +2 -0
  177. package/build/esm/metadata/definitions/index.js +13 -0
  178. package/build/esm/metadata/definitions/interface-class-metadata.js +2 -0
  179. package/build/esm/metadata/definitions/middleware-metadata.js +2 -0
  180. package/build/esm/metadata/definitions/object-class-metadata.js +2 -0
  181. package/build/esm/metadata/definitions/param-metadata.js +2 -0
  182. package/build/esm/metadata/definitions/resolver-metadata.js +2 -0
  183. package/build/esm/metadata/definitions/union-metadata.js +2 -0
  184. package/build/esm/metadata/getMetadataStorage.js +11 -0
  185. package/build/esm/metadata/index.js +5 -0
  186. package/build/esm/metadata/metadata-storage.js +266 -0
  187. package/build/esm/metadata/utils.js +41 -0
  188. package/build/esm/package.json +1 -0
  189. package/build/esm/resolvers/convert-args.js +122 -0
  190. package/build/esm/resolvers/create.js +81 -0
  191. package/build/esm/resolvers/helpers.js +83 -0
  192. package/build/esm/resolvers/validate-arg.js +42 -0
  193. package/build/esm/scalars/aliases.js +7 -0
  194. package/build/esm/scalars/index.js +8 -0
  195. package/build/esm/schema/build-context.js +50 -0
  196. package/build/esm/schema/definition-node.js +129 -0
  197. package/build/esm/schema/schema-generator.js +574 -0
  198. package/build/esm/schema/utils.js +39 -0
  199. package/build/esm/shim.js +38 -0
  200. package/build/esm/typings/Complexity.js +2 -0
  201. package/build/esm/typings/ResolverInterface.js +2 -0
  202. package/build/esm/typings/SubscribeResolverData.js +2 -0
  203. package/build/esm/typings/SubscriptionHandlerData.js +2 -0
  204. package/build/esm/typings/TypeResolver.js +2 -0
  205. package/build/esm/typings/ValidatorFn.js +2 -0
  206. package/build/esm/typings/auth-checker.js +2 -0
  207. package/build/esm/typings/index.js +15 -0
  208. package/build/esm/typings/legacy-decorators.js +2 -0
  209. package/build/esm/typings/middleware.js +2 -0
  210. package/build/esm/typings/resolver-data.js +2 -0
  211. package/build/esm/typings/resolvers-map.js +2 -0
  212. package/build/esm/typings/subscriptions.js +2 -0
  213. package/build/esm/typings/utils/ClassType.js +2 -0
  214. package/build/esm/typings/utils/Constructor.js +2 -0
  215. package/build/esm/typings/utils/Except.js +2 -0
  216. package/build/esm/typings/utils/IsEqual.js +2 -0
  217. package/build/esm/typings/utils/Maybe.js +2 -0
  218. package/build/esm/typings/utils/MaybePromise.js +2 -0
  219. package/build/esm/typings/utils/MergeExclusive.js +2 -0
  220. package/build/esm/typings/utils/NonEmptyArray.js +2 -0
  221. package/build/esm/typings/utils/SetRequired.js +2 -0
  222. package/build/esm/typings/utils/Simplify.js +2 -0
  223. package/build/esm/typings/utils/index.js +13 -0
  224. package/build/esm/utils/buildSchema.js +46 -0
  225. package/build/esm/utils/buildTypeDefsAndResolvers.js +21 -0
  226. package/build/esm/utils/container.js +37 -0
  227. package/build/esm/utils/createResolversMap.js +72 -0
  228. package/build/esm/utils/emitSchemaDefinitionFile.js +29 -0
  229. package/build/esm/utils/graphql-version.js +14 -0
  230. package/build/esm/utils/index.js +17 -0
  231. package/build/esm/utils/isPromiseLike.js +7 -0
  232. package/{dist → build/typings}/decorators/Arg.d.ts +2 -2
  233. package/{dist → build/typings}/decorators/Args.d.ts +2 -2
  234. package/{dist → build/typings}/decorators/Authorized.d.ts +1 -1
  235. package/{dist → build/typings}/decorators/Ctx.d.ts +1 -1
  236. package/build/typings/decorators/Directive.d.ts +2 -0
  237. package/build/typings/decorators/Extensions.d.ts +3 -0
  238. package/{dist → build/typings}/decorators/Field.d.ts +1 -1
  239. package/{dist → build/typings}/decorators/FieldResolver.d.ts +1 -1
  240. package/build/typings/decorators/Info.d.ts +2 -0
  241. package/{dist → build/typings}/decorators/InputType.d.ts +1 -1
  242. package/{dist → build/typings}/decorators/InterfaceType.d.ts +1 -1
  243. package/{dist → build/typings}/decorators/Mutation.d.ts +1 -1
  244. package/{dist → build/typings}/decorators/ObjectType.d.ts +1 -1
  245. package/{dist → build/typings}/decorators/Query.d.ts +1 -1
  246. package/{dist → build/typings}/decorators/Resolver.d.ts +2 -2
  247. package/{dist → build/typings}/decorators/Root.d.ts +1 -1
  248. package/{dist → build/typings}/decorators/Subscription.d.ts +5 -5
  249. package/{dist → build/typings}/decorators/UseMiddleware.d.ts +2 -2
  250. package/build/typings/decorators/createMethodDecorator.d.ts +2 -0
  251. package/build/typings/decorators/createParamDecorator.d.ts +2 -0
  252. package/{dist → build/typings}/decorators/enums.d.ts +1 -1
  253. package/build/typings/decorators/index.d.ts +29 -0
  254. package/{dist → build/typings}/decorators/types.d.ts +9 -7
  255. package/build/typings/decorators/unions.d.ts +9 -0
  256. package/{dist → build/typings}/errors/ConflictingDefaultValuesError.d.ts +1 -1
  257. package/build/typings/errors/GeneratingSchemaError.d.ts +5 -0
  258. package/{dist → build/typings}/errors/InterfaceResolveTypeError.d.ts +1 -1
  259. package/build/typings/errors/MissingPubSubError.d.ts +3 -0
  260. package/{dist → build/typings}/errors/UnionResolveTypeError.d.ts +1 -1
  261. package/build/typings/errors/UnmetGraphQLPeerDependencyError.d.ts +3 -0
  262. package/{dist → build/typings}/errors/WrongNullableListOptionError.d.ts +1 -1
  263. package/build/typings/errors/graphql/ArgumentValidationError.d.ts +10 -0
  264. package/build/typings/errors/graphql/AuthenticationError.d.ts +8 -0
  265. package/build/typings/errors/graphql/AuthorizationError.d.ts +8 -0
  266. package/build/typings/errors/graphql/index.d.ts +3 -0
  267. package/build/typings/errors/index.d.ts +14 -0
  268. package/build/typings/helpers/auth-middleware.d.ts +4 -0
  269. package/{dist → build/typings}/helpers/decorators.d.ts +1 -1
  270. package/build/typings/helpers/filesystem.d.ts +2 -0
  271. package/{dist → build/typings}/helpers/findType.d.ts +1 -1
  272. package/{dist → build/typings}/helpers/params.d.ts +2 -2
  273. package/{dist → build/typings}/helpers/resolver-metadata.d.ts +2 -2
  274. package/{dist → build/typings}/helpers/types.d.ts +2 -2
  275. package/build/typings/helpers/utils.d.ts +2 -0
  276. package/build/typings/index.d.ts +6 -0
  277. package/{dist → build/typings}/metadata/definitions/class-metadata.d.ts +3 -3
  278. package/{dist → build/typings}/metadata/definitions/directive-metadata.d.ts +6 -0
  279. package/{dist → build/typings}/metadata/definitions/enum-metadata.d.ts +1 -1
  280. package/{dist → build/typings}/metadata/definitions/field-metadata.d.ts +6 -6
  281. package/build/typings/metadata/definitions/index.d.ts +10 -0
  282. package/build/typings/metadata/definitions/interface-class-metadata.d.ts +7 -0
  283. package/{dist → build/typings}/metadata/definitions/middleware-metadata.d.ts +1 -1
  284. package/build/typings/metadata/definitions/object-class-metadata.d.ts +4 -0
  285. package/build/typings/metadata/definitions/param-metadata.d.ts +44 -0
  286. package/build/typings/metadata/definitions/resolver-metadata.d.ts +43 -0
  287. package/{dist → build/typings}/metadata/definitions/union-metadata.d.ts +3 -3
  288. package/{dist → build/typings}/metadata/getMetadataStorage.d.ts +1 -1
  289. package/build/typings/metadata/index.d.ts +1 -0
  290. package/{dist → build/typings}/metadata/metadata-storage.d.ts +7 -5
  291. package/{dist → build/typings}/metadata/utils.d.ts +2 -2
  292. package/{dist → build/typings}/resolvers/convert-args.d.ts +2 -2
  293. package/{dist → build/typings}/resolvers/create.d.ts +3 -3
  294. package/build/typings/resolvers/helpers.d.ts +8 -0
  295. package/build/typings/resolvers/validate-arg.d.ts +4 -0
  296. package/build/typings/scalars/index.d.ts +2 -0
  297. package/{dist → build/typings}/schema/build-context.d.ts +11 -14
  298. package/{dist → build/typings}/schema/definition-node.d.ts +3 -3
  299. package/{dist → build/typings}/schema/schema-generator.d.ts +4 -4
  300. package/{dist → build/typings}/schema/utils.d.ts +1 -1
  301. package/{dist/browser-shim.ts → build/typings/shim.ts} +8 -9
  302. package/build/typings/typings/Complexity.d.ts +2 -0
  303. package/build/typings/typings/SubscribeResolverData.d.ts +8 -0
  304. package/build/typings/typings/SubscriptionHandlerData.d.ts +8 -0
  305. package/{dist/interfaces → build/typings/typings}/TypeResolver.d.ts +2 -3
  306. package/build/typings/typings/ValidatorFn.d.ts +13 -0
  307. package/build/typings/typings/auth-checker.d.ts +8 -0
  308. package/build/typings/typings/index.d.ts +13 -0
  309. package/{dist/interfaces/LegacyDecorators.d.ts → build/typings/typings/legacy-decorators.d.ts} +1 -1
  310. package/build/typings/typings/middleware.d.ts +8 -0
  311. package/build/typings/typings/resolver-data.d.ts +8 -0
  312. package/build/typings/typings/resolvers-map.d.ts +11 -0
  313. package/build/typings/typings/subscriptions.d.ts +10 -0
  314. package/build/typings/typings/utils/ClassType.d.ts +7 -0
  315. package/build/typings/typings/utils/Constructor.d.ts +4 -0
  316. package/build/typings/typings/utils/Except.d.ts +74 -0
  317. package/build/typings/typings/utils/IsEqual.d.ts +24 -0
  318. package/build/typings/typings/utils/Maybe.d.ts +1 -0
  319. package/{dist/interfaces/Maybe.d.ts → build/typings/typings/utils/MaybePromise.d.ts} +0 -1
  320. package/build/typings/typings/utils/MergeExclusive.d.ts +36 -0
  321. package/build/typings/typings/utils/NonEmptyArray.d.ts +1 -0
  322. package/build/typings/typings/utils/SetRequired.d.ts +26 -0
  323. package/build/typings/typings/utils/Simplify.d.ts +58 -0
  324. package/build/typings/typings/utils/index.d.ts +10 -0
  325. package/{dist → build/typings}/utils/buildSchema.d.ts +9 -9
  326. package/{dist → build/typings}/utils/buildTypeDefsAndResolvers.d.ts +3 -3
  327. package/{dist → build/typings}/utils/container.d.ts +2 -4
  328. package/build/typings/utils/createResolversMap.d.ts +3 -0
  329. package/{dist → build/typings}/utils/emitSchemaDefinitionFile.d.ts +1 -1
  330. package/build/typings/utils/graphql-version.d.ts +2 -0
  331. package/build/typings/utils/index.d.ts +8 -0
  332. package/build/typings/utils/isPromiseLike.d.ts +1 -0
  333. package/package.json +162 -107
  334. package/dist/browser-shim.js +0 -73
  335. package/dist/decorators/Directive.d.ts +0 -2
  336. package/dist/decorators/Extensions.d.ts +0 -3
  337. package/dist/decorators/Info.d.ts +0 -2
  338. package/dist/decorators/PubSub.d.ts +0 -2
  339. package/dist/decorators/createMethodDecorator.d.ts +0 -2
  340. package/dist/decorators/createParamDecorator.d.ts +0 -3
  341. package/dist/decorators/index.d.ts +0 -24
  342. package/dist/decorators/unions.d.ts +0 -9
  343. package/dist/errors/ArgumentValidationError.d.ts +0 -5
  344. package/dist/errors/ForbiddenError.d.ts +0 -3
  345. package/dist/errors/ForbiddenError.js +0 -11
  346. package/dist/errors/GeneratingSchemaError.d.ts +0 -5
  347. package/dist/errors/UnauthorizedError.d.ts +0 -3
  348. package/dist/errors/UnauthorizedError.js +0 -11
  349. package/dist/errors/UnmetGraphQLPeerDependencyError.d.ts +0 -3
  350. package/dist/errors/index.d.ts +0 -15
  351. package/dist/helpers/auth-middleware.d.ts +0 -4
  352. package/dist/helpers/filesystem.d.ts +0 -9
  353. package/dist/helpers/filesystem.js +0 -74
  354. package/dist/helpers/utils.d.ts +0 -2
  355. package/dist/index.d.ts +0 -7
  356. package/dist/interfaces/AuthChecker.d.ts +0 -8
  357. package/dist/interfaces/AuthChecker.js +0 -3
  358. package/dist/interfaces/ClassType.d.ts +0 -3
  359. package/dist/interfaces/Complexity.d.ts +0 -2
  360. package/dist/interfaces/Complexity.js +0 -3
  361. package/dist/interfaces/LegacyDecorators.js +0 -3
  362. package/dist/interfaces/Middleware.d.ts +0 -10
  363. package/dist/interfaces/Middleware.js +0 -3
  364. package/dist/interfaces/NonEmptyArray.d.ts +0 -1
  365. package/dist/interfaces/NonEmptyArray.js +0 -3
  366. package/dist/interfaces/Publisher.d.ts +0 -1
  367. package/dist/interfaces/Publisher.js +0 -3
  368. package/dist/interfaces/ResolverData.d.ts +0 -10
  369. package/dist/interfaces/ResolverData.js +0 -3
  370. package/dist/interfaces/ResolverFilterData.d.ts +0 -8
  371. package/dist/interfaces/ResolverFilterData.js +0 -3
  372. package/dist/interfaces/ResolverInterface.js +0 -3
  373. package/dist/interfaces/ResolverTopicData.d.ts +0 -3
  374. package/dist/interfaces/ResolverTopicData.js +0 -3
  375. package/dist/interfaces/TypeResolver.js +0 -3
  376. package/dist/interfaces/ValidatorFn.d.ts +0 -2
  377. package/dist/interfaces/ValidatorFn.js +0 -3
  378. package/dist/interfaces/index.d.ts +0 -13
  379. package/dist/interfaces/index.js +0 -16
  380. package/dist/interfaces/resolvers-map.d.ts +0 -17
  381. package/dist/interfaces/resolvers-map.js +0 -3
  382. package/dist/metadata/definitions/authorized-metadata.js +0 -3
  383. package/dist/metadata/definitions/class-metadata.js +0 -3
  384. package/dist/metadata/definitions/directive-metadata.js +0 -3
  385. package/dist/metadata/definitions/enum-metadata.js +0 -3
  386. package/dist/metadata/definitions/extensions-metadata.js +0 -3
  387. package/dist/metadata/definitions/field-metadata.js +0 -3
  388. package/dist/metadata/definitions/index.d.ts +0 -10
  389. package/dist/metadata/definitions/interface-class-metadata.d.ts +0 -7
  390. package/dist/metadata/definitions/interface-class-metadata.js +0 -3
  391. package/dist/metadata/definitions/middleware-metadata.js +0 -3
  392. package/dist/metadata/definitions/object-class-metdata.d.ts +0 -4
  393. package/dist/metadata/definitions/object-class-metdata.js +0 -3
  394. package/dist/metadata/definitions/param-metadata.d.ts +0 -43
  395. package/dist/metadata/definitions/param-metadata.js +0 -3
  396. package/dist/metadata/definitions/resolver-metadata.d.ts +0 -43
  397. package/dist/metadata/definitions/resolver-metadata.js +0 -3
  398. package/dist/metadata/definitions/union-metadata.js +0 -3
  399. package/dist/metadata/getMetadataStorage.js +0 -9
  400. package/dist/metadata/index.d.ts +0 -1
  401. package/dist/resolvers/helpers.d.ts +0 -10
  402. package/dist/resolvers/validate-arg.d.ts +0 -4
  403. package/dist/scalars/index.d.ts +0 -3
  404. package/dist/scalars/index.js +0 -7
  405. package/dist/scalars/isodate.d.ts +0 -2
  406. package/dist/scalars/isodate.js +0 -35
  407. package/dist/scalars/timestamp.d.ts +0 -2
  408. package/dist/scalars/timestamp.js +0 -37
  409. package/dist/utils/createResolversMap.d.ts +0 -3
  410. package/dist/utils/graphql-version.d.ts +0 -3
  411. package/dist/utils/graphql-version.js +0 -25
  412. package/dist/utils/index.d.ts +0 -5
  413. package/dist/utils/isPromiseLike.d.ts +0 -1
  414. package/dist/utils/types.d.ts +0 -4
  415. package/dist/utils/types.js +0 -5
  416. /package/{dist → build/typings}/decorators/ArgsType.d.ts +0 -0
  417. /package/{dist → build/typings}/errors/CannotDetermineGraphQLTypeError.d.ts +0 -0
  418. /package/{dist → build/typings}/errors/InvalidDirectiveError.d.ts +0 -0
  419. /package/{dist → build/typings}/errors/MissingSubscriptionTopicsError.d.ts +0 -0
  420. /package/{dist → build/typings}/errors/NoExplicitTypeError.d.ts +0 -0
  421. /package/{dist → build/typings}/errors/ReflectMetadataMissingError.d.ts +0 -0
  422. /package/{dist → build/typings}/errors/SymbolKeysNotSupportedError.d.ts +0 -0
  423. /package/{dist → build/typings}/helpers/isThrowing.d.ts +0 -0
  424. /package/{dist → build/typings}/helpers/returnTypes.d.ts +0 -0
  425. /package/{dist → build/typings}/metadata/definitions/authorized-metadata.d.ts +0 -0
  426. /package/{dist → build/typings}/metadata/definitions/extensions-metadata.d.ts +0 -0
  427. /package/{dist → build/typings}/scalars/aliases.d.ts +0 -0
  428. /package/{dist/interfaces → build/typings/typings}/ResolverInterface.d.ts +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018-2021 Michał Lytek
3
+ Copyright (c) 2018-2024 Michał Lytek
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,26 +1,29 @@
1
- ![logo](https://raw.githubusercontent.com/MichalLytek/type-graphql/master/img/logo.png)
1
+ <!-- prettier-ignore-start -->
2
+ <!-- markdownlint-disable-next-line MD041 -->
3
+ ![logo](./images/logo.png)
4
+ <!-- prettier-ignore-end -->
2
5
 
3
6
  # TypeGraphQL
4
7
 
8
+ [![release](https://github.com/MichalLytek/type-graphql/actions/workflows/release.yml/badge.svg)](https://github.com/MichalLytek/type-graphql/actions/workflows/release.yml)
9
+ [![website](https://github.com/MichalLytek/type-graphql/actions/workflows/website.yml/badge.svg)](https://github.com/MichalLytek/type-graphql/actions/workflows/website.yml)
10
+ [![codeql](https://github.com/MichalLytek/type-graphql/actions/workflows/codeql.yml/badge.svg)](https://github.com/MichalLytek/type-graphql/actions/workflows/codeql.yml)
5
11
  [![npm version](https://badge.fury.io/js/type-graphql.svg)](https://badge.fury.io/js/type-graphql)
6
- [![Build Status](https://img.shields.io/github/checks-status/MichalLytek/type-graphql/master)](https://github.com/MichalLytek/type-graphql/actions/workflows/main.yml?query=branch%3Amaster)
7
12
  [![codecov](https://codecov.io/gh/MichalLytek/type-graphql/branch/master/graph/badge.svg)](https://codecov.io/gh/MichalLytek/type-graphql)
8
- ![dependencies](https://img.shields.io/david/MichalLytek/type-graphql)
9
- [![open collective](https://opencollective.com/typegraphql/tiers/badge.svg)](<(https://opencollective.com/typegraphql)>)
10
- [![install size](https://packagephobia.now.sh/badge?p=type-graphql)](https://packagephobia.now.sh/result?p=type-graphql)
13
+ [![open collective](https://opencollective.com/typegraphql/tiers/badge.svg)](https://opencollective.com/typegraphql)
14
+ [![install size](https://packagephobia.com/badge?p=type-graphql)](https://packagephobia.com/result?p=type-graphql)
11
15
 
12
- Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
16
+ Create [GraphQL](https://graphql.org) schema and resolvers with [TypeScript](https://www.typescriptlang.org), using classes and decorators!
13
17
 
14
- [**https://typegraphql.com/**](https://typegraphql.com/)
15
- <br>
16
- <br>
17
- [![](https://opencollective.com/typegraphql/donate/button.png?color=white)](https://opencollective.com/typegraphql)
18
+ **<https://typegraphql.com>**
19
+
20
+ [![donate](https://opencollective.com/typegraphql/donate/button.png?color=black)](https://opencollective.com/typegraphql)
18
21
 
19
22
  ## Introduction
20
23
 
21
24
  **TypeGraphQL** makes developing GraphQL APIs an enjoyable process, i.e. by defining the schema using only classes and a bit of decorator magic.
22
25
 
23
- So, to create types like object type or input type, we use a kind of DTO classes.
26
+ So, to create types like object type or input type, we use a kind of DTO class.
24
27
  For example, to declare `Recipe` type we simply create a class and annotate it with decorators:
25
28
 
26
29
  ```ts
@@ -51,7 +54,7 @@ type Recipe {
51
54
  }
52
55
  ```
53
56
 
54
- Then we can create queries, mutations and field resolvers. For this purpose we use controller-like classes that are called "resolvers" by convention. We can also use awesome features like dependency injection and auth guards:
57
+ Then we can create queries, mutations and field resolvers. For this purpose, we use controller-like classes that are called "resolvers" by convention. We can also use awesome features like dependency injection and auth guards:
55
58
 
56
59
  ```ts
57
60
  @Resolver(Recipe)
@@ -77,7 +80,7 @@ class RecipeResolver {
77
80
  }
78
81
  ```
79
82
 
80
- And in this simple way we get this part of the schema in SDL:
83
+ And in this simple way, we get this part of the schema in SDL:
81
84
 
82
85
  ```graphql
83
86
  type Query {
@@ -91,11 +94,11 @@ type Mutation {
91
94
 
92
95
  ## Motivation
93
96
 
94
- We all know that GraphQL is great and solves many problems we have with REST APIs, like overfetching and underfetching. But developing a GraphQL API in Node.js with TypeScript is sometimes a bit of a pain. Why? Let's take a look at the steps we usually have to take.
97
+ We all know that GraphQL is great and solves many problems we have with REST APIs, like Over-Fetching and Under-Fetching. But developing a GraphQL API in Node.js with TypeScript is sometimes a bit of a pain. Why? Let's take a look at the steps we usually have to take.
95
98
 
96
- First, we create all the GraphQL types in `schema.gql` using SDL. Then we create our data models using [ORM classes](https://github.com/typeorm/typeorm), which represent our db entities. Then we start to write resolvers for our queries, mutations and fields, but this forces us to first create TS interfaces for all arguments, inputs, and even object types.
99
+ First, we create all the GraphQL types in `schema.graphql` using SDL. Then we create our data models using [ORM classes](https://github.com/typeorm/typeorm), which represent our DB entities. Then we start to write resolvers for our queries, mutations and fields, but this forces us to first create TS interfaces for all arguments, inputs, and even object types.
97
100
 
98
- Only then can we actually implement the resolvers using weird generic signatures and manually performing common tasks, like validation, authorization and loading dependencies:
101
+ Only then can we implement the resolvers using weird generic signatures and manually performing common tasks, like validation, authorization and loading dependencies:
99
102
 
100
103
  ```ts
101
104
  export const getRecipesResolver: GraphQLFieldResolver<void, Context, GetRecipesArgs> = async (
@@ -116,15 +119,15 @@ export const getRecipesResolver: GraphQLFieldResolver<void, Context, GetRecipesA
116
119
  };
117
120
  ```
118
121
 
119
- The biggest problem is redundancy in our codebase, which makes it difficult to keep things in sync. To add a new field to our entity, we have to jump through all the files - modify an entity class, the schema, as well as the interface. The same goes for inputs or arguments. It's easy to forget to update one piece or make a mistake with a single type. Also, what if we've made a typo in field name? The rename feature (F2) won't work correctly.
122
+ The biggest problem is redundancy in our codebase, which makes it difficult to keep things in sync. To add a new field to our entity, we have to jump through all the files - modify an entity class, the schema, as well as the interface. The same goes for inputs or arguments. It's easy to forget to update one piece or make a mistake with a single type. Also, what if we've made a typo in the field name? The rename feature (F2) won't work correctly.
120
123
 
121
- Tools like [GraphQL Code Generator](https://github.com/dotansimha/graphql-code-generator) or [graphqlgen](https://github.com/prisma/graphqlgen) only solve the first part - they generate the corresponding interfaces (and resolvers skeletons) for our GraphQL schema but they don't fix the schema <--> models redundancy and developer experience (F2 rename won't work, you have to remember about the codegen watch task in background, etc.), as well as common tasks like validation, authorization, etc.
124
+ Tools like [GraphQL Code Generator](https://github.com/dotansimha/graphql-code-generator) or [graphqlgen](https://github.com/prisma/graphqlgen) only solve the first part - they generate the corresponding interfaces (and resolvers skeletons) for our GraphQL schema but they don't fix the schema <--> models redundancy and developer experience (F2 rename won't work, you have to remember about the codegen watch task in the background, etc.), as well as common tasks like validation, authorization, etc.
122
125
 
123
126
  **TypeGraphQL** comes to address these issues, based on experience from a few years of developing GraphQL APIs in TypeScript. The main idea is to have only one source of truth by defining the schema using classes and some help from decorators. Additional features like dependency injection, validation and auth guards help with common tasks that normally we would have to handle ourselves.
124
127
 
125
128
  ## Documentation
126
129
 
127
- The documentation, installation guide, detailed description of the API and all of its features is [available on the website](https://typegraphql.com/).
130
+ The documentation, installation guide, and detailed description of the API and all of its features are [available on the website](https://typegraphql.com).
128
131
 
129
132
  ### Getting started
130
133
 
@@ -136,9 +139,9 @@ If you prefer video tutorials, you can watch [Ben Awad](https://github.com/benaw
136
139
 
137
140
  ### Examples
138
141
 
139
- You can also check the [examples folder](https://github.com/MichalLytek/type-graphql/tree/master/examples) in this repository for more examples of usage: simple fields resolvers, DI Container support, TypeORM integration, automatic validation, etc.
142
+ You can also check the [examples folder](./examples) in this repository for more examples of usage: simple fields resolvers, DI Container support, TypeORM integration, automatic validation, etc.
140
143
 
141
- The [Tests folder](https://github.com/MichalLytek/type-graphql/tree/master/tests) might also give you some tips how to get various things done.
144
+ The [Tests folder](./tests) might also give you some tips on how to get various things done.
142
145
 
143
146
  ## Security contact information
144
147
 
@@ -148,19 +151,19 @@ Tidelift will coordinate the fix and disclosure.
148
151
 
149
152
  ## The future
150
153
 
151
- The currently released version is a stable 1.0.0 release. It is well tested (95% coverage, 428 test cases) and has most of the planned features already implemented. Plenty of companies and independent developers are using it in production with success.
154
+ The currently released version is a stable 1.0.0 release. It is well-tested (97% coverage, ~500 test cases) and has most of the planned features already implemented. Plenty of companies and independent developers are using it in production with success.
152
155
 
153
- However, there are also plans for a lot more features like better TypeORM, Prisma and dataloader integration, custom decorators and metadata annotations support - [the full list of ideas](https://github.com/MichalLytek/type-graphql/issues?q=is%3Aissue+is%3Aopen+label%3A"Enhancement+%3Anew%3A") is available on the GitHub repo. You can also keep track of [development's progress on project board](https://github.com/MichalLytek/type-graphql/projects/1).
156
+ However, there are also plans for a lot more features like better TypeORM, Prisma and DataLoader integration, custom decorators and metadata annotations support - [the full list of ideas](https://github.com/MichalLytek/type-graphql/issues?q=is%3Aissue+is%3Aopen+label%3A"Enhancement+%3Anew%3A") is available on the GitHub repo. You can also keep track of [development's progress on the project board](https://github.com/MichalLytek/type-graphql/projects/1).
154
157
 
155
158
  If you have any interesting feature requests, feel free to open an issue on GitHub so we can discuss that!
156
159
 
157
160
  ## Support
158
161
 
159
- TypeGraphQL is an MIT-licensed open source project. This framework is a result of the tremendous amount of work - sleepless nights, busy evenings and weekends.
162
+ **TypeGraphQL** is an MIT-licensed open-source project. This framework is a result of the tremendous amount of work - sleepless nights, busy evenings and weekends.
160
163
 
161
- It doesn't have a large company that sits behind - its ongoing development is possible only thanks to the support by the community.
164
+ It doesn't have a large company that sits behind it - its ongoing development is possible only thanks to the support of the community.
162
165
 
163
- [![](https://opencollective.com/typegraphql/donate/button.png?color=blue)](https://opencollective.com/typegraphql)
166
+ [![donate](https://opencollective.com/typegraphql/donate/button.png?color=blue)](https://opencollective.com/typegraphql)
164
167
 
165
168
  ### Gold Sponsors 🏆
166
169
 
@@ -168,29 +171,29 @@ It doesn't have a large company that sits behind - its ongoing development is po
168
171
 
169
172
  ### Silver Sponsors 🥈
170
173
 
171
- | [<img src="https://raw.githubusercontent.com/MichalLytek/type-graphql/master/img/lovd.png" width="150">](https://www.lovd.com/) |
172
- | :-----------------------------------------------------------------------------------------------------------------------------: |
173
- | [**Lovd**](https://www.lovd.com/) |
174
+ > Please ask your company to support this open source project by [becoming a silver sponsor](https://opencollective.com/typegraphql/contribute/silver-sponsors-14804).
174
175
 
175
176
  ### Bronze Sponsors 🥉
176
177
 
177
- | [<img src="https://raw.githubusercontent.com/MichalLytek/type-graphql/master/img/live-graphics-system.png" width="55">](https://www.ligrsystems.com/) | [<img src="https://raw.githubusercontent.com/MichalLytek/type-graphql/master/img/lifex.png" width="60">](https://www.joinlifex.com/) | [<img src="https://raw.githubusercontent.com/MichalLytek/type-graphql/master/img/instinctools.svg" width="100">](https://instinctools.com/manufacturing/) | [<img src="https://raw.githubusercontent.com/MichalLytek/type-graphql/master/img/vps-server.png" width="125">](https://www.vpsserver.com/) |
178
- | :---------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------: |
179
- | [**Live Graphic Systems**](https://www.ligrsystems.com/) | [**LifeX Aps**](https://www.joinlifex.com/) | [**\*instinctools**](https://instinctools.com/manufacturing/) | [**VPS Server**](https://www.vpsserver.com/) |
178
+ <!-- markdownlint-disable MD033 -->
179
+
180
+ | [<img src="./images/live-graphics-system.png" width="55" alt="live graphic systems" />](https://www.ligrsystems.com) | [<img src="./images/lifex.png" width="60" alt="lifeX aps" />](https://www.joinlifex.com) | [<img src="./images/instinctools.svg" width="100" alt="instinctools" />](https://instinctools.com/manufacturing) | [<img src="./images/vps-server.png" width="125" alt="vps server" />](https://www.vpsserver.com) | [<img src="./images/nongamstopbets.png" width="50" alt="NonGamstopBets" />](https://www.nongamstopbets.com/casinos-not-on-gamstop/) | [<img src="./images/casinodeps.svg" width="80" alt="CasinoDeps.co.nz" />](https://casinodeps.co.nz/1-dollar-casinos/) |
181
+ | :------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: |
182
+ | [**Live Graphic Systems**](https://www.ligrsystems.com) | [**LifeX Aps**](https://www.joinlifex.com/) | [**instinctools**](https://instinctools.com/manufacturing) | [**VPS Server**](https://www.vpsserver.com) | [**NonGamstopBets**](https://www.nongamstopbets.com/casinos-not-on-gamstop/) | [**CasinoDeps**](https://casinodeps.co.nz/1-dollar-casinos/) |
180
183
 
181
- [![Become a Sponsor](https://opencollective.com/static/images/become_sponsor.svg)](https://opencollective.com/typegraphql)
184
+ <!-- markdownlint-enable MD033 -->
185
+
186
+ [![become a sponsor](https://opencollective.com/static/images/become_sponsor.svg)](https://opencollective.com/typegraphql)
182
187
 
183
188
  ### Members 💪
184
189
 
185
- [![](https://opencollective.com/typegraphql/tiers/members.svg?avatarHeight=45&width=320&button=false)](https://opencollective.com/typegraphql#contributors)
190
+ [![Members](https://opencollective.com/typegraphql/tiers/members.svg?avatarHeight=45&width=320&button=false)](https://opencollective.com/typegraphql#contributors)
186
191
 
187
192
  ### GitHub Sponsors
188
193
 
189
- ![sponsors](./img/github-sponsors.svg)
194
+ [![GitHub Sponsors](./images/github-sponsors.svg)](https://github.com/sponsors/TypeGraphQL)
190
195
 
191
196
  ## Want to help?
192
197
 
193
- Want to file a bug, contribute some code, or improve documentation? Great! Please read our
194
- guidelines for [contributing][contributing] and then check out one of our [help wanted issues](https://github.com/MichalLytek/type-graphql/labels/Help%20Wanted%20%3Asos%3A).
195
-
196
- [contributing]: https://github.com/MichalLytek/type-graphql/blob/master/CONTRIBUTING.md
198
+ Want to file a bug, contribute some code, or improve the documentation? Great! Please read our
199
+ guidelines for [CONTRIBUTING](./CONTRIBUTING.md) and then check out one of our [help-wanted issues](https://github.com/MichalLytek/type-graphql/labels/Help%20Wanted%20%3Asos%3A).
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Arg = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
- const params_1 = require("../helpers/params");
6
4
  const decorators_1 = require("../helpers/decorators");
5
+ const params_1 = require("../helpers/params");
6
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
7
7
  function Arg(name, returnTypeFuncOrOptions, maybeOptions) {
8
8
  return (prototype, propertyKey, parameterIndex) => {
9
9
  const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
@@ -24,4 +24,3 @@ function Arg(name, returnTypeFuncOrOptions, maybeOptions) {
24
24
  };
25
25
  }
26
26
  exports.Arg = Arg;
27
- //# sourceMappingURL=Arg.js.map
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Args = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
- const params_1 = require("../helpers/params");
6
4
  const decorators_1 = require("../helpers/decorators");
5
+ const params_1 = require("../helpers/params");
6
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
7
7
  function Args(paramTypeFnOrOptions, maybeOptions) {
8
8
  const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(paramTypeFnOrOptions, maybeOptions);
9
9
  return (prototype, propertyKey, parameterIndex) => {
@@ -14,4 +14,3 @@ function Args(paramTypeFnOrOptions, maybeOptions) {
14
14
  };
15
15
  }
16
16
  exports.Args = Args;
17
- //# sourceMappingURL=Args.js.map
@@ -11,4 +11,3 @@ function ArgsType() {
11
11
  };
12
12
  }
13
13
  exports.ArgsType = ArgsType;
14
- //# sourceMappingURL=ArgsType.js.map
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Authorized = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
4
  const errors_1 = require("../errors");
6
5
  const decorators_1 = require("../helpers/decorators");
6
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
7
7
  function Authorized(...rolesOrRolesArray) {
8
8
  const roles = (0, decorators_1.getArrayFromOverloadedRest)(rolesOrRolesArray);
9
- return (prototype, propertyKey, descriptor) => {
9
+ return (prototype, propertyKey, _descriptor) => {
10
10
  if (typeof propertyKey === "symbol") {
11
11
  throw new errors_1.SymbolKeysNotSupportedError();
12
12
  }
@@ -18,4 +18,3 @@ function Authorized(...rolesOrRolesArray) {
18
18
  };
19
19
  }
20
20
  exports.Authorized = Authorized;
21
- //# sourceMappingURL=Authorized.js.map
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Ctx = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
4
  const errors_1 = require("../errors");
5
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
6
  function Ctx(propertyName) {
7
7
  return (prototype, propertyKey, parameterIndex) => {
8
8
  if (typeof propertyKey === "symbol") {
@@ -18,4 +18,3 @@ function Ctx(propertyName) {
18
18
  };
19
19
  }
20
20
  exports.Ctx = Ctx;
21
- //# sourceMappingURL=Ctx.js.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Directive = void 0;
4
+ const errors_1 = require("../errors");
5
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
+ function Directive(nameOrDefinition) {
7
+ return (targetOrPrototype, propertyKey, parameterIndexOrDescriptor) => {
8
+ const directive = { nameOrDefinition, args: {} };
9
+ if (typeof propertyKey === "symbol") {
10
+ throw new errors_1.SymbolKeysNotSupportedError();
11
+ }
12
+ if (propertyKey) {
13
+ if (typeof parameterIndexOrDescriptor === "number") {
14
+ (0, getMetadataStorage_1.getMetadataStorage)().collectDirectiveArgumentMetadata({
15
+ target: targetOrPrototype.constructor,
16
+ fieldName: propertyKey,
17
+ parameterIndex: parameterIndexOrDescriptor,
18
+ directive,
19
+ });
20
+ }
21
+ else {
22
+ (0, getMetadataStorage_1.getMetadataStorage)().collectDirectiveFieldMetadata({
23
+ target: targetOrPrototype.constructor,
24
+ fieldName: propertyKey,
25
+ directive,
26
+ });
27
+ }
28
+ }
29
+ else {
30
+ (0, getMetadataStorage_1.getMetadataStorage)().collectDirectiveClassMetadata({
31
+ target: targetOrPrototype,
32
+ directive,
33
+ });
34
+ }
35
+ };
36
+ }
37
+ exports.Directive = Directive;
@@ -4,7 +4,7 @@ exports.Extensions = void 0;
4
4
  const errors_1 = require("../errors");
5
5
  const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
6
  function Extensions(extensions) {
7
- return (targetOrPrototype, propertyKey, descriptor) => {
7
+ return (targetOrPrototype, propertyKey, _descriptor) => {
8
8
  if (typeof propertyKey === "symbol") {
9
9
  throw new errors_1.SymbolKeysNotSupportedError();
10
10
  }
@@ -24,4 +24,3 @@ function Extensions(extensions) {
24
24
  };
25
25
  }
26
26
  exports.Extensions = Extensions;
27
- //# sourceMappingURL=Extensions.js.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Field = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
- const findType_1 = require("../helpers/findType");
6
- const decorators_1 = require("../helpers/decorators");
7
4
  const errors_1 = require("../errors");
5
+ const decorators_1 = require("../helpers/decorators");
6
+ const findType_1 = require("../helpers/findType");
7
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
8
8
  function Field(returnTypeFuncOrOptions, maybeOptions) {
9
9
  return (prototype, propertyKey, descriptor) => {
10
10
  if (typeof propertyKey === "symbol") {
@@ -43,4 +43,3 @@ function Field(returnTypeFuncOrOptions, maybeOptions) {
43
43
  };
44
44
  }
45
45
  exports.Field = Field;
46
- //# sourceMappingURL=Field.js.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FieldResolver = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
4
  const errors_1 = require("../errors");
6
5
  const decorators_1 = require("../helpers/decorators");
7
6
  const findType_1 = require("../helpers/findType");
7
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
8
8
  function FieldResolver(returnTypeFuncOrOptions, maybeOptions) {
9
9
  return (prototype, propertyKey) => {
10
10
  if (typeof propertyKey === "symbol") {
@@ -13,7 +13,6 @@ function FieldResolver(returnTypeFuncOrOptions, maybeOptions) {
13
13
  let getType;
14
14
  let typeOptions;
15
15
  const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
16
- // try to get return type info
17
16
  try {
18
17
  const typeInfo = (0, findType_1.findType)({
19
18
  metadataKey: "design:returntype",
@@ -26,7 +25,6 @@ function FieldResolver(returnTypeFuncOrOptions, maybeOptions) {
26
25
  getType = typeInfo.getType;
27
26
  }
28
27
  catch {
29
- // tslint:disable-next-line:no-empty
30
28
  }
31
29
  (0, getMetadataStorage_1.getMetadataStorage)().collectFieldResolverMetadata({
32
30
  kind: "external",
@@ -42,4 +40,3 @@ function FieldResolver(returnTypeFuncOrOptions, maybeOptions) {
42
40
  };
43
41
  }
44
42
  exports.FieldResolver = FieldResolver;
45
- //# sourceMappingURL=FieldResolver.js.map
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Info = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
4
  const errors_1 = require("../errors");
5
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
6
  function Info() {
7
7
  return (prototype, propertyKey, parameterIndex) => {
8
8
  if (typeof propertyKey === "symbol") {
@@ -17,4 +17,3 @@ function Info() {
17
17
  };
18
18
  }
19
19
  exports.Info = Info;
20
- //# sourceMappingURL=Info.js.map
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InputType = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
4
  const decorators_1 = require("../helpers/decorators");
5
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
6
  function InputType(nameOrOptions, maybeOptions) {
7
7
  const { name, options } = (0, decorators_1.getNameDecoratorParams)(nameOrOptions, maybeOptions);
8
8
  return target => {
@@ -14,4 +14,3 @@ function InputType(nameOrOptions, maybeOptions) {
14
14
  };
15
15
  }
16
16
  exports.InputType = InputType;
17
- //# sourceMappingURL=InputType.js.map
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InterfaceType = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
4
  const decorators_1 = require("../helpers/decorators");
5
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
6
  function InterfaceType(nameOrOptions, maybeOptions) {
7
7
  const { name, options } = (0, decorators_1.getNameDecoratorParams)(nameOrOptions, maybeOptions);
8
8
  const interfaceClasses = options.implements && [].concat(options.implements);
@@ -17,4 +17,3 @@ function InterfaceType(nameOrOptions, maybeOptions) {
17
17
  };
18
18
  }
19
19
  exports.InterfaceType = InterfaceType;
20
- //# sourceMappingURL=InterfaceType.js.map
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Mutation = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
- const resolver_metadata_1 = require("../helpers/resolver-metadata");
6
4
  const decorators_1 = require("../helpers/decorators");
5
+ const resolver_metadata_1 = require("../helpers/resolver-metadata");
6
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
7
7
  function Mutation(returnTypeFuncOrOptions, maybeOptions) {
8
8
  const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
9
9
  return (prototype, methodName) => {
@@ -12,4 +12,3 @@ function Mutation(returnTypeFuncOrOptions, maybeOptions) {
12
12
  };
13
13
  }
14
14
  exports.Mutation = Mutation;
15
- //# sourceMappingURL=Mutation.js.map
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ObjectType = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
4
  const decorators_1 = require("../helpers/decorators");
5
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
6
  function ObjectType(nameOrOptions, maybeOptions) {
7
7
  const { name, options } = (0, decorators_1.getNameDecoratorParams)(nameOrOptions, maybeOptions);
8
8
  const interfaceClasses = options.implements && [].concat(options.implements);
@@ -17,4 +17,3 @@ function ObjectType(nameOrOptions, maybeOptions) {
17
17
  };
18
18
  }
19
19
  exports.ObjectType = ObjectType;
20
- //# sourceMappingURL=ObjectType.js.map
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Query = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
- const resolver_metadata_1 = require("../helpers/resolver-metadata");
6
4
  const decorators_1 = require("../helpers/decorators");
5
+ const resolver_metadata_1 = require("../helpers/resolver-metadata");
6
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
7
7
  function Query(returnTypeFuncOrOptions, maybeOptions) {
8
8
  const { options, returnTypeFunc } = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
9
9
  return (prototype, methodName) => {
@@ -12,4 +12,3 @@ function Query(returnTypeFuncOrOptions, maybeOptions) {
12
12
  };
13
13
  }
14
14
  exports.Query = Query;
15
- //# sourceMappingURL=Query.js.map
@@ -18,4 +18,3 @@ function Resolver(objectTypeOrTypeFunc) {
18
18
  };
19
19
  }
20
20
  exports.Resolver = Resolver;
21
- //# sourceMappingURL=Resolver.js.map
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Root = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
- const findType_1 = require("../helpers/findType");
6
4
  const errors_1 = require("../errors");
5
+ const findType_1 = require("../helpers/findType");
6
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
7
7
  function Root(propertyName) {
8
8
  return (prototype, propertyKey, parameterIndex) => {
9
9
  if (typeof propertyKey === "symbol") {
@@ -20,7 +20,6 @@ function Root(propertyName) {
20
20
  getType = typeInfo.getType;
21
21
  }
22
22
  catch {
23
- // tslint:disable-next-line:no-empty
24
23
  }
25
24
  (0, getMetadataStorage_1.getMetadataStorage)().collectHandlerParamMetadata({
26
25
  kind: "root",
@@ -33,4 +32,3 @@ function Root(propertyName) {
33
32
  };
34
33
  }
35
34
  exports.Root = Root;
36
- //# sourceMappingURL=Root.js.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Subscription = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
- const resolver_metadata_1 = require("../helpers/resolver-metadata");
6
- const decorators_1 = require("../helpers/decorators");
7
4
  const errors_1 = require("../errors");
5
+ const decorators_1 = require("../helpers/decorators");
6
+ const resolver_metadata_1 = require("../helpers/resolver-metadata");
7
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
8
8
  function Subscription(returnTypeFuncOrOptions, maybeOptions) {
9
9
  const params = (0, decorators_1.getTypeDecoratorParams)(returnTypeFuncOrOptions, maybeOptions);
10
10
  const options = params.options;
@@ -16,10 +16,10 @@ function Subscription(returnTypeFuncOrOptions, maybeOptions) {
16
16
  (0, getMetadataStorage_1.getMetadataStorage)().collectSubscriptionHandlerMetadata({
17
17
  ...metadata,
18
18
  topics: options.topics,
19
+ topicId: options.topicId,
19
20
  filter: options.filter,
20
21
  subscribe: options.subscribe,
21
22
  });
22
23
  };
23
24
  }
24
25
  exports.Subscription = Subscription;
25
- //# sourceMappingURL=Subscription.js.map
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UseMiddleware = void 0;
4
4
  const errors_1 = require("../errors");
5
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
5
  const decorators_1 = require("../helpers/decorators");
6
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
7
7
  function UseMiddleware(...middlewaresOrMiddlewareArray) {
8
8
  const middlewares = (0, decorators_1.getArrayFromOverloadedRest)(middlewaresOrMiddlewareArray);
9
- return (prototype, propertyKey, descriptor) => {
9
+ return (prototype, propertyKey, _descriptor) => {
10
10
  if (typeof propertyKey === "symbol") {
11
11
  throw new errors_1.SymbolKeysNotSupportedError();
12
12
  }
@@ -18,4 +18,3 @@ function UseMiddleware(...middlewaresOrMiddlewareArray) {
18
18
  };
19
19
  }
20
20
  exports.UseMiddleware = UseMiddleware;
21
- //# sourceMappingURL=UseMiddleware.js.map
@@ -6,4 +6,3 @@ function createMethodDecorator(resolver) {
6
6
  return (0, UseMiddleware_1.UseMiddleware)(resolver);
7
7
  }
8
8
  exports.createMethodDecorator = createMethodDecorator;
9
- //# sourceMappingURL=createMethodDecorator.js.map
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createParamDecorator = void 0;
4
- const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
5
4
  const errors_1 = require("../errors");
5
+ const getMetadataStorage_1 = require("../metadata/getMetadataStorage");
6
6
  function createParamDecorator(resolver) {
7
7
  return (prototype, propertyKey, parameterIndex) => {
8
8
  if (typeof propertyKey === "symbol") {
@@ -18,4 +18,3 @@ function createParamDecorator(resolver) {
18
18
  };
19
19
  }
20
20
  exports.createParamDecorator = createParamDecorator;
21
- //# sourceMappingURL=createParamDecorator.js.map
@@ -11,4 +11,3 @@ function registerEnumType(enumObj, enumConfig) {
11
11
  });
12
12
  }
13
13
  exports.registerEnumType = registerEnumType;
14
- //# sourceMappingURL=enums.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UseMiddleware = exports.createUnionType = exports.Subscription = exports.Root = exports.Resolver = exports.Query = exports.PubSub = exports.ObjectType = exports.Mutation = exports.InterfaceType = exports.InputType = exports.Info = exports.FieldResolver = exports.Field = exports.registerEnumType = exports.Extensions = exports.Directive = exports.Ctx = exports.createMethodDecorator = exports.createParamDecorator = exports.Authorized = exports.ArgsType = exports.Args = exports.Arg = void 0;
3
+ exports.UseMiddleware = exports.createUnionType = exports.Subscription = exports.Root = exports.Resolver = exports.Query = exports.ObjectType = exports.Mutation = exports.InterfaceType = exports.InputType = exports.Info = exports.FieldResolver = exports.Field = exports.registerEnumType = exports.Extensions = exports.Directive = exports.Ctx = exports.createMethodDecorator = exports.createParamDecorator = exports.Authorized = exports.ArgsType = exports.Args = exports.Arg = void 0;
4
4
  var Arg_1 = require("./Arg");
5
5
  Object.defineProperty(exports, "Arg", { enumerable: true, get: function () { return Arg_1.Arg; } });
6
6
  var Args_1 = require("./Args");
@@ -35,8 +35,6 @@ var Mutation_1 = require("./Mutation");
35
35
  Object.defineProperty(exports, "Mutation", { enumerable: true, get: function () { return Mutation_1.Mutation; } });
36
36
  var ObjectType_1 = require("./ObjectType");
37
37
  Object.defineProperty(exports, "ObjectType", { enumerable: true, get: function () { return ObjectType_1.ObjectType; } });
38
- var PubSub_1 = require("./PubSub");
39
- Object.defineProperty(exports, "PubSub", { enumerable: true, get: function () { return PubSub_1.PubSub; } });
40
38
  var Query_1 = require("./Query");
41
39
  Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return Query_1.Query; } });
42
40
  var Resolver_1 = require("./Resolver");
@@ -49,4 +47,3 @@ var unions_1 = require("./unions");
49
47
  Object.defineProperty(exports, "createUnionType", { enumerable: true, get: function () { return unions_1.createUnionType; } });
50
48
  var UseMiddleware_1 = require("./UseMiddleware");
51
49
  Object.defineProperty(exports, "UseMiddleware", { enumerable: true, get: function () { return UseMiddleware_1.UseMiddleware; } });
52
- //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -12,4 +12,3 @@ function createUnionType({ name, description, types, resolveType, }) {
12
12
  return unionMetadataSymbol;
13
13
  }
14
14
  exports.createUnionType = createUnionType;
15
- //# sourceMappingURL=unions.js.map
@@ -19,4 +19,3 @@ class CannotDetermineGraphQLTypeError extends Error {
19
19
  }
20
20
  }
21
21
  exports.CannotDetermineGraphQLTypeError = CannotDetermineGraphQLTypeError;
22
- //# sourceMappingURL=CannotDetermineGraphQLTypeError.js.map
@@ -10,4 +10,3 @@ class ConflictingDefaultValuesError extends Error {
10
10
  }
11
11
  }
12
12
  exports.ConflictingDefaultValuesError = ConflictingDefaultValuesError;
13
- //# sourceMappingURL=ConflictingDefaultValuesError.js.map