@restorecommerce/facade 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.cjs +13 -0
  3. package/CHANGELOG.md +22 -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 +18 -13
  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
@@ -1,4 +1,4 @@
1
- import { OIDCHbsTemplates } from './interfaces';
1
+ import { type OIDCHbsTemplates } from './interfaces.js';
2
2
  export interface OIDCTemplateError {
3
3
  key: string;
4
4
  message?: string;
@@ -1,56 +1,60 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
+ });
4
9
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.OIDCTemplateEngine = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const fs_1 = __importDefault(require("fs"));
9
- const handlebars_1 = __importDefault(require("handlebars"));
10
- handlebars_1.default.registerHelper('json', (object) => {
10
+ import path from 'node:path';
11
+ import fs from 'node:fs';
12
+ import hbs from 'handlebars';
13
+ import * as url from 'node:url';
14
+ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
15
+ hbs.registerHelper('json', (object) => {
11
16
  return `<pre>${JSON.stringify(object, null, 2)}</pre>`;
12
17
  });
13
- class OIDCTemplateEngine {
18
+ export class OIDCTemplateEngine {
14
19
  constructor(templates) {
15
20
  this.templates = templates;
16
21
  }
17
- async layout(context) {
22
+ layout(context) {
18
23
  var _a, _b;
19
- if (!this.layoutHbs) {
20
- const layoutTpl = (_b = (_a = this.templates) === null || _a === void 0 ? void 0 : _a.login) !== null && _b !== void 0 ? _b : await new Promise((resolve, reject) => {
21
- fs_1.default.readFile(path_1.default.resolve(__dirname, 'views/layout.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
22
- });
23
- this.layoutHbs = handlebars_1.default.compile(layoutTpl);
24
- }
25
- return this.layoutHbs(context);
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ if (!this.layoutHbs) {
26
+ const layoutTpl = (_b = (_a = this.templates) === null || _a === void 0 ? void 0 : _a.login) !== null && _b !== void 0 ? _b : yield new Promise((resolve, reject) => {
27
+ fs.readFile(path.resolve(__dirname, 'views/layout.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
28
+ });
29
+ this.layoutHbs = hbs.compile(layoutTpl);
30
+ }
31
+ return this.layoutHbs(context);
32
+ });
26
33
  }
27
- async login(context) {
34
+ login(context) {
28
35
  var _a, _b;
29
- if (!this.loginHbs) {
30
- const loginTpl = (_b = (_a = this.templates) === null || _a === void 0 ? void 0 : _a.login) !== null && _b !== void 0 ? _b : await new Promise((resolve, reject) => {
31
- fs_1.default.readFile(path_1.default.resolve(__dirname, 'views/login.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
32
- });
33
- this.loginHbs = handlebars_1.default.compile(loginTpl);
34
- }
35
- let html = this.loginHbs(context);
36
- return this.layout({
37
- ...context,
38
- body: html
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ if (!this.loginHbs) {
38
+ const loginTpl = (_b = (_a = this.templates) === null || _a === void 0 ? void 0 : _a.login) !== null && _b !== void 0 ? _b : yield new Promise((resolve, reject) => {
39
+ fs.readFile(path.resolve(__dirname, 'views/login.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
40
+ });
41
+ this.loginHbs = hbs.compile(loginTpl);
42
+ }
43
+ let html = this.loginHbs(context);
44
+ return this.layout(Object.assign(Object.assign({}, context), { body: html }));
39
45
  });
40
46
  }
41
- async consent(context) {
47
+ consent(context) {
42
48
  var _a, _b;
43
- if (!this.consentHbs) {
44
- const consentTpl = (_b = (_a = this.templates) === null || _a === void 0 ? void 0 : _a.consent) !== null && _b !== void 0 ? _b : await new Promise((resolve, reject) => {
45
- fs_1.default.readFile(path_1.default.resolve(__dirname, 'views/consent.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
46
- });
47
- this.consentHbs = handlebars_1.default.compile(consentTpl);
48
- }
49
- let html = this.consentHbs(context);
50
- return this.layout({
51
- ...context,
52
- body: html
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ if (!this.consentHbs) {
51
+ const consentTpl = (_b = (_a = this.templates) === null || _a === void 0 ? void 0 : _a.consent) !== null && _b !== void 0 ? _b : yield new Promise((resolve, reject) => {
52
+ fs.readFile(path.resolve(__dirname, 'views/consent.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
53
+ });
54
+ this.consentHbs = hbs.compile(consentTpl);
55
+ }
56
+ let html = this.consentHbs(context);
57
+ return this.layout(Object.assign(Object.assign({}, context), { body: html }));
53
58
  });
54
59
  }
55
60
  }
56
- exports.OIDCTemplateEngine = OIDCTemplateEngine;
@@ -1,6 +1,6 @@
1
- import { OIDCBodyLoginFn, AuthUser, OIDCLoginFn, OIDCBodyLoginCredentials } from './interfaces';
2
- import { UserServiceClient as userService } from "@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/user";
1
+ import { type OIDCBodyLoginFn, type AuthUser, type OIDCLoginFn, type OIDCBodyLoginCredentials } from './interfaces.js';
2
+ import { type UserServiceClient as userService } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/user.js';
3
+ export declare const loginUser: OIDCLoginFn;
3
4
  export declare const loginUserBody: OIDCBodyLoginFn;
4
5
  export declare const loginUserCredentials: OIDCBodyLoginCredentials;
5
- export declare const loginUser: OIDCLoginFn;
6
- export declare function findUserById(service: userService, id: string): Promise<AuthUser>;
6
+ export declare const findUserById: (service: userService, id: string) => Promise<AuthUser>;
@@ -1,7 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findUserById = exports.loginUser = exports.loginUserCredentials = exports.loginUserBody = void 0;
4
- const user_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/user");
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
+ import { LoginRequest, FindRequest } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/user.js';
5
11
  const KEY_WHITELIST = [
6
12
  'id',
7
13
  'name',
@@ -14,18 +20,14 @@ const KEY_WHITELIST = [
14
20
  'defaultScope',
15
21
  'tokens'
16
22
  ];
17
- const loginUserBody = async (ctx, body) => {
18
- const identifier = typeof (body === null || body === void 0 ? void 0 : body.identifier) === 'string' ? body.identifier : undefined;
19
- const password = typeof (body === null || body === void 0 ? void 0 : body.password) === 'string' ? body.password : undefined;
20
- const remember = !!(body === null || body === void 0 ? void 0 : body.remember);
21
- return (0, exports.loginUser)(ctx, identifier, password, remember);
22
- };
23
- exports.loginUserBody = loginUserBody;
24
- const loginUserCredentials = async (ctx, credentials) => {
25
- return (0, exports.loginUser)(ctx, credentials.identifier, credentials.password || credentials.token);
23
+ const pick = (obj, keys) => {
24
+ const ret = {};
25
+ keys.forEach(key => {
26
+ ret[key] = obj[key];
27
+ });
28
+ return ret;
26
29
  };
27
- exports.loginUserCredentials = loginUserCredentials;
28
- const loginUser = async (ctx, identifier, password, remember) => {
30
+ export const loginUser = (ctx, identifier, password, remember) => __awaiter(void 0, void 0, void 0, function* () {
29
31
  var _a;
30
32
  if (!identifier || !password) {
31
33
  return {
@@ -38,7 +40,7 @@ const loginUser = async (ctx, identifier, password, remember) => {
38
40
  };
39
41
  }
40
42
  try {
41
- const result = await ctx.identitySrvClient.user.Login(user_1.LoginRequest.fromPartial({
43
+ const result = yield ctx.identitySrvClient.user.Login(LoginRequest.fromPartial({
42
44
  identifier,
43
45
  password,
44
46
  }));
@@ -64,10 +66,18 @@ const loginUser = async (ctx, identifier, password, remember) => {
64
66
  }
65
67
  };
66
68
  }
67
- };
68
- exports.loginUser = loginUser;
69
- async function findUserById(service, id) {
70
- const result = await service.find(user_1.FindRequest.fromPartial({
69
+ });
70
+ export const loginUserBody = (ctx, body) => __awaiter(void 0, void 0, void 0, function* () {
71
+ const identifier = typeof (body === null || body === void 0 ? void 0 : body.identifier) === 'string' ? body.identifier : undefined;
72
+ const password = typeof (body === null || body === void 0 ? void 0 : body.password) === 'string' ? body.password : undefined;
73
+ const remember = !!(body === null || body === void 0 ? void 0 : body.remember);
74
+ return loginUser(ctx, identifier, password, remember);
75
+ });
76
+ export const loginUserCredentials = (ctx, credentials) => __awaiter(void 0, void 0, void 0, function* () {
77
+ return loginUser(ctx, credentials.identifier, credentials.password || credentials.token);
78
+ });
79
+ export const findUserById = (service, id) => __awaiter(void 0, void 0, void 0, function* () {
80
+ const result = yield service.find(FindRequest.fromPartial({
71
81
  id,
72
82
  }));
73
83
  if (!(result === null || result === void 0 ? void 0 : result.items) || result.items.length === 0) {
@@ -78,12 +88,4 @@ async function findUserById(service, id) {
78
88
  throw new Error('USER_NOT_FOUND');
79
89
  }
80
90
  return pick(user, KEY_WHITELIST);
81
- }
82
- exports.findUserById = findUserById;
83
- function pick(obj, keys) {
84
- const ret = {};
85
- keys.forEach(key => {
86
- ret[key] = obj[key];
87
- });
88
- return ret;
89
- }
91
+ });
@@ -1,5 +1,5 @@
1
- import { Any } from '@restorecommerce/rc-grpc-clients';
2
- import { AdapterPayload } from 'oidc-provider';
1
+ import { type Any } from '@restorecommerce/rc-grpc-clients';
2
+ import { type AdapterPayload } from 'oidc-provider';
3
3
  export declare const epochTime: (date?: number) => number;
4
4
  export declare const unmarshallProtobufAny: (msg: Any) => AdapterPayload;
5
5
  export declare const marshallProtobufAny: (payload: AdapterPayload) => Any;
@@ -1,22 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nanoid = exports.marshallProtobufAny = exports.unmarshallProtobufAny = exports.epochTime = void 0;
4
- const nanoid_1 = require("nanoid");
5
- const epochTime = (date = Date.now()) => Math.floor(date / 1000);
6
- exports.epochTime = epochTime;
7
- const unmarshallProtobufAny = (msg) => {
1
+ import { customAlphabet } from 'nanoid';
2
+ export const epochTime = (date = Date.now()) => Math.floor(date / 1000);
3
+ export const unmarshallProtobufAny = (msg) => {
8
4
  return JSON.parse(msg.value.toString());
9
5
  };
10
- exports.unmarshallProtobufAny = unmarshallProtobufAny;
11
- const marshallProtobufAny = (payload) => {
6
+ export const marshallProtobufAny = (payload) => {
12
7
  return {
13
8
  typeUrl: '',
14
9
  value: Buffer.from(JSON.stringify(payload))
15
10
  };
16
11
  };
17
- exports.marshallProtobufAny = marshallProtobufAny;
18
- const generate = (0, nanoid_1.customAlphabet)('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-', 21);
19
- const nanoid = () => {
12
+ const generate = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-', 21);
13
+ export const nanoid = () => {
20
14
  return generate();
21
15
  };
22
- exports.nanoid = nanoid;
@@ -1,13 +1,13 @@
1
- export * from './facade-status/index';
2
- export * from './identity/index';
3
- export * from './ordering';
4
- export * from './payment';
5
- export * from './resource';
6
- export * from './catalog';
7
- export * from './invoicing';
8
- export * from './fulfillment';
9
- export * from './indexing';
10
- export * from './scheduling';
11
- export * from './notification';
12
- export * from './access-control';
13
- export * from './ostorage';
1
+ export * from './facade-status/index.js';
2
+ export * from './identity/index.js';
3
+ export * from './ordering/index.js';
4
+ export * from './payment/index.js';
5
+ export * from './resource/index.js';
6
+ export * from './catalog/index.js';
7
+ export * from './invoicing/index.js';
8
+ export * from './fulfillment/index.js';
9
+ export * from './indexing/index.js';
10
+ export * from './scheduling/index.js';
11
+ export * from './notification/index.js';
12
+ export * from './access-control/index.js';
13
+ export * from './ostorage/index.js';
@@ -1,29 +1,13 @@
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("./facade-status/index"), exports);
18
- __exportStar(require("./identity/index"), exports);
19
- __exportStar(require("./ordering"), exports);
20
- __exportStar(require("./payment"), exports);
21
- __exportStar(require("./resource"), exports);
22
- __exportStar(require("./catalog"), exports);
23
- __exportStar(require("./invoicing"), exports);
24
- __exportStar(require("./fulfillment"), exports);
25
- __exportStar(require("./indexing"), exports);
26
- __exportStar(require("./scheduling"), exports);
27
- __exportStar(require("./notification"), exports);
28
- __exportStar(require("./access-control"), exports);
29
- __exportStar(require("./ostorage"), exports);
1
+ export * from './facade-status/index.js';
2
+ export * from './identity/index.js';
3
+ export * from './ordering/index.js';
4
+ export * from './payment/index.js';
5
+ export * from './resource/index.js';
6
+ export * from './catalog/index.js';
7
+ export * from './invoicing/index.js';
8
+ export * from './fulfillment/index.js';
9
+ export * from './indexing/index.js';
10
+ export * from './scheduling/index.js';
11
+ export * from './notification/index.js';
12
+ export * from './access-control/index.js';
13
+ export * from './ostorage/index.js';
@@ -1,2 +1,2 @@
1
- import { SubSpaceServiceConfig } from '../../../gql/protos';
1
+ import { type SubSpaceServiceConfig } from '../../../gql/protos/index.js';
2
2
  export declare const FederatedIndexingSchema: (cfg: SubSpaceServiceConfig) => import("graphql").GraphQLSchema;
@@ -1,20 +1,13 @@
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.FederatedIndexingSchema = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- const federation_1 = require("@apollo/federation");
9
- const schema_1 = require("./schema");
10
- const protos_1 = require("../../../gql/protos");
11
- const interfaces_1 = require("../interfaces");
12
- const graphql_1 = require("graphql");
13
- const types_1 = require("../../access-control/gql/types");
1
+ import { gql } from 'graphql-tag';
2
+ import { buildSubgraphSchema } from '@apollo/federation';
3
+ import { schema } from './schema.js';
4
+ import { generateSubServiceResolvers } from '../../../gql/protos/index.js';
5
+ import { namespace } from '../interfaces.js';
6
+ import { printSchema } from 'graphql';
7
+ import { subServices } from '../../access-control/gql/types.js';
14
8
  // TODO There is currently no way of building a federated schema from GraphQLSchema Object
15
9
  // See https://github.com/apollographql/apollo-server/pull/4310
16
- const FederatedIndexingSchema = (cfg) => (0, federation_1.buildSubgraphSchema)({
17
- typeDefs: (0, graphql_tag_1.default)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
18
- resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
10
+ export const FederatedIndexingSchema = (cfg) => buildSubgraphSchema({
11
+ typeDefs: gql(printSchema(schema(cfg))),
12
+ resolvers: generateSubServiceResolvers(subServices, cfg, namespace)
19
13
  });
20
- exports.FederatedIndexingSchema = FederatedIndexingSchema;
@@ -1,2 +1,2 @@
1
- import { SubSpaceServiceConfig } from "../../../gql/protos";
1
+ import { type SubSpaceServiceConfig } from '../../../gql/protos/index.js';
2
2
  export declare const schema: (cfg: SubSpaceServiceConfig) => import("graphql").GraphQLSchema;
@@ -1,5 +1,5 @@
1
1
  import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql';
2
- import { IndexingContext } from '../interfaces';
2
+ import { IndexingContext } from '../interfaces.js';
3
3
  export type Maybe<T> = T | null | undefined;
4
4
  export type InputMaybe<T> = T | null | undefined;
5
5
  export type Exact<T extends {
@@ -13,17 +13,43 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
13
13
  export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
14
14
  [SubKey in K]: Maybe<T[SubKey]>;
15
15
  };
16
+ export type MakeEmpty<T extends {
17
+ [key: string]: unknown;
18
+ }, K extends keyof T> = {
19
+ [_ in K]?: never;
20
+ };
21
+ export type Incremental<T> = T | {
22
+ [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never;
23
+ };
16
24
  export type RequireFields<T, K extends keyof T> = Omit<T, K> & {
17
25
  [P in K]-?: NonNullable<T[P]>;
18
26
  };
19
27
  /** All built-in and custom scalars, mapped to their actual values */
20
28
  export type Scalars = {
21
- ID: string;
22
- String: string;
23
- Boolean: boolean;
24
- Int: number;
25
- Float: number;
26
- GoogleProtobufAnyValue: any;
29
+ ID: {
30
+ input: string | number;
31
+ output: string;
32
+ };
33
+ String: {
34
+ input: string;
35
+ output: string;
36
+ };
37
+ Boolean: {
38
+ input: boolean;
39
+ output: boolean;
40
+ };
41
+ Int: {
42
+ input: number;
43
+ output: number;
44
+ };
45
+ Float: {
46
+ input: number;
47
+ output: number;
48
+ };
49
+ GoogleProtobufAnyValue: {
50
+ input: any;
51
+ output: any;
52
+ };
27
53
  };
28
54
  export type Mutation = {
29
55
  __typename?: 'Mutation';
@@ -50,13 +76,13 @@ export type IoRestorecommerceSearchSearchResponse = {
50
76
  };
51
77
  export type GoogleProtobufAny = {
52
78
  __typename?: 'GoogleProtobufAny';
53
- typeUrl?: Maybe<Scalars['String']>;
54
- value?: Maybe<Scalars['GoogleProtobufAnyValue']>;
79
+ typeUrl?: Maybe<Scalars['String']['output']>;
80
+ value?: Maybe<Scalars['GoogleProtobufAnyValue']['output']>;
55
81
  };
56
82
  export type IIoRestorecommerceSearchSearchRequest = {
57
- collection?: InputMaybe<Scalars['String']>;
58
- text?: InputMaybe<Scalars['String']>;
59
- acls?: InputMaybe<Array<Scalars['String']>>;
83
+ collection?: InputMaybe<Scalars['String']['input']>;
84
+ text?: InputMaybe<Scalars['String']['input']>;
85
+ acls?: InputMaybe<Array<Scalars['String']['input']>>;
60
86
  };
61
87
  export type Subscription = {
62
88
  __typename?: 'Subscription';
@@ -83,7 +109,7 @@ export type SubscriptionFulfillmentFulfillment_ProductsArgs = {
83
109
  };
84
110
  export type SubscriptionOutput = {
85
111
  __typename?: 'SubscriptionOutput';
86
- id?: Maybe<Scalars['String']>;
112
+ id?: Maybe<Scalars['String']['output']>;
87
113
  };
88
114
  export declare enum SubscriptionAction {
89
115
  Created = "CREATED",
@@ -126,13 +152,13 @@ export type ResolversTypes = ResolversObject<{
126
152
  ProtoIoRestorecommerceSearchSearchResponse: ResolverTypeWrapper<ProtoIoRestorecommerceSearchSearchResponse>;
127
153
  IoRestorecommerceSearchSearchResponse: ResolverTypeWrapper<IoRestorecommerceSearchSearchResponse>;
128
154
  GoogleProtobufAny: ResolverTypeWrapper<GoogleProtobufAny>;
129
- String: ResolverTypeWrapper<Scalars['String']>;
130
- GoogleProtobufAnyValue: ResolverTypeWrapper<Scalars['GoogleProtobufAnyValue']>;
155
+ String: ResolverTypeWrapper<Scalars['String']['output']>;
156
+ GoogleProtobufAnyValue: ResolverTypeWrapper<Scalars['GoogleProtobufAnyValue']['output']>;
131
157
  IIoRestorecommerceSearchSearchRequest: IIoRestorecommerceSearchSearchRequest;
132
158
  Subscription: ResolverTypeWrapper<{}>;
133
159
  SubscriptionOutput: ResolverTypeWrapper<SubscriptionOutput>;
134
160
  SubscriptionAction: SubscriptionAction;
135
- Boolean: ResolverTypeWrapper<Scalars['Boolean']>;
161
+ Boolean: ResolverTypeWrapper<Scalars['Boolean']['output']>;
136
162
  }>;
137
163
  /** Mapping between all available schema types and the resolvers parents */
138
164
  export type ResolversParentTypes = ResolversObject<{
@@ -142,12 +168,12 @@ export type ResolversParentTypes = ResolversObject<{
142
168
  ProtoIoRestorecommerceSearchSearchResponse: ProtoIoRestorecommerceSearchSearchResponse;
143
169
  IoRestorecommerceSearchSearchResponse: IoRestorecommerceSearchSearchResponse;
144
170
  GoogleProtobufAny: GoogleProtobufAny;
145
- String: Scalars['String'];
146
- GoogleProtobufAnyValue: Scalars['GoogleProtobufAnyValue'];
171
+ String: Scalars['String']['output'];
172
+ GoogleProtobufAnyValue: Scalars['GoogleProtobufAnyValue']['output'];
147
173
  IIoRestorecommerceSearchSearchRequest: IIoRestorecommerceSearchSearchRequest;
148
174
  Subscription: {};
149
175
  SubscriptionOutput: SubscriptionOutput;
150
- Boolean: Scalars['Boolean'];
176
+ Boolean: Scalars['Boolean']['output'];
151
177
  }>;
152
178
  export type MutationResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']> = ResolversObject<{
153
179
  indexing?: Resolver<ResolversTypes['IndexingMutation'], ParentType, ContextType>;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriptionAction = void 0;
4
- var SubscriptionAction;
1
+ export var SubscriptionAction;
5
2
  (function (SubscriptionAction) {
6
3
  SubscriptionAction["Created"] = "CREATED";
7
4
  SubscriptionAction["Updated"] = "UPDATED";
8
5
  SubscriptionAction["Deleted"] = "DELETED";
9
- })(SubscriptionAction = exports.SubscriptionAction || (exports.SubscriptionAction = {}));
6
+ })(SubscriptionAction || (SubscriptionAction = {}));
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schema = void 0;
4
- const types_1 = require("./types");
5
- const protos_1 = require("../../../gql/protos");
6
- const interfaces_1 = require("../interfaces");
7
- (0, types_1.registerTypings)();
8
- const schema = (cfg) => (0, protos_1.generateSubServiceSchemas)(types_1.subServices, cfg, interfaces_1.namespace, 'Indexing');
9
- exports.schema = schema;
1
+ import { registerTypings, subServices } from './types.js';
2
+ import { generateSubServiceSchemas } from '../../../gql/protos/index.js';
3
+ import { namespace } from '../interfaces.js';
4
+ registerTypings();
5
+ export const schema = (cfg) => generateSubServiceSchemas(subServices, cfg, namespace, 'Indexing');
@@ -1,3 +1,3 @@
1
- import { ProtoMetadata } from '../../../gql/protos';
2
- export declare function registerTypings(): void;
1
+ import { type ProtoMetadata } from '../../../gql/protos/index.js';
3
2
  export declare const subServices: ProtoMetadata[];
3
+ export declare const registerTypings: () => void;
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subServices = exports.registerTypings = void 0;
4
- const search_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search");
5
- const protos_1 = require("../../../gql/protos");
6
- function registerTypings() {
7
- (0, protos_1.registerPackagesRecursive)(...exports.subServices);
8
- }
9
- exports.registerTypings = registerTypings;
10
- exports.subServices = [
11
- search_1.protoMetadata
1
+ import { protoMetadata } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search.js';
2
+ import { registerPackagesRecursive } from '../../../gql/protos/index.js';
3
+ export const subServices = [
4
+ protoMetadata
12
5
  ];
6
+ export const registerTypings = () => {
7
+ registerPackagesRecursive(...subServices);
8
+ };
@@ -1,6 +1,6 @@
1
1
  import { RestoreCommerceGrpcClient } from '@restorecommerce/rc-grpc-clients';
2
- import { SearchServiceClient } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search';
3
- import { GrpcClientConfig } from '@restorecommerce/grpc-client';
2
+ import { type SearchServiceClient } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search.js';
3
+ import { type GrpcClientConfig } from '@restorecommerce/grpc-client';
4
4
  export declare class IndexingSrvGrpcClient extends RestoreCommerceGrpcClient {
5
5
  readonly search: SearchServiceClient;
6
6
  constructor(address: string, cfg: GrpcClientConfig);
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IndexingSrvGrpcClient = void 0;
4
- const rc_grpc_clients_1 = require("@restorecommerce/rc-grpc-clients");
5
- const search_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search");
6
- class IndexingSrvGrpcClient extends rc_grpc_clients_1.RestoreCommerceGrpcClient {
1
+ import { RestoreCommerceGrpcClient } from '@restorecommerce/rc-grpc-clients';
2
+ import { SearchServiceDefinition } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search.js';
3
+ export class IndexingSrvGrpcClient extends RestoreCommerceGrpcClient {
7
4
  constructor(address, cfg) {
8
5
  super(address, cfg);
9
- this.search = this.createClient(cfg, search_1.SearchServiceDefinition, this.channel);
6
+ this.search = this.createClient(cfg, SearchServiceDefinition, this.channel);
10
7
  }
11
8
  }
12
- exports.IndexingSrvGrpcClient = IndexingSrvGrpcClient;
@@ -1,2 +1,2 @@
1
- import { IndexingConfig } from "./interfaces";
2
- export declare const indexingModule: import("../..").FacadeModuleFactory<IndexingConfig, import("./interfaces").IndexingContext>;
1
+ import { type IndexingConfig } from './interfaces.js';
2
+ export declare const indexingModule: import("../../interfaces.js").FacadeModuleFactory<IndexingConfig, import("./interfaces.js").IndexingContext>;
@@ -1,23 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.indexingModule = void 0;
4
- const federation_1 = require("./gql/federation");
5
- const interfaces_1 = require("./interfaces");
6
- const grpc_1 = require("./grpc");
7
- const utils_1 = require("../../utils");
8
- exports.indexingModule = (0, utils_1.createFacadeModuleFactory)(interfaces_1.namespace, (facade, config) => {
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
+ import { FederatedIndexingSchema } from './gql/federation.js';
11
+ import { namespace } from './interfaces.js';
12
+ import { IndexingSrvGrpcClient } from './grpc/index.js';
13
+ import { createFacadeModuleFactory } from '../../utils.js';
14
+ export const indexingModule = createFacadeModuleFactory(namespace, (facade, config) => {
9
15
  const indexing = {
10
- client: new grpc_1.IndexingSrvGrpcClient(config.config.client.address, {
11
- ...config.config.client,
12
- logger: facade.logger,
13
- })
16
+ client: new IndexingSrvGrpcClient(config.config.client.address, Object.assign(Object.assign({}, config.config.client), { logger: facade.logger }))
14
17
  };
15
18
  facade.addApolloService({
16
- name: interfaces_1.namespace,
17
- schema: (0, federation_1.FederatedIndexingSchema)(config.config)
19
+ name: namespace,
20
+ schema: FederatedIndexingSchema(config.config)
18
21
  });
19
- facade.koa.use(async (ctx, next) => {
22
+ facade.koa.use((ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
20
23
  ctx.indexing = indexing;
21
- await next();
22
- });
24
+ yield next();
25
+ }));
23
26
  });