@qlik/api 1.16.0 → 1.17.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 (79) hide show
  1. package/api-keys.d.ts +31 -27
  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 +1 -1
  6. package/audits.js +2 -2
  7. package/auth.js +2 -2
  8. package/automations.d.ts +1 -1
  9. package/automations.js +2 -2
  10. package/brands.d.ts +1 -1
  11. package/brands.js +2 -2
  12. package/chunks/{MFNOHOWH.js → 5W53XSXH.js} +2 -2
  13. package/chunks/{O3XVX7VQ.js → 6MPNTVLD.js} +1 -1
  14. package/chunks/{6O3XBOLZ.js → AVML2WPM.js} +1 -1
  15. package/chunks/{TBHMVTOT.js → GLS4DAZ4.js} +1 -1
  16. package/chunks/{3XRP5N4L.js → HFUVFYT4.js} +69 -49
  17. package/chunks/{GXMVBX45.js → JBH4H34J.js} +1 -1
  18. package/chunks/{ECWQX4IH.js → NJFCE5EM.js} +1 -1
  19. package/chunks/{7IMOYFWE.js → NJRTJEAQ.js} +3 -3
  20. package/chunks/{PESPSFQN.js → RWQS4ASJ.js} +1 -1
  21. package/chunks/{YHKRUQRS.js → S5OMX5JT.js} +69 -9
  22. package/collections.d.ts +1 -1
  23. package/collections.js +2 -2
  24. package/csp-origins.d.ts +1 -1
  25. package/csp-origins.js +2 -2
  26. package/data-assets.d.ts +1 -1
  27. package/data-assets.js +2 -2
  28. package/data-connections.d.ts +1 -1
  29. package/data-connections.js +2 -2
  30. package/data-credentials.d.ts +1 -1
  31. package/data-credentials.js +2 -2
  32. package/data-files.d.ts +273 -75
  33. package/data-files.js +2 -2
  34. package/extensions.d.ts +1 -1
  35. package/extensions.js +2 -2
  36. package/{global.types-z1p6A9D-.d.ts → global.types-BU2Yugjm.d.ts} +3 -0
  37. package/glossaries.d.ts +1 -1
  38. package/glossaries.js +2 -2
  39. package/groups.d.ts +1 -1
  40. package/groups.js +2 -2
  41. package/identity-providers.d.ts +1 -1
  42. package/identity-providers.js +2 -2
  43. package/index.d.ts +1 -1
  44. package/index.js +4 -4
  45. package/items.d.ts +1 -1
  46. package/items.js +2 -2
  47. package/licenses.d.ts +1 -1
  48. package/licenses.js +2 -2
  49. package/package.json +2 -2
  50. package/qix.d.ts +2 -2
  51. package/qix.js +2 -2
  52. package/quotas.d.ts +1 -1
  53. package/quotas.js +2 -2
  54. package/reload-tasks.d.ts +11 -11
  55. package/reload-tasks.js +2 -2
  56. package/reloads.d.ts +3 -3
  57. package/reloads.js +2 -2
  58. package/reports.d.ts +4 -2
  59. package/reports.js +2 -2
  60. package/roles.d.ts +1 -1
  61. package/roles.js +2 -2
  62. package/spaces.d.ts +1 -1
  63. package/spaces.js +2 -2
  64. package/temp-contents.d.ts +1 -1
  65. package/temp-contents.js +2 -2
  66. package/tenants.d.ts +1 -1
  67. package/tenants.js +2 -2
  68. package/themes.d.ts +1 -1
  69. package/themes.js +2 -2
  70. package/transports.d.ts +1 -1
  71. package/transports.js +2 -2
  72. package/users.d.ts +1 -1
  73. package/users.js +2 -2
  74. package/web-integrations.d.ts +1 -1
  75. package/web-integrations.js +2 -2
  76. package/web-notifications.d.ts +1 -1
  77. package/web-notifications.js +2 -2
  78. package/webhooks.d.ts +1 -1
  79. package/webhooks.js +2 -2
package/api-keys.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ApiCallOptions } from './global.types-z1p6A9D-.js';
1
+ import { A as ApiCallOptions } from './global.types-BU2Yugjm.js';
2
2
  import './auth-types-BU5EGt_9.js';
