@restorecommerce/facade 1.3.5 → 1.3.7

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 (268) hide show
  1. package/.eslintrc.cjs +1 -11
  2. package/CHANGELOG.md +20 -0
  3. package/codegen/tsconfig.codegen.tsbuildinfo +1 -0
  4. package/debug-run.ts +1 -1
  5. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  6. package/package.json +5 -4
  7. package/tsconfig-base.json +8 -19
  8. package/tsconfig.codegen.json +0 -1
  9. package/tsconfig.debug.json +1 -5
  10. package/tsconfig.generate.json +0 -3
  11. package/tsconfig.lib.json +1 -2
  12. package/tsconfig.test.json +1 -22
  13. package/codegen/index.d.ts +0 -12
  14. package/codegen/index.js +0 -43
  15. package/dist/gql/index.d.ts +0 -1
  16. package/dist/gql/index.js +0 -1
  17. package/dist/gql/protos/federation.d.ts +0 -6
  18. package/dist/gql/protos/federation.js +0 -46
  19. package/dist/gql/protos/graphql.d.ts +0 -11
  20. package/dist/gql/protos/graphql.js +0 -158
  21. package/dist/gql/protos/index.d.ts +0 -6
  22. package/dist/gql/protos/index.js +0 -6
  23. package/dist/gql/protos/registry.d.ts +0 -23
  24. package/dist/gql/protos/registry.js +0 -366
  25. package/dist/gql/protos/resolvers.d.ts +0 -9
  26. package/dist/gql/protos/resolvers.js +0 -479
  27. package/dist/gql/protos/schema.d.ts +0 -14
  28. package/dist/gql/protos/schema.js +0 -224
  29. package/dist/gql/protos/stream-to-async-iterator.d.ts +0 -50
  30. package/dist/gql/protos/stream-to-async-iterator.js +0 -190
  31. package/dist/gql/protos/types.d.ts +0 -96
  32. package/dist/gql/protos/types.js +0 -1
  33. package/dist/gql/protos/utils.d.ts +0 -18
  34. package/dist/gql/protos/utils.js +0 -133
  35. package/dist/gql/types/AccessControlTypes.d.ts +0 -6
  36. package/dist/gql/types/AccessControlTypes.js +0 -97
  37. package/dist/gql/types/DateType.d.ts +0 -2
  38. package/dist/gql/types/DateType.js +0 -29
  39. package/dist/gql/types/FilterType.d.ts +0 -2
  40. package/dist/gql/types/FilterType.js +0 -72
  41. package/dist/gql/types/MetaType.d.ts +0 -2
  42. package/dist/gql/types/MetaType.js +0 -25
  43. package/dist/gql/types/ScopeType.d.ts +0 -2
  44. package/dist/gql/types/ScopeType.js +0 -13
  45. package/dist/gql/types/SortType.d.ts +0 -3
  46. package/dist/gql/types/SortType.js +0 -30
  47. package/dist/gql/types/StatusType.d.ts +0 -2
  48. package/dist/gql/types/StatusType.js +0 -15
  49. package/dist/gql/types/index.d.ts +0 -7
  50. package/dist/gql/types/index.js +0 -7
  51. package/dist/index.d.ts +0 -63
  52. package/dist/index.js +0 -307
  53. package/dist/interfaces.d.ts +0 -47
  54. package/dist/interfaces.js +0 -4
  55. package/dist/middlewares/index.d.ts +0 -1
  56. package/dist/middlewares/index.js +0 -1
  57. package/dist/middlewares/req-res-logger/index.d.ts +0 -14
  58. package/dist/middlewares/req-res-logger/index.js +0 -90
  59. package/dist/modules/access-control/gql/federation.d.ts +0 -2
  60. package/dist/modules/access-control/gql/federation.js +0 -13
  61. package/dist/modules/access-control/gql/schema.d.ts +0 -2
  62. package/dist/modules/access-control/gql/schema.generated.d.ts +0 -1124
  63. package/dist/modules/access-control/gql/schema.generated.js +0 -80
  64. package/dist/modules/access-control/gql/schema.js +0 -5
  65. package/dist/modules/access-control/gql/types.d.ts +0 -3
  66. package/dist/modules/access-control/gql/types.js +0 -14
  67. package/dist/modules/access-control/grpc/index.d.ts +0 -13
  68. package/dist/modules/access-control/grpc/index.js +0 -14
  69. package/dist/modules/access-control/index.d.ts +0 -2
  70. package/dist/modules/access-control/index.js +0 -26
  71. package/dist/modules/access-control/interfaces.d.ts +0 -15
  72. package/dist/modules/access-control/interfaces.js +0 -1
  73. package/dist/modules/catalog/gql/federation.d.ts +0 -2
  74. package/dist/modules/catalog/gql/federation.js +0 -13
  75. package/dist/modules/catalog/gql/schema.d.ts +0 -2
  76. package/dist/modules/catalog/gql/schema.generated.d.ts +0 -1503
  77. package/dist/modules/catalog/gql/schema.generated.js +0 -74
  78. package/dist/modules/catalog/gql/schema.js +0 -5
  79. package/dist/modules/catalog/gql/types.d.ts +0 -3
  80. package/dist/modules/catalog/gql/types.js +0 -16
  81. package/dist/modules/catalog/grpc/index.d.ts +0 -15
  82. package/dist/modules/catalog/grpc/index.js +0 -16
  83. package/dist/modules/catalog/index.d.ts +0 -2
  84. package/dist/modules/catalog/index.js +0 -26
  85. package/dist/modules/catalog/interfaces.d.ts +0 -16
  86. package/dist/modules/catalog/interfaces.js +0 -1
  87. package/dist/modules/facade-status/gql/index.d.ts +0 -1
  88. package/dist/modules/facade-status/gql/index.js +0 -11
  89. package/dist/modules/facade-status/gql/resolvers.d.ts +0 -2
  90. package/dist/modules/facade-status/gql/resolvers.js +0 -18
  91. package/dist/modules/facade-status/gql/schema.d.ts +0 -3
  92. package/dist/modules/facade-status/gql/schema.generated.d.ts +0 -109
  93. package/dist/modules/facade-status/gql/schema.generated.js +0 -1
  94. package/dist/modules/facade-status/gql/schema.js +0 -14
  95. package/dist/modules/facade-status/gql/types.d.ts +0 -2
  96. package/dist/modules/facade-status/gql/types.js +0 -10
  97. package/dist/modules/facade-status/index.d.ts +0 -2
  98. package/dist/modules/facade-status/index.js +0 -8
  99. package/dist/modules/facade-status/interfaces.d.ts +0 -4
  100. package/dist/modules/facade-status/interfaces.js +0 -1
  101. package/dist/modules/fulfillment/gql/federation.d.ts +0 -2
  102. package/dist/modules/fulfillment/gql/federation.js +0 -13
  103. package/dist/modules/fulfillment/gql/schema.d.ts +0 -2
  104. package/dist/modules/fulfillment/gql/schema.generated.d.ts +0 -1539
  105. package/dist/modules/fulfillment/gql/schema.generated.js +0 -79
  106. package/dist/modules/fulfillment/gql/schema.js +0 -5
  107. package/dist/modules/fulfillment/gql/types.d.ts +0 -3
  108. package/dist/modules/fulfillment/gql/types.js +0 -12
  109. package/dist/modules/fulfillment/grpc/index.d.ts +0 -9
  110. package/dist/modules/fulfillment/grpc/index.js +0 -10
  111. package/dist/modules/fulfillment/index.d.ts +0 -2
  112. package/dist/modules/fulfillment/index.js +0 -26
  113. package/dist/modules/fulfillment/interfaces.d.ts +0 -16
  114. package/dist/modules/fulfillment/interfaces.js +0 -1
  115. package/dist/modules/identity/api-key/api-key.d.ts +0 -11
  116. package/dist/modules/identity/api-key/api-key.js +0 -137
  117. package/dist/modules/identity/gql/federation.d.ts +0 -2
  118. package/dist/modules/identity/gql/federation.js +0 -5
  119. package/dist/modules/identity/gql/schema.d.ts +0 -2
  120. package/dist/modules/identity/gql/schema.generated.d.ts +0 -1661
  121. package/dist/modules/identity/gql/schema.generated.js +0 -75
  122. package/dist/modules/identity/gql/schema.js +0 -5
  123. package/dist/modules/identity/gql/types.d.ts +0 -3
  124. package/dist/modules/identity/gql/types.js +0 -18
  125. package/dist/modules/identity/grpc/index.d.ts +0 -15
  126. package/dist/modules/identity/grpc/index.js +0 -16
  127. package/dist/modules/identity/index.d.ts +0 -4
  128. package/dist/modules/identity/index.js +0 -54
  129. package/dist/modules/identity/interfaces.d.ts +0 -22
  130. package/dist/modules/identity/interfaces.js +0 -1
  131. package/dist/modules/identity/oauth/oauth.d.ts +0 -11
  132. package/dist/modules/identity/oauth/oauth.js +0 -170
  133. package/dist/modules/identity/oidc/adapter.d.ts +0 -4
  134. package/dist/modules/identity/oidc/adapter.js +0 -135
  135. package/dist/modules/identity/oidc/in-memory-adapter.d.ts +0 -16
  136. package/dist/modules/identity/oidc/in-memory-adapter.js +0 -85
  137. package/dist/modules/identity/oidc/index.d.ts +0 -18
  138. package/dist/modules/identity/oidc/index.js +0 -147
  139. package/dist/modules/identity/oidc/interfaces.d.ts +0 -73
  140. package/dist/modules/identity/oidc/interfaces.js +0 -7
  141. package/dist/modules/identity/oidc/password-grant.d.ts +0 -2
  142. package/dist/modules/identity/oidc/password-grant.js +0 -163
  143. package/dist/modules/identity/oidc/router.d.ts +0 -13
  144. package/dist/modules/identity/oidc/router.js +0 -164
  145. package/dist/modules/identity/oidc/templates.d.ts +0 -36
  146. package/dist/modules/identity/oidc/templates.js +0 -60
  147. package/dist/modules/identity/oidc/user.d.ts +0 -6
  148. package/dist/modules/identity/oidc/user.js +0 -91
  149. package/dist/modules/identity/oidc/utils.d.ts +0 -6
  150. package/dist/modules/identity/oidc/utils.js +0 -15
  151. package/dist/modules/index.d.ts +0 -13
  152. package/dist/modules/index.js +0 -13
  153. package/dist/modules/indexing/gql/federation.d.ts +0 -2
  154. package/dist/modules/indexing/gql/federation.js +0 -13
  155. package/dist/modules/indexing/gql/schema.d.ts +0 -2
  156. package/dist/modules/indexing/gql/schema.generated.d.ts +0 -226
  157. package/dist/modules/indexing/gql/schema.generated.js +0 -6
  158. package/dist/modules/indexing/gql/schema.js +0 -5
  159. package/dist/modules/indexing/gql/types.d.ts +0 -3
  160. package/dist/modules/indexing/gql/types.js +0 -8
  161. package/dist/modules/indexing/grpc/index.d.ts +0 -7
  162. package/dist/modules/indexing/grpc/index.js +0 -8
  163. package/dist/modules/indexing/index.d.ts +0 -2
  164. package/dist/modules/indexing/index.js +0 -26
  165. package/dist/modules/indexing/interfaces.d.ts +0 -13
  166. package/dist/modules/indexing/interfaces.js +0 -1
  167. package/dist/modules/invoicing/gql/federation.d.ts +0 -2
  168. package/dist/modules/invoicing/gql/federation.js +0 -13
  169. package/dist/modules/invoicing/gql/schema.d.ts +0 -2
  170. package/dist/modules/invoicing/gql/schema.generated.d.ts +0 -1150
  171. package/dist/modules/invoicing/gql/schema.generated.js +0 -75
  172. package/dist/modules/invoicing/gql/schema.js +0 -5
  173. package/dist/modules/invoicing/gql/types.d.ts +0 -3
  174. package/dist/modules/invoicing/gql/types.js +0 -8
  175. package/dist/modules/invoicing/grpc/index.d.ts +0 -7
  176. package/dist/modules/invoicing/grpc/index.js +0 -8
  177. package/dist/modules/invoicing/index.d.ts +0 -2
  178. package/dist/modules/invoicing/index.js +0 -26
  179. package/dist/modules/invoicing/interfaces.d.ts +0 -16
  180. package/dist/modules/invoicing/interfaces.js +0 -1
  181. package/dist/modules/master_data/gql/federation.d.ts +0 -2
  182. package/dist/modules/master_data/gql/federation.js +0 -13
  183. package/dist/modules/master_data/gql/schema.d.ts +0 -2
  184. package/dist/modules/master_data/gql/schema.generated.d.ts +0 -2520
  185. package/dist/modules/master_data/gql/schema.generated.js +0 -114
  186. package/dist/modules/master_data/gql/schema.js +0 -5
  187. package/dist/modules/master_data/gql/types.d.ts +0 -3
  188. package/dist/modules/master_data/gql/types.js +0 -32
  189. package/dist/modules/master_data/grpc/index.d.ts +0 -30
  190. package/dist/modules/master_data/grpc/index.js +0 -32
  191. package/dist/modules/master_data/index.d.ts +0 -2
  192. package/dist/modules/master_data/index.js +0 -26
  193. package/dist/modules/master_data/interfaces.d.ts +0 -16
  194. package/dist/modules/master_data/interfaces.js +0 -1
  195. package/dist/modules/notification/gql/federation.d.ts +0 -2
  196. package/dist/modules/notification/gql/federation.js +0 -13
  197. package/dist/modules/notification/gql/schema.d.ts +0 -2
  198. package/dist/modules/notification/gql/schema.generated.d.ts +0 -632
  199. package/dist/modules/notification/gql/schema.generated.js +0 -68
  200. package/dist/modules/notification/gql/schema.js +0 -5
  201. package/dist/modules/notification/gql/types.d.ts +0 -3
  202. package/dist/modules/notification/gql/types.js +0 -8
  203. package/dist/modules/notification/grpc/index.d.ts +0 -7
  204. package/dist/modules/notification/grpc/index.js +0 -8
  205. package/dist/modules/notification/index.d.ts +0 -2
  206. package/dist/modules/notification/index.js +0 -26
  207. package/dist/modules/notification/interfaces.d.ts +0 -16
  208. package/dist/modules/notification/interfaces.js +0 -1
  209. package/dist/modules/ordering/gql/federation.d.ts +0 -2
  210. package/dist/modules/ordering/gql/federation.js +0 -13
  211. package/dist/modules/ordering/gql/schema.d.ts +0 -2
  212. package/dist/modules/ordering/gql/schema.generated.d.ts +0 -1407
  213. package/dist/modules/ordering/gql/schema.generated.js +0 -91
  214. package/dist/modules/ordering/gql/schema.js +0 -5
  215. package/dist/modules/ordering/gql/types.d.ts +0 -3
  216. package/dist/modules/ordering/gql/types.js +0 -8
  217. package/dist/modules/ordering/grpc/index.d.ts +0 -7
  218. package/dist/modules/ordering/grpc/index.js +0 -8
  219. package/dist/modules/ordering/index.d.ts +0 -2
  220. package/dist/modules/ordering/index.js +0 -26
  221. package/dist/modules/ordering/interfaces.d.ts +0 -16
  222. package/dist/modules/ordering/interfaces.js +0 -1
  223. package/dist/modules/ostorage/gql/federation.d.ts +0 -2
  224. package/dist/modules/ostorage/gql/federation.js +0 -13
  225. package/dist/modules/ostorage/gql/schema.d.ts +0 -2
  226. package/dist/modules/ostorage/gql/schema.generated.d.ts +0 -846
  227. package/dist/modules/ostorage/gql/schema.generated.js +0 -31
  228. package/dist/modules/ostorage/gql/schema.js +0 -5
  229. package/dist/modules/ostorage/gql/types.d.ts +0 -3
  230. package/dist/modules/ostorage/gql/types.js +0 -8
  231. package/dist/modules/ostorage/grpc/index.d.ts +0 -7
  232. package/dist/modules/ostorage/grpc/index.js +0 -8
  233. package/dist/modules/ostorage/index.d.ts +0 -2
  234. package/dist/modules/ostorage/index.js +0 -46
  235. package/dist/modules/ostorage/interfaces.d.ts +0 -16
  236. package/dist/modules/ostorage/interfaces.js +0 -1
  237. package/dist/modules/ostorage/objectDownloadReqHandler.d.ts +0 -1
  238. package/dist/modules/ostorage/objectDownloadReqHandler.js +0 -134
  239. package/dist/modules/payment/gql/federation.d.ts +0 -2
  240. package/dist/modules/payment/gql/federation.js +0 -13
  241. package/dist/modules/payment/gql/schema.d.ts +0 -2
  242. package/dist/modules/payment/gql/schema.generated.d.ts +0 -647
  243. package/dist/modules/payment/gql/schema.generated.js +0 -156
  244. package/dist/modules/payment/gql/schema.js +0 -5
  245. package/dist/modules/payment/gql/types.d.ts +0 -3
  246. package/dist/modules/payment/gql/types.js +0 -8
  247. package/dist/modules/payment/grpc/index.d.ts +0 -7
  248. package/dist/modules/payment/grpc/index.js +0 -8
  249. package/dist/modules/payment/index.d.ts +0 -2
  250. package/dist/modules/payment/index.js +0 -26
  251. package/dist/modules/payment/interfaces.d.ts +0 -16
  252. package/dist/modules/payment/interfaces.js +0 -1
  253. package/dist/modules/scheduling/gql/federation.d.ts +0 -2
  254. package/dist/modules/scheduling/gql/federation.js +0 -13
  255. package/dist/modules/scheduling/gql/schema.d.ts +0 -2
  256. package/dist/modules/scheduling/gql/schema.generated.d.ts +0 -626
  257. package/dist/modules/scheduling/gql/schema.generated.js +0 -31
  258. package/dist/modules/scheduling/gql/schema.js +0 -5
  259. package/dist/modules/scheduling/gql/types.d.ts +0 -3
  260. package/dist/modules/scheduling/gql/types.js +0 -8
  261. package/dist/modules/scheduling/grpc/index.d.ts +0 -7
  262. package/dist/modules/scheduling/grpc/index.js +0 -8
  263. package/dist/modules/scheduling/index.d.ts +0 -2
  264. package/dist/modules/scheduling/index.js +0 -26
  265. package/dist/modules/scheduling/interfaces.d.ts +0 -16
  266. package/dist/modules/scheduling/interfaces.js +0 -1
  267. package/dist/utils.d.ts +0 -5
  268. package/dist/utils.js +0 -14
