@restorecommerce/facade 0.3.2 → 0.3.5
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 +31 -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 +44 -45
- 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 +38 -38
- package/dist/gql/protos/types.d.ts +1 -1
- package/dist/gql/protos/utils.d.ts +0 -14
- package/dist/gql/protos/utils.js +16 -40
- 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 +135 -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 +185 -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 +180 -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 +251 -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 +12 -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 +89 -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 +87 -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 +130 -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 +91 -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 +40 -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 +263 -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 +83 -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
@@ -8,10 +8,10 @@ const api_key_1 = require("./api-key/api-key");
|
|
8
8
|
const grpc_1 = require("./grpc");
|
9
9
|
const oauth_1 = require("./oauth/oauth");
|
10
10
|
const mount = eval('require("koa-mount")');
|
11
|
-
exports.identityModule = utils_1.createFacadeModuleFactory('identity', (facade, config) => {
|
11
|
+
exports.identityModule = (0, utils_1.createFacadeModuleFactory)('identity', (facade, config) => {
|
12
12
|
const identitySrvClient = new grpc_1.IdentitySrvGrpcClient(config.identitySrvClientConfig, facade.logger);
|
13
13
|
if (!!config.apiKey) {
|
14
|
-
const apiKey = api_key_1.setupApiKey({
|
14
|
+
const apiKey = (0, api_key_1.setupApiKey)({
|
15
15
|
logger: facade.logger,
|
16
16
|
apiKey: config.apiKey
|
17
17
|
});
|
@@ -21,7 +21,7 @@ exports.identityModule = utils_1.createFacadeModuleFactory('identity', (facade,
|
|
21
21
|
}
|
22
22
|
}
|
23
23
|
if (config.oidc) {
|
24
|
-
const { provider, router } = oidc_1.createOIDC({
|
24
|
+
const { provider, router } = (0, oidc_1.createOIDC)({
|
25
25
|
identitySrvClient,
|
26
26
|
env: facade.env,
|
27
27
|
logger: facade.logger,
|
@@ -31,7 +31,7 @@ exports.identityModule = utils_1.createFacadeModuleFactory('identity', (facade,
|
|
31
31
|
facade.koa.use(mount(provider.app));
|
32
32
|
}
|
33
33
|
if (config.oauth) {
|
34
|
-
facade.koa.use(oauth_1.createOAuth().routes());
|
34
|
+
facade.koa.use((0, oauth_1.createOAuth)().routes());
|
35
35
|
}
|
36
36
|
const identity = {
|
37
37
|
client: identitySrvClient
|
@@ -39,7 +39,7 @@ exports.identityModule = utils_1.createFacadeModuleFactory('identity', (facade,
|
|
39
39
|
facade.koa.context.identitySrvClient = identitySrvClient;
|
40
40
|
facade.addApolloService({
|
41
41
|
name: 'identity',
|
42
|
-
schema: federation_1.FederatedResourceSchema(config.config)
|
42
|
+
schema: (0, federation_1.FederatedResourceSchema)(config.config)
|
43
43
|
});
|
44
44
|
facade.koa.use(async (ctx, next) => {
|
45
45
|
ctx.identity = identity;
|
@@ -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,21 @@ 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']>>;
|
56
|
+
/** target scope */
|
57
|
+
scope?: InputMaybe<Scalars['String']>;
|
57
58
|
};
|
58
59
|
export declare type WithIndex<TObject> = TObject & Record<string, any>;
|
59
60
|
export declare type ResolversObject<TObject> = WithIndex<TObject>;
|
60
61
|
export declare type ResolverTypeWrapper<T> = Promise<T> | T;
|
61
|
-
export declare type
|
62
|
+
export declare type ResolverWithResolve<TResult, TParent, TContext, TArgs> = {
|
63
|
+
resolve: ResolverFn<TResult, TParent, TContext, TArgs>;
|
64
|
+
};
|
65
|
+
export declare type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = ResolverFn<TResult, TParent, TContext, TArgs> | ResolverWithResolve<TResult, TParent, TContext, TArgs>;
|
62
66
|
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) =>
|
67
|
+
export declare type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => AsyncIterable<TResult> | Promise<AsyncIterable<TResult>>;
|
64
68
|
export declare type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = (parent: TParent, args: TArgs, context: TContext, info: GraphQLResolveInfo) => TResult | Promise<TResult>;
|
65
69
|
export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> {
|
66
70
|
subscribe: SubscriptionSubscribeFn<{
|
@@ -135,8 +139,3 @@ export declare type Resolvers<ContextType = IndexingContext> = ResolversObject<{
|
|
135
139
|
GoogleProtobufAny?: GoogleProtobufAnyResolvers<ContextType>;
|
136
140
|
TodoScalar?: GraphQLScalarType;
|
137
141
|
}>;
|
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;
|