@qlik/api 2.3.0 → 2.3.1
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.
- package/analytics/change-stores.js +2 -2
- package/analytics.js +2 -2
- package/api-keys.js +2 -2
- package/apps.js +2 -2
- package/assistants.js +2 -2
- package/audits.js +2 -2
- package/auth.js +1 -1
- package/automation-connections.js +2 -2
- package/automation-connectors.js +2 -2
- package/automations.js +2 -2
- package/automl-deployments.js +2 -2
- package/automl-predictions.js +2 -2
- package/banners.js +2 -2
- package/brands.js +2 -2
- package/chunks/auth-XusKk8IA.js +32 -0
- package/chunks/{interceptors-DipDBQQ5.js → interceptors-2VSXImC9.js} +247 -99
- package/chunks/{invoke-fetch-B7lGscuQ.js → invoke-fetch-CckTK7bh.js} +2 -2
- package/chunks/{invoke-fetch-DhdyFZ0F.js → invoke-fetch-D9lpiAb-.js} +1 -1
- package/chunks/{public-runtime-modules-QhLPeQr5.js → public-runtime-modules-BqxAMJ9M.js} +3 -3
- package/chunks/{qix-RCUslia8.js → qix-DpvHvpx7.js} +3 -3
- package/chunks/{qix-chunk-entrypoint-WAS4NVTf.js → qix-chunk-entrypoint-BXZPnE6J.js} +1 -1
- package/collections.js +2 -2
- package/conditions.js +2 -2
- package/consumption.js +2 -2
- package/core/ip-policies.js +2 -2
- package/core.js +2 -2
- package/csp-origins.js +2 -2
- package/csrf-token.js +2 -2
- package/data-alerts.js +2 -2
- package/data-assets.js +2 -2
- package/data-connections.js +2 -2
- package/data-credentials.js +2 -2
- package/data-files.js +2 -2
- package/data-qualities.js +2 -2
- package/data-sets.js +2 -2
- package/data-sources.js +2 -2
- package/data-stores.js +2 -2
- package/dcaas.js +2 -2
- package/di-projects.js +2 -2
- package/direct-access-agents.js +2 -2
- package/encryption.js +2 -2
- package/extensions.js +2 -2
- package/glossaries.js +2 -2
- package/groups.js +2 -2
- package/identity-providers.js +2 -2
- package/index.js +3 -3
- package/interceptors.js +1 -1
- package/items.js +2 -2
- package/knowledgebases.js +2 -2
- package/licenses.js +2 -2
- package/lineage-graphs.js +2 -2
- package/ml.js +2 -2
- package/notes.js +2 -2
- package/notifications.js +2 -2
- package/oauth-clients.js +2 -2
- package/oauth-tokens.js +2 -2
- package/package.json +1 -2
- package/qix.js +1 -1
- package/questions.js +2 -2
- package/quotas.js +2 -2
- package/reload-tasks.js +2 -2
- package/reloads.js +2 -2
- package/report-templates.js +2 -2
- package/reports.js +2 -2
- package/roles.js +2 -2
- package/sharing-tasks.js +2 -2
- package/spaces.js +2 -2
- package/tasks.js +2 -2
- package/temp-contents.js +2 -2
- package/tenants.js +2 -2
- package/themes.js +2 -2
- package/transports.js +2 -2
- package/ui-config.js +2 -2
- package/users.js +2 -2
- package/web-integrations.js +2 -2
- package/web-notifications.js +2 -2
- package/webhooks.js +2 -2
- package/chunks/auth-BowS4SUR.js +0 -28
|
@@ -3,7 +3,7 @@ import { n as hostConfigCommonProperties, t as authTypesThatCanBeOmitted } from
|
|
|
3
3
|
|
|
4
4
|
//#region src/platform/platform-functions.ts
|
|
5
5
|
const getPlatform = async (options = {}) => {
|
|
6
|
-
const hc =
|
|
6
|
+
const hc = resolveHostConfig(options.hostConfig);
|
|
7
7
|
if (hc.authType === "mock-backend-rest-recorder") return hc.recordGetPlatform();
|
|
8
8
|
if (hc?.authType === "mock-backend") return hc.mockGetPlatform();
|
|
9
9
|
if (hc?.authType === "noauth") return result({ isUnknown: true });
|
|
@@ -156,6 +156,154 @@ function generateRandomHexString(targetLength) {
|
|
|
156
156
|
return generateRandomFromAlphabet(HEX_ALPHABET, targetLength);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/auth/internal/host-config-functions.ts
|
|
161
|
+
const emptyHostConfig = {};
|
|
162
|
+
const normalizedHostConfigs = /* @__PURE__ */ new Map();
|
|
163
|
+
/**
|
|
164
|
+
* Returns a new host config with all default and falsy values removed.
|
|
165
|
+
* @param hostConfig - The host config to fill with defaults
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
function removeDefaults(hostConfig) {
|
|
169
|
+
const cleanedHostConfig = cleanFalsyValues(hostConfig) || {};
|
|
170
|
+
if (cleanedHostConfig.host) cleanedHostConfig.host = toValidLocationUrl(cleanedHostConfig);
|
|
171
|
+
if (isBrowser()) {
|
|
172
|
+
if (toValidLocationUrl(cleanedHostConfig) === window.location.origin) delete cleanedHostConfig.host;
|
|
173
|
+
}
|
|
174
|
+
if (cleanedHostConfig.authType && authTypesThatCanBeOmitted.includes(cleanedHostConfig.authType)) delete cleanedHostConfig.authType;
|
|
175
|
+
return cleanedHostConfig;
|
|
176
|
+
}
|
|
177
|
+
function globalReplacer(key, value) {
|
|
178
|
+
if (typeof value === "function") return;
|
|
179
|
+
return value;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Serializes the provided hostConfig, if present, otherwise the default one.
|
|
183
|
+
*/
|
|
184
|
+
function serializeHostConfig$1(hostConfig) {
|
|
185
|
+
const sorted = sortKeys(removeDefaults(resolveHostConfig(hostConfig)));
|
|
186
|
+
return JSON.stringify(sorted, globalReplacer);
|
|
187
|
+
}
|
|
188
|
+
const registeredHostConfigs = /* @__PURE__ */ new Map();
|
|
189
|
+
/**
|
|
190
|
+
* Registers a host config with the given name.
|
|
191
|
+
* @param name The name of the host config to be used to reference the host config later.
|
|
192
|
+
* @param hostConfig The host config to register.
|
|
193
|
+
*/
|
|
194
|
+
function registerHostConfig$1(name, hostConfig) {
|
|
195
|
+
const reference = hostConfig?.reference || null;
|
|
196
|
+
if (reference && !registeredHostConfigs.has(reference)) throw new InvalidHostConfigError(`Host config with reference "${reference}" is not registered. Please register it before using it.`);
|
|
197
|
+
if (registeredHostConfigs.has(name)) console.warn(`registerHostConfig: Host config with name "${name}" is already registered. Overwriting.`);
|
|
198
|
+
registeredHostConfigs.set(name, hostConfig);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Unregisters a host config with the given name.
|
|
202
|
+
* @param name The name of the host config to unregister.
|
|
203
|
+
*/
|
|
204
|
+
function unregisterHostConfig$1(name) {
|
|
205
|
+
if (registeredHostConfigs.has(name)) registeredHostConfigs.delete(name);
|
|
206
|
+
else console.warn(`unregisterHostConfig: Host config with name "${name}" not found.`);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Gets the host config with the given name.
|
|
210
|
+
* @private
|
|
211
|
+
* @param name The name of the host config to get.
|
|
212
|
+
* @returns The host config, or undefined if not found.
|
|
213
|
+
*/
|
|
214
|
+
function getRegisteredHostConfig(name) {
|
|
215
|
+
return registeredHostConfigs.get(name);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Sets the default host config that will be used for all api calls that do not include a HostConfig
|
|
219
|
+
* @private
|
|
220
|
+
* @param hostConfig the default HostConfig to use
|
|
221
|
+
*/
|
|
222
|
+
function setDefaultHostConfig$1(hostConfig) {
|
|
223
|
+
registerHostConfig$1("default", hostConfig || {});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Gets the default host config that will be used for all qmfe api calls that do not include a HostConfig.
|
|
227
|
+
* @private
|
|
228
|
+
* @returns The default host config that will be used for all qmfe api calls that do not include a HostConfig
|
|
229
|
+
*/
|
|
230
|
+
function getDefaultHostConfig$1() {
|
|
231
|
+
return getRegisteredHostConfig("default") || {};
|
|
232
|
+
}
|
|
233
|
+
function normalizeHostConfig$1(hostConfig) {
|
|
234
|
+
const suppliedHostConfigOrEmpty = hostConfig || emptyHostConfig;
|
|
235
|
+
const serializedHostConfigKey = serializeHostConfig$1(suppliedHostConfigOrEmpty);
|
|
236
|
+
let normalizedHostConfig = normalizedHostConfigs.get(serializedHostConfigKey);
|
|
237
|
+
if (!normalizedHostConfig) {
|
|
238
|
+
normalizedHostConfig = removeDefaults(resolveHostConfig(suppliedHostConfigOrEmpty));
|
|
239
|
+
normalizedHostConfigs.set(serializedHostConfigKey, normalizedHostConfig);
|
|
240
|
+
}
|
|
241
|
+
return normalizedHostConfig;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/auth/internal/page-redirect-request-listeners.ts
|
|
246
|
+
/**
|
|
247
|
+
* A store containing all listener registries for different host configurations.
|
|
248
|
+
*/
|
|
249
|
+
const listenerRegistries$1 = /* @__PURE__ */ new Map();
|
|
250
|
+
/**
|
|
251
|
+
* Retrieves the listener registry for a given host configuration, creating one if it doesn't exist.
|
|
252
|
+
*/
|
|
253
|
+
function getRegistryForHostConfig(hostConfig) {
|
|
254
|
+
const key = serializeHostConfig$1(hostConfig);
|
|
255
|
+
let registry = listenerRegistries$1.get(key);
|
|
256
|
+
if (!registry) {
|
|
257
|
+
registry = {
|
|
258
|
+
redirectRequestedListeners: /* @__PURE__ */ new Set(),
|
|
259
|
+
redirectStartedListeners: /* @__PURE__ */ new Set()
|
|
260
|
+
};
|
|
261
|
+
listenerRegistries$1.set(key, registry);
|
|
262
|
+
}
|
|
263
|
+
return registry;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Registers a listener for page redirects requested by auth modules.
|
|
267
|
+
* @param hostConfig
|
|
268
|
+
* @param listener
|
|
269
|
+
* @returns
|
|
270
|
+
*/
|
|
271
|
+
function onPageRedirectRequested$1(hostConfig, listener) {
|
|
272
|
+
const registry = getRegistryForHostConfig(hostConfig);
|
|
273
|
+
registry.redirectRequestedListeners.add(listener);
|
|
274
|
+
return () => {
|
|
275
|
+
registry.redirectRequestedListeners.delete(listener);
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function onPageRedirectStarted$1(hostConfig, listener) {
|
|
279
|
+
const registry = getRegistryForHostConfig(hostConfig);
|
|
280
|
+
registry.redirectStartedListeners.add(listener);
|
|
281
|
+
return () => {
|
|
282
|
+
registry.redirectStartedListeners.delete(listener);
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function requestRedirect(hostConfig) {
|
|
286
|
+
const registry = getRegistryForHostConfig(hostConfig);
|
|
287
|
+
const hasRedirectListener = registry.redirectRequestedListeners.size > 0 || hostConfig.authRedirectUserConfirmation;
|
|
288
|
+
if (hostConfig.autoRedirect || !hasRedirectListener) return Promise.resolve();
|
|
289
|
+
if (typeof hostConfig.authRedirectUserConfirmation === "function") return hostConfig.authRedirectUserConfirmation().catch(() => {});
|
|
290
|
+
return new Promise((resolve) => {
|
|
291
|
+
const proceed = () => {
|
|
292
|
+
for (const startedListener of registry.redirectStartedListeners) try {
|
|
293
|
+
startedListener();
|
|
294
|
+
} catch (error) {
|
|
295
|
+
console.warn(error);
|
|
296
|
+
}
|
|
297
|
+
resolve();
|
|
298
|
+
};
|
|
299
|
+
for (const requestListener of registry.redirectRequestedListeners) try {
|
|
300
|
+
requestListener({ proceed });
|
|
301
|
+
} catch (error) {
|
|
302
|
+
console.warn(error);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
159
307
|
//#endregion
|
|
160
308
|
//#region src/utils/expose-internal-test-apis.ts
|
|
161
309
|
function exposeInternalApiOnWindow(name, fn) {
|
|
@@ -535,7 +683,7 @@ async function getOAuthTokensForBrowser(hostConfig) {
|
|
|
535
683
|
});
|
|
536
684
|
if (oauthTokens) return oauthTokens;
|
|
537
685
|
if (hostConfig.performInteractiveLogin) return new Promise(() => {});
|
|
538
|
-
|
|
686
|
+
await requestRedirect(hostConfig);
|
|
539
687
|
startFullPageLoginFlow(hostConfig);
|
|
540
688
|
return new Promise(() => {});
|
|
541
689
|
}
|
|
@@ -1565,7 +1713,7 @@ async function handleAuthenticationError$7({ hostConfig, status }) {
|
|
|
1565
1713
|
};
|
|
1566
1714
|
const webIntegrationParam = hostConfig.webIntegrationId ? `qlik-web-integration-id=${hostConfig?.webIntegrationId}&` : "";
|
|
1567
1715
|
const locationUrl = toValidLocationUrl(hostConfig);
|
|
1568
|
-
|
|
1716
|
+
await requestRedirect(hostConfig);
|
|
1569
1717
|
globalThis.location.replace(`${locationUrl}/login?${webIntegrationParam}returnto=${encodeURIComponent(globalThis.location.href)}`);
|
|
1570
1718
|
return { preventDefault: true };
|
|
1571
1719
|
}
|
|
@@ -1712,7 +1860,7 @@ async function handleAuthenticationError$4({ hostConfig }) {
|
|
|
1712
1860
|
clearStoredOauthTokens(hostConfig);
|
|
1713
1861
|
return { retry: true };
|
|
1714
1862
|
}
|
|
1715
|
-
|
|
1863
|
+
await requestRedirect(hostConfig);
|
|
1716
1864
|
startFullPageLoginFlow(hostConfig);
|
|
1717
1865
|
return { preventDefault: true };
|
|
1718
1866
|
}
|
|
@@ -1802,7 +1950,7 @@ async function getWebSocketAuthParams$2({ hostConfig }) {
|
|
|
1802
1950
|
}
|
|
1803
1951
|
async function handleAuthenticationError$2({ hostConfig }) {
|
|
1804
1952
|
if (hostConfig.loginUri) {
|
|
1805
|
-
|
|
1953
|
+
await requestRedirect(hostConfig);
|
|
1806
1954
|
globalThis.location.replace(hostConfig.loginUri.replace("{location}", encodeURIComponent(globalThis.location.href)));
|
|
1807
1955
|
return { preventDefault: true };
|
|
1808
1956
|
}
|
|
@@ -1968,7 +2116,7 @@ function getRegisteredAuthModule(authType) {
|
|
|
1968
2116
|
* @param hostConfig
|
|
1969
2117
|
*/
|
|
1970
2118
|
async function getAuthModule(hostConfig) {
|
|
1971
|
-
const hostConfigToUse =
|
|
2119
|
+
const hostConfigToUse = resolveHostConfig(hostConfig);
|
|
1972
2120
|
const authType = await determineAuthType$1(hostConfigToUse);
|
|
1973
2121
|
if (ongoingAuthModuleLoading) await ongoingAuthModuleLoading;
|
|
1974
2122
|
let authModule = getRegisteredAuthModule(authType);
|
|
@@ -2093,76 +2241,55 @@ var AuthorizationError = class extends Error {
|
|
|
2093
2241
|
};
|
|
2094
2242
|
|
|
2095
2243
|
//#endregion
|
|
2096
|
-
//#region src/auth/internal/
|
|
2244
|
+
//#region src/auth/internal/fatal-auth-error-listeners.ts
|
|
2245
|
+
const listenerRegistries = /* @__PURE__ */ new Map();
|
|
2246
|
+
let lastErrorMessage = "";
|
|
2247
|
+
let lastHostConfig;
|
|
2097
2248
|
/**
|
|
2098
|
-
*
|
|
2099
|
-
* @param hostConfig - The host config to fill with defaults
|
|
2100
|
-
* @returns
|
|
2249
|
+
* Retrieves the listener registry for a given host configuration, creating one if it doesn't exist.
|
|
2101
2250
|
*/
|
|
2102
|
-
function
|
|
2103
|
-
const
|
|
2104
|
-
|
|
2105
|
-
if (
|
|
2106
|
-
|
|
2251
|
+
function getAuthErrorListenerRegistryForHostConfig(hostConfig) {
|
|
2252
|
+
const key = serializeHostConfig$1(hostConfig);
|
|
2253
|
+
let registry = listenerRegistries.get(key);
|
|
2254
|
+
if (!registry) {
|
|
2255
|
+
registry = { listeners: /* @__PURE__ */ new Set() };
|
|
2256
|
+
listenerRegistries.set(key, registry);
|
|
2107
2257
|
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
const
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
}
|
|
2134
|
-
/**
|
|
2135
|
-
* Unregisters a host config with the given name.
|
|
2136
|
-
* @param name The name of the host config to unregister.
|
|
2137
|
-
*/
|
|
2138
|
-
function unregisterHostConfig$1(name) {
|
|
2139
|
-
if (registeredHostConfigs.has(name)) registeredHostConfigs.delete(name);
|
|
2140
|
-
else console.warn(`unregisterHostConfig: Host config with name "${name}" not found.`);
|
|
2141
|
-
}
|
|
2142
|
-
/**
|
|
2143
|
-
* Gets the host config with the given name.
|
|
2144
|
-
* @private
|
|
2145
|
-
* @param name The name of the host config to get.
|
|
2146
|
-
* @returns The host config, or undefined if not found.
|
|
2147
|
-
*/
|
|
2148
|
-
function getRegisteredHostConfig(name) {
|
|
2149
|
-
return registeredHostConfigs.get(name);
|
|
2258
|
+
return registry;
|
|
2259
|
+
}
|
|
2260
|
+
/**
|
|
2261
|
+
* Emits a fatal authentication error to all registered listeners plus to the onAuthFailed property in the hostConfig.
|
|
2262
|
+
* If there are no listeners or onAuthFailed callback, the error message is logged to the console.
|
|
2263
|
+
*/
|
|
2264
|
+
function emitFatalAuthError(hostConfig, normalizedError) {
|
|
2265
|
+
if (hostConfig === lastHostConfig && normalizedError.message === lastErrorMessage) return;
|
|
2266
|
+
lastHostConfig = hostConfig;
|
|
2267
|
+
lastErrorMessage = normalizedError.message;
|
|
2268
|
+
let someOneIsListening = false;
|
|
2269
|
+
const registry = getAuthErrorListenerRegistryForHostConfig(hostConfig);
|
|
2270
|
+
for (const listener of registry.listeners) try {
|
|
2271
|
+
someOneIsListening = true;
|
|
2272
|
+
listener(normalizedError);
|
|
2273
|
+
} catch (listenerError) {
|
|
2274
|
+
console.warn("Error in auth error listener", listenerError);
|
|
2275
|
+
}
|
|
2276
|
+
if (hostConfig.onAuthFailed) try {
|
|
2277
|
+
someOneIsListening = true;
|
|
2278
|
+
hostConfig.onAuthFailed(normalizedError);
|
|
2279
|
+
} catch (callbackError) {
|
|
2280
|
+
console.warn("Error in onAuthFailed callback", callbackError);
|
|
2281
|
+
}
|
|
2282
|
+
if (!someOneIsListening) console.error(normalizedError.message);
|
|
2150
2283
|
}
|
|
2151
2284
|
/**
|
|
2152
|
-
*
|
|
2153
|
-
* @private
|
|
2154
|
-
* @param hostConfig the default HostConfig to use
|
|
2285
|
+
* Registers a listener for fatal auth errors. This means errors in the actual auth mechanism, i.e. misconfigurations etc.
|
|
2155
2286
|
*/
|
|
2156
|
-
function
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
* @returns The default host config that will be used for all qmfe api calls that do not include a HostConfig
|
|
2163
|
-
*/
|
|
2164
|
-
function getDefaultHostConfig$1() {
|
|
2165
|
-
return getRegisteredHostConfig("default") || {};
|
|
2287
|
+
function onFatalAuthError$1(hostConfig, callback) {
|
|
2288
|
+
const registry = getAuthErrorListenerRegistryForHostConfig(hostConfig);
|
|
2289
|
+
registry.listeners.add(callback);
|
|
2290
|
+
return () => {
|
|
2291
|
+
registry.listeners.delete(callback);
|
|
2292
|
+
};
|
|
2166
2293
|
}
|
|
2167
2294
|
|
|
2168
2295
|
//#endregion
|
|
@@ -2171,14 +2298,6 @@ function getDefaultHostConfig$1() {
|
|
|
2171
2298
|
* Set initial loggingOut value to false to make sure it has a value before any auth module is loaded
|
|
2172
2299
|
*/
|
|
2173
2300
|
globalThis.loggingOut = false;
|
|
2174
|
-
let lastErrorMessage = "";
|
|
2175
|
-
/** Default error logger that simply prints the error unless it is identical to the last one (to prevent bloating of the console) */
|
|
2176
|
-
function logToConsole({ message }) {
|
|
2177
|
-
if (message !== lastErrorMessage) {
|
|
2178
|
-
lastErrorMessage = message;
|
|
2179
|
-
console.error(message);
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2182
2301
|
/**
|
|
2183
2302
|
* Determines the authType associated with a HostConfig even if it's
|
|
2184
2303
|
* not explicitly set.
|
|
@@ -2195,7 +2314,7 @@ function determineAuthType(hostConfig) {
|
|
|
2195
2314
|
*/
|
|
2196
2315
|
function isHostCrossOrigin(hostConfig) {
|
|
2197
2316
|
if (!globalThis.location?.origin) return true;
|
|
2198
|
-
const hostConfigToUse =
|
|
2317
|
+
const hostConfigToUse = resolveHostConfig(hostConfig);
|
|
2199
2318
|
if (Object.keys(hostConfigToUse).length === 0) return false;
|
|
2200
2319
|
try {
|
|
2201
2320
|
return new URL(toValidLocationUrl(hostConfigToUse)).origin !== globalThis.location.origin;
|
|
@@ -2207,7 +2326,7 @@ function isHostCrossOrigin(hostConfig) {
|
|
|
2207
2326
|
* @param hostConfig the HostConfig containing authentication details
|
|
2208
2327
|
*/
|
|
2209
2328
|
async function isWindows(hostConfig) {
|
|
2210
|
-
const hostConfigToUse =
|
|
2329
|
+
const hostConfigToUse = resolveHostConfig(hostConfig);
|
|
2211
2330
|
if (typeof hostConfigToUse.forceIsWindows === "boolean") return hostConfigToUse.forceIsWindows;
|
|
2212
2331
|
if (hostConfigToUse.host?.endsWith(".qlik-stage.com") || hostConfigToUse.host?.endsWith(".qlikcloud.com") || hostConfigToUse.host?.endsWith(".qlikcloudgov.com")) return false;
|
|
2213
2332
|
if (hostConfigToUse.authType === "cookie") return false;
|
|
@@ -2219,7 +2338,7 @@ async function isWindows(hostConfig) {
|
|
|
2219
2338
|
* @param hostConfig the HostConfig containing authentication details
|
|
2220
2339
|
*/
|
|
2221
2340
|
function toValidLocationUrl(hostConfig) {
|
|
2222
|
-
const url =
|
|
2341
|
+
const url = resolveHostConfig(hostConfig)?.host?.trim();
|
|
2223
2342
|
let locationUrl;
|
|
2224
2343
|
if (!url) locationUrl = "";
|
|
2225
2344
|
else if (url.toLowerCase().startsWith("https://") || url.toLowerCase().startsWith("http://")) locationUrl = url;
|
|
@@ -2232,7 +2351,7 @@ function toValidLocationUrl(hostConfig) {
|
|
|
2232
2351
|
* @param hostConfig the HostConfig containing authentication details
|
|
2233
2352
|
*/
|
|
2234
2353
|
function toValidWebsocketLocationUrl(hostConfig) {
|
|
2235
|
-
const url =
|
|
2354
|
+
const url = resolveHostConfig(hostConfig)?.host;
|
|
2236
2355
|
let locationUrl;
|
|
2237
2356
|
if (!url) locationUrl = globalThis.location.origin;
|
|
2238
2357
|
else if (url.toLowerCase().startsWith("https://") || url.toLowerCase().startsWith("http://")) locationUrl = url;
|
|
@@ -2245,14 +2364,14 @@ function toValidWebsocketLocationUrl(hostConfig) {
|
|
|
2245
2364
|
* @param hostConfig the HostConfig containing authentication details
|
|
2246
2365
|
*/
|
|
2247
2366
|
async function getWebSocketAuthParams(props) {
|
|
2248
|
-
const hostConfigToUse =
|
|
2367
|
+
const hostConfigToUse = resolveHostConfig(props.hostConfig);
|
|
2249
2368
|
try {
|
|
2250
2369
|
return await (await getAuthModule(hostConfigToUse)).getWebSocketAuthParams({
|
|
2251
2370
|
...props,
|
|
2252
2371
|
hostConfig: hostConfigToUse
|
|
2253
2372
|
});
|
|
2254
2373
|
} catch (err) {
|
|
2255
|
-
(hostConfigToUse
|
|
2374
|
+
emitFatalAuthError(hostConfigToUse, normalizeAuthModuleError(err));
|
|
2256
2375
|
throw err;
|
|
2257
2376
|
}
|
|
2258
2377
|
}
|
|
@@ -2262,14 +2381,14 @@ async function getWebSocketAuthParams(props) {
|
|
|
2262
2381
|
* @param hostConfig the HostConfig containing authentication details
|
|
2263
2382
|
*/
|
|
2264
2383
|
async function getWebResourceAuthParams(props) {
|
|
2265
|
-
const hostConfigToUse =
|
|
2384
|
+
const hostConfigToUse = resolveHostConfig(props.hostConfig);
|
|
2266
2385
|
try {
|
|
2267
2386
|
return await (await getAuthModule(hostConfigToUse)).getWebResourceAuthParams?.({
|
|
2268
2387
|
...props,
|
|
2269
2388
|
hostConfig: hostConfigToUse
|
|
2270
2389
|
}) || { queryParams: {} };
|
|
2271
2390
|
} catch (err) {
|
|
2272
|
-
(hostConfigToUse
|
|
2391
|
+
emitFatalAuthError(hostConfigToUse, normalizeAuthModuleError(err));
|
|
2273
2392
|
throw err;
|
|
2274
2393
|
}
|
|
2275
2394
|
}
|
|
@@ -2277,7 +2396,7 @@ async function getWebResourceAuthParams(props) {
|
|
|
2277
2396
|
* Calls and return handleAuthenticationError on the authModule a host config is associated with.
|
|
2278
2397
|
*/
|
|
2279
2398
|
async function handleAuthenticationError(props) {
|
|
2280
|
-
const hostConfigToUse =
|
|
2399
|
+
const hostConfigToUse = resolveHostConfig(props.hostConfig);
|
|
2281
2400
|
const result$1 = await (await getAuthModule(hostConfigToUse)).handleAuthenticationError({
|
|
2282
2401
|
...props,
|
|
2283
2402
|
hostConfig: hostConfigToUse
|
|
@@ -2286,7 +2405,7 @@ async function handleAuthenticationError(props) {
|
|
|
2286
2405
|
const willHangUntilANewPageIsLoaded = result$1.preventDefault;
|
|
2287
2406
|
if (!willRetry && !willHangUntilANewPageIsLoaded) {
|
|
2288
2407
|
const { status, errorBody } = props;
|
|
2289
|
-
(hostConfigToUse
|
|
2408
|
+
emitFatalAuthError(hostConfigToUse, normalizeInbandAuthError({
|
|
2290
2409
|
status,
|
|
2291
2410
|
errorBody
|
|
2292
2411
|
}));
|
|
@@ -2299,14 +2418,14 @@ async function handleAuthenticationError(props) {
|
|
|
2299
2418
|
* @param props.method the http method, which may affect what authentication are needed.
|
|
2300
2419
|
*/
|
|
2301
2420
|
async function getRestCallAuthParams(props) {
|
|
2302
|
-
const hostConfigToUse =
|
|
2421
|
+
const hostConfigToUse = resolveHostConfig(props.hostConfig);
|
|
2303
2422
|
try {
|
|
2304
2423
|
return await (await getAuthModule(hostConfigToUse)).getRestCallAuthParams({
|
|
2305
2424
|
...props,
|
|
2306
2425
|
hostConfig: hostConfigToUse
|
|
2307
2426
|
});
|
|
2308
2427
|
} catch (err) {
|
|
2309
|
-
(hostConfigToUse
|
|
2428
|
+
emitFatalAuthError(hostConfigToUse, normalizeAuthModuleError(err));
|
|
2310
2429
|
throw err;
|
|
2311
2430
|
}
|
|
2312
2431
|
}
|
|
@@ -2363,13 +2482,19 @@ function serializeHostConfig(hostConfig) {
|
|
|
2363
2482
|
* Throws errors if hostConfig is missing or missing properties on cross domain requests
|
|
2364
2483
|
*/
|
|
2365
2484
|
function checkForCrossDomainRequest(hostConfig) {
|
|
2366
|
-
const hostConfigToUse =
|
|
2485
|
+
const hostConfigToUse = resolveHostConfig(hostConfig);
|
|
2367
2486
|
if (isHostCrossOrigin(hostConfigToUse)) {
|
|
2368
2487
|
if (Object.keys(hostConfigToUse).length === 0) throw new InvalidHostConfigError("a host config must be provided when making a cross domain request");
|
|
2369
2488
|
if (!hostConfigToUse.host) throw new InvalidHostConfigError("A 'host' property must be set in host config when making a cross domain request");
|
|
2370
2489
|
}
|
|
2371
2490
|
}
|
|
2372
2491
|
/**
|
|
2492
|
+
* Returns a normalized host config that will always be the same instance when the serialized host config is the same.
|
|
2493
|
+
*/
|
|
2494
|
+
function normalizeHostConfig(hostConfig) {
|
|
2495
|
+
return normalizeHostConfig$1(hostConfig);
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2373
2498
|
* Logs out the user and sets `global.loggingOut` to true.
|
|
2374
2499
|
* **NOTE**: Does not abort pending requests.
|
|
2375
2500
|
*/
|
|
@@ -2400,15 +2525,14 @@ function normalizeAuthModuleError(err) {
|
|
|
2400
2525
|
return { message: err.message || "Unknown error" };
|
|
2401
2526
|
}
|
|
2402
2527
|
/**
|
|
2403
|
-
*
|
|
2404
|
-
* to the
|
|
2405
|
-
* If the host config is undefined or empty, the default host config will be
|
|
2406
|
-
* If the host config is not a reference, it will be returned as is.
|
|
2407
|
-
*
|
|
2528
|
+
* Replaces the supplied host config according the following rules:
|
|
2529
|
+
* * If the host config is a reference to a registered host config, the registered host config will be used.
|
|
2530
|
+
* * If the host config is undefined or empty, the default host config will be returned.
|
|
2531
|
+
* * If the host config is not a reference and not empty or undefined, it will be returned as is.
|
|
2532
|
+
* * If the host config is empty or undefined an empty object (which represents the default cookie mode) is returned.
|
|
2408
2533
|
* @param hostConfig - The host config to resolve
|
|
2409
|
-
* @returns
|
|
2410
2534
|
*/
|
|
2411
|
-
function
|
|
2535
|
+
function resolveHostConfig(hostConfig) {
|
|
2412
2536
|
if (hostConfig?.reference) {
|
|
2413
2537
|
const refConfig = getRegisteredHostConfig(hostConfig.reference);
|
|
2414
2538
|
if (!refConfig) throw new InvalidHostConfigError(`Host config with name "${hostConfig.reference}" not found.`);
|
|
@@ -2423,6 +2547,30 @@ function withResolvedHostConfig(hostConfig) {
|
|
|
2423
2547
|
function getDefaultHostConfig() {
|
|
2424
2548
|
return getDefaultHostConfig$1();
|
|
2425
2549
|
}
|
|
2550
|
+
/**
|
|
2551
|
+
* Registers a callback to be invoked when a fatal authentication error occurs for the provided hostConfig.
|
|
2552
|
+
* @param callback The callback function to register
|
|
2553
|
+
* @returns A function to unregister the callback
|
|
2554
|
+
*/
|
|
2555
|
+
function onFatalAuthError(hostConfig, callback) {
|
|
2556
|
+
return onFatalAuthError$1(hostConfig, callback);
|
|
2557
|
+
}
|
|
2558
|
+
/**
|
|
2559
|
+
* Registers a listener for page redirect requested by the auth module that is handling authentication for the provided host configuration.
|
|
2560
|
+
* This is typically used when embedded to let the end user explicitly approve a redirect by for instance clicking an "authorize" button. The user can then decide to leave that UI unauthorized
|
|
2561
|
+
* and stay on the page.
|
|
2562
|
+
* The listener is provided a `proceed` function that if called continues the redirect process. Before actually redirecting the page, the onPageRedirectStarted listeners are called.
|
|
2563
|
+
* Note that if more than one listener is registered, it still takes just one proceed call to continue the redirect process so it can not be used to block the redirect.
|
|
2564
|
+
*/
|
|
2565
|
+
function onPageRedirectRequested(hostConfig, listener) {
|
|
2566
|
+
return onPageRedirectRequested$1(hostConfig, listener);
|
|
2567
|
+
}
|
|
2568
|
+
/**
|
|
2569
|
+
* Registers a listener that will be called when a page redirect is started by the auth module that is handling authentication for the provided host configuration.
|
|
2570
|
+
*/
|
|
2571
|
+
function onPageRedirectStarted(hostConfig, listener) {
|
|
2572
|
+
return onPageRedirectStarted$1(hostConfig, listener);
|
|
2573
|
+
}
|
|
2426
2574
|
|
|
2427
2575
|
//#endregion
|
|
2428
2576
|
//#region src/interceptors/boot-interceptors.ts
|
|
@@ -2615,4 +2763,4 @@ const interceptors = {
|
|
|
2615
2763
|
var interceptors_default = interceptors;
|
|
2616
2764
|
|
|
2617
2765
|
//#endregion
|
|
2618
|
-
export {
|
|
2766
|
+
export { InvalidHostConfigError as A, getPlatform as B, serializeHostConfig as C, unregisterHostConfig as D, toValidWebsocketLocationUrl as E, appendQueryToUrl as F, EncodingError as I, InvokeFetchError as L, clearApiCache as M, invokeFetch as N, AuthorizationError as O, parseFetchResponse as P, exposeInternalApiOnWindow as R, registerHostConfig as S, toValidLocationUrl as T, normalizeHostConfig as _, interceptors_default as a, onPageRedirectStarted as b, getAccessToken as c, getWebResourceAuthParams as d, getWebSocketAuthParams as f, logout as g, isWindows as h, getInterceptors as i, UnexpectedAuthTypeError as j, InvalidAuthTypeError as k, getDefaultHostConfig as l, isHostCrossOrigin as m, addInterceptor as n, removeInterceptor as o, handleAuthenticationError as p, createInterceptors as r, determineAuthType as s, addDefaultInterceptors as t, getRestCallAuthParams as u, onFatalAuthError as v, setDefaultHostConfig as w, registerAuthModule as x, onPageRedirectRequested as y, generateRandomString as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as isBrowser } from "./utils-vv-xFm06.js";
|
|
2
|
-
import { n as getInvokeFetchRuntimeModule } from "./public-runtime-modules-
|
|
2
|
+
import { n as getInvokeFetchRuntimeModule } from "./public-runtime-modules-BqxAMJ9M.js";
|
|
3
3
|
|
|
4
4
|
//#region src/public/invoke-fetch.ts
|
|
5
|
-
const defaultUserAgent = "qlik-api/2.3.
|
|
5
|
+
const defaultUserAgent = "qlik-api/2.3.1";
|
|
6
6
|
async function invokeFetch(api, props) {
|
|
7
7
|
const hostConfig = props.options?.hostConfig;
|
|
8
8
|
let userAgent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as EncodingError, L as InvokeFetchError, M as clearApiCache, N as invokeFetch, P as parseFetchResponse } from "./interceptors-2VSXImC9.js";
|
|
2
2
|
|
|
3
3
|
//#region src/invoke-fetch/invoke-fetch.ts
|
|
4
4
|
/**
|
|
@@ -13,17 +13,17 @@ const importRuntimeModulePromise = (async () => {
|
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
15
|
async function getAuthRuntimeModule(hostConfig) {
|
|
16
|
-
if (isNode) return import("./auth-
|
|
16
|
+
if (isNode) return import("./auth-XusKk8IA.js");
|
|
17
17
|
return (await importRuntimeModulePromise)("auth@v1", hostConfig);
|
|
18
18
|
}
|
|
19
19
|
async function getQixRuntimeModule(hostConfig) {
|
|
20
20
|
await getAuthRuntimeModule(hostConfig);
|
|
21
|
-
if (isNode) return import("./qix-
|
|
21
|
+
if (isNode) return import("./qix-DpvHvpx7.js");
|
|
22
22
|
return (await importRuntimeModulePromise)("qix@v1", hostConfig);
|
|
23
23
|
}
|
|
24
24
|
async function getInvokeFetchRuntimeModule(hostConfig) {
|
|
25
25
|
await getAuthRuntimeModule(hostConfig);
|
|
26
|
-
if (isNode) return import("./invoke-fetch-
|
|
26
|
+
if (isNode) return import("./invoke-fetch-D9lpiAb-.js");
|
|
27
27
|
return (await importRuntimeModulePromise)("invoke-fetch@v1", hostConfig);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as isBrowser } from "./utils-vv-xFm06.js";
|
|
2
|
-
import {
|
|
2
|
+
import { B as getPlatform, E as toValidWebsocketLocationUrl, N as invokeFetch, h as isWindows, p as handleAuthenticationError } from "./interceptors-2VSXImC9.js";
|
|
3
3
|
import { t as getHumanReadableSocketClosedErrorMessage } from "./websocket-errors-CRTDTtBL.js";
|
|
4
4
|
|
|
5
5
|
//#region src/qix/app-session.ts
|
|
@@ -199,7 +199,7 @@ function listenForWindowsAuthenticationInformation(session) {
|
|
|
199
199
|
* Opens the websocket and handles a few windows authentication details
|
|
200
200
|
*/
|
|
201
201
|
async function createAndSetupEnigmaSession(props, canRetry, onWebSocketEvent$1) {
|
|
202
|
-
const { createEnigmaSessionEntrypoint } = await import("./qix-chunk-entrypoint-
|
|
202
|
+
const { createEnigmaSessionEntrypoint } = await import("./qix-chunk-entrypoint-BXZPnE6J.js");
|
|
203
203
|
const session = await createEnigmaSessionEntrypoint(props);
|
|
204
204
|
setupSessionListeners(session, props, onWebSocketEvent$1);
|
|
205
205
|
let global;
|
|
@@ -445,7 +445,7 @@ function createSharedPhoenixSession(props, { onClose, onWebSocketEvent: onWebSoc
|
|
|
445
445
|
onWebSocketEventGlobal(event);
|
|
446
446
|
for (const client of clients) client.onWebSocketEvent(event);
|
|
447
447
|
};
|
|
448
|
-
const phoenixConnectionPromise = import("./qix-chunk-entrypoint-
|
|
448
|
+
const phoenixConnectionPromise = import("./qix-chunk-entrypoint-BXZPnE6J.js").then((module) => {
|
|
449
449
|
return module.createPhoenixConnectionEntrypoint(props, {
|
|
450
450
|
onWebSocketEvent: onWebSocketEvent$1,
|
|
451
451
|
getInitialAppActions
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as isNode, n as createResolvablePromise$1 } from "./utils-vv-xFm06.js";
|
|
2
|
-
import {
|
|
2
|
+
import { E as toValidWebsocketLocationUrl, F as appendQueryToUrl, R as exposeInternalApiOnWindow, f as getWebSocketAuthParams, h as isWindows, p as handleAuthenticationError, z as generateRandomString } from "./interceptors-2VSXImC9.js";
|
|
3
3
|
import { t as getHumanReadableSocketClosedErrorMessage$1 } from "./websocket-errors-CRTDTtBL.js";
|
|
4
4
|
import isPlainObject from "lodash/isPlainObject.js";
|
|
5
5
|
import merge from "lodash/merge.js";
|
package/collections.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./chunks/public-runtime-modules-
|
|
2
|
-
import { n as invokeFetch, t as clearApiCache } from "./chunks/invoke-fetch-
|
|
1
|
+
import "./chunks/public-runtime-modules-BqxAMJ9M.js";
|
|
2
|
+
import { n as invokeFetch, t as clearApiCache } from "./chunks/invoke-fetch-CckTK7bh.js";
|
|
3
3
|
|
|
4
4
|
//#region src/public/rest/collections.ts
|
|
5
5
|
/**
|
package/conditions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./chunks/public-runtime-modules-
|
|
2
|
-
import { n as invokeFetch, t as clearApiCache } from "./chunks/invoke-fetch-
|
|
1
|
+
import "./chunks/public-runtime-modules-BqxAMJ9M.js";
|
|
2
|
+
import { n as invokeFetch, t as clearApiCache } from "./chunks/invoke-fetch-CckTK7bh.js";
|
|
3
3
|
|
|
4
4
|
//#region src/public/rest/conditions.ts
|
|
5
5
|
/**
|
package/consumption.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./chunks/public-runtime-modules-
|
|
2
|
-
import { n as invokeFetch, t as clearApiCache } from "./chunks/invoke-fetch-
|
|
1
|
+
import "./chunks/public-runtime-modules-BqxAMJ9M.js";
|
|
2
|
+
import { n as invokeFetch, t as clearApiCache } from "./chunks/invoke-fetch-CckTK7bh.js";
|
|
3
3
|
|
|
4
4
|
//#region src/public/rest/consumption.ts
|
|
5
5
|
/**
|
package/core/ip-policies.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "../chunks/chunk-D3vHIbds.js";
|
|
2
|
-
import "../chunks/public-runtime-modules-
|
|
3
|
-
import { n as invokeFetch, t as clearApiCache } from "../chunks/invoke-fetch-
|
|
2
|
+
import "../chunks/public-runtime-modules-BqxAMJ9M.js";
|
|
3
|
+
import { n as invokeFetch, t as clearApiCache } from "../chunks/invoke-fetch-CckTK7bh.js";
|
|
4
4
|
|
|
5
5
|
//#region src/public/rest/core/ip-policies.ts
|
|
6
6
|
var ip_policies_exports = /* @__PURE__ */ __exportAll({
|
package/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./chunks/public-runtime-modules-
|
|
2
|
-
import "./chunks/invoke-fetch-
|
|
1
|
+
import "./chunks/public-runtime-modules-BqxAMJ9M.js";
|
|
2
|
+
import "./chunks/invoke-fetch-CckTK7bh.js";
|
|
3
3
|
import ip_policies_default, { t as ip_policies_exports } from "./core/ip-policies.js";
|
|
4
4
|
|
|
5
5
|
//#region src/public/rest/core.ts
|