@datalayer/core 1.0.19 → 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.
Files changed (98) 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/checkout/StripeCheckout.d.ts +24 -3
  24. package/lib/components/checkout/StripeCheckout.js +1116 -55
  25. package/lib/components/display/DatalayerBox.js +6 -1
  26. package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +2 -2
  27. package/lib/components/snapshots/{RuntimeSnapshotMenu.d.ts → SandboxSnapshotMenu.d.ts} +4 -4
  28. package/lib/components/snapshots/{RuntimeSnapshotMenu.js → SandboxSnapshotMenu.js} +33 -33
  29. package/lib/components/snapshots/index.d.ts +1 -1
  30. package/lib/components/snapshots/index.js +1 -1
  31. package/lib/components/storage/ContentsBrowser.js +2 -2
  32. package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
  33. package/lib/components/tokens/SpaceVariantToken.js +7 -4
  34. package/lib/components/users/PeerIndicator.js +5 -4
  35. package/lib/hooks/useCache.d.ts +125 -18
  36. package/lib/hooks/useCache.js +893 -120
  37. package/lib/hooks/useDatalayer.js +31 -3
  38. package/lib/hooks/useIAM.js +1 -8
  39. package/lib/hooks/useProjects.d.ts +44 -0
  40. package/lib/hooks/useProjects.js +26 -2
  41. package/lib/index.d.ts +2 -2
  42. package/lib/index.js +1 -1
  43. package/lib/mocks/components/FlashMock.js +8 -2
  44. package/lib/models/{RuntimeSnapshot.d.ts → CodeSandboxSnapshot.d.ts} +5 -5
  45. package/lib/models/{RuntimeSnapshot.js → CodeSandboxSnapshot.js} +1 -1
  46. package/lib/models/{RuntimeSnapshotDTO.d.ts → CodeSandboxSnapshotDTO.d.ts} +30 -30
  47. package/lib/models/{RuntimeSnapshotDTO.js → CodeSandboxSnapshotDTO.js} +6 -6
  48. package/lib/models/Environment.d.ts +4 -0
  49. package/lib/models/IAM.d.ts +66 -0
  50. package/lib/models/Organization.d.ts +1 -0
  51. package/lib/models/Organization.js +1 -0
  52. package/lib/models/Page.d.ts +2 -2
  53. package/lib/models/Page.js +2 -2
  54. package/lib/models/Profile.d.ts +1 -1
  55. package/lib/models/RuntimeDTO.d.ts +2 -2
  56. package/lib/models/Space.d.ts +1 -0
  57. package/lib/models/Space.js +29 -5
  58. package/lib/models/SpaceDTO.d.ts +4 -0
  59. package/lib/models/SpaceDTO.js +5 -0
  60. package/lib/models/Usage.d.ts +15 -0
  61. package/lib/models/Usage.js +9 -0
  62. package/lib/models/User.d.ts +21 -0
  63. package/lib/models/User.js +6 -2
  64. package/lib/models/index.d.ts +2 -2
  65. package/lib/models/index.js +2 -2
  66. package/lib/otel/auth.js +0 -4
  67. package/lib/services/index.d.ts +1 -1
  68. package/lib/services/index.js +1 -1
  69. package/lib/state/substates/IAMState.js +0 -7
  70. package/lib/state/substates/RuntimesState.d.ts +9 -9
  71. package/lib/state/substates/RuntimesState.js +3 -3
  72. package/lib/stateful/runtimes/actions.d.ts +17 -17
  73. package/lib/stateful/runtimes/actions.js +35 -55
  74. package/lib/stateful/runtimes/apis.d.ts +3 -3
  75. package/lib/stateful/runtimes/snapshots.d.ts +2 -2
  76. package/lib/stateful/runtimes/snapshots.js +7 -7
  77. package/lib/utils/Format.d.ts +6 -0
  78. package/lib/utils/Format.js +17 -0
  79. package/lib/utils/Snapshot.d.ts +1 -1
  80. package/lib/utils/Snapshot.js +1 -1
  81. package/lib/views/datasources/DatasourceDetail.d.ts +7 -1
  82. package/lib/views/datasources/DatasourceDetail.js +61 -23
  83. package/lib/views/datasources/DatasourceNew.d.ts +8 -1
  84. package/lib/views/datasources/DatasourceNew.js +23 -10
  85. package/lib/views/datasources/Datasources.d.ts +5 -1
  86. package/lib/views/datasources/Datasources.js +38 -30
  87. package/lib/views/iam/SignInSimple.d.ts +1 -1
  88. package/lib/views/iam/SignInSimple.js +52 -28
  89. package/lib/views/iam-tokens/IAMTokenNew.d.ts +3 -1
  90. package/lib/views/iam-tokens/IAMTokenNew.js +2 -2
  91. package/lib/views/iam-tokens/IAMTokens.d.ts +3 -1
  92. package/lib/views/iam-tokens/IAMTokens.js +2 -2
  93. package/lib/views/otel/OtelHeader.d.ts +5 -0
  94. package/lib/views/otel/OtelHeader.js +3 -3
  95. package/lib/views/profile/UserBadge.d.ts +21 -0
  96. package/lib/views/profile/UserBadge.js +100 -8
  97. package/lib/views/secrets/Secrets.js +21 -21
  98. package/package.json +8 -7