@@ -1,60 +0,0 @@
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 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) => {
16
- return `<pre>${JSON.stringify(object, null, 2)}</pre>`;
17
- });
18
- export class OIDCTemplateEngine {
19
- constructor(templates) {
20
- this.templates = templates;
21
- }
22
- layout(context) {
23
- var _a, _b;
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
- });
33
- }
34
- login(context) {
35
- var _a, _b;
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 }));
45
- });
46
- }
47
- consent(context) {
48
- var _a, _b;
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 }));
58
- });
59
- }
60
- }
@@ -1,6 +0,0 @@
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;
4
- export declare const loginUserBody: OIDCBodyLoginFn;
5
- export declare const loginUserCredentials: OIDCBodyLoginCredentials;
6
- export declare const findUserById: (service: userService, id: string) => Promise<AuthUser>;
@@ -1,91 +0,0 @@
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';
11
- const KEY_WHITELIST = [
12
- 'id',
13
- 'name',
14
- 'email',
15
- 'localeId',
16
- 'timezoneId',
17
- 'roleAssociations',
18
- 'firstName',
19
- 'lastName',
20
- 'defaultScope',
21
- 'tokens'
22
- ];
23
- const pick = (obj, keys) => {
24
- const ret = {};
25
- keys.forEach(key => {
26
- ret[key] = obj[key];
27
- });
28
- return ret;
29
- };
30
- export const loginUser = (ctx, identifier, password, remember) => __awaiter(void 0, void 0, void 0, function* () {
31
- var _a;
32
- if (!identifier || !password) {
33
- return {
34
- identifier,
35
- remember,
36
- error: {
37
- key: 'MISSING_IDENTIFIER_OR_PASSWORD',
38
- message: 'Missing identifier or password'
39
- }
40
- };
41
- }
42
- try {
43
- const result = yield ctx.identitySrvClient.user.Login(LoginRequest.fromPartial({
44
- identifier,
45
- password,
46
- }));
47
- if (!result) {
48
- return {
49
- error: {
50
- key: 'INVALID_IDENTIFIER_OR_PASSWORD',
51
- message: 'Invalid identifier or password'
52
- }
53
- };
54
- }
55
- return {
56
- user: pick(result, KEY_WHITELIST),
57
- identifier,
58
- remember
59
- };
60
- }
61
- catch (error) {
62
- return {
63
- error: {
64
- key: 'ERROR',
65
- message: (_a = error === null || error === void 0 ? void 0 : error.toString()) !== null && _a !== void 0 ? _a : 'Error'
66
- }
67
- };
68
- }
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({
81
- id,
82
- }));
83
- if (!(result === null || result === void 0 ? void 0 : result.items) || result.items.length === 0) {
84
- throw new Error('USER_NOT_FOUND');
85
- }
86
- const user = result.items[0].payload;
87
- if (!user) {
88
- throw new Error('USER_NOT_FOUND');
89
- }
90
- return pick(user, KEY_WHITELIST);
91
- });
@@ -1,6 +0,0 @@
1
- import { type Any } from '@restorecommerce/rc-grpc-clients';
2
- import { type AdapterPayload } from 'oidc-provider';
3
- export declare const epochTime: (date?: number) => number;
4
- export declare const unmarshallProtobufAny: (msg: Any) => AdapterPayload;
5
- export declare const marshallProtobufAny: (payload: AdapterPayload) => Any;
6
- export declare const nanoid: () => string;
@@ -1,15 +0,0 @@
1
- import { customAlphabet } from 'nanoid';
2
- export const epochTime = (date = Date.now()) => Math.floor(date / 1000);
3
- export const unmarshallProtobufAny = (msg) => {
4
- return JSON.parse(msg.value.toString());
5
- };
6
- export const marshallProtobufAny = (payload) => {
7
- return {
8
- typeUrl: '',
9
- value: Buffer.from(JSON.stringify(payload))
10
- };
11
- };
12
- const generate = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-', 21);
13
- export const nanoid = () => {
14
- return generate();
15
- };
@@ -1,13 +0,0 @@
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 './master_data/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,13 +0,0 @@
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 './master_data/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 +0,0 @@
1
- import { type SubSpaceServiceConfig } from '../../../gql/protos/index.js';
2
- export declare const FederatedIndexingSchema: (cfg: SubSpaceServiceConfig) => import("graphql").GraphQLSchema;
@@ -1,13 +0,0 @@
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';
8
- // TODO There is currently no way of building a federated schema from GraphQLSchema Object
9
- // See https://github.com/apollographql/apollo-server/pull/4310
10
- export const FederatedIndexingSchema = (cfg) => buildSubgraphSchema({
11
- typeDefs: gql(printSchema(schema(cfg))),
12
- resolvers: generateSubServiceResolvers(subServices, cfg, namespace)
13
- });
@@ -1,2 +0,0 @@
1
- import { type SubSpaceServiceConfig } from '../../../gql/protos/index.js';
2
- export declare const schema: (cfg: SubSpaceServiceConfig) => import("graphql").GraphQLSchema;
@@ -1,226 +0,0 @@
1
- import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql';
2
- import { IndexingContext } from '../interfaces.js';
3
- export type Maybe<T> = T | null | undefined;
4
- export type InputMaybe<T> = T | null | undefined;
5
- export type Exact<T extends {
6
- [key: string]: unknown;
7
- }> = {
8
- [K in keyof T]: T[K];
9
- };
10
- export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
11
- [SubKey in K]?: Maybe<T[SubKey]>;
12
- };
13
- export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
14
- [SubKey in K]: Maybe<T[SubKey]>;
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
- };
24
- export type RequireFields<T, K extends keyof T> = Omit<T, K> & {
25
- [P in K]-?: NonNullable<T[P]>;
26
- };
27
- /** All built-in and custom scalars, mapped to their actual values */
28
- export type Scalars = {
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
- };
53
- };
54
- export type Mutation = {
55
- __typename?: 'Mutation';
56
- indexing: IndexingMutation;
57
- };
58
- export type IndexingMutation = {
59
- __typename?: 'IndexingMutation';
60
- search: IndexingSearchMutation;
61
- };
62
- export type IndexingSearchMutation = {
63
- __typename?: 'IndexingSearchMutation';
64
- Search?: Maybe<ProtoIoRestorecommerceSearchSearchResponse>;
65
- };
66
- export type IndexingSearchMutationSearchArgs = {
67
- input: IIoRestorecommerceSearchSearchRequest;
68
- };
69
- export type ProtoIoRestorecommerceSearchSearchResponse = {
70
- __typename?: 'ProtoIoRestorecommerceSearchSearchResponse';
71
- details?: Maybe<IoRestorecommerceSearchSearchResponse>;
72
- };
73
- export type IoRestorecommerceSearchSearchResponse = {
74
- __typename?: 'IoRestorecommerceSearchSearchResponse';
75
- data?: Maybe<Array<GoogleProtobufAny>>;
76
- };
77
- export type GoogleProtobufAny = {
78
- __typename?: 'GoogleProtobufAny';
79
- typeUrl?: Maybe<Scalars['String']['output']>;
80
- value?: Maybe<Scalars['GoogleProtobufAnyValue']['output']>;
81
- };
82
- export type IIoRestorecommerceSearchSearchRequest = {
83
- collection?: InputMaybe<Scalars['String']['input']>;
84
- text?: InputMaybe<Scalars['String']['input']>;
85
- acls?: InputMaybe<Array<Scalars['String']['input']>>;
86
- };
87
- export type Subscription = {
88
- __typename?: 'Subscription';
89
- orderingOrders?: Maybe<SubscriptionOutput>;
90
- catalogProducts?: Maybe<SubscriptionOutput>;
91
- fulfillmentFulfillments?: Maybe<SubscriptionOutput>;
92
- fulfillmentFulfillmentCouriers?: Maybe<SubscriptionOutput>;
93
- fulfillmentFulfillment_products?: Maybe<SubscriptionOutput>;
94
- };
95
- export type SubscriptionOrderingOrdersArgs = {
96
- action?: InputMaybe<SubscriptionAction>;
97
- };
98
- export type SubscriptionCatalogProductsArgs = {
99
- action?: InputMaybe<SubscriptionAction>;
100
- };
101
- export type SubscriptionFulfillmentFulfillmentsArgs = {
102
- action?: InputMaybe<SubscriptionAction>;
103
- };
104
- export type SubscriptionFulfillmentFulfillmentCouriersArgs = {
105
- action?: InputMaybe<SubscriptionAction>;
106
- };
107
- export type SubscriptionFulfillmentFulfillment_ProductsArgs = {
108
- action?: InputMaybe<SubscriptionAction>;
109
- };
110
- export type SubscriptionOutput = {
111
- __typename?: 'SubscriptionOutput';
112
- id?: Maybe<Scalars['String']['output']>;
113
- };
114
- export declare enum SubscriptionAction {
115
- Created = "CREATED",
116
- Updated = "UPDATED",
117
- Deleted = "DELETED"
118
- }
119
- export type WithIndex<TObject> = TObject & Record<string, any>;
120
- export type ResolversObject<TObject> = WithIndex<TObject>;
121
- export type ResolverTypeWrapper<T> = Promise<T> | T;
122
- export type ResolverWithResolve<TResult, TParent, TContext, TArgs> = {
123
- resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
124
- };
125
- export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = ResolverFn<TResult, TParent, TContext, TArgs> | ResolverWithResolve<TResult, TParent, TContext, TArgs>;
126
- export type ResolverFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => Promise<TResult> | TResult;
127
- export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>;
128
- export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult | Promise<TResult>;
129
- export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> {
130
- subscribe: SubscriptionSubscribeFn<{
131
- [key in TKey]: TResult;
132
- }, TParent, TContext, TArgs>;
133
- resolve?: SubscriptionResolveFn<TResult, {
134
- [key in TKey]: TResult;
135
- }, TContext, TArgs>;
136
- }
137
- export interface SubscriptionResolverObject<TResult, TParent, TContext, TArgs> {
138
- subscribe: SubscriptionSubscribeFn<any, TParent, TContext, TArgs>;
139
- resolve: SubscriptionResolveFn<TResult, any, TContext, TArgs>;
140
- }
141
- export type SubscriptionObject<TResult, TKey extends string, TParent, TContext, TArgs> = SubscriptionSubscriberObject<TResult, TKey, TParent, TContext, TArgs> | SubscriptionResolverObject<TResult, TParent, TContext, TArgs>;
142
- export type SubscriptionResolver<TResult, TKey extends string, TParent = {}, TContext = {}, TArgs = {}> = ((...args: any[]) => SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>) | SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>;
143
- export type TypeResolveFn<TTypes, TParent = {}, TContext = {}> = (parent: TParent, context: TContext, info: GraphQLResolveInfo) => Maybe<TTypes> | Promise<Maybe<TTypes>>;
144
- export type IsTypeOfResolverFn<T = {}, TContext = {}> = (obj: T, context: TContext, info: GraphQLResolveInfo) => boolean | Promise<boolean>;
145
- export type NextResolverFn<T> = () => Promise<T>;
146
- export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs = {}> = (next: NextResolverFn<TResult>, parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult | Promise<TResult>;
147
- /** Mapping between all available schema types and the resolvers types */
148
- export type ResolversTypes = ResolversObject<{
149
- Mutation: ResolverTypeWrapper<{}>;
150
- IndexingMutation: ResolverTypeWrapper<IndexingMutation>;
151
- IndexingSearchMutation: ResolverTypeWrapper<IndexingSearchMutation>;
152
- ProtoIoRestorecommerceSearchSearchResponse: ResolverTypeWrapper<ProtoIoRestorecommerceSearchSearchResponse>;
153
- IoRestorecommerceSearchSearchResponse: ResolverTypeWrapper<IoRestorecommerceSearchSearchResponse>;
154
- GoogleProtobufAny: ResolverTypeWrapper<GoogleProtobufAny>;
155
- String: ResolverTypeWrapper<Scalars['String']['output']>;
156
- GoogleProtobufAnyValue: ResolverTypeWrapper<Scalars['GoogleProtobufAnyValue']['output']>;
157
- IIoRestorecommerceSearchSearchRequest: IIoRestorecommerceSearchSearchRequest;
158
- Subscription: ResolverTypeWrapper<{}>;
159
- SubscriptionOutput: ResolverTypeWrapper<SubscriptionOutput>;
160
- SubscriptionAction: SubscriptionAction;
161
- Boolean: ResolverTypeWrapper<Scalars['Boolean']['output']>;
162
- }>;
163
- /** Mapping between all available schema types and the resolvers parents */
164
- export type ResolversParentTypes = ResolversObject<{
165
- Mutation: {};
166
- IndexingMutation: IndexingMutation;
167
- IndexingSearchMutation: IndexingSearchMutation;
168
- ProtoIoRestorecommerceSearchSearchResponse: ProtoIoRestorecommerceSearchSearchResponse;
169
- IoRestorecommerceSearchSearchResponse: IoRestorecommerceSearchSearchResponse;
170
- GoogleProtobufAny: GoogleProtobufAny;
171
- String: Scalars['String']['output'];
172
- GoogleProtobufAnyValue: Scalars['GoogleProtobufAnyValue']['output'];
173
- IIoRestorecommerceSearchSearchRequest: IIoRestorecommerceSearchSearchRequest;
174
- Subscription: {};
175
- SubscriptionOutput: SubscriptionOutput;
176
- Boolean: Scalars['Boolean']['output'];
177
- }>;
178
- export type MutationResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']> = ResolversObject<{
179
- indexing?: Resolver<ResolversTypes['IndexingMutation'], ParentType, ContextType>;
180
- }>;
181
- export type IndexingMutationResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['IndexingMutation'] = ResolversParentTypes['IndexingMutation']> = ResolversObject<{
182
- search?: Resolver<ResolversTypes['IndexingSearchMutation'], ParentType, ContextType>;
183
- __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
184
- }>;
185
- export type IndexingSearchMutationResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['IndexingSearchMutation'] = ResolversParentTypes['IndexingSearchMutation']> = ResolversObject<{
186
- Search?: Resolver<Maybe<ResolversTypes['ProtoIoRestorecommerceSearchSearchResponse']>, ParentType, ContextType, RequireFields<IndexingSearchMutationSearchArgs, 'input'>>;
187
- __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
188
- }>;
189
- export type ProtoIoRestorecommerceSearchSearchResponseResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['ProtoIoRestorecommerceSearchSearchResponse'] = ResolversParentTypes['ProtoIoRestorecommerceSearchSearchResponse']> = ResolversObject<{
190
- details?: Resolver<Maybe<ResolversTypes['IoRestorecommerceSearchSearchResponse']>, ParentType, ContextType>;
191
- __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
192
- }>;
193
- export type IoRestorecommerceSearchSearchResponseResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['IoRestorecommerceSearchSearchResponse'] = ResolversParentTypes['IoRestorecommerceSearchSearchResponse']> = ResolversObject<{
194
- data?: Resolver<Maybe<Array<ResolversTypes['GoogleProtobufAny']>>, ParentType, ContextType>;
195
- __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
196
- }>;
197
- export type GoogleProtobufAnyResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['GoogleProtobufAny'] = ResolversParentTypes['GoogleProtobufAny']> = ResolversObject<{
198
- typeUrl?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
199
- value?: Resolver<Maybe<ResolversTypes['GoogleProtobufAnyValue']>, ParentType, ContextType>;
200
- __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
201
- }>;
202
- export interface GoogleProtobufAnyValueScalarConfig extends GraphQLScalarTypeConfig<ResolversTypes['GoogleProtobufAnyValue'], any> {
203
- name: 'GoogleProtobufAnyValue';
204
- }
205
- export type SubscriptionResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['Subscription'] = ResolversParentTypes['Subscription']> = ResolversObject<{
206
- orderingOrders?: SubscriptionResolver<Maybe<ResolversTypes['SubscriptionOutput']>, "orderingOrders", ParentType, ContextType, Partial<SubscriptionOrderingOrdersArgs>>;
207
- catalogProducts?: SubscriptionResolver<Maybe<ResolversTypes['SubscriptionOutput']>, "catalogProducts", ParentType, ContextType, Partial<SubscriptionCatalogProductsArgs>>;
208
- fulfillmentFulfillments?: SubscriptionResolver<Maybe<ResolversTypes['SubscriptionOutput']>, "fulfillmentFulfillments", ParentType, ContextType, Partial<SubscriptionFulfillmentFulfillmentsArgs>>;
209
- fulfillmentFulfillmentCouriers?: SubscriptionResolver<Maybe<ResolversTypes['SubscriptionOutput']>, "fulfillmentFulfillmentCouriers", ParentType, ContextType, Partial<SubscriptionFulfillmentFulfillmentCouriersArgs>>;
210
- fulfillmentFulfillment_products?: SubscriptionResolver<Maybe<ResolversTypes['SubscriptionOutput']>, "fulfillmentFulfillment_products", ParentType, ContextType, Partial<SubscriptionFulfillmentFulfillment_ProductsArgs>>;
211
- }>;
212
- export type SubscriptionOutputResolvers<ContextType = IndexingContext, ParentType extends ResolversParentTypes['SubscriptionOutput'] = ResolversParentTypes['SubscriptionOutput']> = ResolversObject<{
213
- id?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
214
- __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
215
- }>;
216
- export type Resolvers<ContextType = IndexingContext> = ResolversObject<{
217
- Mutation?: MutationResolvers<ContextType>;
218
- IndexingMutation?: IndexingMutationResolvers<ContextType>;
219
- IndexingSearchMutation?: IndexingSearchMutationResolvers<ContextType>;
220
- ProtoIoRestorecommerceSearchSearchResponse?: ProtoIoRestorecommerceSearchSearchResponseResolvers<ContextType>;
221
- IoRestorecommerceSearchSearchResponse?: IoRestorecommerceSearchSearchResponseResolvers<ContextType>;
222
- GoogleProtobufAny?: GoogleProtobufAnyResolvers<ContextType>;
223
- GoogleProtobufAnyValue?: GraphQLScalarType;
224
- Subscription?: SubscriptionResolvers<ContextType>;
225
- SubscriptionOutput?: SubscriptionOutputResolvers<ContextType>;
226
- }>;
@@ -1,6 +0,0 @@
1
- export var SubscriptionAction;
2
- (function (SubscriptionAction) {
3
- SubscriptionAction["Created"] = "CREATED";
4
- SubscriptionAction["Updated"] = "UPDATED";
5
- SubscriptionAction["Deleted"] = "DELETED";
6
- })(SubscriptionAction || (SubscriptionAction = {}));
@@ -1,5 +0,0 @@
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 +0,0 @@
1
- import { type ProtoMetadata } from '../../../gql/protos/index.js';
2
- export declare const subServices: ProtoMetadata[];
3
- export declare const registerTypings: () => void;
@@ -1,8 +0,0 @@
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
5
- ];
6
- export const registerTypings = () => {
7
- registerPackagesRecursive(...subServices);
8
- };
@@ -1,7 +0,0 @@
1
- import { RestoreCommerceGrpcClient } from '@restorecommerce/rc-grpc-clients';
2
- import { type SearchServiceClient } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search.js';
3
- import { type GrpcClientConfig } from '@restorecommerce/grpc-client';
4
- export declare class IndexingSrvGrpcClient extends RestoreCommerceGrpcClient {
5
- readonly search: SearchServiceClient;
6
- constructor(address: string, cfg: GrpcClientConfig);
7
- }
@@ -1,8 +0,0 @@
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 {
4
- constructor(address, cfg) {
5
- super(address, cfg);
6
- this.search = this.createClient(cfg, SearchServiceDefinition, this.channel);
7
- }
8
- }
@@ -1,2 +0,0 @@
1
- import { type IndexingConfig } from './interfaces.js';
2
- export declare const indexingModule: import("../../interfaces.js").FacadeModuleFactory<IndexingConfig, import("./interfaces.js").IndexingContext>;
@@ -1,26 +0,0 @@
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) => {
15
- const indexing = {
16
- client: new IndexingSrvGrpcClient(config.config.client.address, Object.assign(Object.assign({}, config.config.client), { logger: facade.logger }))
17
- };
18
- facade.addApolloService({
19
- name: namespace,
20
- schema: FederatedIndexingSchema(config.config)
21
- });
22
- facade.koa.use((ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
23
- ctx.indexing = indexing;
24
- yield next();
25
- }));
26
- });
@@ -1,13 +0,0 @@
1
- import { type IndexingSrvGrpcClient } from './grpc/index.js';
2
- import { type SubSpaceServiceConfig } from '../../gql/protos/index.js';
3
- import { type FacadeModule, type FacadeContext } from '../../interfaces.js';
4
- export interface IndexingConfig {
5
- config: SubSpaceServiceConfig;
6
- }
7
- export interface IndexingContext extends FacadeContext {
8
- indexing: {
9
- client: IndexingSrvGrpcClient;
10
- };
11
- }
12
- export type IndexingModule = FacadeModule<IndexingContext>;
13
- export declare const namespace = "indexing";
@@ -1 +0,0 @@
1
- export const namespace = 'indexing';
@@ -1,2 +0,0 @@
1
- import { type InvoicingServiceConfig } from '../interfaces.js';
2
- export declare const FederatedInvoicingSchema: (cfg: InvoicingServiceConfig) => import("graphql").GraphQLSchema;
@@ -1,13 +0,0 @@
1
- import { gql } from 'graphql-tag';
2
- import { buildSubgraphSchema } from '@apollo/federation';
3
- import { schema } from './schema.js';
4
- import { namespace } from '../interfaces.js';
5
- import { generateSubServiceResolvers } from '../../../gql/protos/index.js';
6
- import { subServices } from './types.js';
7
- import { printSchema } from 'graphql';
8
- // TODO There is currently no way of building a federated schema from GraphQLSchema Object
9
- // See https://github.com/apollographql/apollo-server/pull/4310
10
- export const FederatedInvoicingSchema = (cfg) => buildSubgraphSchema({
11
- typeDefs: gql(printSchema(schema(cfg))),
12
- resolvers: generateSubServiceResolvers(subServices, cfg, namespace)
13
- });
@@ -1,2 +0,0 @@
1
- import { type InvoicingServiceConfig } from '../interfaces.js';
2
- export declare const schema: (cfg: InvoicingServiceConfig) => import("graphql").GraphQLSchema;