@telia-ace/alliance-internal-node-utilities 1.0.2-next.0 → 1.0.2
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 +13 -0
- package/dist/distribution/cookie-policy.d.ts +2 -0
- package/dist/distribution/create-public-files.d.ts +1 -0
- package/dist/distribution/index.d.ts +1 -0
- package/dist/distribution/json-schemas.d.ts +7 -0
- package/dist/distribution/pkg-json.d.ts +13 -0
- package/dist/exceptions/codes.d.ts +2 -1
- package/dist/get-app-manifests.d.ts +2 -0
- package/dist/index.cjs +807 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +788 -5
- package/dist/types.d.ts +1 -0
- package/package.json +8 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,807 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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,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=="
|
|
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&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
|
+
GatewayErrorCodes2[GatewayErrorCodes2["WorkspacePermissionDenied"] = 10013] = "WorkspacePermissionDenied";
|
|
536
|
+
return GatewayErrorCodes2;
|
|
537
|
+
})(GatewayErrorCodes || {});
|
|
538
|
+
var DatabasesErrorCodes = /* @__PURE__ */ ((DatabasesErrorCodes2) => {
|
|
539
|
+
DatabasesErrorCodes2[DatabasesErrorCodes2["NoPublicKey"] = 11e3] = "NoPublicKey";
|
|
540
|
+
DatabasesErrorCodes2[DatabasesErrorCodes2["NoAuthHeader"] = 11001] = "NoAuthHeader";
|
|
541
|
+
DatabasesErrorCodes2[DatabasesErrorCodes2["FailedFileStore"] = 11002] = "FailedFileStore";
|
|
542
|
+
DatabasesErrorCodes2[DatabasesErrorCodes2["FailedFileRead"] = 11003] = "FailedFileRead";
|
|
543
|
+
return DatabasesErrorCodes2;
|
|
544
|
+
})(DatabasesErrorCodes || {});
|
|
545
|
+
var PortalErrorCodes = /* @__PURE__ */ ((PortalErrorCodes2) => {
|
|
546
|
+
PortalErrorCodes2[PortalErrorCodes2["NoObjectId"] = 12e3] = "NoObjectId";
|
|
547
|
+
return PortalErrorCodes2;
|
|
548
|
+
})(PortalErrorCodes || {});
|
|
549
|
+
const allianceErrors = {
|
|
550
|
+
// gateway
|
|
551
|
+
[1e4 /* NoMatchingEndpoint */]: {
|
|
552
|
+
httpCode: common.HttpStatus.BAD_REQUEST,
|
|
553
|
+
message: "Could not find endpoint matching request in app manifest."
|
|
554
|
+
},
|
|
555
|
+
[10001 /* NoObjectId */]: {
|
|
556
|
+
httpCode: common.HttpStatus.UNAUTHORIZED,
|
|
557
|
+
message: "No object id available on authenticated user."
|
|
558
|
+
},
|
|
559
|
+
[10002 /* NoTargetAppHeader */]: {
|
|
560
|
+
httpCode: common.HttpStatus.BAD_REQUEST,
|
|
561
|
+
message: `Request missing header '${AllianceHeaders.TargetApp}'.`
|
|
562
|
+
},
|
|
563
|
+
[10003 /* NoTargetWorkspaceHeader */]: {
|
|
564
|
+
httpCode: common.HttpStatus.BAD_REQUEST,
|
|
565
|
+
message: `Request missing header '${AllianceHeaders.TargetWorkspace}'.`
|
|
566
|
+
},
|
|
567
|
+
[10004 /* NoManifestsInCache */]: {
|
|
568
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
569
|
+
message: "App manifests missing in cache."
|
|
570
|
+
},
|
|
571
|
+
[10005 /* NoDevSessionInCache */]: {
|
|
572
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
573
|
+
message: "No dev session in memory cache."
|
|
574
|
+
},
|
|
575
|
+
[10006 /* NoManifest */]: {
|
|
576
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
577
|
+
message: "Could not find manifest for app '{{appSlug}}'."
|
|
578
|
+
},
|
|
579
|
+
[10007 /* NoRequestContext */]: {
|
|
580
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
581
|
+
message: "No request context."
|
|
582
|
+
},
|
|
583
|
+
[10008 /* NoUserInRequestContext */]: {
|
|
584
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
585
|
+
message: "No user in request context."
|
|
586
|
+
},
|
|
587
|
+
[10009 /* NoAppInRequestContext */]: {
|
|
588
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
589
|
+
message: "No app in request context."
|
|
590
|
+
},
|
|
591
|
+
[10010 /* NoWorkspaceInRequestContext */]: {
|
|
592
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
593
|
+
message: "No workspace in request context."
|
|
594
|
+
},
|
|
595
|
+
[10011 /* NoManifestInRequestContext */]: {
|
|
596
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
597
|
+
message: "No manifest in request context."
|
|
598
|
+
},
|
|
599
|
+
[10012 /* NoUserPermissionsInRequestContext */]: {
|
|
600
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
601
|
+
message: "No user permissions in request context."
|
|
602
|
+
},
|
|
603
|
+
[10013 /* WorkspacePermissionDenied */]: {
|
|
604
|
+
httpCode: common.HttpStatus.FORBIDDEN,
|
|
605
|
+
message: "User does not have access to the current workspace."
|
|
606
|
+
},
|
|
607
|
+
// databases
|
|
608
|
+
[11e3 /* NoPublicKey */]: {
|
|
609
|
+
httpCode: common.HttpStatus.UNAUTHORIZED,
|
|
610
|
+
message: "No public key available to decode JWT."
|
|
611
|
+
},
|
|
612
|
+
[11001 /* NoAuthHeader */]: {
|
|
613
|
+
httpCode: common.HttpStatus.UNAUTHORIZED,
|
|
614
|
+
message: "No authorization header found."
|
|
615
|
+
},
|
|
616
|
+
[11002 /* FailedFileStore */]: {
|
|
617
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
618
|
+
message: "Error storing file."
|
|
619
|
+
},
|
|
620
|
+
[11003 /* FailedFileRead */]: {
|
|
621
|
+
httpCode: common.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
622
|
+
message: "Error reading file."
|
|
623
|
+
},
|
|
624
|
+
// portal
|
|
625
|
+
[12e3 /* NoObjectId */]: {
|
|
626
|
+
httpCode: common.HttpStatus.UNAUTHORIZED,
|
|
627
|
+
message: "No object id found in user claims."
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
function parseTemplates(message, variables) {
|
|
632
|
+
return Object.entries(variables).reduce((acc, [key, value]) => {
|
|
633
|
+
return acc.replaceAll(`{{${key}}}`, value);
|
|
634
|
+
}, message);
|
|
635
|
+
}
|
|
636
|
+
class AllianceException extends common.HttpException {
|
|
637
|
+
constructor(code, variables = {}) {
|
|
638
|
+
const { message, httpCode } = allianceErrors[code];
|
|
639
|
+
super(parseTemplates(message, variables), httpCode);
|
|
640
|
+
this.code = code;
|
|
641
|
+
this.info = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${code}`;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
var __defProp$2 = Object.defineProperty;
|
|
646
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
647
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
648
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
649
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
650
|
+
if (decorator = decorators[i])
|
|
651
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
652
|
+
if (kind && result)
|
|
653
|
+
__defProp$2(target, key, result);
|
|
654
|
+
return result;
|
|
655
|
+
};
|
|
656
|
+
exports.AllianceExceptionFilter = class AllianceExceptionFilter {
|
|
657
|
+
catch(exception, host) {
|
|
658
|
+
const ctx = host.switchToHttp();
|
|
659
|
+
const response = ctx.getResponse();
|
|
660
|
+
const status = exception.getStatus();
|
|
661
|
+
response.status && response.status(status).json({
|
|
662
|
+
httpCode: status,
|
|
663
|
+
code: exception.code,
|
|
664
|
+
info: exception.info,
|
|
665
|
+
message: exception.message
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
exports.AllianceExceptionFilter = __decorateClass$2([
|
|
670
|
+
common.Catch(AllianceException)
|
|
671
|
+
], exports.AllianceExceptionFilter);
|
|
672
|
+
|
|
673
|
+
var __defProp$1 = Object.defineProperty;
|
|
674
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
675
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
676
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
677
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
678
|
+
if (decorator = decorators[i])
|
|
679
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
680
|
+
if (kind && result)
|
|
681
|
+
__defProp$1(target, key, result);
|
|
682
|
+
return result;
|
|
683
|
+
};
|
|
684
|
+
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
685
|
+
exports.LoggerService = class LoggerService {
|
|
686
|
+
constructor(logger) {
|
|
687
|
+
this.logger = logger;
|
|
688
|
+
this.log = (...args) => this.logger.info(...args);
|
|
689
|
+
this.trace = (...args) => this.logger.trace(...args);
|
|
690
|
+
this.debug = (...args) => this.logger.debug(...args);
|
|
691
|
+
this.info = (...args) => this.logger.info(...args);
|
|
692
|
+
this.warn = (...args) => this.logger.warn(...args);
|
|
693
|
+
this.error = (...args) => this.logger.error(...args);
|
|
694
|
+
this.fatal = (...args) => this.logger.fatal(...args);
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
exports.LoggerService = __decorateClass$1([
|
|
698
|
+
common.Injectable(),
|
|
699
|
+
__decorateParam(0, nestjsPino.InjectPinoLogger())
|
|
700
|
+
], exports.LoggerService);
|
|
701
|
+
|
|
702
|
+
var __defProp = Object.defineProperty;
|
|
703
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
704
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
705
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
706
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
707
|
+
if (decorator = decorators[i])
|
|
708
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
709
|
+
if (kind && result)
|
|
710
|
+
__defProp(target, key, result);
|
|
711
|
+
return result;
|
|
712
|
+
};
|
|
713
|
+
exports.LoggerModule = class LoggerModule {
|
|
714
|
+
static forRoot({ logLevel, redact = true } = {}) {
|
|
715
|
+
return {
|
|
716
|
+
module: exports.LoggerModule,
|
|
717
|
+
controllers: [],
|
|
718
|
+
imports: [
|
|
719
|
+
nestjsPino.LoggerModule.forRootAsync({
|
|
720
|
+
imports: [config.ConfigModule],
|
|
721
|
+
inject: [config.ConfigService],
|
|
722
|
+
useFactory: async (configService) => ({
|
|
723
|
+
pinoHttp: {
|
|
724
|
+
level: logLevel || configService.get(SharedConfigKeys.ServiceLogLevel) || "silent",
|
|
725
|
+
redact: redact ? [
|
|
726
|
+
"authorization",
|
|
727
|
+
"headers.authorization",
|
|
728
|
+
"req.headers.authorization",
|
|
729
|
+
"req.remoteAddress",
|
|
730
|
+
"req.remotePort"
|
|
731
|
+
] : [],
|
|
732
|
+
transport: {
|
|
733
|
+
target: "pino-pretty",
|
|
734
|
+
options: {
|
|
735
|
+
colorize: true,
|
|
736
|
+
colorizeObjects: true
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
})
|
|
741
|
+
})
|
|
742
|
+
],
|
|
743
|
+
global: true,
|
|
744
|
+
providers: [exports.LoggerService],
|
|
745
|
+
exports: []
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
exports.LoggerModule = __decorateClass([
|
|
750
|
+
common.Module({
|
|
751
|
+
providers: [exports.LoggerService],
|
|
752
|
+
exports: [exports.LoggerService]
|
|
753
|
+
})
|
|
754
|
+
], exports.LoggerModule);
|
|
755
|
+
|
|
756
|
+
function slugify(name) {
|
|
757
|
+
return _slugify__default(name, { strict: true, replacement: "-", lower: true });
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
function viteCssImportPlugin(outFilePath, relativePath = false) {
|
|
761
|
+
return {
|
|
762
|
+
name: "vite-plugin-css-import",
|
|
763
|
+
apply: "build",
|
|
764
|
+
enforce: "post",
|
|
765
|
+
writeBundle: async (_, bundle) => {
|
|
766
|
+
const cssFiles = Object.keys(bundle).filter((fileName) => fileName.endsWith(".css"));
|
|
767
|
+
if (!cssFiles.length) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
const tempTargetFilePath = node_path.resolve(process.cwd(), `${outFilePath}-temp.js`);
|
|
771
|
+
const targetFilePath = node_path.resolve(process.cwd(), `${outFilePath}.js`);
|
|
772
|
+
const cssImportStatement = cssFiles.reduce((acc, cssFile) => {
|
|
773
|
+
if (relativePath) {
|
|
774
|
+
const targetDirname = node_path.dirname(targetFilePath);
|
|
775
|
+
const relativePath2 = node_path.relative(targetDirname, cssFile);
|
|
776
|
+
return `${acc}import "${relativePath2.replaceAll("\\", "/")}";
|
|
777
|
+
`;
|
|
778
|
+
}
|
|
779
|
+
return `${acc}import "./${cssFile}";
|
|
780
|
+
`;
|
|
781
|
+
}, "");
|
|
782
|
+
const writeStream = node_fs.createWriteStream(tempTargetFilePath);
|
|
783
|
+
writeStream.write(cssImportStatement, "utf8");
|
|
784
|
+
const readStream = node_fs.createReadStream(targetFilePath);
|
|
785
|
+
await promises.pipeline(readStream, writeStream);
|
|
786
|
+
node_fs.rmSync(targetFilePath, { force: true });
|
|
787
|
+
node_fs.renameSync(tempTargetFilePath, targetFilePath);
|
|
788
|
+
writeStream.end();
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
exports.LoggerErrorInterceptor = nestjsPino.LoggerErrorInterceptor;
|
|
794
|
+
exports.AllianceException = AllianceException;
|
|
795
|
+
exports.AllianceHeaders = AllianceHeaders;
|
|
796
|
+
exports.DatabasesErrorCodes = DatabasesErrorCodes;
|
|
797
|
+
exports.GatewayErrorCodes = GatewayErrorCodes;
|
|
798
|
+
exports.PortalErrorCodes = PortalErrorCodes;
|
|
799
|
+
exports.SharedConfigKeys = SharedConfigKeys;
|
|
800
|
+
exports.authMiddleware = authMiddleware;
|
|
801
|
+
exports.createBearerToken = createBearerToken;
|
|
802
|
+
exports.createPublicDistributionFiles = createPublicDistributionFiles;
|
|
803
|
+
exports.createSystemUserToken = createSystemUserToken;
|
|
804
|
+
exports.getAppManifests = getAppManifests;
|
|
805
|
+
exports.getPrivateKey = getPrivateKey;
|
|
806
|
+
exports.slugify = slugify;
|
|
807
|
+
exports.viteCssImportPlugin = viteCssImportPlugin;
|