@datalayer/core 1.1.60 → 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 (364) 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 +9 -0
  106. package/lib/components/avatars/UserAvatar.js +0 -12
  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 +86 -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 +1 -0
  155. package/lib/components/labels/VisibilityLabel.d.ts +1 -1
  156. package/lib/components/landings/StepBlock.d.ts +1 -1
  157. package/lib/components/mcp/ClientBadge.d.ts +41 -0
  158. package/lib/components/mcp/ClientBadge.js +33 -0
  159. package/lib/components/mcp/McpErrorBlankslate.d.ts +21 -0
  160. package/lib/components/mcp/McpErrorBlankslate.js +17 -0
  161. package/lib/components/mcp/ScopeList.d.ts +28 -0
  162. package/lib/components/mcp/ScopeList.js +14 -0
  163. package/lib/components/mcp/index.d.ts +10 -0
  164. package/lib/components/mcp/index.js +18 -0
  165. package/lib/components/navbar/NavigationVisbilityObserver.d.ts +2 -1
  166. package/lib/components/navbar/SubdomainNavBar.d.ts +10 -5
  167. package/lib/components/navbar/SubdomainNavBar.js +2 -1
  168. package/lib/components/notebooks/JupyterNotebook.d.ts +1 -1
  169. package/lib/components/notebooks/JupyterNotebookToolbar.d.ts +1 -1
  170. package/lib/components/principal/PrincipalAppearance.d.ts +1 -0
  171. package/lib/components/principal/PrincipalAppearance.js +0 -8
  172. package/lib/components/principal/PrincipalAvatar.d.ts +1 -0
  173. package/lib/components/principal/PrincipalAvatar.js +17 -9
  174. package/lib/components/principal/PrincipalBadge.d.ts +1 -1
  175. package/lib/components/principal/PrincipalBanner.d.ts +1 -1
  176. package/lib/components/principal/PrincipalDetailsOverlay.d.ts +31 -1
  177. package/lib/components/principal/PrincipalDetailsOverlay.js +64 -33
  178. package/lib/components/principal/PrincipalHoverCard.d.ts +31 -0
  179. package/lib/components/principal/PrincipalHoverCard.js +52 -0
  180. package/lib/components/principal/PrincipalSwitcherMenu.d.ts +1 -0
  181. package/lib/components/principal/PrincipalSwitcherMenu.js +5 -14
  182. package/lib/components/principal/index.d.ts +2 -1
  183. package/lib/components/principal/index.js +2 -1
  184. package/lib/components/progress/ConsumptionBar.d.ts +1 -0
  185. package/lib/components/progress/ConsumptionBar.js +0 -4
  186. package/lib/components/progress/ProgressRing.d.ts +1 -0
  187. package/lib/components/progress/SpinnerBar.d.ts +1 -1
  188. package/lib/components/progress/Timer.d.ts +1 -0
  189. package/lib/components/progress/Timer.js +0 -4
  190. package/lib/components/screencapture/ScreencaptureButton.d.ts +1 -1
  191. package/lib/components/sharing/ShareAccessComponent.d.ts +15 -1
  192. package/lib/components/sharing/ShareAccessComponent.js +36 -23
  193. package/lib/components/sharing/SharingEditor.d.ts +17 -0
  194. package/lib/components/sharing/SharingEditor.js +0 -24
  195. package/lib/components/sparklines/Sparklines.js +3 -4
  196. package/lib/components/sparklines/index.js +0 -4
  197. package/lib/components/storage/ContentsBrowser.d.ts +25 -1
  198. package/lib/components/storage/ContentsBrowser.js +145 -52
  199. package/lib/components/storage/ContentsBrowserMock.d.ts +3 -0
  200. package/lib/components/storage/ContentsBrowserMock.js +75 -0
  201. package/lib/components/storage/ContentsItems.d.ts +2 -1
  202. package/lib/components/storage/ContentsItems.js +0 -4
  203. package/lib/components/storage/ContentsTable.d.ts +50 -0
  204. package/lib/components/storage/ContentsTable.js +134 -0
  205. package/lib/components/storage/HomeFolderDrive.d.ts +71 -0
  206. package/lib/components/storage/HomeFolderDrive.js +248 -0
  207. package/lib/components/storage/index.d.ts +2 -0
  208. package/lib/components/storage/index.js +2 -0
  209. package/lib/components/students/StudentItemStatus.d.ts +1 -1
  210. package/lib/components/students/StudentResultCircle.d.ts +1 -1
  211. package/lib/components/subnav/SubNav.d.ts +5 -5
  212. package/lib/components/subnav/SubNav.js +11 -9
  213. package/lib/components/tables/DataTable.d.ts +1 -1
  214. package/lib/components/text-reveal/TextRevealAnimation.d.ts +2 -2
  215. package/lib/components/text-reveal/useTextRevealAnimationLines.d.ts +1 -1
  216. package/lib/components/time/LiveRelativeTime.d.ts +1 -0
  217. package/lib/components/time/LiveRelativeTime.js +0 -8
  218. package/lib/components/time/index.js +0 -4
  219. package/lib/components/timeline/Timeline.d.ts +1 -1
  220. package/lib/components/timeline/index.js +0 -4
  221. package/lib/components/users/PeerIndicator.d.ts +1 -0
  222. package/lib/components/users/PeerIndicator.js +0 -4
  223. package/lib/config/Configuration.d.ts +15 -17
  224. package/lib/config/Configuration.js +7 -0
  225. package/lib/hooks/index.d.ts +2 -0
  226. package/lib/hooks/index.js +2 -0
  227. package/lib/hooks/layouts/LayoutBackdrop.d.ts +1 -1
  228. package/lib/hooks/layouts/LayoutScreencapture.d.ts +1 -1
  229. package/lib/hooks/useBackdrop.d.ts +1 -1
  230. package/lib/hooks/useBackdropJupyterLab.d.ts +3 -2
  231. package/lib/hooks/useBackdropJupyterLab.js +0 -4
  232. package/lib/hooks/useCache.d.ts +310 -105
  233. package/lib/hooks/useCache.js +142 -355
  234. package/lib/hooks/useContainsFocus.d.ts +1 -1
  235. package/lib/hooks/useContents.d.ts +313 -0
  236. package/lib/hooks/useContents.js +964 -0
  237. package/lib/hooks/useFocusTrap.d.ts +4 -4
  238. package/lib/hooks/useFocusTrap.js +1 -1
  239. package/lib/hooks/useMcp.d.ts +229 -0
  240. package/lib/hooks/useMcp.js +656 -0
  241. package/lib/hooks/useMobile.js +0 -5
  242. package/lib/hooks/useProjectStore.d.ts +3 -3
  243. package/lib/hooks/useProjectStore.js +4 -4
  244. package/lib/hooks/useRef.d.ts +1 -1
  245. package/lib/hooks/useRef.js +3 -0
  246. package/lib/hooks/useScreencapture.d.ts +2 -1
  247. package/lib/hooks/useScreencapture.js +0 -4
  248. package/lib/hooks/useToast.js +0 -4
  249. package/lib/hooks/useVisibilityObserver.d.ts +1 -1
  250. package/lib/index.d.ts +4 -1
  251. package/lib/index.js +3 -1
  252. package/lib/mocks/components/FlashMock.d.ts +1 -1
  253. package/lib/mocks/views/ActionMenuMock.d.ts +1 -1
  254. package/lib/mocks/views/ChartMock.d.ts +1 -1
  255. package/lib/mocks/views/DashboardMock.d.ts +1 -1
  256. package/lib/mocks/views/FormMock.d.ts +1 -1
  257. package/lib/mocks/views/TableMock.d.ts +1 -1
  258. package/lib/mocks/views/WipMock.d.ts +1 -1
  259. package/lib/models/Credits.d.ts +16 -0
  260. package/lib/models/Credits.js +22 -0
  261. package/lib/models/McpAuditEvent.d.ts +52 -0
  262. package/lib/models/McpAuditEvent.js +5 -0
  263. package/lib/models/McpBinding.d.ts +51 -0
  264. package/lib/models/McpBinding.js +5 -0
  265. package/lib/models/McpPolicy.d.ts +77 -0
  266. package/lib/models/McpPolicy.js +5 -0
  267. package/lib/models/McpTask.d.ts +94 -0
  268. package/lib/models/McpTask.js +7 -0
  269. package/lib/models/StartedBy.d.ts +57 -0
  270. package/lib/models/StartedBy.js +81 -0
  271. package/lib/models/UserDTO.js +4 -2
  272. package/lib/models/contents/__fixtures__/solr-codec.json +57 -0
  273. package/lib/models/contents/__fixtures__/v1-contracts.json +66 -0
  274. package/lib/models/contents/fieldCase.d.ts +8 -0
  275. package/lib/models/contents/fieldCase.js +37 -0
  276. package/lib/models/contents/index.d.ts +2 -0
  277. package/lib/models/contents/index.js +6 -0
  278. package/lib/models/contents/permissions.d.ts +16 -0
  279. package/lib/models/contents/permissions.js +34 -0
  280. package/lib/models/index.d.ts +5 -1
  281. package/lib/models/index.js +5 -1
  282. package/lib/state/substates/CoreState.d.ts +15 -7
  283. package/lib/state/substates/CoreState.js +18 -14
  284. package/lib/state/substates/IAMState.d.ts +1 -1
  285. package/lib/state/substates/IAMState.js +5 -5
  286. package/lib/state/substates/ProfileState.js +0 -4
  287. package/lib/state/substates/index.d.ts +0 -1
  288. package/lib/state/substates/index.js +0 -1
  289. package/lib/utils/Jwt.d.ts +26 -0
  290. package/lib/utils/Jwt.js +37 -0
  291. package/lib/utils/WithSuspense.d.ts +1 -1
  292. package/lib/views/api-keys/APIKeyEdit.d.ts +1 -1
  293. package/lib/views/api-keys/APIKeyNew.d.ts +1 -1
  294. package/lib/views/api-keys/APIKeys.d.ts +1 -1
  295. package/lib/views/api-keys/APIKeys.js +30 -4
  296. package/lib/views/api-keys/APIKeysStandalone.d.ts +5 -1
  297. package/lib/views/api-keys/APIKeysStandalone.js +2 -2
  298. package/lib/views/datasources/DatasourceDetail.d.ts +12 -5
  299. package/lib/views/datasources/DatasourceDetail.js +80 -110
  300. package/lib/views/datasources/DatasourceNew.d.ts +14 -8
  301. package/lib/views/datasources/DatasourceNew.js +129 -118
  302. package/lib/views/datasources/Datasources.d.ts +39 -7
  303. package/lib/views/datasources/Datasources.js +95 -40
  304. package/lib/views/datasources/DatasourcesMock.d.ts +3 -0
  305. package/lib/views/datasources/DatasourcesMock.js +57 -0
  306. package/lib/views/iam/SignInSimple.d.ts +12 -0
  307. package/lib/views/iam/SignInSimple.js +4 -4
  308. package/lib/views/index.d.ts +1 -0
  309. package/lib/views/index.js +1 -0
  310. package/lib/views/mcp/AlertDestinations.d.ts +34 -0
  311. package/lib/views/mcp/AlertDestinations.js +75 -0
  312. package/lib/views/mcp/AlertRules.d.ts +32 -0
  313. package/lib/views/mcp/AlertRules.js +245 -0
  314. package/lib/views/mcp/AuditLog.d.ts +42 -0
  315. package/lib/views/mcp/AuditLog.js +144 -0
  316. package/lib/views/mcp/ConnectedAgents.d.ts +34 -0
  317. package/lib/views/mcp/ConnectedAgents.js +100 -0
  318. package/lib/views/mcp/EnterpriseConsole.d.ts +74 -0
  319. package/lib/views/mcp/EnterpriseConsole.js +173 -0
  320. package/lib/views/mcp/McpDashboard.d.ts +50 -0
  321. package/lib/views/mcp/McpDashboard.js +347 -0
  322. package/lib/views/mcp/McpHome.d.ts +92 -0
  323. package/lib/views/mcp/McpHome.js +153 -0
  324. package/lib/views/mcp/McpObservability.d.ts +50 -0
  325. package/lib/views/mcp/McpObservability.js +150 -0
  326. package/lib/views/mcp/OrganizationPolicy.d.ts +45 -0
  327. package/lib/views/mcp/OrganizationPolicy.js +107 -0
  328. package/lib/views/mcp/OrganizationUsage.d.ts +69 -0
  329. package/lib/views/mcp/OrganizationUsage.js +113 -0
  330. package/lib/views/mcp/PersonalPolicy.d.ts +54 -0
  331. package/lib/views/mcp/PersonalPolicy.js +125 -0
  332. package/lib/views/mcp/Policies.d.ts +53 -0
  333. package/lib/views/mcp/Policies.js +210 -0
  334. package/lib/views/mcp/PolicyForm.d.ts +67 -0
  335. package/lib/views/mcp/PolicyForm.js +91 -0
  336. package/lib/views/mcp/PolicyHistory.d.ts +45 -0
  337. package/lib/views/mcp/PolicyHistory.js +62 -0
  338. package/lib/views/mcp/ServiceAgents.d.ts +46 -0
  339. package/lib/views/mcp/ServiceAgents.js +194 -0
  340. package/lib/views/mcp/TeamPolicies.d.ts +33 -0
  341. package/lib/views/mcp/TeamPolicies.js +98 -0
  342. package/lib/views/mcp/format.d.ts +25 -0
  343. package/lib/views/mcp/format.js +77 -0
  344. package/lib/views/mcp/index.d.ts +29 -0
  345. package/lib/views/mcp/index.js +37 -0
  346. package/lib/views/mcp/types.d.ts +66 -0
  347. package/lib/views/mcp/types.js +5 -0
  348. package/lib/views/secrets/SecretEdit.d.ts +5 -1
  349. package/lib/views/secrets/SecretEdit.js +2 -2
  350. package/lib/views/secrets/SecretNew.d.ts +11 -1
  351. package/lib/views/secrets/SecretNew.js +2 -2
  352. package/lib/views/secrets/Secrets.d.ts +12 -1
  353. package/lib/views/secrets/Secrets.js +2 -2
  354. package/package.json +28 -24
  355. package/scripts/generate-contents-types.py +169 -0
  356. package/scripts/generate-mcp-types.py +233 -0
  357. package/lib/api/iam/datasources.d.ts +0 -86
  358. package/lib/api/iam/datasources.js +0 -185
  359. package/lib/components/toolbars/index.d.ts +0 -1
  360. package/lib/models/Datasource.d.ts +0 -181
  361. package/lib/models/Datasource.js +0 -154
  362. package/lib/state/substates/DatasourceState.d.ts +0 -11
  363. package/lib/state/substates/DatasourceState.js +0 -16
  364. /package/lib/{components/toolbars/index.js → api/contents/generated.js} +0 -0
