@datalayer/core 1.0.14 → 1.0.15

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 (42) hide show
  1. package/lib/api/DatalayerApi.js +5 -0
  2. package/lib/api/constants.d.ts +1 -1
  3. package/lib/api/constants.js +1 -1
  4. package/lib/api/spacer/lexicals.d.ts +8 -0
  5. package/lib/api/spacer/lexicals.js +14 -0
  6. package/lib/api/spacer/notebooks.d.ts +8 -0
  7. package/lib/api/spacer/notebooks.js +14 -0
  8. package/lib/api/spacer/spaces.d.ts +76 -1
  9. package/lib/api/spacer/spaces.js +140 -0
  10. package/lib/client/auth/storage.d.ts +3 -1
  11. package/lib/client/auth/storage.js +34 -13
  12. package/lib/client/index.d.ts +22 -2
  13. package/lib/client/index.js +2 -1
  14. package/lib/client/mixins/SpacerMixin.d.ts +99 -0
  15. package/lib/client/mixins/SpacerMixin.js +254 -0
  16. package/lib/client/utils/slugify.d.ts +8 -0
  17. package/lib/client/utils/slugify.js +18 -0
  18. package/lib/components/sparklines/dataProcessing.d.ts +2 -4
  19. package/lib/components/sparklines/dataProcessing.js +0 -4
  20. package/lib/components/sparklines/index.d.ts +1 -0
  21. package/lib/config/Configuration.d.ts +1 -1
  22. package/lib/config/Configuration.js +1 -1
  23. package/lib/hooks/useCache.js +1 -1
  24. package/lib/hooks/useProjects.d.ts +2 -8
  25. package/lib/hooks/useProjects.js +1 -1
  26. package/lib/index.d.ts +1 -1
  27. package/lib/index.js +1 -1
  28. package/lib/models/EnvironmentDTO.d.ts +1 -1
  29. package/lib/models/EnvironmentDTO.js +1 -1
  30. package/lib/models/ProjectDTO.d.ts +89 -0
  31. package/lib/models/ProjectDTO.js +131 -0
  32. package/lib/models/Space.d.ts +1 -1
  33. package/lib/models/SpaceDTO.d.ts +61 -0
  34. package/lib/otel/types.d.ts +1 -1
  35. package/lib/otel/views/OtelMetricsList.d.ts +2 -5
  36. package/lib/otel/views/index.d.ts +1 -0
  37. package/lib/services/DatalayerServiceManager.d.ts +1 -1
  38. package/lib/services/DatalayerServiceManager.js +1 -1
  39. package/lib/state/storage/IAMStorage.js +29 -4
  40. package/lib/state/substates/CoreState.js +1 -1
  41. package/lib/views/otel/simpleAuthStore.js +1 -1
  42. package/package.json +1 -1
@@ -10,7 +10,7 @@ import { IUser } from './User';
10
10
  * @returns Space
11
11
  */
12
12
  export declare const asSpace: (raw_space: any) => ISpace;
13
- export type ISpaceVariant = 'default' | 'course';
13
+ export type ISpaceVariant = 'default' | 'course' | 'project';
14
14
  export type IAnySpace = ISpace | ICourse;
