@telia-ace/alliance-utilities 1.0.11 → 1.0.12-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! js-cookie v3.0.5 | MIT */
2
- function A(e) {
2
+ function F(e) {
3
3
  for (var t = 1; t < arguments.length; t++) {
4
4
  var r = arguments[t];
5
5
  for (var a in r)
@@ -7,7 +7,7 @@ function A(e) {
7
7
  }
8
8
  return e;
9
9
  }
10
- var H = {
10
+ var X = {
11
11
  read: function(e) {
12
12
  return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
13
13
  },
@@ -19,47 +19,47 @@ var H = {
19
19
  }
20
20
  };
21
21
  function P(e, t) {
22
- function r(i, d, p) {
22
+ function r(i, p, l) {
23
23
  if (!(typeof document > "u")) {
24
- p = A({}, t, p), typeof p.expires == "number" && (p.expires = new Date(Date.now() + p.expires * 864e5)), p.expires && (p.expires = p.expires.toUTCString()), i = encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
25
- var l = "";
26
- for (var c in p)
27
- p[c] && (l += "; " + c, p[c] !== !0 && (l += "=" + p[c].split(";")[0]));
28
- return document.cookie = i + "=" + e.write(d, i) + l;
24
+ l = F({}, t, 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
29
  }
30
30
  }
31
31
  function a(i) {
32
32
  if (!(typeof document > "u" || arguments.length && !i)) {
33
- for (var d = document.cookie ? document.cookie.split("; ") : [], p = {}, l = 0; l < d.length; l++) {
34
- var c = d[l].split("="), u = c.slice(1).join("=");
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
35
  try {
36
36
  var o = decodeURIComponent(c[0]);
37
- if (p[o] = e.read(u, o), i === o)
37
+ if (l[o] = e.read(u, o), i === o)
38
38
  break;
39
39
  } catch {
40
40
  }
41
41
  }
42
- return i ? p[i] : p;
42
+ return i ? l[i] : l;
43
43
  }
44
44
  }
45
45
  return Object.create(
46
46
  {
47
47
  set: r,
48
48
  get: a,
49
- remove: function(i, d) {
49
+ remove: function(i, p) {
50
50
  r(
51
51
  i,
52
52
  "",
53
- A({}, d, {
53
+ F({}, p, {
54
54
  expires: -1
55
55
  })
56
56
  );
57
57
  },
58
58
  withAttributes: function(i) {
59
- return P(this.converter, A({}, this.attributes, i));
59
+ return P(this.converter, F({}, this.attributes, i));
60
60
  },
61
61
  withConverter: function(i) {
62
- return P(A({}, this.converter, i), this.attributes);
62
+ return P(F({}, this.converter, i), this.attributes);
63
63
  }
64
64
  },
65
65
  {
@@ -68,278 +68,122 @@ function P(e, t) {
68
68
  }
69
69
  );
70
70
  }
71
- var ee = P(H, { path: "/" }), re = Object.defineProperty, te = (e, t, r) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, F = (e, t, r) => (te(e, typeof t != "symbol" ? t + "" : t, r), r), R = /* @__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))(R || {});
72
- function oe(e, t) {
71
+ var Y = P(X, { path: "/" }), ee = Object.defineProperty, re = (e, t, r) => t in e ? ee(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, I = (e, t, r) => (re(e, typeof t != "symbol" ? t + "" : t, r), r), R = /* @__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))(R || {});
72
+ function te(e, t) {
73
73
  return Object.entries(t).reduce((r, [a, i]) => r.replaceAll(`{{${a}}}`, i), e);
74
74
  }
75
- const ne = {
75
+ const oe = {
76
76
  // framework
77
- [
78
- 1e3
79
- /* AlreadyInitialized */
80
- ]: "The runtime has already been initialized",
81
- [
82
- 1001
83
- /* NoAppNameOrKey */
84
- ]: "App name and/or app key is not defined on global scope",
85
- [
86
- 1002
87
- /* MissingAppController */
88
- ]: "No app controller registered for app '{{app}}'",
89
- [
90
- 1003
91
- /* MissingCapabilityOnApp */
92
- ]: "No capability '{{capability}}' enabled for app '{{app}}'",
93
- [
94
- 1004
95
- /* MissingManagedObjectProvider */
96
- ]: "No managed object provider registered for object '{{object}}'",
97
- [
98
- 1005
99
- /* NoManifest */
100
- ]: "The current apps manifest is not defined on global scope",
101
- [
102
- 1006
103
- /* NoRootElement */
104
- ]: "Could not find the root element in the DOM",
105
- [
106
- 1007
107
- /* NoView */
108
- ]: "Could not find view with id '{{id}}' on view controller for app '{{app}}'",
109
- [
110
- 1008
111
- /* CookieKeyNotDefined */
112
- ]: "Cookie key '{{key}}' not present in manifest, cookie has not been set",
113
- [
114
- 1009
115
- /* CookieCategoryNotAllowed */
116
- ]: "Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set",
117
- [
118
- 1010
119
- /* StorageKeyNotDefined */
120
- ]: "Storage key '{{key}}' not present in manifest, item has not been stored",
121
- [
122
- 1011
123
- /* StorageCategoryNotAllowed */
124
- ]: "Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored",
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.",
125
90
  // utilities
126
- [
127
- 2e3
128
- /* CurrentUserMissingProvider */
129
- ]: "No managed object provider registered for object 'currentUser'",
130
- [
131
- 2001
132
- /* CurrentUserGatewayNotStarted */
133
- ]: "Could not access the gateway when querying 'currentUser'",
134
- [
135
- 2002
136
- /* CurrentUserMissingBackend */
137
- ]: "Could not access the required backend when querying 'currentUser'",
138
- [
139
- 2003
140
- /* CurrentUserMissingInDatabase */
141
- ]: "Could not locate the authenticated user in the Alliance database"
142
- }, ae = "AllianceError";
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";
143
96
  class ie extends Error {
144
97
  constructor(t, r = {}) {
145
- const a = oe(ne[t], r), i = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${t}`;
146
- super(a), this.code = t, this.name = ae, this.stack = `[${t}] - ${a}
98
+ const a = te(oe[t], r), i = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${t}`;
99
+ super(a), this.code = t, this.name = ne, this.stack = `[${t}] - ${a}
147
100
  ` + i;
148
101
  }
149
102
  }
150
- var z = /* @__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))(z || {});
151
- const se = {
152
- [
153
- 15
154
- /* Done */
155
- ]: "Done",
156
- [
157
- 22
158
- /* NoWorkspaceName */
159
- ]: "No workspace name provided!",
160
- [
161
- 19
162
- /* NoAppName */
163
- ]: "No app name provided!",
164
- [
165
- 0
166
- /* AlreadyExists */
167
- ]: "File or directory '{0}' already exists!",
168
- [
169
- 21
170
- /* NoAppOrWorkspaceInCurrentDirectory */
171
- ]: "Could not find any app entry file at '{0}'!",
172
- [
173
- 33
174
- /* UnrecognizedCommand */
175
- ]: "Unrecognized command(s) {0}!",
176
- [
177
- 34
178
- /* WorkspaceCreated */
179
- ]: "Workspace was created at path '{0}'!",
180
- [
181
- 4
182
- /* AppCreated */
183
- ]: "App was created at path '{0}'!",
184
- [
185
- 25
186
- /* ServedStopped */
187
- ]: "Server stopped.",
188
- [
189
- 11
190
- /* CreateWorkspaceDescription */
191
- ]: "Creates an Alliance Workspace in the current directory.",
192
- [
193
- 10
194
- /* CreateAppDescription */
195
- ]: "Creates an Alliance Application in the current directory or Alliance Workspace.",
196
- [
197
- 24
198
- /* ServeDescription */
199
- ]: "Starts a Alliance development server using the current directory package.json.",
200
- [
201
- 7
202
- /* BuildDescription */
203
- ]: "Builds an Alliance Application using Vite.",
204
- [
205
- 35
206
- /* WorkspaceNameInquiry */
207
- ]: "Enter the name of your workspace",
208
- [
209
- 28
210
- /* ServerModeInquiry */
211
- ]: "Which server mode do you want to use?",
212
- [
213
- 6
214
- /* AppNameInquiry */
215
- ]: "Enter the name of your app",
216
- [
217
- 18
218
- /* MissingTranslationKey */
219
- ]: "No translation key provided!",
220
- [
221
- 23
222
- /* OperationCancelled */
223
- ]: "Operation cancelled.",
224
- [
225
- 30
226
- /* StopServerInstructions */
227
- ]: `Press CTRL + C to stop the server.
103
+ var K = /* @__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))(K || {});
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.
228
124
  `,
229
- [
230
- 32
231
- /* TemplateLanguageInquiry */
232
- ]: "Select preferred language",
233
- [
234
- 31
235
- /* TemplateFrameworkInquiry */
236
- ]: "Select preferred framework template",
237
- [
238
- 13
239
- /* DevServerPortDescription */
240
- ]: "The port that the dev server should use.",
241
- [
242
- 14
243
- /* DevServerLoggingDescription */
244
- ]: "Whether the dev server and browser console should output more log information or not (false).",
245
- [
246
- 1
247
- /* ApiGatewayPortDescription */
248
- ]: "The port that the api gateway should use.",
249
- [
250
- 2
251
- /* ApiServerModeDescription */
252
- ]: "Which components to start. [server|server-proxy|server-gateway].",
253
- [
254
- 12
255
- /* DevServerOpenDescription */
256
- ]: "Whether the dev server should automatically open in your browser or not.",
257
- [
258
- 9
259
- /* BuildWatchDescription */
260
- ]: "Whether the build should start watching and rebuild when files change or not.",
261
- [
262
- 5
263
- /* AppEntryBuildOptionDescription */
264
- ]: "The entry file for the app (./src/app).",
265
- [
266
- 17
267
- /* ManifestEntryBuildOptionDescription */
268
- ]: "The entry file for the app manifest (./src/manifest).",
269
- [
270
- 8
271
- /* BuildModeOptionDescription */
272
- ]: "Which mode to use when building the app.",
273
- [
274
- 16
275
- /* FetchPackageVersionError */
276
- ]: "Failed to fetch package info from the NPM registry for package '${0}'!",
277
- [
278
- 20
279
- /* NoAppNameFound */
280
- ]: "Could not find app name in manifest.",
281
- [
282
- 3
283
- /* AppConfigurationPath */
284
- ]: "The path to the app configuration file.",
285
- [
286
- 27
287
- /* ServerMode */
288
- ]: "Server",
289
- [
290
- 29
291
- /* ServerProxyMode */
292
- ]: "Server with proxy",
293
- [
294
- 26
295
- /* ServerGatewayMode */
296
- ]: "Server with gateway"
297
- }, j = class {
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 {
298
143
  };
299
- let M = j;
300
- F(M, "getTranslations", () => se), F(M, "getTranslation", (e, ...t) => {
301
- const r = j.getTranslations()[e];
144
+ I(v, "getTranslations", () => ae), I(v, "getTranslation", (e, ...t) => {
145
+ const r = v.getTranslations()[e];
302
146
  if (!r)
303
147
  throw new Error(`Could not find text with given key '${e}'.`);
304
148
  return t.reduce(
305
- (a, i, d) => a.toString().replace(`{${d}}`, i.toString()),
149
+ (a, i, p) => a.toString().replace(`{${p}}`, i.toString()),
306
150
  r
307
151
  ).toString();
308
- }), F(M, "get", (e = z.MissingTranslationKey, ...t) => j.getTranslation(e, ...t));
309
- function ce(e) {
152
+ }), I(v, "get", (e = K.MissingTranslationKey, ...t) => v.getTranslation(e, ...t));
153
+ function se(e) {
310
154
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
311
155
  }
312
- var x = { exports: {} }, I, B;
313
- function pe() {
314
- if (B)
315
- return I;
316
- B = 1;
317
- var e = 1e3, t = e * 60, r = t * 60, a = r * 24, i = a * 7, d = a * 365.25;
318
- I = function(o, n) {
156
+ var x = { exports: {} }, O, L;
157
+ function ce() {
158
+ if (L)
159
+ return O;
160
+ L = 1;
161
+ var e = 1e3, t = e * 60, r = t * 60, a = r * 24, i = a * 7, p = a * 365.25;
162
+ O = function(o, n) {
319
163
  n = n || {};
320
164
  var s = typeof o;
321
165
  if (s === "string" && o.length > 0)
322
- return p(o);
166
+ return l(o);
323
167
  if (s === "number" && isFinite(o))
324
- return n.long ? c(o) : l(o);
168
+ return n.long ? c(o) : d(o);
325
169
  throw new Error(
326
170
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(o)
327
171
  );
328
172
  };
329
- function p(o) {
173
+ function l(o) {
330
174
  if (o = String(o), !(o.length > 100)) {
331
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(
332
176
  o
333
177
  );
334
178
  if (n) {
335
- var s = parseFloat(n[1]), C = (n[2] || "ms").toLowerCase();
336
- switch (C) {
179
+ var s = parseFloat(n[1]), f = (n[2] || "ms").toLowerCase();
180
+ switch (f) {
337
181
  case "years":
338
182
  case "year":
339
183
  case "yrs":
340
184
  case "yr":
341
185
  case "y":
342
- return s * d;
186
+ return s * p;
343
187
  case "weeks":
344
188
  case "week":
345
189
  case "w":
@@ -378,7 +222,7 @@ function pe() {
378
222
  }
379
223
  }
380
224
  }
381
- function l(o) {
225
+ function d(o) {
382
226
  var n = Math.abs(o);
383
227
  return n >= a ? Math.round(o / a) + "d" : n >= r ? Math.round(o / r) + "h" : n >= t ? Math.round(o / t) + "m" : n >= e ? Math.round(o / e) + "s" : o + "ms";
384
228
  }
@@ -386,14 +230,14 @@ function pe() {
386
230
  var n = Math.abs(o);
387
231
  return n >= a ? u(o, n, a, "day") : n >= r ? u(o, n, r, "hour") : n >= t ? u(o, n, t, "minute") : n >= e ? u(o, n, e, "second") : o + " ms";
388
232
  }
389
- function u(o, n, s, C) {
390
- var v = n >= s * 1.5;
391
- return Math.round(o / s) + " " + C + (v ? "s" : "");
233
+ function u(o, n, s, f) {
234
+ var k = n >= s * 1.5;
235
+ return Math.round(o / s) + " " + f + (k ? "s" : "");
392
236
  }
393
- return I;
237
+ return O;
394
238
  }
395
- function de(e) {
396
- r.debug = r, r.default = r, r.coerce = c, r.disable = d, r.enable = i, r.enabled = p, r.humanize = pe(), r.destroy = u, Object.keys(e).forEach((o) => {
239
+ function pe(e) {
240
+ r.debug = r, r.default = r, r.coerce = c, r.disable = p, r.enable = i, r.enabled = l, r.humanize = ce(), r.destroy = u, Object.keys(e).forEach((o) => {
397
241
  r[o] = e[o];
398
242
  }), r.names = [], r.skips = [], r.formatters = {};
399
243
  function t(o) {
@@ -404,29 +248,29 @@ function de(e) {
404
248
  }
405
249
  r.selectColor = t;
406
250
  function r(o) {
407
- let n, s = null, C, v;
251
+ let n, s = null, f, k;
408
252
  function h(...g) {
409
253
  if (!h.enabled)
410
254
  return;
411
- const y = h, w = Number(/* @__PURE__ */ new Date()), Q = w - (n || w);
412
- y.diff = Q, y.prev = n, y.curr = w, n = w, g[0] = r.coerce(g[0]), typeof g[0] != "string" && g.unshift("%O");
413
- let b = 0;
414
- g[0] = g[0].replace(/%([a-zA-Z%])/g, (D, Y) => {
415
- if (D === "%%")
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] = r.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 === "%%")
416
260
  return "%";
417
- b++;
418
- const U = r.formatters[Y];
261
+ S++;
262
+ const U = r.formatters[Z];
419
263
  if (typeof U == "function") {
420
- const X = g[b];
421
- D = U.call(y, X), g.splice(b, 1), b--;
264
+ const H = g[S];
265
+ M = U.call(C, H), g.splice(S, 1), S--;
422
266
  }
423
- return D;
424
- }), r.formatArgs.call(y, g), (y.log || r.log).apply(y, g);
267
+ return M;
268
+ }), r.formatArgs.call(C, g), (C.log || r.log).apply(C, g);
425
269
  }
426
270
  return h.namespace = o, h.useColors = r.useColors(), h.color = r.selectColor(o), h.extend = a, h.destroy = r.destroy, Object.defineProperty(h, "enabled", {
427
271
  enumerable: !0,
428
272
  configurable: !1,
429
- get: () => s !== null ? s : (C !== r.namespaces && (C = r.namespaces, v = r.enabled(o)), v),
273
+ get: () => s !== null ? s : (f !== r.namespaces && (f = r.namespaces, k = r.enabled(o)), k),
430
274
  set: (g) => {
431
275
  s = g;
432
276
  }
@@ -439,18 +283,18 @@ function de(e) {
439
283
  function i(o) {
440
284
  r.save(o), r.namespaces = o, r.names = [], r.skips = [];
441
285
  let n;
442
- const s = (typeof o == "string" ? o : "").split(/[\s,]+/), C = s.length;
443
- for (n = 0; n < C; n++)
286
+ const s = (typeof o == "string" ? o : "").split(/[\s,]+/), f = s.length;
287
+ for (n = 0; n < f; n++)
444
288
  s[n] && (o = s[n].replace(/\*/g, ".*?"), o[0] === "-" ? r.skips.push(new RegExp("^" + o.slice(1) + "$")) : r.names.push(new RegExp("^" + o + "$")));
445
289
  }
446
- function d() {
290
+ function p() {
447
291
  const o = [
448
- ...r.names.map(l),
449
- ...r.skips.map(l).map((n) => "-" + n)
292
+ ...r.names.map(d),
293
+ ...r.skips.map(d).map((n) => "-" + n)
450
294
  ].join(",");
451
295
  return r.enable(""), o;
452
296
  }
453
- function p(o) {
297
+ function l(o) {
454
298
  if (o[o.length - 1] === "*")
455
299
  return !0;
456
300
  let n, s;
@@ -462,7 +306,7 @@ function de(e) {
462
306
  return !0;
463
307
  return !1;
464
308
  }
465
- function l(o) {
309
+ function d(o) {
466
310
  return o.toString().substring(2, o.toString().length - 2).replace(/\.\*\?$/, "*");
467
311
  }
468
312
  function c(o) {
@@ -473,9 +317,9 @@ function de(e) {
473
317
  }
474
318
  return r.enable(r.load()), r;
475
319
  }
476
- var le = de;
320
+ var le = pe;
477
321
  (function(e, t) {
478
- t.formatArgs = a, t.save = i, t.load = d, t.useColors = r, t.storage = p(), t.destroy = (() => {
322
+ t.formatArgs = a, t.save = i, t.load = p, t.useColors = r, t.storage = l(), t.destroy = (() => {
479
323
  let c = !1;
480
324
  return () => {
481
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`."));
@@ -583,7 +427,7 @@ var le = de;
583
427
  } catch {
584
428
  }
585
429
  }
586
- function d() {
430
+ function p() {
587
431
  let c;
588
432
  try {
589
433
  c = t.storage.getItem("debug");
@@ -591,15 +435,15 @@ var le = de;
591
435
  }
592
436
  return !c && typeof process < "u" && "env" in process && (c = process.env.DEBUG), c;
593
437
  }
594
- function p() {
438
+ function l() {
595
439
  try {
596
440
  return localStorage;
597
441
  } catch {
598
442
  }
599
443
  }
600
444
  e.exports = le(t);
601
- const { formatters: l } = e.exports;
602
- l.j = function(c) {
445
+ const { formatters: d } = e.exports;
446
+ d.j = function(c) {
603
447
  try {
604
448
  return JSON.stringify(c);
605
449
  } catch (u) {
@@ -607,15 +451,15 @@ var le = de;
607
451
  }
608
452
  };
609
453
  })(x, x.exports);
610
- var ue = x.exports;
611
- const ge = /* @__PURE__ */ ce(ue);
612
- function he() {
454
+ var de = x.exports;
455
+ const ue = /* @__PURE__ */ se(de);
456
+ function ge() {
613
457
  try {
614
458
  return ALLIANCE_APP_NAME;
615
459
  } catch {
616
460
  }
617
461
  }
618
- function Ce() {
462
+ function he() {
619
463
  const e = {
620
464
  environment: "production",
621
465
  logging: !1
@@ -626,37 +470,37 @@ function Ce() {
626
470
  return e;
627
471
  }
628
472
  }
629
- function K() {
473
+ function _() {
630
474
  if ($())
631
475
  return Promise.resolve();
632
476
  const e = 2e4, t = 5;
633
477
  return new Promise((r, a) => {
634
478
  const i = () => {
635
- clearInterval(p), clearTimeout(d);
636
- }, d = setTimeout(() => {
479
+ clearInterval(l), clearTimeout(p);
480
+ }, p = setTimeout(() => {
637
481
  i(), a(new Error(`Runtime not initialized after ${e}ms`));
638
- }, e), p = setInterval(() => {
482
+ }, e), l = setInterval(() => {
639
483
  $() && (i(), r());
640
484
  }, t);
641
485
  });
642
486
  }
643
487
  function $() {
644
- return S(
488
+ return N(
645
489
  "RUNTIME_INITIALIZED"
646
490
  /* RuntimeInitialized */
647
491
  );
648
492
  }
649
- function S(e = "") {
650
- return globalThis[ye(e)];
493
+ function N(e = "") {
494
+ return globalThis[fe(e)];
651
495
  }
652
- function ye(e) {
496
+ function fe(e) {
653
497
  return `__ALLIANCE_${e}`;
654
498
  }
655
- function me(e) {
499
+ function ye(e) {
656
500
  return `APP_CONTROLLER_KEY_${e}`;
657
501
  }
658
- var _ = /* @__PURE__ */ ((e) => (e.RuntimeInitialized = "RUNTIME_INITIALIZED", e.RuntimeApps = "RUNTIME_APPS", e.RuntimeManifests = "RUNTIME_MANIFESTS", e))(_ || {});
659
- function fe(e) {
502
+ var W = /* @__PURE__ */ ((e) => (e.RuntimeInitialized = "RUNTIME_INITIALIZED", e.RuntimeApps = "RUNTIME_APPS", e.RuntimeManifests = "RUNTIME_MANIFESTS", e))(W || {});
503
+ function Ce(e) {
660
504
  return {
661
505
  capabilities: "#25BCDD",
662
506
  "managed-objects": "#FC7A12",
@@ -666,46 +510,55 @@ function fe(e) {
666
510
  system: "#D52C2E"
667
511
  }[e];
668
512
  }
669
- const q = /* @__PURE__ */ new Map();
513
+ const B = /* @__PURE__ */ new Map();
670
514
  function m(e) {
671
- let t = q.get(e);
672
- return t || (t = ge(e === "system" ? "[system]" : `[${he()}] ${e}`), t.color = fe(e), t.enabled = ve(), q.set(e, t), t);
515
+ let t = B.get(e);
516
+ return t || (t = ue(e === "system" ? "[system]" : `[${ge()}] ${e}`), t.color = Ce(e), t.enabled = me(), B.set(e, t), t);
673
517
  }
674
- function ve() {
675
- const e = Ce(), t = ee.get("logging");
518
+ function me() {
519
+ const e = he(), t = Y.get("logging");
676
520
  return e.environment === "development" && !!e.logging || t === "true";
677
521
  }
678
- m("system");
679
- m("views");
680
522
  m("controller");
681
- async function we(e) {
682
- await K();
683
- const t = me(e), r = S(t);
523
+ async function ve(e) {
524
+ await _();
525
+ const t = ye(e), r = N(t);
684
526
  if (!r)
685
527
  return;
686
- const a = S(r);
528
+ const a = N(r);
687
529
  if (a)
688
530
  return a;
689
531
  }
690
- async function be() {
691
- return await K(), (await Promise.all(
692
- S(_.RuntimeApps).map((e) => we(e))
532
+ async function we() {
533
+ return await _(), (await Promise.all(
534
+ N(W.RuntimeApps).map((e) => ve(e))
693
535
  )).filter((e) => !!e);
694
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");
695
548
  m("capabilities");
696
- const O = m("managed-objects");
697
- function Ae(e, t) {
698
- return O("querying objects - object: %o, args: %O", e, t), {
549
+ const E = m("managed-objects");
550
+ function G(e, t) {
551
+ return E("querying objects - object: %o, args: %O", e, t), {
699
552
  async resolve() {
700
- return O("resolving query - object: %o, args: %O", e, t), await (await L(e)).managedObjects.providers.get(e)(t);
553
+ return E("resolving query - object: %o, args: %O", e, t), await (await q(e)).managedObjects.providers.get(e)(t);
701
554
  },
702
555
  async watch(r) {
703
- O("adding watcher - object: %o, args: %O", e, t), (await L(e)).managedObjects.watchers.get(e).push(r);
556
+ E("adding watcher - object: %o, args: %O", e, t), (await q(e)).managedObjects.watchers.get(e).push(r);
704
557
  }
705
558
  };
706
559
  }
707
- async function L(e) {
708
- const t = (await be()).find(
560
+ async function q(e) {
561
+ const t = (await we()).find(
709
562
  (r) => r.managedObjects.providers.has(e) && r.managedObjects.watchers.has(e)
710
563
  );
711
564
  if (!t)
@@ -713,81 +566,34 @@ async function L(e) {
713
566
  return t;
714
567
  }
715
568
  m("proxy");
716
- var Ne = Object.defineProperty, ke = (e, t, r) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, E = (e, t, r) => (ke(e, typeof t != "symbol" ? t + "" : t, r), r), G = /* @__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))(G || {}), f = /* @__PURE__ */ ((e) => (e[e.CurrentUserMissingProvider = 2e3] = "CurrentUserMissingProvider", e[e.CurrentUserGatewayNotStarted = 2001] = "CurrentUserGatewayNotStarted", e[e.CurrentUserMissingBackend = 2002] = "CurrentUserMissingBackend", e[e.CurrentUserMissingInDatabase = 2003] = "CurrentUserMissingInDatabase", e))(f || {});
717
- function Se(e, t) {
569
+ var Ne = Object.defineProperty, ke = (e, t, r) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, T = (e, t, r) => (ke(e, typeof t != "symbol" ? t + "" : t, r), r), z = /* @__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))(z || {}), 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, t) {
718
571
  return Object.entries(t).reduce((r, [a, i]) => r.replaceAll(`{{${a}}}`, i), e);
719
572
  }
720
- const De = {
573
+ const Se = {
721
574
  // framework
722
- [
723
- 1e3
724
- /* AlreadyInitialized */
725
- ]: "The runtime has already been initialized",
726
- [
727
- 1001
728
- /* NoAppNameOrKey */
729
- ]: "App name and/or app key is not defined on global scope",
730
- [
731
- 1002
732
- /* MissingAppController */
733
- ]: "No app controller registered for app '{{app}}'",
734
- [
735
- 1003
736
- /* MissingCapabilityOnApp */
737
- ]: "No capability '{{capability}}' enabled for app '{{app}}'",
738
- [
739
- 1004
740
- /* MissingManagedObjectProvider */
741
- ]: "No managed object provider registered for object '{{object}}'",
742
- [
743
- 1005
744
- /* NoManifest */
745
- ]: "The current apps manifest is not defined on global scope",
746
- [
747
- 1006
748
- /* NoRootElement */
749
- ]: "Could not find the root element in the DOM",
750
- [
751
- 1007
752
- /* NoView */
753
- ]: "Could not find view with id '{{id}}' on view controller for app '{{app}}'",
754
- [
755
- 1008
756
- /* CookieKeyNotDefined */
757
- ]: "Cookie key '{{key}}' not present in manifest, cookie has not been set",
758
- [
759
- 1009
760
- /* CookieCategoryNotAllowed */
761
- ]: "Cookies categorized as '{{category}}' are not allowed by the user, cookie '{{key}}' has not been set",
762
- [
763
- 1010
764
- /* StorageKeyNotDefined */
765
- ]: "Storage key '{{key}}' not present in manifest, item has not been stored",
766
- [
767
- 1011
768
- /* StorageCategoryNotAllowed */
769
- ]: "Storage categorized as '{{category}}' is not allowed by the user, item '{{key}}' has not been stored",
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.",
770
588
  // utilities
771
- [
772
- 2e3
773
- /* CurrentUserMissingProvider */
774
- ]: "No managed object provider registered for object 'currentUser'",
775
- [
776
- 2001
777
- /* CurrentUserGatewayNotStarted */
778
- ]: "Could not access the gateway when querying 'currentUser'",
779
- [
780
- 2002
781
- /* CurrentUserMissingBackend */
782
- ]: "Could not access the required backend when querying 'currentUser'",
783
- [
784
- 2003
785
- /* CurrentUserMissingInDatabase */
786
- ]: "Could not locate the authenticated user in the Alliance database"
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"
787
593
  }, V = "AllianceError";
788
- class N extends Error {
594
+ class A extends Error {
789
595
  constructor(t, r = {}) {
790
- const a = Se(De[t], r), i = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${t}`;
596
+ const a = De(Se[t], r), i = `https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${t}`;
791
597
  super(a), this.code = t, this.name = V, this.stack = `[${t}] - ${a}
792
598
  ` + i;
793
599
  }
@@ -795,185 +601,97 @@ class N extends Error {
795
601
  function Fe(e) {
796
602
  return !!e.code && e.name === V;
797
603
  }
798
- var Z = /* @__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))(Z || {});
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 || {});
799
605
  const Me = {
800
- [
801
- 15
802
- /* Done */
803
- ]: "Done",
804
- [
805
- 22
806
- /* NoWorkspaceName */
807
- ]: "No workspace name provided!",
808
- [
809
- 19
810
- /* NoAppName */
811
- ]: "No app name provided!",
812
- [
813
- 0
814
- /* AlreadyExists */
815
- ]: "File or directory '{0}' already exists!",
816
- [
817
- 21
818
- /* NoAppOrWorkspaceInCurrentDirectory */
819
- ]: "Could not find any app entry file at '{0}'!",
820
- [
821
- 33
822
- /* UnrecognizedCommand */
823
- ]: "Unrecognized command(s) {0}!",
824
- [
825
- 34
826
- /* WorkspaceCreated */
827
- ]: "Workspace was created at path '{0}'!",
828
- [
829
- 4
830
- /* AppCreated */
831
- ]: "App was created at path '{0}'!",
832
- [
833
- 25
834
- /* ServedStopped */
835
- ]: "Server stopped.",
836
- [
837
- 11
838
- /* CreateWorkspaceDescription */
839
- ]: "Creates an Alliance Workspace in the current directory.",
840
- [
841
- 10
842
- /* CreateAppDescription */
843
- ]: "Creates an Alliance Application in the current directory or Alliance Workspace.",
844
- [
845
- 24
846
- /* ServeDescription */
847
- ]: "Starts a Alliance development server using the current directory package.json.",
848
- [
849
- 7
850
- /* BuildDescription */
851
- ]: "Builds an Alliance Application using Vite.",
852
- [
853
- 35
854
- /* WorkspaceNameInquiry */
855
- ]: "Enter the name of your workspace",
856
- [
857
- 28
858
- /* ServerModeInquiry */
859
- ]: "Which server mode do you want to use?",
860
- [
861
- 6
862
- /* AppNameInquiry */
863
- ]: "Enter the name of your app",
864
- [
865
- 18
866
- /* MissingTranslationKey */
867
- ]: "No translation key provided!",
868
- [
869
- 23
870
- /* OperationCancelled */
871
- ]: "Operation cancelled.",
872
- [
873
- 30
874
- /* StopServerInstructions */
875
- ]: `Press CTRL + C to stop the server.
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.
876
625
  `,
877
- [
878
- 32
879
- /* TemplateLanguageInquiry */
880
- ]: "Select preferred language",
881
- [
882
- 31
883
- /* TemplateFrameworkInquiry */
884
- ]: "Select preferred framework template",
885
- [
886
- 13
887
- /* DevServerPortDescription */
888
- ]: "The port that the dev server should use.",
889
- [
890
- 14
891
- /* DevServerLoggingDescription */
892
- ]: "Whether the dev server and browser console should output more log information or not (false).",
893
- [
894
- 1
895
- /* ApiGatewayPortDescription */
896
- ]: "The port that the api gateway should use.",
897
- [
898
- 2
899
- /* ApiServerModeDescription */
900
- ]: "Which components to start. [server|server-proxy|server-gateway].",
901
- [
902
- 12
903
- /* DevServerOpenDescription */
904
- ]: "Whether the dev server should automatically open in your browser or not.",
905
- [
906
- 9
907
- /* BuildWatchDescription */
908
- ]: "Whether the build should start watching and rebuild when files change or not.",
909
- [
910
- 5
911
- /* AppEntryBuildOptionDescription */
912
- ]: "The entry file for the app (./src/app).",
913
- [
914
- 17
915
- /* ManifestEntryBuildOptionDescription */
916
- ]: "The entry file for the app manifest (./src/manifest).",
917
- [
918
- 8
919
- /* BuildModeOptionDescription */
920
- ]: "Which mode to use when building the app.",
921
- [
922
- 16
923
- /* FetchPackageVersionError */
924
- ]: "Failed to fetch package info from the NPM registry for package '${0}'!",
925
- [
926
- 20
927
- /* NoAppNameFound */
928
- ]: "Could not find app name in manifest.",
929
- [
930
- 3
931
- /* AppConfigurationPath */
932
- ]: "The path to the app configuration file.",
933
- [
934
- 27
935
- /* ServerMode */
936
- ]: "Server",
937
- [
938
- 29
939
- /* ServerProxyMode */
940
- ]: "Server with proxy",
941
- [
942
- 26
943
- /* ServerGatewayMode */
944
- ]: "Server with gateway"
945
- }, W = class {
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 {
946
644
  };
947
- let T = W;
948
- E(T, "getTranslations", () => Me), E(T, "getTranslation", (e, ...t) => {
949
- const r = W.getTranslations()[e];
645
+ T(w, "getTranslations", () => Me), T(w, "getTranslation", (e, ...t) => {
646
+ const r = w.getTranslations()[e];
950
647
  if (!r)
951
648
  throw new Error(`Could not find text with given key '${e}'.`);
952
649
  return t.reduce(
953
- (a, i, d) => a.toString().replace(`{${d}}`, i.toString()),
650
+ (a, i, p) => a.toString().replace(`{${p}}`, i.toString()),
954
651
  r
955
652
  ).toString();
956
- }), E(T, "get", (e = Z.MissingTranslationKey, ...t) => W.getTranslation(e, ...t));
957
- let k;
958
- async function J() {
653
+ }), T(w, "get", (e = Q.MissingTranslationKey, ...t) => w.getTranslation(e, ...t));
654
+ let y;
655
+ async function Pe() {
959
656
  try {
960
- return k || (k = await Ae("currentUser").resolve(), k);
657
+ return y || (y = await G("currentUser").resolve()), {
658
+ ...y,
659
+ hasPermission(e, t) {
660
+ return !!(y != null && y.permissions.find(
661
+ ({ permission: r }) => r.app.name === e && r.name === t
662
+ ));
663
+ },
664
+ isSystemAdmin() {
665
+ return !!y && y.type === "system-admin";
666
+ }
667
+ };
961
668
  } catch (e) {
962
- throw Fe(e) && e.code === G.MissingManagedObjectProvider ? new N(f.CurrentUserMissingProvider) : e.message.includes("GraphQL Error (Code: 404)") ? new N(f.CurrentUserGatewayNotStarted) : e.message.includes("GraphQL Error (Code: 500)") ? new N(f.CurrentUserMissingBackend) : e.message.includes("GraphQL Error (Code: 200)") && e.message.includes("Cannot return null for non-nullable field") ? new N(f.CurrentUserMissingInDatabase) : e;
669
+ throw Fe(e) && e.code === z.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;
963
670
  }
964
671
  }
965
- async function Ie() {
966
- const e = await J();
967
- return !!e && e.type === "super-admin";
672
+ function Ie(e) {
673
+ var a;
674
+ return !e || !((a = e.resources) != null && a.localization) ? {} : Object.keys(e.resources.localization).reduce((i, p) => (i[p] = e.resources.localization[p].value, i), {});
968
675
  }
969
- async function Oe(e, t) {
970
- const r = await J();
971
- return !!(r != null && r.permissions.find(
972
- ({ permission: a }) => a.app.name === e && a.name === t
973
- ));
676
+ function Oe(e = "", t) {
677
+ return Object.entries(t).reduce((r, [a, i]) => r.replaceAll(`{{${a}}}`, i), e);
678
+ }
679
+ async function Ee() {
680
+ const e = Ae(), t = be(), r = Ie(e);
681
+ let a = {};
682
+ return t != null && t.find(({ name: i }) => i === "resource-management") && (a = await G("resourceTexts", { app: e == null ? void 0 : e.name }).resolve()), Object.keys(r).reduce((i, p) => (a[p] && (i[p] = a[p]), i), r);
683
+ }
684
+ let j = {};
685
+ async function xe() {
686
+ return Object.keys(j).length === 0 && (j = await Ee()), (e, t) => {
687
+ const r = j[e];
688
+ if (r === void 0)
689
+ throw new A(z.LocalizationTemplateNotDefined, { key: e });
690
+ return !t || typeof t != "object" || Object.keys(t).length === 0 ? r : Oe(r, t);
691
+ };
974
692
  }
975
693
  export {
976
- Oe as hasPermission,
977
- Ie as isSystemAdmin
694
+ Pe as getCurrentUser,
695
+ xe as getTranslator
978
696
  };
979
697
  //# sourceMappingURL=index.js.map