@@ -0,0 +1,119 @@
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 convertRequest = (value) => contentsToSnakeCase(value);
9
+ const convertResponse = (value) => contentsToCamelCase(value);
10
+ const sourceUrl = (baseUrl, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources${suffix}`;
11
+ const requiredEtag = (headers) => {
12
+ const etag = headers.etag ?? headers.ETag;
13
+ if (!etag) {
14
+ throw new Error('Contents response did not include an ETag');
15
+ }
16
+ return etag;
17
+ };
18
+ export const listSources = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
19
+ const parameters = new URLSearchParams();
20
+ parameters.set('limit', String(options.limit ?? 50));
21
+ if (options.kind) {
22
+ parameters.set('kind', options.kind);
23
+ }
24
+ if (options.spaceUid) {
25
+ parameters.set('space_uid', options.spaceUid);
26
+ }
27
+ if (options.cursor) {
28
+ parameters.set('cursor', options.cursor);
29
+ }
30
+ const value = await requestDatalayerAPI({
31
+ url: `${sourceUrl(baseUrl)}?${parameters.toString()}`,
32
+ method: 'GET',
33
+ token,
34
+ });
35
+ return convertResponse(value);
36
+ };
37
+ export const createSource = async (token, source, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
38
+ const response = await requestDatalayerAPIWithResponse({
39
+ url: sourceUrl(baseUrl),
40
+ method: 'POST',
41
+ token,
42
+ headers: { 'Idempotency-Key': idempotencyKey },
43
+ body: convertRequest(source),
44
+ });
45
+ return {
46
+ value: convertResponse(response.data),
47
+ etag: requiredEtag(response.headers),
48
+ };
49
+ };
50
+ export const getSource = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
51
+ const response = await requestDatalayerAPIWithResponse({
52
+ url: sourceUrl(baseUrl, `/${encodeURIComponent(sourceUid)}`),
53
+ method: 'GET',
54
+ token,
55
+ });
56
+ return {
57
+ value: convertResponse(response.data),
58
+ etag: requiredEtag(response.headers),
59
+ };
60
+ };
61
+ export const getHomeFolder = async (token, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
62
+ const response = await requestDatalayerAPIWithResponse({
63
+ url: sourceUrl(baseUrl, '/home-folder'),
64
+ method: 'GET',
65
+ token,
66
+ });
67
+ return {
68
+ value: convertResponse(response.data),
69
+ etag: requiredEtag(response.headers),
70
+ };
71
+ };
72
+ export const updateSource = async (token, sourceUid, update, etag, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
73
+ const response = await requestDatalayerAPIWithResponse({
74
+ url: sourceUrl(baseUrl, `/${encodeURIComponent(sourceUid)}`),
75
+ method: 'PATCH',
76
+ token,
77
+ headers: { 'If-Match': etag },
78
+ body: convertRequest(update),
79
+ });
80
+ return {
81
+ value: convertResponse(response.data),
82
+ etag: requiredEtag(response.headers),
83
+ };
84
+ };
85
+ export const archiveSource = async (token, sourceUid, etag, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
86
+ const response = await requestDatalayerAPIWithResponse({
87
+ url: sourceUrl(baseUrl, `/${encodeURIComponent(sourceUid)}`),
88
+ method: 'DELETE',
89
+ token,
90
+ headers: { 'If-Match': etag },
91
+ });
92
+ return {
93
+ value: convertResponse(response.data),
94
+ etag: requiredEtag(response.headers),
95
+ };
96
+ };
97
+ export const getSourcePermissions = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
98
+ url: sourceUrl(baseUrl, `/${encodeURIComponent(sourceUid)}/permissions`),
99
+ method: 'GET',
100
+ token,
101
+ }));
102
+ export const getSourceSharing = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
103
+ url: sourceUrl(baseUrl, `/${encodeURIComponent(sourceUid)}/sharing`),
104
+ method: 'GET',
105
+ token,
106
+ }));
107
+ export const replaceSourceSharing = async (token, sourceUid, sharing, etag, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
108
+ const response = await requestDatalayerAPIWithResponse({
109
+ url: sourceUrl(baseUrl, `/${encodeURIComponent(sourceUid)}/sharing`),
110
+ method: 'PUT',
111
+ token,
112
+ headers: { 'If-Match': etag },
113
+ body: convertRequest(sharing),
114
+ });
115
+ return {
116
+ value: convertResponse(response.data),
117
+ etag: requiredEtag(response.headers),
118
+ };
119
+ };
@@ -0,0 +1,18 @@
1
+ import type { ConflictResolution, SyncConflictList, SyncCreate, SyncReconcile, SyncReport, SyncSessionList, SyncSessionView } from './generated';
2
+ /** Open a synchronization session; the answer carries the first plan. */
3
+ export declare const createSyncSession: (token: string, request: SyncCreate, idempotencyKey: string, baseUrl?: string) => Promise<SyncSessionView>;
4
+ export declare const getSyncSession: (token: string, sessionUid: string, baseUrl?: string) => Promise<SyncSessionView>;
5
+ export declare const listSyncSessions: (token: string, options?: {
6
+ active?: boolean;
7
+ cursor?: string;
8
+ limit?: number;
9
+ }, baseUrl?: string) => Promise<SyncSessionList>;
10
+ /** A fresh local manifest; a fresh plan. A watch pass and a reconnect both. */
11
+ export declare const reconcileSyncSession: (token: string, sessionUid: string, request: SyncReconcile, baseUrl?: string) => Promise<SyncSessionView>;
12
+ export declare const heartbeatSyncSession: (token: string, sessionUid: string, baseUrl?: string) => Promise<SyncSessionView>;
13
+ export declare const reportSyncSession: (token: string, sessionUid: string, request: SyncReport, baseUrl?: string) => Promise<SyncSessionView>;
14
+ export declare const cancelSyncSession: (token: string, sessionUid: string, baseUrl?: string) => Promise<SyncSessionView>;
15
+ export declare const listSyncConflicts: (token: string, sessionUid: string, options?: {
16
+ openOnly?: boolean;
17
+ }, baseUrl?: string) => Promise<SyncConflictList>;
18
+ export declare const resolveSyncConflict: (token: string, sessionUid: string, conflictUid: string, request: ConflictResolution, baseUrl?: string) => Promise<SyncSessionView>;
@@ -0,0 +1,69 @@
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, contentsToSnakeCase } from '../../models/contents/index.js';
8
+ const convertResponse = (value) => contentsToCamelCase(value);
9
+ const convertRequest = (value) => contentsToSnakeCase(value);
10
+ const syncUrl = (baseUrl, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sync${suffix}`;
11
+ /** Open a synchronization session; the answer carries the first plan. */
12
+ export const createSyncSession = async (token, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
13
+ url: syncUrl(baseUrl),
14
+ method: 'POST',
15
+ token,
16
+ headers: { 'Idempotency-Key': idempotencyKey },
17
+ body: convertRequest(request),
18
+ }));
19
+ export const getSyncSession = async (token, sessionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
20
+ url: syncUrl(baseUrl, `/${encodeURIComponent(sessionUid)}`),
21
+ method: 'GET',
22
+ token,
23
+ }));
24
+ export const listSyncSessions = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
25
+ const parameters = new URLSearchParams();
26
+ parameters.set('active', String(options.active ?? false));
27
+ parameters.set('limit', String(options.limit ?? 50));
28
+ if (options.cursor)
29
+ parameters.set('cursor', options.cursor);
30
+ return convertResponse(await requestDatalayerAPI({
31
+ url: `${syncUrl(baseUrl)}?${parameters.toString()}`,
32
+ method: 'GET',
33
+ token,
34
+ }));
35
+ };
36
+ /** A fresh local manifest; a fresh plan. A watch pass and a reconnect both. */
37
+ export const reconcileSyncSession = async (token, sessionUid, request, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
38
+ url: syncUrl(baseUrl, `/${encodeURIComponent(sessionUid)}/reconcile`),
39
+ method: 'POST',
40
+ token,
41
+ body: convertRequest(request),
42
+ }));
43
+ export const heartbeatSyncSession = async (token, sessionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
44
+ url: syncUrl(baseUrl, `/${encodeURIComponent(sessionUid)}/heartbeat`),
45
+ method: 'POST',
46
+ token,
47
+ }));
48
+ export const reportSyncSession = async (token, sessionUid, request, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
49
+ url: syncUrl(baseUrl, `/${encodeURIComponent(sessionUid)}/report`),
50
+ method: 'POST',
51
+ token,
52
+ body: convertRequest(request),
53
+ }));
54
+ export const cancelSyncSession = async (token, sessionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
55
+ url: syncUrl(baseUrl, `/${encodeURIComponent(sessionUid)}`),
56
+ method: 'DELETE',
57
+ token,
58
+ }));
59
+ export const listSyncConflicts = async (token, sessionUid, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
60
+ url: syncUrl(baseUrl, `/${encodeURIComponent(sessionUid)}/conflicts?open_only=${String(options.openOnly ?? false)}`),
61
+ method: 'GET',
62
+ token,
63
+ }));
64
+ export const resolveSyncConflict = async (token, sessionUid, conflictUid, request, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
65
+ url: syncUrl(baseUrl, `/${encodeURIComponent(sessionUid)}/conflicts/${encodeURIComponent(conflictUid)}/resolve`),
66
+ method: 'POST',
67
+ token,
68
+ body: convertRequest(request),
69
+ }));
@@ -0,0 +1,38 @@
1
+ import type { TransferCreate, TransferList, TransferView } from './generated';
2
+ export declare const createTransfer: (token: string, request: TransferCreate, idempotencyKey: string, baseUrl?: string) => Promise<TransferView>;
3
+ export declare const getTransfer: (token: string, transferUid: string, baseUrl?: string) => Promise<TransferView>;
4
+ export declare const listTransfers: (token: string, options?: {
5
+ active?: boolean;
6
+ cursor?: string;
7
+ limit?: number;
8
+ }, baseUrl?: string) => Promise<TransferList>;
9
+ export declare const uploadTransferPart: (token: string, transferUid: string, partNumber: number, content: Uint8Array, checksum: string, baseUrl?: string) => Promise<TransferView>;
10
+ export declare const completeTransfer: (token: string, transferUid: string, baseUrl?: string) => Promise<TransferView>;
11
+ export declare const cancelTransfer: (token: string, transferUid: string, baseUrl?: string) => Promise<TransferView>;
12
+ export type DownloadedObject = {
13
+ data: ArrayBuffer;
14
+ status: number;
15
+ headers: Record<string, string>;
16
+ };
17
+ export declare const downloadHomeFolderObject: (token: string, objectUid: string, options?: {
18
+ versionUid?: string;
19
+ range?: string;
20
+ }, baseUrl?: string) => Promise<DownloadedObject>;
21
+ export type UploadProgress = {
22
+ transferUid: string;
23
+ uploadedBytes: number;
24
+ totalBytes: number;
25
+ };
26
+ export type UploadOptions = {
27
+ idempotencyKey: string;
28
+ mediaType?: string;
29
+ overwrite?: 'reject' | 'replace' | 'new-version';
30
+ chunkSize?: number;
31
+ onProgress?: (progress: UploadProgress) => void;
32
+ };
33
+ /** Create or resume a checksummed multipart upload into the Home Folder and atomically finalize it. */
34
+ export declare const uploadHomeFolderFile: (token: string, path: string, content: Blob | Uint8Array | ArrayBuffer, options: UploadOptions, baseUrl?: string) => Promise<TransferView>;
35
+ /** Capture a file into a Dataset: the same transfer, landing as a version a revision can pin. */
36
+ export declare const uploadDatasetFile: (token: string, datasetUid: string, path: string, content: Blob | Uint8Array | ArrayBuffer, options: UploadOptions, baseUrl?: string) => Promise<TransferView>;
37
+ /** Create or resume a checksummed multipart upload to any destination the service accepts. */
38
+ export declare const uploadFile: (token: string, destinationUri: string, content: Blob | Uint8Array | ArrayBuffer, options: UploadOptions, baseUrl?: string) => Promise<TransferView>;
@@ -0,0 +1,123 @@
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 convertResponse = (value) => contentsToCamelCase(value);
9
+ const transferUrl = (baseUrl, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/transfers${suffix}`;
10
+ export const createTransfer = async (token, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
11
+ url: transferUrl(baseUrl),
12
+ method: 'POST',
13
+ token,
14
+ headers: { 'Idempotency-Key': idempotencyKey },
15
+ body: contentsToSnakeCase(request),
16
+ }));
17
+ export const getTransfer = async (token, transferUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
18
+ url: transferUrl(baseUrl, `/${encodeURIComponent(transferUid)}`),
19
+ method: 'GET',
20
+ token,
21
+ }));
22
+ export const listTransfers = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
23
+ const parameters = new URLSearchParams();
24
+ parameters.set('active', String(options.active ?? false));
25
+ parameters.set('limit', String(options.limit ?? 50));
26
+ if (options.cursor)
27
+ parameters.set('cursor', options.cursor);
28
+ return convertResponse(await requestDatalayerAPI({
29
+ url: `${transferUrl(baseUrl)}?${parameters.toString()}`,
30
+ method: 'GET',
31
+ token,
32
+ }));
33
+ };
34
+ export const uploadTransferPart = async (token, transferUid, partNumber, content, checksum, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
35
+ url: transferUrl(baseUrl, `/${encodeURIComponent(transferUid)}/parts/${partNumber}`),
36
+ method: 'PUT',
37
+ token,
38
+ headers: {
39
+ 'Content-Type': 'application/octet-stream',
40
+ 'Content-SHA256': checksum,
41
+ },
42
+ body: content,
43
+ }));
44
+ export const completeTransfer = async (token, transferUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
45
+ url: transferUrl(baseUrl, `/${encodeURIComponent(transferUid)}/complete`),
46
+ method: 'POST',
47
+ token,
48
+ }));
49
+ export const cancelTransfer = async (token, transferUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convertResponse(await requestDatalayerAPI({
50
+ url: transferUrl(baseUrl, `/${encodeURIComponent(transferUid)}`),
51
+ method: 'DELETE',
52
+ token,
53
+ }));
54
+ export const downloadHomeFolderObject = async (token, objectUid, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
55
+ const parameters = new URLSearchParams();
56
+ if (options.versionUid)
57
+ parameters.set('version_uid', options.versionUid);
58
+ const query = parameters.size ? `?${parameters.toString()}` : '';
59
+ const response = await requestDatalayerAPIWithResponse({
60
+ url: `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/home-folder/objects/${encodeURIComponent(objectUid)}/download${query}`,
61
+ method: 'GET',
62
+ token,
63
+ headers: options.range ? { Range: options.range } : {},
64
+ responseType: 'arraybuffer',
65
+ });
66
+ return {
67
+ data: response.data,
68
+ status: response.status,
69
+ headers: response.headers,
70
+ };
71
+ };
72
+ const bytes = async (content) => {
73
+ if (content instanceof Uint8Array)
74
+ return content;
75
+ if (content instanceof ArrayBuffer)
76
+ return new Uint8Array(content);
77
+ return new Uint8Array(await content.arrayBuffer());
78
+ };
79
+ const sha256 = async (content) => {
80
+ const copy = new Uint8Array(content.byteLength);
81
+ copy.set(content);
82
+ const digest = await crypto.subtle.digest('SHA-256', copy.buffer);
83
+ return Array.from(new Uint8Array(digest), value => value.toString(16).padStart(2, '0')).join('');
84
+ };
85
+ /** Create or resume a checksummed multipart upload into the Home Folder and atomically finalize it. */
86
+ export const uploadHomeFolderFile = async (token, path, content, options, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => uploadFile(token, `home-folder:///${path.replace(/^\/+/, '')}`, content, options, baseUrl);
87
+ /** Capture a file into a Dataset: the same transfer, landing as a version a revision can pin. */
88
+ export const uploadDatasetFile = async (token, datasetUid, path, content, options, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => uploadFile(token, `dataset://${datasetUid}/${path.replace(/^\/+/, '')}`, content, options, baseUrl);
89
+ /** Create or resume a checksummed multipart upload to any destination the service accepts. */
90
+ export const uploadFile = async (token, destinationUri, content, options, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
91
+ const payload = await bytes(content);
92
+ const checksum = await sha256(payload);
93
+ const transfer = await createTransfer(token, {
94
+ destinationUri,
95
+ size: payload.byteLength,
96
+ checksum,
97
+ mediaType: options.mediaType ?? 'application/octet-stream',
98
+ overwrite: options.overwrite ?? 'reject',
99
+ }, options.idempotencyKey, baseUrl);
100
+ // Resuming: the parts already verified fix the part size. Cutting the file
101
+ // differently would number the bytes differently, and a "verified" part
102
+ // would then be the wrong bytes.
103
+ const chunkSize = transfer.parts?.length
104
+ ? transfer.parts[0].size
105
+ : Math.max(256 * 1024, options.chunkSize ?? 8 * 1024 * 1024);
106
+ const verified = new Set((transfer.parts ?? []).map(part => part.number));
107
+ let uploadedBytes = (transfer.parts ?? []).reduce((total, part) => total + part.size, 0);
108
+ for (let offset = 0, number = 0; offset < payload.byteLength; number += 1) {
109
+ const end = Math.min(offset + chunkSize, payload.byteLength);
110
+ const part = payload.slice(offset, end);
111
+ if (!verified.has(number)) {
112
+ await uploadTransferPart(token, transfer.uid, number, part, await sha256(part), baseUrl);
113
+ uploadedBytes += part.byteLength;
114
+ options.onProgress?.({
115
+ transferUid: transfer.uid,
116
+ uploadedBytes,
117
+ totalBytes: payload.byteLength,
118
+ });
119
+ }
120
+ offset = end;
121
+ }
122
+ return completeTransfer(token, transfer.uid, baseUrl);
123
+ };
@@ -0,0 +1,39 @@
1
+ /** A scope in the words of the consent screen. */
2
+ export interface ConnectedAgentScope {
3
+ name: string;
4
+ title: string;
5
+ description: string;
6
+ }
7
+ /** How the client registered: by document URL, or the deprecated fallback. */
8
+ export type ConnectedAgentRegistration = 'cimd' | 'dcr';
9
+ export interface ConnectedAgent {
10
+ /** The grant's uid: what **Disconnect** names. */
11
+ uid: string;
12
+ clientId: string;
13
+ clientName: string;
14
+ /**
15
+ * The hostname of the client's document when it registered by URL — the
16
+ * part of a client's identity that cannot be invented, and what the
17
+ * consent screen showed. Empty for a DCR client.
18
+ */
19
+ clientHostname: string;
20
+ registration: ConnectedAgentRegistration;
21
+ scopes: string[];
22
+ scopeDetails: ConnectedAgentScope[];
23
+ /** The MCP resource the grant is for. */
24
+ resource: string;
25
+ createdAt?: string | null;
26
+ lastUsedAt?: string | null;
27
+ }
28
+ /**
29
+ * Whether a client id is a Client ID Metadata Document URL: `https`, a host
30
+ * and a path, no fragment. IAM answers `registration` itself; this is for a
31
+ * client id read from somewhere else, such as an audit row or a task.
32
+ */
33
+ export declare const isCimdClientId: (clientId: string) => boolean;
34
+ export declare const listConnectedAgents: (token: string, baseUrl?: string) => Promise<ConnectedAgent[]>;
35
+ /** Revoke one grant. A grant that is not the caller's is a `404`, not a revocation. */
36
+ export declare const disconnectAgent: (token: string, grantUid: string, baseUrl?: string) => Promise<{
37
+ success: boolean;
38
+ message?: string;
39
+ }>;
@@ -0,0 +1,52 @@
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
+ * The agents a person has connected: the OAuth grants IAM holds for them,
11
+ * one per client, with the scopes approved and when each was last used.
12
+ *
13
+ * Disconnecting revokes the grant: the refresh token stops working at once,
14
+ * and an access token the agent still holds dies with its own expiry, which
15
+ * is why they are short.
16
+ *
17
+ * @module api/iam/connectedAgents
18
+ */
19
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
20
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
21
+ const connectedAgentsUrl = (baseUrl, suffix = '') => `${baseUrl}${API_BASE_PATHS.IAM}/oauth/connected-agents${suffix}`;
22
+ /**
23
+ * Whether a client id is a Client ID Metadata Document URL: `https`, a host
24
+ * and a path, no fragment. IAM answers `registration` itself; this is for a
25
+ * client id read from somewhere else, such as an audit row or a task.
26
+ */
27
+ export const isCimdClientId = (clientId) => /^https:\/\/[^/?#]+\/[^#]*$/.test(clientId);
28
+ export const listConnectedAgents = async (token, baseUrl = DEFAULT_SERVICE_URLS.IAM) => {
29
+ const response = await requestDatalayerAPI({
30
+ url: connectedAgentsUrl(baseUrl),
31
+ method: 'GET',
32
+ token,
33
+ });
34
+ return (response.agents ?? []).map(agent => ({
35
+ uid: agent.uid,
36
+ clientId: agent.client_id ?? '',
37
+ clientName: agent.client_name ?? agent.client_id ?? '',
38
+ clientHostname: agent.client_hostname ?? '',
39
+ registration: agent.registration ?? 'dcr',
40
+ scopes: agent.scopes ?? [],
41
+ scopeDetails: agent.scope_details ?? [],
42
+ resource: agent.resource ?? '',
43
+ createdAt: agent.created_at ?? null,
44
+ lastUsedAt: agent.last_used_at ?? null,
45
+ }));
46
+ };
47
+ /** Revoke one grant. A grant that is not the caller's is a `404`, not a revocation. */
48
+ export const disconnectAgent = async (token, grantUid, baseUrl = DEFAULT_SERVICE_URLS.IAM) => requestDatalayerAPI({
49
+ url: connectedAgentsUrl(baseUrl, `/${encodeURIComponent(grantUid)}`),
50
+ method: 'DELETE',
51
+ token,
52
+ });
@@ -11,9 +11,10 @@ export * as profile from './profile';
11
11
  export * as healthz from './healthz';
12
12
  export * as usage from './usage';
13
13
  export * as secrets from './secrets';
14
- export * as datasources from './datasources';
14
+ export * as connectedAgents from './connectedAgents';
15
15
  export { login, logout, checkAuth } from './authentication';
16
16
  export { getOAuth2AuthzUrl, getOAuth2AuthzUrlForLink, handleGitHubOAuth2Callback, handleLinkedInOAuth2Callback, handleOktaOAuth2Callback, type OAuth2Provider, type OAuth2AuthzUrlResponse, type OAuth2CallbackParams, type OAuth2CallbackResponse, } from './oauth2';
17
17
  export { me, whoami } from './profile';
18
18
  export { ping } from './healthz';
19
19
  export { getCredits } from './usage';
20
+ export { listConnectedAgents, disconnectAgent, isCimdClientId, type ConnectedAgent, type ConnectedAgentRegistration, type ConnectedAgentScope, } from './connectedAgents';
@@ -15,10 +15,11 @@ export * as profile from './profile.js';
15
15
  export * as healthz from './healthz.js';
16
16
  export * as usage from './usage.js';
17
17
  export * as secrets from './secrets.js';
18
- export * as datasources from './datasources.js';
18
+ export * as connectedAgents from './connectedAgents.js';
19
19
  // For backward compatibility, export the old API structure
20
20
  export { login, logout, checkAuth } from './authentication.js';
21
21
  export { getOAuth2AuthzUrl, getOAuth2AuthzUrlForLink, handleGitHubOAuth2Callback, handleLinkedInOAuth2Callback, handleOktaOAuth2Callback, } from './oauth2.js';
22
22
  export { me, whoami } from './profile.js';
23
23
  export { ping } from './healthz.js';
24
24
  export { getCredits } from './usage.js';
25
+ export { listConnectedAgents, disconnectAgent, isCimdClientId, } from './connectedAgents.js';
@@ -0,0 +1,51 @@
1
+ /**
2
+ * What a rule may be about.
3
+ *
4
+ * Each name is answered by one reader in the gateway. `measurable` says
5
+ * whether a reader exists *today*: a condition with none is counted
6
+ * unreadable and never fires, which is exactly the silence rules are written
7
+ * to avoid — so a form shows it as not yet available rather than offering it
8
+ * as though it worked.
9
+ */
10
+ export declare const ALERT_CONDITIONS: {
11
+ name: string;
12
+ label: string;
13
+ help: string;
14
+ measurable: boolean;
15
+ }[];
16
+ /** How a reading is compared with the threshold. */
17
+ export declare const ALERT_OPERATORS: {
18
+ name: string;
19
+ label: string;
20
+ }[];
21
+ export declare const ALERT_SEVERITIES: readonly ["info", "warning", "critical"];
22
+ /** What a rule is measured over. */
23
+ export declare const ALERT_SCOPE_KINDS: readonly ["organization", "team", "user", "agent"];
24
+ export type AlertSeverity = (typeof ALERT_SEVERITIES)[number];
25
+ export type AlertScopeKind = (typeof ALERT_SCOPE_KINDS)[number];
26
+ export interface McpAlertRule {
27
+ uid: string;
28
+ orgUid: string;
29
+ condition: string;
30
+ operator: string;
31
+ threshold: number;
32
+ severity: AlertSeverity;
33
+ /** How far back a reading looks. Whole seconds — the tick is a minute. */
34
+ windowSeconds: number;
35
+ scopeKind: AlertScopeKind;
36
+ /** The team, user or agent the rule is about; empty for the organization. */
37
+ scopeUid: string;
38
+ enabled: boolean;
39
+ version?: number;
40
+ }
41
+ /** A rule as it is written. `uid` and `orgUid` come from the route. */
42
+ export type McpAlertRuleDraft = Omit<McpAlertRule, 'uid' | 'orgUid' | 'version'>;
43
+ /** Raised when the evaluator could not evaluate the rule as written. */
44
+ export declare class AlertRuleInvalid extends Error {
45
+ constructor(message: string);
46
+ }
47
+ export declare const listAlertRules: (token: string, orgUid: string, baseUrl?: string) => Promise<McpAlertRule[]>;
48
+ export declare const createAlertRule: (token: string, orgUid: string, rule: McpAlertRuleDraft, baseUrl?: string) => Promise<McpAlertRule>;
49
+ export declare const updateAlertRule: (token: string, orgUid: string, uid: string, rule: McpAlertRuleDraft, baseUrl?: string) => Promise<McpAlertRule>;
50
+ /** Remove one rule. What it watched is unwatched from the next tick. */
51
+ export declare const deleteAlertRule: (token: string, orgUid: string, uid: string, baseUrl?: string) => Promise<void>;