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