@qlik/api 1.32.0 → 1.33.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.
Files changed (142) hide show
  1. package/api-keys.d.ts +10 -10
  2. package/api-keys.js +64 -50
  3. package/apps.d.ts +56 -56
  4. package/apps.js +392 -304
  5. package/assistants.d.ts +34 -34
  6. package/assistants.js +257 -201
  7. package/audits.d.ts +10 -10
  8. package/audits.js +48 -36
  9. package/{auth-types-DqfMuSRX.d.ts → auth-types-Cj5bM3Yk.d.ts} +29 -9
  10. package/auth.d.ts +17 -4
  11. package/auth.js +4 -2
  12. package/automation-connections.d.ts +12 -12
  13. package/automation-connections.js +75 -59
  14. package/automations.d.ts +27 -27
  15. package/automations.js +159 -123
  16. package/automl-deployments.d.ts +4 -4
  17. package/automl-deployments.js +14 -12
  18. package/automl-predictions.d.ts +13 -13
  19. package/automl-predictions.js +56 -44
  20. package/brands.d.ts +18 -18
  21. package/brands.js +107 -83
  22. package/chunks/{YTT2FEVE.js → 33GQY7N7.js} +1 -1
  23. package/chunks/{M64RLKVG.js → 62DXIH3S.js} +7 -5
  24. package/chunks/7MMXU6EL.js +86 -0
  25. package/chunks/{LTNGXTXG.js → GPRUNZV4.js} +3 -3
  26. package/chunks/{VVD2DPKQ.js → LIEZG7IM.js} +3 -3
  27. package/chunks/{FKDGGR2O.js → OTIO4SEJ.js} +698 -708
  28. package/chunks/{UZTIZ4H5.js → RP3EJGHG.js} +74 -74
  29. package/chunks/{RCLKKVYB.js → SPATCXXU.js} +9 -2
  30. package/chunks/{LY7RP2HA.js → XF3TPZKZ.js} +23 -8
  31. package/chunks/{6ZONDHRN.js → YYZCS5PW.js} +11 -4
  32. package/chunks/{3RGGGGAR.js → ZCTVPXGO.js} +1 -1
  33. package/collections.d.ts +16 -15
  34. package/collections.js +98 -76
  35. package/conditions.d.ts +13 -13
  36. package/conditions.js +97 -75
  37. package/consumption.d.ts +4 -4
  38. package/consumption.js +11 -9
  39. package/csp-origins.d.ts +9 -9
  40. package/csp-origins.js +53 -41
  41. package/csrf-token.d.ts +3 -3
  42. package/csrf-token.js +10 -8
  43. package/data-alerts.d.ts +22 -22
  44. package/data-alerts.js +139 -107
  45. package/data-assets.d.ts +8 -8
  46. package/data-assets.js +50 -40
  47. package/data-connections.d.ts +16 -16
  48. package/data-connections.js +87 -69
  49. package/data-credentials.d.ts +11 -11
  50. package/data-credentials.js +52 -42
  51. package/data-files.d.ts +18 -18
  52. package/data-files.js +107 -83
  53. package/data-qualities.d.ts +6 -6
  54. package/data-qualities.js +28 -22
  55. package/data-sets.d.ts +10 -10
  56. package/data-sets.js +59 -47
  57. package/data-sources.d.ts +7 -7
  58. package/data-sources.js +28 -22
  59. package/data-stores.d.ts +16 -16
  60. package/data-stores.js +92 -72
  61. package/dcaas.d.ts +6 -6
  62. package/dcaas.js +28 -22
  63. package/di-projects.d.ts +22 -22
  64. package/di-projects.js +148 -116
  65. package/direct-access-agents.d.ts +328 -0
  66. package/direct-access-agents.js +108 -0
  67. package/encryption.d.ts +12 -12
  68. package/encryption.js +82 -62
  69. package/extensions.d.ts +11 -11
  70. package/extensions.js +61 -47
  71. package/glossaries.d.ts +33 -33
  72. package/glossaries.js +221 -173
  73. package/groups.d.ts +12 -12
  74. package/groups.js +72 -56
  75. package/identity-providers.d.ts +11 -11
  76. package/identity-providers.js +67 -51
  77. package/index.d.ts +9 -4
  78. package/index.js +101 -67
  79. package/interceptors.d.ts +9 -2
  80. package/interceptors.js +2 -2
  81. package/invoke-fetch-types-BYCD4pc9.d.ts +98 -0
  82. package/items.d.ts +14 -13
  83. package/items.js +71 -55
  84. package/knowledgebases.d.ts +23 -23
  85. package/knowledgebases.js +153 -119
  86. package/licenses.d.ts +13 -13
  87. package/licenses.js +76 -58
  88. package/lineage-graphs.d.ts +17 -17
  89. package/lineage-graphs.js +76 -60
  90. package/ml.d.ts +100 -52
  91. package/ml.js +379 -286
  92. package/notes.d.ts +4 -4
  93. package/notes.js +19 -15
  94. package/notifications.d.ts +4 -4
  95. package/notifications.js +11 -9
  96. package/oauth-clients.d.ts +14 -14
  97. package/oauth-clients.js +96 -74
  98. package/oauth-tokens.d.ts +5 -5
  99. package/oauth-tokens.js +19 -15
  100. package/package.json +8 -6
  101. package/qix.d.ts +145 -4
  102. package/qix.js +2 -2
  103. package/questions.d.ts +5 -5
  104. package/questions.js +22 -18
  105. package/quotas.d.ts +6 -6
  106. package/quotas.js +20 -16
  107. package/reload-tasks.d.ts +8 -8
  108. package/reload-tasks.js +46 -36
  109. package/reloads.d.ts +7 -7
  110. package/reloads.js +36 -28
  111. package/report-templates.d.ts +10 -10
  112. package/report-templates.js +64 -50
  113. package/reports.d.ts +4 -4
  114. package/reports.js +20 -16
  115. package/roles.d.ts +8 -8
  116. package/roles.js +46 -36
  117. package/sharing-tasks.d.ts +14 -14
  118. package/sharing-tasks.js +89 -69
  119. package/spaces.d.ts +22 -22
  120. package/spaces.js +153 -119
  121. package/tasks.d.ts +17 -17
  122. package/tasks.js +90 -70
  123. package/temp-contents.d.ts +7 -7
  124. package/temp-contents.js +30 -24
  125. package/tenants.d.ts +8 -8
  126. package/tenants.js +57 -45
  127. package/themes.d.ts +11 -11
  128. package/themes.js +61 -47
  129. package/transports.d.ts +8 -8
  130. package/transports.js +49 -37
  131. package/ui-config.d.ts +9 -9
  132. package/ui-config.js +61 -47
  133. package/users.d.ts +15 -15
  134. package/users.js +81 -63
  135. package/web-integrations.d.ts +8 -8
  136. package/web-integrations.js +46 -36
  137. package/web-notifications.d.ts +9 -9
  138. package/web-notifications.js +53 -41
  139. package/webhooks.d.ts +14 -14
  140. package/webhooks.js +88 -68
  141. package/chunks/2ZQ3ZX7F.js +0 -33
  142. package/invoke-fetch-types-Cq7bjkqn.d.ts +0 -243
@@ -1,49 +1,55 @@
1
1
  import {
2
2
  getInterceptors
3
- } from "./3RGGGGAR.js";
3
+ } from "./ZCTVPXGO.js";
4
4
  import {
5
+ cleanFalsyValues,
5
6
  isBrowser,
6
- isNode
7
- } from "./2ZQ3ZX7F.js";
7
+ isNode,
8
+ sortKeys
9
+ } from "./7MMXU6EL.js";
8
10
 
