@datalayer/core 0.0.12 → 0.0.13

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 (237) hide show
  1. package/README.md +2 -2
  2. package/lib/api/DatalayerApi.d.ts +38 -26
  3. package/lib/api/DatalayerApi.js +35 -8
  4. package/lib/api/iam/authentication.d.ts +8 -7
  5. package/lib/api/iam/authentication.js +14 -15
  6. package/lib/api/iam/healthz.d.ts +3 -2
  7. package/lib/api/iam/healthz.js +5 -3
  8. package/lib/api/iam/index.d.ts +9 -4
  9. package/lib/api/iam/index.js +9 -4
  10. package/lib/api/iam/oauth2.d.ts +115 -0
  11. package/lib/api/iam/oauth2.js +309 -0
  12. package/lib/api/iam/profile.d.ts +8 -1
  13. package/lib/api/iam/profile.js +17 -2
  14. package/lib/api/iam/usage.d.ts +56 -0
  15. package/lib/api/iam/usage.js +39 -0
  16. package/lib/api/index.d.ts +6 -5
  17. package/lib/api/index.js +6 -5
  18. package/lib/api/runtimes/environments.js +3 -2
  19. package/lib/api/runtimes/healthz.d.ts +3 -13
  20. package/lib/api/runtimes/healthz.js +4 -3
  21. package/lib/api/runtimes/index.d.ts +3 -2
  22. package/lib/api/runtimes/index.js +3 -2
  23. package/lib/api/runtimes/runtimes.js +17 -6
  24. package/lib/api/runtimes/snapshots.js +3 -2
  25. package/lib/api/spacer/documents.d.ts +12 -0
  26. package/lib/api/spacer/documents.js +43 -0
  27. package/lib/api/spacer/healthz.d.ts +3 -13
  28. package/lib/api/spacer/healthz.js +4 -3
  29. package/lib/api/spacer/index.d.ts +4 -2
  30. package/lib/api/spacer/index.js +4 -2
  31. package/lib/api/spacer/items.d.ts +9 -1
  32. package/lib/api/spacer/items.js +17 -2
  33. package/lib/api/spacer/lexicals.js +3 -2
  34. package/lib/api/spacer/notebooks.js +3 -2
  35. package/lib/api/spacer/spaces.js +3 -2
  36. package/lib/api/spacer/users.js +3 -2
  37. package/lib/api/types/common.d.ts +64 -0
  38. package/lib/api/types/iam.d.ts +88 -65
  39. package/lib/api/types/index.d.ts +4 -2
  40. package/lib/api/types/index.js +4 -2
  41. package/lib/api/types/runtimes.d.ts +9 -39
  42. package/lib/api/types/spacer.d.ts +37 -65
  43. package/lib/api/utils/validation.d.ts +24 -1
  44. package/lib/api/utils/validation.js +62 -1
  45. package/lib/client/base.d.ts +75 -0
  46. package/lib/client/base.js +199 -0
  47. package/lib/client/constants.d.ts +22 -0
  48. package/lib/client/constants.js +22 -0
  49. package/lib/client/index.d.ts +108 -0
  50. package/lib/client/index.js +79 -0
  51. package/lib/client/mixins/IAMMixin.d.ts +54 -0
  52. package/lib/client/mixins/IAMMixin.js +181 -0
  53. package/lib/client/mixins/RuntimesMixin.d.ts +93 -0
  54. package/lib/client/mixins/RuntimesMixin.js +229 -0
  55. package/lib/client/mixins/SpacerMixin.d.ts +111 -0
  56. package/lib/client/mixins/SpacerMixin.js +340 -0
  57. package/lib/client/models/Credits.d.ts +91 -0
  58. package/lib/client/models/Credits.js +130 -0
  59. package/lib/client/models/Environment.d.ts +73 -0
  60. package/lib/client/models/Environment.js +88 -0
  61. package/lib/client/models/HealthCheck.d.ts +72 -0
  62. package/lib/client/models/HealthCheck.js +107 -0
  63. package/lib/client/models/Item.d.ts +69 -0
  64. package/lib/client/models/Item.js +191 -0
  65. package/lib/client/models/Lexical.d.ts +83 -0
  66. package/lib/client/models/Lexical.js +152 -0
  67. package/lib/client/models/Notebook.d.ts +87 -0
  68. package/lib/client/models/Notebook.js +153 -0
  69. package/lib/client/models/Runtime.d.ts +122 -0
  70. package/lib/client/models/Runtime.js +204 -0
  71. package/lib/client/models/Snapshot.d.ts +92 -0
  72. package/lib/client/models/Snapshot.js +139 -0
  73. package/lib/client/models/Space.d.ts +135 -0
  74. package/lib/client/models/Space.js +234 -0
  75. package/lib/client/models/User.d.ts +64 -0
  76. package/lib/client/models/User.js +83 -0
  77. package/lib/client/models/index.d.ts +26 -0
  78. package/lib/client/models/index.js +25 -0
  79. package/lib/client/utils/mixins.d.ts +12 -0
  80. package/lib/{sdk/client → client}/utils/mixins.js +0 -28
  81. package/lib/client/utils/spacerUtils.d.ts +18 -0
  82. package/lib/client/utils/spacerUtils.js +32 -0
  83. package/lib/collaboration/DatalayerCollaboration.d.ts +6 -1
  84. package/lib/collaboration/DatalayerCollaboration.js +2 -2
  85. package/lib/collaboration/DatalayerCollaborationProvider.d.ts +5 -0
  86. package/lib/collaboration/DatalayerCollaborationProvider.js +10 -9
  87. package/lib/components/progress/CreditsIndicator.d.ts +1 -1
  88. package/lib/components/runtimes/RuntimeCellVariablesDialog.js +1 -1
  89. package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +1 -1
  90. package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
  91. package/lib/components/runtimes/RuntimePickerBase.js +1 -1
  92. package/lib/components/runtimes/RuntimePickerCell.js +2 -2
  93. package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -1
  94. package/lib/components/runtimes/RuntimePickerNotebook.js +1 -1
  95. package/lib/components/runtimes/RuntimeTransfer.d.ts +1 -1
  96. package/lib/components/runtimes/RuntimeUtils.d.ts +1 -1
  97. package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -1
  98. package/lib/components/snapshots/RuntimeSnapshotMenu.js +27 -20
  99. package/lib/config/Configuration.d.ts +8 -0
  100. package/lib/hooks/useDatalayer.js +1 -1
  101. package/lib/hooks/useRuntimes.js +1 -1
  102. package/lib/hooks/useToast.js +1 -1
  103. package/lib/index.d.ts +2 -2
  104. package/lib/index.js +4 -2
  105. package/lib/sdk/index.d.ts +5 -4
  106. package/lib/sdk/index.js +6 -5
  107. package/lib/services/DatalayerServiceManager.js +1 -1
  108. package/lib/state/substates/CoreState.js +2 -0
  109. package/lib/state/substates/RuntimesState.d.ts +1 -1
  110. package/lib/state/substates/RuntimesState.js +1 -1
  111. package/lib/{sdk/stateful → stateful}/index.d.ts +1 -1
  112. package/lib/{sdk/stateful → stateful}/index.js +1 -1
  113. package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.d.ts +1 -41
  114. package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.js +1 -20
  115. package/lib/{sdk/stateful → stateful}/runtimes/actions.d.ts +3 -3
  116. package/lib/{sdk/stateful → stateful}/runtimes/actions.js +8 -8
  117. package/lib/{sdk/stateful → stateful}/runtimes/apis.d.ts +8 -8
  118. package/lib/stateful/runtimes/apis.js +5 -0
  119. package/package.json +12 -10
  120. package/lib/__tests__/hooks.test.d.ts +0 -1
  121. package/lib/__tests__/hooks.test.js +0 -19
  122. package/lib/__tests__/index.test.d.ts +0 -1
  123. package/lib/__tests__/index.test.js +0 -27
  124. package/lib/__tests__/integration.test.d.ts +0 -1
  125. package/lib/__tests__/integration.test.js +0 -57
  126. package/lib/__tests__/shared/cleanup-shared.d.ts +0 -4
  127. package/lib/__tests__/shared/cleanup-shared.js +0 -228
  128. package/lib/__tests__/shared/test-config.d.ts +0 -51
  129. package/lib/__tests__/shared/test-config.js +0 -110
  130. package/lib/__tests__/shared/test-constants.d.ts +0 -66
  131. package/lib/__tests__/shared/test-constants.js +0 -79
  132. package/lib/__tests__/utils.test.d.ts +0 -1
  133. package/lib/__tests__/utils.test.js +0 -59
  134. package/lib/api/__tests__/iam.authentication.integration.test.d.ts +0 -1
  135. package/lib/api/__tests__/iam.authentication.integration.test.js +0 -247
  136. package/lib/api/__tests__/iam.healthz.integration.test.d.ts +0 -1
  137. package/lib/api/__tests__/iam.healthz.integration.test.js +0 -63
  138. package/lib/api/__tests__/iam.profile.integration.test.d.ts +0 -1
  139. package/lib/api/__tests__/iam.profile.integration.test.js +0 -252
  140. package/lib/api/__tests__/runtimes.environments.integration.test.d.ts +0 -1
  141. package/lib/api/__tests__/runtimes.environments.integration.test.js +0 -122
  142. package/lib/api/__tests__/runtimes.healthz.integration.test.d.ts +0 -1
  143. package/lib/api/__tests__/runtimes.healthz.integration.test.js +0 -50
  144. package/lib/api/__tests__/runtimes.integration.test.d.ts +0 -1
  145. package/lib/api/__tests__/runtimes.integration.test.js +0 -369
  146. package/lib/api/__tests__/spacer.healthz.integration.test.d.ts +0 -1
  147. package/lib/api/__tests__/spacer.healthz.integration.test.js +0 -50
  148. package/lib/api/__tests__/spacer.integration.test.d.ts +0 -1
  149. package/lib/api/__tests__/spacer.integration.test.js +0 -519
  150. package/lib/api/iam/__tests__/authentication.unit.test.d.ts +0 -1
  151. package/lib/api/iam/__tests__/authentication.unit.test.js +0 -63
  152. package/lib/api/iam/__tests__/healthz.unit.test.d.ts +0 -1
  153. package/lib/api/iam/__tests__/healthz.unit.test.js +0 -60
  154. package/lib/api/iam/__tests__/profile.unit.test.d.ts +0 -1
  155. package/lib/api/iam/__tests__/profile.unit.test.js +0 -57
  156. package/lib/api/runtimes/__tests__/environments.unit.test.d.ts +0 -1
  157. package/lib/api/runtimes/__tests__/environments.unit.test.js +0 -77
  158. package/lib/api/runtimes/__tests__/healthz.unit.test.d.ts +0 -1
  159. package/lib/api/runtimes/__tests__/healthz.unit.test.js +0 -57
  160. package/lib/api/runtimes/__tests__/runtimes.unit.test.d.ts +0 -1
  161. package/lib/api/runtimes/__tests__/runtimes.unit.test.js +0 -139
  162. package/lib/api/runtimes/__tests__/snapshots.unit.test.d.ts +0 -1
  163. package/lib/api/runtimes/__tests__/snapshots.unit.test.js +0 -96
  164. package/lib/api/spacer/__tests__/healthz.unit.test.d.ts +0 -1
  165. package/lib/api/spacer/__tests__/healthz.unit.test.js +0 -57
  166. package/lib/api/spacer/__tests__/items.unit.test.d.ts +0 -1
  167. package/lib/api/spacer/__tests__/items.unit.test.js +0 -165
  168. package/lib/api/spacer/__tests__/lexicals.unit.test.d.ts +0 -1
  169. package/lib/api/spacer/__tests__/lexicals.unit.test.js +0 -323
  170. package/lib/api/spacer/__tests__/notebooks.unit.test.d.ts +0 -1
  171. package/lib/api/spacer/__tests__/notebooks.unit.test.js +0 -224
  172. package/lib/api/spacer/__tests__/users.unit.test.d.ts +0 -1
  173. package/lib/api/spacer/__tests__/users.unit.test.js +0 -132
  174. package/lib/api/utils/__tests__/validation.test.d.ts +0 -1
  175. package/lib/api/utils/__tests__/validation.test.js +0 -109
  176. package/lib/sdk/client/__tests__/sdk.health.integration.test.d.ts +0 -1
  177. package/lib/sdk/client/__tests__/sdk.health.integration.test.js +0 -110
  178. package/lib/sdk/client/__tests__/sdk.iam.integration.test.d.ts +0 -1
  179. package/lib/sdk/client/__tests__/sdk.iam.integration.test.js +0 -179
  180. package/lib/sdk/client/__tests__/sdk.models.integration.test.d.ts +0 -1
  181. package/lib/sdk/client/__tests__/sdk.models.integration.test.js +0 -376
  182. package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.d.ts +0 -1
  183. package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.js +0 -276
  184. package/lib/sdk/client/__tests__/sdk.spacer.integration.test.d.ts +0 -1
  185. package/lib/sdk/client/__tests__/sdk.spacer.integration.test.js +0 -361
  186. package/lib/sdk/client/base.d.ts +0 -88
  187. package/lib/sdk/client/base.js +0 -112
  188. package/lib/sdk/client/index.d.ts +0 -192
  189. package/lib/sdk/client/index.js +0 -128
  190. package/lib/sdk/client/mixins/HealthMixin.d.ts +0 -100
  191. package/lib/sdk/client/mixins/HealthMixin.js +0 -133
  192. package/lib/sdk/client/mixins/IAMMixin.d.ts +0 -59
  193. package/lib/sdk/client/mixins/IAMMixin.js +0 -83
  194. package/lib/sdk/client/mixins/RuntimesMixin.d.ts +0 -134
  195. package/lib/sdk/client/mixins/RuntimesMixin.js +0 -221
  196. package/lib/sdk/client/mixins/SpacerMixin.d.ts +0 -184
  197. package/lib/sdk/client/mixins/SpacerMixin.js +0 -278
  198. package/lib/sdk/client/models/Lexical.d.ts +0 -156
  199. package/lib/sdk/client/models/Lexical.js +0 -275
  200. package/lib/sdk/client/models/Notebook.d.ts +0 -174
  201. package/lib/sdk/client/models/Notebook.js +0 -311
  202. package/lib/sdk/client/models/Runtime.d.ts +0 -221
  203. package/lib/sdk/client/models/Runtime.js +0 -341
  204. package/lib/sdk/client/models/Snapshot.d.ts +0 -156
  205. package/lib/sdk/client/models/Snapshot.js +0 -244
  206. package/lib/sdk/client/models/Space.d.ts +0 -182
  207. package/lib/sdk/client/models/Space.js +0 -276
  208. package/lib/sdk/client/models/__tests__/Lexical.test.d.ts +0 -1
  209. package/lib/sdk/client/models/__tests__/Lexical.test.js +0 -288
  210. package/lib/sdk/client/models/__tests__/Notebook.test.d.ts +0 -1
  211. package/lib/sdk/client/models/__tests__/Notebook.test.js +0 -206
  212. package/lib/sdk/client/models/__tests__/Runtime.test.d.ts +0 -1
  213. package/lib/sdk/client/models/__tests__/Runtime.test.js +0 -133
  214. package/lib/sdk/client/models/__tests__/Snapshot.test.d.ts +0 -1
  215. package/lib/sdk/client/models/__tests__/Snapshot.test.js +0 -244
  216. package/lib/sdk/client/models/__tests__/Space.test.d.ts +0 -1
  217. package/lib/sdk/client/models/__tests__/Space.test.js +0 -334
  218. package/lib/sdk/client/models/index.d.ts +0 -30
  219. package/lib/sdk/client/models/index.js +0 -30
  220. package/lib/sdk/client/utils/mixins.d.ts +0 -42
  221. /package/lib/{sdk/stateful/runtimes/apis.js → api/types/common.js} +0 -0
  222. /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.d.ts +0 -0
  223. /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.js +0 -0
  224. /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.d.ts +0 -0
  225. /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.js +0 -0
  226. /package/lib/{sdk/stateful → stateful}/jupyter/index.d.ts +0 -0
  227. /package/lib/{sdk/stateful → stateful}/jupyter/index.js +0 -0
  228. /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.d.ts +0 -0
  229. /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.js +0 -0
  230. /package/lib/{sdk/stateful → stateful}/runtimes/index.d.ts +0 -0
  231. /package/lib/{sdk/stateful → stateful}/runtimes/index.js +0 -0
  232. /package/lib/{sdk/stateful → stateful}/runtimes/settings.d.ts +0 -0
  233. /package/lib/{sdk/stateful → stateful}/runtimes/settings.js +0 -0
  234. /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.d.ts +0 -0
  235. /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.js +0 -0
  236. /package/lib/{sdk/stateful → stateful}/runtimes/utils.d.ts +0 -0
  237. /package/lib/{sdk/stateful → stateful}/runtimes/utils.js +0 -0
