@qlik/api 1.18.0 → 1.20.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 (55) hide show
  1. package/api-keys.js +2 -2
  2. package/apps.js +2 -2
  3. package/audits.d.ts +14 -14
  4. package/audits.js +2 -2
  5. package/auth.d.ts +24 -1
  6. package/auth.js +2 -2
  7. package/automations.js +2 -2
  8. package/brands.js +2 -2
  9. package/chunks/{GLS4DAZ4.js → 4VH5O5UL.js} +1 -1
  10. package/chunks/{QLFOH4GP.js → 4XKAFB25.js} +19 -3
  11. package/chunks/{URFSYYRS.js → DT5F6REC.js} +1 -1
  12. package/chunks/{ZLPAS7FC.js → IMLCMV4X.js} +3 -3
  13. package/chunks/{H7WWFWBM.js → MP5FOM4F.js} +1 -1
  14. package/chunks/{GKEPTI44.js → MX5NVZPW.js} +11 -2
  15. package/chunks/{YEHZGXQV.js → OQWY73NC.js} +31 -6
  16. package/chunks/{2NXPFUPZ.js → T6AQ34ZJ.js} +2 -2
  17. package/chunks/{2B3EPESP.js → TEGSUED7.js} +3 -1
  18. package/chunks/{4FZ45I6G.js → Z37XXMYQ.js} +1 -1
  19. package/collections.js +2 -2
  20. package/csp-origins.js +2 -2
  21. package/data-assets.js +2 -2
  22. package/data-connections.js +2 -2
  23. package/data-credentials.js +2 -2
  24. package/data-files.js +2 -2
  25. package/docs/authentication.md +30 -1
  26. package/extensions.js +2 -2
  27. package/glossaries.js +2 -2
  28. package/groups.d.ts +24 -12
  29. package/groups.js +2 -2
  30. package/identity-providers.js +2 -2
  31. package/index.d.ts +47 -40
  32. package/index.js +189 -84
  33. package/items.js +2 -2
  34. package/licenses.d.ts +1 -1
  35. package/licenses.js +2 -2
  36. package/package.json +2 -2
  37. package/qix.d.ts +19 -8
  38. package/qix.js +6 -4
  39. package/quotas.js +2 -2
  40. package/reload-tasks.js +2 -2
  41. package/reloads.d.ts +1 -1
  42. package/reloads.js +2 -2
  43. package/reports.d.ts +2 -0
  44. package/reports.js +2 -2
  45. package/roles.js +2 -2
  46. package/spaces.js +2 -2
  47. package/temp-contents.js +2 -2
  48. package/tenants.js +2 -2
  49. package/themes.js +2 -2
  50. package/transports.js +2 -2
  51. package/users.d.ts +2 -0
  52. package/users.js +2 -2
  53. package/web-integrations.js +2 -2
  54. package/web-notifications.js +2 -2
  55. package/webhooks.js +2 -2
package/api-keys.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/api-keys.ts
package/apps.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/apps.ts
package/audits.d.ts CHANGED
@@ -101,7 +101,7 @@ type ListLinks = {
101
101
  self?: Href;
102
102
  };
103
103
  /**
104
- * Finds and returns the persisted audit events for the given tenant.
104
+ * Retrieves list of events for subscribed services for your tenant. Stores events for 90 days, after which they can be accessed via `/v1/audits/archive`.
105
105
  *
106
106
  * @param query an object with query parameters
107
107
  * @throws GetAuditsHttpError
@@ -109,7 +109,7 @@ type ListLinks = {
109
109
  declare const getAudits: (query: {
110
110
  /** The start/end time interval formatted in ISO 8601 to search by eventTime. For example, "?eventTime=2021-07-14T18:41:15.00Z/2021-07-14T18:41:15.99Z". */
111
111
  eventTime?: string;
112
- /** The case-sensitive string used to search by eventType. */
112
+ /** The case-sensitive string used to search by eventType. Retrieve a list of possible eventTypes with `/v1/audits/types`. */
113
113
  eventType?: string;
114
114
  /** The comma separated list of audit unique identifiers. */
115
115
  id?: string;
