@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.
- package/LICENSE +201 -0
- package/README.md +7 -0
- package/dist/actions/download-content.d.ts +8 -0
- package/dist/actions/download-content.d.ts.map +1 -0
- package/dist/actions/download-content.js +46 -0
- package/dist/actions/download-content.js.map +1 -0
- package/dist/actions/download-variable.d.ts +8 -0
- package/dist/actions/download-variable.d.ts.map +1 -0
- package/dist/actions/download-variable.js +153 -0
- package/dist/actions/download-variable.js.map +1 -0
- package/dist/actions/index.d.ts +11 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +11 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/logout.d.ts +8 -0
- package/dist/actions/logout.d.ts.map +1 -0
- package/dist/actions/logout.js +24 -0
- package/dist/actions/logout.js.map +1 -0
- package/dist/actions/navigate-to.d.ts +8 -0
- package/dist/actions/navigate-to.d.ts.map +1 -0
- package/dist/actions/navigate-to.js +77 -0
- package/dist/actions/navigate-to.js.map +1 -0
- package/dist/actions/notify.d.ts +8 -0
- package/dist/actions/notify.d.ts.map +1 -0
- package/dist/actions/notify.js +16 -0
- package/dist/actions/notify.js.map +1 -0
- package/dist/actions/reset-variables.d.ts +8 -0
- package/dist/actions/reset-variables.d.ts.map +1 -0
- package/dist/actions/reset-variables.js +24 -0
- package/dist/actions/reset-variables.js.map +1 -0
- package/dist/actions/side-effect.d.ts +8 -0
- package/dist/actions/side-effect.d.ts.map +1 -0
- package/dist/actions/side-effect.js +44 -0
- package/dist/actions/side-effect.js.map +1 -0
- package/dist/actions/trigger-variable.d.ts +8 -0
- package/dist/actions/trigger-variable.d.ts.map +1 -0
- package/dist/actions/trigger-variable.js +25 -0
- package/dist/actions/trigger-variable.js.map +1 -0
- package/dist/actions/update-variable.d.ts +9 -0
- package/dist/actions/update-variable.d.ts.map +1 -0
- package/dist/actions/update-variable.js +89 -0
- package/dist/actions/update-variable.js.map +1 -0
- package/dist/actions/utils.d.ts +9 -0
- package/dist/actions/utils.d.ts.map +1 -0
- package/dist/actions/utils.js +37 -0
- package/dist/actions/utils.js.map +1 -0
- package/dist/api/core.d.ts +34 -0
- package/dist/api/core.d.ts.map +1 -0
- package/dist/api/core.js +110 -0
- package/dist/api/core.js.map +1 -0
- package/dist/api/http.d.ts +9 -0
- package/dist/api/http.d.ts.map +1 -0
- package/dist/api/http.js +38 -0
- package/dist/api/http.js.map +1 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +5 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/websocket.d.ts +140 -0
- package/dist/api/websocket.d.ts.map +1 -0
- package/dist/api/websocket.js +241 -0
- package/dist/api/websocket.js.map +1 -0
- package/dist/assets/fonts/Manrope-VariableFont_wght.ttf +0 -0
- package/dist/assets/login-background.svg +11 -0
- package/dist/assets/logo.svg +12 -0
- package/dist/auth/auth-context.d.ts +22 -0
- package/dist/auth/auth-context.d.ts.map +1 -0
- package/dist/auth/auth-context.js +18 -0
- package/dist/auth/auth-context.js.map +1 -0
- package/dist/auth/auth-wrapper.d.ts +14 -0
- package/dist/auth/auth-wrapper.d.ts.map +1 -0
- package/dist/auth/auth-wrapper.js +90 -0
- package/dist/auth/auth-wrapper.js.map +1 -0
- package/dist/auth/auth.d.ts +61 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/auth.js +161 -0
- package/dist/auth/auth.js.map +1 -0
- package/dist/auth/basic/basic-auth-login.d.ts +6 -0
- package/dist/auth/basic/basic-auth-login.d.ts.map +1 -0
- package/dist/auth/basic/basic-auth-login.js +174 -0
- package/dist/auth/basic/basic-auth-login.js.map +1 -0
- package/dist/auth/basic/basic-auth-logout.d.ts +6 -0
- package/dist/auth/basic/basic-auth-logout.d.ts.map +1 -0
- package/dist/auth/basic/basic-auth-logout.js +18 -0
- package/dist/auth/basic/basic-auth-logout.js.map +1 -0
- package/dist/auth/default/default-auth-login.d.ts +6 -0
- package/dist/auth/default/default-auth-login.d.ts.map +1 -0
- package/dist/auth/default/default-auth-login.js +66 -0
- package/dist/auth/default/default-auth-login.js.map +1 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/components/fallback/default.d.ts +5 -0
- package/dist/components/fallback/default.d.ts.map +1 -0
- package/dist/components/fallback/default.js +10 -0
- package/dist/components/fallback/default.js.map +1 -0
- package/dist/components/fallback/dots.d.ts +8 -0
- package/dist/components/fallback/dots.d.ts.map +1 -0
- package/dist/components/fallback/dots.js +77 -0
- package/dist/components/fallback/dots.js.map +1 -0
- package/dist/components/fallback/row.d.ts +5 -0
- package/dist/components/fallback/row.d.ts.map +1 -0
- package/dist/components/fallback/row.js +14 -0
- package/dist/components/fallback/row.js.map +1 -0
- package/dist/components/for/for.d.ts +35 -0
- package/dist/components/for/for.d.ts.map +1 -0
- package/dist/components/for/for.js +43 -0
- package/dist/components/for/for.js.map +1 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/menu/menu.d.ts +14 -0
- package/dist/components/menu/menu.d.ts.map +1 -0
- package/dist/components/menu/menu.js +58 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/progress-tracker/progress-tracker.d.ts +18 -0
- package/dist/components/progress-tracker/progress-tracker.d.ts.map +1 -0
- package/dist/components/progress-tracker/progress-tracker.js +202 -0
- package/dist/components/progress-tracker/progress-tracker.js.map +1 -0
- package/dist/components/router-content/router-content.d.ts +14 -0
- package/dist/components/router-content/router-content.d.ts.map +1 -0
- package/dist/components/router-content/router-content.js +17 -0
- package/dist/components/router-content/router-content.js.map +1 -0
- package/dist/components/side-bar-frame/side-bar-frame.d.ts +21 -0
- package/dist/components/side-bar-frame/side-bar-frame.d.ts.map +1 -0
- package/dist/components/side-bar-frame/side-bar-frame.js +63 -0
- package/dist/components/side-bar-frame/side-bar-frame.js.map +1 -0
- package/dist/components/top-bar-frame/top-bar-frame.d.ts +16 -0
- package/dist/components/top-bar-frame/top-bar-frame.d.ts.map +1 -0
- package/dist/components/top-bar-frame/top-bar-frame.js +70 -0
- package/dist/components/top-bar-frame/top-bar-frame.js.map +1 -0
- package/dist/dara_core-1.0.0a1-py3-none-any.whl +0 -0
- package/dist/devtools/backend-errors/backend-errors-ctx.d.ts +17 -0
- package/dist/devtools/backend-errors/backend-errors-ctx.d.ts.map +1 -0
- package/dist/devtools/backend-errors/backend-errors-ctx.js +37 -0
- package/dist/devtools/backend-errors/backend-errors-ctx.js.map +1 -0
- package/dist/devtools/backend-errors/backend-errors.d.ts +6 -0
- package/dist/devtools/backend-errors/backend-errors.d.ts.map +1 -0
- package/dist/devtools/backend-errors/backend-errors.js +57 -0
- package/dist/devtools/backend-errors/backend-errors.js.map +1 -0
- package/dist/devtools/backend-errors/error-display.d.ts +22 -0
- package/dist/devtools/backend-errors/error-display.d.ts.map +1 -0
- package/dist/devtools/backend-errors/error-display.js +99 -0
- package/dist/devtools/backend-errors/error-display.js.map +1 -0
- package/dist/devtools/backend-errors/index.d.ts +3 -0
- package/dist/devtools/backend-errors/index.d.ts.map +1 -0
- package/dist/devtools/backend-errors/index.js +3 -0
- package/dist/devtools/backend-errors/index.js.map +1 -0
- package/dist/devtools/devtools-content.d.ts +12 -0
- package/dist/devtools/devtools-content.d.ts.map +1 -0
- package/dist/devtools/devtools-content.js +73 -0
- package/dist/devtools/devtools-content.js.map +1 -0
- package/dist/devtools/devtools-context.d.ts +7 -0
- package/dist/devtools/devtools-context.d.ts.map +1 -0
- package/dist/devtools/devtools-context.js +9 -0
- package/dist/devtools/devtools-context.js.map +1 -0
- package/dist/devtools/devtools-wrapper.d.ts +8 -0
- package/dist/devtools/devtools-wrapper.d.ts.map +1 -0
- package/dist/devtools/devtools-wrapper.js +64 -0
- package/dist/devtools/devtools-wrapper.js.map +1 -0
- package/dist/devtools/devtools.d.ts +5 -0
- package/dist/devtools/devtools.d.ts.map +1 -0
- package/dist/devtools/devtools.js +10 -0
- package/dist/devtools/devtools.js.map +1 -0
- package/dist/devtools/floating-button.d.ts +24 -0
- package/dist/devtools/floating-button.d.ts.map +1 -0
- package/dist/devtools/floating-button.js +96 -0
- package/dist/devtools/floating-button.js.map +1 -0
- package/dist/devtools/index.d.ts +2 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +2 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/devtools/resizer.d.ts +18 -0
- package/dist/devtools/resizer.d.ts.map +1 -0
- package/dist/devtools/resizer.js +48 -0
- package/dist/devtools/resizer.js.map +1 -0
- package/dist/devtools/use-move.d.ts +21 -0
- package/dist/devtools/use-move.d.ts.map +1 -0
- package/dist/devtools/use-move.js +55 -0
- package/dist/devtools/use-move.js.map +1 -0
- package/dist/index.css +95 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/jest-setup.d.ts +2 -0
- package/dist/jest-setup.d.ts.map +1 -0
- package/dist/jest-setup.js +7 -0
- package/dist/jest-setup.js.map +1 -0
- package/dist/pages/error-page.d.ts +3 -0
- package/dist/pages/error-page.d.ts.map +1 -0
- package/dist/pages/error-page.js +32 -0
- package/dist/pages/error-page.js.map +1 -0
- package/dist/pages/sso-callback-page.d.ts +6 -0
- package/dist/pages/sso-callback-page.d.ts.map +1 -0
- package/dist/pages/sso-callback-page.js +8 -0
- package/dist/pages/sso-callback-page.js.map +1 -0
- package/dist/run.d.ts +22 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +40 -0
- package/dist/run.js.map +1 -0
- package/dist/shared/center/center.d.ts +5 -0
- package/dist/shared/center/center.d.ts.map +1 -0
- package/dist/shared/center/center.js +15 -0
- package/dist/shared/center/center.js.map +1 -0
- package/dist/shared/context/direction-context.d.ts +7 -0
- package/dist/shared/context/direction-context.d.ts.map +1 -0
- package/dist/shared/context/direction-context.js +4 -0
- package/dist/shared/context/direction-context.js.map +1 -0
- package/dist/shared/context/display-context.d.ts +14 -0
- package/dist/shared/context/display-context.d.ts.map +1 -0
- package/dist/shared/context/display-context.js +4 -0
- package/dist/shared/context/display-context.js.map +1 -0
- package/dist/shared/context/fallback-context.d.ts +11 -0
- package/dist/shared/context/fallback-context.d.ts.map +1 -0
- package/dist/shared/context/fallback-context.js +4 -0
- package/dist/shared/context/fallback-context.js.map +1 -0
- package/dist/shared/context/global-task-context.d.ts +40 -0
- package/dist/shared/context/global-task-context.d.ts.map +1 -0
- package/dist/shared/context/global-task-context.js +78 -0
- package/dist/shared/context/global-task-context.js.map +1 -0
- package/dist/shared/context/importers-context.d.ts +7 -0
- package/dist/shared/context/importers-context.d.ts.map +1 -0
- package/dist/shared/context/importers-context.js +4 -0
- package/dist/shared/context/importers-context.js.map +1 -0
- package/dist/shared/context/index.d.ts +10 -0
- package/dist/shared/context/index.d.ts.map +1 -0
- package/dist/shared/context/index.js +10 -0
- package/dist/shared/context/index.js.map +1 -0
- package/dist/shared/context/registries-context.d.ts +21 -0
- package/dist/shared/context/registries-context.d.ts.map +1 -0
- package/dist/shared/context/registries-context.js +8 -0
- package/dist/shared/context/registries-context.js.map +1 -0
- package/dist/shared/context/variable-context.d.ts +10 -0
- package/dist/shared/context/variable-context.d.ts.map +1 -0
- package/dist/shared/context/variable-context.js +4 -0
- package/dist/shared/context/variable-context.js.map +1 -0
- package/dist/shared/context/websocket-context.d.ts +8 -0
- package/dist/shared/context/websocket-context.d.ts.map +1 -0
- package/dist/shared/context/websocket-context.js +4 -0
- package/dist/shared/context/websocket-context.js.map +1 -0
- package/dist/shared/dynamic-component/dynamic-component.d.ts +16 -0
- package/dist/shared/dynamic-component/dynamic-component.d.ts.map +1 -0
- package/dist/shared/dynamic-component/dynamic-component.js +243 -0
- package/dist/shared/dynamic-component/dynamic-component.js.map +1 -0
- package/dist/shared/error-handling/error-display.d.ts +8 -0
- package/dist/shared/error-handling/error-display.d.ts.map +1 -0
- package/dist/shared/error-handling/error-display.js +92 -0
- package/dist/shared/error-handling/error-display.js.map +1 -0
- package/dist/shared/error-handling/index.d.ts +3 -0
- package/dist/shared/error-handling/index.d.ts.map +1 -0
- package/dist/shared/error-handling/index.js +3 -0
- package/dist/shared/error-handling/index.js.map +1 -0
- package/dist/shared/error-handling/types.d.ts +10 -0
- package/dist/shared/error-handling/types.d.ts.map +1 -0
- package/dist/shared/error-handling/types.js +9 -0
- package/dist/shared/error-handling/types.js.map +1 -0
- package/dist/shared/index.d.ts +11 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +9 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/interactivity/data-variable.d.ts +66 -0
- package/dist/shared/interactivity/data-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/data-variable.js +186 -0
- package/dist/shared/interactivity/data-variable.js.map +1 -0
- package/dist/shared/interactivity/derived-variable.d.ts +153 -0
- package/dist/shared/interactivity/derived-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/derived-variable.js +403 -0
- package/dist/shared/interactivity/derived-variable.js.map +1 -0
- package/dist/shared/interactivity/filtering.d.ts +9 -0
- package/dist/shared/interactivity/filtering.d.ts.map +1 -0
- package/dist/shared/interactivity/filtering.js +20 -0
- package/dist/shared/interactivity/filtering.js.map +1 -0
- package/dist/shared/interactivity/index.d.ts +12 -0
- package/dist/shared/interactivity/index.d.ts.map +1 -0
- package/dist/shared/interactivity/index.js +11 -0
- package/dist/shared/interactivity/index.js.map +1 -0
- package/dist/shared/interactivity/internal.d.ts +8 -0
- package/dist/shared/interactivity/internal.d.ts.map +1 -0
- package/dist/shared/interactivity/internal.js +10 -0
- package/dist/shared/interactivity/internal.js.map +1 -0
- package/dist/shared/interactivity/nested.d.ts +16 -0
- package/dist/shared/interactivity/nested.d.ts.map +1 -0
- package/dist/shared/interactivity/nested.js +50 -0
- package/dist/shared/interactivity/nested.js.map +1 -0
- package/dist/shared/interactivity/plain-variable.d.ts +23 -0
- package/dist/shared/interactivity/plain-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/plain-variable.js +89 -0
- package/dist/shared/interactivity/plain-variable.js.map +1 -0
- package/dist/shared/interactivity/resolve-value.d.ts +13 -0
- package/dist/shared/interactivity/resolve-value.d.ts.map +1 -0
- package/dist/shared/interactivity/resolve-value.js +36 -0
- package/dist/shared/interactivity/resolve-value.js.map +1 -0
- package/dist/shared/interactivity/resolve-variable.d.ts +18 -0
- package/dist/shared/interactivity/resolve-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/resolve-variable.js +47 -0
- package/dist/shared/interactivity/resolve-variable.js.map +1 -0
- package/dist/shared/interactivity/store.d.ts +35 -0
- package/dist/shared/interactivity/store.d.ts.map +1 -0
- package/dist/shared/interactivity/store.js +47 -0
- package/dist/shared/interactivity/store.js.map +1 -0
- package/dist/shared/interactivity/triggers.d.ts +31 -0
- package/dist/shared/interactivity/triggers.d.ts.map +1 -0
- package/dist/shared/interactivity/triggers.js +105 -0
- package/dist/shared/interactivity/triggers.js.map +1 -0
- package/dist/shared/interactivity/url-variable.d.ts +12 -0
- package/dist/shared/interactivity/url-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/url-variable.js +28 -0
- package/dist/shared/interactivity/url-variable.js.map +1 -0
- package/dist/shared/interactivity/use-any-variable.d.ts +8 -0
- package/dist/shared/interactivity/use-any-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/use-any-variable.js +38 -0
- package/dist/shared/interactivity/use-any-variable.js.map +1 -0
- package/dist/shared/interactivity/use-data-variable.d.ts +12 -0
- package/dist/shared/interactivity/use-data-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/use-data-variable.js +56 -0
- package/dist/shared/interactivity/use-data-variable.js.map +1 -0
- package/dist/shared/interactivity/use-refresh-selector.d.ts +5 -0
- package/dist/shared/interactivity/use-refresh-selector.d.ts.map +1 -0
- package/dist/shared/interactivity/use-refresh-selector.js +16 -0
- package/dist/shared/interactivity/use-refresh-selector.js.map +1 -0
- package/dist/shared/interactivity/use-reset-variables.d.ts +8 -0
- package/dist/shared/interactivity/use-reset-variables.d.ts.map +1 -0
- package/dist/shared/interactivity/use-reset-variables.js +46 -0
- package/dist/shared/interactivity/use-reset-variables.js.map +1 -0
- package/dist/shared/interactivity/use-server-component.d.ts +24 -0
- package/dist/shared/interactivity/use-server-component.d.ts.map +1 -0
- package/dist/shared/interactivity/use-server-component.js +227 -0
- package/dist/shared/interactivity/use-server-component.js.map +1 -0
- package/dist/shared/interactivity/use-trigger-variable.d.ts +9 -0
- package/dist/shared/interactivity/use-trigger-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/use-trigger-variable.js +18 -0
- package/dist/shared/interactivity/use-trigger-variable.js.map +1 -0
- package/dist/shared/interactivity/use-variable-state.d.ts +9 -0
- package/dist/shared/interactivity/use-variable-state.d.ts.map +1 -0
- package/dist/shared/interactivity/use-variable-state.js +35 -0
- package/dist/shared/interactivity/use-variable-state.js.map +1 -0
- package/dist/shared/interactivity/use-variable-value.d.ts +20 -0
- package/dist/shared/interactivity/use-variable-value.d.ts.map +1 -0
- package/dist/shared/interactivity/use-variable-value.js +77 -0
- package/dist/shared/interactivity/use-variable-value.js.map +1 -0
- package/dist/shared/interactivity/use-variable.d.ts +11 -0
- package/dist/shared/interactivity/use-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/use-variable.js +62 -0
- package/dist/shared/interactivity/use-variable.js.map +1 -0
- package/dist/shared/private-route/private-route.d.ts +23 -0
- package/dist/shared/private-route/private-route.d.ts.map +1 -0
- package/dist/shared/private-route/private-route.js +39 -0
- package/dist/shared/private-route/private-route.js.map +1 -0
- package/dist/shared/template-root/dynamic-context.d.ts +9 -0
- package/dist/shared/template-root/dynamic-context.d.ts.map +1 -0
- package/dist/shared/template-root/dynamic-context.js +28 -0
- package/dist/shared/template-root/dynamic-context.js.map +1 -0
- package/dist/shared/template-root/template-root.d.ts +8 -0
- package/dist/shared/template-root/template-root.d.ts.map +1 -0
- package/dist/shared/template-root/template-root.js +76 -0
- package/dist/shared/template-root/template-root.js.map +1 -0
- package/dist/shared/utils/clean-session-cache.d.ts +9 -0
- package/dist/shared/utils/clean-session-cache.d.ts.map +1 -0
- package/dist/shared/utils/clean-session-cache.js +17 -0
- package/dist/shared/utils/clean-session-cache.js.map +1 -0
- package/dist/shared/utils/embed.d.ts +13 -0
- package/dist/shared/utils/embed.d.ts.map +1 -0
- package/dist/shared/utils/embed.js +23 -0
- package/dist/shared/utils/embed.js.map +1 -0
- package/dist/shared/utils/get-icon.d.ts +9 -0
- package/dist/shared/utils/get-icon.d.ts.map +1 -0
- package/dist/shared/utils/get-icon.js +30 -0
- package/dist/shared/utils/get-icon.js.map +1 -0
- package/dist/shared/utils/hashing.d.ts +14 -0
- package/dist/shared/utils/hashing.d.ts.map +1 -0
- package/dist/shared/utils/hashing.js +26 -0
- package/dist/shared/utils/hashing.js.map +1 -0
- package/dist/shared/utils/index.d.ts +18 -0
- package/dist/shared/utils/index.d.ts.map +1 -0
- package/dist/shared/utils/index.js +16 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/inject-css.d.ts +13 -0
- package/dist/shared/utils/inject-css.d.ts.map +1 -0
- package/dist/shared/utils/inject-css.js +25 -0
- package/dist/shared/utils/inject-css.js.map +1 -0
- package/dist/shared/utils/is-js-component.d.ts +9 -0
- package/dist/shared/utils/is-js-component.d.ts.map +1 -0
- package/dist/shared/utils/is-js-component.js +11 -0
- package/dist/shared/utils/is-js-component.js.map +1 -0
- package/dist/shared/utils/normalization.d.ts +19 -0
- package/dist/shared/utils/normalization.d.ts.map +1 -0
- package/dist/shared/utils/normalization.js +118 -0
- package/dist/shared/utils/normalization.js.map +1 -0
- package/dist/shared/utils/resolve-theme.d.ts +9 -0
- package/dist/shared/utils/resolve-theme.d.ts.map +1 -0
- package/dist/shared/utils/resolve-theme.js +28 -0
- package/dist/shared/utils/resolve-theme.js.map +1 -0
- package/dist/shared/utils/templating.d.ts +24 -0
- package/dist/shared/utils/templating.d.ts.map +1 -0
- package/dist/shared/utils/templating.js +67 -0
- package/dist/shared/utils/templating.js.map +1 -0
- package/dist/shared/utils/use-action-registry.d.ts +11 -0
- package/dist/shared/utils/use-action-registry.d.ts.map +1 -0
- package/dist/shared/utils/use-action-registry.js +18 -0
- package/dist/shared/utils/use-action-registry.js.map +1 -0
- package/dist/shared/utils/use-action.d.ts +9 -0
- package/dist/shared/utils/use-action.d.ts.map +1 -0
- package/dist/shared/utils/use-action.js +84 -0
- package/dist/shared/utils/use-action.js.map +1 -0
- package/dist/shared/utils/use-component-registry.d.ts +11 -0
- package/dist/shared/utils/use-component-registry.d.ts.map +1 -0
- package/dist/shared/utils/use-component-registry.js +46 -0
- package/dist/shared/utils/use-component-registry.js.map +1 -0
- package/dist/shared/utils/use-component-styles.d.ts +24 -0
- package/dist/shared/utils/use-component-styles.d.ts.map +1 -0
- package/dist/shared/utils/use-component-styles.js +68 -0
- package/dist/shared/utils/use-component-styles.js.map +1 -0
- package/dist/shared/utils/use-defer-loadable.d.ts +8 -0
- package/dist/shared/utils/use-defer-loadable.d.ts.map +1 -0
- package/dist/shared/utils/use-defer-loadable.js +44 -0
- package/dist/shared/utils/use-defer-loadable.js.map +1 -0
- package/dist/shared/utils/use-interval.d.ts +9 -0
- package/dist/shared/utils/use-interval.d.ts.map +1 -0
- package/dist/shared/utils/use-interval.js +18 -0
- package/dist/shared/utils/use-interval.js.map +1 -0
- package/dist/shared/utils/use-previous.d.ts +10 -0
- package/dist/shared/utils/use-previous.d.ts.map +1 -0
- package/dist/shared/utils/use-previous.js +17 -0
- package/dist/shared/utils/use-previous.js.map +1 -0
- package/dist/shared/utils/use-url-sync.d.ts +20 -0
- package/dist/shared/utils/use-url-sync.d.ts.map +1 -0
- package/dist/shared/utils/use-url-sync.js +68 -0
- package/dist/shared/utils/use-url-sync.js.map +1 -0
- package/dist/shared/utils/use-window-title.d.ts +3 -0
- package/dist/shared/utils/use-window-title.d.ts.map +1 -0
- package/dist/shared/utils/use-window-title.js +14 -0
- package/dist/shared/utils/use-window-title.js.map +1 -0
- package/dist/shared/variable-state-provider/variable-state-provider.d.ts +10 -0
- package/dist/shared/variable-state-provider/variable-state-provider.d.ts.map +1 -0
- package/dist/shared/variable-state-provider/variable-state-provider.js +21 -0
- package/dist/shared/variable-state-provider/variable-state-provider.js.map +1 -0
- package/dist/shared/wrapper/wrapper.d.ts +7 -0
- package/dist/shared/wrapper/wrapper.d.ts.map +1 -0
- package/dist/shared/wrapper/wrapper.js +14 -0
- package/dist/shared/wrapper/wrapper.js.map +1 -0
- package/dist/types/auth.d.ts +15 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +6 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/core.d.ts +325 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +22 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/utils.d.ts +50 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +84 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/umd/dara.core.umd.js +93592 -0
- package/dist/umd/style.css +848 -0
- package/package.json +117 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { useNotifications } from '@darajs/ui-notifications';
|
|
4
|
+
/**
|
|
5
|
+
* Frontend handler for Notify action
|
|
6
|
+
* Pushes a notification with the data given in the action
|
|
7
|
+
*/
|
|
8
|
+
const Notify = (action) => {
|
|
9
|
+
const { pushNotification } = useNotifications();
|
|
10
|
+
return useCallback(() => new Promise((resolve) => {
|
|
11
|
+
pushNotification(action);
|
|
12
|
+
resolve();
|
|
13
|
+
}), [action]);
|
|
14
|
+
};
|
|
15
|
+
export default Notify;
|
|
16
|
+
//# sourceMappingURL=notify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../js/actions/notify.tsx"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D;;;GAGG;AACH,MAAM,MAAM,GAAsC,CAAC,MAAM,EAAE,EAAE;IACzD,MAAM,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEhD,OAAO,WAAW,CACd,GAAkB,EAAE,CAChB,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACpB,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACzB,OAAO,EAAE,CAAC;IACd,CAAC,CAAC,EACN,CAAC,MAAM,CAAC,CACX,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionHook, ResetVariablesInstance } from '../types/core';
|
|
2
|
+
/**
|
|
3
|
+
* Front-end handler for ResetVariables action.
|
|
4
|
+
* Sequentially resets variables to their default values (or forces a recalculation for DerivedVariables)
|
|
5
|
+
*/
|
|
6
|
+
declare const ResetVariables: ActionHook<never, ResetVariablesInstance>;
|
|
7
|
+
export default ResetVariables;
|
|
8
|
+
//# sourceMappingURL=reset-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-variables.d.ts","sourceRoot":"","sources":["../../js/actions/reset-variables.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAElE;;;GAGG;AACH,QAAA,MAAM,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE,sBAAsB,CAM7D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 } from 'react';
|
|
11
|
+
import { useResetVariables } from '../shared/interactivity';
|
|
12
|
+
/**
|
|
13
|
+
* Front-end handler for ResetVariables action.
|
|
14
|
+
* Sequentially resets variables to their default values (or forces a recalculation for DerivedVariables)
|
|
15
|
+
*/
|
|
16
|
+
const ResetVariables = (action) => {
|
|
17
|
+
const reset = useResetVariables(action.variables);
|
|
18
|
+
return useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
reset();
|
|
20
|
+
return Promise.resolve();
|
|
21
|
+
}), [reset]);
|
|
22
|
+
};
|
|
23
|
+
export default ResetVariables;
|
|
24
|
+
//# sourceMappingURL=reset-variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-variables.js","sourceRoot":"","sources":["../../js/actions/reset-variables.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;;GAGG;AACH,MAAM,cAAc,GAA8C,CAAC,MAAM,EAAE,EAAE;IACzE,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAClD,OAAO,WAAW,CAAC,GAAS,EAAE;QAC1B,KAAK,EAAE,CAAC;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC,CAAA,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionHook, SideEffectInstance } from '../types/core';
|
|
2
|
+
/**
|
|
3
|
+
* Front-end handler for SideEffect action.
|
|
4
|
+
* Calls the backend to execute an arbitrary function.
|
|
5
|
+
*/
|
|
6
|
+
declare const SideEffect: ActionHook<void, SideEffectInstance>;
|
|
7
|
+
export default SideEffect;
|
|
8
|
+
//# sourceMappingURL=side-effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-effect.d.ts","sourceRoot":"","sources":["../../js/actions/side-effect.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE9D;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,kBAAkB,CA6BpD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 } from 'react';
|
|
11
|
+
import { useNotifications } from '@darajs/ui-notifications';
|
|
12
|
+
import { Status } from '@darajs/ui-utils';
|
|
13
|
+
import { resolveValue, useVariableValue } from '../shared/interactivity';
|
|
14
|
+
import { normalizeRequest } from '../shared/utils/normalization';
|
|
15
|
+
/**
|
|
16
|
+
* Front-end handler for SideEffect action.
|
|
17
|
+
* Calls the backend to execute an arbitrary function.
|
|
18
|
+
*/
|
|
19
|
+
const SideEffect = (action, { fetchAction }) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
22
|
+
const extras = (_b = (_a = action.extras) === null || _a === void 0 ? void 0 : _a.map((variable) => useVariableValue(variable))) !== null && _b !== void 0 ? _b : [];
|
|
23
|
+
const { pushNotification } = useNotifications();
|
|
24
|
+
return useCallback((value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const resolvedExtras = extras.map((extra) => resolveValue(extra, false));
|
|
26
|
+
const normalizedExtras = normalizeRequest(resolvedExtras, action.extras);
|
|
27
|
+
const resultPromise = fetchAction(action.uid, { extras: normalizedExtras, inputs: { value } }).catch(() => {
|
|
28
|
+
// Recover from server error - notify about the error
|
|
29
|
+
pushNotification({
|
|
30
|
+
key: action.uid,
|
|
31
|
+
message: 'Try again or contact the application owner',
|
|
32
|
+
status: Status.ERROR,
|
|
33
|
+
title: 'Error executing action',
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
// only wait for side effect to complete if block flag is set
|
|
37
|
+
if (action.block) {
|
|
38
|
+
yield resultPromise;
|
|
39
|
+
}
|
|
40
|
+
return Promise.resolve();
|
|
41
|
+
}), [action]);
|
|
42
|
+
};
|
|
43
|
+
export default SideEffect;
|
|
44
|
+
//# sourceMappingURL=side-effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-effect.js","sourceRoot":"","sources":["../../js/actions/side-effect.tsx"],"names":[],"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AAC;QAEH,6DAA6D;QAC7D,IAAI,MAAM,CAAC,KAAK,EAAE;YACd,MAAM,aAAa,CAAC;SACvB;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC,CAAA,EACD,CAAC,MAAM,CAAC,CACX,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionHook, TriggerVariableInstance } from '../types/core';
|
|
2
|
+
/**
|
|
3
|
+
* Front-end handler for TriggerVariable action.
|
|
4
|
+
* Forces the recalculation of a particular DerivedVariable.
|
|
5
|
+
*/
|
|
6
|
+
declare const TriggerVariable: ActionHook<never, TriggerVariableInstance>;
|
|
7
|
+
export default TriggerVariable;
|
|
8
|
+
//# sourceMappingURL=trigger-variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-variable.d.ts","sourceRoot":"","sources":["../../js/actions/trigger-variable.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEnE;;;GAGG;AACH,QAAA,MAAM,eAAe,EAAE,UAAU,CAAC,KAAK,EAAE,uBAAuB,CAO/D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 } from 'react';
|
|
11
|
+
import { useTriggerVariable } from '../shared/interactivity';
|
|
12
|
+
/**
|
|
13
|
+
* Front-end handler for TriggerVariable action.
|
|
14
|
+
* Forces the recalculation of a particular DerivedVariable.
|
|
15
|
+
*/
|
|
16
|
+
const TriggerVariable = (action) => {
|
|
17
|
+
// Use force flag based on setting on the Python side in the action def
|
|
18
|
+
const trigger = useTriggerVariable(action.variable, action.force);
|
|
19
|
+
return useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
trigger();
|
|
21
|
+
return Promise.resolve();
|
|
22
|
+
}), [trigger]);
|
|
23
|
+
};
|
|
24
|
+
export default TriggerVariable;
|
|
25
|
+
//# sourceMappingURL=trigger-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-variable.js","sourceRoot":"","sources":["../../js/actions/trigger-variable.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D;;;GAGG;AACH,MAAM,eAAe,GAA+C,CAAC,MAAM,EAAE,EAAE;IAC3E,uEAAuE;IACvE,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAClE,OAAO,WAAW,CAAC,GAAS,EAAE;QAC1B,OAAO,EAAE,CAAC;QACV,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC,CAAA,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionHook, UpdateVariableInstance } from '../types/core';
|
|
2
|
+
/**
|
|
3
|
+
* Front-end handler for UpdateVariable action.
|
|
4
|
+
* Calls the backend to calculate a new value for a variable based on the value passed into the action and optional
|
|
5
|
+
* extra variables. Then updates the value stored on the frontend with the value returned by the backend.
|
|
6
|
+
*/
|
|
7
|
+
declare const UpdateVariable: ActionHook<any, UpdateVariableInstance>;
|
|
8
|
+
export default UpdateVariable;
|
|
9
|
+
//# sourceMappingURL=update-variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-variable.d.ts","sourceRoot":"","sources":["../../js/actions/update-variable.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAElE;;;;GAIG;AACH,QAAA,MAAM,cAAc,EAAE,UAAU,CAAC,GAAG,EAAE,sBAAsB,CA0E3D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { useCallback } from 'react';
|
|
12
|
+
import { useNotifications } from '@darajs/ui-notifications';
|
|
13
|
+
import { Status } from '@darajs/ui-utils';
|
|
14
|
+
import { fetchTaskResult } from '../api';
|
|
15
|
+
import { useTaskContext } from '../shared/context';
|
|
16
|
+
import { useVariable, useVariableValue } from '../shared/interactivity';
|
|
17
|
+
import { resolveValue } from '../shared/interactivity/resolve-value';
|
|
18
|
+
import { normalizeRequest } from '../shared/utils/normalization';
|
|
19
|
+
import { isDataVariable } from '../types';
|
|
20
|
+
/**
|
|
21
|
+
* Front-end handler for UpdateVariable action.
|
|
22
|
+
* Calls the backend to calculate a new value for a variable based on the value passed into the action and optional
|
|
23
|
+
* extra variables. Then updates the value stored on the frontend with the value returned by the backend.
|
|
24
|
+
*/
|
|
25
|
+
const UpdateVariable = (action, { fetchAction, wsClient, sessionToken }) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const taskContext = useTaskContext();
|
|
28
|
+
const { pushNotification } = useNotifications();
|
|
29
|
+
let previousVariableValue = null;
|
|
30
|
+
let setUpdateVar = null;
|
|
31
|
+
// Do not call useVariable on a DateVariable as it will fetch its whole value
|
|
32
|
+
// we also don't need the setter as it's purely server-side
|
|
33
|
+
if (!isDataVariable(action.variable)) {
|
|
34
|
+
[previousVariableValue, setUpdateVar] = useVariable(action.variable);
|
|
35
|
+
}
|
|
36
|
+
const updateVar = useVariableValue(action.variable);
|
|
37
|
+
const extras = (_b = (_a = action.extras) === null || _a === void 0 ? void 0 : _a.map((variable) => useVariableValue(variable))) !== null && _b !== void 0 ? _b : [];
|
|
38
|
+
return useCallback((value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
const resolvedExtras = extras.map((extra) => resolveValue(extra, false));
|
|
40
|
+
const normalizedExtras = normalizeRequest(resolvedExtras, action.extras);
|
|
41
|
+
let variableValue = null;
|
|
42
|
+
try {
|
|
43
|
+
variableValue = yield fetchAction(action.uid, {
|
|
44
|
+
extras: normalizedExtras,
|
|
45
|
+
inputs: {
|
|
46
|
+
new: value,
|
|
47
|
+
old: resolveValue(updateVar, false),
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (_c) {
|
|
52
|
+
// Recover from server error - notify about the error and keep previous variable value
|
|
53
|
+
pushNotification({
|
|
54
|
+
key: action.uid,
|
|
55
|
+
message: 'Try again or contact the application owner',
|
|
56
|
+
status: Status.ERROR,
|
|
57
|
+
title: 'Error executing action',
|
|
58
|
+
});
|
|
59
|
+
return previousVariableValue;
|
|
60
|
+
}
|
|
61
|
+
// If variableValue is a MetaTask, wait for its result
|
|
62
|
+
if ((variableValue === null || variableValue === void 0 ? void 0 : variableValue.task_id) !== undefined) {
|
|
63
|
+
// Add it to list of running tasks so i.e. it can be cancelled; we don't check if there's a task running
|
|
64
|
+
// already because it's a MetaTask specifically created for this action
|
|
65
|
+
const taskId = variableValue.task_id;
|
|
66
|
+
// add task to currently running tasks
|
|
67
|
+
taskContext.startTask(taskId);
|
|
68
|
+
yield wsClient.waitForTask(taskId);
|
|
69
|
+
// remove it once it's finished
|
|
70
|
+
taskContext.endTask(taskId);
|
|
71
|
+
try {
|
|
72
|
+
variableValue = yield fetchTaskResult(taskId, sessionToken);
|
|
73
|
+
}
|
|
74
|
+
catch (_d) {
|
|
75
|
+
// Recover from task server error - notify about the error and keep previous variable value
|
|
76
|
+
pushNotification({
|
|
77
|
+
key: action.uid,
|
|
78
|
+
message: 'Try again or contact the application owner',
|
|
79
|
+
status: Status.ERROR,
|
|
80
|
+
title: 'Error executing action',
|
|
81
|
+
});
|
|
82
|
+
return previousVariableValue;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
setUpdateVar === null || setUpdateVar === void 0 ? void 0 : setUpdateVar(variableValue);
|
|
86
|
+
}), [action, setUpdateVar, sessionToken]);
|
|
87
|
+
};
|
|
88
|
+
export default UpdateVariable;
|
|
89
|
+
//# sourceMappingURL=update-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-variable.js","sourceRoot":"","sources":["../../js/actions/update-variable.tsx"],"names":[],"mappings":"AAAA,+CAA+C;;;;;;;;;;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE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YAAY,uBAAZ,YAAY,CAAG,aAAa,CAAC,CAAC;IAClC,CAAC,CAAA,EACD,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC,CACvC,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionContext } from '../types/core';
|
|
2
|
+
/**
|
|
3
|
+
* Helper hook that exposes an action context object with:
|
|
4
|
+
* - a function to fetch the derived parameter for an action from the backend
|
|
5
|
+
* - the session token
|
|
6
|
+
* - the websocket client instance
|
|
7
|
+
*/
|
|
8
|
+
export declare function useActionContext<T>(): ActionContext<T>;
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../js/actions/utils.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,CAsBtD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
/* eslint-disable import/prefer-default-export */
|
|
11
|
+
import { useCallback, useContext } from 'react';
|
|
12
|
+
import { HTTP_METHOD, validateResponse } from '@darajs/ui-utils';
|
|
13
|
+
import { request } from '../api/http';
|
|
14
|
+
import { useSessionToken } from '../auth/auth-context';
|
|
15
|
+
import { WebSocketCtx } from '../shared/context';
|
|
16
|
+
/**
|
|
17
|
+
* Helper hook that exposes an action context object with:
|
|
18
|
+
* - a function to fetch the derived parameter for an action from the backend
|
|
19
|
+
* - the session token
|
|
20
|
+
* - the websocket client instance
|
|
21
|
+
*/
|
|
22
|
+
export function useActionContext() {
|
|
23
|
+
const { client: wsClient } = useContext(WebSocketCtx);
|
|
24
|
+
const token = useSessionToken();
|
|
25
|
+
const fetchAction = useCallback((uid, body) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const ws_channel = yield wsClient.getChannel();
|
|
27
|
+
const res = yield request(`/api/core/action/${uid}`, { body: JSON.stringify(Object.assign(Object.assign({}, body), { ws_channel })), method: HTTP_METHOD.POST }, token);
|
|
28
|
+
yield validateResponse(res, `Failed to fetch the derived action value with uid: ${uid}`);
|
|
29
|
+
return res.json();
|
|
30
|
+
}), []);
|
|
31
|
+
return {
|
|
32
|
+
fetchAction,
|
|
33
|
+
sessionToken: token,
|
|
34
|
+
wsClient,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../js/actions/utils.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,iDAAiD;AACjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC5B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,MAAM,WAAW,GAAG,WAAW,CAAC,CAAO,GAAW,EAAE,IAA0B,EAAc,EAAE;QAC1F,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC/C,MAAM,GAAG,GAAG,MAAM,OAAO,CACrB,oBAAoB,GAAG,EAAE,EACzB,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,iCAAM,IAAI,KAAE,UAAU,IAAG,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,EAC3E,KAAK,CACR,CAAC;QAEF,MAAM,gBAAgB,CAAC,GAAG,EAAE,sDAAsD,GAAG,EAAE,CAAC,CAAC;QAEzF,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC,CAAA,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACH,WAAW;QACX,YAAY,EAAE,KAAK;QACnB,QAAQ;KACX,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { RequestError } from '@darajs/ui-utils';
|
|
3
|
+
import { ActionDef, Component, Config, Template } from '../types';
|
|
4
|
+
/** Api call to fetch the action registry from the backend */
|
|
5
|
+
export declare function useActions(): UseQueryResult<{
|
|
6
|
+
[k: string]: ActionDef;
|
|
7
|
+
}, RequestError>;
|
|
8
|
+
/** Api call to fetch the main configuration from the backend */
|
|
9
|
+
export declare function useConfig(): UseQueryResult<Config, RequestError>;
|
|
10
|
+
/** Api call to fetch the component registry from the backend */
|
|
11
|
+
export declare function useComponents(): UseQueryResult<{
|
|
12
|
+
[k: string]: Component;
|
|
13
|
+
}, RequestError>;
|
|
14
|
+
/**
|
|
15
|
+
* Api call to fetch the template from the backend
|
|
16
|
+
*
|
|
17
|
+
* @param template - the template name to fetch
|
|
18
|
+
*/
|
|
19
|
+
export declare function useTemplate(template: string): UseQueryResult<Template, RequestError>;
|
|
20
|
+
/**
|
|
21
|
+
* Fetch the result of a task from the backend by it's id
|
|
22
|
+
*
|
|
23
|
+
* @param taskId the id of the task to fetch
|
|
24
|
+
* @param token the session token to use
|
|
25
|
+
*/
|
|
26
|
+
export declare function fetchTaskResult<T>(taskId: string, token: string): Promise<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Cancel a task by it's id
|
|
29
|
+
*
|
|
30
|
+
* @param taskId the id of the task to fetch
|
|
31
|
+
* @param token the session token to use
|
|
32
|
+
*/
|
|
33
|
+
export declare function cancelTask(taskId: string, token: string): Promise<boolean>;
|
|
34
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../js/api/core.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAY,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAe,YAAY,EAAoB,MAAM,kBAAkB,CAAC;AAK/E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAqB,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIpF,6DAA6D;AAC7D,wBAAgB,UAAU,IAAI,cAAc,CACxC;IACI,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,EACD,YAAY,CACf,CAYA;AAED,gEAAgE;AAChE,wBAAgB,SAAS,IAAI,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAahE;AAED,gEAAgE;AAChE,wBAAgB,aAAa,IAAI,cAAc,CAC3C;IACI,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,EACD,YAAY,CACf,CAYA;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAkBpF;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAWlF;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIhF"}
|
package/dist/api/core.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
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 { useQuery } from '@tanstack/react-query';
|
|
11
|
+
import { HTTP_METHOD, validateResponse } from '@darajs/ui-utils';
|
|
12
|
+
import { handleAuthErrors } from '../auth/auth';
|
|
13
|
+
import { useSessionToken } from '../auth/auth-context';
|
|
14
|
+
import { denormalize } from '../shared/utils/normalization';
|
|
15
|
+
import { request } from './http';
|
|
16
|
+
/** Api call to fetch the action registry from the backend */
|
|
17
|
+
export function useActions() {
|
|
18
|
+
const token = useSessionToken();
|
|
19
|
+
return useQuery({
|
|
20
|
+
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const res = yield request('/api/core/actions', { method: HTTP_METHOD.GET }, token);
|
|
22
|
+
yield handleAuthErrors(res, true);
|
|
23
|
+
yield validateResponse(res, 'Failed to fetch the actions for this app');
|
|
24
|
+
return res.json();
|
|
25
|
+
}),
|
|
26
|
+
queryKey: ['actions'],
|
|
27
|
+
refetchOnMount: false,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Api call to fetch the main configuration from the backend */
|
|
31
|
+
export function useConfig() {
|
|
32
|
+
const token = useSessionToken();
|
|
33
|
+
return useQuery({
|
|
34
|
+
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const res = yield request('/api/core/config', { method: HTTP_METHOD.GET }, token);
|
|
36
|
+
yield handleAuthErrors(res, true);
|
|
37
|
+
yield validateResponse(res, 'Failed to fetch the config for this app');
|
|
38
|
+
return res.json();
|
|
39
|
+
}),
|
|
40
|
+
queryKey: ['config'],
|
|
41
|
+
refetchOnMount: false,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** Api call to fetch the component registry from the backend */
|
|
45
|
+
export function useComponents() {
|
|
46
|
+
const token = useSessionToken();
|
|
47
|
+
return useQuery({
|
|
48
|
+
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const res = yield request('/api/core/components', { method: HTTP_METHOD.GET }, token);
|
|
50
|
+
yield handleAuthErrors(res, true);
|
|
51
|
+
yield validateResponse(res, 'Failed to fetch the config for this app');
|
|
52
|
+
return res.json();
|
|
53
|
+
}),
|
|
54
|
+
queryKey: ['components'],
|
|
55
|
+
refetchOnMount: false,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Api call to fetch the template from the backend
|
|
60
|
+
*
|
|
61
|
+
* @param template - the template name to fetch
|
|
62
|
+
*/
|
|
63
|
+
export function useTemplate(template) {
|
|
64
|
+
const token = useSessionToken();
|
|
65
|
+
return useQuery({
|
|
66
|
+
enabled: !!template,
|
|
67
|
+
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const res = yield request(`/api/core/template/${template}`, { method: HTTP_METHOD.GET }, token);
|
|
69
|
+
yield handleAuthErrors(res, true);
|
|
70
|
+
yield validateResponse(res, 'Failed to fetch the template');
|
|
71
|
+
const { data: normalizedTemplate, lookup } = (yield res.json());
|
|
72
|
+
return denormalize(normalizedTemplate, lookup);
|
|
73
|
+
}),
|
|
74
|
+
queryKey: ['template', template],
|
|
75
|
+
refetchOnWindowFocus: false,
|
|
76
|
+
// For now we only need to fetch the template once so treat it as if it never went out of date
|
|
77
|
+
staleTime: Infinity,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Fetch the result of a task from the backend by it's id
|
|
82
|
+
*
|
|
83
|
+
* @param taskId the id of the task to fetch
|
|
84
|
+
* @param token the session token to use
|
|
85
|
+
*/
|
|
86
|
+
export function fetchTaskResult(taskId, token) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const res = yield request(`/api/core/tasks/${taskId}`, { method: HTTP_METHOD.GET }, token);
|
|
89
|
+
yield validateResponse(res, `Failed to fetch the result of task with id: ${taskId}`);
|
|
90
|
+
const resJson = yield res.json();
|
|
91
|
+
if (typeof resJson === 'object' && 'error' in resJson) {
|
|
92
|
+
throw new Error(resJson.error);
|
|
93
|
+
}
|
|
94
|
+
return resJson;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Cancel a task by it's id
|
|
99
|
+
*
|
|
100
|
+
* @param taskId the id of the task to fetch
|
|
101
|
+
* @param token the session token to use
|
|
102
|
+
*/
|
|
103
|
+
export function cancelTask(taskId, token) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const res = yield request(`/api/core/tasks/${taskId}`, { method: HTTP_METHOD.DELETE }, token);
|
|
106
|
+
yield validateResponse(res, `Failed to cancel task with id: ${taskId}`);
|
|
107
|
+
return true;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../js/api/core.tsx"],"names":[],"mappings":";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are function request(url: string | URL, options: RequestInit, sessionToken?: string): Promise<Response>;
|
|
9
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../js/api/http.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkB/G"}
|
package/dist/api/http.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Light wrapper around fetch.
|
|
24
|
+
*
|
|
25
|
+
* @param url URL
|
|
26
|
+
* @param options fetch options
|
|
27
|
+
* @param sessionToken token to use for auth
|
|
28
|
+
*/
|
|
29
|
+
export function request(url, options, sessionToken) {
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const { headers } = options, other = __rest(options, ["headers"]);
|
|
33
|
+
const baseUrl = (_b = (_a = window.dara) === null || _a === void 0 ? void 0 : _a.base_url) !== null && _b !== void 0 ? _b : '';
|
|
34
|
+
const urlString = url instanceof URL ? url.pathname + url.search : url;
|
|
35
|
+
return fetch(baseUrl + urlString, Object.assign({ headers: Object.assign(Object.assign(Object.assign({ Accept: (_d = (_c = options === null || options === void 0 ? void 0 : options.headers) === null || _c === void 0 ? void 0 : _c.Accept) !== null && _d !== void 0 ? _d : 'application/json' }, ((options === null || options === void 0 ? void 0 : options.body) && !((options === null || options === void 0 ? void 0 : options.body) instanceof FormData) ? { 'Content-Type': 'application/json' } : {})), (sessionToken ? { Authorization: `Bearer ${sessionToken}` } : {})), (headers !== null && headers !== void 0 ? headers : {})) }, other));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../js/api/http.tsx"],"names":[],"mappings":"AAAA,iDAAiD;;;;;;;;;;;;;;;;;;;;;AAEjD;;;;;;GAMG;AACH,MAAM,UAAgB,OAAO,CAAC,GAAiB,EAAE,OAAoB,EAAE,YAAqB;;;QACxF,MAAM,EAAE,OAAO,KAAe,OAAO,EAAjB,KAAK,UAAK,OAAO,EAA/B,WAAqB,CAAU,CAAC;QAEtC,MAAM,OAAO,GAAW,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,QAAQ,mCAAI,EAAE,CAAC;QAEpD,MAAM,SAAS,GAAG,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;QAEvE,OAAO,KAAK,CAAC,OAAO,GAAG,SAAS,kBAC5B,OAAO,8CACH,MAAM,EAAE,MAAA,MAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAkC,0CAAE,MAAM,mCAAI,kBAAkB,IAE/E,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,KAAI,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,aAAY,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAErG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACjE,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,KAEnB,KAAK,EACV,CAAC;;CACN"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useSession, getSessionToken, verifySessionToken, useUser, handleAuthErrors } from '../auth/auth';
|
|
2
|
+
export { cancelTask, fetchTaskResult, useConfig, useComponents, useTemplate, useActions } from './core';
|
|
3
|
+
export { WebSocketClientInterface, WebSocketClient, setupWebsocket } from './websocket';
|
|
4
|
+
export { request } from './http';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../js/api/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useSession, getSessionToken, verifySessionToken, useUser, handleAuthErrors } from '../auth/auth';
|
|
2
|
+
export { cancelTask, fetchTaskResult, useConfig, useComponents, useTemplate, useActions } from './core';
|
|
3
|
+
export { WebSocketClient, setupWebsocket } from './websocket';
|
|
4
|
+
export { request } from './http';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../js/api/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACxG,OAAO,EAA4B,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
|