@@ -0,0 +1,12 @@
1
+ import { CollaborationSessionResponse } from '../types/spacer';
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 '../types/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
- * @description
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<SpacerHealthzPingResponse>;
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
- * @module api/spacer/healthz
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
- * @description
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
- * @module api/spacer
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';
@@ -3,12 +3,14 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * @module api/spacer
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 '../types/spacer';
1
+ import { DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse } from '../types/spacer';
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
@@ -3,10 +3,11 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * @module api/spacer/items
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
@@ -3,10 +3,11 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * @module api/spacer/lexicals
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';
@@ -3,10 +3,11 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * @module api/spacer/notebooks
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';
@@ -3,10 +3,11 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * @module api/spacer/spaces
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';
@@ -3,10 +3,11 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * @module api/spacer/users
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';
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Common types shared across all Datalayer API services.
3
+ *
4
+ * @module api/types/common
5
+ */
6
+ /**
7
+ * Standard health check response used by all services.
8
+ * @interface HealthzPingResponse
9
+ */
10
+ export interface HealthzPingResponse {
11
+ /** Whether the request was successful */
12
+ success: boolean;
13
+ /** Response message from the server */
14
+ message: string;
15
+ /** Service status information */
16
+ status?: {
17
+ /** Status indicator (e.g., "OK") */
18
+ status: string;
19
+ };
20
+ /** API version */
21
+ version?: string;
22
+ }
23
+ /**
24
+ * Standard error response structure.
25
+ * @interface ErrorResponse
26
+ */
27
+ export interface ErrorResponse {
28
+ /** Whether the request was successful (always false for errors) */
29
+ success: false;
30
+ /** Error message */
31
+ message: string;
32
+ /** Optional error code */
33
+ code?: string;
34
+ /** Optional additional error details */
35
+ details?: any;
36
+ }
37
+ /**
38
+ * Standard pagination parameters.
39
+ * @interface PaginationParams
40
+ */
41
+ export interface PaginationParams {
42
+ /** Page number (1-based) */
43
+ page?: number;
44
+ /** Items per page */
45
+ limit?: number;
46
+ /** Sort field */
47
+ sort?: string;
48
+ /** Sort order */
49
+ order?: 'asc' | 'desc';
50
+ }
51
+ /**
52
+ * Standard pagination response metadata.
53
+ * @interface PaginationMeta
54
+ */
55
+ export interface PaginationMeta {
56
+ /** Current page */
57
+ page: number;
58
+ /** Items per page */
59
+ limit: number;
60
+ /** Total number of items */
61
+ total: number;
62
+ /** Total number of pages */
63
+ totalPages: number;
64
+ }
@@ -3,38 +3,86 @@
3
3
  * @interface User
