@everysk/apps-sdk 0.2.0 → 0.3.0-beta-20261019175049

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 (378) hide show
  1. package/README.md +342 -12
  2. package/dist/EveryskApp.d.ts +34 -2
  3. package/dist/EveryskApp.d.ts.map +1 -1
  4. package/dist/EveryskApp.js +35 -2
  5. package/dist/EveryskApp.js.map +1 -1
  6. package/dist/agGrid/handleRowsScrollEnd.d.ts +53 -0
  7. package/dist/agGrid/handleRowsScrollEnd.d.ts.map +1 -0
  8. package/dist/agGrid/handleRowsScrollEnd.js +47 -0
  9. package/dist/agGrid/handleRowsScrollEnd.js.map +1 -0
  10. package/dist/agGrid/index.d.ts +2 -0
  11. package/dist/agGrid/index.d.ts.map +1 -1
  12. package/dist/agGrid/index.js +2 -1
  13. package/dist/api/datastore.d.ts +10 -8
  14. package/dist/api/datastore.d.ts.map +1 -1
  15. package/dist/api/datastore.js +24 -55
  16. package/dist/api/datastore.js.map +1 -1
  17. package/dist/api/entityQuery.d.ts +46 -41
  18. package/dist/api/entityQuery.d.ts.map +1 -1
  19. package/dist/api/entityQuery.js +55 -14
  20. package/dist/api/entityQuery.js.map +1 -1
  21. package/dist/api/file.d.ts +26 -9
  22. package/dist/api/file.d.ts.map +1 -1
  23. package/dist/api/file.js +45 -55
  24. package/dist/api/file.js.map +1 -1
  25. package/dist/api/portfolio.d.ts +11 -8
  26. package/dist/api/portfolio.d.ts.map +1 -1
  27. package/dist/api/portfolio.js +24 -55
  28. package/dist/api/portfolio.js.map +1 -1
  29. package/dist/api/profile.d.ts +3 -2
  30. package/dist/api/profile.d.ts.map +1 -1
  31. package/dist/api/profile.js +4 -9
  32. package/dist/api/profile.js.map +1 -1
  33. package/dist/api/request.d.ts +106 -0
  34. package/dist/api/request.d.ts.map +1 -0
  35. package/dist/api/request.js +132 -0
  36. package/dist/api/request.js.map +1 -0
  37. package/dist/api/websocketsConfig.d.ts +7 -2
  38. package/dist/api/websocketsConfig.d.ts.map +1 -1
  39. package/dist/api/websocketsConfig.js +2 -10
  40. package/dist/api/websocketsConfig.js.map +1 -1
  41. package/dist/api/workflow.d.ts +84 -89
  42. package/dist/api/workflow.d.ts.map +1 -1
  43. package/dist/api/workflow.js +121 -208
  44. package/dist/api/workflow.js.map +1 -1
  45. package/dist/api/workspace.d.ts +18 -8
  46. package/dist/api/workspace.d.ts.map +1 -1
  47. package/dist/api/workspace.js +21 -26
  48. package/dist/api/workspace.js.map +1 -1
  49. package/dist/components/ui/Footer/index.d.ts.map +1 -1
  50. package/dist/components/ui/Footer/index.js.map +1 -1
  51. package/dist/components/ui/GlobalLoading/index.d.ts.map +1 -1
  52. package/dist/components/ui/GlobalLoading/index.js.map +1 -1
  53. package/dist/components/ui/PageContainer/index.d.ts +1 -1
  54. package/dist/components/ui/PageContainer/index.d.ts.map +1 -1
  55. package/dist/components/ui/PageContainer/index.js.map +1 -1
  56. package/dist/components/ui/Toolbar/index.d.ts +40 -3
  57. package/dist/components/ui/Toolbar/index.d.ts.map +1 -1
  58. package/dist/components/ui/Toolbar/index.js +42 -15
  59. package/dist/components/ui/Toolbar/index.js.map +1 -1
  60. package/dist/contexts/appAlertContext/provider.js.map +1 -1
  61. package/dist/contexts/appAlertContext/types.d.ts.map +1 -1
  62. package/dist/contexts/appConfigContext/index.d.ts.map +1 -1
  63. package/dist/contexts/appConfigContext/index.js.map +1 -1
  64. package/dist/contexts/appConfigContext/provider.d.ts.map +1 -1
  65. package/dist/contexts/appConfigContext/provider.js.map +1 -1
  66. package/dist/contexts/webSocketContext/handler.d.ts +3 -2
  67. package/dist/contexts/webSocketContext/handler.d.ts.map +1 -1
  68. package/dist/contexts/webSocketContext/handler.js.map +1 -1
  69. package/dist/contexts/webSocketContext/hooks/useWebSocket/index.d.ts +1 -1
  70. package/dist/contexts/webSocketContext/hooks/useWebSocket/index.js +1 -1
  71. package/dist/contexts/webSocketContext/hooks/useWebSocket/index.js.map +1 -1
  72. package/dist/contexts/webSocketContext/provider.d.ts +6 -3
  73. package/dist/contexts/webSocketContext/provider.d.ts.map +1 -1
  74. package/dist/contexts/webSocketContext/provider.js +42 -7
  75. package/dist/contexts/webSocketContext/provider.js.map +1 -1
  76. package/dist/contexts/webSocketContext/types.d.ts +7 -5
  77. package/dist/contexts/webSocketContext/types.d.ts.map +1 -1
  78. package/dist/file/index.d.ts +2 -0
  79. package/dist/file/index.d.ts.map +1 -1
  80. package/dist/hooks/datastore/useDatastoreMutations.d.ts +4 -4
  81. package/dist/hooks/datastore/useDatastoreMutations.d.ts.map +1 -1
  82. package/dist/hooks/datastore/useDatastoreMutations.js +17 -55
  83. package/dist/hooks/datastore/useDatastoreMutations.js.map +1 -1
  84. package/dist/hooks/datastore/useFetchDatastore.d.ts +30 -41
  85. package/dist/hooks/datastore/useFetchDatastore.d.ts.map +1 -1
  86. package/dist/hooks/datastore/useFetchDatastore.js +25 -59
  87. package/dist/hooks/datastore/useFetchDatastore.js.map +1 -1
  88. package/dist/hooks/datastore/useFetchDatastores.d.ts +47 -52
  89. package/dist/hooks/datastore/useFetchDatastores.d.ts.map +1 -1
  90. package/dist/hooks/datastore/useFetchDatastores.js +55 -70
  91. package/dist/hooks/datastore/useFetchDatastores.js.map +1 -1
  92. package/dist/hooks/file/fileData.d.ts +17 -0
  93. package/dist/hooks/file/fileData.d.ts.map +1 -0
  94. package/dist/hooks/file/fileData.js +10 -0
  95. package/dist/hooks/file/fileData.js.map +1 -0
  96. package/dist/hooks/file/useFetchFile.d.ts +38 -58
  97. package/dist/hooks/file/useFetchFile.d.ts.map +1 -1
  98. package/dist/hooks/file/useFetchFile.js +26 -66
  99. package/dist/hooks/file/useFetchFile.js.map +1 -1
  100. package/dist/hooks/file/useFetchFiles.d.ts +18 -52
  101. package/dist/hooks/file/useFetchFiles.d.ts.map +1 -1
  102. package/dist/hooks/file/useFetchFiles.js +53 -69
  103. package/dist/hooks/file/useFetchFiles.js.map +1 -1
  104. package/dist/hooks/file/useFileMutations.d.ts +9 -8
  105. package/dist/hooks/file/useFileMutations.d.ts.map +1 -1
  106. package/dist/hooks/file/useFileMutations.js +23 -60
  107. package/dist/hooks/file/useFileMutations.js.map +1 -1
  108. package/dist/hooks/portfolio/useFetchPortfolio.d.ts +16 -50
  109. package/dist/hooks/portfolio/useFetchPortfolio.d.ts.map +1 -1
  110. package/dist/hooks/portfolio/useFetchPortfolio.js +15 -63
  111. package/dist/hooks/portfolio/useFetchPortfolio.js.map +1 -1
  112. package/dist/hooks/portfolio/useFetchPortfolios.d.ts +13 -52
  113. package/dist/hooks/portfolio/useFetchPortfolios.d.ts.map +1 -1
  114. package/dist/hooks/portfolio/useFetchPortfolios.js +29 -71
  115. package/dist/hooks/portfolio/useFetchPortfolios.js.map +1 -1
  116. package/dist/hooks/portfolio/usePortfolioMutations.d.ts +8 -8
  117. package/dist/hooks/portfolio/usePortfolioMutations.d.ts.map +1 -1
  118. package/dist/hooks/portfolio/usePortfolioMutations.js +20 -58
  119. package/dist/hooks/portfolio/usePortfolioMutations.js.map +1 -1
  120. package/dist/hooks/profile/useFetchProfile.d.ts +18 -44
  121. package/dist/hooks/profile/useFetchProfile.d.ts.map +1 -1
  122. package/dist/hooks/profile/useFetchProfile.js +16 -48
  123. package/dist/hooks/profile/useFetchProfile.js.map +1 -1
  124. package/dist/hooks/useAxios.js.map +1 -1
  125. package/dist/hooks/useEntityInfiniteQuery.d.ts +88 -0
  126. package/dist/hooks/useEntityInfiniteQuery.d.ts.map +1 -0
  127. package/dist/hooks/useEntityInfiniteQuery.js +111 -0
  128. package/dist/hooks/useEntityInfiniteQuery.js.map +1 -0
  129. package/dist/hooks/useEntityMutation.d.ts +47 -0
  130. package/dist/hooks/useEntityMutation.d.ts.map +1 -0
  131. package/dist/hooks/useEntityMutation.js +58 -0
  132. package/dist/hooks/useEntityMutation.js.map +1 -0
  133. package/dist/hooks/useEntityQuery.d.ts +68 -0
  134. package/dist/hooks/useEntityQuery.d.ts.map +1 -0
  135. package/dist/hooks/useEntityQuery.js +75 -0
  136. package/dist/hooks/useEntityQuery.js.map +1 -0
  137. package/dist/hooks/workflow/useFetchWorkerExecution.d.ts +17 -34
  138. package/dist/hooks/workflow/useFetchWorkerExecution.d.ts.map +1 -1
  139. package/dist/hooks/workflow/useFetchWorkerExecution.js +16 -46
  140. package/dist/hooks/workflow/useFetchWorkerExecution.js.map +1 -1
  141. package/dist/hooks/workflow/useFetchWorkerExecutions.d.ts +179 -41
  142. package/dist/hooks/workflow/useFetchWorkerExecutions.d.ts.map +1 -1
  143. package/dist/hooks/workflow/useFetchWorkerExecutions.js +29 -62
  144. package/dist/hooks/workflow/useFetchWorkerExecutions.js.map +1 -1
  145. package/dist/hooks/workflow/useFetchWorkflow.d.ts +16 -35
  146. package/dist/hooks/workflow/useFetchWorkflow.d.ts.map +1 -1
  147. package/dist/hooks/workflow/useFetchWorkflow.js +15 -48
  148. package/dist/hooks/workflow/useFetchWorkflow.js.map +1 -1
  149. package/dist/hooks/workflow/useFetchWorkflowExecution.d.ts +17 -34
  150. package/dist/hooks/workflow/useFetchWorkflowExecution.d.ts.map +1 -1
  151. package/dist/hooks/workflow/useFetchWorkflowExecution.js +16 -46
  152. package/dist/hooks/workflow/useFetchWorkflowExecution.js.map +1 -1
  153. package/dist/hooks/workflow/useFetchWorkflowExecutions.d.ts +22 -36
  154. package/dist/hooks/workflow/useFetchWorkflowExecutions.d.ts.map +1 -1
  155. package/dist/hooks/workflow/useFetchWorkflowExecutions.js +43 -56
  156. package/dist/hooks/workflow/useFetchWorkflowExecutions.js.map +1 -1
  157. package/dist/hooks/workflow/useFetchWorkflows.d.ts +20 -37
  158. package/dist/hooks/workflow/useFetchWorkflows.d.ts.map +1 -1
  159. package/dist/hooks/workflow/useFetchWorkflows.js +32 -47
  160. package/dist/hooks/workflow/useFetchWorkflows.js.map +1 -1
  161. package/dist/hooks/workflow/useRunWorkflow.d.ts +21 -16
  162. package/dist/hooks/workflow/useRunWorkflow.d.ts.map +1 -1
  163. package/dist/hooks/workflow/useRunWorkflow.js +66 -29
  164. package/dist/hooks/workflow/useRunWorkflow.js.map +1 -1
  165. package/dist/hooks/workflow/useTriggerWorkflow.d.ts +20 -0
  166. package/dist/hooks/workflow/useTriggerWorkflow.d.ts.map +1 -0
  167. package/dist/hooks/workflow/useTriggerWorkflow.js +32 -0
  168. package/dist/hooks/workflow/useTriggerWorkflow.js.map +1 -0
  169. package/dist/hooks/workspace/useFetchWorkspace.d.ts +19 -34
  170. package/dist/hooks/workspace/useFetchWorkspace.d.ts.map +1 -1
  171. package/dist/hooks/workspace/useFetchWorkspace.js +16 -46
  172. package/dist/hooks/workspace/useFetchWorkspace.js.map +1 -1
  173. package/dist/hooks/workspace/useFetchWorkspaces.d.ts +17 -37
  174. package/dist/hooks/workspace/useFetchWorkspaces.d.ts.map +1 -1
  175. package/dist/hooks/workspace/useFetchWorkspaces.js +25 -47
  176. package/dist/hooks/workspace/useFetchWorkspaces.js.map +1 -1
  177. package/dist/index.d.ts +13 -10
  178. package/dist/index.d.ts.map +1 -1
  179. package/dist/index.js +13 -11
  180. package/dist/lib/abort.d.ts +58 -0
  181. package/dist/lib/abort.d.ts.map +1 -0
  182. package/dist/lib/abort.js +112 -0
  183. package/dist/lib/abort.js.map +1 -0
  184. package/dist/lib/datastoreTable.d.ts +59 -54
  185. package/dist/lib/datastoreTable.d.ts.map +1 -1
  186. package/dist/lib/datastoreTable.js +58 -62
  187. package/dist/lib/datastoreTable.js.map +1 -1
  188. package/dist/lib/file.d.ts +34 -0
  189. package/dist/lib/file.d.ts.map +1 -0
  190. package/dist/lib/file.js +63 -0
  191. package/dist/lib/file.js.map +1 -0
  192. package/dist/lib/queryClient.d.ts.map +1 -1
  193. package/dist/lib/queryClient.js.map +1 -1
  194. package/dist/lib/workflowRun.d.ts +91 -0
  195. package/dist/lib/workflowRun.d.ts.map +1 -0
  196. package/dist/lib/workflowRun.js +224 -0
  197. package/dist/lib/workflowRun.js.map +1 -0
  198. package/dist/socket/index.d.ts +1 -3
  199. package/dist/socket/index.d.ts.map +1 -1
  200. package/dist/socket/index.js +3 -5
  201. package/dist/test/mocks/index.d.ts +1 -1
  202. package/dist/test/mocks/index.d.ts.map +1 -1
  203. package/dist/test/msw/fakeApi.d.ts +43 -0
  204. package/dist/test/msw/fakeApi.d.ts.map +1 -0
  205. package/dist/test/msw/fakeApi.js +74 -0
  206. package/dist/test/msw/fakeApi.js.map +1 -0
  207. package/dist/test/msw/handlers.d.ts +20 -0
  208. package/dist/test/msw/handlers.d.ts.map +1 -0
  209. package/dist/test/msw/handlers.js +279 -0
  210. package/dist/test/msw/handlers.js.map +1 -0
  211. package/dist/test/msw/index.d.ts +5 -0
  212. package/dist/test/msw/index.d.ts.map +1 -0
  213. package/dist/test/msw/index.js +2 -0
  214. package/dist/test/msw/query.d.ts +34 -0
  215. package/dist/test/msw/query.d.ts.map +1 -0
  216. package/dist/test/msw/query.js +96 -0
  217. package/dist/test/msw/query.js.map +1 -0
  218. package/dist/test/msw/recorder.d.ts +30 -0
  219. package/dist/test/msw/recorder.d.ts.map +1 -0
  220. package/dist/test/msw/recorder.js +65 -0
  221. package/dist/test/msw/recorder.js.map +1 -0
  222. package/dist/test/msw/store.d.ts +57 -0
  223. package/dist/test/msw/store.d.ts.map +1 -0
  224. package/dist/test/msw/store.js +145 -0
  225. package/dist/test/msw/store.js.map +1 -0
  226. package/dist/test/renderWithProviders.d.ts +2 -2
  227. package/dist/test/renderWithProviders.d.ts.map +1 -1
  228. package/dist/test/renderWithProviders.js.map +1 -1
  229. package/dist/test/setup.js.map +1 -1
  230. package/dist/theme/index.d.ts +1 -1
  231. package/dist/theme/index.d.ts.map +1 -1
  232. package/dist/theme/overrides/index.d.ts +4 -2
  233. package/dist/theme/overrides/index.d.ts.map +1 -1
  234. package/dist/theme/overrides/index.js +5 -3
  235. package/dist/theme/overrides/index.js.map +1 -1
  236. package/dist/theme/overrides/muiButton.d.ts +2 -2
  237. package/dist/theme/overrides/muiButton.js.map +1 -1
  238. package/dist/theme/overrides/muiCssBaseline.d.ts.map +1 -1
  239. package/dist/theme/overrides/muiCssBaseline.js.map +1 -1
  240. package/dist/theme/overrides/muiDatePicker.js.map +1 -1
  241. package/dist/theme/overrides/muiFormControl.js.map +1 -1
  242. package/dist/theme/overrides/muiIconButton.d.ts +2 -2
  243. package/dist/theme/overrides/muiIconButton.js.map +1 -1
  244. package/dist/theme/overrides/muiSelect.d.ts.map +1 -1
  245. package/dist/theme/overrides/muiSelect.js.map +1 -1
  246. package/dist/theme/overrides/muiSvgIcon.d.ts.map +1 -1
  247. package/dist/theme/overrides/muiSvgIcon.js.map +1 -1
  248. package/dist/theme/overrides/muiTextField.js.map +1 -1
  249. package/dist/theme/overrides/muiToggleButton.d.ts +2 -2
  250. package/dist/theme/overrides/muiToggleButton.js.map +1 -1
  251. package/dist/theme/overrides/muiToggleButtonGroup.d.ts +2 -2
  252. package/dist/theme/overrides/muiToggleButtonGroup.js.map +1 -1
  253. package/dist/theme/themes/DefaultDark.js +2 -2
  254. package/dist/theme/themes/DefaultDark.js.map +1 -1
  255. package/dist/theme/themes/DefaultLight.js +2 -2
  256. package/dist/theme/themes/DefaultLight.js.map +1 -1
  257. package/dist/theme/themes/EveryskDark.js +2 -2
  258. package/dist/theme/themes/EveryskDark.js.map +1 -1
  259. package/dist/theme/themes/EveryskLight.js +2 -2
  260. package/dist/theme/themes/EveryskLight.js.map +1 -1
  261. package/dist/theme/themes/MidnightEmber.js +2 -2
  262. package/dist/theme/themes/MidnightEmber.js.map +1 -1
  263. package/dist/types/anyRecord.d.ts.map +1 -1
  264. package/dist/types/datastore.d.ts +35 -5
  265. package/dist/types/datastore.d.ts.map +1 -1
  266. package/dist/types/datastoreDataFormat.d.ts +13 -0
  267. package/dist/types/datastoreDataFormat.d.ts.map +1 -0
  268. package/dist/types/entityQuery.d.ts +86 -16
  269. package/dist/types/entityQuery.d.ts.map +1 -1
  270. package/dist/types/file.d.ts +7 -3
  271. package/dist/types/file.d.ts.map +1 -1
  272. package/dist/types/portfolio.d.ts +1 -3
  273. package/dist/types/portfolio.d.ts.map +1 -1
  274. package/dist/types/profile.d.ts +0 -10
  275. package/dist/types/profile.d.ts.map +1 -1
  276. package/dist/types/workflow.d.ts +35 -6
  277. package/dist/types/workflow.d.ts.map +1 -1
  278. package/dist/types/workspace.d.ts +1 -2
  279. package/dist/types/workspace.d.ts.map +1 -1
  280. package/dist/ui/index.d.ts +1 -1
  281. package/dist/ui/index.d.ts.map +1 -1
  282. package/dist/workflow/index.d.ts +2 -0
  283. package/dist/workflow/index.d.ts.map +1 -1
  284. package/package.json +10 -1
  285. package/src/EveryskApp.tsx +53 -2
  286. package/src/agGrid/handleRowsScrollEnd.ts +71 -0
  287. package/src/agGrid/index.ts +5 -1
  288. package/src/api/datastore.ts +79 -107
  289. package/src/api/entityQuery.ts +86 -17
  290. package/src/api/file.ts +110 -103
  291. package/src/api/portfolio.ts +82 -125
  292. package/src/api/profile.ts +25 -18
  293. package/src/api/request.ts +168 -0
  294. package/src/api/websocketsConfig.ts +11 -19
  295. package/src/api/workflow.ts +232 -334
  296. package/src/api/workspace.ts +43 -43
  297. package/src/components/ui/Footer/index.tsx +8 -7
  298. package/src/components/ui/GlobalLoading/index.tsx +13 -3
  299. package/src/components/ui/PageContainer/index.tsx +9 -2
  300. package/src/components/ui/Toolbar/index.tsx +105 -30
  301. package/src/contexts/appAlertContext/provider.tsx +1 -1
  302. package/src/contexts/appAlertContext/types.ts +3 -3
  303. package/src/contexts/appConfigContext/index.tsx +1 -1
  304. package/src/contexts/appConfigContext/provider.tsx +1 -5
  305. package/src/contexts/webSocketContext/handler.ts +8 -2
  306. package/src/contexts/webSocketContext/hooks/useWebSocket/index.ts +1 -1
  307. package/src/contexts/webSocketContext/provider.tsx +64 -14
  308. package/src/contexts/webSocketContext/types.ts +7 -6
  309. package/src/file/index.ts +2 -0
  310. package/src/hooks/datastore/useDatastoreMutations.ts +19 -60
  311. package/src/hooks/datastore/useFetchDatastore.ts +45 -73
  312. package/src/hooks/datastore/useFetchDatastores.ts +106 -131
  313. package/src/hooks/file/fileData.ts +19 -0
  314. package/src/hooks/file/useFetchFile.ts +41 -76
  315. package/src/hooks/file/useFetchFiles.ts +92 -87
  316. package/src/hooks/file/useFileMutations.ts +23 -73
  317. package/src/hooks/portfolio/useFetchPortfolio.ts +26 -78
  318. package/src/hooks/portfolio/useFetchPortfolios.ts +50 -93
  319. package/src/hooks/portfolio/usePortfolioMutations.ts +22 -72
  320. package/src/hooks/profile/useFetchProfile.ts +24 -65
  321. package/src/hooks/useAxios.ts +5 -5
  322. package/src/hooks/useEntityInfiniteQuery.ts +193 -0
  323. package/src/hooks/useEntityMutation.ts +70 -0
  324. package/src/hooks/useEntityQuery.ts +117 -0
  325. package/src/hooks/workflow/useFetchWorkerExecution.ts +27 -56
  326. package/src/hooks/workflow/useFetchWorkerExecutions.ts +54 -79
  327. package/src/hooks/workflow/useFetchWorkflow.ts +24 -58
  328. package/src/hooks/workflow/useFetchWorkflowExecution.ts +27 -57
  329. package/src/hooks/workflow/useFetchWorkflowExecutions.ts +64 -73
  330. package/src/hooks/workflow/useFetchWorkflows.ts +48 -64
  331. package/src/hooks/workflow/useRunWorkflow.ts +82 -36
  332. package/src/hooks/workflow/useTriggerWorkflow.ts +36 -0
  333. package/src/hooks/workspace/useFetchWorkspace.ts +25 -58
  334. package/src/hooks/workspace/useFetchWorkspaces.ts +38 -69
  335. package/src/index.ts +34 -19
  336. package/src/lib/abort.ts +131 -0
  337. package/src/lib/datastoreTable.ts +127 -74
  338. package/src/lib/file.ts +67 -0
  339. package/src/lib/queryClient.ts +11 -13
  340. package/src/lib/workflowRun.ts +329 -0
  341. package/src/socket/index.ts +1 -3
  342. package/src/test/mocks/index.ts +1 -5
  343. package/src/test/msw/fakeApi.ts +83 -0
  344. package/src/test/msw/handlers.ts +350 -0
  345. package/src/test/msw/index.ts +9 -0
  346. package/src/test/msw/query.ts +134 -0
  347. package/src/test/msw/recorder.ts +88 -0
  348. package/src/test/msw/store.ts +182 -0
  349. package/src/test/renderWithProviders.tsx +8 -3
  350. package/src/test/setup.ts +16 -16
  351. package/src/theme/index.ts +1 -1
  352. package/src/theme/overrides/index.ts +5 -3
  353. package/src/theme/overrides/muiButton.ts +3 -3
  354. package/src/theme/overrides/muiCssBaseline.ts +11 -12
  355. package/src/theme/overrides/muiDatePicker.ts +2 -2
  356. package/src/theme/overrides/muiFormControl.ts +2 -2
  357. package/src/theme/overrides/muiIconButton.ts +3 -3
  358. package/src/theme/overrides/muiSelect.ts +2 -2
  359. package/src/theme/overrides/muiSvgIcon.ts +2 -2
  360. package/src/theme/overrides/muiTextField.ts +1 -1
  361. package/src/theme/overrides/muiToggleButton.ts +4 -4
  362. package/src/theme/overrides/muiToggleButtonGroup.ts +4 -4
  363. package/src/theme/themes/DefaultDark.ts +2 -2
  364. package/src/theme/themes/DefaultLight.ts +2 -2
  365. package/src/theme/themes/EveryskDark.ts +2 -2
  366. package/src/theme/themes/EveryskLight.ts +2 -2
  367. package/src/theme/themes/MidnightEmber.ts +15 -15
  368. package/src/types/anyRecord.ts +2 -2
  369. package/src/types/datastore.ts +56 -22
  370. package/src/types/datastoreDataFormat.ts +12 -0
  371. package/src/types/entityQuery.ts +122 -38
  372. package/src/types/file.ts +8 -6
  373. package/src/types/portfolio.ts +70 -74
  374. package/src/types/profile.ts +0 -11
  375. package/src/types/workflow.ts +38 -9
  376. package/src/types/workspace.ts +2 -4
  377. package/src/ui/index.ts +1 -1
  378. package/src/workflow/index.ts +5 -0
