@qlik/api 1.29.0 → 1.31.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 +2 -2
- package/api-keys.js +2 -2
- package/apps.d.ts +5 -13
- package/apps.js +2 -2
- package/audits.d.ts +2 -2
- package/audits.js +2 -2
- package/{auth-types-PkN9CAF_.d.ts → auth-types-DqfMuSRX.d.ts} +1 -0
- package/auth.d.ts +27 -3
- package/auth.js +8 -4
- package/automations.d.ts +38 -38
- package/automations.js +2 -2
- package/brands.d.ts +2 -2
- package/brands.js +2 -2
- package/chunks/{2BRBIRM2.js → 6ZONDHRN.js} +1 -1
- package/chunks/{2B7YWDQC.js → DLKLPD7T.js} +3 -3
- package/chunks/ETNHFALU.js +61 -0
- package/chunks/{NBW6PHZU.js → FKDGGR2O.js} +158 -45
- package/chunks/{KYCIMQ4L.js → GUU3KZGK.js} +11 -1
- package/chunks/{5XNSGPGZ.js → KBSD75QL.js} +1 -1
- package/chunks/{4D5NADHK.js → LY7RP2HA.js} +7 -3
- package/chunks/{QOOCP2TS.js → M64RLKVG.js} +2074 -12
- package/chunks/{5MRIMVKS.js → PLVPW5IR.js} +17 -20
- package/chunks/{MGXEGSJC.js → UZTIZ4H5.js} +392 -372
- package/chunks/{WQYEWU54.js → YKZ2QYHN.js} +2 -2
- package/collections.d.ts +3 -3
- package/collections.js +2 -2
- package/csp-origins.d.ts +2 -2
- package/csp-origins.js +2 -2
- package/data-assets.d.ts +2 -2
- package/data-assets.js +2 -2
- package/data-connections.d.ts +8 -8
- package/data-connections.js +2 -2
- package/data-credentials.d.ts +2 -2
- package/data-credentials.js +2 -2
- package/data-files.d.ts +2 -2
- package/data-files.js +2 -2
- package/docs/authentication.md +47 -0
- package/extensions.d.ts +2 -2
- package/extensions.js +2 -2
- package/glossaries.d.ts +22 -15
- package/glossaries.js +2 -2
- package/groups.d.ts +5 -4
- package/groups.js +2 -2
- package/identity-providers.d.ts +2 -2
- package/identity-providers.js +2 -2
- package/index.d.ts +10 -4
- package/index.js +29 -4
- package/interceptors.d.ts +2 -2
- package/{invoke-fetch-types-BXn-uSF5.d.ts → invoke-fetch-types-Cq7bjkqn.d.ts} +10 -2
- package/items.d.ts +3 -3
- package/items.js +2 -2
- package/licenses.d.ts +5 -2
- package/licenses.js +2 -2
- package/oauth-clients.d.ts +521 -0
- package/oauth-clients.js +112 -0
- package/package.json +4 -2
- package/qix.d.ts +422 -27
- package/qix.js +2 -2
- package/quotas.d.ts +2 -2
- package/quotas.js +2 -2
- package/reload-tasks.d.ts +4 -2
- package/reload-tasks.js +2 -2
- package/reloads.d.ts +6 -2
- package/reloads.js +2 -2
- package/reports.d.ts +4 -2
- package/reports.js +2 -2
- package/roles.d.ts +14 -4
- package/roles.js +2 -2
- package/spaces.d.ts +3 -7
- package/spaces.js +2 -2
- package/temp-contents.d.ts +2 -2
- package/temp-contents.js +2 -2
- package/tenants.d.ts +2 -2
- package/tenants.js +2 -2
- package/themes.d.ts +2 -2
- package/themes.js +2 -2
- package/transports.d.ts +2 -2
- package/transports.js +2 -2
- package/users.d.ts +2 -2
- package/users.js +2 -2
- package/web-integrations.d.ts +2 -2
- package/web-integrations.js +2 -2
- package/web-notifications.d.ts +2 -2
- package/web-notifications.js +2 -2
- package/webhooks.d.ts +2 -2
- package/webhooks.js +2 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/qix/session/websocket-errors.ts
|
|
2
|
+
var closeCodeEngineTerminating = 4003;
|
|
3
|
+
var closeCodeEngineProxyGeneric = 4200;
|
|
4
|
+
var closeCodeClientTimeout = 4201;
|
|
5
|
+
var closeCodeBadRequest = 4202;
|
|
6
|
+
var closeCodePermissions = 4203;
|
|
7
|
+
var closeCodeNotFound = 4204;
|
|
8
|
+
var closeCodeTooManyRequests = 4205;
|
|
9
|
+
var closeCodeNetwork = 4206;
|
|
10
|
+
var closeCodeDependencyGeneric = 4210;
|
|
11
|
+
var closeCodeDependencyUnavailable = 4211;
|
|
12
|
+
var closeCodeEngineGeneric = 4220;
|
|
13
|
+
var closeCodeEntitlement = 4230;
|
|
14
|
+
var closeCodeNoEnginesAvailable = 4240;
|
|
15
|
+
var CloseCodeSessionReservationMissing = 4222;
|
|
16
|
+
var closeCodeMessages = {
|
|
17
|
+
1e3: "Connection closed normally.",
|
|
18
|
+
1001: "Going away.",
|
|
19
|
+
1002: "Protocol error.",
|
|
20
|
+
1003: "Unsupported data.",
|
|
21
|
+
1005: "No status received.",
|
|
22
|
+
1006: "Abnormal closure.",
|
|
23
|
+
1007: "Invalid frame payload data.",
|
|
24
|
+
1008: "Policy violation.",
|
|
25
|
+
1009: "Message too big.",
|
|
26
|
+
1010: "Mandatory extension missing.",
|
|
27
|
+
1011: "Server internal error.",
|
|
28
|
+
1012: "Service restart.",
|
|
29
|
+
1013: "Try again later.",
|
|
30
|
+
1014: "Bad gateway.",
|
|
31
|
+
1015: "TLS handshake failure.",
|
|
32
|
+
[closeCodeEngineTerminating]: "The engine is in terminating state",
|
|
33
|
+
[closeCodeEngineProxyGeneric]: "A problem occurred in engine-proxy",
|
|
34
|
+
[closeCodeClientTimeout]: "The client has closed the connection",
|
|
35
|
+
[closeCodeBadRequest]: "The provided request is invalid and/or malformed",
|
|
36
|
+
[closeCodePermissions]: "No permission to open the app",
|
|
37
|
+
[closeCodeNotFound]: "App not found",
|
|
38
|
+
[closeCodeTooManyRequests]: "Too many requests have been sent in a given amount of time",
|
|
39
|
+
[closeCodeNetwork]: "Networking issues",
|
|
40
|
+
[closeCodeDependencyGeneric]: "A problem occurred in a dependency of engine-proxy",
|
|
41
|
+
[closeCodeDependencyUnavailable]: "A dependency is unavailable and not serving any requests",
|
|
42
|
+
[closeCodeEngineGeneric]: "A problem occurred in an engine",
|
|
43
|
+
[closeCodeEntitlement]: "You are not entitled to perform that operation",
|
|
44
|
+
[closeCodeNoEnginesAvailable]: "There are currently no engines available",
|
|
45
|
+
[CloseCodeSessionReservationMissing]: "The reserved session is missing"
|
|
46
|
+
};
|
|
47
|
+
var uknownCloseErrorMessage = "websocket closed for unknown reason";
|
|
48
|
+
function getHumanReadableSocketClosedErrorMessage(err, { appId, hostConfig }) {
|
|
49
|
+
const closeCode = err?.original?.code || err?.code;
|
|
50
|
+
const reason = err?.original?.reason || err?.reason;
|
|
51
|
+
const closeMessage = closeCode && closeCodeMessages[closeCode] || reason || err.message || uknownCloseErrorMessage;
|
|
52
|
+
if (hostConfig?.host) {
|
|
53
|
+
return `Failed to open app ${appId} on ${hostConfig?.host}: ${closeMessage}`;
|
|
54
|
+
} else {
|
|
55
|
+
return `Failed to open app ${appId}: ${closeMessage}`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
getHumanReadableSocketClosedErrorMessage
|
|
61
|
+
};
|
|
@@ -6,37 +6,79 @@ import {
|
|
|
6
6
|
isNode
|
|
7
7
|
} from "./2ZQ3ZX7F.js";
|
|
8
8
|
|
|
9
|
+
// src/auth/internal/host-config-registry.ts
|
|
10
|
+
var registeredHostConfigs = {};
|
|
11
|
+
function registerHostConfigInternal(name, hostConfig) {
|
|
12
|
+
if (hostConfig?.reference) {
|
|
13
|
+
throw new InvalidHostConfigError("Cannot register a host config with a reference");
|
|
14
|
+
}
|
|
15
|
+
if (registeredHostConfigs[name]) {
|
|
16
|
+
console.warn(`registerHostConfig: Host config with name "${name}" is already registered. Overwriting.`);
|
|
17
|
+
}
|
|
18
|
+
registeredHostConfigs[name] = hostConfig;
|
|
19
|
+
}
|
|
20
|
+
function unregisterHostConfigInternal(name) {
|
|
21
|
+
if (registeredHostConfigs[name]) {
|
|
22
|
+
delete registeredHostConfigs[name];
|
|
23
|
+
} else {
|
|
24
|
+
console.warn(`unregisterHostConfig: Host config with name "${name}" not found.`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function getRegisteredHostConfigInternal(name) {
|
|
28
|
+
if (!registeredHostConfigs[name]) {
|
|
29
|
+
throw new Error(`Host config with name "${name}" not found.`);
|
|
30
|
+
}
|
|
31
|
+
return registeredHostConfigs[name];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/auth/internal/default-host-config.ts
|
|
35
|
+
var defaultHostConfig = {};
|
|
36
|
+
function setDefaultHostConfigInternal(hostConfig) {
|
|
37
|
+
defaultHostConfig = hostConfig || {};
|
|
38
|
+
}
|
|
39
|
+
function withResolvedHostConfig(hostConfig) {
|
|
40
|
+
if (hostConfig?.reference) {
|
|
41
|
+
return getRegisteredHostConfigInternal(hostConfig.reference);
|
|
42
|
+
}
|
|
43
|
+
if (hostConfig && Object.keys(hostConfig).length > 0) {
|
|
44
|
+
return hostConfig;
|
|
45
|
+
}
|
|
46
|
+
return defaultHostConfig;
|
|
47
|
+
}
|
|
48
|
+
|
|
9
49
|
// src/platform/platform-functions.ts
|
|
10
50
|
var getPlatform = async (options = {}) => {
|
|
51
|
+
const hc = withResolvedHostConfig(options.hostConfig);
|
|
52
|
+
const isAnonymous = hc?.authType === "anonymous" || !!hc.accessCode;
|
|
11
53
|
const isNodeEnvironment = typeof window === "undefined";
|
|
12
54
|
if (isNodeEnvironment) {
|
|
13
|
-
return result({ isNodeEnv: true });
|
|
55
|
+
return result({ isNodeEnv: true, isAnonymous });
|
|
14
56
|
}
|
|
15
57
|
const { data: productInfo, status } = await getProductInfo(options);
|
|
16
58
|
if (status === 404) {
|
|
17
|
-
return result({ isUnknown: true });
|
|
59
|
+
return result({ isUnknown: true, isAnonymous });
|
|
18
60
|
}
|
|
19
61
|
if (!productInfo || status <= 399 && status >= 300) {
|
|
20
|
-
return result({ isQSE: true, isWindows: true });
|
|
62
|
+
return result({ isQSE: true, isWindows: true, isAnonymous });
|
|
21
63
|
}
|
|
22
64
|
const deploymentType = (productInfo.composition?.deploymentType || "").toLowerCase();
|
|
23
65
|
const isControlCenter = deploymentType === "controlcenter";
|
|
24
66
|
if (deploymentType === "qliksenseserver") {
|
|
25
|
-
return result({ isQSE: true, isWindows: true });
|
|
67
|
+
return result({ isQSE: true, isWindows: true, isAnonymous, meta: extractMeta(productInfo) });
|
|
26
68
|
}
|
|
27
69
|
if (deploymentType === "qliksensedesktop") {
|
|
28
|
-
return result({ isQSD: true, isWindows: true });
|
|
70
|
+
return result({ isQSD: true, isWindows: true, isAnonymous, meta: extractMeta(productInfo) });
|
|
29
71
|
}
|
|
30
72
|
if (deploymentType === "qliksensemobile") {
|
|
31
|
-
return result({ isQSE: true, isWindows: true });
|
|
73
|
+
return result({ isQSE: true, isWindows: true, isAnonymous, meta: extractMeta(productInfo) });
|
|
32
74
|
}
|
|
33
75
|
if (deploymentType === "cloud-console") {
|
|
34
|
-
return result({ isCloud: true, isCloudConsole: true });
|
|
76
|
+
return result({ isCloud: true, isCloudConsole: true, isAnonymous, meta: extractMeta(productInfo) });
|
|
35
77
|
}
|
|
36
78
|
if (productInfo.composition?.provider === "fedramp") {
|
|
37
|
-
return result({ isCloud: true, isQCG: true, isControlCenter });
|
|
79
|
+
return result({ isCloud: true, isQCG: true, isControlCenter, isAnonymous, meta: extractMeta(productInfo) });
|
|
38
80
|
}
|
|
39
|
-
return result({ isCloud: true, isQCS: true, isControlCenter });
|
|
81
|
+
return result({ isCloud: true, isQCS: true, isControlCenter, isAnonymous, meta: extractMeta(productInfo) });
|
|
40
82
|
};
|
|
41
83
|
var productInfoPromises = {};
|
|
42
84
|
function templateUrl(baseUrl) {
|
|
@@ -73,6 +115,27 @@ var getProductInfo = async ({ hostConfig, noCache } = {}) => {
|
|
|
73
115
|
}
|
|
74
116
|
}
|
|
75
117
|
};
|
|
118
|
+
var extractMeta = (data) => {
|
|
119
|
+
const urls = data.externalUrls;
|
|
120
|
+
if (!urls) {
|
|
121
|
+
return void 0;
|
|
122
|
+
}
|
|
123
|
+
const productName = data.composition?.productName ?? "Qlik";
|
|
124
|
+
const releaseLabel = data.composition?.releaseLabel || "-";
|
|
125
|
+
const productLabel = releaseLabel === "-" ? productName : `${productName} (${releaseLabel})`;
|
|
126
|
+
return {
|
|
127
|
+
productId: data.composition?.senseId ?? "qlik",
|
|
128
|
+
productLabel,
|
|
129
|
+
version: data.composition?.version,
|
|
130
|
+
urls: {
|
|
131
|
+
personalHelpBaseUrl: urls.personalHelpBaseUrl,
|
|
132
|
+
personalUpgradeBase: urls.personalUpgradeBase,
|
|
133
|
+
personalUpgradeUrl: urls.personalUpgradeUrl,
|
|
134
|
+
serverHelpBaseUrl: urls.serverHelpBaseUrl,
|
|
135
|
+
qlikWebPageUrl: urls.qlikWebPageUrl
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
};
|
|
76
139
|
var result = (data) => ({
|
|
77
140
|
isNodeEnv: false,
|
|
78
141
|
isCloud: false,
|
|
@@ -84,21 +147,10 @@ var result = (data) => ({
|
|
|
84
147
|
isQSE: false,
|
|
85
148
|
isQSD: false,
|
|
86
149
|
isUnknown: false,
|
|
150
|
+
isAnonymous: false,
|
|
87
151
|
...data
|
|
88
152
|
});
|
|
89
153
|
|
|
90
|
-
// src/auth/internal/default-host-config.ts
|
|
91
|
-
var defaultHostConfig = {};
|
|
92
|
-
function setDefaultHostConfig(hostConfig) {
|
|
93
|
-
defaultHostConfig = hostConfig || {};
|
|
94
|
-
}
|
|
95
|
-
function withDefaultHostConfig(hostConfig) {
|
|
96
|
-
if (hostConfig && Object.keys(hostConfig).length > 0) {
|
|
97
|
-
return hostConfig;
|
|
98
|
-
}
|
|
99
|
-
return defaultHostConfig;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
154
|
// src/auth/internal/auth-module-registry.ts
|
|
103
155
|
var authModules = {};
|
|
104
156
|
var ongoingAuthModuleLoading = Promise.resolve();
|
|
@@ -112,7 +164,7 @@ function getRegisteredAuthModule(authType) {
|
|
|
112
164
|
return authModules[authType.toLowerCase()];
|
|
113
165
|
}
|
|
114
166
|
async function getAuthModule(hostConfig) {
|
|
115
|
-
const hostConfigToUse =
|
|
167
|
+
const hostConfigToUse = withResolvedHostConfig(hostConfig);
|
|
116
168
|
const authType = await determineAuthType(hostConfigToUse);
|
|
117
169
|
if (ongoingAuthModuleLoading) {
|
|
118
170
|
await ongoingAuthModuleLoading;
|
|
@@ -172,7 +224,7 @@ var InvalidAuthTypeError = class extends Error {
|
|
|
172
224
|
constructor(authType) {
|
|
173
225
|
const validAuthModules = getRegisteredAuthModules();
|
|
174
226
|
super(
|
|
175
|
-
`Not a valid auth type: ${authType}, valid auth types are; '${validAuthModules.filter((name) => name !== "
|
|
227
|
+
`Not a valid auth type: ${authType}, valid auth types are; '${validAuthModules.filter((name) => name.toLowerCase() !== "qmfeembedframerauthmodule").join("', '")}'`
|
|
176
228
|
);
|
|
177
229
|
this.name = "InvalidAuthTypeError";
|
|
178
230
|
}
|
|
@@ -208,7 +260,7 @@ function isHostCrossOrigin(hostConfig) {
|
|
|
208
260
|
if (!globalThis.location?.origin) {
|
|
209
261
|
return true;
|
|
210
262
|
}
|
|
211
|
-
const hostConfigToUse =
|
|
263
|
+
const hostConfigToUse = withResolvedHostConfig(hostConfig);
|
|
212
264
|
if (Object.keys(hostConfigToUse).length === 0) {
|
|
213
265
|
return false;
|
|
214
266
|
}
|
|
@@ -220,7 +272,10 @@ function isHostCrossOrigin(hostConfig) {
|
|
|
220
272
|
return false;
|
|
221
273
|
}
|
|
222
274
|
async function isWindows(hostConfig) {
|
|
223
|
-
const hostConfigToUse =
|
|
275
|
+
const hostConfigToUse = withResolvedHostConfig(hostConfig);
|
|
276
|
+
if (typeof hostConfigToUse.forceIsWindows === "boolean") {
|
|
277
|
+
return hostConfigToUse.forceIsWindows;
|
|
278
|
+
}
|
|
224
279
|
if (hostConfigToUse.authType === "cookie") {
|
|
225
280
|
return false;
|
|
226
281
|
}
|
|
@@ -230,7 +285,7 @@ async function isWindows(hostConfig) {
|
|
|
230
285
|
return (await getPlatform({ hostConfig })).isWindows;
|
|
231
286
|
}
|
|
232
287
|
function toValidLocationUrl(hostConfig) {
|
|
233
|
-
const url =
|
|
288
|
+
const url = withResolvedHostConfig(hostConfig)?.host;
|
|
234
289
|
let locationUrl;
|
|
235
290
|
if (!url) {
|
|
236
291
|
locationUrl = "";
|
|
@@ -245,7 +300,7 @@ function toValidLocationUrl(hostConfig) {
|
|
|
245
300
|
return locationUrl;
|
|
246
301
|
}
|
|
247
302
|
function toValidWebsocketLocationUrl(hostConfig) {
|
|
248
|
-
const url =
|
|
303
|
+
const url = withResolvedHostConfig(hostConfig)?.host;
|
|
249
304
|
let locationUrl;
|
|
250
305
|
if (!url) {
|
|
251
306
|
locationUrl = globalThis.location.origin;
|
|
@@ -260,7 +315,7 @@ function toValidWebsocketLocationUrl(hostConfig) {
|
|
|
260
315
|
return locationUrl.replace(leadingHttp, "ws");
|
|
261
316
|
}
|
|
262
317
|
async function getWebSocketAuthParams(props) {
|
|
263
|
-
const hostConfigToUse =
|
|
318
|
+
const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
|
|
264
319
|
try {
|
|
265
320
|
const authModule = await getAuthModule(hostConfigToUse);
|
|
266
321
|
return await authModule.getWebSocketAuthParams({
|
|
@@ -273,7 +328,7 @@ async function getWebSocketAuthParams(props) {
|
|
|
273
328
|
}
|
|
274
329
|
}
|
|
275
330
|
async function getWebResourceAuthParams(props) {
|
|
276
|
-
const hostConfigToUse =
|
|
331
|
+
const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
|
|
277
332
|
try {
|
|
278
333
|
const authModule = await getAuthModule(hostConfigToUse);
|
|
279
334
|
return await authModule.getWebResourceAuthParams?.({
|
|
@@ -286,7 +341,7 @@ async function getWebResourceAuthParams(props) {
|
|
|
286
341
|
}
|
|
287
342
|
}
|
|
288
343
|
async function handleAuthenticationError(props) {
|
|
289
|
-
const hostConfigToUse =
|
|
344
|
+
const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
|
|
290
345
|
const authModule = await getAuthModule(hostConfigToUse);
|
|
291
346
|
const result2 = await authModule.handleAuthenticationError({
|
|
292
347
|
...props,
|
|
@@ -301,7 +356,7 @@ async function handleAuthenticationError(props) {
|
|
|
301
356
|
return result2;
|
|
302
357
|
}
|
|
303
358
|
async function getRestCallAuthParams(props) {
|
|
304
|
-
const hostConfigToUse =
|
|
359
|
+
const hostConfigToUse = withResolvedHostConfig(props.hostConfig);
|
|
305
360
|
try {
|
|
306
361
|
const authModule = await getAuthModule(hostConfigToUse);
|
|
307
362
|
return await authModule.getRestCallAuthParams({
|
|
@@ -324,11 +379,17 @@ async function getAccessToken(props) {
|
|
|
324
379
|
function registerAuthModule2(name, authModule) {
|
|
325
380
|
registerAuthModule(name, authModule);
|
|
326
381
|
}
|
|
327
|
-
function
|
|
328
|
-
|
|
382
|
+
function setDefaultHostConfig(hostConfig) {
|
|
383
|
+
setDefaultHostConfigInternal(hostConfig);
|
|
384
|
+
}
|
|
385
|
+
function registerHostConfig(name, hostConfig) {
|
|
386
|
+
registerHostConfigInternal(name, hostConfig);
|
|
387
|
+
}
|
|
388
|
+
function unregisterHostConfig(name) {
|
|
389
|
+
unregisterHostConfigInternal(name);
|
|
329
390
|
}
|
|
330
391
|
function serializeHostConfig(hostConfig) {
|
|
331
|
-
const hostConfigToUse =
|
|
392
|
+
const hostConfigToUse = withResolvedHostConfig(hostConfig);
|
|
332
393
|
return JSON.stringify(hostConfigToUse, hostConfigPropertyIgnorer);
|
|
333
394
|
}
|
|
334
395
|
async function determineAuthType(hostConfig) {
|
|
@@ -347,13 +408,16 @@ async function determineAuthType(hostConfig) {
|
|
|
347
408
|
if (hostConfig.webIntegrationId) {
|
|
348
409
|
return "cookie";
|
|
349
410
|
}
|
|
411
|
+
if (hostConfig.reference) {
|
|
412
|
+
return "reference";
|
|
413
|
+
}
|
|
350
414
|
if (await isWindows(hostConfig)) {
|
|
351
415
|
return "windowscookie";
|
|
352
416
|
}
|
|
353
417
|
return "cookie";
|
|
354
418
|
}
|
|
355
419
|
function checkForCrossDomainRequest(hostConfig) {
|
|
356
|
-
const hostConfigToUse =
|
|
420
|
+
const hostConfigToUse = withResolvedHostConfig(hostConfig);
|
|
357
421
|
if (isHostCrossOrigin(hostConfigToUse)) {
|
|
358
422
|
if (Object.keys(hostConfigToUse).length === 0) {
|
|
359
423
|
throw new InvalidHostConfigError("a host config must be provided when making a cross domain request");
|
|
@@ -446,6 +510,17 @@ function internalValidateHostConfig(hostConfig, options) {
|
|
|
446
510
|
return true;
|
|
447
511
|
}
|
|
448
512
|
|
|
513
|
+
// src/utils/expose-internal-test-apis.ts
|
|
514
|
+
var internalApisName = "__QLIK_INTERNAL__DO_NOT_USE_OR_YOU_WILL_BE_FIRED";
|
|
515
|
+
function exposeInternalApiOnWindow(name, fn) {
|
|
516
|
+
if (globalThis.location?.origin.startsWith("https://localhost:") || globalThis.location?.origin?.endsWith("qlik-stage.com")) {
|
|
517
|
+
if (globalThis[internalApisName] === void 0) {
|
|
518
|
+
globalThis[internalApisName] = {};
|
|
519
|
+
}
|
|
520
|
+
globalThis[internalApisName][name] = fn;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
449
524
|
// src/auth/internal/default-auth-modules/oauth/storage-helpers.ts
|
|
450
525
|
var storagePrefix = "qlik-qmfe-api";
|
|
451
526
|
function getTopicFromOauthHostConfig(hostConfig) {
|
|
@@ -462,6 +537,20 @@ function getTopicFromAnonHostConfig(hostConfig) {
|
|
|
462
537
|
return `${hostConfig.accessCode}_${hostConfig.clientId}`;
|
|
463
538
|
}
|
|
464
539
|
var cachedTokens = {};
|
|
540
|
+
function clearAllCachedTokens() {
|
|
541
|
+
for (const key in cachedTokens) {
|
|
542
|
+
delete cachedTokens[key];
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
exposeInternalApiOnWindow("clearAllAccessTokens", () => {
|
|
546
|
+
console.log("Clearing tokens", cachedTokens);
|
|
547
|
+
Object.keys(cachedTokens).forEach((key) => {
|
|
548
|
+
console.log("Clearing access tokens for", key);
|
|
549
|
+
deleteFromLocalStorage(key, ["access-token", "refresh-token"]);
|
|
550
|
+
deleteFromSessionStorage(key, ["access-token", "refresh-token"]);
|
|
551
|
+
});
|
|
552
|
+
clearAllCachedTokens();
|
|
553
|
+
});
|
|
465
554
|
function saveInLocalStorage(topic, name, value) {
|
|
466
555
|
localStorage.setItem(`${storagePrefix}-${topic}-${name}`, value);
|
|
467
556
|
}
|
|
@@ -530,6 +619,7 @@ async function loadOrAcquireAccessToken(topic, acquireTokens, noCache, accessTok
|
|
|
530
619
|
const mayUseStorage = isBrowser();
|
|
531
620
|
const storedOauthTokens = cachedTokens[topic] || (mayUseStorage ? loadOauthTokensFromStorage(topic, accessTokenStorage) : void 0);
|
|
532
621
|
if (storedOauthTokens) {
|
|
622
|
+
cachedTokens[topic] = storedOauthTokens;
|
|
533
623
|
return Promise.resolve(storedOauthTokens);
|
|
534
624
|
}
|
|
535
625
|
const tokensPromise = acquireTokens();
|
|
@@ -1394,6 +1484,23 @@ var oauth_default = {
|
|
|
1394
1484
|
})
|
|
1395
1485
|
};
|
|
1396
1486
|
|
|
1487
|
+
// src/auth/internal/default-auth-modules/reference.ts
|
|
1488
|
+
function getRestCallAuthParams7() {
|
|
1489
|
+
throw new Error("getRestCallAuthParams should never be called for reference auth module");
|
|
1490
|
+
}
|
|
1491
|
+
function getWebSocketAuthParams7() {
|
|
1492
|
+
throw new Error("getWebSocketAuthParams should never be called for reference auth module");
|
|
1493
|
+
}
|
|
1494
|
+
function handleAuthenticationError7() {
|
|
1495
|
+
throw new Error("handleAuthenticationError should never be called for reference auth module");
|
|
1496
|
+
}
|
|
1497
|
+
var reference_default = {
|
|
1498
|
+
getRestCallAuthParams: getRestCallAuthParams7,
|
|
1499
|
+
getWebSocketAuthParams: getWebSocketAuthParams7,
|
|
1500
|
+
handleAuthenticationError: handleAuthenticationError7,
|
|
1501
|
+
validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, { requiredProps: ["reference"], optionalProps: [] })
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1397
1504
|
// src/auth/internal/default-auth-modules/windows-cookie/xrf-keys.ts
|
|
1398
1505
|
var xrfKeys = {};
|
|
1399
1506
|
function createXrfKey() {
|
|
@@ -1417,7 +1524,7 @@ function getXrfKey(hostConfig) {
|
|
|
1417
1524
|
}
|
|
1418
1525
|
|
|
1419
1526
|
// src/auth/internal/default-auth-modules/windows-cookie.ts
|
|
1420
|
-
async function
|
|
1527
|
+
async function getRestCallAuthParams8({
|
|
1421
1528
|
hostConfig
|
|
1422
1529
|
}) {
|
|
1423
1530
|
return {
|
|
@@ -1430,7 +1537,7 @@ async function getRestCallAuthParams7({
|
|
|
1430
1537
|
credentials: getCredentialsForCookieAuth(hostConfig)
|
|
1431
1538
|
};
|
|
1432
1539
|
}
|
|
1433
|
-
async function
|
|
1540
|
+
async function getWebSocketAuthParams8({
|
|
1434
1541
|
hostConfig
|
|
1435
1542
|
}) {
|
|
1436
1543
|
return {
|
|
@@ -1440,7 +1547,7 @@ async function getWebSocketAuthParams7({
|
|
|
1440
1547
|
}
|
|
1441
1548
|
};
|
|
1442
1549
|
}
|
|
1443
|
-
async function
|
|
1550
|
+
async function handleAuthenticationError8({
|
|
1444
1551
|
hostConfig
|
|
1445
1552
|
}) {
|
|
1446
1553
|
if (hostConfig.loginUri) {
|
|
@@ -1459,9 +1566,9 @@ async function handleAuthenticationError7({
|
|
|
1459
1566
|
};
|
|
1460
1567
|
}
|
|
1461
1568
|
var windows_cookie_default = {
|
|
1462
|
-
getRestCallAuthParams:
|
|
1463
|
-
getWebSocketAuthParams:
|
|
1464
|
-
handleAuthenticationError:
|
|
1569
|
+
getRestCallAuthParams: getRestCallAuthParams8,
|
|
1570
|
+
getWebSocketAuthParams: getWebSocketAuthParams8,
|
|
1571
|
+
handleAuthenticationError: handleAuthenticationError8,
|
|
1465
1572
|
validateHostConfig: (hostConfig) => internalValidateHostConfig(hostConfig, {
|
|
1466
1573
|
requiredProps: [],
|
|
1467
1574
|
optionalProps: ["loginUri", "crossSiteCookies"]
|
|
@@ -1479,6 +1586,7 @@ function registerDefaultAuthModules() {
|
|
|
1479
1586
|
registerAuthModule("oauth2", oauth_default);
|
|
1480
1587
|
registerAuthModule("anonymous", anonymous_default);
|
|
1481
1588
|
registerAuthModule("windowscookie", windows_cookie_default);
|
|
1589
|
+
registerAuthModule("reference", reference_default);
|
|
1482
1590
|
authModulesRegistered = true;
|
|
1483
1591
|
}
|
|
1484
1592
|
}
|
|
@@ -1486,7 +1594,9 @@ registerDefaultAuthModules();
|
|
|
1486
1594
|
var auth = {
|
|
1487
1595
|
logout,
|
|
1488
1596
|
registerAuthModule,
|
|
1489
|
-
setDefaultHostConfig
|
|
1597
|
+
setDefaultHostConfig,
|
|
1598
|
+
registerHostConfig,
|
|
1599
|
+
unregisterHostConfig,
|
|
1490
1600
|
getRestCallAuthParams,
|
|
1491
1601
|
getWebSocketAuthParams,
|
|
1492
1602
|
getWebResourceAuthParams,
|
|
@@ -2103,9 +2213,9 @@ function cleanStack(stack) {
|
|
|
2103
2213
|
// src/invoke-fetch/invoke-fetch-functions.ts
|
|
2104
2214
|
var defaultUserAgent = "qmfe-api/latest";
|
|
2105
2215
|
async function invokeFetch(api, props, interceptors) {
|
|
2106
|
-
|
|
2216
|
+
const effectiveInterceptors = interceptors || getInterceptors();
|
|
2107
2217
|
const invokeFetchFinal = (reqeust) => invokeFetchIntercepted(api, reqeust);
|
|
2108
|
-
const withInterceptors = (
|
|
2218
|
+
const withInterceptors = (effectiveInterceptors || []).reduce(
|
|
2109
2219
|
(proceed, interceptor) => (request) => interceptor(request, proceed),
|
|
2110
2220
|
invokeFetchFinal
|
|
2111
2221
|
);
|
|
@@ -2215,12 +2325,15 @@ export {
|
|
|
2215
2325
|
getRestCallAuthParams,
|
|
2216
2326
|
getAccessToken,
|
|
2217
2327
|
registerAuthModule2 as registerAuthModule,
|
|
2218
|
-
|
|
2328
|
+
setDefaultHostConfig,
|
|
2329
|
+
registerHostConfig,
|
|
2330
|
+
unregisterHostConfig,
|
|
2219
2331
|
serializeHostConfig,
|
|
2220
2332
|
determineAuthType,
|
|
2221
2333
|
checkForCrossDomainRequest,
|
|
2222
2334
|
logout,
|
|
2223
2335
|
generateRandomString,
|
|
2336
|
+
exposeInternalApiOnWindow,
|
|
2224
2337
|
InvokeFetchError,
|
|
2225
2338
|
EncodingError,
|
|
2226
2339
|
invokeFetch,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAuthRuntimeModule
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./DLKLPD7T.js";
|
|
4
4
|
|
|
5
5
|
// src/public/auth.ts
|
|
6
6
|
function registerAuthModule(name, authModule) {
|
|
@@ -12,12 +12,20 @@ function logout() {
|
|
|
12
12
|
function setDefaultHostConfig(hostConfig) {
|
|
13
13
|
void getAuthRuntimeModule(hostConfig).then((impl) => impl.setDefaultHostConfig(hostConfig));
|
|
14
14
|
}
|
|
15
|
+
function registerHostConfig(name, hostConfig) {
|
|
16
|
+
void getAuthRuntimeModule(hostConfig).then((impl) => impl.registerHostConfig(name, hostConfig));
|
|
17
|
+
}
|
|
18
|
+
function unregisterHostConfig(name) {
|
|
19
|
+
void getAuthRuntimeModule().then((impl) => impl.unregisterHostConfig(name));
|
|
20
|
+
}
|
|
15
21
|
async function getAccessToken({ hostConfig }) {
|
|
16
22
|
return getAuthRuntimeModule(hostConfig).then((impl) => impl.getAccessToken({ hostConfig }));
|
|
17
23
|
}
|
|
18
24
|
var auth_default = {
|
|
19
25
|
registerAuthModule,
|
|
20
26
|
setDefaultHostConfig,
|
|
27
|
+
registerHostConfig,
|
|
28
|
+
unregisterHostConfig,
|
|
21
29
|
getAccessToken
|
|
22
30
|
};
|
|
23
31
|
|
|
@@ -25,6 +33,8 @@ export {
|
|
|
25
33
|
registerAuthModule,
|
|
26
34
|
logout,
|
|
27
35
|
setDefaultHostConfig,
|
|
36
|
+
registerHostConfig,
|
|
37
|
+
unregisterHostConfig,
|
|
28
38
|
getAccessToken,
|
|
29
39
|
auth_default
|
|
30
40
|
};
|
|
@@ -15,11 +15,13 @@ import {
|
|
|
15
15
|
isWindows,
|
|
16
16
|
logout,
|
|
17
17
|
registerAuthModule,
|
|
18
|
+
registerHostConfig,
|
|
18
19
|
serializeHostConfig,
|
|
19
20
|
setDefaultHostConfig,
|
|
20
21
|
toValidLocationUrl,
|
|
21
|
-
toValidWebsocketLocationUrl
|
|
22
|
-
|
|
22
|
+
toValidWebsocketLocationUrl,
|
|
23
|
+
unregisterHostConfig
|
|
24
|
+
} from "./FKDGGR2O.js";
|
|
23
25
|
import "./3RGGGGAR.js";
|
|
24
26
|
import "./2ZQ3ZX7F.js";
|
|
25
27
|
export {
|
|
@@ -39,8 +41,10 @@ export {
|
|
|
39
41
|
isWindows,
|
|
40
42
|
logout,
|
|
41
43
|
registerAuthModule,
|
|
44
|
+
registerHostConfig,
|
|
42
45
|
serializeHostConfig,
|
|
43
46
|
setDefaultHostConfig,
|
|
44
47
|
toValidLocationUrl,
|
|
45
|
-
toValidWebsocketLocationUrl
|
|
48
|
+
toValidWebsocketLocationUrl,
|
|
49
|
+
unregisterHostConfig
|
|
46
50
|
};
|