4
4
  */
5
5
  export interface User {
6
- /** Unique identifier for the user */
6
+ /** uuid for the user */
7
7
  id: string;
8
- /** Alternative unique identifier (UUID format) */
9
- uid?: string;
10
- /** User ID in the authentication system */
11
- user_id?: string;
12
- /** Username for login */
13
- username?: string;
8
+ /** ulid for the user */
9
+ uid: string;
14
10
  /** User's handle or nickname */
15
- handle?: string;
11
+ handle_s: string;
16
12
  /** User's email address */
17
- email: string;
13
+ email_s: string;
18
14
  /** User's first name */
19
- first_name?: string;
15
+ first_name_t: string;
20
16
  /** User's last name */
21
- last_name?: string;
17
+ last_name_t: string;
22
18
  /** Display name shown in the UI */
23
- display_name?: string;
24
- /** URL to the user's avatar image */
25
- avatar_url?: string;
26
- /** Alternative property name for avatar URL (for backwards compatibility) */
27
- avatarUrl?: string;
19
+ avatar_url_s: string;
20
+ /** Additional fields that may be present in the response */
21
+ [key: string]: any;
22
+ }
23
+ /**
24
+ * Represents a user profile in the Datalayer platform
25
+ * @interface Profile
26
+ */
27
+ interface Profile {
28
28
  /** ISO 8601 timestamp of when the user was created */
29
- created_at?: string;
30
- /** ISO 8601 timestamp of when the user was last updated */
31
- updated_at?: string;
32
- /** Whether the user account is active */
33
- is_active?: boolean;
34
- /** Whether the user's email has been verified */
35
- is_verified?: boolean;
36
- /** Whether multi-factor authentication is enabled */
37
- mfa_enabled?: boolean;
29
+ creation_ts_dt: string;
30
+ /** Unique identifier for the user */
31
+ id: string;
32
+ /** ISO 8601 timestamp of when the user requested to join */
33
+ join_request_ts_dt: string | null;
34
+ /** ISO 8601 timestamp of when the user joined */
35
+ join_ts_dt: string;
36
+ /** ISO 8601 timestamp of last update */
37
+ last_update_ts_dt: string;
38
+ /** Origin of the user account */
39
+ origin_s: string;
40
+ /** Type of the record */
41
+ type_s: string;
42
+ /** User ID */
43
+ uid: string;
44
+ /** Email address */
45
+ email_s: string;
46
+ /** First name */
47
+ first_name_t: string;
48
+ /** User handle */
49
+ handle_s: string;
50
+ /** Last name */
51
+ last_name_t: string;
52
+ /** User roles array */
53
+ roles_ss?: string[];
54
+ /** Avatar URL */
55
+ avatar_url_s?: string;
56
+ /** Onboarding state as JSON string */
57
+ onboarding_s?: string;
58
+ /** New password request timestamp */
59
+ new_password_request_ts_dt?: string | null;
60
+ /** New password confirmation timestamp */
61
+ new_password_confirmation_ts_dt?: string | null;
62
+ /** Customer UID */
63
+ customer_uid?: string | null;
64
+ /** Credits customer UID for billing */
65
+ credits_customer_uid?: string | null;
66
+ /** Email unsubscription status */
67
+ unsubscribed_from_outbounds_b?: boolean;
68
+ /** Linked contact UID */
69
+ linked_contact_uid?: string | null;
70
+ /** MFA URL */
71
+ mfa_url_s?: string | null;
72
+ /** MFA secret */
73
+ mfa_secret_s?: string | null;
74
+ /** Email verification token */
75
+ email_token_s?: string | null;
76
+ /** Pending email update */
77
+ email_update_s?: string | null;
78
+ /** IAM providers (nested structure - not typed in detail) */
79
+ iam_providers?: any[];
80
+ /** User settings (nested structure - not typed in detail) */
81
+ settings?: any;
82
+ /** User events (nested structure - not typed in detail) */
83
+ events?: any[];
84
+ /** Allow additional fields that may come from the server */
85
+ [key: string]: any;
38
86
  }