@@ -0,0 +1,182 @@
1
+ import { DEV_PROFILE } from "@/api/profile";
2
+ import type { WebsocketsConfig } from "@/api/websocketsConfig";
3
+ import type { Datastore } from "@/types/datastore";
4
+ import type { EveryskFile } from "@/types/file";
5
+ import type { Portfolio } from "@/types/portfolio";
6
+ import type { Profile } from "@/types/profile";
7
+ import type { Workflow, WorkflowExecution, WorkerExecution } from "@/types/workflow";
8
+ import type { Workspace } from "@/types/workspace";
9
+
10
+ /** What the fake API holds. A test seeds it and reads it back after a write. */
11
+ export type FakeApiStore = {
12
+ datastores: Datastore[];
13
+ files: EveryskFile[];
14
+ portfolios: Portfolio[];
15
+ workflows: Workflow[];
16
+ workflowExecutions: WorkflowExecution[];
17
+ workerExecutions: WorkerExecution[];
18
+ workspaces: Workspace[];
19
+ profile: Profile;
20
+ websocketsConfig: WebsocketsConfig;
21
+ };
22
+
23
+ /** What a test seeds: partial records, each completed with what its type requires. */
24
+ export type FakeApiSeed = {
25
+ datastores?: Partial<Datastore>[];
26
+ files?: Partial<EveryskFile>[];
27
+ portfolios?: Partial<Portfolio>[];
28
+ workflows?: Partial<Workflow>[];
29
+ workflowExecutions?: Partial<WorkflowExecution>[];
30
+ workerExecutions?: Partial<WorkerExecution>[];
31
+ workspaces?: (Partial<Workspace> & { name: string })[];
32
+ profile?: Profile;
33
+ websocketsConfig?: WebsocketsConfig;
34
+ };
35
+
36
+ export const newId = (prefix: string) =>
37
+ `${prefix}_${Array.from({ length: 25 }, () => Math.floor(Math.random() * 36).toString(36)).join("")}`;
38
+
39
+ /** The hex of a version-4 UUID, as a file's stored `url` is (`RE_FILE_URL`). */
40
+ export const newFileHash = () => crypto.randomUUID().replaceAll("-", "");
41
+
42
+ export const nowSeconds = () => Math.floor(Date.now() / 1000);
43
+
44
+ /**
45
+ * The fields each type requires and a test left out. `workspace` is `main`, as the API's create
46
+ * defaults it; the rest are blank, empty or zero rather than invented values.
47
+ */
48
+ export const complete = {
49
+ datastore: (d: Partial<Datastore>): Datastore => ({
50
+ name: "",
51
+ workspace: "main",
52
+ data: [],
53
+ date_time: "",
54
+ ...d,
55
+ id: d.id ?? newId("dats"),
56
+ }),
57
+ file: (f: Partial<EveryskFile>): EveryskFile => {
58
+ const hash = f.hash ?? newFileHash();
59
+ return {
60
+ name: "",
61
+ workspace: "main",
62
+ content_type: "",
63
+ version: "",
64
+ link_uid: null,
65
+ data: null,
66
+ ...f,
67
+ hash,
68
+ url: f.url ?? `/file/${hash}`,
69
+ id: f.id ?? newId("file"),
70
+ };
71
+ },
72
+ portfolio: (p: Partial<Portfolio>): Portfolio => ({
73
+ workspace: "main",
74
+ base_currency: "",
75
+ securities: [],
76
+ date: "",
77
+ ...p,
78
+ id: p.id ?? newId("port"),
79
+ }),
80
+ workflow: (w: Partial<Workflow>): Workflow => ({
81
+ name: "",
82
+ workspace: "main",
83
+ description: "",
84
+ tags: [],
85
+ status: "",
86
+ created: 0,
87
+ updated: 0,
88
+ version: "",
89
+ trigger_enabled: false,
90
+ trigger_type: "",
91
+ trigger_config: {},
92
+ starter_worker_id: "",
93
+ ender_worker_id: "",
94
+ ...w,
95
+ id: w.id ?? newId("wrkf"),
96
+ }),
97
+ workflowExecution: (e: Partial<WorkflowExecution>): WorkflowExecution => ({
98
+ workflow_id: "",
99
+ workflow_name: "",
100
+ workspace: "main",
101
+ status: "",
102
+ run_status: "",
103
+ duration: 0,
104
+ real_execution_time: 0,
105
+ total_execution_time: 0,
106
+ started: 0,
107
+ created: 0,
108
+ updated: 0,
109
+ trigger: "",
110
+ started_worker_id: "",
111
+ ender_worker_id: "",
112
+ ender_worker_execution_id: "",
113
+ resume: null,
114
+ version: "",
115
+ ...e,
116
+ id: e.id ?? newId("wfex"),
117
+ }),
118
+ workerExecution: (e: Partial<WorkerExecution>): WorkerExecution =>
119
+ ({
120
+ status: "",
121
+ worker_id: "",
122
+ worker_name: "",
123
+ worker_type: "",
124
+ workflow_execution_id: "",
125
+ workflow_id: "",
126
+ workflow_name: "",
127
+ trigger: "",
128
+ created: 0,
129
+ updated: 0,
130
+ started: 0,
131
+ duration: 0,
132
+ cpu_time: 0,
133
+ result: {},
134
+ input_params: {},
135
+ ...e,
136
+ id: e.id ?? newId("wkex"),
137
+ }) as WorkerExecution,
138
+ workspace: (w: Partial<Workspace> & { name: string }): Workspace => ({
139
+ group: null,
140
+ description: "",
141
+ version: "",
142
+ created: 0,
143
+ updated: 0,
144
+ ...w,
145
+ }),
146
+ };
147
+
148
+ const EMPTY_WEBSOCKETS_CONFIG: WebsocketsConfig = {
149
+ appConnectionURL: "",
150
+ appChannelID: "",
151
+ everyskUID: "",
152
+ };
153
+
154
+ /** An empty store: no records, the SDK's dev profile, a blank websocket config. */
155
+ export const emptyStore = (): FakeApiStore => ({
156
+ datastores: [],
157
+ files: [],
158
+ portfolios: [],
159
+ workflows: [],
160
+ workflowExecutions: [],
161
+ workerExecutions: [],
162
+ workspaces: [],
163
+ profile: structuredClone(DEV_PROFILE),
164
+ websocketsConfig: { ...EMPTY_WEBSOCKETS_CONFIG },
165
+ });
166
+
167
+ /** The store a seed describes: each record completed, everything not seeded empty. */
168
+ export const storeFrom = (seed: FakeApiSeed): FakeApiStore => {
169
+ const data = structuredClone(seed);
170
+ const empty = emptyStore();
171
+ return {
172
+ datastores: (data.datastores ?? []).map(complete.datastore),
173
+ files: (data.files ?? []).map(complete.file),
174
+ portfolios: (data.portfolios ?? []).map(complete.portfolio),
175
+ workflows: (data.workflows ?? []).map(complete.workflow),
176
+ workflowExecutions: (data.workflowExecutions ?? []).map(complete.workflowExecution),
177
+ workerExecutions: (data.workerExecutions ?? []).map(complete.workerExecution),
178
+ workspaces: (data.workspaces ?? []).map(complete.workspace),
179
+ profile: data.profile ?? empty.profile,
180
+ websocketsConfig: data.websocketsConfig ?? empty.websocketsConfig,
181
+ };
182
+ };
@@ -9,7 +9,7 @@ import {
9
9
  import userEvent from "@testing-library/user-event";
10
10
  import { QueryClient } from "@tanstack/react-query";
11
11
 
12
- import { EveryskApp, type ProviderComponent } from "@/EveryskApp";
12
+ import { EveryskApp, type ProviderEntry } from "@/EveryskApp";
13
13
  import type { AnyRecord } from "@/types/anyRecord";
14
14
 
15
15
  /**
@@ -39,14 +39,19 @@ export function createTestQueryClient(): QueryClient {
39
39
  type ProviderOptions = {
40
40
  queryClient?: QueryClient;
41
41
  /** Extra providers, mounted inside the core tree and around the subject. */
42
- providers?: ProviderComponent[];
42
+ providers?: ProviderEntry[];
43
43
  /** Injected instead of `window.APP_ID`, so a test needs no page globals. */
44
44
  appId?: string | null;
45
45
  /** Injected instead of `window.APP_CONFIG`. */
46
46
  appEnvironmentVar?: AnyRecord;
47
47
  };
