@datalayer/core 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/lib/App.js +2 -2
  2. package/lib/api/DatalayerApi.js +6 -1
  3. package/lib/api/constants.d.ts +1 -1
  4. package/lib/api/constants.js +1 -1
  5. package/lib/api/iam/authentication.js +3 -3
  6. package/lib/api/iam/datasources.js +3 -3
  7. package/lib/api/iam/healthz.js +2 -2
  8. package/lib/api/iam/index.js +12 -12
  9. package/lib/api/iam/oauth2.js +2 -2
  10. package/lib/api/iam/profile.js +3 -3
  11. package/lib/api/iam/secrets.js +3 -3
  12. package/lib/api/iam/usage.js +2 -2
  13. package/lib/api/index.js +8 -8
  14. package/lib/api/otel/index.js +5 -5
  15. package/lib/api/otel/logs.js +3 -3
  16. package/lib/api/otel/metrics.js +3 -3
  17. package/lib/api/otel/query.js +3 -3
  18. package/lib/api/otel/services.js +3 -3
  19. package/lib/api/otel/traces.js +3 -3
  20. package/lib/api/runtimes/checkpoints.js +3 -3
  21. package/lib/api/runtimes/environments.js +3 -3
  22. package/lib/api/runtimes/healthz.js +2 -2
  23. package/lib/api/runtimes/index.js +5 -5
  24. package/lib/api/runtimes/runtimes.js +3 -3
  25. package/lib/api/runtimes/snapshots.js +3 -3
  26. package/lib/api/spacer/documents.js +2 -2
  27. package/lib/api/spacer/healthz.js +2 -2
  28. package/lib/api/spacer/index.js +7 -7
  29. package/lib/api/spacer/items.js +2 -2
  30. package/lib/api/spacer/lexicals.d.ts +8 -0
  31. package/lib/api/spacer/lexicals.js +16 -2
  32. package/lib/api/spacer/notebooks.d.ts +8 -0
  33. package/lib/api/spacer/notebooks.js +16 -2
  34. package/lib/api/spacer/spaces.d.ts +76 -1
  35. package/lib/api/spacer/spaces.js +143 -3
  36. package/lib/api/spacer/users.js +3 -3
  37. package/lib/client/auth/AuthenticationManager.js +3 -3
  38. package/lib/client/auth/index.js +4 -4
  39. package/lib/client/auth/storage.d.ts +3 -1
  40. package/lib/client/auth/storage.js +35 -14
  41. package/lib/client/auth/strategies.js +3 -3
  42. package/lib/client/base.js +2 -2
  43. package/lib/client/index.d.ts +22 -2
  44. package/lib/client/index.js +21 -20
  45. package/lib/client/mixins/IAMMixin.js +10 -10
  46. package/lib/client/mixins/RuntimesMixin.js +7 -7
  47. package/lib/client/mixins/SpacerMixin.d.ts +99 -0
  48. package/lib/client/mixins/SpacerMixin.js +265 -11
  49. package/lib/client/utils/slugify.d.ts +8 -0
  50. package/lib/client/utils/slugify.js +18 -0
  51. package/lib/client/utils/spacerUtils.js +3 -3
  52. package/lib/collaboration/DatalayerCollaborationProvider.js +1 -1
  53. package/lib/collaboration/index.js +2 -2
  54. package/lib/components/auth/Login.js +6 -6
  55. package/lib/components/auth/Login.stories.js +2 -2
  56. package/lib/components/auth/LoginToken.js +2 -2
  57. package/lib/components/auth/index.js +3 -3
  58. package/lib/components/avatars/BoringAvatar.stories.js +1 -1
  59. package/lib/components/avatars/UserProfileAvatar.js +2 -2
  60. package/lib/components/avatars/index.js +2 -2
  61. package/lib/components/banners/NoAutomationBanner.js +1 -1
  62. package/lib/components/banners/index.js +1 -1
  63. package/lib/components/buttons/DownloadCSVButton.js +1 -1
  64. package/lib/components/buttons/DownloadJsonButton.js +1 -1
  65. package/lib/components/buttons/index.js +5 -5
  66. package/lib/components/checkout/StripeCheckout.js +1 -1
  67. package/lib/components/checkout/index.js +1 -1
  68. package/lib/components/confetti/index.js +1 -1
  69. package/lib/components/context/OrganizationSelect.js +2 -2
  70. package/lib/components/context/SpaceSelect.js +2 -2
  71. package/lib/components/context/index.js +2 -2
  72. package/lib/components/display/DatalayerBox.js +1 -1
  73. package/lib/components/display/LiveRelativeTime.js +1 -1
  74. package/lib/components/display/NavLink.js +1 -1
  75. package/lib/components/display/index.js +14 -14
  76. package/lib/components/echarts/index.js +1 -1
  77. package/lib/components/flashes/FlashDisclaimer.js +2 -2
  78. package/lib/components/flashes/FlashGuest.js +4 -4
  79. package/lib/components/flashes/FlashSurveys.js +4 -4
  80. package/lib/components/flashes/FlashUnauthorized.js +1 -1
  81. package/lib/components/flashes/index.js +6 -6
  82. package/lib/components/flashes/surveys/index.js +2 -2
  83. package/lib/components/iam/ExternalTokenSilentLogin.js +3 -3
  84. package/lib/components/iam/index.js +1 -1
  85. package/lib/components/icons/index.js +1 -1
  86. package/lib/components/index.js +2 -2
  87. package/lib/components/labels/index.js +1 -1
  88. package/lib/components/landings/index.js +1 -1
  89. package/lib/components/navbar/NavigationVisbilityObserver.js +4 -4
  90. package/lib/components/navbar/SubdomainNavBar.js +5 -5
  91. package/lib/components/navbar/index.js +2 -2
  92. package/lib/components/nbgrader/index.js +1 -1
  93. package/lib/components/notebooks/index.js +2 -2
  94. package/lib/components/progress/ConsumptionBar.js +1 -1
  95. package/lib/components/progress/CreditsIndicator.js +2 -2
  96. package/lib/components/progress/index.js +6 -6
  97. package/lib/components/runtimes/RuntimeCellVariablesDialog.js +2 -2
  98. package/lib/components/runtimes/RuntimeLauncherDialog.js +9 -9
  99. package/lib/components/runtimes/RuntimePickerBase.js +3 -3
  100. package/lib/components/runtimes/RuntimePickerCell.js +8 -8
  101. package/lib/components/runtimes/RuntimePickerNotebook.js +6 -6
  102. package/lib/components/runtimes/RuntimeSimplePicker.js +3 -3
  103. package/lib/components/runtimes/index.js +11 -11
  104. package/lib/components/screencapture/ScreencaptureButton.js +3 -3
  105. package/lib/components/screencapture/index.js +2 -2
  106. package/lib/components/snapshots/RuntimeSnapshotMenu.js +4 -4
  107. package/lib/components/snapshots/index.js +1 -1
  108. package/lib/components/snippets/SnippetDialog.js +1 -1
  109. package/lib/components/snippets/index.js +1 -1
  110. package/lib/components/sparklines/Sparklines.js +5 -1
  111. package/lib/components/sparklines/dataProcessing.d.ts +2 -4
  112. package/lib/components/sparklines/dataProcessing.js +1 -1
  113. package/lib/components/sparklines/index.d.ts +1 -0
  114. package/lib/components/sparklines/index.js +7 -3
  115. package/lib/components/sparklines/types.js +1 -1
  116. package/lib/components/storage/ContentsBrowser.js +3 -3
  117. package/lib/components/storage/index.js +2 -2
  118. package/lib/components/students/index.js +1 -1
  119. package/lib/components/subnav/SubNav.js +2 -2
  120. package/lib/components/subnav/index.js +1 -1
  121. package/lib/components/tables/index.js +1 -1
  122. package/lib/components/text-reveal/TextRevealAnimation.js +1 -1
  123. package/lib/components/text-reveal/index.js +1 -1
  124. package/lib/components/tokens/index.js +1 -1
  125. package/lib/components/toolbars/AssignmentEditorToolbar.js +1 -1
  126. package/lib/components/toolbars/DocumentEditorToolbar.js +1 -1
  127. package/lib/components/toolbars/index.js +3 -3
  128. package/lib/components/users/PeerIndicator.js +1 -1
  129. package/lib/components/users/index.js +1 -1
  130. package/lib/config/Configuration.d.ts +1 -1
  131. package/lib/config/Configuration.js +2 -2
  132. package/lib/config/index.js +2 -2
  133. package/lib/config/integrations/index.js +1 -1
  134. package/lib/hooks/assets/index.js +1 -1
  135. package/lib/hooks/index.js +33 -33
  136. package/lib/hooks/layouts/LayoutBackdrop.js +2 -2
  137. package/lib/hooks/layouts/LayoutScreencapture.js +3 -3
  138. package/lib/hooks/layouts/index.js +2 -2
  139. package/lib/hooks/useAuthorization.js +3 -3
  140. package/lib/hooks/useBackdrop.js +2 -2
  141. package/lib/hooks/useCache.js +9 -9
  142. package/lib/hooks/useCellOutputshot.js +2 -2
  143. package/lib/hooks/useDatalayer.js +6 -6
  144. package/lib/hooks/useIAM.js +4 -4
  145. package/lib/hooks/useLocation.js +2 -2
  146. package/lib/hooks/useLocationHandles.js +3 -3
  147. package/lib/hooks/useNavigate.js +4 -4
  148. package/lib/hooks/useParams.js +2 -2
  149. package/lib/hooks/useProjects.d.ts +2 -8
  150. package/lib/hooks/useProjects.js +2 -2
  151. package/lib/hooks/useRuntimes.js +1 -1
  152. package/lib/hooks/useScreencapture.js +1 -1
  153. package/lib/hooks/useToast.js +41 -5
  154. package/lib/hooks/useUpload.js +2 -2
  155. package/lib/hooks/useUser.js +1 -1
  156. package/lib/i18n/index.js +1 -1
  157. package/lib/index.d.ts +1 -1
  158. package/lib/index.js +17 -17
  159. package/lib/main.js +1 -1
  160. package/lib/mocks/components/FlashMock.js +1 -1
  161. package/lib/mocks/components/index.js +1 -1
  162. package/lib/mocks/hooks/index.js +1 -1
  163. package/lib/mocks/hooks/rests/index.js +1 -1
  164. package/lib/mocks/hooks/useDatalayerMock.js +5 -5
  165. package/lib/mocks/index.js +5 -5
  166. package/lib/mocks/models/CourseMock.js +3 -3
  167. package/lib/mocks/models/InviteMock.js +2 -2
  168. package/lib/mocks/models/OrganisationMock.js +1 -1
  169. package/lib/mocks/models/SchoolMock.js +1 -1
  170. package/lib/mocks/models/SpaceMock.js +2 -2
  171. package/lib/mocks/models/TeamMock.js +1 -1
  172. package/lib/mocks/models/UserMock.js +1 -1
  173. package/lib/mocks/models/index.js +9 -9
  174. package/lib/mocks/views/ChartMock.js +3 -3
  175. package/lib/mocks/views/DashboardMock.js +2 -2
  176. package/lib/mocks/views/TableMock.js +1 -1
  177. package/lib/mocks/views/index.js +7 -7
  178. package/lib/models/Contact.js +3 -3
  179. package/lib/models/CreditsDTO.js +1 -1
  180. package/lib/models/Datasource.js +1 -1
  181. package/lib/models/EnvironmentDTO.d.ts +1 -1
  182. package/lib/models/EnvironmentDTO.js +2 -2
  183. package/lib/models/HealthCheck.js +1 -1
  184. package/lib/models/IAMProviderUsers.js +1 -1
  185. package/lib/models/Invite.js +1 -1
  186. package/lib/models/ItemDTO.js +1 -1
  187. package/lib/models/LexicalDTO.js +4 -4
  188. package/lib/models/NotebookDTO.js +4 -4
  189. package/lib/models/Organization.js +2 -2
  190. package/lib/models/Page.js +2 -2
  191. package/lib/models/ProjectDTO.d.ts +89 -0
  192. package/lib/models/ProjectDTO.js +131 -0
  193. package/lib/models/RuntimeDTO.js +2 -2
  194. package/lib/models/RuntimeSnapshotDTO.js +2 -2
  195. package/lib/models/Secret.js +1 -1
  196. package/lib/models/Space.d.ts +1 -1
  197. package/lib/models/Space.js +3 -3
  198. package/lib/models/SpaceDTO.d.ts +61 -0
  199. package/lib/models/SpaceDTO.js +9 -9
  200. package/lib/models/Team.js +2 -2
  201. package/lib/models/User.js +5 -5
  202. package/lib/models/UserDTO.js +1 -1
  203. package/lib/models/index.js +75 -75
  204. package/lib/navigation/components.js +1 -1
  205. package/lib/navigation/index.js +4 -4
  206. package/lib/otel/client/OtelClient.js +1 -1
  207. package/lib/otel/client/index.js +1 -1
  208. package/lib/otel/hooks/index.js +1 -1
  209. package/lib/otel/index.js +15 -15
  210. package/lib/otel/types.d.ts +1 -1
  211. package/lib/otel/views/OtelLive.js +11 -11
  212. package/lib/otel/views/OtelLogsList.js +1 -1
  213. package/lib/otel/views/OtelMetricsList.d.ts +2 -5
  214. package/lib/otel/views/OtelMetricsList.js +2 -2
  215. package/lib/otel/views/OtelSpanDetail.js +2 -2
  216. package/lib/otel/views/OtelSpanTree.js +1 -1
  217. package/lib/otel/views/OtelSqlView.js +1 -1
  218. package/lib/otel/views/OtelSystemView.js +1 -1
  219. package/lib/otel/views/OtelTimeline.js +1 -1
  220. package/lib/otel/views/OtelTracesList.js +1 -1
  221. package/lib/otel/views/index.d.ts +1 -0
  222. package/lib/otel/views/index.js +12 -12
  223. package/lib/routes/index.js +1 -1
  224. package/lib/services/DatalayerServiceManager.d.ts +1 -1
  225. package/lib/services/DatalayerServiceManager.js +4 -4
  226. package/lib/services/index.js +3 -3
  227. package/lib/state/State.js +13 -13
  228. package/lib/state/index.js +3 -3
  229. package/lib/state/storage/IAMStorage.js +31 -6
  230. package/lib/state/storage/index.js +1 -1
  231. package/lib/state/substates/CoreState.js +2 -2
  232. package/lib/state/substates/IAMState.js +5 -5
  233. package/lib/state/substates/RuntimesState.js +3 -3
  234. package/lib/state/substates/SurveysState.js +4 -4
  235. package/lib/state/substates/TeamState.js +1 -1
  236. package/lib/state/substates/index.js +14 -14
  237. package/lib/stateful/index.js +2 -2
  238. package/lib/stateful/jupyter/exec/Snippets.js +1 -1
  239. package/lib/stateful/jupyter/exec/index.js +2 -2
  240. package/lib/stateful/jupyter/index.js +2 -2
  241. package/lib/stateful/runtimes/actions.js +4 -4
  242. package/lib/stateful/runtimes/index.js +5 -5
  243. package/lib/stateful/runtimes/snapshots.js +1 -1
  244. package/lib/utils/Date.d.ts +11 -0
  245. package/lib/utils/Date.js +30 -0
  246. package/lib/utils/cli/index.js +1 -1
  247. package/lib/utils/index.js +29 -29
  248. package/lib/views/datasources/DatasourceDetail.js +3 -3
  249. package/lib/views/datasources/DatasourceNew.js +2 -2
  250. package/lib/views/datasources/Datasources.js +1 -1
  251. package/lib/views/datasources/index.js +3 -3
  252. package/lib/views/iam/SignInSimple.js +1 -1
  253. package/lib/views/iam/index.js +1 -1
  254. package/lib/views/iam-tokens/IAMTokenEdit.js +3 -3
  255. package/lib/views/iam-tokens/IAMTokenNew.js +2 -2
  256. package/lib/views/iam-tokens/IAMTokens.js +1 -1
  257. package/lib/views/iam-tokens/Tokens.js +1 -1
  258. package/lib/views/iam-tokens/index.js +3 -3
  259. package/lib/views/index.js +3 -3
  260. package/lib/views/otel/DashboardView.js +1 -1
  261. package/lib/views/otel/LogsView.js +1 -1
  262. package/lib/views/otel/MetricsView.js +1 -1
  263. package/lib/views/otel/OtelHeader.js +1 -1
  264. package/lib/views/otel/SqlView.js +1 -1
  265. package/lib/views/otel/SystemView.js +1 -1
  266. package/lib/views/otel/TracesView.js +1 -1
  267. package/lib/views/otel/index.js +8 -8
  268. package/lib/views/otel/simpleAuthStore.js +1 -1
  269. package/lib/views/profile/UserBadge.js +1 -1
  270. package/lib/views/profile/index.js +1 -1
  271. package/lib/views/secrets/SecretEdit.js +3 -3
  272. package/lib/views/secrets/SecretNew.js +2 -2
  273. package/lib/views/secrets/Secrets.js +1 -1
  274. package/lib/views/secrets/index.js +3 -3
  275. package/package.json +1 -1
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @module api/spacer/spaces
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
- import { validateToken } from '../utils/validation';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
+ import { validateToken } from '../utils/validation.js';
15
15
  /**
16
16
  * Create a new workspace space.
17
17
  * @param token - Authentication token
@@ -28,3 +28,143 @@ export const createSpace = async (token, data, baseUrl = DEFAULT_SERVICE_URLS.SP
28
28
  body: data,
29
29
  });
30
30
  };
31
+ /**
32
+ * Get a space by UID.
33
+ * @param token - Authentication token
34
+ * @param uid - Space UID
35
+ * @param baseUrl - Base URL for the API
36
+ * @returns Promise resolving to the space response
37
+ */
38
+ export const getSpace = async (token, uid, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
39
+ validateToken(token);
40
+ return requestDatalayerAPI({
41
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/${uid}`,
42
+ method: 'GET',
43
+ token,
44
+ });
45
+ };
46
+ /**
47
+ * Update a space (owner updating their own space).
48
+ * @param token - Authentication token
49
+ * @param uid - Space UID
50
+ * @param data - Update data (supports arbitrary Solr fields)
51
+ * @param baseUrl - Base URL for the API
52
+ * @returns Promise resolving to the updated space response
53
+ */
54
+ export const updateSpace = async (token, uid, data, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
55
+ validateToken(token);
56
+ return requestDatalayerAPI({
57
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/${uid}`,
58
+ method: 'PUT',
59
+ token,
60
+ body: data,
61
+ });
62
+ };
63
+ /**
64
+ * Update a user-specific space (e.g., org admin managing another user's space).
65
+ * @param token - Authentication token
66
+ * @param uid - Space UID
67
+ * @param userId - User ID
68
+ * @param data - Update data (supports arbitrary Solr fields)
69
+ * @param baseUrl - Base URL for the API
70
+ * @returns Promise resolving to the updated space response
71
+ */
72
+ export const updateUserSpace = async (token, uid, userId, data, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
73
+ validateToken(token);
74
+ return requestDatalayerAPI({
75
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/${uid}/users/${userId}`,
76
+ method: 'PUT',
77
+ token,
78
+ body: data,
79
+ });
80
+ };
81
+ /**
82
+ * Delete a space and all its contents.
83
+ * @param token - Authentication token
84
+ * @param uid - Space UID
85
+ * @param baseUrl - Base URL for the API
86
+ * @returns Promise resolving to the delete response
87
+ */
88
+ export const deleteSpace = async (token, uid, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
89
+ validateToken(token);
90
+ return requestDatalayerAPI({
91
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/${uid}`,
92
+ method: 'DELETE',
93
+ token,
94
+ });
95
+ };
96
+ /**
97
+ * Get default items (notebook UID and document UID) for a space.
98
+ * @param token - Authentication token
99
+ * @param uid - Space UID
100
+ * @param baseUrl - Base URL for the API
101
+ * @returns Promise resolving to the default items response
102
+ */
103
+ export const getSpaceDefaultItems = async (token, uid, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
104
+ validateToken(token);
105
+ return requestDatalayerAPI({
106
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/${uid}/default-items`,
107
+ method: 'GET',
108
+ token,
109
+ });
110
+ };
111
+ /**
112
+ * Get spaces by type (e.g., 'project', 'workspace', 'course').
113
+ * @param token - Authentication token
114
+ * @param type - Space type to filter by
115
+ * @param baseUrl - Base URL for the API
116
+ * @returns Promise resolving to the spaces response
117
+ */
118
+ export const getSpacesByType = async (token, type, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
119
+ validateToken(token);
120
+ return requestDatalayerAPI({
121
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/types/${type}`,
122
+ method: 'GET',
123
+ token,
124
+ });
125
+ };
126
+ /**
127
+ * Make a space public.
128
+ * @param token - Authentication token
129
+ * @param uid - Space UID
130
+ * @param baseUrl - Base URL for the API
131
+ * @returns Promise resolving to the updated space response
132
+ */
133
+ export const makeSpacePublic = async (token, uid, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
134
+ validateToken(token);
135
+ return requestDatalayerAPI({
136
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/${uid}/public`,
137
+ method: 'PUT',
138
+ token,
139
+ });
140
+ };
141
+ /**
142
+ * Make a space private.
143
+ * @param token - Authentication token
144
+ * @param uid - Space UID
145
+ * @param baseUrl - Base URL for the API
146
+ * @returns Promise resolving to the updated space response
147
+ */
148
+ export const makeSpacePrivate = async (token, uid, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
149
+ validateToken(token);
150
+ return requestDatalayerAPI({
151
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/${uid}/private`,
152
+ method: 'PUT',
153
+ token,
154
+ });
155
+ };
156
+ /**
157
+ * Export a space and its contents.
158
+ * @param token - Authentication token
159
+ * @param uid - Space UID
160
+ * @param baseUrl - Base URL for the API
161
+ * @returns Promise resolving to the export data
162
+ */
163
+ export const exportSpace = async (token, uid, baseUrl = DEFAULT_SERVICE_URLS.SPACER) => {
164
+ validateToken(token);
165
+ return requestDatalayerAPI({
166
+ url: `${baseUrl}${API_BASE_PATHS.SPACER}/spaces/${uid}/export`,
167
+ method: 'GET',
168
+ token,
169
+ });
170
+ };
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @module api/spacer/users
11
11
  */