39
87
  /**
40
88
  * Request payload for user login
@@ -112,16 +160,18 @@ export interface UserMeResponse {
112
160
  uid: string;
113
161
  /** User handle (username) */
114
162
  handle: string;
115
- /** Email address of the user */
163
+ /** Email address of the user (may be empty string) */
116
164
  email: string;
117
- /** First name of the user */
165
+ /** First name of the user (may be empty string) */
118
166
  firstName: string;
119
- /** Last name of the user */
167
+ /** Last name of the user (may be empty string) */
120
168
  lastName: string;
121
- /** Avatar URL for the user */
169
+ /** Avatar URL for the user (may be empty string) */
122
170
  avatarUrl: string;
123
171
  /** Array of roles assigned to the user */
124
172
  roles: string[];
173
+ /** Allow additional fields that may come from the server */
174
+ [key: string]: any;
125
175
  };
126
176
  }
127
177
  /**
@@ -134,47 +184,20 @@ export interface WhoAmIResponse {
134
184
  /** Response message from the server */
135
185
  message: string;
136
186
  /** User profile information */
137
- profile: {
138
- /** ISO 8601 timestamp of when the user was created */
139
- creation_ts_dt: string;
140
- /** Unique identifier for the user */
141
- id: string;
142
- /** ISO 8601 timestamp of when the user requested to join */
143
- join_request_ts_dt: string | null;
144
- /** ISO 8601 timestamp of when the user joined */
145
- join_ts_dt: string;
146
- /** ISO 8601 timestamp of last update */
147
- last_update_ts_dt: string;
148
- /** Origin of the user account */
149
- origin_s: string;
150
- /** Type of the record */
151
- type_s: string;
152
- /** User ID */
153
- uid: string;
154
- /** Email address */
155
- email_s: string;
156
- /** First name */
157
- first_name_t: string;
158
- /** User handle */
159
- handle_s: string;
160
- /** Last name */
161
- last_name_t: string;
162
- };
187
+ profile: Profile;
163
188
  }
