@datalayer/core 1.0.20 → 1.0.21
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 +27 -0
- package/lib/api/DatalayerApi.d.ts +5 -1
- package/lib/api/DatalayerApi.js +55 -8
- package/lib/api/iam/oauth2.d.ts +3 -3
- package/lib/api/iam/oauth2.js +2 -2
- package/lib/api/iam/profile.d.ts +9 -1
- package/lib/api/iam/profile.js +15 -0
- package/lib/api/runtimes/checkpoints.js +1 -1
- package/lib/api/runtimes/snapshots.d.ts +7 -7
- package/lib/api/runtimes/snapshots.js +9 -9
- package/lib/client/auth/storage.js +103 -12
- package/lib/client/index.d.ts +7 -7
- package/lib/client/index.js +1 -1
- package/lib/client/mixins/RuntimesMixin.d.ts +6 -6
- package/lib/client/mixins/RuntimesMixin.js +5 -5
- package/lib/client/mixins/SpacerMixin.js +22 -1
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +4 -3
- package/lib/components/avatars/DLAvatar.d.ts +24 -0
- package/lib/components/avatars/DLAvatar.js +26 -0
- package/lib/components/avatars/UserProfileAvatar.js +4 -4
- package/lib/components/avatars/index.d.ts +1 -0
- package/lib/components/avatars/index.js +1 -0
- package/lib/components/checkout/StripeCheckout.d.ts +24 -3
- package/lib/components/checkout/StripeCheckout.js +1116 -55
- package/lib/components/display/DatalayerBox.js +6 -1
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +2 -2
- package/lib/components/snapshots/{RuntimeSnapshotMenu.d.ts → SandboxSnapshotMenu.d.ts} +4 -4
- package/lib/components/snapshots/{RuntimeSnapshotMenu.js → SandboxSnapshotMenu.js} +33 -33
- package/lib/components/snapshots/index.d.ts +1 -1
- package/lib/components/snapshots/index.js +1 -1
- package/lib/components/storage/ContentsBrowser.js +2 -2
- package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
- package/lib/components/tokens/SpaceVariantToken.js +7 -4
- package/lib/components/users/PeerIndicator.js +5 -4
- package/lib/hooks/useCache.d.ts +125 -18
- package/lib/hooks/useCache.js +893 -120
- package/lib/hooks/useDatalayer.js +31 -3
- package/lib/hooks/useIAM.js +1 -8
- package/lib/hooks/useProjects.d.ts +44 -0
- package/lib/hooks/useProjects.js +26 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/mocks/components/FlashMock.js +8 -2
- package/lib/models/{RuntimeSnapshot.d.ts → CodeSandboxSnapshot.d.ts} +5 -5
- package/lib/models/{RuntimeSnapshot.js → CodeSandboxSnapshot.js} +1 -1
- package/lib/models/{RuntimeSnapshotDTO.d.ts → CodeSandboxSnapshotDTO.d.ts} +30 -30
- package/lib/models/{RuntimeSnapshotDTO.js → CodeSandboxSnapshotDTO.js} +6 -6
- package/lib/models/Environment.d.ts +4 -0
- package/lib/models/IAM.d.ts +66 -0
- package/lib/models/Organization.d.ts +1 -0
- package/lib/models/Organization.js +1 -0
- package/lib/models/Page.d.ts +2 -2
- package/lib/models/Page.js +2 -2
- package/lib/models/Profile.d.ts +1 -1
- package/lib/models/RuntimeDTO.d.ts +2 -2
- package/lib/models/Space.d.ts +1 -0
- package/lib/models/Space.js +29 -5
- package/lib/models/SpaceDTO.d.ts +4 -0
- package/lib/models/SpaceDTO.js +5 -0
- package/lib/models/Usage.d.ts +15 -0
- package/lib/models/Usage.js +9 -0
- package/lib/models/User.d.ts +21 -0
- package/lib/models/User.js +6 -2
- package/lib/models/index.d.ts +2 -2
- package/lib/models/index.js +2 -2
- package/lib/otel/auth.js +0 -4
- package/lib/services/index.d.ts +1 -1
- package/lib/services/index.js +1 -1
- package/lib/state/substates/IAMState.js +0 -7
- package/lib/state/substates/RuntimesState.d.ts +9 -9
- package/lib/state/substates/RuntimesState.js +3 -3
- package/lib/stateful/runtimes/actions.d.ts +17 -17
- package/lib/stateful/runtimes/actions.js +35 -55
- package/lib/stateful/runtimes/apis.d.ts +3 -3
- package/lib/stateful/runtimes/snapshots.d.ts +2 -2
- package/lib/stateful/runtimes/snapshots.js +7 -7
- package/lib/utils/Format.d.ts +6 -0
- package/lib/utils/Format.js +17 -0
- package/lib/utils/Snapshot.d.ts +1 -1
- package/lib/utils/Snapshot.js +1 -1
- package/lib/views/datasources/DatasourceDetail.d.ts +7 -1
- package/lib/views/datasources/DatasourceDetail.js +61 -23
- package/lib/views/datasources/DatasourceNew.d.ts +8 -1
- package/lib/views/datasources/DatasourceNew.js +23 -10
- package/lib/views/datasources/Datasources.d.ts +5 -1
- package/lib/views/datasources/Datasources.js +38 -30
- package/lib/views/iam-tokens/IAMTokenNew.d.ts +3 -1
- package/lib/views/iam-tokens/IAMTokenNew.js +2 -2
- package/lib/views/iam-tokens/IAMTokens.d.ts +3 -1
- package/lib/views/iam-tokens/IAMTokens.js +2 -2
- package/lib/views/otel/OtelHeader.d.ts +5 -0
- package/lib/views/otel/OtelHeader.js +3 -3
- package/lib/views/profile/UserBadge.d.ts +7 -2
- package/lib/views/profile/UserBadge.js +11 -2
- package/lib/views/secrets/Secrets.js +21 -21
- package/package.json +8 -7
package/lib/models/Page.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
import { asUser } from './User.js';
|
|
6
|
-
import {
|
|
6
|
+
import { asCodeSandboxSnapshot, } from './CodeSandboxSnapshot.js';
|
|
7
7
|
export const asPage = (s) => {
|
|
8
8
|
return {
|
|
9
9
|
id: s.uid,
|
|
@@ -18,7 +18,7 @@ export const asPage = (s) => {
|
|
|
18
18
|
creator: s.creator ? asUser(s.creator) : undefined,
|
|
19
19
|
creatorId: s.creator_uid,
|
|
20
20
|
kernelSnapshot: s.kernel_snapshot
|
|
21
|
-
?
|
|
21
|
+
? asCodeSandboxSnapshot(s.kernel_snapshot)
|
|
22
22
|
: undefined,
|
|
23
23
|
kernelSnapshotId: s.kernel_snapshot_uid,
|
|
24
24
|
};
|
package/lib/models/Profile.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface Profile {
|
|
|
41
41
|
/** Customer UID */
|
|
42
42
|
customer_uid?: string | null;
|
|
43
43
|
/** Credits customer UID for billing */
|
|
44
|
-
|
|
44
|
+
stripe_customer_id_s?: string | null;
|
|
45
45
|
/** Email unsubscription status */
|
|
46
46
|
unsubscribed_from_outbounds_b?: boolean;
|
|
47
47
|
/** Linked contact UID */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DatalayerClient } from '../index';
|
|
2
|
-
import {
|
|
2
|
+
import { CodeSandboxSnapshotDTO } from './CodeSandboxSnapshotDTO';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a running instance of a computing environment.
|
|
5
5
|
* @interface RuntimeData
|
|
@@ -168,7 +168,7 @@ export declare class RuntimeDTO {
|
|
|
168
168
|
* @param stop - Whether to stop runtime after snapshotting
|
|
169
169
|
* @returns Created Snapshot instance
|
|
170
170
|
*/
|
|
171
|
-
createSnapshot(name: string, description?: string, stop?: boolean): Promise<
|
|
171
|
+
createSnapshot(name: string, description?: string, stop?: boolean): Promise<CodeSandboxSnapshotDTO>;
|
|
172
172
|
/**
|
|
173
173
|
* Get runtime data in camelCase format.
|
|
174
174
|
* Returns only the core fields that consumers need.
|
package/lib/models/Space.d.ts
CHANGED
package/lib/models/Space.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { asUser } from './User.js';
|
|
6
6
|
import { asArray } from '../utils/index.js';
|
|
7
|
-
import { newUserMock } from './../mocks/models/index.js';
|
|
8
7
|
/**
|
|
9
8
|
* Convert the raw space object to {@link ISpace}.
|
|
10
9
|
*
|
|
@@ -12,7 +11,31 @@ import { newUserMock } from './../mocks/models/index.js';
|
|
|
12
11
|
* @returns Space
|
|
13
12
|
*/
|
|
14
13
|
export const asSpace = (raw_space) => {
|
|
15
|
-
const
|
|
14
|
+
const sharedOwnerUserUids = asArray(raw_space?.shared_owner_user_uids_ss ||
|
|
15
|
+
raw_space?.shared_ower_user_uids_ss ||
|
|
16
|
+
[]).filter((uid) => typeof uid === 'string' && uid.length > 0);
|
|
17
|
+
// The backend resolves the canonical (friendly) account handles and exposes
|
|
18
|
+
// them as `space.owner` and `space.organization`. Trust those single sources
|
|
19
|
+
// of truth; do not invent fallbacks here.
|
|
20
|
+
const organizationHandle = raw_space?.organization?.handle;
|
|
21
|
+
const owner = raw_space?.owner
|
|
22
|
+
? asUser(raw_space.owner)
|
|
23
|
+
: {
|
|
24
|
+
id: '',
|
|
25
|
+
handle: '',
|
|
26
|
+
email: '',
|
|
27
|
+
firstName: '',
|
|
28
|
+
lastName: '',
|
|
29
|
+
initials: '',
|
|
30
|
+
displayName: '',
|
|
31
|
+
roles: [],
|
|
32
|
+
iamProviders: [],
|
|
33
|
+
setRoles: () => { },
|
|
34
|
+
unsubscribedFromOutbounds: false,
|
|
35
|
+
onboarding: {},
|
|
36
|
+
events: [],
|
|
37
|
+
settings: {},
|
|
38
|
+
};
|
|
16
39
|
let members = new Array();
|
|
17
40
|
if (raw_space.members) {
|
|
18
41
|
members = asArray(raw_space.members).map(m => {
|
|
@@ -31,9 +54,10 @@ export const asSpace = (raw_space) => {
|
|
|
31
54
|
members,
|
|
32
55
|
creationDate: new Date(raw_space.creation_ts_dt),
|
|
33
56
|
owner,
|
|
34
|
-
organization:
|
|
35
|
-
handle:
|
|
36
|
-
|
|
57
|
+
organization: organizationHandle
|
|
58
|
+
? { handle: organizationHandle }
|
|
59
|
+
: undefined,
|
|
60
|
+
sharedOwnerUserUids,
|
|
37
61
|
// Preserve raw Solr fields so consumers can access dynamic fields
|
|
38
62
|
// (e.g. attached_agent_pod_name_s for project-agent assignment)
|
|
39
63
|
...raw_space,
|
package/lib/models/SpaceDTO.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface SpaceData {
|
|
|
21
21
|
attached_agent_pod_name_s?: string;
|
|
22
22
|
attached_agent_spec_id_s?: string;
|
|
23
23
|
attached_agent_given_name_s?: string;
|
|
24
|
+
shared_owner_user_uids_ss?: string[];
|
|
25
|
+
shared_ower_user_uids_ss?: string[];
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Stable public interface for Space data.
|
|
@@ -40,6 +42,8 @@ export interface SpaceJSON {
|
|
|
40
42
|
description: string;
|
|
41
43
|
/** Items contained in the space (as JSON) */
|
|
42
44
|
items: Array<NotebookJSON | LexicalJSON>;
|
|
45
|
+
/** Owner user UIDs for this space */
|
|
46
|
+
ownerUserUids?: string[];
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
45
49
|
* Space domain model that wraps API responses with convenient methods.
|
package/lib/models/SpaceDTO.js
CHANGED
|
@@ -208,12 +208,17 @@ export class SpaceDTO {
|
|
|
208
208
|
*/
|
|
209
209
|
toJSON() {
|
|
210
210
|
this._checkDeleted();
|
|
211
|
+
const ownerUserUids = Array.from(new Set([
|
|
212
|
+
...(this._data.shared_owner_user_uids_ss || []),
|
|
213
|
+
...(this._data.shared_ower_user_uids_ss || []),
|
|
214
|
+
].filter(uid => typeof uid === 'string' && uid.length > 0)));
|
|
211
215
|
const obj = {
|
|
212
216
|
uid: this.uid,
|
|
213
217
|
name: this.name,
|
|
214
218
|
description: this.description,
|
|
215
219
|
variant: this.variant,
|
|
216
220
|
handle: this.handle,
|
|
221
|
+
ownerUserUids,
|
|
217
222
|
items: this._data.items
|
|
218
223
|
? convertSpaceItemsToModels(this._data.items, this._client).map(item => item.toJSON())
|
|
219
224
|
: [],
|
package/lib/models/Usage.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export interface IRawUsage {
|
|
|
12
12
|
resource_given_name?: string;
|
|
13
13
|
resource_state?: string;
|
|
14
14
|
pod_resources?: IResources;
|
|
15
|
+
plan?: string;
|
|
16
|
+
usage_period_key?: string;
|
|
17
|
+
usage_period_label?: string;
|
|
18
|
+
usage_period_start?: string;
|
|
19
|
+
usage_period_end?: string;
|
|
15
20
|
metadata: Map<string, string>;
|
|
16
21
|
}
|
|
17
22
|
export declare const asUsage: (u: any) => {
|
|
@@ -27,6 +32,11 @@ export declare const asUsage: (u: any) => {
|
|
|
27
32
|
endDate: Date | undefined;
|
|
28
33
|
resourceState: any;
|
|
29
34
|
resources: any;
|
|
35
|
+
plan: any;
|
|
36
|
+
usagePeriodKey: any;
|
|
37
|
+
usagePeriodLabel: any;
|
|
38
|
+
usagePeriodStart: Date | undefined;
|
|
39
|
+
usagePeriodEnd: Date | undefined;
|
|
30
40
|
metadata: Map<string, string>;
|
|
31
41
|
};
|
|
32
42
|
export interface IUsage {
|
|
@@ -42,5 +52,10 @@ export interface IUsage {
|
|
|
42
52
|
givenName: string;
|
|
43
53
|
resourceState: string;
|
|
44
54
|
resources?: IResources;
|
|
55
|
+
plan?: string;
|
|
56
|
+
usagePeriodKey?: string;
|
|
57
|
+
usagePeriodLabel?: string;
|
|
58
|
+
usagePeriodStart?: Date;
|
|
59
|
+
usagePeriodEnd?: Date;
|
|
45
60
|
metadata: Map<string, string>;
|
|
46
61
|
}
|
package/lib/models/Usage.js
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
export const asUsage = (u) => {
|
|
6
|
+
const usagePeriodKey = u.usage_period_key;
|
|
7
|
+
const usagePeriodLabel = u.usage_period_label;
|
|
8
|
+
const usagePeriodStart = u.usage_period_start;
|
|
9
|
+
const usagePeriodEnd = u.usage_period_end;
|
|
6
10
|
return {
|
|
7
11
|
id: u.resource_uid,
|
|
8
12
|
accountId: u.account_uid ?? '',
|
|
@@ -16,6 +20,11 @@ export const asUsage = (u) => {
|
|
|
16
20
|
endDate: u.end_date ? new Date(u.end_date) : undefined,
|
|
17
21
|
resourceState: u.resource_state,
|
|
18
22
|
resources: u.pod_resources,
|
|
23
|
+
plan: u.plan ?? 'free_plan',
|
|
24
|
+
usagePeriodKey,
|
|
25
|
+
usagePeriodLabel,
|
|
26
|
+
usagePeriodStart: usagePeriodStart ? new Date(usagePeriodStart) : undefined,
|
|
27
|
+
usagePeriodEnd: usagePeriodEnd ? new Date(usagePeriodEnd) : undefined,
|
|
19
28
|
metadata: new Map(Object.entries(u.metadata ?? {})),
|
|
20
29
|
};
|
|
21
30
|
};
|
package/lib/models/User.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const ANONYMOUS_USER_EXTERNAL_TOKEN: undefined;
|
|
|
12
12
|
export declare const getUserRandomColor: () => string;
|
|
13
13
|
export declare class User implements IUser {
|
|
14
14
|
id: string;
|
|
15
|
+
uid?: string;
|
|
15
16
|
handle: string;
|
|
16
17
|
email: string;
|
|
17
18
|
firstName: string;
|
|
@@ -33,6 +34,7 @@ export declare class User implements IUser {
|
|
|
33
34
|
onboarding: IUserOnboarding;
|
|
34
35
|
linkedContactId?: string;
|
|
35
36
|
events: Array<IUserEvent>;
|
|
37
|
+
subscription?: IUserSubscription;
|
|
36
38
|
constructor(u: any);
|
|
37
39
|
setRoles(roles: string[]): void;
|
|
38
40
|
}
|
|
@@ -56,6 +58,7 @@ export type IBaseUser = {
|
|
|
56
58
|
};
|
|
57
59
|
export type IUser = IBaseUser & {
|
|
58
60
|
id: string;
|
|
61
|
+
uid?: string;
|
|
59
62
|
handle: string;
|
|
60
63
|
credits?: number;
|
|
61
64
|
creditsCustomerId?: string;
|
|
@@ -69,5 +72,23 @@ export type IUser = IBaseUser & {
|
|
|
69
72
|
onboarding: IUserOnboarding;
|
|
70
73
|
linkedContactId?: string;
|
|
71
74
|
events: Array<IUserEvent>;
|
|
75
|
+
subscription?: IUserSubscription;
|
|
76
|
+
};
|
|
77
|
+
export type IUserSubscription = {
|
|
78
|
+
plan_name?: string;
|
|
79
|
+
plan?: {
|
|
80
|
+
name?: string;
|
|
81
|
+
} | string;
|
|
82
|
+
tier?: string;
|
|
83
|
+
included_runs?: number;
|
|
84
|
+
current_runs?: number;
|
|
85
|
+
used_runs?: number;
|
|
86
|
+
current_credits?: number;
|
|
87
|
+
used_credits?: number;
|
|
88
|
+
usage?: {
|
|
89
|
+
included_runs?: number;
|
|
90
|
+
current_runs?: number;
|
|
91
|
+
current_credits?: number;
|
|
92
|
+
};
|
|
72
93
|
};
|
|
73
94
|
export default IUser;
|
package/lib/models/User.js
CHANGED
|
@@ -28,6 +28,7 @@ const USER_COLORS = [
|
|
|
28
28
|
export const getUserRandomColor = () => USER_COLORS[Math.floor(Math.random() * USER_COLORS.length)];
|
|
29
29
|
export class User {
|
|
30
30
|
id;
|
|
31
|
+
uid;
|
|
31
32
|
handle;
|
|
32
33
|
email;
|
|
33
34
|
firstName;
|
|
@@ -49,8 +50,10 @@ export class User {
|
|
|
49
50
|
onboarding;
|
|
50
51
|
linkedContactId;
|
|
51
52
|
events;
|
|
53
|
+
subscription;
|
|
52
54
|
constructor(u) {
|
|
53
|
-
this.id = u.uid;
|
|
55
|
+
this.id = u.uid || u.id;
|
|
56
|
+
this.uid = u.uid || u.id;
|
|
54
57
|
this.handle = u.handle_s;
|
|
55
58
|
this.email = u.email_s;
|
|
56
59
|
this.firstName = u.first_name_t;
|
|
@@ -64,7 +67,7 @@ export class User {
|
|
|
64
67
|
this.origin = u.origin_s;
|
|
65
68
|
this.joinDate = u.join_ts_dt ? new Date(u.join_ts_dt) : undefined;
|
|
66
69
|
this.credits = u.credits_i ? Number(u.credits_i) : 0;
|
|
67
|
-
this.creditsCustomerId = u.
|
|
70
|
+
this.creditsCustomerId = u.stripe_customer_id_s;
|
|
68
71
|
this.roles = u.roles_ss ?? [];
|
|
69
72
|
let iamProviders = [];
|
|
70
73
|
try {
|
|
@@ -81,6 +84,7 @@ export class User {
|
|
|
81
84
|
? JSON.parse(u.onboarding_s)
|
|
82
85
|
: BOOTSTRAP_USER_ONBOARDING;
|
|
83
86
|
this.linkedContactId = u.linked_contact_uid;
|
|
87
|
+
this.subscription = u.subscription;
|
|
84
88
|
let events = u.events ?? [];
|
|
85
89
|
if (!Array.isArray(events)) {
|
|
86
90
|
events = [events];
|
package/lib/models/index.d.ts
CHANGED
|
@@ -82,8 +82,8 @@ export * from './RolesPlatform';
|
|
|
82
82
|
export * from './RolesTeam';
|
|
83
83
|
export * from './Runtime';
|
|
84
84
|
export * from './RuntimeDTO';
|
|
85
|
-
export * from './
|
|
86
|
-
export * from './
|
|
85
|
+
export * from './CodeSandboxSnapshot';
|
|
86
|
+
export * from './CodeSandboxSnapshotDTO';
|
|
87
87
|
export * from './School';
|
|
88
88
|
export * from './Secret';
|
|
89
89
|
export * from './Space';
|
package/lib/models/index.js
CHANGED
|
@@ -86,8 +86,8 @@ export * from './RolesPlatform.js';
|
|
|
86
86
|
export * from './RolesTeam.js';
|
|
87
87
|
export * from './Runtime.js';
|
|
88
88
|
export * from './RuntimeDTO.js';
|
|
89
|
-
export * from './
|
|
90
|
-
export * from './
|
|
89
|
+
export * from './CodeSandboxSnapshot.js';
|
|
90
|
+
export * from './CodeSandboxSnapshotDTO.js';
|
|
91
91
|
export * from './School.js';
|
|
92
92
|
export * from './Secret.js';
|
|
93
93
|
export * from './Space.js';
|
package/lib/otel/auth.js
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
7
|
-
* Distributed under the terms of the Modified BSD License.
|
|
8
|
-
*/
|
|
9
5
|
import { getDatalayerJwtUser, parseJwtPayload } from '../utils/Jwt.js';
|
|
10
6
|
function normalizeBaseUrl(baseUrl) {
|
|
11
7
|
const normalized = baseUrl.startsWith('ws://') || baseUrl.startsWith('wss://')
|
package/lib/services/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createDatalayerServiceManager } from './DatalayerServiceManager';
|
|
2
|
-
export { default as DatalayerServiceManager } from './DatalayerServiceManager';
|
|
3
2
|
export { reconnectToRuntime } from './reconnectToRuntime';
|
|
4
3
|
export type { RuntimeInfo } from './reconnectToRuntime';
|
|
4
|
+
export { default as DatalayerServiceManager } from './DatalayerServiceManager';
|
package/lib/services/index.js
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
export { createDatalayerServiceManager } from './DatalayerServiceManager.js';
|
|
6
|
-
export { default as DatalayerServiceManager } from './DatalayerServiceManager.js';
|
|
7
6
|
export { reconnectToRuntime } from './reconnectToRuntime.js';
|
|
7
|
+
export { default as DatalayerServiceManager } from './DatalayerServiceManager.js';
|
|
@@ -179,13 +179,6 @@ export const iamStore = createStore((set, get) => {
|
|
|
179
179
|
storeUser(user);
|
|
180
180
|
storeToken(token);
|
|
181
181
|
set(() => ({ user, token }));
|
|
182
|
-
// TODO Centralize User Setting Management.
|
|
183
|
-
const aiagentsRunUrl = user.settings?.aiAgentsUrl;
|
|
184
|
-
if (aiagentsRunUrl) {
|
|
185
|
-
coreStore.getState().setConfiguration({
|
|
186
|
-
aiagentsRunUrl,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
182
|
}
|
|
190
183
|
catch (error) {
|
|
191
184
|
if (error.name === 'RunResponseError' &&
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IMultiServiceManager } from '../../stateful/runtimes';
|
|
2
2
|
import type { IRuntimesConfiguration } from '../../config';
|
|
3
|
-
import type { IRuntimePod,
|
|
3
|
+
import type { IRuntimePod, ICodeSandboxSnapshot, IRuntimeModel } from '../../models';
|
|
4
4
|
/**
|
|
5
5
|
* Datalayer Runtimes state.
|
|
6
6
|
*/
|
|
@@ -49,21 +49,21 @@ export type RuntimesState = {
|
|
|
49
49
|
showDisclaimer: boolean;
|
|
50
50
|
setShowDisclaimer: (showDisclaimer: boolean) => void;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Code Sandbox snapshots.
|
|
53
53
|
*/
|
|
54
|
-
runtimeSnapshots: readonly
|
|
54
|
+
runtimeSnapshots: readonly ICodeSandboxSnapshot[];
|
|
55
55
|
/**
|
|
56
|
-
* Add a
|
|
56
|
+
* Add a code sandbox snapshot.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
addSandboxSnapshot: (snapshot: ICodeSandboxSnapshot) => void;
|
|
59
59
|
/**
|
|
60
|
-
* Remove a
|
|
60
|
+
* Remove a Code Sandbox Snapshot.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
removeSandboxSnapshot: (id: string) => void;
|
|
63
63
|
/**
|
|
64
|
-
* Set
|
|
64
|
+
* Set Code Sandbox Snapshots.
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
setSandboxSnapshots: (snapshots: ICodeSandboxSnapshot[]) => void;
|
|
67
67
|
/**
|
|
68
68
|
* Package version.
|
|
69
69
|
*/
|
|
@@ -90,7 +90,7 @@ export const runtimesStore = createStore((set, get) => {
|
|
|
90
90
|
/**
|
|
91
91
|
* Add a Kernel Snapshot
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
addSandboxSnapshot: (snapshot) => {
|
|
94
94
|
const snapshots = get().runtimeSnapshots;
|
|
95
95
|
const index = snapshots.findIndex(s => s.id === snapshot.id);
|
|
96
96
|
if (index < 0) {
|
|
@@ -106,7 +106,7 @@ export const runtimesStore = createStore((set, get) => {
|
|
|
106
106
|
/**
|
|
107
107
|
* Remove a Kernel Snapshot.
|
|
108
108
|
*/
|
|
109
|
-
|
|
109
|
+
removeSandboxSnapshot: (id) => {
|
|
110
110
|
const snapshots = get().runtimeSnapshots;
|
|
111
111
|
const index = snapshots.findIndex(s => s.id === id);
|
|
112
112
|
if (index >= 0) {
|
|
@@ -118,7 +118,7 @@ export const runtimesStore = createStore((set, get) => {
|
|
|
118
118
|
/**
|
|
119
119
|
* Set Kernel Snapshots.
|
|
120
120
|
*/
|
|
121
|
-
|
|
121
|
+
setSandboxSnapshots: (snapshots) => {
|
|
122
122
|
if (!JSONExt.deepEqual(get().runtimeSnapshots, snapshots)) {
|
|
123
123
|
set({ runtimeSnapshots: [...snapshots] });
|
|
124
124
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRuntimeOptions } from '../../api';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ICodeSandboxSnapshot, IDatalayerEnvironment, IRuntimePod } from '../../models';
|
|
3
3
|
/**
|
|
4
4
|
* Get available Environments.
|
|
5
5
|
*/
|
|
@@ -45,15 +45,15 @@ export declare function snapshotRuntime(options: {
|
|
|
45
45
|
* Whether to stop the runtime after the snapshot completion or not.
|
|
46
46
|
*/
|
|
47
47
|
stop?: boolean;
|
|
48
|
-
}): Promise<
|
|
48
|
+
}): Promise<ICodeSandboxSnapshot | undefined>;
|
|
49
49
|
/**
|
|
50
|
-
* Get
|
|
50
|
+
* Get Code Sandbox Snapshots.
|
|
51
51
|
*/
|
|
52
|
-
export declare function
|
|
52
|
+
export declare function getSandboxSnapshots(): Promise<ICodeSandboxSnapshot[]>;
|
|
53
53
|
/**
|
|
54
|
-
* Load a
|
|
54
|
+
* Load a Code Sandbox Snapshot within a Runtime.
|
|
55
55
|
*/
|
|
56
|
-
export declare function
|
|
56
|
+
export declare function loadSandboxSnapshot(options: {
|
|
57
57
|
/**
|
|
58
58
|
* Runtime ID
|
|
59
59
|
*/
|
|
@@ -64,35 +64,35 @@ export declare function loadRuntimeSnapshot(options: {
|
|
|
64
64
|
from: string;
|
|
65
65
|
}): Promise<void>;
|
|
66
66
|
/**
|
|
67
|
-
* Returns the
|
|
67
|
+
* Returns the Code Sandbox Snapshot download URL.
|
|
68
68
|
*
|
|
69
69
|
* @param id Snapshot UID to download
|
|
70
70
|
* @returns The download URL
|
|
71
71
|
*/
|
|
72
|
-
export declare function
|
|
72
|
+
export declare function createSandboxSnapshotDownloadURL(id: string): string;
|
|
73
73
|
/**
|
|
74
|
-
* Export a
|
|
74
|
+
* Export a Code Sandbox Snapshot.
|
|
75
75
|
*
|
|
76
|
-
* @param id
|
|
76
|
+
* @param id Code Sandbox snapshot UID to download
|
|
77
77
|
*/
|
|
78
|
-
export declare function
|
|
78
|
+
export declare function exportCodeSandboxSnapshot(id: string): void;
|
|
79
79
|
/**
|
|
80
|
-
* Delete a
|
|
80
|
+
* Delete a Code Sandbox Snapshot.
|
|
81
81
|
*/
|
|
82
|
-
export declare function
|
|
82
|
+
export declare function deleteCodeSandboxSnapshot(id: string): Promise<void>;
|
|
83
83
|
/**
|
|
84
|
-
* Update
|
|
84
|
+
* Update Code Sandbox Snapshot metadata.
|
|
85
85
|
*/
|
|
86
|
-
export declare function
|
|
86
|
+
export declare function updateCodeSandboxSnapshot(id: string, metadata: {
|
|
87
87
|
name?: string;
|
|
88
88
|
description?: string;
|
|
89
89
|
}): Promise<void>;
|
|
90
90
|
/**
|
|
91
|
-
* Upload a
|
|
91
|
+
* Upload a Code Sandbox Snapshot.
|
|
92
92
|
*
|
|
93
93
|
* Note: The promise will be rejected if the runtime state is empty.
|
|
94
94
|
*/
|
|
95
|
-
export declare function
|
|
95
|
+
export declare function uploadCodeSandboxSnapshot(options: {
|
|
96
96
|
file: File | Blob;
|
|
97
97
|
metadata: {
|
|
98
98
|
filename: string;
|