@qlik/api 1.22.0 → 1.24.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 (84) hide show
  1. package/api-keys.d.ts +6 -2
  2. package/api-keys.js +2 -2
  3. package/apps.d.ts +10 -2
  4. package/apps.js +2 -2
  5. package/audits.d.ts +4 -16
  6. package/audits.js +2 -2
  7. package/auth.js +2 -2
  8. package/automations.d.ts +2 -59
  9. package/automations.js +3 -19
  10. package/brands.d.ts +23 -23
  11. package/brands.js +2 -2
  12. package/chunks/{GZRY5VHW.js → 3DYV7KOJ.js} +2 -2
  13. package/chunks/{SEBN4KFZ.js → 6DEESTGF.js} +2 -2
  14. package/chunks/{PR52AAWU.js → 6QRR5VUM.js} +36 -32
  15. package/chunks/7BDAXGID.js +116 -0
  16. package/chunks/{TGDZVKG2.js → BL5PJM4B.js} +1 -1
  17. package/chunks/{SNQHDUYY.js → CZC7KEJN.js} +3 -3
  18. package/chunks/{OEVNZ5IQ.js → I5UOE4ZZ.js} +90 -85
  19. package/chunks/{KBR7JBWC.js → N3ZFICDU.js} +38 -24
  20. package/chunks/{VHPC6L7L.js → OIQ5ELGS.js} +1 -1
  21. package/chunks/{TUPLQG25.js → UA6BE3VB.js} +2 -2
  22. package/chunks/{EUWNVVK5.js → VX3MQBE7.js} +1 -1
  23. package/collections.d.ts +1 -1
  24. package/collections.js +2 -2
  25. package/csp-origins.d.ts +1 -1
  26. package/csp-origins.js +2 -2
  27. package/data-assets.d.ts +1 -1
  28. package/data-assets.js +2 -2
  29. package/data-connections.d.ts +2 -2
  30. package/data-connections.js +2 -2
  31. package/data-credentials.d.ts +64 -2
  32. package/data-credentials.js +11 -2
  33. package/data-files.d.ts +1 -1
  34. package/data-files.js +2 -2
  35. package/docs/rest.md +47 -0
  36. package/extensions.d.ts +1 -1
  37. package/extensions.js +2 -2
  38. package/glossaries.d.ts +3 -4
  39. package/glossaries.js +2 -2
  40. package/groups.d.ts +1 -1
  41. package/groups.js +2 -2
  42. package/identity-providers.d.ts +17 -17
  43. package/identity-providers.js +2 -2
  44. package/index.d.ts +11 -4
  45. package/index.js +90 -79
  46. package/interceptors.d.ts +51 -0
  47. package/interceptors.js +17 -0
  48. package/{global.types-qsBNouXJ.d.ts → invoke-fetch-types-BLrpeZOL.d.ts} +81 -48
  49. package/items.d.ts +1 -1
  50. package/items.js +2 -2
  51. package/licenses.d.ts +3 -1
  52. package/licenses.js +2 -2
  53. package/package.json +2 -2
  54. package/qix.d.ts +6 -3
  55. package/qix.js +2 -2
  56. package/quotas.d.ts +1 -1
  57. package/quotas.js +2 -2
  58. package/reload-tasks.d.ts +1 -1
  59. package/reload-tasks.js +2 -2
  60. package/reloads.d.ts +1 -1
  61. package/reloads.js +2 -2
  62. package/reports.d.ts +42 -4
  63. package/reports.js +2 -2
  64. package/roles.d.ts +98 -4
  65. package/roles.js +28 -4
  66. package/spaces.d.ts +3 -1
  67. package/spaces.js +2 -2
  68. package/temp-contents.d.ts +5 -5
  69. package/temp-contents.js +2 -2
  70. package/tenants.d.ts +25 -16
  71. package/tenants.js +2 -2
  72. package/themes.d.ts +1 -1
  73. package/themes.js +2 -2
  74. package/transports.d.ts +1 -1
  75. package/transports.js +2 -2
  76. package/users.d.ts +4 -39
  77. package/users.js +2 -9
  78. package/web-integrations.d.ts +1 -1
  79. package/web-integrations.js +2 -2
  80. package/web-notifications.d.ts +1 -1
  81. package/web-notifications.js +2 -2
  82. package/webhooks.d.ts +1 -1
  83. package/webhooks.js +2 -2
  84. package/chunks/7RHSSS4W.js +0 -0