3
3
 
4
4
  type ApiKey = {
@@ -16,7 +16,7 @@ type ApiKey = {
16
16
  readonly lastUpdated?: string;
17
17
  /** The status of the API key. */
18
18
  status: "active" | "expired" | "revoked";
19
- /** The ID of the subject for the API key. For SCIM the format is `SCIM\\{{IDP-ID}}`, where `{{IDP-ID}}` is the ID of the IDP in Qlik. */
19
+ /** The ID of the subject for the API key. For SCIM the format is `SCIM\\{{IDP-ID}}`, where `{{IDP-ID}}` is the ID of the IDP in Qlik. For users, use their user ID, e.g. `64ef645a3b7009d55dee5a2b`. */
20
20
  sub: string;
21
21
  /** Type of the subject. For SCIM, it should be `externalClient`. */
22
22
  subType: "user" | "externalClient";
@@ -26,11 +26,11 @@ type ApiKey = {
26
26
  type ApiKeyBody = {
27
27
  /** Text that describes the API key. */
28
28
  description: string;
29
- /** The expiry of the API key, in ISO8601 duration format. */
29
+ /** The expiry of the API key, in ISO8601 duration format. For example, `P7D` sets expiry after 7 days. If not provided, defaults to the maximum API key or SCIM key expiry configured in the tenant. */
30
30
  expiry?: string;
31
- /** The ID of the subject for the API key. For SCIM the format is `SCIM\\{{IDP-ID}}`, where `{{IDP-ID}}` is the ID of the IDP in Qlik. */
31
+ /** The ID of the subject for the API key. For SCIM the format is `SCIM\\{{IDP-ID}}`, where `{{IDP-ID}}` is the ID of the IDP in Qlik. When creating an API key for a user, this is their user ID, e.g. `64ef645a3b7009d55dee5a2b`, and will default to the requesting user if not provided. User must be assigned the `Developer` role. */
32
32
  sub?: string;
33
- /** Type of the subject. For SCIM, it should be `externalClient`. */
33
+ /** Type of the subject. For SCIM, it should be `externalClient`. If not specified, defaults to `user`. */
34
34
  subType?: "user" | "externalClient";
35
35
  };
36
36
  /**
@@ -40,7 +40,7 @@ type ApiKeyConfigPatch = {
40
40
  /** The operation to be performed. */
41
41
  op: "replace";
42
42
  /** The path for the given resource field to patch. */
43
- path: "/api_keys_enabled" | "/max_api_key_expiry" | "/max_keys_per_user";
43
+ path: "/api_keys_enabled" | "/max_api_key_expiry" | "/max_keys_per_user" | "/scim_externalClient_expiry";
44
44
  /** The value to be used for this operation. */
45
45
  value: unknown;
46
46
  };
@@ -80,12 +80,14 @@ type ApiKeyWithToken = {
80
80
  token: string;
81
81
  };
82
82
  type ApiKeysConfig = {
83
- /** Enables or disables API key functionality for the specified tenant. */
83
+ /** Enables or disables user API key functionality for the specified tenant. */
84
84
  api_keys_enabled?: boolean;
85
- /** The maximum lifetime, in ISO8601 duration format, for which an API key can be issued for the specified tenant. */
85
+ /** The maximum lifetime, in ISO8601 duration format, for which an API key can be issued for the specified tenant, e.g. `P7D` for 7 days. */
86
86
  max_api_key_expiry?: string;
87
87
  /** The maximum number of active API keys that any user can create for the specified tenant. */
88
88
  max_keys_per_user?: number;
89
+ /** The expiry of the scim `externalClient` token in ISO8601 duration format, e.g. `P365D` for 365 days. Used during the creation of an `externalClient` API key for configuring a SCIM compatible Identity Provider. */
90
+ scim_externalClient_expiry?: string;
89
91
  };
90
92
  type ApiKeysConfigPatchSchema = ApiKeyConfigPatch[];
91
93
  type ApiKeysPatchSchema = ApiKeyPatch[];
@@ -130,7 +132,7 @@ type ApiKeyPage = {
130
132
  };
131
133
  };
132
134
  /**
133
- * Lists API keys for a given tenant ID.
135
+ * Lists API keys for the tenant. To list API keys owned by other users, requesting user must be assigned the `TenantAdmin` role.
134
136
  *
135
137
  * @param query an object with query parameters
136
138
  * @throws GetApiKeysHttpError
@@ -148,7 +150,7 @@ declare const getApiKeys: (query: {
148
150
  startingAfter?: string;
149
151
  /** The status of the API key. */
150
152
  status?: "active" | "expired" | "revoked";
151
- /** The ID of the subject. */
153
+ /** The ID of the subject. For SCIM the format is `SCIM\\{{IDP-ID}}`, where `{{IDP-ID}}` is the ID of the IDP in Qlik. For users, use their user ID, e.g. `64ef645a3b7009d55dee5a2b`. */
152
154
  sub?: string;
153
155
  }, options?: ApiCallOptions) => Promise<GetApiKeysHttpResponse>;
