@telia-ace/alliance-internal-node-utilities 1.0.2-next.0 → 1.0.2-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 CHANGED
@@ -1,5 +1,802 @@
1
- "use strict";const nestjsPino=require("nestjs-pino"),expressOpenidConnect=require("express-openid-connect"),jsonwebtoken=require("jsonwebtoken"),common=require("@nestjs/common"),config=require("@nestjs/config"),t=require("slugify"),node_fs=require("node:fs"),node_path=require("node:path"),promises=require("node:stream/promises");function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const t__default=_interopDefaultCompat(t);var SharedConfigKeys=(e=>(e.AuthAuthority="AUTH_AUTHORITY",e.AuthCookieName="AUTH_COOKIE_NAME",e.AuthCookieSecret="AUTH_COOKIE_SECRET",e.DbEndpoint="DB_ENDPOINT",e.JwtPrivateKey="JWT_PRIVATE_KEY",e.ServiceLogLevel="SERVICE_LOG_LEVEL",e.ServicePort="SERVICE_PORT",e))(SharedConfigKeys||{}),AllianceHeaders=(e=>(e.TargetUrl="alliance-target-url",e.TargetApp="alliance-target-app",e.TargetWorkspace="alliance-target-workspace",e))(AllianceHeaders||{});function authMiddleware(e,{baseURL:i="https://127.0.0.1",clientSecret:o,clientID:u=" ",authRequired:n=!0,authorizationParams:g={},afterCallback:d}={}){return expressOpenidConnect.auth({baseURL:i,clientSecret:o,clientID:u,authRequired:n,authorizationParams:g,afterCallback:d,issuerBaseURL:`${e.getOrThrow(SharedConfigKeys.AuthAuthority)}/.well-known/openid-configuration`,secret:e.getOrThrow(SharedConfigKeys.AuthCookieSecret),session:{name:e.getOrThrow(SharedConfigKeys.AuthCookieName)},routes:{callback:"/signin-oidc"}})}function createBearerToken({privateKey:e,aud:i,sub:o,name:u,user:n,workspace:g}){return`Bearer ${jsonwebtoken.sign({iss:"Alliance",aud:i,sub:o,name:u,"https://alliance.teliacompany.net/user_type":n.type,"https://alliance.teliacompany.net/user_privileges":n.permissions,"https://alliance.teliacompany.net/workspace":g.slug,"https://alliance.teliacompany.net/workspace_name":g.name,"https://alliance.teliacompany.net/tenant":g.slug,"https://alliance.teliacompany.net/tenant_name":g.name},e,{expiresIn:"1h",algorithm:"RS256"})}`}function getPrivateKey(e){return`-----BEGIN RSA PRIVATE KEY-----
2
- `+e.getOrThrow(SharedConfigKeys.JwtPrivateKey)+`
3
- -----END RSA PRIVATE KEY-----`}function createSystemUserToken(e){return createBearerToken({aud:"system",sub:"system",name:"system",workspace:{slug:"system",name:"system"},user:{type:"system",permissions:[]},privateKey:getPrivateKey(e)})}var GatewayErrorCodes=(e=>(e[e.NoMatchingEndpoint=1e4]="NoMatchingEndpoint",e[e.NoObjectId=10001]="NoObjectId",e[e.NoTargetAppHeader=10002]="NoTargetAppHeader",e[e.NoTargetWorkspaceHeader=10003]="NoTargetWorkspaceHeader",e[e.NoManifestsInCache=10004]="NoManifestsInCache",e[e.NoDevSessionInCache=10005]="NoDevSessionInCache",e[e.NoManifest=10006]="NoManifest",e[e.NoRequestContext=10007]="NoRequestContext",e[e.NoUserInRequestContext=10008]="NoUserInRequestContext",e[e.NoAppInRequestContext=10009]="NoAppInRequestContext",e[e.NoWorkspaceInRequestContext=10010]="NoWorkspaceInRequestContext",e[e.NoManifestInRequestContext=10011]="NoManifestInRequestContext",e[e.NoUserPermissionsInRequestContext=10012]="NoUserPermissionsInRequestContext",e))(GatewayErrorCodes||{}),DatabasesErrorCodes=(e=>(e[e.NoPublicKey=11e3]="NoPublicKey",e[e.NoAuthHeader=11001]="NoAuthHeader",e[e.FailedFileStore=11002]="FailedFileStore",e[e.FailedFileRead=11003]="FailedFileRead",e))(DatabasesErrorCodes||{}),PortalErrorCodes=(e=>(e[e.NoObjectId=12e3]="NoObjectId",e))(PortalErrorCodes||{});const allianceErrors={[1e4]:{httpCode:common.HttpStatus.BAD_REQUEST,message:"Could not find endpoint matching request in app manifest."},[10001]:{httpCode:common.HttpStatus.UNAUTHORIZED,message:"No object id available on authenticated user."},[10002]:{httpCode:common.HttpStatus.BAD_REQUEST,message:`Request missing header '${AllianceHeaders.TargetApp}'.`},[10003]:{httpCode:common.HttpStatus.BAD_REQUEST,message:`Request missing header '${AllianceHeaders.TargetWorkspace}'.`},[10004]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"App manifests missing in cache."},[10005]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"No dev session in memory cache."},[10006]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"Could not find manifest for app '{{appSlug}}'."},[10007]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"No request context."},[10008]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"No user in request context."},[10009]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"No app in request context."},[10010]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"No workspace in request context."},[10011]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"No manifest in request context."},[10012]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"No user permissions in request context."},[11e3]:{httpCode:common.HttpStatus.UNAUTHORIZED,message:"No public key available to decode JWT."},[11001]:{httpCode:common.HttpStatus.UNAUTHORIZED,message:"No authorization header found."},[11002]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"Error storing file."},[11003]:{httpCode:common.HttpStatus.INTERNAL_SERVER_ERROR,message:"Error reading file."},[12e3]:{httpCode:common.HttpStatus.UNAUTHORIZED,message:"No object id found in user claims."}};function p(e,i){return Object.entries(i).reduce((o,[u,n])=>o.replaceAll(`{{${u}}}`,n),e)}class AllianceException extends common.HttpException{constructor(i,o={}){const{message:u,httpCode:n}=allianceErrors[i];super(p(u,o),n),this.code=i,this.info=`https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${i}`}}var c=Object.defineProperty,a$2=Object.getOwnPropertyDescriptor,r=(e,i,o,u)=>{for(var n=u>1?void 0:u?a$2(i,o):i,g=e.length-1,d;g>=0;g--)(d=e[g])&&(n=(u?d(i,o,n):d(n))||n);return u&&n&&c(i,o,n),n};exports.AllianceExceptionFilter=class{catch(i,o){const u=o.switchToHttp().getResponse(),n=i.getStatus();u.status&&u.status(n).json({httpCode:n,code:i.code,info:i.info,message:i.message})}},exports.AllianceExceptionFilter=r([common.Catch(AllianceException)],exports.AllianceExceptionFilter);var f=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a$1=(e,i,o,u)=>{for(var n=u>1?void 0:u?s(i,o):i,g=e.length-1,d;g>=0;g--)(d=e[g])&&(n=(u?d(i,o,n):d(n))||n);return u&&n&&f(i,o,n),n},l$1=(e,i)=>(o,u)=>i(o,u,e);exports.LoggerService=class{constructor(i){this.logger=i,this.log=(...o)=>this.logger.info(...o),this.trace=(...o)=>this.logger.trace(...o),this.debug=(...o)=>this.logger.debug(...o),this.info=(...o)=>this.logger.info(...o),this.warn=(...o)=>this.logger.warn(...o),this.error=(...o)=>this.logger.error(...o),this.fatal=(...o)=>this.logger.fatal(...o)}},exports.LoggerService=a$1([common.Injectable(),l$1(0,nestjsPino.InjectPinoLogger())],exports.LoggerService);var l=Object.defineProperty,m=Object.getOwnPropertyDescriptor,a=(e,i,o,u)=>{for(var n=u>1?void 0:u?m(i,o):i,g=e.length-1,d;g>=0;g--)(d=e[g])&&(n=(u?d(i,o,n):d(n))||n);return u&&n&&l(i,o,n),n};exports.LoggerModule=class{static forRoot({logLevel:i,redact:o=!0}={}){return{module:exports.LoggerModule,controllers:[],imports:[nestjsPino.LoggerModule.forRootAsync({imports:[config.ConfigModule],inject:[config.ConfigService],useFactory:async u=>({pinoHttp:{level:i||u.get(SharedConfigKeys.ServiceLogLevel)||"silent",redact:o?["authorization","headers.authorization","req.headers.authorization","req.remoteAddress","req.remotePort"]:[],transport:{target:"pino-pretty",options:{colorize:!0,colorizeObjects:!0}}}})})],global:!0,providers:[exports.LoggerService],exports:[]}}},exports.LoggerModule=a([common.Module({providers:[exports.LoggerService],exports:[exports.LoggerService]})],exports.LoggerModule);function slugify(e){return t__default(e,{strict:!0,replacement:"-",lower:!0})}function viteCssImportPlugin(e,i=!1){return{name:"vite-plugin-css-import",apply:"build",enforce:"post",writeBundle:async(o,u)=>{const n=Object.keys(u).filter(R=>R.endsWith(".css"));if(!n.length)return;const g=node_path.resolve(process.cwd(),`${e}-temp.js`),d=node_path.resolve(process.cwd(),`${e}.js`),N=n.reduce((R,E)=>{if(i){const C=node_path.dirname(d),A=node_path.relative(C,E);return`${R}import "${A.replaceAll("\\","/")}";
4
- `}return`${R}import "./${E}";
5
- `},""),h=node_fs.createWriteStream(g);h.write(N,"utf8");const S=node_fs.createReadStream(d);await promises.pipeline(S,h),node_fs.rmSync(d,{force:!0}),node_fs.renameSync(g,d),h.end()}}}exports.LoggerErrorInterceptor=nestjsPino.LoggerErrorInterceptor,exports.AllianceException=AllianceException,exports.AllianceHeaders=AllianceHeaders,exports.DatabasesErrorCodes=DatabasesErrorCodes,exports.GatewayErrorCodes=GatewayErrorCodes,exports.PortalErrorCodes=PortalErrorCodes,exports.SharedConfigKeys=SharedConfigKeys,exports.authMiddleware=authMiddleware,exports.createBearerToken=createBearerToken,exports.createSystemUserToken=createSystemUserToken,exports.getPrivateKey=getPrivateKey,exports.slugify=slugify,exports.viteCssImportPlugin=viteCssImportPlugin;
1
+ 'use strict';
2
+
3
+ const nestjsPino = require('nestjs-pino');
4
+ const expressOpenidConnect = require('express-openid-connect');
5
+ const jsonwebtoken = require('jsonwebtoken');
6
+ const jsonschema = require('jsonschema');
7
+ const node_path = require('node:path');
8
+ const node_fs = require('node:fs');
9
+ const common = require('@nestjs/common');
10
+ const config = require('@nestjs/config');
11
+ const _slugify = require('slugify');
12
+ const promises = require('node:stream/promises');
13
+
14
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
15
+
16
+ const _slugify__default = /*#__PURE__*/_interopDefaultCompat(_slugify);
17
+
18
+ var SharedConfigKeys = /* @__PURE__ */ ((SharedConfigKeys2) => {
19
+ SharedConfigKeys2["AuthAuthority"] = "AUTH_AUTHORITY";
20
+ SharedConfigKeys2["AuthCookieName"] = "AUTH_COOKIE_NAME";
21
+ SharedConfigKeys2["AuthCookieSecret"] = "AUTH_COOKIE_SECRET";
22
+ SharedConfigKeys2["DbEndpoint"] = "DB_ENDPOINT";
23
+ SharedConfigKeys2["JwtPrivateKey"] = "JWT_PRIVATE_KEY";
24
+ SharedConfigKeys2["ServiceLogLevel"] = "SERVICE_LOG_LEVEL";
25
+ SharedConfigKeys2["ServicePort"] = "SERVICE_PORT";
26
+ return SharedConfigKeys2;
27
+ })(SharedConfigKeys || {});
28
+
29
+ var AllianceHeaders = /* @__PURE__ */ ((AllianceHeaders2) => {
30
+ AllianceHeaders2["TargetUrl"] = "alliance-target-url";
31
+ AllianceHeaders2["TargetApp"] = "alliance-target-app";
32
+ AllianceHeaders2["TargetWorkspace"] = "alliance-target-workspace";
33
+ return AllianceHeaders2;
34
+ })(AllianceHeaders || {});
35
+
36
+ function authMiddleware(configService, {
37
+ baseURL = "https://127.0.0.1",
38
+ clientSecret,
39
+ clientID = " ",
40
+ authRequired = true,
41
+ authorizationParams = {},
42
+ afterCallback
43
+ } = {}) {
44
+ return expressOpenidConnect.auth({
45
+ baseURL,
46
+ clientSecret,
47
+ clientID,
48
+ authRequired,
49
+ authorizationParams,
50
+ afterCallback,
51
+ issuerBaseURL: `${configService.getOrThrow(
52
+ SharedConfigKeys.AuthAuthority
53
+ )}/.well-known/openid-configuration`,
54
+ secret: configService.getOrThrow(SharedConfigKeys.AuthCookieSecret),
55
+ session: {
56
+ name: configService.getOrThrow(SharedConfigKeys.AuthCookieName)
57
+ },
58
+ routes: {
59
+ callback: "/signin-oidc"
60
+ }
61
+ });
62
+ }
63
+
64
+ function createBearerToken({
65
+ privateKey,
66
+ aud,
67
+ sub,
68
+ name,
69
+ user,
70
+ workspace
71
+ }) {
72
+ const jwt = jsonwebtoken.sign(
73
+ {
74
+ iss: "Alliance",
75
+ aud,
76
+ sub,
77
+ name,
78
+ "https://alliance.teliacompany.net/user_type": user.type,
79
+ "https://alliance.teliacompany.net/user_privileges": user.permissions,
80
+ "https://alliance.teliacompany.net/workspace": workspace.slug,
81
+ "https://alliance.teliacompany.net/workspace_name": workspace.name,
82
+ "https://alliance.teliacompany.net/tenant": workspace.slug,
83
+ "https://alliance.teliacompany.net/tenant_name": workspace.name
84
+ },
85
+ privateKey,
86
+ {
87
+ expiresIn: "1h",
88
+ algorithm: "RS256"
89
+ }
90
+ );
91
+ return `Bearer ${jwt}`;
92
+ }
93
+ function getPrivateKey(configService) {
94
+ const privateKey = configService.getOrThrow(SharedConfigKeys.JwtPrivateKey);
95
+ return "-----BEGIN RSA PRIVATE KEY-----\n" + privateKey + "\n-----END RSA PRIVATE KEY-----";
96
+ }
97
+ function createSystemUserToken(configService) {
98
+ return createBearerToken({
99
+ aud: "system",
100
+ sub: "system",
101
+ name: "system",
102
+ workspace: {
103
+ slug: "system",
104
+ name: "system"
105
+ },
106
+ user: {
107
+ type: "system",
108
+ permissions: []
109
+ },
110
+ privateKey: getPrivateKey(configService)
111
+ });
112
+ }
113
+
114
+ function generateCookiePolicyHtml(appManifests) {
115
+ const cookiePolicyTableRows = [];
116
+ for (const appName in appManifests) {
117
+ const manifest = appManifests[appName];
118
+ if (!manifest.storage) {
119
+ continue;
120
+ }
121
+ for (const [key, value] of Object.entries(manifest.storage)) {
122
+ const tableRow = createCookiePolicyTableRow(key, value);
123
+ cookiePolicyTableRows.push(tableRow);
124
+ }
125
+ }
126
+ return cookiePolicyHtml.replace("{APP_COOKIES}", cookiePolicyTableRows.join(""));
127
+ }
128
+ function createCookiePolicyTableRow(key, claimEntry) {
129
+ const rows = ["<tr>"];
130
+ const { category, purpose, lifespan } = claimEntry;
131
+ rows.push(`<td>${key}</td>`);
132
+ rows.push(`<td>${category}</td>`);
133
+ rows.push(`<td>${purpose}</td>`);
134
+ rows.push(`<td>${lifespan}</td>`);
135
+ rows.push("</tr>");
136
+ return rows.join("");
137
+ }
138
+ const cookiePolicyHtml = `
139
+ <!DOCTYPE html>
140
+ <html lang="en">
141
+ <head>
142
+ <meta charset="UTF-8" />
143
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
144
+ <title>ACE Alliance - Cookie Policy</title>
145
+ <link
146
+ rel="icon"
147
+ href="data:image/png;base64,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"
148
+ />
149
+ <style>
150
+ @charset "UTF-8";
151
+ @import 'https://cdn.voca.teliacompany.com/fonts/TeliaSansV10/TeliaSans.css';
152
+ @import 'https://fonts.googleapis.com/css?family=Reenie+Beanie';
153
+
154
+ body {
155
+ font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
156
+ }
157
+
158
+ body > div {
159
+ max-width: 1000px;
160
+ margin: 0 auto;
161
+ padding: 0 40px 40px;
162
+ }
163
+ </style>
164
+ </head>
165
+
166
+ <body>
167
+ <div>
168
+ <h1>Cookie Policy</h1>
169
+ <p>
170
+ On our websites, we use cookies and other similar technologies. You can choose
171
+ whether you want to allow our websites to store cookies on your computer or not. You
172
+ can change your choices at any time.
173
+ </p>
174
+
175
+ <h2>Your consent is required</h2>
176
+ <p>
177
+ You choose whether you want to accept cookies on your device or not. Your consent is
178
+ required for the use of cookies, but not for such cookies that are necessary to
179
+ enable the service that you as a user have requested. If you do not accept our use
180
+ of cookies, or if you have previously approved our use and have changed your mind,
181
+ you can return to your cookie settings at any time and change your choices. You do
182
+ this by clicking on the cookie button/link. You may also need to change the settings
183
+ in your browser and manually delete cookies to clear your device of previously
184
+ stored cookies.
185
+ </p>
186
+
187
+ <h2>What are cookies?</h2>
188
+ <p>
189
+ A cookie is a small text file that is stored on your computer by the web browser
190
+ while browsing a website. When we refer to cookies (\u201Ccookies\u201D) in this policy, other
191
+ similar technologies and tools that retrieve and store information in your browser,
192
+ and in some cases forward such information to third parties, in a manner similar to
193
+ cookies. Examples are pixels, local storage, session storage and fingerprinting.
194
+ </p>
195
+ <p>
196
+ The websites will \u201Cremember\u201D and \u201Crecognize\u201D you. This can be done by placing
197
+ cookies in three different ways;
198
+ </p>
199
+ <ul>
200
+ <li>The session ends, ie until you close the window in your browser.</li>
201
+ <li>
202
+ Time-limited, ie the cookie has a predetermined lifespan. The time may vary
203
+ between different cookies.
204
+ </li>
205
+ <li>
206
+ Until further notice, ie the information remains until you choose to delete it
207
+ yourself. This applies to local storage.
208
+ </li>
209
+ </ul>
210
+ <p>You can always go into your browser and delete already stored cookies yourself.</p>
211
+
212
+ <h3>Third Party Cookies</h3>
213
+ <p>
214
+ We use third-party cookies on our websites. Third-party cookies are stored by
215
+ someone other than the person responsible for the website, in this case by a company
216
+ other than Telia.
217
+ </p>
218
+ <p>
219
+ Telia uses external platforms to communicate digitally, these include the Google
220
+ Marketing Platform and others. The platforms use both first- and third-party cookies
221
+ as well as similar techniques to advertise and follow up the results of the
222
+ advertising.
223
+ </p>
224
+ <p>
225
+ A third-party cookie can be used by several websites to understand and track how you
226
+ browse between different websites. Telia receives information from these cookies,
227
+ but the information can also be used for other purposes determined by third parties.
228
+ Third-party cookies found on our website are covered by each third-party privacy
229
+ policy. Feel free to read these to understand what other purposes the information
230
+ can be used for. Links are in our Cookie Table.
231
+ </p>
232
+ <p>
233
+ For information about which third-party cookies are used on our websites, see our
234
+ Cookie Table. For more information on how Telia handles personal data in connection
235
+ with transfers to third parties, read our Privacy Policy.
236
+ </p>
237
+
238
+ <h2>Cookies on our websites</h2>
239
+ <p>
240
+ In order for you to have better control over which cookies are used on the websites,
241
+ and thus be able to more easily decide how cookies should be used when you visit our
242
+ websites, we have identified four different categories of cookies. These categories
243
+ are defined based on the purposes for the use of the cookies.
244
+ </p>
245
+ <p>
246
+ In our Cookie Table, you can also see which category each cookie belongs to, for
247
+ what purposes it is used and for how long it is active.
248
+ </p>
249
+ <p>
250
+ We have identified the following four categories of cookies. All categories contain
251
+ cookies which means that data is shared with third parties.
252
+ </p>
253
+
254
+ <h3>Necessary</h3>
255
+ <p>
256
+ These cookies are needed for our app to work in a secure and correct way. Necessary
257
+ cookies enable you to use our app and us to provide the service you request.
258
+ Necessary cookies make basic functions of the app possible, for example, identifying
259
+ you when you log into My Telia, detecting repeated failed login attempts,
260
+ identifying where you are in the buying process and remembering the items put into
261
+ your shopping basket.
262
+ </p>
263
+
264
+ <h3>Functionality</h3>
265
+ <p>
266
+ These cookies let us to enable some useful functionalities to make the user
267
+ experience better, for example, to remember your login details and settings.
268
+ </p>
269
+
270
+ <h3>Analytics</h3>
271
+ <p>
272
+ These cookies give us information about how you use our app and allow us to improve
273
+ the user experience.
274
+ </p>
275
+
276
+ <h3>Marketing</h3>
277
+ <p>
278
+ These cookies help us and our partners to display personalized and relevant ads
279
+ based on your browsing behavior on our website and in our app, even when you later
280
+ visit other (third parties\u2019) websites. These cookies are used to evaluate the
281
+ effectiveness of our marketingcampaigns, as well as for targeted marketing and
282
+ profiling, regardless of which device(s) you have used. Information collected for
283
+ this purpose may also be combined with other customer and traffic data we have about
284
+ you, if you have given your consent that we may use your traffic data for marketing
285
+ purpose and have not objected to the use of your customer data for marketing
286
+ purposes.
287
+ </p>
288
+
289
+ <h2>Manage settings</h2>
290
+ <p>
291
+ We save your cookie consent for 12 months. Then we will ask you again. Please note
292
+ that some cookies have a lifespan that exceeds these 12 months. You may therefore
293
+ need to change the settings in your browser and manually delete all cookies.
294
+ </p>
295
+ <p>
296
+ More information on how to turn off cookies can be found in the instructions for
297
+ your browser.
298
+ </p>
299
+ <ul>
300
+ <li>
301
+ <a
302
+ href="https://support.google.com/accounts/answer/61416?co=GENIE.Platform%3DDesktop&amp;hl=en"
303
+ target="_blank"
304
+ rel="noopener noreferrer"
305
+ >Google Chrome</a
306
+ >
307
+ </li>
308
+ <li>
309
+ <a
310
+ href="https://privacy.microsoft.com/en-us/windows-10-microsoft-edge-and-privacy"
311
+ target="_blank"
312
+ rel="noopener noreferrer"
313
+ >Microsoft Edge</a
314
+ >
315
+ </li>
316
+ <li>
317
+ <a
318
+ href="https://support.mozilla.org/en-US/kb/enable-and-disable-cookies-website-preferences"
319
+ target="_blank"
320
+ rel="noopener noreferrer"
321
+ >Mozilla Firefox</a
322
+ >
323
+ </li>
324
+ <li>
325
+ <a
326
+ href="https://support.microsoft.com/en-gb/help/17442/windows-internet-explorer-delete-manage-cookies"
327
+ target="_blank"
328
+ rel="noopener noreferrer"
329
+ >Microsoft Internet Explorer</a
330
+ >
331
+ </li>
332
+ <li>
333
+ <a
334
+ href="https://www.opera.com/help/tutorials/security/privacy/"
335
+ target="_blank"
336
+ rel="noopener noreferrer"
337
+ >Opera</a
338
+ >
339
+ </li>
340
+ <li>
341
+ <a
342
+ href="https://support.apple.com/guide/safari/manage-cookies-and-website-data-sfri11471/mac"
343
+ target="_blank"
344
+ rel="noopener noreferrer"
345
+ >Apple Safari</a
346
+ >
347
+ </li>
348
+ </ul>
349
+
350
+ <h3>Do Not Track-signals</h3>
351
+ <p>
352
+ If you have chosen to turn on the Do Not Track function in your browser, we will not
353
+ automatically place cookies for marketing on your device. You make other choices in
354
+ your cookie settings.
355
+ </p>
356
+
357
+ <h3>If you block cookies</h3>
358
+ <p>
359
+ If you choose not to accept our use of cookies, the functionality and performance of
360
+ our websites may deteriorate as certain functions are dependent on cookies. A
361
+ blocking of cookies can therefore mean that the websites\u2019 services do not work as
362
+ they should.
363
+ </p>
364
+
365
+ <h3>Your security with us</h3>
366
+ <p>
367
+ If you want to read more about your rights and how we protect your privacy, go to
368
+ our privacy policy for
369
+ <a
370
+ href="https://www.telia.se/dam/jcr:df2eeb83-50ce-4383-89fc-0613f7615796/Integritetspolicy-privatkunder.pdf"
371
+ >private customers</a
372
+ >
373
+ (C2B) or
374
+ <a
375
+ href="https://www.telia.se/dam/jcr:95b2b4a5-82ca-436b-90e0-873e0a864118/Telia-integritetspolicy-foretag.pdf"
376
+ >corporate customers</a
377
+ >
378
+ (B2B). You are always welcome to contact us at
379
+ <a href="mailto:dpo-se@teliacompany.com">dpo-se@teliacompany.com</a> if you have any
380
+ questions.
381
+ </p>
382
+ <p>Our cookie policy may change in the future.</p>
383
+ <p>
384
+ More information about cookies can be found at the Swedish Post and Telecom
385
+ Authority (PTS).
386
+ </p>
387
+
388
+ <h2>Our Cookie Table</h2>
389
+ <p>
390
+ Below, you will find a list of the cookies and similar technologies that we use on
391
+ this website. These cookies are stored on your device by us.
392
+ </p>
393
+ <table>
394
+ <thead>
395
+ <tr>
396
+ <th>Cookie</th>
397
+ <th>Category</th>
398
+ <th>Purpose</th>
399
+ <th>Lifespan</th>
400
+ </tr>
401
+ </thead>
402
+ <tbody>
403
+ <tr>
404
+ <td>alliance-session-v1</td>
405
+ <td>necessary</td>
406
+ <td>Contains the authenticated user.</td>
407
+ <td>1 day</td>
408
+ </tr>
409
+ {APP_COOKIES}
410
+ </tbody>
411
+ </table>
412
+ <style>
413
+ table {
414
+ width: 100%;
415
+ border: 1px solid rgba(0, 0, 0, 0.15);
416
+ }
417
+ th, td {
418
+ text-align: left;
419
+ padding: 3px;
420
+ }
421
+ </style>
422
+ </div>
423
+ </body>
424
+ </html>
425
+ `;
426
+
427
+ function getJsonSchemas() {
428
+ const frameworkDistDirPath = node_path.resolve(
429
+ process.cwd(),
430
+ "node_modules",
431
+ "@telia-ace/alliance-framework",
432
+ "dist"
433
+ );
434
+ const appConfigSchemaPath = node_path.resolve(frameworkDistDirPath, "config.schema.json");
435
+ const appManifestSchemaPath = node_path.resolve(frameworkDistDirPath, "manifest.schema.json");
436
+ const appConfigSchemaFile = node_fs.readFileSync(appConfigSchemaPath).toString();
437
+ const appManifestSchemaFile = node_fs.readFileSync(appManifestSchemaPath).toString();
438
+ const appConfig = JSON.parse(appConfigSchemaFile);
439
+ const appManifest = JSON.parse(appManifestSchemaFile);
440
+ return {
441
+ appConfig,
442
+ appManifest
443
+ };
444
+ }
445
+
446
+ async function createTempModuleAndImport(moduleString, fileName) {
447
+ const file = node_path.resolve(process.cwd(), `${fileName}.mjs`);
448
+ node_fs.writeFileSync(file, moduleString);
449
+ const importedModule = await import(`file:///${file}`);
450
+ node_fs.rmSync(file, { force: true });
451
+ return importedModule;
452
+ }
453
+ async function getAppManifests(apps) {
454
+ const moduleStringParts = [];
455
+ const manifestImportVariables = [];
456
+ for (const packageName of apps) {
457
+ const manifestImportVariable = `app${apps.indexOf(packageName)}`;
458
+ manifestImportVariables.push(manifestImportVariable);
459
+ moduleStringParts.push(`import ${manifestImportVariable} from '${packageName}/manifest';`);
460
+ }
461
+ moduleStringParts.push(`export default [${manifestImportVariables.join(", ")}];`);
462
+ const result = await createTempModuleAndImport(
463
+ moduleStringParts.join("\n"),
464
+ "app-manifests"
465
+ );
466
+ return result.default;
467
+ }
468
+
469
+ function getPkgJson() {
470
+ const packageJson = node_path.resolve(process.cwd(), "package.json");
471
+ const pkgJsonFile = node_fs.readFileSync(packageJson).toString();
472
+ return JSON.parse(pkgJsonFile);
473
+ }
474
+ async function getManifests(pkgJson) {
475
+ if (!pkgJson || !pkgJson.alliance || !pkgJson.alliance.apps) {
476
+ throw new Error("Alliance apps not defined in package.json.");
477
+ }
478
+ const manifestArray = await getAppManifests(pkgJson.alliance.apps);
479
+ return manifestArray.reduce((acc, curr) => {
480
+ acc[curr.name] = curr;
481
+ return acc;
482
+ }, {});
483
+ }
484
+
485
+ const PUBLIC_DIR_NAME = "public";
486
+ const MANIFESTS_FILE_NAME = "manifests.json";
487
+ const COOKIE_POLICY_FILE_NAME = "cookie-policy.html";
488
+ const APP_CONFIG_SCHEMA_FILE_NAME = "config.schema.json";
489
+ const APP_MANIFEST_SCHEMA_FILE_NAME = "manifest.schema.json";
490
+ async function createPublicDistributionFiles() {
491
+ const pkgJson = getPkgJson();
492
+ const manifests = await getManifests(pkgJson);
493
+ const schemas = getJsonSchemas();
494
+ for (const appName in manifests) {
495
+ const manifest = manifests[appName];
496
+ const validationResult = jsonschema.validate(manifest, schemas.appManifest);
497
+ if (validationResult.errors.length) {
498
+ const errors = validationResult.errors.map((e) => JSON.stringify(e, null, 2));
499
+ throw new Error(
500
+ `Validation of app manifest for app '${appName}' failed with the following errors:
501
+ ${errors.join(
502
+ "\n"
503
+ )}`
504
+ );
505
+ }
506
+ }
507
+ const publicDirPath = node_path.resolve(process.cwd(), PUBLIC_DIR_NAME);
508
+ if (!node_fs.existsSync(publicDirPath)) {
509
+ node_fs.mkdirSync(publicDirPath);
510
+ }
511
+ const manifestsFilePath = node_path.resolve(publicDirPath, MANIFESTS_FILE_NAME);
512
+ node_fs.writeFileSync(manifestsFilePath, JSON.stringify(manifests));
513
+ const cookiePolicyFilePath = node_path.resolve(publicDirPath, COOKIE_POLICY_FILE_NAME);
514
+ node_fs.writeFileSync(cookiePolicyFilePath, generateCookiePolicyHtml(manifests));
515
+ const appConfigSchemaFilePath = node_path.resolve(publicDirPath, APP_CONFIG_SCHEMA_FILE_NAME);
516
+ const appManifestSchemaFilePath = node_path.resolve(publicDirPath, APP_MANIFEST_SCHEMA_FILE_NAME);
517
+ node_fs.writeFileSync(appConfigSchemaFilePath, JSON.stringify(schemas.appConfig));
518
+ node_fs.writeFileSync(appManifestSchemaFilePath, JSON.stringify(schemas.appManifest));
519
+ }
520
+
521
+ var GatewayErrorCodes = /* @__PURE__ */ ((GatewayErrorCodes2) => {
522
+ GatewayErrorCodes2[GatewayErrorCodes2["NoMatchingEndpoint"] = 1e4] = "NoMatchingEndpoint";
523
+ GatewayErrorCodes2[GatewayErrorCodes2["NoObjectId"] = 10001] = "NoObjectId";
524
+ GatewayErrorCodes2[GatewayErrorCodes2["NoTargetAppHeader"] = 10002] = "NoTargetAppHeader";
525
+ GatewayErrorCodes2[GatewayErrorCodes2["NoTargetWorkspaceHeader"] = 10003] = "NoTargetWorkspaceHeader";
526
+ GatewayErrorCodes2[GatewayErrorCodes2["NoManifestsInCache"] = 10004] = "NoManifestsInCache";
527
+ GatewayErrorCodes2[GatewayErrorCodes2["NoDevSessionInCache"] = 10005] = "NoDevSessionInCache";
528
+ GatewayErrorCodes2[GatewayErrorCodes2["NoManifest"] = 10006] = "NoManifest";
529
+ GatewayErrorCodes2[GatewayErrorCodes2["NoRequestContext"] = 10007] = "NoRequestContext";
530
+ GatewayErrorCodes2[GatewayErrorCodes2["NoUserInRequestContext"] = 10008] = "NoUserInRequestContext";
531
+ GatewayErrorCodes2[GatewayErrorCodes2["NoAppInRequestContext"] = 10009] = "NoAppInRequestContext";
532
+ GatewayErrorCodes2[GatewayErrorCodes2["NoWorkspaceInRequestContext"] = 10010] = "NoWorkspaceInRequestContext";
533
+ GatewayErrorCodes2[GatewayErrorCodes2["NoManifestInRequestContext"] = 10011] = "NoManifestInRequestContext";
534
+ GatewayErrorCodes2[GatewayErrorCodes2["NoUserPermissionsInRequestContext"] = 10012] = "NoUserPermissionsInRequestContext";
535
+ return GatewayErrorCodes2;
536
+ })(GatewayErrorCodes || {});
537
+ var DatabasesErrorCodes = /* @__PURE__ */ ((DatabasesErrorCodes2) => {
538
+ DatabasesErrorCodes2[DatabasesErrorCodes2["NoPublicKey"] = 11e3] = "NoPublicKey";
539
+ DatabasesErrorCodes2[DatabasesErrorCodes2["NoAuthHeader"] = 11001] = "NoAuthHeader";
540
+ DatabasesErrorCodes2[DatabasesErrorCodes2["FailedFileStore"] = 11002] = "FailedFileStore";
541
+ DatabasesErrorCodes2[DatabasesErrorCodes2["FailedFileRead"] = 11003] = "FailedFileRead";
542
+ return DatabasesErrorCodes2;
543
+ })(DatabasesErrorCodes || {});
544
+ var PortalErrorCodes = /* @__PURE__ */ ((PortalErrorCodes2) => {
545
+ PortalErrorCodes2[PortalErrorCodes2["NoObjectId"] = 12e3] = "NoObjectId";
546
+ return PortalErrorCodes2;
547
+ })(PortalErrorCodes || {});
548
+ const allianceErrors = {
549
+ // gateway
550
+ [1e4 /* NoMatchingEndpoint */]: {
551
+ httpCode: common.HttpStatus.BAD_REQUEST,
552
+ message: "Could not find endpoint matching request in app manifest."
553
+ },
554
+ [10001 /* NoObjectId */]: {
555
+ httpCode: common.HttpStatus.UNAUTHORIZED,
556
+ message: "No object id available on authenticated user."
557
+ },
558
+ [10002 /* NoTargetAppHeader */]: {
559
+ httpCode: common.HttpStatus.BAD_REQUEST,
560
+ message: `Request missing header '${AllianceHeaders.TargetApp}'.`
561
+ },
562
+ [10003 /* NoTargetWorkspaceHeader */]: {
563
+ httpCode: common.HttpStatus.BAD_REQUEST,
564
+ message: `Request missing header '${AllianceHeaders.TargetWorkspace}'.`
565
+ },
566
+ [10004 /* NoManifestsInCache */]: {
567
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
568
+ message: "App manifests missing in cache."
569
+ },
570
+ [10005 /* NoDevSessionInCache */]: {
571
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
572
+ message: "No dev session in memory cache."
573
+ },
574
+ [10006 /* NoManifest */]: {
575
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
576
+ message: "Could not find manifest for app '{{appSlug}}'."
577
+ },
578
+ [10007 /* NoRequestContext */]: {
579
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
580
+ message: "No request context."
581
+ },
582
+ [10008 /* NoUserInRequestContext */]: {
583
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
584
+ message: "No user in request context."
585
+ },
586
+ [10009 /* NoAppInRequestContext */]: {
587
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
588
+ message: "No app in request context."
589
+ },
590
+ [10010 /* NoWorkspaceInRequestContext */]: {
591
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
592
+ message: "No workspace in request context."
593
+ },
594
+ [10011 /* NoManifestInRequestContext */]: {
595
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
596
+ message: "No manifest in request context."
597
+ },
598
+ [10012 /* NoUserPermissionsInRequestContext */]: {
599
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
600
+ message: "No user permissions in request context."
601
+ },
602
+ // databases
603
+ [11e3 /* NoPublicKey */]: {
604
+ httpCode: common.HttpStatus.UNAUTHORIZED,
605
+ message: "No public key available to decode JWT."
606
+ },
607
+ [11001 /* NoAuthHeader */]: {
608
+ httpCode: common.HttpStatus.UNAUTHORIZED,
609
+ message: "No authorization header found."
610
+ },
611
+ [11002 /* FailedFileStore */]: {
612
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
613
+ message: "Error storing file."
614
+ },
615
+ [11003 /* FailedFileRead */]: {
616
+ httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
617
+ message: "Error reading file."
618
+ },
619
+ // portal
620
+ [12e3 /* NoObjectId */]: {
621
+ httpCode: common.HttpStatus.UNAUTHORIZED,
622
+ message: "No object id found in user claims."
623
+ }
624
+ };
625
+
626
+ function parseTemplates(message, variables) {
627
+ return Object.entries(variables).reduce((acc, [key, value]) => {
628
+ return acc.replaceAll(`{{${key}}}`, value);
629
+ }, message);
630
+ }
631
+ class AllianceException extends common.HttpException {
632
+ constructor(code, variables = {}) {
633
+ const { message, httpCode } = allianceErrors[code];
634
+ super(parseTemplates(message, variables), httpCode);
635
+ this.code = code;
636
+ this.info = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${code}`;
637
+ }
638
+ }
639
+
640
+ var __defProp$2 = Object.defineProperty;
641
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
642
+ var __decorateClass$2 = (decorators, target, key, kind) => {
643
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
644
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
645
+ if (decorator = decorators[i])
646
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
647
+ if (kind && result)
648
+ __defProp$2(target, key, result);
649
+ return result;
650
+ };
651
+ exports.AllianceExceptionFilter = class AllianceExceptionFilter {
652
+ catch(exception, host) {
653
+ const ctx = host.switchToHttp();
654
+ const response = ctx.getResponse();
655
+ const status = exception.getStatus();
656
+ response.status && response.status(status).json({
657
+ httpCode: status,
658
+ code: exception.code,
659
+ info: exception.info,
660
+ message: exception.message
661
+ });
662
+ }
663
+ };
664
+ exports.AllianceExceptionFilter = __decorateClass$2([
665
+ common.Catch(AllianceException)
666
+ ], exports.AllianceExceptionFilter);
667
+
668
+ var __defProp$1 = Object.defineProperty;
669
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
670
+ var __decorateClass$1 = (decorators, target, key, kind) => {
671
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
672
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
673
+ if (decorator = decorators[i])
674
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
675
+ if (kind && result)
676
+ __defProp$1(target, key, result);
677
+ return result;
678
+ };
679
+ var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
680
+ exports.LoggerService = class LoggerService {
681
+ constructor(logger) {
682
+ this.logger = logger;
683
+ this.log = (...args) => this.logger.info(...args);
684
+ this.trace = (...args) => this.logger.trace(...args);
685
+ this.debug = (...args) => this.logger.debug(...args);
686
+ this.info = (...args) => this.logger.info(...args);
687
+ this.warn = (...args) => this.logger.warn(...args);
688
+ this.error = (...args) => this.logger.error(...args);
689
+ this.fatal = (...args) => this.logger.fatal(...args);
690
+ }
691
+ };
692
+ exports.LoggerService = __decorateClass$1([
693
+ common.Injectable(),
694
+ __decorateParam(0, nestjsPino.InjectPinoLogger())
695
+ ], exports.LoggerService);
696
+
697
+ var __defProp = Object.defineProperty;
698
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
699
+ var __decorateClass = (decorators, target, key, kind) => {
700
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
701
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
702
+ if (decorator = decorators[i])
703
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
704
+ if (kind && result)
705
+ __defProp(target, key, result);
706
+ return result;
707
+ };
708
+ exports.LoggerModule = class LoggerModule {
709
+ static forRoot({ logLevel, redact = true } = {}) {
710
+ return {
711
+ module: exports.LoggerModule,
712
+ controllers: [],
713
+ imports: [
714
+ nestjsPino.LoggerModule.forRootAsync({
715
+ imports: [config.ConfigModule],
716
+ inject: [config.ConfigService],
717
+ useFactory: async (configService) => ({
718
+ pinoHttp: {
719
+ level: logLevel || configService.get(SharedConfigKeys.ServiceLogLevel) || "silent",
720
+ redact: redact ? [
721
+ "authorization",
722
+ "headers.authorization",
723
+ "req.headers.authorization",
724
+ "req.remoteAddress",
725
+ "req.remotePort"
726
+ ] : [],
727
+ transport: {
728
+ target: "pino-pretty",
729
+ options: {
730
+ colorize: true,
731
+ colorizeObjects: true
732
+ }
733
+ }
734
+ }
735
+ })
736
+ })
737
+ ],
738
+ global: true,
739
+ providers: [exports.LoggerService],
740
+ exports: []
741
+ };
742
+ }
743
+ };
744
+ exports.LoggerModule = __decorateClass([
745
+ common.Module({
746
+ providers: [exports.LoggerService],
747
+ exports: [exports.LoggerService]
748
+ })
749
+ ], exports.LoggerModule);
750
+
751
+ function slugify(name) {
752
+ return _slugify__default(name, { strict: true, replacement: "-", lower: true });
753
+ }
754
+
755
+ function viteCssImportPlugin(outFilePath, relativePath = false) {
756
+ return {
757
+ name: "vite-plugin-css-import",
758
+ apply: "build",
759
+ enforce: "post",
760
+ writeBundle: async (_, bundle) => {
761
+ const cssFiles = Object.keys(bundle).filter((fileName) => fileName.endsWith(".css"));
762
+ if (!cssFiles.length) {
763
+ return;
764
+ }
765
+ const tempTargetFilePath = node_path.resolve(process.cwd(), `${outFilePath}-temp.js`);
766
+ const targetFilePath = node_path.resolve(process.cwd(), `${outFilePath}.js`);
767
+ const cssImportStatement = cssFiles.reduce((acc, cssFile) => {
768
+ if (relativePath) {
769
+ const targetDirname = node_path.dirname(targetFilePath);
770
+ const relativePath2 = node_path.relative(targetDirname, cssFile);
771
+ return `${acc}import "${relativePath2.replaceAll("\\", "/")}";
772
+ `;
773
+ }
774
+ return `${acc}import "./${cssFile}";
775
+ `;
776
+ }, "");
777
+ const writeStream = node_fs.createWriteStream(tempTargetFilePath);
778
+ writeStream.write(cssImportStatement, "utf8");
779
+ const readStream = node_fs.createReadStream(targetFilePath);
780
+ await promises.pipeline(readStream, writeStream);
781
+ node_fs.rmSync(targetFilePath, { force: true });
782
+ node_fs.renameSync(tempTargetFilePath, targetFilePath);
783
+ writeStream.end();
784
+ }
785
+ };
786
+ }
787
+
788
+ exports.LoggerErrorInterceptor = nestjsPino.LoggerErrorInterceptor;
789
+ exports.AllianceException = AllianceException;
790
+ exports.AllianceHeaders = AllianceHeaders;
791
+ exports.DatabasesErrorCodes = DatabasesErrorCodes;
792
+ exports.GatewayErrorCodes = GatewayErrorCodes;
793
+ exports.PortalErrorCodes = PortalErrorCodes;
794
+ exports.SharedConfigKeys = SharedConfigKeys;
795
+ exports.authMiddleware = authMiddleware;
796
+ exports.createBearerToken = createBearerToken;
797
+ exports.createPublicDistributionFiles = createPublicDistributionFiles;
798
+ exports.createSystemUserToken = createSystemUserToken;
799
+ exports.getAppManifests = getAppManifests;
800
+ exports.getPrivateKey = getPrivateKey;
801
+ exports.slugify = slugify;
802
+ exports.viteCssImportPlugin = viteCssImportPlugin;