@datalayer/core 1.1.59 → 1.1.66

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 (366) hide show
  1. package/README.md +2 -2
  2. package/lib/api/DatalayerApi.d.ts +42 -1
  3. package/lib/api/DatalayerApi.js +90 -3
  4. package/lib/api/constants.d.ts +18 -0
  5. package/lib/api/constants.js +18 -0
  6. package/lib/api/contents/attachments.d.ts +9 -0
  7. package/lib/api/contents/attachments.js +43 -0
  8. package/lib/api/contents/bridges.d.ts +22 -0
  9. package/lib/api/contents/bridges.js +79 -0
  10. package/lib/api/contents/capabilities.d.ts +11 -0
  11. package/lib/api/contents/capabilities.js +21 -0
  12. package/lib/api/contents/cloudStorage.d.ts +31 -0
  13. package/lib/api/contents/cloudStorage.js +89 -0
  14. package/lib/api/contents/dataservers.d.ts +37 -0
  15. package/lib/api/contents/dataservers.js +121 -0
  16. package/lib/api/contents/datasets.d.ts +15 -0
  17. package/lib/api/contents/datasets.js +45 -0
  18. package/lib/api/contents/datasources.d.ts +70 -0
  19. package/lib/api/contents/datasources.js +149 -0
  20. package/lib/api/contents/generated.d.ts +1070 -0
  21. package/lib/api/contents/index.d.ts +16 -0
  22. package/lib/api/contents/index.js +20 -0
  23. package/lib/api/contents/mcp.d.ts +46 -0
  24. package/lib/api/contents/mcp.js +157 -0
  25. package/lib/api/contents/objects.d.ts +31 -0
  26. package/lib/api/contents/objects.js +88 -0
  27. package/lib/api/contents/operations.d.ts +3 -0
  28. package/lib/api/contents/operations.js +19 -0
  29. package/lib/api/contents/runtimeMounts.d.ts +40 -0
  30. package/lib/api/contents/runtimeMounts.js +59 -0
  31. package/lib/api/contents/sandboxUid.d.ts +53 -0
  32. package/lib/api/contents/sandboxUid.js +78 -0
  33. package/lib/api/contents/sources.d.ts +19 -0
  34. package/lib/api/contents/sources.js +119 -0
  35. package/lib/api/contents/sync.d.ts +18 -0
  36. package/lib/api/contents/sync.js +69 -0
  37. package/lib/api/contents/transfers.d.ts +38 -0
  38. package/lib/api/contents/transfers.js +123 -0
  39. package/lib/api/iam/connectedAgents.d.ts +39 -0
  40. package/lib/api/iam/connectedAgents.js +52 -0
  41. package/lib/api/iam/index.d.ts +2 -1
  42. package/lib/api/iam/index.js +2 -1
  43. package/lib/api/iam/mcpAlertRules.d.ts +51 -0
  44. package/lib/api/iam/mcpAlertRules.js +198 -0
  45. package/lib/api/iam/mcpAuditSettings.d.ts +46 -0
  46. package/lib/api/iam/mcpAuditSettings.js +120 -0
  47. package/lib/api/iam/mcpPolicy.d.ts +80 -0
  48. package/lib/api/iam/mcpPolicy.js +132 -0
  49. package/lib/api/iam/organizationTeams.d.ts +13 -0
  50. package/lib/api/iam/organizationTeams.js +43 -0
  51. package/lib/api/iam/serviceAgents.d.ts +68 -0
  52. package/lib/api/iam/serviceAgents.js +119 -0
  53. package/lib/api/index.d.ts +4 -1
  54. package/lib/api/index.js +3 -1
  55. package/lib/api/mcp/activity.d.ts +37 -0
  56. package/lib/api/mcp/activity.js +26 -0
  57. package/lib/api/mcp/alerts.d.ts +25 -0
  58. package/lib/api/mcp/alerts.js +51 -0
  59. package/lib/api/mcp/audit.d.ts +29 -0
  60. package/lib/api/mcp/audit.js +55 -0
  61. package/lib/api/mcp/bindings.d.ts +18 -0
  62. package/lib/api/mcp/bindings.js +42 -0
  63. package/lib/api/mcp/forwarding.d.ts +25 -0
  64. package/lib/api/mcp/forwarding.js +46 -0
  65. package/lib/api/mcp/gateway.d.ts +16 -0
  66. package/lib/api/mcp/gateway.js +70 -0
  67. package/lib/api/mcp/generated.d.ts +22 -0
  68. package/lib/api/mcp/generated.js +213 -0
  69. package/lib/api/mcp/index.d.ts +17 -0
  70. package/lib/api/mcp/index.js +25 -0
  71. package/lib/api/mcp/observability.d.ts +125 -0
  72. package/lib/api/mcp/observability.js +254 -0
  73. package/lib/api/mcp/operations.d.ts +83 -0
  74. package/lib/api/mcp/operations.js +50 -0
  75. package/lib/api/mcp/organizations.d.ts +102 -0
  76. package/lib/api/mcp/organizations.js +46 -0
  77. package/lib/api/mcp/policy.d.ts +9 -0
  78. package/lib/api/mcp/policy.js +23 -0
  79. package/lib/api/mcp/tasks.d.ts +49 -0
  80. package/lib/api/mcp/tasks.js +147 -0
  81. package/lib/api/utils/validation.d.ts +1 -1
  82. package/lib/api/utils/validation.js +1 -1
  83. package/lib/client/auth/index.js +0 -5
  84. package/lib/client/auth/storage.js +0 -5
  85. package/lib/client/auth/strategies.js +0 -5
  86. package/lib/client/base.d.ts +6 -0
  87. package/lib/client/base.js +8 -0
  88. package/lib/client/index.d.ts +0 -10
  89. package/lib/client/index.js +2 -2
  90. package/lib/client/mixins/ContentsMixin.d.ts +71 -0
  91. package/lib/client/mixins/ContentsMixin.js +157 -0
  92. package/lib/client/mixins/IAMMixin.d.ts +0 -31
  93. package/lib/client/mixins/IAMMixin.js +0 -58
  94. package/lib/components/animation/AnimatedText.d.ts +1 -0
  95. package/lib/components/animation/AnimatedText.js +0 -4
  96. package/lib/components/auth/SigInAPIKey.d.ts +1 -0
  97. package/lib/components/auth/SigInAPIKey.js +0 -6
  98. package/lib/components/auth/SignIn.d.ts +1 -0
  99. package/lib/components/auth/SignIn.js +0 -4
  100. package/lib/components/auth/SignIn.stories.d.ts +2 -2
  101. package/lib/components/avatars/BoringAvatar.d.ts +1 -1
  102. package/lib/components/avatars/BoringAvatar.stories.d.ts +1 -1
  103. package/lib/components/avatars/DLAvatar.d.ts +1 -1
  104. package/lib/components/avatars/DLAvatar.js +0 -4
  105. package/lib/components/avatars/UserAvatar.d.ts +18 -1
  106. package/lib/components/avatars/UserAvatar.js +14 -14
  107. package/lib/components/avatars/UserProfileAvatar.d.ts +1 -1
  108. package/lib/components/banners/NoAutomationBanner.d.ts +1 -1
  109. package/lib/components/billing/BillingEntitySelect.d.ts +10 -0
  110. package/lib/components/billing/BillingEntitySelect.js +0 -17
  111. package/lib/components/billing/index.js +0 -4
  112. package/lib/components/buttons/DownloadCSVButton.d.ts +1 -1
  113. package/lib/components/buttons/DownloadJsonButton.d.ts +1 -1
  114. package/lib/components/buttons/LongActionButton.d.ts +1 -0
  115. package/lib/components/buttons/LongActionButton.js +0 -4
  116. package/lib/components/buttons/UploadButton.d.ts +1 -0
  117. package/lib/components/buttons/UploadButton.js +0 -4
  118. package/lib/components/checkout/StripeCheckout.d.ts +1 -1
  119. package/lib/components/collaboration/LiveEditorCollaborators.d.ts +31 -0
  120. package/lib/components/collaboration/LiveEditorCollaborators.js +98 -53
  121. package/lib/components/collaboration/index.js +0 -4
  122. package/lib/components/confetti/ConfettiSuccess.d.ts +1 -1
  123. package/lib/components/contents/ContentSourceCard.d.ts +8 -0
  124. package/lib/components/contents/ContentSourceCard.js +23 -0
  125. package/lib/components/contents/HomeFolderObjectsBrowser.d.ts +10 -0
  126. package/lib/components/contents/HomeFolderObjectsBrowser.js +148 -0
  127. package/lib/components/contents/index.d.ts +2 -0
  128. package/lib/components/contents/index.js +6 -0
  129. package/lib/components/context/OrganizationSelect.d.ts +1 -1
  130. package/lib/components/display/AvatarSkeleton.d.ts +1 -1
  131. package/lib/components/display/BusyDots.d.ts +1 -1
  132. package/lib/components/display/CenteredSpinner.d.ts +1 -1
  133. package/lib/components/display/CodePreview.d.ts +1 -1
  134. package/lib/components/display/DatalayerBox.d.ts +7 -2
  135. package/lib/components/display/DatalayerBox.js +6 -6
  136. package/lib/components/display/HorizontalCenter.d.ts +1 -1
  137. package/lib/components/display/JupyterDialog.d.ts +1 -0
  138. package/lib/components/display/JupyterDialog.js +1 -7
  139. package/lib/components/display/Markdown.d.ts +1 -0
  140. package/lib/components/display/NotebookSkeleton.d.ts +1 -1
  141. package/lib/components/display/Placeholder.d.ts +1 -1
  142. package/lib/components/display/ToTopBranded.d.ts +1 -1
  143. package/lib/components/echarts/EChartsReact.d.ts +1 -1
  144. package/lib/components/flashes/FlashClosable.d.ts +1 -0
  145. package/lib/components/flashes/FlashClosable.js +0 -4
  146. package/lib/components/flashes/FlashGuest.d.ts +1 -1
  147. package/lib/components/flashes/FlashSurveys.d.ts +1 -1
  148. package/lib/components/flashes/FlashUnauthorized.d.ts +1 -0
  149. package/lib/components/flashes/FlashUnauthorized.js +0 -6
  150. package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
  151. package/lib/components/iam/ExternalTokenSilentLogin.d.ts +1 -1
  152. package/lib/components/index.d.ts +2 -0
  153. package/lib/components/index.js +2 -0
  154. package/lib/components/labels/StatusLabels.d.ts +10 -0
  155. package/lib/components/labels/StatusLabels.js +30 -1
  156. package/lib/components/labels/VisibilityLabel.d.ts +1 -1
  157. package/lib/components/landings/StepBlock.d.ts +1 -1
  158. package/lib/components/mcp/ClientBadge.d.ts +41 -0
  159. package/lib/components/mcp/ClientBadge.js +33 -0
  160. package/lib/components/mcp/McpErrorBlankslate.d.ts +21 -0
  161. package/lib/components/mcp/McpErrorBlankslate.js +17 -0
  162. package/lib/components/mcp/ScopeList.d.ts +28 -0
  163. package/lib/components/mcp/ScopeList.js +14 -0
  164. package/lib/components/mcp/index.d.ts +10 -0
  165. package/lib/components/mcp/index.js +18 -0
  166. package/lib/components/navbar/NavigationVisbilityObserver.d.ts +2 -1
  167. package/lib/components/navbar/SubdomainNavBar.d.ts +10 -5
  168. package/lib/components/navbar/SubdomainNavBar.js +2 -1
  169. package/lib/components/notebooks/JupyterNotebook.d.ts +1 -1
  170. package/lib/components/notebooks/JupyterNotebookToolbar.d.ts +1 -1
  171. package/lib/components/principal/PrincipalAppearance.d.ts +1 -0
  172. package/lib/components/principal/PrincipalAppearance.js +0 -8
  173. package/lib/components/principal/PrincipalAvatar.d.ts +9 -1
  174. package/lib/components/principal/PrincipalAvatar.js +25 -10
  175. package/lib/components/principal/PrincipalBadge.d.ts +1 -1
  176. package/lib/components/principal/PrincipalBanner.d.ts +1 -1
  177. package/lib/components/principal/PrincipalDetailsOverlay.d.ts +31 -1
  178. package/lib/components/principal/PrincipalDetailsOverlay.js +64 -33
  179. package/lib/components/principal/PrincipalHoverCard.d.ts +31 -0
  180. package/lib/components/principal/PrincipalHoverCard.js +52 -0
  181. package/lib/components/principal/PrincipalSwitcherMenu.d.ts +1 -0
  182. package/lib/components/principal/PrincipalSwitcherMenu.js +7 -15
  183. package/lib/components/principal/index.d.ts +2 -1
  184. package/lib/components/principal/index.js +2 -1
  185. package/lib/components/progress/ConsumptionBar.d.ts +1 -0
  186. package/lib/components/progress/ConsumptionBar.js +0 -4
  187. package/lib/components/progress/ProgressRing.d.ts +1 -0
  188. package/lib/components/progress/SpinnerBar.d.ts +1 -1
  189. package/lib/components/progress/Timer.d.ts +1 -0
  190. package/lib/components/progress/Timer.js +0 -4
  191. package/lib/components/screencapture/ScreencaptureButton.d.ts +1 -1
  192. package/lib/components/sharing/ShareAccessComponent.d.ts +15 -1
  193. package/lib/components/sharing/ShareAccessComponent.js +36 -23
  194. package/lib/components/sharing/SharingEditor.d.ts +17 -0
  195. package/lib/components/sharing/SharingEditor.js +0 -24
  196. package/lib/components/sparklines/Sparklines.js +3 -4
  197. package/lib/components/sparklines/index.js +0 -4
  198. package/lib/components/storage/ContentsBrowser.d.ts +25 -1
  199. package/lib/components/storage/ContentsBrowser.js +145 -52
  200. package/lib/components/storage/ContentsBrowserMock.d.ts +3 -0
  201. package/lib/components/storage/ContentsBrowserMock.js +75 -0
  202. package/lib/components/storage/ContentsItems.d.ts +2 -1
  203. package/lib/components/storage/ContentsItems.js +0 -4
  204. package/lib/components/storage/ContentsTable.d.ts +50 -0
  205. package/lib/components/storage/ContentsTable.js +134 -0
  206. package/lib/components/storage/HomeFolderDrive.d.ts +71 -0
  207. package/lib/components/storage/HomeFolderDrive.js +248 -0
  208. package/lib/components/storage/index.d.ts +2 -0
  209. package/lib/components/storage/index.js +2 -0
  210. package/lib/components/students/StudentItemStatus.d.ts +1 -1
  211. package/lib/components/students/StudentResultCircle.d.ts +1 -1
  212. package/lib/components/subnav/SubNav.d.ts +5 -5
  213. package/lib/components/subnav/SubNav.js +11 -9
  214. package/lib/components/tables/DataTable.d.ts +1 -1
  215. package/lib/components/text-reveal/TextRevealAnimation.d.ts +2 -2
  216. package/lib/components/text-reveal/useTextRevealAnimationLines.d.ts +1 -1
  217. package/lib/components/time/LiveRelativeTime.d.ts +1 -0
  218. package/lib/components/time/LiveRelativeTime.js +0 -8
  219. package/lib/components/time/index.js +0 -4
  220. package/lib/components/timeline/Timeline.d.ts +1 -1
  221. package/lib/components/timeline/index.js +0 -4
  222. package/lib/components/users/PeerIndicator.d.ts +1 -0
  223. package/lib/components/users/PeerIndicator.js +0 -4
  224. package/lib/config/Configuration.d.ts +15 -17
  225. package/lib/config/Configuration.js +7 -0
  226. package/lib/hooks/index.d.ts +2 -0
  227. package/lib/hooks/index.js +2 -0
  228. package/lib/hooks/layouts/LayoutBackdrop.d.ts +1 -1
  229. package/lib/hooks/layouts/LayoutScreencapture.d.ts +1 -1
  230. package/lib/hooks/useBackdrop.d.ts +1 -1
  231. package/lib/hooks/useBackdropJupyterLab.d.ts +3 -2
  232. package/lib/hooks/useBackdropJupyterLab.js +0 -4
  233. package/lib/hooks/useCache.d.ts +310 -105
  234. package/lib/hooks/useCache.js +142 -355
  235. package/lib/hooks/useContainsFocus.d.ts +1 -1
  236. package/lib/hooks/useContents.d.ts +313 -0
  237. package/lib/hooks/useContents.js +964 -0
  238. package/lib/hooks/useFocusTrap.d.ts +4 -4
  239. package/lib/hooks/useFocusTrap.js +1 -1
  240. package/lib/hooks/useMcp.d.ts +229 -0
  241. package/lib/hooks/useMcp.js +656 -0
  242. package/lib/hooks/useMobile.js +0 -5
  243. package/lib/hooks/useProjectStore.d.ts +3 -3
  244. package/lib/hooks/useProjectStore.js +4 -4
  245. package/lib/hooks/useRef.d.ts +1 -1
  246. package/lib/hooks/useRef.js +3 -0
  247. package/lib/hooks/useScreencapture.d.ts +2 -1
  248. package/lib/hooks/useScreencapture.js +0 -4
  249. package/lib/hooks/useToast.js +0 -4
  250. package/lib/hooks/useUser.js +42 -0
  251. package/lib/hooks/useVisibilityObserver.d.ts +1 -1
  252. package/lib/index.d.ts +4 -1
  253. package/lib/index.js +3 -1
  254. package/lib/mocks/components/FlashMock.d.ts +1 -1
  255. package/lib/mocks/views/ActionMenuMock.d.ts +1 -1
  256. package/lib/mocks/views/ChartMock.d.ts +1 -1
  257. package/lib/mocks/views/DashboardMock.d.ts +1 -1
  258. package/lib/mocks/views/FormMock.d.ts +1 -1
  259. package/lib/mocks/views/TableMock.d.ts +1 -1
  260. package/lib/mocks/views/WipMock.d.ts +1 -1
  261. package/lib/models/Credits.d.ts +16 -0
  262. package/lib/models/Credits.js +22 -0
  263. package/lib/models/McpAuditEvent.d.ts +52 -0
  264. package/lib/models/McpAuditEvent.js +5 -0
  265. package/lib/models/McpBinding.d.ts +51 -0
  266. package/lib/models/McpBinding.js +5 -0
  267. package/lib/models/McpPolicy.d.ts +77 -0
  268. package/lib/models/McpPolicy.js +5 -0
  269. package/lib/models/McpTask.d.ts +94 -0
  270. package/lib/models/McpTask.js +7 -0
  271. package/lib/models/StartedBy.d.ts +57 -0
  272. package/lib/models/StartedBy.js +81 -0
  273. package/lib/models/UserDTO.js +4 -2
  274. package/lib/models/contents/__fixtures__/solr-codec.json +57 -0
  275. package/lib/models/contents/__fixtures__/v1-contracts.json +66 -0
  276. package/lib/models/contents/fieldCase.d.ts +8 -0
  277. package/lib/models/contents/fieldCase.js +37 -0
  278. package/lib/models/contents/index.d.ts +2 -0
  279. package/lib/models/contents/index.js +6 -0
  280. package/lib/models/contents/permissions.d.ts +16 -0
  281. package/lib/models/contents/permissions.js +34 -0
  282. package/lib/models/index.d.ts +5 -1
  283. package/lib/models/index.js +5 -1
  284. package/lib/state/substates/CoreState.d.ts +15 -7
  285. package/lib/state/substates/CoreState.js +18 -14
  286. package/lib/state/substates/IAMState.d.ts +1 -1
  287. package/lib/state/substates/IAMState.js +5 -5
  288. package/lib/state/substates/ProfileState.js +0 -4
  289. package/lib/state/substates/index.d.ts +0 -1
  290. package/lib/state/substates/index.js +0 -1
  291. package/lib/utils/Jwt.d.ts +26 -0
  292. package/lib/utils/Jwt.js +37 -0
  293. package/lib/utils/WithSuspense.d.ts +1 -1
  294. package/lib/views/api-keys/APIKeyEdit.d.ts +1 -1
  295. package/lib/views/api-keys/APIKeyNew.d.ts +1 -1
  296. package/lib/views/api-keys/APIKeys.d.ts +1 -1
  297. package/lib/views/api-keys/APIKeys.js +30 -4
  298. package/lib/views/api-keys/APIKeysStandalone.d.ts +5 -1
  299. package/lib/views/api-keys/APIKeysStandalone.js +2 -2
  300. package/lib/views/datasources/DatasourceDetail.d.ts +12 -5
  301. package/lib/views/datasources/DatasourceDetail.js +80 -110
  302. package/lib/views/datasources/DatasourceNew.d.ts +14 -8
  303. package/lib/views/datasources/DatasourceNew.js +129 -118
  304. package/lib/views/datasources/Datasources.d.ts +39 -7
  305. package/lib/views/datasources/Datasources.js +95 -40
  306. package/lib/views/datasources/DatasourcesMock.d.ts +3 -0
  307. package/lib/views/datasources/DatasourcesMock.js +57 -0
  308. package/lib/views/iam/SignInSimple.d.ts +12 -0
  309. package/lib/views/iam/SignInSimple.js +4 -4
  310. package/lib/views/index.d.ts +1 -0
  311. package/lib/views/index.js +1 -0
  312. package/lib/views/mcp/AlertDestinations.d.ts +34 -0
  313. package/lib/views/mcp/AlertDestinations.js +75 -0
  314. package/lib/views/mcp/AlertRules.d.ts +32 -0
  315. package/lib/views/mcp/AlertRules.js +245 -0
  316. package/lib/views/mcp/AuditLog.d.ts +42 -0
  317. package/lib/views/mcp/AuditLog.js +144 -0
  318. package/lib/views/mcp/ConnectedAgents.d.ts +34 -0
  319. package/lib/views/mcp/ConnectedAgents.js +100 -0
  320. package/lib/views/mcp/EnterpriseConsole.d.ts +74 -0
  321. package/lib/views/mcp/EnterpriseConsole.js +173 -0
  322. package/lib/views/mcp/McpDashboard.d.ts +50 -0
  323. package/lib/views/mcp/McpDashboard.js +347 -0
  324. package/lib/views/mcp/McpHome.d.ts +92 -0
  325. package/lib/views/mcp/McpHome.js +153 -0
  326. package/lib/views/mcp/McpObservability.d.ts +50 -0
  327. package/lib/views/mcp/McpObservability.js +150 -0
  328. package/lib/views/mcp/OrganizationPolicy.d.ts +45 -0
  329. package/lib/views/mcp/OrganizationPolicy.js +107 -0
  330. package/lib/views/mcp/OrganizationUsage.d.ts +69 -0
  331. package/lib/views/mcp/OrganizationUsage.js +113 -0
  332. package/lib/views/mcp/PersonalPolicy.d.ts +54 -0
  333. package/lib/views/mcp/PersonalPolicy.js +125 -0
  334. package/lib/views/mcp/Policies.d.ts +53 -0
  335. package/lib/views/mcp/Policies.js +210 -0
  336. package/lib/views/mcp/PolicyForm.d.ts +67 -0
  337. package/lib/views/mcp/PolicyForm.js +91 -0
  338. package/lib/views/mcp/PolicyHistory.d.ts +45 -0
  339. package/lib/views/mcp/PolicyHistory.js +62 -0
  340. package/lib/views/mcp/ServiceAgents.d.ts +46 -0
  341. package/lib/views/mcp/ServiceAgents.js +194 -0
  342. package/lib/views/mcp/TeamPolicies.d.ts +33 -0
  343. package/lib/views/mcp/TeamPolicies.js +98 -0
  344. package/lib/views/mcp/format.d.ts +25 -0
  345. package/lib/views/mcp/format.js +77 -0
  346. package/lib/views/mcp/index.d.ts +29 -0
  347. package/lib/views/mcp/index.js +37 -0
  348. package/lib/views/mcp/types.d.ts +66 -0
  349. package/lib/views/mcp/types.js +5 -0
  350. package/lib/views/secrets/SecretEdit.d.ts +5 -1
  351. package/lib/views/secrets/SecretEdit.js +2 -2
  352. package/lib/views/secrets/SecretNew.d.ts +11 -1
  353. package/lib/views/secrets/SecretNew.js +2 -2
  354. package/lib/views/secrets/Secrets.d.ts +12 -1
  355. package/lib/views/secrets/Secrets.js +2 -2
  356. package/package.json +28 -24
  357. package/scripts/generate-contents-types.py +169 -0
  358. package/scripts/generate-mcp-types.py +233 -0
  359. package/lib/api/iam/datasources.d.ts +0 -86
  360. package/lib/api/iam/datasources.js +0 -185
  361. package/lib/components/toolbars/index.d.ts +0 -1
  362. package/lib/models/Datasource.d.ts +0 -181
  363. package/lib/models/Datasource.js +0 -154
  364. package/lib/state/substates/DatasourceState.d.ts +0 -11
  365. package/lib/state/substates/DatasourceState.js +0 -16
  366. /package/lib/{components/toolbars/index.js → api/contents/generated.js} +0 -0