@@ -121,7 +121,7 @@ declare const getAudits: (query: {
121
121
  prev?: string;
122
122
  /** The property of a resource to sort on (default sort is -eventTime). The supported properties are source, eventType, and eventTime. A property must be prefixed by + or - to indicate ascending or descending sort order respectively. */
123
123
  sort?: string;
124
- /** The case-sensitive string used to search by source. */
124
+ /** The case-sensitive string used to search by source. Retrieve a list of possible sources with `/v1/audits/sources`. */
125
125
  source?: string;
126
126
  /** The case-sensitive string used to search by userId. */
127
127
  userId?: string;
@@ -139,7 +139,7 @@ type GetAuditsHttpError = {
139
139
  status: number;
140
140
  };
141
141
  /**
142
- * Finds and returns audit events from the archive, formatted as a JSON array, for the given date and tenant (in JWT).
142
+ * Retrieves audit events from long term storage. Finds and returns audit events from the archive, formatted as a JSON array, for the given date and tenant (in JWT). Archived events are not removed.
143
143
  *
144
144
  * @param query an object with query parameters
145
145
  * @throws GetArchivedAuditsHttpError
@@ -159,7 +159,7 @@ type GetArchivedAuditsHttpError = {
159
159
  status: number;
160
160
  };
161
161
  /**
162
- * It includes options that represent the server configuration state and parameters that were used to run the server with certain functionality.
162
+ * Returns the server configuration options. It includes options that represent the server configuration state and parameters that were used to run the server with certain functionality.
163
163
  *
164
164
  * @throws GetAuditsSettingsHttpError
165
165
  */
@@ -175,7 +175,7 @@ type GetAuditsSettingsHttpError = {
175
175
  status: number;
176
176
  };
177
177
  /**
178
- * Finds and returns the distinct list of unique event sources.
178
+ * Finds and returns the list of possible event sources for this tenant.
179
179
  *
180
180
  * @throws GetAuditSourcesHttpError
181
181
  */
@@ -193,7 +193,7 @@ type GetAuditSourcesHttpError = {
193
193
  status: number;
194
194
  };
195
195
  /**
196
- * Finds and returns the distinct list of unique event types.
196
+ * Finds and returns the list of possible event types for this tenant.
197
197
  *
198
198
  * @throws GetAuditTypesHttpError
199
199
  */
@@ -211,7 +211,7 @@ type GetAuditTypesHttpError = {
211
211
  status: number;
212
212
  };
213
213
  /**
214
- * Finds and returns the persisted audit events for the given tenant.
214
+ * Finds and returns a specific audit events for the given event ID.
215
215
  *
216
216
  * @param id The audit item's unique identifier.
217
217
  * @throws GetAuditHttpError
@@ -233,39 +233,39 @@ type GetAuditHttpError = {
233
233
  declare function clearCache(): void;
234
234
  interface AuditsAPI {
235
235
  /**
236
- * Finds and returns the persisted audit events for the given tenant.
236
+ * Retrieves list of events for subscribed services for your tenant. Stores events for 90 days, after which they can be accessed via `/v1/audits/archive`.
237
237
  *
238
238
  * @param query an object with query parameters
239
239
  * @throws GetAuditsHttpError
240
240
  */
241
241
  getAudits: typeof getAudits;
242
242
  /**
243
- * Finds and returns audit events from the archive, formatted as a JSON array, for the given date and tenant (in JWT).
243
+ * Retrieves audit events from long term storage. Finds and returns audit events from the archive, formatted as a JSON array, for the given date and tenant (in JWT). Archived events are not removed.
244
244
  *
245
245
  * @param query an object with query parameters
246
246
  * @throws GetArchivedAuditsHttpError
247
247
  */
248
248
  getArchivedAudits: typeof getArchivedAudits;
249
249
  /**
250
- * It includes options that represent the server configuration state and parameters that were used to run the server with certain functionality.
250
+ * Returns the server configuration options. It includes options that represent the server configuration state and parameters that were used to run the server with certain functionality.
251
251
  *
252
252
  * @throws GetAuditsSettingsHttpError
253
253
  */
254
254
  getAuditsSettings: typeof getAuditsSettings;
255
255
  /**
256
- * Finds and returns the distinct list of unique event sources.
256
+ * Finds and returns the list of possible event sources for this tenant.
257
257
  *
258
258
  * @throws GetAuditSourcesHttpError
259
259
  */
260
260
  getAuditSources: typeof getAuditSources;
261
261
  /**
262
- * Finds and returns the distinct list of unique event types.
262
+ * Finds and returns the list of possible event types for this tenant.
263
263
  *
264
264
  * @throws GetAuditTypesHttpError
265
265
  */
266
266
  getAuditTypes: typeof getAuditTypes;
267
267
  /**
268
- * Finds and returns the persisted audit events for the given tenant.
268
+ * Finds and returns a specific audit events for the given event ID.
269
269
  *
270
270
  * @param id The audit item's unique identifier.
271
271
  * @throws GetAuditHttpError
package/audits.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/audits.ts
package/auth.d.ts CHANGED
@@ -18,13 +18,36 @@ declare function logout(): void;
18
18
  * @param hostConfig the default HostConfig to use
19
19
  */
20
20
  declare function setDefaultHostConfig(hostConfig: HostConfig | undefined): void;
21
+ /**
22
+ * Returns an access token using the supplied host config. Typically used on the backend to supply the access token to the frontend
23
+ */
21
24
  declare function getAccessToken({ hostConfig }: {
22
25
  hostConfig?: HostConfig;
23
26
  }): Promise<string>;
27
+ /**
28
+ * The AuthApi interface provides the public interface for the auth module.
29
+ */
30
+ interface AuthAPI {
31
+ /**
32
+ * Registers an auth module that can handle authentication. An auth module is used by specifying its name as authType in the HostConfig passed in to api calls.
33
+ * @param name the name of the module
34
+ * @param authModule the implementation of the AuthModule interface
35
+ */
36
+ registerAuthModule: typeof registerAuthModule;
37
+ /**
38
+ * Sets the default host config that will be used for all qmfe api calls that do not include a host config
39
+ * @param hostConfig the default HostConfig to use
40
+ */
41
+ setDefaultHostConfig: typeof setDefaultHostConfig;
42
+ /**
43
+ * Returns an access token using the supplied host config. Typically used on the backend to supply the access token to the frontend
44
+ */
45
+ getAccessToken: typeof getAccessToken;
46
+ }
24
47
  declare const _default: {
25
48
  registerAuthModule: typeof registerAuthModule;
26
49
  setDefaultHostConfig: typeof setDefaultHostConfig;
27
50
  getAccessToken: typeof getAccessToken;
28
51
  };
29
52
 
30
- export { AuthModule, AuthType, HostConfig, _default as default, getAccessToken, logout, registerAuthModule, setDefaultHostConfig };
53
+ export { type AuthAPI, AuthModule, AuthType, HostConfig, _default as default, getAccessToken, logout, registerAuthModule, setDefaultHostConfig };
package/auth.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  logout,
5
5
  registerAuthModule,
6
6
  setDefaultHostConfig
7
- } from "./chunks/H7WWFWBM.js";
8
- import "./chunks/ZLPAS7FC.js";
7
+ } from "./chunks/MP5FOM4F.js";
8
+ import "./chunks/IMLCMV4X.js";
9
9
  export {
10
10
  auth_default as default,
11
11
  getAccessToken,
package/automations.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/automations.ts
package/brands.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/brands.ts
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@qlik+runtime-module-loader@1.0.10/node_modules/@qlik/runtime-module-loader/dist/index.js
1
+ // node_modules/.pnpm/@qlik+runtime-module-loader@1.0.11/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);
@@ -4,7 +4,7 @@ import {
4
4
  invokeFetch,
5
5
  isWindows,
6
6
  toValidWebsocketLocationUrl
7
- } from "./YEHZGXQV.js";
7
+ } from "./OQWY73NC.js";
8
8
  import {
9
9
  isBrowser
10
10
  } from "./2ZQ3ZX7F.js";
