@datalayer/core 1.0.20 → 1.0.22

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.
Files changed (138) hide show
  1. package/README.md +27 -0
  2. package/lib/api/DatalayerApi.d.ts +5 -1
  3. package/lib/api/DatalayerApi.js +55 -8
  4. package/lib/api/iam/oauth2.d.ts +3 -3
  5. package/lib/api/iam/oauth2.js +2 -2
  6. package/lib/api/iam/profile.d.ts +9 -1
  7. package/lib/api/iam/profile.js +15 -0
  8. package/lib/api/runtimes/checkpoints.js +1 -1
  9. package/lib/api/runtimes/snapshots.d.ts +7 -7
  10. package/lib/api/runtimes/snapshots.js +9 -9
  11. package/lib/client/auth/storage.js +103 -12
  12. package/lib/client/index.d.ts +7 -7
  13. package/lib/client/index.js +1 -1
  14. package/lib/client/mixins/RuntimesMixin.d.ts +6 -6
  15. package/lib/client/mixins/RuntimesMixin.js +5 -5
  16. package/lib/client/mixins/SpacerMixin.js +22 -1
  17. package/lib/collaboration/DatalayerCollaborationProvider.d.ts +4 -3
  18. package/lib/components/avatars/DLAvatar.d.ts +24 -0
  19. package/lib/components/avatars/DLAvatar.js +26 -0
  20. package/lib/components/avatars/UserProfileAvatar.js +4 -4
  21. package/lib/components/avatars/index.d.ts +1 -0
  22. package/lib/components/avatars/index.js +1 -0
  23. package/lib/components/billing/BillableAccountSelect.d.ts +35 -0
  24. package/lib/components/billing/BillableAccountSelect.js +340 -0
  25. package/lib/components/billing/index.d.ts +1 -0
  26. package/lib/components/billing/index.js +5 -0
  27. package/lib/components/checkout/StripeCheckout.d.ts +24 -3
  28. package/lib/components/checkout/StripeCheckout.js +1116 -55
  29. package/lib/components/display/DatalayerBox.js +6 -1
  30. package/lib/components/index.d.ts +2 -0
  31. package/lib/components/index.js +2 -0
  32. package/lib/components/principal/Principal.d.ts +37 -0
  33. package/lib/components/principal/Principal.js +54 -0
  34. package/lib/components/principal/PrincipalAvatar.d.ts +10 -0
  35. package/lib/components/principal/PrincipalAvatar.js +55 -0
  36. package/lib/components/principal/PrincipalBadge.d.ts +20 -0
  37. package/lib/components/principal/PrincipalBadge.js +208 -0
  38. package/lib/components/principal/PrincipalBanner.d.ts +7 -0
  39. package/lib/components/principal/PrincipalBanner.js +84 -0
  40. package/lib/components/principal/PrincipalDetailsOverlay.d.ts +23 -0
  41. package/lib/components/principal/PrincipalDetailsOverlay.js +86 -0
  42. package/lib/components/principal/PrincipalSwitcherMenu.d.ts +14 -0
  43. package/lib/components/principal/PrincipalSwitcherMenu.js +287 -0
  44. package/lib/components/principal/index.d.ts +7 -0
  45. package/lib/components/principal/index.js +10 -0
  46. package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +2 -2
  47. package/lib/components/sharing/ShareAccessComponent.d.ts +18 -0
  48. package/lib/components/sharing/ShareAccessComponent.js +1368 -0
  49. package/lib/components/sharing/SharingEditor.d.ts +20 -0
  50. package/lib/components/sharing/SharingEditor.js +65 -0
  51. package/lib/components/sharing/index.d.ts +9 -0
  52. package/lib/components/sharing/index.js +12 -0
  53. package/lib/components/snapshots/{RuntimeSnapshotMenu.d.ts → SandboxSnapshotMenu.d.ts} +4 -4
  54. package/lib/components/snapshots/{RuntimeSnapshotMenu.js → SandboxSnapshotMenu.js} +33 -33
  55. package/lib/components/snapshots/index.d.ts +1 -1
  56. package/lib/components/snapshots/index.js +1 -1
  57. package/lib/components/storage/ContentsBrowser.js +2 -2
  58. package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
  59. package/lib/components/tokens/SpaceVariantToken.js +7 -4
  60. package/lib/components/users/PeerIndicator.js +5 -4
  61. package/lib/hooks/index.d.ts +5 -0
  62. package/lib/hooks/index.js +5 -0
  63. package/lib/hooks/useBillableAccountStore.d.ts +31 -0
  64. package/lib/hooks/useBillableAccountStore.js +53 -0
  65. package/lib/hooks/useCache.d.ts +125 -18
  66. package/lib/hooks/useCache.js +893 -120
  67. package/lib/hooks/useDatalayer.js +31 -3
  68. package/lib/hooks/useIAM.js +1 -8
  69. package/lib/hooks/usePrincipalStore.d.ts +41 -0
  70. package/lib/hooks/usePrincipalStore.js +101 -0
  71. package/lib/hooks/useProjects.d.ts +44 -0
  72. package/lib/hooks/useProjects.js +26 -2
  73. package/lib/hooks/useSelectedBillableAccount.d.ts +14 -0
  74. package/lib/hooks/useSelectedBillableAccount.js +36 -0
  75. package/lib/hooks/useSelectedPrincipal.d.ts +17 -0
  76. package/lib/hooks/useSelectedPrincipal.js +29 -0
  77. package/lib/hooks/useUsageRefreshStore.d.ts +8 -0
  78. package/lib/hooks/useUsageRefreshStore.js +16 -0
  79. package/lib/index.d.ts +2 -2
  80. package/lib/index.js +1 -1
  81. package/lib/mocks/components/FlashMock.js +8 -2
  82. package/lib/models/{RuntimeSnapshot.d.ts → CodeSandboxSnapshot.d.ts} +5 -5
  83. package/lib/models/{RuntimeSnapshot.js → CodeSandboxSnapshot.js} +1 -1
  84. package/lib/models/{RuntimeSnapshotDTO.d.ts → CodeSandboxSnapshotDTO.d.ts} +30 -30
  85. package/lib/models/{RuntimeSnapshotDTO.js → CodeSandboxSnapshotDTO.js} +6 -6
  86. package/lib/models/Environment.d.ts +4 -0
  87. package/lib/models/IAM.d.ts +66 -0
  88. package/lib/models/Organization.d.ts +1 -0
  89. package/lib/models/Organization.js +1 -0
  90. package/lib/models/Page.d.ts +2 -2
  91. package/lib/models/Page.js +2 -2
  92. package/lib/models/Profile.d.ts +1 -1
  93. package/lib/models/RuntimeDTO.d.ts +2 -2
  94. package/lib/models/Space.d.ts +1 -0
  95. package/lib/models/Space.js +29 -5
  96. package/lib/models/SpaceDTO.d.ts +4 -0
  97. package/lib/models/SpaceDTO.js +5 -0
  98. package/lib/models/Usage.d.ts +15 -0
  99. package/lib/models/Usage.js +9 -0
  100. package/lib/models/User.d.ts +21 -0
  101. package/lib/models/User.js +6 -2
  102. package/lib/models/index.d.ts +2 -2
  103. package/lib/models/index.js +2 -2
  104. package/lib/otel/auth.js +0 -4
  105. package/lib/services/index.d.ts +1 -1
  106. package/lib/services/index.js +1 -1
  107. package/lib/state/substates/IAMState.js +0 -7
  108. package/lib/state/substates/RuntimesState.d.ts +9 -9
  109. package/lib/state/substates/RuntimesState.js +3 -3
  110. package/lib/stateful/runtimes/actions.d.ts +17 -17
  111. package/lib/stateful/runtimes/actions.js +35 -55
  112. package/lib/stateful/runtimes/apis.d.ts +3 -3
  113. package/lib/stateful/runtimes/snapshots.d.ts +2 -2
  114. package/lib/stateful/runtimes/snapshots.js +7 -7
  115. package/lib/utils/Format.d.ts +6 -0
  116. package/lib/utils/Format.js +17 -0
  117. package/lib/utils/Handles.d.ts +3 -0
  118. package/lib/utils/Handles.js +53 -0
  119. package/lib/utils/Snapshot.d.ts +1 -1
  120. package/lib/utils/Snapshot.js +1 -1
  121. package/lib/utils/index.d.ts +1 -0
  122. package/lib/utils/index.js +1 -0
  123. package/lib/views/datasources/DatasourceDetail.d.ts +7 -1
  124. package/lib/views/datasources/DatasourceDetail.js +61 -23
  125. package/lib/views/datasources/DatasourceNew.d.ts +8 -1
  126. package/lib/views/datasources/DatasourceNew.js +23 -10
  127. package/lib/views/datasources/Datasources.d.ts +5 -1
  128. package/lib/views/datasources/Datasources.js +38 -30
  129. package/lib/views/iam-tokens/IAMTokenNew.d.ts +3 -1
  130. package/lib/views/iam-tokens/IAMTokenNew.js +2 -2
  131. package/lib/views/iam-tokens/IAMTokens.d.ts +3 -1
  132. package/lib/views/iam-tokens/IAMTokens.js +2 -2
  133. package/lib/views/otel/OtelHeader.d.ts +5 -0
  134. package/lib/views/otel/OtelHeader.js +3 -3
  135. package/lib/views/profile/UserBadge.d.ts +7 -2
  136. package/lib/views/profile/UserBadge.js +11 -2
  137. package/lib/views/secrets/Secrets.js +21 -21
  138. package/package.json +7 -8
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * Snapshot domain model for the Datalayer Client.
3
3
  *