154
156
  type GetApiKeysHttpResponse = {
@@ -164,7 +166,8 @@ type GetApiKeysHttpError = {
164
166
  status: number;
165
167
  };
166
168
  /**
167
- * Creates an API key resource.
169
+ * Creates an API key, either for a user, or for configuring SCIM for a compatible Identity Provider.
170
+ * Sending `sub` and `subType` is required only for creating SCIM keys.
168
171
  *
169
172
  * @param body an object with the body content
170
173
  * @throws CreateApiKeyHttpError
@@ -181,9 +184,9 @@ type CreateApiKeyHttpError = {
181
184
  status: number;
182
185
  };
183
186
  /**
184
- * Gets the API keys configuration for a given tenant ID.
187
+ * Retrieves the API key configuration for a tenant.
185
188
  *
186
- * @param tenantId The tenant ID of the API keys configuration to be retrieved.
189
+ * @param tenantId The tenant ID from which you wish to retrieve the API key configuration.
187
190
  * @throws GetApiKeysConfigHttpError
188
191
  */
189
192
  declare const getApiKeysConfig: (tenantId: string, options?: ApiCallOptions) => Promise<GetApiKeysConfigHttpResponse>;
@@ -216,9 +219,9 @@ type PatchApiKeysConfigHttpError = {
216
219
  status: number;
217
220
  };
218
221
  /**
219
- * When the owner of the API key sends the request, the key will be removed. When a TenantAdmin sends the request, the key will be revoked.
222
+ * Deletes or revokes an API key for a given API key ID. When the owner of the API key sends the request, the key will be deleted and removed from the tenant. When a user assigned the `TenantAdmin` role sends the request, the key will be disabled and marked as revoked.
220
223
  *
221
- * @param id The ID of the API key resource to be retrieved.
224
+ * @param id The ID of the API key to be retrieved.
222
225
  * @throws DeleteApiKeyHttpError
223
226
  */
224
227
  declare const deleteApiKey: (id: string, options?: ApiCallOptions) => Promise<DeleteApiKeyHttpResponse>;
@@ -233,9 +236,9 @@ type DeleteApiKeyHttpError = {
233
236
  status: number;
234
237
  };
235
238
  /**
236
- * Gets the API key for a given ID.
239
+ * Returns the API key for a given API key ID.
237
240
  *
238
- * @param id The ID of the API key resource to be retrieved.
241
+ * @param id The ID of the API key to be retrieved.
239
242
  * @throws GetApiKeyHttpError
240
243
  */
241
244
  declare const getApiKey: (id: string, options?: ApiCallOptions) => Promise<GetApiKeyHttpResponse>;
@@ -250,7 +253,7 @@ type GetApiKeyHttpError = {
250
253
  status: number;
251
254
  };
252
255
  /**
253
- * Updates an API key for a given ID.
256
+ * Updates an API key description for a given API key ID.
254
257
  *
255
258
  * @param id The ID of the API key resource to be updated.
256
259
  * @param body an object with the body content
@@ -273,23 +276,24 @@ type PatchApiKeyHttpError = {
273
276
  declare function clearCache(): void;
274
277
  interface ApiKeysAPI {
275
278
  /**
276
- * Lists API keys for a given tenant ID.
279
+ * Lists API keys for the tenant. To list API keys owned by other users, requesting user must be assigned the `TenantAdmin` role.
277
280
  *
278
281
  * @param query an object with query parameters
279
282
  * @throws GetApiKeysHttpError
280
283
  */
281
284
  getApiKeys: typeof getApiKeys;
282
285
  /**
283
- * Creates an API key resource.
286
+ * Creates an API key, either for a user, or for configuring SCIM for a compatible Identity Provider.
287
+ * Sending `sub` and `subType` is required only for creating SCIM keys.
284
288
  *
285
289
  * @param body an object with the body content
286
290
  * @throws CreateApiKeyHttpError
287
291
  */
288
292
  createApiKey: typeof createApiKey;
289
293
  /**
290
- * Gets the API keys configuration for a given tenant ID.
294
+ * Retrieves the API key configuration for a tenant.
291
295
  *
292
- * @param tenantId The tenant ID of the API keys configuration to be retrieved.
296
+ * @param tenantId The tenant ID from which you wish to retrieve the API key configuration.
293
297
  * @throws GetApiKeysConfigHttpError
294
298
  */
295
299
  getApiKeysConfig: typeof getApiKeysConfig;
@@ -302,21 +306,21 @@ interface ApiKeysAPI {
302
306
  */
303
307
  patchApiKeysConfig: typeof patchApiKeysConfig;
304
308
  /**
305
- * When the owner of the API key sends the request, the key will be removed. When a TenantAdmin sends the request, the key will be revoked.
309
+ * Deletes or revokes an API key for a given API key ID. When the owner of the API key sends the request, the key will be deleted and removed from the tenant. When a user assigned the `TenantAdmin` role sends the request, the key will be disabled and marked as revoked.
306
310
  *
307
- * @param id The ID of the API key resource to be retrieved.
311
+ * @param id The ID of the API key to be retrieved.
308
312
  * @throws DeleteApiKeyHttpError
309
313
  */
310
314
  deleteApiKey: typeof deleteApiKey;
311
315
  /**
312
- * Gets the API key for a given ID.
316
+ * Returns the API key for a given API key ID.
313
317
  *
314
- * @param id The ID of the API key resource to be retrieved.
318
+ * @param id The ID of the API key to be retrieved.
315
319
  * @throws GetApiKeyHttpError
316
320
  */
317
321
  getApiKey: typeof getApiKey;
318
322
  /**
319
- * Updates an API key for a given ID.
323
+ * Updates an API key description for a given API key ID.
320
324
  *
321
325
  * @param id The ID of the API key resource to be updated.
322
326
  * @param body an object with the body content
package/api-keys.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/MFNOHOWH.js";
5
- import "./chunks/7IMOYFWE.js";
4
+ } from "./chunks/5W53XSXH.js";
5
+ import "./chunks/NJRTJEAQ.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/api-keys.ts
package/apps.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ApiCallOptions, D as DownloadableBlob } from './global.types-z1p6A9D-.js';
1
+ import { A as ApiCallOptions, D as DownloadableBlob } from './global.types-BU2Yugjm.js';
2
2
  import './auth-types-BU5EGt_9.js';
3
3
 
4
4
  type Analysis = "breakdown" | "changePoint" | "comparison" | "contribution" | "correlation" | "fact" | "mutualInfo" | "rank" | "spike" | "trend" | "values";
package/apps.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/MFNOHOWH.js";
5
- import "./chunks/7IMOYFWE.js";
4
+ } from "./chunks/5W53XSXH.js";
5
+ import "./chunks/NJRTJEAQ.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/apps.ts
package/audits.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ApiCallOptions } from './global.types-z1p6A9D-.js';
1
+ import { A as ApiCallOptions } from './global.types-BU2Yugjm.js';
2
2
  import './auth-types-BU5EGt_9.js';
3
3
 
4
4
  type ErrorResponse = {
package/audits.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/MFNOHOWH.js";
5
- import "./chunks/7IMOYFWE.js";
4
+ } from "./chunks/5W53XSXH.js";
5
+ import "./chunks/NJRTJEAQ.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/audits.ts
package/auth.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  logout,
5
5
  registerAuthModule,
6
6
  setDefaultHostConfig
7
- } from "./chunks/6O3XBOLZ.js";
8
- import "./chunks/7IMOYFWE.js";
7
+ } from "./chunks/AVML2WPM.js";
8
+ import "./chunks/NJRTJEAQ.js";
9
9
  export {
10
10
  auth_default as default,
11
11
  getAccessToken,
package/automations.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ApiCallOptions } from './global.types-z1p6A9D-.js';
1
+ import { A as ApiCallOptions } from './global.types-BU2Yugjm.js';
2
2
  import './auth-types-BU5EGt_9.js';
3
3
 
4
4
  type AutomationDetailRequestObject = {
package/automations.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/MFNOHOWH.js";
5
- import "./chunks/7IMOYFWE.js";
4
+ } from "./chunks/5W53XSXH.js";
5
+ import "./chunks/NJRTJEAQ.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/automations.ts
package/brands.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ApiCallOptions, D as DownloadableBlob } from './global.types-z1p6A9D-.js';
1
+ import { A as ApiCallOptions, D as DownloadableBlob } from './global.types-BU2Yugjm.js';
2
2
  import './auth-types-BU5EGt_9.js';
3
3
 
4
4
  /**
package/brands.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearApiCache,
3
3
  invokeFetch
4
- } from "./chunks/MFNOHOWH.js";
5
- import "./chunks/7IMOYFWE.js";
4
+ } from "./chunks/5W53XSXH.js";
5
+ import "./chunks/NJRTJEAQ.js";
6
6
  import "./chunks/2ZQ3ZX7F.js";
7
7
 
8
8
  // src/public/rest/brands.ts
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getInvokeFetchRuntimeModule
3
- } from "./7IMOYFWE.js";
3
+ } from "./NJRTJEAQ.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.16.0";
9
+ var defaultUserAgent = "qlik-api/1.17.0";
10
10
  async function invokeFetch(api, props) {
11
11
  const hostConfig = props.options?.hostConfig;
12
12
  let userAgent;
@@ -4,7 +4,7 @@ import {
4
4
  getRestCallAuthParams,
5
5
  getWebSocketAuthParams,
6
6
  toValidWebsocketLocationUrl
7
- } from "./3XRP5N4L.js";
7
+ } from "./HFUVFYT4.js";
8
8
  import {
9
9
  isBrowser,
10
10
  isNode
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getAuthRuntimeModule
3
- } from "./7IMOYFWE.js";
3
+ } from "./NJRTJEAQ.js";
4
4
 
5
5
  // src/public/auth.ts
6
6
  function registerAuthModule(name, authModule) {
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@qlik+runtime-module-loader@1.0.8/node_modules/@qlik/runtime-module-loader/dist/index.js
1
+ // node_modules/.pnpm/@qlik+runtime-module-loader@1.0.10/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);
@@ -792,7 +792,61 @@ async function refreshAccessToken(hostConfig) {
792
792
  }
793
793
  }
794
794
 
795
+ // src/auth/internal/default-auth-modules/oauth/temporary-token.ts
796
+ async function exchangeAccessTokenForTemporaryToken(hostConfig, accessToken, purpose) {
797
+ const response = await fetch(`${toValidLocationUrl(hostConfig)}/oauth/token`, {
798
+ method: "POST",
799
+ credentials: "include",
800
+ mode: "cors",
801
+ headers: { "content-type": "application/json" },
802
+ redirect: "follow",
803
+ body: JSON.stringify({
804
+ subject_token: accessToken,
805
+ subject_token_type: "urn:ietf:params:oauth:token-type:access_token",
806
+ grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
807
+ purpose,
808
+ redirect_uri: globalThis.location?.href,
809
+ client_id: hostConfig.clientId
810
+ })
811
+ });
812
+ if (response.status !== 200) {
813
+ throw await toError(response);
814
+ }
815
+ const data = await response.json();
816
+ return data.access_token;
817
+ }
818
+ async function toError(response) {
819
+ const body = await response.text();
820
+ try {
821
+ const data = JSON.parse(body);
822
+ return new AuthorizationError(data.errors);
823
+ } catch (err) {
824
+ return new AuthorizationError([
825
+ {
826
+ code: "unknown",
827
+ status: response.status,
828
+ detail: body,
829
+ title: "Unknown authentication error"
830
+ }
831
+ ]);
832
+ }
833
+ }
834
+
795
835
  // src/auth/internal/default-auth-modules/anonymous.ts
836
+ async function handlePotentialAuthenticationErrorAndRetry(hostConfig, fn) {
837
+ try {
838
+ return await fn();
839
+ } catch (err) {
840
+ const { retry } = await handleAuthenticationError2({
841
+ hostConfig,
842
+ canRetry: true
843
+ });
844
+ if (retry) {
845
+ return fn();
846
+ }
847
+ throw err;
848
+ }
849
+ }
796
850
  async function getOrCreateTrackingCode(hostConfig) {
797
851
  let trackingCode;
798
852
  if (isBrowser()) {
@@ -809,7 +863,7 @@ async function getOrCreateTrackingCode(hostConfig) {
809
863
  }
810
864
  function createTrackingCode() {
811
865
  const timeStamp = Math.floor(Date.now() / 1e3).toString(16);
812
- const randomString = generateRandomHexString(20);
866
+ const randomString = generateRandomHexString(40 - timeStamp.length);
813
867
  return `${timeStamp}${randomString}`;
814
868
  }
815
869
  async function getAnonymousAccessToken(hostConfig) {
@@ -849,20 +903,26 @@ async function getRestCallAuthParams2({
849
903
  async function getWebSocketAuthParams2({
850
904
  hostConfig
851
905
  }) {
852
- const accessToken = await getAnonymousAccessToken(hostConfig);
906
+ const websocketAccessToken = await handlePotentialAuthenticationErrorAndRetry(hostConfig, async () => {
907
+ const accessToken = await getAnonymousAccessToken(hostConfig);
908
+ return exchangeAccessTokenForTemporaryToken(hostConfig, accessToken, "websocket");
909
+ });
853
910
  return {
854
911
  queryParams: {
855
- accessToken
912
+ accessToken: websocketAccessToken
856
913
  }
857
914
  };
858
915
  }
859
916
  async function getWebResourceAuthParams2({
860
917
  hostConfig
861
918
  }) {
862
- const accessToken = await getAnonymousAccessToken(hostConfig);
919
+ const websocketResourceAccessToken = await handlePotentialAuthenticationErrorAndRetry(hostConfig, async () => {
920
+ const accessToken = await getAnonymousAccessToken(hostConfig);
921
+ return exchangeAccessTokenForTemporaryToken(hostConfig, accessToken, "websocket");
922
+ });
863
923
  return {
864
924
  queryParams: {
865
- accessToken
925
+ accessToken: websocketResourceAccessToken
866
926
  }
867
927
  };
868
928
  }
@@ -1009,7 +1069,7 @@ var cookie_default = {
1009
1069
  handleAuthenticationError: handleAuthenticationError4,
1010
1070
  validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, {
1011
1071
  requiredProps: [],
1012
- optionalProps: ["webIntegrationId", "crossSiteCookies"]
1072
+ optionalProps: ["webIntegrationId", "crossSiteCookies", "anonymousMode"]
1013
1073
  })
1014
1074
  };
1015
1075
 
@@ -1059,51 +1119,11 @@ function handleOAuthCallback() {
1059
1119
  }
1060
1120
  }
1061
1121
 
1062
- // src/auth/internal/default-auth-modules/oauth/temporary-token.ts
1063
- async function exchangeAccessTokenForTemporaryToken(hostConfig, accessToken, purpose) {
1064
- const response = await fetch(`${toValidLocationUrl(hostConfig)}/oauth/token`, {
1065
- method: "POST",
1066
- credentials: "include",
1067
- mode: "cors",
1068
- headers: { "content-type": "application/json" },
1069
- redirect: "follow",
1070
- body: JSON.stringify({
1071
- subject_token: accessToken,
1072
- subject_token_type: "urn:ietf:params:oauth:token-type:access_token",
1073
- grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
1074
- purpose,
1075
- redirect_uri: globalThis.location?.href,
1076
- client_id: hostConfig.clientId
1077
- })
1078
- });
1079
- if (response.status !== 200) {
1080
- throw await toError(response);
1081
- }
1082
- const data = await response.json();
1083
- return data.access_token;
1084
- }
1085
- async function toError(response) {
1086
- const body = await response.text();
1087
- try {
1088
- const data = JSON.parse(body);
1089
- return new AuthorizationError(data.errors);
1090
- } catch (err) {
1091
- return new AuthorizationError([
1092
- {
1093
- code: "unknown",
1094
- status: response.status,
1095
- detail: body,
1096
- title: "Unknown authentication error"
1097
- }
1098
- ]);
1099
- }
1100
- }
1101
-
1102
1122
  // src/auth/internal/default-auth-modules/oauth.ts
1103
1123
  if (isBrowser()) {
1104
1124
  handleOAuthCallback();
1105
1125
  }
1106
- async function handlePotentialAuthenticationErrorAndRetry(hostConfig, fn) {
1126
+ async function handlePotentialAuthenticationErrorAndRetry2(hostConfig, fn) {
1107
1127
  try {
1108
1128
  return await fn();
1109
1129
  } catch (err) {
@@ -1131,7 +1151,7 @@ async function getRestCallAuthParams6({
1131
1151
  async function getWebSocketAuthParams6({
1132
1152
  hostConfig
1133
1153
  }) {
1134
- const websocketAccessToken = await handlePotentialAuthenticationErrorAndRetry(hostConfig, async () => {
1154
+ const websocketAccessToken = await handlePotentialAuthenticationErrorAndRetry2(hostConfig, async () => {
1135
1155
  const accessToken = await getOAuthAccessToken(hostConfig);
1136
1156
  return exchangeAccessTokenForTemporaryToken(hostConfig, accessToken, "websocket");
1137
1157
  });
@@ -1144,7 +1164,7 @@ async function getWebSocketAuthParams6({
1144
1164
  async function getWebResourceAuthParams3({
1145
1165
  hostConfig
1146
1166
  }) {
1147
- const webResourceAccessToken = await handlePotentialAuthenticationErrorAndRetry(hostConfig, async () => {
1167
+ const webResourceAccessToken = await handlePotentialAuthenticationErrorAndRetry2(hostConfig, async () => {
1148
1168
  const accessToken = await getOAuthAccessToken(hostConfig);
1149
1169
  return exchangeAccessTokenForTemporaryToken(hostConfig, accessToken, "webresource");
1150
1170
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getQixRuntimeModule
3
- } from "./7IMOYFWE.js";
3
+ } from "./NJRTJEAQ.js";
4
4
 
5
5
  // src/public/qix.ts
6
6
  function openAppSession(appSessionProps) {
@@ -5,7 +5,7 @@ import {
5
5
  invokeFetch,
6
6
  invoke_fetch_default,
7
7
  parseFetchResponse
8
- } from "./3XRP5N4L.js";
8
+ } from "./HFUVFYT4.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("./PESPSFQN.js") : import("./TBHMVTOT.js").then(
4
+ return isNode ? import("./RWQS4ASJ.js") : import("./GLS4DAZ4.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("./YHKRUQRS.js") : import("./TBHMVTOT.js").then(
11
+ return isNode ? import("./S5OMX5JT.js") : import("./GLS4DAZ4.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("./ECWQX4IH.js") : import("./TBHMVTOT.js").then(
18
+ return isNode ? import("./NJFCE5EM.js") : import("./GLS4DAZ4.js").then(
19
19
  (mod) => mod.importRuntimeModule("invoke-fetch@v1", hostConfig)
20
20
  );
21
21
  }
@@ -18,7 +18,7 @@ import {
18
18
  toValidEnigmaLocationUrl,
19
19
  toValidLocationUrl,
20
20
  toValidWebsocketLocationUrl
21
- } from "./3XRP5N4L.js";
21
+ } from "./HFUVFYT4.js";
22
22
  import "./2ZQ3ZX7F.js";
23
23
  export {
24
24
  AuthorizationError,
@@ -4,7 +4,7 @@ import {
4
4
  invokeFetch,
5
5
  isWindows,
6
6
  toValidWebsocketLocationUrl
7
- } from "./3XRP5N4L.js";
7
+ } from "./HFUVFYT4.js";
8
8
  import {
9
9
  isBrowser
10
10
  } from "./2ZQ3ZX7F.js";
@@ -101,7 +101,7 @@ function listenForWindowsAuthenticationInformation(session) {
101
101
  return authSuggestedInWebsocket;
102
102
  }
103
103
  async function createAndSetupEnigmaSession(props, canRetry) {
104
- const { createEnigmaSession } = await import("./O3XVX7VQ.js");
104
+ const { createEnigmaSession } = await import("./6MPNTVLD.js");
105
105
  const session = await createEnigmaSession(props);
106
106
  setupSessionListeners(session, props);
107
107
  let global;
@@ -449,6 +449,72 @@ function getOrCreateSharedSession(props) {
449
449
  sharedSessions[key] = sharedSessions[key] || createSharedSession(props);
450
450
  return sharedSessions[key];
451
451
  }
452
+ function getExternalSession(externalApp, appSessionProps) {
453
+ const listeners = /* @__PURE__ */ new Set();
454
+ const appSession = {
455
+ _listeners: listeners,
456
+ getDoc: () => externalApp,
457
+ onWebSocketEvent: (fn) => () => {
458
+ appSession._listeners.add(fn);
459
+ return () => {
460
+ appSession._listeners.delete(fn);
461
+ };
462
+ },
463
+ resume: () => Promise.resolve(),
464
+ close: () => Promise.resolve()
465
+ };
466
+ const triggerEventListeners = (event) => {
467
+ for (const fn of globalEventListeners) {
468
+ fn(event);
469
+ }
470
+ for (const fn of appSession._listeners) {
471
+ fn(event);
472
+ }
473
+ };
474
+ externalApp.then((app) => {
475
+ app.session.on("opened", (event) => {
476
+ const wsEvent = {
477
+ eventType: "opened",
478
+ ...appSessionProps,
479
+ ...event
480
+ };
481
+ triggerEventListeners(wsEvent);
482
+ });
483
+ app.session.on("closed", (event) => {
484
+ const wsEvent = {
485
+ eventType: "closed",
486
+ ...appSessionProps,
487
+ ...event
488
+ };
489
+ triggerEventListeners(wsEvent);
490
+ });
491
+ app.session.on("suspended", (event) => {
492
+ const wsEvent = {
493
+ eventType: "suspended",
494
+ ...appSessionProps,
495
+ ...event
496
+ };
497
+ triggerEventListeners(wsEvent);
498
+ });
499
+ app.session.on("resuming", (event) => {
500
+ const wsEvent = {
501
+ eventType: "resuming",
502
+ ...appSessionProps,
503
+ ...event
504
+ };
505
+ triggerEventListeners(wsEvent);
506
+ });
507
+ app.session.on("resumed", (event) => {
508
+ const wsEvent = {
509
+ eventType: "resumed",
510
+ ...appSessionProps,
511
+ ...event
512
+ };
513
+ triggerEventListeners(wsEvent);
514
+ });
515
+ });
516
+ return appSession;
517
+ }
452
518
 
453
519
  // src/qix/qix-functions.ts
454
520
  async function createSessionApp() {
@@ -491,13 +557,7 @@ function openAppSession(appIdOrProps) {
491
557
  const appSessionId = toGlobalAppSessionId(appSessionProps);
492
558
  const externalApp = externalApps[appSessionId];
493
559
  if (externalApp) {
494
- return {
495
- getDoc: () => externalApp,
496
- onWebSocketEvent: (fn) => () => {
497
- },
498
- resume: () => Promise.resolve(),
499
- close: () => Promise.resolve()
500
- };
560
+ return getExternalSession(externalApp, appSessionProps);
501
561
  }
502
562
  const sharedSession = getOrCreateSharedSession(appSessionProps);
503
563
  const listeners = /* @__PURE__ */ new Set();