48
48
 
49
- const buildWrapper = ({ queryClient, providers, appId, appEnvironmentVar }: ProviderOptions & {
49
+ const buildWrapper = ({
50
+ queryClient,
51
+ providers,
52
+ appId,
53
+ appEnvironmentVar,
54
+ }: ProviderOptions & {
50
55
  queryClient: QueryClient;
51
56
  }) =>
52
57
  function Wrapper({ children }: { children?: React.ReactNode }) {
package/src/test/setup.ts CHANGED
@@ -5,31 +5,31 @@ import "@testing-library/jest-dom/vitest";
5
5
 
6
6
  // Unmount React trees and clear the jsdom document between tests so they stay isolated.
7
7
  afterEach(() => {
8
- cleanup();
8
+ cleanup();
9
9
  });
10
10
 
11
11
  // jsdom does not implement matchMedia; MUI's `useMediaQuery` needs it. The theme no longer
12
12
  // reads it — it is pinned to the brand dark theme — but responsive components still do.
13
13
  if (!window.matchMedia) {
14
- window.matchMedia = vi.fn().mockImplementation((query: string) => ({
15
- matches: false,
16
- media: query,
17
- onchange: null,
18
- addListener: vi.fn(),
19
- removeListener: vi.fn(),
20
- addEventListener: vi.fn(),
21
- removeEventListener: vi.fn(),
22
- dispatchEvent: vi.fn(),
23
- }));
14
+ window.matchMedia = vi.fn().mockImplementation((query: string) => ({
15
+ matches: false,
16
+ media: query,
17
+ onchange: null,
18
+ addListener: vi.fn(),
19
+ removeListener: vi.fn(),
20
+ addEventListener: vi.fn(),
21
+ removeEventListener: vi.fn(),
22
+ dispatchEvent: vi.fn(),
23
+ }));
24
24
  }
25
25
 
26
26
  // jsdom does not implement ResizeObserver; several MUI components observe their container.
27
27
  if (!globalThis.ResizeObserver) {
28
- globalThis.ResizeObserver = class {
29
- observe(): void {}
30
- unobserve(): void {}
31
- disconnect(): void {}
32
- };
28
+ globalThis.ResizeObserver = class {
29
+ observe(): void {}
30
+ unobserve(): void {}
31
+ disconnect(): void {}
32
+ };
33
33
  }
34
34
 
35
35
  // The template stubbed `BroadcastChannel` here, which jsdom does not implement. Nothing in
@@ -12,4 +12,4 @@ export { EveryskDarkTheme } from "./themes/EveryskDark";
12
12
  export { DefaultLightTheme } from "./themes/DefaultLight";
13
13
  export { DefaultDarkTheme } from "./themes/DefaultDark";
14
14
  export { MidnightEmberTheme } from "./themes/MidnightEmber";
15
- export { components } from "./overrides";
15
+ export { componentOverrides } from "./overrides";
@@ -1,6 +1,6 @@
1
1
  import type { Components, Theme } from "@mui/material/styles";
2
2
 
3
- import type { } from '@mui/x-date-pickers/themeAugmentation';
3
+ import type {} from "@mui/x-date-pickers/themeAugmentation";
4
4
 
5
5
  import { MuiCssBaseline } from "./muiCssBaseline";
6
6
  import { MuiDatePicker } from "./muiDatePicker";
@@ -15,9 +15,11 @@ import { MuiButton } from "./muiButton";
15
15
 
16
16
  /**
17
17
  * Shared MUI component overrides applied by every theme (light, dark and branded).
18
- * They read `theme.palette.mode`, so the same set works for any palette.
18
+ * They read `theme.palette.mode`, so the same set works for any palette. Public as
19
+ * `componentOverrides` for an app that builds its own theme; `components` alone, at the root of
20
+ * the package, did not say whose components.
19
21
  */
20
- export const components: Components<Omit<Theme, "components">> = {
22
+ export const componentOverrides: Components<Omit<Theme, "components">> = {
21
23
  MuiCssBaseline,
22
24
  MuiDatePicker,
23
25
  MuiTextField,
@@ -1,7 +1,7 @@
1
- import type { Components, Theme } from '@mui/material/styles';
1
+ import type { Components, Theme } from "@mui/material/styles";
2
2
 
3
- export const MuiButton: Components<Theme>['MuiButton'] = {
3
+ export const MuiButton: Components<Theme>["MuiButton"] = {
4
4
  defaultProps: {
5
- size: 'small',
5
+ size: "small",
6
6
  },
7
7
  };
@@ -9,27 +9,26 @@ export const MuiCssBaseline = {
9
9
  },
10
10
  "*::-webkit-scrollbar-thumb": {
11
11
  borderRadius: 10,
12
- backgroundColor: '#959595'
13
-
12
+ backgroundColor: "#959595",
14
13
  },
15
14
  "*::-webkit-scrollbar-thumb:hover ": {
16
- backgroundColor: '#959595'
15
+ backgroundColor: "#959595",
17
16
  },
18
17
  "*:hover::-webkit-scrollbar-thumb": {
19
- backgroundColor: '#959595'
18
+ backgroundColor: "#959595",
20
19
  },
21
20
 
22
21
  "*::-webkit-scrollbar-thumb:active": {
23
- backgroundColor: theme.palette.primary.main
22
+ backgroundColor: theme.palette.primary.main,
24
23
  },
25
24
 
26
25
  "*::-moz-selection": {
27
- color: (theme.palette.mode === "dark" ? colors.common.black : colors.common.white),
28
- backgroundColor: theme.palette.primary.main
26
+ color: theme.palette.mode === "dark" ? colors.common.black : colors.common.white,
27
+ backgroundColor: theme.palette.primary.main,
29
28
  },
30
29
  "*::selection": {
31
- color: (theme.palette.mode === "dark") ? colors.common.black : colors.common.white,
32
- backgroundColor: theme.palette.primary.main
33
- }
34
- })
35
- }
30
+ color: theme.palette.mode === "dark" ? colors.common.black : colors.common.white,
31
+ backgroundColor: theme.palette.primary.main,
32
+ },
33
+ }),
34
+ };
@@ -1,5 +1,5 @@
1
1
  export const MuiDatePicker = {
2
2
  defaultProps: {
3
- slotProps: { textField: { size: 'small' as const } },
3
+ slotProps: { textField: { size: "small" as const } },
4
4
  },
5
- };
5
+ };
@@ -2,6 +2,6 @@ import type { Components, Theme } from "@mui/material/styles";
2
2
 
