@restorecommerce/facade 0.3.13 → 0.3.16
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,38 @@
|
|
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.16](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.3.15...@restorecommerce/facade@0.3.16) (2022-04-07)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* **facade:** blacklist and whitelist config for sub service name space level ([6d737d6](https://github.com/restorecommerce/libs/commit/6d737d62a5395890e506a3fb76aa31f9e127d38e))
|
12
|
+
* **facade:** mask register resolver schema for blacklisted config ([8478590](https://github.com/restorecommerce/libs/commit/8478590bd994eedd3023a8e0f7f347a33f2019f1))
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
## [0.3.15](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.3.14...@restorecommerce/facade@0.3.15) (2022-04-05)
|
19
|
+
|
20
|
+
**Note:** Version bump only for package @restorecommerce/facade
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
## [0.3.14](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.3.13...@restorecommerce/facade@0.3.14) (2022-04-01)
|
27
|
+
|
28
|
+
|
29
|
+
### Bug Fixes
|
30
|
+
|
31
|
+
* **facade:** fix to convert google.protobuf.timestamp to DateTime scalar type and convert it to JS Date object for create / update operation. ([ced5ecf](https://github.com/restorecommerce/libs/commit/ced5ecfae25eb928691a6a17eb32683ae9650a68))
|
32
|
+
* **facade:** renamed preprocess and postprocess GQL function name ([ef0f5f0](https://github.com/restorecommerce/libs/commit/ef0f5f02dcd605067b6399d4afa525248ce64417))
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
6
38
|
## [0.3.13](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.3.12...@restorecommerce/facade@0.3.13) (2022-03-29)
|
7
39
|
|
8
40
|
**Note:** Version bump only for package @restorecommerce/facade
|
@@ -2,27 +2,26 @@ import { GraphQLInputField, GraphQLOutputType, GraphQLResolveInfo, GraphQLSchema
|
|
2
2
|
import { GraphQLEnumType, GraphQLFieldConfig, GraphQLFieldConfigMap, GraphQLInputObjectType, GraphQLInputType } from "graphql/type/definition";
|
3
3
|
import { ServiceConfig, SubService, SubSpaceServiceConfig } from "./types";
|
4
4
|
import { MethodDescriptorProto, ServiceDescriptorProto } from "ts-proto-descriptors";
|
5
|
-
import { GrpcClientConfig } from "@restorecommerce/grpc-client";
|
6
5
|
export declare const getGQLSchema: <TSource, TContext>(method: MethodDescriptorProto) => GraphQLFieldConfig<TSource, TContext, any>;
|
7
6
|
export declare const getGQLSchemas: <TSource, TContext>(service: ServiceDescriptorProto) => GraphQLFieldConfigMap<TSource, TContext>;
|
8
|
-
export declare const
|
9
|
-
export declare const
|
7
|
+
export declare const preprocessGQLInput: (data: any, model: GraphQLInputObjectType | GraphQLEnumType | GraphQLInputField | GraphQLInputType) => Promise<any>;
|
8
|
+
export declare const postProcessGQLValue: (data: any, model: GraphQLOutputType) => any;
|
10
9
|
export declare type ResolverFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => Promise<TResult> | TResult;
|
11
10
|
declare type ServiceClient<Context extends Pick<Context, Key>, Key extends keyof Context, T extends Record<string, any>> = {
|
12
11
|
[V in Key]: {
|
13
12
|
client: T;
|
14
13
|
};
|
15
14
|
};
|
16
|
-
export declare const getGQLResolverFunctions: <T extends Record<string, any>, CTX extends ServiceClient<CTX, keyof CTX, T>, SRV = any, R = ResolverFn<any, any, ServiceClient<CTX, keyof CTX, T>, any>, B extends keyof T = any, NS extends keyof CTX = any>(service: ServiceDescriptorProto, key: NS, serviceKey: B,
|
15
|
+
export declare const getGQLResolverFunctions: <T extends Record<string, any>, CTX extends ServiceClient<CTX, keyof CTX, T>, SRV = any, R = ResolverFn<any, any, ServiceClient<CTX, keyof CTX, T>, any>, B extends keyof T = any, NS extends keyof CTX = any>(service: ServiceDescriptorProto, key: NS, serviceKey: B, cfg: ServiceConfig) => { [key in keyof SRV]: R; };
|
17
16
|
export declare const registerResolverFunction: <T extends Record<string, any>, CTX extends ServiceClient<CTX, keyof CTX, T>>(namespace: string, name: string, func: ResolverFn<any, any, ServiceClient<CTX, keyof CTX, T>, any>, mutation?: boolean, subspace?: string | undefined, service?: ServiceDescriptorProto | undefined) => void;
|
18
17
|
export declare const generateResolver: (...namespaces: string[]) => any;
|
19
18
|
declare type SchemaBaseOrSub = ThunkObjMap<GraphQLFieldConfig<any, any>> | Map<string, ThunkObjMap<GraphQLFieldConfig<any, any>>>;
|
20
|
-
export declare const registerResolverSchema: (namespace: string, name: string, schema: SchemaBaseOrSub, mutation
|
19
|
+
export declare const registerResolverSchema: (namespace: string, name: string, schema: SchemaBaseOrSub, mutation: boolean | undefined, subspace: string | undefined, config: ServiceConfig) => void;
|
21
20
|
export declare const generateSchema: (setup: {
|
22
21
|
prefix: string;
|
23
22
|
namespace: string;
|
24
23
|
}[]) => GraphQLSchema;
|
25
|
-
export declare const getWhitelistBlacklistConfig: (metaService: ServiceDescriptorProto, queries: string[], config: ServiceConfig) => {
|
24
|
+
export declare const getWhitelistBlacklistConfig: (metaService: ServiceDescriptorProto, queries: string[], config: ServiceConfig, entity: string) => {
|
26
25
|
queries: Set<string>;
|
27
26
|
mutations: Set<string>;
|
28
27
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.generateSubServiceResolvers = exports.generateSubServiceSchemas = exports.getAndGenerateResolvers = exports.getAndGenerateSchema = exports.getWhitelistBlacklistConfig = exports.generateSchema = exports.registerResolverSchema = exports.generateResolver = exports.registerResolverFunction = exports.getGQLResolverFunctions = exports.
|
3
|
+
exports.generateSubServiceResolvers = exports.generateSubServiceSchemas = exports.getAndGenerateResolvers = exports.getAndGenerateSchema = exports.getWhitelistBlacklistConfig = exports.generateSchema = exports.registerResolverSchema = exports.generateResolver = exports.registerResolverFunction = exports.getGQLResolverFunctions = exports.postProcessGQLValue = exports.preprocessGQLInput = exports.getGQLSchemas = exports.getGQLSchema = void 0;
|
4
4
|
const graphql_1 = require("graphql");
|
5
5
|
const definition_1 = require("graphql/type/definition");
|
6
6
|
const types_1 = require("./types");
|
@@ -57,7 +57,7 @@ const getGQLSchemas = (service) => {
|
|
57
57
|
}, {});
|
58
58
|
};
|
59
59
|
exports.getGQLSchemas = getGQLSchemas;
|
60
|
-
const
|
60
|
+
const preprocessGQLInput = async (data, model) => {
|
61
61
|
if (model instanceof definition_1.GraphQLEnumType) {
|
62
62
|
return data;
|
63
63
|
}
|
@@ -80,17 +80,22 @@ const recursiveUploadToBuffer = async (data, model) => {
|
|
80
80
|
const fields = model.getFields();
|
81
81
|
for (let key of Object.keys(fields)) {
|
82
82
|
if (data && key in data) {
|
83
|
-
data[key] = await (0, exports.
|
83
|
+
data[key] = await (0, exports.preprocessGQLInput)(data[key], fields[key].type);
|
84
84
|
}
|
85
85
|
}
|
86
86
|
}
|
87
87
|
}
|
88
|
+
if (model instanceof definition_1.GraphQLScalarType) {
|
89
|
+
if (model.name === 'IDateTime') {
|
90
|
+
return new Date(data);
|
91
|
+
}
|
92
|
+
}
|
88
93
|
if (model instanceof graphql_1.GraphQLNonNull) {
|
89
|
-
return await (0, exports.
|
94
|
+
return await (0, exports.preprocessGQLInput)(data, model.ofType);
|
90
95
|
}
|
91
96
|
if (model instanceof graphql_1.GraphQLList) {
|
92
97
|
for (let i = 0; i < data.length; i++) {
|
93
|
-
data[i] = await (0, exports.
|
98
|
+
data[i] = await (0, exports.preprocessGQLInput)(data[i], model.ofType);
|
94
99
|
}
|
95
100
|
}
|
96
101
|
if (model instanceof definition_1.GraphQLScalarType) {
|
@@ -111,8 +116,8 @@ const recursiveUploadToBuffer = async (data, model) => {
|
|
111
116
|
}
|
112
117
|
return data;
|
113
118
|
};
|
114
|
-
exports.
|
115
|
-
const
|
119
|
+
exports.preprocessGQLInput = preprocessGQLInput;
|
120
|
+
const postProcessGQLValue = (data, model) => {
|
116
121
|
if (model instanceof definition_1.GraphQLEnumType) {
|
117
122
|
return data;
|
118
123
|
}
|
@@ -129,27 +134,34 @@ const recursiveBufferToValue = (data, model) => {
|
|
129
134
|
const fields = model.getFields();
|
130
135
|
for (let key of Object.keys(fields)) {
|
131
136
|
if (data && key in data) {
|
132
|
-
data[key] = (0, exports.
|
137
|
+
data[key] = (0, exports.postProcessGQLValue)(data[key], fields[key].type);
|
133
138
|
}
|
134
139
|
}
|
135
140
|
}
|
136
141
|
}
|
137
142
|
if (model instanceof graphql_1.GraphQLNonNull) {
|
138
|
-
return (0, exports.
|
143
|
+
return (0, exports.postProcessGQLValue)(data, model.ofType);
|
139
144
|
}
|
140
145
|
if (model instanceof graphql_1.GraphQLList) {
|
141
146
|
for (let i = 0; i < data.length; i++) {
|
142
|
-
data[i] = (0, exports.
|
147
|
+
data[i] = (0, exports.postProcessGQLValue)(data[i], model.ofType);
|
143
148
|
}
|
144
149
|
}
|
145
150
|
return data;
|
146
151
|
};
|
147
|
-
exports.
|
148
|
-
const getGQLResolverFunctions = (service, key, serviceKey,
|
152
|
+
exports.postProcessGQLValue = postProcessGQLValue;
|
153
|
+
const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
149
154
|
if (!service.method) {
|
150
155
|
return {};
|
151
156
|
}
|
152
157
|
return service.method.reduce((obj, method) => {
|
158
|
+
var _a, _b, _c, _d;
|
159
|
+
if ((_b = (_a = cfg[serviceKey]) === null || _a === void 0 ? void 0 : _a.methods) === null || _b === void 0 ? void 0 : _b.blacklist) {
|
160
|
+
const blacklistMethods = (_d = (_c = cfg[serviceKey]) === null || _c === void 0 ? void 0 : _c.methods) === null || _d === void 0 ? void 0 : _d.blacklist;
|
161
|
+
if (blacklistMethods.includes(method.name)) {
|
162
|
+
return {};
|
163
|
+
}
|
164
|
+
}
|
153
165
|
const typing = (0, registry_1.getTyping)(method.inputType);
|
154
166
|
const outputTyping = (0, registry_1.getTyping)(method.outputType);
|
155
167
|
if (!typing) {
|
@@ -182,7 +194,7 @@ const getGQLResolverFunctions = (service, key, serviceKey, grpcClientConfig) =>
|
|
182
194
|
const client = context[key].client;
|
183
195
|
const service = client[serviceKey];
|
184
196
|
try {
|
185
|
-
const converted = await (0, exports.
|
197
|
+
const converted = await (0, exports.preprocessGQLInput)(args.input, typing.input);
|
186
198
|
const scope = (_a = args === null || args === void 0 ? void 0 : args.input) === null || _a === void 0 ? void 0 : _a.scope;
|
187
199
|
let req = typing.processor.fromPartial(converted);
|
188
200
|
// convert enum strings to integers
|
@@ -214,7 +226,8 @@ const getGQLResolverFunctions = (service, key, serviceKey, grpcClientConfig) =>
|
|
214
226
|
}
|
215
227
|
}
|
216
228
|
const rawResult = await service[realMethod](req);
|
217
|
-
const result = (0, exports.
|
229
|
+
const result = (0, exports.postProcessGQLValue)(rawResult, outputTyping.output);
|
230
|
+
const grpcClientConfig = cfg.client;
|
218
231
|
const bufferFields = (0, utils_1.getKeys)(grpcClientConfig === null || grpcClientConfig === void 0 ? void 0 : grpcClientConfig.bufferFields);
|
219
232
|
if (result instanceof stream.Readable) {
|
220
233
|
let operationStatus = { code: 0, message: '' };
|
@@ -378,10 +391,16 @@ const generateResolver = (...namespaces) => {
|
|
378
391
|
};
|
379
392
|
exports.generateResolver = generateResolver;
|
380
393
|
const namespaceResolverSchemaRegistry = new Map();
|
381
|
-
const registerResolverSchema = (namespace, name, schema, mutation = false, subspace = undefined) => {
|
394
|
+
const registerResolverSchema = (namespace, name, schema, mutation = false, subspace = undefined, config) => {
|
382
395
|
if (!namespaceResolverSchemaRegistry.has(namespace)) {
|
383
396
|
namespaceResolverSchemaRegistry.set(namespace, new Map());
|
384
397
|
}
|
398
|
+
if (subspace && config[subspace]) {
|
399
|
+
const blacklistMethods = config[subspace].methods.blacklist;
|
400
|
+
if (blacklistMethods.includes(name)) {
|
401
|
+
return;
|
402
|
+
}
|
403
|
+
}
|
385
404
|
if (!namespaceResolverSchemaRegistry.get(namespace).has(mutation)) {
|
386
405
|
namespaceResolverSchemaRegistry.get(namespace).set(mutation, new Map());
|
387
406
|
}
|
@@ -477,12 +496,13 @@ const generateSchema = (setup) => {
|
|
477
496
|
return new graphql_1.GraphQLSchema(config);
|
478
497
|
};
|
479
498
|
exports.generateSchema = generateSchema;
|
480
|
-
const getWhitelistBlacklistConfig = (metaService, queries, config) => {
|
499
|
+
const getWhitelistBlacklistConfig = (metaService, queries, config, entity) => {
|
500
|
+
var _a, _b, _c, _d;
|
481
501
|
const mut = new Set(metaService.method.map(m => m.name).filter(key => queries.indexOf(key) < 0));
|
482
502
|
const que = new Set(metaService.method.map(m => m.name).filter(key => queries.indexOf(key) >= 0));
|
483
|
-
if (config
|
484
|
-
if (config.methods.whitelist) {
|
485
|
-
const whitelist = new Set(config.methods.whitelist);
|
503
|
+
if (config[entity]) {
|
504
|
+
if ((_b = (_a = config[entity]) === null || _a === void 0 ? void 0 : _a.methods) === null || _b === void 0 ? void 0 : _b.whitelist) {
|
505
|
+
const whitelist = new Set(config[entity].methods.whitelist);
|
486
506
|
mut.forEach(key => {
|
487
507
|
if (whitelist.has(key)) {
|
488
508
|
whitelist.delete(key);
|
@@ -504,8 +524,8 @@ const getWhitelistBlacklistConfig = (metaService, queries, config) => {
|
|
504
524
|
console.error('Whitelist contains undefined methods:', whitelist);
|
505
525
|
}
|
506
526
|
}
|
507
|
-
else if (config.methods.blacklist) {
|
508
|
-
const blacklist = new Set(config.methods.blacklist);
|
527
|
+
else if ((_d = (_c = config[entity]) === null || _c === void 0 ? void 0 : _c.methods) === null || _d === void 0 ? void 0 : _d.blacklist) {
|
528
|
+
const blacklist = new Set(config[entity].methods.blacklist);
|
509
529
|
mut.forEach(key => {
|
510
530
|
if (blacklist.has(key)) {
|
511
531
|
blacklist.delete(key);
|
@@ -534,17 +554,17 @@ const getWhitelistBlacklistConfig = (metaService, queries, config) => {
|
|
534
554
|
};
|
535
555
|
exports.getWhitelistBlacklistConfig = getWhitelistBlacklistConfig;
|
536
556
|
const getAndGenerateSchema = (service, namespace, prefix, cfg, queryList) => {
|
537
|
-
const { mutations, queries } = (0, exports.getWhitelistBlacklistConfig)(service, queryList, cfg);
|
557
|
+
const { mutations, queries } = (0, exports.getWhitelistBlacklistConfig)(service, queryList, cfg, service.name);
|
538
558
|
const schemas = (0, exports.getGQLSchemas)(service);
|
539
559
|
Object.keys(schemas).forEach(key => {
|
540
|
-
(0, exports.registerResolverSchema)(namespace, key, schemas[key], !queries.has(key) && mutations.has(key));
|
560
|
+
(0, exports.registerResolverSchema)(namespace, key, schemas[key], !queries.has(key) && mutations.has(key), undefined, cfg);
|
541
561
|
});
|
542
562
|
return (0, exports.generateSchema)([{ prefix, namespace }]);
|
543
563
|
};
|
544
564
|
exports.getAndGenerateSchema = getAndGenerateSchema;
|
545
565
|
const getAndGenerateResolvers = (service, namespace, cfg, queryList, subspace = undefined, serviceKey = undefined) => {
|
546
|
-
const { mutations, queries } = (0, exports.getWhitelistBlacklistConfig)(service, queryList, cfg);
|
547
|
-
const func = (0, exports.getGQLResolverFunctions)(service, namespace, serviceKey || subspace || namespace, cfg
|
566
|
+
const { mutations, queries } = (0, exports.getWhitelistBlacklistConfig)(service, queryList, cfg, service.name);
|
567
|
+
const func = (0, exports.getGQLResolverFunctions)(service, namespace, serviceKey || subspace || namespace, cfg);
|
548
568
|
Object.keys(func).forEach(k => {
|
549
569
|
(0, exports.registerResolverFunction)(namespace, k, func[k], !queries.has(k) && mutations.has(k), subspace, service);
|
550
570
|
});
|
@@ -553,10 +573,10 @@ const getAndGenerateResolvers = (service, namespace, cfg, queryList, subspace =
|
|
553
573
|
exports.getAndGenerateResolvers = getAndGenerateResolvers;
|
554
574
|
const generateSubServiceSchemas = (subServices, config, namespace, prefix) => {
|
555
575
|
subServices.forEach((sub) => {
|
556
|
-
const { mutations, queries } = (0, exports.getWhitelistBlacklistConfig)(sub.service, sub.queries, config);
|
576
|
+
const { mutations, queries } = (0, exports.getWhitelistBlacklistConfig)(sub.service, sub.queries, config, sub.name);
|
557
577
|
const schemas = (0, exports.getGQLSchemas)(sub.service);
|
558
578
|
Object.keys(schemas).forEach(key => {
|
559
|
-
(0, exports.registerResolverSchema)(config.root ? sub.name : namespace, key, schemas[key], !queries.has(key) && mutations.has(key), config.root ? undefined : sub.name);
|
579
|
+
(0, exports.registerResolverSchema)(config.root ? sub.name : namespace, key, schemas[key], !queries.has(key) && mutations.has(key), config.root ? undefined : sub.name, config);
|
560
580
|
});
|
561
581
|
});
|
562
582
|
if (config.root) {
|
@@ -570,8 +590,8 @@ const generateSubServiceSchemas = (subServices, config, namespace, prefix) => {
|
|
570
590
|
exports.generateSubServiceSchemas = generateSubServiceSchemas;
|
571
591
|
const generateSubServiceResolvers = (subServices, config, namespace) => {
|
572
592
|
subServices.forEach((sub) => {
|
573
|
-
const { mutations, queries } = (0, exports.getWhitelistBlacklistConfig)(sub.service, sub.queries, config);
|
574
|
-
const func = (0, exports.getGQLResolverFunctions)(sub.service, namespace, sub.name || namespace, config
|
593
|
+
const { mutations, queries } = (0, exports.getWhitelistBlacklistConfig)(sub.service, sub.queries, config, sub.name);
|
594
|
+
const func = (0, exports.getGQLResolverFunctions)(sub.service, namespace, sub.name || namespace, config);
|
575
595
|
Object.keys(func).forEach(k => {
|
576
596
|
const regNamespace = config.root ? sub.name : namespace;
|
577
597
|
const regSubspace = config.root ? undefined : sub.name;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { GraphQLEnumTypeConfig, GraphQLInputObjectTypeConfig, GraphQLObjectType, GraphQLObjectTypeConfig } from "graphql";
|
2
|
-
import { GraphQLEnumType, GraphQLInputObjectType } from "graphql/type/definition";
|
2
|
+
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLScalarType } from "graphql/type/definition";
|
3
3
|
import { ProtoMetadata } from "./types";
|
4
4
|
import { DescriptorProto, EnumDescriptorProto, MethodDescriptorProto } from "ts-proto-descriptors";
|
5
5
|
export interface TypingData {
|
6
|
-
output: GraphQLObjectType | GraphQLEnumType;
|
7
|
-
input: GraphQLInputObjectType | GraphQLEnumType;
|
6
|
+
output: GraphQLObjectType | GraphQLEnumType | GraphQLScalarType;
|
7
|
+
input: GraphQLInputObjectType | GraphQLEnumType | GraphQLScalarType;
|
8
8
|
meta: DescriptorProto | EnumDescriptorProto;
|
9
9
|
processor?: any;
|
10
10
|
}
|
@@ -33,7 +33,22 @@ exports.IGoogleProtobufAny = new definition_1.GraphQLInputObjectType({
|
|
33
33
|
name: 'IGoogleProtobufAny',
|
34
34
|
fields: protobufAnyFields
|
35
35
|
});
|
36
|
+
const DateTime = new definition_1.GraphQLScalarType({
|
37
|
+
name: 'DateTime',
|
38
|
+
description: `A date-time string at UTC, such as 2007-12-03T10:15:30Z,
|
39
|
+
compliant with the date-time format outlined in section 5.6 of
|
40
|
+
the RFC 3339 profile of the ISO 8601 standard for representation
|
41
|
+
of dates and times using the Gregorian calendar.`,
|
42
|
+
});
|
43
|
+
const IDateTime = new definition_1.GraphQLScalarType({
|
44
|
+
name: 'IDateTime',
|
45
|
+
description: `A date-time string at UTC, such as 2007-12-03T10:15:30Z,
|
46
|
+
compliant with the date-time format outlined in section 5.6 of
|
47
|
+
the RFC 3339 profile of the ISO 8601 standard for representation
|
48
|
+
of dates and times using the Gregorian calendar.`,
|
49
|
+
});
|
36
50
|
const googleProtobufAnyName = '.google.protobuf.Any';
|
51
|
+
const googleProtobufTimestampName = '.google.protobuf.Timestamp';
|
37
52
|
const Mutate = ['Create', 'Update', 'Upsert'];
|
38
53
|
const CRUD_TRAVERSAL_OP_NAMES = ['Cretae', 'Update', 'Upsert', 'Delete', 'Read', 'Traversal'];
|
39
54
|
const TodoScalar = new definition_1.GraphQLScalarType({
|
@@ -164,6 +179,14 @@ const registerTyping = (protoPackage, message, methodDef, opts, inputOpts) => {
|
|
164
179
|
meta: message
|
165
180
|
});
|
166
181
|
}
|
182
|
+
if (type === googleProtobufTimestampName) {
|
183
|
+
typeNameAndNameSpaceMapping.set(DateTime.name, type);
|
184
|
+
exports.registeredTypings.set(type, {
|
185
|
+
output: DateTime,
|
186
|
+
input: IDateTime,
|
187
|
+
meta: message
|
188
|
+
});
|
189
|
+
}
|
167
190
|
if (exports.registeredTypings.has(type)) {
|
168
191
|
// TODO Log debug "Typings for object are already registered"
|
169
192
|
return;
|
@@ -280,6 +303,14 @@ const resolveMeta = (key, field, rootObjType, objName, input) => {
|
|
280
303
|
result = GoogleProtobufAny;
|
281
304
|
break;
|
282
305
|
}
|
306
|
+
if (objType === googleProtobufTimestampName) {
|
307
|
+
if (input) {
|
308
|
+
result = IDateTime;
|
309
|
+
break;
|
310
|
+
}
|
311
|
+
result = DateTime;
|
312
|
+
break;
|
313
|
+
}
|
283
314
|
if (!exports.registeredTypings.has(objType)) {
|
284
315
|
throw new Error("Typing '" + objType + "' not registered for key '" + key + "' in object: " + objName);
|
285
316
|
}
|
@@ -8,13 +8,16 @@ export interface ProtoMetadata {
|
|
8
8
|
};
|
9
9
|
dependencies?: ProtoMetadata[];
|
10
10
|
}
|
11
|
-
export interface
|
11
|
+
export interface BlackListWhiteListConfig {
|
12
12
|
whitelist?: string[];
|
13
13
|
blacklist?: string[];
|
14
14
|
}
|
15
|
+
export interface MethodConfig {
|
16
|
+
methods?: BlackListWhiteListConfig;
|
17
|
+
}
|
15
18
|
export interface ServiceConfig {
|
16
19
|
client: GrpcClientConfig;
|
17
|
-
|
20
|
+
[key: string]: any;
|
18
21
|
}
|
19
22
|
export interface SubSpaceServiceConfig extends ServiceConfig {
|
20
23
|
root: boolean;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@restorecommerce/facade",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.16",
|
4
4
|
"description": "Facade for Restorecommerce microservices",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"typings": "dist/index.d.ts",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"@restorecommerce/grpc-client": "^0.3.1",
|
28
28
|
"@restorecommerce/kafka-client": "^0.3.1",
|
29
29
|
"@restorecommerce/logger": "^0.12.1",
|
30
|
-
"@restorecommerce/rc-grpc-clients": "^0.4.
|
30
|
+
"@restorecommerce/rc-grpc-clients": "^0.4.5",
|
31
31
|
"@restorecommerce/service-config": "^0.4.25",
|
32
32
|
"apollo-server-core": "^3.6.3",
|
33
33
|
"apollo-server-koa": "^3.6.3",
|
@@ -108,5 +108,5 @@
|
|
108
108
|
"publishConfig": {
|
109
109
|
"access": "public"
|
110
110
|
},
|
111
|
-
"gitHead": "
|
111
|
+
"gitHead": "781c23f4dbe746909e90366dc22bfbfd97a7e10a"
|
112
112
|
}
|