@restorecommerce/facade 0.3.3 → 0.3.6

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/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.3.6](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.3.5...@restorecommerce/facade@0.3.6) (2022-03-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **facade:** merge query and mutation resolvers ([c2481b0](https://github.com/restorecommerce/libs/commit/c2481b05c46a5992d2a05017f9c4d279f3055613))
12
+ * **facade:** to add scope only to root mutation / query instead of all input types and updated suject scope to read from request scope ([9bbc8da](https://github.com/restorecommerce/libs/commit/9bbc8daba19d1ce5ef16b54f9353b9c2df39258e))
13
+
14
+
15
+
16
+
17
+
18
+ ## [0.3.5](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.3.4...@restorecommerce/facade@0.3.5) (2022-03-04)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **facade:** added null check ([2ff25fe](https://github.com/restorecommerce/libs/commit/2ff25febd04ffa624d2ba4a7b50179726abfe8da))
24
+
25
+
26
+
27
+
28
+
29
+ ## [0.3.4](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.3.3...@restorecommerce/facade@0.3.4) (2022-03-04)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * **facade:** added scope for all mutations and queries ([3b4df19](https://github.com/restorecommerce/libs/commit/3b4df196fa8bbbdc169846c588d3d53c85a4c091))
35
+ * **facade:** fixed enum type mapping for nested object ([f452229](https://github.com/restorecommerce/libs/commit/f452229fc3ceec7205d079884a55076578e5a975))
36
+
37
+
38
+
39
+
40
+
6
41
  ## [0.3.3](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.3.2...@restorecommerce/facade@0.3.3) (2022-03-01)
7
42
 
8
43
  **Note:** Version bump only for package @restorecommerce/facade
@@ -64,7 +64,7 @@ const recursiveUploadToBuffer = async (data, model) => {
64
64
  if (model instanceof definition_1.GraphQLInputObjectType) {
65
65
  const fields = model.getFields();
66
66
  for (let key of Object.keys(fields)) {
67
- if (key in data) {
67
+ if (data && key in data) {
68
68
  data[key] = await (0, exports.recursiveUploadToBuffer)(data[key], fields[key].type);
69
69
  }
70
70
  }
@@ -108,7 +108,6 @@ const getGQLResolverFunctions = (service, key, serviceKey, grpcClientConfig) =>
108
108
  if (!('fromPartial' in typing.processor)) {
109
109
  throw Error(`Method ${method.name} input type '${method.inputType}' does not contain 'fromPartial' function`);
110
110
  }
111
- const defaults = typing.processor.fromPartial({});
112
111
  let subjectField = null;
113
112
  if (typing) {
114
113
  for (let field of typing.meta.field) {
@@ -118,16 +117,20 @@ const getGQLResolverFunctions = (service, key, serviceKey, grpcClientConfig) =>
118
117
  }
119
118
  }
120
119
  }
121
- obj[method.name] = async (args, context) => {
120
+ let methodName = method.name;
121
+ if (Mutate.indexOf(method.name) > -1) {
122
+ methodName = 'Mutate';
123
+ }
124
+ if (methodName in obj) {
125
+ return obj;
126
+ }
127
+ obj[methodName] = async (args, context) => {
128
+ var _a;
122
129
  const client = context[key].client;
123
130
  const service = client[serviceKey];
124
131
  try {
125
132
  const converted = await (0, exports.recursiveUploadToBuffer)(args.input, typing.input);
126
- let req = {
127
- // Fill defaults
128
- ...defaults,
129
- ...converted
130
- };
133
+ let req = typing.processor.fromPartial(converted);
131
134
  // convert enum strings to integers
132
135
  req = (0, utils_1.convertEnumToInt)(typing, req);
133
136
  if (subjectField !== null) {
@@ -136,8 +139,27 @@ const getGQLResolverFunctions = (service, key, serviceKey, grpcClientConfig) =>
136
139
  if (authToken && authToken.startsWith('Bearer ')) {
137
140
  req.subject.token = authToken.split(' ')[1];
138
141
  }
142
+ if (req.scope) {
143
+ req.subject.scope = req.scope;
144
+ }
145
+ }
146
+ let realMethod = method.name;
147
+ if (Mutate.indexOf(method.name) > -1) {
148
+ const mode = (_a = args === null || args === void 0 ? void 0 : args.input) === null || _a === void 0 ? void 0 : _a.mode;
149
+ if (!mode) {
150
+ throw new Error('Please specify mode');
151
+ }
152
+ if (mode === 'CREATE') {
153
+ realMethod = 'Create';
154
+ }
155
+ else if (mode === 'UPDATE') {
156
+ realMethod = 'Update';
157
+ }
158
+ else if (mode === 'UPSERT') {
159
+ realMethod = 'Upsert';
160
+ }
139
161
  }
140
- const result = await service[method.name](req);
162
+ const result = await service[realMethod](req);
141
163
  const bufferFields = (0, utils_1.getKeys)(grpcClientConfig === null || grpcClientConfig === void 0 ? void 0 : grpcClientConfig.bufferFields);
142
164
  if (result instanceof stream.Readable) {
143
165
  let operationStatus = { code: 0, message: '' };
@@ -226,155 +248,6 @@ const getGQLResolverFunctions = (service, key, serviceKey, grpcClientConfig) =>
226
248
  };
227
249
  exports.getGQLResolverFunctions = getGQLResolverFunctions;
228
250
  const namespaceResolverRegistry = new Map();
229
- const MutateResolver = async (req, ctx, schema) => {
230
- var _a, _b, _c, _d, _e, _f;
231
- let module_name, key, service;
232
- if ((_b = (_a = schema === null || schema === void 0 ? void 0 : schema.path) === null || _a === void 0 ? void 0 : _a.prev) === null || _b === void 0 ? void 0 : _b.key) {
233
- key = schema.path.prev.key;
234
- }
235
- if ((_d = (_c = schema === null || schema === void 0 ? void 0 : schema.path) === null || _c === void 0 ? void 0 : _c.prev) === null || _d === void 0 ? void 0 : _d.typename) {
236
- let typeName = schema.path.prev.typename;
237
- if (typeName.endsWith('Mutation')) {
238
- module_name = typeName.split('Mutation')[0];
239
- }
240
- }
241
- if (key && module_name) {
242
- module_name = (0, utils_1.convertyCamelToSnakeCase)(module_name);
243
- key = (0, utils_1.convertyCamelToSnakeCase)(key);
244
- service = (_e = ctx[module_name]) === null || _e === void 0 ? void 0 : _e.client[key];
245
- }
246
- try {
247
- let method = '';
248
- let input = req.input;
249
- const mode = (_f = req === null || req === void 0 ? void 0 : req.input) === null || _f === void 0 ? void 0 : _f.mode;
250
- if (!mode) {
251
- throw new Error('Please specify mode');
252
- }
253
- if (mode === 'CREATE') {
254
- method = 'Create';
255
- }
256
- else if (mode === 'UPDATE') {
257
- method = 'Update';
258
- }
259
- else if (mode === 'UPSERT') {
260
- method = 'Upsert';
261
- }
262
- const inputMethodTypeKey = module_name.toLowerCase() + '.' + key.toLowerCase() + '.' + method.toLowerCase();
263
- const nsType = inputMethodType.get(inputMethodTypeKey);
264
- if (nsType) {
265
- const inputTyping = (0, registry_1.getTyping)(nsType);
266
- (0, utils_1.convertEnumToInt)(inputTyping, input);
267
- }
268
- // check service object contains requested mode's method def
269
- if (!service[method]) {
270
- throw new Error(`Method ${method} not defined on ${module_name}`);
271
- }
272
- // update subject token from authorizatin header
273
- let subject = {
274
- id: '',
275
- scope: '',
276
- roleAssociations: [],
277
- hierarchicalScopes: [],
278
- token: '',
279
- unauthenticated: false
280
- };
281
- const authToken = ctx.request.req.headers['authorization'];
282
- if (authToken && authToken.startsWith('Bearer ')) {
283
- subject.token = authToken.split(' ')[1];
284
- }
285
- // TODO identify google.protobufAny from config
286
- for (let item of input.items) {
287
- let keys = Object.keys(item);
288
- for (let key of keys) {
289
- if (item[key] && item[key].value) {
290
- item[key] = { typeUrl: '', value: Buffer.from(JSON.stringify(item.data.value)) };
291
- }
292
- }
293
- }
294
- const result = await service[method]({
295
- items: input === null || input === void 0 ? void 0 : input.items,
296
- subject
297
- });
298
- // TODO read from grpcClientConfig
299
- // const bufferFields = getKeys((grpcClientConfig as any)?.bufferFields);
300
- const bufferFields = [];
301
- if (result instanceof stream.Readable) {
302
- let operationStatus = { code: 0, message: '' };
303
- let aggregatedResponse = await new Promise((resolve, reject) => {
304
- let response = {};
305
- result.on('data', (chunk) => {
306
- const chunkObj = _.cloneDeep(chunk);
307
- if (!response) {
308
- response = chunk;
309
- }
310
- else {
311
- Object.assign(response, chunk);
312
- }
313
- const existingBufferFields = _.intersection(Object.keys(chunk), bufferFields);
314
- for (let bufferField of existingBufferFields) {
315
- if (chunkObj[bufferField] && chunkObj[bufferField].value) {
316
- if (response[bufferField] && response[bufferField].value && !_.isArray(response[bufferField].value)) {
317
- response[bufferField].value = [];
318
- }
319
- let data = JSON.parse(chunkObj[bufferField].value.toString());
320
- if (_.isArray(data)) {
321
- for (let dataObj of data) {
322
- response[bufferField].value.push(dataObj);
323
- }
324
- }
325
- else {
326
- response[bufferField].value.push(data);
327
- }
328
- }
329
- }
330
- });
331
- result.on('error', (err) => {
332
- console.error(err);
333
- operationStatus.code = err.code ? err.code : 500;
334
- operationStatus.message = err.message;
335
- });
336
- result.on('end', () => {
337
- if (_.isEmpty(operationStatus.message)) {
338
- operationStatus.code = 200;
339
- operationStatus.message = 'success';
340
- }
341
- resolve(response);
342
- });
343
- });
344
- return { details: { items: aggregatedResponse, operationStatus } };
345
- }
346
- // TODO identify google.protobufAny from config
347
- // let items = decodeBufferFields(result.items, bufferFields);
348
- for (let item of result.items) {
349
- if (item && item.payload) {
350
- const keys = Object.keys(item.payload);
351
- for (let bufferField of keys) {
352
- if (item.payload[bufferField] && item.payload[bufferField].value) {
353
- item.payload[bufferField].value = JSON.parse(item.payload[bufferField].value.toString());
354
- }
355
- }
356
- }
357
- }
358
- return {
359
- details: {
360
- items: result.items,
361
- operationStatus: result.operationStatus // overall status
362
- }
363
- };
364
- }
365
- catch (error) {
366
- console.error(error);
367
- return {
368
- details: {
369
- items: [],
370
- operationStatus: {
371
- code: error.code,
372
- message: error.message
373
- }
374
- }
375
- };
376
- }
377
- };
378
251
  const registerResolverFunction = (namespace, name, func, mutation = false, subspace = undefined, service) => {
379
252
  if (!namespaceResolverRegistry.has(namespace)) {
380
253
  namespaceResolverRegistry.set(namespace, new Map());
@@ -404,11 +277,6 @@ const registerResolverFunction = (namespace, name, func, mutation = false, subsp
404
277
  inputMethodType.set(key, value.inputType);
405
278
  }
406
279
  }
407
- // custom mutation resolver for create, update and upsert - Mutate
408
- if (Mutate.indexOf(name) > -1) {
409
- name = 'Mutate';
410
- func = MutateResolver;
411
- }
412
280
  space.set(name, func);
413
281
  };
414
282
  exports.registerResolverFunction = registerResolverFunction;
@@ -601,6 +469,9 @@ const getWhitelistBlacklistConfig = (metaService, queries, config) => {
601
469
  }
602
470
  }
603
471
  }
472
+ if (Mutate.findIndex(val => mut.has(val)) > -1) {
473
+ mut.add('Mutate');
474
+ }
604
475
  return {
605
476
  mutations: mut,
606
477
  queries: que
@@ -7,7 +7,6 @@ const graphql_upload_1 = require("graphql-upload");
7
7
  const utils_1 = require("./utils");
8
8
  const types_1 = require("./types");
9
9
  const ts_proto_descriptors_1 = require("ts-proto-descriptors");
10
- const _ = require("lodash");
11
10
  exports.registeredTypings = new Map();
12
11
  exports.scalarTypes = ['Boolean', 'Int', 'Float', 'String', 'ID', 'Upload'];
13
12
  const typeNameAndNameSpaceMapping = new Map();
@@ -16,6 +15,7 @@ const MapScalar = new definition_1.GraphQLScalarType({
16
15
  name: 'MapScalar',
17
16
  });
18
17
  const Mutate = ['Create', 'Update', 'Upsert'];
18
+ const CRUD_OPERATION_NAMES = ['Cretae', 'Update', 'Upsert', 'Delete', 'Read'];
19
19
  const TodoScalar = new definition_1.GraphQLScalarType({
20
20
  name: 'TodoScalar',
21
21
  serialize: () => {
@@ -81,12 +81,6 @@ const recursiveEnumCheck = (typeName, enumMap, prevFieldName, traversedFields) =
81
81
  // skip loop as this GQL type is already traversed
82
82
  continue;
83
83
  }
84
- if (!prevFieldName || _.isEmpty(prevFieldName)) {
85
- prevFieldName = fieldName;
86
- }
87
- if (prevFieldName && prevFieldName != fieldName) {
88
- fieldName = prevFieldName + '.' + fieldName;
89
- }
90
84
  (0, exports.recursiveEnumCheck)(fieldType, enumMap, fieldName, traversedFields);
91
85
  }
92
86
  }
@@ -126,6 +120,7 @@ const ModeType = new definition_1.GraphQLEnumType({
126
120
  });
127
121
  const registerTyping = (protoPackage, message, methodDef, opts, inputOpts) => {
128
122
  let insertMode = false;
123
+ let crudOperation = false;
129
124
  const type = (protoPackage.startsWith('.') ? '' : '.') + protoPackage + '.' + message.name;
130
125
  if (methodDef && methodDef.length > 0) {
131
126
  for (let method of methodDef) {
@@ -134,6 +129,10 @@ const registerTyping = (protoPackage, message, methodDef, opts, inputOpts) => {
134
129
  if ((Mutate.indexOf(method.name) > -1) && type === method.inputType) {
135
130
  insertMode = true;
136
131
  }
132
+ // add scope
133
+ if ((CRUD_OPERATION_NAMES.indexOf(method.name) > -1) && type === method.inputType) {
134
+ crudOperation = true;
135
+ }
137
136
  }
138
137
  }
139
138
  if (exports.registeredTypings.has(type)) {
@@ -173,6 +172,15 @@ const registerTyping = (protoPackage, message, methodDef, opts, inputOpts) => {
173
172
  type: ModeType
174
173
  };
175
174
  }
175
+ if (crudOperation) {
176
+ // add scope to all mutations / queries
177
+ if (!result.scope) {
178
+ result['scope'] = {
179
+ description: 'target scope',
180
+ type: graphql_1.GraphQLString
181
+ };
182
+ }
183
+ }
176
184
  return result;
177
185
  };
178
186
  const resultObj = new graphql_1.GraphQLObjectType({
@@ -3,23 +3,9 @@ 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[];
5
5
  export declare const decodeBufferFields: (items: any, bufferFields: string[]) => any;
6
- interface EnumMetaData {
7
- name: string;
8
- number: number;
9
- options?: any;
10
- }
11
- /**
12
- * recursively find the path and updates the object with given value, this function
13
- * also takes care to handle if there is an array at any position in the path
14
- * @param path path in dot notation
15
- * @param val value to be updated in Object
16
- * @param obj Object
17
- */
18
- export declare const updateJSON: (path: string, val: EnumMetaData[], obj: any) => void;
19
6
  /**
20
7
  * converts enum string values to integers reading from the inputTyping
21
8
  * @param TypingData input typing
22
9
  * @param req request object from which the enum strings to be replaced
23
10
  */
24
11
  export declare const convertEnumToInt: (inputTyping: TypingData, req: any) => any;
25
- export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertEnumToInt = exports.updateJSON = exports.decodeBufferFields = exports.getKeys = exports.convertyCamelToSnakeCase = exports.capitalizeProtoName = void 0;
3
+ exports.convertEnumToInt = exports.decodeBufferFields = exports.getKeys = exports.convertyCamelToSnakeCase = exports.capitalizeProtoName = void 0;
4
4
  const _ = require("lodash");
5
5
  const registry_1 = require("./registry");
6
6
  const capitalizeProtoName = (name) => {
@@ -50,50 +50,25 @@ const decodeBufferFields = (items, bufferFields) => {
50
50
  };
51
51
  exports.decodeBufferFields = decodeBufferFields;
52
52
  /**
53
- * recursively find the path and updates the object with given value, this function
53
+ * recursively find the id and updates the object with given value, this function
54
54
  * also takes care to handle if there is an array at any position in the path
55
- * @param path path in dot notation
55
+ * @param id property of the object
56
56
  * @param val value to be updated in Object
57
57
  * @param obj Object
58
58
  */
59
- const updateJSON = (path, val, obj) => {
60
- let fields = path.split('.');
61
- let result = obj;
62
- let j = 0;
63
- for (let i = 0, n = fields.length; i < n && result !== undefined; i++) {
64
- let field = fields[i];
65
- if (i === n - 1) {
66
- // reset value finally after iterating to the position (only if value already exists)
67
- if (result[field]) {
68
- const foundElement = val.find((e) => e.name === result[field]);
69
- result[field] = foundElement === null || foundElement === void 0 ? void 0 : foundElement.number;
59
+ const updateJSON = (id, value, obj) => {
60
+ for (const [k, v] of Object.entries(obj)) {
61
+ if (k === id) {
62
+ const foundObj = value.find((e) => e.name === obj[k]);
63
+ if (foundObj) {
64
+ obj[k] = foundObj.number;
70
65
  }
71
66
  }
72
- else {
73
- if (_.isArray(result[field])) {
74
- // till i < n concat new fields
75
- let newField = '';
76
- for (let k = i + 1; k < n; k++) {
77
- if (newField && !_.isEmpty(newField)) {
78
- newField = newField + '.' + fields[k];
79
- }
80
- else {
81
- newField = fields[k];
82
- }
83
- }
84
- for (; j < result[field].length; j++) {
85
- // recurisve call to update each element if its an array
86
- (0, exports.updateJSON)(newField, val, result[field][j]);
87
- }
88
- }
89
- else {
90
- // update object till final path is reached
91
- result = result[field];
92
- }
67
+ else if (typeof v === "object") {
68
+ updateJSON(id, value, v);
93
69
  }
94
70
  }
95
71
  };
96
- exports.updateJSON = updateJSON;
97
72
  /**
98
73
  * converts enum string values to integers reading from the inputTyping
99
74
  * @param TypingData input typing
@@ -128,7 +103,8 @@ const convertEnumToInt = (inputTyping, req) => {
128
103
  const enumTyping = (0, registry_1.getTyping)(enumNameSpace);
129
104
  const enumIntMapping = (enumTyping === null || enumTyping === void 0 ? void 0 : enumTyping.meta).value;
130
105
  if (enumIntMapping && _.isArray(enumIntMapping) && enumIntMapping.length > 0) {
131
- (0, exports.updateJSON)(val, enumIntMapping, req);
106
+ // val refers to property name
107
+ updateJSON(val, enumIntMapping, req);
132
108
  }
133
109
  }
134
110
  }
@@ -247,6 +247,8 @@ export declare type IIoRestorecommerceResourcebaseReadRequest = {
247
247
  localesLimiter?: InputMaybe<Array<Scalars['String']>>;
248
248
  customQueries?: InputMaybe<Array<Scalars['String']>>;
249
249
  customArguments?: InputMaybe<IGoogleProtobufAny>;
250
+ /** target scope */
251
+ scope?: InputMaybe<Scalars['String']>;
250
252
  };
251
253
  export declare type IIoRestorecommerceResourcebaseSort = {
252
254
  field?: InputMaybe<Scalars['String']>;
@@ -396,6 +398,8 @@ export declare type IIoRestorecommercePolicyPolicyList = {
396
398
  items?: InputMaybe<Array<IIoRestorecommercePolicyPolicy>>;
397
399
  totalCount?: InputMaybe<Scalars['Int']>;
398
400
  mode?: InputMaybe<ModeType>;
401
+ /** target scope */
402
+ scope?: InputMaybe<Scalars['String']>;
399
403
  };
400
404
  export declare type IIoRestorecommercePolicyPolicy = {
401
405
  id?: InputMaybe<Scalars['String']>;
@@ -435,6 +439,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
435
439
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
436
440
  collection?: InputMaybe<Scalars['Boolean']>;
437
441
  ids?: InputMaybe<Array<Scalars['String']>>;
442
+ /** target scope */
443
+ scope?: InputMaybe<Scalars['String']>;
438
444
  };
439
445
  export declare type AccessControlRuleMutation = {
440
446
  __typename?: 'AccessControlRuleMutation';
@@ -451,6 +457,8 @@ export declare type IIoRestorecommerceRuleRuleList = {
451
457
  items?: InputMaybe<Array<IIoRestorecommerceRuleRule>>;
452
458
  totalCount?: InputMaybe<Scalars['Int']>;
453
459
  mode?: InputMaybe<ModeType>;
460
+ /** target scope */
461
+ scope?: InputMaybe<Scalars['String']>;
454
462
  };
455
463
  export declare type IIoRestorecommerceRuleRule = {
456
464
  id?: InputMaybe<Scalars['String']>;
@@ -482,6 +490,8 @@ export declare type IIoRestorecommercePolicySetPolicySetList = {
482
490
  items?: InputMaybe<Array<IIoRestorecommercePolicySetPolicySet>>;
483
491
  totalCount?: InputMaybe<Scalars['Int']>;
484
492
  mode?: InputMaybe<ModeType>;
493
+ /** target scope */
494
+ scope?: InputMaybe<Scalars['String']>;
485
495
  };
486
496
  export declare type IIoRestorecommercePolicySetPolicySet = {
487
497
  id?: InputMaybe<Scalars['String']>;
@@ -162,6 +162,8 @@ export declare type IIoRestorecommerceResourcebaseReadRequest = {
162
162
  localesLimiter?: InputMaybe<Array<Scalars['String']>>;
163
163
  customQueries?: InputMaybe<Array<Scalars['String']>>;
164
164
  customArguments?: InputMaybe<IGoogleProtobufAny>;
165
+ /** target scope */
166
+ scope?: InputMaybe<Scalars['String']>;
165
167
  };
166
168
  export declare type IIoRestorecommerceResourcebaseSort = {
167
169
  field?: InputMaybe<Scalars['String']>;
@@ -398,6 +400,8 @@ export declare type IIoRestorecommerceProductProductList = {
398
400
  items?: InputMaybe<Array<IIoRestorecommerceProductMainProduct>>;
399
401
  totalCount?: InputMaybe<Scalars['Int']>;
400
402
  mode?: InputMaybe<ModeType>;
403
+ /** target scope */
404
+ scope?: InputMaybe<Scalars['String']>;
401
405
  };
402
406
  export declare type IIoRestorecommerceProductMainProduct = {
403
407
  id?: InputMaybe<Scalars['String']>;
@@ -488,6 +492,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
488
492
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
489
493
  collection?: InputMaybe<Scalars['Boolean']>;
490
494
  ids?: InputMaybe<Array<Scalars['String']>>;
495
+ /** target scope */
496
+ scope?: InputMaybe<Scalars['String']>;
491
497
  };
492
498
  export declare type CatalogProductPrototypeMutation = {
493
499
  __typename?: 'CatalogProductPrototypeMutation';
@@ -504,6 +510,8 @@ export declare type IIoRestorecommerceProductPrototypeProductPrototypeList = {
504
510
  items?: InputMaybe<Array<IIoRestorecommerceProductPrototypeProductPrototype>>;
505
511
  totalCount?: InputMaybe<Scalars['Int']>;
506
512
  mode?: InputMaybe<ModeType>;
513
+ /** target scope */
514
+ scope?: InputMaybe<Scalars['String']>;
507
515
  };
508
516
  export declare type IIoRestorecommerceProductPrototypeProductPrototype = {
509
517
  id?: InputMaybe<Scalars['String']>;
@@ -528,6 +536,8 @@ export declare type IIoRestorecommerceProductCategoryProductCategoryList = {
528
536
  items?: InputMaybe<Array<IIoRestorecommerceProductCategoryProductCategory>>;
529
537
  totalCount?: InputMaybe<Scalars['Int']>;
530
538
  mode?: InputMaybe<ModeType>;
539
+ /** target scope */
540
+ scope?: InputMaybe<Scalars['String']>;
531
541
  };
532
542
  export declare type IIoRestorecommerceProductCategoryProductCategory = {
533
543
  id?: InputMaybe<Scalars['String']>;
@@ -556,6 +566,8 @@ export declare type IIoRestorecommercePriceGroupPriceGroupList = {
556
566
  items?: InputMaybe<Array<IIoRestorecommercePriceGroupPriceGroup>>;
557
567
  totalCount?: InputMaybe<Scalars['Int']>;
558
568
  mode?: InputMaybe<ModeType>;
569
+ /** target scope */
570
+ scope?: InputMaybe<Scalars['String']>;
559
571
  };
560
572
  export declare type IIoRestorecommercePriceGroupPriceGroup = {
561
573
  id?: InputMaybe<Scalars['String']>;
@@ -578,6 +590,8 @@ export declare type IIoRestorecommerceManufacturerManufacturerList = {
578
590
  items?: InputMaybe<Array<IIoRestorecommerceManufacturerManufacturer>>;
579
591
  totalCount?: InputMaybe<Scalars['Int']>;
580
592
  mode?: InputMaybe<ModeType>;
593
+ /** target scope */
594
+ scope?: InputMaybe<Scalars['String']>;
581
595
  };
582
596
  export declare type IIoRestorecommerceManufacturerManufacturer = {
583
597
  id?: InputMaybe<Scalars['String']>;
@@ -111,6 +111,8 @@ export declare type IIoRestorecommerceResourcebaseReadRequest = {
111
111
  localesLimiter?: InputMaybe<Array<Scalars['String']>>;
112
112
  customQueries?: InputMaybe<Array<Scalars['String']>>;
113
113
  customArguments?: InputMaybe<IGoogleProtobufAny>;
114
+ /** target scope */
115
+ scope?: InputMaybe<Scalars['String']>;
114
116
  };
115
117
  export declare type IIoRestorecommerceResourcebaseSort = {
116
118
  field?: InputMaybe<Scalars['String']>;
@@ -507,6 +509,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
507
509
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
508
510
  collection?: InputMaybe<Scalars['Boolean']>;
509
511
  ids?: InputMaybe<Array<Scalars['String']>>;
512
+ /** target scope */
513
+ scope?: InputMaybe<Scalars['String']>;
510
514
  };
511
515
  export declare type FulfillmentFulfillmentCourierMutation = {
512
516
  __typename?: 'FulfillmentFulfillmentCourierMutation';
@@ -523,6 +527,8 @@ export declare type IIoRestorecommerceFulfillmentCourierFulfillmentCourierList =
523
527
  items?: InputMaybe<Array<IIoRestorecommerceFulfillmentCourierFulfillmentCourier>>;
524
528
  totalCount?: InputMaybe<Scalars['Int']>;
525
529
  mode?: InputMaybe<ModeType>;
530
+ /** target scope */
531
+ scope?: InputMaybe<Scalars['String']>;
526
532
  };
527
533
  export declare type IIoRestorecommerceFulfillmentCourierFulfillmentCourier = {
528
534
  id?: InputMaybe<Scalars['String']>;
@@ -180,6 +180,8 @@ export declare type IIoRestorecommerceResourcebaseReadRequest = {
180
180
  localesLimiter?: InputMaybe<Array<Scalars['String']>>;
181
181
  customQueries?: InputMaybe<Array<Scalars['String']>>;
182
182
  customArguments?: InputMaybe<IGoogleProtobufAny>;
183
+ /** target scope */
184
+ scope?: InputMaybe<Scalars['String']>;
183
185
  };
184
186
  export declare type IIoRestorecommerceResourcebaseSort = {
185
187
  field?: InputMaybe<Scalars['String']>;
@@ -465,6 +467,8 @@ export declare type IIoRestorecommerceUserUserList = {
465
467
  items?: InputMaybe<Array<IIoRestorecommerceUserUser>>;
466
468
  totalCount?: InputMaybe<Scalars['Int']>;
467
469
  mode?: InputMaybe<ModeType>;
470
+ /** target scope */
471
+ scope?: InputMaybe<Scalars['String']>;
468
472
  };
469
473
  export declare type IIoRestorecommerceUserUser = {
470
474
  id?: InputMaybe<Scalars['String']>;
@@ -546,6 +550,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
546
550
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
547
551
  collection?: InputMaybe<Scalars['Boolean']>;
548
552
  ids?: InputMaybe<Array<Scalars['String']>>;
553
+ /** target scope */
554
+ scope?: InputMaybe<Scalars['String']>;
549
555
  };
550
556
  export declare type IIoRestorecommerceUserRegisterRequest = {
551
557
  id?: InputMaybe<Scalars['String']>;
@@ -642,6 +648,8 @@ export declare type IIoRestorecommerceRoleRoleList = {
642
648
  items?: InputMaybe<Array<IIoRestorecommerceRoleRole>>;
643
649
  totalCount?: InputMaybe<Scalars['Int']>;
644
650
  mode?: InputMaybe<ModeType>;
651
+ /** target scope */
652
+ scope?: InputMaybe<Scalars['String']>;
645
653
  };
646
654
  export declare type IIoRestorecommerceRoleRole = {
647
655
  id?: InputMaybe<Scalars['String']>;
@@ -665,6 +673,8 @@ export declare type IIoRestorecommerceAuthenticationLogAuthenticationLogList = {
665
673
  items?: InputMaybe<Array<IIoRestorecommerceAuthenticationLogAuthenticationLog>>;
666
674
  totalCount?: InputMaybe<Scalars['Int']>;
667
675
  mode?: InputMaybe<ModeType>;
676
+ /** target scope */
677
+ scope?: InputMaybe<Scalars['String']>;
668
678
  };
669
679
  export declare type IIoRestorecommerceAuthenticationLogAuthenticationLog = {
670
680
  id?: InputMaybe<Scalars['String']>;
@@ -108,6 +108,8 @@ export declare type IIoRestorecommerceResourcebaseReadRequest = {
108
108
  localesLimiter?: InputMaybe<Array<Scalars['String']>>;
109
109
  customQueries?: InputMaybe<Array<Scalars['String']>>;
110
110
  customArguments?: InputMaybe<IGoogleProtobufAny>;
111
+ /** target scope */
112
+ scope?: InputMaybe<Scalars['String']>;
111
113
  };
112
114
  export declare type IIoRestorecommerceResourcebaseSort = {
113
115
  field?: InputMaybe<Scalars['String']>;
@@ -215,6 +217,8 @@ export declare type IIoRestorecommerceInvoiceInvoiceList = {
215
217
  items?: InputMaybe<Array<IIoRestorecommerceInvoiceInvoice>>;
216
218
  totalCount?: InputMaybe<Scalars['Int']>;
217
219
  mode?: InputMaybe<ModeType>;
220
+ /** target scope */
221
+ scope?: InputMaybe<Scalars['String']>;
218
222
  };
219
223
  export declare type IIoRestorecommerceInvoiceInvoice = {
220
224
  id?: InputMaybe<Scalars['String']>;
@@ -261,6 +265,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
261
265
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
262
266
  collection?: InputMaybe<Scalars['Boolean']>;
263
267
  ids?: InputMaybe<Array<Scalars['String']>>;
268
+ /** target scope */
269
+ scope?: InputMaybe<Scalars['String']>;
264
270
  };
265
271
  export declare type WithIndex<TObject> = TObject & Record<string, any>;
266
272
  export declare type ResolversObject<TObject> = WithIndex<TObject>;
@@ -114,6 +114,8 @@ export declare type IIoRestorecommerceResourcebaseReadRequest = {
114
114
  localesLimiter?: InputMaybe<Array<Scalars['String']>>;
115
115
  customQueries?: InputMaybe<Array<Scalars['String']>>;
116
116
  customArguments?: InputMaybe<IGoogleProtobufAny>;
117
+ /** target scope */
118
+ scope?: InputMaybe<Scalars['String']>;
117
119
  };
118
120
  export declare type IIoRestorecommerceResourcebaseSort = {
119
121
  field?: InputMaybe<Scalars['String']>;
@@ -202,6 +204,8 @@ export declare type IIoRestorecommerceNotificationNotificationList = {
202
204
  items?: InputMaybe<Array<IIoRestorecommerceNotificationNotification>>;
203
205
  totalCount?: InputMaybe<Scalars['Int']>;
204
206
  mode?: InputMaybe<ModeType>;
207
+ /** target scope */
208
+ scope?: InputMaybe<Scalars['String']>;
205
209
  };
206
210
  export declare type IIoRestorecommerceNotificationNotification = {
207
211
  id?: InputMaybe<Scalars['String']>;
@@ -246,6 +250,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
246
250
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
247
251
  collection?: InputMaybe<Scalars['Boolean']>;
248
252
  ids?: InputMaybe<Array<Scalars['String']>>;
253
+ /** target scope */
254
+ scope?: InputMaybe<Scalars['String']>;
249
255
  };
250
256
  export declare type WithIndex<TObject> = TObject & Record<string, any>;
251
257
  export declare type ResolversObject<TObject> = WithIndex<TObject>;
@@ -133,6 +133,8 @@ export declare type IIoRestorecommerceResourcebaseReadRequest = {
133
133
  localesLimiter?: InputMaybe<Array<Scalars['String']>>;
134
134
  customQueries?: InputMaybe<Array<Scalars['String']>>;
135
135
  customArguments?: InputMaybe<IGoogleProtobufAny>;
136
+ /** target scope */
137
+ scope?: InputMaybe<Scalars['String']>;
136
138
  };
137
139
  export declare type IIoRestorecommerceResourcebaseSort = {
138
140
  field?: InputMaybe<Scalars['String']>;
@@ -244,6 +246,8 @@ export declare type IIoRestorecommerceOrderOrderList = {
244
246
  items?: InputMaybe<Array<IIoRestorecommerceOrderOrder>>;
245
247
  totalCount?: InputMaybe<Scalars['Int']>;
246
248
  mode?: InputMaybe<ModeType>;
249
+ /** target scope */
250
+ scope?: InputMaybe<Scalars['String']>;
247
251
  };
248
252
  export declare type IIoRestorecommerceOrderOrder = {
249
253
  id?: InputMaybe<Scalars['String']>;
@@ -313,6 +317,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
313
317
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
314
318
  collection?: InputMaybe<Scalars['Boolean']>;
315
319
  ids?: InputMaybe<Array<Scalars['String']>>;
320
+ /** target scope */
321
+ scope?: InputMaybe<Scalars['String']>;
316
322
  };
317
323
  export declare type ProtoIoRestorecommerceOrderFulfillmentResults = {
318
324
  __typename?: 'ProtoIoRestorecommerceOrderFulfillmentResults';
@@ -278,6 +278,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
278
278
  export declare type IIoRestorecommerceOstorageDeleteRequest = {
279
279
  key?: InputMaybe<Scalars['String']>;
280
280
  bucket?: InputMaybe<Scalars['String']>;
281
+ /** target scope */
282
+ scope?: InputMaybe<Scalars['String']>;
281
283
  };
282
284
  export declare type ProtoIoRestorecommerceOstorageCopyResponseList = {
283
285
  __typename?: 'ProtoIoRestorecommerceOstorageCopyResponseList';
@@ -130,6 +130,8 @@ export declare type IIoRestorecommerceResourcebaseReadRequest = {
130
130
  localesLimiter?: InputMaybe<Array<Scalars['String']>>;
131
131
  customQueries?: InputMaybe<Array<Scalars['String']>>;
132
132
  customArguments?: InputMaybe<IGoogleProtobufAny>;
133
+ /** target scope */
134
+ scope?: InputMaybe<Scalars['String']>;
133
135
  };
134
136
  export declare type IIoRestorecommerceResourcebaseSort = {
135
137
  field?: InputMaybe<Scalars['String']>;
@@ -628,6 +630,8 @@ export declare type IIoRestorecommerceAddressAddressList = {
628
630
  items?: InputMaybe<Array<IIoRestorecommerceAddressAddress>>;
629
631
  totalCount?: InputMaybe<Scalars['Int']>;
630
632
  mode?: InputMaybe<ModeType>;
633
+ /** target scope */
634
+ scope?: InputMaybe<Scalars['String']>;
631
635
  };
632
636
  export declare type IIoRestorecommerceAddressAddress = {
633
637
  id?: InputMaybe<Scalars['String']>;
@@ -682,6 +686,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
682
686
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
683
687
  collection?: InputMaybe<Scalars['Boolean']>;
684
688
  ids?: InputMaybe<Array<Scalars['String']>>;
689
+ /** target scope */
690
+ scope?: InputMaybe<Scalars['String']>;
685
691
  };
686
692
  export declare type ResourceCountryMutation = {
687
693
  __typename?: 'ResourceCountryMutation';
@@ -698,6 +704,8 @@ export declare type IIoRestorecommerceCountryCountryList = {
698
704
  items?: InputMaybe<Array<IIoRestorecommerceCountryCountry>>;
699
705
  totalCount?: InputMaybe<Scalars['Int']>;
700
706
  mode?: InputMaybe<ModeType>;
707
+ /** target scope */
708
+ scope?: InputMaybe<Scalars['String']>;
701
709
  };
702
710
  export declare type IIoRestorecommerceCountryCountry = {
703
711
  id?: InputMaybe<Scalars['String']>;
@@ -722,6 +730,8 @@ export declare type IIoRestorecommerceTimezoneTimezoneList = {
722
730
  items?: InputMaybe<Array<IIoRestorecommerceTimezoneTimezone>>;
723
731
  totalCount?: InputMaybe<Scalars['Int']>;
724
732
  mode?: InputMaybe<ModeType>;
733
+ /** target scope */
734
+ scope?: InputMaybe<Scalars['String']>;
725
735
  };
726
736
  export declare type IIoRestorecommerceTimezoneTimezone = {
727
737
  id?: InputMaybe<Scalars['String']>;
@@ -743,6 +753,8 @@ export declare type IIoRestorecommerceContactPointTypeContactPointTypeList = {
743
753
  items?: InputMaybe<Array<IIoRestorecommerceContactPointTypeContactPointType>>;
744
754
  totalCount?: InputMaybe<Scalars['Int']>;
745
755
  mode?: InputMaybe<ModeType>;
756
+ /** target scope */
757
+ scope?: InputMaybe<Scalars['String']>;
746
758
  };
747
759
  export declare type IIoRestorecommerceContactPointTypeContactPointType = {
748
760
  id?: InputMaybe<Scalars['String']>;
@@ -764,6 +776,8 @@ export declare type IIoRestorecommerceCustomerCustomerList = {
764
776
  items?: InputMaybe<Array<IIoRestorecommerceCustomerCustomer>>;
765
777
  totalCount?: InputMaybe<Scalars['Int']>;
766
778
  mode?: InputMaybe<ModeType>;
779
+ /** target scope */
780
+ scope?: InputMaybe<Scalars['String']>;
767
781
  };
768
782
  export declare type IIoRestorecommerceCustomerCustomer = {
769
783
  id?: InputMaybe<Scalars['String']>;
@@ -801,6 +815,8 @@ export declare type IIoRestorecommerceContactPointContactPointList = {
801
815
  items?: InputMaybe<Array<IIoRestorecommerceContactPointContactPoint>>;
802
816
  totalCount?: InputMaybe<Scalars['Int']>;
803
817
  mode?: InputMaybe<ModeType>;
818
+ /** target scope */
819
+ scope?: InputMaybe<Scalars['String']>;
804
820
  };
805
821
  export declare type IIoRestorecommerceContactPointContactPoint = {
806
822
  id?: InputMaybe<Scalars['String']>;
@@ -828,6 +844,8 @@ export declare type IIoRestorecommerceLocaleLocaleList = {
828
844
  items?: InputMaybe<Array<IIoRestorecommerceLocaleLocale>>;
829
845
  totalCount?: InputMaybe<Scalars['Int']>;
830
846
  mode?: InputMaybe<ModeType>;
847
+ /** target scope */
848
+ scope?: InputMaybe<Scalars['String']>;
831
849
  };
832
850
  export declare type IIoRestorecommerceLocaleLocale = {
833
851
  id?: InputMaybe<Scalars['String']>;
@@ -850,6 +868,8 @@ export declare type IIoRestorecommerceLocationLocationList = {
850
868
  items?: InputMaybe<Array<IIoRestorecommerceLocationLocation>>;
851
869
  totalCount?: InputMaybe<Scalars['Int']>;
852
870
  mode?: InputMaybe<ModeType>;
871
+ /** target scope */
872
+ scope?: InputMaybe<Scalars['String']>;
853
873
  };
854
874
  export declare type IIoRestorecommerceLocationLocation = {
855
875
  id?: InputMaybe<Scalars['String']>;
@@ -877,6 +897,8 @@ export declare type IIoRestorecommerceOrganizationOrganizationList = {
877
897
  items?: InputMaybe<Array<IIoRestorecommerceOrganizationOrganization>>;
878
898
  totalCount?: InputMaybe<Scalars['Int']>;
879
899
  mode?: InputMaybe<ModeType>;
900
+ /** target scope */
901
+ scope?: InputMaybe<Scalars['String']>;
880
902
  };
881
903
  export declare type IIoRestorecommerceOrganizationOrganization = {
882
904
  id?: InputMaybe<Scalars['String']>;
@@ -910,6 +932,8 @@ export declare type IIoRestorecommerceTaxTaxList = {
910
932
  items?: InputMaybe<Array<IIoRestorecommerceTaxTax>>;
911
933
  totalCount?: InputMaybe<Scalars['Int']>;
912
934
  mode?: InputMaybe<ModeType>;
935
+ /** target scope */
936
+ scope?: InputMaybe<Scalars['String']>;
913
937
  };
914
938
  export declare type IIoRestorecommerceTaxTax = {
915
939
  id?: InputMaybe<Scalars['String']>;
@@ -934,6 +958,8 @@ export declare type IIoRestorecommerceTaxTypeTaxTypeList = {
934
958
  items?: InputMaybe<Array<IIoRestorecommerceTaxTypeTaxType>>;
935
959
  totalCount?: InputMaybe<Scalars['Int']>;
936
960
  mode?: InputMaybe<ModeType>;
961
+ /** target scope */
962
+ scope?: InputMaybe<Scalars['String']>;
937
963
  };
938
964
  export declare type IIoRestorecommerceTaxTypeTaxType = {
939
965
  id?: InputMaybe<Scalars['String']>;
@@ -956,6 +982,8 @@ export declare type IIoRestorecommerceCommandCommandList = {
956
982
  items?: InputMaybe<Array<IIoRestorecommerceCommandCommand>>;
957
983
  totalCount?: InputMaybe<Scalars['Int']>;
958
984
  mode?: InputMaybe<ModeType>;
985
+ /** target scope */
986
+ scope?: InputMaybe<Scalars['String']>;
959
987
  };
960
988
  export declare type IIoRestorecommerceCommandCommand = {
961
989
  id?: InputMaybe<Scalars['String']>;
@@ -145,6 +145,8 @@ export declare type IIoRestorecommerceJobJobReadRequest = {
145
145
  sort?: InputMaybe<IoRestorecommerceJobJobReadRequestSortOrder>;
146
146
  filter?: InputMaybe<IIoRestorecommerceJobJobFilter>;
147
147
  field?: InputMaybe<Array<IIoRestorecommerceResourcebaseFieldFilter>>;
148
+ /** target scope */
149
+ scope?: InputMaybe<Scalars['String']>;
148
150
  };
149
151
  export declare enum IoRestorecommerceJobJobReadRequestSortOrder {
150
152
  Unsorted = 0,
@@ -182,6 +184,8 @@ export declare type IIoRestorecommerceJobJobList = {
182
184
  items?: InputMaybe<Array<IIoRestorecommerceJobJob>>;
183
185
  totalCount?: InputMaybe<Scalars['Int']>;
184
186
  mode?: InputMaybe<ModeType>;
187
+ /** target scope */
188
+ scope?: InputMaybe<Scalars['String']>;
185
189
  };
186
190
  export declare type IIoRestorecommerceJobJob = {
187
191
  id?: InputMaybe<Scalars['String']>;
@@ -253,6 +257,8 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
253
257
  export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
254
258
  collection?: InputMaybe<Scalars['Boolean']>;
255
259
  ids?: InputMaybe<Array<Scalars['String']>>;
260
+ /** target scope */
261
+ scope?: InputMaybe<Scalars['String']>;
256
262
  };
257
263
  export declare type WithIndex<TObject> = TObject & Record<string, any>;
258
264
  export declare type ResolversObject<TObject> = WithIndex<TObject>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restorecommerce/facade",
3
- "version": "0.3.3",
3
+ "version": "0.3.6",
4
4
  "description": "Facade for Restorecommerce microservices",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -108,5 +108,5 @@
108
108
  "publishConfig": {
109
109
  "access": "public"
110
110
  },
111
- "gitHead": "54e2b0719f7442d9d7a0a4c94f67f40c6348225a"
111
+ "gitHead": "1b39474c7c3a95c5617c1164e2b358161e4d9eac"
112
112
  }