3
3
  export const MuiFormControl: Components<Theme>["MuiFormControl"] = {
4
4
  defaultProps: {
5
- size: 'small',
5
+ size: "small",
6
6
  },
7
- };
7
+ };
@@ -1,7 +1,7 @@
1
- import type { Components, Theme } from '@mui/material/styles';
1
+ import type { Components, Theme } from "@mui/material/styles";
2
2
 
3
- export const MuiIconButton: Components<Theme>['MuiIconButton'] = {
3
+ export const MuiIconButton: Components<Theme>["MuiIconButton"] = {
4
4
  defaultProps: {
5
- size: 'small',
5
+ size: "small",
6
6
  },
7
7
  };
@@ -2,6 +2,6 @@ import type { Components, Theme } from "@mui/material/styles";
2
2
 
3
3
  export const MuiSelect: Components<Theme>["MuiSelect"] = {
4
4
  defaultProps: {
5
- size: 'small',
5
+ size: "small",
6
6
  },
7
- }
7
+ };
@@ -2,6 +2,6 @@ import type { Components, Theme } from "@mui/material/styles";
2
2
 
3
3
  export const MuiSvgIcon: Components<Theme>["MuiSvgIcon"] = {
4
4
  defaultProps: {
5
- fontSize: 'small',
5
+ fontSize: "small",
6
6
  },
7
- }
7
+ };
@@ -4,4 +4,4 @@ export const MuiTextField: Components<Theme>["MuiTextField"] = {
4
4
  defaultProps: {
5
5
  size: "small",
6
6
  },
7
- };
7
+ };
@@ -1,7 +1,7 @@
1
- import type { Components, Theme } from '@mui/material/styles';
1
+ import type { Components, Theme } from "@mui/material/styles";
2
2
 