12
- import { requestDatalayerAPI } from '../DatalayerApi';
13
- import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
- import { validateToken } from '../utils/validation';
12
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
14
+ import { validateToken } from '../utils/validation.js';
15
15
  /**
16
16
  * Get all spaces for the current authenticated user.
17
17
  * @param token - Authentication token
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * Core authentication manager for the Datalayer Client
7
7
  */
8
- import * as authentication from '../../api/iam/authentication';
9
- import { TokenAuthStrategy, CredentialsAuthStrategy, StorageAuthStrategy, BrowserOAuthStrategy, } from './strategies';
10
- import { NodeStorage, BrowserStorage } from './storage';
8
+ import * as authentication from '../../api/iam/authentication.js';
9
+ import { TokenAuthStrategy, CredentialsAuthStrategy, StorageAuthStrategy, BrowserOAuthStrategy, } from './strategies.js';
10
+ import { NodeStorage, BrowserStorage } from './storage.js';
11
11
  /**
12
12
  * Authentication Manager for Datalayer Client
13
13
  * Provides a unified interface for all authentication methods
@@ -11,7 +11,7 @@
11
11
  * Authentication module for Datalayer Client
12
12
  * Provides unified authentication interface with multiple strategies
13
13
  */
14
- export * from './types';
15
- export * from './storage';
16
- export * from './strategies';
17
- export * from './AuthenticationManager';
14
+ export * from './types.js';
15
+ export * from './storage.js';
16
+ export * from './strategies.js';
17
+ export * from './AuthenticationManager.js';
@@ -4,6 +4,7 @@ import { UserDTO } from '../../models/UserDTO';
4
4
  * Browser localStorage-based token storage
