@datalayer/core 0.0.12 → 0.0.14
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 +2 -2
- package/lib/api/DatalayerApi.d.ts +38 -26
- package/lib/api/DatalayerApi.js +52 -13
- package/lib/api/iam/authentication.d.ts +9 -8
- package/lib/api/iam/authentication.js +14 -15
- package/lib/api/iam/healthz.d.ts +3 -2
- package/lib/api/iam/healthz.js +5 -3
- package/lib/api/iam/index.d.ts +9 -4
- package/lib/api/iam/index.js +9 -4
- package/lib/api/iam/oauth2.d.ts +115 -0
- package/lib/api/iam/oauth2.js +309 -0
- package/lib/api/iam/profile.d.ts +8 -1
- package/lib/api/iam/profile.js +17 -2
- package/lib/api/iam/usage.d.ts +18 -0
- package/lib/api/iam/usage.js +39 -0
- package/lib/api/index.d.ts +6 -6
- package/lib/api/index.js +6 -7
- package/lib/api/runtimes/environments.d.ts +2 -2
- package/lib/api/runtimes/environments.js +3 -2
- package/lib/api/runtimes/healthz.d.ts +3 -13
- package/lib/api/runtimes/healthz.js +4 -3
- package/lib/api/runtimes/index.d.ts +3 -2
- package/lib/api/runtimes/index.js +3 -2
- package/lib/api/runtimes/runtimes.d.ts +4 -4
- package/lib/api/runtimes/runtimes.js +17 -6
- package/lib/api/runtimes/snapshots.d.ts +4 -4
- package/lib/api/runtimes/snapshots.js +3 -2
- package/lib/api/spacer/documents.d.ts +12 -0
- package/lib/api/spacer/documents.js +43 -0
- package/lib/api/spacer/healthz.d.ts +3 -13
- package/lib/api/spacer/healthz.js +4 -3
- package/lib/api/spacer/index.d.ts +4 -2
- package/lib/api/spacer/index.js +4 -2
- package/lib/api/spacer/items.d.ts +9 -1
- package/lib/api/spacer/items.js +17 -2
- package/lib/api/spacer/lexicals.d.ts +1 -1
- package/lib/api/spacer/lexicals.js +3 -2
- package/lib/api/spacer/notebooks.d.ts +1 -1
- package/lib/api/spacer/notebooks.js +3 -2
- package/lib/api/spacer/spaces.d.ts +1 -1
- package/lib/api/spacer/spaces.js +3 -2
- package/lib/api/spacer/users.d.ts +1 -1
- package/lib/api/spacer/users.js +3 -2
- package/lib/api/utils/validation.d.ts +24 -1
- package/lib/api/utils/validation.js +62 -1
- package/lib/client/base.d.ts +75 -0
- package/lib/client/base.js +199 -0
- package/lib/client/constants.d.ts +22 -0
- package/lib/client/constants.js +22 -0
- package/lib/client/index.d.ts +108 -0
- package/lib/client/index.js +79 -0
- package/lib/client/mixins/IAMMixin.d.ts +54 -0
- package/lib/client/mixins/IAMMixin.js +181 -0
- package/lib/client/mixins/RuntimesMixin.d.ts +93 -0
- package/lib/client/mixins/RuntimesMixin.js +229 -0
- package/lib/client/mixins/SpacerMixin.d.ts +111 -0
- package/lib/client/mixins/SpacerMixin.js +340 -0
- package/lib/client/utils/mixins.d.ts +12 -0
- package/lib/{sdk/client → client}/utils/mixins.js +0 -28
- package/lib/client/utils/spacerUtils.d.ts +18 -0
- package/lib/client/utils/spacerUtils.js +32 -0
- package/lib/collaboration/DatalayerCollaboration.d.ts +6 -1
- package/lib/collaboration/DatalayerCollaboration.js +2 -2
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +5 -0
- package/lib/collaboration/DatalayerCollaborationProvider.js +10 -9
- package/lib/components/progress/CreditsIndicator.d.ts +1 -1
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +1 -1
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +1 -1
- package/lib/components/runtimes/RuntimeLauncherDialog.js +2 -2
- package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.js +1 -1
- package/lib/components/runtimes/RuntimePickerCell.js +3 -3
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerNotebook.js +2 -2
- package/lib/components/runtimes/RuntimeTransfer.d.ts +2 -2
- package/lib/components/runtimes/RuntimeUtils.d.ts +1 -1
- package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -1
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +27 -20
- package/lib/config/Configuration.d.ts +8 -0
- package/lib/hooks/useDatalayer.js +1 -1
- package/lib/hooks/useRuntimes.js +1 -1
- package/lib/hooks/useToast.js +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +4 -3
- package/lib/models/Common.d.ts +64 -0
- package/lib/models/CreditsDTO.d.ts +124 -0
- package/lib/models/CreditsDTO.js +135 -0
- package/lib/models/Environment.d.ts +1 -1
- package/lib/models/EnvironmentDTO.d.ts +125 -0
- package/lib/models/EnvironmentDTO.js +88 -0
- package/lib/models/HealthCheck.d.ts +72 -0
- package/lib/models/HealthCheck.js +107 -0
- package/lib/{api/types/iam.d.ts → models/IAM.d.ts} +15 -78
- package/lib/models/ItemDTO.d.ts +74 -0
- package/lib/models/ItemDTO.js +186 -0
- package/lib/models/LexicalDTO.d.ts +155 -0
- package/lib/models/LexicalDTO.js +157 -0
- package/lib/models/NotebookDTO.d.ts +96 -0
- package/lib/models/NotebookDTO.js +153 -0
- package/lib/models/Profile.d.ts +65 -0
- package/lib/models/RuntimeDTO.d.ts +191 -0
- package/lib/models/RuntimeDTO.js +204 -0
- package/lib/models/RuntimeSnapshotDTO.d.ts +173 -0
- package/lib/models/RuntimeSnapshotDTO.js +139 -0
- package/lib/models/SpaceDTO.d.ts +280 -0
- package/lib/models/SpaceDTO.js +239 -0
- package/lib/models/UserDTO.d.ts +86 -0
- package/lib/models/UserDTO.js +84 -0
- package/lib/models/index.d.ts +45 -4
- package/lib/models/index.js +45 -4
- package/lib/sdk/index.d.ts +5 -4
- package/lib/sdk/index.js +6 -5
- package/lib/services/DatalayerServiceManager.js +1 -1
- package/lib/state/substates/CoreState.js +2 -0
- package/lib/state/substates/RuntimesState.d.ts +1 -1
- package/lib/state/substates/RuntimesState.js +1 -1
- package/lib/{sdk/stateful → stateful}/index.d.ts +1 -1
- package/lib/{sdk/stateful → stateful}/index.js +1 -1
- package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.d.ts +1 -41
- package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.js +1 -20
- package/lib/{sdk/stateful → stateful}/runtimes/actions.d.ts +3 -3
- package/lib/{sdk/stateful → stateful}/runtimes/actions.js +8 -8
- package/lib/{sdk/stateful → stateful}/runtimes/apis.d.ts +8 -8
- package/package.json +13 -10
- package/lib/__tests__/hooks.test.d.ts +0 -1
- package/lib/__tests__/hooks.test.js +0 -19
- package/lib/__tests__/index.test.d.ts +0 -1
- package/lib/__tests__/index.test.js +0 -27
- package/lib/__tests__/integration.test.d.ts +0 -1
- package/lib/__tests__/integration.test.js +0 -57
- package/lib/__tests__/shared/cleanup-shared.d.ts +0 -4
- package/lib/__tests__/shared/cleanup-shared.js +0 -228
- package/lib/__tests__/shared/test-config.d.ts +0 -51
- package/lib/__tests__/shared/test-config.js +0 -110
- package/lib/__tests__/shared/test-constants.d.ts +0 -66
- package/lib/__tests__/shared/test-constants.js +0 -79
- package/lib/__tests__/utils.test.d.ts +0 -1
- package/lib/__tests__/utils.test.js +0 -59
- package/lib/api/__tests__/iam.authentication.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.authentication.integration.test.js +0 -247
- package/lib/api/__tests__/iam.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.healthz.integration.test.js +0 -63
- package/lib/api/__tests__/iam.profile.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.profile.integration.test.js +0 -252
- package/lib/api/__tests__/runtimes.environments.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.environments.integration.test.js +0 -122
- package/lib/api/__tests__/runtimes.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.healthz.integration.test.js +0 -50
- package/lib/api/__tests__/runtimes.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.integration.test.js +0 -369
- package/lib/api/__tests__/spacer.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/spacer.healthz.integration.test.js +0 -50
- package/lib/api/__tests__/spacer.integration.test.d.ts +0 -1
- package/lib/api/__tests__/spacer.integration.test.js +0 -519
- package/lib/api/iam/__tests__/authentication.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/authentication.unit.test.js +0 -63
- package/lib/api/iam/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/healthz.unit.test.js +0 -60
- package/lib/api/iam/__tests__/profile.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/profile.unit.test.js +0 -57
- package/lib/api/runtimes/__tests__/environments.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/environments.unit.test.js +0 -77
- package/lib/api/runtimes/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/healthz.unit.test.js +0 -57
- package/lib/api/runtimes/__tests__/runtimes.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/runtimes.unit.test.js +0 -139
- package/lib/api/runtimes/__tests__/snapshots.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/snapshots.unit.test.js +0 -96
- package/lib/api/spacer/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/healthz.unit.test.js +0 -57
- package/lib/api/spacer/__tests__/items.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/items.unit.test.js +0 -165
- package/lib/api/spacer/__tests__/lexicals.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/lexicals.unit.test.js +0 -323
- package/lib/api/spacer/__tests__/notebooks.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/notebooks.unit.test.js +0 -224
- package/lib/api/spacer/__tests__/users.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/users.unit.test.js +0 -132
- package/lib/api/types/index.d.ts +0 -32
- package/lib/api/types/index.js +0 -36
- package/lib/api/types/runtimes.d.ts +0 -235
- package/lib/api/types/spacer.d.ts +0 -271
- package/lib/api/types/spacer.js +0 -5
- package/lib/api/utils/__tests__/validation.test.d.ts +0 -1
- package/lib/api/utils/__tests__/validation.test.js +0 -109
- package/lib/sdk/client/__tests__/sdk.health.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.health.integration.test.js +0 -110
- package/lib/sdk/client/__tests__/sdk.iam.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.iam.integration.test.js +0 -179
- package/lib/sdk/client/__tests__/sdk.models.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.models.integration.test.js +0 -376
- package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.js +0 -276
- package/lib/sdk/client/__tests__/sdk.spacer.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.spacer.integration.test.js +0 -361
- package/lib/sdk/client/base.d.ts +0 -88
- package/lib/sdk/client/base.js +0 -112
- package/lib/sdk/client/index.d.ts +0 -192
- package/lib/sdk/client/index.js +0 -128
- package/lib/sdk/client/mixins/HealthMixin.d.ts +0 -100
- package/lib/sdk/client/mixins/HealthMixin.js +0 -133
- package/lib/sdk/client/mixins/IAMMixin.d.ts +0 -59
- package/lib/sdk/client/mixins/IAMMixin.js +0 -83
- package/lib/sdk/client/mixins/RuntimesMixin.d.ts +0 -134
- package/lib/sdk/client/mixins/RuntimesMixin.js +0 -221
- package/lib/sdk/client/mixins/SpacerMixin.d.ts +0 -184
- package/lib/sdk/client/mixins/SpacerMixin.js +0 -278
- package/lib/sdk/client/models/Lexical.d.ts +0 -156
- package/lib/sdk/client/models/Lexical.js +0 -275
- package/lib/sdk/client/models/Notebook.d.ts +0 -174
- package/lib/sdk/client/models/Notebook.js +0 -311
- package/lib/sdk/client/models/Runtime.d.ts +0 -221
- package/lib/sdk/client/models/Runtime.js +0 -341
- package/lib/sdk/client/models/Snapshot.d.ts +0 -156
- package/lib/sdk/client/models/Snapshot.js +0 -244
- package/lib/sdk/client/models/Space.d.ts +0 -182
- package/lib/sdk/client/models/Space.js +0 -276
- package/lib/sdk/client/models/__tests__/Lexical.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Lexical.test.js +0 -288
- package/lib/sdk/client/models/__tests__/Notebook.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Notebook.test.js +0 -206
- package/lib/sdk/client/models/__tests__/Runtime.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Runtime.test.js +0 -133
- package/lib/sdk/client/models/__tests__/Snapshot.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Snapshot.test.js +0 -244
- package/lib/sdk/client/models/__tests__/Space.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Space.test.js +0 -334
- package/lib/sdk/client/models/index.d.ts +0 -30
- package/lib/sdk/client/models/index.js +0 -30
- package/lib/sdk/client/utils/mixins.d.ts +0 -42
- /package/lib/{api/types/iam.js → models/Common.js} +0 -0
- /package/lib/{api/types/runtimes.js → models/IAM.js} +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/apis.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/settings.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/settings.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/utils.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/utils.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateRuntimeSnapshotRequest,
|
|
1
|
+
import { CreateRuntimeSnapshotRequest, ListRuntimeSnapshotsResponse, GetRuntimeSnapshotResponse, CreateRuntimeSnapshotResponse } from '../../models/RuntimeSnapshotDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Create a snapshot of a runtime instance.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -7,7 +7,7 @@ import { CreateRuntimeSnapshotRequest, SnapshotsListResponse, SnapshotGetRespons
|
|
|
7
7
|
* @returns Promise resolving to the created snapshot response
|
|
8
8
|
* @throws {Error} If authentication token is missing or invalid
|
|
9
9
|
*/
|
|
10
|
-
export declare const createSnapshot: (token: string, data: CreateRuntimeSnapshotRequest, baseUrl?: string) => Promise<
|
|
10
|
+
export declare const createSnapshot: (token: string, data: CreateRuntimeSnapshotRequest, baseUrl?: string) => Promise<CreateRuntimeSnapshotResponse>;
|
|
11
11
|
/**
|
|
12
12
|
* List all runtime snapshots.
|
|
13
13
|
* @param token - Authentication token
|
|
@@ -15,7 +15,7 @@ export declare const createSnapshot: (token: string, data: CreateRuntimeSnapshot
|
|
|
15
15
|
* @returns Promise resolving to list of snapshots
|
|
16
16
|
* @throws {Error} If authentication token is missing or invalid
|
|
17
17
|
*/
|
|
18
|
-
export declare const listSnapshots: (token: string, baseUrl?: string) => Promise<
|
|
18
|
+
export declare const listSnapshots: (token: string, baseUrl?: string) => Promise<ListRuntimeSnapshotsResponse>;
|
|
19
19
|
/**
|
|
20
20
|
* Get details for a specific runtime snapshot.
|
|
21
21
|
* @param token - Authentication token
|
|
@@ -25,7 +25,7 @@ export declare const listSnapshots: (token: string, baseUrl?: string) => Promise
|
|
|
25
25
|
* @throws {Error} If authentication token is missing or invalid
|
|
26
26
|
* @throws {Error} If snapshot ID is missing or invalid
|
|
27
27
|
*/
|
|
28
|
-
export declare const getSnapshot: (token: string, snapshotId: string, baseUrl?: string) => Promise<
|
|
28
|
+
export declare const getSnapshot: (token: string, snapshotId: string, baseUrl?: string) => Promise<GetRuntimeSnapshotResponse>;
|
|
29
29
|
/**
|
|
30
30
|
* Delete a runtime snapshot.
|
|
31
31
|
* @param token - Authentication token
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description Runtime snapshots API functions for the Datalayer platform.
|
|
6
|
+
* Runtime snapshots API functions for the Datalayer platform.
|
|
8
7
|
*
|
|
9
8
|
* Provides functions for managing runtime snapshots (saved runtime states).
|
|
9
|
+
*
|
|
10
|
+
* @module api/runtimes/snapshots
|
|
10
11
|
*/
|
|
11
12
|
import { requestDatalayerAPI } from '../DatalayerApi';
|
|
12
13
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CollaborationSessionResponse } from '../../models/SpaceDTO';
|
|
2
|
+
/**
|
|
3
|
+
* Get collaboration session ID for a document.
|
|
4
|
+
*
|
|
5
|
+
* This function attempts to retrieve the collaboration session ID from the document API.
|
|
6
|
+
*
|
|
7
|
+
* @param token - Authentication token
|
|
8
|
+
* @param documentId - Document UID
|
|
9
|
+
* @param baseUrl - Base URL for the API (defaults to production)
|
|
10
|
+
* @returns Promise resolving to collaboration session response
|
|
11
|
+
*/
|
|
12
|
+
export declare const getCollaborationSessionId: (token: string, documentId: string, baseUrl?: string) => Promise<CollaborationSessionResponse>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Documents API functions for the Datalayer platform.
|
|
7
|
+
*
|
|
8
|
+
* Provides functions for document operations including collaboration session management.
|
|
9
|
+
*
|
|
10
|
+
* @module api/spacer/documents
|
|
11
|
+
*/
|
|
12
|
+
import { requestDatalayerAPI } from '../DatalayerApi';
|
|
13
|
+
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
|
14
|
+
/**
|
|
15
|
+
* Get collaboration session ID for a document.
|
|
16
|
+
*
|
|
17
|
+
* This function attempts to retrieve the collaboration session ID from the document API.
|
|
18
|
+
*
|
|
19
|
+
* @param token - Authentication token
|
|
20
|
+
* @param documentId - Document UID
|
|
21
|
+
* @param baseUrl - Base URL for the API (defaults to production)
|
|
22
|
+
* @returns Promise resolving to collaboration session response
|
|
23
|
+
*/
|
|
24
|
+
export const getCollaborationSessionId = async (token, documentId, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
|
|
25
|
+
try {
|
|
26
|
+
const response = await requestDatalayerAPI({
|
|
27
|
+
url: `${baseUrl}${API_BASE_PATHS.SPACER}/documents/${documentId}`,
|
|
28
|
+
method: 'GET',
|
|
29
|
+
token,
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
success: true,
|
|
33
|
+
sessionId: response.sessionId || documentId, // FIXME: is this ok?
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
// FIXME: is this ok?
|
|
38
|
+
return {
|
|
39
|
+
success: true,
|
|
40
|
+
sessionId: documentId,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
* Health check response from the Spacer service
|
|
3
|
-
*/
|
|
4
|
-
export interface SpacerHealthzPingResponse {
|
|
5
|
-
success: boolean;
|
|
6
|
-
message: string;
|
|
7
|
-
status?: {
|
|
8
|
-
status: string;
|
|
9
|
-
};
|
|
10
|
-
version?: string;
|
|
11
|
-
}
|
|
1
|
+
import type { HealthzPingResponse } from '../../models/Common';
|
|
12
2
|
/**
|
|
13
3
|
* Health check ping endpoint for Spacer service
|
|
14
4
|
* @param baseUrl - Base URL for the API (defaults to production Spacer URL)
|
|
15
5
|
* @returns Health check response
|
|
16
6
|
* @throws {Error} If the health check fails
|
|
17
7
|
*
|
|
18
|
-
* @
|
|
8
|
+
* @remarks
|
|
19
9
|
* This endpoint provides a basic health check for the Spacer service.
|
|
20
10
|
* It returns the current status of the service.
|
|
21
11
|
*
|
|
22
12
|
* Expected status codes:
|
|
23
13
|
* - 200: Service is healthy
|
|
24
14
|
*/
|
|
25
|
-
export declare const ping: (baseUrl?: string) => Promise<
|
|
15
|
+
export declare const ping: (baseUrl?: string) => Promise<HealthzPingResponse>;
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description Health check API functions for the Datalayer Spacer service.
|
|
6
|
+
* Health check API functions for the Datalayer Spacer service.
|
|
8
7
|
*
|
|
9
8
|
* Provides functions for checking the health status of the Spacer service.
|
|
9
|
+
*
|
|
10
|
+
* @module api/spacer/healthz
|
|
10
11
|
*/
|
|
11
12
|
import { requestDatalayerAPI } from '../DatalayerApi';
|
|
12
13
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
|
@@ -16,7 +17,7 @@ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
|
|
16
17
|
* @returns Health check response
|
|
17
18
|
* @throws {Error} If the health check fails
|
|
18
19
|
*
|
|
19
|
-
* @
|
|
20
|
+
* @remarks
|
|
20
21
|
* This endpoint provides a basic health check for the Spacer service.
|
|
21
22
|
* It returns the current status of the service.
|
|
22
23
|
*
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @description Spacer API exports.
|
|
2
|
+
* Spacer API exports.
|
|
4
3
|
*
|
|
5
4
|
* Provides organized access to spacer functionality including
|
|
6
5
|
* spaces, notebooks, cells, and lexical documents.
|
|
6
|
+
*
|
|
7
|
+
* @module api/spacer
|
|
7
8
|
*/
|
|
9
|
+
export * as documents from './documents';
|
|
8
10
|
export * as healthz from './healthz';
|
|
9
11
|
export * as items from './items';
|
|
10
12
|
export * as lexicals from './lexicals';
|
package/lib/api/spacer/index.js
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description Spacer API exports.
|
|
6
|
+
* Spacer API exports.
|
|
8
7
|
*
|
|
9
8
|
* Provides organized access to spacer functionality including
|
|
10
9
|
* spaces, notebooks, cells, and lexical documents.
|
|
10
|
+
*
|
|
11
|
+
* @module api/spacer
|
|
11
12
|
*/
|
|
13
|
+
export * as documents from './documents';
|
|
12
14
|
export * as healthz from './healthz';
|
|
13
15
|
export * as items from './items';
|
|
14
16
|
export * as lexicals from './lexicals';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeleteSpaceItemResponse, GetSpaceItemsResponse } from '
|
|
1
|
+
import { DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse } from '../../models/SpaceDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Get the items of a space.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -7,6 +7,14 @@ import { DeleteSpaceItemResponse, GetSpaceItemsResponse } from '../types/spacer'
|
|
|
7
7
|
* @returns Promise resolving to the items response
|
|
8
8
|
*/
|
|
9
9
|
export declare const getSpaceItems: (token: string, spaceId: string, baseUrl?: string) => Promise<GetSpaceItemsResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Get a single item from a space.
|
|
12
|
+
* @param token - Authentication token
|
|
13
|
+
* @param id - The item ID to retrieve
|
|
14
|
+
* @param baseUrl - Base URL for the API (defaults to production)
|
|
15
|
+
* @returns Promise resolving to the item response
|
|
16
|
+
*/
|
|
17
|
+
export declare const getItem: (token: string, id: string, baseUrl?: string) => Promise<GetSpaceItemResponse>;
|
|
10
18
|
/**
|
|
11
19
|
* Delete an item from a space.
|
|
12
20
|
* @param token - Authentication token
|
package/lib/api/spacer/items.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description Items API functions for the Datalayer platform.
|
|
6
|
+
* Items API functions for the Datalayer platform.
|
|
8
7
|
*
|
|
9
8
|
* Provides functions for managing items in spaces.
|
|
9
|
+
*
|
|
10
|
+
* @module api/spacer/items
|
|
10
11
|
*/
|
|
11
12
|
import { requestDatalayerAPI } from '../DatalayerApi';
|
|
12
13
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
|
@@ -24,6 +25,20 @@ export const getSpaceItems = async (token, spaceId, baseUrl = DEFAULT_SERVICE_UR
|
|
|
24
25
|
token,
|
|
25
26
|
});
|
|
26
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Get a single item from a space.
|
|
30
|
+
* @param token - Authentication token
|
|
31
|
+
* @param id - The item ID to retrieve
|
|
32
|
+
* @param baseUrl - Base URL for the API (defaults to production)
|
|
33
|
+
* @returns Promise resolving to the item response
|
|
34
|
+
*/
|
|
35
|
+
export const getItem = async (token, id, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
|
|
36
|
+
return requestDatalayerAPI({
|
|
37
|
+
url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/items/${id}`,
|
|
38
|
+
method: 'GET',
|
|
39
|
+
token,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
27
42
|
/**
|
|
28
43
|
* Delete an item from a space.
|
|
29
44
|
* @param token - Authentication token
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateLexicalRequest, CreateLexicalResponse, GetLexicalResponse, UpdateLexicalRequest, UpdateLexicalResponse } from '
|
|
1
|
+
import { CreateLexicalRequest, CreateLexicalResponse, GetLexicalResponse, UpdateLexicalRequest, UpdateLexicalResponse } from '../../models/LexicalDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Create a new lexical document.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description Lexical documents API functions for the Datalayer platform.
|
|
6
|
+
* Lexical documents API functions for the Datalayer platform.
|
|
8
7
|
*
|
|
9
8
|
* Provides functions for creating, retrieving, and updating lexical (rich text) documents.
|
|
9
|
+
*
|
|
10
|
+
* @module api/spacer/lexicals
|
|
10
11
|
*/
|
|
11
12
|
import { requestDatalayerAPI } from '../DatalayerApi';
|
|
12
13
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateNotebookRequest, CreateNotebookResponse, GetNotebookResponse, UpdateNotebookRequest, UpdateNotebookResponse } from '
|
|
1
|
+
import { CreateNotebookRequest, CreateNotebookResponse, GetNotebookResponse, UpdateNotebookRequest, UpdateNotebookResponse } from '../../models/SpaceDTO';
|
|
2
2
|
/**
|
|
3
3
|
* Create a new Jupyter notebook.
|
|
4
4
|
* @param token - Authentication token
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description Jupyter notebooks API functions for the Datalayer platform.
|
|
6
|
+
* Jupyter notebooks API functions for the Datalayer platform.
|
|
8
7
|
*
|
|
9
8
|
* Provides functions for creating and retrieving Jupyter notebooks within workspaces.
|
|
9
|
+
*
|
|
10
|
+
* @module api/spacer/notebooks
|
|
10
11
|
*/
|
|
11
12
|
import { requestDatalayerAPI } from '../DatalayerApi';
|
|
12
13
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
package/lib/api/spacer/spaces.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description Workspace spaces API functions for the Datalayer platform.
|
|
6
|
+
* Workspace spaces API functions for the Datalayer platform.
|
|
8
7
|
*
|
|
9
8
|
* Provides function for creating workspace spaces.
|
|
9
|
+
*
|
|
10
|
+
* @module api/spacer/spaces
|
|
10
11
|
*/
|
|
11
12
|
import { requestDatalayerAPI } from '../DatalayerApi';
|
|
12
13
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
package/lib/api/spacer/users.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description User-related Spacer API functions for the Datalayer platform.
|
|
6
|
+
* User-related Spacer API functions for the Datalayer platform.
|
|
8
7
|
*
|
|
9
8
|
* Provides functions for user-specific operations in the Spacer service.
|
|
9
|
+
*
|
|
10
|
+
* @module api/spacer/users
|
|
10
11
|
*/
|
|
11
12
|
import { requestDatalayerAPI } from '../DatalayerApi';
|
|
12
13
|
import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Utility functions for API parameter validation
|
|
3
|
+
*
|
|
2
4
|
* @module api/utils/validation
|
|
3
|
-
* @description Utility functions for API parameter validation
|
|
4
5
|
*/
|
|
5
6
|
/**
|
|
6
7
|
* Validates that an authentication token is provided and is a valid JWT format
|
|
@@ -22,3 +23,25 @@ export declare const validateRequired: (value: any, paramName: string) => void;
|
|
|
22
23
|
* @throws {Error} If the value is missing, null, undefined, or empty/whitespace
|
|
23
24
|
*/
|
|
24
25
|
export declare const validateRequiredString: (value: string | undefined | null, paramName: string) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Validates that all properties in an object are defined (not undefined).
|
|
28
|
+
* Recursively checks nested objects and arrays to ensure complete data integrity.
|
|
29
|
+
* This is used to validate model toJSON() outputs and ensure SDK contract compliance.
|
|
30
|
+
*
|
|
31
|
+
* @param obj - The object to validate
|
|
32
|
+
* @param modelName - Name of the model class for error messages (e.g., 'Runtime')
|
|
33
|
+
* @param path - Current property path for recursive validation (internal use)
|
|
34
|
+
* @throws {Error} If any property value is undefined, with full path to the undefined property
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const runtimeData = {
|
|
39
|
+
* uid: 'abc123',
|
|
40
|
+
* podName: 'my-pod',
|
|
41
|
+
* environmentName: undefined // This will throw
|
|
42
|
+
* };
|
|
43
|
+
* validateJSON(runtimeData, 'Runtime');
|
|
44
|
+
* // Error: Runtime.toJSON(): Property 'environmentName' is undefined
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare const validateJSON: (obj: Record<string, any>, modelName: string, path?: string) => void;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
+
* Utility functions for API parameter validation
|
|
7
|
+
*
|
|
6
8
|
* @module api/utils/validation
|
|
7
|
-
* @description Utility functions for API parameter validation
|
|
8
9
|
*/
|
|
9
10
|
/**
|
|
10
11
|
* Validates that an authentication token is provided and is a valid JWT format
|
|
@@ -131,3 +132,63 @@ export const validateRequiredString = (value, paramName) => {
|
|
|
131
132
|
throw new Error(`${paramName} is required`);
|
|
132
133
|
}
|
|
133
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Validates that all properties in an object are defined (not undefined).
|
|
137
|
+
* Recursively checks nested objects and arrays to ensure complete data integrity.
|
|
138
|
+
* This is used to validate model toJSON() outputs and ensure SDK contract compliance.
|
|
139
|
+
*
|
|
140
|
+
* @param obj - The object to validate
|
|
141
|
+
* @param modelName - Name of the model class for error messages (e.g., 'Runtime')
|
|
142
|
+
* @param path - Current property path for recursive validation (internal use)
|
|
143
|
+
* @throws {Error} If any property value is undefined, with full path to the undefined property
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* const runtimeData = {
|
|
148
|
+
* uid: 'abc123',
|
|
149
|
+
* podName: 'my-pod',
|
|
150
|
+
* environmentName: undefined // This will throw
|
|
151
|
+
* };
|
|
152
|
+
* validateJSON(runtimeData, 'Runtime');
|
|
153
|
+
* // Error: Runtime.toJSON(): Property 'environmentName' is undefined
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
export const validateJSON = (obj, modelName, path = '') => {
|
|
157
|
+
// Iterate over all enumerable properties
|
|
158
|
+
for (const key in obj) {
|
|
159
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const value = obj[key];
|
|
163
|
+
const currentPath = path ? `${path}.${key}` : key;
|
|
164
|
+
// Check if value is undefined - this is the error case
|
|
165
|
+
if (value === undefined) {
|
|
166
|
+
throw new Error(`${modelName}.toJSON(): Property '${currentPath}' is undefined`);
|
|
167
|
+
}
|
|
168
|
+
// Skip null, functions, and symbols - these are valid
|
|
169
|
+
if (value === null ||
|
|
170
|
+
typeof value === 'function' ||
|
|
171
|
+
typeof value === 'symbol') {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
// Recursively validate arrays
|
|
175
|
+
if (Array.isArray(value)) {
|
|
176
|
+
value.forEach((item, index) => {
|
|
177
|
+
if (item === undefined) {
|
|
178
|
+
throw new Error(`${modelName}.toJSON(): Array element at '${currentPath}[${index}]' is undefined`);
|
|
179
|
+
}
|
|
180
|
+
// If array element is an object, recurse into it
|
|
181
|
+
if (item !== null && typeof item === 'object') {
|
|
182
|
+
validateJSON(item, modelName, `${currentPath}[${index}]`);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
// Recursively validate nested objects
|
|
188
|
+
// Note: typeof null === 'object', but we already checked for null above
|
|
189
|
+
if (typeof value === 'object') {
|
|
190
|
+
validateJSON(value, modelName, currentPath);
|
|
191
|
+
}
|
|
192
|
+
// Primitives (string, number, boolean) are valid - no further checks needed
|
|
193
|
+
}
|
|
194
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { EnvironmentDTO } from '../models/EnvironmentDTO';
|
|
2
|
+
/** Handlers for SDK method lifecycle events. */
|
|
3
|
+
export interface SDKHandlers {
|
|
4
|
+
/** Called before any SDK method execution */
|
|
5
|
+
beforeCall?: (methodName: string, args: any[]) => void | Promise<void>;
|
|
6
|
+
/** Called after successful SDK method execution */
|
|
7
|
+
afterCall?: (methodName: string, result: any) => void | Promise<void>;
|
|
8
|
+
/** Called when an SDK method throws an error */
|
|
9
|
+
onError?: (methodName: string, error: any) => void | Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
/** Configuration options for the Datalayer Client. */
|
|
12
|
+
export interface DatalayerClientConfig {
|
|
13
|
+
/** Authentication token for API requests */
|
|
14
|
+
token?: string;
|
|
15
|
+
/** URL for the IAM service */
|
|
16
|
+
iamRunUrl?: string;
|
|
17
|
+
/** URL for the Runtimes service */
|
|
18
|
+
runtimesRunUrl?: string;
|
|
19
|
+
/** URL for the Spacer service */
|
|
20
|
+
spacerRunUrl?: string;
|
|
21
|
+
/** Handlers for intercepting SDK method calls */
|
|
22
|
+
handlers?: SDKHandlers;
|
|
23
|
+
}
|
|
24
|
+
/** Base Client class providing core configuration and token management. */
|
|
25
|
+
export declare class DatalayerClientBase {
|
|
26
|
+
/** URL for IAM service */
|
|
27
|
+
readonly iamRunUrl: string;
|
|
28
|
+
/** URL for Runtimes service */
|
|
29
|
+
readonly runtimesRunUrl: string;
|
|
30
|
+
/** URL for Spacer service */
|
|
31
|
+
readonly spacerRunUrl: string;
|
|
32
|
+
/** Authentication token */
|
|
33
|
+
token?: string;
|
|
34
|
+
/** Environments */
|
|
35
|
+
readonly environments: EnvironmentDTO[];
|
|
36
|
+
/** Method lifecycle handlers */
|
|
37
|
+
readonly handlers?: SDKHandlers;
|
|
38
|
+
/**
|
|
39
|
+
* Create a DatalayerClient base instance.
|
|
40
|
+
* @param config - Client configuration options
|
|
41
|
+
*/
|
|
42
|
+
constructor(config: DatalayerClientConfig);
|
|
43
|
+
/**
|
|
44
|
+
* Get the current configuration including service URLs and token.
|
|
45
|
+
* @returns Current configuration
|
|
46
|
+
*/
|
|
47
|
+
getConfig(): DatalayerClientConfig;
|
|
48
|
+
/** Get the IAM service URL. */
|
|
49
|
+
getIamRunUrl(): string;
|
|
50
|
+
/** Get the Runtimes service URL. */
|
|
51
|
+
getRuntimesRunUrl(): string;
|
|
52
|
+
/** Get the Spacer service URL. */
|
|
53
|
+
getSpacerRunUrl(): string;
|
|
54
|
+
/** Get the current authentication token. */
|
|
55
|
+
getToken(): string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* set the authentication token for all API requests.
|
|
58
|
+
* @param token - New authentication token
|
|
59
|
+
*/
|
|
60
|
+
setToken(token: string): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Wrap all SDK methods with handlers for cross-cutting concerns.
|
|
63
|
+
* Called automatically by the DatalayerClient constructor.
|
|
64
|
+
*
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
protected wrapAllMethods(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get all method names from mixins only.
|
|
70
|
+
* @returns Array of mixin method names to wrap
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
private getAllMethodNames;
|
|
74
|
+
calculateCreditsFromMinutes(minutes: number, burningRate: number): number;
|
|
75
|
+
}
|