@qlik/api 1.19.0 → 1.21.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.js +2 -2
- package/apps.js +2 -2
- package/audits.js +2 -2
- package/auth.d.ts +24 -1
- package/auth.js +2 -2
- package/automations.js +2 -2
- package/brands.js +2 -2
- package/chunks/{VISO65GO.js → 2OQLWLWE.js} +3 -3
- package/chunks/{P5AG7AME.js → 3FHEUGST.js} +1 -1
- package/chunks/{ILZFMC3L.js → 4M3Q6QY3.js} +19 -3
- package/chunks/{63L3IUY2.js → BUSRKHDX.js} +33 -5
- package/chunks/{BOJLTXK6.js → DTGUILK5.js} +2 -2
- package/chunks/{GLS4DAZ4.js → EUWNVVK5.js} +12 -4
- package/chunks/{AKBUFQRX.js → GVE5ABSG.js} +1 -1
- package/chunks/{J6G5ZOKI.js → JCJIPO2A.js} +1 -1
- package/chunks/{64RJJHEL.js → LVRC5AWE.js} +3 -1
- package/chunks/{KKAWWYOT.js → YQLW56LG.js} +11 -2
- package/collections.js +2 -2
- package/csp-origins.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/docs/authentication.md +30 -1
- package/extensions.js +2 -2
- package/glossaries.js +2 -2
- package/groups.d.ts +16 -4
- package/groups.js +2 -2
- package/identity-providers.js +2 -2
- package/index.d.ts +47 -40
- package/index.js +189 -84
- package/items.js +2 -2
- package/licenses.d.ts +1 -1
- package/licenses.js +2 -2
- package/package.json +2 -2
- package/qix.d.ts +19 -8
- package/qix.js +6 -4
- package/quotas.js +2 -2
- package/reload-tasks.js +2 -2
- package/reloads.d.ts +1 -1
- package/reloads.js +2 -2
- package/reports.d.ts +2 -0
- package/reports.js +2 -2
- package/roles.js +2 -2
- package/spaces.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/users.d.ts +2 -0
- package/users.js +2 -2
- package/web-integrations.js +2 -2
- package/web-notifications.js +2 -2
- package/webhooks.js +2 -2
package/api-keys.js
CHANGED
package/apps.js
CHANGED
package/audits.js
CHANGED
package/auth.d.ts
CHANGED
|
@@ -18,13 +18,36 @@ declare function logout(): void;
|
|
|
18
18
|
* @param hostConfig the default HostConfig to use
|
|
19
19
|
*/
|
|
20
20
|
declare function setDefaultHostConfig(hostConfig: HostConfig | undefined): void;
|
|
21
|
+
/**
|
|
22
|
+
* Returns an access token using the supplied host config. Typically used on the backend to supply the access token to the frontend
|
|
23
|
+
*/
|
|
21
24
|
declare function getAccessToken({ hostConfig }: {
|
|
22
25
|
hostConfig?: HostConfig;
|
|
23
26
|
}): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* The AuthApi interface provides the public interface for the auth module.
|
|
29
|
+
*/
|
|
30
|
+
interface AuthAPI {
|
|
31
|
+
/**
|
|
32
|
+
* Registers an auth module that can handle authentication. An auth module is used by specifying its name as authType in the HostConfig passed in to api calls.
|
|
33
|
+
* @param name the name of the module
|
|
34
|
+
* @param authModule the implementation of the AuthModule interface
|
|
35
|
+
*/
|
|
36
|
+
registerAuthModule: typeof registerAuthModule;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the default host config that will be used for all qmfe api calls that do not include a host config
|
|
39
|
+
* @param hostConfig the default HostConfig to use
|
|
40
|
+
*/
|
|
41
|
+
setDefaultHostConfig: typeof setDefaultHostConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Returns an access token using the supplied host config. Typically used on the backend to supply the access token to the frontend
|
|
44
|
+
*/
|
|
45
|
+
getAccessToken: typeof getAccessToken;
|
|
46
|
+
}
|
|
24
47
|
declare const _default: {
|
|
25
48
|
registerAuthModule: typeof registerAuthModule;
|
|
26
49
|
setDefaultHostConfig: typeof setDefaultHostConfig;
|
|
27
50
|
getAccessToken: typeof getAccessToken;
|
|
28
51
|
};
|
|
29
52
|
|
|
30
|
-
export { AuthModule, AuthType, HostConfig, _default as default, getAccessToken, logout, registerAuthModule, setDefaultHostConfig };
|
|
53
|
+
export { type AuthAPI, AuthModule, AuthType, HostConfig, _default as default, getAccessToken, logout, registerAuthModule, setDefaultHostConfig };
|
package/auth.js
CHANGED
package/automations.js
CHANGED
package/brands.js
CHANGED
|
@@ -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("./LVRC5AWE.js") : import("./EUWNVVK5.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("./4M3Q6QY3.js") : import("./EUWNVVK5.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("./GVE5ABSG.js") : import("./EUWNVVK5.js").then(
|
|
19
19
|
(mod) => mod.importRuntimeModule("invoke-fetch@v1", hostConfig)
|
|
20
20
|
);
|
|
21
21
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
invokeFetch,
|
|
5
5
|
isWindows,
|
|
6
6
|
toValidWebsocketLocationUrl
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./BUSRKHDX.js";
|
|
8
8
|
import {
|
|
9
9
|
isBrowser
|
|
10
10
|
} from "./2ZQ3ZX7F.js";
|
|
@@ -145,7 +145,7 @@ function listenForWindowsAuthenticationInformation(session) {
|
|
|
145
145
|
return authSuggestedInWebsocket;
|
|
146
146
|
}
|
|
147
147
|
async function createAndSetupEnigmaSession(props, canRetry) {
|
|
148
|
-
const { createEnigmaSession } = await import("./
|
|
148
|
+
const { createEnigmaSession } = await import("./3FHEUGST.js");
|
|
149
149
|
const session = await createEnigmaSession(props);
|
|
150
150
|
setupSessionListeners(session, props);
|
|
151
151
|
let global;
|
|
@@ -684,7 +684,23 @@ var qix = {
|
|
|
684
684
|
onWebSocketEvent,
|
|
685
685
|
onCombinedWebSocketStateChange,
|
|
686
686
|
resumeSuspendedSessions,
|
|
687
|
-
resumeOnlyOnReattach
|
|
687
|
+
resumeOnlyOnReattach,
|
|
688
|
+
withHostConfig: (hostConfig) => ({
|
|
689
|
+
addInitialAppAction: (openAppSessionProps, action) => addInitialAppAction(
|
|
690
|
+
typeof openAppSessionProps === "string" ? { hostConfig, appId: openAppSessionProps } : { hostConfig, ...openAppSessionProps },
|
|
691
|
+
action
|
|
692
|
+
),
|
|
693
|
+
createSessionApp,
|
|
694
|
+
openAppSession: (openAppSessionProps) => openAppSession(
|
|
695
|
+
typeof openAppSessionProps === "string" ? { hostConfig, appId: openAppSessionProps } : { hostConfig, ...openAppSessionProps }
|
|
696
|
+
),
|
|
697
|
+
registerExternalAppSession,
|
|
698
|
+
useAppHook,
|
|
699
|
+
onWebSocketEvent,
|
|
700
|
+
onCombinedWebSocketStateChange,
|
|
701
|
+
resumeSuspendedSessions,
|
|
702
|
+
resumeOnlyOnReattach
|
|
703
|
+
})
|
|
688
704
|
};
|
|
689
705
|
var qix_default = qix;
|
|
690
706
|
export {
|
|
@@ -341,6 +341,10 @@ function registerAuthModule2(name, authModule) {
|
|
|
341
341
|
function setDefaultHostConfig2(hostConfig) {
|
|
342
342
|
setDefaultHostConfig(hostConfig);
|
|
343
343
|
}
|
|
344
|
+
function serializeHostConfig(hostConfig) {
|
|
345
|
+
const hostConfigToUse = withDefaultHostConfig(hostConfig);
|
|
346
|
+
return JSON.stringify(hostConfigToUse, hostConfigPropertyIgnorer);
|
|
347
|
+
}
|
|
344
348
|
function checkForCrossDomainRequest(hostConfig) {
|
|
345
349
|
const hostConfigToUse = withDefaultHostConfig(hostConfig);
|
|
346
350
|
if (isHostCrossOrigin(hostConfigToUse)) {
|
|
@@ -368,6 +372,19 @@ function normalizeInbandAuthError({ errorBody, status }) {
|
|
|
368
372
|
function normalizeAuthModuleError(err) {
|
|
369
373
|
return { message: err.message || "Unknown error" };
|
|
370
374
|
}
|
|
375
|
+
function hostConfigPropertyIgnorer(key, value) {
|
|
376
|
+
if (key === "") {
|
|
377
|
+
return value;
|
|
378
|
+
}
|
|
379
|
+
if (key === "authType") {
|
|
380
|
+
return void 0;
|
|
381
|
+
}
|
|
382
|
+
const vtype = typeof value;
|
|
383
|
+
if (vtype === "object" || vtype === "function") {
|
|
384
|
+
return void 0;
|
|
385
|
+
}
|
|
386
|
+
return value;
|
|
387
|
+
}
|
|
371
388
|
|
|
372
389
|
// src/random/random.ts
|
|
373
390
|
import { customAlphabet, nanoid } from "nanoid";
|
|
@@ -1398,7 +1415,7 @@ function applyPathVariables(pathTemplate, pathVariables) {
|
|
|
1398
1415
|
}
|
|
1399
1416
|
return result2;
|
|
1400
1417
|
}
|
|
1401
|
-
function toCacheKey(url, query, headers) {
|
|
1418
|
+
function toCacheKey(url, query, serializedHostConfig, headers) {
|
|
1402
1419
|
let cacheKey = url;
|
|
1403
1420
|
if (query !== "") {
|
|
1404
1421
|
cacheKey = cacheKey.concat(`?${query}`);
|
|
@@ -1406,6 +1423,9 @@ function toCacheKey(url, query, headers) {
|
|
|
1406
1423
|
if (headers) {
|
|
1407
1424
|
cacheKey = cacheKey.concat(`+headers=${JSON.stringify(headers)}`);
|
|
1408
1425
|
}
|
|
1426
|
+
if (serializedHostConfig) {
|
|
1427
|
+
cacheKey = cacheKey.concat(`+host-config=${serializedHostConfig}`);
|
|
1428
|
+
}
|
|
1409
1429
|
return cacheKey;
|
|
1410
1430
|
}
|
|
1411
1431
|
function toCompleteUrl(url, query) {
|
|
@@ -1455,6 +1475,10 @@ function cacheKeyToUrl(cachedUrl) {
|
|
|
1455
1475
|
if (headersIdx >= 0) {
|
|
1456
1476
|
return cachedUrl.substring(0, headersIdx);
|
|
1457
1477
|
}
|
|
1478
|
+
const hostConfigIdx = cachedUrl.indexOf("+host-config=");
|
|
1479
|
+
if (hostConfigIdx >= 0) {
|
|
1480
|
+
return cachedUrl.substring(0, hostConfigIdx);
|
|
1481
|
+
}
|
|
1458
1482
|
return cachedUrl;
|
|
1459
1483
|
}
|
|
1460
1484
|
function clearRelatedCacheEntries(cache2, cacheKey) {
|
|
@@ -1675,7 +1699,7 @@ async function getInvokeFetchUrlParams({
|
|
|
1675
1699
|
const url = locationUrl + applyPathVariables(pathTemplate, pathVariables);
|
|
1676
1700
|
const queryString = encodeQueryParams({ ...query, ...authQueryParams });
|
|
1677
1701
|
const completeUrl = toCompleteUrl(url, queryString);
|
|
1678
|
-
const cacheKey = toCacheKey(url, queryString, options?.headers);
|
|
1702
|
+
const cacheKey = toCacheKey(url, queryString, serializeHostConfig(options?.hostConfig), options?.headers);
|
|
1679
1703
|
return { completeUrl, cacheKey, authHeaders, credentials };
|
|
1680
1704
|
}
|
|
1681
1705
|
function invokeFetchWithUrl(api, props, interceptors) {
|
|
@@ -1762,6 +1786,7 @@ function invokeFetchWithUrlAndRetry(api, {
|
|
|
1762
1786
|
return cloneResultPromise(resultPromiseAfterCacheClearing);
|
|
1763
1787
|
}
|
|
1764
1788
|
function addPagingFunctions(api, value, method, body, options, interceptors, authHeaders, credentials) {
|
|
1789
|
+
const serializedHostConfig = serializeHostConfig(options?.hostConfig);
|
|
1765
1790
|
return value.then((resp) => {
|
|
1766
1791
|
const dataWithPotentialLinks = resp.data;
|
|
1767
1792
|
if (!dataWithPotentialLinks) {
|
|
@@ -1777,7 +1802,7 @@ function addPagingFunctions(api, value, method, body, options, interceptors, aut
|
|
|
1777
1802
|
completeUrl: prevUrl,
|
|
1778
1803
|
body,
|
|
1779
1804
|
options: prevOptions || options,
|
|
1780
|
-
cacheKey: toCacheKey(prevUrl, "", options?.headers),
|
|
1805
|
+
cacheKey: toCacheKey(prevUrl, "", serializedHostConfig, options?.headers),
|
|
1781
1806
|
authHeaders,
|
|
1782
1807
|
credentials
|
|
1783
1808
|
},
|
|
@@ -1792,7 +1817,7 @@ function addPagingFunctions(api, value, method, body, options, interceptors, aut
|
|
|
1792
1817
|
completeUrl: nextUrl,
|
|
1793
1818
|
body,
|
|
1794
1819
|
options: nextOptions || options,
|
|
1795
|
-
cacheKey: toCacheKey(nextUrl, "", options?.headers),
|
|
1820
|
+
cacheKey: toCacheKey(nextUrl, "", serializedHostConfig, options?.headers),
|
|
1796
1821
|
authHeaders,
|
|
1797
1822
|
credentials
|
|
1798
1823
|
},
|
|
@@ -1862,7 +1887,9 @@ async function download(blob, filename) {
|
|
|
1862
1887
|
window.URL.revokeObjectURL(blobUrl);
|
|
1863
1888
|
} else {
|
|
1864
1889
|
const { writeFileSync } = await import("fs");
|
|
1865
|
-
|
|
1890
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
1891
|
+
const uint8Array = new Uint8Array(arrayBuffer);
|
|
1892
|
+
writeFileSync(filename, uint8Array);
|
|
1866
1893
|
}
|
|
1867
1894
|
}
|
|
1868
1895
|
|
|
@@ -2012,6 +2039,7 @@ export {
|
|
|
2012
2039
|
getAccessToken,
|
|
2013
2040
|
registerAuthModule2 as registerAuthModule,
|
|
2014
2041
|
setDefaultHostConfig2 as setDefaultHostConfig,
|
|
2042
|
+
serializeHostConfig,
|
|
2015
2043
|
checkForCrossDomainRequest,
|
|
2016
2044
|
logout,
|
|
2017
2045
|
generateRandomString,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getInvokeFetchRuntimeModule
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./2OQLWLWE.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.21.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.13/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);
|
|
@@ -8,14 +8,14 @@ window.__qlikMainPrivateResolvers.qlikMainPromise = window.__qlikMainPrivateReso
|
|
|
8
8
|
return window.QlikMain;
|
|
9
9
|
}
|
|
10
10
|
const url = await window.__qlikMainPrivateResolvers.mainUrlPromise;
|
|
11
|
-
return new Promise((resolve
|
|
11
|
+
return new Promise((resolve) => {
|
|
12
12
|
if (window.QlikMain) {
|
|
13
13
|
resolve(window.QlikMain);
|
|
14
14
|
}
|
|
15
15
|
const script = window.document.createElement("script");
|
|
16
16
|
script.src = url;
|
|
17
|
-
script.addEventListener("error", (
|
|
18
|
-
|
|
17
|
+
script.addEventListener("error", () => {
|
|
18
|
+
console.error(`Qlik runtime system not found: ${url}`);
|
|
19
19
|
});
|
|
20
20
|
script.addEventListener("load", () => {
|
|
21
21
|
if (window.QlikMain) {
|
|
@@ -30,6 +30,9 @@ function provideHostConfigForMainJsUrl(hostConfig) {
|
|
|
30
30
|
function toMainJsUrl(hc) {
|
|
31
31
|
const url = hc?.embedRuntimeUrl || hc?.url || hc?.host;
|
|
32
32
|
if (!url) {
|
|
33
|
+
window.__qlikMainPrivateResolvers.noHostWarningTimer = setTimeout(() => {
|
|
34
|
+
console.warn("Waiting for a host parameter pointing to a Qlik runtime system");
|
|
35
|
+
}, 5e3);
|
|
33
36
|
return void 0;
|
|
34
37
|
}
|
|
35
38
|
let locationUrl;
|
|
@@ -43,6 +46,11 @@ function provideHostConfigForMainJsUrl(hostConfig) {
|
|
|
43
46
|
}
|
|
44
47
|
const potentialMainJsUrl = toMainJsUrl(hostConfig);
|
|
45
48
|
if (potentialMainJsUrl) {
|
|
49
|
+
const warningTimer = window.__qlikMainPrivateResolvers.noHostWarningTimer;
|
|
50
|
+
if (warningTimer) {
|
|
51
|
+
window.__qlikMainPrivateResolvers.noHostWarningTimer = void 0;
|
|
52
|
+
clearTimeout(warningTimer);
|
|
53
|
+
}
|
|
46
54
|
window.__qlikMainPrivateResolvers.resolveMainJsUrl(potentialMainJsUrl);
|
|
47
55
|
}
|
|
48
56
|
}
|
|
@@ -14,11 +14,12 @@ import {
|
|
|
14
14
|
isWindows,
|
|
15
15
|
logout,
|
|
16
16
|
registerAuthModule,
|
|
17
|
+
serializeHostConfig,
|
|
17
18
|
setDefaultHostConfig,
|
|
18
19
|
toValidEnigmaLocationUrl,
|
|
19
20
|
toValidLocationUrl,
|
|
20
21
|
toValidWebsocketLocationUrl
|
|
21
|
-
} from "./
|
|
22
|
+
} from "./BUSRKHDX.js";
|
|
22
23
|
import "./2ZQ3ZX7F.js";
|
|
23
24
|
export {
|
|
24
25
|
AuthorizationError,
|
|
@@ -36,6 +37,7 @@ export {
|
|
|
36
37
|
isWindows,
|
|
37
38
|
logout,
|
|
38
39
|
registerAuthModule,
|
|
40
|
+
serializeHostConfig,
|
|
39
41
|
setDefaultHostConfig,
|
|
40
42
|
toValidEnigmaLocationUrl,
|
|
41
43
|
toValidLocationUrl,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getQixRuntimeModule
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./2OQLWLWE.js";
|
|
4
4
|
|
|
5
5
|
// src/public/qix.ts
|
|
6
6
|
function openAppSession(appSessionProps) {
|
|
@@ -47,12 +47,21 @@ function openAppSession(appSessionProps) {
|
|
|
47
47
|
};
|
|
48
48
|
return appSessionProxy;
|
|
49
49
|
}
|
|
50
|
+
function withHostConfig(hostConfig) {
|
|
51
|
+
return {
|
|
52
|
+
openAppSession: (openAppSessionProps) => openAppSession(
|
|
53
|
+
typeof openAppSessionProps === "string" ? { hostConfig, appId: openAppSessionProps } : { hostConfig, ...openAppSessionProps }
|
|
54
|
+
)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
50
57
|
var qix = {
|
|
51
|
-
openAppSession
|
|
58
|
+
openAppSession,
|
|
59
|
+
withHostConfig
|
|
52
60
|
};
|
|
53
61
|
var qix_default = qix;
|
|
54
62
|
|
|
55
63
|
export {
|
|
56
64
|
openAppSession,
|
|
65
|
+
withHostConfig,
|
|
57
66
|
qix_default
|
|
58
67
|
};
|
package/collections.js
CHANGED
package/csp-origins.js
CHANGED
package/data-assets.js
CHANGED
package/data-connections.js
CHANGED
package/data-credentials.js
CHANGED
package/data-files.js
CHANGED
package/docs/authentication.md
CHANGED
|
@@ -27,7 +27,7 @@ const { data: mySpaces } = spaces.getSpaces();
|
|
|
27
27
|
console.log(mySpaces);
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
A host config can also be passed in to every single api request which then will override any default host config previously set.
|
|
30
|
+
A host config can also be passed in to every single api request which then will override any default host config previously set. This way multiple host configs can be used if needed.
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
33
|
import spaces from "@qlik/api/spaces";
|
|
@@ -45,6 +45,35 @@ const { data: mySpaces } = spaces.getSpaces({}, {
|
|
|
45
45
|
console.log(mySpaces);
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
### Binding an instance of `@qlik/api` to a specific host config
|
|
49
|
+
|
|
50
|
+
As an alternative to the methods above it is also possible to create an instance of `@qlik/api` bound to a specific host config. This allows users to use several host configs in their solutions and easily separate them by having seperate `@qlik/api` instances.
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { createQlikApi } from "@qlik-trial/qmfe-api";
|
|
56
|
+
|
|
57
|
+
const api = createQlikApi({
|
|
58
|
+
authType: "apikey"
|
|
59
|
+
host: "my-org.region.qlikcloud.com", // a qlikcloud tenant
|
|
60
|
+
apiKey: "<api-key>",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// "api" now has the full @qlik/api bound to one specific hostconfig
|
|
64
|
+
const { data: mySpaces } = api.spaces.getSpaces();
|
|
65
|
+
|
|
66
|
+
// create another api with a different auth mechanism
|
|
67
|
+
const apiToOtherTenant = createQlikApi({
|
|
68
|
+
authType: "oauth2"
|
|
69
|
+
host: "my-other-tenant.region.qlikcloud.com", // a qlikcloud tenant
|
|
70
|
+
clientId: "<client-id>",
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// "apiToOtherTenant" is now bound to another hostconfig
|
|
74
|
+
const { data: myOtherSpaces } = apiToOtherTenant.spaces.getSpaces();
|
|
75
|
+
```
|
|
76
|
+
|
|
48
77
|
## The Auth Module
|
|
49
78
|
|
|
50
79
|
An auth module in `@qlik/api` is an object with a few implemented methods. When connecting to Qlik Cloud Services (or Qlik Sense Enterprise for Windows) with `@qlik/api` or with `@qlik/embed` libraries an auth module is used for configuring the communication.
|
package/extensions.js
CHANGED
package/glossaries.js
CHANGED
package/groups.d.ts
CHANGED
|
@@ -74,6 +74,10 @@ type Group = {
|
|
|
74
74
|
assignedRoles?: AssignedRoles;
|
|
75
75
|
/** The timestamp for when the group record was created. */
|
|
76
76
|
createdAt: string;
|
|
77
|
+
/** Id of user that created role. */
|
|
78
|
+
readonly createdBy?: string;
|
|
79
|
+
/** A description of a custom group. */
|
|
80
|
+
description?: string;
|
|
77
81
|
/** The unique identifier for the group */
|
|
78
82
|
readonly id: string;
|
|
79
83
|
/** The timestamp for when the group record was last updated. */
|
|
@@ -87,10 +91,14 @@ type Group = {
|
|
|
87
91
|
};
|
|
88
92
|
/** The name of the group. */
|
|
89
93
|
name: string;
|
|
94
|
+
/** The type of provider for the group. */
|
|
95
|
+
providerType?: "idp" | "custom";
|
|
90
96
|
/** The state of the group. */
|
|
91
97
|
status: "active" | "disabled";
|
|
92
98
|
/** The tenant identifier associated with the given group */
|
|
93
99
|
tenantId: string;
|
|
100
|
+
/** Id of user that last updated this role. */
|
|
101
|
+
readonly updatedBy?: string;
|
|
94
102
|
};
|
|
95
103
|
/**
|
|
96
104
|
* A JSON Patch document.
|
|
@@ -98,8 +106,8 @@ type Group = {
|
|
|
98
106
|
type GroupPatch = {
|
|
99
107
|
/** The operation to be performed. Currently "replace" is the only supported operation. */
|
|
100
108
|
op: "replace";
|
|
101
|
-
/** Attribute name of a field of the Groups entity. */
|
|
102
|
-
path: "assignedRoles";
|
|
109
|
+
/** Attribute name of a field of the Groups entity. "Name" and "description" is only available for custom groups. */
|
|
110
|
+
path: "assignedRoles" | "name" | "description";
|
|
103
111
|
/** The roles to assign to the group (limit of 100 roles per group). */
|
|
104
112
|
value: AssignedRolesRefIDs | AssignedRolesRefNames;
|
|
105
113
|
};
|
|
@@ -110,8 +118,12 @@ type GroupPatchSchema = GroupPatch[];
|
|
|
110
118
|
type GroupPostSchema = {
|
|
111
119
|
/** The roles to assign to the group (limit of 100 roles per group). */
|
|
112
120
|
assignedRoles?: AssignedRolesRefIDs | AssignedRolesRefNames;
|
|
121
|
+
/** The description of the group. */
|
|
122
|
+
description?: string;
|
|
113
123
|
/** The name of the group (maximum length of 256 characters). */
|
|
114
124
|
name: string;
|
|
125
|
+
/** The type of group provider. Must be "idp" or "custom". Defaults to "idp" if not provided. */
|
|
126
|
+
providerType?: "idp" | "custom";
|
|
115
127
|
/** The status of the created group within the tenant. Defaults to active if empty. */
|
|
116
128
|
status?: "active";
|
|
117
129
|
};
|
|
@@ -222,7 +234,7 @@ type GetGroupsHttpError = {
|
|
|
222
234
|
status: number;
|
|
223
235
|
};
|
|
224
236
|
/**
|
|
225
|
-
* Creates a group. The maximum number of groups a tenant can have is 10,000.
|
|
237
|
+
* Creates a new group. The maximum number of groups a tenant can have is 10,000. Group names are case-sensitive, and must be unique.
|
|
226
238
|
*
|
|
227
239
|
* @param body an object with the body content
|
|
228
240
|
* @throws CreateGroupHttpError
|
|
@@ -365,7 +377,7 @@ interface GroupsAPI {
|
|
|
365
377
|
*/
|
|
366
378
|
getGroups: typeof getGroups;
|
|
367
379
|
/**
|
|
368
|
-
* Creates a group. The maximum number of groups a tenant can have is 10,000.
|
|
380
|
+
* Creates a new group. The maximum number of groups a tenant can have is 10,000. Group names are case-sensitive, and must be unique.
|
|
369
381
|
*
|
|
370
382
|
* @param body an object with the body content
|
|
371
383
|
* @throws CreateGroupHttpError
|
package/groups.js
CHANGED