5
5
  */
6
6
  export declare class BrowserStorage implements TokenStorage {
7
+ private _available;
7
8
  /**
8
9
  * Get token from browser localStorage
9
10
  */
@@ -17,7 +18,8 @@ export declare class BrowserStorage implements TokenStorage {
17
18
  */
18
19
  delete(key: string): void;
19
20
  /**
20
- * Check if browser localStorage is available
21
+ * Check if browser localStorage is available and functional.
22
+ * Result is cached after the first probe to avoid repeated writes.
21
23
  */
22
24
  isAvailable(): boolean;
23
25
  /**
@@ -10,16 +10,17 @@
10
10
  /**
11
11
  * Token storage backend implementations
12
12
  */
13
- import { DATALAYER_IAM_TOKEN_KEY, DATALAYER_IAM_USER_KEY, } from '../../state/storage/IAMStorage';
13
+ import { DATALAYER_IAM_TOKEN_KEY, DATALAYER_IAM_USER_KEY, } from '../../state/storage/IAMStorage.js';
14
14
  /**
15
15
  * Browser localStorage-based token storage
16
16
  */
17
17
  export class BrowserStorage {
18
+ _available;
18
19
  /**
19
20
  * Get token from browser localStorage
20
21
  */
21
22
  get(key) {
22
- if (typeof window === 'undefined') {
23
+ if (!this.isAvailable()) {
23
24
  return null;
24
25
  }
25
26
  return window.localStorage.getItem(key);
@@ -28,7 +29,7 @@ export class BrowserStorage {
28
29
  * Set token in browser localStorage
29
30
  */
30
31
  set(key, value) {
31
- if (typeof window === 'undefined') {
32
+ if (!this.isAvailable()) {
32
33
  return;
33
34
  }
34
35
  window.localStorage.setItem(key, value);
@@ -37,16 +38,34 @@ export class BrowserStorage {
37
38
  * Delete token from browser localStorage
38
39
  */
39
40
  delete(key) {
40
- if (typeof window === 'undefined') {
41
+ if (!this.isAvailable()) {
41
42
  return;
42
43
  }
43
44
  window.localStorage.removeItem(key);
44
45
  }
45
46
  /**
46
- * Check if browser localStorage is available
47
+ * Check if browser localStorage is available and functional.
48
+ * Result is cached after the first probe to avoid repeated writes.
47
49
  */
48
50
  isAvailable() {
49
- return typeof window !== 'undefined' && !!window.localStorage;
51
+ if (this._available !== undefined) {
52
+ return this._available;
53
+ }
54
+ try {
55
+ if (typeof window === 'undefined' || !window.localStorage) {
56
+ this._available = false;
57
+ return false;
58
+ }
59
+ const testKey = '__datalayer_storage_test__';
60
+ window.localStorage.setItem(testKey, 'test');
61
+ window.localStorage.removeItem(testKey);
62
+ this._available = true;
63
+ return true;
64
+ }
65
+ catch {
66
+ this._available = false;
67
+ return false;
68
+ }
50
69
  }
51
70
  /**
52
71
  * Get stored authentication token
@@ -395,16 +414,18 @@ export class ElectronStorage {
395
414
  */
396
415
  export function getDefaultStorage() {
397
416
  if (typeof window !== 'undefined') {
398
- // Browser environment
399
- return new BrowserStorage();
417
+ const browserStorage = new BrowserStorage();
418
+ if (browserStorage.isAvailable()) {
419
+ return browserStorage;
420
+ }
421
+ // window exists but localStorage is not functional (e.g., Node 22 with --localstorage-file)
422
+ // Fall through to Node.js storage
400
423
  }
401
- else if (typeof process !== 'undefined') {
424
+ if (typeof process !== 'undefined') {
402
425
  // Node.js environment
403
426
  return new NodeStorage();
404
427
  }
405
- else {
406
- // Unknown environment, use in-memory storage
407
- console.warn('Unknown environment, using in-memory storage (data will not persist)');
408
- return new NodeStorage(); // NodeStorage has in-memory fallback
409
- }
428
+ // Unknown environment, use in-memory storage
429
+ console.warn('Unknown environment, using in-memory storage (data will not persist)');
430
+ return new NodeStorage(); // NodeStorage has in-memory fallback
410
431
  }
@@ -10,9 +10,9 @@
10
10
  /**
11
11
  * Authentication strategy implementations
12
12
  */
13
- import * as authentication from '../../api/iam/authentication';
14
- import * as profile from '../../api/iam/profile';
15
- import { UserDTO } from '../../models/UserDTO';
13
+ import * as authentication from '../../api/iam/authentication.js';
14
+ import * as profile from '../../api/iam/profile.js';
15
+ import { UserDTO } from '../../models/UserDTO.js';
16
16
  /**
17
17
  * Base authentication strategy with common functionality
18
18
  */
@@ -6,8 +6,8 @@
6
6
  * Base Client class providing core configuration and token management.
7
7
  * @module client/base
8
8
  */
9
- import { DEFAULT_SERVICE_URLS } from '../api/constants';
10
- import { AuthenticationManager } from './auth';
9
+ import { DEFAULT_SERVICE_URLS } from '../api/constants.js';
10
+ import { AuthenticationManager } from './auth/index.js';
11
11
  /** Base Client class providing core configuration and token management. */
12
12
  export class DatalayerClientBase {
13
13
  /** URL for IAM service */
@@ -26,6 +26,9 @@ import type { LexicalDTO } from '../models/LexicalDTO';
26
26
  import type { HealthCheck } from '../models/HealthCheck';
27
27
  import type { SecretDTO } from '../models/Secret';
28
28
  import type { CreateSecretRequest, UpdateSecretRequest } from '../models/Secret';
29
+ import type { ProjectDTO } from '../models/ProjectDTO';
30
+ import type { ProjectDefaultItems } from '../models/ProjectDTO';
31
+ import type { UpdateSpaceRequest } from '../models/SpaceDTO';
29
32
  import type { DatasourceDTO } from '../models/Datasource';
30
33
  import type { CreateDatasourceRequest, UpdateDatasourceRequest } from '../models/Datasource';
31
34
  declare const DatalayerClientWithMixins: typeof DatalayerClientBase;
@@ -41,7 +44,7 @@ declare const DatalayerClientWithMixins: typeof DatalayerClientBase;
41
44
  *
42
45
  * const user = await client.whoami();
43
46
  * const runtime = await client.createRuntime({
44
- * environment_name: 'python-cpu-env',
47
+ * environment_name: 'ai-agents-env',
45
48
  * credits_limit: 100
46
49
  * });
47
50
  * ```
@@ -65,7 +68,9 @@ export type { EnvironmentJSON, EnvironmentData, ListEnvironmentsResponse, } from
65
68
  export { RuntimeSnapshotDTO as Snapshot } from '../models/RuntimeSnapshotDTO';
66
69
  export type { RuntimeSnapshotJSON, RuntimeSnapshotData, CreateRuntimeSnapshotRequest, CreateRuntimeSnapshotResponse, GetRuntimeSnapshotResponse, ListRuntimeSnapshotsResponse, } from '../models/RuntimeSnapshotDTO';
67
70
  export { SpaceDTO as Space } from '../models/SpaceDTO';
68
- export type { SpaceJSON, SpaceData, SpaceItem, CreateSpaceRequest, CreateSpaceResponse, SpacesForUserResponse, CollaborationSessionResponse, DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse, CreateNotebookRequest, CreateNotebookResponse, GetNotebookResponse, UpdateNotebookRequest, UpdateNotebookResponse, } from '../models/SpaceDTO';
71
+ export type { SpaceJSON, SpaceData, SpaceItem, CreateSpaceRequest, CreateSpaceResponse, SpacesForUserResponse, CollaborationSessionResponse, DeleteSpaceItemResponse, GetSpaceItemResponse, GetSpaceItemsResponse, CreateNotebookRequest, CreateNotebookResponse, GetNotebookResponse, UpdateNotebookRequest, UpdateNotebookResponse, UpdateSpaceRequest, GetSpaceResponse, UpdateSpaceResponse, DeleteSpaceResponse, GetSpaceDefaultItemsResponse, GetSpacesByTypeResponse, } from '../models/SpaceDTO';
72
+ export { ProjectDTO as Project } from '../models/ProjectDTO';
73
+ export type { ProjectJSON, ProjectDefaultItems } from '../models/ProjectDTO';
69
74
  export { NotebookDTO as Notebook } from '../models/NotebookDTO';
70
75
  export type { NotebookJSON, NotebookData } from '../models/NotebookDTO';
71
76
  export { LexicalDTO } from '../models/LexicalDTO';
@@ -184,5 +189,20 @@ export interface DatalayerClient {
184
189
  getCollaborationSessionId(documentId: string): Promise<string>;
185
190
  getContent(itemId: string): Promise<any>;
186
191
  checkSpacerHealth(): Promise<HealthCheck>;
192
+ getSpace(uid: string): Promise<SpaceDTO>;
193
+ updateSpace(uid: string, data: UpdateSpaceRequest): Promise<SpaceDTO>;
194
+ updateUserSpace(uid: string, userId: string, data: UpdateSpaceRequest): Promise<SpaceDTO>;
195
+ deleteSpace(uid: string): Promise<void>;
196
+ makeSpacePublic(uid: string): Promise<SpaceDTO>;
197
+ makeSpacePrivate(uid: string): Promise<SpaceDTO>;
198
+ exportSpace(uid: string): Promise<any>;
199
+ cloneNotebook(id: string): Promise<NotebookDTO>;
200
+ cloneLexical(id: string): Promise<LexicalDTO>;
201
+ getProjects(): Promise<ProjectDTO[]>;
202
+ getProject(uid: string): Promise<ProjectDTO>;
203
+ createProject(name: string, description?: string): Promise<ProjectDTO>;
204
+ updateProject(uid: string, data: UpdateSpaceRequest): Promise<ProjectDTO>;
205
+ renameProject(uid: string, newName: string, description?: string): Promise<ProjectDTO>;
206
+ getProjectDefaultItems(uid: string): Promise<ProjectDefaultItems>;
187
207
  calculateCreditsFromMinutes(minutes: number, burningRate: number): number;
188
208
  }
@@ -18,10 +18,10 @@
18
18
  * const runtime = await client.createRuntime(config);
19
19
  * ```
20
20
  */
21
- import { DatalayerClientBase, } from './base';
22
- import { IAMMixin } from './mixins/IAMMixin';
23
- import { RuntimesMixin } from './mixins/RuntimesMixin';
24
- import { SpacerMixin } from './mixins/SpacerMixin';
21
+ import { DatalayerClientBase, } from './base.js';
22
+ import { IAMMixin } from './mixins/IAMMixin.js';
23
+ import { RuntimesMixin } from './mixins/RuntimesMixin.js';
24
+ import { SpacerMixin } from './mixins/SpacerMixin.js';
25
25
  /**
26
26
  * Helper function to compose mixins in a more readable way.
27
27
  * Applies mixins in the order provided.
@@ -46,7 +46,7 @@ const DatalayerClientWithMixins = composeMixins(IAMMixin, RuntimesMixin, SpacerM
46
46
  *
47
47
  * const user = await client.whoami();
48
48
  * const runtime = await client.createRuntime({
49
- * environment_name: 'python-cpu-env',
49
+ * environment_name: 'ai-agents-env',
50
50
  * credits_limit: 100
51
51
  * });
52
52
  * ```
@@ -65,21 +65,22 @@ export class DatalayerClient extends DatalayerClientWithMixins {
65
65
  }
66
66
  export { DatalayerClientBase };
67
67
  // Export models for use by consumers
68
- export { UserDTO as User } from './../models/UserDTO';
69
- export { RuntimeDTO as Runtime } from '../models/RuntimeDTO';
70
- export { EnvironmentDTO as Environment } from '../models/EnvironmentDTO';
71
- export { RuntimeSnapshotDTO as Snapshot } from '../models/RuntimeSnapshotDTO';
72
- export { SpaceDTO as Space } from '../models/SpaceDTO';
73
- export { NotebookDTO as Notebook } from '../models/NotebookDTO';
74
- export { LexicalDTO } from '../models/LexicalDTO';
75
- export { CreditsDTO as Credits } from '../models/CreditsDTO';
76
- export { ItemDTO as Item } from '../models/ItemDTO';
77
- export { HealthCheck } from '../models/HealthCheck';
78
- export { SecretDTO as Secret } from './../models/Secret';
79
- export { DatasourceDTO as Datasource } from './../models/Datasource';
68
+ export { UserDTO as User } from './../models/UserDTO.js';
69
+ export { RuntimeDTO as Runtime } from '../models/RuntimeDTO.js';
70
+ export { EnvironmentDTO as Environment } from '../models/EnvironmentDTO.js';
71
+ export { RuntimeSnapshotDTO as Snapshot } from '../models/RuntimeSnapshotDTO.js';
72
+ export { SpaceDTO as Space } from '../models/SpaceDTO.js';
73
+ export { ProjectDTO as Project } from '../models/ProjectDTO.js';
74
+ export { NotebookDTO as Notebook } from '../models/NotebookDTO.js';
75
+ export { LexicalDTO } from '../models/LexicalDTO.js';
76
+ export { CreditsDTO as Credits } from '../models/CreditsDTO.js';
77
+ export { ItemDTO as Item } from '../models/ItemDTO.js';
78
+ export { HealthCheck } from '../models/HealthCheck.js';
79
+ export { SecretDTO as Secret } from './../models/Secret.js';
80
+ export { DatasourceDTO as Datasource } from './../models/Datasource.js';
80
81
  // Export auth types
81
- export { AuthenticationManager } from './auth/AuthenticationManager';
82
+ export { AuthenticationManager } from './auth/AuthenticationManager.js';
82
83
  // Constants
83
- export { ItemTypes } from './constants';
84
+ export { ItemTypes } from './constants.js';
84
85
  // Export authentication module
85
- export * from './auth';
86
+ export * from './auth/index.js';
@@ -6,16 +6,16 @@
6
6
  * IAM mixin providing authentication and user management functionality.
7
7
  * @module client/mixins/IAMMixin
8
8
  */
9
- import * as authentication from '../../api/iam/authentication';
10
- import * as profile from '../../api/iam/profile';
11
- import * as usage from '../../api/iam/usage';
12
- import * as secrets from '../../api/iam/secrets';
13
- import * as datasources from '../../api/iam/datasources';
14
- import { UserDTO } from '../../models/UserDTO';
15
- import { CreditsDTO } from '../../models/CreditsDTO';
16
- import { HealthCheck } from '../../models/HealthCheck';
17
- import { SecretDTO } from '../../models/Secret';
18
- import { DatasourceDTO } from '../../models/Datasource';
9
+ import * as authentication from '../../api/iam/authentication.js';
10
+ import * as profile from '../../api/iam/profile.js';
11
+ import * as usage from '../../api/iam/usage.js';
12
+ import * as secrets from '../../api/iam/secrets.js';
13
+ import * as datasources from '../../api/iam/datasources.js';
14
+ import { UserDTO } from '../../models/UserDTO.js';
15
+ import { CreditsDTO } from '../../models/CreditsDTO.js';
16
+ import { HealthCheck } from '../../models/HealthCheck.js';
17
+ import { SecretDTO } from '../../models/Secret.js';
18
+ import { DatasourceDTO } from '../../models/Datasource.js';
19
19
  /** IAM mixin providing authentication and user management. */
20
20
  export function IAMMixin(Base) {
21
21
  return class extends Base {
@@ -6,13 +6,13 @@
6
6
  * Runtimes mixin for managing computational environments and runtime instances.
7
7
  * @module client/mixins/RuntimesMixin
8
8
  */
9
- import * as environments from '../../api/runtimes/environments';
10
- import * as runtimes from '../../api/runtimes/runtimes';
11
- import * as snapshots from '../../api/runtimes/snapshots';
12
- import { EnvironmentDTO } from '../../models/EnvironmentDTO';
13
- import { RuntimeDTO } from '../../models/RuntimeDTO';
14
- import { RuntimeSnapshotDTO } from '../../models/RuntimeSnapshotDTO';
15
- import { HealthCheck } from '../../models/HealthCheck';
9
+ import * as environments from '../../api/runtimes/environments.js';
10
+ import * as runtimes from '../../api/runtimes/runtimes.js';
11
+ import * as snapshots from '../../api/runtimes/snapshots.js';
12
+ import { EnvironmentDTO } from '../../models/EnvironmentDTO.js';
13
+ import { RuntimeDTO } from '../../models/RuntimeDTO.js';
14
+ import { RuntimeSnapshotDTO } from '../../models/RuntimeSnapshotDTO.js';
15
+ import { HealthCheck } from '../../models/HealthCheck.js';
16
16
  /** Runtimes mixin providing computational environment and runtime management. */
17
17
  export function RuntimesMixin(Base) {
18
18
  return class extends Base {
@@ -1,7 +1,9 @@
1
+ import type { UpdateSpaceRequest } from '../../models/SpaceDTO';
1
2
  import type { Constructor } from '../utils/mixins';
2
3
  import { NotebookDTO } from '../../models/NotebookDTO';
3
4
  import { LexicalDTO } from '../../models/LexicalDTO';
4
5
  import { SpaceDTO } from '../../models/SpaceDTO';
6
+ import { ProjectDTO, type ProjectDefaultItems } from '../../models/ProjectDTO';
5
7
  import { HealthCheck } from '../../models/HealthCheck';
6
8
  /** Options for content loading with CDN support. */
7
9
  export interface ContentLoadingOptions {
@@ -107,5 +109,102 @@ export declare function SpacerMixin<TBase extends Constructor>(Base: TBase): {
107
109
  * Get collaboration session ID for a document
108
110
  */
109
111
  getCollaborationSessionId(documentId: string): Promise<string>;
112
+ /**
113
+ * Get a space by UID.
114
+ * @param uid - Space UID
115
+ * @returns Space instance
116
+ */
117
+ getSpace(uid: string): Promise<SpaceDTO>;
118
+ /**
119
+ * Update a space (owner updating their own space).
120
+ * @param uid - Space UID
121
+ * @param data - Update data (supports arbitrary Solr fields)
122
+ * @returns Updated Space instance
123
+ */
124
+ updateSpace(uid: string, data: UpdateSpaceRequest): Promise<SpaceDTO>;
125
+ /**
126
+ * Update a user-specific space (e.g., org admin context).
127
+ * @param uid - Space UID
128
+ * @param userId - User ID
129
+ * @param data - Update data (supports arbitrary Solr fields)
130
+ * @returns Updated Space instance
131
+ */
132
+ updateUserSpace(uid: string, userId: string, data: UpdateSpaceRequest): Promise<SpaceDTO>;
133
+ /**
134
+ * Delete a space and all its contents.
135
+ * @param uid - Space UID
136
+ */
137
+ deleteSpace(uid: string): Promise<void>;
138
+ /**
139
+ * Make a space public.
140
+ * @param uid - Space UID
141
+ * @returns Updated Space instance
142
+ */
143
+ makeSpacePublic(uid: string): Promise<SpaceDTO>;
144
+ /**
145
+ * Make a space private.
146
+ * @param uid - Space UID
147
+ * @returns Updated Space instance
148
+ */
149
+ makeSpacePrivate(uid: string): Promise<SpaceDTO>;
150
+ /**
151
+ * Export a space and its contents.
152
+ * @param uid - Space UID
153
+ * @returns Export data
154
+ */
155
+ exportSpace(uid: string): Promise<any>;
156
+ /**
157
+ * Clone a notebook.
158
+ * @param id - Notebook ID to clone
159
+ * @returns Cloned Notebook instance
160
+ */
161
+ cloneNotebook(id: string): Promise<NotebookDTO>;
162
+ /**
163
+ * Clone a lexical document.
164
+ * @param id - Document ID to clone
165
+ * @returns Cloned Lexical instance
166
+ */
167
+ cloneLexical(id: string): Promise<LexicalDTO>;
168
+ /**
169
+ * Get all projects for the authenticated user.
170
+ * Projects are spaces with variant='project'.
171
+ * @returns Array of Project instances
172
+ */
173
+ getProjects(): Promise<ProjectDTO[]>;
174
+ /**
175
+ * Get a project by UID.
176
+ * @param uid - Project UID
177
+ * @returns Project instance
178
+ */
179
+ getProject(uid: string): Promise<ProjectDTO>;
180
+ /**
181
+ * Create a new project.
182
+ * @param name - Project name
183
+ * @param description - Project description
184
+ * @returns Created Project instance
185
+ */
186
+ createProject(name: string, description?: string): Promise<ProjectDTO>;
187
+ /**
188
+ * Update a project.
189
+ * @param uid - Project UID
190
+ * @param data - Update data (supports arbitrary Solr fields)
191
+ * @returns Updated Project instance
192
+ */
193
+ updateProject(uid: string, data: UpdateSpaceRequest): Promise<ProjectDTO>;
194
+ /**
195
+ * Rename a project.
196
+ * @param uid - Project UID
197
+ * @param newName - New project name
198
+ * @param description - Project description to preserve.
199
+ * @param userId - Authenticated user ID for user-scoped update.
200
+ * @returns Updated Project instance
201
+ */
202
+ renameProject(uid: string, newName: string, description?: string): Promise<ProjectDTO>;
203
+ /**
204
+ * Get default items (notebook UID and document UID) for a project.
205
+ * @param uid - Project UID
206
+ * @returns Default notebook and document UIDs
207
+ */
208
+ getProjectDefaultItems(uid: string): Promise<ProjectDefaultItems>;
110
209
  };
111
210
  } & TBase;