@restorecommerce/facade 1.1.6 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +3 -0
- package/.eslintrc.cjs +13 -0
- package/CHANGELOG.md +22 -0
- package/codegen/index.d.ts +1 -1
- package/codegen/index.js +19 -44
- package/debug-run.ts +7 -6
- package/dist/gql/index.d.ts +1 -1
- package/dist/gql/index.js +1 -17
- package/dist/gql/protos/federation.d.ts +3 -3
- package/dist/gql/protos/federation.js +16 -24
- package/dist/gql/protos/graphql.d.ts +4 -4
- package/dist/gql/protos/graphql.js +64 -42
- package/dist/gql/protos/index.d.ts +6 -6
- package/dist/gql/protos/index.js +6 -22
- package/dist/gql/protos/registry.d.ts +6 -6
- package/dist/gql/protos/registry.js +157 -176
- package/dist/gql/protos/resolvers.d.ts +3 -3
- package/dist/gql/protos/resolvers.js +78 -104
- package/dist/gql/protos/schema.d.ts +4 -4
- package/dist/gql/protos/schema.js +40 -53
- package/dist/gql/protos/types.d.ts +3 -3
- package/dist/gql/protos/types.js +1 -4
- package/dist/gql/protos/utils.d.ts +3 -3
- package/dist/gql/protos/utils.js +23 -62
- package/dist/gql/types/AccessControlTypes.js +13 -16
- package/dist/gql/types/DateType.js +4 -7
- package/dist/gql/types/FilterType.js +7 -10
- package/dist/gql/types/MetaType.js +8 -11
- package/dist/gql/types/ScopeType.js +4 -7
- package/dist/gql/types/SortType.js +5 -8
- package/dist/gql/types/StatusType.js +4 -7
- package/dist/gql/types/index.d.ts +7 -7
- package/dist/gql/types/index.js +7 -23
- package/dist/index.d.ts +14 -14
- package/dist/index.js +195 -207
- package/dist/interfaces.d.ts +8 -8
- package/dist/interfaces.js +1 -2
- package/dist/middlewares/index.d.ts +1 -1
- package/dist/middlewares/index.js +1 -17
- package/dist/middlewares/req-res-logger/index.d.ts +2 -2
- package/dist/middlewares/req-res-logger/index.js +33 -31
- package/dist/modules/access-control/gql/federation.d.ts +1 -1
- package/dist/modules/access-control/gql/federation.js +10 -17
- package/dist/modules/access-control/gql/schema.d.ts +1 -1
- package/dist/modules/access-control/gql/schema.generated.d.ts +136 -110
- package/dist/modules/access-control/gql/schema.generated.js +22 -25
- package/dist/modules/access-control/gql/schema.js +5 -9
- package/dist/modules/access-control/gql/types.d.ts +2 -2
- package/dist/modules/access-control/gql/types.js +13 -17
- package/dist/modules/access-control/grpc/index.d.ts +5 -5
- package/dist/modules/access-control/grpc/index.js +10 -14
- package/dist/modules/access-control/index.d.ts +2 -2
- package/dist/modules/access-control/index.js +20 -17
- package/dist/modules/access-control/interfaces.d.ts +3 -3
- package/dist/modules/access-control/interfaces.js +1 -4
- package/dist/modules/catalog/gql/federation.d.ts +1 -1
- package/dist/modules/catalog/gql/federation.js +10 -17
- package/dist/modules/catalog/gql/schema.d.ts +1 -1
- package/dist/modules/catalog/gql/schema.generated.d.ts +252 -226
- package/dist/modules/catalog/gql/schema.generated.js +20 -23
- package/dist/modules/catalog/gql/schema.js +5 -9
- package/dist/modules/catalog/gql/types.d.ts +2 -2
- package/dist/modules/catalog/gql/types.js +15 -19
- package/dist/modules/catalog/grpc/index.d.ts +6 -6
- package/dist/modules/catalog/grpc/index.js +12 -16
- package/dist/modules/catalog/index.d.ts +2 -2
- package/dist/modules/catalog/index.js +20 -17
- package/dist/modules/catalog/interfaces.d.ts +3 -3
- package/dist/modules/catalog/interfaces.js +1 -4
- package/dist/modules/facade-status/gql/index.js +8 -14
- package/dist/modules/facade-status/gql/resolvers.d.ts +1 -1
- package/dist/modules/facade-status/gql/resolvers.js +14 -8
- package/dist/modules/facade-status/gql/schema.d.ts +1 -1
- package/dist/modules/facade-status/gql/schema.generated.d.ts +34 -11
- package/dist/modules/facade-status/gql/schema.generated.js +1 -2
- package/dist/modules/facade-status/gql/schema.js +6 -9
- package/dist/modules/facade-status/gql/types.js +3 -6
- package/dist/modules/facade-status/index.d.ts +1 -1
- package/dist/modules/facade-status/index.js +4 -7
- package/dist/modules/facade-status/interfaces.d.ts +1 -1
- package/dist/modules/facade-status/interfaces.js +1 -2
- package/dist/modules/fulfillment/gql/federation.d.ts +1 -1
- package/dist/modules/fulfillment/gql/federation.js +10 -17
- package/dist/modules/fulfillment/gql/schema.d.ts +1 -1
- package/dist/modules/fulfillment/gql/schema.generated.d.ts +249 -223
- package/dist/modules/fulfillment/gql/schema.generated.js +20 -23
- package/dist/modules/fulfillment/gql/schema.js +5 -9
- package/dist/modules/fulfillment/gql/types.d.ts +2 -2
- package/dist/modules/fulfillment/gql/types.js +11 -15
- package/dist/modules/fulfillment/grpc/index.d.ts +3 -3
- package/dist/modules/fulfillment/grpc/index.js +6 -10
- package/dist/modules/fulfillment/index.d.ts +2 -2
- package/dist/modules/fulfillment/index.js +20 -17
- package/dist/modules/fulfillment/interfaces.d.ts +3 -3
- package/dist/modules/fulfillment/interfaces.js +1 -4
- package/dist/modules/identity/api-key/api-key.d.ts +2 -2
- package/dist/modules/identity/api-key/api-key.js +45 -65
- package/dist/modules/identity/gql/federation.d.ts +2 -2
- package/dist/modules/identity/gql/federation.js +5 -9
- package/dist/modules/identity/gql/schema.d.ts +1 -1
- package/dist/modules/identity/gql/schema.generated.d.ts +284 -255
- package/dist/modules/identity/gql/schema.generated.js +20 -23
- package/dist/modules/identity/gql/schema.js +5 -9
- package/dist/modules/identity/gql/types.d.ts +2 -2
- package/dist/modules/identity/gql/types.js +17 -21
- package/dist/modules/identity/grpc/index.d.ts +6 -6
- package/dist/modules/identity/grpc/index.js +12 -16
- package/dist/modules/identity/index.d.ts +4 -4
- package/dist/modules/identity/index.js +24 -21
- package/dist/modules/identity/interfaces.d.ts +5 -5
- package/dist/modules/identity/interfaces.js +1 -4
- package/dist/modules/identity/oauth/oauth.d.ts +4 -4
- package/dist/modules/identity/oauth/oauth.js +109 -132
- package/dist/modules/identity/oidc/adapter.d.ts +3 -3
- package/dist/modules/identity/oidc/adapter.js +111 -92
- package/dist/modules/identity/oidc/in-memory-adapter.d.ts +1 -1
- package/dist/modules/identity/oidc/in-memory-adapter.js +64 -50
- package/dist/modules/identity/oidc/index.d.ts +6 -6
- package/dist/modules/identity/oidc/index.js +29 -30
- package/dist/modules/identity/oidc/interfaces.d.ts +6 -6
- package/dist/modules/identity/oidc/interfaces.js +2 -6
- package/dist/modules/identity/oidc/password-grant.d.ts +1 -1
- package/dist/modules/identity/oidc/password-grant.js +43 -66
- package/dist/modules/identity/oidc/router.d.ts +6 -6
- package/dist/modules/identity/oidc/router.js +31 -26
- package/dist/modules/identity/oidc/templates.d.ts +1 -1
- package/dist/modules/identity/oidc/templates.js +45 -41
- package/dist/modules/identity/oidc/user.d.ts +4 -4
- package/dist/modules/identity/oidc/user.js +31 -29
- package/dist/modules/identity/oidc/utils.d.ts +2 -2
- package/dist/modules/identity/oidc/utils.js +6 -13
- package/dist/modules/index.d.ts +13 -13
- package/dist/modules/index.js +13 -29
- package/dist/modules/indexing/gql/federation.d.ts +1 -1
- package/dist/modules/indexing/gql/federation.js +10 -17
- package/dist/modules/indexing/gql/schema.d.ts +1 -1
- package/dist/modules/indexing/gql/schema.generated.d.ts +45 -19
- package/dist/modules/indexing/gql/schema.generated.js +2 -5
- package/dist/modules/indexing/gql/schema.js +5 -9
- package/dist/modules/indexing/gql/types.d.ts +2 -2
- package/dist/modules/indexing/gql/types.js +7 -11
- package/dist/modules/indexing/grpc/index.d.ts +2 -2
- package/dist/modules/indexing/grpc/index.js +4 -8
- package/dist/modules/indexing/index.d.ts +2 -2
- package/dist/modules/indexing/index.js +20 -17
- package/dist/modules/indexing/interfaces.d.ts +3 -3
- package/dist/modules/indexing/interfaces.js +1 -4
- package/dist/modules/invoicing/gql/federation.d.ts +1 -1
- package/dist/modules/invoicing/gql/federation.js +10 -17
- package/dist/modules/invoicing/gql/schema.d.ts +1 -1
- package/dist/modules/invoicing/gql/schema.generated.d.ts +209 -183
- package/dist/modules/invoicing/gql/schema.generated.js +20 -23
- package/dist/modules/invoicing/gql/schema.js +5 -9
- package/dist/modules/invoicing/gql/types.d.ts +2 -2
- package/dist/modules/invoicing/gql/types.js +7 -11
- package/dist/modules/invoicing/grpc/index.d.ts +2 -2
- package/dist/modules/invoicing/grpc/index.js +4 -8
- package/dist/modules/invoicing/index.d.ts +2 -2
- package/dist/modules/invoicing/index.js +20 -17
- package/dist/modules/invoicing/interfaces.d.ts +3 -3
- package/dist/modules/invoicing/interfaces.js +1 -4
- package/dist/modules/notification/gql/federation.d.ts +1 -1
- package/dist/modules/notification/gql/federation.js +10 -17
- package/dist/modules/notification/gql/schema.d.ts +1 -1
- package/dist/modules/notification/gql/schema.generated.d.ts +100 -74
- package/dist/modules/notification/gql/schema.generated.js +18 -21
- package/dist/modules/notification/gql/schema.js +5 -9
- package/dist/modules/notification/gql/types.d.ts +2 -2
- package/dist/modules/notification/gql/types.js +7 -11
- package/dist/modules/notification/grpc/index.d.ts +2 -2
- package/dist/modules/notification/grpc/index.js +4 -8
- package/dist/modules/notification/index.d.ts +2 -2
- package/dist/modules/notification/index.js +20 -17
- package/dist/modules/notification/interfaces.d.ts +3 -3
- package/dist/modules/notification/interfaces.js +1 -4
- package/dist/modules/ordering/gql/federation.d.ts +1 -1
- package/dist/modules/ordering/gql/federation.js +10 -17
- package/dist/modules/ordering/gql/schema.d.ts +1 -1
- package/dist/modules/ordering/gql/schema.generated.d.ts +221 -195
- package/dist/modules/ordering/gql/schema.generated.js +22 -25
- package/dist/modules/ordering/gql/schema.js +5 -9
- package/dist/modules/ordering/gql/types.d.ts +2 -2
- package/dist/modules/ordering/gql/types.js +7 -11
- package/dist/modules/ordering/grpc/index.d.ts +2 -2
- package/dist/modules/ordering/grpc/index.js +4 -8
- package/dist/modules/ordering/index.d.ts +2 -2
- package/dist/modules/ordering/index.js +20 -17
- package/dist/modules/ordering/interfaces.d.ts +3 -3
- package/dist/modules/ordering/interfaces.js +1 -4
- package/dist/modules/ostorage/gql/federation.d.ts +1 -1
- package/dist/modules/ostorage/gql/federation.js +10 -17
- package/dist/modules/ostorage/gql/schema.d.ts +1 -1
- package/dist/modules/ostorage/gql/schema.generated.d.ts +126 -94
- package/dist/modules/ostorage/gql/schema.generated.js +8 -11
- package/dist/modules/ostorage/gql/schema.js +5 -9
- package/dist/modules/ostorage/gql/types.d.ts +2 -2
- package/dist/modules/ostorage/gql/types.js +7 -11
- package/dist/modules/ostorage/grpc/index.d.ts +2 -2
- package/dist/modules/ostorage/grpc/index.js +4 -8
- package/dist/modules/ostorage/index.d.ts +2 -2
- package/dist/modules/ostorage/index.js +20 -17
- package/dist/modules/ostorage/interfaces.d.ts +3 -3
- package/dist/modules/ostorage/interfaces.js +1 -4
- package/dist/modules/payment/gql/federation.d.ts +1 -1
- package/dist/modules/payment/gql/federation.js +10 -17
- package/dist/modules/payment/gql/schema.d.ts +1 -1
- package/dist/modules/payment/gql/schema.generated.d.ts +67 -44
- package/dist/modules/payment/gql/schema.generated.js +4 -7
- package/dist/modules/payment/gql/schema.js +5 -9
- package/dist/modules/payment/gql/types.d.ts +2 -2
- package/dist/modules/payment/gql/types.js +7 -11
- package/dist/modules/payment/grpc/index.d.ts +2 -2
- package/dist/modules/payment/grpc/index.js +4 -8
- package/dist/modules/payment/index.d.ts +2 -2
- package/dist/modules/payment/index.js +20 -17
- package/dist/modules/payment/interfaces.d.ts +3 -3
- package/dist/modules/payment/interfaces.js +1 -4
- package/dist/modules/resource/gql/federation.d.ts +1 -1
- package/dist/modules/resource/gql/federation.js +10 -17
- package/dist/modules/resource/gql/schema.d.ts +1 -1
- package/dist/modules/resource/gql/schema.generated.d.ts +514 -299
- package/dist/modules/resource/gql/schema.generated.js +50 -27
- package/dist/modules/resource/gql/schema.js +5 -9
- package/dist/modules/resource/gql/types.d.ts +2 -2
- package/dist/modules/resource/gql/types.js +31 -33
- package/dist/modules/resource/grpc/index.d.ts +14 -12
- package/dist/modules/resource/grpc/index.js +28 -30
- package/dist/modules/resource/index.d.ts +2 -2
- package/dist/modules/resource/index.js +20 -17
- package/dist/modules/resource/interfaces.d.ts +3 -3
- package/dist/modules/resource/interfaces.js +1 -4
- package/dist/modules/scheduling/gql/federation.d.ts +1 -1
- package/dist/modules/scheduling/gql/federation.js +10 -17
- package/dist/modules/scheduling/gql/schema.d.ts +1 -1
- package/dist/modules/scheduling/gql/schema.generated.d.ts +109 -83
- package/dist/modules/scheduling/gql/schema.generated.js +10 -13
- package/dist/modules/scheduling/gql/schema.js +5 -9
- package/dist/modules/scheduling/gql/types.d.ts +2 -2
- package/dist/modules/scheduling/gql/types.js +7 -11
- package/dist/modules/scheduling/grpc/index.d.ts +2 -2
- package/dist/modules/scheduling/grpc/index.js +4 -8
- package/dist/modules/scheduling/index.d.ts +2 -2
- package/dist/modules/scheduling/index.js +20 -17
- package/dist/modules/scheduling/interfaces.d.ts +3 -3
- package/dist/modules/scheduling/interfaces.js +1 -4
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +4 -9
- package/generate.ts +42 -42
- package/jest.config.cjs +23 -0
- package/package.json +19 -14
- package/tsconfig-base.json +8 -0
- package/tsconfig.debug.json +5 -1
- package/tsconfig.test.json +17 -2
- 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
|
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;
|
package/dist/gql/protos/utils.js
CHANGED
@@ -1,41 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
-
|
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
|
-
|
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 ===
|
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 (
|
118
|
-
enumMap =
|
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 =
|
94
|
+
const enumNameSpace = getNameSpaceTypeName(key);
|
125
95
|
if (enumNameSpace && typeof enumNameSpace === 'string') {
|
126
|
-
const enumTyping =
|
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
|
-
|
137
|
-
|
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
|
118
|
+
return capitalize(word.toLowerCase());
|
147
119
|
}
|
148
120
|
})
|
149
121
|
.join('');
|
150
122
|
};
|
151
|
-
|
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
|
-
|
158
|
-
|
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
|
-
|
166
|
-
|
167
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
57
|
+
type: new GraphQLNonNull(GraphQLString),
|
61
58
|
description: 'Attribute ID'
|
62
59
|
},
|
63
60
|
value: {
|
64
|
-
type: new
|
61
|
+
type: new GraphQLNonNull(GraphQLString),
|
65
62
|
description: 'Attribute value'
|
66
63
|
}
|
67
64
|
})
|
68
65
|
});
|
69
|
-
|
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
|
71
|
+
type: new GraphQLNonNull(GraphQLString),
|
75
72
|
description: 'Attribute ID',
|
76
73
|
},
|
77
74
|
value: {
|
78
|
-
type: new
|
75
|
+
type: new GraphQLNonNull(GraphQLString),
|
79
76
|
description: 'Attribute value'
|
80
77
|
}
|
81
78
|
})
|
82
79
|
});
|
83
|
-
|
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
|
85
|
+
type: new GraphQLList(AttributeType),
|
89
86
|
description: 'Entity requesting access.',
|
90
87
|
},
|
91
88
|
resources: {
|
92
|
-
type: new
|
89
|
+
type: new GraphQLList(AttributeType),
|
93
90
|
description: 'Targeted resources',
|
94
91
|
},
|
95
92
|
action: {
|
96
|
-
type: new
|
93
|
+
type: new GraphQLList(AttributeType),
|
97
94
|
description: 'Targeted action',
|
98
95
|
},
|
99
96
|
}),
|
@@ -1,9 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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 ===
|
21
|
+
if (ast.kind === Kind.STRING) {
|
25
22
|
if (ast.value === '0') {
|
26
23
|
return null;
|
27
24
|
}
|
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
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
|
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
|
-
|
50
|
+
export const FilterOptionsInputType = new GraphQLInputObjectType({
|
54
51
|
name: 'FilterOptionsInputType',
|
55
52
|
description: 'Filter options',
|
56
53
|
fields: {
|
57
54
|
field: {
|
58
|
-
type: new
|
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
|
59
|
+
type: new GraphQLNonNull(FilterOperationEnumType),
|
63
60
|
description: 'Filter Operation options',
|
64
61
|
},
|
65
62
|
value: {
|
66
|
-
type: new
|
63
|
+
type: new GraphQLNonNull(GraphQLString),
|
67
64
|
description: 'Field value',
|
68
65
|
},
|
69
66
|
type: {
|
@@ -1,27 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const
|
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
|
9
|
+
type: new GraphQLNonNull(DateType),
|
13
10
|
description: 'Creation timestamp',
|
14
11
|
},
|
15
12
|
modified: {
|
16
|
-
type: new
|
13
|
+
type: new GraphQLNonNull(DateType),
|
17
14
|
description: 'Last-modification timestamp',
|
18
15
|
},
|
19
16
|
modified_by: {
|
20
|
-
type:
|
17
|
+
type: GraphQLString,
|
21
18
|
description: 'UUID from last User who modified the resource',
|
22
19
|
},
|
23
20
|
owner: {
|
24
|
-
type: new
|
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
|
-
|
2
|
-
|
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:
|
7
|
+
type: GraphQLString,
|
11
8
|
},
|
12
9
|
instance: {
|
13
|
-
type:
|
10
|
+
type: GraphQLString,
|
14
11
|
}
|
15
12
|
}),
|
16
13
|
});
|
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
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
|
-
|
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
|
21
|
+
type: new GraphQLNonNull(GraphQLString),
|
25
22
|
description: 'Field names to be sorted on',
|
26
23
|
},
|
27
24
|
order: {
|
28
|
-
type:
|
25
|
+
type: SortEnumType,
|
29
26
|
description: 'Sorting Options',
|
30
27
|
defaultValue: 'asc'
|
31
28
|
},
|
@@ -1,17 +1,14 @@
|
|
1
|
-
|
2
|
-
|
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
|
7
|
+
type: new GraphQLNonNull(GraphQLInt),
|
11
8
|
description: 'Status code',
|
12
9
|
},
|
13
10
|
message: {
|
14
|
-
type:
|
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';
|
package/dist/gql/types/index.js
CHANGED
@@ -1,23 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
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
|
63
|
+
export declare const createFacade: (config: FacadeConfig) => Facade;
|