@darajs/core 1.0.0-a.1

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 (462) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/dist/actions/download-content.d.ts +8 -0
  4. package/dist/actions/download-content.d.ts.map +1 -0
  5. package/dist/actions/download-content.js +46 -0
  6. package/dist/actions/download-content.js.map +1 -0
  7. package/dist/actions/download-variable.d.ts +8 -0
  8. package/dist/actions/download-variable.d.ts.map +1 -0
  9. package/dist/actions/download-variable.js +153 -0
  10. package/dist/actions/download-variable.js.map +1 -0
  11. package/dist/actions/index.d.ts +11 -0
  12. package/dist/actions/index.d.ts.map +1 -0
  13. package/dist/actions/index.js +11 -0
  14. package/dist/actions/index.js.map +1 -0
  15. package/dist/actions/logout.d.ts +8 -0
  16. package/dist/actions/logout.d.ts.map +1 -0
  17. package/dist/actions/logout.js +24 -0
  18. package/dist/actions/logout.js.map +1 -0
  19. package/dist/actions/navigate-to.d.ts +8 -0
  20. package/dist/actions/navigate-to.d.ts.map +1 -0
  21. package/dist/actions/navigate-to.js +77 -0
  22. package/dist/actions/navigate-to.js.map +1 -0
  23. package/dist/actions/notify.d.ts +8 -0
  24. package/dist/actions/notify.d.ts.map +1 -0
  25. package/dist/actions/notify.js +16 -0
  26. package/dist/actions/notify.js.map +1 -0
  27. package/dist/actions/reset-variables.d.ts +8 -0
  28. package/dist/actions/reset-variables.d.ts.map +1 -0
  29. package/dist/actions/reset-variables.js +24 -0
  30. package/dist/actions/reset-variables.js.map +1 -0
  31. package/dist/actions/side-effect.d.ts +8 -0
  32. package/dist/actions/side-effect.d.ts.map +1 -0
  33. package/dist/actions/side-effect.js +44 -0
  34. package/dist/actions/side-effect.js.map +1 -0
  35. package/dist/actions/trigger-variable.d.ts +8 -0
  36. package/dist/actions/trigger-variable.d.ts.map +1 -0
  37. package/dist/actions/trigger-variable.js +25 -0
  38. package/dist/actions/trigger-variable.js.map +1 -0
  39. package/dist/actions/update-variable.d.ts +9 -0
  40. package/dist/actions/update-variable.d.ts.map +1 -0
  41. package/dist/actions/update-variable.js +89 -0
  42. package/dist/actions/update-variable.js.map +1 -0
  43. package/dist/actions/utils.d.ts +9 -0
  44. package/dist/actions/utils.d.ts.map +1 -0
  45. package/dist/actions/utils.js +37 -0
  46. package/dist/actions/utils.js.map +1 -0
  47. package/dist/api/core.d.ts +34 -0
  48. package/dist/api/core.d.ts.map +1 -0
  49. package/dist/api/core.js +110 -0
  50. package/dist/api/core.js.map +1 -0
  51. package/dist/api/http.d.ts +9 -0
  52. package/dist/api/http.d.ts.map +1 -0
  53. package/dist/api/http.js +38 -0
  54. package/dist/api/http.js.map +1 -0
  55. package/dist/api/index.d.ts +5 -0
  56. package/dist/api/index.d.ts.map +1 -0
  57. package/dist/api/index.js +5 -0
  58. package/dist/api/index.js.map +1 -0
  59. package/dist/api/websocket.d.ts +140 -0
  60. package/dist/api/websocket.d.ts.map +1 -0
  61. package/dist/api/websocket.js +241 -0
  62. package/dist/api/websocket.js.map +1 -0
  63. package/dist/assets/fonts/Manrope-VariableFont_wght.ttf +0 -0
  64. package/dist/assets/login-background.svg +11 -0
  65. package/dist/assets/logo.svg +12 -0
  66. package/dist/auth/auth-context.d.ts +22 -0
  67. package/dist/auth/auth-context.d.ts.map +1 -0
  68. package/dist/auth/auth-context.js +18 -0
  69. package/dist/auth/auth-context.js.map +1 -0
  70. package/dist/auth/auth-wrapper.d.ts +14 -0
  71. package/dist/auth/auth-wrapper.d.ts.map +1 -0
  72. package/dist/auth/auth-wrapper.js +90 -0
  73. package/dist/auth/auth-wrapper.js.map +1 -0
  74. package/dist/auth/auth.d.ts +61 -0
  75. package/dist/auth/auth.d.ts.map +1 -0
  76. package/dist/auth/auth.js +161 -0
  77. package/dist/auth/auth.js.map +1 -0
  78. package/dist/auth/basic/basic-auth-login.d.ts +6 -0
  79. package/dist/auth/basic/basic-auth-login.d.ts.map +1 -0
  80. package/dist/auth/basic/basic-auth-login.js +174 -0
  81. package/dist/auth/basic/basic-auth-login.js.map +1 -0
  82. package/dist/auth/basic/basic-auth-logout.d.ts +6 -0
  83. package/dist/auth/basic/basic-auth-logout.d.ts.map +1 -0
  84. package/dist/auth/basic/basic-auth-logout.js +18 -0
  85. package/dist/auth/basic/basic-auth-logout.js.map +1 -0
  86. package/dist/auth/default/default-auth-login.d.ts +6 -0
  87. package/dist/auth/default/default-auth-login.d.ts.map +1 -0
  88. package/dist/auth/default/default-auth-login.js +66 -0
  89. package/dist/auth/default/default-auth-login.js.map +1 -0
  90. package/dist/auth/index.d.ts +7 -0
  91. package/dist/auth/index.d.ts.map +1 -0
  92. package/dist/auth/index.js +7 -0
  93. package/dist/auth/index.js.map +1 -0
  94. package/dist/components/fallback/default.d.ts +5 -0
  95. package/dist/components/fallback/default.d.ts.map +1 -0
  96. package/dist/components/fallback/default.js +10 -0
  97. package/dist/components/fallback/default.js.map +1 -0
  98. package/dist/components/fallback/dots.d.ts +8 -0
  99. package/dist/components/fallback/dots.d.ts.map +1 -0
  100. package/dist/components/fallback/dots.js +77 -0
  101. package/dist/components/fallback/dots.js.map +1 -0
  102. package/dist/components/fallback/row.d.ts +5 -0
  103. package/dist/components/fallback/row.d.ts.map +1 -0
  104. package/dist/components/fallback/row.js +14 -0
  105. package/dist/components/fallback/row.js.map +1 -0
  106. package/dist/components/for/for.d.ts +35 -0
  107. package/dist/components/for/for.d.ts.map +1 -0
  108. package/dist/components/for/for.js +43 -0
  109. package/dist/components/for/for.js.map +1 -0
  110. package/dist/components/index.d.ts +9 -0
  111. package/dist/components/index.d.ts.map +1 -0
  112. package/dist/components/index.js +9 -0
  113. package/dist/components/index.js.map +1 -0
  114. package/dist/components/menu/menu.d.ts +14 -0
  115. package/dist/components/menu/menu.d.ts.map +1 -0
  116. package/dist/components/menu/menu.js +58 -0
  117. package/dist/components/menu/menu.js.map +1 -0
  118. package/dist/components/progress-tracker/progress-tracker.d.ts +18 -0
  119. package/dist/components/progress-tracker/progress-tracker.d.ts.map +1 -0
  120. package/dist/components/progress-tracker/progress-tracker.js +202 -0
  121. package/dist/components/progress-tracker/progress-tracker.js.map +1 -0
  122. package/dist/components/router-content/router-content.d.ts +14 -0
  123. package/dist/components/router-content/router-content.d.ts.map +1 -0
  124. package/dist/components/router-content/router-content.js +17 -0
  125. package/dist/components/router-content/router-content.js.map +1 -0
  126. package/dist/components/side-bar-frame/side-bar-frame.d.ts +21 -0
  127. package/dist/components/side-bar-frame/side-bar-frame.d.ts.map +1 -0
  128. package/dist/components/side-bar-frame/side-bar-frame.js +63 -0
  129. package/dist/components/side-bar-frame/side-bar-frame.js.map +1 -0
  130. package/dist/components/top-bar-frame/top-bar-frame.d.ts +16 -0
  131. package/dist/components/top-bar-frame/top-bar-frame.d.ts.map +1 -0
  132. package/dist/components/top-bar-frame/top-bar-frame.js +70 -0
  133. package/dist/components/top-bar-frame/top-bar-frame.js.map +1 -0
  134. package/dist/dara_core-1.0.0a1-py3-none-any.whl +0 -0
  135. package/dist/devtools/backend-errors/backend-errors-ctx.d.ts +17 -0
  136. package/dist/devtools/backend-errors/backend-errors-ctx.d.ts.map +1 -0
  137. package/dist/devtools/backend-errors/backend-errors-ctx.js +37 -0
  138. package/dist/devtools/backend-errors/backend-errors-ctx.js.map +1 -0
  139. package/dist/devtools/backend-errors/backend-errors.d.ts +6 -0
  140. package/dist/devtools/backend-errors/backend-errors.d.ts.map +1 -0
  141. package/dist/devtools/backend-errors/backend-errors.js +57 -0
  142. package/dist/devtools/backend-errors/backend-errors.js.map +1 -0
  143. package/dist/devtools/backend-errors/error-display.d.ts +22 -0
  144. package/dist/devtools/backend-errors/error-display.d.ts.map +1 -0
  145. package/dist/devtools/backend-errors/error-display.js +99 -0
  146. package/dist/devtools/backend-errors/error-display.js.map +1 -0
  147. package/dist/devtools/backend-errors/index.d.ts +3 -0
  148. package/dist/devtools/backend-errors/index.d.ts.map +1 -0
  149. package/dist/devtools/backend-errors/index.js +3 -0
  150. package/dist/devtools/backend-errors/index.js.map +1 -0
  151. package/dist/devtools/devtools-content.d.ts +12 -0
  152. package/dist/devtools/devtools-content.d.ts.map +1 -0
  153. package/dist/devtools/devtools-content.js +73 -0
  154. package/dist/devtools/devtools-content.js.map +1 -0
  155. package/dist/devtools/devtools-context.d.ts +7 -0
  156. package/dist/devtools/devtools-context.d.ts.map +1 -0
  157. package/dist/devtools/devtools-context.js +9 -0
  158. package/dist/devtools/devtools-context.js.map +1 -0
  159. package/dist/devtools/devtools-wrapper.d.ts +8 -0
  160. package/dist/devtools/devtools-wrapper.d.ts.map +1 -0
  161. package/dist/devtools/devtools-wrapper.js +64 -0
  162. package/dist/devtools/devtools-wrapper.js.map +1 -0
  163. package/dist/devtools/devtools.d.ts +5 -0
  164. package/dist/devtools/devtools.d.ts.map +1 -0
  165. package/dist/devtools/devtools.js +10 -0
  166. package/dist/devtools/devtools.js.map +1 -0
  167. package/dist/devtools/floating-button.d.ts +24 -0
  168. package/dist/devtools/floating-button.d.ts.map +1 -0
  169. package/dist/devtools/floating-button.js +96 -0
  170. package/dist/devtools/floating-button.js.map +1 -0
  171. package/dist/devtools/index.d.ts +2 -0
  172. package/dist/devtools/index.d.ts.map +1 -0
  173. package/dist/devtools/index.js +2 -0
  174. package/dist/devtools/index.js.map +1 -0
  175. package/dist/devtools/resizer.d.ts +18 -0
  176. package/dist/devtools/resizer.d.ts.map +1 -0
  177. package/dist/devtools/resizer.js +48 -0
  178. package/dist/devtools/resizer.js.map +1 -0
  179. package/dist/devtools/use-move.d.ts +21 -0
  180. package/dist/devtools/use-move.d.ts.map +1 -0
  181. package/dist/devtools/use-move.js +55 -0
  182. package/dist/devtools/use-move.js.map +1 -0
  183. package/dist/index.css +95 -0
  184. package/dist/index.d.ts +15 -0
  185. package/dist/index.d.ts.map +1 -0
  186. package/dist/index.js +13 -0
  187. package/dist/index.js.map +1 -0
  188. package/dist/jest-setup.d.ts +2 -0
  189. package/dist/jest-setup.d.ts.map +1 -0
  190. package/dist/jest-setup.js +7 -0
  191. package/dist/jest-setup.js.map +1 -0
  192. package/dist/pages/error-page.d.ts +3 -0
  193. package/dist/pages/error-page.d.ts.map +1 -0
  194. package/dist/pages/error-page.js +32 -0
  195. package/dist/pages/error-page.js.map +1 -0
  196. package/dist/pages/sso-callback-page.d.ts +6 -0
  197. package/dist/pages/sso-callback-page.d.ts.map +1 -0
  198. package/dist/pages/sso-callback-page.js +8 -0
  199. package/dist/pages/sso-callback-page.js.map +1 -0
  200. package/dist/run.d.ts +22 -0
  201. package/dist/run.d.ts.map +1 -0
  202. package/dist/run.js +40 -0
  203. package/dist/run.js.map +1 -0
  204. package/dist/shared/center/center.d.ts +5 -0
  205. package/dist/shared/center/center.d.ts.map +1 -0
  206. package/dist/shared/center/center.js +15 -0
  207. package/dist/shared/center/center.js.map +1 -0
  208. package/dist/shared/context/direction-context.d.ts +7 -0
  209. package/dist/shared/context/direction-context.d.ts.map +1 -0
  210. package/dist/shared/context/direction-context.js +4 -0
  211. package/dist/shared/context/direction-context.js.map +1 -0
  212. package/dist/shared/context/display-context.d.ts +14 -0
  213. package/dist/shared/context/display-context.d.ts.map +1 -0
  214. package/dist/shared/context/display-context.js +4 -0
  215. package/dist/shared/context/display-context.js.map +1 -0
  216. package/dist/shared/context/fallback-context.d.ts +11 -0
  217. package/dist/shared/context/fallback-context.d.ts.map +1 -0
  218. package/dist/shared/context/fallback-context.js +4 -0
  219. package/dist/shared/context/fallback-context.js.map +1 -0
  220. package/dist/shared/context/global-task-context.d.ts +40 -0
  221. package/dist/shared/context/global-task-context.d.ts.map +1 -0
  222. package/dist/shared/context/global-task-context.js +78 -0
  223. package/dist/shared/context/global-task-context.js.map +1 -0
  224. package/dist/shared/context/importers-context.d.ts +7 -0
  225. package/dist/shared/context/importers-context.d.ts.map +1 -0
  226. package/dist/shared/context/importers-context.js +4 -0
  227. package/dist/shared/context/importers-context.js.map +1 -0
  228. package/dist/shared/context/index.d.ts +10 -0
  229. package/dist/shared/context/index.d.ts.map +1 -0
  230. package/dist/shared/context/index.js +10 -0
  231. package/dist/shared/context/index.js.map +1 -0
  232. package/dist/shared/context/registries-context.d.ts +21 -0
  233. package/dist/shared/context/registries-context.d.ts.map +1 -0
  234. package/dist/shared/context/registries-context.js +8 -0
  235. package/dist/shared/context/registries-context.js.map +1 -0
  236. package/dist/shared/context/variable-context.d.ts +10 -0
  237. package/dist/shared/context/variable-context.d.ts.map +1 -0
  238. package/dist/shared/context/variable-context.js +4 -0
  239. package/dist/shared/context/variable-context.js.map +1 -0
  240. package/dist/shared/context/websocket-context.d.ts +8 -0
  241. package/dist/shared/context/websocket-context.d.ts.map +1 -0
  242. package/dist/shared/context/websocket-context.js +4 -0
  243. package/dist/shared/context/websocket-context.js.map +1 -0
  244. package/dist/shared/dynamic-component/dynamic-component.d.ts +16 -0
  245. package/dist/shared/dynamic-component/dynamic-component.d.ts.map +1 -0
  246. package/dist/shared/dynamic-component/dynamic-component.js +243 -0
  247. package/dist/shared/dynamic-component/dynamic-component.js.map +1 -0
  248. package/dist/shared/error-handling/error-display.d.ts +8 -0
  249. package/dist/shared/error-handling/error-display.d.ts.map +1 -0
  250. package/dist/shared/error-handling/error-display.js +92 -0
  251. package/dist/shared/error-handling/error-display.js.map +1 -0
  252. package/dist/shared/error-handling/index.d.ts +3 -0
  253. package/dist/shared/error-handling/index.d.ts.map +1 -0
  254. package/dist/shared/error-handling/index.js +3 -0
  255. package/dist/shared/error-handling/index.js.map +1 -0
  256. package/dist/shared/error-handling/types.d.ts +10 -0
  257. package/dist/shared/error-handling/types.d.ts.map +1 -0
  258. package/dist/shared/error-handling/types.js +9 -0
  259. package/dist/shared/error-handling/types.js.map +1 -0
  260. package/dist/shared/index.d.ts +11 -0
  261. package/dist/shared/index.d.ts.map +1 -0
  262. package/dist/shared/index.js +9 -0
  263. package/dist/shared/index.js.map +1 -0
  264. package/dist/shared/interactivity/data-variable.d.ts +66 -0
  265. package/dist/shared/interactivity/data-variable.d.ts.map +1 -0
  266. package/dist/shared/interactivity/data-variable.js +186 -0
  267. package/dist/shared/interactivity/data-variable.js.map +1 -0
  268. package/dist/shared/interactivity/derived-variable.d.ts +153 -0
  269. package/dist/shared/interactivity/derived-variable.d.ts.map +1 -0
  270. package/dist/shared/interactivity/derived-variable.js +403 -0
  271. package/dist/shared/interactivity/derived-variable.js.map +1 -0
  272. package/dist/shared/interactivity/filtering.d.ts +9 -0
  273. package/dist/shared/interactivity/filtering.d.ts.map +1 -0
  274. package/dist/shared/interactivity/filtering.js +20 -0
  275. package/dist/shared/interactivity/filtering.js.map +1 -0
  276. package/dist/shared/interactivity/index.d.ts +12 -0
  277. package/dist/shared/interactivity/index.d.ts.map +1 -0
  278. package/dist/shared/interactivity/index.js +11 -0
  279. package/dist/shared/interactivity/index.js.map +1 -0
  280. package/dist/shared/interactivity/internal.d.ts +8 -0
  281. package/dist/shared/interactivity/internal.d.ts.map +1 -0
  282. package/dist/shared/interactivity/internal.js +10 -0
  283. package/dist/shared/interactivity/internal.js.map +1 -0
  284. package/dist/shared/interactivity/nested.d.ts +16 -0
  285. package/dist/shared/interactivity/nested.d.ts.map +1 -0
  286. package/dist/shared/interactivity/nested.js +50 -0
  287. package/dist/shared/interactivity/nested.js.map +1 -0
  288. package/dist/shared/interactivity/plain-variable.d.ts +23 -0
  289. package/dist/shared/interactivity/plain-variable.d.ts.map +1 -0
  290. package/dist/shared/interactivity/plain-variable.js +89 -0
  291. package/dist/shared/interactivity/plain-variable.js.map +1 -0
  292. package/dist/shared/interactivity/resolve-value.d.ts +13 -0
  293. package/dist/shared/interactivity/resolve-value.d.ts.map +1 -0
  294. package/dist/shared/interactivity/resolve-value.js +36 -0
  295. package/dist/shared/interactivity/resolve-value.js.map +1 -0
  296. package/dist/shared/interactivity/resolve-variable.d.ts +18 -0
  297. package/dist/shared/interactivity/resolve-variable.d.ts.map +1 -0
  298. package/dist/shared/interactivity/resolve-variable.js +47 -0
  299. package/dist/shared/interactivity/resolve-variable.js.map +1 -0
  300. package/dist/shared/interactivity/store.d.ts +35 -0
  301. package/dist/shared/interactivity/store.d.ts.map +1 -0
  302. package/dist/shared/interactivity/store.js +47 -0
  303. package/dist/shared/interactivity/store.js.map +1 -0
  304. package/dist/shared/interactivity/triggers.d.ts +31 -0
  305. package/dist/shared/interactivity/triggers.d.ts.map +1 -0
  306. package/dist/shared/interactivity/triggers.js +105 -0
  307. package/dist/shared/interactivity/triggers.js.map +1 -0
  308. package/dist/shared/interactivity/url-variable.d.ts +12 -0
  309. package/dist/shared/interactivity/url-variable.d.ts.map +1 -0
  310. package/dist/shared/interactivity/url-variable.js +28 -0
  311. package/dist/shared/interactivity/url-variable.js.map +1 -0
  312. package/dist/shared/interactivity/use-any-variable.d.ts +8 -0
  313. package/dist/shared/interactivity/use-any-variable.d.ts.map +1 -0
  314. package/dist/shared/interactivity/use-any-variable.js +38 -0
  315. package/dist/shared/interactivity/use-any-variable.js.map +1 -0
  316. package/dist/shared/interactivity/use-data-variable.d.ts +12 -0
  317. package/dist/shared/interactivity/use-data-variable.d.ts.map +1 -0
  318. package/dist/shared/interactivity/use-data-variable.js +56 -0
  319. package/dist/shared/interactivity/use-data-variable.js.map +1 -0
  320. package/dist/shared/interactivity/use-refresh-selector.d.ts +5 -0
  321. package/dist/shared/interactivity/use-refresh-selector.d.ts.map +1 -0
  322. package/dist/shared/interactivity/use-refresh-selector.js +16 -0
  323. package/dist/shared/interactivity/use-refresh-selector.js.map +1 -0
  324. package/dist/shared/interactivity/use-reset-variables.d.ts +8 -0
  325. package/dist/shared/interactivity/use-reset-variables.d.ts.map +1 -0
  326. package/dist/shared/interactivity/use-reset-variables.js +46 -0
  327. package/dist/shared/interactivity/use-reset-variables.js.map +1 -0
  328. package/dist/shared/interactivity/use-server-component.d.ts +24 -0
  329. package/dist/shared/interactivity/use-server-component.d.ts.map +1 -0
  330. package/dist/shared/interactivity/use-server-component.js +227 -0
  331. package/dist/shared/interactivity/use-server-component.js.map +1 -0
  332. package/dist/shared/interactivity/use-trigger-variable.d.ts +9 -0
  333. package/dist/shared/interactivity/use-trigger-variable.d.ts.map +1 -0
  334. package/dist/shared/interactivity/use-trigger-variable.js +18 -0
  335. package/dist/shared/interactivity/use-trigger-variable.js.map +1 -0
  336. package/dist/shared/interactivity/use-variable-state.d.ts +9 -0
  337. package/dist/shared/interactivity/use-variable-state.d.ts.map +1 -0
  338. package/dist/shared/interactivity/use-variable-state.js +35 -0
  339. package/dist/shared/interactivity/use-variable-state.js.map +1 -0
  340. package/dist/shared/interactivity/use-variable-value.d.ts +20 -0
  341. package/dist/shared/interactivity/use-variable-value.d.ts.map +1 -0
  342. package/dist/shared/interactivity/use-variable-value.js +77 -0
  343. package/dist/shared/interactivity/use-variable-value.js.map +1 -0
  344. package/dist/shared/interactivity/use-variable.d.ts +11 -0
  345. package/dist/shared/interactivity/use-variable.d.ts.map +1 -0
  346. package/dist/shared/interactivity/use-variable.js +62 -0
  347. package/dist/shared/interactivity/use-variable.js.map +1 -0
  348. package/dist/shared/private-route/private-route.d.ts +23 -0
  349. package/dist/shared/private-route/private-route.d.ts.map +1 -0
  350. package/dist/shared/private-route/private-route.js +39 -0
  351. package/dist/shared/private-route/private-route.js.map +1 -0
  352. package/dist/shared/template-root/dynamic-context.d.ts +9 -0
  353. package/dist/shared/template-root/dynamic-context.d.ts.map +1 -0
  354. package/dist/shared/template-root/dynamic-context.js +28 -0
  355. package/dist/shared/template-root/dynamic-context.js.map +1 -0
  356. package/dist/shared/template-root/template-root.d.ts +8 -0
  357. package/dist/shared/template-root/template-root.d.ts.map +1 -0
  358. package/dist/shared/template-root/template-root.js +76 -0
  359. package/dist/shared/template-root/template-root.js.map +1 -0
  360. package/dist/shared/utils/clean-session-cache.d.ts +9 -0
  361. package/dist/shared/utils/clean-session-cache.d.ts.map +1 -0
  362. package/dist/shared/utils/clean-session-cache.js +17 -0
  363. package/dist/shared/utils/clean-session-cache.js.map +1 -0
  364. package/dist/shared/utils/embed.d.ts +13 -0
  365. package/dist/shared/utils/embed.d.ts.map +1 -0
  366. package/dist/shared/utils/embed.js +23 -0
  367. package/dist/shared/utils/embed.js.map +1 -0
  368. package/dist/shared/utils/get-icon.d.ts +9 -0
  369. package/dist/shared/utils/get-icon.d.ts.map +1 -0
  370. package/dist/shared/utils/get-icon.js +30 -0
  371. package/dist/shared/utils/get-icon.js.map +1 -0
  372. package/dist/shared/utils/hashing.d.ts +14 -0
  373. package/dist/shared/utils/hashing.d.ts.map +1 -0
  374. package/dist/shared/utils/hashing.js +26 -0
  375. package/dist/shared/utils/hashing.js.map +1 -0
  376. package/dist/shared/utils/index.d.ts +18 -0
  377. package/dist/shared/utils/index.d.ts.map +1 -0
  378. package/dist/shared/utils/index.js +16 -0
  379. package/dist/shared/utils/index.js.map +1 -0
  380. package/dist/shared/utils/inject-css.d.ts +13 -0
  381. package/dist/shared/utils/inject-css.d.ts.map +1 -0
  382. package/dist/shared/utils/inject-css.js +25 -0
  383. package/dist/shared/utils/inject-css.js.map +1 -0
  384. package/dist/shared/utils/is-js-component.d.ts +9 -0
  385. package/dist/shared/utils/is-js-component.d.ts.map +1 -0
  386. package/dist/shared/utils/is-js-component.js +11 -0
  387. package/dist/shared/utils/is-js-component.js.map +1 -0
  388. package/dist/shared/utils/normalization.d.ts +19 -0
  389. package/dist/shared/utils/normalization.d.ts.map +1 -0
  390. package/dist/shared/utils/normalization.js +118 -0
  391. package/dist/shared/utils/normalization.js.map +1 -0
  392. package/dist/shared/utils/resolve-theme.d.ts +9 -0
  393. package/dist/shared/utils/resolve-theme.d.ts.map +1 -0
  394. package/dist/shared/utils/resolve-theme.js +28 -0
  395. package/dist/shared/utils/resolve-theme.js.map +1 -0
  396. package/dist/shared/utils/templating.d.ts +24 -0
  397. package/dist/shared/utils/templating.d.ts.map +1 -0
  398. package/dist/shared/utils/templating.js +67 -0
  399. package/dist/shared/utils/templating.js.map +1 -0
  400. package/dist/shared/utils/use-action-registry.d.ts +11 -0
  401. package/dist/shared/utils/use-action-registry.d.ts.map +1 -0
  402. package/dist/shared/utils/use-action-registry.js +18 -0
  403. package/dist/shared/utils/use-action-registry.js.map +1 -0
  404. package/dist/shared/utils/use-action.d.ts +9 -0
  405. package/dist/shared/utils/use-action.d.ts.map +1 -0
  406. package/dist/shared/utils/use-action.js +84 -0
  407. package/dist/shared/utils/use-action.js.map +1 -0
  408. package/dist/shared/utils/use-component-registry.d.ts +11 -0
  409. package/dist/shared/utils/use-component-registry.d.ts.map +1 -0
  410. package/dist/shared/utils/use-component-registry.js +46 -0
  411. package/dist/shared/utils/use-component-registry.js.map +1 -0
  412. package/dist/shared/utils/use-component-styles.d.ts +24 -0
  413. package/dist/shared/utils/use-component-styles.d.ts.map +1 -0
  414. package/dist/shared/utils/use-component-styles.js +68 -0
  415. package/dist/shared/utils/use-component-styles.js.map +1 -0
  416. package/dist/shared/utils/use-defer-loadable.d.ts +8 -0
  417. package/dist/shared/utils/use-defer-loadable.d.ts.map +1 -0
  418. package/dist/shared/utils/use-defer-loadable.js +44 -0
  419. package/dist/shared/utils/use-defer-loadable.js.map +1 -0
  420. package/dist/shared/utils/use-interval.d.ts +9 -0
  421. package/dist/shared/utils/use-interval.d.ts.map +1 -0
  422. package/dist/shared/utils/use-interval.js +18 -0
  423. package/dist/shared/utils/use-interval.js.map +1 -0
  424. package/dist/shared/utils/use-previous.d.ts +10 -0
  425. package/dist/shared/utils/use-previous.d.ts.map +1 -0
  426. package/dist/shared/utils/use-previous.js +17 -0
  427. package/dist/shared/utils/use-previous.js.map +1 -0
  428. package/dist/shared/utils/use-url-sync.d.ts +20 -0
  429. package/dist/shared/utils/use-url-sync.d.ts.map +1 -0
  430. package/dist/shared/utils/use-url-sync.js +68 -0
  431. package/dist/shared/utils/use-url-sync.js.map +1 -0
  432. package/dist/shared/utils/use-window-title.d.ts +3 -0
  433. package/dist/shared/utils/use-window-title.d.ts.map +1 -0
  434. package/dist/shared/utils/use-window-title.js +14 -0
  435. package/dist/shared/utils/use-window-title.js.map +1 -0
  436. package/dist/shared/variable-state-provider/variable-state-provider.d.ts +10 -0
  437. package/dist/shared/variable-state-provider/variable-state-provider.d.ts.map +1 -0
  438. package/dist/shared/variable-state-provider/variable-state-provider.js +21 -0
  439. package/dist/shared/variable-state-provider/variable-state-provider.js.map +1 -0
  440. package/dist/shared/wrapper/wrapper.d.ts +7 -0
  441. package/dist/shared/wrapper/wrapper.d.ts.map +1 -0
  442. package/dist/shared/wrapper/wrapper.js +14 -0
  443. package/dist/shared/wrapper/wrapper.js.map +1 -0
  444. package/dist/types/auth.d.ts +15 -0
  445. package/dist/types/auth.d.ts.map +1 -0
  446. package/dist/types/auth.js +6 -0
  447. package/dist/types/auth.js.map +1 -0
  448. package/dist/types/core.d.ts +325 -0
  449. package/dist/types/core.d.ts.map +1 -0
  450. package/dist/types/core.js +22 -0
  451. package/dist/types/core.js.map +1 -0
  452. package/dist/types/index.d.ts +7 -0
  453. package/dist/types/index.d.ts.map +1 -0
  454. package/dist/types/index.js +4 -0
  455. package/dist/types/index.js.map +1 -0
  456. package/dist/types/utils.d.ts +50 -0
  457. package/dist/types/utils.d.ts.map +1 -0
  458. package/dist/types/utils.js +84 -0
  459. package/dist/types/utils.js.map +1 -0
  460. package/dist/umd/dara.core.umd.js +93592 -0
  461. package/dist/umd/style.css +848 -0
  462. package/package.json +117 -0