@@ -0,0 +1,116 @@
1
+ import {
2
+ isBrowser
3
+ } from "./2ZQ3ZX7F.js";
4
+
5
+ // src/interceptors/interceptors.ts
6
+ var GLOBAL_INTERCEPTORS;
7
+ function createInterceptors() {
8
+ const startingInterceptors = GLOBAL_INTERCEPTORS?.getInterceptors() || [];
9
+ const interceptors2 = [...startingInterceptors];
10
+ return {
11
+ /**
12
+ * Adds an interceptor to the global interceptor stack
13
+ * Returns the newly added interceptor
14
+ * @param interceptor the interceptor to add
15
+ * @returns the newly added interceptor
16
+ */
17
+ addInterceptor: (interceptor) => {
18
+ interceptors2.push(interceptor);
19
+ return interceptor;
20
+ },
21
+ /**
22
+ * Removes an interceptor from the global interceptor stack
23
+ * Returns null if the interceptor was not found
24
+ * @param interceptor the interceptor remove
25
+ * @returns the removed interceptor or null if not found
26
+ */
27
+ removeInterceptor: (interceptor) => {
28
+ const index = interceptors2.indexOf(interceptor);
29
+ let removed;
30
+ if (index !== -1) {
31
+ removed = interceptors2.splice(index, 1)[0];
32
+ }
33
+ return removed || null;
34
+ },
35
+ /**
36
+ * Gets all registered interceptors
37
+ */
38
+ getInterceptors: () => interceptors2
39
+ };
40
+ }
41
+ var addDefaultInterceptorsRun = false;
42
+ function addDefaultInterceptors() {
43
+ if (addDefaultInterceptorsRun) {
44
+ return;
45
+ }
46
+ if (isBrowser()) {
47
+ const readFlagsFromUrlQuery = () => {
48
+ const params = new URLSearchParams(window.location.search);
49
+ const featuresParam = params.get("features");
50
+ if (!featuresParam) {
51
+ return {};
52
+ }
53
+ const features = featuresParam.split(",").map((item) => item.trim());
54
+ const urlFeatures = features.reduce(
55
+ (map, obj) => {
56
+ const value = !obj.startsWith("!");
57
+ const key = value ? obj : obj.substring(1);
58
+ map[key] = value;
59
+ return map;
60
+ },
61
+ {}
62
+ );
63
+ return urlFeatures;
64
+ };
65
+ const readFlagsFromLocalStorage = () => {
66
+ try {
67
+ const featuresParam = localStorage.getItem("qcs-features");
68
+ if (featuresParam) {
69
+ return JSON.parse(featuresParam);
70
+ }
71
+ return {};
72
+ } catch {
73
+ return {};
74
+ }
75
+ };
76
+ const flagsFromUrl = readFlagsFromUrlQuery();
77
+ const flagsFromLocalStorage = readFlagsFromLocalStorage();
78
+ const interceptor = async (request, proceed) => {
79
+ let resultPromise;
80
+ if (request.pathTemplate === "/api/v1/features") {
81
+ resultPromise = proceed(request);
82
+ const result = await resultPromise;
83
+ return { ...result, data: { ...result.data || {}, ...flagsFromLocalStorage, ...flagsFromUrl } };
84
+ }
85
+ return proceed(request);
86
+ };
87
+ GLOBAL_INTERCEPTORS.addInterceptor(interceptor);
88
+ }
89
+ addDefaultInterceptorsRun = true;
90
+ }
91
+ GLOBAL_INTERCEPTORS = createInterceptors();
92
+ function addInterceptor(interceptor) {
93
+ return GLOBAL_INTERCEPTORS.addInterceptor(interceptor);
94
+ }
95
+ function removeInterceptor(interceptor) {
96
+ return GLOBAL_INTERCEPTORS.removeInterceptor(interceptor);
97
+ }
98
+ function getInterceptors() {
99
+ return GLOBAL_INTERCEPTORS.getInterceptors();
100
+ }
101
+ var interceptors = {
102
+ addInterceptor,
103
+ removeInterceptor,
104
+ getInterceptors,
105
+ createInterceptors
106
+ };
107
+ var interceptors_default = interceptors;
108
+
109
+ export {
110
+ createInterceptors,
111
+ addDefaultInterceptors,
112
+ addInterceptor,
113
+ removeInterceptor,
114
+ getInterceptors,
115
+ interceptors_default
116
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getAuthRuntimeModule
3
- } from "./SNQHDUYY.js";
3
+ } from "./CZC7KEJN.js";
4
4
 
