@restorecommerce/facade 1.3.6 → 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.
- package/.eslintrc.cjs +1 -11
- package/CHANGELOG.md +12 -0
- package/codegen/tsconfig.codegen.tsbuildinfo +1 -0
- package/debug-run.ts +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +5 -4
- package/tsconfig-base.json +8 -19
- package/tsconfig.codegen.json +0 -1
- package/tsconfig.debug.json +1 -5
- package/tsconfig.generate.json +0 -3
- package/tsconfig.lib.json +1 -2
- package/tsconfig.test.json +1 -22
- package/codegen/index.d.ts +0 -12
- package/codegen/index.js +0 -43
- package/dist/gql/index.d.ts +0 -1
- package/dist/gql/index.js +0 -1
- package/dist/gql/protos/federation.d.ts +0 -6
- package/dist/gql/protos/federation.js +0 -46
- package/dist/gql/protos/graphql.d.ts +0 -11
- package/dist/gql/protos/graphql.js +0 -158
- package/dist/gql/protos/index.d.ts +0 -6
- package/dist/gql/protos/index.js +0 -6
- package/dist/gql/protos/registry.d.ts +0 -23
- package/dist/gql/protos/registry.js +0 -366
- package/dist/gql/protos/resolvers.d.ts +0 -9
- package/dist/gql/protos/resolvers.js +0 -479
- package/dist/gql/protos/schema.d.ts +0 -14
- package/dist/gql/protos/schema.js +0 -224
- package/dist/gql/protos/stream-to-async-iterator.d.ts +0 -50
- package/dist/gql/protos/stream-to-async-iterator.js +0 -190
- package/dist/gql/protos/types.d.ts +0 -96
- package/dist/gql/protos/types.js +0 -1
- package/dist/gql/protos/utils.d.ts +0 -18
- package/dist/gql/protos/utils.js +0 -133
- package/dist/gql/types/AccessControlTypes.d.ts +0 -6
- package/dist/gql/types/AccessControlTypes.js +0 -97
- package/dist/gql/types/DateType.d.ts +0 -2
- package/dist/gql/types/DateType.js +0 -29
- package/dist/gql/types/FilterType.d.ts +0 -2
- package/dist/gql/types/FilterType.js +0 -72
- package/dist/gql/types/MetaType.d.ts +0 -2
- package/dist/gql/types/MetaType.js +0 -25
- package/dist/gql/types/ScopeType.d.ts +0 -2
- package/dist/gql/types/ScopeType.js +0 -13
- package/dist/gql/types/SortType.d.ts +0 -3
- package/dist/gql/types/SortType.js +0 -30
- package/dist/gql/types/StatusType.d.ts +0 -2
- package/dist/gql/types/StatusType.js +0 -15
- package/dist/gql/types/index.d.ts +0 -7
- package/dist/gql/types/index.js +0 -7
- package/dist/index.d.ts +0 -66
- package/dist/index.js +0 -312
- package/dist/interfaces.d.ts +0 -54
- package/dist/interfaces.js +0 -6
- package/dist/middlewares/index.d.ts +0 -1
- package/dist/middlewares/index.js +0 -1
- package/dist/middlewares/req-res-logger/index.d.ts +0 -14
- package/dist/middlewares/req-res-logger/index.js +0 -90
- package/dist/modules/access-control/gql/federation.d.ts +0 -2
- package/dist/modules/access-control/gql/federation.js +0 -13
- package/dist/modules/access-control/gql/schema.d.ts +0 -2
- package/dist/modules/access-control/gql/schema.generated.d.ts +0 -1124
- package/dist/modules/access-control/gql/schema.generated.js +0 -80
- package/dist/modules/access-control/gql/schema.js +0 -5
- package/dist/modules/access-control/gql/types.d.ts +0 -3
- package/dist/modules/access-control/gql/types.js +0 -14
- package/dist/modules/access-control/grpc/index.d.ts +0 -13
- package/dist/modules/access-control/grpc/index.js +0 -14
- package/dist/modules/access-control/index.d.ts +0 -2
- package/dist/modules/access-control/index.js +0 -26
- package/dist/modules/access-control/interfaces.d.ts +0 -15
- package/dist/modules/access-control/interfaces.js +0 -1
- package/dist/modules/catalog/gql/federation.d.ts +0 -2
- package/dist/modules/catalog/gql/federation.js +0 -13
- package/dist/modules/catalog/gql/schema.d.ts +0 -2
- package/dist/modules/catalog/gql/schema.generated.d.ts +0 -1503
- package/dist/modules/catalog/gql/schema.generated.js +0 -74
- package/dist/modules/catalog/gql/schema.js +0 -5
- package/dist/modules/catalog/gql/types.d.ts +0 -3
- package/dist/modules/catalog/gql/types.js +0 -16
- package/dist/modules/catalog/grpc/index.d.ts +0 -15
- package/dist/modules/catalog/grpc/index.js +0 -16
- package/dist/modules/catalog/index.d.ts +0 -2
- package/dist/modules/catalog/index.js +0 -26
- package/dist/modules/catalog/interfaces.d.ts +0 -16
- package/dist/modules/catalog/interfaces.js +0 -1
- package/dist/modules/facade-status/gql/index.d.ts +0 -1
- package/dist/modules/facade-status/gql/index.js +0 -11
- package/dist/modules/facade-status/gql/resolvers.d.ts +0 -2
- package/dist/modules/facade-status/gql/resolvers.js +0 -18
- package/dist/modules/facade-status/gql/schema.d.ts +0 -3
- package/dist/modules/facade-status/gql/schema.generated.d.ts +0 -109
- package/dist/modules/facade-status/gql/schema.generated.js +0 -1
- package/dist/modules/facade-status/gql/schema.js +0 -14
- package/dist/modules/facade-status/gql/types.d.ts +0 -2
- package/dist/modules/facade-status/gql/types.js +0 -10
- package/dist/modules/facade-status/index.d.ts +0 -2
- package/dist/modules/facade-status/index.js +0 -8
- package/dist/modules/facade-status/interfaces.d.ts +0 -4
- package/dist/modules/facade-status/interfaces.js +0 -1
- package/dist/modules/fulfillment/gql/federation.d.ts +0 -2
- package/dist/modules/fulfillment/gql/federation.js +0 -13
- package/dist/modules/fulfillment/gql/schema.d.ts +0 -2
- package/dist/modules/fulfillment/gql/schema.generated.d.ts +0 -1539
- package/dist/modules/fulfillment/gql/schema.generated.js +0 -79
- package/dist/modules/fulfillment/gql/schema.js +0 -5
- package/dist/modules/fulfillment/gql/types.d.ts +0 -3
- package/dist/modules/fulfillment/gql/types.js +0 -12
- package/dist/modules/fulfillment/grpc/index.d.ts +0 -9
- package/dist/modules/fulfillment/grpc/index.js +0 -10
- package/dist/modules/fulfillment/index.d.ts +0 -2
- package/dist/modules/fulfillment/index.js +0 -26
- package/dist/modules/fulfillment/interfaces.d.ts +0 -16
- package/dist/modules/fulfillment/interfaces.js +0 -1
- package/dist/modules/identity/api-key/api-key.d.ts +0 -11
- package/dist/modules/identity/api-key/api-key.js +0 -137
- package/dist/modules/identity/gql/federation.d.ts +0 -2
- package/dist/modules/identity/gql/federation.js +0 -5
- package/dist/modules/identity/gql/schema.d.ts +0 -2
- package/dist/modules/identity/gql/schema.generated.d.ts +0 -1661
- package/dist/modules/identity/gql/schema.generated.js +0 -75
- package/dist/modules/identity/gql/schema.js +0 -5
- package/dist/modules/identity/gql/types.d.ts +0 -3
- package/dist/modules/identity/gql/types.js +0 -18
- package/dist/modules/identity/grpc/index.d.ts +0 -15
- package/dist/modules/identity/grpc/index.js +0 -16
- package/dist/modules/identity/index.d.ts +0 -4
- package/dist/modules/identity/index.js +0 -54
- package/dist/modules/identity/interfaces.d.ts +0 -22
- package/dist/modules/identity/interfaces.js +0 -1
- package/dist/modules/identity/oauth/oauth.d.ts +0 -11
- package/dist/modules/identity/oauth/oauth.js +0 -170
- package/dist/modules/identity/oidc/adapter.d.ts +0 -4
- package/dist/modules/identity/oidc/adapter.js +0 -135
- package/dist/modules/identity/oidc/in-memory-adapter.d.ts +0 -16
- package/dist/modules/identity/oidc/in-memory-adapter.js +0 -85
- package/dist/modules/identity/oidc/index.d.ts +0 -18
- package/dist/modules/identity/oidc/index.js +0 -147
- package/dist/modules/identity/oidc/interfaces.d.ts +0 -73
- package/dist/modules/identity/oidc/interfaces.js +0 -7
- package/dist/modules/identity/oidc/password-grant.d.ts +0 -2
- package/dist/modules/identity/oidc/password-grant.js +0 -163
- package/dist/modules/identity/oidc/router.d.ts +0 -13
- package/dist/modules/identity/oidc/router.js +0 -164
- package/dist/modules/identity/oidc/templates.d.ts +0 -36
- package/dist/modules/identity/oidc/templates.js +0 -60
- package/dist/modules/identity/oidc/user.d.ts +0 -6
- package/dist/modules/identity/oidc/user.js +0 -91
- package/dist/modules/identity/oidc/utils.d.ts +0 -6
- package/dist/modules/identity/oidc/utils.js +0 -15
- package/dist/modules/index.d.ts +0 -13
- package/dist/modules/index.js +0 -13
- package/dist/modules/indexing/gql/federation.d.ts +0 -2
- package/dist/modules/indexing/gql/federation.js +0 -13
- package/dist/modules/indexing/gql/schema.d.ts +0 -2
- package/dist/modules/indexing/gql/schema.generated.d.ts +0 -226
- package/dist/modules/indexing/gql/schema.generated.js +0 -6
- package/dist/modules/indexing/gql/schema.js +0 -5
- package/dist/modules/indexing/gql/types.d.ts +0 -3
- package/dist/modules/indexing/gql/types.js +0 -8
- package/dist/modules/indexing/grpc/index.d.ts +0 -7
- package/dist/modules/indexing/grpc/index.js +0 -8
- package/dist/modules/indexing/index.d.ts +0 -2
- package/dist/modules/indexing/index.js +0 -26
- package/dist/modules/indexing/interfaces.d.ts +0 -13
- package/dist/modules/indexing/interfaces.js +0 -1
- package/dist/modules/invoicing/gql/federation.d.ts +0 -2
- package/dist/modules/invoicing/gql/federation.js +0 -13
- package/dist/modules/invoicing/gql/schema.d.ts +0 -2
- package/dist/modules/invoicing/gql/schema.generated.d.ts +0 -1150
- package/dist/modules/invoicing/gql/schema.generated.js +0 -75
- package/dist/modules/invoicing/gql/schema.js +0 -5
- package/dist/modules/invoicing/gql/types.d.ts +0 -3
- package/dist/modules/invoicing/gql/types.js +0 -8
- package/dist/modules/invoicing/grpc/index.d.ts +0 -7
- package/dist/modules/invoicing/grpc/index.js +0 -8
- package/dist/modules/invoicing/index.d.ts +0 -2
- package/dist/modules/invoicing/index.js +0 -26
- package/dist/modules/invoicing/interfaces.d.ts +0 -16
- package/dist/modules/invoicing/interfaces.js +0 -1
- package/dist/modules/master_data/gql/federation.d.ts +0 -2
- package/dist/modules/master_data/gql/federation.js +0 -13
- package/dist/modules/master_data/gql/schema.d.ts +0 -2
- package/dist/modules/master_data/gql/schema.generated.d.ts +0 -2520
- package/dist/modules/master_data/gql/schema.generated.js +0 -114
- package/dist/modules/master_data/gql/schema.js +0 -5
- package/dist/modules/master_data/gql/types.d.ts +0 -3
- package/dist/modules/master_data/gql/types.js +0 -32
- package/dist/modules/master_data/grpc/index.d.ts +0 -30
- package/dist/modules/master_data/grpc/index.js +0 -32
- package/dist/modules/master_data/index.d.ts +0 -2
- package/dist/modules/master_data/index.js +0 -26
- package/dist/modules/master_data/interfaces.d.ts +0 -16
- package/dist/modules/master_data/interfaces.js +0 -1
- package/dist/modules/notification/gql/federation.d.ts +0 -2
- package/dist/modules/notification/gql/federation.js +0 -13
- package/dist/modules/notification/gql/schema.d.ts +0 -2
- package/dist/modules/notification/gql/schema.generated.d.ts +0 -632
- package/dist/modules/notification/gql/schema.generated.js +0 -68
- package/dist/modules/notification/gql/schema.js +0 -5
- package/dist/modules/notification/gql/types.d.ts +0 -3
- package/dist/modules/notification/gql/types.js +0 -8
- package/dist/modules/notification/grpc/index.d.ts +0 -7
- package/dist/modules/notification/grpc/index.js +0 -8
- package/dist/modules/notification/index.d.ts +0 -2
- package/dist/modules/notification/index.js +0 -26
- package/dist/modules/notification/interfaces.d.ts +0 -16
- package/dist/modules/notification/interfaces.js +0 -1
- package/dist/modules/ordering/gql/federation.d.ts +0 -2
- package/dist/modules/ordering/gql/federation.js +0 -13
- package/dist/modules/ordering/gql/schema.d.ts +0 -2
- package/dist/modules/ordering/gql/schema.generated.d.ts +0 -1407
- package/dist/modules/ordering/gql/schema.generated.js +0 -91
- package/dist/modules/ordering/gql/schema.js +0 -5
- package/dist/modules/ordering/gql/types.d.ts +0 -3
- package/dist/modules/ordering/gql/types.js +0 -8
- package/dist/modules/ordering/grpc/index.d.ts +0 -7
- package/dist/modules/ordering/grpc/index.js +0 -8
- package/dist/modules/ordering/index.d.ts +0 -2
- package/dist/modules/ordering/index.js +0 -26
- package/dist/modules/ordering/interfaces.d.ts +0 -16
- package/dist/modules/ordering/interfaces.js +0 -1
- package/dist/modules/ostorage/gql/federation.d.ts +0 -2
- package/dist/modules/ostorage/gql/federation.js +0 -13
- package/dist/modules/ostorage/gql/schema.d.ts +0 -2
- package/dist/modules/ostorage/gql/schema.generated.d.ts +0 -846
- package/dist/modules/ostorage/gql/schema.generated.js +0 -31
- package/dist/modules/ostorage/gql/schema.js +0 -5
- package/dist/modules/ostorage/gql/types.d.ts +0 -3
- package/dist/modules/ostorage/gql/types.js +0 -8
- package/dist/modules/ostorage/grpc/index.d.ts +0 -7
- package/dist/modules/ostorage/grpc/index.js +0 -8
- package/dist/modules/ostorage/index.d.ts +0 -2
- package/dist/modules/ostorage/index.js +0 -46
- package/dist/modules/ostorage/interfaces.d.ts +0 -16
- package/dist/modules/ostorage/interfaces.js +0 -1
- package/dist/modules/ostorage/objectDownloadReqHandler.d.ts +0 -1
- package/dist/modules/ostorage/objectDownloadReqHandler.js +0 -134
- package/dist/modules/payment/gql/federation.d.ts +0 -2
- package/dist/modules/payment/gql/federation.js +0 -13
- package/dist/modules/payment/gql/schema.d.ts +0 -2
- package/dist/modules/payment/gql/schema.generated.d.ts +0 -647
- package/dist/modules/payment/gql/schema.generated.js +0 -156
- package/dist/modules/payment/gql/schema.js +0 -5
- package/dist/modules/payment/gql/types.d.ts +0 -3
- package/dist/modules/payment/gql/types.js +0 -8
- package/dist/modules/payment/grpc/index.d.ts +0 -7
- package/dist/modules/payment/grpc/index.js +0 -8
- package/dist/modules/payment/index.d.ts +0 -2
- package/dist/modules/payment/index.js +0 -26
- package/dist/modules/payment/interfaces.d.ts +0 -16
- package/dist/modules/payment/interfaces.js +0 -1
- package/dist/modules/scheduling/gql/federation.d.ts +0 -2
- package/dist/modules/scheduling/gql/federation.js +0 -13
- package/dist/modules/scheduling/gql/schema.d.ts +0 -2
- package/dist/modules/scheduling/gql/schema.generated.d.ts +0 -626
- package/dist/modules/scheduling/gql/schema.generated.js +0 -31
- package/dist/modules/scheduling/gql/schema.js +0 -5
- package/dist/modules/scheduling/gql/types.d.ts +0 -3
- package/dist/modules/scheduling/gql/types.js +0 -8
- package/dist/modules/scheduling/grpc/index.d.ts +0 -7
- package/dist/modules/scheduling/grpc/index.js +0 -8
- package/dist/modules/scheduling/index.d.ts +0 -2
- package/dist/modules/scheduling/index.js +0 -26
- package/dist/modules/scheduling/interfaces.d.ts +0 -16
- package/dist/modules/scheduling/interfaces.js +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.js +0 -14
package/dist/gql/protos/utils.js
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
import _ from 'lodash';
|
2
|
-
import { scalarTypes, recursiveEnumCheck, getNameSpaceTypeName, getTyping } from './registry.js';
|
3
|
-
export const capitalizeProtoName = (name) => {
|
4
|
-
return name.replace(/(?:\.|^|_)(\w)/g, v => v.toUpperCase()).replace(/[._]/g, '');
|
5
|
-
};
|
6
|
-
// converts camelcase entity name to snake case
|
7
|
-
export const convertyCamelToSnakeCase = (entity) => {
|
8
|
-
return entity.replace(/(?:^|\.?)([A-Z])/g, (x, y) => { return '_' + y.toLowerCase(); }).replace(/^_/, '');
|
9
|
-
};
|
10
|
-
export const getKeys = (obj) => {
|
11
|
-
let set = new Set();
|
12
|
-
if (obj) {
|
13
|
-
const keys = Object.keys(obj);
|
14
|
-
for (let key of keys) {
|
15
|
-
if (typeof obj[key] === 'string') {
|
16
|
-
set.add(obj[key]);
|
17
|
-
}
|
18
|
-
else if (Array.isArray(obj[key])) {
|
19
|
-
for (let value of obj[key]) {
|
20
|
-
set.add(value);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}
|
24
|
-
}
|
25
|
-
return Array.from(set);
|
26
|
-
};
|
27
|
-
export const decodeBufferFields = (items, bufferFields) => {
|
28
|
-
if (bufferFields && bufferFields.length > 0 && items && items.length > 0) {
|
29
|
-
for (let item of items) {
|
30
|
-
if (item && item.payload) {
|
31
|
-
const existingBufferFields = _.intersection(Object.keys(item.payload), bufferFields);
|
32
|
-
for (let bufferField of existingBufferFields) {
|
33
|
-
if (item.payload[bufferField] && item.payload[bufferField].value && item.payload[bufferField].value instanceof Buffer) {
|
34
|
-
item.payload[bufferField].value = JSON.parse(item.payload[bufferField].value.toString());
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
}
|
39
|
-
return items;
|
40
|
-
}
|
41
|
-
else {
|
42
|
-
return items;
|
43
|
-
}
|
44
|
-
};
|
45
|
-
/**
|
46
|
-
* recursively find the id and updates the object with given value, this function
|
47
|
-
* also takes care to handle if there is an array at any position in the path
|
48
|
-
* @param id property of the object
|
49
|
-
* @param val value to be updated in Object
|
50
|
-
* @param obj Object
|
51
|
-
*/
|
52
|
-
const updateJSON = (id, value, obj) => {
|
53
|
-
for (const [k, v] of Object.entries(obj)) {
|
54
|
-
if (k === id) {
|
55
|
-
const foundObj = value.find((e) => e.name === obj[k]);
|
56
|
-
if (foundObj) {
|
57
|
-
obj[k] = foundObj.number;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
else if (typeof v === 'object') {
|
61
|
-
updateJSON(id, value, v);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
};
|
65
|
-
/**
|
66
|
-
* converts enum string values to integers reading from the inputTyping
|
67
|
-
* @param TypingData input typing
|
68
|
-
* @param req request object from which the enum strings to be replaced
|
69
|
-
*/
|
70
|
-
export const convertEnumToInt = (inputTyping, req) => {
|
71
|
-
let enumMap = new Map();
|
72
|
-
// enumMap populated with key as enum name space type and value as the path (to replace from request object)
|
73
|
-
if (inputTyping) {
|
74
|
-
const gqlInputObject = inputTyping.input;
|
75
|
-
const gqlFields = gqlInputObject.getFields();
|
76
|
-
if (gqlFields) {
|
77
|
-
const fieldNames = Object.keys(gqlFields);
|
78
|
-
for (let fieldName of fieldNames) {
|
79
|
-
// gql fieldName from input is of format [IIoRestorecommerceResourcebaseSort!]
|
80
|
-
// below check is to remove `[` and `!]`
|
81
|
-
let fieldType = gqlFields[fieldName].type.toString();
|
82
|
-
if (fieldType.startsWith('[') && fieldType.endsWith('!]')) {
|
83
|
-
fieldType = fieldType.substring(1, fieldType.length - 2);
|
84
|
-
}
|
85
|
-
// if fieldType is not basic type, then check if its fieldType belongs to Enum
|
86
|
-
// if not get the object and make recursive check till no more objects are found
|
87
|
-
if (scalarTypes.indexOf(fieldType) <= -1) {
|
88
|
-
enumMap = recursiveEnumCheck(fieldType, enumMap, fieldName, []);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
}
|
93
|
-
for (let [key, val] of enumMap) {
|
94
|
-
const enumNameSpace = getNameSpaceTypeName(key);
|
95
|
-
if (enumNameSpace && typeof enumNameSpace === 'string') {
|
96
|
-
const enumTyping = getTyping(enumNameSpace);
|
97
|
-
const enumIntMapping = (enumTyping === null || enumTyping === void 0 ? void 0 : enumTyping.meta).value;
|
98
|
-
if (enumIntMapping && _.isArray(enumIntMapping) && enumIntMapping.length > 0) {
|
99
|
-
// val refers to property name
|
100
|
-
updateJSON(val, enumIntMapping, req);
|
101
|
-
}
|
102
|
-
}
|
103
|
-
}
|
104
|
-
return req;
|
105
|
-
};
|
106
|
-
export const capitalize = (s) => {
|
107
|
-
return s.substring(0, 1).toUpperCase() + s.substring(1);
|
108
|
-
};
|
109
|
-
export const snakeToCamel = (s) => {
|
110
|
-
return s
|
111
|
-
.split('_')
|
112
|
-
.map((word, i) => {
|
113
|
-
if (i === 0) {
|
114
|
-
// if first symbol is "_" then skip it
|
115
|
-
return word ? word[0] + word.substring(1).toLowerCase() : '';
|
116
|
-
}
|
117
|
-
else {
|
118
|
-
return capitalize(word.toLowerCase());
|
119
|
-
}
|
120
|
-
})
|
121
|
-
.join('');
|
122
|
-
};
|
123
|
-
export const camelToSnake = (serviceName) => {
|
124
|
-
// convert camel case to snake case
|
125
|
-
serviceName = serviceName.replace(/(?:^|\.?)([A-Z])/g, (x, y) => { return '_' + y.toLowerCase(); }).replace(/^_/, '');
|
126
|
-
return serviceName;
|
127
|
-
};
|
128
|
-
export const getServiceName = (serviceName) => {
|
129
|
-
return serviceName.endsWith('Service') ? camelToSnake(serviceName.substr(0, serviceName.length - 7)) : camelToSnake(serviceName);
|
130
|
-
};
|
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,6 +0,0 @@
|
|
1
|
-
import { GraphQLObjectType, GraphQLInputObjectType, GraphQLEnumType } from 'graphql';
|
2
|
-
export declare const AccessControlEffectType: GraphQLEnumType;
|
3
|
-
export declare const AccessControlDecisionType: GraphQLEnumType;
|
4
|
-
export declare const AttributeType: GraphQLObjectType<any, any>;
|
5
|
-
export declare const AttributeInputType: GraphQLInputObjectType;
|
6
|
-
export declare const AccessControlTargetType: GraphQLObjectType<any, any>;
|
@@ -1,97 +0,0 @@
|
|
1
|
-
import { GraphQLObjectType, GraphQLInputObjectType, GraphQLString, GraphQLEnumType, GraphQLList, GraphQLNonNull } from 'graphql';
|
2
|
-
// export const AccessControlnputTargetType = new GraphQLInputObjectType({
|
3
|
-
// name: 'AccessControlnputTargetType',
|
4
|
-
// description: 'Generic command resource.',
|
5
|
-
// fields: () => ({
|
6
|
-
// subject: {
|
7
|
-
// type: new GraphQLList(InputAttribute),
|
8
|
-
// description: 'Entity requesting access.',
|
9
|
-
// },
|
10
|
-
// resources: {
|
11
|
-
// type: new GraphQLList(InputAttribute),
|
12
|
-
// description: 'Targeted resources',
|
13
|
-
// },
|
14
|
-
// action: {
|
15
|
-
// type: new GraphQLList(InputAttribute),
|
16
|
-
// description: 'Targeted action',
|
17
|
-
// },
|
18
|
-
// }),
|
19
|
-
// });
|
20
|
-
export const AccessControlEffectType = new GraphQLEnumType({
|
21
|
-
name: 'AccessControlEffect',
|
22
|
-
description: 'Effect resulting from a rule, policy or policy set',
|
23
|
-
values: {
|
24
|
-
PERMIT: {
|
25
|
-
value: 'PERMIT',
|
26
|
-
description: 'Permit operation',
|
27
|
-
},
|
28
|
-
DENY: {
|
29
|
-
value: 'DENY',
|
30
|
-
description: 'Deny operation',
|
31
|
-
},
|
32
|
-
}
|
33
|
-
});
|
34
|
-
export const AccessControlDecisionType = new GraphQLEnumType({
|
35
|
-
name: 'AccessControlDecision',
|
36
|
-
description: 'Decision from an access control response',
|
37
|
-
values: {
|
38
|
-
PERMIT: {
|
39
|
-
value: 'PERMIT',
|
40
|
-
description: 'Permit operation',
|
41
|
-
},
|
42
|
-
DENY: {
|
43
|
-
value: 'DENY',
|
44
|
-
description: 'Deny operation',
|
45
|
-
},
|
46
|
-
INDETERMINATE: {
|
47
|
-
value: 'INDETERMINATE',
|
48
|
-
description: 'Indeterminate result (no targets are applicable to request)',
|
49
|
-
}
|
50
|
-
}
|
51
|
-
});
|
52
|
-
export const AttributeType = new GraphQLObjectType({
|
53
|
-
name: 'Attribute',
|
54
|
-
description: 'An ID-value attribute',
|
55
|
-
fields: () => ({
|
56
|
-
id: {
|
57
|
-
type: new GraphQLNonNull(GraphQLString),
|
58
|
-
description: 'Attribute ID'
|
59
|
-
},
|
60
|
-
value: {
|
61
|
-
type: new GraphQLNonNull(GraphQLString),
|
62
|
-
description: 'Attribute value'
|
63
|
-
}
|
64
|
-
})
|
65
|
-
});
|
66
|
-
export const AttributeInputType = new GraphQLInputObjectType({
|
67
|
-
name: 'InputAttribute',
|
68
|
-
description: 'Attribute from a Target property',
|
69
|
-
fields: () => ({
|
70
|
-
id: {
|
71
|
-
type: new GraphQLNonNull(GraphQLString),
|
72
|
-
description: 'Attribute ID',
|
73
|
-
},
|
74
|
-
value: {
|
75
|
-
type: new GraphQLNonNull(GraphQLString),
|
76
|
-
description: 'Attribute value'
|
77
|
-
}
|
78
|
-
})
|
79
|
-
});
|
80
|
-
export const AccessControlTargetType = new GraphQLObjectType({
|
81
|
-
name: 'AccessControlTarget',
|
82
|
-
description: 'Generic command resource.',
|
83
|
-
fields: () => ({
|
84
|
-
subject: {
|
85
|
-
type: new GraphQLList(AttributeType),
|
86
|
-
description: 'Entity requesting access.',
|
87
|
-
},
|
88
|
-
resources: {
|
89
|
-
type: new GraphQLList(AttributeType),
|
90
|
-
description: 'Targeted resources',
|
91
|
-
},
|
92
|
-
action: {
|
93
|
-
type: new GraphQLList(AttributeType),
|
94
|
-
description: 'Targeted action',
|
95
|
-
},
|
96
|
-
}),
|
97
|
-
});
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { GraphQLScalarType } from 'graphql';
|
2
|
-
import { Kind } from 'graphql/language/index.js';
|
3
|
-
export const DateType = new GraphQLScalarType({
|
4
|
-
name: 'Date',
|
5
|
-
description: 'Date custom scalar type',
|
6
|
-
parseValue: (value) => {
|
7
|
-
if (value === 0) {
|
8
|
-
return null;
|
9
|
-
}
|
10
|
-
return new Date(value);
|
11
|
-
},
|
12
|
-
serialize: (value) => {
|
13
|
-
// This is the object received back from the DB
|
14
|
-
if (value === 0) {
|
15
|
-
return null;
|
16
|
-
}
|
17
|
-
let dateObj = new Date(value);
|
18
|
-
return dateObj;
|
19
|
-
},
|
20
|
-
parseLiteral: (ast) => {
|
21
|
-
if (ast.kind === Kind.STRING) {
|
22
|
-
if (ast.value === '0') {
|
23
|
-
return null;
|
24
|
-
}
|
25
|
-
return (new Date(ast.value)).getTime();
|
26
|
-
}
|
27
|
-
return null;
|
28
|
-
},
|
29
|
-
});
|
@@ -1,72 +0,0 @@
|
|
1
|
-
import { GraphQLInputObjectType, GraphQLString, GraphQLEnumType, GraphQLNonNull } from 'graphql';
|
2
|
-
const FilterOperationEnumType = new GraphQLEnumType({
|
3
|
-
name: 'FilterOperationEnumType',
|
4
|
-
description: 'Filters the fields based on the operation specified',
|
5
|
-
values: {
|
6
|
-
lt: {
|
7
|
-
value: 'lt',
|
8
|
-
description: 'Filter fields lesser than the the specified value',
|
9
|
-
},
|
10
|
-
lte: {
|
11
|
-
value: 'lte',
|
12
|
-
description: 'Filter fields lesser than or equal to the the specified value',
|
13
|
-
},
|
14
|
-
gt: {
|
15
|
-
value: 'gt',
|
16
|
-
description: 'Filter fields greater than the the specified value',
|
17
|
-
},
|
18
|
-
gte: {
|
19
|
-
value: 'gte',
|
20
|
-
description: 'Filter fields greater than or equal to the the specified value',
|
21
|
-
},
|
22
|
-
eq: {
|
23
|
-
value: 'eq',
|
24
|
-
description: 'Filter fields exactly equal to the the specified value',
|
25
|
-
},
|
26
|
-
isEmpty: {
|
27
|
-
value: 'isEmpty',
|
28
|
-
description: 'Filter fields exactly equal to the the specified value',
|
29
|
-
},
|
30
|
-
}
|
31
|
-
});
|
32
|
-
const FilterFieldValueEnumType = new GraphQLEnumType({
|
33
|
-
name: 'FilterFieldValueEnumType',
|
34
|
-
description: '',
|
35
|
-
values: {
|
36
|
-
STRING: {
|
37
|
-
value: 'string'
|
38
|
-
},
|
39
|
-
BOOLEAN: {
|
40
|
-
value: 'boolean'
|
41
|
-
},
|
42
|
-
NUMBER: {
|
43
|
-
value: 'number'
|
44
|
-
},
|
45
|
-
DATE: {
|
46
|
-
value: 'date'
|
47
|
-
}
|
48
|
-
}
|
49
|
-
});
|
50
|
-
export const FilterOptionsInputType = new GraphQLInputObjectType({
|
51
|
-
name: 'FilterOptionsInputType',
|
52
|
-
description: 'Filter options',
|
53
|
-
fields: {
|
54
|
-
field: {
|
55
|
-
type: new GraphQLNonNull(GraphQLString),
|
56
|
-
description: 'Field names based on which the filtering needs to be done',
|
57
|
-
},
|
58
|
-
operation: {
|
59
|
-
type: new GraphQLNonNull(FilterOperationEnumType),
|
60
|
-
description: 'Filter Operation options',
|
61
|
-
},
|
62
|
-
value: {
|
63
|
-
type: new GraphQLNonNull(GraphQLString),
|
64
|
-
description: 'Field value',
|
65
|
-
},
|
66
|
-
type: {
|
67
|
-
type: FilterFieldValueEnumType,
|
68
|
-
description: 'Value type (optional, default is STRING)',
|
69
|
-
defaultValue: 'string'
|
70
|
-
}
|
71
|
-
}
|
72
|
-
});
|
@@ -1,25 +0,0 @@
|
|
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({
|
5
|
-
name: 'MetaType',
|
6
|
-
description: 'Meta info common to all resources',
|
7
|
-
fields: () => ({
|
8
|
-
created: {
|
9
|
-
type: new GraphQLNonNull(DateType),
|
10
|
-
description: 'Creation timestamp',
|
11
|
-
},
|
12
|
-
modified: {
|
13
|
-
type: new GraphQLNonNull(DateType),
|
14
|
-
description: 'Last-modification timestamp',
|
15
|
-
},
|
16
|
-
modified_by: {
|
17
|
-
type: GraphQLString,
|
18
|
-
description: 'UUID from last User who modified the resource',
|
19
|
-
},
|
20
|
-
owner: {
|
21
|
-
type: new GraphQLList(new GraphQLNonNull(AttributeType)),
|
22
|
-
description: 'A list of attributes describing the owner\'s entities',
|
23
|
-
}
|
24
|
-
}),
|
25
|
-
});
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { GraphQLInputObjectType, GraphQLString } from 'graphql';
|
2
|
-
export const ScopeInputType = new GraphQLInputObjectType({
|
3
|
-
name: 'ScopeInputType',
|
4
|
-
description: 'A role scope',
|
5
|
-
fields: () => ({
|
6
|
-
entity: {
|
7
|
-
type: GraphQLString,
|
8
|
-
},
|
9
|
-
instance: {
|
10
|
-
type: GraphQLString,
|
11
|
-
}
|
12
|
-
}),
|
13
|
-
});
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { GraphQLInputObjectType, GraphQLString, GraphQLEnumType, GraphQLNonNull } from 'graphql';
|
2
|
-
export const SortEnumType = new GraphQLEnumType({
|
3
|
-
name: 'SortEnumType',
|
4
|
-
description: 'Sorts the fields in either Ascending or Descending order',
|
5
|
-
values: {
|
6
|
-
ASC: {
|
7
|
-
value: 'asc',
|
8
|
-
description: 'Sort in Ascending order',
|
9
|
-
},
|
10
|
-
DESC: {
|
11
|
-
value: 'desc',
|
12
|
-
description: 'Sort in Descending order',
|
13
|
-
},
|
14
|
-
}
|
15
|
-
});
|
16
|
-
export const SortInputType = new GraphQLInputObjectType({
|
17
|
-
name: 'SortInputType',
|
18
|
-
description: 'For sotring based on fileds',
|
19
|
-
fields: () => ({
|
20
|
-
field: {
|
21
|
-
type: new GraphQLNonNull(GraphQLString),
|
22
|
-
description: 'Field names to be sorted on',
|
23
|
-
},
|
24
|
-
order: {
|
25
|
-
type: SortEnumType,
|
26
|
-
description: 'Sorting Options',
|
27
|
-
defaultValue: 'asc'
|
28
|
-
},
|
29
|
-
}),
|
30
|
-
});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLInt } from 'graphql';
|
2
|
-
export const OperationStatusType = new GraphQLObjectType({
|
3
|
-
name: 'StatusType',
|
4
|
-
description: 'Objects with error returned for GraphQL operations',
|
5
|
-
fields: () => ({
|
6
|
-
code: {
|
7
|
-
type: new GraphQLNonNull(GraphQLInt),
|
8
|
-
description: 'Status code',
|
9
|
-
},
|
10
|
-
message: {
|
11
|
-
type: GraphQLString,
|
12
|
-
description: 'Status message description',
|
13
|
-
}
|
14
|
-
}),
|
15
|
-
});
|
package/dist/gql/types/index.js
DELETED
package/dist/index.d.ts
DELETED
@@ -1,66 +0,0 @@
|
|
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, FileUploadOptionsConfig } 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
|
-
interface RestoreCommerceFacadeImplConfig {
|
15
|
-
koa: Koa<any, any>;
|
16
|
-
logger: Logger;
|
17
|
-
port?: number;
|
18
|
-
hostname?: string;
|
19
|
-
env?: string;
|
20
|
-
kafka?: KafkaProviderConfig['kafka'];
|
21
|
-
fileUploadOptions?: FileUploadOptionsConfig['fileUploadOptions'];
|
22
|
-
}
|
23
|
-
export declare class RestoreCommerceFacade<TModules extends FacadeModuleBase[] = []> implements Facade<TModules> {
|
24
|
-
private apolloServices;
|
25
|
-
private allResolvers;
|
26
|
-
private _server?;
|
27
|
-
private _initialized;
|
28
|
-
readonly logger: Logger;
|
29
|
-
readonly port: number;
|
30
|
-
readonly hostname: string;
|
31
|
-
readonly koa: Koa<any, FacadeModulesContext<TModules>>;
|
32
|
-
readonly env: string;
|
33
|
-
readonly modules: FacadeModule[];
|
34
|
-
readonly kafkaConfig?: KafkaProviderConfig['kafka'];
|
35
|
-
readonly fileUploadOptionsConfig?: FileUploadOptionsConfig['fileUploadOptions'];
|
36
|
-
private startFns;
|
37
|
-
private stopFns;
|
38
|
-
constructor({ koa, logger, port, hostname, env, kafka, fileUploadOptions }: RestoreCommerceFacadeImplConfig);
|
39
|
-
get server(): Server<typeof import("http").IncomingMessage, typeof ServerResponse> | undefined;
|
40
|
-
get address(): AddressInfo | undefined;
|
41
|
-
get listening(): boolean;
|
42
|
-
useMiddleware<TNewState extends object = {}, TNewContext extends object = {}>(middleware: Koa.Middleware<TNewState, TNewContext>): any;
|
43
|
-
useModule<TNewModule extends FacadeModule>(module: TNewModule): any;
|
44
|
-
supportsModule<TSupportedModule extends FacadeModuleBase<FacadeBaseContext>>(module: TSupportedModule): this is Facade<[TSupportedModule, ...TModules]> & Facade<[...TModules]>;
|
45
|
-
addApolloService({ name, schema, url }: {
|
46
|
-
name: string;
|
47
|
-
schema: any;
|
48
|
-
url: string;
|
49
|
-
}): void;
|
50
|
-
onStart(fn: () => Promise<void>): void;
|
51
|
-
onStop(fn: () => Promise<void>): void;
|
52
|
-
private runFnQueue;
|
53
|
-
start(): Promise<void>;
|
54
|
-
stop(): Promise<void>;
|
55
|
-
private mountApolloServer;
|
56
|
-
}
|
57
|
-
export interface FacadeConfig {
|
58
|
-
port?: number;
|
59
|
-
logger?: Logger;
|
60
|
-
hostname?: string;
|
61
|
-
env?: string;
|
62
|
-
keys?: string[];
|
63
|
-
kafka?: KafkaProviderConfig['kafka'];
|
64
|
-
fileUploadOptions?: FileUploadOptionsConfig['fileUploadOptions'];
|
65
|
-
}
|
66
|
-
export declare const createFacade: (config: FacadeConfig) => Facade;
|