@restorecommerce/facade 1.2.0 → 1.3.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 (254) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.cjs +13 -0
  3. package/CHANGELOG.md +11 -0
  4. package/codegen/index.d.ts +1 -1
  5. package/codegen/index.js +18 -44
  6. package/debug-run.ts +7 -6
  7. package/dist/gql/index.d.ts +1 -1
  8. package/dist/gql/index.js +1 -17
  9. package/dist/gql/protos/federation.d.ts +3 -3
  10. package/dist/gql/protos/federation.js +16 -24
  11. package/dist/gql/protos/graphql.d.ts +4 -4
  12. package/dist/gql/protos/graphql.js +64 -42
  13. package/dist/gql/protos/index.d.ts +6 -6
  14. package/dist/gql/protos/index.js +6 -22
  15. package/dist/gql/protos/registry.d.ts +6 -6
  16. package/dist/gql/protos/registry.js +157 -176
  17. package/dist/gql/protos/resolvers.d.ts +3 -3
  18. package/dist/gql/protos/resolvers.js +78 -104
  19. package/dist/gql/protos/schema.d.ts +4 -4
  20. package/dist/gql/protos/schema.js +40 -53
  21. package/dist/gql/protos/types.d.ts +3 -3
  22. package/dist/gql/protos/types.js +1 -4
  23. package/dist/gql/protos/utils.d.ts +3 -3
  24. package/dist/gql/protos/utils.js +23 -62
  25. package/dist/gql/types/AccessControlTypes.js +13 -16
  26. package/dist/gql/types/DateType.js +4 -7
  27. package/dist/gql/types/FilterType.js +7 -10
  28. package/dist/gql/types/MetaType.js +8 -11
  29. package/dist/gql/types/ScopeType.js +4 -7
  30. package/dist/gql/types/SortType.js +5 -8
  31. package/dist/gql/types/StatusType.js +4 -7
  32. package/dist/gql/types/index.d.ts +7 -7
  33. package/dist/gql/types/index.js +7 -23
  34. package/dist/index.d.ts +14 -14
  35. package/dist/index.js +195 -207
  36. package/dist/interfaces.d.ts +8 -8
  37. package/dist/interfaces.js +1 -2
  38. package/dist/middlewares/index.d.ts +1 -1
  39. package/dist/middlewares/index.js +1 -17
  40. package/dist/middlewares/req-res-logger/index.d.ts +2 -2
  41. package/dist/middlewares/req-res-logger/index.js +33 -31
  42. package/dist/modules/access-control/gql/federation.d.ts +1 -1
  43. package/dist/modules/access-control/gql/federation.js +10 -17
  44. package/dist/modules/access-control/gql/schema.d.ts +1 -1
  45. package/dist/modules/access-control/gql/schema.generated.d.ts +136 -110
  46. package/dist/modules/access-control/gql/schema.generated.js +22 -25
  47. package/dist/modules/access-control/gql/schema.js +5 -9
  48. package/dist/modules/access-control/gql/types.d.ts +2 -2
  49. package/dist/modules/access-control/gql/types.js +13 -17
  50. package/dist/modules/access-control/grpc/index.d.ts +5 -5
  51. package/dist/modules/access-control/grpc/index.js +10 -14
  52. package/dist/modules/access-control/index.d.ts +2 -2
  53. package/dist/modules/access-control/index.js +20 -17
  54. package/dist/modules/access-control/interfaces.d.ts +3 -3
  55. package/dist/modules/access-control/interfaces.js +1 -4
  56. package/dist/modules/catalog/gql/federation.d.ts +1 -1
  57. package/dist/modules/catalog/gql/federation.js +10 -17
  58. package/dist/modules/catalog/gql/schema.d.ts +1 -1
  59. package/dist/modules/catalog/gql/schema.generated.d.ts +252 -226
  60. package/dist/modules/catalog/gql/schema.generated.js +20 -23
  61. package/dist/modules/catalog/gql/schema.js +5 -9
  62. package/dist/modules/catalog/gql/types.d.ts +2 -2
  63. package/dist/modules/catalog/gql/types.js +15 -19
  64. package/dist/modules/catalog/grpc/index.d.ts +6 -6
  65. package/dist/modules/catalog/grpc/index.js +12 -16
  66. package/dist/modules/catalog/index.d.ts +2 -2
  67. package/dist/modules/catalog/index.js +20 -17
  68. package/dist/modules/catalog/interfaces.d.ts +3 -3
  69. package/dist/modules/catalog/interfaces.js +1 -4
  70. package/dist/modules/facade-status/gql/index.js +8 -14
  71. package/dist/modules/facade-status/gql/resolvers.d.ts +1 -1
  72. package/dist/modules/facade-status/gql/resolvers.js +14 -8
  73. package/dist/modules/facade-status/gql/schema.d.ts +1 -1
  74. package/dist/modules/facade-status/gql/schema.generated.d.ts +34 -11
  75. package/dist/modules/facade-status/gql/schema.generated.js +1 -2
  76. package/dist/modules/facade-status/gql/schema.js +6 -9
  77. package/dist/modules/facade-status/gql/types.js +3 -6
  78. package/dist/modules/facade-status/index.d.ts +1 -1
  79. package/dist/modules/facade-status/index.js +4 -7
  80. package/dist/modules/facade-status/interfaces.d.ts +1 -1
  81. package/dist/modules/facade-status/interfaces.js +1 -2
  82. package/dist/modules/fulfillment/gql/federation.d.ts +1 -1
  83. package/dist/modules/fulfillment/gql/federation.js +10 -17
  84. package/dist/modules/fulfillment/gql/schema.d.ts +1 -1
  85. package/dist/modules/fulfillment/gql/schema.generated.d.ts +249 -223
  86. package/dist/modules/fulfillment/gql/schema.generated.js +20 -23
  87. package/dist/modules/fulfillment/gql/schema.js +5 -9
  88. package/dist/modules/fulfillment/gql/types.d.ts +2 -2
  89. package/dist/modules/fulfillment/gql/types.js +11 -15
  90. package/dist/modules/fulfillment/grpc/index.d.ts +3 -3
  91. package/dist/modules/fulfillment/grpc/index.js +6 -10
  92. package/dist/modules/fulfillment/index.d.ts +2 -2
  93. package/dist/modules/fulfillment/index.js +20 -17
  94. package/dist/modules/fulfillment/interfaces.d.ts +3 -3
  95. package/dist/modules/fulfillment/interfaces.js +1 -4
  96. package/dist/modules/identity/api-key/api-key.d.ts +2 -2
  97. package/dist/modules/identity/api-key/api-key.js +45 -65
  98. package/dist/modules/identity/gql/federation.d.ts +2 -2
  99. package/dist/modules/identity/gql/federation.js +5 -9
  100. package/dist/modules/identity/gql/schema.d.ts +1 -1
  101. package/dist/modules/identity/gql/schema.generated.d.ts +284 -255
  102. package/dist/modules/identity/gql/schema.generated.js +20 -23
  103. package/dist/modules/identity/gql/schema.js +5 -9
  104. package/dist/modules/identity/gql/types.d.ts +2 -2
  105. package/dist/modules/identity/gql/types.js +17 -21
  106. package/dist/modules/identity/grpc/index.d.ts +6 -6
  107. package/dist/modules/identity/grpc/index.js +12 -16
  108. package/dist/modules/identity/index.d.ts +4 -4
  109. package/dist/modules/identity/index.js +24 -21
  110. package/dist/modules/identity/interfaces.d.ts +5 -5
  111. package/dist/modules/identity/interfaces.js +1 -4
  112. package/dist/modules/identity/oauth/oauth.d.ts +4 -4
  113. package/dist/modules/identity/oauth/oauth.js +109 -135
  114. package/dist/modules/identity/oidc/adapter.d.ts +3 -3
  115. package/dist/modules/identity/oidc/adapter.js +111 -92
  116. package/dist/modules/identity/oidc/in-memory-adapter.d.ts +1 -1
  117. package/dist/modules/identity/oidc/in-memory-adapter.js +64 -50
  118. package/dist/modules/identity/oidc/index.d.ts +6 -6
  119. package/dist/modules/identity/oidc/index.js +29 -30
  120. package/dist/modules/identity/oidc/interfaces.d.ts +6 -6
  121. package/dist/modules/identity/oidc/interfaces.js +2 -6
  122. package/dist/modules/identity/oidc/password-grant.d.ts +1 -1
  123. package/dist/modules/identity/oidc/password-grant.js +43 -66
  124. package/dist/modules/identity/oidc/router.d.ts +6 -6
  125. package/dist/modules/identity/oidc/router.js +31 -26
  126. package/dist/modules/identity/oidc/templates.d.ts +1 -1
  127. package/dist/modules/identity/oidc/templates.js +45 -41
  128. package/dist/modules/identity/oidc/user.d.ts +4 -4
  129. package/dist/modules/identity/oidc/user.js +31 -29
  130. package/dist/modules/identity/oidc/utils.d.ts +2 -2
  131. package/dist/modules/identity/oidc/utils.js +6 -13
  132. package/dist/modules/index.d.ts +13 -13
  133. package/dist/modules/index.js +13 -29
  134. package/dist/modules/indexing/gql/federation.d.ts +1 -1
  135. package/dist/modules/indexing/gql/federation.js +10 -17
  136. package/dist/modules/indexing/gql/schema.d.ts +1 -1
  137. package/dist/modules/indexing/gql/schema.generated.d.ts +45 -19
  138. package/dist/modules/indexing/gql/schema.generated.js +2 -5
  139. package/dist/modules/indexing/gql/schema.js +5 -9
  140. package/dist/modules/indexing/gql/types.d.ts +2 -2
  141. package/dist/modules/indexing/gql/types.js +7 -11
  142. package/dist/modules/indexing/grpc/index.d.ts +2 -2
  143. package/dist/modules/indexing/grpc/index.js +4 -8
  144. package/dist/modules/indexing/index.d.ts +2 -2
  145. package/dist/modules/indexing/index.js +20 -17
  146. package/dist/modules/indexing/interfaces.d.ts +3 -3
  147. package/dist/modules/indexing/interfaces.js +1 -4
  148. package/dist/modules/invoicing/gql/federation.d.ts +1 -1
  149. package/dist/modules/invoicing/gql/federation.js +10 -17
  150. package/dist/modules/invoicing/gql/schema.d.ts +1 -1
  151. package/dist/modules/invoicing/gql/schema.generated.d.ts +209 -183
  152. package/dist/modules/invoicing/gql/schema.generated.js +20 -23
  153. package/dist/modules/invoicing/gql/schema.js +5 -9
  154. package/dist/modules/invoicing/gql/types.d.ts +2 -2
  155. package/dist/modules/invoicing/gql/types.js +7 -11
  156. package/dist/modules/invoicing/grpc/index.d.ts +2 -2
  157. package/dist/modules/invoicing/grpc/index.js +4 -8
  158. package/dist/modules/invoicing/index.d.ts +2 -2
  159. package/dist/modules/invoicing/index.js +20 -17
  160. package/dist/modules/invoicing/interfaces.d.ts +3 -3
  161. package/dist/modules/invoicing/interfaces.js +1 -4
  162. package/dist/modules/notification/gql/federation.d.ts +1 -1
  163. package/dist/modules/notification/gql/federation.js +10 -17
  164. package/dist/modules/notification/gql/schema.d.ts +1 -1
  165. package/dist/modules/notification/gql/schema.generated.d.ts +100 -74
  166. package/dist/modules/notification/gql/schema.generated.js +18 -21
  167. package/dist/modules/notification/gql/schema.js +5 -9
  168. package/dist/modules/notification/gql/types.d.ts +2 -2
  169. package/dist/modules/notification/gql/types.js +7 -11
  170. package/dist/modules/notification/grpc/index.d.ts +2 -2
  171. package/dist/modules/notification/grpc/index.js +4 -8
  172. package/dist/modules/notification/index.d.ts +2 -2
  173. package/dist/modules/notification/index.js +20 -17
  174. package/dist/modules/notification/interfaces.d.ts +3 -3
  175. package/dist/modules/notification/interfaces.js +1 -4
  176. package/dist/modules/ordering/gql/federation.d.ts +1 -1
  177. package/dist/modules/ordering/gql/federation.js +10 -17
  178. package/dist/modules/ordering/gql/schema.d.ts +1 -1
  179. package/dist/modules/ordering/gql/schema.generated.d.ts +221 -195
  180. package/dist/modules/ordering/gql/schema.generated.js +22 -25
  181. package/dist/modules/ordering/gql/schema.js +5 -9
  182. package/dist/modules/ordering/gql/types.d.ts +2 -2
  183. package/dist/modules/ordering/gql/types.js +7 -11
  184. package/dist/modules/ordering/grpc/index.d.ts +2 -2
  185. package/dist/modules/ordering/grpc/index.js +4 -8
  186. package/dist/modules/ordering/index.d.ts +2 -2
  187. package/dist/modules/ordering/index.js +20 -17
  188. package/dist/modules/ordering/interfaces.d.ts +3 -3
  189. package/dist/modules/ordering/interfaces.js +1 -4
  190. package/dist/modules/ostorage/gql/federation.d.ts +1 -1
  191. package/dist/modules/ostorage/gql/federation.js +10 -17
  192. package/dist/modules/ostorage/gql/schema.d.ts +1 -1
  193. package/dist/modules/ostorage/gql/schema.generated.d.ts +126 -94
  194. package/dist/modules/ostorage/gql/schema.generated.js +8 -11
  195. package/dist/modules/ostorage/gql/schema.js +5 -9
  196. package/dist/modules/ostorage/gql/types.d.ts +2 -2
  197. package/dist/modules/ostorage/gql/types.js +7 -11
  198. package/dist/modules/ostorage/grpc/index.d.ts +2 -2
  199. package/dist/modules/ostorage/grpc/index.js +4 -8
  200. package/dist/modules/ostorage/index.d.ts +2 -2
  201. package/dist/modules/ostorage/index.js +20 -17
  202. package/dist/modules/ostorage/interfaces.d.ts +3 -3
  203. package/dist/modules/ostorage/interfaces.js +1 -4
  204. package/dist/modules/payment/gql/federation.d.ts +1 -1
  205. package/dist/modules/payment/gql/federation.js +10 -17
  206. package/dist/modules/payment/gql/schema.d.ts +1 -1
  207. package/dist/modules/payment/gql/schema.generated.d.ts +67 -44
  208. package/dist/modules/payment/gql/schema.generated.js +4 -7
  209. package/dist/modules/payment/gql/schema.js +5 -9
  210. package/dist/modules/payment/gql/types.d.ts +2 -2
  211. package/dist/modules/payment/gql/types.js +7 -11
  212. package/dist/modules/payment/grpc/index.d.ts +2 -2
  213. package/dist/modules/payment/grpc/index.js +4 -8
  214. package/dist/modules/payment/index.d.ts +2 -2
  215. package/dist/modules/payment/index.js +20 -17
  216. package/dist/modules/payment/interfaces.d.ts +3 -3
  217. package/dist/modules/payment/interfaces.js +1 -4
  218. package/dist/modules/resource/gql/federation.d.ts +1 -1
  219. package/dist/modules/resource/gql/federation.js +10 -17
  220. package/dist/modules/resource/gql/schema.d.ts +1 -1
  221. package/dist/modules/resource/gql/schema.generated.d.ts +348 -322
  222. package/dist/modules/resource/gql/schema.generated.js +28 -31
  223. package/dist/modules/resource/gql/schema.js +5 -9
  224. package/dist/modules/resource/gql/types.d.ts +2 -2
  225. package/dist/modules/resource/gql/types.js +31 -35
  226. package/dist/modules/resource/grpc/index.d.ts +13 -13
  227. package/dist/modules/resource/grpc/index.js +28 -32
  228. package/dist/modules/resource/index.d.ts +2 -2
  229. package/dist/modules/resource/index.js +20 -17
  230. package/dist/modules/resource/interfaces.d.ts +3 -3
  231. package/dist/modules/resource/interfaces.js +1 -4
  232. package/dist/modules/scheduling/gql/federation.d.ts +1 -1
  233. package/dist/modules/scheduling/gql/federation.js +10 -17
  234. package/dist/modules/scheduling/gql/schema.d.ts +1 -1
  235. package/dist/modules/scheduling/gql/schema.generated.d.ts +109 -83
  236. package/dist/modules/scheduling/gql/schema.generated.js +10 -13
  237. package/dist/modules/scheduling/gql/schema.js +5 -9
  238. package/dist/modules/scheduling/gql/types.d.ts +2 -2
  239. package/dist/modules/scheduling/gql/types.js +7 -11
  240. package/dist/modules/scheduling/grpc/index.d.ts +2 -2
  241. package/dist/modules/scheduling/grpc/index.js +4 -8
  242. package/dist/modules/scheduling/index.d.ts +2 -2
  243. package/dist/modules/scheduling/index.js +20 -17
  244. package/dist/modules/scheduling/interfaces.d.ts +3 -3
  245. package/dist/modules/scheduling/interfaces.js +1 -4
  246. package/dist/utils.d.ts +3 -3
  247. package/dist/utils.js +4 -9
  248. package/generate.ts +42 -42
  249. package/jest.config.cjs +23 -0
  250. package/package.json +17 -12
  251. package/tsconfig-base.json +8 -0
  252. package/tsconfig.debug.json +5 -1
  253. package/tsconfig.test.json +17 -2
  254. package/jest.config.js +0 -14