4
- * @module models/RuntimeSnapshotDTO
4
+ * @module models/CodeSandboxSnapshotDTO
5
5
  */
6
6
  import type { DatalayerClient } from '../index';
7
7
  import { RuntimeDTO } from './RuntimeDTO';
8
8
  /**
9
9
  * Represents a runthime snapshot of a runtime's state and files.
10
- * @interface RuntimeSnapshotData
10
+ * @interface CodeSandboxSnapshotData
11
11
  */
12
- export interface RuntimeSnapshotData {
12
+ export interface CodeSandboxSnapshotData {
13
13
  /** Unique identifier for the snapshot */
14
14
  uid: string;
15
15
  /** Name of the snapshot */
@@ -42,7 +42,7 @@ export interface RuntimeSnapshotData {
42
42
  * This is the contract that Client consumers can rely on.
43
43
  * The raw API may change, but this interface remains stable.
44
44
  */
45
- export interface RuntimeSnapshotJSON {
45
+ export interface CodeSandboxSnapshotJSON {
46
46
  /** Unique identifier for the snapshot */
47
47
  uid: string;
48
48
  /** Name of the snapshot */
@@ -55,10 +55,10 @@ export interface RuntimeSnapshotJSON {
55
55
  updatedAt: string;
56
56
  }
57
57
  /**
58
- * Request payload for creating a runtime snapshot
59
- * @interface CreateRuntimeSnapshotRequest
58
+ * Request payload for creating a code sandbox snapshot
59
+ * @interface CreateCodeSandboxSnapshotRequest
60
60
  */
61
- export interface CreateRuntimeSnapshotRequest {
61
+ export interface CreateCodeSandboxSnapshotRequest {
62
62
  /** Pod name of the runtime to snapshot */
63
63
  pod_name: string;
64
64
  /** Name for the snapshot */
@@ -69,44 +69,44 @@ export interface CreateRuntimeSnapshotRequest {
69
69
  stop: boolean;
70
70
  }
71
71
  /**
72
- * Response for getting a specific runtime snapshot
73
- * @interface GetRuntimeSnapshotResponse
72
+ * Response for getting a specific code snapshot snapshot
73
+ * @interface GetCodeSandboxSnapshotResponse
74
74
  */
75
- export interface GetRuntimeSnapshotResponse {
75
+ export interface GetCodeSandboxSnapshotResponse {
76
76
  /** Indicates if the request was successful */
77
77
  success: boolean;
78
78
  /** Response message */
79
79
  message: string;
80
80
  /** The snapshot details */
81
- snapshot: RuntimeSnapshotData;
81
+ snapshot: CodeSandboxSnapshotData;
82
82
  }
83
83
  /**
84
- * Response for creating a runtime snapshot
85
- * @interface CreateRuntimeSnapshotResponse
84
+ * Response for creating a code sandbox snapshot
85
+ * @interface CreateCodeSandboxSnapshotResponse
86
86
  */
87
- export interface CreateRuntimeSnapshotResponse {
87
+ export interface CreateCodeSandboxSnapshotResponse {
88
88
  /** Indicates if the request was successful */
89
89
  success: boolean;
90
90
  /** Response message */
91
91
  message: string;
92
92
  /** The created snapshot details */
93
- snapshot: RuntimeSnapshotData;
93
+ snapshot: CodeSandboxSnapshotData;
94
94
  }
95
95
  /**
96
- * Response from listing runtime snapshots
97
- * @interface RuntimeSnapshotsListResponse
96
+ * Response from listing code sandbox snapshots
97
+ * @interface ListCodeSandboxSnapshotsResponse
98
98
  */
99
- export interface ListRuntimeSnapshotsResponse {
99
+ export interface ListCodeSandboxSnapshotsResponse {
100
100
  /** Whether the request was successful */
101
101
  success: boolean;
102
102
  /** Response message from the server */
103
103
  message: string;
104
- /** Array of runtime snapshots */
105
- snapshots: RuntimeSnapshotData[];
104
+ /** Array of code sandbox snapshots */
105
+ snapshots: CodeSandboxSnapshotData[];
106
106
  }
107
107
  /**
108
108
  * Snapshot domain model that wraps API responses with convenient methods.
109
- * Provides runtime snapshot management with data refresh and lifecycle operations.
109
+ * Provides code sandbox snapshot management with data refresh and lifecycle operations.
110
110
  *
111
111
  * @example
112
112
  * ```typescript
@@ -114,17 +114,17 @@ export interface ListRuntimeSnapshotsResponse {
114
114
  * const runtime = await snapshot.restore();
115
115
  * ```
116
116
  */
117
- export declare class RuntimeSnapshotDTO {
118
- protected _data: RuntimeSnapshotData;
117
+ export declare class CodeSandboxSnapshotDTO {
118
+ protected _data: CodeSandboxSnapshotData;
119
119
  private _client;
120
120
  private _deleted;
121
121
  /**
122
- * Create a Runtime Snapshot instance.
122
+ * Create a Code Sandbox Snapshot instance.
123
123
  *
124
124
  * @param data - Snapshot data from API
125
125
  * @param client - Client instance
126
126
  */
127
- constructor(data: RuntimeSnapshotData, client: DatalayerClient);
127
+ constructor(data: CodeSandboxSnapshotData, client: DatalayerClient);
128
128
  /**
129
129
  * Check if this snapshot has been deleted and throw error if so.
130
130
  * @throws Error if deleted
@@ -146,28 +146,28 @@ export declare class RuntimeSnapshotDTO {
146
146
  */
147
147
  delete(): Promise<void>;
148
148
  /**
149
- * Create a runtime from this snapshot (restore functionality).
149
+ * Create a code sandbox from this snapshot (restore functionality).
150
150
  *
151
151
  * @param minutesLimit - Time limit in minutes for the restored runtime
152
152
  * @returns Created Runtime instance
153
153
  */
154
154
  restore(minutesLimit: number): Promise<RuntimeDTO>;
155
155
  /**
156
- * Get snapshot data in camelCase format.
156
+ * Get code snapshot snapshot data in camelCase format.
157
157
  * Returns only the core fields that consumers need.
158
158
  * This provides a stable interface regardless of API changes.
159
159
  * Note: Returns current cached state - call getStatus() first if you need fresh data.
160
160
  *
161
- * @returns Core snapshot data with camelCase properties
161
+ * @returns Core code snapshot snapshot data with camelCase properties
162
162
  */
163
- toJSON(): RuntimeSnapshotJSON;
163
+ toJSON(): CodeSandboxSnapshotJSON;
164
164
  /**
165
165
  * Get the raw snapshot data exactly as received from the API.
166
166
  * This preserves the original snake_case naming from the API response.
167
167
  *
168
168
  * @returns Raw snapshot data from API
169
169
  */
170
- rawData(): RuntimeSnapshotData;
170
+ rawData(): CodeSandboxSnapshotData;
171
171
  /** String representation of the snapshot. */
172
172
  toString(): string;
173
173
  }
@@ -6,7 +6,7 @@ import { snapshots } from '../api/runtimes/index.js';
6
6
  import { validateJSON } from '../api/utils/validation.js';
7
7
  /**
8
8
  * Snapshot domain model that wraps API responses with convenient methods.
9
- * Provides runtime snapshot management with data refresh and lifecycle operations.
9
+ * Provides code sandbox snapshot management with data refresh and lifecycle operations.
10
10
  *
11
11
  * @example
12
12
  * ```typescript
@@ -14,12 +14,12 @@ import { validateJSON } from '../api/utils/validation.js';
14
14
  * const runtime = await snapshot.restore();
15
15
  * ```
16
16
  */
17
- export class RuntimeSnapshotDTO {
17
+ export class CodeSandboxSnapshotDTO {
18
18
  _data;
19
19
  _client;
20
20
  _deleted = false;
21
21
  /**
22
- * Create a Runtime Snapshot instance.
22
+ * Create a Code Sandbox Snapshot instance.
23
23
  *
24
24
  * @param data - Snapshot data from API
25
25
  * @param client - Client instance
@@ -83,7 +83,7 @@ export class RuntimeSnapshotDTO {
83
83
  this._deleted = true;
84
84
  }
85
85
  /**
86
- * Create a runtime from this snapshot (restore functionality).
86
+ * Create a code sandbox from this snapshot (restore functionality).
87
87
  *
88
88
  * @param minutesLimit - Time limit in minutes for the restored runtime
89
89
  * @returns Created Runtime instance
@@ -102,12 +102,12 @@ export class RuntimeSnapshotDTO {
102
102
  // Utility Methods
103
103
  // ========================================================================
104
104
  /**
105
- * Get snapshot data in camelCase format.
105
+ * Get code snapshot snapshot data in camelCase format.
106
106
  * Returns only the core fields that consumers need.
107
107
  * This provides a stable interface regardless of API changes.
108
108
  * Note: Returns current cached state - call getStatus() first if you need fresh data.
109
109
  *
110
- * @returns Core snapshot data with camelCase properties
110
+ * @returns Core code snapshot snapshot data with camelCase properties
111
111
  */
112
112
  toJSON() {
113
113
  this._checkDeleted();
@@ -41,6 +41,10 @@ export interface IDatalayerEnvironment {
41
41
  * Description
42
42
  */
43
43
  description: string;
44
+ /**
45
+ * Icon key (e.g. ai-agent -> AiAgentIcon)
46
+ */
47
+ icon?: string;
44
48
  /**
45
49
  * Execution language
46
50
  */
@@ -115,3 +115,69 @@ export interface MembershipsResponse {
115
115
  /** Memberships information */
116
116
  memberships: any[];
117
117
  }
118
+ /**
119
+ * A principal (self / member organization / member team) the authenticated
120
+ * user can share artifacts with.
121
+ */
122
+ export interface ShareablePrincipal {
123
+ kind: 'user' | 'organization' | 'team';
124
+ uid: string;
125
+ handle: string;
126
+ name?: string | null;
127
+ description?: string | null;
128
+ email?: string | null;
129
+ avatar_url?: string | null;
130
+ /** Parent organization UID — set when kind === 'team'. */
131
+ organization_uid?: string | null;
132
+ /** Parent organization handle — set when kind === 'team'. */
133
+ organization_handle?: string | null;
134
+ }
135
+ /**
136
+ * Response from the /principals/shareable endpoint.
137
+ */
138
+ export interface ShareablePrincipalsResponse {
139
+ success: boolean;
140
+ message?: string;
141
+ principals: ShareablePrincipal[];
142
+ }
143
+ export interface PrincipalSearchUser {
144
+ uid: string;
145
+ handle_s: string;
146
+ first_name_t?: string;
147
+ last_name_t?: string;
148
+ display_name_t?: string;
149
+ display_name?: string;
150
+ origin_s?: string;
151
+ origin?: string;
152
+ avatar_url_s?: string;
153
+ avatarUrl?: string;
154
+ [key: string]: any;
155
+ }
156
+ export interface PrincipalSearchTeam {
157
+ uid: string;
158
+ handle_s: string;
159
+ name_t?: string;
160
+ description_t?: string;
161
+ organization_uid?: string;
162
+ organization_handle_s?: string;
163
+ [key: string]: any;
164
+ }
165
+ export interface PrincipalSearchOrganization {
166
+ uid: string;
167
+ handle_s: string;
168
+ name_t?: string;
169
+ description_t?: string;
170
+ [key: string]: any;
171
+ }
172
+ export interface PrincipalSearchResponseData {
173
+ users: PrincipalSearchUser[];
174
+ teams: PrincipalSearchTeam[];
175
+ organizations: PrincipalSearchOrganization[];
176
+ principalTypes: string[];
177
+ total: number;
178
+ }
179
+ export interface PrincipalSearchResponse {
180
+ success: boolean;
181
+ message: string;
182
+ data: PrincipalSearchResponseData;
183
+ }
@@ -14,6 +14,7 @@ export type IBaseOrganization = {
14
14
  handle: string;
15
15
  type: string;
16
16
  name: string;
17
+ displayName?: string;
17
18
  description: string;
18
19
  public: boolean;
19
20
  creationDate: Date;
@@ -23,6 +23,7 @@ export function asOrganization(org) {
23
23
  handle: org.handle_s,
24
24
  type: 'organization',
25
25
  name: org.name_t,
26
+ displayName: org.display_name_t || org.name_t,
26
27
  description: org.description_t,
27
28
  public: org.public_b,
28
29
  members,
@@ -1,7 +1,7 @@
1
1
  import { INotebookContent } from '@jupyterlab/nbformat';
2
2
  import { IUser } from './User';
3
3
  import { PageTagName } from './PageTag';
4
- import { IRuntimeSnapshot } from './RuntimeSnapshot';
4
+ import { ICodeSandboxSnapshot } from './CodeSandboxSnapshot';
5
5
  export type PageTheme = 'default';
6
6
  export type PageVariant = 'document' | 'cell' | 'notebook';
7
7
  /**
@@ -29,7 +29,7 @@ export type IPage = {
29
29
  screenCapture?: string;
30
30
  creator?: IUser;
31
31
  creatorId?: string;
32
- kernelSnapshot?: IRuntimeSnapshot;
32
+ kernelSnapshot?: ICodeSandboxSnapshot;
33
33
  kernelSnapshotId?: string;
34
34
  createdAt?: string;
35
35
  updatedAt?: string;
@@ -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 { asRuntimeSnapshot } from './RuntimeSnapshot.js';
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
- ? asRuntimeSnapshot(s.kernel_snapshot)
21
+ ? asCodeSandboxSnapshot(s.kernel_snapshot)
22
22
  : undefined,
23
23
  kernelSnapshotId: s.kernel_snapshot_uid,
24
24
  };
@@ -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
- credits_customer_uid?: string | null;
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 { RuntimeSnapshotDTO } from './RuntimeSnapshotDTO';
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<RuntimeSnapshotDTO>;
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.
@@ -24,6 +24,7 @@ export type IBaseSpace = {
24
24
  owner: IUser;
25
25
  organization?: Partial<IOrganization>;
26
26
  members?: SpaceMember[];
27
+ sharedOwnerUserUids?: string[];
27
28
  };
28
29
  export type ISpace = IBaseSpace & {
29
30
  type: 'space';
@@ -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 owner = newUserMock();
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: raw_space.handle_s,
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,
@@ -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.
@@ -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
  : [],
@@ -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
  }
@@ -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
  };
@@ -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;
@@ -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.credits_customer_uid;
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];
@@ -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 './RuntimeSnapshot';
86
- export * from './RuntimeSnapshotDTO';
85
+ export * from './CodeSandboxSnapshot';
86
+ export * from './CodeSandboxSnapshotDTO';
87
87
  export * from './School';
88
88
  export * from './Secret';
89
89
  export * from './Space';
@@ -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 './RuntimeSnapshot.js';
90
- export * from './RuntimeSnapshotDTO.js';
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://')
@@ -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';
@@ -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';