9
- // src/auth/internal/host-config-registry.ts
10
- var registeredHostConfigs = {};
11
- function registerHostConfigInternal(name, hostConfig) {
12
- if (hostConfig?.reference) {
13
- throw new InvalidHostConfigError("Cannot register a host config with a reference");
14
- }
15
- if (registeredHostConfigs[name]) {
16
- console.warn(`registerHostConfig: Host config with name "${name}" is already registered. Overwriting.`);
17
- }
18
- registeredHostConfigs[name] = hostConfig;
19
- }
20
- function unregisterHostConfigInternal(name) {
21
- if (registeredHostConfigs[name]) {
22
- delete registeredHostConfigs[name];
23
- } else {
24
- console.warn(`unregisterHostConfig: Host config with name "${name}" not found.`);
11
+ // src/invoke-fetch/invoke-fetch-errors.ts
12
+ var InvokeFetchError = class extends Error {
13
+ status;
14
+ headers;
15
+ data;
16
+ constructor(errorMessage, status, headers, data) {
17
+ super(errorMessage);
18
+ this.status = status;
19
+ this.headers = headers;
20
+ this.data = data;
21
+ this.stack = cleanStack(this.stack);
25
22
  }
26
- }
27
- function getRegisteredHostConfigInternal(name) {
28
- if (!registeredHostConfigs[name]) {
29
- throw new Error(`Host config with name "${name}" not found.`);
23
+ };
24
+ var EncodingError = class extends Error {
25
+ contentType;
26
+ data;
27
+ constructor(errorMessage, contentType, data) {
28
+ super(errorMessage);
29
+ this.contentType = contentType;
30
+ this.data = data;
31
+ this.stack = cleanStack(this.stack);
30
32
  }
31
- return registeredHostConfigs[name];
32
- }
33
-
34
- // src/auth/internal/default-host-config.ts
35
- var defaultHostConfig = {};
36
- function setDefaultHostConfigInternal(hostConfig) {
37
- defaultHostConfig = hostConfig || {};
38
- }
39
- function withResolvedHostConfig(hostConfig) {
40
- if (hostConfig?.reference) {
41
- return getRegisteredHostConfigInternal(hostConfig.reference);
33
+ };
34
+ var regex = /^.+\/qmfe-api(?:\.js)?:(\d+)(?::\d+)?$/gim;
35
+ var isFromQmfeApi = (line) => {
36
+ const matches = line.match(regex);
37
+ return Boolean(matches && matches.length > 0);
38
+ };
39
+ function cleanStack(stack) {
40
+ if (!stack) {
41
+ return stack;
42
42
  }
43
- if (hostConfig && Object.keys(hostConfig).length > 0) {
44
- return hostConfig;
43
+ const newStack = [];
44
+ const lines = stack.split("\n");
45
+ lines.reverse();
46
+ for (const line of lines) {
47
+ if (isFromQmfeApi(line)) {
48
+ break;
49
+ }
50
+ newStack.unshift(line);
45
51
  }
46
- return defaultHostConfig;
52
+ return newStack.join("\n");
47
53
  }
48
54
 
49
55
  // src/platform/platform-functions.ts
@@ -151,414 +157,82 @@ var result = (data) => ({
151
157
  ...data
152
158
  });
153
159
 
154
- // src/auth/internal/auth-module-registry.ts
155
- var authModules = {};
156
- var ongoingAuthModuleLoading = Promise.resolve();
157
- function registerAuthModule(name, authModule) {
158
- authModules[name.toLowerCase()] = authModule;
159
- }
160
- function getRegisteredAuthModules() {
161
- return Object.keys(authModules);
162
- }
163
- function getRegisteredAuthModule(authType) {
164
- return authModules[authType.toLowerCase()];
160
+ // src/auth/auth-types.ts
161
+ var hostConfigCommonProperties = [
162
+ "authType",
163
+ "autoRedirect",
164
+ "authRedirectUserConfirmation",
165
+ "embedRuntimeUrl",
166
+ "host",
167
+ "onAuthFailed"
168
+ ];
169
+ var authTypesThatCanBeOmitted = [
170
+ "apikey",
171
+ "oauth2",
172
+ "cookie",
173
+ "windowscookie",
174
+ "reference",
175
+ "anonymous"
176
+ ];
177
+
178
+ // src/utils/random.ts
179
+ import { customAlphabet, nanoid } from "nanoid";
180
+ function generateRandomString(targetLength) {
181
+ return nanoid(targetLength);
165
182
  }
166
- async function getAuthModule(hostConfig) {
167
- const hostConfigToUse = withResolvedHostConfig(hostConfig);
168
- const authType = await determineAuthType(hostConfigToUse);
169
- if (ongoingAuthModuleLoading) {
170
- await ongoingAuthModuleLoading;
171
- }
172
- let authModule = getRegisteredAuthModule(authType);
173
- if (!authModule) {
174
- ongoingAuthModuleLoading = (async () => {
175
- authModule = await resolveGloballyDefinedAuthModule(authType);
176
- if (authModule) {
177
- registerAuthModule(authType, authModule);
178
- }
179
- })();
180
- await ongoingAuthModuleLoading;
181
- }
182
- if (!authModule) {
183
- throw new InvalidAuthTypeError(authType);
184
- }
185
- if (authModule.validateHostConfig) {
186
- authModule.validateHostConfig({ authType, ...hostConfigToUse });
187
- }
188
- return authModule;
183
+ function generateRandomHexString(targetLength) {
184
+ return customAlphabet("1234567890abcdef", targetLength)();
189
185
  }
190
- async function resolveGloballyDefinedAuthModule(authType) {
191
- const globalWindow = globalThis;
192
- const globalVariable = globalWindow[authType];
193
- if (globalVariable) {
194
- let potentialAuthModule;
195
- if (typeof globalVariable === "function") {
196
- potentialAuthModule = await globalVariable();
197
- } else {
198
- potentialAuthModule = globalVariable;
199
- }
200
- if (potentialAuthModule && potentialAuthModule.getRestCallAuthParams && potentialAuthModule.getWebSocketAuthParams && potentialAuthModule.handleAuthenticationError) {
201
- return potentialAuthModule;
186
+
187
+ // src/utils/expose-internal-test-apis.ts
188
+ var internalApisName = "__QLIK_INTERNAL__DO_NOT_USE_OR_YOU_WILL_BE_FIRED";
189
+ function exposeInternalApiOnWindow(name, fn) {
190
+ if (globalThis.location?.origin.startsWith("https://localhost:") || globalThis.location?.origin?.endsWith("qlik-stage.com")) {
191
+ if (globalThis[internalApisName] === void 0) {
192
+ globalThis[internalApisName] = {};
202
193
  }
203
- console.error("Not a valid auth module", potentialAuthModule);
204
- throw new InvalidAuthTypeError(authType);
194
+ globalThis[internalApisName][name] = fn;
205
195
  }
206
- return Promise.resolve(void 0);
207
196
  }
208
197
 
209
- // src/auth/auth-errors.ts
210
- var InvalidHostConfigError = class extends Error {
211
- constructor(message) {
212
- super(`Invalid host config: ${message}`);
213
- this.name = "InvalidHostConfigError";
214
- }
215
- };
216
- var UnexpectedAuthTypeError = class extends Error {
217
- constructor(...expectedAuthTypes) {
218
- const ors = expectedAuthTypes.map((item, index) => index === 0 ? `"${item}"` : `or "${item}"`).join(" ");
219
- super(`HostConfig is not properly configured. authType is expected to be ${ors}`);
220
- this.name = "UnexpectedAuthTypeError";
221
- }
222
- };
223
- var InvalidAuthTypeError = class extends Error {
224
- constructor(authType) {
225
- const validAuthModules = getRegisteredAuthModules();
226
- super(
227
- `Not a valid auth type: ${authType}, valid auth types are; '${validAuthModules.filter((name) => name.toLowerCase() !== "qmfeembedframerauthmodule").join("', '")}'`
228
- );
229
- this.name = "InvalidAuthTypeError";
198
+ // src/auth/internal/default-auth-modules/oauth/storage-helpers.ts
199
+ var storagePrefix = "qlik-qmfe-api";
200
+ function getTopicFromOauthHostConfig(hostConfig) {
201
+ let topic = hostConfig.clientId + (hostConfig.scope ? `_${hostConfig.scope}` : "_user_default");
202
+ if (hostConfig.subject) {
203
+ topic += `_${hostConfig.subject}`;
230
204
  }
231
- };
232
- function errorToString({ title, detail, code, status }) {
233
- if (detail) {
234
- return `${title} - ${detail} (Status: ${status}, Code: ${code})`;
205
+ if (hostConfig.userId) {
206
+ topic += `_${hostConfig.userId}`;
235
207
  }
236
- return `${title} (Status: ${status}, Code: ${code})`;
208
+ return topic;
237
209
  }
238
- var AuthorizationError = class extends Error {
239
- errors;
240
- constructor(errors) {
241
- if (typeof errors !== "object") {
242
- super("Unknown error");
243
- return;
244
- }
245
- const errorArray = Array.isArray(errors) ? errors : [errors];
246
- super(errorArray.map(errorToString).join(", "));
247
- this.errors = errorArray;
248
- }
249
- };
250
-
251
- // src/auth/auth-functions.ts
252
- var lastErrorMessage = "";
253
- function logToConsole({ message }) {
254
- if (message !== lastErrorMessage) {
255
- lastErrorMessage = message;
256
- console.error(message);
257
- }
210
+ function getTopicFromAnonHostConfig(hostConfig) {
211
+ return `${hostConfig.accessCode}_${hostConfig.clientId}`;
258
212
  }
259
- function isHostCrossOrigin(hostConfig) {
260
- if (!globalThis.location?.origin) {
261
- return true;
262
- }
263
- const hostConfigToUse = withResolvedHostConfig(hostConfig);
264
- if (Object.keys(hostConfigToUse).length === 0) {
265
- return false;
266
- }
267
- try {
268
- const locationUrl = new URL(toValidLocationUrl(hostConfigToUse));
269
- return locationUrl.origin !== globalThis.location.origin;
270
- } catch {
213
+ var cachedTokens = {};
214
+ function clearAllCachedTokens() {
215
+ for (const key in cachedTokens) {
216
+ delete cachedTokens[key];
271
217
  }
272
- return false;
273
218
  }
274
- async function isWindows(hostConfig) {
275
- const hostConfigToUse = withResolvedHostConfig(hostConfig);
276
- if (typeof hostConfigToUse.forceIsWindows === "boolean") {
277
- return hostConfigToUse.forceIsWindows;
278
- }
279
- if (hostConfigToUse.authType === "cookie") {
280
- return false;
281
- }
282
- if (hostConfigToUse.authType === "windowscookie") {
283
- return true;
284
- }
285
- return (await getPlatform({ hostConfig })).isWindows;
219
+ exposeInternalApiOnWindow("clearAllAccessTokens", () => {
220
+ console.log("Clearing tokens", cachedTokens);
221
+ Object.keys(cachedTokens).forEach((key) => {
222
+ console.log("Clearing access tokens for", key);
223
+ deleteFromLocalStorage(key, ["access-token", "refresh-token"]);
224
+ deleteFromSessionStorage(key, ["access-token", "refresh-token"]);
225
+ });
226
+ clearAllCachedTokens();
227
+ });
228
+ function saveInLocalStorage(topic, name, value) {
229
+ localStorage.setItem(`${storagePrefix}-${topic}-${name}`, value);
286
230
  }
287
- function toValidLocationUrl(hostConfig) {
288
- const url = withResolvedHostConfig(hostConfig)?.host;
289
- let locationUrl;
290
- if (!url) {
291
- locationUrl = "";
292
- } else if (url.toLowerCase().startsWith("https://") || url.toLowerCase().startsWith("http://")) {
293
- locationUrl = url;
294
- } else {
295
- locationUrl = `https://${url}`;
296
- }
297
- while (locationUrl[locationUrl.length - 1] === "/") {
298
- locationUrl = locationUrl.substring(0, locationUrl.length - 1);
299
- }
300
- return locationUrl;
231
+ function saveInSessionStorage(topic, name, value) {
232
+ sessionStorage.setItem(`${storagePrefix}-${topic}-${name}`, value);
301
233
  }
302
- function toValidWebsocketLocationUrl(hostConfig) {
303
- const url = withResolvedHostConfig(hostConfig)?.host;
304
- let locationUrl;
305
- if (!url) {
306
- locationUrl = globalThis.location.origin;
307
- } else if (url.toLowerCase().startsWith("https://") || url.toLowerCase().startsWith("http://")) {
308
- locationUrl = url;
309
- } else {
310
- locationUrl = `https://${url}`;
311
- }
312
- while (locationUrl[locationUrl.length - 1] === "/") {
313
- locationUrl = locationUrl.substring(0, locationUrl.length - 1);
314
- }
315
- return locationUrl.replace(leadingHttp, "ws");
316
- }
317
- async function getWebSocketAuthParams(props) {
318
- const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
319
- try {
320
- const authModule = await getAuthModule(hostConfigToUse);
321
- return await authModule.getWebSocketAuthParams({
322
- ...props,
323
- hostConfig: hostConfigToUse
324
- });
325
- } catch (err) {
326
- (hostConfigToUse.onAuthFailed || logToConsole)(normalizeAuthModuleError(err));
327
- throw err;
328
- }
329
- }
330
- async function getWebResourceAuthParams(props) {
331
- const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
332
- try {
333
- const authModule = await getAuthModule(hostConfigToUse);
334
- return await authModule.getWebResourceAuthParams?.({
335
- ...props,
336
- hostConfig: hostConfigToUse
337
- }) || { queryParams: {} };
338
- } catch (err) {
339
- (hostConfigToUse.onAuthFailed || logToConsole)(normalizeAuthModuleError(err));
340
- throw err;
341
- }
342
- }
343
- async function handleAuthenticationError(props) {
344
- const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
345
- const authModule = await getAuthModule(hostConfigToUse);
346
- const result2 = await authModule.handleAuthenticationError({
347
- ...props,
348
- hostConfig: hostConfigToUse
349
- });
350
- const willRetry = props.canRetry && result2.retry;
351
- const willHangUntilANewPageIsLoaded = result2.preventDefault;
352
- if (!willRetry && !willHangUntilANewPageIsLoaded) {
353
- const { status, errorBody } = props;
354
- (hostConfigToUse.onAuthFailed || logToConsole)(normalizeInbandAuthError({ status, errorBody }));
355
- }
356
- return result2;
357
- }
358
- async function getRestCallAuthParams(props) {
359
- const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
360
- try {
361
- const authModule = await getAuthModule(hostConfigToUse);
362
- return await authModule.getRestCallAuthParams({
363
- ...props,
364
- hostConfig: hostConfigToUse
365
- });
366
- } catch (err) {
367
- (hostConfigToUse.onAuthFailed || logToConsole)(normalizeAuthModuleError(err));
368
- throw err;
369
- }
370
- }
371
- async function getAccessToken(props) {
372
- const res = await getRestCallAuthParams({ method: "GET", ...props });
373
- const authorizationHeader = res.headers?.Authorization;
374
- if (authorizationHeader.indexOf("Bearer ") === 0) {
375
- return authorizationHeader.substring(7);
376
- }
377
- throw new Error("Unknown format of authorization header returned by remote auth module");
378
- }
379
- function registerAuthModule2(name, authModule) {
380
- registerAuthModule(name, authModule);
381
- }
382
- function setDefaultHostConfig(hostConfig) {
383
- setDefaultHostConfigInternal(hostConfig);
384
- }
385
- function registerHostConfig(name, hostConfig) {
386
- registerHostConfigInternal(name, hostConfig);
387
- }
388
- function unregisterHostConfig(name) {
389
- unregisterHostConfigInternal(name);
390
- }
391
- function serializeHostConfig(hostConfig) {
392
- const hostConfigToUse = withResolvedHostConfig(hostConfig);
393
- return JSON.stringify(hostConfigToUse, hostConfigPropertyIgnorer);
394
- }
395
- async function determineAuthType(hostConfig) {
396
- if (hostConfig.authType) {
397
- return hostConfig.authType;
398
- }
399
- if (hostConfig.apiKey) {
400
- return "apikey";
401
- }
402
- if (hostConfig.accessCode) {
403
- return "anonymous";
404
- }
405
- if (hostConfig.clientId) {
406
- return "oauth2";
407
- }
408
- if (hostConfig.webIntegrationId) {
409
- return "cookie";
410
- }
411
- if (hostConfig.reference) {
412
- return "reference";
413
- }
414
- if (await isWindows(hostConfig)) {
415
- return "windowscookie";
416
- }
417
- return "cookie";
418
- }
419
- function checkForCrossDomainRequest(hostConfig) {
420
- const hostConfigToUse = withResolvedHostConfig(hostConfig);
421
- if (isHostCrossOrigin(hostConfigToUse)) {
422
- if (Object.keys(hostConfigToUse).length === 0) {
423
- throw new InvalidHostConfigError("a host config must be provided when making a cross domain request");
424
- }
425
- if (!hostConfigToUse.host) {
426
- throw new InvalidHostConfigError("A 'host' must be set in host config when making a cross domain request");
427
- }
428
- }
429
- }
430
- var logout = () => {
431
- globalThis.loggingOut = true;
432
- globalThis.location.href = "/logout";
433
- };
434
- var leadingHttp = /^http/;
435
- function normalizeInbandAuthError({ errorBody, status }) {
436
- const authError = errorBody;
437
- if (typeof authError?.errors === "object") {
438
- const err = new AuthorizationError(authError?.errors);
439
- return { message: err.message };
440
- }
441
- return { message: `HTTP ${status}` };
442
- }
443
- function normalizeAuthModuleError(err) {
444
- return { message: err.message || "Unknown error" };
445
- }
446
- function hostConfigPropertyIgnorer(key, value) {
447
- if (key === "") {
448
- return value;
449
- }
450
- if (key === "authType") {
451
- return void 0;
452
- }
453
- const vtype = typeof value;
454
- if (vtype === "object" || vtype === "function") {
455
- return void 0;
456
- }
457
- return value;
458
- }
459
-
460
- // src/random/random.ts
461
- import { customAlphabet, nanoid } from "nanoid";
462
- function generateRandomString(targetLength) {
463
- return nanoid(targetLength);
464
- }
465
- function generateRandomHexString(targetLength) {
466
- return customAlphabet("1234567890abcdef", targetLength)();
467
- }
468
-
469
- // src/auth/internal/auth-functions.ts
470
- function getCredentialsForCookieAuth(hostConfig) {
471
- if (hostConfig.crossSiteCookies === false) {
472
- return "same-origin";
473
- }
474
- if (isHostCrossOrigin(hostConfig)) {
475
- return "include";
476
- }
477
- return "same-origin";
478
- }
479
- function internalValidateHostConfig(hostConfig, options) {
480
- const missingRequiredProps = [];
481
- for (const requiredProp of options.requiredProps) {
482
- if (!hostConfig[requiredProp]) {
483
- missingRequiredProps.push(requiredProp);
484
- }
485
- }
486
- if (missingRequiredProps.length > 0) {
487
- throw new InvalidHostConfigError(
488
- `missing required properties in host config; '${missingRequiredProps.join("', '")}'`
489
- );
490
- }
491
- const validProps = [
492
- "authType",
493
- "autoRedirect",
494
- "authRedirectUserConfirmation",
495
- "embedRuntimeUrl",
496
- "host",
497
- "onAuthFailed",
498
- ...options.requiredProps,
499
- ...options.optionalProps
500
- ];
501
- const invalidKeys = [];
502
- Object.keys(hostConfig).forEach((key) => {
503
- if (!validProps.some((k) => k === key)) {
504
- invalidKeys.push(key);
505
- }
506
- });
507
- if (invalidKeys.length > 0) {
508
- throw new InvalidHostConfigError(`unknown properties in host config; '${invalidKeys.join("', '")}'`);
509
- }
510
- return true;
511
- }
512
-
513
- // src/utils/expose-internal-test-apis.ts
514
- var internalApisName = "__QLIK_INTERNAL__DO_NOT_USE_OR_YOU_WILL_BE_FIRED";
515
- function exposeInternalApiOnWindow(name, fn) {
516
- if (globalThis.location?.origin.startsWith("https://localhost:") || globalThis.location?.origin?.endsWith("qlik-stage.com")) {
517
- if (globalThis[internalApisName] === void 0) {
518
- globalThis[internalApisName] = {};
519
- }
520
- globalThis[internalApisName][name] = fn;
521
- }
522
- }
523
-
524
- // src/auth/internal/default-auth-modules/oauth/storage-helpers.ts
525
- var storagePrefix = "qlik-qmfe-api";
526
- function getTopicFromOauthHostConfig(hostConfig) {
527
- let topic = hostConfig.clientId + (hostConfig.scope ? `_${hostConfig.scope}` : "_user_default");
528
- if (hostConfig.subject) {
529
- topic += `_${hostConfig.subject}`;
530
- }
531
- if (hostConfig.userId) {
532
- topic += `_${hostConfig.userId}`;
533
- }
534
- return topic;
535
- }
536
- function getTopicFromAnonHostConfig(hostConfig) {
537
- return `${hostConfig.accessCode}_${hostConfig.clientId}`;
538
- }
539
- var cachedTokens = {};
540
- function clearAllCachedTokens() {
541
- for (const key in cachedTokens) {
542
- delete cachedTokens[key];
543
- }
544
- }
545
- exposeInternalApiOnWindow("clearAllAccessTokens", () => {
546
- console.log("Clearing tokens", cachedTokens);
547
- Object.keys(cachedTokens).forEach((key) => {
548
- console.log("Clearing access tokens for", key);
549
- deleteFromLocalStorage(key, ["access-token", "refresh-token"]);
550
- deleteFromSessionStorage(key, ["access-token", "refresh-token"]);
551
- });
552
- clearAllCachedTokens();
553
- });
554
- function saveInLocalStorage(topic, name, value) {
555
- localStorage.setItem(`${storagePrefix}-${topic}-${name}`, value);
556
- }
557
- function saveInSessionStorage(topic, name, value) {
558
- sessionStorage.setItem(`${storagePrefix}-${topic}-${name}`, value);
559
- }
560
- function loadFromLocalStorage(topic, name) {
561
- return localStorage.getItem(`${storagePrefix}-${topic}-${name}`) || void 0;
234
+ function loadFromLocalStorage(topic, name) {
235
+ return localStorage.getItem(`${storagePrefix}-${topic}-${name}`) || void 0;
562
236
  }
563
237
  function loadFromSessionStorage(topic, name) {
564
238
  return sessionStorage.getItem(`${storagePrefix}-${topic}-${name}`) || void 0;
@@ -672,8 +346,8 @@ function toPerformInteractiveLoginFunction(performInteractiveLogin) {
672
346
  }
673
347
  return performInteractiveLogin;
674
348
  }
675
- function lookupGetAccessFn(getAccessToken2) {
676
- return globalThis[getAccessToken2];
349
+ function lookupGetAccessFn(getAccessToken) {
350
+ return globalThis[getAccessToken];
677
351
  }
678
352
  function lookupInteractiveLoginFn(name) {
679
353
  return globalThis[name];
@@ -1087,7 +761,7 @@ async function handlePotentialAuthenticationErrorAndRetry(hostConfig, fn) {
1087
761
  try {
1088
762
  return await fn();
1089
763
  } catch (err) {
1090
- const { retry } = await handleAuthenticationError2({
764
+ const { retry } = await handleAuthenticationError({
1091
765
  hostConfig,
1092
766
  canRetry: true
1093
767
  });
@@ -1139,7 +813,7 @@ async function getAnonymousAccessToken(hostConfig) {
1139
813
  }
1140
814
  return "";
1141
815
  }
1142
- async function getRestCallAuthParams2({
816
+ async function getRestCallAuthParams({
1143
817
  hostConfig
1144
818
  }) {
1145
819
  return {
@@ -1150,7 +824,7 @@ async function getRestCallAuthParams2({
1150
824
  credentials: "omit"
1151
825
  };
1152
826
  }
1153
- async function getWebSocketAuthParams2({
827
+ async function getWebSocketAuthParams({
1154
828
  hostConfig
1155
829
  }) {
1156
830
  const websocketAccessToken = await handlePotentialAuthenticationErrorAndRetry(hostConfig, async () => {
@@ -1163,7 +837,7 @@ async function getWebSocketAuthParams2({
1163
837
  }
1164
838
  };
1165
839
  }
1166
- async function getWebResourceAuthParams2({
840
+ async function getWebResourceAuthParams({
1167
841
  hostConfig
1168
842
  }) {
1169
843
  const websocketResourceAccessToken = await handlePotentialAuthenticationErrorAndRetry(hostConfig, async () => {
@@ -1176,7 +850,7 @@ async function getWebResourceAuthParams2({
1176
850
  }
1177
851
  };
1178
852
  }
1179
- async function handleAuthenticationError2({
853
+ async function handleAuthenticationError({
1180
854
  hostConfig
1181
855
  }) {
1182
856
  clearStoredAnonymousTokens(hostConfig);
@@ -1186,18 +860,16 @@ async function handleAuthenticationError2({
1186
860
  };
1187
861
  }
1188
862
  var anonymous_default = {
1189
- getRestCallAuthParams: getRestCallAuthParams2,
1190
- getWebSocketAuthParams: getWebSocketAuthParams2,
1191
- getWebResourceAuthParams: getWebResourceAuthParams2,
1192
- handleAuthenticationError: handleAuthenticationError2,
1193
- validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, {
1194
- requiredProps: ["clientId", "accessCode"],
1195
- optionalProps: []
1196
- })
863
+ requiredProps: ["clientId", "accessCode"],
864
+ optionalProps: [],
865
+ getRestCallAuthParams,
866
+ getWebSocketAuthParams,
867
+ getWebResourceAuthParams,
868
+ handleAuthenticationError
1197
869
  };
1198
870
 
1199
871
  // src/auth/internal/default-auth-modules/apikey.ts
1200
- function getRestCallAuthParams3({ hostConfig }) {
872
+ function getRestCallAuthParams2({ hostConfig }) {
1201
873
  return Promise.resolve({
1202
874
  headers: {
1203
875
  Authorization: `Bearer ${hostConfig?.apiKey}`
@@ -1206,25 +878,28 @@ function getRestCallAuthParams3({ hostConfig }) {
1206
878
  credentials: "omit"
1207
879
  });
1208
880
  }
1209
- async function getWebSocketAuthParams3() {
881
+ async function getWebSocketAuthParams2() {
1210
882
  return {
1211
883
  queryParams: {
1212
884
  // accessToken: hostConfig.apiKey,
1213
885
  }
1214
886
  };
1215
887
  }
1216
- function handleAuthenticationError3() {
888
+ function handleAuthenticationError2() {
1217
889
  return Promise.resolve({});
1218
890
  }
1219
891
  var apikey_default = {
1220
- getRestCallAuthParams: getRestCallAuthParams3,
1221
- getWebSocketAuthParams: getWebSocketAuthParams3,
1222
- handleAuthenticationError: handleAuthenticationError3,
1223
- validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, { requiredProps: ["apiKey"], optionalProps: [] })
892
+ requiredProps: ["apiKey"],
893
+ optionalProps: [],
894
+ getRestCallAuthParams: getRestCallAuthParams2,
895
+ getWebSocketAuthParams: getWebSocketAuthParams2,
896
+ handleAuthenticationError: handleAuthenticationError2
1224
897
  };
1225
898
 
1226
- // src/http/http-functions.ts
899
+ // src/http/http-constants.ts
1227
900
  var QLIK_CSRF_TOKEN = "qlik-csrf-token";
901
+
902
+ // src/http/http-functions.ts
1228
903
  function clearCsrfToken(hostConfig) {
1229
904
  const locationUrl = toValidLocationUrl(hostConfig);
1230
905
  delete csrfTokens[locationUrl];
@@ -1269,11 +944,22 @@ async function getCsrfToken(hostConfig, noCache) {
1269
944
  }
1270
945
  var csrfTokens = {};
1271
946
 
947
+ // src/auth/internal/internal-auth-functions.ts
948
+ function internalGetCredentialsForCookieAuth(hostConfig) {
949
+ if (hostConfig.crossSiteCookies === false) {
950
+ return "same-origin";
951
+ }
952
+ if (isHostCrossOrigin(hostConfig)) {
953
+ return "include";
954
+ }
955
+ return "same-origin";
956
+ }
957
+
1272
958
  // src/auth/internal/default-auth-modules/cookie.ts
1273
959
  function isModifyingVerb(verb) {
1274
960
  return !(verb === "get" || verb === "GET");
1275
961
  }
1276
- async function getRestCallAuthParams4({
962
+ async function getRestCallAuthParams3({
1277
963
  hostConfig,
1278
964
  method
1279
965
  }) {
@@ -1284,9 +970,9 @@ async function getRestCallAuthParams4({
1284
970
  if (hostConfig.webIntegrationId) {
1285
971
  headers["qlik-web-integration-id"] = hostConfig.webIntegrationId;
1286
972
  }
1287
- return { headers, queryParams: {}, credentials: getCredentialsForCookieAuth(hostConfig) };
973
+ return { headers, queryParams: {}, credentials: internalGetCredentialsForCookieAuth(hostConfig) };
1288
974
  }
1289
- async function getWebSocketAuthParams4({
975
+ async function getWebSocketAuthParams3({
1290
976
  hostConfig
1291
977
  }) {
1292
978
  const params = {
@@ -1298,7 +984,7 @@ async function getWebSocketAuthParams4({
1298
984
  }
1299
985
  return { queryParams: params };
1300
986
  }
1301
- async function handleAuthenticationError4({
987
+ async function handleAuthenticationError3({
1302
988
  hostConfig,
1303
989
  status
1304
990
  }) {
@@ -1322,30 +1008,29 @@ async function handleAuthenticationError4({
1322
1008
  };
1323
1009
  }
1324
1010
  var cookie_default = {
1325
- getRestCallAuthParams: getRestCallAuthParams4,
1326
- getWebSocketAuthParams: getWebSocketAuthParams4,
1327
- handleAuthenticationError: handleAuthenticationError4,
1328
- validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, {
1329
- requiredProps: [],
1330
- optionalProps: ["webIntegrationId", "crossSiteCookies", "anonymousMode"]
1331
- })
1011
+ requiredProps: [],
1012
+ optionalProps: ["webIntegrationId", "crossSiteCookies", "anonymousMode"],
1013
+ getRestCallAuthParams: getRestCallAuthParams3,
1014
+ getWebSocketAuthParams: getWebSocketAuthParams3,
1015
+ handleAuthenticationError: handleAuthenticationError3
1332
1016
  };
1333
1017
 
1334
1018
  // src/auth/internal/default-auth-modules/none.ts
1335
- function getRestCallAuthParams5() {
1019
+ function getRestCallAuthParams4() {
1336
1020
  return Promise.resolve({ headers: {}, queryParams: {}, credentials: "same-origin" });
1337
1021
  }
1338
- function getWebSocketAuthParams5() {
1022
+ function getWebSocketAuthParams4() {
1339
1023
  return Promise.resolve({ queryParams: {} });
1340
1024
  }
1341
- function handleAuthenticationError5() {
1025
+ function handleAuthenticationError4() {
1342
1026
  return Promise.resolve({});
1343
1027
  }
1344
1028
  var none_default = {
1345
- getRestCallAuthParams: getRestCallAuthParams5,
1346
- getWebSocketAuthParams: getWebSocketAuthParams5,
1347
- handleAuthenticationError: handleAuthenticationError5,
1348
- validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, { requiredProps: [], optionalProps: [] })
1029
+ requiredProps: [],
1030
+ optionalProps: [],
1031
+ getRestCallAuthParams: getRestCallAuthParams4,
1032
+ getWebSocketAuthParams: getWebSocketAuthParams4,
1033
+ handleAuthenticationError: handleAuthenticationError4
1349
1034
  };
1350
1035
 
1351
1036
  // src/auth/internal/default-auth-modules/oauth/callback.ts
@@ -1385,7 +1070,7 @@ async function handlePotentialAuthenticationErrorAndRetry2(hostConfig, fn) {
1385
1070
  try {
1386
1071
  return await fn();
1387
1072
  } catch (err) {
1388
- const { retry } = await handleAuthenticationError6({
1073
+ const { retry } = await handleAuthenticationError5({
1389
1074
  hostConfig,
1390
1075
  canRetry: true
1391
1076
  });
@@ -1395,7 +1080,7 @@ async function handlePotentialAuthenticationErrorAndRetry2(hostConfig, fn) {
1395
1080
  throw err;
1396
1081
  }
1397
1082
  }
1398
- async function getRestCallAuthParams6({
1083
+ async function getRestCallAuthParams5({
1399
1084
  hostConfig
1400
1085
  }) {
1401
1086
  return {
@@ -1406,7 +1091,7 @@ async function getRestCallAuthParams6({
1406
1091
  credentials: "omit"
1407
1092
  };
1408
1093
  }
1409
- async function getWebSocketAuthParams6({
1094
+ async function getWebSocketAuthParams5({
1410
1095
  hostConfig
1411
1096
  }) {
1412
1097
  const websocketAccessToken = await handlePotentialAuthenticationErrorAndRetry2(hostConfig, async () => {
@@ -1419,7 +1104,7 @@ async function getWebSocketAuthParams6({
1419
1104
  }
1420
1105
  };
1421
1106
  }
1422
- async function getWebResourceAuthParams3({
1107
+ async function getWebResourceAuthParams2({
1423
1108
  hostConfig
1424
1109
  }) {
1425
1110
  const webResourceAccessToken = await handlePotentialAuthenticationErrorAndRetry2(hostConfig, async () => {
@@ -1432,183 +1117,544 @@ async function getWebResourceAuthParams3({
1432
1117
  }
1433
1118
  };
1434
1119
  }
1435
- async function handleAuthenticationError6({
1436
- hostConfig
1437
- }) {
1438
- if (hostConfig.getAccessToken) {
1439
- clearStoredOauthTokens(hostConfig);
1440
- return {
1441
- preventDefault: false,
1442
- retry: true
1443
- };
1120
+ async function handleAuthenticationError5({
1121
+ hostConfig
1122
+ }) {
1123
+ if (hostConfig.getAccessToken) {
1124
+ clearStoredOauthTokens(hostConfig);
1125
+ return {
1126
+ preventDefault: false,
1127
+ retry: true
1128
+ };
1129
+ }
1130
+ if (isBrowser()) {
1131
+ if (hostConfig.performInteractiveLogin) {
1132
+ clearStoredOauthTokens(hostConfig);
1133
+ return {
1134
+ retry: true
1135
+ };
1136
+ }
1137
+ if (hostConfig.authRedirectUserConfirmation) {
1138
+ await hostConfig.authRedirectUserConfirmation();
1139
+ }
1140
+ startFullPageLoginFlow(hostConfig);
1141
+ return {
1142
+ preventDefault: true
1143
+ };
1144
+ }
1145
+ await refreshAccessToken(hostConfig);
1146
+ return {
1147
+ preventDefault: false,
1148
+ retry: true
1149
+ };
1150
+ }
1151
+ var oauth_default = {
1152
+ requiredProps: ["clientId"],
1153
+ optionalProps: [
1154
+ "clientSecret",
1155
+ "redirectUri",
1156
+ "accessTokenStorage",
1157
+ "scope",
1158
+ "subject",
1159
+ "userId",
1160
+ "noCache",
1161
+ "getAccessToken",
1162
+ "performInteractiveLogin"
1163
+ ],
1164
+ getRestCallAuthParams: getRestCallAuthParams5,
1165
+ getWebSocketAuthParams: getWebSocketAuthParams5,
1166
+ getWebResourceAuthParams: getWebResourceAuthParams2,
1167
+ handleAuthenticationError: handleAuthenticationError5
1168
+ };
1169
+
1170
+ // src/auth/internal/default-auth-modules/reference.ts
1171
+ function getRestCallAuthParams6() {
1172
+ throw new Error("getRestCallAuthParams should never be called for reference auth module");
1173
+ }
1174
+ function getWebSocketAuthParams6() {
1175
+ throw new Error("getWebSocketAuthParams should never be called for reference auth module");
1176
+ }
1177
+ function handleAuthenticationError6() {
1178
+ throw new Error("handleAuthenticationError should never be called for reference auth module");
1179
+ }
1180
+ var reference_default = {
1181
+ requiredProps: ["reference"],
1182
+ optionalProps: [],
1183
+ getRestCallAuthParams: getRestCallAuthParams6,
1184
+ getWebSocketAuthParams: getWebSocketAuthParams6,
1185
+ handleAuthenticationError: handleAuthenticationError6
1186
+ };
1187
+
1188
+ // src/auth/internal/default-auth-modules/windows-cookie/xrf-keys.ts
1189
+ var xrfKeys = {};
1190
+ function createXrfKey() {
1191
+ let result2 = "";
1192
+ for (let i = 0; i < 16; i += 1) {
1193
+ const j = Math.floor(Math.random() * 62);
1194
+ if (j < 10) {
1195
+ result2 += j;
1196
+ } else if (j > 9 && j < 36) {
1197
+ result2 += String.fromCharCode(j + 55);
1198
+ } else {
1199
+ result2 += String.fromCharCode(j + 61);
1200
+ }
1201
+ }
1202
+ return result2;
1203
+ }
1204
+ function getXrfKey(hostConfig) {
1205
+ const locationUrl = toValidLocationUrl(hostConfig);
1206
+ xrfKeys[locationUrl] = xrfKeys[locationUrl] || createXrfKey();
1207
+ return xrfKeys[locationUrl];
1208
+ }
1209
+
1210
+ // src/auth/internal/default-auth-modules/windows-cookie.ts
1211
+ async function getRestCallAuthParams7({
1212
+ hostConfig
1213
+ }) {
1214
+ return {
1215
+ headers: {
1216
+ "X-Qlik-XrfKey": getXrfKey(hostConfig)
1217
+ },
1218
+ queryParams: {
1219
+ xrfkey: getXrfKey(hostConfig)
1220
+ },
1221
+ credentials: internalGetCredentialsForCookieAuth(hostConfig)
1222
+ };
1223
+ }
1224
+ async function getWebSocketAuthParams7({
1225
+ hostConfig
1226
+ }) {
1227
+ return {
1228
+ queryParams: {
1229
+ xrfkey: getXrfKey(hostConfig),
1230
+ "qlik-csrf-token": await getCsrfToken(hostConfig, true)
1231
+ }
1232
+ };
1233
+ }
1234
+ async function handleAuthenticationError7({
1235
+ hostConfig
1236
+ }) {
1237
+ if (hostConfig.loginUri) {
1238
+ if (hostConfig.authRedirectUserConfirmation) {
1239
+ await hostConfig.authRedirectUserConfirmation();
1240
+ }
1241
+ globalThis.location.replace(
1242
+ hostConfig.loginUri.replace("{location}", encodeURIComponent(globalThis.location.href))
1243
+ );
1244
+ return {
1245
+ preventDefault: true
1246
+ };
1247
+ }
1248
+ return {
1249
+ // Do nothing, just let the error be thrown to calling code
1250
+ };
1251
+ }
1252
+ var windows_cookie_default = {
1253
+ requiredProps: [],
1254
+ optionalProps: ["loginUri", "crossSiteCookies"],
1255
+ getRestCallAuthParams: getRestCallAuthParams7,
1256
+ getWebSocketAuthParams: getWebSocketAuthParams7,
1257
+ handleAuthenticationError: handleAuthenticationError7
1258
+ };
1259
+
1260
+ // src/auth/internal/auth-module-registry.ts
1261
+ var authModules = {};
1262
+ var ongoingAuthModuleLoading = Promise.resolve();
1263
+ var authModulesRegistered = false;
1264
+ (function registerDefaultAuthModules() {
1265
+ if (!authModulesRegistered) {
1266
+ registerAuthModule("apikey", apikey_default);
1267
+ registerAuthModule("cookie", cookie_default);
1268
+ registerAuthModule("none", none_default);
1269
+ registerAuthModule("oauth2", oauth_default);
1270
+ registerAuthModule("anonymous", anonymous_default);
1271
+ registerAuthModule("windowscookie", windows_cookie_default);
1272
+ registerAuthModule("reference", reference_default);
1273
+ authModulesRegistered = true;
1274
+ }
1275
+ })();
1276
+ function registerAuthModule(name, authModule) {
1277
+ authModules[name.toLowerCase()] = authModule;
1278
+ }
1279
+ function getRegisteredAuthModules() {
1280
+ return Object.keys(authModules);
1281
+ }
1282
+ function getRegisteredAuthModule(authType) {
1283
+ return authModules[authType.toLowerCase()];
1284
+ }
1285
+ async function getAuthModule(hostConfig) {
1286
+ const hostConfigToUse = withResolvedHostConfig(hostConfig);
1287
+ const authType = await determineAuthType(hostConfigToUse);
1288
+ if (ongoingAuthModuleLoading) {
1289
+ await ongoingAuthModuleLoading;
1290
+ }
1291
+ let authModule = getRegisteredAuthModule(authType);
1292
+ if (!authModule) {
1293
+ ongoingAuthModuleLoading = (async () => {
1294
+ authModule = await resolveGloballyDefinedAuthModule(authType);
1295
+ if (authModule) {
1296
+ registerAuthModule(authType, authModule);
1297
+ }
1298
+ })();
1299
+ await ongoingAuthModuleLoading;
1300
+ }
1301
+ if (!authModule) {
1302
+ throw new InvalidAuthTypeError(authType);
1303
+ }
1304
+ if (authModule.validateHostConfig) {
1305
+ authModule.validateHostConfig({ authType, ...hostConfigToUse });
1306
+ } else {
1307
+ internalValidateHostConfig(
1308
+ { authType, ...hostConfigToUse },
1309
+ { requiredProps: authModule.requiredProps || [], optionalProps: authModule.optionalProps || [] }
1310
+ );
1311
+ }
1312
+ return authModule;
1313
+ }
1314
+ async function resolveGloballyDefinedAuthModule(authType) {
1315
+ const globalWindow = globalThis;
1316
+ const globalVariable = globalWindow[authType];
1317
+ if (globalVariable) {
1318
+ let potentialAuthModule;
1319
+ if (typeof globalVariable === "function") {
1320
+ potentialAuthModule = await globalVariable();
1321
+ } else {
1322
+ potentialAuthModule = globalVariable;
1323
+ }
1324
+ if (potentialAuthModule && potentialAuthModule.getRestCallAuthParams && potentialAuthModule.getWebSocketAuthParams && potentialAuthModule.handleAuthenticationError) {
1325
+ return potentialAuthModule;
1326
+ }
1327
+ console.error("Not a valid auth module", potentialAuthModule);
1328
+ throw new InvalidAuthTypeError(authType);
1329
+ }
1330
+ return Promise.resolve(void 0);
1331
+ }
1332
+ function internalValidateHostConfig(hostConfig, { requiredProps, optionalProps }) {
1333
+ const missingRequiredProps = [];
1334
+ for (const requiredProp of requiredProps) {
1335
+ if (!hostConfig[requiredProp]) {
1336
+ missingRequiredProps.push(requiredProp);
1337
+ }
1338
+ }
1339
+ if (missingRequiredProps.length > 0) {
1340
+ throw new InvalidHostConfigError(
1341
+ `missing required properties in host config; '${missingRequiredProps.join("', '")}'`
1342
+ );
1343
+ }
1344
+ const validProps = [...hostConfigCommonProperties, ...requiredProps, ...optionalProps];
1345
+ const invalidKeys = [];
1346
+ Object.keys(hostConfig).forEach((key) => {
1347
+ if (!validProps.includes(key)) {
1348
+ invalidKeys.push(key);
1349
+ }
1350
+ });
1351
+ if (invalidKeys.length > 0) {
1352
+ console.warn(`WARNING: unknown properties in host config; '${invalidKeys.join("', '")}'`);
1353
+ }
1354
+ return true;
1355
+ }
1356
+ async function determineAuthType(hostConfig) {
1357
+ if (hostConfig.authType) {
1358
+ return hostConfig.authType;
1359
+ }
1360
+ if (hostConfig.apiKey) {
1361
+ return "apikey";
1362
+ }
1363
+ if (hostConfig.accessCode) {
1364
+ return "anonymous";
1365
+ }
1366
+ if (hostConfig.clientId) {
1367
+ return "oauth2";
1368
+ }
1369
+ if (hostConfig.webIntegrationId) {
1370
+ return "cookie";
1371
+ }
1372
+ if (hostConfig.reference) {
1373
+ return "reference";
1374
+ }
1375
+ if (await isWindows(hostConfig)) {
1376
+ return "windowscookie";
1377
+ }
1378
+ return "cookie";
1379
+ }
1380
+
1381
+ // src/auth/auth-errors.ts
1382
+ var InvalidHostConfigError = class extends Error {
1383
+ constructor(message) {
1384
+ super(`Invalid host config: ${message}`);
1385
+ this.name = "InvalidHostConfigError";
1386
+ }
1387
+ };
1388
+ var UnexpectedAuthTypeError = class extends Error {
1389
+ constructor(...expectedAuthTypes) {
1390
+ const ors = expectedAuthTypes.map((item, index) => index === 0 ? `"${item}"` : `or "${item}"`).join(" ");
1391
+ super(`HostConfig is not properly configured. authType is expected to be ${ors}`);
1392
+ this.name = "UnexpectedAuthTypeError";
1393
+ }
1394
+ };
1395
+ var InvalidAuthTypeError = class extends Error {
1396
+ constructor(authType) {
1397
+ const validAuthModules = getRegisteredAuthModules();
1398
+ super(
1399
+ `Not a valid auth type: ${authType}, valid auth types are; '${validAuthModules.filter((name) => name.toLowerCase() !== "qmfeembedframerauthmodule").join("', '")}'`
1400
+ );
1401
+ this.name = "InvalidAuthTypeError";
1402
+ }
1403
+ };
1404
+ function errorToString({ title, detail, code, status }) {
1405
+ if (detail) {
1406
+ return `${title} - ${detail} (Status: ${status}, Code: ${code})`;
1407
+ }
1408
+ return `${title} (Status: ${status}, Code: ${code})`;
1409
+ }
1410
+ var AuthorizationError = class extends Error {
1411
+ errors;
1412
+ constructor(errors) {
1413
+ if (typeof errors !== "object") {
1414
+ super("Unknown error");
1415
+ return;
1416
+ }
1417
+ const errorArray = Array.isArray(errors) ? errors : [errors];
1418
+ super(errorArray.map(errorToString).join(", "));
1419
+ this.errors = errorArray;
1420
+ }
1421
+ };
1422
+
1423
+ // src/auth/internal/host-config-functions.ts
1424
+ var defaultHostConfig = {};
1425
+ function setDefaultHostConfigInternal(hostConfig) {
1426
+ defaultHostConfig = hostConfig || {};
1427
+ }
1428
+ function getDefaultHostConfigInternal() {
1429
+ return defaultHostConfig;
1430
+ }
1431
+ function removeDefaults(hostConfig) {
1432
+ const cleanedHostConfig = cleanFalsyValues(hostConfig) || {};
1433
+ if (cleanedHostConfig.host) {
1434
+ cleanedHostConfig.host = toValidLocationUrl(cleanedHostConfig);
1435
+ }
1436
+ if (isBrowser()) {
1437
+ if (toValidLocationUrl(cleanedHostConfig) === window.location.origin) {
1438
+ delete cleanedHostConfig.host;
1439
+ }
1440
+ }
1441
+ if (cleanedHostConfig.authType && authTypesThatCanBeOmitted.includes(cleanedHostConfig.authType)) {
1442
+ delete cleanedHostConfig.authType;
1443
+ }
1444
+ return cleanedHostConfig;
1445
+ }
1446
+ function globalReplacer(key, value) {
1447
+ if (typeof value === "function") {
1448
+ return void 0;
1449
+ }
1450
+ return value;
1451
+ }
1452
+ function serializeHostConfigInternal(hostConfig) {
1453
+ const hostConfigToUse = removeDefaults(withResolvedHostConfig(hostConfig));
1454
+ const sorted = sortKeys(hostConfigToUse);
1455
+ return JSON.stringify(sorted, globalReplacer);
1456
+ }
1457
+ var registeredHostConfigs = /* @__PURE__ */ new Map();
1458
+ function registerHostConfigInternal(name, hostConfig) {
1459
+ if (hostConfig?.reference) {
1460
+ throw new InvalidHostConfigError("Cannot register a host config with a reference");
1461
+ }
1462
+ if (registeredHostConfigs.has(name)) {
1463
+ console.warn(`registerHostConfig: Host config with name "${name}" is already registered. Overwriting.`);
1464
+ }
1465
+ registeredHostConfigs.set(name, hostConfig);
1466
+ }
1467
+ function unregisterHostConfigInternal(name) {
1468
+ if (registeredHostConfigs.has(name)) {
1469
+ registeredHostConfigs.delete(name);
1470
+ } else {
1471
+ console.warn(`unregisterHostConfig: Host config with name "${name}" not found.`);
1472
+ }
1473
+ }
1474
+ function getRegisteredHostConfigInternal(name) {
1475
+ if (!registeredHostConfigs.has(name)) {
1476
+ throw new Error(`Host config with name "${name}" not found.`);
1477
+ }
1478
+ return registeredHostConfigs.get(name);
1479
+ }
1480
+
1481
+ // src/auth/auth-functions.ts
1482
+ globalThis.loggingOut = false;
1483
+ var lastErrorMessage = "";
1484
+ function logToConsole({ message }) {
1485
+ if (message !== lastErrorMessage) {
1486
+ lastErrorMessage = message;
1487
+ console.error(message);
1488
+ }
1489
+ }
1490
+ function determineAuthType2(hostConfig) {
1491
+ return determineAuthType(hostConfig);
1492
+ }
1493
+ function isHostCrossOrigin(hostConfig) {
1494
+ if (!globalThis.location?.origin) {
1495
+ return true;
1496
+ }
1497
+ const hostConfigToUse = withResolvedHostConfig(hostConfig);
1498
+ if (Object.keys(hostConfigToUse).length === 0) {
1499
+ return false;
1500
+ }
1501
+ try {
1502
+ const locationUrl = new URL(toValidLocationUrl(hostConfigToUse));
1503
+ return locationUrl.origin !== globalThis.location.origin;
1504
+ } catch {
1505
+ }
1506
+ return false;
1507
+ }
1508
+ async function isWindows(hostConfig) {
1509
+ const hostConfigToUse = withResolvedHostConfig(hostConfig);
1510
+ if (typeof hostConfigToUse.forceIsWindows === "boolean") {
1511
+ return hostConfigToUse.forceIsWindows;
1512
+ }
1513
+ if (hostConfigToUse.authType === "cookie") {
1514
+ return false;
1515
+ }
1516
+ if (hostConfigToUse.authType === "windowscookie") {
1517
+ return true;
1518
+ }
1519
+ return (await getPlatform({ hostConfig })).isWindows;
1520
+ }
1521
+ function toValidLocationUrl(hostConfig) {
1522
+ const url = withResolvedHostConfig(hostConfig)?.host?.trim();
1523
+ let locationUrl;
1524
+ if (!url) {
1525
+ locationUrl = "";
1526
+ } else if (url.toLowerCase().startsWith("https://") || url.toLowerCase().startsWith("http://")) {
1527
+ locationUrl = url;
1528
+ } else {
1529
+ locationUrl = `https://${url}`;
1530
+ }
1531
+ while (locationUrl[locationUrl.length - 1] === "/") {
1532
+ locationUrl = locationUrl.substring(0, locationUrl.length - 1);
1533
+ }
1534
+ return locationUrl;
1535
+ }
1536
+ function toValidWebsocketLocationUrl(hostConfig) {
1537
+ const url = withResolvedHostConfig(hostConfig)?.host;
1538
+ let locationUrl;
1539
+ if (!url) {
1540
+ locationUrl = globalThis.location.origin;
1541
+ } else if (url.toLowerCase().startsWith("https://") || url.toLowerCase().startsWith("http://")) {
1542
+ locationUrl = url;
1543
+ } else {
1544
+ locationUrl = `https://${url}`;
1545
+ }
1546
+ while (locationUrl[locationUrl.length - 1] === "/") {
1547
+ locationUrl = locationUrl.substring(0, locationUrl.length - 1);
1548
+ }
1549
+ return locationUrl.replace(leadingHttp, "ws");
1550
+ }
1551
+ async function getWebSocketAuthParams8(props) {
1552
+ const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
1553
+ try {
1554
+ const authModule = await getAuthModule(hostConfigToUse);
1555
+ return await authModule.getWebSocketAuthParams({
1556
+ ...props,
1557
+ hostConfig: hostConfigToUse
1558
+ });
1559
+ } catch (err) {
1560
+ (hostConfigToUse.onAuthFailed || logToConsole)(normalizeAuthModuleError(err));
1561
+ throw err;
1562
+ }
1563
+ }
1564
+ async function getWebResourceAuthParams3(props) {
1565
+ const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
1566
+ try {
1567
+ const authModule = await getAuthModule(hostConfigToUse);
1568
+ return await authModule.getWebResourceAuthParams?.({
1569
+ ...props,
1570
+ hostConfig: hostConfigToUse
1571
+ }) || { queryParams: {} };
1572
+ } catch (err) {
1573
+ (hostConfigToUse.onAuthFailed || logToConsole)(normalizeAuthModuleError(err));
1574
+ throw err;
1444
1575
  }
1445
- if (isBrowser()) {
1446
- if (hostConfig.performInteractiveLogin) {
1447
- clearStoredOauthTokens(hostConfig);
1448
- return {
1449
- retry: true
1450
- };
1451
- }
1452
- if (hostConfig.authRedirectUserConfirmation) {
1453
- await hostConfig.authRedirectUserConfirmation();
1454
- }
1455
- startFullPageLoginFlow(hostConfig);
1456
- return {
1457
- preventDefault: true
1458
- };
1576
+ }
1577
+ async function handleAuthenticationError8(props) {
1578
+ const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
1579
+ const authModule = await getAuthModule(hostConfigToUse);
1580
+ const result2 = await authModule.handleAuthenticationError({
1581
+ ...props,
1582
+ hostConfig: hostConfigToUse
1583
+ });
1584
+ const willRetry = props.canRetry && result2.retry;
1585
+ const willHangUntilANewPageIsLoaded = result2.preventDefault;
1586
+ if (!willRetry && !willHangUntilANewPageIsLoaded) {
1587
+ const { status, errorBody } = props;
1588
+ (hostConfigToUse.onAuthFailed || logToConsole)(normalizeInbandAuthError({ status, errorBody }));
1459
1589
  }
1460
- await refreshAccessToken(hostConfig);
1461
- return {
1462
- preventDefault: false,
1463
- retry: true
1464
- };
1590
+ return result2;
1465
1591
  }
1466
- var oauth_default = {
1467
- getRestCallAuthParams: getRestCallAuthParams6,
1468
- getWebSocketAuthParams: getWebSocketAuthParams6,
1469
- getWebResourceAuthParams: getWebResourceAuthParams3,
1470
- handleAuthenticationError: handleAuthenticationError6,
1471
- validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, {
1472
- requiredProps: ["clientId"],
1473
- optionalProps: [
1474
- "clientSecret",
1475
- "redirectUri",
1476
- "accessTokenStorage",
1477
- "scope",
1478
- "subject",
1479
- "userId",
1480
- "noCache",
1481
- "getAccessToken",
1482
- "performInteractiveLogin"
1483
- ]
1484
- })
1485
- };
1486
-
1487
- // src/auth/internal/default-auth-modules/reference.ts
1488
- function getRestCallAuthParams7() {
1489
- throw new Error("getRestCallAuthParams should never be called for reference auth module");
1592
+ async function getRestCallAuthParams8(props) {
1593
+ const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
1594
+ try {
1595
+ const authModule = await getAuthModule(hostConfigToUse);
1596
+ return await authModule.getRestCallAuthParams({
1597
+ ...props,
1598
+ hostConfig: hostConfigToUse
1599
+ });
1600
+ } catch (err) {
1601
+ (hostConfigToUse.onAuthFailed || logToConsole)(normalizeAuthModuleError(err));
1602
+ throw err;
1603
+ }
1490
1604
  }
1491
- function getWebSocketAuthParams7() {
1492
- throw new Error("getWebSocketAuthParams should never be called for reference auth module");
1605
+ function registerAuthModule2(name, authModule) {
1606
+ registerAuthModule(name, authModule);
1493
1607
  }
1494
- function handleAuthenticationError7() {
1495
- throw new Error("handleAuthenticationError should never be called for reference auth module");
1608
+ function setDefaultHostConfig(hostConfig) {
1609
+ setDefaultHostConfigInternal(hostConfig);
1496
1610
  }
1497
- var reference_default = {
1498
- getRestCallAuthParams: getRestCallAuthParams7,
1499
- getWebSocketAuthParams: getWebSocketAuthParams7,
1500
- handleAuthenticationError: handleAuthenticationError7,
1501
- validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, { requiredProps: ["reference"], optionalProps: [] })
1502
- };
1503
-
1504
- // src/auth/internal/default-auth-modules/windows-cookie/xrf-keys.ts
1505
- var xrfKeys = {};
1506
- function createXrfKey() {
1507
- let result2 = "";
1508
- for (let i = 0; i < 16; i += 1) {
1509
- const j = Math.floor(Math.random() * 62);
1510
- if (j < 10) {
1511
- result2 += j;
1512
- } else if (j > 9 && j < 36) {
1513
- result2 += String.fromCharCode(j + 55);
1514
- } else {
1515
- result2 += String.fromCharCode(j + 61);
1516
- }
1517
- }
1518
- return result2;
1611
+ function registerHostConfig(name, hostConfig) {
1612
+ registerHostConfigInternal(name, hostConfig);
1519
1613
  }
1520
- function getXrfKey(hostConfig) {
1521
- const locationUrl = toValidLocationUrl(hostConfig);
1522
- xrfKeys[locationUrl] = xrfKeys[locationUrl] || createXrfKey();
1523
- return xrfKeys[locationUrl];
1614
+ function unregisterHostConfig(name) {
1615
+ unregisterHostConfigInternal(name);
1524
1616
  }
1525
-
1526
- // src/auth/internal/default-auth-modules/windows-cookie.ts
1527
- async function getRestCallAuthParams8({
1528
- hostConfig
1529
- }) {
1530
- return {
1531
- headers: {
1532
- "X-Qlik-XrfKey": getXrfKey(hostConfig)
1533
- },
1534
- queryParams: {
1535
- xrfkey: getXrfKey(hostConfig)
1536
- },
1537
- credentials: getCredentialsForCookieAuth(hostConfig)
1538
- };
1617
+ function serializeHostConfig(hostConfig) {
1618
+ return serializeHostConfigInternal(hostConfig);
1539
1619
  }
1540
- async function getWebSocketAuthParams8({
1541
- hostConfig
1542
- }) {
1543
- return {
1544
- queryParams: {
1545
- xrfkey: getXrfKey(hostConfig),
1546
- "qlik-csrf-token": await getCsrfToken(hostConfig, true)
1620
+ function checkForCrossDomainRequest(hostConfig) {
1621
+ const hostConfigToUse = withResolvedHostConfig(hostConfig);
1622
+ if (isHostCrossOrigin(hostConfigToUse)) {
1623
+ if (Object.keys(hostConfigToUse).length === 0) {
1624
+ throw new InvalidHostConfigError("a host config must be provided when making a cross domain request");
1547
1625
  }
1548
- };
1549
- }
1550
- async function handleAuthenticationError8({
1551
- hostConfig
1552
- }) {
1553
- if (hostConfig.loginUri) {
1554
- if (hostConfig.authRedirectUserConfirmation) {
1555
- await hostConfig.authRedirectUserConfirmation();
1626
+ if (!hostConfigToUse.host) {
1627
+ throw new InvalidHostConfigError(
1628
+ "A 'host' property must be set in host config when making a cross domain request"
1629
+ );
1556
1630
  }
1557
- globalThis.location.replace(
1558
- hostConfig.loginUri.replace("{location}", encodeURIComponent(globalThis.location.href))
1559
- );
1560
- return {
1561
- preventDefault: true
1562
- };
1563
1631
  }
1564
- return {
1565
- // Do nothing, just let the error be thrown to calling code
1566
- };
1567
1632
  }
1568
- var windows_cookie_default = {
1569
- getRestCallAuthParams: getRestCallAuthParams8,
1570
- getWebSocketAuthParams: getWebSocketAuthParams8,
1571
- handleAuthenticationError: handleAuthenticationError8,
1572
- validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, {
1573
- requiredProps: [],
1574
- optionalProps: ["loginUri", "crossSiteCookies"]
1575
- })
1633
+ var logout = () => {
1634
+ globalThis.loggingOut = true;
1635
+ globalThis.location.href = "/logout";
1576
1636
  };
1577
-
1578
- // src/auth/auth.ts
1579
- globalThis.loggingOut = false;
1580
- var authModulesRegistered = false;
1581
- function registerDefaultAuthModules() {
1582
- if (!authModulesRegistered) {
1583
- registerAuthModule("apikey", apikey_default);
1584
- registerAuthModule("cookie", cookie_default);
1585
- registerAuthModule("none", none_default);
1586
- registerAuthModule("oauth2", oauth_default);
1587
- registerAuthModule("anonymous", anonymous_default);
1588
- registerAuthModule("windowscookie", windows_cookie_default);
1589
- registerAuthModule("reference", reference_default);
1590
- authModulesRegistered = true;
1637
+ var leadingHttp = /^http/;
1638
+ function normalizeInbandAuthError({ errorBody, status }) {
1639
+ const authError = errorBody;
1640
+ if (typeof authError?.errors === "object") {
1641
+ const err = new AuthorizationError(authError?.errors);
1642
+ return { message: err.message };
1591
1643
  }
1644
+ return { message: `HTTP ${status}` };
1645
+ }
1646
+ function normalizeAuthModuleError(err) {
1647
+ return { message: err.message || "Unknown error" };
1648
+ }
1649
+ function withResolvedHostConfig(hostConfig) {
1650
+ if (hostConfig?.reference) {
1651
+ return getRegisteredHostConfigInternal(hostConfig.reference);
1652
+ }
1653
+ if (hostConfig && Object.keys(hostConfig).length > 0) {
1654
+ return hostConfig;
1655
+ }
1656
+ return getDefaultHostConfigInternal();
1592
1657
  }
1593
- registerDefaultAuthModules();
1594
- var auth = {
1595
- logout,
1596
- registerAuthModule,
1597
- setDefaultHostConfig,
1598
- registerHostConfig,
1599
- unregisterHostConfig,
1600
- getRestCallAuthParams,
1601
- getWebSocketAuthParams,
1602
- getWebResourceAuthParams,
1603
- handleAuthenticationError,
1604
- toValidLocationUrl,
1605
- toValidWebsocketLocationUrl,
1606
- isWindows,
1607
- isHostCrossOrigin,
1608
- determineAuthType,
1609
- serializeHostConfig
1610
- };
1611
- var auth_default = auth;
1612
1658
 
1613
1659
  // src/invoke-fetch/internal/invoke-fetch-helpers.ts
1614
1660
  function encodeQueryParams(query) {
@@ -1981,7 +2027,7 @@ async function getInvokeFetchUrlParams({
1981
2027
  headers: authHeaders,
1982
2028
  queryParams: authQueryParams,
1983
2029
  credentials
1984
- } = await getRestCallAuthParams({
2030
+ } = await getRestCallAuthParams8({
1985
2031
  hostConfig: options?.hostConfig,
1986
2032
  method
1987
2033
  });
@@ -2114,7 +2160,7 @@ async function interceptAuthenticationErrors(hostConfig, resultPromise, performR
2114
2160
  if (globalThis.loggingOut) {
2115
2161
  return neverResolvingPromise();
2116
2162
  }
2117
- const { retry, preventDefault } = await handleAuthenticationError({
2163
+ const { retry, preventDefault } = await handleAuthenticationError8({
2118
2164
  hostConfig,
2119
2165
  status: err.status,
2120
2166
  headers: err.headers,
@@ -2166,50 +2212,6 @@ async function download(blob, filename) {
2166
2212
  }
2167
2213
  }
2168
2214
 
2169
- // src/invoke-fetch/invoke-fetch-error.ts
2170
- var InvokeFetchError = class extends Error {
2171
- status;
2172
- headers;
2173
- data;
2174
- constructor(errorMessage, status, headers, data) {
2175
- super(errorMessage);
2176
- this.status = status;
2177
- this.headers = headers;
2178
- this.data = data;
2179
- this.stack = cleanStack(this.stack);
2180
- }
2181
- };
2182
- var EncodingError = class extends Error {
2183
- contentType;
2184
- data;
2185
- constructor(errorMessage, contentType, data) {
2186
- super(errorMessage);
2187
- this.contentType = contentType;
2188
- this.data = data;
2189
- this.stack = cleanStack(this.stack);
2190
- }
2191
- };
2192
- var regex = /^.+\/qmfe-api(?:\.js)?:(\d+)(?::\d+)?$/gim;
2193
- var isFromQmfeApi = (line) => {
2194
- const matches = line.match(regex);
2195
- return Boolean(matches && matches.length > 0);
2196
- };
2197
- function cleanStack(stack) {
2198
- if (!stack) {
2199
- return stack;
2200
- }
2201
- const newStack = [];
2202
- const lines = stack.split("\n");
2203
- lines.reverse();
2204
- for (const line of lines) {
2205
- if (isFromQmfeApi(line)) {
2206
- break;
2207
- }
2208
- newStack.unshift(line);
2209
- }
2210
- return newStack.join("\n");
2211
- }
2212
-
2213
2215
  // src/invoke-fetch/invoke-fetch-functions.ts
2214
2216
  var defaultUserAgent = "qmfe-api/latest";
2215
2217
  async function invokeFetch(api, props, interceptors) {
@@ -2301,44 +2303,32 @@ async function parseFetchResponse(fetchResponse, url) {
2301
2303
  return invokeFetchResponse;
2302
2304
  }
2303
2305
 
2304
- // src/invoke-fetch/invoke-fetch.ts
2305
- var invokeFetchExp = {
2306
- invokeFetch,
2307
- clearApiCache,
2308
- parseFetchResponse
2309
- };
2310
- var invoke_fetch_default = invokeFetchExp;
2311
-
2312
2306
  export {
2313
2307
  getPlatform,
2308
+ generateRandomString,
2309
+ exposeInternalApiOnWindow,
2310
+ InvokeFetchError,
2311
+ EncodingError,
2312
+ invokeFetch,
2313
+ clearApiCache,
2314
+ parseFetchResponse,
2314
2315
  InvalidHostConfigError,
2315
2316
  UnexpectedAuthTypeError,
2316
2317
  InvalidAuthTypeError,
2317
2318
  AuthorizationError,
2319
+ determineAuthType2 as determineAuthType,
2318
2320
  isHostCrossOrigin,
2319
2321
  isWindows,
2320
2322
  toValidLocationUrl,
2321
2323
  toValidWebsocketLocationUrl,
2322
- getWebSocketAuthParams,
2323
- getWebResourceAuthParams,
2324
- handleAuthenticationError,
2325
- getRestCallAuthParams,
2326
- getAccessToken,
2324
+ getWebSocketAuthParams8 as getWebSocketAuthParams,
2325
+ getWebResourceAuthParams3 as getWebResourceAuthParams,
2326
+ handleAuthenticationError8 as handleAuthenticationError,
2327
+ getRestCallAuthParams8 as getRestCallAuthParams,
2327
2328
  registerAuthModule2 as registerAuthModule,
2328
2329
  setDefaultHostConfig,
2329
2330
  registerHostConfig,
2330
2331
  unregisterHostConfig,
2331
2332
  serializeHostConfig,
2332
- determineAuthType,
2333
- checkForCrossDomainRequest,
2334
- logout,
2335
- generateRandomString,
2336
- exposeInternalApiOnWindow,
2337
- InvokeFetchError,
2338
- EncodingError,
2339
- invokeFetch,
2340
- clearApiCache,
2341
- parseFetchResponse,
2342
- invoke_fetch_default,
2343
- auth_default
2333
+ logout
2344
2334
  };