@telia-ace/alliance-internal-node-utilities 1.0.3 → 1.0.4-next.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +445 -252
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +128 -0
- package/dist/index.d.ts +127 -8
- package/dist/{index.mjs → index.js} +406 -209
- package/dist/index.js.map +1 -0
- package/package.json +23 -23
- package/dist/auth/auth.middleware.d.ts +0 -14
- package/dist/auth/index.d.ts +0 -2
- package/dist/auth/tokens.d.ts +0 -19
- package/dist/constants/config.d.ts +0 -10
- package/dist/constants/headers.d.ts +0 -5
- package/dist/constants/index.d.ts +0 -2
- package/dist/distribution/cookie-policy.d.ts +0 -2
- package/dist/distribution/create-public-files.d.ts +0 -1
- package/dist/distribution/index.d.ts +0 -1
- package/dist/distribution/json-schemas.d.ts +0 -7
- package/dist/distribution/pkg-json.d.ts +0 -13
- package/dist/exceptions/alliance-gql.exception.d.ts +0 -7
- package/dist/exceptions/alliance.exception.d.ts +0 -7
- package/dist/exceptions/codes.d.ts +0 -35
- package/dist/exceptions/exception.filter.d.ts +0 -5
- package/dist/exceptions/index.d.ts +0 -4
- package/dist/get-app-manifests.d.ts +0 -2
- package/dist/logging/index.d.ts +0 -2
- package/dist/logging/logging.module.d.ts +0 -9
- package/dist/logging/logging.service.d.ts +0 -12
- package/dist/slugify.d.ts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/vite-css-import.plugin.d.ts +0 -2
package/dist/index.cjs
CHANGED
|
@@ -1,25 +1,201 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
var nestjsPino = require('nestjs-pino');
|
|
4
|
+
var expressSession = require('express-session');
|
|
5
|
+
var expressOpenidConnect = require('express-openid-connect');
|
|
6
|
+
var redis = require('redis');
|
|
7
|
+
var jsonwebtoken = require('jsonwebtoken');
|
|
8
|
+
var jsonschema = require('jsonschema');
|
|
9
|
+
var fs = require('fs');
|
|
10
|
+
var path = require('path');
|
|
11
|
+
var graphql = require('graphql');
|
|
12
|
+
var common = require('@nestjs/common');
|
|
13
|
+
var config = require('@nestjs/config');
|
|
14
|
+
var _slugify = require('slugify');
|
|
15
|
+
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
|
|
18
|
+
var _slugify__default = /*#__PURE__*/_interopDefault(_slugify);
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
var __defProp = Object.defineProperty;
|
|
21
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
22
|
+
var noop = /* @__PURE__ */ __name((_err, _data) => {
|
|
23
|
+
}, "noop");
|
|
24
|
+
var RedisStore = class RedisStore2 extends expressSession.Store {
|
|
25
|
+
static {
|
|
26
|
+
__name(this, "RedisStore");
|
|
27
|
+
}
|
|
28
|
+
constructor(opts) {
|
|
29
|
+
super();
|
|
30
|
+
this.prefix = opts.prefix == null ? "sess:" : opts.prefix;
|
|
31
|
+
this.scanCount = opts.scanCount || 100;
|
|
32
|
+
this.serializer = opts.serializer || JSON;
|
|
33
|
+
this.ttl = opts.ttl || 86400;
|
|
34
|
+
this.disableTTL = opts.disableTTL || false;
|
|
35
|
+
this.disableTouch = opts.disableTouch || false;
|
|
36
|
+
this.client = this.normalizeClient(opts.client);
|
|
37
|
+
}
|
|
38
|
+
// Create a redis and ioredis compatible client
|
|
39
|
+
normalizeClient(client) {
|
|
40
|
+
let isRedis = "scanIterator" in client;
|
|
41
|
+
return {
|
|
42
|
+
get: (key) => client.get(key),
|
|
43
|
+
set: (key, val, ttl) => {
|
|
44
|
+
if (ttl) {
|
|
45
|
+
return isRedis ? client.set(key, val, {
|
|
46
|
+
EX: ttl
|
|
47
|
+
}) : client.set(key, val, "EX", ttl);
|
|
48
|
+
}
|
|
49
|
+
return client.set(key, val);
|
|
50
|
+
},
|
|
51
|
+
del: (key) => client.del(key),
|
|
52
|
+
expire: (key, ttl) => client.expire(key, ttl),
|
|
53
|
+
mget: (keys) => isRedis ? client.mGet(keys) : client.mget(keys),
|
|
54
|
+
scanIterator: (match, count) => {
|
|
55
|
+
if (isRedis)
|
|
56
|
+
return client.scanIterator({
|
|
57
|
+
MATCH: match,
|
|
58
|
+
COUNT: count
|
|
59
|
+
});
|
|
60
|
+
return async function* () {
|
|
61
|
+
let [c, xs] = await client.scan("0", "MATCH", match, "COUNT", count);
|
|
62
|
+
for (let key of xs)
|
|
63
|
+
yield key;
|
|
64
|
+
while (c !== "0") {
|
|
65
|
+
[c, xs] = await client.scan(c, "MATCH", match, "COUNT", count);
|
|
66
|
+
for (let key of xs)
|
|
67
|
+
yield key;
|
|
68
|
+
}
|
|
69
|
+
}();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
async get(sid, cb = noop) {
|
|
74
|
+
let key = this.prefix + sid;
|
|
75
|
+
try {
|
|
76
|
+
let data = await this.client.get(key);
|
|
77
|
+
if (!data)
|
|
78
|
+
return cb();
|
|
79
|
+
return cb(null, await this.serializer.parse(data));
|
|
80
|
+
} catch (err) {
|
|
81
|
+
return cb(err);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async set(sid, sess, cb = noop) {
|
|
85
|
+
let key = this.prefix + sid;
|
|
86
|
+
let ttl = this._getTTL(sess);
|
|
87
|
+
try {
|
|
88
|
+
let val = this.serializer.stringify(sess);
|
|
89
|
+
if (ttl > 0) {
|
|
90
|
+
if (this.disableTTL)
|
|
91
|
+
await this.client.set(key, val);
|
|
92
|
+
else
|
|
93
|
+
await this.client.set(key, val, ttl);
|
|
94
|
+
return cb();
|
|
95
|
+
} else {
|
|
96
|
+
return this.destroy(sid, cb);
|
|
97
|
+
}
|
|
98
|
+
} catch (err) {
|
|
99
|
+
return cb(err);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async touch(sid, sess, cb = noop) {
|
|
103
|
+
let key = this.prefix + sid;
|
|
104
|
+
if (this.disableTouch || this.disableTTL)
|
|
105
|
+
return cb();
|
|
106
|
+
try {
|
|
107
|
+
await this.client.expire(key, this._getTTL(sess));
|
|
108
|
+
return cb();
|
|
109
|
+
} catch (err) {
|
|
110
|
+
return cb(err);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async destroy(sid, cb = noop) {
|
|
114
|
+
let key = this.prefix + sid;
|
|
115
|
+
try {
|
|
116
|
+
await this.client.del([
|
|
117
|
+
key
|
|
118
|
+
]);
|
|
119
|
+
return cb();
|
|
120
|
+
} catch (err) {
|
|
121
|
+
return cb(err);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async clear(cb = noop) {
|
|
125
|
+
try {
|
|
126
|
+
let keys = await this._getAllKeys();
|
|
127
|
+
if (!keys.length)
|
|
128
|
+
return cb();
|
|
129
|
+
await this.client.del(keys);
|
|
130
|
+
return cb();
|
|
131
|
+
} catch (err) {
|
|
132
|
+
return cb(err);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async length(cb = noop) {
|
|
136
|
+
try {
|
|
137
|
+
let keys = await this._getAllKeys();
|
|
138
|
+
return cb(null, keys.length);
|
|
139
|
+
} catch (err) {
|
|
140
|
+
return cb(err);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async ids(cb = noop) {
|
|
144
|
+
let len = this.prefix.length;
|
|
145
|
+
try {
|
|
146
|
+
let keys = await this._getAllKeys();
|
|
147
|
+
return cb(null, keys.map((k) => k.substring(len)));
|
|
148
|
+
} catch (err) {
|
|
149
|
+
return cb(err);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async all(cb = noop) {
|
|
153
|
+
let len = this.prefix.length;
|
|
154
|
+
try {
|
|
155
|
+
let keys = await this._getAllKeys();
|
|
156
|
+
if (keys.length === 0)
|
|
157
|
+
return cb(null, []);
|
|
158
|
+
let data = await this.client.mget(keys);
|
|
159
|
+
let results = data.reduce((acc, raw, idx) => {
|
|
160
|
+
if (!raw)
|
|
161
|
+
return acc;
|
|
162
|
+
let sess = this.serializer.parse(raw);
|
|
163
|
+
sess.id = keys[idx].substring(len);
|
|
164
|
+
acc.push(sess);
|
|
165
|
+
return acc;
|
|
166
|
+
}, []);
|
|
167
|
+
return cb(null, results);
|
|
168
|
+
} catch (err) {
|
|
169
|
+
return cb(err);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
_getTTL(sess) {
|
|
173
|
+
if (typeof this.ttl === "function") {
|
|
174
|
+
return this.ttl(sess);
|
|
175
|
+
}
|
|
176
|
+
let ttl;
|
|
177
|
+
if (sess && sess.cookie && sess.cookie.expires) {
|
|
178
|
+
let ms = Number(new Date(sess.cookie.expires)) - Date.now();
|
|
179
|
+
ttl = Math.ceil(ms / 1e3);
|
|
180
|
+
} else {
|
|
181
|
+
ttl = this.ttl;
|
|
182
|
+
}
|
|
183
|
+
return ttl;
|
|
184
|
+
}
|
|
185
|
+
async _getAllKeys() {
|
|
186
|
+
let pattern = this.prefix + "*";
|
|
187
|
+
let keys = [];
|
|
188
|
+
for await (let key of this.client.scanIterator(pattern, this.scanCount)) {
|
|
189
|
+
keys.push(key);
|
|
190
|
+
}
|
|
191
|
+
return keys;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var esm_default = RedisStore;
|
|
21
195
|
|
|
22
|
-
|
|
196
|
+
// src/constants/config.ts
|
|
197
|
+
exports.SharedConfigKeys = void 0;
|
|
198
|
+
(function(SharedConfigKeys2) {
|
|
23
199
|
SharedConfigKeys2["AuthCookieName"] = "AUTH_COOKIE_NAME";
|
|
24
200
|
SharedConfigKeys2["AuthCookieSecret"] = "AUTH_COOKIE_SECRET";
|
|
25
201
|
SharedConfigKeys2["DbEndpoint"] = "DB_ENDPOINT";
|
|
@@ -28,33 +204,30 @@ var SharedConfigKeys = /* @__PURE__ */ ((SharedConfigKeys2) => {
|
|
|
28
204
|
SharedConfigKeys2["ServicePort"] = "SERVICE_PORT";
|
|
29
205
|
SharedConfigKeys2["RedisHost"] = "REDIS_HOST";
|
|
30
206
|
SharedConfigKeys2["RedisPassword"] = "REDIS_PASSWORD";
|
|
31
|
-
|
|
32
|
-
})(SharedConfigKeys || {});
|
|
207
|
+
})(exports.SharedConfigKeys || (exports.SharedConfigKeys = {}));
|
|
33
208
|
|
|
34
|
-
|
|
209
|
+
// src/constants/headers.ts
|
|
210
|
+
exports.AllianceHeaders = void 0;
|
|
211
|
+
(function(AllianceHeaders2) {
|
|
35
212
|
AllianceHeaders2["TargetUrl"] = "alliance-target-url";
|
|
36
213
|
AllianceHeaders2["TargetApp"] = "alliance-target-app";
|
|
37
214
|
AllianceHeaders2["TargetWorkspace"] = "alliance-target-workspace";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
function authMiddleware(configService, {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
redisClient.connect().catch(console.error);
|
|
55
|
-
const redisStore = new RedisStore__default({
|
|
56
|
-
client: redisClient
|
|
57
|
-
});
|
|
215
|
+
})(exports.AllianceHeaders || (exports.AllianceHeaders = {}));
|
|
216
|
+
|
|
217
|
+
// src/auth/auth.middleware.ts
|
|
218
|
+
function authMiddleware(configService, { baseURL = "https://127.0.0.1", clientSecret, clientID = " ", authRequired = true, authorizationParams = {}, afterCallback, issuerBaseURL = "https://127.0.0.1", sessionCookiePath } = {}) {
|
|
219
|
+
let store;
|
|
220
|
+
const redisHostUrl = configService.get(exports.SharedConfigKeys.RedisHost);
|
|
221
|
+
if (redisHostUrl) {
|
|
222
|
+
const redisClient = redis.createClient({
|
|
223
|
+
url: configService.getOrThrow(exports.SharedConfigKeys.RedisHost),
|
|
224
|
+
password: configService.get(exports.SharedConfigKeys.RedisPassword)
|
|
225
|
+
});
|
|
226
|
+
redisClient.connect().catch(console.error);
|
|
227
|
+
store = new esm_default({
|
|
228
|
+
client: redisClient
|
|
229
|
+
});
|
|
230
|
+
}
|
|
58
231
|
return expressOpenidConnect.auth({
|
|
59
232
|
baseURL,
|
|
60
233
|
clientSecret,
|
|
@@ -63,50 +236,46 @@ function authMiddleware(configService, {
|
|
|
63
236
|
authorizationParams,
|
|
64
237
|
afterCallback,
|
|
65
238
|
issuerBaseURL,
|
|
66
|
-
secret: configService.getOrThrow(SharedConfigKeys.AuthCookieSecret),
|
|
239
|
+
secret: configService.getOrThrow(exports.SharedConfigKeys.AuthCookieSecret),
|
|
67
240
|
session: {
|
|
68
|
-
name: configService.getOrThrow(SharedConfigKeys.AuthCookieName),
|
|
69
|
-
|
|
241
|
+
name: configService.getOrThrow(exports.SharedConfigKeys.AuthCookieName),
|
|
242
|
+
// @ts-ignore
|
|
243
|
+
store,
|
|
244
|
+
cookie: {
|
|
245
|
+
path: sessionCookiePath
|
|
246
|
+
}
|
|
70
247
|
},
|
|
71
248
|
routes: {
|
|
72
249
|
callback: "/signin-oidc"
|
|
73
250
|
}
|
|
74
251
|
});
|
|
75
252
|
}
|
|
76
|
-
|
|
77
|
-
function createBearerToken({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"https://alliance.teliacompany.net/workspace_name": workspace.name,
|
|
95
|
-
"https://alliance.teliacompany.net/tenant": workspace.slug,
|
|
96
|
-
"https://alliance.teliacompany.net/tenant_name": workspace.name
|
|
97
|
-
},
|
|
98
|
-
privateKey,
|
|
99
|
-
{
|
|
100
|
-
expiresIn: "1h",
|
|
101
|
-
algorithm: "RS256"
|
|
102
|
-
}
|
|
103
|
-
);
|
|
253
|
+
__name(authMiddleware, "authMiddleware");
|
|
254
|
+
function createBearerToken({ privateKey, aud, sub, name, user, workspace }) {
|
|
255
|
+
const jwt = jsonwebtoken.sign({
|
|
256
|
+
iss: "Alliance",
|
|
257
|
+
aud,
|
|
258
|
+
sub,
|
|
259
|
+
name,
|
|
260
|
+
"https://alliance.teliacompany.net/user_type": user.type,
|
|
261
|
+
"https://alliance.teliacompany.net/user_email": user.email,
|
|
262
|
+
"https://alliance.teliacompany.net/user_privileges": user.permissions,
|
|
263
|
+
"https://alliance.teliacompany.net/workspace": workspace.slug,
|
|
264
|
+
"https://alliance.teliacompany.net/workspace_name": workspace.name,
|
|
265
|
+
"https://alliance.teliacompany.net/tenant": workspace.slug,
|
|
266
|
+
"https://alliance.teliacompany.net/tenant_name": workspace.name
|
|
267
|
+
}, privateKey, {
|
|
268
|
+
expiresIn: "1h",
|
|
269
|
+
algorithm: "RS256"
|
|
270
|
+
});
|
|
104
271
|
return `Bearer ${jwt}`;
|
|
105
272
|
}
|
|
273
|
+
__name(createBearerToken, "createBearerToken");
|
|
106
274
|
function getPrivateKey(configService) {
|
|
107
|
-
const privateKey = configService.getOrThrow(SharedConfigKeys.JwtPrivateKey);
|
|
275
|
+
const privateKey = configService.getOrThrow(exports.SharedConfigKeys.JwtPrivateKey);
|
|
108
276
|
return "-----BEGIN RSA PRIVATE KEY-----\n" + privateKey + "\n-----END RSA PRIVATE KEY-----";
|
|
109
277
|
}
|
|
278
|
+
__name(getPrivateKey, "getPrivateKey");
|
|
110
279
|
function createSystemUserToken(configService) {
|
|
111
280
|
return createBearerToken({
|
|
112
281
|
aud: "system",
|
|
@@ -118,12 +287,15 @@ function createSystemUserToken(configService) {
|
|
|
118
287
|
},
|
|
119
288
|
user: {
|
|
120
289
|
type: "system",
|
|
121
|
-
permissions: []
|
|
290
|
+
permissions: [],
|
|
291
|
+
email: "system"
|
|
122
292
|
},
|
|
123
293
|
privateKey: getPrivateKey(configService)
|
|
124
294
|
});
|
|
125
295
|
}
|
|
296
|
+
__name(createSystemUserToken, "createSystemUserToken");
|
|
126
297
|
|
|
298
|
+
// src/distribution/cookie-policy.ts
|
|
127
299
|
function generateCookiePolicyHtml(appManifests) {
|
|
128
300
|
const cookiePolicyTableRows = [];
|
|
129
301
|
for (const appName in appManifests) {
|
|
@@ -138,8 +310,11 @@ function generateCookiePolicyHtml(appManifests) {
|
|
|
138
310
|
}
|
|
139
311
|
return cookiePolicyHtml.replace("{APP_COOKIES}", cookiePolicyTableRows.join(""));
|
|
140
312
|
}
|
|
313
|
+
__name(generateCookiePolicyHtml, "generateCookiePolicyHtml");
|
|
141
314
|
function createCookiePolicyTableRow(key, claimEntry) {
|
|
142
|
-
const rows = [
|
|
315
|
+
const rows = [
|
|
316
|
+
"<tr>"
|
|
317
|
+
];
|
|
143
318
|
const { category, purpose, lifespan } = claimEntry;
|
|
144
319
|
rows.push(`<td>${key}</td>`);
|
|
145
320
|
rows.push(`<td>${category}</td>`);
|
|
@@ -148,7 +323,8 @@ function createCookiePolicyTableRow(key, claimEntry) {
|
|
|
148
323
|
rows.push("</tr>");
|
|
149
324
|
return rows.join("");
|
|
150
325
|
}
|
|
151
|
-
|
|
326
|
+
__name(createCookiePolicyTableRow, "createCookiePolicyTableRow");
|
|
327
|
+
var cookiePolicyHtml = `
|
|
152
328
|
<!DOCTYPE html>
|
|
153
329
|
<html lang="en">
|
|
154
330
|
<head>
|
|
@@ -436,18 +612,12 @@ const cookiePolicyHtml = `
|
|
|
436
612
|
</body>
|
|
437
613
|
</html>
|
|
438
614
|
`;
|
|
439
|
-
|
|
440
615
|
function getJsonSchemas() {
|
|
441
|
-
const frameworkDistDirPath =
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
);
|
|
447
|
-
const appConfigSchemaPath = node_path.resolve(frameworkDistDirPath, "config.schema.json");
|
|
448
|
-
const appManifestSchemaPath = node_path.resolve(frameworkDistDirPath, "manifest.schema.json");
|
|
449
|
-
const appConfigSchemaFile = node_fs.readFileSync(appConfigSchemaPath).toString();
|
|
450
|
-
const appManifestSchemaFile = node_fs.readFileSync(appManifestSchemaPath).toString();
|
|
616
|
+
const frameworkDistDirPath = path.resolve(process.cwd(), "node_modules", "@telia-ace/alliance-framework", "dist");
|
|
617
|
+
const appConfigSchemaPath = path.resolve(frameworkDistDirPath, "config.schema.json");
|
|
618
|
+
const appManifestSchemaPath = path.resolve(frameworkDistDirPath, "manifest.schema.json");
|
|
619
|
+
const appConfigSchemaFile = fs.readFileSync(appConfigSchemaPath).toString();
|
|
620
|
+
const appManifestSchemaFile = fs.readFileSync(appManifestSchemaPath).toString();
|
|
451
621
|
const appConfig = JSON.parse(appConfigSchemaFile);
|
|
452
622
|
const appManifest = JSON.parse(appManifestSchemaFile);
|
|
453
623
|
return {
|
|
@@ -455,14 +625,17 @@ function getJsonSchemas() {
|
|
|
455
625
|
appManifest
|
|
456
626
|
};
|
|
457
627
|
}
|
|
458
|
-
|
|
628
|
+
__name(getJsonSchemas, "getJsonSchemas");
|
|
459
629
|
async function createTempModuleAndImport(moduleString, fileName) {
|
|
460
|
-
const file =
|
|
461
|
-
|
|
630
|
+
const file = path.resolve(process.cwd(), `${fileName}.mjs`);
|
|
631
|
+
fs.writeFileSync(file, moduleString);
|
|
462
632
|
const importedModule = await import(`file:///${file}`);
|
|
463
|
-
|
|
633
|
+
fs.rmSync(file, {
|
|
634
|
+
force: true
|
|
635
|
+
});
|
|
464
636
|
return importedModule;
|
|
465
637
|
}
|
|
638
|
+
__name(createTempModuleAndImport, "createTempModuleAndImport");
|
|
466
639
|
async function getAppManifests(apps) {
|
|
467
640
|
const moduleStringParts = [];
|
|
468
641
|
const manifestImportVariables = [];
|
|
@@ -472,18 +645,18 @@ async function getAppManifests(apps) {
|
|
|
472
645
|
moduleStringParts.push(`import ${manifestImportVariable} from '${packageName}/manifest';`);
|
|
473
646
|
}
|
|
474
647
|
moduleStringParts.push(`export default [${manifestImportVariables.join(", ")}];`);
|
|
475
|
-
const result = await createTempModuleAndImport(
|
|
476
|
-
moduleStringParts.join("\n"),
|
|
477
|
-
"app-manifests"
|
|
478
|
-
);
|
|
648
|
+
const result = await createTempModuleAndImport(moduleStringParts.join("\n"), "app-manifests");
|
|
479
649
|
return result.default;
|
|
480
650
|
}
|
|
651
|
+
__name(getAppManifests, "getAppManifests");
|
|
481
652
|
|
|
653
|
+
// src/distribution/pkg-json.ts
|
|
482
654
|
function getPkgJson() {
|
|
483
|
-
const packageJson =
|
|
484
|
-
const pkgJsonFile =
|
|
655
|
+
const packageJson = path.resolve(process.cwd(), "package.json");
|
|
656
|
+
const pkgJsonFile = fs.readFileSync(packageJson).toString();
|
|
485
657
|
return JSON.parse(pkgJsonFile);
|
|
486
658
|
}
|
|
659
|
+
__name(getPkgJson, "getPkgJson");
|
|
487
660
|
async function getManifests(pkgJson) {
|
|
488
661
|
if (!pkgJson || !pkgJson.alliance || !pkgJson.alliance.apps) {
|
|
489
662
|
throw new Error("Alliance apps not defined in package.json.");
|
|
@@ -494,12 +667,14 @@ async function getManifests(pkgJson) {
|
|
|
494
667
|
return acc;
|
|
495
668
|
}, {});
|
|
496
669
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
670
|
+
__name(getManifests, "getManifests");
|
|
671
|
+
|
|
672
|
+
// src/distribution/create-public-files.ts
|
|
673
|
+
var PUBLIC_DIR_NAME = "public";
|
|
674
|
+
var MANIFESTS_FILE_NAME = "manifests.json";
|
|
675
|
+
var COOKIE_POLICY_FILE_NAME = "cookie-policy.html";
|
|
676
|
+
var APP_CONFIG_SCHEMA_FILE_NAME = "config.schema.json";
|
|
677
|
+
var APP_MANIFEST_SCHEMA_FILE_NAME = "manifest.schema.json";
|
|
503
678
|
async function createPublicDistributionFiles() {
|
|
504
679
|
const pkgJson = getPkgJson();
|
|
505
680
|
const manifests = await getManifests(pkgJson);
|
|
@@ -509,29 +684,26 @@ async function createPublicDistributionFiles() {
|
|
|
509
684
|
const validationResult = jsonschema.validate(manifest, schemas.appManifest);
|
|
510
685
|
if (validationResult.errors.length) {
|
|
511
686
|
const errors = validationResult.errors.map((e) => JSON.stringify(e, null, 2));
|
|
512
|
-
throw new Error(
|
|
513
|
-
|
|
514
|
-
${errors.join(
|
|
515
|
-
"\n"
|
|
516
|
-
)}`
|
|
517
|
-
);
|
|
687
|
+
throw new Error(`Validation of app manifest for app '${appName}' failed with the following errors:
|
|
688
|
+
${errors.join("\n")}`);
|
|
518
689
|
}
|
|
519
690
|
}
|
|
520
|
-
const publicDirPath =
|
|
521
|
-
if (!
|
|
522
|
-
|
|
691
|
+
const publicDirPath = path.resolve(process.cwd(), PUBLIC_DIR_NAME);
|
|
692
|
+
if (!fs.existsSync(publicDirPath)) {
|
|
693
|
+
fs.mkdirSync(publicDirPath);
|
|
523
694
|
}
|
|
524
|
-
const manifestsFilePath =
|
|
525
|
-
|
|
526
|
-
const cookiePolicyFilePath =
|
|
527
|
-
|
|
528
|
-
const appConfigSchemaFilePath =
|
|
529
|
-
const appManifestSchemaFilePath =
|
|
530
|
-
|
|
531
|
-
|
|
695
|
+
const manifestsFilePath = path.resolve(publicDirPath, MANIFESTS_FILE_NAME);
|
|
696
|
+
fs.writeFileSync(manifestsFilePath, JSON.stringify(manifests));
|
|
697
|
+
const cookiePolicyFilePath = path.resolve(publicDirPath, COOKIE_POLICY_FILE_NAME);
|
|
698
|
+
fs.writeFileSync(cookiePolicyFilePath, generateCookiePolicyHtml(manifests));
|
|
699
|
+
const appConfigSchemaFilePath = path.resolve(publicDirPath, APP_CONFIG_SCHEMA_FILE_NAME);
|
|
700
|
+
const appManifestSchemaFilePath = path.resolve(publicDirPath, APP_MANIFEST_SCHEMA_FILE_NAME);
|
|
701
|
+
fs.writeFileSync(appConfigSchemaFilePath, JSON.stringify(schemas.appConfig));
|
|
702
|
+
fs.writeFileSync(appManifestSchemaFilePath, JSON.stringify(schemas.appManifest));
|
|
532
703
|
}
|
|
533
|
-
|
|
534
|
-
|
|
704
|
+
__name(createPublicDistributionFiles, "createPublicDistributionFiles");
|
|
705
|
+
exports.GatewayErrorCodes = void 0;
|
|
706
|
+
(function(GatewayErrorCodes2) {
|
|
535
707
|
GatewayErrorCodes2[GatewayErrorCodes2["NoObjectId"] = 10001] = "NoObjectId";
|
|
536
708
|
GatewayErrorCodes2[GatewayErrorCodes2["NoTargetAppHeader"] = 10002] = "NoTargetAppHeader";
|
|
537
709
|
GatewayErrorCodes2[GatewayErrorCodes2["NoTargetWorkspaceHeader"] = 10003] = "NoTargetWorkspaceHeader";
|
|
@@ -544,145 +716,158 @@ var GatewayErrorCodes = /* @__PURE__ */ ((GatewayErrorCodes2) => {
|
|
|
544
716
|
GatewayErrorCodes2[GatewayErrorCodes2["NoWorkspaceInRequestContext"] = 10010] = "NoWorkspaceInRequestContext";
|
|
545
717
|
GatewayErrorCodes2[GatewayErrorCodes2["NoUserPermissionsInRequestContext"] = 10012] = "NoUserPermissionsInRequestContext";
|
|
546
718
|
GatewayErrorCodes2[GatewayErrorCodes2["WorkspacePermissionDenied"] = 10013] = "WorkspacePermissionDenied";
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
719
|
+
})(exports.GatewayErrorCodes || (exports.GatewayErrorCodes = {}));
|
|
720
|
+
exports.DatabasesErrorCodes = void 0;
|
|
721
|
+
(function(DatabasesErrorCodes2) {
|
|
550
722
|
DatabasesErrorCodes2[DatabasesErrorCodes2["NoPublicKey"] = 11e3] = "NoPublicKey";
|
|
551
723
|
DatabasesErrorCodes2[DatabasesErrorCodes2["NoAuthHeader"] = 11001] = "NoAuthHeader";
|
|
552
724
|
DatabasesErrorCodes2[DatabasesErrorCodes2["FailedFileStore"] = 11002] = "FailedFileStore";
|
|
553
725
|
DatabasesErrorCodes2[DatabasesErrorCodes2["FailedFileRead"] = 11003] = "FailedFileRead";
|
|
554
726
|
DatabasesErrorCodes2[DatabasesErrorCodes2["NoRecord"] = 11004] = "NoRecord";
|
|
555
727
|
DatabasesErrorCodes2[DatabasesErrorCodes2["UniqueConstrain"] = 11005] = "UniqueConstrain";
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
728
|
+
})(exports.DatabasesErrorCodes || (exports.DatabasesErrorCodes = {}));
|
|
729
|
+
exports.PortalErrorCodes = void 0;
|
|
730
|
+
(function(PortalErrorCodes2) {
|
|
559
731
|
PortalErrorCodes2[PortalErrorCodes2["NoObjectId"] = 12e3] = "NoObjectId";
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
const allianceErrors = {
|
|
732
|
+
})(exports.PortalErrorCodes || (exports.PortalErrorCodes = {}));
|
|
733
|
+
var allianceErrors = {
|
|
563
734
|
// gateway
|
|
564
|
-
[10001
|
|
735
|
+
[10001]: {
|
|
565
736
|
httpCode: common.HttpStatus.UNAUTHORIZED,
|
|
566
737
|
message: "No object id available on authenticated user."
|
|
567
738
|
},
|
|
568
|
-
[10002
|
|
739
|
+
[10002]: {
|
|
569
740
|
httpCode: common.HttpStatus.BAD_REQUEST,
|
|
570
|
-
message: `Request missing header '${AllianceHeaders.TargetApp}'.`
|
|
741
|
+
message: `Request missing header '${exports.AllianceHeaders.TargetApp}'.`
|
|
571
742
|
},
|
|
572
|
-
[10003
|
|
743
|
+
[10003]: {
|
|
573
744
|
httpCode: common.HttpStatus.BAD_REQUEST,
|
|
574
|
-
message: `Request missing header '${AllianceHeaders.TargetWorkspace}'.`
|
|
745
|
+
message: `Request missing header '${exports.AllianceHeaders.TargetWorkspace}'.`
|
|
575
746
|
},
|
|
576
|
-
[10004
|
|
747
|
+
[10004]: {
|
|
577
748
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
578
749
|
message: "App manifests missing in cache."
|
|
579
750
|
},
|
|
580
|
-
[10005
|
|
751
|
+
[10005]: {
|
|
581
752
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
582
753
|
message: "No dev session in memory cache."
|
|
583
754
|
},
|
|
584
|
-
[10006
|
|
755
|
+
[10006]: {
|
|
585
756
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
586
757
|
message: "Could not find manifest for app '{{appSlug}}'."
|
|
587
758
|
},
|
|
588
|
-
[10007
|
|
759
|
+
[10007]: {
|
|
589
760
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
590
761
|
message: "No request context."
|
|
591
762
|
},
|
|
592
|
-
[10008
|
|
763
|
+
[10008]: {
|
|
593
764
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
594
765
|
message: "No user in request context."
|
|
595
766
|
},
|
|
596
|
-
[10009
|
|
767
|
+
[10009]: {
|
|
597
768
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
598
769
|
message: "No app in request context."
|
|
599
770
|
},
|
|
600
|
-
[10010
|
|
771
|
+
[10010]: {
|
|
601
772
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
602
773
|
message: "No workspace in request context."
|
|
603
774
|
},
|
|
604
|
-
[10012
|
|
775
|
+
[10012]: {
|
|
605
776
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
606
777
|
message: "No user permissions in request context."
|
|
607
778
|
},
|
|
608
|
-
[10013
|
|
779
|
+
[10013]: {
|
|
609
780
|
httpCode: common.HttpStatus.FORBIDDEN,
|
|
610
781
|
message: "User does not have access to the current workspace."
|
|
611
782
|
},
|
|
612
783
|
// databases
|
|
613
|
-
[11e3
|
|
784
|
+
[11e3]: {
|
|
614
785
|
httpCode: common.HttpStatus.UNAUTHORIZED,
|
|
615
786
|
message: "No public key available to decode JWT."
|
|
616
787
|
},
|
|
617
|
-
[11001
|
|
788
|
+
[11001]: {
|
|
618
789
|
httpCode: common.HttpStatus.UNAUTHORIZED,
|
|
619
790
|
message: "No authorization header found."
|
|
620
791
|
},
|
|
621
|
-
[11002
|
|
792
|
+
[11002]: {
|
|
622
793
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
623
794
|
message: "Error storing file."
|
|
624
795
|
},
|
|
625
|
-
[11003
|
|
796
|
+
[11003]: {
|
|
626
797
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
627
798
|
message: "Error reading file."
|
|
628
799
|
},
|
|
629
|
-
[11004
|
|
800
|
+
[11004]: {
|
|
630
801
|
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
631
802
|
message: "Missing database record."
|
|
632
803
|
},
|
|
633
|
-
[11005
|
|
804
|
+
[11005]: {
|
|
634
805
|
httpCode: common.HttpStatus.CONFLICT,
|
|
635
806
|
message: "Field has to be unique."
|
|
636
807
|
},
|
|
637
808
|
// portal
|
|
638
|
-
[12e3
|
|
809
|
+
[12e3]: {
|
|
639
810
|
httpCode: common.HttpStatus.UNAUTHORIZED,
|
|
640
811
|
message: "No object id found in user claims."
|
|
641
812
|
}
|
|
642
813
|
};
|
|
643
814
|
|
|
644
|
-
|
|
815
|
+
// src/exceptions/alliance-gql.exception.ts
|
|
816
|
+
function parseTemplates(message, variables) {
|
|
645
817
|
return Object.entries(variables).reduce((acc, [key, value]) => {
|
|
646
818
|
return acc.replaceAll(`{{${key}}}`, value);
|
|
647
819
|
}, message);
|
|
648
820
|
}
|
|
649
|
-
|
|
821
|
+
__name(parseTemplates, "parseTemplates");
|
|
822
|
+
var AllianceGqlException = class extends graphql.GraphQLError {
|
|
823
|
+
static {
|
|
824
|
+
__name(this, "AllianceGqlException");
|
|
825
|
+
}
|
|
826
|
+
info;
|
|
827
|
+
code;
|
|
650
828
|
constructor(code, variables = {}, extensions) {
|
|
651
829
|
const { message } = allianceErrors[code];
|
|
652
|
-
super(parseTemplates
|
|
830
|
+
super(parseTemplates(message, variables), {
|
|
653
831
|
extensions
|
|
654
832
|
});
|
|
655
833
|
this.code = code;
|
|
656
834
|
this.info = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${code}`;
|
|
657
835
|
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
function parseTemplates(message, variables) {
|
|
836
|
+
};
|
|
837
|
+
function parseTemplates2(message, variables) {
|
|
661
838
|
return Object.entries(variables).reduce((acc, [key, value]) => {
|
|
662
839
|
return acc.replaceAll(`{{${key}}}`, value);
|
|
663
840
|
}, message);
|
|
664
841
|
}
|
|
665
|
-
|
|
842
|
+
__name(parseTemplates2, "parseTemplates");
|
|
843
|
+
var AllianceException = class extends common.HttpException {
|
|
844
|
+
static {
|
|
845
|
+
__name(this, "AllianceException");
|
|
846
|
+
}
|
|
847
|
+
info;
|
|
848
|
+
code;
|
|
666
849
|
constructor(code, variables = {}) {
|
|
667
850
|
const { message, httpCode } = allianceErrors[code];
|
|
668
|
-
super(
|
|
851
|
+
super(parseTemplates2(message, variables), httpCode);
|
|
669
852
|
this.code = code;
|
|
670
853
|
this.info = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${code}`;
|
|
671
854
|
}
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
var __defProp$2 = Object.defineProperty;
|
|
675
|
-
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
676
|
-
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
677
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
678
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
679
|
-
if (decorator = decorators[i])
|
|
680
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
681
|
-
if (kind && result)
|
|
682
|
-
__defProp$2(target, key, result);
|
|
683
|
-
return result;
|
|
684
855
|
};
|
|
685
|
-
|
|
856
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
857
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
858
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
859
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
860
|
+
else
|
|
861
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
862
|
+
if (d = decorators[i])
|
|
863
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
864
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
865
|
+
}
|
|
866
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
867
|
+
exports.AllianceExceptionFilter = class AllianceExceptionFilter2 {
|
|
868
|
+
static {
|
|
869
|
+
__name(this, "AllianceExceptionFilter");
|
|
870
|
+
}
|
|
686
871
|
catch(exception, host) {
|
|
687
872
|
const ctx = host.switchToHttp();
|
|
688
873
|
const response = ctx.getResponse();
|
|
@@ -695,23 +880,36 @@ exports.AllianceExceptionFilter = class AllianceExceptionFilter {
|
|
|
695
880
|
});
|
|
696
881
|
}
|
|
697
882
|
};
|
|
698
|
-
exports.AllianceExceptionFilter =
|
|
883
|
+
exports.AllianceExceptionFilter = _ts_decorate([
|
|
699
884
|
common.Catch(AllianceException)
|
|
700
885
|
], exports.AllianceExceptionFilter);
|
|
701
|
-
|
|
702
|
-
var
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
886
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
887
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
888
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
889
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
890
|
+
else
|
|
891
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
892
|
+
if (d = decorators[i])
|
|
893
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
894
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
895
|
+
}
|
|
896
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
897
|
+
function _ts_metadata(k, v) {
|
|
898
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
899
|
+
return Reflect.metadata(k, v);
|
|
900
|
+
}
|
|
901
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
902
|
+
function _ts_param(paramIndex, decorator) {
|
|
903
|
+
return function(target, key) {
|
|
904
|
+
decorator(target, key, paramIndex);
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
__name(_ts_param, "_ts_param");
|
|
908
|
+
exports.LoggerService = class LoggerService2 {
|
|
909
|
+
static {
|
|
910
|
+
__name(this, "LoggerService");
|
|
911
|
+
}
|
|
912
|
+
logger;
|
|
715
913
|
constructor(logger) {
|
|
716
914
|
this.logger = logger;
|
|
717
915
|
this.log = (...args) => this.logger.info(...args);
|
|
@@ -722,35 +920,54 @@ exports.LoggerService = class LoggerService {
|
|
|
722
920
|
this.error = (...args) => this.logger.error(...args);
|
|
723
921
|
this.fatal = (...args) => this.logger.fatal(...args);
|
|
724
922
|
}
|
|
923
|
+
log;
|
|
924
|
+
trace;
|
|
925
|
+
debug;
|
|
926
|
+
info;
|
|
927
|
+
warn;
|
|
928
|
+
error;
|
|
929
|
+
fatal;
|
|
725
930
|
};
|
|
726
|
-
exports.LoggerService =
|
|
931
|
+
exports.LoggerService = _ts_decorate2([
|
|
727
932
|
common.Injectable(),
|
|
728
|
-
|
|
933
|
+
_ts_param(0, nestjsPino.InjectPinoLogger()),
|
|
934
|
+
_ts_metadata("design:type", Function),
|
|
935
|
+
_ts_metadata("design:paramtypes", [
|
|
936
|
+
typeof nestjsPino.PinoLogger === "undefined" ? Object : nestjsPino.PinoLogger
|
|
937
|
+
])
|
|
729
938
|
], exports.LoggerService);
|
|
730
939
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
var
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
return
|
|
741
|
-
}
|
|
742
|
-
|
|
940
|
+
// src/logging/logging.module.ts
|
|
941
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
942
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
943
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
944
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
945
|
+
else
|
|
946
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
947
|
+
if (d = decorators[i])
|
|
948
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
949
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
950
|
+
}
|
|
951
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
952
|
+
exports.LoggerModule = class LoggerModule2 {
|
|
953
|
+
static {
|
|
954
|
+
__name(this, "LoggerModule");
|
|
955
|
+
}
|
|
743
956
|
static forRoot({ logLevel, redact = true } = {}) {
|
|
744
957
|
return {
|
|
745
|
-
module:
|
|
958
|
+
module: LoggerModule2,
|
|
746
959
|
controllers: [],
|
|
747
960
|
imports: [
|
|
748
961
|
nestjsPino.LoggerModule.forRootAsync({
|
|
749
|
-
imports: [
|
|
750
|
-
|
|
962
|
+
imports: [
|
|
963
|
+
config.ConfigModule
|
|
964
|
+
],
|
|
965
|
+
inject: [
|
|
966
|
+
config.ConfigService
|
|
967
|
+
],
|
|
751
968
|
useFactory: async (configService) => ({
|
|
752
969
|
pinoHttp: {
|
|
753
|
-
level: logLevel || configService.get(SharedConfigKeys.ServiceLogLevel) || "silent",
|
|
970
|
+
level: logLevel || configService.get(exports.SharedConfigKeys.ServiceLogLevel) || "silent",
|
|
754
971
|
redact: redact ? [
|
|
755
972
|
"authorization",
|
|
756
973
|
"headers.authorization",
|
|
@@ -762,63 +979,38 @@ exports.LoggerModule = class LoggerModule {
|
|
|
762
979
|
})
|
|
763
980
|
],
|
|
764
981
|
global: true,
|
|
765
|
-
providers: [
|
|
982
|
+
providers: [
|
|
983
|
+
exports.LoggerService
|
|
984
|
+
],
|
|
766
985
|
exports: []
|
|
767
986
|
};
|
|
768
987
|
}
|
|
769
988
|
};
|
|
770
|
-
exports.LoggerModule =
|
|
989
|
+
exports.LoggerModule = _ts_decorate3([
|
|
771
990
|
common.Module({
|
|
772
|
-
providers: [
|
|
773
|
-
|
|
991
|
+
providers: [
|
|
992
|
+
exports.LoggerService
|
|
993
|
+
],
|
|
994
|
+
exports: [
|
|
995
|
+
exports.LoggerService
|
|
996
|
+
]
|
|
774
997
|
})
|
|
775
998
|
], exports.LoggerModule);
|
|
776
|
-
|
|
777
999
|
function slugify(name) {
|
|
778
|
-
return _slugify__default(name, {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
name: "vite-plugin-css-import",
|
|
784
|
-
apply: "build",
|
|
785
|
-
enforce: "post",
|
|
786
|
-
writeBundle: async (_, bundle) => {
|
|
787
|
-
const cssFiles = Object.keys(bundle).filter((fileName) => fileName.endsWith(".css"));
|
|
788
|
-
if (!cssFiles.length) {
|
|
789
|
-
return;
|
|
790
|
-
}
|
|
791
|
-
const tempTargetFilePath = node_path.resolve(process.cwd(), `${outFilePath}-temp.js`);
|
|
792
|
-
const targetFilePath = node_path.resolve(process.cwd(), `${outFilePath}.js`);
|
|
793
|
-
const cssImportStatement = cssFiles.reduce((acc, cssFile) => {
|
|
794
|
-
if (relativePath) {
|
|
795
|
-
const targetDirname = node_path.dirname(targetFilePath);
|
|
796
|
-
const relativePath2 = node_path.relative(targetDirname, cssFile);
|
|
797
|
-
return `${acc}import "${relativePath2.replaceAll("\\", "/")}";
|
|
798
|
-
`;
|
|
799
|
-
}
|
|
800
|
-
return `${acc}import "./${cssFile}";
|
|
801
|
-
`;
|
|
802
|
-
}, "");
|
|
803
|
-
const writeStream = node_fs.createWriteStream(tempTargetFilePath);
|
|
804
|
-
writeStream.write(cssImportStatement, "utf8");
|
|
805
|
-
const readStream = node_fs.createReadStream(targetFilePath);
|
|
806
|
-
await promises.pipeline(readStream, writeStream);
|
|
807
|
-
node_fs.rmSync(targetFilePath, { force: true });
|
|
808
|
-
node_fs.renameSync(tempTargetFilePath, targetFilePath);
|
|
809
|
-
writeStream.end();
|
|
810
|
-
}
|
|
811
|
-
};
|
|
1000
|
+
return _slugify__default.default(name, {
|
|
1001
|
+
strict: true,
|
|
1002
|
+
replacement: "-",
|
|
1003
|
+
lower: true
|
|
1004
|
+
});
|
|
812
1005
|
}
|
|
1006
|
+
__name(slugify, "slugify");
|
|
813
1007
|
|
|
814
|
-
exports
|
|
1008
|
+
Object.defineProperty(exports, 'LoggerErrorInterceptor', {
|
|
1009
|
+
enumerable: true,
|
|
1010
|
+
get: function () { return nestjsPino.LoggerErrorInterceptor; }
|
|
1011
|
+
});
|
|
815
1012
|
exports.AllianceException = AllianceException;
|
|
816
1013
|
exports.AllianceGqlException = AllianceGqlException;
|
|
817
|
-
exports.AllianceHeaders = AllianceHeaders;
|
|
818
|
-
exports.DatabasesErrorCodes = DatabasesErrorCodes;
|
|
819
|
-
exports.GatewayErrorCodes = GatewayErrorCodes;
|
|
820
|
-
exports.PortalErrorCodes = PortalErrorCodes;
|
|
821
|
-
exports.SharedConfigKeys = SharedConfigKeys;
|
|
822
1014
|
exports.authMiddleware = authMiddleware;
|
|
823
1015
|
exports.createBearerToken = createBearerToken;
|
|
824
1016
|
exports.createPublicDistributionFiles = createPublicDistributionFiles;
|
|
@@ -826,4 +1018,5 @@ exports.createSystemUserToken = createSystemUserToken;
|
|
|
826
1018
|
exports.getAppManifests = getAppManifests;
|
|
827
1019
|
exports.getPrivateKey = getPrivateKey;
|
|
828
1020
|
exports.slugify = slugify;
|
|
829
|
-
|
|
1021
|
+
//# sourceMappingURL=out.js.map
|
|
1022
|
+
//# sourceMappingURL=index.cjs.map
|