package/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ **/*.d.ts
3
+ **/schema.generated.ts
package/.eslintrc.cjs ADDED
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ "root": false,
3
+ "parserOptions": {
4
+ "project": [
5
+ "tsconfig.lib.json",
6
+ "tsconfig.test.json",
7
+ "tsconfig.debug.json",
8
+ "tsconfig.codegen.json",
9
+ "tsconfig.generate.json"
10
+ ],
11
+ "sourceType": "module"
12
+ }
13
+ };
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.3.0](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@1.2.0...@restorecommerce/facade@1.3.0) (2023-06-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **facade:** move tests to esm ([a580de7](https://github.com/restorecommerce/libs/commit/a580de7b9e3e29c2856d3f4811e47c3fddcc5856))
12
+
13
+
14
+
15
+
16
+
6
17
  # [1.2.0](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@1.1.6...@restorecommerce/facade@1.2.0) (2023-06-02)
7
18
 
8
19
 
@@ -9,4 +9,4 @@ export interface GenerateSchemaTypingsArgs {
9
9
  [key: string]: any;
10
10
  };
11
11
  }
12
- export declare function generateSchemaTypings({ schema, outputFile, typescript, typescriptResolvers }: GenerateSchemaTypingsArgs): Promise<void>;
12
+ export declare const generateSchemaTypings: ({ schema, outputFile, typescript, typescriptResolvers }: GenerateSchemaTypingsArgs) => Promise<void>;
package/codegen/index.js CHANGED
@@ -1,34 +1,17 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
24
9
  };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.generateSchemaTypings = void 0;
27
- const fs = __importStar(require("fs"));
28
- const typescriptPlugin = __importStar(require("@graphql-codegen/typescript"));
29
- const typescriptResolversPlugin = __importStar(require("@graphql-codegen/typescript-resolvers"));
30
- const core_1 = require("@graphql-codegen/core");
31
- async function generateSchemaTypings({ schema, outputFile, typescript, typescriptResolvers }) {
10
+ import * as fs from 'node:fs';
11
+ import * as typescriptPlugin from '@graphql-codegen/typescript';
12
+ import * as typescriptResolversPlugin from '@graphql-codegen/typescript-resolvers';
13
+ import { codegen } from '@graphql-codegen/core';
14
+ export const generateSchemaTypings = ({ schema, outputFile, typescript, typescriptResolvers }) => __awaiter(void 0, void 0, void 0, function* () {
32
15
  try {
33
16
  const codegenConfig /* typings wrong? */ = {
34
17
  // used by a plugin internally, although the 'typescript' plugin currently
@@ -38,32 +21,23 @@ async function generateSchemaTypings({ schema, outputFile, typescript, typescrip
38
21
  documents: [],
39
22
  plugins: [
40
23
  {
41
- typescript: {
42
- maybeValue: 'T | null | undefined',
43
- inputMaybeValue: 'T | null | undefined',
44
- ...(typescript !== null && typescript !== void 0 ? typescript : {})
45
- },
24
+ typescript: Object.assign({ maybeValue: 'T | null | undefined', inputMaybeValue: 'T | null | undefined' }, (typescript !== null && typescript !== void 0 ? typescript : {})),
46
25
  },
47
26
  {
48
- typescriptResolvers: {
49
- noSchemaStitching: true,
50
- useIndexSignature: true,
51
- federation: true,
52
- ...(typescriptResolvers !== null && typescriptResolvers !== void 0 ? typescriptResolvers : {})
53
- },
27
+ typescriptResolvers: Object.assign({ noSchemaStitching: true, useIndexSignature: true, federation: true }, (typescriptResolvers !== null && typescriptResolvers !== void 0 ? typescriptResolvers : {})),
54
28
  },
55
29
  ],
56
30
  pluginMap: {
57
31
  typescript: typescriptPlugin,
58
32
  typescriptResolvers: typescriptResolversPlugin,
59
33
  },
34
+ emitLegacyCommonJSImports: false
60
35
  };
61
- const output = await (0, core_1.codegen)(codegenConfig);
36
+ const output = yield codegen(codegenConfig);
62
37
  fs.writeFileSync(outputFile, output);
63
38
  console.log('Schema typings generated in' + outputFile);
64
39
  }
65
40
  catch (ex) {
66
41
  console.error(ex);
67
42
  }
68
- }
69
- exports.generateSchemaTypings = generateSchemaTypings;
43
+ });
package/debug-run.ts CHANGED
@@ -15,13 +15,14 @@ import {
15
15
  ostorageModule,
16
16
  paymentModule,
17
17
  schedulingModule
18
- } from './src';
19
- import { join } from 'path';
18
+ } from './src/index.js';
19
+ import { join, dirname } from 'node:path';
20
+ import * as url from 'node:url';
20
21
 
21
- const CONFIG_PATH = __dirname;
22
- const jwks = require('./tests/jwks.json');
22
+ const CONFIG_PATH = dirname(url.fileURLToPath(import.meta.url));
23
+ import jwks from './tests/jwks.json' assert { type: 'json' };
23
24
 
24
- function createTestFacade() {
25
+ const createTestFacade = () => {
25
26
  const serviceConfig = createServiceConfig(join(CONFIG_PATH, 'tests'));
26
27
 
27
28
  const logger = createLogger(serviceConfig.get('logger'));
@@ -66,7 +67,7 @@ function createTestFacade() {
66
67
  .useModule(paymentModule({config: serviceConfig.get('payment')}))
67
68
  .useModule(schedulingModule({config: serviceConfig.get('scheduling')}))
68
69
  .useMiddleware(reqResLogger({logger}));
69
- }
70
+ };
70
71
 
71
72
  const facade = createTestFacade();
72
73
 
@@ -1 +1 @@
1
- export * from './types/index';
1
+ export * from './types/index.js';
package/dist/gql/index.js CHANGED
@@ -1,17 +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
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types/index"), exports);
1
+ export * from './types/index.js';
@@ -1,6 +1,6 @@
1
- import { FederatedSchemaWithResolvers, GraphQLResolverMap, ProtoMetadata, ServiceClient, SubSpaceServiceConfig } from './types';
2
- import { GraphQLSchema } from 'graphql/index';
1
+ import { type FederatedSchemaWithResolvers, type GraphQLResolverMap, type ProtoMetadata, type ServiceClient, type SubSpaceServiceConfig } from './types.js';
2
+ import { type GraphQLSchema } from 'graphql/index.js';
3
3
  import { GraphQLObjectType } from 'graphql';
4
- import { GraphQLList } from 'graphql/type/definition';
4
+ import { GraphQLList } from 'graphql/type/definition.js';
5
5
  export declare const buildFederatedSubscriptionSchema: <T, M extends Record<string, any>, CTX extends ServiceClient<CTX, keyof CTX, M>>(subServices: ProtoMetadata[], config: SubSpaceServiceConfig, namespace: string, schema: GraphQLSchema) => FederatedSchemaWithResolvers;
6
6
  export declare const mergeSubscribeIntoSchema: (schema: GraphQLObjectType | GraphQLList<any> | null | undefined, resolvers: GraphQLResolverMap<any>[string]) => void;
@@ -1,21 +1,15 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.mergeSubscribeIntoSchema = exports.buildFederatedSubscriptionSchema = void 0;
7
- const federation_1 = require("@apollo/federation");
8
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
9
- const index_1 = require("graphql/index");
10
- const graphql_1 = require("graphql");
11
- const definition_1 = require("graphql/type/definition");
12
- const resolvers_1 = require("./resolvers");
13
- const buildFederatedSubscriptionSchema = (subServices, config, namespace, schema) => {
14
- const resolvers = (0, resolvers_1.generateSubServiceResolvers)(subServices, config, namespace);
1
+ import { buildSubgraphSchema } from '@apollo/federation';
2
+ import { gql } from 'graphql-tag';
3
+ import { printSchema } from 'graphql/index.js';
4
+ import { GraphQLObjectType } from 'graphql';
5
+ import { GraphQLList, GraphQLScalarType } from 'graphql/type/definition.js';
6
+ import { generateSubServiceResolvers } from './resolvers.js';
7
+ export const buildFederatedSubscriptionSchema = (subServices, config, namespace, schema) => {
8
+ const resolvers = generateSubServiceResolvers(subServices, config, namespace);
15
9
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
16
10
  // See https://github.com/apollographql/apollo-server/pull/4310
17
- const federatedSchema = (0, federation_1.buildSubgraphSchema)({
18
- typeDefs: (0, graphql_tag_1.default)((0, index_1.printSchema)(schema)),
11
+ const federatedSchema = buildSubgraphSchema({
12
+ typeDefs: gql(printSchema(schema)),
19
13
  resolvers
20
14
  });
21
15
  return {
@@ -23,14 +17,13 @@ const buildFederatedSubscriptionSchema = (subServices, config, namespace, schema
23
17
  resolvers
24
18
  };
25
19
  };
26
- exports.buildFederatedSubscriptionSchema = buildFederatedSubscriptionSchema;
27
- const mergeSubscribeIntoSchema = (schema, resolvers) => {
20
+ export const mergeSubscribeIntoSchema = (schema, resolvers) => {
28
21
  if (!schema || !resolvers) {
29
22
  return;
30
23
  }
31
24
  Object.entries(resolvers).forEach(([key, val]) => {
32
- if (schema instanceof definition_1.GraphQLList) {
33
- (0, exports.mergeSubscribeIntoSchema)(schema.ofType, val);
25
+ if (schema instanceof GraphQLList) {
26
+ mergeSubscribeIntoSchema(schema.ofType, val);
34
27
  return;
35
28
  }
36
29
  const field = schema.getFields()[key];
@@ -43,12 +36,11 @@ const mergeSubscribeIntoSchema = (schema, resolvers) => {
43
36
  return;
44
37
  }
45
38
  const fieldType = field.type;
46
- if (fieldType instanceof definition_1.GraphQLScalarType) {
39
+ if (fieldType instanceof GraphQLScalarType) {
47
40
  field.subscribe = val['subscribe'];
48
41
  }
49
- else if (fieldType instanceof graphql_1.GraphQLObjectType) {
50
- (0, exports.mergeSubscribeIntoSchema)(fieldType, val);
42
+ else if (fieldType instanceof GraphQLObjectType) {
43
+ mergeSubscribeIntoSchema(fieldType, val);
51
44
  }
52
45
  });
53
46
  };
54
- exports.mergeSubscribeIntoSchema = mergeSubscribeIntoSchema;
@@ -1,7 +1,7 @@
1
- import { GraphQLInputField, GraphQLOutputType } from 'graphql';
2
- import { GraphQLEnumType, GraphQLInputObjectType, GraphQLInputType } from 'graphql/type/definition';
3
- import { ProtoMetadata, ServiceConfig } from './types';
4
- import { ServiceDescriptorProto } from 'ts-proto-descriptors';
1
+ import { type GraphQLInputField, type GraphQLOutputType } from 'graphql';
2
+ import { GraphQLEnumType, GraphQLInputObjectType, type GraphQLInputType } from 'graphql/type/definition.js';
3
+ import { type ProtoMetadata, type ServiceConfig } from './types.js';
4
+ import { type ServiceDescriptorProto } from 'ts-proto-descriptors';
5
5
  export declare const Mutate: string[];
6
6
  export declare const preprocessGQLInput: (data: any, model: GraphQLInputObjectType | GraphQLEnumType | GraphQLInputField | GraphQLInputType) => Promise<any>;
7
7
  export declare const postProcessGQLValue: (data: any, model: GraphQLOutputType) => any;
@@ -1,14 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWhitelistBlacklistConfig = exports.postProcessGQLValue = exports.preprocessGQLInput = exports.Mutate = void 0;
4
- const graphql_1 = require("graphql");
5
- const definition_1 = require("graphql/type/definition");
6
- exports.Mutate = ['Create', 'Update', 'Upsert'];
7
- const preprocessGQLInput = async (data, model) => {
8
- if (model instanceof definition_1.GraphQLEnumType) {
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
11
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
12
+ var m = o[Symbol.asyncIterator], i;
13
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
14
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
15
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
16
+ };
17
+ import { GraphQLList, GraphQLNonNull, GraphQLObjectType, } from 'graphql';
18
+ import { GraphQLEnumType, GraphQLInputObjectType, GraphQLScalarType, } from 'graphql/type/definition.js';
19
+ export const Mutate = ['Create', 'Update', 'Upsert'];
20
+ export const preprocessGQLInput = (data, model) => __awaiter(void 0, void 0, void 0, function* () {
21
+ var _a, e_1, _b, _c;
22
+ if (model instanceof GraphQLEnumType) {
9
23
  return data;
10
24
  }
11
- if (model instanceof definition_1.GraphQLInputObjectType) {
25
+ if (model instanceof GraphQLInputObjectType) {
12
26
  if (model.name === 'IGoogleProtobufAny') {
13
27
  // TODO Use encoded once resource base supports it
14
28
  // const typing = getTyping(data.typeUrl);
@@ -18,86 +32,95 @@ const preprocessGQLInput = async (data, model) => {
18
32
  //
19
33
  // const encoded = typing.processor.encode(typing.processor.fromPartial(data.value)).finish();
20
34
  const encoded = Buffer.from(JSON.stringify(data.value));
21
- return {
22
- ...data,
23
- value: encoded
24
- };
35
+ return Object.assign(Object.assign({}, data), { value: encoded });
25
36
  }
26
37
  else {
27
38
  const fields = model.getFields();
28
39
  for (let key of Object.keys(fields)) {
29
40
  if (data && key in data) {
30
- data[key] = await (0, exports.preprocessGQLInput)(data[key], fields[key].type);
41
+ data[key] = yield preprocessGQLInput(data[key], fields[key].type);
31
42
  }
32
43
  }
33
44
  }
34
45
  }
35
- if (model instanceof definition_1.GraphQLScalarType) {
46
+ if (model instanceof GraphQLScalarType) {
36
47
  if (model.name === 'IDateTime') {
37
48
  return new Date(data);
38
49
  }
39
50
  }
40
- if (model instanceof graphql_1.GraphQLNonNull) {
41
- return await (0, exports.preprocessGQLInput)(data, model.ofType);
51
+ if (model instanceof GraphQLNonNull) {
52
+ return yield preprocessGQLInput(data, model.ofType);
42
53
  }
43
- if (model instanceof graphql_1.GraphQLList) {
54
+ if (model instanceof GraphQLList) {
44
55
  for (let i = 0; i < data.length; i++) {
45
- data[i] = await (0, exports.preprocessGQLInput)(data[i], model.ofType);
56
+ data[i] = yield preprocessGQLInput(data[i], model.ofType);
46
57
  }
47
58
  }
48
- if (model instanceof definition_1.GraphQLScalarType) {
59
+ if (model instanceof GraphQLScalarType) {
49
60
  switch (model.name) {
50
61
  case 'Upload':
51
62
  if (typeof data !== 'object') {
52
63
  return Buffer.from(data.toString(), 'utf8');
53
64
  }
54
- let fileData = await data;
55
- const upload = await fileData.promise;
65
+ let fileData = yield data;
66
+ const upload = yield fileData.promise;
56
67
  const stream = upload.createReadStream();
57
68
  const chunks = [];
58
- for await (let chunk of stream) {
59
- chunks.push(chunk);
69
+ try {
70
+ for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _a = stream_1_1.done, !_a;) {
71
+ _c = stream_1_1.value;
72
+ _d = false;
73
+ try {
74
+ let chunk = _c;
75
+ chunks.push(chunk);
76
+ }
77
+ finally {
78
+ _d = true;
79
+ }
80
+ }
81
+ }
82
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
83
+ finally {
84
+ try {
85
+ if (!_d && !_a && (_b = stream_1.return)) yield _b.call(stream_1);
86
+ }
87
+ finally { if (e_1) throw e_1.error; }
60
88
  }
61
89
  return Buffer.concat(chunks);
62
90
  }
63
91
  }
64
92
  return data;
65
- };
66
- exports.preprocessGQLInput = preprocessGQLInput;
67
- const postProcessGQLValue = (data, model) => {
68
- if (model instanceof definition_1.GraphQLEnumType) {
93
+ });
94
+ export const postProcessGQLValue = (data, model) => {
95
+ if (model instanceof GraphQLEnumType) {
69
96
  return data;
70
97
  }
71
- if (model instanceof graphql_1.GraphQLObjectType) {
98
+ if (model instanceof GraphQLObjectType) {
72
99
  if (model.name === 'GoogleProtobufAny' && (data === null || data === void 0 ? void 0 : data.value)) {
73
100
  // TODO Use encoded once resource base supports it
74
101
  const decoded = JSON.parse(data.value.toString());
75
- return {
76
- ...data,
77
- value: decoded
78
- };
102
+ return Object.assign(Object.assign({}, data), { value: decoded });
79
103
  }
80
104
  else {
81
105
  const fields = model.getFields();
82
106
  for (let key of Object.keys(fields)) {
83
107
  if (data && key in data) {
84
- data[key] = (0, exports.postProcessGQLValue)(data[key], fields[key].type);
108
+ data[key] = postProcessGQLValue(data[key], fields[key].type);
85
109
  }
86
110
  }
87
111
  }
88
112
  }
89
- if (model instanceof graphql_1.GraphQLNonNull) {
90
- return (0, exports.postProcessGQLValue)(data, model.ofType);
113
+ if (model instanceof GraphQLNonNull) {
114
+ return postProcessGQLValue(data, model.ofType);
91
115
  }
92
- if (model instanceof graphql_1.GraphQLList) {
116
+ if (model instanceof GraphQLList) {
93
117
  for (let i = 0; i < data.length; i++) {
94
- data[i] = (0, exports.postProcessGQLValue)(data[i], model.ofType);
118
+ data[i] = postProcessGQLValue(data[i], model.ofType);
95
119
  }
96
120
  }
97
121
  return data;
98
122
  };
99
- exports.postProcessGQLValue = postProcessGQLValue;
100
- const getWhitelistBlacklistConfig = (metaService, config, meta, entity) => {
123
+ export const getWhitelistBlacklistConfig = (metaService, config, meta, entity) => {
101
124
  var _a, _b, _c, _d;
102
125
  const queryList = [];
103
126
  if (meta.options && meta.options.services && meta.options.services[metaService.name] && meta.options.services[metaService.name].methods) {
@@ -154,7 +177,7 @@ const getWhitelistBlacklistConfig = (metaService, config, meta, entity) => {
154
177
  }
155
178
  }
156
179
  }
157
- if (exports.Mutate.findIndex(val => mut.has(val)) > -1) {
180
+ if (Mutate.findIndex(val => mut.has(val)) > -1) {
158
181
  mut.add('Mutate');
159
182
  }
160
183
  return {
@@ -162,4 +185,3 @@ const getWhitelistBlacklistConfig = (metaService, config, meta, entity) => {
162
185
  queries: que
163
186
  };
164
187
  };
165
- exports.getWhitelistBlacklistConfig = getWhitelistBlacklistConfig;
@@ -1,6 +1,6 @@
1
- export * from './types';
2
- export * from './registry';
3
- export * from './graphql';
4
- export * from './federation';
5
- export * from './resolvers';
6
- export * from './schema';
1
+ export * from './types.js';
2
+ export * from './registry.js';
3
+ export * from './graphql.js';
4
+ export * from './federation.js';
5
+ export * from './resolvers.js';
6
+ export * from './schema.js';
@@ -1,22 +1,6 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./registry"), exports);
19
- __exportStar(require("./graphql"), exports);
20
- __exportStar(require("./federation"), exports);
21
- __exportStar(require("./resolvers"), exports);
22
- __exportStar(require("./schema"), exports);
1
+ export * from './types.js';
2
+ export * from './registry.js';
3
+ export * from './graphql.js';
4
+ export * from './federation.js';
5
+ export * from './resolvers.js';
6
+ export * from './schema.js';
@@ -1,7 +1,7 @@
1
- import { GraphQLEnumTypeConfig, GraphQLInputObjectTypeConfig, GraphQLObjectType, GraphQLObjectTypeConfig } from "graphql";
2
- import { GraphQLEnumType, GraphQLInputObjectType, GraphQLScalarType } from "graphql/type/definition";
3
- import { ProtoMetadata, ProtoMetaMessageOptions } from './types';
4
- import { DescriptorProto, EnumDescriptorProto, MethodDescriptorProto } from "ts-proto-descriptors";
1
+ import { type GraphQLEnumTypeConfig, type GraphQLInputObjectTypeConfig, GraphQLObjectType, type GraphQLObjectTypeConfig } from 'graphql';
2
+ import { GraphQLEnumType, GraphQLInputObjectType, GraphQLScalarType } from 'graphql/type/definition.js';
3
+ import { type ProtoMetadata, type ProtoMetaMessageOptions } from './types.js';
4
+ import { type DescriptorProto, type EnumDescriptorProto, type MethodDescriptorProto } from 'ts-proto-descriptors';
5
5
  export interface TypingData {
6
6
  output: GraphQLObjectType | GraphQLEnumType | GraphQLScalarType;
7
7
  input: GraphQLInputObjectType | GraphQLEnumType | GraphQLScalarType;
@@ -12,12 +12,12 @@ export declare const registeredTypings: Map<string, TypingData>;
12
12
  export declare const scalarTypes: string[];
13
13
  export declare const IGoogleProtobufAny: GraphQLInputObjectType;
14
14
  export declare const clearRegistry: () => void;
15
- export declare const registerPackagesRecursive: (...protoMetadata: ProtoMetadata[]) => void;
16
15
  export declare const getRegisteredEnumTypings: () => string[];
17
16
  export declare const getNameSpaceTypeName: (typeName: string) => string | undefined;
17
+ export declare const getTyping: (type: string) => TypingData | undefined;
18
18
  export declare const recursiveEnumCheck: (typeName: string, enumMap: Map<string, string>, prevFieldName: string, traversedFields: string[]) => Map<string, string>;
19
19
  export declare const registerTyping: (protoPackage: string, message: DescriptorProto, methodDef: MethodDescriptorProto[], opts?: Omit<Readonly<GraphQLObjectTypeConfig<any, any>>, 'fields'>, inputOpts?: Omit<Readonly<GraphQLInputObjectTypeConfig>, 'fields'>, messageOptions?: ProtoMetaMessageOptions) => void;
20
20
  export declare const registerEnumTyping: <T = {
21
21
  [key: string]: any;
22
22
  }>(protoPackage: string, message: EnumDescriptorProto, opts?: Omit<Readonly<GraphQLEnumTypeConfig>, 'values'>) => void;
23
- export declare const getTyping: (type: string) => TypingData | undefined;
23
+ export declare const registerPackagesRecursive: (...protoMetadata: ProtoMetadata[]) => void;