164
189
  /**
165
- * Response from the health check ping endpoint
166
- * @interface HealthzPingResponse
190
+ * Response from the /memberships endpoint
191
+ * @interface MembershipsResponse
167
192
  */
168
- export interface HealthzPingResponse {
193
+ export interface MembershipsResponse {
169
194
  /** Whether the request was successful */
170
195
  success: boolean;
171
196
  /** Response message from the server */
172
197
  message: string;
173
- /** Service status information */
174
- status: {
175
- /** Status indicator (e.g., "OK") */
176
- status: string;
177
- };
178
- /** API version */
179
- version: string;
198
+ /** User profile information */
199
+ profile: Profile;
200
+ /** Memberships information */
201
+ memberships: any[];
180
202
  }
203
+ export {};
@@ -1,6 +1,5 @@
1
1
  /**
2
- * @module types
3
- * @description TypeScript type definitions for all Datalayer API services.
2
+ * TypeScript type definitions for all Datalayer API services.
4
3
  *
5
4
  * This module consolidates all type definitions used by the SDK, providing
6
5
  * comprehensive TypeScript support for requests, responses, and data models
@@ -26,7 +25,10 @@
26
25
  * // Implementation
27
26
  * }
28
27
  * ```
28
+ *
29
+ * @module types
29
30
  */
31
+ export * from './common';
30
32
  export * from './runtimes';
31
33
  export * from './iam';
32
34
  export * from './spacer';
@@ -3,8 +3,7 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * @module types
7
- * @description TypeScript type definitions for all Datalayer API services.
6
+ * TypeScript type definitions for all Datalayer API services.
8
7
  *
9
8
  * This module consolidates all type definitions used by the SDK, providing
10
9
  * comprehensive TypeScript support for requests, responses, and data models
@@ -30,7 +29,10 @@
30
29
  * // Implementation
31
30
  * }