3
- export const MuiToggleButton: Components<Theme>['MuiToggleButton'] = {
3
+ export const MuiToggleButton: Components<Theme>["MuiToggleButton"] = {
4
4
  defaultProps: {
5
- size: 'small',
5
+ size: "small",
6
6
  },
7
- };
7
+ };
@@ -1,7 +1,7 @@
1
- import type { Components, Theme } from '@mui/material/styles';
1
+ import type { Components, Theme } from "@mui/material/styles";
2
2
 
3
- export const MuiToggleButtonGroup: Components<Theme>['MuiToggleButtonGroup'] = {
3
+ export const MuiToggleButtonGroup: Components<Theme>["MuiToggleButtonGroup"] = {
4
4
  defaultProps: {
5
- size: 'small',
5
+ size: "small",
6
6
  },
7
- };
7
+ };
@@ -1,6 +1,6 @@
1
1
  import { createTheme, type Theme } from "@mui/material/styles";
2
2
 
3
- import { components } from "@/theme/overrides";
3
+ import { componentOverrides } from "@/theme/overrides";
4
4
 
5
5
  /**
6
6
  * Neutral dark theme. Uses MUI's default palette (no brand color) plus the
@@ -10,5 +10,5 @@ export const DefaultDarkTheme: Theme = createTheme({
10
10
  palette: {
11
11
  mode: "dark",
12
12
  },
13
- components,
13
+ components: componentOverrides,
14
14
  });
@@ -1,6 +1,6 @@
1
1
  import { createTheme, type Theme } from "@mui/material/styles";
2
2
 
3
- import { components } from "@/theme/overrides";
3
+ import { componentOverrides } from "@/theme/overrides";
4
4
 
5
5
  /**
6
6
  * Neutral light theme. Uses MUI's default palette (no brand color) plus the
@@ -10,5 +10,5 @@ export const DefaultLightTheme: Theme = createTheme({
10
10
  palette: {
11
11
  mode: "light",
12
12
  },
13
- components,
13
+ components: componentOverrides,
14
14
  });
@@ -1,6 +1,6 @@
1
1
  import { createTheme, type Theme } from "@mui/material/styles";
2
2
 
3
- import { components } from "@/theme/overrides";
3
+ import { componentOverrides } from "@/theme/overrides";
4
4
 
5
5
  /**
6
6
  * Everysk Dark — the theme every Everysk app runs with.
@@ -58,5 +58,5 @@ export const EveryskDarkTheme: Theme = createTheme({
58
58
  shape: {
59
59
  borderRadius: 8,
60
60
  },
61
- components,
61
+ components: componentOverrides,
62
62
  });
@@ -1,6 +1,6 @@
1
1
  import { createTheme, type Theme } from "@mui/material/styles";
2
2
 
3
- import { components } from "@/theme/overrides";
3
+ import { componentOverrides } from "@/theme/overrides";
4
4
 
5
5
  /**
6
6
  * Everysk Light — the light twin of {@link EveryskDarkTheme}.
@@ -64,5 +64,5 @@ export const EveryskLightTheme: Theme = createTheme({
64
64
  shape: {
65
65
  borderRadius: 8,
66
66
  },
67
- components,
67
+ components: componentOverrides,
68
68
  });
@@ -1,30 +1,30 @@
1
1
  import { createTheme, type Theme } from "@mui/material/styles";
2
2
 
3
- import { components } from "@/theme/overrides";
3
+ import { componentOverrides } from "@/theme/overrides";
4
4
 
5
5
  export const MidnightEmberTheme: Theme = createTheme({
6
6
  palette: {
7
- mode: 'dark',
7
+ mode: "dark",
8
8
  primary: {
9
- main: '#F97316',
10
- dark: '#EA580C',
11
- light: '#FDBA74',
12
- contrastText: '#020617',
9
+ main: "#F97316",
10
+ dark: "#EA580C",
11
+ light: "#FDBA74",
12
+ contrastText: "#020617",
13
13
  },
14
14
  secondary: {
15
- main: '#94A3B8',
16
- dark: '#64748B',
17
- light: '#CBD5F5',
18
- contrastText: '#020617',
15
+ main: "#94A3B8",
16
+ dark: "#64748B",
17
+ light: "#CBD5F5",
18
+ contrastText: "#020617",
19
19
  },
20
20
  background: {
21
- default: '#020617',
22
- paper: '#0B1120',
21
+ default: "#020617",
22
+ paper: "#0B1120",
23
23
  },
24
24
  text: {
25
- primary: '#F9FAFB',
25
+ primary: "#F9FAFB",
26
26
  },
27
- divider: 'rgba(148, 163, 184, 0.25)'
27
+ divider: "rgba(148, 163, 184, 0.25)",
28
28
  },
29
- components,
29
+ components: componentOverrides,
30
30
  });
@@ -1,4 +1,4 @@
1
1
  export type AnyRecord = {
2
2
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
- [key: string]: any
4
- }
3
+ [key: string]: any;
4
+ };
@@ -1,33 +1,67 @@
1
1
  import type { AnyRecord } from "./anyRecord";
2
- import type { EntitySingleResponse, EntityListResponse, DeleteEntityResponse } from "./entityQuery";
2
+ import type { EntityListResponse } from "./entityQuery";
3
+ import type { DatastoreDataFormat } from "./datastoreDataFormat";
3
4
 
4
5
  export type DatastoreRow = string | number | null;
6
+
7
+ /** A tabular datastore's content: a matrix whose first row names the columns. */
5
8
  export type DatastoreData = DatastoreRow[][];
