@telia-ace/alliance-internal-node-utilities 1.0.5-next.0 → 1.0.5-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/dist/index.cjs DELETED
@@ -1,1074 +0,0 @@
1
- 'use strict';
2
-
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 zod = require('zod');
8
- var jsonwebtoken = require('jsonwebtoken');
9
- var jsonschema = require('jsonschema');
10
- var fs = require('fs');
11
- var path = require('path');
12
- var graphql = require('graphql');
13
- var common = require('@nestjs/common');
14
- var config = require('@nestjs/config');
15
- var terminus = require('@nestjs/terminus');
16
- var _slugify = require('slugify');
17
-
18
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
-
20
- var _slugify__default = /*#__PURE__*/_interopDefault(_slugify);
21
-
22
- var __defProp = Object.defineProperty;
23
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
24
- var noop = /* @__PURE__ */ __name((_err, _data) => {
25
- }, "noop");
26
- var RedisStore = class RedisStore2 extends expressSession.Store {
27
- static {
28
- __name(this, "RedisStore");
29
- }
30
- constructor(opts) {
31
- super();
32
- this.prefix = opts.prefix == null ? "sess:" : opts.prefix;
33
- this.scanCount = opts.scanCount || 100;
34
- this.serializer = opts.serializer || JSON;
35
- this.ttl = opts.ttl || 86400;
36
- this.disableTTL = opts.disableTTL || false;
37
- this.disableTouch = opts.disableTouch || false;
38
- this.client = this.normalizeClient(opts.client);
39
- }
40
- // Create a redis and ioredis compatible client
41
- normalizeClient(client) {
42
- let isRedis = "scanIterator" in client;
43
- return {
44
- get: (key) => client.get(key),
45
- set: (key, val, ttl) => {
46
- if (ttl) {
47
- return isRedis ? client.set(key, val, {
48
- EX: ttl
49
- }) : client.set(key, val, "EX", ttl);
50
- }
51
- return client.set(key, val);
52
- },
53
- del: (key) => client.del(key),
54
- expire: (key, ttl) => client.expire(key, ttl),
55
- mget: (keys) => isRedis ? client.mGet(keys) : client.mget(keys),
56
- scanIterator: (match, count) => {
57
- if (isRedis)
58
- return client.scanIterator({
59
- MATCH: match,
60
- COUNT: count
61
- });
62
- return async function* () {
63
- let [c, xs] = await client.scan("0", "MATCH", match, "COUNT", count);
64
- for (let key of xs)
65
- yield key;
66
- while (c !== "0") {
67
- [c, xs] = await client.scan(c, "MATCH", match, "COUNT", count);
68
- for (let key of xs)
69
- yield key;
70
- }
71
- }();
72
- }
73
- };
74
- }
75
- async get(sid, cb = noop) {
76
- let key = this.prefix + sid;
77
- try {
78
- let data = await this.client.get(key);
79
- if (!data)
80
- return cb();
81
- return cb(null, await this.serializer.parse(data));
82
- } catch (err) {
83
- return cb(err);
84
- }
85
- }
86
- async set(sid, sess, cb = noop) {
87
- let key = this.prefix + sid;
88
- let ttl = this._getTTL(sess);
89
- try {
90
- let val = this.serializer.stringify(sess);
91
- if (ttl > 0) {
92
- if (this.disableTTL)
93
- await this.client.set(key, val);
94
- else
95
- await this.client.set(key, val, ttl);
96
- return cb();
97
- } else {
98
- return this.destroy(sid, cb);
99
- }
100
- } catch (err) {
101
- return cb(err);
102
- }
103
- }
104
- async touch(sid, sess, cb = noop) {
105
- let key = this.prefix + sid;
106
- if (this.disableTouch || this.disableTTL)
107
- return cb();
108
- try {
109
- await this.client.expire(key, this._getTTL(sess));
110
- return cb();
111
- } catch (err) {
112
- return cb(err);
113
- }
114
- }
115
- async destroy(sid, cb = noop) {
116
- let key = this.prefix + sid;
117
- try {
118
- await this.client.del([
119
- key
120
- ]);
121
- return cb();
122
- } catch (err) {
123
- return cb(err);
124
- }
125
- }
126
- async clear(cb = noop) {
127
- try {
128
- let keys = await this._getAllKeys();
129
- if (!keys.length)
130
- return cb();
131
- await this.client.del(keys);
132
- return cb();
133
- } catch (err) {
134
- return cb(err);
135
- }
136
- }
137
- async length(cb = noop) {
138
- try {
139
- let keys = await this._getAllKeys();
140
- return cb(null, keys.length);
141
- } catch (err) {
142
- return cb(err);
143
- }
144
- }
145
- async ids(cb = noop) {
146
- let len = this.prefix.length;
147
- try {
148
- let keys = await this._getAllKeys();
149
- return cb(null, keys.map((k) => k.substring(len)));
150
- } catch (err) {
151
- return cb(err);
152
- }
153
- }
154
- async all(cb = noop) {
155
- let len = this.prefix.length;
156
- try {
157
- let keys = await this._getAllKeys();
158
- if (keys.length === 0)
159
- return cb(null, []);
160
- let data = await this.client.mget(keys);
161
- let results = data.reduce((acc, raw, idx) => {
162
- if (!raw)
163
- return acc;
164
- let sess = this.serializer.parse(raw);
165
- sess.id = keys[idx].substring(len);
166
- acc.push(sess);
167
- return acc;
168
- }, []);
169
- return cb(null, results);
170
- } catch (err) {
171
- return cb(err);
172
- }
173
- }
174
- _getTTL(sess) {
175
- if (typeof this.ttl === "function") {
176
- return this.ttl(sess);
177
- }
178
- let ttl;
179
- if (sess && sess.cookie && sess.cookie.expires) {
180
- let ms = Number(new Date(sess.cookie.expires)) - Date.now();
181
- ttl = Math.ceil(ms / 1e3);
182
- } else {
183
- ttl = this.ttl;
184
- }
185
- return ttl;
186
- }
187
- async _getAllKeys() {
188
- let pattern = this.prefix + "*";
189
- let keys = [];
190
- for await (let key of this.client.scanIterator(pattern, this.scanCount)) {
191
- keys.push(key);
192
- }
193
- return keys;
194
- }
195
- };
196
- var esm_default = RedisStore;
197
- exports.SharedConfigKeys = void 0;
198
- (function(SharedConfigKeys2) {
199
- SharedConfigKeys2["AuthCookieName"] = "AUTH_COOKIE_NAME";
200
- SharedConfigKeys2["AuthCookieSecret"] = "AUTH_COOKIE_SECRET";
201
- SharedConfigKeys2["DbEndpoint"] = "DB_ENDPOINT";
202
- SharedConfigKeys2["JwtPrivateKey"] = "JWT_PRIVATE_KEY";
203
- SharedConfigKeys2["ServiceLogLevel"] = "SERVICE_LOG_LEVEL";
204
- SharedConfigKeys2["ServicePort"] = "SERVICE_PORT";
205
- SharedConfigKeys2["RedisHost"] = "REDIS_HOST";
206
- SharedConfigKeys2["RedisPassword"] = "REDIS_PASSWORD";
207
- })(exports.SharedConfigKeys || (exports.SharedConfigKeys = {}));
208
- var zBooleanEnum = zod.z.enum([
209
- "true",
210
- "false"
211
- ]).transform((strBool) => strBool === "true");
212
- var zNonEmptyString = zod.z.string().min(1);
213
- var zSharedConfig = zod.z.object({
214
- ["AUTH_COOKIE_NAME"]: zNonEmptyString.default("alliance-auth"),
215
- ["AUTH_COOKIE_SECRET"]: zNonEmptyString.default("zlLZBlk7wt8lypP5lA4D"),
216
- ["DB_ENDPOINT"]: zNonEmptyString,
217
- ["JWT_PRIVATE_KEY"]: zNonEmptyString.default("MIIEogIBAAKCAQEAsGqOzjnfQtCYlDqhgGAnKuJOCiPt2WpCmL1Cs+SLBQlyoNn6LT8BJ6ZRj8t/vK8Sw0p51Uq/3k0tazh7bLGkWNMBLY3BqFiNRMMnCqHJfvGIUi/itNXNe2kbP7H3rbyQTu4O7yH/ZAMitdpF2KLucVRlFxrQ/ggZjxwEGso4JUnCwmAnoKct/uupKz9Y2PMTr00WWN79aPfD4LcKi570VJqBT3ISSucdwFLYNqnOkQnEa8O8xbthQhiI0k1GGJT+GCQcATUPeEbaCFXonOrJm+CyuMmQWYLFF3NbE5NllU1jz9PYHzp2hAgAx8WGeretTvpEA1dE2gvXNESGbQ8FxQIDAQABAoIBAAjTJmud1348eGAfLV8CRaij2MAxxenJ9/ozVXfcPIa2+fCelsuBSv8pwbYODvNoVT7xpcs2nwccGI6JgnBl09EhqlMWCT7w7GLT2aBy3A/T6JF76xJICQGzDfWPYygMtlyhv0YqZDUjjFlJHun+/ysqIUMY81AR0FLUAEc6yw41ChcdSvTgIqBM9f5PsBRK7zOgdW1vcVQiZbf2Vqr+7wTJ+6b9A4rWnnAqesGDXqYupx3UJEu3x0wRNQB8FeiG9iJrw4cyD9SmM95doTyKosQ2PWWnUO1NMgmWCR/mWcKZAUcfZUpnQ8rz75WAWept8ZIOOdha8UZ1B/kw3EsVdEECgYEA3iN0BRUqMN0J69bazvlNOWtI+Chc1lYMt/tZ4p78pIJpAZvc3rQ9lAp6JvOEno2IglULA4I+ZLUmpz+lfu7XxKMNOI3cnG7WdiGbiIlwOSwuxzeO1FJqhtnc0U6mNkIjptV8b2etj8U2/SXAC3CC8XgsawAj9A/I7awlCL3NXdECgYEAy07gun3rcd3Y0ISmd3+SbAn/MbGf8uRLcfSc2ls9B6m3pXj25prXJWIrB6DyGuL/HQmHzffQkOeXmwFGHFXyiIFOIITX4z8b9lMnavgUZoPDY+ZFsxp6I7vMn75AetB8wYXpOFFeCG/Ck/VSIYP7oAN8kLw8EHdOuNbZYbu34bUCgYBYd14ZOBiZZS4yUlrJ2tc6atOgoNJ4OcTO8LcXXaHYEmenUF9iAf4UGygSoyDJ1CvtW9kLCK+4g7xlFx/dsVkU4qq9PyIA2tNmMHQ0qCedXU8z35huTnRGSDV81gmzyhtQsezgoTWp8Cy6HHKjG6fKasWlx2SKKk8m+Eu3c396QQKBgBMY2asq4M7VU+RiUXCwHwTe+4Wjda7PGvcdTw6Du3vYyVNVxXtr2AG+8uPIjnVQFT6ZApSqToEOAAOjXv6SZDHGU5xiXhUOfIXq0a0OmHv4rIXZv3pPZmGs5k+rA0uGAfH7riiIHBkWxmQ3ivty9lPVgAHobIvvaQmbxNeVVnRxAoGAUzUmcBiUAiODfjulrpYvWG0tCn5B//yk7g1Tm3Chrh9huA1qGEN3jDoqSsTd5k4Yi5foyAZt5ORgoiUVm4IsfS56aoxIco1CtFG3zeMQRy4uKzTsvUTOdsJ4RlQdjNwpngXR44VL0WelgCDqTqJwn5ubzPvuIHuTj3cBpmJCjOo="),
218
- ["SERVICE_LOG_LEVEL"]: zod.z.enum([
219
- "silent",
220
- "fatal",
221
- "error",
222
- "warn",
223
- "info",
224
- "debug",
225
- "trace"
226
- ]).default("trace"),
227
- ["SERVICE_PORT"]: zNonEmptyString.transform(Number).default("3000"),
228
- ["REDIS_HOST"]: zNonEmptyString.optional(),
229
- ["REDIS_PASSWORD"]: zNonEmptyString.optional()
230
- });
231
-
232
- // src/constants/headers.ts
233
- exports.AllianceHeaders = void 0;
234
- (function(AllianceHeaders2) {
235
- AllianceHeaders2["TargetUrl"] = "alliance-target-url";
236
- AllianceHeaders2["TargetApp"] = "alliance-target-app";
237
- AllianceHeaders2["TargetWorkspace"] = "alliance-target-workspace";
238
- })(exports.AllianceHeaders || (exports.AllianceHeaders = {}));
239
-
240
- // src/auth/auth.middleware.ts
241
- function authMiddleware(configService, { baseURL = "https://127.0.0.1", clientSecret, clientID = " ", authRequired = true, authorizationParams = {}, afterCallback, issuerBaseURL = "https://127.0.0.1", sessionCookiePath } = {}) {
242
- let store;
243
- const redisHostUrl = configService.get(exports.SharedConfigKeys.RedisHost);
244
- if (redisHostUrl) {
245
- const redisClient = redis.createClient({
246
- url: configService.getOrThrow(exports.SharedConfigKeys.RedisHost),
247
- password: configService.get(exports.SharedConfigKeys.RedisPassword)
248
- });
249
- redisClient.connect().catch(console.error);
250
- store = new esm_default({
251
- client: redisClient
252
- });
253
- }
254
- return expressOpenidConnect.auth({
255
- baseURL,
256
- clientSecret,
257
- clientID,
258
- authRequired,
259
- authorizationParams,
260
- afterCallback,
261
- issuerBaseURL,
262
- secret: configService.getOrThrow(exports.SharedConfigKeys.AuthCookieSecret),
263
- session: {
264
- name: configService.getOrThrow(exports.SharedConfigKeys.AuthCookieName),
265
- // @ts-ignore
266
- store,
267
- cookie: {
268
- path: sessionCookiePath
269
- }
270
- },
271
- routes: {
272
- callback: "/signin-oidc"
273
- }
274
- });
275
- }
276
- __name(authMiddleware, "authMiddleware");
277
- function createBearerToken({ privateKey, aud, sub, name, user, workspace }) {
278
- const jwt = jsonwebtoken.sign({
279
- iss: "Alliance",
280
- aud,
281
- sub,
282
- name,
283
- "https://alliance.teliacompany.net/user_type": user.type,
284
- "https://alliance.teliacompany.net/user_email": user.email,
285
- "https://alliance.teliacompany.net/user_privileges": user.permissions,
286
- "https://alliance.teliacompany.net/workspace": workspace.slug,
287
- "https://alliance.teliacompany.net/workspace_name": workspace.name,
288
- "https://alliance.teliacompany.net/tenant": workspace.slug,
289
- "https://alliance.teliacompany.net/tenant_name": workspace.name
290
- }, privateKey, {
291
- expiresIn: "1h",
292
- algorithm: "RS256"
293
- });
294
- return `Bearer ${jwt}`;
295
- }
296
- __name(createBearerToken, "createBearerToken");
297
- function getPrivateKey(configService) {
298
- const privateKey = configService.getOrThrow(exports.SharedConfigKeys.JwtPrivateKey);
299
- return "-----BEGIN RSA PRIVATE KEY-----\n" + privateKey + "\n-----END RSA PRIVATE KEY-----";
300
- }
301
- __name(getPrivateKey, "getPrivateKey");
302
- function createSystemUserToken(configService) {
303
- return createBearerToken({
304
- aud: "system",
305
- sub: "system",
306
- name: "system",
307
- workspace: {
308
- slug: "system",
309
- name: "system"
310
- },
311
- user: {
312
- type: "system",
313
- permissions: [],
314
- email: "system"
315
- },
316
- privateKey: getPrivateKey(configService)
317
- });
318
- }
319
- __name(createSystemUserToken, "createSystemUserToken");
320
-
321
- // src/distribution/cookie-policy.ts
322
- function generateCookiePolicyHtml(appManifests) {
323
- const cookiePolicyTableRows = [];
324
- for (const appName in appManifests) {
325
- const manifest = appManifests[appName];
326
- if (!manifest.storage) {
327
- continue;
328
- }
329
- for (const [key, value] of Object.entries(manifest.storage)) {
330
- const tableRow = createCookiePolicyTableRow(key, value);
331
- cookiePolicyTableRows.push(tableRow);
332
- }
333
- }
334
- return cookiePolicyHtml.replace("{APP_COOKIES}", cookiePolicyTableRows.join(""));
335
- }
336
- __name(generateCookiePolicyHtml, "generateCookiePolicyHtml");
337
- function createCookiePolicyTableRow(key, claimEntry) {
338
- const rows = [
339
- "<tr>"
340
- ];
341
- const { category, purpose, lifespan } = claimEntry;
342
- rows.push(`<td>${key}</td>`);
343
- rows.push(`<td>${category}</td>`);
344
- rows.push(`<td>${purpose}</td>`);
345
- rows.push(`<td>${lifespan}</td>`);
346
- rows.push("</tr>");
347
- return rows.join("");
348
- }
349
- __name(createCookiePolicyTableRow, "createCookiePolicyTableRow");
350
- var cookiePolicyHtml = `
351
- <!DOCTYPE html>
352
- <html lang="en">
353
- <head>
354
- <meta charset="UTF-8" />
355
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
356
- <title>ACE Alliance - Cookie Policy</title>
357
- <link
358
- rel="icon"
359
- href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGcElEQVRYha2Xe4xUVx3HP7/fPTOzDLO7sw8RlzWlZEtp2dCy0qIVWltKU/UPDZH6ijXWEK2odPcPa2qbhpi2kSa7blSStsFUjNq0lWCMaVMx8rAm22IJMJRHCqFC6BJ22eEx+5p7z88/7sywC7uwgCe5mXsz5/y+j/M753eOcJ2tK5sDyBrME2gBmkBq43/tnMERgXdAjrbn518yXq4RNA3cB/J54HNiMhfEicm4oAYghmHexN4Dew5k01giUybQlc1h0CbI9zC+Imi9mCAIYhoHsnI4KcNjYoDhxWPxsxFY1Z5vHQVwVwSu3Qdid4E8rSb3i6mqKYwBjpWX1V/QZBiYYWIIiifCw8Mm/vS7L/W237FqJno58M5srgmxP4npjsAHDwTeaeAdagGBdwQWoBYgFqCmqGlMqvTE3+U+ipbeE+ngB42Lde6kDnRmcwisAHlBfdBYCYxStp3y7xjTJ51RA0XxgGCkasQFSfkW8NQlBDqzORVYK6ZPqAU6ThUyqd0TN7mQDRZ/CULzvVVeRO68xIGubE6BbjH9oVqA+thaQccpvjLwRDTit2RG/fxVGR3sLc4ELuRAV90+gJ/G4K4EHpRs1wr7qwW/uH36uaxPzwz0xNZhHUfAzJZgsjZWrqXEiTP9WlRP1Bb+pCacs2KaCwvmD/5+cLhCoCubU0G61QJXyWYkVv9/Av/UEzVh2+PVDmDPr875ob4oD6UcMLhfTdqU8dket+sDD6rwS7vrfMs30i4qRhzfMhwe3FhwQG+FgMDKytIyKe1o1zffZlB3swvve7mehgVJZ95zatdouG31gHpvoHYUwHVmc4AsqoCXYK9HtzhYsDoTLnqyRl1a1QxOvjMavrmyT4sFr6hhsA/AZUbqKKTy9ZfCXhuFpntS4WfWZWloTcTTa8bh14fCrY/2a3E4UlOLt2jYCeCGE+cBBuPhdk2gZjDjjmS46KkampelnEhMPhwy3/PkGb/vhXPO4zGJ60KyTo5nPpk8wg5wPz57M13Z3PuGzRtTxEovV3BBoXlZKrytvZqmpSknKhVCJ3tGwu2rBxjYHzrEymUZw9Py0LQtD6yb7aG8CoR/mNgKs1LHEomJ4M2M9McDf9PX0n7eI9OpbXEVxQCFE5F/d+0Zf+iPgy7e/GPDjVj9rGXJcO7D6b+yLu7vABavrd10/O8jz5/cFqXNFBGr1HYzQ0SoviEIm5dXceOXpvGJpSkNEjJuGy+ciPzu7nN+/4aCRkM2vsaUrM/coH7ed9Ond3WffbPyF8CxQ/1Y5F8b/C9fHthlFPvFB05JNzqtvSnBxxYmmN4UVCwe60b/7mK4d/15Dr82qH50fHkva/fiSc00v/SlGr97fX79ytdb1owjAHDwX71tVbWuJ9OQdMl0gmTKESQUVWGsxQDD/ZE/snnIH/xdgVP/KU5yqCnBi2f6bPF3b6jxe17Mhx9sKizsyLceKPeqDP7bF/rfa2xLvHrLN6sfmr08o0GDqAaCIYRD3g/sD/1Hb49w7K1hev89otEoTi6To+V5n3l3Mryru1r3vpjn8KbCZjU5MLbfuBCd2VyzIHsTgauZ3pAkkXIanScc6Tf1RfRiJyYHN4Iq/O2PZ/zc71Rpz89P+30bz4QmdltHvvXQpARKJB5R0w0XSvL4cjwV+FnLU+HiZ2tUpxtbf9Tnj20vOJPo2fZ8688u7n3pmdB42Yt/xUuESVQ+yVJexZNtVmbQ2JYIH9zcGC5/pd71Hxjxm5f1cnzboDPx7xs8M9G4CSV1ZnOZICE7GNXbKweTMU7EA6USoemeVLhgTYame1Nu4MBI2PN0ng+3DDovIZFG5w37bEe+dc+UCQC8/ZtjzX07i/88saU4J8yLXiAhaCC+fn7Sz/7iNFq+mqZ6TuD6do+Gu7vPcuQvBRf62LlIQ2/Y1zvyra9OhnPZSf1g58k5I6ftDSnqnNFTaOACqmclfP0tSa3KBjrc5/2Hbwz7Q38ocHLniDM8XjxeIrxG3rA16vXXj529dVKMK2bVL2fkmhrmJ/9cPy91Z2ZGwhMqQx95TudC8gdCZx4obbMVAhqNGvaoCr99bKD1svGntK4647vg84J8X021PBXlK5gJGJWr11GDb3fkW7dPJfaUi3539iARxSUCz4AsERMVpHwDxMTyhq0HftGRbz071bhXfeooXVJvBR4EbgSGgR6Bt9qvArjc/gfZzPoCTDB+AgAAAABJRU5ErkJggg=="
360
- />
361
- <style>
362
- @charset "UTF-8";
363
- @import 'https://cdn.voca.teliacompany.com/fonts/TeliaSansV10/TeliaSans.css';
364
- @import 'https://fonts.googleapis.com/css?family=Reenie+Beanie';
365
-
366
- body {
367
- font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
368
- }
369
-
370
- body > div {
371
- max-width: 1000px;
372
- margin: 0 auto;
373
- padding: 0 40px 40px;
374
- }
375
- </style>
376
- </head>
377
-
378
- <body>
379
- <div>
380
- <h1>Cookie Policy</h1>
381
- <p>
382
- On our websites, we use cookies and other similar technologies. You can choose
383
- whether you want to allow our websites to store cookies on your computer or not. You
384
- can change your choices at any time.
385
- </p>
386
-
387
- <h2>Your consent is required</h2>
388
- <p>
389
- You choose whether you want to accept cookies on your device or not. Your consent is
390
- required for the use of cookies, but not for such cookies that are necessary to
391
- enable the service that you as a user have requested. If you do not accept our use
392
- of cookies, or if you have previously approved our use and have changed your mind,
393
- you can return to your cookie settings at any time and change your choices. You do
394
- this by clicking on the cookie button/link. You may also need to change the settings
395
- in your browser and manually delete cookies to clear your device of previously
396
- stored cookies.
397
- </p>
398
-
399
- <h2>What are cookies?</h2>
400
- <p>
401
- A cookie is a small text file that is stored on your computer by the web browser
402
- while browsing a website. When we refer to cookies (\u201Ccookies\u201D) in this policy, other
403
- similar technologies and tools that retrieve and store information in your browser,
404
- and in some cases forward such information to third parties, in a manner similar to
405
- cookies. Examples are pixels, local storage, session storage and fingerprinting.
406
- </p>
407
- <p>
408
- The websites will \u201Cremember\u201D and \u201Crecognize\u201D you. This can be done by placing
409
- cookies in three different ways;
410
- </p>
411
- <ul>
412
- <li>The session ends, ie until you close the window in your browser.</li>
413
- <li>
414
- Time-limited, ie the cookie has a predetermined lifespan. The time may vary
415
- between different cookies.
416
- </li>
417
- <li>
418
- Until further notice, ie the information remains until you choose to delete it
419
- yourself. This applies to local storage.
420
- </li>
421
- </ul>
422
- <p>You can always go into your browser and delete already stored cookies yourself.</p>
423
-
424
- <h3>Third Party Cookies</h3>
425
- <p>
426
- We use third-party cookies on our websites. Third-party cookies are stored by
427
- someone other than the person responsible for the website, in this case by a company
428
- other than Telia.
429
- </p>
430
- <p>
431
- Telia uses external platforms to communicate digitally, these include the Google
432
- Marketing Platform and others. The platforms use both first- and third-party cookies
433
- as well as similar techniques to advertise and follow up the results of the
434
- advertising.
435
- </p>
436
- <p>
437
- A third-party cookie can be used by several websites to understand and track how you
438
- browse between different websites. Telia receives information from these cookies,
439
- but the information can also be used for other purposes determined by third parties.
440
- Third-party cookies found on our website are covered by each third-party privacy
441
- policy. Feel free to read these to understand what other purposes the information
442
- can be used for. Links are in our Cookie Table.
443
- </p>
444
- <p>
445
- For information about which third-party cookies are used on our websites, see our
446
- Cookie Table. For more information on how Telia handles personal data in connection
447
- with transfers to third parties, read our Privacy Policy.
448
- </p>
449
-
450
- <h2>Cookies on our websites</h2>
451
- <p>
452
- In order for you to have better control over which cookies are used on the websites,
453
- and thus be able to more easily decide how cookies should be used when you visit our
454
- websites, we have identified four different categories of cookies. These categories
455
- are defined based on the purposes for the use of the cookies.
456
- </p>
457
- <p>
458
- In our Cookie Table, you can also see which category each cookie belongs to, for
459
- what purposes it is used and for how long it is active.
460
- </p>
461
- <p>
462
- We have identified the following four categories of cookies. All categories contain
463
- cookies which means that data is shared with third parties.
464
- </p>
465
-
466
- <h3>Necessary</h3>
467
- <p>
468
- These cookies are needed for our app to work in a secure and correct way. Necessary
469
- cookies enable you to use our app and us to provide the service you request.
470
- Necessary cookies make basic functions of the app possible, for example, identifying
471
- you when you log into My Telia, detecting repeated failed login attempts,
472
- identifying where you are in the buying process and remembering the items put into
473
- your shopping basket.
474
- </p>
475
-
476
- <h3>Functionality</h3>
477
- <p>
478
- These cookies let us to enable some useful functionalities to make the user
479
- experience better, for example, to remember your login details and settings.
480
- </p>
481
-
482
- <h3>Analytics</h3>
483
- <p>
484
- These cookies give us information about how you use our app and allow us to improve
485
- the user experience.
486
- </p>
487
-
488
- <h3>Marketing</h3>
489
- <p>
490
- These cookies help us and our partners to display personalized and relevant ads
491
- based on your browsing behavior on our website and in our app, even when you later
492
- visit other (third parties\u2019) websites. These cookies are used to evaluate the
493
- effectiveness of our marketingcampaigns, as well as for targeted marketing and
494
- profiling, regardless of which device(s) you have used. Information collected for
495
- this purpose may also be combined with other customer and traffic data we have about
496
- you, if you have given your consent that we may use your traffic data for marketing
497
- purpose and have not objected to the use of your customer data for marketing
498
- purposes.
499
- </p>
500
-
501
- <h2>Manage settings</h2>
502
- <p>
503
- We save your cookie consent for 12 months. Then we will ask you again. Please note
504
- that some cookies have a lifespan that exceeds these 12 months. You may therefore
505
- need to change the settings in your browser and manually delete all cookies.
506
- </p>
507
- <p>
508
- More information on how to turn off cookies can be found in the instructions for
509
- your browser.
510
- </p>
511
- <ul>
512
- <li>
513
- <a
514
- href="https://support.google.com/accounts/answer/61416?co=GENIE.Platform%3DDesktop&amp;hl=en"
515
- target="_blank"
516
- rel="noopener noreferrer"
517
- >Google Chrome</a
518
- >
519
- </li>
520
- <li>
521
- <a
522
- href="https://privacy.microsoft.com/en-us/windows-10-microsoft-edge-and-privacy"
523
- target="_blank"
524
- rel="noopener noreferrer"
525
- >Microsoft Edge</a
526
- >
527
- </li>
528
- <li>
529
- <a
530
- href="https://support.mozilla.org/en-US/kb/enable-and-disable-cookies-website-preferences"
531
- target="_blank"
532
- rel="noopener noreferrer"
533
- >Mozilla Firefox</a
534
- >
535
- </li>
536
- <li>
537
- <a
538
- href="https://support.microsoft.com/en-gb/help/17442/windows-internet-explorer-delete-manage-cookies"
539
- target="_blank"
540
- rel="noopener noreferrer"
541
- >Microsoft Internet Explorer</a
542
- >
543
- </li>
544
- <li>
545
- <a
546
- href="https://www.opera.com/help/tutorials/security/privacy/"
547
- target="_blank"
548
- rel="noopener noreferrer"
549
- >Opera</a
550
- >
551
- </li>
552
- <li>
553
- <a
554
- href="https://support.apple.com/guide/safari/manage-cookies-and-website-data-sfri11471/mac"
555
- target="_blank"
556
- rel="noopener noreferrer"
557
- >Apple Safari</a
558
- >
559
- </li>
560
- </ul>
561
-
562
- <h3>Do Not Track-signals</h3>
563
- <p>
564
- If you have chosen to turn on the Do Not Track function in your browser, we will not
565
- automatically place cookies for marketing on your device. You make other choices in
566
- your cookie settings.
567
- </p>
568
-
569
- <h3>If you block cookies</h3>
570
- <p>
571
- If you choose not to accept our use of cookies, the functionality and performance of
572
- our websites may deteriorate as certain functions are dependent on cookies. A
573
- blocking of cookies can therefore mean that the websites\u2019 services do not work as
574
- they should.
575
- </p>
576
-
577
- <h3>Your security with us</h3>
578
- <p>
579
- If you want to read more about your rights and how we protect your privacy, go to
580
- our privacy policy for
581
- <a
582
- href="https://www.telia.se/dam/jcr:df2eeb83-50ce-4383-89fc-0613f7615796/Integritetspolicy-privatkunder.pdf"
583
- >private customers</a
584
- >
585
- (C2B) or
586
- <a
587
- href="https://www.telia.se/dam/jcr:95b2b4a5-82ca-436b-90e0-873e0a864118/Telia-integritetspolicy-foretag.pdf"
588
- >corporate customers</a
589
- >
590
- (B2B). You are always welcome to contact us at
591
- <a href="mailto:dpo-se@teliacompany.com">dpo-se@teliacompany.com</a> if you have any
592
- questions.
593
- </p>
594
- <p>Our cookie policy may change in the future.</p>
595
- <p>
596
- More information about cookies can be found at the Swedish Post and Telecom
597
- Authority (PTS).
598
- </p>
599
-
600
- <h2>Our Cookie Table</h2>
601
- <p>
602
- Below, you will find a list of the cookies and similar technologies that we use on
603
- this website. These cookies are stored on your device by us.
604
- </p>
605
- <table>
606
- <thead>
607
- <tr>
608
- <th>Cookie</th>
609
- <th>Category</th>
610
- <th>Purpose</th>
611
- <th>Lifespan</th>
612
- </tr>
613
- </thead>
614
- <tbody>
615
- <tr>
616
- <td>alliance-session-v1</td>
617
- <td>necessary</td>
618
- <td>Contains the authenticated user.</td>
619
- <td>1 day</td>
620
- </tr>
621
- {APP_COOKIES}
622
- </tbody>
623
- </table>
624
- <style>
625
- table {
626
- width: 100%;
627
- border: 1px solid rgba(0, 0, 0, 0.15);
628
- }
629
- th, td {
630
- text-align: left;
631
- padding: 3px;
632
- }
633
- </style>
634
- </div>
635
- </body>
636
- </html>
637
- `;
638
- function getJsonSchemas() {
639
- const frameworkDistDirPath = path.resolve(process.cwd(), "node_modules", "@telia-ace/alliance-framework", "dist");
640
- const appConfigSchemaPath = path.resolve(frameworkDistDirPath, "config.schema.json");
641
- const appManifestSchemaPath = path.resolve(frameworkDistDirPath, "manifest.schema.json");
642
- const appConfigSchemaFile = fs.readFileSync(appConfigSchemaPath).toString();
643
- const appManifestSchemaFile = fs.readFileSync(appManifestSchemaPath).toString();
644
- const appConfig = JSON.parse(appConfigSchemaFile);
645
- const appManifest = JSON.parse(appManifestSchemaFile);
646
- return {
647
- appConfig,
648
- appManifest
649
- };
650
- }
651
- __name(getJsonSchemas, "getJsonSchemas");
652
- async function createTempModuleAndImport(moduleString, fileName) {
653
- const file = path.resolve(process.cwd(), `${fileName}.mjs`);
654
- fs.writeFileSync(file, moduleString);
655
- const importedModule = await import(`file:///${file}`);
656
- fs.rmSync(file, {
657
- force: true
658
- });
659
- return importedModule;
660
- }
661
- __name(createTempModuleAndImport, "createTempModuleAndImport");
662
- async function getAppManifests(apps) {
663
- const moduleStringParts = [];
664
- const manifestImportVariables = [];
665
- for (const packageName of apps) {
666
- const manifestImportVariable = `app${apps.indexOf(packageName)}`;
667
- manifestImportVariables.push(manifestImportVariable);
668
- moduleStringParts.push(`import ${manifestImportVariable} from '${packageName}/manifest';`);
669
- }
670
- moduleStringParts.push(`export default [${manifestImportVariables.join(", ")}];`);
671
- const result = await createTempModuleAndImport(moduleStringParts.join("\n"), "app-manifests");
672
- return result.default;
673
- }
674
- __name(getAppManifests, "getAppManifests");
675
-
676
- // src/distribution/pkg-json.ts
677
- function getPkgJson() {
678
- const packageJson = path.resolve(process.cwd(), "package.json");
679
- const pkgJsonFile = fs.readFileSync(packageJson).toString();
680
- return JSON.parse(pkgJsonFile);
681
- }
682
- __name(getPkgJson, "getPkgJson");
683
- async function getManifests(pkgJson) {
684
- if (!pkgJson || !pkgJson.alliance || !pkgJson.alliance.apps) {
685
- throw new Error("Alliance apps not defined in package.json.");
686
- }
687
- const manifestArray = await getAppManifests(pkgJson.alliance.apps);
688
- return manifestArray.reduce((acc, curr) => {
689
- acc[curr.name] = curr;
690
- return acc;
691
- }, {});
692
- }
693
- __name(getManifests, "getManifests");
694
-
695
- // src/distribution/create-public-files.ts
696
- var PUBLIC_DIR_NAME = "public";
697
- var MANIFESTS_FILE_NAME = "manifests.json";
698
- var COOKIE_POLICY_FILE_NAME = "cookie-policy.html";
699
- var APP_CONFIG_SCHEMA_FILE_NAME = "config.schema.json";
700
- var APP_MANIFEST_SCHEMA_FILE_NAME = "manifest.schema.json";
701
- async function createPublicDistributionFiles() {
702
- const pkgJson = getPkgJson();
703
- const manifests = await getManifests(pkgJson);
704
- const schemas = getJsonSchemas();
705
- for (const appName in manifests) {
706
- const manifest = manifests[appName];
707
- const validationResult = jsonschema.validate(manifest, schemas.appManifest);
708
- if (validationResult.errors.length) {
709
- const errors = validationResult.errors.map((e) => JSON.stringify(e, null, 2));
710
- throw new Error(`Validation of app manifest for app '${appName}' failed with the following errors:
711
- ${errors.join("\n")}`);
712
- }
713
- }
714
- const publicDirPath = path.resolve(process.cwd(), PUBLIC_DIR_NAME);
715
- if (!fs.existsSync(publicDirPath)) {
716
- fs.mkdirSync(publicDirPath);
717
- }
718
- const manifestsFilePath = path.resolve(publicDirPath, MANIFESTS_FILE_NAME);
719
- fs.writeFileSync(manifestsFilePath, JSON.stringify(manifests));
720
- const cookiePolicyFilePath = path.resolve(publicDirPath, COOKIE_POLICY_FILE_NAME);
721
- fs.writeFileSync(cookiePolicyFilePath, generateCookiePolicyHtml(manifests));
722
- const appConfigSchemaFilePath = path.resolve(publicDirPath, APP_CONFIG_SCHEMA_FILE_NAME);
723
- const appManifestSchemaFilePath = path.resolve(publicDirPath, APP_MANIFEST_SCHEMA_FILE_NAME);
724
- fs.writeFileSync(appConfigSchemaFilePath, JSON.stringify(schemas.appConfig));
725
- fs.writeFileSync(appManifestSchemaFilePath, JSON.stringify(schemas.appManifest));
726
- }
727
- __name(createPublicDistributionFiles, "createPublicDistributionFiles");
728
- exports.GatewayErrorCodes = void 0;
729
- (function(GatewayErrorCodes2) {
730
- GatewayErrorCodes2[GatewayErrorCodes2["NoObjectId"] = 10001] = "NoObjectId";
731
- GatewayErrorCodes2[GatewayErrorCodes2["NoTargetAppHeader"] = 10002] = "NoTargetAppHeader";
732
- GatewayErrorCodes2[GatewayErrorCodes2["NoTargetWorkspaceHeader"] = 10003] = "NoTargetWorkspaceHeader";
733
- GatewayErrorCodes2[GatewayErrorCodes2["NoManifestsInCache"] = 10004] = "NoManifestsInCache";
734
- GatewayErrorCodes2[GatewayErrorCodes2["NoDevSessionInCache"] = 10005] = "NoDevSessionInCache";
735
- GatewayErrorCodes2[GatewayErrorCodes2["NoManifest"] = 10006] = "NoManifest";
736
- GatewayErrorCodes2[GatewayErrorCodes2["NoRequestContext"] = 10007] = "NoRequestContext";
737
- GatewayErrorCodes2[GatewayErrorCodes2["NoUserInRequestContext"] = 10008] = "NoUserInRequestContext";
738
- GatewayErrorCodes2[GatewayErrorCodes2["NoAppInRequestContext"] = 10009] = "NoAppInRequestContext";
739
- GatewayErrorCodes2[GatewayErrorCodes2["NoWorkspaceInRequestContext"] = 10010] = "NoWorkspaceInRequestContext";
740
- GatewayErrorCodes2[GatewayErrorCodes2["NoUserPermissionsInRequestContext"] = 10012] = "NoUserPermissionsInRequestContext";
741
- GatewayErrorCodes2[GatewayErrorCodes2["WorkspacePermissionDenied"] = 10013] = "WorkspacePermissionDenied";
742
- })(exports.GatewayErrorCodes || (exports.GatewayErrorCodes = {}));
743
- exports.PortalErrorCodes = void 0;
744
- (function(PortalErrorCodes2) {
745
- PortalErrorCodes2[PortalErrorCodes2["NoObjectId"] = 12e3] = "NoObjectId";
746
- })(exports.PortalErrorCodes || (exports.PortalErrorCodes = {}));
747
- var allianceErrors = {
748
- // gateway
749
- [10001]: {
750
- httpCode: common.HttpStatus.UNAUTHORIZED,
751
- message: "No object id available on authenticated user."
752
- },
753
- [10002]: {
754
- httpCode: common.HttpStatus.BAD_REQUEST,
755
- message: `Request missing header '${exports.AllianceHeaders.TargetApp}'.`
756
- },
757
- [10003]: {
758
- httpCode: common.HttpStatus.BAD_REQUEST,
759
- message: `Request missing header '${exports.AllianceHeaders.TargetWorkspace}'.`
760
- },
761
- [10004]: {
762
- httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
763
- message: "App manifests missing in cache."
764
- },
765
- [10005]: {
766
- httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
767
- message: "No dev session in memory cache."
768
- },
769
- [10006]: {
770
- httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
771
- message: "Could not find manifest for app '{{appSlug}}'."
772
- },
773
- [10007]: {
774
- httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
775
- message: "No request context."
776
- },
777
- [10008]: {
778
- httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
779
- message: "No user in request context."
780
- },
781
- [10009]: {
782
- httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
783
- message: "No app in request context."
784
- },
785
- [10010]: {
786
- httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
787
- message: "No workspace in request context."
788
- },
789
- [10012]: {
790
- httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
791
- message: "No user permissions in request context."
792
- },
793
- [10013]: {
794
- httpCode: common.HttpStatus.FORBIDDEN,
795
- message: "User does not have access to the current workspace."
796
- },
797
- // portal
798
- [12e3]: {
799
- httpCode: common.HttpStatus.UNAUTHORIZED,
800
- message: "No object id found in user claims."
801
- }
802
- };
803
-
804
- // src/exceptions/alliance-gql.exception.ts
805
- function parseTemplates(message, variables) {
806
- return Object.entries(variables).reduce((acc, [key, value]) => {
807
- return acc.replaceAll(`{{${key}}}`, value);
808
- }, message);
809
- }
810
- __name(parseTemplates, "parseTemplates");
811
- var AllianceGqlException = class extends graphql.GraphQLError {
812
- static {
813
- __name(this, "AllianceGqlException");
814
- }
815
- info;
816
- code;
817
- constructor(code, variables = {}, extensions) {
818
- const { message } = allianceErrors[code];
819
- super(parseTemplates(message, variables), {
820
- extensions
821
- });
822
- this.code = code;
823
- this.info = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${code}`;
824
- }
825
- };
826
- function parseTemplates2(message, variables) {
827
- return Object.entries(variables).reduce((acc, [key, value]) => {
828
- return acc.replaceAll(`{{${key}}}`, value);
829
- }, message);
830
- }
831
- __name(parseTemplates2, "parseTemplates");
832
- var AllianceException = class extends common.HttpException {
833
- static {
834
- __name(this, "AllianceException");
835
- }
836
- info;
837
- code;
838
- constructor(code, variables = {}) {
839
- const { message, httpCode } = allianceErrors[code];
840
- super(parseTemplates2(message, variables), httpCode);
841
- this.code = code;
842
- this.info = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${code}`;
843
- }
844
- };
845
- function _ts_decorate(decorators, target, key, desc) {
846
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
847
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
848
- r = Reflect.decorate(decorators, target, key, desc);
849
- else
850
- for (var i = decorators.length - 1; i >= 0; i--)
851
- if (d = decorators[i])
852
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
853
- return c > 3 && r && Object.defineProperty(target, key, r), r;
854
- }
855
- __name(_ts_decorate, "_ts_decorate");
856
- exports.AllianceExceptionFilter = class AllianceExceptionFilter2 {
857
- static {
858
- __name(this, "AllianceExceptionFilter");
859
- }
860
- catch(exception, host) {
861
- const ctx = host.switchToHttp();
862
- const response = ctx.getResponse();
863
- const status = exception.getStatus();
864
- response.status && response.status(status).json({
865
- httpCode: status,
866
- code: exception.code,
867
- info: exception.info,
868
- message: exception.message
869
- });
870
- }
871
- };
872
- exports.AllianceExceptionFilter = _ts_decorate([
873
- common.Catch(AllianceException)
874
- ], exports.AllianceExceptionFilter);
875
- function _ts_decorate2(decorators, target, key, desc) {
876
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
877
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
878
- r = Reflect.decorate(decorators, target, key, desc);
879
- else
880
- for (var i = decorators.length - 1; i >= 0; i--)
881
- if (d = decorators[i])
882
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
883
- return c > 3 && r && Object.defineProperty(target, key, r), r;
884
- }
885
- __name(_ts_decorate2, "_ts_decorate");
886
- function _ts_metadata(k, v) {
887
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
888
- return Reflect.metadata(k, v);
889
- }
890
- __name(_ts_metadata, "_ts_metadata");
891
- exports.RedisHealthIndicator = class RedisHealthIndicator2 extends terminus.HealthIndicator {
892
- static {
893
- __name(this, "RedisHealthIndicator");
894
- }
895
- configService;
896
- constructor(configService) {
897
- super();
898
- this.configService = configService;
899
- }
900
- async isHealthy() {
901
- try {
902
- const client = await this.getRedisClient();
903
- await client.ping();
904
- } catch {
905
- return this.getStatus("redis", false);
906
- }
907
- return this.getStatus("redis", true);
908
- }
909
- async getRedisClient() {
910
- const redisClient = redis.createClient({
911
- url: this.configService.getOrThrow(exports.SharedConfigKeys.RedisHost),
912
- password: this.configService.get(exports.SharedConfigKeys.RedisPassword)
913
- });
914
- await redisClient.connect();
915
- return redisClient;
916
- }
917
- };
918
- exports.RedisHealthIndicator = _ts_decorate2([
919
- common.Injectable(),
920
- _ts_metadata("design:type", Function),
921
- _ts_metadata("design:paramtypes", [
922
- typeof config.ConfigService === "undefined" ? Object : config.ConfigService
923
- ])
924
- ], exports.RedisHealthIndicator);
925
- function _ts_decorate3(decorators, target, key, desc) {
926
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
927
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
928
- r = Reflect.decorate(decorators, target, key, desc);
929
- else
930
- for (var i = decorators.length - 1; i >= 0; i--)
931
- if (d = decorators[i])
932
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
933
- return c > 3 && r && Object.defineProperty(target, key, r), r;
934
- }
935
- __name(_ts_decorate3, "_ts_decorate");
936
- function _ts_metadata2(k, v) {
937
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
938
- return Reflect.metadata(k, v);
939
- }
940
- __name(_ts_metadata2, "_ts_metadata");
941
- function _ts_param(paramIndex, decorator) {
942
- return function(target, key) {
943
- decorator(target, key, paramIndex);
944
- };
945
- }
946
- __name(_ts_param, "_ts_param");
947
- exports.LoggerService = class LoggerService2 {
948
- static {
949
- __name(this, "LoggerService");
950
- }
951
- logger;
952
- constructor(logger) {
953
- this.logger = logger;
954
- this.log = this.logFn("info");
955
- this.trace = this.logFn("trace");
956
- this.debug = this.logFn("debug");
957
- this.info = this.logFn("info");
958
- this.warn = this.logFn("warn");
959
- this.error = this.logFn("error");
960
- this.fatal = this.logFn("fatal");
961
- }
962
- logFn(type) {
963
- return (msg, context = {}) => {
964
- return this.logger[type]({
965
- ...context,
966
- msg
967
- });
968
- };
969
- }
970
- log;
971
- trace;
972
- debug;
973
- info;
974
- warn;
975
- error;
976
- fatal;
977
- };
978
- exports.LoggerService = _ts_decorate3([
979
- common.Injectable(),
980
- _ts_param(0, nestjsPino.InjectPinoLogger()),
981
- _ts_metadata2("design:type", Function),
982
- _ts_metadata2("design:paramtypes", [
983
- typeof nestjsPino.PinoLogger === "undefined" ? Object : nestjsPino.PinoLogger
984
- ])
985
- ], exports.LoggerService);
986
-
987
- // src/logging/logging.module.ts
988
- function _ts_decorate4(decorators, target, key, desc) {
989
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
990
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
991
- r = Reflect.decorate(decorators, target, key, desc);
992
- else
993
- for (var i = decorators.length - 1; i >= 0; i--)
994
- if (d = decorators[i])
995
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
996
- return c > 3 && r && Object.defineProperty(target, key, r), r;
997
- }
998
- __name(_ts_decorate4, "_ts_decorate");
999
- exports.LoggerModule = class LoggerModule2 {
1000
- static {
1001
- __name(this, "LoggerModule");
1002
- }
1003
- static forRoot({ logLevel, redact = true } = {}) {
1004
- return {
1005
- module: LoggerModule2,
1006
- controllers: [],
1007
- imports: [
1008
- nestjsPino.LoggerModule.forRootAsync({
1009
- imports: [
1010
- config.ConfigModule
1011
- ],
1012
- inject: [
1013
- config.ConfigService
1014
- ],
1015
- useFactory: async (configService) => ({
1016
- pinoHttp: {
1017
- level: logLevel || configService.get(exports.SharedConfigKeys.ServiceLogLevel) || "silent",
1018
- redact: redact ? [
1019
- "authorization",
1020
- "headers.authorization",
1021
- "req.headers.authorization",
1022
- "res.headers.authorization",
1023
- "req.headers.cookie",
1024
- 'res.headers["set-cookie"]'
1025
- ] : []
1026
- }
1027
- })
1028
- })
1029
- ],
1030
- global: true,
1031
- providers: [
1032
- exports.LoggerService
1033
- ],
1034
- exports: []
1035
- };
1036
- }
1037
- };
1038
- exports.LoggerModule = _ts_decorate4([
1039
- common.Module({
1040
- providers: [
1041
- exports.LoggerService
1042
- ],
1043
- exports: [
1044
- exports.LoggerService
1045
- ]
1046
- })
1047
- ], exports.LoggerModule);
1048
- function slugify(name) {
1049
- return _slugify__default.default(name, {
1050
- strict: true,
1051
- replacement: "-",
1052
- lower: true
1053
- });
1054
- }
1055
- __name(slugify, "slugify");
1056
-
1057
- Object.defineProperty(exports, 'LoggerErrorInterceptor', {
1058
- enumerable: true,
1059
- get: function () { return nestjsPino.LoggerErrorInterceptor; }
1060
- });
1061
- exports.AllianceException = AllianceException;
1062
- exports.AllianceGqlException = AllianceGqlException;
1063
- exports.authMiddleware = authMiddleware;
1064
- exports.createBearerToken = createBearerToken;
1065
- exports.createPublicDistributionFiles = createPublicDistributionFiles;
1066
- exports.createSystemUserToken = createSystemUserToken;
1067
- exports.getAppManifests = getAppManifests;
1068
- exports.getPrivateKey = getPrivateKey;
1069
- exports.slugify = slugify;
1070
- exports.zBooleanEnum = zBooleanEnum;
1071
- exports.zNonEmptyString = zNonEmptyString;
1072
- exports.zSharedConfig = zSharedConfig;
1073
- //# sourceMappingURL=out.js.map
1074
- //# sourceMappingURL=index.cjs.map