@@ -145,7 +145,7 @@ function listenForWindowsAuthenticationInformation(session) {
145
145
  return authSuggestedInWebsocket;
146
146
  }
147
147
  async function createAndSetupEnigmaSession(props, canRetry) {
148
- const { createEnigmaSession } = await import("./4FZ45I6G.js");
148
+ const { createEnigmaSession } = await import("./Z37XXMYQ.js");
149
149
  const session = await createEnigmaSession(props);
150
150
  setupSessionListeners(session, props);
151
151
  let global;
@@ -684,7 +684,23 @@ var qix = {
684
684
  onWebSocketEvent,
685
685
  onCombinedWebSocketStateChange,
686
686
  resumeSuspendedSessions,
687
- resumeOnlyOnReattach
687
+ resumeOnlyOnReattach,
688
+ withHostConfig: (hostConfig) => ({
689
+ addInitialAppAction: (openAppSessionProps, action) => addInitialAppAction(
690
+ typeof openAppSessionProps === "string" ? { hostConfig, appId: openAppSessionProps } : { hostConfig, ...openAppSessionProps },
691
+ action
692
+ ),
693
+ createSessionApp,
694
+ openAppSession: (openAppSessionProps) => openAppSession(
695
+ typeof openAppSessionProps === "string" ? { hostConfig, appId: openAppSessionProps } : { hostConfig, ...openAppSessionProps }
696
+ ),
697
+ registerExternalAppSession,
698
+ useAppHook,
699
+ onWebSocketEvent,
700
+ onCombinedWebSocketStateChange,
701
+ resumeSuspendedSessions,
702
+ resumeOnlyOnReattach
703
+ })
688
704
  };
689
705
  var qix_default = qix;
690
706
  export {
@@ -5,7 +5,7 @@ import {
5
5
  invokeFetch,
6
6
  invoke_fetch_default,
7
7
  parseFetchResponse
8
- } from "./YEHZGXQV.js";
8
+ } from "./OQWY73NC.js";
9
9
  import "./2ZQ3ZX7F.js";
10
10
  export {
11
11
  EncodingError,
@@ -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("./2B3EPESP.js") : import("./GLS4DAZ4.js").then(
4
+ return isNode ? import("./TEGSUED7.js") : import("./4VH5O5UL.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("./QLFOH4GP.js") : import("./GLS4DAZ4.js").then(
11
+ return isNode ? import("./4XKAFB25.js") : import("./4VH5O5UL.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("./URFSYYRS.js") : import("./GLS4DAZ4.js").then(
18
+ return isNode ? import("./DT5F6REC.js") : import("./4VH5O5UL.js").then(
19
19
  (mod) => mod.importRuntimeModule("invoke-fetch@v1", hostConfig)
20
20
  );
21
21
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getAuthRuntimeModule
3
- } from "./ZLPAS7FC.js";
3
+ } from "./IMLCMV4X.js";
4
4
 
5
5
  // src/public/auth.ts
6
6
  function registerAuthModule(name, authModule) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getQixRuntimeModule
3
- } from "./ZLPAS7FC.js";
3
+ } from "./IMLCMV4X.js";
4
4
 
5
5
  // src/public/qix.ts
6
6
  function openAppSession(appSessionProps) {
@@ -47,12 +47,21 @@ function openAppSession(appSessionProps) {
47
47
  };
48
48
  return appSessionProxy;
49
49
  }
50
+ function withHostConfig(hostConfig) {
51
+ return {
52
+ openAppSession: (openAppSessionProps) => openAppSession(
53
+ typeof openAppSessionProps === "string" ? { hostConfig, appId: openAppSessionProps } : { hostConfig, ...openAppSessionProps }
54
+ )
55
+ };
56
+ }
50
57
  var qix = {
51
- openAppSession
58
+ openAppSession,
59
+ withHostConfig
52
60
  };
53
61
  var qix_default = qix;
54
62
 
55
63
  export {
56
64
  openAppSession,
65
+ withHostConfig,
57
66
  qix_default
58
67
  };
@@ -341,6 +341,10 @@ function registerAuthModule2(name, authModule) {
341
341
  function setDefaultHostConfig2(hostConfig) {
342
342
  setDefaultHostConfig(hostConfig);
343
343
  }
344
+ function serializeHostConfig(hostConfig) {
345
+ const hostConfigToUse = withDefaultHostConfig(hostConfig);
346
+ return JSON.stringify(hostConfigToUse, hostConfigPropertyIgnorer);
347
+ }
344
348
  function checkForCrossDomainRequest(hostConfig) {
345
349
  const hostConfigToUse = withDefaultHostConfig(hostConfig);
346
350
  if (isHostCrossOrigin(hostConfigToUse)) {
@@ -368,6 +372,19 @@ function normalizeInbandAuthError({ errorBody, status }) {
368
372
  function normalizeAuthModuleError(err) {
369
373
  return { message: err.message || "Unknown error" };
370
374
  }
375
+ function hostConfigPropertyIgnorer(key, value) {
376
+ if (key === "") {
377
+ return value;
378
+ }
379
+ if (key === "authType") {
380
+ return void 0;
381
+ }
382
+ const vtype = typeof value;
383
+ if (vtype === "object" || vtype === "function") {
384
+ return void 0;
385
+ }
386
+ return value;
387
+ }
371
388
 
372
389
  // src/random/random.ts
373
390
  import { customAlphabet, nanoid } from "nanoid";
@@ -1398,7 +1415,7 @@ function applyPathVariables(pathTemplate, pathVariables) {
1398
1415
  }
1399
1416
  return result2;
1400
1417
  }
1401
- function toCacheKey(url, query, headers) {
1418
+ function toCacheKey(url, query, serializedHostConfig, headers) {
1402
1419
  let cacheKey = url;
1403
1420
  if (query !== "") {
1404
1421
  cacheKey = cacheKey.concat(`?${query}`);
@@ -1406,6 +1423,9 @@ function toCacheKey(url, query, headers) {
1406
1423
  if (headers) {
1407
1424
  cacheKey = cacheKey.concat(`+headers=${JSON.stringify(headers)}`);
1408
1425
  }
1426
+ if (serializedHostConfig) {
1427
+ cacheKey = cacheKey.concat(`+host-config=${serializedHostConfig}`);
1428
+ }
1409
1429
  return cacheKey;
1410
1430
  }
1411
1431
  function toCompleteUrl(url, query) {
@@ -1675,7 +1695,7 @@ async function getInvokeFetchUrlParams({
1675
1695
  const url = locationUrl + applyPathVariables(pathTemplate, pathVariables);
1676
1696
  const queryString = encodeQueryParams({ ...query, ...authQueryParams });
1677
1697
  const completeUrl = toCompleteUrl(url, queryString);
1678
- const cacheKey = toCacheKey(url, queryString, options?.headers);
1698
+ const cacheKey = toCacheKey(url, queryString, serializeHostConfig(options?.hostConfig), options?.headers);
1679
1699
  return { completeUrl, cacheKey, authHeaders, credentials };
1680
1700
  }
1681
1701
  function invokeFetchWithUrl(api, props, interceptors) {
@@ -1686,7 +1706,8 @@ function invokeFetchWithUrl(api, props, interceptors) {
1686
1706
  const { cacheKey, authHeaders, credentials } = await getInvokeFetchUrlParams(props);
1687
1707
  return invokeFetchWithUrlAndRetry(
1688
1708
  api,
1689
- { ...props, cacheKey, authHeaders, credentials },
1709
+ { ...props, cacheKey, authHeaders, credentials, options: { ...props.options, noCache: true } },
1710
+ // don't cache the retry
1690
1711
  void 0,
1691
1712
  // only retry once
1692
1713
  interceptors
@@ -1761,6 +1782,7 @@ function invokeFetchWithUrlAndRetry(api, {
1761
1782
  return cloneResultPromise(resultPromiseAfterCacheClearing);
1762
1783
  }
1763
1784
  function addPagingFunctions(api, value, method, body, options, interceptors, authHeaders, credentials) {
1785
+ const serializedHostConfig = serializeHostConfig(options?.hostConfig);
1764
1786
  return value.then((resp) => {
1765
1787
  const dataWithPotentialLinks = resp.data;
1766
1788
  if (!dataWithPotentialLinks) {
@@ -1776,7 +1798,7 @@ function addPagingFunctions(api, value, method, body, options, interceptors, aut
1776
1798
  completeUrl: prevUrl,
1777
1799
  body,
1778
1800
  options: prevOptions || options,
1779
- cacheKey: toCacheKey(prevUrl, "", options?.headers),
1801
+ cacheKey: toCacheKey(prevUrl, "", serializedHostConfig, options?.headers),
1780
1802
  authHeaders,
1781
1803
  credentials
1782
1804
  },
@@ -1791,7 +1813,7 @@ function addPagingFunctions(api, value, method, body, options, interceptors, aut
1791
1813
  completeUrl: nextUrl,
1792
1814
  body,
1793
1815
  options: nextOptions || options,
1794
- cacheKey: toCacheKey(nextUrl, "", options?.headers),
1816
+ cacheKey: toCacheKey(nextUrl, "", serializedHostConfig, options?.headers),
1795
1817
  authHeaders,
1796
1818
  credentials
1797
1819
  },
@@ -1861,7 +1883,9 @@ async function download(blob, filename) {
1861
1883
  window.URL.revokeObjectURL(blobUrl);
1862
1884
  } else {
1863
1885
  const { writeFileSync } = await import("fs");
1864
- writeFileSync(filename, Buffer.from(await blob.arrayBuffer()));
1886
+ const arrayBuffer = await blob.arrayBuffer();
1887
+ const uint8Array = new Uint8Array(arrayBuffer);
1888
+ writeFileSync(filename, uint8Array);
1865
1889
  }
1866
1890
  }
1867
1891
 
@@ -2011,6 +2035,7 @@ export {
2011
2035
  getAccessToken,
2012
2036
  registerAuthModule2 as registerAuthModule,
2013
2037
  setDefaultHostConfig2 as setDefaultHostConfig,
2038
+ serializeHostConfig,
2014
2039
  checkForCrossDomainRequest,
2015
2040
  logout,
2016
2041
  generateRandomString,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getInvokeFetchRuntimeModule
3
- } from "./ZLPAS7FC.js";
3
+ } from "./IMLCMV4X.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.18.0";
9
+ var defaultUserAgent = "qlik-api/1.20.0";
10
10
  async function invokeFetch(api, props) {
11
11
  const hostConfig = props.options?.hostConfig;
12
12
  let userAgent;
@@ -14,11 +14,12 @@ import {
14
14
  isWindows,
15
15
  logout,
16
16
  registerAuthModule,
17
+ serializeHostConfig,
17
18
  setDefaultHostConfig,
18
19
  toValidEnigmaLocationUrl,
19
20
  toValidLocationUrl,
20
21
  toValidWebsocketLocationUrl
21
- } from "./YEHZGXQV.js";
22
+ } from "./OQWY73NC.js";
22
23
  import "./2ZQ3ZX7F.js";
23
24
  export {
24
25
  AuthorizationError,
@@ -36,6 +37,7 @@ export {
36
37
  isWindows,
37
38
  logout,
38
39
  registerAuthModule,
40
+ serializeHostConfig,
39
41
  setDefaultHostConfig,
40
42
  toValidEnigmaLocationUrl,
41
43
  toValidLocationUrl,
@@ -4,7 +4,7 @@ import {
4
4
  getRestCallAuthParams,
5
5
  getWebSocketAuthParams,
6
6
  toValidWebsocketLocationUrl
7
- } from "./YEHZGXQV.js";
7
+ } from "./OQWY73NC.js";
8
8
  import {
9
9
  isBrowser,
10
10
  isNode
package/collections.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/collections.ts
package/csp-origins.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/csp-origins.ts
package/data-assets.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/data-assets.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/data-connections.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/data-credentials.ts
package/data-files.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/data-files.ts
@@ -27,7 +27,7 @@ const { data: mySpaces } = spaces.getSpaces();
27
27
  console.log(mySpaces);
28
28
  ```
29
29
 
30
- A host config can also be passed in to every single api request which then will override any default host config previously set.
30
+ A host config can also be passed in to every single api request which then will override any default host config previously set. This way multiple host configs can be used if needed.
31
31
 
32
32
  ```ts
33
33
  import spaces from "@qlik/api/spaces";
@@ -45,6 +45,35 @@ const { data: mySpaces } = spaces.getSpaces({}, {
45
45
  console.log(mySpaces);
46
46
  ```
47
47
 
48
+ ### Binding an instance of `@qlik/api` to a specific host config
49
+
50
+ As an alternative to the methods above it is also possible to create an instance of `@qlik/api` bound to a specific host config. This allows users to use several host configs in their solutions and easily separate them by having seperate `@qlik/api` instances.
51
+
52
+ Example:
53
+
54
+ ```ts
55
+ import { createQlikApi } from "@qlik-trial/qmfe-api";
56
+
57
+ const api = createQlikApi({
58
+ authType: "apikey"
59
+ host: "my-org.region.qlikcloud.com", // a qlikcloud tenant
60
+ apiKey: "<api-key>",
61
+ });
62
+
63
+ // "api" now has the full @qlik/api bound to one specific hostconfig
64
+ const { data: mySpaces } = api.spaces.getSpaces();
65
+
66
+ // create another api with a different auth mechanism
67
+ const apiToOtherTenant = createQlikApi({
68
+ authType: "oauth2"
69
+ host: "my-other-tenant.region.qlikcloud.com", // a qlikcloud tenant
70
+ clientId: "<client-id>",
71
+ });
72
+
73
+ // "apiToOtherTenant" is now bound to another hostconfig
74
+ const { data: myOtherSpaces } = apiToOtherTenant.spaces.getSpaces();
75
+ ```
76
+
48
77
  ## The Auth Module
49
78
 
50
79
  An auth module in `@qlik/api` is an object with a few implemented methods. When connecting to Qlik Cloud Services (or Qlik Sense Enterprise for Windows) with `@qlik/api` or with `@qlik/embed` libraries an auth module is used for configuring the communication.
package/extensions.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/extensions.ts
package/glossaries.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/2NXPFUPZ.js";
5
- import "./chunks/ZLPAS7FC.js";
4
+ } from "./chunks/T6AQ34ZJ.js";
5
+ import "./chunks/IMLCMV4X.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/glossaries.ts