6
9
 
7
10
  export type Datastore = {
8
- updated?: number,
9
- created?: number,
10
-
11
- id: string,
12
- name: string,
13
- date?: string,
14
- version?: string,
15
- description?: string,
16
-
17
- tags?: string[],
18
- link_uid?: string,
19
- workspace: string,
20
- data: DatastoreData,
21
- date_time: string,
22
- level?: string,
23
- }
24
-
25
- export type DatastoreWithRows = Omit<Datastore, "data"> & {
11
+ updated?: number;
12
+ created?: number;
13
+
14
+ id: string;
15
+ name: string;
16
+ date?: string;
17
+ version?: string;
18
+ description?: string;
19
+
20
+ tags?: string[];
21
+ link_uid?: string;
22
+ workspace: string;
23
+ /**
24
+ * A matrix for a tabular datastore; an object or an array of objects for a JSON one. The API
25
+ * does not say which, so the shape is the only signal: an array whose every element is an
26
+ * array is a table. The API has returned `[{ … }]` for a JSON one, an array without being a
27
+ * table.
28
+ */
29
+ data: DatastoreData | AnyRecord | AnyRecord[];
30
+ date_time: string;
31
+ level?: string;
32
+ };
33
+
34
+ /** A tabular datastore as the hooks return it: the matrix converted to row objects. */
35
+ export type TableDatastore = Omit<Datastore, "data"> & {
36
+ format: "table";
26
37
  data: AnyRecord[];
38
+ /**
39
+ * The column names in the datastore's own order, from the header row the conversion to
40
+ * objects drops. Saving back needs it — `toDatastoreMatrix(datastore)` uses it — rather
41
+ * than rebuilding the order from object keys and leaving out the `datastoreId` the SDK adds.
42
+ * Empty when the read projects `data` away.
43
+ */
44
+ fields: string[];
45
+ };
46
+
47
+ /** A JSON datastore as the hooks return it: its object or array of objects, untouched. */
48
+ export type JsonDatastore = Omit<Datastore, "data"> & {
49
+ format: "json";
50
+ data: AnyRecord | AnyRecord[];
27
51
  };
