@datalayer/core 1.1.41 → 1.1.43
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/README.md +10 -121
- package/lib/client/auth/AuthenticationManager.d.ts +3 -3
- package/lib/client/auth/AuthenticationManager.js +13 -13
- package/lib/client/auth/strategies.d.ts +2 -2
- package/lib/client/auth/strategies.js +6 -6
- package/lib/client/base.d.ts +9 -9
- package/lib/client/base.js +17 -17
- package/lib/client/mixins/IAMMixin.js +26 -26
- package/lib/components/auth/Login.js +2 -2
- package/lib/components/principal/PrincipalSwitcherMenu.js +3 -3
- package/lib/components/sharing/ShareAccessComponent.js +14 -14
- package/lib/config/Configuration.d.ts +13 -13
- package/lib/config/Configuration.js +5 -5
- package/lib/hooks/useCache.js +266 -266
- package/lib/hooks/useIAM.js +1 -1
- package/lib/models/UserSettings.d.ts +1 -1
- package/lib/models/UserSettings.js +1 -1
- package/lib/otel/client/OtelClient.d.ts +2 -2
- package/lib/otel/client/OtelClient.js +2 -2
- package/lib/otel/hooks/index.js +5 -5
- package/lib/otel/types.d.ts +1 -1
- package/lib/otel/views/OtelLive.js +1 -1
- package/lib/state/substates/CoreState.js +13 -13
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/IAMState.js +14 -14
- package/lib/state/substates/SurveysState.d.ts +1 -1
- package/lib/state/substates/SurveysState.js +10 -10
- package/lib/views/iam/SignInSimple.js +6 -6
- package/package.json +1 -1
|
@@ -433,8 +433,8 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
433
433
|
]);
|
|
434
434
|
// ----- Derived -----
|
|
435
435
|
const canRequest = Boolean(requestUrl && token);
|
|
436
|
-
const canSearchPrincipals = Boolean(configuration?.
|
|
437
|
-
const
|
|
436
|
+
const canSearchPrincipals = Boolean(configuration?.iamUrl && token);
|
|
437
|
+
const iamUrl = configuration?.iamUrl;
|
|
438
438
|
const principalKindsSet = useMemo(() => new Set(principalKinds), [principalKinds]);
|
|
439
439
|
const principalKindsKey = useMemo(() => [...principalKinds].sort().join('|'), [principalKinds]);
|
|
440
440
|
const aclEntries = useMemo(() => buildAclEntries(access, principalKinds), [access, principalKinds]);
|
|
@@ -592,14 +592,14 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
592
592
|
]);
|
|
593
593
|
// ----- Fetch shareable principals on open -----
|
|
594
594
|
useEffect(() => {
|
|
595
|
-
if (!isOpen || !canSearchPrincipals || !
|
|
595
|
+
if (!isOpen || !canSearchPrincipals || !iamUrl || !token) {
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
598
|
let cancelled = false;
|
|
599
599
|
const run = async () => {
|
|
600
600
|
setIsLoadingShareable(true);
|
|
601
601
|
try {
|
|
602
|
-
const response = await fetch(`${
|
|
602
|
+
const response = await fetch(`${iamUrl}/api/iam/v1/principals/shareable`, {
|
|
603
603
|
method: 'GET',
|
|
604
604
|
headers: {
|
|
605
605
|
'Content-Type': 'application/json',
|
|
@@ -671,7 +671,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
671
671
|
return () => {
|
|
672
672
|
cancelled = true;
|
|
673
673
|
};
|
|
674
|
-
}, [isOpen, canSearchPrincipals,
|
|
674
|
+
}, [isOpen, canSearchPrincipals, iamUrl, token, mergePrincipalCacheEntry]);
|
|
675
675
|
// ----- Debounce search query -----
|
|
676
676
|
useEffect(() => {
|
|
677
677
|
const timeout = window.setTimeout(() => {
|
|
@@ -683,7 +683,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
683
683
|
}, [searchQuery]);
|
|
684
684
|
// ----- Run search against /principals/search -----
|
|
685
685
|
useEffect(() => {
|
|
686
|
-
if (!isOpen || !canSearchPrincipals || !
|
|
686
|
+
if (!isOpen || !canSearchPrincipals || !iamUrl || !token) {
|
|
687
687
|
setSearchResults([]);
|
|
688
688
|
return;
|
|
689
689
|
}
|
|
@@ -704,7 +704,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
704
704
|
let response;
|
|
705
705
|
let payload;
|
|
706
706
|
try {
|
|
707
|
-
response = await fetch(`${
|
|
707
|
+
response = await fetch(`${iamUrl}/api/iam/v1/principals/search`, {
|
|
708
708
|
method: 'POST',
|
|
709
709
|
headers: {
|
|
710
710
|
'Content-Type': 'application/json',
|
|
@@ -837,7 +837,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
837
837
|
}, [
|
|
838
838
|
isOpen,
|
|
839
839
|
canSearchPrincipals,
|
|
840
|
-
|
|
840
|
+
iamUrl,
|
|
841
841
|
token,
|
|
842
842
|
normalizedDebouncedSearch,
|
|
843
843
|
principalKindsKey,
|
|
@@ -847,7 +847,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
847
847
|
]);
|
|
848
848
|
// ----- Hydrate ACL user uids in bulk -----
|
|
849
849
|
useEffect(() => {
|
|
850
|
-
if (!isOpen || !canSearchPrincipals || !
|
|
850
|
+
if (!isOpen || !canSearchPrincipals || !iamUrl || !token) {
|
|
851
851
|
return;
|
|
852
852
|
}
|
|
853
853
|
const userUids = Array.from(new Set([
|
|
@@ -881,7 +881,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
881
881
|
return acc;
|
|
882
882
|
}, {}));
|
|
883
883
|
try {
|
|
884
|
-
const response = await fetch(`${
|
|
884
|
+
const response = await fetch(`${iamUrl}/api/iam/v1/users/bulk`, {
|
|
885
885
|
method: 'POST',
|
|
886
886
|
headers: {
|
|
887
887
|
'Content-Type': 'application/json',
|
|
@@ -942,7 +942,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
942
942
|
}, [
|
|
943
943
|
isOpen,
|
|
944
944
|
canSearchPrincipals,
|
|
945
|
-
|
|
945
|
+
iamUrl,
|
|
946
946
|
token,
|
|
947
947
|
aclEntries,
|
|
948
948
|
ownerPrincipals,
|
|
@@ -951,7 +951,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
951
951
|
]);
|
|
952
952
|
// ----- Hydrate ACL team uids individually -----
|
|
953
953
|
useEffect(() => {
|
|
954
|
-
if (!isOpen || !canSearchPrincipals || !
|
|
954
|
+
if (!isOpen || !canSearchPrincipals || !iamUrl || !token) {
|
|
955
955
|
return;
|
|
956
956
|
}
|
|
957
957
|
const unknownTeams = aclEntries.filter(entry => {
|
|
@@ -967,7 +967,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
967
967
|
let cancelled = false;
|
|
968
968
|
void Promise.all(unknownTeams.map(async (entry) => {
|
|
969
969
|
try {
|
|
970
|
-
const response = await fetch(`${
|
|
970
|
+
const response = await fetch(`${iamUrl}/api/iam/v1/teams/${encodeURIComponent(entry.uid)}`, {
|
|
971
971
|
method: 'GET',
|
|
972
972
|
headers: {
|
|
973
973
|
'Content-Type': 'application/json',
|
|
@@ -1001,7 +1001,7 @@ export function ShareAccessComponent({ isOpen, requestUrl, resourceLabel, resour
|
|
|
1001
1001
|
}, [
|
|
1002
1002
|
isOpen,
|
|
1003
1003
|
canSearchPrincipals,
|
|
1004
|
-
|
|
1004
|
+
iamUrl,
|
|
1005
1005
|
token,
|
|
1006
1006
|
aclEntries,
|
|
1007
1007
|
principalCache,
|
|
@@ -12,7 +12,7 @@ export type IDatalayerCoreConfig = {
|
|
|
12
12
|
* The base URL for the Datalayer platform API.
|
|
13
13
|
* @example "https://prod1.datalayer.run"
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
datalayerUrl: string;
|
|
16
16
|
/**
|
|
17
17
|
* Datalayer API authentication token.
|
|
18
18
|
* Used for authenticating requests to the Datalayer platform.
|
|
@@ -46,51 +46,51 @@ export type IDatalayerCoreConfig = {
|
|
|
46
46
|
/**
|
|
47
47
|
* IAM API URL.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
iamUrl: string;
|
|
50
50
|
/**
|
|
51
51
|
* Runtimes API URL.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
runtimesUrl: string;
|
|
54
54
|
/**
|
|
55
55
|
* Spacer API URL.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
spacerUrl: string;
|
|
58
58
|
/**
|
|
59
59
|
* Library API URL.
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
libraryUrl: string;
|
|
62
62
|
/**
|
|
63
63
|
* AI Agents API URL.
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
aiAgentsUrl: string;
|
|
66
66
|
/**
|
|
67
67
|
* AI Inference API URL.
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
aiInferenceUrl: string;
|
|
70
70
|
/**
|
|
71
71
|
* MCP Servers API URL.
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
mcpServersUrl: string;
|
|
74
74
|
/**
|
|
75
75
|
* OTEL (OpenTelemetry) API URL.
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
otelUrl: string;
|
|
78
78
|
/**
|
|
79
79
|
* Growth API URL.
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
growthUrl: string;
|
|
82
82
|
/**
|
|
83
83
|
* Inbounds API URL.
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
inboundsUrl: string;
|
|
86
86
|
/**
|
|
87
87
|
* Success API URL.
|
|
88
88
|
*/
|
|
89
|
-
|
|
89
|
+
successUrl: string;
|
|
90
90
|
/**
|
|
91
91
|
* Support API URL.
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
supportUrl: string;
|
|
94
94
|
/**
|
|
95
95
|
* Load configuration from server.
|
|
96
96
|
*/
|
|
@@ -26,7 +26,7 @@ export class DatalayerConfiguration {
|
|
|
26
26
|
* Default configuration values for Datalayer
|
|
27
27
|
*/
|
|
28
28
|
export const DEFAULT_DATALAYER_CONFIG = {
|
|
29
|
-
|
|
29
|
+
datalayerUrl: 'https://oss.datalayer.run',
|
|
30
30
|
credits: 100,
|
|
31
31
|
cpuEnvironment: 'ai-agents-env',
|
|
32
32
|
gpuEnvironment: 'ai-env',
|
|
@@ -37,7 +37,7 @@ export const DEFAULT_DATALAYER_CONFIG = {
|
|
|
37
37
|
export function isDatalayerConfig(config) {
|
|
38
38
|
return (config &&
|
|
39
39
|
typeof config === 'object' &&
|
|
40
|
-
typeof config.
|
|
40
|
+
typeof config.datalayerUrl === 'string' &&
|
|
41
41
|
typeof config.token === 'string' &&
|
|
42
42
|
typeof config.credits === 'number' &&
|
|
43
43
|
typeof config.cpuEnvironment === 'string' &&
|
|
@@ -51,10 +51,10 @@ export function isDatalayerConfig(config) {
|
|
|
51
51
|
export function mergeConfigWithDefaults(config) {
|
|
52
52
|
if (!config)
|
|
53
53
|
return undefined;
|
|
54
|
-
// If we have required fields (token and
|
|
55
|
-
if (config.token && config.
|
|
54
|
+
// If we have required fields (token and datalayerUrl), merge with defaults for optional fields
|
|
55
|
+
if (config.token && config.datalayerUrl) {
|
|
56
56
|
return {
|
|
57
|
-
|
|
57
|
+
datalayerUrl: config.datalayerUrl,
|
|
58
58
|
token: config.token,
|
|
59
59
|
credits: config.credits ?? DEFAULT_DATALAYER_CONFIG.credits,
|
|
60
60
|
cpuEnvironment: config.cpuEnvironment ?? DEFAULT_DATALAYER_CONFIG.cpuEnvironment,
|