@restorecommerce/facade 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +3 -0
- package/.eslintrc.cjs +13 -0
- package/CHANGELOG.md +22 -0
- package/codegen/index.d.ts +1 -1
- package/codegen/index.js +18 -44
- package/debug-run.ts +7 -6
- package/dist/gql/index.d.ts +1 -1
- package/dist/gql/index.js +1 -17
- package/dist/gql/protos/federation.d.ts +3 -3
- package/dist/gql/protos/federation.js +16 -24
- package/dist/gql/protos/graphql.d.ts +4 -4
- package/dist/gql/protos/graphql.js +64 -42
- package/dist/gql/protos/index.d.ts +6 -6
- package/dist/gql/protos/index.js +6 -22
- package/dist/gql/protos/registry.d.ts +6 -6
- package/dist/gql/protos/registry.js +157 -176
- package/dist/gql/protos/resolvers.d.ts +3 -3
- package/dist/gql/protos/resolvers.js +78 -104
- package/dist/gql/protos/schema.d.ts +4 -4
- package/dist/gql/protos/schema.js +40 -53
- package/dist/gql/protos/types.d.ts +3 -3
- package/dist/gql/protos/types.js +1 -4
- package/dist/gql/protos/utils.d.ts +3 -3
- package/dist/gql/protos/utils.js +23 -62
- package/dist/gql/types/AccessControlTypes.js +13 -16
- package/dist/gql/types/DateType.js +4 -7
- package/dist/gql/types/FilterType.js +7 -10
- package/dist/gql/types/MetaType.js +8 -11
- package/dist/gql/types/ScopeType.js +4 -7
- package/dist/gql/types/SortType.js +5 -8
- package/dist/gql/types/StatusType.js +4 -7
- package/dist/gql/types/index.d.ts +7 -7
- package/dist/gql/types/index.js +7 -23
- package/dist/index.d.ts +14 -14
- package/dist/index.js +195 -207
- package/dist/interfaces.d.ts +8 -8
- package/dist/interfaces.js +1 -2
- package/dist/middlewares/index.d.ts +1 -1
- package/dist/middlewares/index.js +1 -17
- package/dist/middlewares/req-res-logger/index.d.ts +2 -2
- package/dist/middlewares/req-res-logger/index.js +33 -31
- package/dist/modules/access-control/gql/federation.d.ts +1 -1
- package/dist/modules/access-control/gql/federation.js +10 -17
- package/dist/modules/access-control/gql/schema.d.ts +1 -1
- package/dist/modules/access-control/gql/schema.generated.d.ts +136 -110
- package/dist/modules/access-control/gql/schema.generated.js +22 -25
- package/dist/modules/access-control/gql/schema.js +5 -9
- package/dist/modules/access-control/gql/types.d.ts +2 -2
- package/dist/modules/access-control/gql/types.js +13 -17
- package/dist/modules/access-control/grpc/index.d.ts +5 -5
- package/dist/modules/access-control/grpc/index.js +10 -14
- package/dist/modules/access-control/index.d.ts +2 -2
- package/dist/modules/access-control/index.js +20 -17
- package/dist/modules/access-control/interfaces.d.ts +3 -3
- package/dist/modules/access-control/interfaces.js +1 -4
- package/dist/modules/catalog/gql/federation.d.ts +1 -1
- package/dist/modules/catalog/gql/federation.js +10 -17
- package/dist/modules/catalog/gql/schema.d.ts +1 -1
- package/dist/modules/catalog/gql/schema.generated.d.ts +252 -226
- package/dist/modules/catalog/gql/schema.generated.js +20 -23
- package/dist/modules/catalog/gql/schema.js +5 -9
- package/dist/modules/catalog/gql/types.d.ts +2 -2
- package/dist/modules/catalog/gql/types.js +15 -19
- package/dist/modules/catalog/grpc/index.d.ts +6 -6
- package/dist/modules/catalog/grpc/index.js +12 -16
- package/dist/modules/catalog/index.d.ts +2 -2
- package/dist/modules/catalog/index.js +20 -17
- package/dist/modules/catalog/interfaces.d.ts +3 -3
- package/dist/modules/catalog/interfaces.js +1 -4
- package/dist/modules/facade-status/gql/index.js +8 -14
- package/dist/modules/facade-status/gql/resolvers.d.ts +1 -1
- package/dist/modules/facade-status/gql/resolvers.js +14 -8
- package/dist/modules/facade-status/gql/schema.d.ts +1 -1
- package/dist/modules/facade-status/gql/schema.generated.d.ts +34 -11
- package/dist/modules/facade-status/gql/schema.generated.js +1 -2
- package/dist/modules/facade-status/gql/schema.js +6 -9
- package/dist/modules/facade-status/gql/types.js +3 -6
- package/dist/modules/facade-status/index.d.ts +1 -1
- package/dist/modules/facade-status/index.js +4 -7
- package/dist/modules/facade-status/interfaces.d.ts +1 -1
- package/dist/modules/facade-status/interfaces.js +1 -2
- package/dist/modules/fulfillment/gql/federation.d.ts +1 -1
- package/dist/modules/fulfillment/gql/federation.js +10 -17
- package/dist/modules/fulfillment/gql/schema.d.ts +1 -1
- package/dist/modules/fulfillment/gql/schema.generated.d.ts +249 -223
- package/dist/modules/fulfillment/gql/schema.generated.js +20 -23
- package/dist/modules/fulfillment/gql/schema.js +5 -9
- package/dist/modules/fulfillment/gql/types.d.ts +2 -2
- package/dist/modules/fulfillment/gql/types.js +11 -15
- package/dist/modules/fulfillment/grpc/index.d.ts +3 -3
- package/dist/modules/fulfillment/grpc/index.js +6 -10
- package/dist/modules/fulfillment/index.d.ts +2 -2
- package/dist/modules/fulfillment/index.js +20 -17
- package/dist/modules/fulfillment/interfaces.d.ts +3 -3
- package/dist/modules/fulfillment/interfaces.js +1 -4
- package/dist/modules/identity/api-key/api-key.d.ts +2 -2
- package/dist/modules/identity/api-key/api-key.js +45 -65
- package/dist/modules/identity/gql/federation.d.ts +2 -2
- package/dist/modules/identity/gql/federation.js +5 -9
- package/dist/modules/identity/gql/schema.d.ts +1 -1
- package/dist/modules/identity/gql/schema.generated.d.ts +284 -255
- package/dist/modules/identity/gql/schema.generated.js +20 -23
- package/dist/modules/identity/gql/schema.js +5 -9
- package/dist/modules/identity/gql/types.d.ts +2 -2
- package/dist/modules/identity/gql/types.js +17 -21
- package/dist/modules/identity/grpc/index.d.ts +6 -6
- package/dist/modules/identity/grpc/index.js +12 -16
- package/dist/modules/identity/index.d.ts +4 -4
- package/dist/modules/identity/index.js +24 -21
- package/dist/modules/identity/interfaces.d.ts +5 -5
- package/dist/modules/identity/interfaces.js +1 -4
- package/dist/modules/identity/oauth/oauth.d.ts +4 -4
- package/dist/modules/identity/oauth/oauth.js +109 -135
- package/dist/modules/identity/oidc/adapter.d.ts +3 -3
- package/dist/modules/identity/oidc/adapter.js +111 -92
- package/dist/modules/identity/oidc/in-memory-adapter.d.ts +1 -1
- package/dist/modules/identity/oidc/in-memory-adapter.js +64 -50
- package/dist/modules/identity/oidc/index.d.ts +6 -6
- package/dist/modules/identity/oidc/index.js +29 -30
- package/dist/modules/identity/oidc/interfaces.d.ts +6 -6
- package/dist/modules/identity/oidc/interfaces.js +2 -6
- package/dist/modules/identity/oidc/password-grant.d.ts +1 -1
- package/dist/modules/identity/oidc/password-grant.js +43 -66
- package/dist/modules/identity/oidc/router.d.ts +6 -6
- package/dist/modules/identity/oidc/router.js +31 -26
- package/dist/modules/identity/oidc/templates.d.ts +1 -1
- package/dist/modules/identity/oidc/templates.js +45 -41
- package/dist/modules/identity/oidc/user.d.ts +4 -4
- package/dist/modules/identity/oidc/user.js +31 -29
- package/dist/modules/identity/oidc/utils.d.ts +2 -2
- package/dist/modules/identity/oidc/utils.js +6 -13
- package/dist/modules/index.d.ts +13 -13
- package/dist/modules/index.js +13 -29
- package/dist/modules/indexing/gql/federation.d.ts +1 -1
- package/dist/modules/indexing/gql/federation.js +10 -17
- package/dist/modules/indexing/gql/schema.d.ts +1 -1
- package/dist/modules/indexing/gql/schema.generated.d.ts +45 -19
- package/dist/modules/indexing/gql/schema.generated.js +2 -5
- package/dist/modules/indexing/gql/schema.js +5 -9
- package/dist/modules/indexing/gql/types.d.ts +2 -2
- package/dist/modules/indexing/gql/types.js +7 -11
- package/dist/modules/indexing/grpc/index.d.ts +2 -2
- package/dist/modules/indexing/grpc/index.js +4 -8
- package/dist/modules/indexing/index.d.ts +2 -2
- package/dist/modules/indexing/index.js +20 -17
- package/dist/modules/indexing/interfaces.d.ts +3 -3
- package/dist/modules/indexing/interfaces.js +1 -4
- package/dist/modules/invoicing/gql/federation.d.ts +1 -1
- package/dist/modules/invoicing/gql/federation.js +10 -17
- package/dist/modules/invoicing/gql/schema.d.ts +1 -1
- package/dist/modules/invoicing/gql/schema.generated.d.ts +209 -183
- package/dist/modules/invoicing/gql/schema.generated.js +20 -23
- package/dist/modules/invoicing/gql/schema.js +5 -9
- package/dist/modules/invoicing/gql/types.d.ts +2 -2
- package/dist/modules/invoicing/gql/types.js +7 -11
- package/dist/modules/invoicing/grpc/index.d.ts +2 -2
- package/dist/modules/invoicing/grpc/index.js +4 -8
- package/dist/modules/invoicing/index.d.ts +2 -2
- package/dist/modules/invoicing/index.js +20 -17
- package/dist/modules/invoicing/interfaces.d.ts +3 -3
- package/dist/modules/invoicing/interfaces.js +1 -4
- package/dist/modules/notification/gql/federation.d.ts +1 -1
- package/dist/modules/notification/gql/federation.js +10 -17
- package/dist/modules/notification/gql/schema.d.ts +1 -1
- package/dist/modules/notification/gql/schema.generated.d.ts +100 -74
- package/dist/modules/notification/gql/schema.generated.js +18 -21
- package/dist/modules/notification/gql/schema.js +5 -9
- package/dist/modules/notification/gql/types.d.ts +2 -2
- package/dist/modules/notification/gql/types.js +7 -11
- package/dist/modules/notification/grpc/index.d.ts +2 -2
- package/dist/modules/notification/grpc/index.js +4 -8
- package/dist/modules/notification/index.d.ts +2 -2
- package/dist/modules/notification/index.js +20 -17
- package/dist/modules/notification/interfaces.d.ts +3 -3
- package/dist/modules/notification/interfaces.js +1 -4
- package/dist/modules/ordering/gql/federation.d.ts +1 -1
- package/dist/modules/ordering/gql/federation.js +10 -17
- package/dist/modules/ordering/gql/schema.d.ts +1 -1
- package/dist/modules/ordering/gql/schema.generated.d.ts +221 -195
- package/dist/modules/ordering/gql/schema.generated.js +22 -25
- package/dist/modules/ordering/gql/schema.js +5 -9
- package/dist/modules/ordering/gql/types.d.ts +2 -2
- package/dist/modules/ordering/gql/types.js +7 -11
- package/dist/modules/ordering/grpc/index.d.ts +2 -2
- package/dist/modules/ordering/grpc/index.js +4 -8
- package/dist/modules/ordering/index.d.ts +2 -2
- package/dist/modules/ordering/index.js +20 -17
- package/dist/modules/ordering/interfaces.d.ts +3 -3
- package/dist/modules/ordering/interfaces.js +1 -4
- package/dist/modules/ostorage/gql/federation.d.ts +1 -1
- package/dist/modules/ostorage/gql/federation.js +10 -17
- package/dist/modules/ostorage/gql/schema.d.ts +1 -1
- package/dist/modules/ostorage/gql/schema.generated.d.ts +126 -94
- package/dist/modules/ostorage/gql/schema.generated.js +8 -11
- package/dist/modules/ostorage/gql/schema.js +5 -9
- package/dist/modules/ostorage/gql/types.d.ts +2 -2
- package/dist/modules/ostorage/gql/types.js +7 -11
- package/dist/modules/ostorage/grpc/index.d.ts +2 -2
- package/dist/modules/ostorage/grpc/index.js +4 -8
- package/dist/modules/ostorage/index.d.ts +2 -2
- package/dist/modules/ostorage/index.js +20 -17
- package/dist/modules/ostorage/interfaces.d.ts +3 -3
- package/dist/modules/ostorage/interfaces.js +1 -4
- package/dist/modules/payment/gql/federation.d.ts +1 -1
- package/dist/modules/payment/gql/federation.js +10 -17
- package/dist/modules/payment/gql/schema.d.ts +1 -1
- package/dist/modules/payment/gql/schema.generated.d.ts +67 -44
- package/dist/modules/payment/gql/schema.generated.js +4 -7
- package/dist/modules/payment/gql/schema.js +5 -9
- package/dist/modules/payment/gql/types.d.ts +2 -2
- package/dist/modules/payment/gql/types.js +7 -11
- package/dist/modules/payment/grpc/index.d.ts +2 -2
- package/dist/modules/payment/grpc/index.js +4 -8
- package/dist/modules/payment/index.d.ts +2 -2
- package/dist/modules/payment/index.js +20 -17
- package/dist/modules/payment/interfaces.d.ts +3 -3
- package/dist/modules/payment/interfaces.js +1 -4
- package/dist/modules/resource/gql/federation.d.ts +1 -1
- package/dist/modules/resource/gql/federation.js +10 -17
- package/dist/modules/resource/gql/schema.d.ts +1 -1
- package/dist/modules/resource/gql/schema.generated.d.ts +348 -322
- package/dist/modules/resource/gql/schema.generated.js +28 -31
- package/dist/modules/resource/gql/schema.js +5 -9
- package/dist/modules/resource/gql/types.d.ts +2 -2
- package/dist/modules/resource/gql/types.js +31 -35
- package/dist/modules/resource/grpc/index.d.ts +13 -13
- package/dist/modules/resource/grpc/index.js +28 -32
- package/dist/modules/resource/index.d.ts +2 -2
- package/dist/modules/resource/index.js +20 -17
- package/dist/modules/resource/interfaces.d.ts +3 -3
- package/dist/modules/resource/interfaces.js +1 -4
- package/dist/modules/scheduling/gql/federation.d.ts +1 -1
- package/dist/modules/scheduling/gql/federation.js +10 -17
- package/dist/modules/scheduling/gql/schema.d.ts +1 -1
- package/dist/modules/scheduling/gql/schema.generated.d.ts +109 -83
- package/dist/modules/scheduling/gql/schema.generated.js +10 -13
- package/dist/modules/scheduling/gql/schema.js +5 -9
- package/dist/modules/scheduling/gql/types.d.ts +2 -2
- package/dist/modules/scheduling/gql/types.js +7 -11
- package/dist/modules/scheduling/grpc/index.d.ts +2 -2
- package/dist/modules/scheduling/grpc/index.js +4 -8
- package/dist/modules/scheduling/index.d.ts +2 -2
- package/dist/modules/scheduling/index.js +20 -17
- package/dist/modules/scheduling/interfaces.d.ts +3 -3
- package/dist/modules/scheduling/interfaces.js +1 -4
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +4 -9
- package/generate.ts +42 -42
- package/jest.config.cjs +23 -0
- package/package.json +18 -13
- package/tsconfig-base.json +8 -0
- package/tsconfig.debug.json +5 -1
- package/tsconfig.test.json +17 -2
- package/jest.config.js +0 -14
@@ -1,44 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
27
9
|
};
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
const _ = __importStar(require("lodash"));
|
39
|
-
const kafka_client_1 = require("@restorecommerce/kafka-client");
|
10
|
+
import { authSubjectType } from './types.js';
|
11
|
+
import flat from 'array.prototype.flat';
|
12
|
+
import { getTyping } from './registry.js';
|
13
|
+
import { getWhitelistBlacklistConfig, Mutate, postProcessGQLValue, preprocessGQLInput, } from './graphql.js';
|
14
|
+
import { camelCase, capitalize, convertEnumToInt, decodeBufferFields, getKeys, snakeToCamel, useSubscriptions, getServiceName } from './utils.js';
|
15
|
+
import { ReadRequest } from '@restorecommerce/rc-grpc-clients';
|
16
|
+
import { Filter_Operation, Filter_ValueType, FilterOp_Operator } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/resource_base.js';
|
17
|
+
import * as stream from 'node:stream';
|
18
|
+
import _ from 'lodash';
|
19
|
+
import { Events } from '@restorecommerce/kafka-client';
|
40
20
|
const inputMethodType = new Map();
|
41
|
-
const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
21
|
+
export const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
42
22
|
if (!service.method) {
|
43
23
|
return {};
|
44
24
|
}
|
@@ -50,8 +30,8 @@ const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
|
50
30
|
return {};
|
51
31
|
}
|
52
32
|
}
|
53
|
-
const typing =
|
54
|
-
const outputTyping =
|
33
|
+
const typing = getTyping(method.inputType);
|
34
|
+
const outputTyping = getTyping(method.outputType);
|
55
35
|
if (!typing) {
|
56
36
|
throw Error(`Method '${method.name}' could not find input type: ${method.inputType}`);
|
57
37
|
}
|
@@ -64,31 +44,31 @@ const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
|
64
44
|
let subjectField = null;
|
65
45
|
if (typing) {
|
66
46
|
for (let field of typing.meta.field) {
|
67
|
-
if (field.typeName ===
|
47
|
+
if (field.typeName === authSubjectType) {
|
68
48
|
subjectField = field.name;
|
69
49
|
break;
|
70
50
|
}
|
71
51
|
}
|
72
52
|
}
|
73
53
|
let methodName = method.name;
|
74
|
-
if (
|
54
|
+
if (Mutate.indexOf(method.name) > -1) {
|
75
55
|
methodName = 'Mutate';
|
76
56
|
}
|
77
57
|
if (methodName in obj) {
|
78
58
|
return obj;
|
79
59
|
}
|
80
|
-
obj[methodName] =
|
81
|
-
var
|
60
|
+
obj[methodName] = (args, context) => __awaiter(void 0, void 0, void 0, function* () {
|
61
|
+
var _e, _f;
|
82
62
|
const client = context[key].client;
|
83
63
|
const service = client[serviceKey];
|
84
64
|
try {
|
85
|
-
const converted =
|
86
|
-
const scope = (
|
65
|
+
const converted = yield preprocessGQLInput(args.input, typing.input);
|
66
|
+
const scope = (_e = args === null || args === void 0 ? void 0 : args.input) === null || _e === void 0 ? void 0 : _e.scope;
|
87
67
|
let req = typing.processor.fromPartial(converted);
|
88
68
|
// convert enum strings to integers
|
89
|
-
req =
|
69
|
+
req = convertEnumToInt(typing, req);
|
90
70
|
if (subjectField !== null) {
|
91
|
-
req.subject =
|
71
|
+
req.subject = getTyping(authSubjectType).processor.fromPartial({});
|
92
72
|
const authToken = context.request.req.headers['authorization'];
|
93
73
|
if (authToken && authToken.startsWith('Bearer ')) {
|
94
74
|
req.subject.token = authToken.split(' ')[1];
|
@@ -98,8 +78,8 @@ const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
|
98
78
|
}
|
99
79
|
}
|
100
80
|
let realMethod = method.name;
|
101
|
-
if (
|
102
|
-
const mode = (
|
81
|
+
if (Mutate.indexOf(method.name) > -1) {
|
82
|
+
const mode = (_f = args === null || args === void 0 ? void 0 : args.input) === null || _f === void 0 ? void 0 : _f.mode;
|
103
83
|
if (!mode) {
|
104
84
|
throw new Error('Please specify mode');
|
105
85
|
}
|
@@ -113,14 +93,14 @@ const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
|
113
93
|
realMethod = 'Upsert';
|
114
94
|
}
|
115
95
|
}
|
116
|
-
const methodFunc = service[
|
117
|
-
const rawResult =
|
118
|
-
const result =
|
96
|
+
const methodFunc = service[camelCase(realMethod)] || service[realMethod];
|
97
|
+
const rawResult = yield methodFunc(req);
|
98
|
+
const result = postProcessGQLValue(rawResult, outputTyping.output);
|
119
99
|
const grpcClientConfig = cfg.client;
|
120
|
-
const bufferFields =
|
100
|
+
const bufferFields = getKeys(grpcClientConfig === null || grpcClientConfig === void 0 ? void 0 : grpcClientConfig.bufferFields);
|
121
101
|
if (result instanceof stream.Readable) {
|
122
102
|
let operationStatus = { code: 0, message: '' };
|
123
|
-
let aggregatedResponse =
|
103
|
+
let aggregatedResponse = yield new Promise((resolve, reject) => {
|
124
104
|
let response = {};
|
125
105
|
let combinedChunks = {};
|
126
106
|
result.on('data', (chunk) => {
|
@@ -173,17 +153,17 @@ const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
|
173
153
|
return { details: aggregatedResponse, operationStatus };
|
174
154
|
}
|
175
155
|
if ('items' in result) {
|
176
|
-
let items =
|
156
|
+
let items = decodeBufferFields(result.items, bufferFields);
|
177
157
|
return {
|
178
158
|
details: {
|
179
|
-
items
|
159
|
+
items,
|
180
160
|
operationStatus: result.operationStatus // overall status
|
181
161
|
},
|
182
162
|
};
|
183
163
|
}
|
184
164
|
else {
|
185
165
|
return {
|
186
|
-
details:
|
166
|
+
details: decodeBufferFields([result], bufferFields)[0]
|
187
167
|
};
|
188
168
|
}
|
189
169
|
}
|
@@ -199,14 +179,13 @@ const getGQLResolverFunctions = (service, key, serviceKey, cfg) => {
|
|
199
179
|
}
|
200
180
|
};
|
201
181
|
}
|
202
|
-
};
|
182
|
+
});
|
203
183
|
return obj;
|
204
184
|
}, {});
|
205
185
|
};
|
206
|
-
exports.getGQLResolverFunctions = getGQLResolverFunctions;
|
207
186
|
const namespaceResolverRegistry = new Map();
|
208
187
|
const subscriptionResolvers = {};
|
209
|
-
const registerResolverFunction = (namespace, name, func, mutation = false, subspace = undefined, service) => {
|
188
|
+
export const registerResolverFunction = (namespace, name, func, mutation = false, subspace = undefined, service) => {
|
210
189
|
if (!namespaceResolverRegistry.has(namespace)) {
|
211
190
|
namespaceResolverRegistry.set(namespace, new Map());
|
212
191
|
}
|
@@ -237,8 +216,7 @@ const registerResolverFunction = (namespace, name, func, mutation = false, subsp
|
|
237
216
|
}
|
238
217
|
space.set(name, func);
|
239
218
|
};
|
240
|
-
|
241
|
-
const generateResolver = (...namespaces) => {
|
219
|
+
export const generateResolver = (...namespaces) => {
|
242
220
|
const queryResolvers = {};
|
243
221
|
const mutationResolvers = {};
|
244
222
|
namespaces.forEach(ns => {
|
@@ -282,30 +260,29 @@ const generateResolver = (...namespaces) => {
|
|
282
260
|
}
|
283
261
|
return resolvers;
|
284
262
|
};
|
285
|
-
|
286
|
-
const generateSubServiceResolvers = (subServices, config, namespace) => {
|
263
|
+
export const generateSubServiceResolvers = (subServices, config, namespace) => {
|
287
264
|
subServices.forEach((meta) => {
|
288
265
|
var _a;
|
289
266
|
meta.fileDescriptor.service.forEach(service => {
|
290
267
|
if (service.name) {
|
291
268
|
// strip Service from end of String for sub service name
|
292
|
-
const subName =
|
293
|
-
const { mutations, queries } =
|
294
|
-
const func =
|
269
|
+
const subName = getServiceName(service.name);
|
270
|
+
const { mutations, queries } = getWhitelistBlacklistConfig(service, config, meta, subName);
|
271
|
+
const func = getGQLResolverFunctions(service, namespace, subName || namespace, config);
|
295
272
|
Object.keys(func).forEach(k => {
|
296
273
|
const regNamespace = config.root ? subName : namespace;
|
297
274
|
const regSubspace = config.root ? undefined : subName;
|
298
|
-
|
275
|
+
registerResolverFunction(regNamespace, k, func[k], !queries.has(k) && mutations.has(k), regSubspace, service);
|
299
276
|
});
|
300
277
|
}
|
301
278
|
});
|
302
|
-
if (
|
279
|
+
if (useSubscriptions) {
|
303
280
|
Object.entries(((_a = meta.options) === null || _a === void 0 ? void 0 : _a.messages) || {}).forEach(([messageName, option]) => {
|
304
281
|
if (option.options && 'kafka_subscriber' in option.options) {
|
305
282
|
const kafkaSubscriber = option.options.kafka_subscriber;
|
306
|
-
const fieldName = namespace +
|
283
|
+
const fieldName = namespace + capitalize(kafkaSubscriber.plural);
|
307
284
|
const baseMessageName = meta.fileDescriptor.package + '.' + messageName;
|
308
|
-
const typing =
|
285
|
+
const typing = getTyping('.' + baseMessageName);
|
309
286
|
if (typing) {
|
310
287
|
subscriptionResolvers[fieldName] = {
|
311
288
|
// resolve: (parent, args, context, info) => {
|
@@ -323,7 +300,7 @@ const generateSubServiceResolvers = (subServices, config, namespace) => {
|
|
323
300
|
// // TODO Implement user lookup
|
324
301
|
// return obj;
|
325
302
|
// },
|
326
|
-
subscribe:
|
303
|
+
subscribe: (parent, args, context, info) => __awaiter(void 0, void 0, void 0, function* () {
|
327
304
|
const action = args.action || 'CREATED';
|
328
305
|
let event = kafkaSubscriber.created;
|
329
306
|
switch (action) {
|
@@ -334,17 +311,15 @@ const generateSubServiceResolvers = (subServices, config, namespace) => {
|
|
334
311
|
event = kafkaSubscriber.deleted;
|
335
312
|
break;
|
336
313
|
}
|
337
|
-
const events = new
|
314
|
+
const events = new Events({
|
338
315
|
provider: 'kafka',
|
339
|
-
kafka: {
|
340
|
-
...context.kafkaConfig
|
341
|
-
},
|
316
|
+
kafka: Object.assign({}, context.kafkaConfig),
|
342
317
|
[event]: {
|
343
318
|
messageObject: baseMessageName
|
344
319
|
}
|
345
320
|
}, context.logger);
|
346
|
-
|
347
|
-
const commandTopic =
|
321
|
+
yield events.start();
|
322
|
+
const commandTopic = yield events.topic(kafkaSubscriber.topic);
|
348
323
|
let deferred = null;
|
349
324
|
const pending = [];
|
350
325
|
commandTopic.on(event, (message) => {
|
@@ -355,23 +330,23 @@ const generateSubServiceResolvers = (subServices, config, namespace) => {
|
|
355
330
|
[Symbol.asyncIterator]() {
|
356
331
|
return this;
|
357
332
|
},
|
358
|
-
|
333
|
+
next: () => __awaiter(void 0, void 0, void 0, function* () {
|
359
334
|
if (pending.length) {
|
360
335
|
return { value: { [fieldName]: pending.shift() } };
|
361
336
|
}
|
362
|
-
return (
|
337
|
+
return (yield new Promise((resolve, reject) => (deferred = { resolve, reject })))
|
363
338
|
? { done: true, value: undefined }
|
364
339
|
: { value: { [fieldName]: pending.shift() } };
|
365
|
-
},
|
366
|
-
|
340
|
+
}),
|
341
|
+
throw: (err) => __awaiter(void 0, void 0, void 0, function* () {
|
367
342
|
throw err;
|
368
|
-
},
|
369
|
-
|
370
|
-
|
343
|
+
}),
|
344
|
+
return: () => __awaiter(void 0, void 0, void 0, function* () {
|
345
|
+
yield events.stop();
|
371
346
|
return { done: true, value: undefined };
|
372
|
-
},
|
347
|
+
}),
|
373
348
|
};
|
374
|
-
}
|
349
|
+
})
|
375
350
|
};
|
376
351
|
}
|
377
352
|
}
|
@@ -379,32 +354,32 @@ const generateSubServiceResolvers = (subServices, config, namespace) => {
|
|
379
354
|
}
|
380
355
|
});
|
381
356
|
if (config.root) {
|
382
|
-
return
|
357
|
+
return generateResolver(...flat(subServices.map(meta => {
|
383
358
|
return meta.fileDescriptor.service.map(service => {
|
384
359
|
if (service.name) {
|
385
|
-
return
|
360
|
+
return getServiceName(service.name);
|
386
361
|
}
|
387
362
|
return '';
|
388
363
|
}).filter(s => s !== '');
|
389
364
|
})));
|
390
365
|
}
|
391
|
-
const finalResolver =
|
366
|
+
const finalResolver = generateResolver(namespace);
|
392
367
|
subServices.forEach((meta) => {
|
393
368
|
meta.fileDescriptor.service.forEach(service => {
|
394
369
|
if (meta.options && meta.options.messages) {
|
395
370
|
for (const key of Object.keys(meta.options.messages)) {
|
396
371
|
const message = meta.options.messages[key];
|
397
372
|
if (message.fields) {
|
398
|
-
const typing =
|
373
|
+
const typing = getTyping('.' + meta.fileDescriptor.package + '.' + key);
|
399
374
|
if (typing) {
|
400
375
|
const result = {};
|
401
376
|
for (const fieldName of Object.keys(message.fields)) {
|
402
377
|
const field = message.fields[fieldName];
|
403
378
|
if ('resolver' in field) {
|
404
|
-
const fieldJsonName =
|
379
|
+
const fieldJsonName = snakeToCamel(fieldName);
|
405
380
|
const resolver = field['resolver'];
|
406
381
|
// TODO This creates an N+1 problem!
|
407
|
-
result[resolver.fieldName] =
|
382
|
+
result[resolver.fieldName] = (parent, _, ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
408
383
|
if (!parent || !(fieldJsonName in parent) || parent[fieldJsonName] === undefined) {
|
409
384
|
return undefined;
|
410
385
|
}
|
@@ -412,24 +387,24 @@ const generateSubServiceResolvers = (subServices, config, namespace) => {
|
|
412
387
|
const service = client[resolver.targetSubService];
|
413
388
|
const idList = Array.isArray(parent[fieldJsonName]) ? parent[fieldJsonName] : [parent[fieldJsonName]];
|
414
389
|
// TODO Support custom input messages
|
415
|
-
const req =
|
390
|
+
const req = ReadRequest.fromPartial({
|
416
391
|
filters: [{
|
417
392
|
filter: idList.map(id => ({
|
418
393
|
field: 'id',
|
419
|
-
operation:
|
394
|
+
operation: Filter_Operation.eq,
|
420
395
|
value: id,
|
421
|
-
type:
|
396
|
+
type: Filter_ValueType.STRING
|
422
397
|
})),
|
423
|
-
operator:
|
398
|
+
operator: FilterOp_Operator.or
|
424
399
|
}]
|
425
400
|
});
|
426
|
-
req.subject =
|
401
|
+
req.subject = getTyping(authSubjectType).processor.fromPartial({});
|
427
402
|
const authToken = ctx.request.req.headers['authorization'];
|
428
403
|
if (authToken && authToken.startsWith('Bearer ')) {
|
429
404
|
req.subject.token = authToken.split(' ')[1];
|
430
405
|
}
|
431
|
-
const methodFunc = service[
|
432
|
-
const result =
|
406
|
+
const methodFunc = service[camelCase(resolver.targetMethod)] || service[resolver.targetMethod];
|
407
|
+
const result = yield methodFunc(req);
|
433
408
|
if (result && result.items && result.items.length) {
|
434
409
|
if (Array.isArray(parent[fieldJsonName])) {
|
435
410
|
return result.items.map((item) => item.payload);
|
@@ -439,7 +414,7 @@ const generateSubServiceResolvers = (subServices, config, namespace) => {
|
|
439
414
|
}
|
440
415
|
}
|
441
416
|
return undefined;
|
442
|
-
};
|
417
|
+
});
|
443
418
|
}
|
444
419
|
}
|
445
420
|
finalResolver[typing.output.name] = result;
|
@@ -451,4 +426,3 @@ const generateSubServiceResolvers = (subServices, config, namespace) => {
|
|
451
426
|
});
|
452
427
|
return finalResolver;
|
453
428
|
};
|
454
|
-
exports.generateSubServiceResolvers = generateSubServiceResolvers;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { MethodDescriptorProto, ServiceDescriptorProto } from 'ts-proto-descriptors';
|
2
|
-
import { ProtoMetadata, ServiceConfig, SubSpaceServiceConfig } from './types';
|
3
|
-
import { GraphQLSchema, ThunkObjMap } from 'graphql';
|
4
|
-
import { GraphQLFieldConfig, GraphQLFieldConfigMap } from 'graphql/type/definition';
|
1
|
+
import { type MethodDescriptorProto, type ServiceDescriptorProto } from 'ts-proto-descriptors';
|
2
|
+
import { type ProtoMetadata, type ServiceConfig, type SubSpaceServiceConfig } from './types.js';
|
3
|
+
import { GraphQLSchema, type ThunkObjMap } from 'graphql';
|
4
|
+
import { type GraphQLFieldConfig, type GraphQLFieldConfigMap } from 'graphql/type/definition.js';
|
5
5
|
export declare const getGQLSchema: <TSource, TContext>(method: MethodDescriptorProto) => GraphQLFieldConfig<TSource, TContext, any>;
|
6
6
|
export declare const getGQLSchemas: <TSource, TContext>(service: ServiceDescriptorProto) => GraphQLFieldConfigMap<TSource, TContext>;
|
7
7
|
type SchemaBaseOrSub = ThunkObjMap<GraphQLFieldConfig<any, any>> | Map<string, ThunkObjMap<GraphQLFieldConfig<any, any>>>;
|
@@ -1,16 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
|
6
|
-
exports.generateSubServiceSchemas = exports.generateSchema = exports.registerResolverSchema = exports.getGQLSchemas = exports.getGQLSchema = void 0;
|
7
|
-
const graphql_1 = require("graphql");
|
8
|
-
const array_prototype_flat_1 = __importDefault(require("array.prototype.flat"));
|
9
|
-
const graphql_2 = require("./graphql");
|
10
|
-
const utils_1 = require("./utils");
|
11
|
-
const registry_1 = require("./registry");
|
1
|
+
import { GraphQLSchema, GraphQLNonNull, GraphQLObjectType, GraphQLString, GraphQLEnumType } from 'graphql';
|
2
|
+
import flat from 'array.prototype.flat';
|
3
|
+
import { getWhitelistBlacklistConfig, Mutate } from './graphql.js';
|
4
|
+
import { capitalize, capitalizeProtoName, useSubscriptions, getServiceName } from './utils.js';
|
5
|
+
import { getTyping } from './registry.js';
|
12
6
|
const typeCache = new Map();
|
13
|
-
const subscriptionAction = new
|
7
|
+
const subscriptionAction = new GraphQLEnumType({
|
14
8
|
name: 'SubscriptionAction',
|
15
9
|
values: {
|
16
10
|
CREATED: { value: 'CREATED' },
|
@@ -23,17 +17,17 @@ const subscriptionInput = {
|
|
23
17
|
type: subscriptionAction
|
24
18
|
}
|
25
19
|
};
|
26
|
-
const subscriptionOutput = new
|
20
|
+
const subscriptionOutput = new GraphQLObjectType({
|
27
21
|
name: 'SubscriptionOutput',
|
28
22
|
fields: {
|
29
23
|
id: {
|
30
|
-
type:
|
24
|
+
type: GraphQLString
|
31
25
|
}
|
32
26
|
}
|
33
27
|
});
|
34
|
-
const getGQLSchema = (method) => {
|
28
|
+
export const getGQLSchema = (method) => {
|
35
29
|
const fields = {};
|
36
|
-
const responseTyping =
|
30
|
+
const responseTyping = getTyping(method.outputType);
|
37
31
|
if (!responseTyping) {
|
38
32
|
throw Error('Method doesn\'t have registered typings: ' + method.outputType);
|
39
33
|
}
|
@@ -42,16 +36,16 @@ const getGQLSchema = (method) => {
|
|
42
36
|
type: responseTyping.output,
|
43
37
|
};
|
44
38
|
}
|
45
|
-
const outName = 'Proto' +
|
39
|
+
const outName = 'Proto' + capitalizeProtoName(method.outputType);
|
46
40
|
let out = typeCache.get(outName);
|
47
41
|
if (!out) {
|
48
|
-
out = new
|
42
|
+
out = new GraphQLObjectType({
|
49
43
|
name: outName,
|
50
44
|
fields,
|
51
45
|
});
|
52
46
|
typeCache.set(outName, out);
|
53
47
|
}
|
54
|
-
const typing =
|
48
|
+
const typing = getTyping(method.inputType);
|
55
49
|
if (!typing) {
|
56
50
|
throw Error('Method doesn\'t have registered typings: ' + method.inputType);
|
57
51
|
}
|
@@ -59,23 +53,21 @@ const getGQLSchema = (method) => {
|
|
59
53
|
type: out,
|
60
54
|
args: method.inputType === '.google.protobuf.Empty' ? undefined : {
|
61
55
|
input: {
|
62
|
-
type: new
|
56
|
+
type: new GraphQLNonNull(typing.input)
|
63
57
|
}
|
64
58
|
}
|
65
59
|
};
|
66
60
|
};
|
67
|
-
|
68
|
-
const getGQLSchemas = (service) => {
|
61
|
+
export const getGQLSchemas = (service) => {
|
69
62
|
var _a;
|
70
63
|
return (_a = service.method) === null || _a === void 0 ? void 0 : _a.reduce((obj, method) => {
|
71
|
-
obj[method.name] =
|
64
|
+
obj[method.name] = getGQLSchema(method);
|
72
65
|
return obj;
|
73
66
|
}, {});
|
74
67
|
};
|
75
|
-
exports.getGQLSchemas = getGQLSchemas;
|
76
68
|
const namespaceResolverSchemaRegistry = new Map();
|
77
69
|
const subscriptionFields = {};
|
78
|
-
const registerResolverSchema = (namespace, name, schema, mutation = false, subspace = undefined, config) => {
|
70
|
+
export const registerResolverSchema = (namespace, name, schema, mutation = false, subspace = undefined, config) => {
|
79
71
|
if (!namespaceResolverSchemaRegistry.has(namespace)) {
|
80
72
|
namespaceResolverSchemaRegistry.set(namespace, new Map());
|
81
73
|
}
|
@@ -104,13 +96,12 @@ const registerResolverSchema = (namespace, name, schema, mutation = false, subsp
|
|
104
96
|
}
|
105
97
|
}
|
106
98
|
// register create, update and upsert with Mutate
|
107
|
-
if (
|
99
|
+
if (Mutate.indexOf(name) > -1) {
|
108
100
|
name = 'Mutate';
|
109
101
|
}
|
110
102
|
space.set(name, schema);
|
111
103
|
};
|
112
|
-
|
113
|
-
const generateSchema = (setup) => {
|
104
|
+
export const generateSchema = (setup) => {
|
114
105
|
const queryFields = {};
|
115
106
|
const mutationFields = {};
|
116
107
|
setup.forEach(s => {
|
@@ -121,9 +112,9 @@ const generateSchema = (setup) => {
|
|
121
112
|
const fields = {};
|
122
113
|
namespaceResolverSchemaRegistry.get(s.namespace).get(false).forEach((value, key) => {
|
123
114
|
if (value instanceof Map) {
|
124
|
-
const capitalName =
|
115
|
+
const capitalName = capitalizeProtoName(key);
|
125
116
|
fields[key] = {
|
126
|
-
type: new
|
117
|
+
type: new GraphQLNonNull(new GraphQLObjectType({
|
127
118
|
name: s.prefix + capitalName + 'Query',
|
128
119
|
fields: Object.fromEntries(value),
|
129
120
|
}))
|
@@ -134,7 +125,7 @@ const generateSchema = (setup) => {
|
|
134
125
|
}
|
135
126
|
});
|
136
127
|
queryFields[s.namespace] = {
|
137
|
-
type: new
|
128
|
+
type: new GraphQLNonNull(new GraphQLObjectType({
|
138
129
|
name: s.prefix + 'Query',
|
139
130
|
fields
|
140
131
|
}))
|
@@ -144,9 +135,9 @@ const generateSchema = (setup) => {
|
|
144
135
|
const fields = {};
|
145
136
|
namespaceResolverSchemaRegistry.get(s.namespace).get(true).forEach((value, key) => {
|
146
137
|
if (value instanceof Map) {
|
147
|
-
const capitalName =
|
138
|
+
const capitalName = capitalizeProtoName(key);
|
148
139
|
fields[key] = {
|
149
|
-
type: new
|
140
|
+
type: new GraphQLNonNull(new GraphQLObjectType({
|
150
141
|
name: s.prefix + capitalName + 'Mutation',
|
151
142
|
fields: Object.fromEntries(value),
|
152
143
|
}))
|
@@ -157,7 +148,7 @@ const generateSchema = (setup) => {
|
|
157
148
|
}
|
158
149
|
});
|
159
150
|
mutationFields[s.namespace] = {
|
160
|
-
type: new
|
151
|
+
type: new GraphQLNonNull(new GraphQLObjectType({
|
161
152
|
name: s.prefix + 'Mutation',
|
162
153
|
fields
|
163
154
|
}))
|
@@ -166,46 +157,43 @@ const generateSchema = (setup) => {
|
|
166
157
|
});
|
167
158
|
const config = {};
|
168
159
|
if (Object.keys(queryFields).length > 0) {
|
169
|
-
config.query = new
|
160
|
+
config.query = new GraphQLObjectType({
|
170
161
|
name: 'Query',
|
171
162
|
fields: queryFields
|
172
163
|
});
|
173
164
|
}
|
174
165
|
if (Object.keys(mutationFields).length > 0) {
|
175
|
-
config.mutation = new
|
166
|
+
config.mutation = new GraphQLObjectType({
|
176
167
|
name: 'Mutation',
|
177
168
|
fields: mutationFields
|
178
169
|
});
|
179
170
|
}
|
180
171
|
if (Object.keys(subscriptionFields).length > 0) {
|
181
|
-
config.subscription = new
|
172
|
+
config.subscription = new GraphQLObjectType({
|
182
173
|
name: 'Subscription',
|
183
174
|
fields: subscriptionFields
|
184
175
|
});
|
185
176
|
}
|
186
|
-
return new
|
187
|
-
...config,
|
188
|
-
});
|
177
|
+
return new GraphQLSchema(Object.assign({}, config));
|
189
178
|
};
|
190
|
-
|
191
|
-
const generateSubServiceSchemas = (subServices, config, namespace, prefix) => {
|
179
|
+
export const generateSubServiceSchemas = (subServices, config, namespace, prefix) => {
|
192
180
|
subServices.forEach((meta) => {
|
193
181
|
var _a;
|
194
182
|
meta.fileDescriptor.service.forEach(service => {
|
195
183
|
if (service.name) {
|
196
|
-
const subName =
|
197
|
-
const { mutations, queries } =
|
198
|
-
const schemas =
|
184
|
+
const subName = getServiceName(service.name);
|
185
|
+
const { mutations, queries } = getWhitelistBlacklistConfig(service, config, meta, subName);
|
186
|
+
const schemas = getGQLSchemas(service);
|
199
187
|
Object.keys(schemas).forEach(key => {
|
200
|
-
|
188
|
+
registerResolverSchema(config.root ? subName : namespace, key, schemas[key], !queries.has(key) && mutations.has(key), config.root ? undefined : subName, config);
|
201
189
|
});
|
202
190
|
}
|
203
191
|
});
|
204
|
-
if (
|
192
|
+
if (useSubscriptions) {
|
205
193
|
Object.entries(((_a = meta.options) === null || _a === void 0 ? void 0 : _a.messages) || {}).forEach(([messageName, option]) => {
|
206
194
|
if (option.options && 'kafka_subscriber' in option.options) {
|
207
|
-
const fieldName = namespace +
|
208
|
-
const typing =
|
195
|
+
const fieldName = namespace + capitalize(option.options.kafka_subscriber.plural);
|
196
|
+
const typing = getTyping('.' + meta.fileDescriptor.package + '.' + messageName);
|
209
197
|
if (typing) {
|
210
198
|
subscriptionFields[fieldName] = {
|
211
199
|
// TODO Implement user lookup
|
@@ -219,10 +207,10 @@ const generateSubServiceSchemas = (subServices, config, namespace, prefix) => {
|
|
219
207
|
}
|
220
208
|
});
|
221
209
|
if (config.root) {
|
222
|
-
return
|
210
|
+
return generateSchema(flat(subServices.map(meta => {
|
223
211
|
return meta.fileDescriptor.service.map(service => {
|
224
212
|
if (service.name) {
|
225
|
-
const subName =
|
213
|
+
const subName = getServiceName(service.name);
|
226
214
|
return {
|
227
215
|
prefix: prefix + subName.substring(0, 1).toUpperCase() + subName.substring(1).toLowerCase(),
|
228
216
|
namespace: subName
|
@@ -232,6 +220,5 @@ const generateSubServiceSchemas = (subServices, config, namespace, prefix) => {
|
|
232
220
|
}).filter(s => s !== null);
|
233
221
|
})));
|
234
222
|
}
|
235
|
-
return
|
223
|
+
return generateSchema([{ prefix, namespace }]);
|
236
224
|
};
|
237
|
-
exports.generateSubServiceSchemas = generateSubServiceSchemas;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { GrpcClientConfig } from
|
2
|
-
import { FileDescriptorProto } from
|
3
|
-
import { GraphQLSchema, GraphQLFieldResolver, GraphQLScalarType } from 'graphql';
|
1
|
+
import { type GrpcClientConfig } from '@restorecommerce/grpc-client';
|
2
|
+
import { type FileDescriptorProto } from 'ts-proto-descriptors';
|
3
|
+
import { type GraphQLSchema, type GraphQLFieldResolver, type GraphQLScalarType } from 'graphql';
|
4
4
|
export interface GraphQLResolverMap<TContext = {}> {
|
5
5
|
[typeName: string]: {
|
6
6
|
[fieldName: string]: GraphQLFieldResolver<any, TContext, any> | {
|
package/dist/gql/protos/types.js
CHANGED