@restorecommerce/facade 0.3.2 → 0.3.3
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 +8 -0
- package/codegen/index.js +1 -1
- package/dist/gql/helpers/schema.d.ts +2 -6
- package/dist/gql/index.js +5 -1
- package/dist/gql/protos/graphql.d.ts +5 -7
- package/dist/gql/protos/graphql.js +43 -44
- package/dist/gql/protos/index.js +5 -1
- package/dist/gql/protos/protos.d.ts +1 -1
- package/dist/gql/protos/protos.js +4 -4
- package/dist/gql/protos/registry.d.ts +1 -1
- package/dist/gql/protos/registry.js +31 -31
- package/dist/gql/protos/types.d.ts +1 -1
- package/dist/gql/protos/utils.js +5 -5
- package/dist/gql/types/AccessControlTypes.js +2 -2
- package/dist/gql/types/DateType.d.ts +1 -1
- package/dist/gql/types/index.js +5 -1
- package/dist/index.js +13 -6
- package/dist/middlewares/index.js +5 -1
- package/dist/middlewares/req-res-logger/index.js +2 -2
- package/dist/modules/access-control/gql/federation.js +4 -3
- package/dist/modules/access-control/gql/schema.generated.d.ts +91 -94
- package/dist/modules/access-control/gql/schema.js +2 -2
- package/dist/modules/access-control/gql/types.js +1 -1
- package/dist/modules/access-control/grpc/index.js +4 -4
- package/dist/modules/access-control/index.js +2 -2
- package/dist/modules/catalog/gql/federation.js +4 -3
- package/dist/modules/catalog/gql/schema.generated.d.ts +127 -130
- package/dist/modules/catalog/gql/schema.js +2 -2
- package/dist/modules/catalog/gql/types.js +1 -1
- package/dist/modules/catalog/grpc/index.js +5 -5
- package/dist/modules/catalog/index.js +2 -2
- package/dist/modules/facade-status/gql/index.js +2 -2
- package/dist/modules/facade-status/gql/schema.generated.d.ts +6 -7
- package/dist/modules/facade-status/gql/types.js +1 -1
- package/dist/modules/facade-status/index.js +1 -1
- package/dist/modules/fulfillment/gql/federation.js +4 -3
- package/dist/modules/fulfillment/gql/schema.generated.d.ts +120 -123
- package/dist/modules/fulfillment/gql/schema.js +2 -2
- package/dist/modules/fulfillment/gql/types.js +1 -1
- package/dist/modules/fulfillment/grpc/index.js +2 -2
- package/dist/modules/fulfillment/index.js +2 -2
- package/dist/modules/identity/api-key/api-key.js +1 -1
- package/dist/modules/identity/gql/federation.js +4 -3
- package/dist/modules/identity/gql/schema.generated.d.ts +169 -172
- package/dist/modules/identity/gql/schema.js +2 -2
- package/dist/modules/identity/gql/types.js +1 -1
- package/dist/modules/identity/grpc/index.js +5 -5
- package/dist/modules/identity/index.js +5 -5
- package/dist/modules/identity/oauth/oauth.js +11 -11
- package/dist/modules/identity/oidc/adapter.js +2 -2
- package/dist/modules/identity/oidc/in-memory-adapter.js +10 -6
- package/dist/modules/identity/oidc/index.js +6 -6
- package/dist/modules/identity/oidc/password-grant.js +4 -4
- package/dist/modules/identity/oidc/user.js +2 -2
- package/dist/modules/identity/oidc/utils.js +1 -1
- package/dist/modules/index.js +5 -1
- package/dist/modules/indexing/gql/federation.js +4 -3
- package/dist/modules/indexing/gql/schema.generated.d.ts +10 -13
- package/dist/modules/indexing/gql/schema.js +2 -2
- package/dist/modules/indexing/gql/types.js +1 -1
- package/dist/modules/indexing/grpc/index.js +1 -1
- package/dist/modules/indexing/index.js +2 -2
- package/dist/modules/invoicing/gql/federation.js +4 -3
- package/dist/modules/invoicing/gql/schema.generated.d.ts +61 -64
- package/dist/modules/invoicing/gql/schema.js +2 -2
- package/dist/modules/invoicing/gql/types.js +1 -1
- package/dist/modules/invoicing/grpc/index.js +1 -1
- package/dist/modules/invoicing/index.js +2 -2
- package/dist/modules/notification/gql/federation.js +4 -3
- package/dist/modules/notification/gql/schema.generated.d.ts +59 -62
- package/dist/modules/notification/gql/schema.js +2 -2
- package/dist/modules/notification/gql/types.js +1 -1
- package/dist/modules/notification/grpc/index.js +1 -1
- package/dist/modules/notification/index.js +2 -2
- package/dist/modules/ordering/gql/federation.js +4 -3
- package/dist/modules/ordering/gql/schema.generated.d.ts +92 -95
- package/dist/modules/ordering/gql/schema.js +2 -2
- package/dist/modules/ordering/gql/types.js +1 -1
- package/dist/modules/ordering/grpc/index.js +1 -1
- package/dist/modules/ordering/index.js +2 -2
- package/dist/modules/ostorage/gql/federation.js +4 -3
- package/dist/modules/ostorage/gql/schema.generated.d.ts +61 -64
- package/dist/modules/ostorage/gql/schema.js +2 -2
- package/dist/modules/ostorage/gql/types.js +1 -1
- package/dist/modules/ostorage/grpc/index.js +1 -1
- package/dist/modules/ostorage/index.js +2 -2
- package/dist/modules/payment/gql/federation.js +4 -3
- package/dist/modules/payment/gql/schema.generated.d.ts +32 -35
- package/dist/modules/payment/gql/schema.js +2 -2
- package/dist/modules/payment/gql/types.js +1 -1
- package/dist/modules/payment/grpc/index.js +1 -1
- package/dist/modules/payment/index.js +2 -2
- package/dist/modules/resource/gql/federation.js +4 -3
- package/dist/modules/resource/gql/schema.generated.d.ts +179 -182
- package/dist/modules/resource/gql/schema.js +2 -2
- package/dist/modules/resource/gql/types.js +1 -1
- package/dist/modules/resource/grpc/index.js +12 -12
- package/dist/modules/resource/index.js +2 -2
- package/dist/modules/scheduling/gql/federation.js +4 -3
- package/dist/modules/scheduling/gql/schema.generated.d.ts +55 -58
- package/dist/modules/scheduling/gql/schema.js +2 -2
- package/dist/modules/scheduling/gql/types.js +1 -1
- package/dist/modules/scheduling/grpc/index.js +1 -1
- package/dist/modules/scheduling/index.js +2 -2
- package/package.json +42 -42
@@ -15,7 +15,7 @@ const createOAuth = () => {
|
|
15
15
|
router.use(bodyParser({ multipart: true }));
|
16
16
|
router.get('/oauth2-login', async (ctx, next) => {
|
17
17
|
ctx.type = 'html';
|
18
|
-
ctx.body = await exports.login((await ctx.identitySrvClient.oauth.GenerateLinks({})).links);
|
18
|
+
ctx.body = await (0, exports.login)((await ctx.identitySrvClient.oauth.GenerateLinks({})).links);
|
19
19
|
return next();
|
20
20
|
});
|
21
21
|
router.get('/oauth2-logout', async (ctx, next) => {
|
@@ -44,7 +44,7 @@ const createOAuth = () => {
|
|
44
44
|
return next();
|
45
45
|
}
|
46
46
|
ctx.type = 'html';
|
47
|
-
ctx.body = await exports.account(user.payload);
|
47
|
+
ctx.body = await (0, exports.account)(user.payload);
|
48
48
|
return next();
|
49
49
|
});
|
50
50
|
router.post('/oauth2-register', async (ctx, next) => {
|
@@ -81,7 +81,7 @@ const createOAuth = () => {
|
|
81
81
|
});
|
82
82
|
if (!user.user || !user.user.payload || !user.token || (user.user.status && user.user.status.code !== 200)) {
|
83
83
|
ctx.type = 'html';
|
84
|
-
ctx.body = await exports.register(user.email || '');
|
84
|
+
ctx.body = await (0, exports.register)(user.email || '');
|
85
85
|
return next();
|
86
86
|
}
|
87
87
|
ctx.cookies.set('token', user.token.token);
|
@@ -104,7 +104,7 @@ const upsertUserToken = async (ids, accountId) => {
|
|
104
104
|
id: uuid.v4().replace(/-/g, ''),
|
105
105
|
type: 'access_token',
|
106
106
|
expiresIn: expiresIn,
|
107
|
-
payload: utils_1.marshallProtobufAny({
|
107
|
+
payload: (0, utils_1.marshallProtobufAny)({
|
108
108
|
accountId: accountId,
|
109
109
|
exp: expiresIn,
|
110
110
|
jti: token
|
@@ -116,7 +116,7 @@ let layoutHbs;
|
|
116
116
|
const layout = async (context) => {
|
117
117
|
if (!layoutHbs) {
|
118
118
|
const layoutTpl = await new Promise((resolve, reject) => {
|
119
|
-
fs_1.readFile(path_1.resolve(__dirname, 'views/layout.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
|
119
|
+
(0, fs_1.readFile)((0, path_1.resolve)(__dirname, 'views/layout.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
|
120
120
|
});
|
121
121
|
layoutHbs = handlebars_1.default.compile(layoutTpl);
|
122
122
|
}
|
@@ -127,11 +127,11 @@ let registerHbs;
|
|
127
127
|
const register = async (email) => {
|
128
128
|
if (!registerHbs) {
|
129
129
|
const registerTpl = await new Promise((resolve, reject) => {
|
130
|
-
fs_1.readFile(path_1.resolve(__dirname, 'views/register.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
|
130
|
+
(0, fs_1.readFile)((0, path_1.resolve)(__dirname, 'views/register.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
|
131
131
|
});
|
132
132
|
registerHbs = handlebars_1.default.compile(registerTpl);
|
133
133
|
}
|
134
|
-
return exports.layout({
|
134
|
+
return (0, exports.layout)({
|
135
135
|
title: 'Register',
|
136
136
|
body: registerHbs({ email })
|
137
137
|
});
|
@@ -141,11 +141,11 @@ let loginHbs;
|
|
141
141
|
const login = async (links) => {
|
142
142
|
if (!loginHbs) {
|
143
143
|
const loginTpl = await new Promise((resolve, reject) => {
|
144
|
-
fs_1.readFile(path_1.resolve(__dirname, 'views/login.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
|
144
|
+
(0, fs_1.readFile)((0, path_1.resolve)(__dirname, 'views/login.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
|
145
145
|
});
|
146
146
|
loginHbs = handlebars_1.default.compile(loginTpl);
|
147
147
|
}
|
148
|
-
return exports.layout({
|
148
|
+
return (0, exports.layout)({
|
149
149
|
title: 'Login',
|
150
150
|
body: loginHbs({ links })
|
151
151
|
});
|
@@ -155,11 +155,11 @@ let accountHbs;
|
|
155
155
|
const account = async (user) => {
|
156
156
|
if (!accountHbs) {
|
157
157
|
const accountTpl = await new Promise((resolve, reject) => {
|
158
|
-
fs_1.readFile(path_1.resolve(__dirname, 'views/account.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
|
158
|
+
(0, fs_1.readFile)((0, path_1.resolve)(__dirname, 'views/account.hbs'), (err, data) => err ? reject(err) : resolve(data.toString()));
|
159
159
|
});
|
160
160
|
accountHbs = handlebars_1.default.compile(accountTpl);
|
161
161
|
}
|
162
|
-
return exports.layout({
|
162
|
+
return (0, exports.layout)({
|
163
163
|
title: 'Account',
|
164
164
|
body: accountHbs({ user })
|
165
165
|
});
|
@@ -56,7 +56,7 @@ function createIdentityServiceAdapterClass(remoteTokenService, logger, localToke
|
|
56
56
|
type: this.type,
|
57
57
|
subject: auth_1.Subject.fromPartial({ token: id })
|
58
58
|
});
|
59
|
-
return result ? utils_1.unmarshallProtobufAny(result) : undefined;
|
59
|
+
return result ? (0, utils_1.unmarshallProtobufAny)(result) : undefined;
|
60
60
|
}
|
61
61
|
catch (error) {
|
62
62
|
logger.error(`Error finding ${this.type} token ${id}`, error);
|
@@ -83,7 +83,7 @@ function createIdentityServiceAdapterClass(remoteTokenService, logger, localToke
|
|
83
83
|
await remoteTokenService.upsert({
|
84
84
|
expiresIn,
|
85
85
|
id,
|
86
|
-
payload: utils_1.marshallProtobufAny(payload),
|
86
|
+
payload: (0, utils_1.marshallProtobufAny)(payload),
|
87
87
|
type: this.type,
|
88
88
|
subject: undefined
|
89
89
|
});
|
@@ -6,9 +6,9 @@ const utils_1 = require("./utils");
|
|
6
6
|
class InMemoryAdapter {
|
7
7
|
constructor(type) {
|
8
8
|
this.type = type;
|
9
|
-
this.tokenStorage = new lru_cache_1.default(
|
10
|
-
this.sessionStorage = new lru_cache_1.default(
|
11
|
-
this.grantIdStorage = new lru_cache_1.default(
|
9
|
+
this.tokenStorage = new lru_cache_1.default();
|
10
|
+
this.sessionStorage = new lru_cache_1.default();
|
11
|
+
this.grantIdStorage = new lru_cache_1.default();
|
12
12
|
}
|
13
13
|
key(id) {
|
14
14
|
return `${this.type}:${id}`;
|
@@ -16,7 +16,9 @@ class InMemoryAdapter {
|
|
16
16
|
async upsert(id, payload, expiresIn) {
|
17
17
|
const key = this.key(id);
|
18
18
|
if (this.type === 'Session' && payload.uid) {
|
19
|
-
this.sessionStorage.set(payload.uid, id,
|
19
|
+
this.sessionStorage.set(payload.uid, id, {
|
20
|
+
ttl: expiresIn * 1000
|
21
|
+
});
|
20
22
|
}
|
21
23
|
const { grantId, userCode } = payload;
|
22
24
|
if (grantId) {
|
@@ -32,7 +34,9 @@ class InMemoryAdapter {
|
|
32
34
|
if (userCode) {
|
33
35
|
throw 'UNSUPPORTED';
|
34
36
|
}
|
35
|
-
this.tokenStorage.set(key, payload,
|
37
|
+
this.tokenStorage.set(key, payload, {
|
38
|
+
ttl: expiresIn * 1000
|
39
|
+
});
|
36
40
|
}
|
37
41
|
findByUserCode(userCode) {
|
38
42
|
throw new Error('UNSUPPORTED');
|
@@ -47,7 +51,7 @@ class InMemoryAdapter {
|
|
47
51
|
async consume(id) {
|
48
52
|
const payload = this.tokenStorage.get(this.key(id));
|
49
53
|
if (payload) {
|
50
|
-
payload.consumed = utils_1.epochTime();
|
54
|
+
payload.consumed = (0, utils_1.epochTime)();
|
51
55
|
}
|
52
56
|
}
|
53
57
|
async destroy(id) {
|
@@ -10,7 +10,7 @@ var router_2 = require("./router");
|
|
10
10
|
Object.defineProperty(exports, "createOIDCRouter", { enumerable: true, get: function () { return router_2.createOIDCRouter; } });
|
11
11
|
function createOIDC({ identitySrvClient, env, logger, config: { loginFn, post_logout_redirect_uris, localTokenServiceFactory, remoteTokenService, cookies, redirect_uris, client_id, client_secret, issuer, jwks, templates } }) {
|
12
12
|
var _a, _b;
|
13
|
-
const adapterClass = adapter_1.createIdentityServiceAdapterClass(remoteTokenService !== null && remoteTokenService !== void 0 ? remoteTokenService : identitySrvClient.token, logger, localTokenServiceFactory);
|
13
|
+
const adapterClass = (0, adapter_1.createIdentityServiceAdapterClass)(remoteTokenService !== null && remoteTokenService !== void 0 ? remoteTokenService : identitySrvClient.token, logger, localTokenServiceFactory);
|
14
14
|
const provider = new oidc_provider_1.Provider(issuer, {
|
15
15
|
adapter: adapterClass,
|
16
16
|
clients: [{
|
@@ -43,14 +43,14 @@ function createOIDC({ identitySrvClient, env, logger, config: { loginFn, post_lo
|
|
43
43
|
// passing it our Account model method is sufficient, it should return a Promise that resolves
|
44
44
|
// with an object with accountId property and a claims method.
|
45
45
|
findAccount: async (ctx, id) => {
|
46
|
-
var _a
|
46
|
+
var _a;
|
47
47
|
try {
|
48
|
-
const userService = (
|
48
|
+
const userService = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.identitySrvClient) === null || _a === void 0 ? void 0 : _a.user;
|
49
49
|
return {
|
50
50
|
accountId: id,
|
51
51
|
claims: async (use, scope) => {
|
52
52
|
try {
|
53
|
-
const user = await user_1.findUserById(userService, id);
|
53
|
+
const user = await (0, user_1.findUserById)(userService, id);
|
54
54
|
return {
|
55
55
|
sub: id,
|
56
56
|
data: user
|
@@ -112,14 +112,14 @@ function createOIDC({ identitySrvClient, env, logger, config: { loginFn, post_lo
|
|
112
112
|
});
|
113
113
|
// Disabled due to playground being disabled
|
114
114
|
// provider.use(helmet());
|
115
|
-
const router = router_1.createOIDCRouter({
|
115
|
+
const router = (0, router_1.createOIDCRouter)({
|
116
116
|
loginFn: loginFn !== null && loginFn !== void 0 ? loginFn : user_1.loginUserBody,
|
117
117
|
templates,
|
118
118
|
logger,
|
119
119
|
provider,
|
120
120
|
env,
|
121
121
|
});
|
122
|
-
password_grant_1.registerPasswordGrantType({
|
122
|
+
(0, password_grant_1.registerPasswordGrantType)({
|
123
123
|
authLogService: identitySrvClient.authentication_log,
|
124
124
|
authenticate: user_1.loginUserCredentials,
|
125
125
|
provider
|
@@ -72,8 +72,8 @@ const registerPasswordGrantType = (config) => {
|
|
72
72
|
const client = await ctx.oidc.provider.Client.find(clientId);
|
73
73
|
ctx.oidc.entity('Client', client);
|
74
74
|
const { IdToken } = ctx.oidc.provider;
|
75
|
-
const jti = utils_1.nanoid();
|
76
|
-
const exp = utils_1.epochTime() + expiresIn;
|
75
|
+
const jti = (0, utils_1.nanoid)();
|
76
|
+
const exp = (0, utils_1.epochTime)() + expiresIn;
|
77
77
|
const token = new IdToken({
|
78
78
|
...claims,
|
79
79
|
}, { ctx });
|
@@ -85,8 +85,8 @@ const registerPasswordGrantType = (config) => {
|
|
85
85
|
return {
|
86
86
|
access_token: accessToken,
|
87
87
|
id_token: idToken,
|
88
|
-
expires_in: utils_1.epochTime() + at.expiration,
|
89
|
-
last_login: utils_1.epochTime(),
|
88
|
+
expires_in: (0, utils_1.epochTime)() + at.expiration,
|
89
|
+
last_login: (0, utils_1.epochTime)(),
|
90
90
|
token_type: at.tokenType,
|
91
91
|
scope: 'openid',
|
92
92
|
token_name: tokenName,
|
@@ -18,11 +18,11 @@ const loginUserBody = async (ctx, body) => {
|
|
18
18
|
const identifier = typeof (body === null || body === void 0 ? void 0 : body.identifier) === 'string' ? body.identifier : undefined;
|
19
19
|
const password = typeof (body === null || body === void 0 ? void 0 : body.password) === 'string' ? body.password : undefined;
|
20
20
|
const remember = !!(body === null || body === void 0 ? void 0 : body.remember);
|
21
|
-
return exports.loginUser(ctx, identifier, password, remember);
|
21
|
+
return (0, exports.loginUser)(ctx, identifier, password, remember);
|
22
22
|
};
|
23
23
|
exports.loginUserBody = loginUserBody;
|
24
24
|
const loginUserCredentials = async (ctx, credentials) => {
|
25
|
-
return exports.loginUser(ctx, credentials.identifier, credentials.password || credentials.token);
|
25
|
+
return (0, exports.loginUser)(ctx, credentials.identifier, credentials.password || credentials.token);
|
26
26
|
};
|
27
27
|
exports.loginUserCredentials = loginUserCredentials;
|
28
28
|
const loginUser = async (ctx, identifier, password, remember) => {
|
@@ -15,7 +15,7 @@ const marshallProtobufAny = (payload) => {
|
|
15
15
|
};
|
16
16
|
};
|
17
17
|
exports.marshallProtobufAny = marshallProtobufAny;
|
18
|
-
const generate = nanoid_1.customAlphabet('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-', 21);
|
18
|
+
const generate = (0, nanoid_1.customAlphabet)('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-', 21);
|
19
19
|
const nanoid = () => {
|
20
20
|
return generate();
|
21
21
|
};
|
package/dist/modules/index.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
@@ -7,10 +7,11 @@ const schema_1 = require("./schema");
|
|
7
7
|
const protos_1 = require("../../../gql/protos");
|
8
8
|
const interfaces_1 = require("../interfaces");
|
9
9
|
const search_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search");
|
10
|
+
const graphql_1 = require("graphql");
|
10
11
|
// TODO There is currently no way of building a federated schema from GraphQLSchema Object
|
11
12
|
// See https://github.com/apollographql/apollo-server/pull/4310
|
12
|
-
const FederatedIndexingSchema = (cfg) => federation_1.buildFederatedSchema({
|
13
|
-
typeDefs: apollo_server_koa_1.gql(
|
14
|
-
resolvers: protos_1.getAndGenerateResolvers(search_1.protoMetadata.fileDescriptor.service[0], interfaces_1.namespace, cfg, ['Search'], undefined, 'search')
|
13
|
+
const FederatedIndexingSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
|
14
|
+
typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
|
15
|
+
resolvers: (0, protos_1.getAndGenerateResolvers)(search_1.protoMetadata.fileDescriptor.service[0], interfaces_1.namespace, cfg, ['Search'], undefined, 'search')
|
15
16
|
});
|
16
17
|
exports.FederatedIndexingSchema = FederatedIndexingSchema;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql';
|
2
2
|
import { IndexingContext } from '../interfaces';
|
3
3
|
export declare type Maybe<T> = T | undefined;
|
4
|
+
export declare type InputMaybe<T> = T | undefined;
|
4
5
|
export declare type Exact<T extends {
|
5
6
|
[key: string]: unknown;
|
6
7
|
}> = {
|
@@ -12,9 +13,7 @@ export declare type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
12
13
|
export declare type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
13
14
|
[SubKey in K]: Maybe<T[SubKey]>;
|
14
15
|
};
|
15
|
-
export declare type RequireFields<T, K extends keyof T> = {
|
16
|
-
[X in Exclude<keyof T, K>]?: T[X];
|
17
|
-
} & {
|
16
|
+
export declare type RequireFields<T, K extends keyof T> = Omit<T, K> & {
|
18
17
|
[P in K]-?: NonNullable<T[P]>;
|
19
18
|
};
|
20
19
|
/** All built-in and custom scalars, mapped to their actual values */
|
@@ -51,16 +50,19 @@ export declare type GoogleProtobufAny = {
|
|
51
50
|
value?: Maybe<Scalars['TodoScalar']>;
|
52
51
|
};
|
53
52
|
export declare type IIoRestorecommerceSearchSearchRequest = {
|
54
|
-
collection?:
|
55
|
-
text?:
|
56
|
-
acl?:
|
53
|
+
collection?: InputMaybe<Scalars['String']>;
|
54
|
+
text?: InputMaybe<Scalars['String']>;
|
55
|
+
acl?: InputMaybe<Array<Scalars['String']>>;
|
57
56
|
};
|
58
57
|
export declare type WithIndex<TObject> = TObject & Record<string, any>;
|
59
58
|
export declare type ResolversObject<TObject> = WithIndex<TObject>;
|
60
59
|
export declare type ResolverTypeWrapper<T> = Promise<T> | T;
|
61
|
-
export declare type
|
60
|
+
export declare type ResolverWithResolve<TResult, TParent, TContext, TArgs> = {
|
61
|
+
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
|
62
|
+
};
|
63
|
+
export declare type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = ResolverFn<TResult, TParent, TContext, TArgs> | ResolverWithResolve<TResult, TParent, TContext, TArgs>;
|
62
64
|
export declare type ResolverFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => Promise<TResult> | TResult;
|
63
|
-
export declare type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) =>
|
65
|
+
export declare type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>;
|
64
66
|
export declare type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult | Promise<TResult>;
|
65
67
|
export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> {
|
66
68
|
subscribe: SubscriptionSubscribeFn<{
|
@@ -135,8 +137,3 @@ export declare type Resolvers<ContextType = IndexingContext> = ResolversObject<{
|
|
135
137
|
GoogleProtobufAny?: GoogleProtobufAnyResolvers<ContextType>;
|
136
138
|
TodoScalar?: GraphQLScalarType;
|
137
139
|
}>;
|
138
|
-
/**
|
139
|
-
* @deprecated
|
140
|
-
* Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config.
|
141
|
-
*/
|
142
|
-
export declare type IResolvers<ContextType = IndexingContext> = Resolvers<ContextType>;
|
@@ -5,6 +5,6 @@ const types_1 = require("./types");
|
|
5
5
|
const protos_1 = require("../../../gql/protos");
|
6
6
|
const search_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search");
|
7
7
|
const interfaces_1 = require("../interfaces");
|
8
|
-
types_1.registerTypings();
|
9
|
-
const schema = (cfg) => protos_1.getAndGenerateSchema(search_1.protoMetadata.fileDescriptor.service[0], interfaces_1.namespace, 'Indexing', cfg, ['Search']);
|
8
|
+
(0, types_1.registerTypings)();
|
9
|
+
const schema = (cfg) => (0, protos_1.getAndGenerateSchema)(search_1.protoMetadata.fileDescriptor.service[0], interfaces_1.namespace, 'Indexing', cfg, ['Search']);
|
10
10
|
exports.schema = schema;
|
@@ -4,6 +4,6 @@ exports.registerTypings = void 0;
|
|
4
4
|
const search_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/search");
|
5
5
|
const protos_1 = require("../../../gql/protos");
|
6
6
|
function registerTypings() {
|
7
|
-
protos_1.registerPackagesRecursive(search_1.protoMetadata);
|
7
|
+
(0, protos_1.registerPackagesRecursive)(search_1.protoMetadata);
|
8
8
|
}
|
9
9
|
exports.registerTypings = registerTypings;
|
@@ -7,7 +7,7 @@ const protos_1 = require("../../../gql/protos");
|
|
7
7
|
class IndexingSrvGrpcClient extends rc_grpc_clients_1.RestoreCommerceGrpcClient {
|
8
8
|
constructor(cfg, logger) {
|
9
9
|
super(cfg, logger);
|
10
|
-
this.search = protos_1.getGRPCService(this, search_1.protobufPackage, search_1.protoMetadata.fileDescriptor.service[0]);
|
10
|
+
this.search = (0, protos_1.getGRPCService)(this, search_1.protobufPackage, search_1.protoMetadata.fileDescriptor.service[0]);
|
11
11
|
}
|
12
12
|
}
|
13
13
|
exports.IndexingSrvGrpcClient = IndexingSrvGrpcClient;
|
@@ -5,13 +5,13 @@ const federation_1 = require("./gql/federation");
|
|
5
5
|
const interfaces_1 = require("./interfaces");
|
6
6
|
const grpc_1 = require("./grpc");
|
7
7
|
const utils_1 = require("../../utils");
|
8
|
-
exports.indexingModule = utils_1.createFacadeModuleFactory(interfaces_1.namespace, (facade, config) => {
|
8
|
+
exports.indexingModule = (0, utils_1.createFacadeModuleFactory)(interfaces_1.namespace, (facade, config) => {
|
9
9
|
const indexing = {
|
10
10
|
client: new grpc_1.IndexingSrvGrpcClient(config.config.client, facade.logger)
|
11
11
|
};
|
12
12
|
facade.addApolloService({
|
13
13
|
name: interfaces_1.namespace,
|
14
|
-
schema: federation_1.FederatedIndexingSchema(config.config)
|
14
|
+
schema: (0, federation_1.FederatedIndexingSchema)(config.config)
|
15
15
|
});
|
16
16
|
facade.koa.use(async (ctx, next) => {
|
17
17
|
ctx.indexing = indexing;
|
@@ -7,10 +7,11 @@ const schema_1 = require("./schema");
|
|
7
7
|
const interfaces_1 = require("../interfaces");
|
8
8
|
const protos_1 = require("../../../gql/protos");
|
9
9
|
const types_1 = require("./types");
|
10
|
+
const graphql_1 = require("graphql");
|
10
11
|
// TODO There is currently no way of building a federated schema from GraphQLSchema Object
|
11
12
|
// See https://github.com/apollographql/apollo-server/pull/4310
|
12
|
-
const FederatedInvoicingSchema = (cfg) => federation_1.buildFederatedSchema({
|
13
|
-
typeDefs: apollo_server_koa_1.gql(
|
14
|
-
resolvers: protos_1.generateSubServiceResolvers(types_1.subServices, cfg, interfaces_1.namespace)
|
13
|
+
const FederatedInvoicingSchema = (cfg) => (0, federation_1.buildFederatedSchema)({
|
14
|
+
typeDefs: (0, apollo_server_koa_1.gql)((0, graphql_1.printSchema)((0, schema_1.schema)(cfg))),
|
15
|
+
resolvers: (0, protos_1.generateSubServiceResolvers)(types_1.subServices, cfg, interfaces_1.namespace)
|
15
16
|
});
|
16
17
|
exports.FederatedInvoicingSchema = FederatedInvoicingSchema;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql';
|
2
2
|
import { InvoicingContext } from '../interfaces';
|
3
3
|
export declare type Maybe<T> = T | undefined;
|
4
|
+
export declare type InputMaybe<T> = T | undefined;
|
4
5
|
export declare type Exact<T extends {
|
5
6
|
[key: string]: unknown;
|
6
7
|
}> = {
|
@@ -12,9 +13,7 @@ export declare type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
12
13
|
export declare type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
13
14
|
[SubKey in K]: Maybe<T[SubKey]>;
|
14
15
|
};
|
15
|
-
export declare type RequireFields<T, K extends keyof T> = {
|
16
|
-
[X in Exclude<keyof T, K>]?: T[X];
|
17
|
-
} & {
|
16
|
+
export declare type RequireFields<T, K extends keyof T> = Omit<T, K> & {
|
18
17
|
[P in K]-?: NonNullable<T[P]>;
|
19
18
|
};
|
20
19
|
/** All built-in and custom scalars, mapped to their actual values */
|
@@ -100,19 +99,19 @@ export declare type IoRestorecommerceStatusOperationStatus = {
|
|
100
99
|
message?: Maybe<Scalars['String']>;
|
101
100
|
};
|
102
101
|
export declare type IIoRestorecommerceResourcebaseReadRequest = {
|
103
|
-
offset?:
|
104
|
-
limit?:
|
105
|
-
sort?:
|
106
|
-
filters?:
|
107
|
-
field?:
|
108
|
-
search?:
|
109
|
-
localesLimiter?:
|
110
|
-
customQueries?:
|
111
|
-
customArguments?:
|
102
|
+
offset?: InputMaybe<Scalars['Int']>;
|
103
|
+
limit?: InputMaybe<Scalars['Int']>;
|
104
|
+
sort?: InputMaybe<Array<IIoRestorecommerceResourcebaseSort>>;
|
105
|
+
filters?: InputMaybe<Array<IIoRestorecommerceResourcebaseFilterOp>>;
|
106
|
+
field?: InputMaybe<Array<IIoRestorecommerceResourcebaseFieldFilter>>;
|
107
|
+
search?: InputMaybe<Array<Scalars['String']>>;
|
108
|
+
localesLimiter?: InputMaybe<Array<Scalars['String']>>;
|
109
|
+
customQueries?: InputMaybe<Array<Scalars['String']>>;
|
110
|
+
customArguments?: InputMaybe<IGoogleProtobufAny>;
|
112
111
|
};
|
113
112
|
export declare type IIoRestorecommerceResourcebaseSort = {
|
114
|
-
field?:
|
115
|
-
order?:
|
113
|
+
field?: InputMaybe<Scalars['String']>;
|
114
|
+
order?: InputMaybe<IoRestorecommerceResourcebaseSortSortOrder>;
|
116
115
|
};
|
117
116
|
export declare enum IoRestorecommerceResourcebaseSortSortOrder {
|
118
117
|
Unsorted = 0,
|
@@ -120,15 +119,15 @@ export declare enum IoRestorecommerceResourcebaseSortSortOrder {
|
|
120
119
|
Descending = 2
|
121
120
|
}
|
122
121
|
export declare type IIoRestorecommerceResourcebaseFilterOp = {
|
123
|
-
filter?:
|
124
|
-
operator?:
|
122
|
+
filter?: InputMaybe<Array<IIoRestorecommerceResourcebaseFilter>>;
|
123
|
+
operator?: InputMaybe<IoRestorecommerceResourcebaseFilterOpOperator>;
|
125
124
|
};
|
126
125
|
export declare type IIoRestorecommerceResourcebaseFilter = {
|
127
|
-
field?:
|
128
|
-
operation?:
|
129
|
-
value?:
|
130
|
-
type?:
|
131
|
-
filters?:
|
126
|
+
field?: InputMaybe<Scalars['String']>;
|
127
|
+
operation?: InputMaybe<IoRestorecommerceResourcebaseFilterOperation>;
|
128
|
+
value?: InputMaybe<Scalars['String']>;
|
129
|
+
type?: InputMaybe<IoRestorecommerceResourcebaseFilterValueType>;
|
130
|
+
filters?: InputMaybe<Array<IIoRestorecommerceFilterFilterOp>>;
|
132
131
|
};
|
133
132
|
export declare enum IoRestorecommerceResourcebaseFilterOperation {
|
134
133
|
Eq = 0,
|
@@ -149,15 +148,15 @@ export declare enum IoRestorecommerceResourcebaseFilterValueType {
|
|
149
148
|
Array = 4
|
150
149
|
}
|
151
150
|
export declare type IIoRestorecommerceFilterFilterOp = {
|
152
|
-
filter?:
|
153
|
-
operator?:
|
151
|
+
filter?: InputMaybe<Array<IIoRestorecommerceFilterFilter>>;
|
152
|
+
operator?: InputMaybe<IoRestorecommerceFilterFilterOpOperator>;
|
154
153
|
};
|
155
154
|
export declare type IIoRestorecommerceFilterFilter = {
|
156
|
-
field?:
|
157
|
-
operation?:
|
158
|
-
value?:
|
159
|
-
type?:
|
160
|
-
filters?:
|
155
|
+
field?: InputMaybe<Scalars['String']>;
|
156
|
+
operation?: InputMaybe<IoRestorecommerceFilterFilterOperation>;
|
157
|
+
value?: InputMaybe<Scalars['String']>;
|
158
|
+
type?: InputMaybe<IoRestorecommerceFilterFilterValueType>;
|
159
|
+
filters?: InputMaybe<Array<IIoRestorecommerceFilterFilterOp>>;
|
161
160
|
};
|
162
161
|
export declare enum IoRestorecommerceFilterFilterOperation {
|
163
162
|
Eq = 0,
|
@@ -186,12 +185,12 @@ export declare enum IoRestorecommerceResourcebaseFilterOpOperator {
|
|
186
185
|
Or = 1
|
187
186
|
}
|
188
187
|
export declare type IIoRestorecommerceResourcebaseFieldFilter = {
|
189
|
-
name?:
|
190
|
-
include?:
|
188
|
+
name?: InputMaybe<Scalars['String']>;
|
189
|
+
include?: InputMaybe<Scalars['Boolean']>;
|
191
190
|
};
|
192
191
|
export declare type IGoogleProtobufAny = {
|
193
|
-
typeUrl?:
|
194
|
-
value?:
|
192
|
+
typeUrl?: InputMaybe<Scalars['String']>;
|
193
|
+
value?: InputMaybe<Scalars['Upload']>;
|
195
194
|
};
|
196
195
|
export declare type Mutation = {
|
197
196
|
__typename?: 'Mutation';
|
@@ -213,37 +212,37 @@ export declare type InvoicingInvoiceMutationDeleteArgs = {
|
|
213
212
|
input: IIoRestorecommerceResourcebaseDeleteRequest;
|
214
213
|
};
|
215
214
|
export declare type IIoRestorecommerceInvoiceInvoiceList = {
|
216
|
-
items?:
|
217
|
-
totalCount?:
|
218
|
-
mode?:
|
215
|
+
items?: InputMaybe<Array<IIoRestorecommerceInvoiceInvoice>>;
|
216
|
+
totalCount?: InputMaybe<Scalars['Int']>;
|
217
|
+
mode?: InputMaybe<ModeType>;
|
219
218
|
};
|
220
219
|
export declare type IIoRestorecommerceInvoiceInvoice = {
|
221
|
-
id?:
|
222
|
-
meta?:
|
223
|
-
timestamp?:
|
224
|
-
customerId?:
|
225
|
-
paymentStatus?:
|
226
|
-
totalAmount?:
|
227
|
-
netAmount?:
|
228
|
-
vatAmount?:
|
229
|
-
document?:
|
230
|
-
invoiceNumber?:
|
231
|
-
customerRemark?:
|
220
|
+
id?: InputMaybe<Scalars['String']>;
|
221
|
+
meta?: InputMaybe<IIoRestorecommerceMetaMeta>;
|
222
|
+
timestamp?: InputMaybe<Scalars['String']>;
|
223
|
+
customerId?: InputMaybe<Scalars['String']>;
|
224
|
+
paymentStatus?: InputMaybe<Scalars['String']>;
|
225
|
+
totalAmount?: InputMaybe<Scalars['Float']>;
|
226
|
+
netAmount?: InputMaybe<Scalars['Float']>;
|
227
|
+
vatAmount?: InputMaybe<Scalars['Float']>;
|
228
|
+
document?: InputMaybe<Scalars['String']>;
|
229
|
+
invoiceNumber?: InputMaybe<Scalars['String']>;
|
230
|
+
customerRemark?: InputMaybe<Scalars['String']>;
|
232
231
|
};
|
233
232
|
export declare type IIoRestorecommerceMetaMeta = {
|
234
|
-
created?:
|
235
|
-
modified?:
|
236
|
-
modifiedBy?:
|
237
|
-
owner?:
|
238
|
-
acl?:
|
233
|
+
created?: InputMaybe<Scalars['Float']>;
|
234
|
+
modified?: InputMaybe<Scalars['Float']>;
|
235
|
+
modifiedBy?: InputMaybe<Scalars['String']>;
|
236
|
+
owner?: InputMaybe<Array<IIoRestorecommerceAttributeAttribute>>;
|
237
|
+
acl?: InputMaybe<Array<IIoRestorecommerceAttributeAttributeObj>>;
|
239
238
|
};
|
240
239
|
export declare type IIoRestorecommerceAttributeAttribute = {
|
241
|
-
id?:
|
242
|
-
value?:
|
243
|
-
attribute?:
|
240
|
+
id?: InputMaybe<Scalars['String']>;
|
241
|
+
value?: InputMaybe<Scalars['String']>;
|
242
|
+
attribute?: InputMaybe<Array<IIoRestorecommerceAttributeAttribute>>;
|
244
243
|
};
|
245
244
|
export declare type IIoRestorecommerceAttributeAttributeObj = {
|
246
|
-
attribute?:
|
245
|
+
attribute?: InputMaybe<IIoRestorecommerceAttributeAttribute>;
|
247
246
|
};
|
248
247
|
export declare enum ModeType {
|
249
248
|
Create = "CREATE",
|
@@ -260,15 +259,18 @@ export declare type IoRestorecommerceResourcebaseDeleteResponse = {
|
|
260
259
|
operationStatus?: Maybe<IoRestorecommerceStatusOperationStatus>;
|
261
260
|
};
|
262
261
|
export declare type IIoRestorecommerceResourcebaseDeleteRequest = {
|
263
|
-
collection?:
|
264
|
-
ids?:
|
262
|
+
collection?: InputMaybe<Scalars['Boolean']>;
|
263
|
+
ids?: InputMaybe<Array<Scalars['String']>>;
|
265
264
|
};
|
266
265
|
export declare type WithIndex<TObject> = TObject & Record<string, any>;
|
267
266
|
export declare type ResolversObject<TObject> = WithIndex<TObject>;
|
268
267
|
export declare type ResolverTypeWrapper<T> = Promise<T> | T;
|
269
|
-
export declare type
|
268
|
+
export declare type ResolverWithResolve<TResult, TParent, TContext, TArgs> = {
|
269
|
+
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
|
270
|
+
};
|
271
|
+
export declare type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = ResolverFn<TResult, TParent, TContext, TArgs> | ResolverWithResolve<TResult, TParent, TContext, TArgs>;
|
270
272
|
export declare type ResolverFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => Promise<TResult> | TResult;
|
271
|
-
export declare type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) =>
|
273
|
+
export declare type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>;
|
272
274
|
export declare type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult | Promise<TResult>;
|
273
275
|
export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> {
|
274
276
|
subscribe: SubscriptionSubscribeFn<{
|
@@ -543,8 +545,3 @@ export declare type Resolvers<ContextType = InvoicingContext> = ResolversObject<
|
|
543
545
|
ProtoIoRestorecommerceResourcebaseDeleteResponse?: ProtoIoRestorecommerceResourcebaseDeleteResponseResolvers<ContextType>;
|
544
546
|
IoRestorecommerceResourcebaseDeleteResponse?: IoRestorecommerceResourcebaseDeleteResponseResolvers<ContextType>;
|
545
547
|
}>;
|
546
|
-
/**
|
547
|
-
* @deprecated
|
548
|
-
* Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config.
|
549
|
-
*/
|
550
|
-
export declare type IResolvers<ContextType = InvoicingContext> = Resolvers<ContextType>;
|
@@ -4,6 +4,6 @@ exports.schema = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
5
5
|
const protos_1 = require("../../../gql/protos");
|
6
6
|
const interfaces_1 = require("../interfaces");
|
7
|
-
types_1.registerTypings();
|
8
|
-
const schema = (cfg) => protos_1.generateSubServiceSchemas(types_1.subServices, cfg, interfaces_1.namespace, 'Invoicing');
|
7
|
+
(0, types_1.registerTypings)();
|
8
|
+
const schema = (cfg) => (0, protos_1.generateSubServiceSchemas)(types_1.subServices, cfg, interfaces_1.namespace, 'Invoicing');
|
9
9
|
exports.schema = schema;
|
@@ -4,7 +4,7 @@ exports.subServices = exports.registerTypings = void 0;
|
|
4
4
|
const invoice_1 = require("@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/invoice");
|
5
5
|
const protos_1 = require("../../../gql/protos");
|
6
6
|
function registerTypings() {
|
7
|
-
protos_1.registerPackagesRecursive(invoice_1.protoMetadata);
|
7
|
+
(0, protos_1.registerPackagesRecursive)(invoice_1.protoMetadata);
|
8
8
|
}
|
9
9
|
exports.registerTypings = registerTypings;
|
10
10
|
exports.subServices = [
|
@@ -7,7 +7,7 @@ const protos_1 = require("../../../gql/protos");
|
|
7
7
|
class InvoicingSrvGrpcClient extends rc_grpc_clients_1.RestoreCommerceGrpcClient {
|
8
8
|
constructor(cfg, logger) {
|
9
9
|
super(cfg, logger);
|
10
|
-
this.invoice = protos_1.getGRPCService(this, invoice_1.protobufPackage, invoice_1.protoMetadata.fileDescriptor.service[0]);
|
10
|
+
this.invoice = (0, protos_1.getGRPCService)(this, invoice_1.protobufPackage, invoice_1.protoMetadata.fileDescriptor.service[0]);
|
11
11
|
}
|
12
12
|
}
|
13
13
|
exports.InvoicingSrvGrpcClient = InvoicingSrvGrpcClient;
|