@@ -0,0 +1,186 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { useCallback, useRef } from 'react';
11
+ import { atom } from 'recoil';
12
+ import { HTTP_METHOD, validateResponse } from '@darajs/ui-utils';
13
+ import { fetchTaskResult } from '../../api';
14
+ import { request } from '../../api/http';
15
+ import { useSessionToken } from '../../auth/auth-context';
16
+ import { combineFilters } from './filtering';
17
+ import { atomRegistry } from './store';
18
+ /**
19
+ * Format a DataVariable into a ResolvedDataVariable structure for the backend
20
+ *
21
+ * @param variable the variable to resolve for the backend
22
+ */
23
+ export function resolveDataVariable(variable) {
24
+ return {
25
+ filters: variable.filters,
26
+ type: 'data',
27
+ uid: variable.uid,
28
+ };
29
+ }
30
+ /**
31
+ * Create necessary query parameters on a URL based on pagination settings
32
+ *
33
+ * @param path url path
34
+ * @param pagination pagination object
35
+ */
36
+ function createDataUrl(path, pagination) {
37
+ const url = new URL(path, window.location.origin);
38
+ if (pagination === null || pagination === void 0 ? void 0 : pagination.limit) {
39
+ url.searchParams.set('limit', String(pagination.limit));
40
+ }
41
+ if (pagination === null || pagination === void 0 ? void 0 : pagination.offset) {
42
+ url.searchParams.set('offset', String(pagination.offset));
43
+ }
44
+ if (pagination === null || pagination === void 0 ? void 0 : pagination.sort) {
45
+ url.searchParams.set('order_by', (pagination.sort.desc ? '-' : '') + pagination.sort.id);
46
+ }
47
+ return url;
48
+ }
49
+ /**
50
+ * Retrieve the value of a data variable from the backend
51
+ *
52
+ * @param uid
53
+ * @param token
54
+ * @param filters
55
+ * @param pagination
56
+ */
57
+ export function fetchDataVariable(uid, token, filters, pagination) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const url = createDataUrl(`/api/core/data-variable/${uid}`, pagination);
60
+ const response = yield request(url, { body: JSON.stringify({ filters }), method: HTTP_METHOD.POST }, token);
61
+ yield validateResponse(response, 'Failed to fetch data variable');
62
+ return response.json();
63
+ });
64
+ }
65
+ export function isDataResponse(response) {
66
+ return typeof response === 'object' && 'data' in response && 'totalCount' in response;
67
+ }
68
+ /**
69
+ * Retrieve the value of a derived data variable from the backend
70
+ *
71
+ * @param uid
72
+ * @param token
73
+ * @param filters
74
+ * @param pagination
75
+ * @param cacheKey - cache key of the underlying DV, required for DerivedDataVariables
76
+ * @param wsChannel - websocket channel, required for DerivedDataVariables
77
+ */
78
+ export function fetchDerivedDataVariable(uid, token, cacheKey, wsChannel, filters, pagination) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const url = createDataUrl(`/api/core/data-variable/${uid}`, pagination);
81
+ const response = yield request(url, { body: JSON.stringify({ cache_key: cacheKey, filters, ws_channel: wsChannel }), method: HTTP_METHOD.POST }, token);
82
+ yield validateResponse(response, 'Failed to fetch data variable');
83
+ return response.json();
84
+ });
85
+ }
86
+ /**
87
+ * Get total count of data in a data variable
88
+ *
89
+ * @param uid uid of the variable
90
+ * @param token session token
91
+ * @param cacheKey cache key of the underlying DV in the case of derived data variables
92
+ */
93
+ function fetchDataVariableCount(uid, token, filters, cacheKey) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const response = yield request(`/api/core/data-variable/${uid}/count`, { body: JSON.stringify({ cache_key: cacheKey, filters }), method: HTTP_METHOD.POST }, token);
96
+ yield validateResponse(response, 'Failed to fetch data variable total count');
97
+ return response.json();
98
+ });
99
+ }
100
+ /**
101
+ * Get a callback to fetch data variable from the backend
102
+ *
103
+ * @param variable variable instance
104
+ * @param token session token
105
+ * @param serverTriggerCounter a counter to force recreation of the callback
106
+ */
107
+ export function useFetchDataVariable(variable, serverTriggerCounter) {
108
+ const token = useSessionToken();
109
+ const dataCallback = useCallback((filters, pagination) => __awaiter(this, void 0, void 0, function* () {
110
+ const mergedFilters = combineFilters('AND', [variable.filters, filters]);
111
+ const data = yield fetchDataVariable(variable.uid, token, mergedFilters, pagination);
112
+ const totalCount = yield fetchDataVariableCount(variable.uid, token, mergedFilters);
113
+ return {
114
+ data,
115
+ totalCount,
116
+ };
117
+ }), [variable, token, serverTriggerCounter]);
118
+ return dataCallback;
119
+ }
120
+ /**
121
+ * Get a callback to fetch derived data variable from the backend.
122
+ * Throws a TaskCancelledError when the backend task is cancelled.
123
+ *
124
+ * @param variable variable instance
125
+ * @param taskContext global task context
126
+ * @param wsClient websocket client instance
127
+ * @param dvValuePromise promise representing underlying derived variable state
128
+ * @param token session token
129
+ */
130
+ export function useFetchDerivedDataVariable(variable, taskContext, wsClient, dvValuePromise) {
131
+ const token = useSessionToken();
132
+ const previousResult = useRef({ data: null, totalCount: 0 });
133
+ const dataCallback = useCallback((filters, pagination) => __awaiter(this, void 0, void 0, function* () {
134
+ const mergedFilters = combineFilters('AND', [variable.filters, filters]);
135
+ const dvValue = yield dvValuePromise;
136
+ const response = yield fetchDerivedDataVariable(variable.uid, token, dvValue.cache_key, yield wsClient.getChannel(), mergedFilters, pagination);
137
+ let data = null;
138
+ const variableTaskId = `${variable.uid}-filter`;
139
+ // cancel previously running filter tasks
140
+ taskContext.cleanupRunningTasks(variableTaskId);
141
+ // if task was returned, wait for it to complete and fetch task result
142
+ if (response && 'task_id' in response) {
143
+ const taskId = response.task_id;
144
+ // add task to currently running tasks
145
+ taskContext.startTask(taskId, variableTaskId);
146
+ try {
147
+ yield wsClient.waitForTask(taskId);
148
+ }
149
+ catch (_a) {
150
+ // If an error occurred (i.e. task was cancelled) return the previous result.
151
+ // This would also cause the callback's identity to change so if the consuming component is
152
+ // honouring the contract, it should execute the callback again
153
+ return previousResult.current;
154
+ }
155
+ finally {
156
+ taskContext.endTask(taskId);
157
+ }
158
+ data = yield fetchTaskResult(taskId, token);
159
+ }
160
+ else {
161
+ // otherwise use response directly
162
+ data = response;
163
+ }
164
+ // For derived data variables count can only be fetched when task is not running so we have to make the request here
165
+ // As the total count could have changed because of the underlying DV changing
166
+ const totalCount = yield fetchDataVariableCount(variable.uid, token, mergedFilters, dvValue.cache_key);
167
+ previousResult.current = { data, totalCount };
168
+ return {
169
+ data,
170
+ totalCount,
171
+ };
172
+ }), [variable, token, dvValuePromise]);
173
+ return dataCallback;
174
+ }
175
+ /**
176
+ * Register an empty atom for DataVariable.
177
+ * Used to check whether a variable is registered within the app.
178
+ *
179
+ * @param variable variable to register
180
+ */
181
+ export function registerDataVariable(variable) {
182
+ if (!atomRegistry.has(variable.uid)) {
183
+ atomRegistry.set(variable.uid, atom({ default: true, key: variable.uid }));
184
+ }
185
+ }
186
+ //# sourceMappingURL=data-variable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-variable.js","sourceRoot":"","sources":["../../../js/shared/interactivity/data-variable.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAA4B,eAAe,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAsB;IACtD,OAAO;QACH,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,QAAQ,CAAC,GAAG;KACpB,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,IAAY,EAAE,UAAuB;IACxD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAElD,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,EAAE;QACnB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;KAC3D;IAED,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,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,CAAC,CAAC;YAE9C,IAAI;gBACA,MAAM,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;aACtC;YAAC,WAAM;gBACJ,6EAA6E;gBAC7E,2FAA2F;gBAC3F,+DAA+D;gBAC/D,OAAO,cAAc,CAAC,OAAO,CAAC;aACjC;oBAAS;gBACN,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC/B;YAED,IAAI,GAAG,MAAM,eAAe,CAAY,MAAM,EAAE,KAAK,CAAC,CAAC;SAC1D;aAAM;YACH,kCAAkC;YAClC,IAAI,GAAG,QAA4B,CAAC;SACvC;QAED,oHAAoH;QACpH,8EAA8E;QAC9E,MAAM,UAAU,GAAG,MAAM,sBAAsB,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAEvG,cAAc,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAE9C,OAAO;YACH,IAAI;YACJ,UAAU;SACb,CAAC;IACN,CAAC,CAAA,EACD,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CAAC,CACpC,CAAC;IAEF,OAAO,YAAY,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAsB;IACvD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACjC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;KAC9E;AACL,CAAC"}
@@ -0,0 +1,153 @@
1
+ import { GetRecoilValue, RecoilValue } from 'recoil';
2
+ import { WebSocketClientInterface } from '../../api';
3
+ import { GlobalTaskContext } from '../../shared/context/global-task-context';
4
+ import { AnyVariable, DerivedDataVariable, DerivedVariable, ResolvedDataVariable, ResolvedDerivedDataVariable, ResolvedDerivedVariable } from '../../types';
5
+ import { TriggerIndexValue } from './store';
6
+ export interface DerivedVariableValueResponse<T> {
7
+ cache_key: string;
8
+ value: T;
9
+ }
10
+ type DerivedVariableResponse<T> = DerivedVariableTaskResponse | DerivedVariableValueResponse<T>;
11
+ export declare function isTaskResponse(dvResponse: DerivedVariableResponse<any>): dvResponse is DerivedVariableTaskResponse;
12
+ interface DerivedVariableTaskResponse {
13
+ cache_key: string;
14
+ task_id: string;
15
+ }
16
+ /**
17
+ * Format values into a shape expected by the backend.
18
+ *
19
+ * @param values list of values - plain values or ResolvedDerivedVariable constructs with plain values nested inside
20
+ */
21
+ export declare function formatDerivedVariableRequest(values: Array<any | ResolvedDerivedVariable>): any[];
22
+ interface FetchDerivedVariableArgs {
23
+ cache: DerivedVariable['cache'];
24
+ force: boolean;
25
+ is_data_variable?: boolean;
26
+ token: string;
27
+ uid: string;
28
+ values: Record<string | number, any>;
29
+ wsClient: WebSocketClientInterface;
30
+ }
31
+ /**
32
+ * Fetch the value of a derived variable from the backend
33
+ *
34
+ * @param input Function inputs
35
+ * - `cache`, the cache option for the derived variable.
36
+ * - `force`, send force=true in the request body
37
+ * - `sessionToken`, bearer token for the session
38
+ * - `uid`, the uid of the derived variable
39
+ * - `values`, values to pass in the request
40
+ * - `wsClient`, websocket client
41
+ */
42
+ export declare function fetchDerivedVariable<T>({ cache, force, token, uid, values, wsClient, is_data_variable, }: FetchDerivedVariableArgs): Promise<DerivedVariableResponse<T>>;
43
+ /**
44
+ * Resolve a value to a format understood by the backend, resolving atoms to values.
45
+ *
46
+ * @param value value to resolve
47
+ * @param getter recoil getter function
48
+ */
49
+ export declare function resolveValue(value: ResolvedDerivedVariable | ResolvedDerivedDataVariable | ResolvedDataVariable | RecoilValue<any>, getter: GetRecoilValue): any;
50
+ /**
51
+ * Recursively build a deps array from a list of values
52
+ * Values not in deps array are replaced with empty array
53
+ *
54
+ * @param values array of primitives and ResolvedDerivedVariable objects
55
+ * @param deps array of indexes of dependencies to get values from
56
+ */
57
+ export declare function getDeps(values: Array<ResolvedDerivedVariable | any>, deps?: number[]): any[];
58
+ /**
59
+ * A helper hook that turns a DerivedVariable into its trigger index value.
60
+ * Useful to subscribe a component to forced trigger updates.
61
+ *
62
+ * @param variable variable to use
63
+ */
64
+ export declare function useTriggerIndex(variable: DerivedVariable): TriggerIndexValue;
65
+ /**
66
+ * DerivedVariable resolution result meaning that the value did not change since last time
67
+ * and should be returned from the previous entry.
68
+ */
69
+ interface PreviousResult {
70
+ /**
71
+ * Previous entry in the depsRegistry found to not have been changed
72
+ */
73
+ entry: {
74
+ args: any[];
75
+ cacheKey: string;
76
+ result: any;
77
+ };
78
+ type: 'previous';
79
+ }
80
+ /**
81
+ * DerivedVariable resolution result meaning that the value changed since last time
82
+ * and should be refetched.
83
+ */
84
+ interface CurrentResult {
85
+ /**
86
+ * Whether the refetch should be forcing
87
+ */
88
+ force: boolean;
89
+ /**
90
+ * List of new 'relevant' values which should be used to update the depsRegistry entry if refetch was successful
91
+ */
92
+ relevantValues: any[];
93
+ type: 'current';
94
+ /**
95
+ * List of values to use in the refetch request
96
+ */
97
+ values: any[];
98
+ }
99
+ /**
100
+ * Represents the result of a derived variable resolution.
101
+ */
102
+ type DerivedResult = PreviousResult | CurrentResult;
103
+ /**
104
+ * Resolve a derived value from a list of dependant variables and their resolved values.
105
+ *
106
+ * Handles a dependency array, where in case 'relevant' (i.e. present in deps) values did not change,
107
+ * an earlier result from the `depsRegistry` is returned.
108
+ *
109
+ * This is the core of the derived variable resolution logic, extracted so that it can be used in both
110
+ * DerivedVariable and py_component logic.
111
+ *
112
+ * @param key unique key to look up `depsRegistry` entry from
113
+ * @param variables dependant variables
114
+ * @param deps list of relevant dependant variables, akin to useEffect dependency array
115
+ * @param resolvedVariables resolved values of dependant variables - turned into primitives and Resolved forms
116
+ * @param wsClient websocket client
117
+ * @param get getter function to resolve atoms to values
118
+ * @param selfTrigger additional trigger index value to register as a dependency
119
+ */
120
+ export declare function resolveDerivedValue(key: string, variables: AnyVariable<any>[], deps: AnyVariable<any>[], resolvedVariables: any[], wsClient: WebSocketClientInterface, get: GetRecoilValue, selfTrigger?: TriggerIndexValue): Promise<DerivedResult>;
121
+ /**
122
+ * Get a derived variable from the selector registry, registering it if not already registered
123
+ *
124
+ * @param variable variable to register
125
+ * @param wsClient WebSocket client from context
126
+ * @param tasks tasks list from context
127
+ * @param search search query from location
128
+ * @param sessionToken session token from context
129
+ */
130
+ export declare function getOrRegisterDerivedVariable(variable: DerivedVariable | DerivedDataVariable, wsClient: WebSocketClientInterface, taskContext: GlobalTaskContext, search: string, token: string): RecoilValue<DerivedVariableValueResponse<any>>;
131
+ /**
132
+ * Get a derived selector for a derived variable.
133
+ * Retrieves the value of the derived variable directly instead of returning an object with cache_key and value.
134
+ *
135
+ * @param variable variable to register
136
+ * @param wsClient WebSocket client from context
137
+ * @param taskContext global task context
138
+ * @param search search query from location
139
+ * @param sessionToken session token from context
140
+ */
141
+ export declare function getOrRegisterDerivedVariableValue(variable: DerivedVariable, wsClient: WebSocketClientInterface, taskContext: GlobalTaskContext, search: string, token: string): RecoilValue<any>;
142
+ /**
143
+ * Helper hook to get the (data) derived variable selector, while correctly registering triggers and setting up polling interval.
144
+ *
145
+ * @param variable derived variable to use
146
+ * @param WsClient websocket client instance
147
+ * @param taskContext global task context
148
+ * @param search search query
149
+ * @param token auth context
150
+ */
151
+ export declare function useDerivedVariable(variable: DerivedVariable | DerivedDataVariable, WsClient: WebSocketClientInterface, taskContext: GlobalTaskContext, search: string, token: string): RecoilValue<DerivedVariableValueResponse<any>>;
152
+ export {};
153
+ //# sourceMappingURL=derived-variable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derived-variable.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/derived-variable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,WAAW,EAA+C,MAAM,QAAQ,CAAC;AAOlG,OAA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