@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 { TypingData } from './registry';
1
+ import { type TypingData } from './registry.js';
2
2
  export declare const capitalizeProtoName: (name: string) => string;
3
3
  export declare const convertyCamelToSnakeCase: (entity: string) => string;
4
4
  export declare const getKeys: (obj: any) => string[];
@@ -9,10 +9,10 @@ export declare const decodeBufferFields: (items: any[], bufferFields: string[])
9
9
  * @param req request object from which the enum strings to be replaced
10
10
  */
11
11
  export declare const convertEnumToInt: (inputTyping: TypingData, req: any) => any;
12
+ export declare const capitalize: (s: string) => string;
12
13
  export declare const snakeToCamel: (s: string) => string;
13
14
  export declare const camelToSnake: (serviceName: string) => string;
14
15
  export declare const getServiceName: (serviceName: string) => string;
15
- export declare const capitalize: (s: string) => string;
16
- export declare function camelCase(s: string): string;
16
+ export declare const camelCase: (s: string) => string;
17
17
  export declare let useSubscriptions: boolean;
18
18
  export declare const setUseSubscriptions: (value: boolean) => boolean;
@@ -1,41 +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 __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;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.setUseSubscriptions = exports.useSubscriptions = exports.camelCase = exports.capitalize = exports.getServiceName = exports.camelToSnake = exports.snakeToCamel = exports.convertEnumToInt = exports.decodeBufferFields = exports.getKeys = exports.convertyCamelToSnakeCase = exports.capitalizeProtoName = void 0;
27
- const _ = __importStar(require("lodash"));
28
- const registry_1 = require("./registry");
29
- const capitalizeProtoName = (name) => {
1
+ import _ from 'lodash';
2
+ import { scalarTypes, recursiveEnumCheck, getNameSpaceTypeName, getTyping } from './registry.js';
3
+ export const capitalizeProtoName = (name) => {
30
4
  return name.replace(/(?:\.|^|_)(\w)/g, v => v.toUpperCase()).replace(/[._]/g, '');
31
5
  };
32
- exports.capitalizeProtoName = capitalizeProtoName;
33
6
  // converts camelcase entity name to snake case
34
- const convertyCamelToSnakeCase = (entity) => {
7
+ export const convertyCamelToSnakeCase = (entity) => {
35
8
  return entity.replace(/(?:^|\.?)([A-Z])/g, (x, y) => { return '_' + y.toLowerCase(); }).replace(/^_/, '');
36
9
  };
37
- exports.convertyCamelToSnakeCase = convertyCamelToSnakeCase;
38
- const getKeys = (obj) => {
10
+ export const getKeys = (obj) => {
39
11
  let set = new Set();
40
12
  if (obj) {
41
13
  const keys = Object.keys(obj);
@@ -52,8 +24,7 @@ const getKeys = (obj) => {
52
24
  }
53
25
  return Array.from(set);
54
26
  };
55
- exports.getKeys = getKeys;
56
- const decodeBufferFields = (items, bufferFields) => {
27
+ export const decodeBufferFields = (items, bufferFields) => {
57
28
  if (bufferFields && bufferFields.length > 0 && items && items.length > 0) {
58
29
  for (let item of items) {
59
30
  if (item && item.payload) {
@@ -71,7 +42,6 @@ const decodeBufferFields = (items, bufferFields) => {
71
42
  return items;
72
43
  }
73
44
  };
74
- exports.decodeBufferFields = decodeBufferFields;
75
45
  /**
76
46
  * recursively find the id and updates the object with given value, this function
77
47
  * also takes care to handle if there is an array at any position in the path
@@ -87,7 +57,7 @@ const updateJSON = (id, value, obj) => {
87
57
  obj[k] = foundObj.number;
88
58
  }
89
59
  }
90
- else if (typeof v === "object") {
60
+ else if (typeof v === 'object') {
91
61
  updateJSON(id, value, v);
92
62
  }
93
63
  }
@@ -97,7 +67,7 @@ const updateJSON = (id, value, obj) => {
97
67
  * @param TypingData input typing
98
68
  * @param req request object from which the enum strings to be replaced
99
69
  */
100
- const convertEnumToInt = (inputTyping, req) => {
70
+ export const convertEnumToInt = (inputTyping, req) => {
101
71
  let enumMap = new Map();
102
72
  // enumMap populated with key as enum name space type and value as the path (to replace from request object)
103
73
  if (inputTyping) {
@@ -114,16 +84,16 @@ const convertEnumToInt = (inputTyping, req) => {
114
84
  }
115
85
  // if fieldType is not basic type, then check if its fieldType belongs to Enum
116
86
  // if not get the object and make recursive check till no more objects are found
117
- if (registry_1.scalarTypes.indexOf(fieldType) <= -1) {
118
- enumMap = (0, registry_1.recursiveEnumCheck)(fieldType, enumMap, fieldName, []);
87
+ if (scalarTypes.indexOf(fieldType) <= -1) {
88
+ enumMap = recursiveEnumCheck(fieldType, enumMap, fieldName, []);
119
89
  }
120
90
  }
121
91
  }
122
92
  }
123
93
  for (let [key, val] of enumMap) {
124
- const enumNameSpace = (0, registry_1.getNameSpaceTypeName)(key);
94
+ const enumNameSpace = getNameSpaceTypeName(key);
125
95
  if (enumNameSpace && typeof enumNameSpace === 'string') {
126
- const enumTyping = (0, registry_1.getTyping)(enumNameSpace);
96
+ const enumTyping = getTyping(enumNameSpace);
127
97
  const enumIntMapping = (enumTyping === null || enumTyping === void 0 ? void 0 : enumTyping.meta).value;
128
98
  if (enumIntMapping && _.isArray(enumIntMapping) && enumIntMapping.length > 0) {
129
99
  // val refers to property name
@@ -133,8 +103,10 @@ const convertEnumToInt = (inputTyping, req) => {
133
103
  }
134
104
  return req;
135
105
  };
136
- exports.convertEnumToInt = convertEnumToInt;
137
- const snakeToCamel = (s) => {
106
+ export const capitalize = (s) => {
107
+ return s.substring(0, 1).toUpperCase() + s.substring(1);
108
+ };
109
+ export const snakeToCamel = (s) => {
138
110
  return s
139
111
  .split('_')
140
112
  .map((word, i) => {
@@ -143,30 +115,19 @@ const snakeToCamel = (s) => {
143
115
  return word ? word[0] + word.substring(1).toLowerCase() : '';
144
116
  }
145
117
  else {
146
- return (0, exports.capitalize)(word.toLowerCase());
118
+ return capitalize(word.toLowerCase());
147
119
  }
148
120
  })
149
121
  .join('');
150
122
  };
151
- exports.snakeToCamel = snakeToCamel;
152
- const camelToSnake = (serviceName) => {
123
+ export const camelToSnake = (serviceName) => {
153
124
  // convert camel case to snake case
154
125
  serviceName = serviceName.replace(/(?:^|\.?)([A-Z])/g, (x, y) => { return '_' + y.toLowerCase(); }).replace(/^_/, '');
155
126
  return serviceName;
156
127
  };
157
- exports.camelToSnake = camelToSnake;
158
- const getServiceName = (serviceName) => {
159
- return serviceName.endsWith('Service') ? (0, exports.camelToSnake)(serviceName.substr(0, serviceName.length - 7)) : (0, exports.camelToSnake)(serviceName);
160
- };
161
- exports.getServiceName = getServiceName;
162
- const capitalize = (s) => {
163
- return s.substring(0, 1).toUpperCase() + s.substring(1);
128
+ export const getServiceName = (serviceName) => {
129
+ return serviceName.endsWith('Service') ? camelToSnake(serviceName.substr(0, serviceName.length - 7)) : camelToSnake(serviceName);
164
130
  };
165
- exports.capitalize = capitalize;
166
- function camelCase(s) {
167
- return s.substring(0, 1).toLowerCase() + s.substring(1);
168
- }
169
- exports.camelCase = camelCase;
170
- exports.useSubscriptions = false;
171
- const setUseSubscriptions = (value) => exports.useSubscriptions = value;
172
- exports.setUseSubscriptions = setUseSubscriptions;
131
+ export const camelCase = (s) => s.substring(0, 1).toLowerCase() + s.substring(1);
132
+ export let useSubscriptions = false;
133
+ export const setUseSubscriptions = (value) => useSubscriptions = value;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AccessControlTargetType = exports.AttributeInputType = exports.AttributeType = exports.AccessControlDecisionType = exports.AccessControlEffectType = void 0;
4
- const graphql_1 = require("graphql");
1
+ import { GraphQLObjectType, GraphQLInputObjectType, GraphQLString, GraphQLEnumType, GraphQLList, GraphQLNonNull } from 'graphql';
5
2
  // export const AccessControlnputTargetType = new GraphQLInputObjectType({
6
3
  // name: 'AccessControlnputTargetType',
7
4
  // description: 'Generic command resource.',
@@ -20,7 +17,7 @@ const graphql_1 = require("graphql");
20
17
  // },
21
18
  // }),
22
19
  // });
23
- exports.AccessControlEffectType = new graphql_1.GraphQLEnumType({
20
+ export const AccessControlEffectType = new GraphQLEnumType({
24
21
  name: 'AccessControlEffect',
25
22
  description: 'Effect resulting from a rule, policy or policy set',
26
23
  values: {
@@ -34,7 +31,7 @@ exports.AccessControlEffectType = new graphql_1.GraphQLEnumType({
34
31
  },
35
32
  }
36
33
  });
37
- exports.AccessControlDecisionType = new graphql_1.GraphQLEnumType({
34
+ export const AccessControlDecisionType = new GraphQLEnumType({
38
35
  name: 'AccessControlDecision',
39
36
  description: 'Decision from an access control response',
40
37
  values: {
@@ -52,48 +49,48 @@ exports.AccessControlDecisionType = new graphql_1.GraphQLEnumType({
52
49
  }
53
50
  }
54
51
  });
55
- exports.AttributeType = new graphql_1.GraphQLObjectType({
52
+ export const AttributeType = new GraphQLObjectType({
56
53
  name: 'Attribute',
57
54
  description: 'An ID-value attribute',
58
55
  fields: () => ({
59
56
  id: {
60
- type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
57
+ type: new GraphQLNonNull(GraphQLString),
61
58
  description: 'Attribute ID'
62
59
  },
63
60
  value: {
64
- type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
61
+ type: new GraphQLNonNull(GraphQLString),
65
62
  description: 'Attribute value'
66
63
  }
67
64
  })
68
65
  });
69
- exports.AttributeInputType = new graphql_1.GraphQLInputObjectType({
66
+ export const AttributeInputType = new GraphQLInputObjectType({
70
67
  name: 'InputAttribute',
71
68
  description: 'Attribute from a Target property',
72
69
  fields: () => ({
73
70
  id: {
74
- type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
71
+ type: new GraphQLNonNull(GraphQLString),
75
72
  description: 'Attribute ID',
76
73
  },
77
74
  value: {
78
- type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
75
+ type: new GraphQLNonNull(GraphQLString),
79
76
  description: 'Attribute value'
80
77
  }
81
78
  })
82
79
  });
83
- exports.AccessControlTargetType = new graphql_1.GraphQLObjectType({
80
+ export const AccessControlTargetType = new GraphQLObjectType({
84
81
  name: 'AccessControlTarget',
85
82
  description: 'Generic command resource.',
86
83
  fields: () => ({
87
84
  subject: {
88
- type: new graphql_1.GraphQLList(exports.AttributeType),
85
+ type: new GraphQLList(AttributeType),
89
86
  description: 'Entity requesting access.',
90
87
  },
91
88
  resources: {
92
- type: new graphql_1.GraphQLList(exports.AttributeType),
89
+ type: new GraphQLList(AttributeType),
93
90
  description: 'Targeted resources',
94
91
  },
95
92
  action: {
96
- type: new graphql_1.GraphQLList(exports.AttributeType),
93
+ type: new GraphQLList(AttributeType),
97
94
  description: 'Targeted action',
98
95
  },
99
96
  }),
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DateType = void 0;
4
- const graphql_1 = require("graphql");
5
- const language_1 = require("graphql/language");
6
- exports.DateType = new graphql_1.GraphQLScalarType({
1
+ import { GraphQLScalarType } from 'graphql';
2
+ import { Kind } from 'graphql/language/index.js';
3
+ export const DateType = new GraphQLScalarType({
7
4
  name: 'Date',
8
5
  description: 'Date custom scalar type',
9
6
  parseValue: (value) => {
@@ -21,7 +18,7 @@ exports.DateType = new graphql_1.GraphQLScalarType({
21
18
  return dateObj;
22
19
  },
23
20
  parseLiteral: (ast) => {
24
- if (ast.kind === language_1.Kind.STRING) {
21
+ if (ast.kind === Kind.STRING) {
25
22
  if (ast.value === '0') {
26
23
  return null;
27
24
  }
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FilterOptionsInputType = void 0;
4
- const graphql_1 = require("graphql");
5
- const FilterOperationEnumType = new graphql_1.GraphQLEnumType({
1
+ import { GraphQLInputObjectType, GraphQLString, GraphQLEnumType, GraphQLNonNull } from 'graphql';
2
+ const FilterOperationEnumType = new GraphQLEnumType({
6
3
  name: 'FilterOperationEnumType',
7
4
  description: 'Filters the fields based on the operation specified',
8
5
  values: {
@@ -32,7 +29,7 @@ const FilterOperationEnumType = new graphql_1.GraphQLEnumType({
32
29
  },
33
30
  }
34
31
  });
35
- const FilterFieldValueEnumType = new graphql_1.GraphQLEnumType({
32
+ const FilterFieldValueEnumType = new GraphQLEnumType({
36
33
  name: 'FilterFieldValueEnumType',
37
34
  description: '',
38
35
  values: {
@@ -50,20 +47,20 @@ const FilterFieldValueEnumType = new graphql_1.GraphQLEnumType({
50
47
  }
51
48
  }
52
49
  });
53
- exports.FilterOptionsInputType = new graphql_1.GraphQLInputObjectType({
50
+ export const FilterOptionsInputType = new GraphQLInputObjectType({
54
51
  name: 'FilterOptionsInputType',
55
52
  description: 'Filter options',
56
53
  fields: {
57
54
  field: {
58
- type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
55
+ type: new GraphQLNonNull(GraphQLString),
59
56
  description: 'Field names based on which the filtering needs to be done',
60
57
  },
61
58
  operation: {
62
- type: new graphql_1.GraphQLNonNull(FilterOperationEnumType),
59
+ type: new GraphQLNonNull(FilterOperationEnumType),
63
60
  description: 'Filter Operation options',
64
61
  },
65
62
  value: {
66
- type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
63
+ type: new GraphQLNonNull(GraphQLString),
67
64
  description: 'Field value',
68
65
  },
69
66
  type: {
@@ -1,27 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MetaType = void 0;
4
- const graphql_1 = require("graphql");
5
- const DateType_1 = require("./DateType");
6
- const AccessControlTypes_1 = require("./AccessControlTypes");
7
- exports.MetaType = new graphql_1.GraphQLObjectType({
1
+ import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLNonNull } from 'graphql';
2
+ import { DateType } from './DateType.js';
3
+ import { AttributeType } from './AccessControlTypes.js';
4
+ export const MetaType = new GraphQLObjectType({
8
5
  name: 'MetaType',
9
6
  description: 'Meta info common to all resources',
10
7
  fields: () => ({
11
8
  created: {
12
- type: new graphql_1.GraphQLNonNull(DateType_1.DateType),
9
+ type: new GraphQLNonNull(DateType),
13
10
  description: 'Creation timestamp',
14
11
  },
15
12
  modified: {
16
- type: new graphql_1.GraphQLNonNull(DateType_1.DateType),
13
+ type: new GraphQLNonNull(DateType),
17
14
  description: 'Last-modification timestamp',
18
15
  },
19
16
  modified_by: {
20
- type: graphql_1.GraphQLString,
17
+ type: GraphQLString,
21
18
  description: 'UUID from last User who modified the resource',
22
19
  },
23
20
  owner: {
24
- type: new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(AccessControlTypes_1.AttributeType)),
21
+ type: new GraphQLList(new GraphQLNonNull(AttributeType)),
25
22
  description: 'A list of attributes describing the owner\'s entities',
26
23
  }
27
24
  }),
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScopeInputType = void 0;
4
- const graphql_1 = require("graphql");
5
- exports.ScopeInputType = new graphql_1.GraphQLInputObjectType({
1
+ import { GraphQLInputObjectType, GraphQLString } from 'graphql';
2
+ export const ScopeInputType = new GraphQLInputObjectType({
6
3
  name: 'ScopeInputType',
7
4
  description: 'A role scope',
8
5
  fields: () => ({
9
6
  entity: {
10
- type: graphql_1.GraphQLString,
7
+ type: GraphQLString,
11
8
  },
12
9
  instance: {
13
- type: graphql_1.GraphQLString,
10
+ type: GraphQLString,
14
11
  }
15
12
  }),
16
13
  });
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SortInputType = exports.SortEnumType = void 0;
4
- const graphql_1 = require("graphql");
5
- exports.SortEnumType = new graphql_1.GraphQLEnumType({
1
+ import { GraphQLInputObjectType, GraphQLString, GraphQLEnumType, GraphQLNonNull } from 'graphql';
2
+ export const SortEnumType = new GraphQLEnumType({
6
3
  name: 'SortEnumType',
7
4
  description: 'Sorts the fields in either Ascending or Descending order',
8
5
  values: {
@@ -16,16 +13,16 @@ exports.SortEnumType = new graphql_1.GraphQLEnumType({
16
13
  },
17
14
  }
18
15
  });
19
- exports.SortInputType = new graphql_1.GraphQLInputObjectType({
16
+ export const SortInputType = new GraphQLInputObjectType({
20
17
  name: 'SortInputType',
21
18
  description: 'For sotring based on fileds',
22
19
  fields: () => ({
23
20
  field: {
24
- type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
21
+ type: new GraphQLNonNull(GraphQLString),
25
22
  description: 'Field names to be sorted on',
26
23
  },
27
24
  order: {
28
- type: exports.SortEnumType,
25
+ type: SortEnumType,
29
26
  description: 'Sorting Options',
30
27
  defaultValue: 'asc'
31
28
  },
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OperationStatusType = void 0;
4
- const graphql_1 = require("graphql");
5
- exports.OperationStatusType = new graphql_1.GraphQLObjectType({
1
+ import { GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLInt } from 'graphql';
2
+ export const OperationStatusType = new GraphQLObjectType({
6
3
  name: 'StatusType',
7
4
  description: 'Objects with error returned for GraphQL operations',
8
5
  fields: () => ({
9
6
  code: {
10
- type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLInt),
7
+ type: new GraphQLNonNull(GraphQLInt),
11
8
  description: 'Status code',
12
9
  },
13
10
  message: {
14
- type: graphql_1.GraphQLString,
11
+ type: GraphQLString,
15
12
  description: 'Status message description',
16
13
  }
17
14
  }),
@@ -1,7 +1,7 @@
1
- export * from './AccessControlTypes';
2
- export * from './DateType';
3
- export * from './FilterType';
4
- export * from './MetaType';
5
- export * from './ScopeType';
6
- export * from './SortType';
7
- export * from './StatusType';
1
+ export * from './AccessControlTypes.js';
2
+ export * from './DateType.js';
3
+ export * from './FilterType.js';
4
+ export * from './MetaType.js';
5
+ export * from './ScopeType.js';
6
+ export * from './SortType.js';
7
+ export * from './StatusType.js';
@@ -1,23 +1,7 @@
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("./AccessControlTypes"), exports);
18
- __exportStar(require("./DateType"), exports);
19
- __exportStar(require("./FilterType"), exports);
20
- __exportStar(require("./MetaType"), exports);
21
- __exportStar(require("./ScopeType"), exports);
22
- __exportStar(require("./SortType"), exports);
23
- __exportStar(require("./StatusType"), exports);
1
+ export * from './AccessControlTypes.js';
2
+ export * from './DateType.js';
3
+ export * from './FilterType.js';
4
+ export * from './MetaType.js';
5
+ export * from './ScopeType.js';
6
+ export * from './SortType.js';
7
+ export * from './StatusType.js';
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Logger } from 'winston';
4
- import { Server, ServerResponse } from 'http';
5
- import Koa from "koa";
6
- import { AddressInfo } from 'net';
7
- import { Facade, FacadeBaseContext, FacadeModule, FacadeModuleBase, FacadeModulesContext } from './interfaces';
8
- import { KafkaProviderConfig } from '@restorecommerce/kafka-client';
9
- export * from './modules/index';
10
- export * from './middlewares/index';
11
- export * from './interfaces';
12
- export * from './utils';
13
- export * from './gql/index';
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
+ import { type Logger } from 'winston';
4
+ import { type Server, ServerResponse } from 'node:http';
5
+ import Koa from 'koa';
6
+ import { type AddressInfo } from 'node:net';
7
+ import { type Facade, type FacadeBaseContext, type FacadeModule, type FacadeModuleBase, type FacadeModulesContext } from './interfaces.js';
8
+ import { type KafkaProviderConfig } from '@restorecommerce/kafka-client';
9
+ export * from './modules/index.js';
10
+ export * from './middlewares/index.js';
11
+ export * from './interfaces.js';
12
+ export * from './utils.js';
13
+ export * from './gql/index.js';
14
14
  interface RestoreCommerceFacadeImplConfig {
15
15
  koa: Koa<any, any>;
16
16
  logger: Logger;
@@ -60,4 +60,4 @@ export interface FacadeConfig {
60
60
  keys?: string[];
61
61
  kafka?: KafkaProviderConfig['kafka'];
62
62
  }
63
- export declare function createFacade(config: FacadeConfig): Facade;
63
+ export declare const createFacade: (config: FacadeConfig) => Facade;