@@ -0,0 +1,16 @@
1
+ export * from './generated';
2
+ export * from './attachments';
3
+ export * from './bridges';
4
+ export * from './sandboxUid';
5
+ export * from './capabilities';
6
+ export * from './cloudStorage';
7
+ export * from './datasets';
8
+ export * from './datasources';
9
+ export * from './dataservers';
10
+ export * from './mcp';
11
+ export * from './objects';
12
+ export * from './runtimeMounts';
13
+ export * from './operations';
14
+ export * from './sources';
15
+ export * from './sync';
16
+ export * from './transfers';
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ export * from './generated.js';
6
+ export * from './attachments.js';
7
+ export * from './bridges.js';
8
+ export * from './sandboxUid.js';
9
+ export * from './capabilities.js';
10
+ export * from './cloudStorage.js';
11
+ export * from './datasets.js';
12
+ export * from './datasources.js';
13
+ export * from './dataservers.js';
14
+ export * from './mcp.js';
15
+ export * from './objects.js';
16
+ export * from './runtimeMounts.js';
17
+ export * from './operations.js';
18
+ export * from './sources.js';
19
+ export * from './sync.js';
20
+ export * from './transfers.js';
@@ -0,0 +1,46 @@
1
+ import type { McpApproval, McpApprovalList, McpCall, McpCallCreate, McpCallList, McpHealth, McpSession, McpSessionCreate, McpSessionList, McpToolManifest } from './generated';
2
+ export type McpCallStatus = McpCall['status'];
3
+ export type McpApprovalStatus = McpApproval['status'];
4
+ export type McpSessionStatus = McpSession['status'];
5
+ /** A call the service has finished with, one way or another. */
6
+ export declare const MCP_TERMINAL_CALL_STATUSES: ReadonlySet<McpCallStatus>;
7
+ export declare const isMcpCallTerminal: (status: McpCallStatus) => boolean;
8
+ /** The tools and resources the server behind a source offers. */
9
+ export declare const discoverMcpTools: (token: string, sourceUid: string, baseUrl?: string) => Promise<McpToolManifest>;
10
+ /** Does the server answer through this source, right now? */
11
+ export declare const testMcpSource: (token: string, sourceUid: string, baseUrl?: string) => Promise<McpHealth>;
12
+ /**
13
+ * Open a scoped connection to an MCP source on the caller's behalf.
14
+ *
15
+ * The session's allowlists are the source's, narrowed by `tools` when given.
16
+ */
17
+ export declare const createMcpSession: (token: string, request: McpSessionCreate, idempotencyKey: string, baseUrl?: string) => Promise<McpSession>;
18
+ export declare const getMcpSession: (token: string, sessionUid: string, baseUrl?: string) => Promise<McpSession>;
19
+ /** Every session the caller opened. The contract lists them whole; a reader narrows. */
20
+ export declare const listMcpSessions: (token: string, baseUrl?: string) => Promise<McpSessionList>;
21
+ export declare const revokeMcpSession: (token: string, sessionUid: string, baseUrl?: string) => Promise<McpSession>;
22
+ /**
23
+ * Invoke one tool through a session.
24
+ *
25
+ * The answer is the call record, not necessarily the result: under an
26
+ * `explicit` approval policy it comes back `pending-approval` with the
27
+ * approval to decide, and a bulk acquisition ends in artifacts that name a
28
+ * Transfer rather than carrying bytes. The arguments are the tool's own and
29
+ * go over as typed; only the envelope is converted.
30
+ */
31
+ export declare const callMcpTool: (token: string, sessionUid: string, request: McpCallCreate, baseUrl?: string) => Promise<McpCall>;
32
+ export declare const getMcpCall: (token: string, sessionUid: string, callUid: string, baseUrl?: string) => Promise<McpCall>;
33
+ /**
34
+ * The calls made through a session, newest first.
35
+ *
36
+ * This is where provenance lives: a call whose result carries artifacts is
37
+ * an acquisition, and the artifact names the Transfer, object and version it
38
+ * became.
39
+ */
40
+ export declare const listMcpCalls: (token: string, sessionUid: string, baseUrl?: string) => Promise<McpCallList>;
41
+ /** The caller's approvals, in one status; the contract filters on nothing else. */
42
+ export declare const listMcpApprovals: (token: string, options?: {
43
+ status?: McpApprovalStatus;
44
+ }, baseUrl?: string) => Promise<McpApprovalList>;
45
+ /** Approve or reject a pending call; the note travels with the decision. */
46
+ export declare const decideMcpApproval: (token: string, approvalUid: string, decision: "approve" | "reject", note?: string, baseUrl?: string) => Promise<McpApproval>;
@@ -0,0 +1,157 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /*
6
+ * Copyright (c) 2023-2026 Datalayer, Inc.
7
+ * Distributed under the terms of the Modified BSD License.
8
+ */
9
+ /**
10
+ * An MCP source through the service: discovered, tested, used.
11
+ *
12
+ * Nothing here talks to the MCP server. Contents does, with the credential
13
+ * it holds, through a session it opens for the caller and narrows to the
14
+ * source's allowlists. What a browser gets back is tool definitions, call
15
+ * records and approvals — and for a call that moved bytes, the Transfer or
16
+ * object that holds them rather than the bytes.
17
+ *
18
+ * The wire types are the generated ones; what is declared here is what the
19
+ * contract does not name — the status unions as standalone types, and which
20
+ * of them are terminal.
21
+ */
22
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
23
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
24
+ import { contentsToCamelCase, contentsToSnakeCase } from '../../models/contents/index.js';
25
+ /** A call the service has finished with, one way or another. */
26
+ export const MCP_TERMINAL_CALL_STATUSES = new Set([
27
+ 'denied',
28
+ 'succeeded',
29
+ 'failed',
30
+ 'refused',
31
+ ]);
32
+ export const isMcpCallTerminal = (status) => MCP_TERMINAL_CALL_STATUSES.has(status);
33
+ const convertRequest = (value) => contentsToSnakeCase(value);
34
+ const convertResponse = (value) => contentsToCamelCase(value);
35
+ /**
36
+ * A tool's input schema is JSON Schema: its property names are the tool's
37
+ * argument names and must survive as typed, so the discovery answer is
38
+ * converted around them rather than through them.
39
+ */
40
+ const convertDiscovery = (value) => {
41
+ const raw = (value ?? {});
42
+ const tools = (raw.tools ?? []).map(tool => ({
43
+ name: String(tool.name ?? ''),
44
+ description: tool.description ?? null,
45
+ inputSchema: tool.input_schema ??
46
+ tool.inputSchema ??
47
+ {},
48
+ }));
49
+ const resources = (raw.resources ?? []).map(resource => ({
50
+ uri: String(resource.uri ?? ''),
51
+ name: resource.name ?? null,
52
+ mediaType: resource.media_type ?? null,
53
+ }));
54
+ return { tools, resources, discoveredAt: raw.discovered_at ?? '' };
55
+ };
56
+ const contentsUrl = (baseUrl, suffix) => `${baseUrl}${API_BASE_PATHS.CONTENTS}${suffix}`;
57
+ const sourceMcpUrl = (baseUrl, sourceUid, suffix = '') => contentsUrl(baseUrl, `/sources/${encodeURIComponent(sourceUid)}/mcp${suffix}`);
58
+ const sessionUrl = (baseUrl, sessionUid, suffix = '') => contentsUrl(baseUrl, `/mcp-sessions/${encodeURIComponent(sessionUid)}${suffix}`);
59
+ /** The tools and resources the server behind a source offers. */
60
+ export const discoverMcpTools = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertDiscovery(await requestDatalayerAPI({
61
+ url: sourceMcpUrl(baseUrl, sourceUid, '/tools'),
62
+ method: 'GET',
63
+ token,
64
+ }));
65
+ /** Does the server answer through this source, right now? */
66
+ export const testMcpSource = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
67
+ url: sourceMcpUrl(baseUrl, sourceUid, '/health'),
68
+ method: 'POST',
69
+ token,
70
+ }));
71
+ /**
72
+ * Open a scoped connection to an MCP source on the caller's behalf.
73
+ *
74
+ * The session's allowlists are the source's, narrowed by `tools` when given.
75
+ */
76
+ export const createMcpSession = async (token, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
77
+ url: contentsUrl(baseUrl, '/mcp-sessions'),
78
+ method: 'POST',
79
+ token,
80
+ headers: { 'Idempotency-Key': idempotencyKey },
81
+ body: convertRequest(request),
82
+ }));
83
+ export const getMcpSession = async (token, sessionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
84
+ url: sessionUrl(baseUrl, sessionUid),
85
+ method: 'GET',
86
+ token,
87
+ }));
88
+ /** Every session the caller opened. The contract lists them whole; a reader narrows. */
89
+ export const listMcpSessions = async (token, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
90
+ url: contentsUrl(baseUrl, '/mcp-sessions'),
91
+ method: 'GET',
92
+ token,
93
+ }));
94
+ export const revokeMcpSession = async (token, sessionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
95
+ url: sessionUrl(baseUrl, sessionUid),
96
+ method: 'DELETE',
97
+ token,
98
+ }));
99
+ /**
100
+ * Invoke one tool through a session.
101
+ *
102
+ * The answer is the call record, not necessarily the result: under an
103
+ * `explicit` approval policy it comes back `pending-approval` with the
104
+ * approval to decide, and a bulk acquisition ends in artifacts that name a
105
+ * Transfer rather than carrying bytes. The arguments are the tool's own and
106
+ * go over as typed; only the envelope is converted.
107
+ */
108
+ export const callMcpTool = async (token, sessionUid, request, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
109
+ url: sessionUrl(baseUrl, sessionUid, '/calls'),
110
+ method: 'POST',
111
+ token,
112
+ body: {
113
+ tool: request.tool,
114
+ arguments: request.arguments ?? {},
115
+ ...(request.destinationUri ? { destination_uri: request.destinationUri } : {}),
116
+ },
117
+ }));
118
+ export const getMcpCall = async (token, sessionUid, callUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
119
+ url: sessionUrl(baseUrl, sessionUid, `/calls/${encodeURIComponent(callUid)}`),
120
+ method: 'GET',
121
+ token,
122
+ }));
123
+ /**
124
+ * The calls made through a session, newest first.
125
+ *
126
+ * This is where provenance lives: a call whose result carries artifacts is
127
+ * an acquisition, and the artifact names the Transfer, object and version it
128
+ * became.
129
+ */
130
+ export const listMcpCalls = async (token, sessionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
131
+ url: sessionUrl(baseUrl, sessionUid, '/calls'),
132
+ method: 'GET',
133
+ token,
134
+ }));
135
+ /** The caller's approvals, in one status; the contract filters on nothing else. */
136
+ export const listMcpApprovals = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
137
+ const parameters = new URLSearchParams();
138
+ if (options.status) {
139
+ parameters.set('status', options.status);
140
+ }
141
+ const query = parameters.toString();
142
+ return convertResponse(await requestDatalayerAPI({
143
+ url: `${contentsUrl(baseUrl, '/mcp-approvals')}${query ? `?${query}` : ''}`,
144
+ method: 'GET',
145
+ token,
146
+ }));
147
+ };
148
+ /** Approve or reject a pending call; the note travels with the decision. */
149
+ export const decideMcpApproval = async (token, approvalUid, decision, note, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
150
+ const body = note ? { note } : {};
151
+ return convertResponse(await requestDatalayerAPI({
152
+ url: contentsUrl(baseUrl, `/mcp-approvals/${encodeURIComponent(approvalUid)}/${decision}`),
153
+ method: 'POST',
154
+ token,
155
+ body,
156
+ }));
157
+ };
@@ -0,0 +1,31 @@
1
+ import type { HomeFolderFileList, ContentObject, ObjectList, RestoreRequest, HomeFolderQuota, VersionList } from './generated';
2
+ export type HomeFolderObjectListOptions = {
3
+ prefix?: string;
4
+ cursor?: string;
5
+ limit?: number;
6
+ order?: 'path' | 'updated';
7
+ };
8
+ export declare const getHomeFolderQuota: (token: string, baseUrl?: string) => Promise<HomeFolderQuota>;
9
+ export declare const listHomeFolderObjects: (token: string, options?: HomeFolderObjectListOptions, baseUrl?: string) => Promise<ObjectList>;
10
+ export declare const statHomeFolderObject: (token: string, path: string, baseUrl?: string) => Promise<ContentObject>;
11
+ export declare const listHomeFolderObjectVersions: (token: string, objectUid: string, options?: {
12
+ cursor?: string;
13
+ limit?: number;
14
+ }, baseUrl?: string) => Promise<VersionList>;
15
+ export declare const deleteHomeFolderObject: (token: string, objectUid: string, idempotencyKey: string, baseUrl?: string) => Promise<ContentObject>;
16
+ export declare const restoreHomeFolderObject: (token: string, objectUid: string, request: RestoreRequest, idempotencyKey: string, baseUrl?: string) => Promise<ContentObject>;
17
+ /**
18
+ * The files under a path of the caller's Home Folders — what a sandbox
19
+ * wrote as well as what was uploaded — as the shared filesystem holds them.
20
+ * The root lists the folders the caller reaches: their own, and one per
21
+ * organization and team.
22
+ */
23
+ export declare const listHomeFolderFiles: (token: string, path?: string, baseUrl?: string) => Promise<HomeFolderFileList>;
24
+ /** The bytes of one Home Folder file, or a range of them, from the shared filesystem. */
25
+ export declare const readHomeFolderFile: (token: string, path: string, options?: {
26
+ range?: string;
27
+ }, baseUrl?: string) => Promise<{
28
+ body: ArrayBuffer;
29
+ status: number;
30
+ headers: Record<string, string>;
31
+ }>;
@@ -0,0 +1,88 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ import { requestDatalayerAPI, requestDatalayerAPIWithResponse, } from '../DatalayerApi.js';
6
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
7
+ import { contentsToCamelCase, contentsToSnakeCase } from '../../models/contents/index.js';
8
+ const homeFolderUrl = (baseUrl, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/home-folder${suffix}`;
9
+ const convertResponse = (value) => contentsToCamelCase(value);
10
+ const homeFolderObjectsUrl = (baseUrl, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/home-folder/objects${suffix}`;
11
+ export const getHomeFolderQuota = async (token, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
12
+ url: `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/home-folder/quota`,
13
+ method: 'GET',
14
+ token,
15
+ }));
16
+ export const listHomeFolderObjects = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
17
+ const parameters = new URLSearchParams();
18
+ parameters.set('limit', String(options.limit ?? 100));
19
+ if (options.prefix) {
20
+ parameters.set('prefix', options.prefix);
21
+ }
22
+ if (options.cursor) {
23
+ parameters.set('cursor', options.cursor);
24
+ }
25
+ if (options.order) {
26
+ parameters.set('order', options.order);
27
+ }
28
+ return convertResponse(await requestDatalayerAPI({
29
+ url: `${homeFolderObjectsUrl(baseUrl)}?${parameters.toString()}`,
30
+ method: 'GET',
31
+ token,
32
+ }));
33
+ };
34
+ export const statHomeFolderObject = async (token, path, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
35
+ const parameters = new URLSearchParams({ path });
36
+ return convertResponse(await requestDatalayerAPI({
37
+ url: `${homeFolderObjectsUrl(baseUrl, '/stat')}?${parameters.toString()}`,
38
+ method: 'GET',
39
+ token,
40
+ }));
41
+ };
42
+ export const listHomeFolderObjectVersions = async (token, objectUid, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
43
+ const parameters = new URLSearchParams();
44
+ parameters.set('limit', String(options.limit ?? 100));
45
+ if (options.cursor) {
46
+ parameters.set('cursor', options.cursor);
47
+ }
48
+ return convertResponse(await requestDatalayerAPI({
49
+ url: `${homeFolderObjectsUrl(baseUrl, `/${encodeURIComponent(objectUid)}/versions`)}?${parameters.toString()}`,
50
+ method: 'GET',
51
+ token,
52
+ }));
53
+ };
54
+ export const deleteHomeFolderObject = async (token, objectUid, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
55
+ url: homeFolderObjectsUrl(baseUrl, `/${encodeURIComponent(objectUid)}`),
56
+ method: 'DELETE',
57
+ token,
58
+ headers: { 'Idempotency-Key': idempotencyKey },
59
+ }));
60
+ export const restoreHomeFolderObject = async (token, objectUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
61
+ url: homeFolderObjectsUrl(baseUrl, `/${encodeURIComponent(objectUid)}/restore`),
62
+ method: 'POST',
63
+ token,
64
+ headers: { 'Idempotency-Key': idempotencyKey },
65
+ body: contentsToSnakeCase(request),
66
+ }));
67
+ /**
68
+ * The files under a path of the caller's Home Folders — what a sandbox
69
+ * wrote as well as what was uploaded — as the shared filesystem holds them.
70
+ * The root lists the folders the caller reaches: their own, and one per
71
+ * organization and team.
72
+ */
73
+ export const listHomeFolderFiles = async (token, path = '', baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
74
+ url: `${homeFolderUrl(baseUrl, '/files')}?path=${encodeURIComponent(path)}`,
75
+ method: 'GET',
76
+ token,
77
+ }));
78
+ /** The bytes of one Home Folder file, or a range of them, from the shared filesystem. */
79
+ export const readHomeFolderFile = async (token, path, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
80
+ const response = await requestDatalayerAPIWithResponse({
81
+ url: `${homeFolderUrl(baseUrl, '/files/content')}?path=${encodeURIComponent(path)}`,
82
+ method: 'GET',
83
+ token,
84
+ headers: options.range ? { Range: options.range } : undefined,
85
+ responseType: 'arraybuffer',
86
+ });
87
+ return { body: response.data, status: response.status, headers: response.headers };
88
+ };
@@ -0,0 +1,3 @@
1
+ import type { OperationView } from './generated';
2
+ export declare const getOperation: (token: string, operationUid: string, baseUrl?: string) => Promise<OperationView>;
3
+ export declare const cancelOperation: (token: string, operationUid: string, baseUrl?: string) => Promise<OperationView>;
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
6
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
7
+ import { contentsToCamelCase } from '../../models/contents/index.js';
8
+ const operationUrl = (baseUrl, operationUid) => `${baseUrl}${API_BASE_PATHS.CONTENTS}/operations/${encodeURIComponent(operationUid)}`;
9
+ const convertResponse = (value) => contentsToCamelCase(value);
10
+ export const getOperation = async (token, operationUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
11
+ url: operationUrl(baseUrl, operationUid),
12
+ method: 'GET',
13
+ token,
14
+ }));
15
+ export const cancelOperation = async (token, operationUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
16
+ url: `${operationUrl(baseUrl, operationUid)}/cancel`,
17
+ method: 'POST',
18
+ token,
19
+ }));
@@ -0,0 +1,40 @@
1
+ /** One folder bound into a running Runtime. */
2
+ export type RuntimeMount = {
3
+ /** The single path segment it appears under, and the account's handle. */
4
+ target: string;
5
+ /** Where it comes from on the shared filesystem. Informational. */
6
+ source: string;
7
+ mode: 'ro' | 'rw';
8
+ allowExec: boolean;
9
+ uid?: string;
10
+ kind?: string;
11
+ };
12
+ /** What the platform reports about a Runtime's mounts. */
13
+ export type RuntimeMounts = {
14
+ success: boolean;
15
+ message: string;
16
+ /**
17
+ * `ready` when everything asked for is mounted, `degraded` when some of it
18
+ * is, `failed` or `GATEWAY_NOT_READY` when none of it is yet.
19
+ */
20
+ state: string;
21
+ /** What has been granted. */
22
+ mounts: RuntimeMount[];
23
+ /** Of those, what has actually arrived in the sandbox. */
24
+ mounted: string[];
25
+ /** Those that could not be mounted, by target, with the reason. */
26
+ failed: Record<string, string>;
27
+ };
28
+ /** What this Runtime is granted, and what has arrived. */
29
+ export declare const getRuntimeMounts: (token: string, runtimeName: string, baseUrl?: string) => Promise<RuntimeMounts>;
30
+ /**
31
+ * Mount the caller's home folders into a Runtime that is already running.
32
+ *
33
+ * Which folders is not a parameter: the platform resolves the caller's own
34
+ * memberships and mounts those.
35
+ */
36
+ export declare const attachRuntimeMounts: (token: string, runtimeName: string, baseUrl?: string) => Promise<RuntimeMounts>;
37
+ /** Take one folder out of a running Runtime, by the name it appears under. */
38
+ export declare const detachRuntimeMount: (token: string, runtimeName: string, target: string, baseUrl?: string) => Promise<RuntimeMounts>;
39
+ /** Whether the platform has finished applying what was asked for. */
40
+ export declare const isRuntimeMountsSettled: (mounts?: RuntimeMounts) => boolean;
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * The folders mounted into a Runtime that is already running.
7
+ *
8
+ * A Pod's volumes are fixed when it is created, so for most of a sandbox's
9
+ * life its mounts were decided before it existed. The mount gateway lifts
10
+ * that for the Home Folder: the platform binds a folder into a running pod
11
+ * and the sandbox sees it at `/home/jovyan/{handle}` within a second or two,
12
+ * with no restart.
13
+ *
14
+ * Not every Runtime can take one — a pod created before the gateway cannot,
15
+ * and neither can a sandbox at an external provider — which is why a Runtime
16
+ * carries `mountGateway` and why attaching answers with a reason rather than
17
+ * appearing to work. The folders themselves are never named here: they are
18
+ * resolved from the caller's memberships by the platform, and a client naming
19
+ * one is not a way to mount it.
20
+ */
21
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
22
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
23
+ import { contentsToCamelCase } from '../../models/contents/index.js';
24
+ const convert = (value) => {
25
+ const converted = contentsToCamelCase(value);
26
+ return {
27
+ ...converted,
28
+ mounts: converted.mounts ?? [],
29
+ mounted: converted.mounted ?? [],
30
+ failed: converted.failed ?? {},
31
+ };
32
+ };
33
+ const runtimesUrl = (baseUrl, suffix) => `${baseUrl}${API_BASE_PATHS.RUNTIMES}${suffix}`;
34
+ /** What this Runtime is granted, and what has arrived. */
35
+ export const getRuntimeMounts = async (token, runtimeName, baseUrl = DEFAULT_SERVICE_URLS.RUNTIMES) => convert(await requestDatalayerAPI({
36
+ url: runtimesUrl(baseUrl, `/runtimes/${encodeURIComponent(runtimeName)}/mounts`),
37
+ method: 'GET',
38
+ token,
39
+ }));
40
+ /**
41
+ * Mount the caller's home folders into a Runtime that is already running.
42
+ *
43
+ * Which folders is not a parameter: the platform resolves the caller's own
44
+ * memberships and mounts those.
45
+ */
46
+ export const attachRuntimeMounts = async (token, runtimeName, baseUrl = DEFAULT_SERVICE_URLS.RUNTIMES) => convert(await requestDatalayerAPI({
47
+ url: runtimesUrl(baseUrl, `/runtimes/${encodeURIComponent(runtimeName)}/mounts`),
48
+ method: 'POST',
49
+ token,
50
+ body: {},
51
+ }));
52
+ /** Take one folder out of a running Runtime, by the name it appears under. */
53
+ export const detachRuntimeMount = async (token, runtimeName, target, baseUrl = DEFAULT_SERVICE_URLS.RUNTIMES) => convert(await requestDatalayerAPI({
54
+ url: runtimesUrl(baseUrl, `/runtimes/${encodeURIComponent(runtimeName)}/mounts/${encodeURIComponent(target)}`),
55
+ method: 'DELETE',
56
+ token,
57
+ }));
58
+ /** Whether the platform has finished applying what was asked for. */
59
+ export const isRuntimeMountsSettled = (mounts) => mounts ? mounts.state === 'ready' || mounts.state === 'degraded' : false;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * A sandbox is identified by its uid, never by its runtime's Pod name.
3
+ *
4
+ * A Datalayer runtime has a ULID; its Kubernetes Pod is named
5
+ * `runtime-<ulid>`, because a Pod name has to be a DNS label. Route
6
+ * parameters and `runtime_name` fields carry the Pod name, and every Contents
7
+ * record keyed on a sandbox is keyed on the ULID.
8
+ *
9
+ * Passing the Pod name where a uid belongs used to *work* at the call site
10
+ * and fail far away: Contents validates `sandbox_uid` while building its
11
+ * reply, so a Pod name became an unhandled 500 that reached the browser as
12
+ * "Network Error", with nothing readable in it and nothing pointing at the
13
+ * caller. Throwing here names the caller in the stack instead.
14
+ *
15
+ * The server half of this is `datalayer_common.runtime_names`.
16
+ */
17
+ /** What a runtime Pod's name is prefixed with. */
18
+ export declare const RUNTIME_NAME_PREFIX = "runtime-";
19
+ /** Thrown when a Pod name is given where a sandbox uid is required. */
20
+ export declare class RuntimeNameNotAUid extends Error {
21
+ readonly value: string;
22
+ constructor(value: string);
23
+ }
24
+ /**
25
+ * Assert that a value is a sandbox uid, and return it.
26
+ *
27
+ * Use this wherever a `sandbox_uid` is sent. A non-Datalayer identifier —
28
+ * Daytona, E2B and Modal name their own sandboxes — passes through: there is
29
+ * no ULID to check it against, and inventing one would be worse.
30
+ */
31
+ export declare function assertSandboxUid(value: string): string;
32
+ /**
33
+ * The Pod name for a sandbox uid, converting on purpose.
34
+ *
35
+ * The mirror of {@link sandboxUidFromRuntimeName}, and the direction that was
36
+ * missing: route parameters and `runtime_name` fields carry the **Pod name**,
37
+ * so anything addressing `/runtimes/{name}/…` needs one. Without this, a
38
+ * caller holding only a uid either wrote the prefix itself or — the version
39
+ * that was here — passed the uid and hoped, which is a `404` from a route
40
+ * whose parameter looked plausible.
41
+ *
42
+ * Idempotent, like the server's `runtime_name()`: a name that has been
43
+ * through here stays one name rather than growing a second prefix.
44
+ */
45
+ export declare function runtimeNameFromSandboxUid(value: string): string;
46
+ /**
47
+ * The sandbox uid for a Pod name, converting on purpose.
48
+ *
49
+ * For the few callers that genuinely only hold the Pod name — a route
50
+ * parameter, a label read off a Pod. Everywhere else should already have the
51
+ * uid, and {@link assertSandboxUid} is what says so.
52
+ */
53
+ export declare function sandboxUidFromRuntimeName(value: string): string;
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * A sandbox is identified by its uid, never by its runtime's Pod name.
7
+ *
8
+ * A Datalayer runtime has a ULID; its Kubernetes Pod is named
9
+ * `runtime-<ulid>`, because a Pod name has to be a DNS label. Route
10
+ * parameters and `runtime_name` fields carry the Pod name, and every Contents
11
+ * record keyed on a sandbox is keyed on the ULID.
12
+ *
13
+ * Passing the Pod name where a uid belongs used to *work* at the call site
14
+ * and fail far away: Contents validates `sandbox_uid` while building its
15
+ * reply, so a Pod name became an unhandled 500 that reached the browser as
16
+ * "Network Error", with nothing readable in it and nothing pointing at the
17
+ * caller. Throwing here names the caller in the stack instead.
18
+ *
19
+ * The server half of this is `datalayer_common.runtime_names`.
20
+ */
21
+ /** What a runtime Pod's name is prefixed with. */
22
+ export const RUNTIME_NAME_PREFIX = 'runtime-';
23
+ /** Thrown when a Pod name is given where a sandbox uid is required. */
24
+ export class RuntimeNameNotAUid extends Error {
25
+ value;
26
+ constructor(value) {
27
+ super(`'${value}' is a runtime Pod name, not a sandbox uid. A sandbox is ` +
28
+ `identified by its ULID ('${value.slice(RUNTIME_NAME_PREFIX.length)}'). ` +
29
+ 'If all you hold is the Pod name, convert it deliberately with ' +
30
+ 'sandboxUidFromRuntimeName().');
31
+ this.name = 'RuntimeNameNotAUid';
32
+ this.value = value;
33
+ }
34
+ }
35
+ /**
36
+ * Assert that a value is a sandbox uid, and return it.
37
+ *
38
+ * Use this wherever a `sandbox_uid` is sent. A non-Datalayer identifier —
39
+ * Daytona, E2B and Modal name their own sandboxes — passes through: there is
40
+ * no ULID to check it against, and inventing one would be worse.
41
+ */
42
+ export function assertSandboxUid(value) {
43
+ if (value.startsWith(RUNTIME_NAME_PREFIX)) {
44
+ throw new RuntimeNameNotAUid(value);
45
+ }
46
+ return value;
47
+ }
48
+ /**
49
+ * The Pod name for a sandbox uid, converting on purpose.
50
+ *
51
+ * The mirror of {@link sandboxUidFromRuntimeName}, and the direction that was
52
+ * missing: route parameters and `runtime_name` fields carry the **Pod name**,
53
+ * so anything addressing `/runtimes/{name}/…` needs one. Without this, a
54
+ * caller holding only a uid either wrote the prefix itself or — the version
55
+ * that was here — passed the uid and hoped, which is a `404` from a route
56
+ * whose parameter looked plausible.
57
+ *
58
+ * Idempotent, like the server's `runtime_name()`: a name that has been
59
+ * through here stays one name rather than growing a second prefix.
60
+ */
61
+ export function runtimeNameFromSandboxUid(value) {
62
+ if (!value || value.startsWith(RUNTIME_NAME_PREFIX)) {
63
+ return value;
64
+ }
65
+ return `${RUNTIME_NAME_PREFIX}${value}`;
66
+ }
67
+ /**
68
+ * The sandbox uid for a Pod name, converting on purpose.
69
+ *
70
+ * For the few callers that genuinely only hold the Pod name — a route
71
+ * parameter, a label read off a Pod. Everywhere else should already have the
72
+ * uid, and {@link assertSandboxUid} is what says so.
73
+ */
74
+ export function sandboxUidFromRuntimeName(value) {
75
+ return value.startsWith(RUNTIME_NAME_PREFIX)
76
+ ? value.slice(RUNTIME_NAME_PREFIX.length)
77
+ : value;
78
+ }
@@ -0,0 +1,19 @@
1
+ import type { CatalogSource, ContentSourceCreate, ContentSourceUpdate, EffectivePermissions, Sharing, SourceList } from './generated';
2
+ export interface ConditionalCatalogSource {
3
+ value: CatalogSource;
4
+ etag: string;
5
+ }
6
+ export declare const listSources: (token: string, options?: {
7
+ kind?: string;
8
+ spaceUid?: string;
9
+ cursor?: string;
10
+ limit?: number;
11
+ }, baseUrl?: string) => Promise<SourceList>;
12
+ export declare const createSource: (token: string, source: ContentSourceCreate, idempotencyKey: string, baseUrl?: string) => Promise<ConditionalCatalogSource>;
13
+ export declare const getSource: (token: string, sourceUid: string, baseUrl?: string) => Promise<ConditionalCatalogSource>;
14
+ export declare const getHomeFolder: (token: string, baseUrl?: string) => Promise<ConditionalCatalogSource>;
15
+ export declare const updateSource: (token: string, sourceUid: string, update: ContentSourceUpdate, etag: string, baseUrl?: string) => Promise<ConditionalCatalogSource>;
16
+ export declare const archiveSource: (token: string, sourceUid: string, etag: string, baseUrl?: string) => Promise<ConditionalCatalogSource>;
17
+ export declare const getSourcePermissions: (token: string, sourceUid: string, baseUrl?: string) => Promise<EffectivePermissions>;
18
+ export declare const getSourceSharing: (token: string, sourceUid: string, baseUrl?: string) => Promise<Sharing>;
19
+ export declare const replaceSourceSharing: (token: string, sourceUid: string, sharing: Sharing, etag: string, baseUrl?: string) => Promise<ConditionalCatalogSource>;