@sixb/app 0.2.1 → 0.2.3
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/dist/agent/agent-chat.d.ts +9 -2
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-panel.d.ts +9 -1
- package/dist/agent/agent-panel.d.ts.map +1 -1
- package/dist/agent/agent-surface.d.ts.map +1 -1
- package/dist/agent/artifact-card.d.ts +3 -1
- package/dist/agent/artifact-card.d.ts.map +1 -1
- package/dist/agent/artifact-panel.d.ts +7 -1
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/components/composer-place.d.ts +3 -1
- package/dist/agent/components/composer-place.d.ts.map +1 -1
- package/dist/agent/components/composer.d.ts +20 -1
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/context-chips.d.ts.map +1 -1
- package/dist/agent/components/context-meter.d.ts +1 -1
- package/dist/agent/components/conversation-panel.d.ts +3 -1
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-parts.d.ts +3 -1
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/thread-artifacts-menu.d.ts.map +1 -1
- package/dist/agent/composer-insertion.d.ts +24 -0
- package/dist/agent/composer-insertion.d.ts.map +1 -0
- package/dist/agent/delegation/use-children.d.ts +5 -5
- package/dist/agent/delegation/use-children.d.ts.map +1 -1
- package/dist/agent/hooks/use-agent-conversation.d.ts +10 -4
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-new-thread-place.d.ts +39 -17
- package/dist/agent/hooks/use-new-thread-place.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +14 -0
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +20 -0
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/publish-artifact/interpret.d.ts +8 -2
- package/dist/agent/publish-artifact/interpret.d.ts.map +1 -1
- package/dist/agent/publish-artifact/open-artifact-tool-view.d.ts +9 -0
- package/dist/agent/publish-artifact/open-artifact-tool-view.d.ts.map +1 -0
- package/dist/agent/publish-artifact/publish-artifact-tool-view.d.ts +4 -2
- package/dist/agent/publish-artifact/publish-artifact-tool-view.d.ts.map +1 -1
- package/dist/agent/publish-artifact/use-live-publishes.d.ts +3 -3
- package/dist/agent/publish-artifact/use-live-publishes.d.ts.map +1 -1
- package/dist/agent/tool-views/built-in.d.ts.map +1 -1
- package/dist/agent/types.d.ts +3 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/artifacts/artifact-page.d.ts.map +1 -1
- package/dist/artifacts/artifact-viewer.d.ts +16 -0
- package/dist/artifacts/artifact-viewer.d.ts.map +1 -0
- package/dist/artifacts/card-details.d.ts +1 -1
- package/dist/artifacts/card-details.d.ts.map +1 -1
- package/dist/artifacts/card-preview.d.ts.map +1 -1
- package/dist/artifacts/comments-context.d.ts +48 -0
- package/dist/artifacts/comments-context.d.ts.map +1 -0
- package/dist/artifacts/edit-session.d.ts +6 -6
- package/dist/artifacts/edit-session.d.ts.map +1 -1
- package/dist/artifacts/file-source.d.ts.map +1 -1
- package/dist/artifacts/frame.d.ts +10 -2
- package/dist/artifacts/frame.d.ts.map +1 -1
- package/dist/artifacts/guest-badge.d.ts +8 -0
- package/dist/artifacts/guest-badge.d.ts.map +1 -0
- package/dist/artifacts/held-artifact.d.ts +19 -0
- package/dist/artifacts/held-artifact.d.ts.map +1 -0
- package/dist/artifacts/holders.d.ts +10 -0
- package/dist/artifacts/holders.d.ts.map +1 -0
- package/dist/artifacts/live/boards.d.ts +15 -0
- package/dist/artifacts/live/boards.d.ts.map +1 -0
- package/dist/artifacts/live/canvas.d.ts +79 -0
- package/dist/artifacts/live/canvas.d.ts.map +1 -0
- package/dist/artifacts/live/header.d.ts +29 -0
- package/dist/artifacts/live/header.d.ts.map +1 -0
- package/dist/artifacts/live/hooks.d.ts +21 -0
- package/dist/artifacts/live/hooks.d.ts.map +1 -0
- package/dist/artifacts/live/presence.d.ts +32 -0
- package/dist/artifacts/live/presence.d.ts.map +1 -0
- package/dist/artifacts/live/session.d.ts +130 -0
- package/dist/artifacts/live/session.d.ts.map +1 -0
- package/dist/artifacts/live/view.d.ts +28 -0
- package/dist/artifacts/live/view.d.ts.map +1 -0
- package/dist/artifacts/messages.d.ts +424 -14
- package/dist/artifacts/messages.d.ts.map +1 -1
- package/dist/artifacts/page-queries.d.ts +2 -2
- package/dist/artifacts/page-queries.d.ts.map +1 -1
- package/dist/artifacts/page-state.d.ts.map +1 -1
- package/dist/artifacts/publish-edit.d.ts +24 -14
- package/dist/artifacts/publish-edit.d.ts.map +1 -1
- package/dist/artifacts/queries.d.ts +490 -9
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/references/references.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/arrows.d.ts +0 -18
- package/dist/artifacts/renderers/canvas/arrows.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board-editor.d.ts +43 -0
- package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/board-properties.d.ts +37 -0
- package/dist/artifacts/renderers/canvas/board-properties.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/board-source.d.ts +18 -0
- package/dist/artifacts/renderers/canvas/board-source.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/board.d.ts +64 -19
- package/dist/artifacts/renderers/canvas/board.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/canvas.d.ts +13 -4
- package/dist/artifacts/renderers/canvas/canvas.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts +84 -0
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/commenting.d.ts +58 -0
- package/dist/artifacts/renderers/canvas/commenting.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/comments-panel.d.ts +27 -0
- package/dist/artifacts/renderers/canvas/comments-panel.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/comments.d.ts +56 -0
- package/dist/artifacts/renderers/canvas/comments.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/draft.d.ts +7 -6
- package/dist/artifacts/renderers/canvas/draft.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/edit-mode.d.ts +19 -2
- package/dist/artifacts/renderers/canvas/edit-mode.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/focus.d.ts +40 -5
- package/dist/artifacts/renderers/canvas/focus.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/items.d.ts +47 -4
- package/dist/artifacts/renderers/canvas/items.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/layout.d.ts +5 -8
- package/dist/artifacts/renderers/canvas/layout.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/presence.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/presence.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/previews.d.ts +54 -0
- package/dist/artifacts/renderers/canvas/previews.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/renderer.d.ts +11 -2
- package/dist/artifacts/renderers/canvas/renderer.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/thumbnail.d.ts +5 -2
- package/dist/artifacts/renderers/canvas/thumbnail.d.ts.map +1 -1
- package/dist/artifacts/version-menu.d.ts +19 -0
- package/dist/artifacts/version-menu.d.ts.map +1 -0
- package/dist/artifacts/view-context.d.ts +43 -0
- package/dist/artifacts/view-context.d.ts.map +1 -0
- package/dist/artifacts/viewer.d.ts.map +1 -1
- package/dist/build.d.ts +5 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/{chunk-ytadd0b5.js → chunk-001c4gnk.js} +6871 -3756
- package/dist/chunk-001c4gnk.js.map +204 -0
- package/dist/chunk-00wggsst.js +7 -0
- package/dist/chunk-00wggsst.js.map +10 -0
- package/dist/chunk-5crvhjp2.js +4704 -0
- package/dist/chunk-5crvhjp2.js.map +28 -0
- package/dist/{chunk-q69001w3.js → chunk-694m74s7.js} +7 -1
- package/dist/{chunk-q69001w3.js.map → chunk-694m74s7.js.map} +3 -3
- package/dist/{chunk-4mprsd2n.js → chunk-fg6thecb.js} +25 -1
- package/dist/chunk-fg6thecb.js.map +10 -0
- package/dist/{chunk-j8g956dt.js → chunk-fwb9mxwm.js} +1 -1
- package/dist/{chunk-7fj9cfkw.js → chunk-kes4ygmz.js} +1 -1
- package/dist/{chunk-kwbw4dyk.js → chunk-ryed2jq8.js} +1 -1
- package/dist/codegen.d.ts.map +1 -1
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +930 -309
- package/dist/index.js.map +15 -10
- package/dist/locale-messages.d.ts +12 -0
- package/dist/locale-messages.d.ts.map +1 -1
- package/dist/locale.d.ts +12 -0
- package/dist/locale.d.ts.map +1 -1
- package/dist/locale.js +1 -1
- package/dist/metadata.d.ts +8 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/pages/console/action-run.d.ts.map +1 -1
- package/dist/pages/console/data/connectors.d.ts.map +1 -1
- package/dist/pages/console/data/datasets.d.ts.map +1 -1
- package/dist/pages/console/data/lake-health.d.ts +3 -0
- package/dist/pages/console/data/lake-health.d.ts.map +1 -0
- package/dist/pages/console/data/messages.d.ts +98 -2
- package/dist/pages/console/data/messages.d.ts.map +1 -1
- package/dist/pages/console/data/pipelines.d.ts.map +1 -1
- package/dist/pages/console/data/projections.d.ts.map +1 -1
- package/dist/pages/console/data/syncs.d.ts.map +1 -1
- package/dist/pages/console/ontology/action-runs.d.ts.map +1 -1
- package/dist/pages/console/ontology/actions.d.ts.map +1 -1
- package/dist/pages/console/ontology/components/action-button.d.ts.map +1 -1
- package/dist/pages/console/ontology/components/artifact-picker.d.ts +36 -0
- package/dist/pages/console/ontology/components/artifact-picker.d.ts.map +1 -0
- package/dist/pages/console/ontology/components/object-query-bar.d.ts.map +1 -1
- package/dist/pages/console/ontology/lib/action-params.d.ts +2 -0
- package/dist/pages/console/ontology/lib/action-params.d.ts.map +1 -1
- package/dist/pages/console/ontology/lineage/properties-panel.d.ts +2 -1
- package/dist/pages/console/ontology/lineage/properties-panel.d.ts.map +1 -1
- package/dist/pages/console/ontology/object-page.d.ts.map +1 -1
- package/dist/pages/console/ontology/object-type.d.ts.map +1 -1
- package/dist/pages/console/ontology/object-types.d.ts.map +1 -1
- package/dist/pages/console/ontology/objects.d.ts.map +1 -1
- package/dist/pages/console/ontology/rules.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflow.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflows/run-input-form.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflows/schema-shape.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflows.d.ts.map +1 -1
- package/dist/pages/console/skeletons.d.ts +30 -0
- package/dist/pages/console/skeletons.d.ts.map +1 -0
- package/dist/pages/console/workflow-run.d.ts.map +1 -1
- package/dist/pages/section-page.d.ts +11 -1
- package/dist/pages/section-page.d.ts.map +1 -1
- package/dist/pages/section-ui.d.ts +25 -3
- package/dist/pages/section-ui.d.ts.map +1 -1
- package/dist/pages/settings/activity/calendar.d.ts.map +1 -1
- package/dist/pages/settings/activity/connections.d.ts.map +1 -1
- package/dist/pages/settings/activity/page.d.ts.map +1 -1
- package/dist/pages/settings/activity/thread.d.ts.map +1 -1
- package/dist/pages/settings/activity/timeline.d.ts +2 -0
- package/dist/pages/settings/activity/timeline.d.ts.map +1 -1
- package/dist/pages/settings/controls.d.ts +4 -0
- package/dist/pages/settings/controls.d.ts.map +1 -1
- package/dist/pages/settings/members.d.ts.map +1 -1
- package/dist/pages/settings/memory-history.d.ts +2 -0
- package/dist/pages/settings/memory-history.d.ts.map +1 -1
- package/dist/pages/settings/memory.d.ts.map +1 -1
- package/dist/pages/settings/service-accounts.d.ts.map +1 -1
- package/dist/pages/settings/sessions.d.ts.map +1 -1
- package/dist/pages/settings/usage/breakdown.d.ts.map +1 -1
- package/dist/pages/settings/usage/limits.d.ts.map +1 -1
- package/dist/pages/settings/usage/messages.d.ts +0 -2
- package/dist/pages/settings/usage/messages.d.ts.map +1 -1
- package/dist/pages/settings/usage/runs.d.ts +8 -2
- package/dist/pages/settings/usage/runs.d.ts.map +1 -1
- package/dist/pages/settings/usage/spend-chart.d.ts.map +1 -1
- package/dist/pages/settings/usage/spend-model.d.ts +5 -0
- package/dist/pages/settings/usage/spend-model.d.ts.map +1 -1
- package/dist/pages/values.d.ts +6 -0
- package/dist/pages/values.d.ts.map +1 -1
- package/dist/pages.d.ts +4 -0
- package/dist/pages.d.ts.map +1 -1
- package/dist/pages.js +8188 -4841
- package/dist/pages.js.map +56 -47
- package/dist/sections/catalog.d.ts.map +1 -1
- package/dist/sections/sections.d.ts.map +1 -1
- package/dist/server.js +294 -23
- package/dist/server.js.map +8 -7
- package/dist/service-worker.d.ts +39 -0
- package/dist/service-worker.d.ts.map +1 -0
- package/dist/shared-session.d.ts +25 -0
- package/dist/shared-session.d.ts.map +1 -0
- package/dist/shell/app-return.d.ts +35 -0
- package/dist/shell/app-return.d.ts.map +1 -0
- package/dist/shell/app-shell.d.ts +1 -1
- package/dist/shell/app-shell.d.ts.map +1 -1
- package/dist/shell/nav-items.d.ts +2 -0
- package/dist/shell/nav-items.d.ts.map +1 -1
- package/dist/shell/phone/back.d.ts +6 -0
- package/dist/shell/phone/back.d.ts.map +1 -0
- package/dist/shell/phone/launch.d.ts +7 -0
- package/dist/shell/phone/launch.d.ts.map +1 -0
- package/dist/shell/phone/more-sheet.d.ts +36 -0
- package/dist/shell/phone/more-sheet.d.ts.map +1 -0
- package/dist/shell/phone/phone-foundations.d.ts +9 -0
- package/dist/shell/phone/phone-foundations.d.ts.map +1 -0
- package/dist/shell/phone/pull-to-refresh.d.ts +9 -0
- package/dist/shell/phone/pull-to-refresh.d.ts.map +1 -0
- package/dist/shell/phone/routes.d.ts +12 -0
- package/dist/shell/phone/routes.d.ts.map +1 -0
- package/dist/shell/phone/screen-motion.d.ts +11 -0
- package/dist/shell/phone/screen-motion.d.ts.map +1 -0
- package/dist/shell/phone/scroll-restoration.d.ts +7 -0
- package/dist/shell/phone/scroll-restoration.d.ts.map +1 -0
- package/dist/shell/phone/startup-image.d.ts +17 -0
- package/dist/shell/phone/startup-image.d.ts.map +1 -0
- package/dist/shell/phone/tab-bar.d.ts +14 -0
- package/dist/shell/phone/tab-bar.d.ts.map +1 -0
- package/dist/shell/phone/top-bar.d.ts +24 -0
- package/dist/shell/phone/top-bar.d.ts.map +1 -0
- package/dist/shell/search-command.d.ts +3 -1
- package/dist/shell/search-command.d.ts.map +1 -1
- package/dist/shell/user-menu.d.ts +2 -0
- package/dist/shell/user-menu.d.ts.map +1 -1
- package/package.json +8 -5
- package/src/agent/agent-chat.tsx +51 -8
- package/src/agent/agent-panel.tsx +12 -0
- package/src/agent/agent-surface.tsx +4 -0
- package/src/agent/artifact-card.tsx +84 -16
- package/src/agent/artifact-panel.tsx +63 -43
- package/src/agent/components/agent-message-body.tsx +1 -1
- package/src/agent/components/composer-place.tsx +77 -53
- package/src/agent/components/composer.tsx +92 -7
- package/src/agent/components/context-chips.tsx +72 -2
- package/src/agent/components/conversation-panel.tsx +3 -2
- package/src/agent/components/message-parts.tsx +6 -1
- package/src/agent/components/thread-artifacts-menu.tsx +22 -5
- package/src/agent/composer-insertion.ts +36 -0
- package/src/agent/hooks/use-agent-conversation.ts +41 -10
- package/src/agent/hooks/use-new-thread-place.ts +149 -25
- package/src/agent/i18n/en.ts +14 -0
- package/src/agent/i18n/fr.ts +12 -0
- package/src/agent/publish-artifact/interpret.ts +27 -5
- package/src/agent/publish-artifact/open-artifact-tool-view.tsx +49 -0
- package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +14 -8
- package/src/agent/publish-artifact/use-live-publishes.ts +7 -11
- package/src/agent/react-router.tsx +2 -2
- package/src/agent/tool-views/built-in.tsx +3 -0
- package/src/agent/types.ts +4 -0
- package/src/artifacts/artifact-page.tsx +42 -17
- package/src/artifacts/artifact-viewer.tsx +56 -0
- package/src/artifacts/artifacts.css +80 -0
- package/src/artifacts/card-details.ts +2 -2
- package/src/artifacts/card-preview.tsx +17 -3
- package/src/artifacts/comments-context.ts +125 -0
- package/src/artifacts/edit-session.tsx +6 -6
- package/src/artifacts/file-source.ts +10 -3
- package/src/artifacts/frame.tsx +50 -12
- package/src/artifacts/gallery.tsx +9 -11
- package/src/artifacts/guest-badge.tsx +21 -0
- package/src/artifacts/held-artifact.tsx +241 -0
- package/src/artifacts/holders.tsx +170 -0
- package/src/artifacts/live/boards.ts +95 -0
- package/src/artifacts/live/canvas.ts +402 -0
- package/src/artifacts/live/header.tsx +137 -0
- package/src/artifacts/live/hooks.ts +94 -0
- package/src/artifacts/live/presence.ts +147 -0
- package/src/artifacts/live/session.ts +520 -0
- package/src/artifacts/live/view.ts +81 -0
- package/src/artifacts/messages.ts +415 -24
- package/src/artifacts/page-queries.ts +2 -3
- package/src/artifacts/page-state.ts +16 -7
- package/src/artifacts/publish-edit.ts +50 -22
- package/src/artifacts/queries.ts +108 -10
- package/src/artifacts/references/references.tsx +6 -9
- package/src/artifacts/renderers/canvas/arrows.tsx +12 -39
- package/src/artifacts/renderers/canvas/board-editor.tsx +817 -0
- package/src/artifacts/renderers/canvas/board-properties.tsx +488 -0
- package/src/artifacts/renderers/canvas/board-source.ts +110 -0
- package/src/artifacts/renderers/canvas/board.tsx +309 -33
- package/src/artifacts/renderers/canvas/canvas.tsx +387 -72
- package/src/artifacts/renderers/canvas/comment-pins.tsx +465 -0
- package/src/artifacts/renderers/canvas/commenting.tsx +319 -0
- package/src/artifacts/renderers/canvas/comments-panel.tsx +574 -0
- package/src/artifacts/renderers/canvas/comments.ts +225 -0
- package/src/artifacts/renderers/canvas/draft.ts +41 -50
- package/src/artifacts/renderers/canvas/edit-mode.tsx +145 -20
- package/src/artifacts/renderers/canvas/focus.tsx +175 -24
- package/src/artifacts/renderers/canvas/items.tsx +179 -52
- package/src/artifacts/renderers/canvas/layout.ts +99 -47
- package/src/artifacts/renderers/canvas/presence.tsx +184 -0
- package/src/artifacts/renderers/canvas/previews.ts +127 -0
- package/src/artifacts/renderers/canvas/renderer.tsx +87 -22
- package/src/artifacts/renderers/canvas/thumbnail.tsx +56 -15
- package/src/artifacts/renderers/canvas/toolbar.tsx +1 -1
- package/src/artifacts/renderers/slides/slides.tsx +1 -1
- package/src/artifacts/version-menu.tsx +438 -0
- package/src/artifacts/view-context.ts +102 -0
- package/src/artifacts/viewer.tsx +205 -147
- package/src/build.ts +96 -11
- package/src/codegen.ts +83 -5
- package/src/createCustomApp.ts +20 -7
- package/src/index.ts +12 -0
- package/src/locale-messages.ts +24 -0
- package/src/metadata.ts +12 -0
- package/src/pages/console/action-run.tsx +20 -0
- package/src/pages/console/data/connectors.tsx +27 -3
- package/src/pages/console/data/datasets.tsx +30 -1
- package/src/pages/console/data/lake-health.tsx +299 -0
- package/src/pages/console/data/messages.ts +143 -2
- package/src/pages/console/data/pipelines.tsx +91 -3
- package/src/pages/console/data/projections.tsx +23 -4
- package/src/pages/console/data/syncs.tsx +39 -2
- package/src/pages/console/ontology/action-runs.tsx +8 -2
- package/src/pages/console/ontology/actions.tsx +39 -15
- package/src/pages/console/ontology/components/action-button.tsx +10 -0
- package/src/pages/console/ontology/components/artifact-picker.tsx +522 -0
- package/src/pages/console/ontology/components/object-query-bar.tsx +21 -5
- package/src/pages/console/ontology/lib/action-params.ts +10 -0
- package/src/pages/console/ontology/lineage/properties-panel.tsx +32 -24
- package/src/pages/console/ontology/object-page.tsx +2 -0
- package/src/pages/console/ontology/object-type.tsx +73 -14
- package/src/pages/console/ontology/object-types.tsx +56 -7
- package/src/pages/console/ontology/objects.tsx +167 -19
- package/src/pages/console/ontology/rules.tsx +186 -30
- package/src/pages/console/ontology/workflow.tsx +130 -74
- package/src/pages/console/ontology/workflows/run-input-form.tsx +21 -2
- package/src/pages/console/ontology/workflows/schema-shape.tsx +3 -0
- package/src/pages/console/ontology/workflows.tsx +34 -21
- package/src/pages/console/skeletons.tsx +99 -0
- package/src/pages/console/workflow-run.tsx +20 -0
- package/src/pages/section-page.tsx +37 -7
- package/src/pages/section-ui.tsx +96 -13
- package/src/pages/settings/activity/calendar.tsx +13 -6
- package/src/pages/settings/activity/connections.tsx +26 -9
- package/src/pages/settings/activity/page.tsx +31 -4
- package/src/pages/settings/activity/thread.tsx +32 -18
- package/src/pages/settings/activity/timeline.tsx +39 -0
- package/src/pages/settings/controls.tsx +19 -1
- package/src/pages/settings/developers.tsx +2 -2
- package/src/pages/settings/members.tsx +42 -9
- package/src/pages/settings/memory-history.tsx +76 -10
- package/src/pages/settings/memory.tsx +47 -5
- package/src/pages/settings/service-accounts.tsx +7 -2
- package/src/pages/settings/sessions.tsx +6 -2
- package/src/pages/settings/usage/breakdown.tsx +62 -2
- package/src/pages/settings/usage/limits.tsx +45 -3
- package/src/pages/settings/usage/messages.ts +0 -2
- package/src/pages/settings/usage/page.tsx +99 -52
- package/src/pages/settings/usage/runs.tsx +105 -8
- package/src/pages/settings/usage/spend-chart.tsx +79 -45
- package/src/pages/settings/usage/spend-model.ts +16 -0
- package/src/pages/values.tsx +72 -6
- package/src/pages.ts +4 -0
- package/src/sections/catalog.ts +6 -0
- package/src/sections/sections.tsx +2 -0
- package/src/service-worker.ts +176 -0
- package/src/shared-session.ts +73 -0
- package/src/shell/app-return.ts +115 -0
- package/src/shell/app-shell.tsx +125 -27
- package/src/shell/nav-items.tsx +2 -0
- package/src/shell/phone/back.ts +16 -0
- package/src/shell/phone/launch.ts +6 -0
- package/src/shell/phone/more-sheet.tsx +249 -0
- package/src/shell/phone/phone-foundations.tsx +43 -0
- package/src/shell/phone/phone.css +660 -0
- package/src/shell/phone/pull-to-refresh.tsx +201 -0
- package/src/shell/phone/routes.ts +34 -0
- package/src/shell/phone/screen-motion.ts +292 -0
- package/src/shell/phone/scroll-restoration.tsx +70 -0
- package/src/shell/phone/startup-image.ts +119 -0
- package/src/shell/phone/tab-bar.tsx +95 -0
- package/src/shell/phone/top-bar.tsx +195 -0
- package/src/shell/search-command.tsx +30 -14
- package/src/shell/user-menu.tsx +2 -1
- package/dist/chunk-4j3c3p72.js +0 -1487
- package/dist/chunk-4j3c3p72.js.map +0 -18
- package/dist/chunk-4mprsd2n.js.map +0 -10
- package/dist/chunk-ytadd0b5.js.map +0 -188
- /package/dist/{chunk-j8g956dt.js.map → chunk-fwb9mxwm.js.map} +0 -0
- /package/dist/{chunk-7fj9cfkw.js.map → chunk-kes4ygmz.js.map} +0 -0
- /package/dist/{chunk-kwbw4dyk.js.map → chunk-ryed2jq8.js.map} +0 -0
package/src/pages/values.tsx
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
useState,
|
|
34
34
|
} from "react"
|
|
35
35
|
import { Link } from "react-router-dom"
|
|
36
|
+
import { HeldArtifactCards, HeldArtifactChip } from "../artifacts/held-artifact"
|
|
36
37
|
import { objectHref } from "./routes"
|
|
37
38
|
import { CopyButton } from "./section-ui"
|
|
38
39
|
|
|
@@ -82,7 +83,7 @@ export interface ValueSchema {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
type ValueSchemaNode =
|
|
85
|
-
| { readonly kind: "unknown" | "fileRef" | "userRef" }
|
|
86
|
+
| { readonly kind: "unknown" | "fileRef" | "userRef" | "artifactRef" }
|
|
86
87
|
/** `type` is the declared one: `"timestamp"`, `"double"`, `"enum"`. */
|
|
87
88
|
| { readonly kind: "primitive"; readonly type: string }
|
|
88
89
|
| { readonly kind: "objectRef"; readonly objectTypeId: string }
|
|
@@ -180,7 +181,9 @@ function describe({ schema, valueTypes }: ValueSchema): ValueSchemaNode {
|
|
|
180
181
|
seen.add(id)
|
|
181
182
|
resolved = resolved._resolved !== undefined ? resolved._resolved : valueTypes.get(id)
|
|
182
183
|
}
|
|
183
|
-
if (resolved === "fileRef" || resolved === "userRef"
|
|
184
|
+
if (resolved === "fileRef" || resolved === "userRef" || resolved === "artifactRef") {
|
|
185
|
+
return { kind: resolved }
|
|
186
|
+
}
|
|
184
187
|
if (typeof resolved === "string") {
|
|
185
188
|
return primitives.has(resolved) ? { kind: "primitive", type: resolved } : { kind: "unknown" }
|
|
186
189
|
}
|
|
@@ -230,6 +233,8 @@ interface Position {
|
|
|
230
233
|
readonly objectRef: ObjectRefValue | null
|
|
231
234
|
readonly fileRef: FileRef | null
|
|
232
235
|
readonly userRef: UserRef | null
|
|
236
|
+
/** The id of the artifact a `ref.artifact()` value holds. */
|
|
237
|
+
readonly artifactRef: string | null
|
|
233
238
|
/** The declared primitive type, which decides how a date or a number reads. */
|
|
234
239
|
readonly primitive: string | null
|
|
235
240
|
/** The schema of a child; `undefined` (open) below an open value. */
|
|
@@ -237,13 +242,14 @@ interface Position {
|
|
|
237
242
|
}
|
|
238
243
|
|
|
239
244
|
// With a schema only the schema decides; without one, the value's shape is all there is. A user
|
|
240
|
-
// is never guessed: `{ type: "user", id }` is too common a shape.
|
|
245
|
+
// or an artifact is never guessed: `{ type: "user", id }` is too common a shape.
|
|
241
246
|
function readPosition(value: unknown, schema: ValueSchema | undefined): Position {
|
|
242
247
|
if (!schema) {
|
|
243
248
|
return {
|
|
244
249
|
objectRef: isObjectRefShape(value) ? value : null,
|
|
245
250
|
fileRef: isFileRef(value) ? value : null,
|
|
246
251
|
userRef: null,
|
|
252
|
+
artifactRef: null,
|
|
247
253
|
primitive: null,
|
|
248
254
|
child: () => undefined,
|
|
249
255
|
}
|
|
@@ -266,6 +272,7 @@ function readPosition(value: unknown, schema: ValueSchema | undefined): Position
|
|
|
266
272
|
value.id.length > 0
|
|
267
273
|
? { type: "user", id: value.id }
|
|
268
274
|
: null,
|
|
275
|
+
artifactRef: node.kind === "artifactRef" ? heldArtifactId(value) : null,
|
|
269
276
|
primitive: node.kind === "primitive" ? node.type : null,
|
|
270
277
|
child: (key) => childSchema(node, key),
|
|
271
278
|
}
|
|
@@ -440,7 +447,7 @@ export function ValueTree({
|
|
|
440
447
|
const position = readPosition(value, schema)
|
|
441
448
|
const entries = Array.isArray(value)
|
|
442
449
|
? value.map((item, index) => [String(index), item] as const)
|
|
443
|
-
: isRecord(value) && !position
|
|
450
|
+
: isRecord(value) && !isReference(position)
|
|
444
451
|
? Object.entries(value)
|
|
445
452
|
: null
|
|
446
453
|
|
|
@@ -490,8 +497,9 @@ function Field({
|
|
|
490
497
|
readonly path: readonly string[]
|
|
491
498
|
}) {
|
|
492
499
|
const messages = useValueMessages()
|
|
500
|
+
const cards = useContext(ArtifactCardsContext)
|
|
493
501
|
const position = readPosition(value, schema)
|
|
494
|
-
const plain = !position
|
|
502
|
+
const plain = !isReference(position)
|
|
495
503
|
const count = !plain
|
|
496
504
|
? null
|
|
497
505
|
: Array.isArray(value)
|
|
@@ -501,6 +509,24 @@ function Field({
|
|
|
501
509
|
: null
|
|
502
510
|
const long = typeof value === "string" && (value.length > 80 || value.includes("\n"))
|
|
503
511
|
|
|
512
|
+
// A list of artifacts lines its cards up rather than numbering them.
|
|
513
|
+
const heldArtifacts = cards ? heldArtifactList(value, schema) : null
|
|
514
|
+
if (heldArtifacts) {
|
|
515
|
+
return (
|
|
516
|
+
<div className="py-2.5 first:pt-0 last:pb-0">
|
|
517
|
+
<dt className="flex items-baseline gap-2">
|
|
518
|
+
<span className="font-medium">{label}</span>
|
|
519
|
+
<span className="text-xs text-muted-foreground">
|
|
520
|
+
{messages.items(heldArtifacts.length)}
|
|
521
|
+
</span>
|
|
522
|
+
</dt>
|
|
523
|
+
<dd className="mt-2">
|
|
524
|
+
<HeldArtifactCards artifactIds={heldArtifacts} />
|
|
525
|
+
</dd>
|
|
526
|
+
</div>
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
|
|
504
530
|
if (count !== null) {
|
|
505
531
|
return (
|
|
506
532
|
<div className="py-2.5 first:pt-0 last:pb-0">
|
|
@@ -522,7 +548,9 @@ function Field({
|
|
|
522
548
|
<div
|
|
523
549
|
className={cn(
|
|
524
550
|
"grid gap-x-4 gap-y-1 py-2.5 first:pt-0 last:pb-0",
|
|
525
|
-
long || position.fileRef
|
|
551
|
+
long || position.fileRef || (cards && position.artifactRef)
|
|
552
|
+
? ""
|
|
553
|
+
: "sm:grid-cols-[minmax(7rem,12rem)_minmax(0,1fr)]"
|
|
526
554
|
)}
|
|
527
555
|
>
|
|
528
556
|
<dt className="min-w-0 font-medium break-words">{label}</dt>
|
|
@@ -539,6 +567,13 @@ function Field({
|
|
|
539
567
|
*/
|
|
540
568
|
export const ObjectRefLinksContext = createContext(true)
|
|
541
569
|
|
|
570
|
+
/**
|
|
571
|
+
* Whether an artifact shows as a card with a preview of it, as an object's page shows the
|
|
572
|
+
* artifacts its properties hold. Elsewhere, such as in a run's input, it is a chip among the
|
|
573
|
+
* other values.
|
|
574
|
+
*/
|
|
575
|
+
export const ArtifactCardsContext = createContext(false)
|
|
576
|
+
|
|
542
577
|
function Leaf({
|
|
543
578
|
value,
|
|
544
579
|
position,
|
|
@@ -552,6 +587,7 @@ function Leaf({
|
|
|
552
587
|
}) {
|
|
553
588
|
const locale = useLocale()
|
|
554
589
|
const objectLinks = useContext(ObjectRefLinksContext)
|
|
590
|
+
const artifactCards = useContext(ArtifactCardsContext)
|
|
555
591
|
if (position.objectRef) {
|
|
556
592
|
const { objectTypeId, primaryId } = position.objectRef
|
|
557
593
|
if (!objectLinks) {
|
|
@@ -577,6 +613,13 @@ function Leaf({
|
|
|
577
613
|
if (position.userRef) {
|
|
578
614
|
return <UserRefChip user={position.userRef} />
|
|
579
615
|
}
|
|
616
|
+
if (position.artifactRef) {
|
|
617
|
+
return artifactCards ? (
|
|
618
|
+
<HeldArtifactCards artifactIds={[position.artifactRef]} />
|
|
619
|
+
) : (
|
|
620
|
+
<HeldArtifactChip artifactId={position.artifactRef} link={objectLinks} />
|
|
621
|
+
)
|
|
622
|
+
}
|
|
580
623
|
if (position.fileRef) {
|
|
581
624
|
return <FileValue file={position.fileRef} links={fileLinks?.(path, position.fileRef) ?? null} />
|
|
582
625
|
}
|
|
@@ -789,6 +832,29 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
789
832
|
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
790
833
|
}
|
|
791
834
|
|
|
835
|
+
/** A position drawn as what it points to, rather than as the record it is stored as. */
|
|
836
|
+
function isReference(position: Position): boolean {
|
|
837
|
+
return !!(position.objectRef || position.fileRef || position.userRef || position.artifactRef)
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/** The artifact `{ type: "artifact", id }` holds, or `null` for any other value. */
|
|
841
|
+
function heldArtifactId(value: unknown): string | null {
|
|
842
|
+
return isRecord(value) && value.type === "artifact" && typeof value.id === "string" && value.id
|
|
843
|
+
? value.id
|
|
844
|
+
: null
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/** The artifacts a declared list of them holds; `null` for any other value, or an empty list. */
|
|
848
|
+
function heldArtifactList(value: unknown, schema: ValueSchema | undefined): string[] | null {
|
|
849
|
+
if (!schema || !Array.isArray(value) || value.length === 0) return null
|
|
850
|
+
|
|
851
|
+
const node = describe(schema)
|
|
852
|
+
if (node.kind !== "array" || describe(node.items).kind !== "artifactRef") return null
|
|
853
|
+
|
|
854
|
+
const ids = value.map(heldArtifactId)
|
|
855
|
+
return ids.every((id): id is string => id !== null) ? ids : null
|
|
856
|
+
}
|
|
857
|
+
|
|
792
858
|
/** Nothing recorded: no value, or an empty record or list. */
|
|
793
859
|
function isEmptyValue(value: unknown): boolean {
|
|
794
860
|
return (
|
package/src/pages.ts
CHANGED
|
@@ -21,6 +21,7 @@ export {
|
|
|
21
21
|
ConsoleConnectorsPage,
|
|
22
22
|
} from "./pages/console/data/connectors"
|
|
23
23
|
export { ConsoleDatasetPage, ConsoleDatasetsPage } from "./pages/console/data/datasets"
|
|
24
|
+
export { ConsoleLakeHealthPage } from "./pages/console/data/lake-health"
|
|
24
25
|
export { ConsolePipelinePage, ConsolePipelinesPage } from "./pages/console/data/pipelines"
|
|
25
26
|
export { ConsoleProjectionPage, ConsoleProjectionsPage } from "./pages/console/data/projections"
|
|
26
27
|
export { ConsoleSyncPage, ConsoleSyncsPage } from "./pages/console/data/syncs"
|
|
@@ -47,3 +48,6 @@ export { SettingsMemoryPage } from "./pages/settings/memory"
|
|
|
47
48
|
export { SettingsPersonalPage } from "./pages/settings/personal"
|
|
48
49
|
export { SettingsUsagePage } from "./pages/settings/usage/page"
|
|
49
50
|
export { SectionsProvider } from "./sections/sections"
|
|
51
|
+
export { keepSharedSession } from "./shared-session"
|
|
52
|
+
export { refreshOnReturn, restoreLastScreen } from "./shell/app-return"
|
|
53
|
+
export { PhoneFoundations } from "./shell/phone/phone-foundations"
|
package/src/sections/catalog.ts
CHANGED
|
@@ -77,6 +77,12 @@ export const sectionCatalog: readonly SectionDefinition[] = [
|
|
|
77
77
|
group: "data",
|
|
78
78
|
details: [{ path: "/console/datasets/:datasetId", exportName: "ConsoleDatasetPage" }],
|
|
79
79
|
},
|
|
80
|
+
{
|
|
81
|
+
id: "lake-health",
|
|
82
|
+
path: "/console/lake-health",
|
|
83
|
+
exportName: "ConsoleLakeHealthPage",
|
|
84
|
+
group: "data",
|
|
85
|
+
},
|
|
80
86
|
{
|
|
81
87
|
id: "pipelines",
|
|
82
88
|
path: "/console/pipelines",
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ChartNoAxesCombined,
|
|
8
8
|
Database,
|
|
9
9
|
GitBranch,
|
|
10
|
+
HeartPulse,
|
|
10
11
|
Layers,
|
|
11
12
|
LayoutGrid,
|
|
12
13
|
ListChecks,
|
|
@@ -128,6 +129,7 @@ const pageIcons: Record<string, ComponentType<{ readonly className?: string }>>
|
|
|
128
129
|
connectors: Cable,
|
|
129
130
|
syncs: RefreshCw,
|
|
130
131
|
datasets: Database,
|
|
132
|
+
"lake-health": HeartPulse,
|
|
131
133
|
pipelines: Workflow,
|
|
132
134
|
projections: Layers,
|
|
133
135
|
logs: ScrollText,
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/** Where the service worker is served: a Sixb name, so a project's own `public/sw.js` keeps its. */
|
|
2
|
+
export const SERVICE_WORKER_PATH = "/sixb-service-worker.js"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Paths the app's origin keeps for the API, sign-in, docs and shared links. The worker leaves them
|
|
6
|
+
* to the network, as the app's link handling does.
|
|
7
|
+
*/
|
|
8
|
+
export const RESERVED_PATH_PREFIXES = ["/api", "/auth", "/ws", "/docs", "/shared"] as const
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Names `buildApp` gives entries, chunks and assets: a content hash keeps each one's contents fixed
|
|
12
|
+
* under its URL, so the server caches them forever and the worker can serve them without asking.
|
|
13
|
+
*/
|
|
14
|
+
export const IMMUTABLE_ASSET_PATTERN =
|
|
15
|
+
/^(?:(?:app|shared|chunk)-[a-z0-9]+|(?:chunk|asset)-.+-[a-z0-9]+)\.[a-z0-9]+(?:\.map)?$/
|
|
16
|
+
|
|
17
|
+
/** How long a page waits for the network before opening from the device instead. */
|
|
18
|
+
const NAVIGATION_TIMEOUT_MS = 3000
|
|
19
|
+
|
|
20
|
+
export interface ServiceWorkerOptions {
|
|
21
|
+
/** Changes with every build, so a deploy replaces what the device keeps. */
|
|
22
|
+
readonly version: string
|
|
23
|
+
/** The shell's entry script: a shell that doesn't name it belongs to another deploy. */
|
|
24
|
+
readonly entry: string
|
|
25
|
+
/** Same-origin files the app needs to open: its entry script and stylesheet, and its icons. */
|
|
26
|
+
readonly precache: readonly string[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The service worker a production build ships. It keeps the app on the device, so the installed
|
|
31
|
+
* app opens on a slow connection or none:
|
|
32
|
+
*
|
|
33
|
+
* - A page goes to the network first, and opens from the device when the network fails or takes
|
|
34
|
+
* longer than three seconds. Every page is the same app shell, saved from `/` once per version.
|
|
35
|
+
* - A hashed file comes from the device once saved; any other file of the app's comes from the
|
|
36
|
+
* network, and from the device when the network fails. Each is saved as it loads.
|
|
37
|
+
* - Other origins, such as a separately served API, and the reserved paths pass through untouched.
|
|
38
|
+
*
|
|
39
|
+
* Installing saves the shell and the files it opens with; a new version takes over at once. The last
|
|
40
|
+
* version's files stay one more round, for a page still running it, and older ones go. The page's
|
|
41
|
+
* data still comes from the API.
|
|
42
|
+
*
|
|
43
|
+
* With navigation preload, the browser asks for a page while the worker starts rather than after, so
|
|
44
|
+
* the worker adds no wait to a launch online.
|
|
45
|
+
*/
|
|
46
|
+
export function renderServiceWorker(options: ServiceWorkerOptions): string {
|
|
47
|
+
return `// Generated by Sixb: the app's service worker. See @sixb/app's service-worker.ts.
|
|
48
|
+
const CACHE_PREFIX = "sixb-app-"
|
|
49
|
+
const CACHE = CACHE_PREFIX + ${JSON.stringify(options.version)}
|
|
50
|
+
const SHELL = "/"
|
|
51
|
+
const ENTRY = ${JSON.stringify(options.entry)}
|
|
52
|
+
const PRECACHE = ${JSON.stringify(options.precache)}
|
|
53
|
+
const RESERVED = ${JSON.stringify(RESERVED_PATH_PREFIXES)}
|
|
54
|
+
const IMMUTABLE = ${IMMUTABLE_ASSET_PATTERN.toString()}
|
|
55
|
+
const NAVIGATION_TIMEOUT_MS = ${NAVIGATION_TIMEOUT_MS}
|
|
56
|
+
|
|
57
|
+
self.addEventListener("install", (event) => {
|
|
58
|
+
// Best effort: a file that fails to save is saved when the app next loads it.
|
|
59
|
+
event.waitUntil(
|
|
60
|
+
caches
|
|
61
|
+
.open(CACHE)
|
|
62
|
+
.then((cache) =>
|
|
63
|
+
Promise.allSettled([
|
|
64
|
+
fetch(new Request(SHELL, { cache: "reload" })).then((response) => saveShell(cache, response)),
|
|
65
|
+
// The page has just loaded these, so most come from the browser's cache.
|
|
66
|
+
...PRECACHE.map((path) => cache.add(path)),
|
|
67
|
+
])
|
|
68
|
+
)
|
|
69
|
+
.then(() => self.skipWaiting())
|
|
70
|
+
)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
self.addEventListener("activate", (event) => {
|
|
74
|
+
event.waitUntil(
|
|
75
|
+
caches
|
|
76
|
+
.keys()
|
|
77
|
+
.then((keys) =>
|
|
78
|
+
Promise.all(
|
|
79
|
+
keys
|
|
80
|
+
.filter((key) => key.startsWith(CACHE_PREFIX) && key !== CACHE)
|
|
81
|
+
// Oldest first: all but the last version go.
|
|
82
|
+
.slice(0, -1)
|
|
83
|
+
.map((key) => caches.delete(key))
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
// The browser asks for a page while it starts the worker, rather than after.
|
|
87
|
+
.then(() => self.registration.navigationPreload?.enable())
|
|
88
|
+
.then(() => self.clients.claim())
|
|
89
|
+
)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
self.addEventListener("fetch", (event) => {
|
|
93
|
+
const request = event.request
|
|
94
|
+
if (request.method !== "GET" || request.headers.has("range")) return
|
|
95
|
+
const url = new URL(request.url)
|
|
96
|
+
if (url.origin !== self.location.origin || isReserved(url.pathname)) return
|
|
97
|
+
|
|
98
|
+
if (request.mode === "navigate") {
|
|
99
|
+
event.respondWith(page(event, url))
|
|
100
|
+
} else {
|
|
101
|
+
event.respondWith(file(event, url))
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
function page(event, url) {
|
|
106
|
+
let saving = Promise.resolve()
|
|
107
|
+
const network = Promise.resolve(event.preloadResponse)
|
|
108
|
+
.then((preloaded) => preloaded ?? fetch(event.request))
|
|
109
|
+
.then((response) => {
|
|
110
|
+
// Only "/" refreshes the shell: another address may be a page of the project's own.
|
|
111
|
+
if (url.pathname === SHELL) {
|
|
112
|
+
const copy = response.clone()
|
|
113
|
+
saving = caches.open(CACHE).then((cache) => saveShell(cache, copy))
|
|
114
|
+
}
|
|
115
|
+
return response
|
|
116
|
+
})
|
|
117
|
+
event.waitUntil(network.then(() => saving, () => undefined))
|
|
118
|
+
|
|
119
|
+
const offline = network.catch(() => savedShell().then((saved) => saved ?? Response.error()))
|
|
120
|
+
const slow = delay(NAVIGATION_TIMEOUT_MS)
|
|
121
|
+
.then(savedShell)
|
|
122
|
+
.then((saved) => saved ?? offline)
|
|
123
|
+
return Promise.race([offline, slow])
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function file(event, url) {
|
|
127
|
+
// Any version's copy will do for a hashed file, so a page the last version runs still finds its own.
|
|
128
|
+
const immutable = IMMUTABLE.test(url.pathname.split("/").pop() ?? "")
|
|
129
|
+
if (immutable) {
|
|
130
|
+
const saved = await caches.match(event.request)
|
|
131
|
+
if (saved) return saved
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
const response = await fetch(event.request)
|
|
135
|
+
if (response.ok && response.type === "basic") {
|
|
136
|
+
const copy = response.clone()
|
|
137
|
+
event.waitUntil(caches.open(CACHE).then((cache) => cache.put(event.request, copy)))
|
|
138
|
+
}
|
|
139
|
+
return response
|
|
140
|
+
} catch (error) {
|
|
141
|
+
const saved = await caches.match(event.request)
|
|
142
|
+
if (saved) return saved
|
|
143
|
+
throw error
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function saveShell(cache, response) {
|
|
148
|
+
if (!isShell(response)) return
|
|
149
|
+
// Mid-rollout another server can answer with the other deploy's shell, whose files aren't kept.
|
|
150
|
+
if (!(await response.clone().text()).includes(ENTRY)) return
|
|
151
|
+
await cache.put(SHELL, response)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function isShell(response) {
|
|
155
|
+
return (
|
|
156
|
+
response.ok &&
|
|
157
|
+
!response.redirected &&
|
|
158
|
+
response.type === "basic" &&
|
|
159
|
+
(response.headers.get("content-type") ?? "").includes("text/html")
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// This version's shell, else the last version's, whose files are still kept.
|
|
164
|
+
async function savedShell() {
|
|
165
|
+
return (await (await caches.open(CACHE)).match(SHELL)) ?? (await caches.match(SHELL))
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function isReserved(pathname) {
|
|
169
|
+
return RESERVED.some((prefix) => pathname === prefix || pathname.startsWith(prefix + "/"))
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function delay(ms) {
|
|
173
|
+
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
174
|
+
}
|
|
175
|
+
`
|
|
176
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type GetAuthSessionResponse, setSharedAccessGuestName } from "@sixb/client"
|
|
2
|
+
import type { SixbSharedAccessSession } from "@sixb/client/browser"
|
|
3
|
+
import { getAuthSessionQueryKey } from "@sixb/client/hooks"
|
|
4
|
+
import { type QueryClient, useQuery, useQueryClient } from "@tanstack/react-query"
|
|
5
|
+
import { useCallback } from "react"
|
|
6
|
+
|
|
7
|
+
// A shared link opens the app for a visitor without an account: a guest. The bootstrap keeps its
|
|
8
|
+
// session here, so a page knows it reads as one, and never asks for a member's session.
|
|
9
|
+
|
|
10
|
+
const SHARED_SESSION_QUERY_KEY = ["sixb", "shared-session"] as const
|
|
11
|
+
|
|
12
|
+
/** The visitor of a shared link, as their session knows them. */
|
|
13
|
+
export interface SharedGuest {
|
|
14
|
+
readonly grantId: string
|
|
15
|
+
/** The page the link opens, within the app: where the guest goes back to. */
|
|
16
|
+
readonly destinationPath: string
|
|
17
|
+
/** The author id of the comments they write. */
|
|
18
|
+
readonly id: string
|
|
19
|
+
/** The name they gave, which their comments and presence carry; none until they give it. */
|
|
20
|
+
readonly name?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Keeps the shared link's session the bootstrap opened. Nobody is signed in: the member's session
|
|
25
|
+
* is never asked for, as the boundary would refuse it.
|
|
26
|
+
*/
|
|
27
|
+
export function keepSharedSession(queries: QueryClient, session: SixbSharedAccessSession): void {
|
|
28
|
+
const signedOut: GetAuthSessionResponse = { authenticated: false, authEnabled: true }
|
|
29
|
+
queries.setQueryData(getAuthSessionQueryKey(), signedOut)
|
|
30
|
+
queries.setQueryData(SHARED_SESSION_QUERY_KEY, session)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The guest reading through a shared link, or `null` for anyone else. */
|
|
34
|
+
export function useSharedGuest(): SharedGuest | null {
|
|
35
|
+
const { data } = useQuery<SixbSharedAccessSession | null>({
|
|
36
|
+
queryKey: SHARED_SESSION_QUERY_KEY,
|
|
37
|
+
queryFn: () => null,
|
|
38
|
+
// Only the bootstrap knows the session: nothing here fetches it.
|
|
39
|
+
enabled: false,
|
|
40
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
41
|
+
})
|
|
42
|
+
if (!data) return null
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
grantId: data.grantId,
|
|
46
|
+
destinationPath: data.destinationPath,
|
|
47
|
+
id: data.guestId,
|
|
48
|
+
...(data.guestName ? { name: data.guestName } : {}),
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Gives the guest's name, which their session keeps for their comments and presence. Rejects when
|
|
54
|
+
* the API refuses it, so a form can say why.
|
|
55
|
+
*/
|
|
56
|
+
export function useGiveGuestName(): (name: string) => Promise<void> {
|
|
57
|
+
const queries = useQueryClient()
|
|
58
|
+
|
|
59
|
+
return useCallback(
|
|
60
|
+
async (name: string) => {
|
|
61
|
+
const session = queries.getQueryData<SixbSharedAccessSession>(SHARED_SESSION_QUERY_KEY)
|
|
62
|
+
if (!session) throw new Error("[SixbApp] Only a shared link's visitor gives a guest name.")
|
|
63
|
+
|
|
64
|
+
const { data } = await setSharedAccessGuestName({
|
|
65
|
+
path: { grantId: session.grantId },
|
|
66
|
+
body: { name },
|
|
67
|
+
throwOnError: true,
|
|
68
|
+
})
|
|
69
|
+
queries.setQueryData(SHARED_SESSION_QUERY_KEY, data)
|
|
70
|
+
},
|
|
71
|
+
[queries]
|
|
72
|
+
)
|
|
73
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { isInstalledApp } from "@sixb/ui/components"
|
|
2
|
+
import type { QueryClient } from "@tanstack/react-query"
|
|
3
|
+
|
|
4
|
+
/** Away at least this long, the app refreshes what it shows when it comes back. */
|
|
5
|
+
export const REFRESH_AFTER_MS = 30_000
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Relaunched within this long of being left, the installed app opens on the screen it was left on.
|
|
9
|
+
* iOS closes a web app in the background as it needs the memory, and opens it again at its start
|
|
10
|
+
* page; a native app comes back where it was.
|
|
11
|
+
*/
|
|
12
|
+
export const RESTORE_WITHIN_MS = 30 * 60_000
|
|
13
|
+
|
|
14
|
+
const LAST_SCREEN_KEY = "sixb-last-screen"
|
|
15
|
+
|
|
16
|
+
export interface LeftScreen {
|
|
17
|
+
/** The address, with its query string. */
|
|
18
|
+
readonly path: string
|
|
19
|
+
/** When the app was left, in milliseconds since the epoch. */
|
|
20
|
+
readonly at: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let refreshing = false
|
|
24
|
+
let remembering = false
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* In the installed app, refreshes every query on screen when the app comes back after
|
|
28
|
+
* `REFRESH_AFTER_MS` or longer in the background, so returning to it shows what changed, as a
|
|
29
|
+
* native app does. A browser tab keeps the query client's own choice not to refetch on focus.
|
|
30
|
+
* Once per page.
|
|
31
|
+
*/
|
|
32
|
+
export function refreshOnReturn(queryClient: QueryClient): void {
|
|
33
|
+
if (refreshing || !isInstalledApp()) return
|
|
34
|
+
refreshing = true
|
|
35
|
+
|
|
36
|
+
let hiddenAt: number | null = null
|
|
37
|
+
document.addEventListener("visibilitychange", () => {
|
|
38
|
+
if (document.visibilityState === "hidden") {
|
|
39
|
+
hiddenAt = Date.now()
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
if (hiddenAt !== null && Date.now() - hiddenAt >= REFRESH_AFTER_MS) {
|
|
43
|
+
void queryClient.invalidateQueries()
|
|
44
|
+
}
|
|
45
|
+
hiddenAt = null
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* In the installed app, reopens the screen it was left on when it is launched again at its start
|
|
51
|
+
* page within `RESTORE_WITHIN_MS`, before the first render, and remembers the screen each time the
|
|
52
|
+
* app is left. Back from a reopened record climbs to its list (`useBack`). Browser tabs keep their
|
|
53
|
+
* own history and are left alone.
|
|
54
|
+
*/
|
|
55
|
+
export function restoreLastScreen(): void {
|
|
56
|
+
if (!isInstalledApp()) return
|
|
57
|
+
|
|
58
|
+
const path = screenToReopen(readLeftScreen(), {
|
|
59
|
+
path: window.location.pathname + window.location.search + window.location.hash,
|
|
60
|
+
now: Date.now(),
|
|
61
|
+
})
|
|
62
|
+
if (path) {
|
|
63
|
+
try {
|
|
64
|
+
window.history.replaceState(null, "", path)
|
|
65
|
+
} catch {
|
|
66
|
+
// An address the page can't take: open where iOS did.
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (remembering) return
|
|
71
|
+
remembering = true
|
|
72
|
+
const remember = () => {
|
|
73
|
+
writeLeftScreen({ path: window.location.pathname + window.location.search, at: Date.now() })
|
|
74
|
+
}
|
|
75
|
+
document.addEventListener("visibilitychange", () => {
|
|
76
|
+
if (document.visibilityState === "hidden") remember()
|
|
77
|
+
})
|
|
78
|
+
window.addEventListener("pagehide", remember)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The screen to reopen at launch, or null to open where iOS did. */
|
|
82
|
+
export function screenToReopen(
|
|
83
|
+
left: LeftScreen | null,
|
|
84
|
+
launch: { readonly path: string; readonly now: number }
|
|
85
|
+
): string | null {
|
|
86
|
+
if (!left || launch.path !== "/") return null
|
|
87
|
+
if (launch.now - left.at > RESTORE_WITHIN_MS || launch.now < left.at) return null
|
|
88
|
+
if (left.path === "/" || !left.path.startsWith("/") || left.path.startsWith("//")) return null
|
|
89
|
+
return left.path
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function readLeftScreen(): LeftScreen | null {
|
|
93
|
+
try {
|
|
94
|
+
const value: unknown = JSON.parse(localStorage.getItem(LAST_SCREEN_KEY) ?? "null")
|
|
95
|
+
if (
|
|
96
|
+
typeof value === "object" &&
|
|
97
|
+
value !== null &&
|
|
98
|
+
typeof (value as LeftScreen).path === "string" &&
|
|
99
|
+
typeof (value as LeftScreen).at === "number"
|
|
100
|
+
) {
|
|
101
|
+
return value as LeftScreen
|
|
102
|
+
}
|
|
103
|
+
} catch {
|
|
104
|
+
// Storage blocked or the value unreadable: open where iOS did.
|
|
105
|
+
}
|
|
106
|
+
return null
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function writeLeftScreen(screen: LeftScreen): void {
|
|
110
|
+
try {
|
|
111
|
+
localStorage.setItem(LAST_SCREEN_KEY, JSON.stringify(screen))
|
|
112
|
+
} catch {
|
|
113
|
+
// Storage blocked: the next launch opens at the start page.
|
|
114
|
+
}
|
|
115
|
+
}
|