@@ -11,6 +11,23 @@ import { requestDatalayerAPI } from '../api/DatalayerApi.js';
11
11
  export function useDatalayer(props = {}) {
12
12
  const { loginRoute = '/login', notifyOnError = true } = props;
13
13
  const location = useLocation();
14
+ const resolveLoginRoute = (candidateRoute) => {
15
+ if (candidateRoute !== '/login') {
16
+ return candidateRoute;
17
+ }
18
+ const pathname = location.pathname || '';
19
+ const kernelsPrefix = '/jupyter/kernels';
20
+ const iamPrefix = '/jupyter/iam';
21
+ if (pathname.includes(kernelsPrefix)) {
22
+ const [base] = pathname.split(kernelsPrefix);
23
+ return `${base}${kernelsPrefix}/login`;
24
+ }
25
+ if (pathname.includes(iamPrefix)) {
26
+ const [base] = pathname.split(iamPrefix);
27
+ return `${base}${iamPrefix}/login`;
28
+ }
29
+ return candidateRoute;
30
+ };
14
31
  /*
15
32
  // TODO Fix the conditional hook call.
16
33
  const coreStore = useCoreStore();
@@ -35,15 +52,19 @@ export function useDatalayer(props = {}) {
35
52
  .catch(error => {
36
53
  if (error.name === 'RunResponseError') {
37
54
  const responseError = error;
55
+ const isForbidden = responseError.response.status === 403;
38
56
  if (responseError.response.status === 401) {
39
57
  console.log('Datalayer sent a 401 return code.');
40
- if (location.pathname !== loginRoute_) {
58
+ const resolvedLoginRoute = resolveLoginRoute(loginRoute_);
59
+ const alreadyOnLoginRoute = location.pathname === resolvedLoginRoute ||
60
+ location.pathname.endsWith('/login');
61
+ if (!alreadyOnLoginRoute) {
41
62
  iamStore.logout();
42
- navigate(loginRoute_);
63
+ navigate(resolvedLoginRoute);
43
64
  }
44
65
  }
45
66
  else {
46
- if (notifyOnError_) {
67
+ if (notifyOnError_ && !isForbidden) {
47
68
  if (responseError.warnings) {
48
69
  responseError.warnings.forEach(warning => enqueueToast(`${warning}`, { variant: 'warning' }));
49
70
  }
@@ -64,9 +85,16 @@ export function useDatalayer(props = {}) {
64
85
  }
65
86
  }
66
87
  const response = {
88
+ success: false,
67
89
  sucess: false,
68
90
  message: responseError.message,
69
91
  errors: responseError.errors,
92
+ warnings: responseError.warnings,
93
+ detail: responseError.detail,
94
+ status: responseError.response.status,
95
+ code: responseError.response.status === 403
96
+ ? 'FORBIDDEN'
97
+ : `HTTP_${responseError.response.status}`,
70
98
  };
71
99
  return response;
72
100
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { useEffect, useState } from 'react';
6
6
  import { useCache } from './useCache.js';
7
- import { coreStore, useIAMStore, useLayoutStore, useOrganizationStore, useSpaceStore, } from '../state/index.js';
7
+ import { useIAMStore, useLayoutStore, useOrganizationStore, useSpaceStore, } from '../state/index.js';
8
8
  import { asUser, ANONYMOUS_USER, ANONYMOUS_USER_TOKEN, } from '../models/index.js';
9
9
  import { requestDatalayerAPI, } from '../api/DatalayerApi.js';
10
10
  export const useIAM = (props = { user: undefined, token: undefined }) => {
@@ -72,13 +72,6 @@ export const useIAM = (props = { user: undefined, token: undefined }) => {
72
72
  const user = asUser(whoamiData.profile);
73
73
  setIAMState({ user, token });
74
74
  iamStore.setLogin(user, token);
75
- // TODO centralize user settings management.
76
- const aiagentsRunUrl = user.settings?.aiAgentsUrl;
77
- if (aiagentsRunUrl) {
78
- coreStore.getState().setConfiguration({
79
- aiagentsRunUrl,
80
- });
81
- }
82
75
  }
83
76
  }
84
77
  }, [token, whoamiData, iamStore]);
@@ -385,6 +385,10 @@ export declare function useCreateProject(): {
385
385
  mutate: import("@tanstack/react-query").UseMutateFunction<any, Error, {
386
386
  space: Partial<import("..").IAnySpace>;
387
387
  organization?: import("..").IAnyOrganization;
388
+ team?: {
389
+ id?: string;
390
+ handle?: string;
391
+ };
388
392
  }, unknown>;
389
393
  reset: () => void;
390
394
  context: unknown;
@@ -395,6 +399,10 @@ export declare function useCreateProject(): {
395
399
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<any, Error, {
396
400
  space: Partial<import("..").IAnySpace>;
397
401
  organization?: import("..").IAnyOrganization;
402
+ team?: {
403
+ id?: string;
404
+ handle?: string;
405
+ };
398
406
  }, unknown>;
399
407
  } | {
400
408
  createProject: (request: CreateProjectRequest) => Promise<any>;
@@ -402,6 +410,10 @@ export declare function useCreateProject(): {
402
410
  variables: {
403
411
  space: Partial<import("..").IAnySpace>;
404
412
  organization?: import("..").IAnyOrganization;
413
+ team?: {
414
+ id?: string;
415
+ handle?: string;
416
+ };
405
417
  };
406
418
  error: null;
407
419
  isError: false;
@@ -412,6 +424,10 @@ export declare function useCreateProject(): {
412
424
  mutate: import("@tanstack/react-query").UseMutateFunction<any, Error, {
413
425
  space: Partial<import("..").IAnySpace>;
414
426
  organization?: import("..").IAnyOrganization;
427
+ team?: {
428
+ id?: string;
429
+ handle?: string;
430
+ };
415
431
  }, unknown>;
416
432
  reset: () => void;
417
433
  context: unknown;
@@ -422,6 +438,10 @@ export declare function useCreateProject(): {
422
438
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<any, Error, {
423
439
  space: Partial<import("..").IAnySpace>;
424
440
  organization?: import("..").IAnyOrganization;
441
+ team?: {
442
+ id?: string;
443
+ handle?: string;
444
+ };
425
445
  }, unknown>;
426
446
  } | {
427
447
  createProject: (request: CreateProjectRequest) => Promise<any>;
@@ -430,6 +450,10 @@ export declare function useCreateProject(): {
430
450
  variables: {
431
451
  space: Partial<import("..").IAnySpace>;
432
452
  organization?: import("..").IAnyOrganization;
453
+ team?: {
454
+ id?: string;
455
+ handle?: string;
456
+ };
433
457
  };
434
458
  isError: true;
435
459
  isIdle: false;
@@ -439,6 +463,10 @@ export declare function useCreateProject(): {
439
463
  mutate: import("@tanstack/react-query").UseMutateFunction<any, Error, {
440
464
  space: Partial<import("..").IAnySpace>;
441
465
  organization?: import("..").IAnyOrganization;
466
+ team?: {
467
+ id?: string;
468
+ handle?: string;
469
+ };
442
470
  }, unknown>;
443
471
  reset: () => void;
444
472
  context: unknown;
@@ -449,6 +477,10 @@ export declare function useCreateProject(): {
449
477
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<any, Error, {
450
478
  space: Partial<import("..").IAnySpace>;
451
479
  organization?: import("..").IAnyOrganization;
480
+ team?: {
481
+ id?: string;
482
+ handle?: string;
483
+ };
452
484
  }, unknown>;
453
485
  } | {
454
486
  createProject: (request: CreateProjectRequest) => Promise<any>;
@@ -457,6 +489,10 @@ export declare function useCreateProject(): {
457
489
  variables: {
458
490
  space: Partial<import("..").IAnySpace>;
459
491
  organization?: import("..").IAnyOrganization;
492
+ team?: {
493
+ id?: string;
494
+ handle?: string;
495
+ };
460
496
  };
461
497
  isError: false;
462
498
  isIdle: false;
@@ -466,6 +502,10 @@ export declare function useCreateProject(): {
466
502
  mutate: import("@tanstack/react-query").UseMutateFunction<any, Error, {
467
503
  space: Partial<import("..").IAnySpace>;
468
504
  organization?: import("..").IAnyOrganization;
505
+ team?: {
506
+ id?: string;
507
+ handle?: string;
508
+ };
469
509
  }, unknown>;
470
510
  reset: () => void;
471
511
  context: unknown;
@@ -476,6 +516,10 @@ export declare function useCreateProject(): {
476
516
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<any, Error, {
477
517
  space: Partial<import("..").IAnySpace>;
478
518
  organization?: import("..").IAnyOrganization;
519
+ team?: {
520
+ id?: string;
521
+ handle?: string;
522
+ };
479
523
  }, unknown>;
480
524
  };
481
525
  /**
@@ -16,6 +16,31 @@ import { useMemo, useCallback } from 'react';
16
16
  import { useCache } from './useCache.js';
17
17
  /** The space type value used to identify project spaces in Solr */
18
18
  export const PROJECT_SPACE_VARIANT = 'project';
19
+ const normalizeProjectItems = (items) => {
20
+ if (Array.isArray(items)) {
21
+ return items;
22
+ }
23
+ if (items && typeof items === 'object') {
24
+ return [items];
25
+ }
26
+ return [];
27
+ };
28
+ const isProjectSpace = (space) => {
29
+ const variant = space?.variant ?? space?.variant_s;
30
+ if (variant !== PROJECT_SPACE_VARIANT) {
31
+ return false;
32
+ }
33
+ const items = normalizeProjectItems(space?.items);
34
+ if (items.length === 0) {
35
+ return true;
36
+ }
37
+ const hasNotebook = items.some(item => (item?.type_s ?? item?.type) === 'notebook');
38
+ const hasDocument = items.some(item => {
39
+ const type = item?.type_s ?? item?.type;
40
+ return type === 'document' || type === 'lexical';
41
+ });
42
+ return hasNotebook && hasDocument;
43
+ };
19
44
  /**
20
45
  * Hook to fetch user's projects (spaces with type "project").
21
46
  *
@@ -29,8 +54,7 @@ export function useProjects() {
29
54
  if (!allSpaces)
30
55
  return [];
31
56
  return allSpaces
32
- .filter((space) => space.variant === PROJECT_SPACE_VARIANT ||
33
- space.type_s === PROJECT_SPACE_VARIANT)
57
+ .filter((space) => isProjectSpace(space))
34
58
  .map((space) => ({
35
59
  uid: space.uid,
36
60
  id: space.id ?? space.uid,
package/lib/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { API_BASE_PATHS } from './api/constants';
11
11
  export * as runtimesApi from './api/runtimes';
12
12
  export * as iamApi from './api/iam';
13
13
  export * as spacerApi from './api/spacer';
14
- export { DatalayerClient, type DatalayerClientConfig, type ClientHandlers, User, Runtime, Environment, Snapshot, Space, Project, Notebook, LexicalDTO, Secret, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, type RuntimeData, type EnvironmentData, type UserData, type SpaceData, type SpaceItem, type NotebookData, type LexicalData, type RuntimeSnapshotData, type CreditsInfo, type CreditReservation, type CreateRuntimeRequest, type CreateRuntimeResponse, type ListRuntimesResponse, type ListEnvironmentsResponse, type CreateRuntimeSnapshotRequest, type CreateRuntimeSnapshotResponse, type GetRuntimeSnapshotResponse, type ListRuntimeSnapshotsResponse, type CreateSpaceRequest, type CreateSpaceResponse, type SpacesForUserResponse, type CollaborationSessionResponse, type DeleteSpaceItemResponse, type GetSpaceItemResponse, type GetSpaceItemsResponse, type CreateNotebookRequest, type CreateNotebookResponse, type GetNotebookResponse, type UpdateNotebookRequest, type UpdateNotebookResponse, type CreateLexicalRequest, type CreateLexicalResponse, type GetLexicalResponse, type UpdateLexicalRequest, type UpdateLexicalResponse, type CreditsResponse, type CreateDatasourceResponse, type GetDatasourceResponse, type ListDatasourcesResponse, type UpdateDatasourceResponse, type CreateSecretRequest, type CreateSecretResponse, type GetSecretResponse, type ListSecretsResponse, type UpdateSecretRequest, type UpdateSecretResponse, type SpaceJSON, type ProjectJSON, type ProjectDefaultItems, type UpdateSpaceRequest, type GetSpaceResponse, type UpdateSpaceResponse, type DeleteSpaceResponse, type GetSpaceDefaultItemsResponse, type GetSpacesByTypeResponse, type NotebookJSON, type LexicalJSON, type RuntimeSnapshotJSON, HealthCheck, type HealthCheckJSON, type LoginRequest, type LoginResponse, type UserMeResponse, type MembershipsResponse, type WhoAmIResponse, type HealthzPingResponse, AuthenticationManager, type IUser, type IBaseUser, type ICell, type IDatasource, type IDatasourceVariant, type ICredits, type ICreditsReservation, type ISpaceItem, type ISurvey, type ISpace, type IBaseSpace, type IAnySpace, type ISpaceVariant, type IBaseTeam, type IAnyTeam, type IOrganization, type IAnyOrganization, type IBaseOrganization, type IRuntimeModel, type IRuntimePod, type IRuntimeType, type IRuntimeLocation, type IRuntimeCapabilities, type IRuntimeSnapshot, type IDatalayerEnvironment, type IResources, type ISnippet, type IRole, type IAssignment, type IContact, type ICourse, type IOrganizationMember, type IPage, type PageTagName, type PageTheme, type PageVariant, type ISecret, type ISecretVariant, type SecretData, type SecretJSON, type DatasourceData, type DatasourceJSON, type DatasourceType, type CreateDatasourceRequest, type UpdateDatasourceRequest, Datasource, type IIAMToken, type IIAMTokenVariant, type IDocument, type IBaseDocument, type IEnvironment, type IExercise, type ICode, type IHelp, type IInvite, type ILesson, type INotebook, type IBaseNotebook, type ISchool, type ITeam, type TeamMember, type IUserOnboarding, type IClient, type IOnboardingPosition, type IOnboardingTours, type ITour, type ITourStatus, type IUserSettings, type IDataset, type IUsage, type IItem, type IItemType, type Member, type Profile, type SpaceMember, type IContactEvent, type IContactIAMProvider, type IStudentItem, type Instructor, type IStudent, type IDean, type IUserEvent, type IIAMProviderLinked, type IContent, type AuthResult, type TokenValidationResult, type AuthOptions, type TokenStorage, type IRuntimeOptions, type IMultiServiceManager, type IRemoteServicesManager, type IEnvironmentsManager, type IRemoteRuntimesManager, type NavigationLinkProps, type IDatalayerCoreConfig, type IRuntimesConfiguration, type IIAMProviderName, } from './client';
15
- export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
14
+ export { DatalayerClient, type DatalayerClientConfig, type ClientHandlers, User, Runtime, Environment, Snapshot, Space, Project, Notebook, LexicalDTO, Secret, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, type RuntimeData, type EnvironmentData, type UserData, type SpaceData, type SpaceItem, type NotebookData, type LexicalData, type CodeSandboxSnapshotData, type CreditsInfo, type CreditReservation, type CreateRuntimeRequest, type CreateRuntimeResponse, type ListRuntimesResponse, type ListEnvironmentsResponse, type CreateCodeSandboxSnapshotRequest, type CreateCodeSandboxSnapshotResponse, type GetCodeSandboxSnapshotResponse, type ListCodeSandboxSnapshotsResponse, type CreateSpaceRequest, type CreateSpaceResponse, type SpacesForUserResponse, type CollaborationSessionResponse, type DeleteSpaceItemResponse, type GetSpaceItemResponse, type GetSpaceItemsResponse, type CreateNotebookRequest, type CreateNotebookResponse, type GetNotebookResponse, type UpdateNotebookRequest, type UpdateNotebookResponse, type CreateLexicalRequest, type CreateLexicalResponse, type GetLexicalResponse, type UpdateLexicalRequest, type UpdateLexicalResponse, type CreditsResponse, type CreateDatasourceResponse, type GetDatasourceResponse, type ListDatasourcesResponse, type UpdateDatasourceResponse, type CreateSecretRequest, type CreateSecretResponse, type GetSecretResponse, type ListSecretsResponse, type UpdateSecretRequest, type UpdateSecretResponse, type SpaceJSON, type ProjectJSON, type ProjectDefaultItems, type UpdateSpaceRequest, type GetSpaceResponse, type UpdateSpaceResponse, type DeleteSpaceResponse, type GetSpaceDefaultItemsResponse, type GetSpacesByTypeResponse, type NotebookJSON, type LexicalJSON, type CodeSandboxSnapshotJSON, HealthCheck, type HealthCheckJSON, type LoginRequest, type LoginResponse, type UserMeResponse, type MembershipsResponse, type WhoAmIResponse, type HealthzPingResponse, AuthenticationManager, type IUser, type IBaseUser, type ICell, type IDatasource, type IDatasourceVariant, type ICredits, type ICreditsReservation, type ISpaceItem, type ISurvey, type ISpace, type IBaseSpace, type IAnySpace, type ISpaceVariant, type IBaseTeam, type IAnyTeam, type IOrganization, type IAnyOrganization, type IBaseOrganization, type IRuntimeModel, type IRuntimePod, type IRuntimeType, type IRuntimeLocation, type IRuntimeCapabilities, type ICodeSandboxSnapshot, type IDatalayerEnvironment, type IResources, type ISnippet, type IRole, type IAssignment, type IContact, type ICourse, type IOrganizationMember, type IPage, type PageTagName, type PageTheme, type PageVariant, type ISecret, type ISecretVariant, type SecretData, type SecretJSON, type DatasourceData, type DatasourceJSON, type DatasourceType, type CreateDatasourceRequest, type UpdateDatasourceRequest, Datasource, type IIAMToken, type IIAMTokenVariant, type IDocument, type IBaseDocument, type IEnvironment, type IExercise, type ICode, type IHelp, type IInvite, type ILesson, type INotebook, type IBaseNotebook, type ISchool, type ITeam, type TeamMember, type IUserOnboarding, type IClient, type IOnboardingPosition, type IOnboardingTours, type ITour, type ITourStatus, type IUserSettings, type IDataset, type IUsage, type IItem, type IItemType, type Member, type Profile, type SpaceMember, type IContactEvent, type IContactIAMProvider, type IStudentItem, type Instructor, type IStudent, type IDean, type IUserEvent, type IIAMProviderLinked, type IContent, type AuthResult, type TokenValidationResult, type AuthOptions, type TokenStorage, type IRuntimeOptions, type IMultiServiceManager, type IRemoteServicesManager, type IEnvironmentsManager, type IRemoteRuntimesManager, type NavigationLinkProps, type IDatalayerCoreConfig, type IRuntimesConfiguration, type IIAMProviderName, } from './client';
15
+ export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getSandboxSnapshots, loadSandboxSnapshot, } from './stateful/runtimes/actions';
16
16
  export * from './otel';
17
17
  export * from './views';
package/lib/index.js CHANGED
@@ -25,7 +25,7 @@ User, Runtime, Environment, Snapshot, Space, Project, Notebook, LexicalDTO, Secr
25
25
  // Export auth
26
26
  AuthenticationManager, Datasource, } from './client/index.js';
27
27
  // Export commonly used functions directly for convenience
28
- export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions.js';
28
+ export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getSandboxSnapshots, loadSandboxSnapshot, } from './stateful/runtimes/actions.js';
29
29
  // OTEL observability components, hooks, and types
30
30
  export * from './otel/index.js';
31
31
  // Reusable views (sign-in pages, etc.)
@@ -4,10 +4,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
6
  import { AlertIcon } from '@primer/octicons-react';
7
- import { Flash, Link } from '@primer/react';
7
+ import { Box, Button, Flash } from '@primer/react';
8
8
  import { useNavigate } from '../../hooks/index.js';
9
9
  export const FlashMock = () => {
10
10
  const navigate = useNavigate();
11
- return (_jsxs(Flash, { variant: "warning", style: { marginBottom: 10 }, children: [_jsx(AlertIcon, {}), " This is a mock content.", ' ', _jsx(Link, { href: "#", onClick: e => navigate('/contact', e), children: "Contact us" }), ' ', "if you'd like to know more about this feature."] }));
11
+ return (_jsx(Flash, { variant: "warning", style: { marginBottom: 10 }, children: _jsxs(Box, { sx: {
12
+ display: 'flex',
13
+ alignItems: 'center',
14
+ justifyContent: 'space-between',
15
+ gap: 3,
16
+ width: '100%',
17
+ }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(AlertIcon, {}), _jsx("span", { children: "This is placeholder content. Contact us to learn more about this feature." })] }), _jsx(Button, { size: "small", onClick: () => navigate('/contact'), children: "Contact Us" })] }) }));
12
18
  };
13
19
  export default FlashMock;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Runtime snapshot from API.
2
+ * Code Sandbox snapshot from API.
3
3
  */
4
- export interface IAPIRuntimeSnapshot {
4
+ export interface IAPICodeSandboxSnapshot {
5
5
  /**
6
6
  * Snapshot UID
7
7
  */
@@ -44,9 +44,9 @@ export interface IAPIRuntimeSnapshot {
44
44
  status: string;
45
45
  }
46
46
  /**
47
- * Runtime snapshot model.
47
+ * Code Sandbox snapshot model.
48
48
  */
49
- export interface IRuntimeSnapshot {
49
+ export interface ICodeSandboxSnapshot {
50
50
  /**
51
51
  * Snapshot UID
52
52
  */
@@ -89,4 +89,4 @@ export interface IRuntimeSnapshot {
89
89
  */
90
90
  status: string;
91
91
  }
92
- export declare function asRuntimeSnapshot(s: IAPIRuntimeSnapshot): IRuntimeSnapshot;
92
+ export declare function asCodeSandboxSnapshot(s: IAPICodeSandboxSnapshot): ICodeSandboxSnapshot;
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2023-2025 Datalayer, Inc.
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
- export function asRuntimeSnapshot(s) {
5
+ export function asCodeSandboxSnapshot(s) {
6
6
  const { uid, updated_at, format_version, ...others } = s;
7
7
  return {
8
8
  ...others,
@@ -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;