@telia-ace/alliance-utilities 1.0.13-next.0 → 1.0.14-next.0
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 +20 -0
- package/dist/index.d.ts +35 -3
- package/dist/index.js +89 -690
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/get-current-user.d.ts +0 -24
- package/dist/get-current-workspace.d.ts +0 -6
- package/dist/get-translator.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @telia-ace/alliance-utilities
|
|
2
2
|
|
|
3
|
+
## 1.0.14-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cd44395: Replace Vite with Tsup when building packages.
|
|
8
|
+
- Updated dependencies [cd44395]
|
|
9
|
+
- Updated dependencies [cd44395]
|
|
10
|
+
- Updated dependencies [cd44395]
|
|
11
|
+
- Updated dependencies [cd44395]
|
|
12
|
+
- @telia-ace/alliance-framework@1.0.13-next.0
|
|
13
|
+
- @telia-ace/alliance-internal-client-utilities@1.0.4-next.0
|
|
14
|
+
|
|
15
|
+
## 1.0.13
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [3489aea]
|
|
20
|
+
- @telia-ace/alliance-internal-client-utilities@1.0.3
|
|
21
|
+
- @telia-ace/alliance-framework@1.0.12
|
|
22
|
+
|
|
3
23
|
## 1.0.13-next.0
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type CurrentUser = {
|
|
2
|
+
displayName: string;
|
|
3
|
+
email: string;
|
|
4
|
+
type: 'system-admin' | 'user';
|
|
5
|
+
objectId: string;
|
|
6
|
+
permissions: {
|
|
7
|
+
permission: {
|
|
8
|
+
name: string;
|
|
9
|
+
app: {
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}[];
|
|
14
|
+
workspaces: {
|
|
15
|
+
workspace: {
|
|
16
|
+
name: string;
|
|
17
|
+
slug: string;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
20
|
+
hasPermission: (appName: string, permissionName: string) => boolean;
|
|
21
|
+
isSystemAdmin: () => boolean;
|
|
22
|
+
};
|
|
23
|
+
declare function getCurrentUser(): Promise<CurrentUser>;
|
|
24
|
+
|
|
25
|
+
type CurrentWorkspace = {
|
|
26
|
+
name: string;
|
|
27
|
+
slug: string;
|
|
28
|
+
};
|
|
29
|
+
declare function getCurrentWorkspace(): Promise<CurrentWorkspace>;
|
|
30
|
+
|
|
31
|
+
type RecordEntries = Record<string, string>;
|
|
32
|
+
type TranslatorFunction = (key: string, params?: RecordEntries) => string;
|
|
33
|
+
declare function getTranslator(): Promise<TranslatorFunction>;
|
|
34
|
+
|
|
35
|
+
export { TranslatorFunction, getCurrentUser, getCurrentWorkspace, getTranslator };
|
package/dist/index.js
CHANGED
|
@@ -1,701 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
13
|
-
},
|
|
14
|
-
write: function(e) {
|
|
15
|
-
return encodeURIComponent(e).replace(
|
|
16
|
-
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
17
|
-
decodeURIComponent
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
function P(e, r) {
|
|
22
|
-
function t(i, p, l) {
|
|
23
|
-
if (!(typeof document > "u")) {
|
|
24
|
-
l = F({}, r, l), typeof l.expires == "number" && (l.expires = new Date(Date.now() + l.expires * 864e5)), l.expires && (l.expires = l.expires.toUTCString()), i = encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
25
|
-
var d = "";
|
|
26
|
-
for (var c in l)
|
|
27
|
-
l[c] && (d += "; " + c, l[c] !== !0 && (d += "=" + l[c].split(";")[0]));
|
|
28
|
-
return document.cookie = i + "=" + e.write(p, i) + d;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function a(i) {
|
|
32
|
-
if (!(typeof document > "u" || arguments.length && !i)) {
|
|
33
|
-
for (var p = document.cookie ? document.cookie.split("; ") : [], l = {}, d = 0; d < p.length; d++) {
|
|
34
|
-
var c = p[d].split("="), u = c.slice(1).join("=");
|
|
35
|
-
try {
|
|
36
|
-
var o = decodeURIComponent(c[0]);
|
|
37
|
-
if (l[o] = e.read(u, o), i === o)
|
|
38
|
-
break;
|
|
39
|
-
} catch {
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return i ? l[i] : l;
|
|
1
|
+
import { queryObjects, getAppManifest, getAppManifests } from '@telia-ace/alliance-framework';
|
|
2
|
+
import { isAllianceError, FrameworkErrorCodes, AllianceError, UtilitiesErrorCodes } from '@telia-ace/alliance-internal-client-utilities';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var currentUser;
|
|
7
|
+
async function getCurrentUser() {
|
|
8
|
+
try {
|
|
9
|
+
if (!currentUser) {
|
|
10
|
+
const query = queryObjects("currentUser");
|
|
11
|
+
currentUser = await query.resolve();
|
|
43
12
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
get: a,
|
|
49
|
-
remove: function(i, p) {
|
|
50
|
-
t(
|
|
51
|
-
i,
|
|
52
|
-
"",
|
|
53
|
-
F({}, p, {
|
|
54
|
-
expires: -1
|
|
55
|
-
})
|
|
56
|
-
);
|
|
57
|
-
},
|
|
58
|
-
withAttributes: function(i) {
|
|
59
|
-
return P(this.converter, F({}, this.attributes, i));
|
|
13
|
+
return {
|
|
14
|
+
...currentUser,
|
|
15
|
+
hasPermission(appName, permissionName) {
|
|
16
|
+
return !!currentUser?.permissions.find(({ permission }) => permission.app.name === appName && permission.name === permissionName);
|
|
60
17
|
},
|
|
61
|
-
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
attributes: { value: Object.freeze(r) },
|
|
67
|
-
converter: { value: Object.freeze(e) }
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
var Y = P(X, { path: "/" }), ee = Object.defineProperty, te = (e, r, t) => r in e ? ee(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, I = (e, r, t) => (te(e, typeof r != "symbol" ? r + "" : r, t), t), K = /* @__PURE__ */ ((e) => (e[e.AlreadyInitialized = 1e3] = "AlreadyInitialized", e[e.NoAppNameOrKey = 1001] = "NoAppNameOrKey", e[e.MissingAppController = 1002] = "MissingAppController", e[e.MissingCapabilityOnApp = 1003] = "MissingCapabilityOnApp", e[e.MissingManagedObjectProvider = 1004] = "MissingManagedObjectProvider", e[e.NoManifest = 1005] = "NoManifest", e[e.NoRootElement = 1006] = "NoRootElement", e[e.NoView = 1007] = "NoView", e[e.CookieKeyNotDefined = 1008] = "CookieKeyNotDefined", e[e.CookieCategoryNotAllowed = 1009] = "CookieCategoryNotAllowed", e[e.StorageKeyNotDefined = 1010] = "StorageKeyNotDefined", e[e.StorageCategoryNotAllowed = 1011] = "StorageCategoryNotAllowed", e[e.LocalizationTemplateNotDefined = 1012] = "LocalizationTemplateNotDefined", e))(K || {});
|
|
72
|
-
function re(e, r) {
|
|
73
|
-
return Object.entries(r).reduce((t, [a, i]) => t.replaceAll(`{{${a}}}`, i), e);
|
|
74
|
-
}
|
|
75
|
-
const oe = {
|
|
76
|
-
// framework
|
|
77
|
-
1e3: "The runtime has already been initialized",
|
|
78
|
-
1001: "App name and/or app key is not defined on global scope",
|
|
79
|
-
1002: "No app controller registered for app '{{app}}'",
|
|
80
|
-
1003: "No capability '{{capability}}' enabled for app '{{app}}'",
|
|
81
|
-
1004: "No managed object provider registered for object '{{object}}'",
|
|
82
|
-
1005: "The current apps manifest is not defined on global scope",
|
|
83
|
-
1006: "Could not find the root element in the DOM",
|
|
84
|
-
1007: "Could not find view with id '{{id}}' on view controller for app '{{app}}'",
|
|
85
|
-
1008: "Cookie key '{{key}}' not present in manifest, cookie has not been set",
|
|
86
|
-
1009: "Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set",
|
|
87
|
-
1010: "Storage key '{{key}}' not present in manifest, item has not been stored",
|
|
88
|
-
1011: "Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored",
|
|
89
|
-
1012: "The translation template, referred by the key '{{key}}' is being used in app, but is not defined in the manifest.",
|
|
90
|
-
// utilities
|
|
91
|
-
2e3: "No managed object provider registered for object 'currentUser'",
|
|
92
|
-
2001: "Could not access the gateway when querying 'currentUser'",
|
|
93
|
-
2002: "Could not access the required backend when querying 'currentUser'",
|
|
94
|
-
2003: "Could not locate the authenticated user in the Alliance database"
|
|
95
|
-
}, ne = "AllianceError";
|
|
96
|
-
let ie = class extends Error {
|
|
97
|
-
constructor(r, t = {}) {
|
|
98
|
-
const a = re(oe[r], t), i = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${r}`;
|
|
99
|
-
super(a), this.code = r, this.name = ne, this.stack = `[${r}] - ${a}
|
|
100
|
-
` + i;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
var _ = /* @__PURE__ */ ((e) => (e[e.AlreadyExists = 0] = "AlreadyExists", e[e.ApiGatewayPortDescription = 1] = "ApiGatewayPortDescription", e[e.ApiServerModeDescription = 2] = "ApiServerModeDescription", e[e.AppConfigurationPath = 3] = "AppConfigurationPath", e[e.AppCreated = 4] = "AppCreated", e[e.AppEntryBuildOptionDescription = 5] = "AppEntryBuildOptionDescription", e[e.AppNameInquiry = 6] = "AppNameInquiry", e[e.BuildDescription = 7] = "BuildDescription", e[e.BuildModeOptionDescription = 8] = "BuildModeOptionDescription", e[e.BuildWatchDescription = 9] = "BuildWatchDescription", e[e.CreateAppDescription = 10] = "CreateAppDescription", e[e.CreateWorkspaceDescription = 11] = "CreateWorkspaceDescription", e[e.DevServerOpenDescription = 12] = "DevServerOpenDescription", e[e.DevServerPortDescription = 13] = "DevServerPortDescription", e[e.DevServerLoggingDescription = 14] = "DevServerLoggingDescription", e[e.Done = 15] = "Done", e[e.FetchPackageVersionError = 16] = "FetchPackageVersionError", e[e.ManifestEntryBuildOptionDescription = 17] = "ManifestEntryBuildOptionDescription", e[e.MissingTranslationKey = 18] = "MissingTranslationKey", e[e.NoAppName = 19] = "NoAppName", e[e.NoAppNameFound = 20] = "NoAppNameFound", e[e.NoAppOrWorkspaceInCurrentDirectory = 21] = "NoAppOrWorkspaceInCurrentDirectory", e[e.NoWorkspaceName = 22] = "NoWorkspaceName", e[e.OperationCancelled = 23] = "OperationCancelled", e[e.ServeDescription = 24] = "ServeDescription", e[e.ServedStopped = 25] = "ServedStopped", e[e.ServerGatewayMode = 26] = "ServerGatewayMode", e[e.ServerMode = 27] = "ServerMode", e[e.ServerModeInquiry = 28] = "ServerModeInquiry", e[e.ServerProxyMode = 29] = "ServerProxyMode", e[e.StopServerInstructions = 30] = "StopServerInstructions", e[e.TemplateFrameworkInquiry = 31] = "TemplateFrameworkInquiry", e[e.TemplateLanguageInquiry = 32] = "TemplateLanguageInquiry", e[e.UnrecognizedCommand = 33] = "UnrecognizedCommand", e[e.WorkspaceCreated = 34] = "WorkspaceCreated", e[e.WorkspaceNameInquiry = 35] = "WorkspaceNameInquiry", e))(_ || {});
|
|
104
|
-
const ae = {
|
|
105
|
-
15: "Done",
|
|
106
|
-
22: "No workspace name provided!",
|
|
107
|
-
19: "No app name provided!",
|
|
108
|
-
0: "File or directory '{0}' already exists!",
|
|
109
|
-
21: "Could not find any app entry file at '{0}'!",
|
|
110
|
-
33: "Unrecognized command(s) {0}!",
|
|
111
|
-
34: "Workspace was created at path '{0}'!",
|
|
112
|
-
4: "App was created at path '{0}'!",
|
|
113
|
-
25: "Server stopped.",
|
|
114
|
-
11: "Creates an Alliance Workspace in the current directory.",
|
|
115
|
-
10: "Creates an Alliance Application in the current directory or Alliance Workspace.",
|
|
116
|
-
24: "Starts a Alliance development server using the current directory package.json.",
|
|
117
|
-
7: "Builds an Alliance Application using Vite.",
|
|
118
|
-
35: "Enter the name of your workspace",
|
|
119
|
-
28: "Which server mode do you want to use?",
|
|
120
|
-
6: "Enter the name of your app",
|
|
121
|
-
18: "No translation key provided!",
|
|
122
|
-
23: "Operation cancelled.",
|
|
123
|
-
30: `Press CTRL + C to stop the server.
|
|
124
|
-
`,
|
|
125
|
-
32: "Select preferred language",
|
|
126
|
-
31: "Select preferred framework template",
|
|
127
|
-
13: "The port that the dev server should use.",
|
|
128
|
-
14: "Whether the dev server and browser console should output more log information or not (false).",
|
|
129
|
-
1: "The port that the api gateway should use.",
|
|
130
|
-
2: "Which components to start. [server|server-proxy|server-gateway].",
|
|
131
|
-
12: "Whether the dev server should automatically open in your browser or not.",
|
|
132
|
-
9: "Whether the build should start watching and rebuild when files change or not.",
|
|
133
|
-
5: "The entry file for the app (./src/app).",
|
|
134
|
-
17: "The entry file for the app manifest (./src/manifest).",
|
|
135
|
-
8: "Which mode to use when building the app.",
|
|
136
|
-
16: "Failed to fetch package info from the NPM registry for package '${0}'!",
|
|
137
|
-
20: "Could not find app name in manifest.",
|
|
138
|
-
3: "The path to the app configuration file.",
|
|
139
|
-
27: "Server",
|
|
140
|
-
29: "Server with proxy",
|
|
141
|
-
26: "Server with gateway"
|
|
142
|
-
}, v = class {
|
|
143
|
-
};
|
|
144
|
-
I(v, "getTranslations", () => ae), I(v, "getTranslation", (e, ...r) => {
|
|
145
|
-
const t = v.getTranslations()[e];
|
|
146
|
-
if (!t)
|
|
147
|
-
throw new Error(`Could not find text with given key '${e}'.`);
|
|
148
|
-
return r.reduce(
|
|
149
|
-
(a, i, p) => a.toString().replace(`{${p}}`, i.toString()),
|
|
150
|
-
t
|
|
151
|
-
).toString();
|
|
152
|
-
}), I(v, "get", (e = _.MissingTranslationKey, ...r) => v.getTranslation(e, ...r));
|
|
153
|
-
function se(e) {
|
|
154
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
155
|
-
}
|
|
156
|
-
var x = { exports: {} }, O, q;
|
|
157
|
-
function ce() {
|
|
158
|
-
if (q)
|
|
159
|
-
return O;
|
|
160
|
-
q = 1;
|
|
161
|
-
var e = 1e3, r = e * 60, t = r * 60, a = t * 24, i = a * 7, p = a * 365.25;
|
|
162
|
-
O = function(o, n) {
|
|
163
|
-
n = n || {};
|
|
164
|
-
var s = typeof o;
|
|
165
|
-
if (s === "string" && o.length > 0)
|
|
166
|
-
return l(o);
|
|
167
|
-
if (s === "number" && isFinite(o))
|
|
168
|
-
return n.long ? c(o) : d(o);
|
|
169
|
-
throw new Error(
|
|
170
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(o)
|
|
171
|
-
);
|
|
172
|
-
};
|
|
173
|
-
function l(o) {
|
|
174
|
-
if (o = String(o), !(o.length > 100)) {
|
|
175
|
-
var n = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
176
|
-
o
|
|
177
|
-
);
|
|
178
|
-
if (n) {
|
|
179
|
-
var s = parseFloat(n[1]), f = (n[2] || "ms").toLowerCase();
|
|
180
|
-
switch (f) {
|
|
181
|
-
case "years":
|
|
182
|
-
case "year":
|
|
183
|
-
case "yrs":
|
|
184
|
-
case "yr":
|
|
185
|
-
case "y":
|
|
186
|
-
return s * p;
|
|
187
|
-
case "weeks":
|
|
188
|
-
case "week":
|
|
189
|
-
case "w":
|
|
190
|
-
return s * i;
|
|
191
|
-
case "days":
|
|
192
|
-
case "day":
|
|
193
|
-
case "d":
|
|
194
|
-
return s * a;
|
|
195
|
-
case "hours":
|
|
196
|
-
case "hour":
|
|
197
|
-
case "hrs":
|
|
198
|
-
case "hr":
|
|
199
|
-
case "h":
|
|
200
|
-
return s * t;
|
|
201
|
-
case "minutes":
|
|
202
|
-
case "minute":
|
|
203
|
-
case "mins":
|
|
204
|
-
case "min":
|
|
205
|
-
case "m":
|
|
206
|
-
return s * r;
|
|
207
|
-
case "seconds":
|
|
208
|
-
case "second":
|
|
209
|
-
case "secs":
|
|
210
|
-
case "sec":
|
|
211
|
-
case "s":
|
|
212
|
-
return s * e;
|
|
213
|
-
case "milliseconds":
|
|
214
|
-
case "millisecond":
|
|
215
|
-
case "msecs":
|
|
216
|
-
case "msec":
|
|
217
|
-
case "ms":
|
|
218
|
-
return s;
|
|
219
|
-
default:
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
function d(o) {
|
|
226
|
-
var n = Math.abs(o);
|
|
227
|
-
return n >= a ? Math.round(o / a) + "d" : n >= t ? Math.round(o / t) + "h" : n >= r ? Math.round(o / r) + "m" : n >= e ? Math.round(o / e) + "s" : o + "ms";
|
|
228
|
-
}
|
|
229
|
-
function c(o) {
|
|
230
|
-
var n = Math.abs(o);
|
|
231
|
-
return n >= a ? u(o, n, a, "day") : n >= t ? u(o, n, t, "hour") : n >= r ? u(o, n, r, "minute") : n >= e ? u(o, n, e, "second") : o + " ms";
|
|
232
|
-
}
|
|
233
|
-
function u(o, n, s, f) {
|
|
234
|
-
var k = n >= s * 1.5;
|
|
235
|
-
return Math.round(o / s) + " " + f + (k ? "s" : "");
|
|
236
|
-
}
|
|
237
|
-
return O;
|
|
238
|
-
}
|
|
239
|
-
function pe(e) {
|
|
240
|
-
t.debug = t, t.default = t, t.coerce = c, t.disable = p, t.enable = i, t.enabled = l, t.humanize = ce(), t.destroy = u, Object.keys(e).forEach((o) => {
|
|
241
|
-
t[o] = e[o];
|
|
242
|
-
}), t.names = [], t.skips = [], t.formatters = {};
|
|
243
|
-
function r(o) {
|
|
244
|
-
let n = 0;
|
|
245
|
-
for (let s = 0; s < o.length; s++)
|
|
246
|
-
n = (n << 5) - n + o.charCodeAt(s), n |= 0;
|
|
247
|
-
return t.colors[Math.abs(n) % t.colors.length];
|
|
248
|
-
}
|
|
249
|
-
t.selectColor = r;
|
|
250
|
-
function t(o) {
|
|
251
|
-
let n, s = null, f, k;
|
|
252
|
-
function h(...g) {
|
|
253
|
-
if (!h.enabled)
|
|
254
|
-
return;
|
|
255
|
-
const C = h, D = Number(/* @__PURE__ */ new Date()), J = D - (n || D);
|
|
256
|
-
C.diff = J, C.prev = n, C.curr = D, n = D, g[0] = t.coerce(g[0]), typeof g[0] != "string" && g.unshift("%O");
|
|
257
|
-
let S = 0;
|
|
258
|
-
g[0] = g[0].replace(/%([a-zA-Z%])/g, (M, Z) => {
|
|
259
|
-
if (M === "%%")
|
|
260
|
-
return "%";
|
|
261
|
-
S++;
|
|
262
|
-
const L = t.formatters[Z];
|
|
263
|
-
if (typeof L == "function") {
|
|
264
|
-
const H = g[S];
|
|
265
|
-
M = L.call(C, H), g.splice(S, 1), S--;
|
|
266
|
-
}
|
|
267
|
-
return M;
|
|
268
|
-
}), t.formatArgs.call(C, g), (C.log || t.log).apply(C, g);
|
|
269
|
-
}
|
|
270
|
-
return h.namespace = o, h.useColors = t.useColors(), h.color = t.selectColor(o), h.extend = a, h.destroy = t.destroy, Object.defineProperty(h, "enabled", {
|
|
271
|
-
enumerable: !0,
|
|
272
|
-
configurable: !1,
|
|
273
|
-
get: () => s !== null ? s : (f !== t.namespaces && (f = t.namespaces, k = t.enabled(o)), k),
|
|
274
|
-
set: (g) => {
|
|
275
|
-
s = g;
|
|
18
|
+
isSystemAdmin() {
|
|
19
|
+
return !!currentUser && currentUser.type === "system-admin";
|
|
276
20
|
}
|
|
277
|
-
}), typeof t.init == "function" && t.init(h), h;
|
|
278
|
-
}
|
|
279
|
-
function a(o, n) {
|
|
280
|
-
const s = t(this.namespace + (typeof n > "u" ? ":" : n) + o);
|
|
281
|
-
return s.log = this.log, s;
|
|
282
|
-
}
|
|
283
|
-
function i(o) {
|
|
284
|
-
t.save(o), t.namespaces = o, t.names = [], t.skips = [];
|
|
285
|
-
let n;
|
|
286
|
-
const s = (typeof o == "string" ? o : "").split(/[\s,]+/), f = s.length;
|
|
287
|
-
for (n = 0; n < f; n++)
|
|
288
|
-
s[n] && (o = s[n].replace(/\*/g, ".*?"), o[0] === "-" ? t.skips.push(new RegExp("^" + o.slice(1) + "$")) : t.names.push(new RegExp("^" + o + "$")));
|
|
289
|
-
}
|
|
290
|
-
function p() {
|
|
291
|
-
const o = [
|
|
292
|
-
...t.names.map(d),
|
|
293
|
-
...t.skips.map(d).map((n) => "-" + n)
|
|
294
|
-
].join(",");
|
|
295
|
-
return t.enable(""), o;
|
|
296
|
-
}
|
|
297
|
-
function l(o) {
|
|
298
|
-
if (o[o.length - 1] === "*")
|
|
299
|
-
return !0;
|
|
300
|
-
let n, s;
|
|
301
|
-
for (n = 0, s = t.skips.length; n < s; n++)
|
|
302
|
-
if (t.skips[n].test(o))
|
|
303
|
-
return !1;
|
|
304
|
-
for (n = 0, s = t.names.length; n < s; n++)
|
|
305
|
-
if (t.names[n].test(o))
|
|
306
|
-
return !0;
|
|
307
|
-
return !1;
|
|
308
|
-
}
|
|
309
|
-
function d(o) {
|
|
310
|
-
return o.toString().substring(2, o.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
311
|
-
}
|
|
312
|
-
function c(o) {
|
|
313
|
-
return o instanceof Error ? o.stack || o.message : o;
|
|
314
|
-
}
|
|
315
|
-
function u() {
|
|
316
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
317
|
-
}
|
|
318
|
-
return t.enable(t.load()), t;
|
|
319
|
-
}
|
|
320
|
-
var le = pe;
|
|
321
|
-
(function(e, r) {
|
|
322
|
-
r.formatArgs = a, r.save = i, r.load = p, r.useColors = t, r.storage = l(), r.destroy = (() => {
|
|
323
|
-
let c = !1;
|
|
324
|
-
return () => {
|
|
325
|
-
c || (c = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
|
|
326
21
|
};
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
"
|
|
331
|
-
|
|
332
|
-
"
|
|
333
|
-
|
|
334
|
-
"
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
"#00CC66",
|
|
339
|
-
"#00CC99",
|
|
340
|
-
"#00CCCC",
|
|
341
|
-
"#00CCFF",
|
|
342
|
-
"#3300CC",
|
|
343
|
-
"#3300FF",
|
|
344
|
-
"#3333CC",
|
|
345
|
-
"#3333FF",
|
|
346
|
-
"#3366CC",
|
|
347
|
-
"#3366FF",
|
|
348
|
-
"#3399CC",
|
|
349
|
-
"#3399FF",
|
|
350
|
-
"#33CC00",
|
|
351
|
-
"#33CC33",
|
|
352
|
-
"#33CC66",
|
|
353
|
-
"#33CC99",
|
|
354
|
-
"#33CCCC",
|
|
355
|
-
"#33CCFF",
|
|
356
|
-
"#6600CC",
|
|
357
|
-
"#6600FF",
|
|
358
|
-
"#6633CC",
|
|
359
|
-
"#6633FF",
|
|
360
|
-
"#66CC00",
|
|
361
|
-
"#66CC33",
|
|
362
|
-
"#9900CC",
|
|
363
|
-
"#9900FF",
|
|
364
|
-
"#9933CC",
|
|
365
|
-
"#9933FF",
|
|
366
|
-
"#99CC00",
|
|
367
|
-
"#99CC33",
|
|
368
|
-
"#CC0000",
|
|
369
|
-
"#CC0033",
|
|
370
|
-
"#CC0066",
|
|
371
|
-
"#CC0099",
|
|
372
|
-
"#CC00CC",
|
|
373
|
-
"#CC00FF",
|
|
374
|
-
"#CC3300",
|
|
375
|
-
"#CC3333",
|
|
376
|
-
"#CC3366",
|
|
377
|
-
"#CC3399",
|
|
378
|
-
"#CC33CC",
|
|
379
|
-
"#CC33FF",
|
|
380
|
-
"#CC6600",
|
|
381
|
-
"#CC6633",
|
|
382
|
-
"#CC9900",
|
|
383
|
-
"#CC9933",
|
|
384
|
-
"#CCCC00",
|
|
385
|
-
"#CCCC33",
|
|
386
|
-
"#FF0000",
|
|
387
|
-
"#FF0033",
|
|
388
|
-
"#FF0066",
|
|
389
|
-
"#FF0099",
|
|
390
|
-
"#FF00CC",
|
|
391
|
-
"#FF00FF",
|
|
392
|
-
"#FF3300",
|
|
393
|
-
"#FF3333",
|
|
394
|
-
"#FF3366",
|
|
395
|
-
"#FF3399",
|
|
396
|
-
"#FF33CC",
|
|
397
|
-
"#FF33FF",
|
|
398
|
-
"#FF6600",
|
|
399
|
-
"#FF6633",
|
|
400
|
-
"#FF9900",
|
|
401
|
-
"#FF9933",
|
|
402
|
-
"#FFCC00",
|
|
403
|
-
"#FFCC33"
|
|
404
|
-
];
|
|
405
|
-
function t() {
|
|
406
|
-
return typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs) ? !0 : typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/) ? !1 : typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
407
|
-
typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
408
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
409
|
-
typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
410
|
-
typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
411
|
-
}
|
|
412
|
-
function a(c) {
|
|
413
|
-
if (c[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + c[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff), !this.useColors)
|
|
414
|
-
return;
|
|
415
|
-
const u = "color: " + this.color;
|
|
416
|
-
c.splice(1, 0, u, "color: inherit");
|
|
417
|
-
let o = 0, n = 0;
|
|
418
|
-
c[0].replace(/%[a-zA-Z%]/g, (s) => {
|
|
419
|
-
s !== "%%" && (o++, s === "%c" && (n = o));
|
|
420
|
-
}), c.splice(n, 0, u);
|
|
421
|
-
}
|
|
422
|
-
r.log = console.debug || console.log || (() => {
|
|
423
|
-
});
|
|
424
|
-
function i(c) {
|
|
425
|
-
try {
|
|
426
|
-
c ? r.storage.setItem("debug", c) : r.storage.removeItem("debug");
|
|
427
|
-
} catch {
|
|
22
|
+
} catch (err) {
|
|
23
|
+
if (isAllianceError(err) && err.code === FrameworkErrorCodes.MissingManagedObjectProvider) {
|
|
24
|
+
throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingProvider);
|
|
25
|
+
} else if (err.message.includes("GraphQL Error (Code: 404)")) {
|
|
26
|
+
throw new AllianceError(UtilitiesErrorCodes.CurrentUserGatewayNotStarted);
|
|
27
|
+
} else if (err.message.includes("GraphQL Error (Code: 500)")) {
|
|
28
|
+
throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingBackend);
|
|
29
|
+
} else if (err.message.includes("GraphQL Error (Code: 200)") && err.message.includes("Cannot return null for non-nullable field")) {
|
|
30
|
+
throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingInDatabase);
|
|
31
|
+
} else {
|
|
32
|
+
throw err;
|
|
428
33
|
}
|
|
429
34
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
35
|
+
}
|
|
36
|
+
__name(getCurrentUser, "getCurrentUser");
|
|
37
|
+
async function getCurrentWorkspace() {
|
|
38
|
+
const query = queryObjects("currentWorkspace");
|
|
39
|
+
return await query.resolve();
|
|
40
|
+
}
|
|
41
|
+
__name(getCurrentWorkspace, "getCurrentWorkspace");
|
|
42
|
+
function getDefaultLocalization(manifest) {
|
|
43
|
+
if (!manifest || !manifest.resources?.localization) {
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
const localizationKeys = Object.keys(manifest.resources.localization);
|
|
47
|
+
const defaults = localizationKeys.reduce((obj, item) => {
|
|
48
|
+
obj[item] = manifest.resources.localization[item].value;
|
|
49
|
+
return obj;
|
|
50
|
+
}, {});
|
|
51
|
+
return defaults;
|
|
52
|
+
}
|
|
53
|
+
__name(getDefaultLocalization, "getDefaultLocalization");
|
|
54
|
+
function parseTemplates(message = "", variables) {
|
|
55
|
+
return Object.entries(variables).reduce((acc, [key, value]) => {
|
|
56
|
+
return acc.replaceAll(`{{${key}}}`, value);
|
|
57
|
+
}, message);
|
|
58
|
+
}
|
|
59
|
+
__name(parseTemplates, "parseTemplates");
|
|
60
|
+
async function getAppLocalization() {
|
|
61
|
+
const manifest = getAppManifest();
|
|
62
|
+
const appManifests = getAppManifests();
|
|
63
|
+
const defaultLocalization = getDefaultLocalization(manifest);
|
|
64
|
+
let localization = {};
|
|
65
|
+
if (appManifests?.find(({ name }) => name === "resource-management")) {
|
|
66
|
+
localization = await queryObjects("resourceTexts", {
|
|
67
|
+
app: manifest?.name
|
|
68
|
+
}).resolve();
|
|
69
|
+
}
|
|
70
|
+
return Object.keys(defaultLocalization).reduce((acc, key) => {
|
|
71
|
+
if (localization[key]) {
|
|
72
|
+
acc[key] = localization[key];
|
|
435
73
|
}
|
|
436
|
-
return
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
74
|
+
return acc;
|
|
75
|
+
}, defaultLocalization);
|
|
76
|
+
}
|
|
77
|
+
__name(getAppLocalization, "getAppLocalization");
|
|
78
|
+
var localizationStore = {};
|
|
79
|
+
async function getTranslator() {
|
|
80
|
+
if (Object.keys(localizationStore).length === 0) {
|
|
81
|
+
localizationStore = await getAppLocalization();
|
|
82
|
+
}
|
|
83
|
+
return (key, params) => {
|
|
84
|
+
const template = localizationStore[key];
|
|
85
|
+
if (template === void 0) {
|
|
86
|
+
throw new AllianceError(FrameworkErrorCodes.LocalizationTemplateNotDefined, {
|
|
87
|
+
key
|
|
88
|
+
});
|
|
442
89
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const { formatters: d } = e.exports;
|
|
446
|
-
d.j = function(c) {
|
|
447
|
-
try {
|
|
448
|
-
return JSON.stringify(c);
|
|
449
|
-
} catch (u) {
|
|
450
|
-
return "[UnexpectedJSONParseError]: " + u.message;
|
|
90
|
+
if (!params || typeof params !== "object" || Object.keys(params).length === 0) {
|
|
91
|
+
return template;
|
|
451
92
|
}
|
|
452
|
-
|
|
453
|
-
})(x, x.exports);
|
|
454
|
-
var de = x.exports;
|
|
455
|
-
const ue = /* @__PURE__ */ se(de);
|
|
456
|
-
function ge() {
|
|
457
|
-
try {
|
|
458
|
-
return ALLIANCE_APP_NAME;
|
|
459
|
-
} catch {
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
function he() {
|
|
463
|
-
const e = {
|
|
464
|
-
environment: "production",
|
|
465
|
-
logging: !1
|
|
466
|
-
};
|
|
467
|
-
try {
|
|
468
|
-
return ALLIANCE_ENVIRONMENT || e;
|
|
469
|
-
} catch {
|
|
470
|
-
return e;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
function G() {
|
|
474
|
-
if (B())
|
|
475
|
-
return Promise.resolve();
|
|
476
|
-
const e = 2e4, r = 5;
|
|
477
|
-
return new Promise((t, a) => {
|
|
478
|
-
const i = () => {
|
|
479
|
-
clearInterval(l), clearTimeout(p);
|
|
480
|
-
}, p = setTimeout(() => {
|
|
481
|
-
i(), a(new Error(`Runtime not initialized after ${e}ms`));
|
|
482
|
-
}, e), l = setInterval(() => {
|
|
483
|
-
B() && (i(), t());
|
|
484
|
-
}, r);
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
function B() {
|
|
488
|
-
return N(
|
|
489
|
-
"RUNTIME_INITIALIZED"
|
|
490
|
-
/* RuntimeInitialized */
|
|
491
|
-
);
|
|
492
|
-
}
|
|
493
|
-
function N(e = "") {
|
|
494
|
-
return globalThis[fe(e)];
|
|
495
|
-
}
|
|
496
|
-
function fe(e) {
|
|
497
|
-
return `__ALLIANCE_${e}`;
|
|
498
|
-
}
|
|
499
|
-
function ye(e) {
|
|
500
|
-
return `APP_CONTROLLER_KEY_${e}`;
|
|
501
|
-
}
|
|
502
|
-
var W = /* @__PURE__ */ ((e) => (e.RuntimeInitialized = "RUNTIME_INITIALIZED", e.RuntimeApps = "RUNTIME_APPS", e.RuntimeManifests = "RUNTIME_MANIFESTS", e))(W || {});
|
|
503
|
-
function Ce(e) {
|
|
504
|
-
return {
|
|
505
|
-
capabilities: "#25BCDD",
|
|
506
|
-
"managed-objects": "#FC7A12",
|
|
507
|
-
controller: "#F635C6",
|
|
508
|
-
proxy: "#48E70B",
|
|
509
|
-
views: "#F6D72E",
|
|
510
|
-
system: "#D52C2E"
|
|
511
|
-
}[e];
|
|
512
|
-
}
|
|
513
|
-
const $ = /* @__PURE__ */ new Map();
|
|
514
|
-
function m(e) {
|
|
515
|
-
let r = $.get(e);
|
|
516
|
-
return r || (r = ue(e === "system" ? "[system]" : `[${ge()}] ${e}`), r.color = Ce(e), r.enabled = me(), $.set(e, r), r);
|
|
517
|
-
}
|
|
518
|
-
function me() {
|
|
519
|
-
const e = he(), r = Y.get("logging");
|
|
520
|
-
return e.environment === "development" && !!e.logging || r === "true";
|
|
521
|
-
}
|
|
522
|
-
m("controller");
|
|
523
|
-
async function ve(e) {
|
|
524
|
-
await G();
|
|
525
|
-
const r = ye(e), t = N(r);
|
|
526
|
-
if (!t)
|
|
527
|
-
return;
|
|
528
|
-
const a = N(t);
|
|
529
|
-
if (a)
|
|
530
|
-
return a;
|
|
531
|
-
}
|
|
532
|
-
async function we() {
|
|
533
|
-
return await G(), (await Promise.all(
|
|
534
|
-
N(W.RuntimeApps).map((e) => ve(e))
|
|
535
|
-
)).filter((e) => !!e);
|
|
536
|
-
}
|
|
537
|
-
m("views");
|
|
538
|
-
function be() {
|
|
539
|
-
return structuredClone(N(W.RuntimeManifests));
|
|
540
|
-
}
|
|
541
|
-
function Ae() {
|
|
542
|
-
try {
|
|
543
|
-
return ALLIANCE_APP_MANIFEST;
|
|
544
|
-
} catch {
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
m("system");
|
|
548
|
-
m("capabilities");
|
|
549
|
-
const E = m("managed-objects");
|
|
550
|
-
function z(e, r) {
|
|
551
|
-
return E("querying objects - object: %o, args: %O", e, r), {
|
|
552
|
-
async resolve() {
|
|
553
|
-
return E("resolving query - object: %o, args: %O", e, r), await (await R(e)).managedObjects.providers.get(e)(r);
|
|
554
|
-
},
|
|
555
|
-
async watch(t) {
|
|
556
|
-
E("adding watcher - object: %o, args: %O", e, r), (await R(e)).managedObjects.watchers.get(e).push(t);
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
async function R(e) {
|
|
561
|
-
const r = (await we()).find(
|
|
562
|
-
(t) => t.managedObjects.providers.has(e) && t.managedObjects.watchers.has(e)
|
|
563
|
-
);
|
|
564
|
-
if (!r)
|
|
565
|
-
throw new ie(K.MissingManagedObjectProvider, { object: e });
|
|
566
|
-
return r;
|
|
567
|
-
}
|
|
568
|
-
m("proxy");
|
|
569
|
-
var Ne = Object.defineProperty, ke = (e, r, t) => r in e ? Ne(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, T = (e, r, t) => (ke(e, typeof r != "symbol" ? r + "" : r, t), t), U = /* @__PURE__ */ ((e) => (e[e.AlreadyInitialized = 1e3] = "AlreadyInitialized", e[e.NoAppNameOrKey = 1001] = "NoAppNameOrKey", e[e.MissingAppController = 1002] = "MissingAppController", e[e.MissingCapabilityOnApp = 1003] = "MissingCapabilityOnApp", e[e.MissingManagedObjectProvider = 1004] = "MissingManagedObjectProvider", e[e.NoManifest = 1005] = "NoManifest", e[e.NoRootElement = 1006] = "NoRootElement", e[e.NoView = 1007] = "NoView", e[e.CookieKeyNotDefined = 1008] = "CookieKeyNotDefined", e[e.CookieCategoryNotAllowed = 1009] = "CookieCategoryNotAllowed", e[e.StorageKeyNotDefined = 1010] = "StorageKeyNotDefined", e[e.StorageCategoryNotAllowed = 1011] = "StorageCategoryNotAllowed", e[e.LocalizationTemplateNotDefined = 1012] = "LocalizationTemplateNotDefined", e))(U || {}), b = /* @__PURE__ */ ((e) => (e[e.CurrentUserMissingProvider = 2e3] = "CurrentUserMissingProvider", e[e.CurrentUserGatewayNotStarted = 2001] = "CurrentUserGatewayNotStarted", e[e.CurrentUserMissingBackend = 2002] = "CurrentUserMissingBackend", e[e.CurrentUserMissingInDatabase = 2003] = "CurrentUserMissingInDatabase", e))(b || {});
|
|
570
|
-
function De(e, r) {
|
|
571
|
-
return Object.entries(r).reduce((t, [a, i]) => t.replaceAll(`{{${a}}}`, i), e);
|
|
572
|
-
}
|
|
573
|
-
const Se = {
|
|
574
|
-
// framework
|
|
575
|
-
1e3: "The runtime has already been initialized",
|
|
576
|
-
1001: "App name and/or app key is not defined on global scope",
|
|
577
|
-
1002: "No app controller registered for app '{{app}}'",
|
|
578
|
-
1003: "No capability '{{capability}}' enabled for app '{{app}}'",
|
|
579
|
-
1004: "No managed object provider registered for object '{{object}}'",
|
|
580
|
-
1005: "The current apps manifest is not defined on global scope",
|
|
581
|
-
1006: "Could not find the root element in the DOM",
|
|
582
|
-
1007: "Could not find view with id '{{id}}' on view controller for app '{{app}}'",
|
|
583
|
-
1008: "Cookie key '{{key}}' not present in manifest, cookie has not been set",
|
|
584
|
-
1009: "Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set",
|
|
585
|
-
1010: "Storage key '{{key}}' not present in manifest, item has not been stored",
|
|
586
|
-
1011: "Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored",
|
|
587
|
-
1012: "The translation template, referred by the key '{{key}}' is being used in app, but is not defined in the manifest.",
|
|
588
|
-
// utilities
|
|
589
|
-
2e3: "No managed object provider registered for object 'currentUser'",
|
|
590
|
-
2001: "Could not access the gateway when querying 'currentUser'",
|
|
591
|
-
2002: "Could not access the required backend when querying 'currentUser'",
|
|
592
|
-
2003: "Could not locate the authenticated user in the Alliance database"
|
|
593
|
-
}, V = "AllianceError";
|
|
594
|
-
class A extends Error {
|
|
595
|
-
constructor(r, t = {}) {
|
|
596
|
-
const a = De(Se[r], t), i = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${r}`;
|
|
597
|
-
super(a), this.code = r, this.name = V, this.stack = `[${r}] - ${a}
|
|
598
|
-
` + i;
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
function Fe(e) {
|
|
602
|
-
return !!e.code && e.name === V;
|
|
603
|
-
}
|
|
604
|
-
var Q = /* @__PURE__ */ ((e) => (e[e.AlreadyExists = 0] = "AlreadyExists", e[e.ApiGatewayPortDescription = 1] = "ApiGatewayPortDescription", e[e.ApiServerModeDescription = 2] = "ApiServerModeDescription", e[e.AppConfigurationPath = 3] = "AppConfigurationPath", e[e.AppCreated = 4] = "AppCreated", e[e.AppEntryBuildOptionDescription = 5] = "AppEntryBuildOptionDescription", e[e.AppNameInquiry = 6] = "AppNameInquiry", e[e.BuildDescription = 7] = "BuildDescription", e[e.BuildModeOptionDescription = 8] = "BuildModeOptionDescription", e[e.BuildWatchDescription = 9] = "BuildWatchDescription", e[e.CreateAppDescription = 10] = "CreateAppDescription", e[e.CreateWorkspaceDescription = 11] = "CreateWorkspaceDescription", e[e.DevServerOpenDescription = 12] = "DevServerOpenDescription", e[e.DevServerPortDescription = 13] = "DevServerPortDescription", e[e.DevServerLoggingDescription = 14] = "DevServerLoggingDescription", e[e.Done = 15] = "Done", e[e.FetchPackageVersionError = 16] = "FetchPackageVersionError", e[e.ManifestEntryBuildOptionDescription = 17] = "ManifestEntryBuildOptionDescription", e[e.MissingTranslationKey = 18] = "MissingTranslationKey", e[e.NoAppName = 19] = "NoAppName", e[e.NoAppNameFound = 20] = "NoAppNameFound", e[e.NoAppOrWorkspaceInCurrentDirectory = 21] = "NoAppOrWorkspaceInCurrentDirectory", e[e.NoWorkspaceName = 22] = "NoWorkspaceName", e[e.OperationCancelled = 23] = "OperationCancelled", e[e.ServeDescription = 24] = "ServeDescription", e[e.ServedStopped = 25] = "ServedStopped", e[e.ServerGatewayMode = 26] = "ServerGatewayMode", e[e.ServerMode = 27] = "ServerMode", e[e.ServerModeInquiry = 28] = "ServerModeInquiry", e[e.ServerProxyMode = 29] = "ServerProxyMode", e[e.StopServerInstructions = 30] = "StopServerInstructions", e[e.TemplateFrameworkInquiry = 31] = "TemplateFrameworkInquiry", e[e.TemplateLanguageInquiry = 32] = "TemplateLanguageInquiry", e[e.UnrecognizedCommand = 33] = "UnrecognizedCommand", e[e.WorkspaceCreated = 34] = "WorkspaceCreated", e[e.WorkspaceNameInquiry = 35] = "WorkspaceNameInquiry", e))(Q || {});
|
|
605
|
-
const Me = {
|
|
606
|
-
15: "Done",
|
|
607
|
-
22: "No workspace name provided!",
|
|
608
|
-
19: "No app name provided!",
|
|
609
|
-
0: "File or directory '{0}' already exists!",
|
|
610
|
-
21: "Could not find any app entry file at '{0}'!",
|
|
611
|
-
33: "Unrecognized command(s) {0}!",
|
|
612
|
-
34: "Workspace was created at path '{0}'!",
|
|
613
|
-
4: "App was created at path '{0}'!",
|
|
614
|
-
25: "Server stopped.",
|
|
615
|
-
11: "Creates an Alliance Workspace in the current directory.",
|
|
616
|
-
10: "Creates an Alliance Application in the current directory or Alliance Workspace.",
|
|
617
|
-
24: "Starts a Alliance development server using the current directory package.json.",
|
|
618
|
-
7: "Builds an Alliance Application using Vite.",
|
|
619
|
-
35: "Enter the name of your workspace",
|
|
620
|
-
28: "Which server mode do you want to use?",
|
|
621
|
-
6: "Enter the name of your app",
|
|
622
|
-
18: "No translation key provided!",
|
|
623
|
-
23: "Operation cancelled.",
|
|
624
|
-
30: `Press CTRL + C to stop the server.
|
|
625
|
-
`,
|
|
626
|
-
32: "Select preferred language",
|
|
627
|
-
31: "Select preferred framework template",
|
|
628
|
-
13: "The port that the dev server should use.",
|
|
629
|
-
14: "Whether the dev server and browser console should output more log information or not (false).",
|
|
630
|
-
1: "The port that the api gateway should use.",
|
|
631
|
-
2: "Which components to start. [server|server-proxy|server-gateway].",
|
|
632
|
-
12: "Whether the dev server should automatically open in your browser or not.",
|
|
633
|
-
9: "Whether the build should start watching and rebuild when files change or not.",
|
|
634
|
-
5: "The entry file for the app (./src/app).",
|
|
635
|
-
17: "The entry file for the app manifest (./src/manifest).",
|
|
636
|
-
8: "Which mode to use when building the app.",
|
|
637
|
-
16: "Failed to fetch package info from the NPM registry for package '${0}'!",
|
|
638
|
-
20: "Could not find app name in manifest.",
|
|
639
|
-
3: "The path to the app configuration file.",
|
|
640
|
-
27: "Server",
|
|
641
|
-
29: "Server with proxy",
|
|
642
|
-
26: "Server with gateway"
|
|
643
|
-
}, w = class {
|
|
644
|
-
};
|
|
645
|
-
T(w, "getTranslations", () => Me), T(w, "getTranslation", (e, ...r) => {
|
|
646
|
-
const t = w.getTranslations()[e];
|
|
647
|
-
if (!t)
|
|
648
|
-
throw new Error(`Could not find text with given key '${e}'.`);
|
|
649
|
-
return r.reduce(
|
|
650
|
-
(a, i, p) => a.toString().replace(`{${p}}`, i.toString()),
|
|
651
|
-
t
|
|
652
|
-
).toString();
|
|
653
|
-
}), T(w, "get", (e = Q.MissingTranslationKey, ...r) => w.getTranslation(e, ...r));
|
|
654
|
-
let y;
|
|
655
|
-
async function Pe() {
|
|
656
|
-
try {
|
|
657
|
-
return y || (y = await z("currentUser").resolve()), {
|
|
658
|
-
...y,
|
|
659
|
-
hasPermission(e, r) {
|
|
660
|
-
return !!(y != null && y.permissions.find(
|
|
661
|
-
({ permission: t }) => t.app.name === e && t.name === r
|
|
662
|
-
));
|
|
663
|
-
},
|
|
664
|
-
isSystemAdmin() {
|
|
665
|
-
return !!y && y.type === "system-admin";
|
|
666
|
-
}
|
|
667
|
-
};
|
|
668
|
-
} catch (e) {
|
|
669
|
-
throw Fe(e) && e.code === U.MissingManagedObjectProvider ? new A(b.CurrentUserMissingProvider) : e.message.includes("GraphQL Error (Code: 404)") ? new A(b.CurrentUserGatewayNotStarted) : e.message.includes("GraphQL Error (Code: 500)") ? new A(b.CurrentUserMissingBackend) : e.message.includes("GraphQL Error (Code: 200)") && e.message.includes("Cannot return null for non-nullable field") ? new A(b.CurrentUserMissingInDatabase) : e;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
async function xe() {
|
|
673
|
-
return await z("currentWorkspace").resolve();
|
|
674
|
-
}
|
|
675
|
-
function Ie(e) {
|
|
676
|
-
var a;
|
|
677
|
-
return !e || !((a = e.resources) != null && a.localization) ? {} : Object.keys(e.resources.localization).reduce((i, p) => (i[p] = e.resources.localization[p].value, i), {});
|
|
678
|
-
}
|
|
679
|
-
function Oe(e = "", r) {
|
|
680
|
-
return Object.entries(r).reduce((t, [a, i]) => t.replaceAll(`{{${a}}}`, i), e);
|
|
681
|
-
}
|
|
682
|
-
async function Ee() {
|
|
683
|
-
const e = Ae(), r = be(), t = Ie(e);
|
|
684
|
-
let a = {};
|
|
685
|
-
return r != null && r.find(({ name: i }) => i === "resource-management") && (a = await z("resourceTexts", { app: e == null ? void 0 : e.name }).resolve()), Object.keys(t).reduce((i, p) => (a[p] && (i[p] = a[p]), i), t);
|
|
686
|
-
}
|
|
687
|
-
let j = {};
|
|
688
|
-
async function We() {
|
|
689
|
-
return Object.keys(j).length === 0 && (j = await Ee()), (e, r) => {
|
|
690
|
-
const t = j[e];
|
|
691
|
-
if (t === void 0)
|
|
692
|
-
throw new A(U.LocalizationTemplateNotDefined, { key: e });
|
|
693
|
-
return !r || typeof r != "object" || Object.keys(r).length === 0 ? t : Oe(t, r);
|
|
93
|
+
return parseTemplates(template, params);
|
|
694
94
|
};
|
|
695
95
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
//# sourceMappingURL=index.js.map
|
|
96
|
+
__name(getTranslator, "getTranslator");
|
|
97
|
+
|
|
98
|
+
export { getCurrentUser, getCurrentWorkspace, getTranslator };
|
|
99
|
+
//# sourceMappingURL=out.js.map
|
|
100
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../framework/dist/chunks/capabilities-ff8d3362.js","../../framework/dist/index.js","../../../internal/client-utilities/dist/index.js","../src/get-current-user.ts","../src/get-current-workspace.ts","../src/get-translator.ts"],"sourcesContent":["var ae = Object.defineProperty;\nvar se = (e, n, t) => n in e ? ae(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;\nvar b = (e, n, t) => (se(e, typeof n != \"symbol\" ? n + \"\" : n, t), t);\n/*! js-cookie v3.0.5 | MIT */\nfunction k(e) {\n for (var n = 1; n < arguments.length; n++) {\n var t = arguments[n];\n for (var o in t)\n e[o] = t[o];\n }\n return e;\n}\nvar ce = {\n read: function(e) {\n return e[0] === '\"' && (e = e.slice(1, -1)), e.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent);\n },\n write: function(e) {\n return encodeURIComponent(e).replace(\n /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n decodeURIComponent\n );\n }\n};\nfunction j(e, n) {\n function t(i, s, l) {\n if (!(typeof document > \"u\")) {\n l = k({}, n, l), typeof l.expires == \"number\" && (l.expires = new Date(Date.now() + l.expires * 864e5)), l.expires && (l.expires = l.expires.toUTCString()), i = encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);\n var p = \"\";\n for (var c in l)\n l[c] && (p += \"; \" + c, l[c] !== !0 && (p += \"=\" + l[c].split(\";\")[0]));\n return document.cookie = i + \"=\" + e.write(s, i) + p;\n }\n }\n function o(i) {\n if (!(typeof document > \"u\" || arguments.length && !i)) {\n for (var s = document.cookie ? document.cookie.split(\"; \") : [], l = {}, p = 0; p < s.length; p++) {\n var c = s[p].split(\"=\"), d = c.slice(1).join(\"=\");\n try {\n var r = decodeURIComponent(c[0]);\n if (l[r] = e.read(d, r), i === r)\n break;\n } catch {\n }\n }\n return i ? l[i] : l;\n }\n }\n return Object.create(\n {\n set: t,\n get: o,\n remove: function(i, s) {\n t(\n i,\n \"\",\n k({}, s, {\n expires: -1\n })\n );\n },\n withAttributes: function(i) {\n return j(this.converter, k({}, this.attributes, i));\n },\n withConverter: function(i) {\n return j(k({}, this.converter, i), this.attributes);\n }\n },\n {\n attributes: { value: Object.freeze(n) },\n converter: { value: Object.freeze(e) }\n }\n );\n}\nvar V = j(ce, { path: \"/\" }), ue = Object.defineProperty, le = (e, n, t) => n in e ? ue(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, R = (e, n, t) => (le(e, typeof n != \"symbol\" ? n + \"\" : n, t), t), C = /* @__PURE__ */ ((e) => (e[e.AlreadyInitialized = 1e3] = \"AlreadyInitialized\", e[e.NoAppNameOrKey = 1001] = \"NoAppNameOrKey\", e[e.MissingAppController = 1002] = \"MissingAppController\", e[e.MissingCapabilityOnApp = 1003] = \"MissingCapabilityOnApp\", e[e.MissingManagedObjectProvider = 1004] = \"MissingManagedObjectProvider\", e[e.NoManifest = 1005] = \"NoManifest\", e[e.NoRootElement = 1006] = \"NoRootElement\", e[e.NoView = 1007] = \"NoView\", e[e.CookieKeyNotDefined = 1008] = \"CookieKeyNotDefined\", e[e.CookieCategoryNotAllowed = 1009] = \"CookieCategoryNotAllowed\", e[e.StorageKeyNotDefined = 1010] = \"StorageKeyNotDefined\", e[e.StorageCategoryNotAllowed = 1011] = \"StorageCategoryNotAllowed\", e[e.LocalizationTemplateNotDefined = 1012] = \"LocalizationTemplateNotDefined\", e))(C || {});\nfunction pe(e, n) {\n return Object.entries(n).reduce((t, [o, i]) => t.replaceAll(`{{${o}}}`, i), e);\n}\nconst de = {\n // framework\n 1e3: \"The runtime has already been initialized\",\n 1001: \"App name and/or app key is not defined on global scope\",\n 1002: \"No app controller registered for app '{{app}}'\",\n 1003: \"No capability '{{capability}}' enabled for app '{{app}}'\",\n 1004: \"No managed object provider registered for object '{{object}}'\",\n 1005: \"The current apps manifest is not defined on global scope\",\n 1006: \"Could not find the root element in the DOM\",\n 1007: \"Could not find view with id '{{id}}' on view controller for app '{{app}}'\",\n 1008: \"Cookie key '{{key}}' not present in manifest, cookie has not been set\",\n 1009: \"Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set\",\n 1010: \"Storage key '{{key}}' not present in manifest, item has not been stored\",\n 1011: \"Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored\",\n 1012: \"The translation template, referred by the key '{{key}}' is being used in app, but is not defined in the manifest.\",\n // utilities\n 2e3: \"No managed object provider registered for object 'currentUser'\",\n 2001: \"Could not access the gateway when querying 'currentUser'\",\n 2002: \"Could not access the required backend when querying 'currentUser'\",\n 2003: \"Could not locate the authenticated user in the Alliance database\"\n}, fe = \"AllianceError\";\nclass v extends Error {\n constructor(n, t = {}) {\n const o = pe(de[n], t), i = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${n}`;\n super(o), this.code = n, this.name = fe, this.stack = `[${n}] - ${o}\n` + i;\n }\n}\nfunction ge(e) {\n const n = Object.entries(e).reduce((t, o) => {\n const [i, s] = o;\n return typeof s > \"u\" || (typeof s == \"object\" && s !== null ? t[i] = JSON.stringify(s) : t[i] = s), t;\n }, {});\n return Object.keys(n).length ? `?${new URLSearchParams(n)}` : \"\";\n}\nfunction me() {\n const e = G(), { href: n, search: t } = window.location;\n return n.replace(e, \"\").replace(t, \"\");\n}\nfunction Ce(e = \"\", n = \"\", t = {}) {\n const o = G().replace(location.origin, \"\"), i = ge(t);\n return e ? n ? `${o}/${e}/${n}${i}` : `${o}/${e}${i}` : `${o}${i}`;\n}\nfunction ze() {\n const e = me(), [n = \"\", t = \"\"] = e.split(\"/\").filter((o) => !!o);\n return {\n app: n,\n capability: t\n };\n}\nfunction Ke(e) {\n const { origin: n, pathname: t } = window.location;\n if (e === \"production\") {\n const [o] = t.split(\"/\").filter((i) => !!i);\n return globalThis.__ALLIANCE_RUNTIME_ROOT_URL = `${n}/${o}`;\n }\n return globalThis.__ALLIANCE_RUNTIME_ROOT_URL = n;\n}\nfunction G() {\n return globalThis.__ALLIANCE_RUNTIME_ROOT_URL;\n}\nvar J = /* @__PURE__ */ ((e) => (e[e.AlreadyExists = 0] = \"AlreadyExists\", e[e.ApiGatewayPortDescription = 1] = \"ApiGatewayPortDescription\", e[e.ApiServerModeDescription = 2] = \"ApiServerModeDescription\", e[e.AppConfigurationPath = 3] = \"AppConfigurationPath\", e[e.AppCreated = 4] = \"AppCreated\", e[e.AppEntryBuildOptionDescription = 5] = \"AppEntryBuildOptionDescription\", e[e.AppNameInquiry = 6] = \"AppNameInquiry\", e[e.BuildDescription = 7] = \"BuildDescription\", e[e.BuildModeOptionDescription = 8] = \"BuildModeOptionDescription\", e[e.BuildWatchDescription = 9] = \"BuildWatchDescription\", e[e.CreateAppDescription = 10] = \"CreateAppDescription\", e[e.CreateWorkspaceDescription = 11] = \"CreateWorkspaceDescription\", e[e.DevServerOpenDescription = 12] = \"DevServerOpenDescription\", e[e.DevServerPortDescription = 13] = \"DevServerPortDescription\", e[e.DevServerLoggingDescription = 14] = \"DevServerLoggingDescription\", e[e.Done = 15] = \"Done\", e[e.FetchPackageVersionError = 16] = \"FetchPackageVersionError\", e[e.ManifestEntryBuildOptionDescription = 17] = \"ManifestEntryBuildOptionDescription\", e[e.MissingTranslationKey = 18] = \"MissingTranslationKey\", e[e.NoAppName = 19] = \"NoAppName\", e[e.NoAppNameFound = 20] = \"NoAppNameFound\", e[e.NoAppOrWorkspaceInCurrentDirectory = 21] = \"NoAppOrWorkspaceInCurrentDirectory\", e[e.NoWorkspaceName = 22] = \"NoWorkspaceName\", e[e.OperationCancelled = 23] = \"OperationCancelled\", e[e.ServeDescription = 24] = \"ServeDescription\", e[e.ServedStopped = 25] = \"ServedStopped\", e[e.ServerGatewayMode = 26] = \"ServerGatewayMode\", e[e.ServerMode = 27] = \"ServerMode\", e[e.ServerModeInquiry = 28] = \"ServerModeInquiry\", e[e.ServerProxyMode = 29] = \"ServerProxyMode\", e[e.StopServerInstructions = 30] = \"StopServerInstructions\", e[e.TemplateFrameworkInquiry = 31] = \"TemplateFrameworkInquiry\", e[e.TemplateLanguageInquiry = 32] = \"TemplateLanguageInquiry\", e[e.UnrecognizedCommand = 33] = \"UnrecognizedCommand\", e[e.WorkspaceCreated = 34] = \"WorkspaceCreated\", e[e.WorkspaceNameInquiry = 35] = \"WorkspaceNameInquiry\", e))(J || {});\nconst ye = {\n 15: \"Done\",\n 22: \"No workspace name provided!\",\n 19: \"No app name provided!\",\n 0: \"File or directory '{0}' already exists!\",\n 21: \"Could not find any app entry file at '{0}'!\",\n 33: \"Unrecognized command(s) {0}!\",\n 34: \"Workspace was created at path '{0}'!\",\n 4: \"App was created at path '{0}'!\",\n 25: \"Server stopped.\",\n 11: \"Creates an Alliance Workspace in the current directory.\",\n 10: \"Creates an Alliance Application in the current directory or Alliance Workspace.\",\n 24: \"Starts a Alliance development server using the current directory package.json.\",\n 7: \"Builds an Alliance Application using Vite.\",\n 35: \"Enter the name of your workspace\",\n 28: \"Which server mode do you want to use?\",\n 6: \"Enter the name of your app\",\n 18: \"No translation key provided!\",\n 23: \"Operation cancelled.\",\n 30: `Press CTRL + C to stop the server.\n`,\n 32: \"Select preferred language\",\n 31: \"Select preferred framework template\",\n 13: \"The port that the dev server should use.\",\n 14: \"Whether the dev server and browser console should output more log information or not (false).\",\n 1: \"The port that the api gateway should use.\",\n 2: \"Which components to start. [server|server-proxy|server-gateway].\",\n 12: \"Whether the dev server should automatically open in your browser or not.\",\n 9: \"Whether the build should start watching and rebuild when files change or not.\",\n 5: \"The entry file for the app (./src/app).\",\n 17: \"The entry file for the app manifest (./src/manifest).\",\n 8: \"Which mode to use when building the app.\",\n 16: \"Failed to fetch package info from the NPM registry for package '${0}'!\",\n 20: \"Could not find app name in manifest.\",\n 3: \"The path to the app configuration file.\",\n 27: \"Server\",\n 29: \"Server with proxy\",\n 26: \"Server with gateway\"\n}, F = class {\n};\nR(F, \"getTranslations\", () => ye), R(F, \"getTranslation\", (e, ...n) => {\n const t = F.getTranslations()[e];\n if (!t)\n throw new Error(`Could not find text with given key '${e}'.`);\n return n.reduce(\n (o, i, s) => o.toString().replace(`{${s}}`, i.toString()),\n t\n ).toString();\n}), R(F, \"get\", (e = J.MissingTranslationKey, ...n) => F.getTranslation(e, ...n));\nfunction he(e) {\n return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, \"default\") ? e.default : e;\n}\nvar $ = { exports: {} }, _, K;\nfunction we() {\n if (K)\n return _;\n K = 1;\n var e = 1e3, n = e * 60, t = n * 60, o = t * 24, i = o * 7, s = o * 365.25;\n _ = function(r, a) {\n a = a || {};\n var u = typeof r;\n if (u === \"string\" && r.length > 0)\n return l(r);\n if (u === \"number\" && isFinite(r))\n return a.long ? c(r) : p(r);\n throw new Error(\n \"val is not a non-empty string or a valid number. val=\" + JSON.stringify(r)\n );\n };\n function l(r) {\n if (r = String(r), !(r.length > 100)) {\n var a = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n r\n );\n if (a) {\n var u = parseFloat(a[1]), h = (a[2] || \"ms\").toLowerCase();\n switch (h) {\n case \"years\":\n case \"year\":\n case \"yrs\":\n case \"yr\":\n case \"y\":\n return u * s;\n case \"weeks\":\n case \"week\":\n case \"w\":\n return u * i;\n case \"days\":\n case \"day\":\n case \"d\":\n return u * o;\n case \"hours\":\n case \"hour\":\n case \"hrs\":\n case \"hr\":\n case \"h\":\n return u * t;\n case \"minutes\":\n case \"minute\":\n case \"mins\":\n case \"min\":\n case \"m\":\n return u * n;\n case \"seconds\":\n case \"second\":\n case \"secs\":\n case \"sec\":\n case \"s\":\n return u * e;\n case \"milliseconds\":\n case \"millisecond\":\n case \"msecs\":\n case \"msec\":\n case \"ms\":\n return u;\n default:\n return;\n }\n }\n }\n }\n function p(r) {\n var a = Math.abs(r);\n return a >= o ? Math.round(r / o) + \"d\" : a >= t ? Math.round(r / t) + \"h\" : a >= n ? Math.round(r / n) + \"m\" : a >= e ? Math.round(r / e) + \"s\" : r + \"ms\";\n }\n function c(r) {\n var a = Math.abs(r);\n return a >= o ? d(r, a, o, \"day\") : a >= t ? d(r, a, t, \"hour\") : a >= n ? d(r, a, n, \"minute\") : a >= e ? d(r, a, e, \"second\") : r + \" ms\";\n }\n function d(r, a, u, h) {\n var f = a >= u * 1.5;\n return Math.round(r / u) + \" \" + h + (f ? \"s\" : \"\");\n }\n return _;\n}\nfunction ve(e) {\n t.debug = t, t.default = t, t.coerce = c, t.disable = s, t.enable = i, t.enabled = l, t.humanize = we(), t.destroy = d, Object.keys(e).forEach((r) => {\n t[r] = e[r];\n }), t.names = [], t.skips = [], t.formatters = {};\n function n(r) {\n let a = 0;\n for (let u = 0; u < r.length; u++)\n a = (a << 5) - a + r.charCodeAt(u), a |= 0;\n return t.colors[Math.abs(a) % t.colors.length];\n }\n t.selectColor = n;\n function t(r) {\n let a, u = null, h, f;\n function g(...m) {\n if (!g.enabled)\n return;\n const y = g, N = Number(/* @__PURE__ */ new Date()), re = N - (a || N);\n y.diff = re, y.prev = a, y.curr = N, a = N, m[0] = t.coerce(m[0]), typeof m[0] != \"string\" && m.unshift(\"%O\");\n let S = 0;\n m[0] = m[0].replace(/%([a-zA-Z%])/g, (T, oe) => {\n if (T === \"%%\")\n return \"%\";\n S++;\n const z = t.formatters[oe];\n if (typeof z == \"function\") {\n const ie = m[S];\n T = z.call(y, ie), m.splice(S, 1), S--;\n }\n return T;\n }), t.formatArgs.call(y, m), (y.log || t.log).apply(y, m);\n }\n return g.namespace = r, g.useColors = t.useColors(), g.color = t.selectColor(r), g.extend = o, g.destroy = t.destroy, Object.defineProperty(g, \"enabled\", {\n enumerable: !0,\n configurable: !1,\n get: () => u !== null ? u : (h !== t.namespaces && (h = t.namespaces, f = t.enabled(r)), f),\n set: (m) => {\n u = m;\n }\n }), typeof t.init == \"function\" && t.init(g), g;\n }\n function o(r, a) {\n const u = t(this.namespace + (typeof a > \"u\" ? \":\" : a) + r);\n return u.log = this.log, u;\n }\n function i(r) {\n t.save(r), t.namespaces = r, t.names = [], t.skips = [];\n let a;\n const u = (typeof r == \"string\" ? r : \"\").split(/[\\s,]+/), h = u.length;\n for (a = 0; a < h; a++)\n u[a] && (r = u[a].replace(/\\*/g, \".*?\"), r[0] === \"-\" ? t.skips.push(new RegExp(\"^\" + r.slice(1) + \"$\")) : t.names.push(new RegExp(\"^\" + r + \"$\")));\n }\n function s() {\n const r = [\n ...t.names.map(p),\n ...t.skips.map(p).map((a) => \"-\" + a)\n ].join(\",\");\n return t.enable(\"\"), r;\n }\n function l(r) {\n if (r[r.length - 1] === \"*\")\n return !0;\n let a, u;\n for (a = 0, u = t.skips.length; a < u; a++)\n if (t.skips[a].test(r))\n return !1;\n for (a = 0, u = t.names.length; a < u; a++)\n if (t.names[a].test(r))\n return !0;\n return !1;\n }\n function p(r) {\n return r.toString().substring(2, r.toString().length - 2).replace(/\\.\\*\\?$/, \"*\");\n }\n function c(r) {\n return r instanceof Error ? r.stack || r.message : r;\n }\n function d() {\n console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\");\n }\n return t.enable(t.load()), t;\n}\nvar Ae = ve;\n(function(e, n) {\n n.formatArgs = o, n.save = i, n.load = s, n.useColors = t, n.storage = l(), n.destroy = (() => {\n let c = !1;\n return () => {\n c || (c = !0, console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\"));\n };\n })(), n.colors = [\n \"#0000CC\",\n \"#0000FF\",\n \"#0033CC\",\n \"#0033FF\",\n \"#0066CC\",\n \"#0066FF\",\n \"#0099CC\",\n \"#0099FF\",\n \"#00CC00\",\n \"#00CC33\",\n \"#00CC66\",\n \"#00CC99\",\n \"#00CCCC\",\n \"#00CCFF\",\n \"#3300CC\",\n \"#3300FF\",\n \"#3333CC\",\n \"#3333FF\",\n \"#3366CC\",\n \"#3366FF\",\n \"#3399CC\",\n \"#3399FF\",\n \"#33CC00\",\n \"#33CC33\",\n \"#33CC66\",\n \"#33CC99\",\n \"#33CCCC\",\n \"#33CCFF\",\n \"#6600CC\",\n \"#6600FF\",\n \"#6633CC\",\n \"#6633FF\",\n \"#66CC00\",\n \"#66CC33\",\n \"#9900CC\",\n \"#9900FF\",\n \"#9933CC\",\n \"#9933FF\",\n \"#99CC00\",\n \"#99CC33\",\n \"#CC0000\",\n \"#CC0033\",\n \"#CC0066\",\n \"#CC0099\",\n \"#CC00CC\",\n \"#CC00FF\",\n \"#CC3300\",\n \"#CC3333\",\n \"#CC3366\",\n \"#CC3399\",\n \"#CC33CC\",\n \"#CC33FF\",\n \"#CC6600\",\n \"#CC6633\",\n \"#CC9900\",\n \"#CC9933\",\n \"#CCCC00\",\n \"#CCCC33\",\n \"#FF0000\",\n \"#FF0033\",\n \"#FF0066\",\n \"#FF0099\",\n \"#FF00CC\",\n \"#FF00FF\",\n \"#FF3300\",\n \"#FF3333\",\n \"#FF3366\",\n \"#FF3399\",\n \"#FF33CC\",\n \"#FF33FF\",\n \"#FF6600\",\n \"#FF6633\",\n \"#FF9900\",\n \"#FF9933\",\n \"#FFCC00\",\n \"#FFCC33\"\n ];\n function t() {\n return typeof window < \"u\" && window.process && (window.process.type === \"renderer\" || window.process.__nwjs) ? !0 : typeof navigator < \"u\" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/) ? !1 : typeof document < \"u\" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773\n typeof window < \"u\" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n typeof navigator < \"u\" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker\n typeof navigator < \"u\" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n }\n function o(c) {\n if (c[0] = (this.useColors ? \"%c\" : \"\") + this.namespace + (this.useColors ? \" %c\" : \" \") + c[0] + (this.useColors ? \"%c \" : \" \") + \"+\" + e.exports.humanize(this.diff), !this.useColors)\n return;\n const d = \"color: \" + this.color;\n c.splice(1, 0, d, \"color: inherit\");\n let r = 0, a = 0;\n c[0].replace(/%[a-zA-Z%]/g, (u) => {\n u !== \"%%\" && (r++, u === \"%c\" && (a = r));\n }), c.splice(a, 0, d);\n }\n n.log = console.debug || console.log || (() => {\n });\n function i(c) {\n try {\n c ? n.storage.setItem(\"debug\", c) : n.storage.removeItem(\"debug\");\n } catch {\n }\n }\n function s() {\n let c;\n try {\n c = n.storage.getItem(\"debug\");\n } catch {\n }\n return !c && typeof process < \"u\" && \"env\" in process && (c = process.env.DEBUG), c;\n }\n function l() {\n try {\n return localStorage;\n } catch {\n }\n }\n e.exports = Ae(n);\n const { formatters: p } = e.exports;\n p.j = function(c) {\n try {\n return JSON.stringify(c);\n } catch (d) {\n return \"[UnexpectedJSONParseError]: \" + d.message;\n }\n };\n})($, $.exports);\nvar be = $.exports;\nconst Fe = /* @__PURE__ */ he(be);\nfunction Z(e) {\n return e.type === \"Logic\";\n}\nvar U = /* @__PURE__ */ ((e) => (e.View = \"View\", e.Logic = \"Logic\", e))(U || {});\nclass Ne {\n constructor(n) {\n b(this, \"type\", \"Logic\");\n b(this, \"execute\");\n this.execute = n;\n }\n}\nfunction I() {\n try {\n return ALLIANCE_APP_NAME;\n } catch {\n }\n}\nfunction Se() {\n try {\n return ALLIANCE_APP_KEY;\n } catch {\n }\n}\nfunction ke() {\n const e = {\n environment: \"production\",\n logging: !1\n };\n try {\n return ALLIANCE_ENVIRONMENT || e;\n } catch {\n return e;\n }\n}\nfunction H() {\n if (O())\n return Promise.resolve();\n const e = 2e4, n = 5;\n return new Promise((t, o) => {\n const i = () => {\n clearInterval(l), clearTimeout(s);\n }, s = setTimeout(() => {\n i(), o(new Error(`Runtime not initialized after ${e}ms`));\n }, e), l = setInterval(() => {\n O() && (i(), t());\n }, n);\n });\n}\nfunction O() {\n return w(\n \"RUNTIME_INITIALIZED\"\n /* RuntimeInitialized */\n );\n}\nfunction w(e = \"\") {\n return globalThis[Q(e)];\n}\nfunction Y(e, n) {\n return globalThis[Q(e)] = n;\n}\nfunction Q(e) {\n return `__ALLIANCE_${e}`;\n}\nfunction X(e) {\n return `APP_CONTROLLER_KEY_${e}`;\n}\nvar E = /* @__PURE__ */ ((e) => (e.RuntimeInitialized = \"RUNTIME_INITIALIZED\", e.RuntimeApps = \"RUNTIME_APPS\", e.RuntimeManifests = \"RUNTIME_MANIFESTS\", e))(E || {});\nfunction Ve() {\n const e = document.createElement(\"div\");\n return e.id = \"root\", document.body.append(e), e;\n}\nfunction Oe() {\n const e = document.getElementById(\"root\");\n if (!e)\n throw new v(C.NoRootElement);\n return e;\n}\nfunction Ie(e) {\n return {\n capabilities: \"#25BCDD\",\n \"managed-objects\": \"#FC7A12\",\n controller: \"#F635C6\",\n proxy: \"#48E70B\",\n views: \"#F6D72E\",\n system: \"#D52C2E\"\n }[e];\n}\nconst q = /* @__PURE__ */ new Map();\nfunction M(e) {\n let n = q.get(e);\n return n || (n = Fe(e === \"system\" ? \"[system]\" : `[${I()}] ${e}`), n.color = Ie(e), n.enabled = Ee(), q.set(e, n), n);\n}\nfunction Ee() {\n const e = ke(), n = V.get(\"logging\");\n return e.environment === \"development\" && !!e.logging || n === \"true\";\n}\nlet x = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((n, t) => (t &= 63, t < 36 ? n += t.toString(36) : t < 62 ? n += (t - 26).toString(36).toUpperCase() : t > 62 ? n += \"-\" : n += \"_\", n), \"\");\nconst Me = M(\"controller\");\nfunction De() {\n const e = I(), n = Se();\n if (!e || !n)\n throw new v(C.NoAppNameOrKey);\n const t = X(e);\n return w(t) ? w(t) : (Y(t, n), n);\n}\nfunction ee() {\n const e = De();\n if (w(e))\n return w(e);\n const n = I();\n Me(\"creating app controller\");\n const t = {\n name: n,\n capabilities: {\n app: /* @__PURE__ */ new Map(),\n system: /* @__PURE__ */ new Map()\n },\n managedObjects: {\n providers: /* @__PURE__ */ new Map(),\n watchers: /* @__PURE__ */ new Map()\n },\n views: Le()\n };\n return Y(e, t), t;\n}\nasync function B(e) {\n await H();\n const n = X(e), t = w(n);\n if (!t)\n return;\n const o = w(t);\n if (o)\n return o;\n}\nasync function Ge() {\n return await H(), (await Promise.all(\n w(E.RuntimeApps).map((n) => B(n))\n )).filter((n) => !!n);\n}\nconst P = M(\"views\");\nfunction te(e) {\n return e.type === U.View;\n}\nvar D = /* @__PURE__ */ ((e) => (e.Main = \"main\", e.Aside = \"aside\", e.Body = \"body\", e))(D || {});\nclass W {\n constructor(n, t) {\n b(this, \"type\", U.View);\n b(this, \"execute\");\n this.container = t, this.execute = n;\n }\n}\nfunction Le() {\n const e = I(), n = /* @__PURE__ */ new Map(), t = async (i) => {\n const s = n.get(i);\n if (P(\"unmounting view - view: %O\", s), !s)\n throw new v(C.NoView, { id: i, app: e });\n s.unmount && await s.unmount(), s.element.replaceChildren(), s.element.removeAttribute(\"app\"), s.element.removeAttribute(\"view-id\"), n.delete(i), s.element.remove();\n };\n return {\n unmount: t,\n mount: async (i, s, l, p) => {\n if (P(\"mounting view - operation: %O, capability: %o, args: %O\", i, l, p), i.container === \"main\") {\n const f = Ce(e, l, p), g = location.href.replace(location.origin, \"\");\n f !== g && (P(\"syncing url - data: %O, url: %o\", p, f), history.pushState(p, \"\", f));\n }\n if (i.container === \"aside\" || i.container === \"main\") {\n const [f] = Array.from(document.getElementsByTagName(i.container)), g = f == null ? void 0 : f.getAttribute(\"app\"), m = f == null ? void 0 : f.getAttribute(\"view-id\");\n if (g && m) {\n const y = await B(g);\n await (y == null ? void 0 : y.views.unmount(m));\n }\n }\n let c;\n const d = Oe();\n i.container === \"aside\" ? (c = document.createElement(\n \"aside\"\n /* Aside */\n ), d.prepend(c)) : i.container === \"body\" ? (c = document.createElement(\"div\"), d.append(c)) : (c = document.createElement(\n \"main\"\n /* Main */\n ), d.append(c));\n const r = Te(), a = x(8);\n c.setAttribute(\"app\", e), c.setAttribute(\"view-id\", a);\n const u = await i.execute(c, (f) => {\n s(f), t(a);\n });\n r.remove();\n const h = {\n element: c,\n unmount: u\n };\n n.set(a, h);\n }\n };\n}\nfunction Te() {\n const e = document.createElement(\"div\");\n return e.id = \"app-loader\", e.innerHTML = `\n <div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n `, document.body.append(e), e;\n}\nfunction Je(e) {\n return new W(e, D.Main);\n}\nfunction Ze(e) {\n return new W(e, D.Body);\n}\nfunction He(e) {\n return new W(e, D.Aside);\n}\nfunction Ye(e) {\n return new Ne(e);\n}\nfunction Re() {\n return structuredClone(w(E.RuntimeManifests));\n}\nfunction Qe() {\n try {\n return ALLIANCE_APP_MANIFEST;\n } catch {\n }\n}\nconst A = M(\"system\");\nfunction _e(e) {\n const n = e.split(\";\")[0];\n return decodeURIComponent(n.split(\"=\")[0].trim());\n}\nconst Pe = \"alliance-cookie-consent\";\nfunction je() {\n let e = [\"necessary\"];\n const n = V.get(Pe);\n if (n) {\n const t = n.split(\",\"), o = /* @__PURE__ */ new Set([...e, ...t]);\n e = Array.from(o);\n }\n return e;\n}\nfunction $e() {\n return Re().reduce((n, t) => {\n if (!t.storage)\n return n;\n for (const [o, i] of Object.entries(t.storage))\n n[o] = i;\n return n;\n }, {});\n}\nfunction Xe() {\n const e = $e();\n function n(t, o, i) {\n const s = e[t];\n if (!s)\n throw new v(o, {\n key: t\n });\n if (!je().includes(s.category))\n throw new v(i, {\n key: t,\n category: s.category\n });\n return !0;\n }\n try {\n const t = Object.getOwnPropertyDescriptor(Document.prototype, \"cookie\") || Object.getOwnPropertyDescriptor(HTMLDocument.prototype, \"cookie\");\n t && t.configurable && (A(\"registering override for document.cookie setter\"), Object.defineProperty(document, \"cookie\", {\n get: function() {\n var o;\n return (o = t == null ? void 0 : t.get) == null ? void 0 : o.call(document);\n },\n set: function(o) {\n var i;\n if (o) {\n const s = _e(o);\n try {\n n(\n s,\n C.CookieKeyNotDefined,\n C.CookieCategoryNotAllowed\n );\n } catch (l) {\n console.error(l);\n return;\n }\n }\n return (i = t == null ? void 0 : t.set) == null ? void 0 : i.call(document, o);\n }\n }));\n } catch (t) {\n A(\"error occurred when attempting to override document.cookie setter - error: %O\", t);\n }\n try {\n const t = window.CookieStore.prototype.set;\n t && (A(\"registering override for cookieStore.set function\"), window.CookieStore.prototype.set = async function(o) {\n const i = typeof o == \"object\" ? o.name : o;\n try {\n n(\n i,\n C.CookieKeyNotDefined,\n C.CookieCategoryNotAllowed\n );\n } catch (s) {\n console.error(s);\n return;\n }\n return t.apply(this, arguments);\n });\n } catch (t) {\n A(\"error occurred when attempting to cookieStore.set - error: %O\", t);\n }\n try {\n const t = window.Storage.prototype.setItem;\n A(\"registering override for sessionStorage.setItem and localStorage.setItem\"), window.Storage.prototype.setItem = function(o, i) {\n try {\n n(\n o,\n C.StorageKeyNotDefined,\n C.StorageCategoryNotAllowed\n );\n } catch (s) {\n console.error(s);\n return;\n }\n return t.apply(this, arguments);\n };\n } catch (t) {\n A(\n \"error occurred when attempting to sessionStorage.setItem and localStorage.setItem - error: %O\",\n t\n );\n }\n}\nconst L = M(\"capabilities\");\nasync function ne(e, n, t) {\n const o = await B(e);\n if (!o)\n throw new v(C.MissingAppController, { app: e });\n const s = (t === \"app\" ? o.capabilities.app : o.capabilities.system).get(n);\n if (!s)\n throw new v(C.MissingCapabilityOnApp, {\n capability: n,\n app: e\n });\n return { controller: o, handler: s };\n}\nfunction Ue(e) {\n return (n, t, o) => (e(\"requesting capability - app: %o, capability: %o, args: %O\", n, t, o), {\n id: x(8),\n result: new Promise(async (i) => {\n const { controller: s, handler: l } = await ne(\n n,\n t,\n \"app\"\n ), p = await l(o);\n Z(p) ? await p.execute(i) : te(p) && await s.views.mount(p, i, t, o), e(\n \"resolved capability - app: %o, capability: %o, args: %O\",\n n,\n t,\n o\n );\n })\n });\n}\nfunction et(e, n) {\n if (O())\n throw new v(C.AlreadyInitialized);\n const t = ee();\n L(\"enabling capability - capability: %o, handler: %O\", e, n), t.capabilities.app.set(e, n);\n}\nfunction tt(e, n) {\n if (O())\n throw new v(C.AlreadyInitialized);\n const t = ee();\n L(\"enabling system capability - capability: %o, handler: %O\", e, n), t.capabilities.system.set(e, n);\n}\nfunction xe(e) {\n return (n, t, o) => {\n e(\n \"requesting system capability - capability: %o, args: %O, targetApp: %o\",\n n,\n t,\n o\n );\n const i = [], s = w(E.RuntimeApps);\n for (const l of s) {\n if (o && l !== o)\n continue;\n const p = new Promise(async (c) => {\n const { controller: d, handler: r } = await ne(\n l,\n n,\n \"system\"\n ), a = await r(t);\n Z(a) ? await a.execute(c) : te(a) && await d.views.mount(a, c, n, t), e(\n \"resolved system capability - capability: %o, args: %O, targetApp: %o\",\n n,\n t,\n o\n );\n });\n i.push({\n id: x(8),\n result: p\n });\n }\n return i;\n };\n}\nconst nt = xe(L), rt = Ue(L);\nexport {\n Pe as A,\n v as I,\n C as N,\n Ke as P,\n E as S,\n ze as W,\n Ge as a,\n Qe as b,\n M as c,\n ke as d,\n et as e,\n tt as f,\n ee as g,\n nt as h,\n O as i,\n He as j,\n Ze as k,\n Ye as l,\n Je as m,\n Re as n,\n Ve as o,\n xe as p,\n B as q,\n rt as r,\n Ue as s,\n Xe as t,\n w as u,\n Y as w\n};\n//# sourceMappingURL=capabilities-ff8d3362.js.map\n","import { c as C, i as b, I as p, N as g, g as P, a as S, b as A, d as N } from \"./chunks/capabilities-ff8d3362.js\";\nimport { A as _, j as V, k as z, l as K, m as Q, e as W, f as B, n as J, r as F, h as M } from \"./chunks/capabilities-ff8d3362.js\";\nfunction $(e) {\n return e;\n}\nconst c = C(\"managed-objects\");\nfunction I(e, n) {\n return c(\"querying objects - object: %o, args: %O\", e, n), {\n async resolve() {\n return c(\"resolving query - object: %o, args: %O\", e, n), await (await m(e)).managedObjects.providers.get(e)(n);\n },\n async watch(r) {\n c(\"adding watcher - object: %o, args: %O\", e, n), (await m(e)).managedObjects.watchers.get(e).push(r);\n }\n };\n}\nfunction U(e, n) {\n if (b())\n throw new p(g.AlreadyInitialized);\n c(\"registering provider - object: %o, handler: %O\", e, n);\n const r = P();\n return r.managedObjects.providers.set(e, n), r.managedObjects.watchers.set(e, []), function() {\n c(\"triggering watchers - object: %o, handler: %O\", e, n);\n const t = r.managedObjects.watchers.get(e) || [];\n for (const a of t)\n a();\n };\n}\nasync function m(e) {\n const r = (await S()).find(\n (t) => t.managedObjects.providers.has(e) && t.managedObjects.watchers.has(e)\n );\n if (!r)\n throw new p(g.MissingManagedObjectProvider, { object: e });\n return r;\n}\nconst y = C(\"proxy\");\nvar v = /* @__PURE__ */ ((e) => (e.Get = \"GET\", e.Head = \"HEAD\", e.Post = \"POST\", e.Put = \"PUT\", e.Delete = \"DELETE\", e.Connect = \"CONNECT\", e.Options = \"OPTIONS\", e.Trace = \"TRACE\", e.Patch = \"PATCH\", e))(v || {});\nfunction E(e, n, r = []) {\n const t = new URL(e, location.origin);\n if (r.find((o) => q(o, e))) {\n const s = \"/-/gateway\" + (t.pathname !== \"/\" ? t.pathname : \"/\") + (n ? t.search : \"\");\n return new URL(s, location.origin);\n }\n return t;\n}\nfunction R(e = {}) {\n if (Object.keys(e).length === 0)\n return \"\";\n const n = Object.entries(e).reduce(\n (t, [a, o]) => (typeof o > \"u\" || o === null || (t[a] = o.toString()), t),\n {}\n );\n return `?${new URLSearchParams(n).toString()}`;\n}\nfunction j(e) {\n return e.replaceAll(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n}\nfunction q(e, n) {\n const r = j(e);\n return new RegExp(`^${r.replaceAll(\"\\\\?\", \".?\").replaceAll(\"\\\\*\", \".*\")}`, \"i\").test(n);\n}\nfunction x(e, n) {\n const r = A();\n if (!r)\n throw new p(g.NoManifest);\n const { name: t, endpoints: a = [] } = r;\n y(\"creating request - input: %o, options: %O\", e, { lots: 1, of: { properties: 123 } });\n const o = E(e.toString(), !0, a), s = new Request(o, n), { environment: l } = N();\n if (l === \"production\") {\n const u = location.pathname.split(\"/\").filter((f) => !!f);\n s.headers.set(\"Alliance-Target-Workspace\", u[0]);\n }\n return s.headers.set(\"Alliance-Target-Url\", e.toString()), s.headers.set(\"Alliance-Target-App\", t), y(\"created request - request: %O\", s), s;\n}\nfunction k() {\n const e = A();\n if (!e)\n throw new p(g.NoManifest);\n const { name: n, endpoints: r = [] } = e;\n async function t(a, o, s = {}) {\n const { body: l, query: u, headers: f } = s, T = E(a, !1, r), d = R(u), O = {\n \"Alliance-Target-Url\": `${a}${d}`,\n // FUTURE TODO: Is there a better name for this?\n \"Alliance-Target-App\": n\n }, w = location.pathname.split(\"/\").filter((i) => !!i);\n w.length > 1 && (O[\n \"Alliance-Target-Workspace\"\n /* TargetWorkspace */\n ] = w[0]);\n const h = {\n method: o,\n headers: {\n \"Content-Type\": \"application/json\",\n ...f,\n ...O\n }\n };\n return l && (h.body = JSON.stringify(l)), fetch(`${T}${d}`, h).then((i) => i.json()).catch((i) => {\n throw i;\n });\n }\n return {\n post: (a, o) => t(a, \"POST\", o),\n put: (a, o) => t(a, \"PUT\", o),\n delete: (a, o) => t(a, \"DELETE\", o),\n get: (a, o) => t(a, \"GET\", o),\n create: x\n };\n}\nexport {\n _ as ALLIANCE_COOKIE_CONSENT_COOKIE_NAME,\n v as HttpMethods,\n V as createAsideViewOperation,\n z as createBodyViewOperation,\n K as createOperation,\n k as createProxy,\n x as createRequest,\n Q as createViewOperation,\n $ as defineConfig,\n W as enableCapability,\n B as enableSystemCapability,\n A as getAppManifest,\n J as getAppManifests,\n U as provideObjects,\n I as queryObjects,\n F as runCapability,\n M as runSystemCapability\n};\n//# sourceMappingURL=index.js.map\n","var g = Object.defineProperty;\nvar v = (e, t, r) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;\nvar a = (e, t, r) => (v(e, typeof t != \"symbol\" ? t + \"\" : t, r), r);\nvar N = /* @__PURE__ */ ((e) => (e[e.AlreadyInitialized = 1e3] = \"AlreadyInitialized\", e[e.NoAppNameOrKey = 1001] = \"NoAppNameOrKey\", e[e.MissingAppController = 1002] = \"MissingAppController\", e[e.MissingCapabilityOnApp = 1003] = \"MissingCapabilityOnApp\", e[e.MissingManagedObjectProvider = 1004] = \"MissingManagedObjectProvider\", e[e.NoManifest = 1005] = \"NoManifest\", e[e.NoRootElement = 1006] = \"NoRootElement\", e[e.NoView = 1007] = \"NoView\", e[e.CookieKeyNotDefined = 1008] = \"CookieKeyNotDefined\", e[e.CookieCategoryNotAllowed = 1009] = \"CookieCategoryNotAllowed\", e[e.StorageKeyNotDefined = 1010] = \"StorageKeyNotDefined\", e[e.StorageCategoryNotAllowed = 1011] = \"StorageCategoryNotAllowed\", e[e.LocalizationTemplateNotDefined = 1012] = \"LocalizationTemplateNotDefined\", e))(N || {}), A = /* @__PURE__ */ ((e) => (e[e.CurrentUserMissingProvider = 2e3] = \"CurrentUserMissingProvider\", e[e.CurrentUserGatewayNotStarted = 2001] = \"CurrentUserGatewayNotStarted\", e[e.CurrentUserMissingBackend = 2002] = \"CurrentUserMissingBackend\", e[e.CurrentUserMissingInDatabase = 2003] = \"CurrentUserMissingInDatabase\", e))(A || {});\nfunction m(e, t) {\n return Object.entries(t).reduce((r, [i, n]) => r.replaceAll(`{{${i}}}`, n), e);\n}\nconst S = {\n // framework\n 1e3: \"The runtime has already been initialized\",\n 1001: \"App name and/or app key is not defined on global scope\",\n 1002: \"No app controller registered for app '{{app}}'\",\n 1003: \"No capability '{{capability}}' enabled for app '{{app}}'\",\n 1004: \"No managed object provider registered for object '{{object}}'\",\n 1005: \"The current apps manifest is not defined on global scope\",\n 1006: \"Could not find the root element in the DOM\",\n 1007: \"Could not find view with id '{{id}}' on view controller for app '{{app}}'\",\n 1008: \"Cookie key '{{key}}' not present in manifest, cookie has not been set\",\n 1009: \"Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set\",\n 1010: \"Storage key '{{key}}' not present in manifest, item has not been stored\",\n 1011: \"Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored\",\n 1012: \"The translation template, referred by the key '{{key}}' is being used in app, but is not defined in the manifest.\",\n // utilities\n 2e3: \"No managed object provider registered for object 'currentUser'\",\n 2001: \"Could not access the gateway when querying 'currentUser'\",\n 2002: \"Could not access the required backend when querying 'currentUser'\",\n 2003: \"Could not locate the authenticated user in the Alliance database\"\n}, d = \"AllianceError\";\nclass I extends Error {\n constructor(t, r = {}) {\n const i = m(S[t], r), n = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${t}`;\n super(i), this.code = t, this.name = d, this.stack = `[${t}] - ${i}\n` + n;\n }\n}\nfunction k(e) {\n return !!e.code && e.name === d;\n}\nfunction b(e) {\n const r = Object.entries(e).reduce((i, n) => {\n const [o, p] = n;\n return typeof p > \"u\" || (typeof p == \"object\" && p !== null ? i[o] = JSON.stringify(p) : i[o] = p), i;\n }, {});\n return Object.keys(r).length ? `?${new URLSearchParams(r)}` : \"\";\n}\nfunction D() {\n const e = l(), { href: t, search: r } = window.location;\n return t.replace(e, \"\").replace(r, \"\");\n}\nfunction C(e = \"\", t = \"\", r = {}) {\n const i = l().replace(location.origin, \"\"), n = b(r);\n return e ? t ? `${i}/${e}/${t}${n}` : `${i}/${e}${n}` : `${i}${n}`;\n}\nfunction W() {\n const e = D(), [t = \"\", r = \"\"] = e.split(\"/\").filter((i) => !!i);\n return {\n app: t,\n capability: r\n };\n}\nfunction P(e) {\n const { origin: t, pathname: r } = window.location;\n if (e === \"production\") {\n const [i] = r.split(\"/\").filter((n) => !!n);\n return globalThis.__ALLIANCE_RUNTIME_ROOT_URL = `${t}/${i}`;\n }\n return globalThis.__ALLIANCE_RUNTIME_ROOT_URL = t;\n}\nfunction l() {\n return globalThis.__ALLIANCE_RUNTIME_ROOT_URL;\n}\nvar s = /* @__PURE__ */ ((e) => (e[e.AlreadyExists = 0] = \"AlreadyExists\", e[e.ApiGatewayPortDescription = 1] = \"ApiGatewayPortDescription\", e[e.ApiServerModeDescription = 2] = \"ApiServerModeDescription\", e[e.AppConfigurationPath = 3] = \"AppConfigurationPath\", e[e.AppCreated = 4] = \"AppCreated\", e[e.AppEntryBuildOptionDescription = 5] = \"AppEntryBuildOptionDescription\", e[e.AppNameInquiry = 6] = \"AppNameInquiry\", e[e.BuildDescription = 7] = \"BuildDescription\", e[e.BuildModeOptionDescription = 8] = \"BuildModeOptionDescription\", e[e.BuildWatchDescription = 9] = \"BuildWatchDescription\", e[e.CreateAppDescription = 10] = \"CreateAppDescription\", e[e.CreateWorkspaceDescription = 11] = \"CreateWorkspaceDescription\", e[e.DevServerOpenDescription = 12] = \"DevServerOpenDescription\", e[e.DevServerPortDescription = 13] = \"DevServerPortDescription\", e[e.DevServerLoggingDescription = 14] = \"DevServerLoggingDescription\", e[e.Done = 15] = \"Done\", e[e.FetchPackageVersionError = 16] = \"FetchPackageVersionError\", e[e.ManifestEntryBuildOptionDescription = 17] = \"ManifestEntryBuildOptionDescription\", e[e.MissingTranslationKey = 18] = \"MissingTranslationKey\", e[e.NoAppName = 19] = \"NoAppName\", e[e.NoAppNameFound = 20] = \"NoAppNameFound\", e[e.NoAppOrWorkspaceInCurrentDirectory = 21] = \"NoAppOrWorkspaceInCurrentDirectory\", e[e.NoWorkspaceName = 22] = \"NoWorkspaceName\", e[e.OperationCancelled = 23] = \"OperationCancelled\", e[e.ServeDescription = 24] = \"ServeDescription\", e[e.ServedStopped = 25] = \"ServedStopped\", e[e.ServerGatewayMode = 26] = \"ServerGatewayMode\", e[e.ServerMode = 27] = \"ServerMode\", e[e.ServerModeInquiry = 28] = \"ServerModeInquiry\", e[e.ServerProxyMode = 29] = \"ServerProxyMode\", e[e.StopServerInstructions = 30] = \"StopServerInstructions\", e[e.TemplateFrameworkInquiry = 31] = \"TemplateFrameworkInquiry\", e[e.TemplateLanguageInquiry = 32] = \"TemplateLanguageInquiry\", e[e.UnrecognizedCommand = 33] = \"UnrecognizedCommand\", e[e.WorkspaceCreated = 34] = \"WorkspaceCreated\", e[e.WorkspaceNameInquiry = 35] = \"WorkspaceNameInquiry\", e))(s || {});\nconst M = {\n 15: \"Done\",\n 22: \"No workspace name provided!\",\n 19: \"No app name provided!\",\n 0: \"File or directory '{0}' already exists!\",\n 21: \"Could not find any app entry file at '{0}'!\",\n 33: \"Unrecognized command(s) {0}!\",\n 34: \"Workspace was created at path '{0}'!\",\n 4: \"App was created at path '{0}'!\",\n 25: \"Server stopped.\",\n 11: \"Creates an Alliance Workspace in the current directory.\",\n 10: \"Creates an Alliance Application in the current directory or Alliance Workspace.\",\n 24: \"Starts a Alliance development server using the current directory package.json.\",\n 7: \"Builds an Alliance Application using Vite.\",\n 35: \"Enter the name of your workspace\",\n 28: \"Which server mode do you want to use?\",\n 6: \"Enter the name of your app\",\n 18: \"No translation key provided!\",\n 23: \"Operation cancelled.\",\n 30: `Press CTRL + C to stop the server.\n`,\n 32: \"Select preferred language\",\n 31: \"Select preferred framework template\",\n 13: \"The port that the dev server should use.\",\n 14: \"Whether the dev server and browser console should output more log information or not (false).\",\n 1: \"The port that the api gateway should use.\",\n 2: \"Which components to start. [server|server-proxy|server-gateway].\",\n 12: \"Whether the dev server should automatically open in your browser or not.\",\n 9: \"Whether the build should start watching and rebuild when files change or not.\",\n 5: \"The entry file for the app (./src/app).\",\n 17: \"The entry file for the app manifest (./src/manifest).\",\n 8: \"Which mode to use when building the app.\",\n 16: \"Failed to fetch package info from the NPM registry for package '${0}'!\",\n 20: \"Could not find app name in manifest.\",\n 3: \"The path to the app configuration file.\",\n 27: \"Server\",\n 29: \"Server with proxy\",\n 26: \"Server with gateway\"\n}, c = class c {\n};\na(c, \"getTranslations\", () => M), a(c, \"getTranslation\", (t, ...r) => {\n const n = c.getTranslations()[t];\n if (!n)\n throw new Error(`Could not find text with given key '${t}'.`);\n return r.reduce(\n (p, h, f) => p.toString().replace(`{${f}}`, h.toString()),\n n\n ).toString();\n}), a(c, \"get\", (t = s.MissingTranslationKey, ...r) => c.getTranslation(t, ...r));\nlet u = c;\nfunction R(e, t) {\n return O(Object.values(e), ({ name: r }) => ({\n label: r,\n value: r,\n selected: t === r\n }));\n}\nvar y = /* @__PURE__ */ ((e) => (e.Primary = \"primary\", e.Secondary = \"secondary\", e.Expressive = \"expressive\", e.Destructive = \"destructive\", e.Text = \"text\", e.PrimaryWhite = \"primary-white\", e.SecondaryWhite = \"secondary-white\", e.ExpressiveWhite = \"expressive-white\", e.TertiaryPurple = \"tertiary-purple\", e))(y || {});\nfunction $(e, t) {\n return Object.values(e).find((i) => i.name === t);\n}\nfunction O(e, t, r = \"Choose...\") {\n return e.reduce(\n (i, n) => (i.push({\n disabled: !1,\n selected: !1,\n ...t(n)\n }), i),\n [\n {\n label: r,\n value: \"\",\n disabled: !0,\n selected: !0\n }\n ]\n );\n}\nfunction L(e) {\n return (t) => {\n t.key === \"Enter\" && e(t);\n };\n}\nfunction U(e, t = \"all\") {\n const { email: r, displayName: i } = e, n = i && i !== \"unknown\", o = !!r;\n switch (t) {\n case \"all\": {\n if (n && o)\n return `${i} (${r})`;\n if (n)\n return i;\n if (o)\n return r;\n }\n case \"single\": {\n if (n)\n return i;\n if (o)\n return r;\n }\n }\n return \"<UNKNOWN USER>\";\n}\nfunction j(...e) {\n return e.filter((t) => !!t).join(\" \");\n}\nfunction q(e) {\n return Object.entries(e).reduce(\n (t, [r, i]) => (typeof i != \"object\" && typeof i != \"function\" && (t[r] = i), t),\n {}\n );\n}\nexport {\n I as AllianceError,\n N as FrameworkErrorCodes,\n u as Texts,\n s as TranslationsKey,\n A as UtilitiesErrorCodes,\n y as VocaButtonVariant,\n j as classNames,\n C as createCapabilityPath,\n U as friendlyUserName,\n W as getCurrentLocationInfo,\n l as getRuntimeRootUrl,\n $ as getVocaIcon,\n k as isAllianceError,\n O as mapToVocaOptions,\n L as onEnter,\n q as props,\n P as setRuntimeRootUrl,\n R as vocaIconsToOptions\n};\n//# sourceMappingURL=index.js.map\n","import { queryObjects } from '@telia-ace/alliance-framework';\nimport {\n AllianceError,\n FrameworkErrorCodes,\n UtilitiesErrorCodes,\n isAllianceError,\n} from '@telia-ace/alliance-internal-client-utilities';\n\ntype CurrentUser = {\n displayName: string;\n email: string;\n type: 'system-admin' | 'user';\n objectId: string;\n permissions: { permission: { name: string; app: { name: string } } }[];\n workspaces: { workspace: { name: string; slug: string } }[];\n hasPermission: (appName: string, permissionName: string) => boolean;\n isSystemAdmin: () => boolean;\n};\n\nlet currentUser: CurrentUser;\n\nexport async function getCurrentUser(): Promise<CurrentUser> {\n try {\n if (!currentUser) {\n const query = queryObjects<CurrentUser>('currentUser');\n currentUser = await query.resolve();\n }\n\n return {\n ...currentUser,\n hasPermission(appName, permissionName) {\n return !!currentUser?.permissions.find(\n ({ permission }) =>\n permission.app.name === appName && permission.name === permissionName\n );\n },\n isSystemAdmin() {\n return !!currentUser && currentUser.type === 'system-admin';\n },\n };\n } catch (err: any) {\n if (isAllianceError(err) && err.code === FrameworkErrorCodes.MissingManagedObjectProvider) {\n throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingProvider);\n } else if (err.message.includes('GraphQL Error (Code: 404)')) {\n throw new AllianceError(UtilitiesErrorCodes.CurrentUserGatewayNotStarted);\n } else if (err.message.includes('GraphQL Error (Code: 500)')) {\n throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingBackend);\n } else if (\n err.message.includes('GraphQL Error (Code: 200)') &&\n err.message.includes('Cannot return null for non-nullable field')\n ) {\n throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingInDatabase);\n } else {\n throw err;\n }\n }\n}\n","import { queryObjects } from '@telia-ace/alliance-framework';\n\ntype CurrentWorkspace = {\n name: string;\n slug: string;\n};\n\nexport async function getCurrentWorkspace() {\n const query = queryObjects<CurrentWorkspace>('currentWorkspace');\n return await query.resolve();\n}\n","import {\n getAppManifest,\n getAppManifests,\n queryObjects,\n type AppManifest,\n} from '@telia-ace/alliance-framework';\nimport { AllianceError, FrameworkErrorCodes } from '@telia-ace/alliance-internal-client-utilities';\n\ntype RecordEntries = Record<string, string>;\nexport type TranslatorFunction = (key: string, params?: RecordEntries) => string;\n\nexport function getDefaultLocalization(manifest?: AppManifest): RecordEntries {\n if (!manifest || !manifest.resources?.localization) {\n return {};\n }\n\n const localizationKeys = Object.keys(manifest.resources.localization);\n const defaults = localizationKeys.reduce((obj: RecordEntries, item: string) => {\n obj[item] = manifest.resources!.localization![item].value;\n\n return obj;\n }, {});\n\n return defaults;\n}\n\nfunction parseTemplates(message: string = '', variables: RecordEntries) {\n return Object.entries(variables).reduce((acc, [key, value]) => {\n return acc.replaceAll(`{{${key}}}`, value);\n }, message);\n}\n\nasync function getAppLocalization(): Promise<RecordEntries> {\n const manifest = getAppManifest();\n const appManifests = getAppManifests();\n\n const defaultLocalization = getDefaultLocalization(manifest);\n let localization: Record<string, string> = {};\n\n // Dont try to query objects if the resource management app is not installed\n if (appManifests?.find(({ name }) => name === 'resource-management')) {\n localization = await queryObjects('resourceTexts', { app: manifest?.name }).resolve();\n }\n\n return Object.keys(defaultLocalization).reduce<Record<string, string>>((acc, key) => {\n if (localization[key]) {\n acc[key] = localization[key];\n }\n\n return acc;\n }, defaultLocalization);\n}\n\nlet localizationStore: RecordEntries = {};\n\nexport async function getTranslator(): Promise<TranslatorFunction> {\n if (Object.keys(localizationStore).length === 0) {\n localizationStore = await getAppLocalization();\n }\n\n return (key: string, params?: RecordEntries): string => {\n const template = localizationStore[key];\n\n if (template === undefined) {\n throw new AllianceError(FrameworkErrorCodes.LocalizationTemplateNotDefined, { key });\n }\n\n if (!params || typeof params !== 'object' || Object.keys(params).length === 0) {\n return template;\n }\n\n return parseTemplates(template, params);\n };\n}\n"],"names":["k","n","o","ce","j","s","p","d","r","V","ue","le","R","C","pe","de","fe","J","ye","F","he","$","_","K","we","a","u","h","f","ve","g","m","y","N","re","T","oe","z","ie","Ae","be","Fe","I","ke","H","O","w","Q","X","E","Ie","q","M","Ee","B","Ge","Re","Qe","c","S","v","t","A","i","currentUser","getCurrentUser","queryObjects","appName","permissionName","permission","err","isAllianceError","FrameworkErrorCodes","AllianceError","UtilitiesErrorCodes","getCurrentWorkspace","getDefaultLocalization","manifest","_a","obj","item","parseTemplates","message","variables","acc","key","value","getAppLocalization","getAppManifest","appManifests","getAppManifests","defaultLocalization","localization","name","localizationStore","getTranslator","params","template"],"mappings":"AAGA;AACA,SAASA,EAAE,GAAG;AACZ,WAASC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AACzC,QAAI,IAAI,UAAUA,CAAC;AACnB,aAASC,KAAK;AACZ,QAAEA,CAAC,IAAI,EAAEA,CAAC;AAAA,EACb;AACD,SAAO;AACT;AACA,IAAIC,IAAK;AAAA,EACP,MAAM,SAAS,GAAG;AAChB,WAAO,EAAE,CAAC,MAAM,QAAQ,IAAI,EAAE,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,oBAAoB,kBAAkB;AAAA,EAC9F;AAAA,EACD,OAAO,SAAS,GAAG;AACjB,WAAO,mBAAmB,CAAC,EAAE;AAAA,MAC3B;AAAA,MACA;AAAA,IACN;AAAA,EACG;AACH;AACA,SAASC,EAAE,GAAGH,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CAAG,MACZD,EAAAC,CAAG,IAAIO,EAAaP,CAAG,IAGxBD,IACRO,CAAmB;AAC1B;AAEA,IAAIG,IAAmC,CAAA;AAEvC,eAAsBC,KAA6C;AAC/D,SAAI,OAAO,KAAKD,CAAiB,EAAE,WAAW,MAC1CA,IAAoB,MAAMP,OAGvB,CAACF,GAAaW,MAAmC;AAC9C,UAAAC,IAAWH,EAAkBT,CAAG;AAEtC,QAAIY,MAAa;AACb,YAAM,IAAIxB,EAAcD,EAAoB,gCAAgC,EAAE,KAAAa,EAAK,CAAA;AAGnF,WAAA,CAACW,KAAU,OAAOA,KAAW,YAAY,OAAO,KAAKA,CAAM,EAAE,WAAW,IACjEC,IAGJhB,GAAegB,GAAUD,CAAM;AAAA,EAAA;AAE9C;"}
|
|
1
|
+
{"version":3,"sources":["../src/get-current-user.ts","../src/get-current-workspace.ts","../src/get-translator.ts"],"names":["queryObjects","AllianceError","FrameworkErrorCodes","UtilitiesErrorCodes","isAllianceError","currentUser","getCurrentUser","query","resolve","hasPermission","appName","permissionName","permissions","find","permission","app","name","isSystemAdmin","type","err","code","MissingManagedObjectProvider","CurrentUserMissingProvider","message","includes","CurrentUserGatewayNotStarted","CurrentUserMissingBackend","CurrentUserMissingInDatabase","getCurrentWorkspace","getAppManifest","getAppManifests","getDefaultLocalization","manifest","resources","localization","localizationKeys","Object","keys","defaults","reduce","obj","item","value","parseTemplates","variables","entries","acc","key","replaceAll","getAppLocalization","appManifests","defaultLocalization","localizationStore","getTranslator","length","params","template","undefined","LocalizationTemplateNotDefined"],"mappings":";;;;AAAA,SAASA,oBAAoB;AAC7B,SACIC,eACAC,qBACAC,qBACAC,uBACG;AAaP,IAAIC;AAEJ,eAAsBC,iBAAAA;AAClB,MAAI;AACA,QAAI,CAACD,aAAa;AACd,YAAME,QAAQP,aAA0B,aAAA;AACxCK,oBAAc,MAAME,MAAMC,QAAO;IACrC;AAEA,WAAO;MACH,GAAGH;MACHI,cAAcC,SAASC,gBAAc;AACjC,eA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eAAea,UAAUD,MAAAA;EACpC;AACJ;AAlBsBF","sourcesContent":["import { queryObjects } from '@telia-ace/alliance-framework';\nimport {\n AllianceError,\n FrameworkErrorCodes,\n UtilitiesErrorCodes,\n isAllianceError,\n} from '@telia-ace/alliance-internal-client-utilities';\n\ntype CurrentUser = {\n displayName: string;\n email: string;\n type: 'system-admin' | 'user';\n objectId: string;\n permissions: { permission: { name: string; app: { name: string } } }[];\n workspaces: { workspace: { name: string; slug: string } }[];\n hasPermission: (appName: string, permissionName: string) => boolean;\n isSystemAdmin: () => boolean;\n};\n\nlet currentUser: CurrentUser;\n\nexport async function getCurrentUser(): Promise<CurrentUser> {\n try {\n if (!currentUser) {\n const query = queryObjects<CurrentUser>('currentUser');\n currentUser = await query.resolve();\n }\n\n return {\n ...currentUser,\n hasPermission(appName, permissionName) {\n return !!currentUser?.permissions.find(\n ({ permission }) =>\n permission.app.name === appName && permission.name === permissionName,\n );\n },\n isSystemAdmin() {\n return !!currentUser && currentUser.type === 'system-admin';\n },\n };\n } catch (err: any) {\n if (isAllianceError(err) && err.code === FrameworkErrorCodes.MissingManagedObjectProvider) {\n throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingProvider);\n } else if (err.message.includes('GraphQL Error (Code: 404)')) {\n throw new AllianceError(UtilitiesErrorCodes.CurrentUserGatewayNotStarted);\n } else if (err.message.includes('GraphQL Error (Code: 500)')) {\n throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingBackend);\n } else if (\n err.message.includes('GraphQL Error (Code: 200)') &&\n err.message.includes('Cannot return null for non-nullable field')\n ) {\n throw new AllianceError(UtilitiesErrorCodes.CurrentUserMissingInDatabase);\n } else {\n throw err;\n }\n }\n}\n","import { queryObjects } from '@telia-ace/alliance-framework';\n\ntype CurrentWorkspace = {\n name: string;\n slug: string;\n};\n\nexport async function getCurrentWorkspace() {\n const query = queryObjects<CurrentWorkspace>('currentWorkspace');\n return await query.resolve();\n}\n","import {\n type AppManifest,\n getAppManifest,\n getAppManifests,\n queryObjects,\n} from '@telia-ace/alliance-framework';\nimport { AllianceError, FrameworkErrorCodes } from '@telia-ace/alliance-internal-client-utilities';\n\ntype RecordEntries = Record<string, string>;\nexport type TranslatorFunction = (key: string, params?: RecordEntries) => string;\n\nexport function getDefaultLocalization(manifest?: AppManifest): RecordEntries {\n if (!manifest || !manifest.resources?.localization) {\n return {};\n }\n\n const localizationKeys = Object.keys(manifest.resources.localization);\n const defaults = localizationKeys.reduce((obj: RecordEntries, item: string) => {\n obj[item] = manifest.resources!.localization![item].value;\n\n return obj;\n }, {});\n\n return defaults;\n}\n\nfunction parseTemplates(message: string = '', variables: RecordEntries) {\n return Object.entries(variables).reduce((acc, [key, value]) => {\n return acc.replaceAll(`{{${key}}}`, value);\n }, message);\n}\n\nasync function getAppLocalization(): Promise<RecordEntries> {\n const manifest = getAppManifest();\n const appManifests = getAppManifests();\n\n const defaultLocalization = getDefaultLocalization(manifest);\n let localization: Record<string, string> = {};\n\n // Dont try to query objects if the resource management app is not installed\n if (appManifests?.find(({ name }) => name === 'resource-management')) {\n localization = await queryObjects('resourceTexts', { app: manifest?.name }).resolve();\n }\n\n return Object.keys(defaultLocalization).reduce<Record<string, string>>((acc, key) => {\n if (localization[key]) {\n acc[key] = localization[key];\n }\n\n return acc;\n }, defaultLocalization);\n}\n\nlet localizationStore: RecordEntries = {};\n\nexport async function getTranslator(): Promise<TranslatorFunction> {\n if (Object.keys(localizationStore).length === 0) {\n localizationStore = await getAppLocalization();\n }\n\n return (key: string, params?: RecordEntries): string => {\n const template = localizationStore[key];\n\n if (template === undefined) {\n throw new AllianceError(FrameworkErrorCodes.LocalizationTemplateNotDefined, { key });\n }\n\n if (!params || typeof params !== 'object' || Object.keys(params).length === 0) {\n return template;\n }\n\n return parseTemplates(template, params);\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/alliance-utilities",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14-next.0",
|
|
4
4
|
"description": "Utilities used by ACE Alliance apps.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@telia-ace/alliance-framework": "1.0.
|
|
18
|
-
"@telia-ace/alliance-internal-client-utilities": "1.0.
|
|
17
|
+
"@telia-ace/alliance-framework": "1.0.13-next.0",
|
|
18
|
+
"@telia-ace/alliance-internal-client-utilities": "1.0.4-next.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"
|
|
22
|
-
"vitest": "^0.
|
|
21
|
+
"tsup": "^7.2.0",
|
|
22
|
+
"vitest": "^0.34.6"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build:dev": "
|
|
29
|
-
"build:prod": "
|
|
28
|
+
"build:dev": "tsup",
|
|
29
|
+
"build:prod": "tsup",
|
|
30
30
|
"test": "vitest",
|
|
31
|
-
"dev": "
|
|
31
|
+
"dev": "tsup --watch"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
type CurrentUser = {
|
|
2
|
-
displayName: string;
|
|
3
|
-
email: string;
|
|
4
|
-
type: 'system-admin' | 'user';
|
|
5
|
-
objectId: string;
|
|
6
|
-
permissions: {
|
|
7
|
-
permission: {
|
|
8
|
-
name: string;
|
|
9
|
-
app: {
|
|
10
|
-
name: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
}[];
|
|
14
|
-
workspaces: {
|
|
15
|
-
workspace: {
|
|
16
|
-
name: string;
|
|
17
|
-
slug: string;
|
|
18
|
-
};
|
|
19
|
-
}[];
|
|
20
|
-
hasPermission: (appName: string, permissionName: string) => boolean;
|
|
21
|
-
isSystemAdmin: () => boolean;
|
|
22
|
-
};
|
|
23
|
-
export declare function getCurrentUser(): Promise<CurrentUser>;
|
|
24
|
-
export {};
|
package/dist/get-translator.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type AppManifest } from '@telia-ace/alliance-framework';
|
|
2
|
-
type RecordEntries = Record<string, string>;
|
|
3
|
-
export type TranslatorFunction = (key: string, params?: RecordEntries) => string;
|
|
4
|
-
export declare function getDefaultLocalization(manifest?: AppManifest): RecordEntries;
|
|
5
|
-
export declare function getTranslator(): Promise<TranslatorFunction>;
|
|
6
|
-
export {};
|