5
5
  // src/public/auth.ts
6
6
  function registerAuthModule(name, authModule) {
@@ -1,21 +1,21 @@
1
1
  // src/public/public-runtime-modules.ts
2
2
  function getAuthRuntimeModule(hostConfig) {
3
3
  const isNode = !!globalThis.process?.argv;
4
- return isNode ? import("./SEBN4KFZ.js") : import("./EUWNVVK5.js").then(
4
+ return isNode ? import("./6DEESTGF.js") : import("./VX3MQBE7.js").then(
5
5
  (mod) => mod.importRuntimeModule("auth@v1", hostConfig)
6
6
  );
7
7
  }
8
8
  async function getQixRuntimeModule(hostConfig) {
9
9
  await getAuthRuntimeModule(hostConfig);
10
10
  const isNode = !!globalThis.process?.argv;
11
- return isNode ? import("./KBR7JBWC.js") : import("./EUWNVVK5.js").then(
11
+ return isNode ? import("./N3ZFICDU.js") : import("./VX3MQBE7.js").then(
12
12
  (mod) => mod.importRuntimeModule("qix@v1", hostConfig)
13
13
  );
14
14
  }
15
15
  async function getInvokeFetchRuntimeModule(hostConfig) {
16
16
  await getAuthRuntimeModule(hostConfig);
17
17
  const isNode = !!globalThis.process?.argv;
18
- return isNode ? import("./GZRY5VHW.js") : import("./EUWNVVK5.js").then(
18
+ return isNode ? import("./3DYV7KOJ.js") : import("./VX3MQBE7.js").then(
19
19
  (mod) => mod.importRuntimeModule("invoke-fetch@v1", hostConfig)
20
20
  );
21
21
  }
@@ -1,3 +1,6 @@
1
+ import {
2
+ getInterceptors
3
+ } from "./7BDAXGID.js";
1
4
  import {
2
5
  isBrowser,
3
6
  isNode
@@ -1142,19 +1145,27 @@ async function getCsrfToken(hostConfig, noCache) {
1142
1145
  pathTemplate = "/api/v1/csrf-token";
1143
1146
  }
1144
1147
  const fetchCsrfToken = async () => {
1145
- const res = await invokeFetch("csrf-token", {
1146
- method: "get",
1147
- pathTemplate,
1148
- options: {
1149
- hostConfig,
1150
- noCache: true
1148
+ try {
1149
+ const res = await invokeFetch("csrf-token", {
1150
+ method: "get",
1151
+ pathTemplate,
1152
+ options: {
1153
+ hostConfig,
1154
+ noCache: true
1155
+ }
1156
+ });
1157
+ const csrfToken = res.headers.get(QLIK_CSRF_TOKEN);
1158
+ if (!csrfToken) {
1159
+ return "";
1151
1160
  }
1152
- });
1153
- const csrfToken = res.headers.get(QLIK_CSRF_TOKEN);
1154
- if (!csrfToken) {
1155
- return "";
1161
+ return csrfToken;
1162
+ } catch (e) {
1163
+ const error = e;
1164
+ if (error.status === 404) {
1165
+ return "";
1166
+ }
1167
+ throw e;
1156
1168
  }
1157
- return csrfToken;
1158
1169
  };
1159
1170
  if (noCache) {
1160
1171
  csrfTokens[locationUrl] = fetchCsrfToken();
@@ -1403,10 +1414,10 @@ function getXrfKey(hostConfig) {
1403
1414
  }
1404
1415
 
1405
1416
  // src/auth/internal/default-auth-modules/windows-cookie.ts
1406
- function getRestCallAuthParams7({
1417
+ async function getRestCallAuthParams7({
1407
1418
  hostConfig
1408
1419
  }) {
1409
- return Promise.resolve({
1420
+ return {
1410
1421
  headers: {
1411
1422
  "X-Qlik-XrfKey": getXrfKey(hostConfig)
1412
1423
  },
@@ -1414,16 +1425,17 @@ function getRestCallAuthParams7({
1414
1425
  xrfkey: getXrfKey(hostConfig)
1415
1426
  },
1416
1427
  credentials: getCredentialsForCookieAuth(hostConfig)
1417
- });
1428
+ };
1418
1429
  }
1419
- function getWebSocketAuthParams7({
1430
+ async function getWebSocketAuthParams7({
1420
1431
  hostConfig
1421
1432
  }) {
1422
- return Promise.resolve({
1433
+ return {
1423
1434
  queryParams: {
1424
- xrfkey: getXrfKey(hostConfig)
1435
+ xrfkey: getXrfKey(hostConfig),
1436
+ "qlik-csrf-token": await getCsrfToken(hostConfig, true)
1425
1437
  }
1426
- });
1438
+ };
1427
1439
  }
1428
1440
  async function handleAuthenticationError7({
1429
1441
  hostConfig
@@ -1635,10 +1647,10 @@ async function fetchAndTransformExceptions(input, init) {
1635
1647
  try {
1636
1648
  return await fetch(input, init);
1637
1649
  } catch (e) {
1638
- return Promise.reject(new InvokeFetchError(getErrorMessage(e), 0, new Headers(), {}));
1650
+ return Promise.reject(new InvokeFetchError2(getErrorMessage(e), 0, new Headers(), {}));
1639
1651
  }
1640
1652
  }
1641
- async function performActualHttpFetch(method, completeUrl, unencodedBody, contentType, options, interceptors, authHeaders, credentials, userAgent) {
1653
+ async function performActualHttpFetch(method, completeUrl, unencodedBody, contentType, options, authHeaders, credentials, userAgent) {
1642
1654
  const { body, contentTypeHeader, requestOptions } = encodeBody(unencodedBody, contentType ?? "");
1643
1655
  const headers = {
1644
1656
  ...contentTypeHeader,
@@ -1650,12 +1662,13 @@ async function performActualHttpFetch(method, completeUrl, unencodedBody, conten
1650
1662
  headers["User-Agent"] = userAgent;
1651
1663
  }
1652
1664
  const isCrossOrigin = isHostCrossOrigin(options?.hostConfig);
1653
- let request = {
1665
+ const request = {
1654
1666
  method,
1655
1667
  credentials,
1656
1668
  mode: isCrossOrigin ? "cors" : "same-origin",
1657
1669
  headers,
1658
1670
  redirect: await isWindows(options?.hostConfig) ? "manual" : "follow",
1671
+ keepalive: options?.keepalive,
1659
1672
  body,
1660
1673
  // body data type must match "Content-Type" header
1661
1674
  ...requestOptions
@@ -1671,17 +1684,11 @@ async function performActualHttpFetch(method, completeUrl, unencodedBody, conten
1671
1684
  }, options.timeoutMs);
1672
1685
  request.signal = controller.signal;
1673
1686
  }
1674
- if (interceptors?.request.hasInterceptors()) {
1675
- request = await interceptors.request.apply(completeUrl, request);
1676
- }
1677
1687
  const fetchResponse = await fetchAndTransformExceptions(completeUrl, request);
1678
1688
  if (fetchTimeoutId) {
1679
1689
  clearTimeout(fetchTimeoutId);
1680
1690
  }
1681
- let invokeFetchResponse = await parseFetchResponse(fetchResponse, completeUrl);
1682
- if (interceptors?.response.hasInterceptors()) {
1683
- invokeFetchResponse = await interceptors.response.apply(invokeFetchResponse);
1684
- }
1691
+ const invokeFetchResponse = await parseFetchResponse(fetchResponse, completeUrl);
1685
1692
  return invokeFetchResponse;
1686
1693
  }
1687
1694
  function encodeBody(unencodedBody, contentType) {
@@ -1798,23 +1805,17 @@ async function getInvokeFetchUrlParams({
1798
1805
  const cacheKey = toCacheKey(url, queryString, serializeHostConfig(options?.hostConfig), options?.headers);
1799
1806
  return { completeUrl, cacheKey, authHeaders, credentials };
1800
1807
  }
1801
- function invokeFetchWithUrl(api, props, interceptors) {
1802
- return invokeFetchWithUrlAndRetry(
1803
- api,
1804
- props,
1805
- async () => {
1806
- const { cacheKey, authHeaders, credentials } = await getInvokeFetchUrlParams(props);
1807
- return invokeFetchWithUrlAndRetry(
1808
- api,
1809
- { ...props, cacheKey, authHeaders, credentials, options: { ...props.options, noCache: true } },
1810
- // don't cache the retry
1811
- void 0,
1812
- // only retry once
1813
- interceptors
1814
- );
1815
- },
1816
- interceptors
1817
- );
1808
+ function invokeFetchWithUrl(api, props) {
1809
+ return invokeFetchWithUrlAndRetry(api, props, async () => {
1810
+ const { cacheKey, authHeaders, credentials } = await getInvokeFetchUrlParams(props);
1811
+ return invokeFetchWithUrlAndRetry(
1812
+ api,
1813
+ { ...props, cacheKey, authHeaders, credentials, options: { ...props.options, noCache: true } },
1814
+ // don't cache the retry
1815
+ void 0
1816
+ // only retry once
1817
+ );
1818
+ });
1818
1819
  }
1819
1820
  function invokeFetchWithUrlAndRetry(api, {
1820
1821
  method,
@@ -1826,7 +1827,7 @@ function invokeFetchWithUrlAndRetry(api, {
1826
1827
  credentials,
1827
1828
  contentType,
1828
1829
  userAgent
1829
- }, performRetry, interceptors) {
1830
+ }, performRetry) {
1830
1831
  if (!cache[api]) {
1831
1832
  cache[api] = {};
1832
1833
  }
@@ -1846,7 +1847,6 @@ function invokeFetchWithUrlAndRetry(api, {
1846
1847
  body,
1847
1848
  contentType,
1848
1849
  options,
1849
- interceptors,
1850
1850
  authHeaders,
1851
1851
  credentials,
1852
1852
  userAgent
@@ -1862,7 +1862,6 @@ function invokeFetchWithUrlAndRetry(api, {
1862
1862
  method,
1863
1863
  body,
1864
1864
  options,
1865
- interceptors,
1866
1865
  authHeaders,
1867
1866
  credentials
1868
1867
  );
@@ -1881,7 +1880,7 @@ function invokeFetchWithUrlAndRetry(api, {
1881
1880
  }
1882
1881
  return cloneResultPromise(resultPromiseAfterCacheClearing);
1883
1882
  }
1884
- function addPagingFunctions(api, value, method, body, options, interceptors, authHeaders, credentials) {
1883
+ function addPagingFunctions(api, value, method, body, options, authHeaders, credentials) {
1885
1884
  const serializedHostConfig = serializeHostConfig(options?.hostConfig);
1886
1885
  return value.then((resp) => {
1887
1886
  const dataWithPotentialLinks = resp.data;
@@ -1891,34 +1890,26 @@ function addPagingFunctions(api, value, method, body, options, interceptors, aut
1891
1890
  const prevUrl = dataWithPotentialLinks.links?.prev?.href;
1892
1891
  const nextUrl = dataWithPotentialLinks.links?.next?.href;
1893
1892
  if (prevUrl) {
1894
- resp.prev = (prevOptions) => invokeFetchWithUrl(
1895
- api,
1896
- {
1897
- method,
1898
- completeUrl: prevUrl,
1899
- body,
1900
- options: prevOptions || options,
1901
- cacheKey: toCacheKey(prevUrl, "", serializedHostConfig, options?.headers),
1902
- authHeaders,
1903
- credentials
1904
- },
1905
- interceptors
1906
- );
1893
+ resp.prev = (prevOptions) => invokeFetchWithUrl(api, {
1894
+ method,
1895
+ completeUrl: prevUrl,
1896
+ body,
1897
+ options: prevOptions || options,
1898
+ cacheKey: toCacheKey(prevUrl, "", serializedHostConfig, options?.headers),
1899
+ authHeaders,
1900
+ credentials
1901
+ });
1907
1902
  }
1908
1903
  if (nextUrl) {
1909
- resp.next = (nextOptions) => invokeFetchWithUrl(
1910
- api,
1911
- {
1912
- method,
1913
- completeUrl: nextUrl,
1914
- body,
1915
- options: nextOptions || options,
1916
- cacheKey: toCacheKey(nextUrl, "", serializedHostConfig, options?.headers),
1917
- authHeaders,
1918
- credentials
1919
- },
1920
- interceptors
1921
- );
1904
+ resp.next = (nextOptions) => invokeFetchWithUrl(api, {
1905
+ method,
1906
+ completeUrl: nextUrl,
1907
+ body,
1908
+ options: nextOptions || options,
1909
+ cacheKey: toCacheKey(nextUrl, "", serializedHostConfig, options?.headers),
1910
+ authHeaders,
1911
+ credentials
1912
+ });
1922
1913
  }
1923
1914
  return resp;
1924
1915
  });
@@ -1990,7 +1981,7 @@ async function download(blob, filename) {
1990
1981
  }
1991
1982
 
1992
1983
  // src/invoke-fetch/invoke-fetch-error.ts
1993
- var InvokeFetchError = class extends Error {
1984
+ var InvokeFetchError2 = class extends Error {
1994
1985
  status;
1995
1986
  headers;
1996
1987
  data;
@@ -2036,6 +2027,15 @@ function cleanStack(stack) {
2036
2027
  // src/invoke-fetch/invoke-fetch-functions.ts
2037
2028
  var defaultUserAgent = "qmfe-api/latest";
2038
2029
  async function invokeFetch(api, props, interceptors) {
2030
+ interceptors = interceptors || getInterceptors();
2031
+ const invokeFetchFinal = (reqeust) => invokeFetchIntercepted(api, reqeust);
2032
+ const withInterceptors = (interceptors || []).reduce(
2033
+ (proceed, interceptor) => (request) => interceptor(request, proceed),
2034
+ invokeFetchFinal
2035
+ );
2036
+ return withInterceptors(props);
2037
+ }
2038
+ async function invokeFetchIntercepted(api, props) {
2039
2039
  checkForCrossDomainRequest(props.options?.hostConfig);
2040
2040
  let userAgent;
2041
2041
  if (props?.userAgent) {
@@ -2046,11 +2046,15 @@ async function invokeFetch(api, props, interceptors) {
2046
2046
  userAgent = defaultUserAgent;
2047
2047
  }
2048
2048
  const { completeUrl, cacheKey, authHeaders, credentials } = await getInvokeFetchUrlParams(props);
2049
- return invokeFetchWithUrl(
2050
- api,
2051
- { ...props, method: props.method.toUpperCase(), completeUrl, cacheKey, authHeaders, credentials, userAgent },
2052
- interceptors
2053
- );
2049
+ return invokeFetchWithUrl(api, {
2050
+ ...props,
2051
+ method: props.method.toUpperCase(),
2052
+ completeUrl,
2053
+ cacheKey,
2054
+ authHeaders,
2055
+ credentials,
2056
+ userAgent
2057
+ });
2054
2058
  }
2055
2059
  function clearApiCache(api) {
2056
2060
  clearApiCacheInternal(api);
@@ -2072,6 +2076,7 @@ async function parseFetchResponse(fetchResponse, url) {
2072
2076
  resultData = toDownloadableBlob(await fetchResponse.blob(), filename);
2073
2077
  } else {
2074
2078
  switch (contentType) {
2079
+ // Note: This list is by no means exhaustive, populate with more types as needed.
2075
2080
  case "image/png":
2076
2081
  case "image/jpeg":
2077
2082
  case "image/x-icon":
@@ -2079,6 +2084,7 @@ async function parseFetchResponse(fetchResponse, url) {
2079
2084
  case "application/octet-stream":
2080
2085
  case "application/zip":
2081
2086
  case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
2087
+ case "application/pdf":
2082
2088
  resultData = toDownloadableBlob(await fetchResponse.blob());
2083
2089
  break;
2084
2090
  case "text/event-stream":
@@ -2096,10 +2102,10 @@ async function parseFetchResponse(fetchResponse, url) {
2096
2102
  const { status, statusText, headers } = fetchResponse;
2097
2103
  const errorMsg = `request to '${url}' failed with status ${status} ${statusText}.`;
2098
2104
  if (status >= 300) {
2099
- throw new InvokeFetchError(errorMsg, status, headers, resultData);
2105
+ throw new InvokeFetchError2(errorMsg, status, headers, resultData);
2100
2106
  }
2101
2107
  if (status === 0) {
2102
- throw new InvokeFetchError(errorMsg, 302, headers, resultData);
2108
+ throw new InvokeFetchError2(errorMsg, 302, headers, resultData);
2103
2109
  }
2104
2110
  const invokeFetchResponse = {
2105
2111
  status,
@@ -2139,12 +2145,11 @@ export {
2139
2145
  checkForCrossDomainRequest,
2140
2146
  logout,
2141
2147
  generateRandomString,
2142
- InvokeFetchError,
2148
+ InvokeFetchError2 as InvokeFetchError,
2143
2149
  EncodingError,
2144
2150
  invokeFetch,
2145
2151
  clearApiCache,
2146
2152
  parseFetchResponse,
2147
2153
  invoke_fetch_default,
2148
- getCsrfToken,
2149
2154
  auth_default
2150
2155
  };
@@ -4,8 +4,8 @@ import {
4
4
  invokeFetch,
5
5
  isWindows,
6
6
  toValidWebsocketLocationUrl
7
- } from "./OEVNZ5IQ.js";
8
- import "./7RHSSS4W.js";
7
+ } from "./I5UOE4ZZ.js";
8
+ import "./7BDAXGID.js";
9
9
  import {
10
10
  isBrowser
11
11
  } from "./2ZQ3ZX7F.js";
@@ -88,7 +88,8 @@ function toGlobalAppSessionId({
88
88
  hostConfig,
89
89
  withoutData,
90
90
  useReloadEngine,
91
- ttlSeconds
91
+ ttlSeconds,
92
+ workloadType
92
93
  }) {
93
94
  const locationUrl = toValidWebsocketLocationUrl(hostConfig);
94
95
  let url = `${locationUrl}/${appId}`;
@@ -104,6 +105,9 @@ function toGlobalAppSessionId({
104
105
  if (withoutData) {
105
106
  url += "/withoutData";
106
107
  }
108
+ if (workloadType) {
109
+ url += `?workloadType=${workloadType}`;
110
+ }
107
111
  return url;
108
112
  }
109
113
  async function runPendingInitialActions(initialActionsForApp, sharedSession, doc) {
@@ -114,7 +118,7 @@ async function runPendingInitialActions(initialActionsForApp, sharedSession, doc
114
118
  }
115
119
  }
116
120
  }
117
- async function addInitialSharedSessionCreationAction(openAppSessionProps, action) {
121
+ function addInitialSharedSessionCreationAction(openAppSessionProps, action) {
118
122
  const key = toGlobalAppSessionId(openAppSessionProps);
119
123
  let initialActionArray = initialActions[key];
120
124
  if (!initialActionArray) {
@@ -123,11 +127,18 @@ async function addInitialSharedSessionCreationAction(openAppSessionProps, action
123
127
  initialActionArray.push(action);
124
128
  const existingSharedSession = sharedSessions[key];
125
129
  if (existingSharedSession) {
126
- const doc = await existingSharedSession.docPromise;
127
- if (doc) {
128
- runPendingInitialActions(initialActionArray, existingSharedSession, doc);
129
- }
130
+ existingSharedSession.docPromise.then((doc) => {
131
+ if (doc) {
132
+ runPendingInitialActions(initialActionArray, existingSharedSession, doc);
133
+ }
134
+ });
130
135
  }
136
+ return () => {
137
+ const index = initialActionArray.indexOf(action);
138
+ if (index > -1) {
139
+ initialActionArray.splice(index, 1);
140
+ }
141
+ };
131
142
  }
132
143
  function listenForWindowsAuthenticationInformation(session) {
133
144
  let resolveAuthSuggestedInWebsocket;
@@ -150,7 +161,7 @@ function listenForWindowsAuthenticationInformation(session) {
150
161
  return authSuggestedInWebsocket;
151
162
  }
152
163
  async function createAndSetupEnigmaSession(props, canRetry) {
153
- const { createEnigmaSession } = await import("./PR52AAWU.js");
164
+ const { createEnigmaSession } = await import("./6QRR5VUM.js");
154
165
  const session = await createEnigmaSession(props);
155
166
  setupSessionListeners(session, props);
156
167
  let global;
@@ -444,7 +455,18 @@ function resumeShouldRejectPromiseIfNotReattached(bool) {
444
455
  }
445
456
  async function checkConnectivity(hostConfig) {
446
457
  let status = "online";
447
- const catchFunc = (err) => {
458
+ const method = "get";
459
+ const options = {
460
+ hostConfig,
461
+ timeoutMs: 4e3,
462
+ noCache: true
463
+ };
464
+ try {
465
+ const result = await invokeFetch("", { method, pathTemplate: "/api/v1/user-locale", options });
466
+ if (!result.headers.get("content-type")?.includes("application/json")) {
467
+ status = "unauthorized";
468
+ }
469
+ } catch (err) {
448
470
  const fetchErr = err;
449
471
  switch (fetchErr.status) {
450
472
  case 0:
@@ -454,16 +476,7 @@ async function checkConnectivity(hostConfig) {
454
476
  status = "unauthorized";
455
477
  break;
456
478
  }
457
- };
458
- const method = "get";
459
- const options = {
460
- hostConfig,
461
- timeoutMs: 2e3,
462
- noCache: true
463
- };
464
- const fetchRoot = invokeFetch("", { method, pathTemplate: "", options }).catch(catchFunc);
465
- const fetchMe = invokeFetch("", { method, pathTemplate: "/api/v1/users/me", options }).catch(catchFunc);
466
- await Promise.all([fetchRoot, fetchMe]);
479
+ }
467
480
  return Promise.resolve(status);
468
481
  }
469
482
  async function sessionResumeWithRetry(session, hostConfig) {
@@ -571,15 +584,16 @@ function getExternalSession(externalApp, appSessionProps) {
571
584
  }
572
585
 
573
586
  // src/qix/qix-functions.ts
574
- async function createSessionApp(ttlSeconds) {
587
+ async function createSessionApp(ttlSeconds, workloadType) {
575
588
  let sharedSession;
576
589
  if ((await getPlatform()).isCloud) {
577
- sharedSession = await getOrCreateSharedSession({ appId: `SessionApp_${Date.now()}`, ttlSeconds });
590
+ sharedSession = await getOrCreateSharedSession({ appId: `SessionApp_${Date.now()}`, ttlSeconds, workloadType });
578
591
  } else {
579
592
  sharedSession = await getOrCreateSharedSession({
580
593
  appId: `%3Ftransient%3D/identity/${Date.now()}`,
581
594
  useSessionApp: true,
582
- ttlSeconds
595
+ ttlSeconds,
596
+ workloadType
583
597
  });
584
598
  }
585
599
  let alreadyClosed = false;
@@ -663,7 +677,7 @@ function useAppHook(react) {
663
677
  };
664
678
  }
665
679
  function addInitialAppAction(openAppSessionProps, action) {
666
- addInitialSharedSessionCreationAction(openAppSessionProps, action);
680
+ return addInitialSharedSessionCreationAction(openAppSessionProps, action);
667
681
  }
668
682
  function onWebSocketEvent(fn) {
669
683
  return globalOnWebSocketEvent(fn);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getQixRuntimeModule
3
- } from "./SNQHDUYY.js";
3
+ } from "./CZC7KEJN.js";
4
4
 
5
5
  // src/public/qix.ts
6
6
  function openAppSession(appSessionProps) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getInvokeFetchRuntimeModule
3
- } from "./SNQHDUYY.js";
3
+ } from "./CZC7KEJN.js";
4
4
  import {
5
5
  isBrowser
6
6
  } from "./2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/invoke-fetch.ts
9
- var defaultUserAgent = "qlik-api/1.22.0";
9
+ var defaultUserAgent = "qlik-api/1.24.0";
10
10
  async function invokeFetch(api, props) {
11
11
  const hostConfig = props.options?.hostConfig;
12
12
  let userAgent;
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@qlik+runtime-module-loader@1.0.13/node_modules/@qlik/runtime-module-loader/dist/index.js
1
+ // node_modules/.pnpm/@qlik+runtime-module-loader@1.0.14/node_modules/@qlik/runtime-module-loader/dist/index.js
2
2
  window.__qlikMainPrivateResolvers = window.__qlikMainPrivateResolvers || {};
3
3
  window.__qlikMainPrivateResolvers.mainUrlPromise = window.__qlikMainPrivateResolvers.mainUrlPromise || new Promise((resolve) => {
4
4
  window.__qlikMainPrivateResolvers.resolveMainJsUrl = (value) => resolve(value);
package/collections.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ApiCallOptions } from './global.types-qsBNouXJ.js';
1
+ import { A as ApiCallOptions } from './invoke-fetch-types-BLrpeZOL.js';
2
2
  import './auth-types-PkN9CAF_.js';
3
3
 
4
4
  type CollectionByIdPatch = {
package/collections.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/TUPLQG25.js";
5
- import "./chunks/SNQHDUYY.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/collections.ts
package/csp-origins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ApiCallOptions } from './global.types-qsBNouXJ.js';
1
+ import { A as ApiCallOptions } from './invoke-fetch-types-BLrpeZOL.js';
2
2
  import './auth-types-PkN9CAF_.js';
3
3
 
4
4
  type CSPEntry = {