15
15
  export type IBaseSpace = {
16
16
  id: string;
@@ -8,6 +8,7 @@ import { LexicalDTO, type LexicalJSON } from './LexicalDTO';
8
8
  */
9
9
  export interface SpaceData {
10
10
  uid: string;
11
+ id?: string;
11
12
  name_t: string;
12
13
  handle_s: string;
13
14
  variant_s: string;
@@ -15,6 +16,11 @@ export interface SpaceData {
15
16
  tags_ss?: string[];
16
17
  members?: any[];
17
18
  items?: any[];
19
+ public_b?: boolean;
20
+ creation_ts_dt?: string;
21
+ attached_agent_pod_name_s?: string;
22
+ attached_agent_spec_id_s?: string;
23
+ attached_agent_given_name_s?: string;
18
24
  }
19
25
  /**
20
26
  * Stable public interface for Space data.
@@ -267,3 +273,58 @@ export interface SpacesForUserResponse {
267
273
  message: string;
268
274
  spaces: SpaceData[];
269
275
  }
276
+ /**
277
+ * Request payload for updating a space.
278
+ * Supports arbitrary Solr fields via index signature.
279
+ * @interface UpdateSpaceRequest
280
+ */
281
+ export interface UpdateSpaceRequest {
282
+ name?: string;
283
+ description?: string;
284
+ [key: string]: unknown;
285
+ }
286
+ /**
287
+ * Response from getting a space by ID
288
+ * @interface GetSpaceResponse
289
+ */
290
+ export interface GetSpaceResponse {
291
+ success: boolean;
292
+ message: string;
293
+ space?: SpaceData;
294
+ }
295
+ /**
296
+ * Response from updating a space
297
+ * @interface UpdateSpaceResponse
298
+ */
299
+ export interface UpdateSpaceResponse {
300
+ success: boolean;
301
+ message: string;
302
+ space?: SpaceData;
303
+ }
304
+ /**
305
+ * Response from deleting a space
306
+ * @interface DeleteSpaceResponse
307
+ */
308
+ export interface DeleteSpaceResponse {
309
+ success: boolean;
310
+ message: string;
311
+ }
312
+ /**
313
+ * Response from getting default items for a space
314
+ * @interface GetSpaceDefaultItemsResponse
315
+ */
316
+ export interface GetSpaceDefaultItemsResponse {
317
+ success: boolean;
318
+ message: string;
319
+ default_notebook_uid: string | null;
320
+ default_document_uid: string | null;
321
+ }
322
+ /**
323
+ * Response from getting spaces by type
324
+ * @interface GetSpacesByTypeResponse
325
+ */
326
+ export interface GetSpacesByTypeResponse {
327
+ success: boolean;
328
+ message: string;
329
+ spaces: SpaceData[];
330
+ }
@@ -156,7 +156,7 @@ export interface OtelTimelineRangeSliderProps {
156
156
  formatTick?: (date: Date) => string;
157
157
  /** Height of the slider in px. Default 56. */
158
158
  height?: number;
159
- /** Optional histogram data: array of { time: Date; count: number } */
159
+ /** Optional histogram data: array of objects with `time` (Date) and `count` (number) fields. */
160
160
  histogram?: {
161
161
  time: Date;
162
162
  count: number;
@@ -7,9 +7,6 @@
7
7
  * @module otel/OtelMetricsList
8
8
  */
9
9
  import React from 'react';
10
- import type { OtelMetric } from '../types';
11
- export interface OtelMetricsListProps {
12
- metrics: OtelMetric[];
13
- loading?: boolean;
14
- }
10
+ import type { OtelMetricsListProps } from '../types';
11
+ export type { OtelMetricsListProps } from '../types';
15
12
  export declare const OtelMetricsList: React.FC<OtelMetricsListProps>;
@@ -7,6 +7,7 @@ export { OtelLive } from './OtelLive';
7
7
  export { OtelTracesList } from './OtelTracesList';
8
8
  export { OtelLogsList } from './OtelLogsList';
9
9
  export { OtelMetricsList } from './OtelMetricsList';
10
+ export type { OtelMetricsListProps } from './OtelMetricsList';
10
11
  export { OtelMetricsChart } from './OtelMetricsChart';
11
12
  export type { OtelMetricsChartProps } from './OtelMetricsChart';
12
13
  export { OtelSearchBar } from './OtelSearchBar';
@@ -13,7 +13,7 @@ import { ServiceManager } from '@jupyterlab/services';
13
13
  *
14
14
  * @example
15
15
  * ```typescript
16
- * const serviceManager = await createDatalayerServiceManager('python-cpu-env', 100);
16
+ * const serviceManager = await createDatalayerServiceManager('ai-agents-env', 100);
17
17
  * await serviceManager.ready;
18
18
  * // Use the service manager with notebooks
19
19
  * ```
@@ -20,7 +20,7 @@ import { createRuntime } from '../stateful/runtimes/actions.js';
20
20
  *
21
21
  * @example
22
22
  * ```typescript
23
- * const serviceManager = await createDatalayerServiceManager('python-cpu-env', 100);
23
+ * const serviceManager = await createDatalayerServiceManager('ai-agents-env', 100);
24
24
  * await serviceManager.ready;
25
25
  * // Use the service manager with notebooks
26
26
  * ```
@@ -5,6 +5,31 @@
5
5
  import jwt_decode from 'jwt-decode';
6
6
  import { getCookie } from '../../utils/index.js';
7
7
  import { ANONYMOUS_USER, ANONYMOUS_USER_TOKEN } from '../../models/index.js';
8
+ /**
9
+ * Check if browser localStorage is available and functional.
10
+ * Result is memoized to avoid repeated set/remove probes.
11
+ */
12
+ let _localStorageAvailable;
13
+ function isLocalStorageAvailable() {
14
+ if (_localStorageAvailable !== undefined) {
15
+ return _localStorageAvailable;
16
+ }
17
+ try {
18
+ if (typeof window === 'undefined' || !window.localStorage) {
19
+ _localStorageAvailable = false;
20
+ return false;
21
+ }
22
+ const testKey = '__datalayer_ls_test__';
23
+ window.localStorage.setItem(testKey, 'test');
24
+ window.localStorage.removeItem(testKey);
25
+ _localStorageAvailable = true;
26
+ return true;
27
+ }
28
+ catch {
29
+ _localStorageAvailable = false;
30
+ return false;
31
+ }
32
+ }
8
33
  export const JWT_DATALAYER_ISSUER = 'https://id.datalayer.run';
9
34
  export const DATALAYER_IAM_USER_KEY = '@datalayer/iam:user';
10
35
  export const DATALAYER_IAM_TOKEN_KEY = '@datalayer/iam:token';
@@ -13,7 +38,7 @@ export const JWT_REFRESH_TOKEN_COOKIE_NAME = 'refresh_token';
13
38
  * Return the user from the local storage.
14
39
  */
15
40
  export const getStoredUser = () => {
16
- if (typeof window === 'undefined') {
41
+ if (!isLocalStorageAvailable()) {
17
42
  return ANONYMOUS_USER;
18
43
  }
19
44
  const user = window.localStorage.getItem(DATALAYER_IAM_USER_KEY);
@@ -33,7 +58,7 @@ export const getStoredUser = () => {
33
58
  * Set the user in the local storage.
34
59
  */
35
60
  export const storeUser = (user) => {
36
- if (typeof window === 'undefined') {
61
+ if (!isLocalStorageAvailable()) {
37
62
  return;
38
63
  }
39
64
  if (user) {
@@ -47,7 +72,7 @@ export const storeUser = (user) => {
47
72
  * Return the IAM token from the local storage.
48
73
  */
49
74
  export const getStoredToken = () => {
50
- if (typeof window === 'undefined') {
75
+ if (!isLocalStorageAvailable()) {
51
76
  return ANONYMOUS_USER_TOKEN;
52
77
  }
53
78
  const token = window.localStorage.getItem(DATALAYER_IAM_TOKEN_KEY);
@@ -60,7 +85,7 @@ export const getStoredToken = () => {
60
85
  * Set the IAM token in the local storage.
61
86
  */
62
87
  export const storeToken = (token) => {
63
- if (typeof window === 'undefined') {
88
+ if (!isLocalStorageAvailable()) {
64
89
  return;
65
90
  }
66
91
  if (token) {
@@ -10,7 +10,7 @@ let initialConfiguration = {
10
10
  runUrl: 'https://prod1.datalayer.run',
11
11
  token: '',
12
12
  credits: 0,
13
- cpuEnvironment: 'python-cpu-env"',
13
+ cpuEnvironment: 'ai-agents-env"',
14
14
  gpuEnvironment: 'ai-env',
15
15
  useMock: false,
16
16
  whiteLabel: true,
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import { create } from 'zustand';
16
16
  import { persist } from 'zustand/middleware';
17
- export const useSimpleAuthStore = create()(persist((set) => ({
17
+ export const useSimpleAuthStore = create()(persist(set => ({
18
18
  token: null,
19
19
  handle: null,
20
20
  setAuth: (token, handle) => set({ token, handle }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/core",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",