@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.
- package/lib/api/DatalayerApi.js +5 -0
- package/lib/api/constants.d.ts +1 -1
- package/lib/api/constants.js +1 -1
- package/lib/api/spacer/lexicals.d.ts +8 -0
- package/lib/api/spacer/lexicals.js +14 -0
- package/lib/api/spacer/notebooks.d.ts +8 -0
- package/lib/api/spacer/notebooks.js +14 -0
- package/lib/api/spacer/spaces.d.ts +76 -1
- package/lib/api/spacer/spaces.js +140 -0
- package/lib/client/auth/storage.d.ts +3 -1
- package/lib/client/auth/storage.js +34 -13
- package/lib/client/index.d.ts +22 -2
- package/lib/client/index.js +2 -1
- package/lib/client/mixins/SpacerMixin.d.ts +99 -0
- package/lib/client/mixins/SpacerMixin.js +254 -0
- package/lib/client/utils/slugify.d.ts +8 -0
- package/lib/client/utils/slugify.js +18 -0
- package/lib/components/sparklines/dataProcessing.d.ts +2 -4
- package/lib/components/sparklines/dataProcessing.js +0 -4
- package/lib/components/sparklines/index.d.ts +1 -0
- package/lib/config/Configuration.d.ts +1 -1
- package/lib/config/Configuration.js +1 -1
- package/lib/hooks/useCache.js +1 -1
- package/lib/hooks/useProjects.d.ts +2 -8
- package/lib/hooks/useProjects.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/models/EnvironmentDTO.d.ts +1 -1
- package/lib/models/EnvironmentDTO.js +1 -1
- package/lib/models/ProjectDTO.d.ts +89 -0
- package/lib/models/ProjectDTO.js +131 -0
- package/lib/models/Space.d.ts +1 -1
- package/lib/models/SpaceDTO.d.ts +61 -0
- package/lib/otel/types.d.ts +1 -1
- package/lib/otel/views/OtelMetricsList.d.ts +2 -5
- package/lib/otel/views/index.d.ts +1 -0
- package/lib/services/DatalayerServiceManager.d.ts +1 -1
- package/lib/services/DatalayerServiceManager.js +1 -1
- package/lib/state/storage/IAMStorage.js +29 -4
- package/lib/state/substates/CoreState.js +1 -1
- package/lib/views/otel/simpleAuthStore.js +1 -1
- package/package.json +1 -1
package/lib/models/Space.d.ts
CHANGED
|
@@ -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;
|
package/lib/models/SpaceDTO.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/lib/otel/types.d.ts
CHANGED
|
@@ -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
|
|
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 {
|
|
11
|
-
export
|
|
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('
|
|
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('
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
88
|
+
if (!isLocalStorageAvailable()) {
|
|
64
89
|
return;
|
|
65
90
|
}
|
|
66
91
|
if (token) {
|
|
@@ -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(
|
|
17
|
+
export const useSimpleAuthStore = create()(persist(set => ({
|
|
18
18
|
token: null,
|
|
19
19
|
handle: null,
|
|
20
20
|
setAuth: (token, handle) => set({ token, handle }),
|