@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
@@ -1,88 +0,0 @@
1
- /**
2
- * Configuration options for the Datalayer SDK.
3
- */
4
- export interface DatalayerSDKConfig {
5
- /** Authentication token for API requests. */
6
- token?: string;
7
- /** URL for the IAM (Identity and Access Management) service. */
8
- iamRunUrl?: string;
9
- /** URL for the Runtimes service. */
10
- runtimesRunUrl?: string;
11
- /** URL for the Spacer (workspaces and collaboration) service. */
12
- spacerRunUrl?: string;
13
- }
14
- /**
15
- * Base SDK class that provides core configuration and token management.
16
- *
17
- * This class serves as the foundation for the DatalayerSDK, handling
18
- * authentication tokens, service URL configuration, and other common
19
- * SDK functionality that all mixins can access.
20
- */
21
- export declare class DatalayerSDKBase {
22
- /** URL for IAM service */
23
- readonly iamRunUrl: string;
24
- /** URL for Runtimes service */
25
- readonly runtimesRunUrl: string;
26
- /** URL for Spacer service */
27
- readonly spacerRunUrl: string;
28
- /** Authentication token */
29
- token?: string;
30
- /**
31
- * Create a DatalayerSDK base instance.
32
- *
33
- * @param config - SDK configuration options
34
- */
35
- constructor(config: DatalayerSDKConfig);
36
- /**
37
- * Update the authentication token for all API requests.
38
- *
39
- * This method updates the token that will be used for all subsequent
40
- * API calls made through the SDK.
41
- *
42
- * @param token - New authentication token
43
- *
44
- * @example
45
- * ```typescript
46
- * // After login, update the SDK with the new token
47
- * const loginResponse = await sdk.login(credentials);
48
- * sdk.updateToken(loginResponse.access_token);
49
- * ```
50
- */
51
- updateToken(token: string): void;
52
- /**
53
- * Get the current configuration including service URLs and token.
54
- *
55
- * @returns The current configuration
56
- */
57
- getConfig(): DatalayerSDKConfig;
58
- /**
59
- * Update the configuration for API requests.
60
- *
61
- * @param config - Configuration updates
62
- */
63
- updateConfig(config: Partial<DatalayerSDKConfig>): void;
64
- /**
65
- * Get the IAM service URL for API requests.
66
- *
67
- * @returns The IAM service URL
68
- */
69
- getIamRunUrl(): string;
70
- /**
71
- * Get the Runtimes service URL for API requests.
72
- *
73
- * @returns The Runtimes service URL
74
- */
75
- getRuntimesRunUrl(): string;
76
- /**
77
- * Get the Spacer service URL for API requests.
78
- *
79
- * @returns The Spacer service URL
80
- */
81
- getSpacerRunUrl(): string;
82
- /**
83
- * Get the current authentication token.
84
- *
85
- * @returns The authentication token
86
- */
87
- getToken(): string | undefined;
88
- }
@@ -1,112 +0,0 @@
1
- /*
2
- * Copyright (c) 2023-2025 Datalayer, Inc.
3
- * Distributed under the terms of the Modified BSD License.
4
- */
5
- /**
6
- * @module sdk/client/base
7
- * @description Base SDK class providing core configuration and token management.
8
- */
9
- import { DEFAULT_SERVICE_URLS } from '../../api/constants';
10
- /**
11
- * Base SDK class that provides core configuration and token management.
12
- *
13
- * This class serves as the foundation for the DatalayerSDK, handling
14
- * authentication tokens, service URL configuration, and other common
15
- * SDK functionality that all mixins can access.
16
- */
17
- export class DatalayerSDKBase {
18
- /** URL for IAM service */
19
- iamRunUrl;
20
- /** URL for Runtimes service */
21
- runtimesRunUrl;
22
- /** URL for Spacer service */
23
- spacerRunUrl;
24
- /** Authentication token */
25
- token;
26
- /**
27
- * Create a DatalayerSDK base instance.
28
- *
29
- * @param config - SDK configuration options
30
- */
31
- constructor(config) {
32
- this.iamRunUrl = config.iamRunUrl || DEFAULT_SERVICE_URLS.IAM;
33
- this.runtimesRunUrl =
34
- config.runtimesRunUrl || DEFAULT_SERVICE_URLS.RUNTIMES;
35
- this.spacerRunUrl = config.spacerRunUrl || DEFAULT_SERVICE_URLS.SPACER;
36
- this.token = config.token;
37
- }
38
- /**
39
- * Update the authentication token for all API requests.
40
- *
41
- * This method updates the token that will be used for all subsequent
42
- * API calls made through the SDK.
43
- *
44
- * @param token - New authentication token
45
- *
46
- * @example
47
- * ```typescript
48
- * // After login, update the SDK with the new token
49
- * const loginResponse = await sdk.login(credentials);
50
- * sdk.updateToken(loginResponse.access_token);
51
- * ```
52
- */
53
- updateToken(token) {
54
- this.token = token;
55
- }
56
- /**
57
- * Get the current configuration including service URLs and token.
58
- *
59
- * @returns The current configuration
60
- */
61
- getConfig() {
62
- return {
63
- iamRunUrl: this.iamRunUrl,
64
- runtimesRunUrl: this.runtimesRunUrl,
65
- spacerRunUrl: this.spacerRunUrl,
66
- token: this.token,
67
- };
68
- }
69
- /**
70
- * Update the configuration for API requests.
71
- *
72
- * @param config - Configuration updates
73
- */
74
- updateConfig(config) {
75
- if (config.token !== undefined) {
76
- this.updateToken(config.token);
77
- }
78
- // Note: service URLs cannot be changed after initialization
79
- }
80
- /**
81
- * Get the IAM service URL for API requests.
82
- *
83
- * @returns The IAM service URL
84
- */
85
- getIamRunUrl() {
86
- return this.iamRunUrl;
87
- }
88
- /**
89
- * Get the Runtimes service URL for API requests.
90
- *
91
- * @returns The Runtimes service URL
92
- */
93
- getRuntimesRunUrl() {
94
- return this.runtimesRunUrl;
95
- }
96
- /**
97
- * Get the Spacer service URL for API requests.
98
- *
99
- * @returns The Spacer service URL
100
- */
101
- getSpacerRunUrl() {
102
- return this.spacerRunUrl;
103
- }
104
- /**
105
- * Get the current authentication token.
106
- *
107
- * @returns The authentication token
108
- */
109
- getToken() {
110
- return this.token;
111
- }
112
- }
@@ -1,192 +0,0 @@
1
- /**
2
- * @module sdk/client
3
- * @description Main Datalayer SDK client with intuitive mixin-based API.
4
- *
5
- * The DatalayerSDK class provides a unified, flat API for all Datalayer platform
6
- * services through TypeScript mixins. This design offers the best discoverability
7
- * and ease of use compared to nested service objects.
8
- *
9
- * @example
10
- * ```typescript
11
- * import { DatalayerSDK } from '@datalayer/core/sdk';
12
- *
13
- * // Initialize SDK
14
- * const sdk = new DatalayerSDK({
15
- * token: 'your-api-token',
16
- * baseUrl: 'https://prod1.datalayer.run'
17
- * });
18
- *
19
- * // Flat, intuitive API
20
- * const user = await sdk.whoami();
21
- * const environments = await sdk.listEnvironments();
22
- * const notebook = await sdk.createNotebook(data);
23
- * const runtime = await sdk.createRuntime(config);
24
- * await sdk.startRuntime(podName);
25
- * ```
26
- */
27
- import { DatalayerSDKBase, type DatalayerSDKConfig } from './base';
28
- declare const DatalayerSDKWithMixins: {
29
- new (...args: any[]): {
30
- getMySpaces(): Promise<import("./models").Space[]>;
31
- createSpace(data: import("../..").CreateSpaceRequest): Promise<import("./models").Space>;
32
- _extractNotebookId(notebookIdOrInstance: string | import("./models").Notebook): string;
33
- _extractLexicalId(lexicalIdOrInstance: string | import("./models").Lexical): string;
34
- createNotebook(data: import("../..").CreateNotebookRequest): Promise<import("./models").Notebook>;
35
- getNotebook(idOrNotebook: string | import("./models").Notebook): Promise<import("./models").Notebook>;
36
- updateNotebook(idOrNotebook: string | import("./models").Notebook, data: import("../..").UpdateNotebookRequest): Promise<import("./models").Notebook>;
37
- createLexical(data: import("../..").CreateLexicalRequest): Promise<import("./models").Lexical>;
38
- getLexical(idOrLexical: string | import("./models").Lexical): Promise<import("./models").Lexical>;
39
- updateLexical(idOrLexical: string | import("./models").Lexical, data: import("../..").UpdateLexicalRequest): Promise<import("./models").Lexical>;
40
- getSpaceItems(spaceId: string): Promise<import("../..").GetSpaceItemsResponse>;
41
- deleteSpaceItem(itemId: string): Promise<import("../..").DeleteSpaceItemResponse>;
42
- };
43
- } & {
44
- new (...args: any[]): {
45
- _extractRuntimePodName(runtimePodNameOrInstance: string | import("./models").Runtime): string;
46
- _extractSnapshotId(snapshotIdOrInstance: string | import("./models").Snapshot): string;
47
- listEnvironments(): Promise<import("../..").Environment[]>;
48
- createRuntime(data: import("../..").CreateRuntimeRequest): Promise<import("./models").Runtime>;
49
- listRuntimes(): Promise<import("./models").Runtime[]>;
50
- getRuntime(podNameOrRuntime: string | import("./models").Runtime): Promise<import("./models").Runtime>;
51
- deleteRuntime(podNameOrRuntime: string | import("./models").Runtime): Promise<void>;
52
- createSnapshot(data: import("../..").CreateRuntimeSnapshotRequest): Promise<import("./models").Snapshot>;
53
- listSnapshots(): Promise<import("./models").Snapshot[]>;
54
- getSnapshot(idOrSnapshot: string | import("./models").Snapshot): Promise<import("./models").Snapshot>;
55
- deleteSnapshot(idOrSnapshot: string | import("./models").Snapshot): Promise<void>;
56
- };
57
- } & {
58
- new (...args: any[]): {
59
- whoami(): Promise<import("../..").User>;
60
- login(data: import("../..").LoginRequest): Promise<import("../..").LoginResponse>;
61
- logout(): Promise<void>;
62
- };
63
- } & {
64
- new (...args: any[]): {
65
- isIAMHealthy(): Promise<boolean>;
66
- isRuntimesHealthy(): Promise<boolean>;
67
- isSpacerHealthy(): Promise<boolean>;
68
- areAllServicesHealthy(): Promise<boolean>;
69
- getHealthStatus(): Promise<{
70
- iam: {
71
- healthy: boolean;
72
- details?: any;
73
- error?: string;
74
- version?: string;
75
- };
76
- runtimes: {
77
- healthy: boolean;
78
- details?: any;
79
- error?: string;
80
- version?: string;
81
- };
82
- spacer: {
83
- healthy: boolean;
84
- details?: any;
85
- error?: string;
86
- version?: string;
87
- };
88
- allHealthy: boolean;
89
- }>;
90
- readonly iamRunUrl: string;
91
- readonly runtimesRunUrl: string;
92
- readonly spacerRunUrl: string;
93
- token?: string;
94
- updateToken(token: string): void;
95
- getConfig(): DatalayerSDKConfig;
96
- updateConfig(config: Partial<DatalayerSDKConfig>): void;
97
- getIamRunUrl(): string;
98
- getRuntimesRunUrl(): string;
99
- getSpacerRunUrl(): string;
100
- getToken(): string | undefined;
101
- };
102
- } & typeof DatalayerSDKBase;
103
- /**
104
- * Main Datalayer SDK client providing unified access to all platform services.
105
- *
106
- * This class uses TypeScript mixins to provide a flat, discoverable API where
107
- * all methods are directly accessible on the SDK instance. This design offers
108
- * superior developer experience compared to nested service objects.
109
- *
110
- * **Key Features:**
111
- * - **Flat API**: All methods directly on `sdk.` (e.g., `sdk.createNotebook()`)
112
- * - **Intuitive naming**: Descriptive method names (e.g., `whoami()` vs `iam.users.me()`)
113
- * - **Perfect discoverability**: IDE shows all available methods immediately
114
- * - **Type safety**: Full TypeScript support with comprehensive interfaces
115
- *
116
- * **Authentication Methods:**
117
- * - `whoami()` - Get current user profile
118
- * - `login(credentials)` - Authenticate with credentials
119
- * - `logout()` - Log out current user
120
- *
121
- * **Environment Methods:**
122
- * - `listEnvironments()` - List available compute environments
123
- *
124
- * **Runtime Methods:**
125
- * - `createRuntime(config)` - Create new computational runtime
126
- * - `listRuntimes()` - List all runtimes
127
- * - `getRuntime(podName)` - Get runtime details
128
- * - `deleteRuntime(podName)` - Delete runtime
129
- *
130
- * **Workspace Methods:**
131
- * - `createSpace(data)` - Create new workspace
132
- * - `listSpaces()` - List all workspaces
133
- * - `getSpace(spaceId)` - Get workspace details
134
- * - `deleteSpace(spaceId)` - Delete workspace
135
- *
136
- * **Notebook Methods:**
137
- * - `createNotebook(data)` - Create new notebook
138
- * - `listNotebooks(spaceId?)` - List notebooks
139
- * - `getNotebook(notebookId)` - Get notebook details
140
- * - `getNotebookByUid(uid)` - Get notebook by UID
141
- * - `updateNotebook(notebookId, data)` - Update notebook
142
- * - `cloneNotebook(data)` - Clone existing notebook
143
- * - `getNotebookContent(notebookId)` - Get notebook content
144
- * - `updateNotebookContent(notebookId, content)` - Update notebook content
145
- * - `deleteNotebook(notebookId)` - Delete notebook
146
- *
147
- * **Cell Methods:**
148
- * - `createCell(notebookId, cell)` - Create new cell
149
- * - `getCell(notebookId, cellId)` - Get cell details
150
- * - `deleteCell(notebookId, cellId)` - Delete cell
151
- *
152
- * @example
153
- * ```typescript
154
- * // Initialize SDK
155
- * const sdk = new DatalayerSDK({
156
- * token: 'your-token',
157
- * baseUrl: 'https://prod1.datalayer.run'
158
- * });
159
- *
160
- * // Authentication
161
- * const user = await sdk.whoami();
162
- * console.log('Logged in as:', user.email);
163
- *
164
- * // Create workspace and notebook
165
- * const space = await sdk.createSpace({
166
- * name: 'My Project'
167
- * });
168
- *
169
- * const notebook = await sdk.createNotebook({
170
- * space_id: space.id,
171
- * name: 'Analysis'
172
- * });
173
- *
174
- * // Create and start runtime
175
- * const runtime = await sdk.createRuntime({
176
- * environment_name: 'python-cpu-env',
177
- * credits_limit: 100
178
- * });
179
- *
180
- * console.log('Setup complete!');
181
- * ```
182
- */
183
- export declare class DatalayerSDK extends DatalayerSDKWithMixins {
184
- /**
185
- * Create a DatalayerSDK instance.
186
- *
187
- * @param config - SDK configuration options
188
- */
189
- constructor(config: DatalayerSDKConfig);
190
- }
191
- export type { DatalayerSDKConfig };
192
- export { DatalayerSDKBase };
@@ -1,128 +0,0 @@
1
- /*
2
- * Copyright (c) 2023-2025 Datalayer, Inc.
3
- * Distributed under the terms of the Modified BSD License.
4
- */
5
- /**
6
- * @module sdk/client
7
- * @description Main Datalayer SDK client with intuitive mixin-based API.
8
- *
9
- * The DatalayerSDK class provides a unified, flat API for all Datalayer platform
10
- * services through TypeScript mixins. This design offers the best discoverability
11
- * and ease of use compared to nested service objects.
12
- *
13
- * @example
14
- * ```typescript
15
- * import { DatalayerSDK } from '@datalayer/core/sdk';
16
- *
17
- * // Initialize SDK
18
- * const sdk = new DatalayerSDK({
19
- * token: 'your-api-token',
20
- * baseUrl: 'https://prod1.datalayer.run'
21
- * });
22
- *
23
- * // Flat, intuitive API
24
- * const user = await sdk.whoami();
25
- * const environments = await sdk.listEnvironments();
26
- * const notebook = await sdk.createNotebook(data);
27
- * const runtime = await sdk.createRuntime(config);
28
- * await sdk.startRuntime(podName);
29
- * ```
30
- */
31
- import { DatalayerSDKBase } from './base';
32
- import { HealthMixin } from './mixins/HealthMixin';
33
- import { IAMMixin } from './mixins/IAMMixin';
34
- import { RuntimesMixin } from './mixins/RuntimesMixin';
35
- import { SpacerMixin } from './mixins/SpacerMixin';
36
- // Apply mixins to the base class
37
- const DatalayerSDKWithMixins = SpacerMixin(RuntimesMixin(IAMMixin(HealthMixin(DatalayerSDKBase))));
38
- /**
39
- * Main Datalayer SDK client providing unified access to all platform services.
40
- *
41
- * This class uses TypeScript mixins to provide a flat, discoverable API where
42
- * all methods are directly accessible on the SDK instance. This design offers
43
- * superior developer experience compared to nested service objects.
44
- *
45
- * **Key Features:**
46
- * - **Flat API**: All methods directly on `sdk.` (e.g., `sdk.createNotebook()`)
47
- * - **Intuitive naming**: Descriptive method names (e.g., `whoami()` vs `iam.users.me()`)
48
- * - **Perfect discoverability**: IDE shows all available methods immediately
49
- * - **Type safety**: Full TypeScript support with comprehensive interfaces
50
- *
51
- * **Authentication Methods:**
52
- * - `whoami()` - Get current user profile
53
- * - `login(credentials)` - Authenticate with credentials
54
- * - `logout()` - Log out current user
55
- *
56
- * **Environment Methods:**
57
- * - `listEnvironments()` - List available compute environments
58
- *
59
- * **Runtime Methods:**
60
- * - `createRuntime(config)` - Create new computational runtime
61
- * - `listRuntimes()` - List all runtimes
62
- * - `getRuntime(podName)` - Get runtime details
63
- * - `deleteRuntime(podName)` - Delete runtime
64
- *
65
- * **Workspace Methods:**
66
- * - `createSpace(data)` - Create new workspace
67
- * - `listSpaces()` - List all workspaces
68
- * - `getSpace(spaceId)` - Get workspace details
69
- * - `deleteSpace(spaceId)` - Delete workspace
70
- *
71
- * **Notebook Methods:**
72
- * - `createNotebook(data)` - Create new notebook
73
- * - `listNotebooks(spaceId?)` - List notebooks
74
- * - `getNotebook(notebookId)` - Get notebook details
75
- * - `getNotebookByUid(uid)` - Get notebook by UID
76
- * - `updateNotebook(notebookId, data)` - Update notebook
77
- * - `cloneNotebook(data)` - Clone existing notebook
78
- * - `getNotebookContent(notebookId)` - Get notebook content
79
- * - `updateNotebookContent(notebookId, content)` - Update notebook content
80
- * - `deleteNotebook(notebookId)` - Delete notebook
81
- *
82
- * **Cell Methods:**
83
- * - `createCell(notebookId, cell)` - Create new cell
84
- * - `getCell(notebookId, cellId)` - Get cell details
85
- * - `deleteCell(notebookId, cellId)` - Delete cell
86
- *
87
- * @example
88
- * ```typescript
89
- * // Initialize SDK
90
- * const sdk = new DatalayerSDK({
91
- * token: 'your-token',
92
- * baseUrl: 'https://prod1.datalayer.run'
93
- * });
94
- *
95
- * // Authentication
96
- * const user = await sdk.whoami();
97
- * console.log('Logged in as:', user.email);
98
- *
99
- * // Create workspace and notebook
100
- * const space = await sdk.createSpace({
101
- * name: 'My Project'
102
- * });
103
- *
104
- * const notebook = await sdk.createNotebook({
105
- * space_id: space.id,
106
- * name: 'Analysis'
107
- * });
108
- *
109
- * // Create and start runtime
110
- * const runtime = await sdk.createRuntime({
111
- * environment_name: 'python-cpu-env',
112
- * credits_limit: 100
113
- * });
114
- *
115
- * console.log('Setup complete!');
116
- * ```
117
- */
118
- export class DatalayerSDK extends DatalayerSDKWithMixins {
119
- /**
120
- * Create a DatalayerSDK instance.
121
- *
122
- * @param config - SDK configuration options
123
- */
124
- constructor(config) {
125
- super(config);
126
- }
127
- }
128
- export { DatalayerSDKBase };
@@ -1,100 +0,0 @@
1
- import type { DatalayerSDKBase } from '../base';
2
- /**
3
- * Interface for health check methods.
4
- */
5
- export interface HealthMixinInterface {
6
- /** Check if IAM service is healthy */
7
- isIAMHealthy(): Promise<boolean>;
8
- /** Check if Runtimes service is healthy */
9
- isRuntimesHealthy(): Promise<boolean>;
10
- /** Check if Spacer service is healthy */
11
- isSpacerHealthy(): Promise<boolean>;
12
- /** Check if all services are healthy */
13
- areAllServicesHealthy(): Promise<boolean>;
14
- /** Get detailed health status for all services */
15
- getHealthStatus(): Promise<{
16
- iam: {
17
- healthy: boolean;
18
- details?: any;
19
- error?: string;
20
- };
21
- runtimes: {
22
- healthy: boolean;
23
- details?: any;
24
- error?: string;
25
- };
26
- spacer: {
27
- healthy: boolean;
28
- details?: any;
29
- error?: string;
30
- };
31
- }>;
32
- }
33
- /**
34
- * Mixin that provides health check functionality for the SDK.
35
- */
36
- export declare function HealthMixin<T extends new (...args: any[]) => DatalayerSDKBase>(Base: T): {
37
- new (...args: any[]): {
38
- /**
39
- * Check if the IAM service is healthy.
40
- *
41
- * @returns True if service is healthy, false otherwise
42
- */
43
- isIAMHealthy(): Promise<boolean>;
44
- /**
45
- * Check if the Runtimes service is healthy.
46
- *
47
- * @returns True if service is healthy, false otherwise
48
- */
49
- isRuntimesHealthy(): Promise<boolean>;
50
- /**
51
- * Check if the Spacer service is healthy.
52
- *
53
- * @returns True if service is healthy, false otherwise
54
- */
55
- isSpacerHealthy(): Promise<boolean>;
56
- /**
57
- * Check if all Datalayer services are healthy.
58
- *
59
- * @returns True if all services are healthy, false otherwise
60
- */
61
- areAllServicesHealthy(): Promise<boolean>;
62
- /**
63
- * Get detailed health status for all services.
64
- *
65
- * @returns Object containing health status and details for each service
66
- */
67
- getHealthStatus(): Promise<{
68
- iam: {
69
- healthy: boolean;
70
- details?: any;
71
- error?: string;
72
- version?: string;
73
- };
74
- runtimes: {
75
- healthy: boolean;
76
- details?: any;
77
- error?: string;
78
- version?: string;
79
- };
80
- spacer: {
81
- healthy: boolean;
82
- details?: any;
83
- error?: string;
84
- version?: string;
85
- };
86
- allHealthy: boolean;
87
- }>;
88
- readonly iamRunUrl: string;
89
- readonly runtimesRunUrl: string;
90
- readonly spacerRunUrl: string;
91
- token?: string;
92
- updateToken(token: string): void;
93
- getConfig(): import("..").DatalayerSDKConfig;
94
- updateConfig(config: Partial<import("..").DatalayerSDKConfig>): void;
95
- getIamRunUrl(): string;
96
- getRuntimesRunUrl(): string;
97
- getSpacerRunUrl(): string;
98
- getToken(): string | undefined;
99
- };
100
- } & T;