@qlik/api 1.23.0 → 1.25.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 +1 -1
  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 +1 -1
  11. package/brands.js +2 -2
  12. package/chunks/{E5TLRYTH.js → 3DYV7KOJ.js} +2 -2
  13. package/chunks/{CUC5USM5.js → 6DEESTGF.js} +2 -2
  14. package/chunks/{3REGOC54.js → 6QRR5VUM.js} +2 -2
  15. package/chunks/7BDAXGID.js +116 -0
  16. package/chunks/{3W4PFUMC.js → BL5PJM4B.js} +1 -1
  17. package/chunks/{3KD5W26Z.js → CZC7KEJN.js} +3 -3
  18. package/chunks/{OCV75U5H.js → I5UOE4ZZ.js} +81 -77
  19. package/chunks/{UJV2QU2J.js → N3ZFICDU.js} +3 -3
  20. package/chunks/{VXEOAWM6.js → OIQ5ELGS.js} +1 -1
  21. package/chunks/{SMQGR3VM.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 +1 -1
  30. package/data-connections.js +2 -2
  31. package/data-credentials.d.ts +1 -1
  32. package/data-credentials.js +2 -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 +3 -3
  41. package/groups.js +2 -2
  42. package/identity-providers.d.ts +1 -1
  43. package/identity-providers.js +2 -2
  44. package/index.d.ts +11 -4
  45. package/index.js +89 -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 +3 -3
  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 +35 -2
  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 +5 -3
  63. package/reports.js +2 -2
  64. package/roles.d.ts +98 -4
  65. package/roles.js +28 -4
  66. package/spaces.d.ts +23 -23
  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 +1 -1
  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 +37 -61
  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
@@ -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();
@@ -1636,10 +1647,10 @@ async function fetchAndTransformExceptions(input, init) {
1636
1647
  try {
1637
1648
  return await fetch(input, init);
1638
1649
  } catch (e) {
1639
- return Promise.reject(new InvokeFetchError(getErrorMessage(e), 0, new Headers(), {}));
1650
+ return Promise.reject(new InvokeFetchError2(getErrorMessage(e), 0, new Headers(), {}));
1640
1651
  }
1641
1652
  }
1642
- async function performActualHttpFetch(method, completeUrl, unencodedBody, contentType, options, interceptors, authHeaders, credentials, userAgent) {
1653
+ async function performActualHttpFetch(method, completeUrl, unencodedBody, contentType, options, authHeaders, credentials, userAgent) {
1643
1654
  const { body, contentTypeHeader, requestOptions } = encodeBody(unencodedBody, contentType ?? "");
1644
1655
  const headers = {
1645
1656
  ...contentTypeHeader,
@@ -1651,12 +1662,13 @@ async function performActualHttpFetch(method, completeUrl, unencodedBody, conten
1651
1662
  headers["User-Agent"] = userAgent;
1652
1663
  }
1653
1664
  const isCrossOrigin = isHostCrossOrigin(options?.hostConfig);
1654
- let request = {
1665
+ const request = {
1655
1666
  method,
1656
1667
  credentials,
1657
1668
  mode: isCrossOrigin ? "cors" : "same-origin",
1658
1669
  headers,
1659
1670
  redirect: await isWindows(options?.hostConfig) ? "manual" : "follow",
1671
+ keepalive: options?.keepalive,
1660
1672
  body,
1661
1673
  // body data type must match "Content-Type" header
1662
1674
  ...requestOptions
@@ -1672,17 +1684,11 @@ async function performActualHttpFetch(method, completeUrl, unencodedBody, conten
1672
1684
  }, options.timeoutMs);
1673
1685
  request.signal = controller.signal;
1674
1686
  }
1675
- if (interceptors?.request.hasInterceptors()) {
1676
- request = await interceptors.request.apply(completeUrl, request);
1677
- }
1678
1687
  const fetchResponse = await fetchAndTransformExceptions(completeUrl, request);
1679
1688
  if (fetchTimeoutId) {
1680
1689
  clearTimeout(fetchTimeoutId);
1681
1690
  }
1682
- let invokeFetchResponse = await parseFetchResponse(fetchResponse, completeUrl);
1683
- if (interceptors?.response.hasInterceptors()) {
1684
- invokeFetchResponse = await interceptors.response.apply(invokeFetchResponse);
1685
- }
1691
+ const invokeFetchResponse = await parseFetchResponse(fetchResponse, completeUrl);
1686
1692
  return invokeFetchResponse;
1687
1693
  }
1688
1694
  function encodeBody(unencodedBody, contentType) {
@@ -1799,23 +1805,17 @@ async function getInvokeFetchUrlParams({
1799
1805
  const cacheKey = toCacheKey(url, queryString, serializeHostConfig(options?.hostConfig), options?.headers);
1800
1806
  return { completeUrl, cacheKey, authHeaders, credentials };
1801
1807
  }
1802
- function invokeFetchWithUrl(api, props, interceptors) {
1803
- return invokeFetchWithUrlAndRetry(
1804
- api,
1805
- props,
1806
- async () => {
1807
- const { cacheKey, authHeaders, credentials } = await getInvokeFetchUrlParams(props);
1808
- return invokeFetchWithUrlAndRetry(
1809
- api,
1810
- { ...props, cacheKey, authHeaders, credentials, options: { ...props.options, noCache: true } },
1811
- // don't cache the retry
1812
- void 0,
1813
- // only retry once
1814
- interceptors
1815
- );
1816
- },
1817
- interceptors
1818
- );
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
+ });
1819
1819
  }
1820
1820
  function invokeFetchWithUrlAndRetry(api, {
1821
1821
  method,
@@ -1827,7 +1827,7 @@ function invokeFetchWithUrlAndRetry(api, {
1827
1827
  credentials,
1828
1828
  contentType,
1829
1829
  userAgent
1830
- }, performRetry, interceptors) {
1830
+ }, performRetry) {
1831
1831
  if (!cache[api]) {
1832
1832
  cache[api] = {};
1833
1833
  }
@@ -1847,7 +1847,6 @@ function invokeFetchWithUrlAndRetry(api, {
1847
1847
  body,
1848
1848
  contentType,
1849
1849
  options,
1850
- interceptors,
1851
1850
  authHeaders,
1852
1851
  credentials,
1853
1852
  userAgent
@@ -1863,7 +1862,6 @@ function invokeFetchWithUrlAndRetry(api, {
1863
1862
  method,
1864
1863
  body,
1865
1864
  options,
1866
- interceptors,
1867
1865
  authHeaders,
1868
1866
  credentials
1869
1867
  );
@@ -1882,7 +1880,7 @@ function invokeFetchWithUrlAndRetry(api, {
1882
1880
  }
1883
1881
  return cloneResultPromise(resultPromiseAfterCacheClearing);
1884
1882
  }
1885
- function addPagingFunctions(api, value, method, body, options, interceptors, authHeaders, credentials) {
1883
+ function addPagingFunctions(api, value, method, body, options, authHeaders, credentials) {
1886
1884
  const serializedHostConfig = serializeHostConfig(options?.hostConfig);
1887
1885
  return value.then((resp) => {
1888
1886
  const dataWithPotentialLinks = resp.data;
@@ -1892,34 +1890,26 @@ function addPagingFunctions(api, value, method, body, options, interceptors, aut
1892
1890
  const prevUrl = dataWithPotentialLinks.links?.prev?.href;
1893
1891
  const nextUrl = dataWithPotentialLinks.links?.next?.href;
1894
1892
  if (prevUrl) {
1895
- resp.prev = (prevOptions) => invokeFetchWithUrl(
1896
- api,
1897
- {
1898
- method,
1899
- completeUrl: prevUrl,
1900
- body,
1901
- options: prevOptions || options,
1902
- cacheKey: toCacheKey(prevUrl, "", serializedHostConfig, options?.headers),
1903
- authHeaders,
1904
- credentials
1905
- },
1906
- interceptors
1907
- );
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
+ });
1908
1902
  }
1909
1903
  if (nextUrl) {
1910
- resp.next = (nextOptions) => invokeFetchWithUrl(
1911
- api,
1912
- {
1913
- method,
1914
- completeUrl: nextUrl,
1915
- body,
1916
- options: nextOptions || options,
1917
- cacheKey: toCacheKey(nextUrl, "", serializedHostConfig, options?.headers),
1918
- authHeaders,
1919
- credentials
1920
- },
1921
- interceptors
1922
- );
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
+ });
1923
1913
  }
1924
1914
  return resp;
1925
1915
  });
@@ -1991,7 +1981,7 @@ async function download(blob, filename) {
1991
1981
  }
1992
1982
 
1993
1983
  // src/invoke-fetch/invoke-fetch-error.ts
1994
- var InvokeFetchError = class extends Error {
1984
+ var InvokeFetchError2 = class extends Error {
1995
1985
  status;
1996
1986
  headers;
1997
1987
  data;
@@ -2037,6 +2027,15 @@ function cleanStack(stack) {
2037
2027
  // src/invoke-fetch/invoke-fetch-functions.ts
2038
2028
  var defaultUserAgent = "qmfe-api/latest";
2039
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) {
2040
2039
  checkForCrossDomainRequest(props.options?.hostConfig);
2041
2040
  let userAgent;
2042
2041
  if (props?.userAgent) {
@@ -2047,11 +2046,15 @@ async function invokeFetch(api, props, interceptors) {
2047
2046
  userAgent = defaultUserAgent;
2048
2047
  }
2049
2048
  const { completeUrl, cacheKey, authHeaders, credentials } = await getInvokeFetchUrlParams(props);
2050
- return invokeFetchWithUrl(
2051
- api,
2052
- { ...props, method: props.method.toUpperCase(), completeUrl, cacheKey, authHeaders, credentials, userAgent },
2053
- interceptors
2054
- );
2049
+ return invokeFetchWithUrl(api, {
2050
+ ...props,
2051
+ method: props.method.toUpperCase(),
2052
+ completeUrl,
2053
+ cacheKey,
2054
+ authHeaders,
2055
+ credentials,
2056
+ userAgent
2057
+ });
2055
2058
  }
2056
2059
  function clearApiCache(api) {
2057
2060
  clearApiCacheInternal(api);
@@ -2073,6 +2076,7 @@ async function parseFetchResponse(fetchResponse, url) {
2073
2076
  resultData = toDownloadableBlob(await fetchResponse.blob(), filename);
2074
2077
  } else {
2075
2078
  switch (contentType) {
2079
+ // Note: This list is by no means exhaustive, populate with more types as needed.
2076
2080
  case "image/png":
2077
2081
  case "image/jpeg":
2078
2082
  case "image/x-icon":
@@ -2098,10 +2102,10 @@ async function parseFetchResponse(fetchResponse, url) {
2098
2102
  const { status, statusText, headers } = fetchResponse;
2099
2103
  const errorMsg = `request to '${url}' failed with status ${status} ${statusText}.`;
2100
2104
  if (status >= 300) {
2101
- throw new InvokeFetchError(errorMsg, status, headers, resultData);
2105
+ throw new InvokeFetchError2(errorMsg, status, headers, resultData);
2102
2106
  }
2103
2107
  if (status === 0) {
2104
- throw new InvokeFetchError(errorMsg, 302, headers, resultData);
2108
+ throw new InvokeFetchError2(errorMsg, 302, headers, resultData);
2105
2109
  }
2106
2110
  const invokeFetchResponse = {
2107
2111
  status,
@@ -2141,7 +2145,7 @@ export {
2141
2145
  checkForCrossDomainRequest,
2142
2146
  logout,
2143
2147
  generateRandomString,
2144
- InvokeFetchError,
2148
+ InvokeFetchError2 as InvokeFetchError,
2145
2149
  EncodingError,
2146
2150
  invokeFetch,
2147
2151
  clearApiCache,
@@ -4,8 +4,8 @@ import {
4
4
  invokeFetch,
5
5
  isWindows,
6
6
  toValidWebsocketLocationUrl
7
- } from "./OCV75U5H.js";
8
- import "./7RHSSS4W.js";
7
+ } from "./I5UOE4ZZ.js";
8
+ import "./7BDAXGID.js";
9
9
  import {
10
10
  isBrowser
11
11
  } from "./2ZQ3ZX7F.js";
@@ -161,7 +161,7 @@ function listenForWindowsAuthenticationInformation(session) {
161
161
  return authSuggestedInWebsocket;
162
162
  }
163
163
  async function createAndSetupEnigmaSession(props, canRetry) {
164
- const { createEnigmaSession } = await import("./3REGOC54.js");
164
+ const { createEnigmaSession } = await import("./6QRR5VUM.js");
165
165
  const session = await createEnigmaSession(props);
166
166
  setupSessionListeners(session, props);
167
167
  let global;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getQixRuntimeModule
3
- } from "./3KD5W26Z.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 "./3KD5W26Z.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.23.0";
9
+ var defaultUserAgent = "qlik-api/1.25.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/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.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 = {
package/csp-origins.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/csp-origins.ts
package/data-assets.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 BatchIdDto = {
package/data-assets.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/data-assets.ts
@@ -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 ActionDeleteRequest = {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/data-connections.ts
@@ -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 ActionFilterOrphanRequest = {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/data-credentials.ts
package/data-files.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 BatchChangeSpaceItem = {
package/data-files.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/data-files.ts
package/docs/rest.md CHANGED
@@ -62,3 +62,50 @@ try {
62
62
  ## Caching
63
63
 
64
64
  Every GET request is cached so that subsequent calls to the same api will resolve immediately from the cache. Read more about caching [here](features.md#caching).
65
+
66
+ ## Rest Interceptors
67
+
68
+ Interceptors can be added to allow custom functionality to happen before or after an api call. They run globally always on every request. The format is:
69
+
70
+ ```ts
71
+ // the interceptor format
72
+ const interceptor = async (request, proceed) => {
73
+ // do things before the request
74
+ const result = await proceed(request);
75
+ // do things after the request
76
+ return result;
77
+ };
78
+ ```
79
+
80
+ > [!WARNING]
81
+ > Use Interceptors with caution. They affect every request made by the library and can introduce strange side effects that are hard to discover and debug.
82
+
83
+ #### Examples
84
+
85
+ ```ts
86
+ import { addInterceptor, removeInterceptor } from "@qlik/api/interceptors";
87
+
88
+ // add a logging interceptor, which logs all requests, responses and errors
89
+ addInterceptor(async (request, proceed) => {
90
+ try {
91
+ console.log("-->", request.method, request.pathTemplate, request.pathVariables, request.query, request.body);
92
+ const result = await proceed(request);
93
+ console.log("<--", result.data);
94
+ return result;
95
+ } catch (err) {
96
+ console.log("<-*", err);
97
+ throw err;
98
+ }
99
+ });
100
+
101
+ // add additional header to a request
102
+ const headerInterceptor = addInterceptor(async (request, proceed) => {
103
+ // make sure headers object exists
104
+ (request.options = request.options || {}).headers = request.options.headers || {};
105
+ request.options.headers["x-another-header"] = "foobarvalue";
106
+ return proceed(request);
107
+ });
108
+
109
+ // remove an interceptor
110
+ removeInterceptor(headerInterceptor);
111
+ ```
package/extensions.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
  /**
package/extensions.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/extensions.ts
package/glossaries.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
  /**
@@ -110,6 +110,8 @@ type Category = {
110
110
  readonly createdBy: string;
111
111
  description: string;
112
112
  glossaryId: string;
113
+ /** The id for resolving updates in future imports/updates.
114
+ * Opposed to the id of terms, id on category are not resolved by backend. Any category referred in the category array in terms will have to be identical to the id property of the category. If not, the category reference will be discarded. */
113
115
  id: string;
114
116
  name: string;
115
117
  parentId?: string;
@@ -121,9 +123,6 @@ type Category = {
121
123
  };
122
124
  type CreateCategory = {
123
125
  description?: string;
124
- /** The id for resolving updates in future imports/updates.
125
- * Opposed to the id of terms, id on category are not resolved by backend. Any category referred in the category array in terms will have to be identical to the id property of the category. If not, the category reference will be discarded. */
126
- id?: string;
127
126
  /** The name of the category. May not be identical to another category belonging to the same parent. */
128
127
  name?: string;
129
128
  parentId?: string;
package/glossaries.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/glossaries.ts
package/groups.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
  /**
@@ -108,8 +108,8 @@ type GroupPatch = {
108
108
  op: "replace";
109
109
  /** Attribute name of a field of the Groups entity. "Name" and "description" is only available for custom groups. */
110
110
  path: "assignedRoles" | "name" | "description";
111
- /** The roles to assign to the group (limit of 100 roles per group). */
112
- value: AssignedRolesRefIDs | AssignedRolesRefNames;
111
+ /** The roles to assign to the group (limit of 100 roles per group) or the new custom group name or description. */
112
+ value: AssignedRolesRefIDs | AssignedRolesRefNames | string;
113
113
  };
114
114
  /**
115
115
  * An array of JSON Patches for a group.
package/groups.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/groups.ts
@@ -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 BaseIDP = {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/SMQGR3VM.js";
5
- import "./chunks/3KD5W26Z.js";
4
+ } from "./chunks/UA6BE3VB.js";
5
+ import "./chunks/CZC7KEJN.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/identity-providers.ts