32
31
  * ```
32
+ *
33
+ * @module types
33
34
  */
35
+ export * from './common';
34
36
  export * from './runtimes';
35
37
  export * from './iam';
36
38
  export * from './spacer';
@@ -29,7 +29,7 @@ export interface Environment {
29
29
  /** Simple resource specification */
30
30
  resources?: any;
31
31
  /** Name identifier for the environment */
32
- name?: string;
32
+ name: string;
33
33
  /** Docker registry for the image */
34
34
  dockerRegistry?: string;
35
35
  /** Icon or avatar URL for the environment */
@@ -51,51 +51,21 @@ export interface Runtime {
51
51
  /** Name of the environment this runtime is based on */
52
52
  environment_name: string;
53
53
  /** Title of the environment for display */
54
- environment_title?: string;
55
- /** Credits allocated to this runtime */
56
- credits?: number;
57
- /** Current state of the runtime */
58
- state?: 'starting' | 'running' | 'stopping' | 'stopped' | 'error';
54
+ environment_title: string;
59
55
  /** Type of runtime - notebook, terminal, or job */
60
- type?: 'notebook' | 'terminal' | 'job';
61
- /** Type of runtime (deprecated, use type) */
62
- runtime_type?: 'notebook' | 'cell';
63
- /** Credits consumed per hour */
56
+ type: string;
57
+ /** Credits consumed per second */
64
58
  burning_rate: number;
65
59
  /** User-friendly name for the runtime */
66
- given_name?: string;
60
+ given_name: string;
67
61
  /** Authentication token for accessing the runtime */
68
- token?: string;
62
+ token: string;
69
63
  /** Ingress URL for accessing the runtime */
70
- ingress?: string;
71
- /** Reservation ID if runtime is reserved */
72
- reservation_id?: string;
64
+ ingress: string;
73
65
  /** ISO 8601 timestamp of when the runtime started */
74
- started_at?: string;
66
+ started_at: string;
75
67
  /** ISO 8601 timestamp of when the runtime will expire */
76
- expired_at?: string;
77
- /** ISO 8601 timestamp of when the runtime was created */
78
- created_at?: string;
79
- /** ISO 8601 timestamp of last update */
80
- updated_at?: string;
81
- /** Jupyter kernel ID if applicable */
82
- kernel_id?: string;
83
- /** Path to the notebook file if runtime is for a notebook */
84
- notebook_path?: string;
85
- /** Cell ID if runtime is for a specific cell */
86
- cell_id?: string;
87
- /** URL for accessing Jupyter server */
88
- jupyter_url?: string;
89
- /** Token for Jupyter server authentication */
90
- jupyter_token?: string;
91
- /** Detailed status information */
92
- status?: any;
93
- /** Alternative naming from API responses */
94
- podName?: string;
95
- /** Alternative naming from API responses */
96
- createdAt?: string;
97
- /** Alternative naming from API responses */
98
- environment?: string;
68
+ expired_at: string;
99
69
  }
100
70
  /**
101
71
  * Request payload for creating a new runtime