28
52
 
29
- export type DatastoreSingleResponse = EntitySingleResponse<"datastore", Datastore>;
53
+ /**
54
+ * A datastore as the hooks return it: its `data` read and classified by `parseDatastore`. Narrow
55
+ * on `format` (or with `isTableDatastore`) before reading `data` as rows: a list can mix both
56
+ * kinds. `F` is the `dataFormat` the hook read with. It was `DatastoreWithRows`, a name from
57
+ * before JSON datastores, which carry no rows.
58
+ */
59
+ export type ParsedDatastore<F extends DatastoreDataFormat = "object"> =
60
+ | (F extends "matrix"
61
+ ? // A tabular datastore read with `dataFormat: "matrix"`: its matrix unconverted, header row included,
62
+ // so it can be written back unchanged. Written in place: nothing refers to it by name.
63
+ Omit<TableDatastore, "data"> & { data: DatastoreData }
64
+ : TableDatastore)
65
+ | JsonDatastore;
30
66
 
31
67
  export type DatastoreListResponse = EntityListResponse<"datastores", Datastore>;
32
-
33
- export type DeleteDatastoreResponse = DeleteEntityResponse<"datastores">;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * How the datastore hooks hand over a **tabular** datastore's `data`; a JSON datastore's is never
3
+ * converted. `"object"` (the default) is each row as an object — a list of them, not one
4
+ * object — which lets an app patch a row as `{ ...row, ...patch }`. `"matrix"` leaves the table's
5
+ * matrix unconverted, header row included. A value rather than a conversion function, so it can
6
+ * be part of the cache key.
7
+ *
8
+ * Internal: no barrel re-exports this file. An app never writes the name — `dataFormat` is
9
+ * inferred from the value it passes — so it stays out of the public types, and exists only so
10
+ * the SDK does not repeat the union in every generic.
11
+ */
12
+ export type DatastoreDataFormat = "object" | "matrix";