vite-hub 0.5.0 → 0.6.0
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/README.md +9 -8
- package/dist/_internal/runtime/browser-errors.d.ts +0 -2
- package/dist/_internal/runtime/browser-errors.js +3 -4
- package/dist/_internal/runtime/redirects.d.ts +1 -2
- package/dist/_internal/runtime/redirects.js +2 -3
- package/dist/_internal/runtime/request-policy.d.ts +1 -2
- package/dist/_internal/runtime/request-policy.js +2 -3
- package/dist/_internal/runtime/security.d.ts +1 -2
- package/dist/_internal/runtime/security.js +1 -2
- package/dist/{access-BC9HtX_M.js → access-CUFHPi8T.js} +13 -140
- package/dist/{access-policy-DhsEACna.d.ts → access-DkBck8Vu.d.ts} +17 -21
- package/dist/{access-policy-CVZg9LPR.js → access-policy-BM48XstY.js} +5 -6
- package/dist/{account-Cjj-tYzo.d.ts → account-DNr8fHcQ.d.ts} +5 -7
- package/dist/{console/runtime/server → agent/console}/agents.get.d.ts +2 -3
- package/dist/{console/runtime/server → agent/console}/agents.get.js +3 -4
- package/dist/{console/runtime/server → agent/console}/channel-replay.d.ts +3 -5
- package/dist/{console/runtime/server → agent/console}/channel-replay.js +6 -7
- package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.d.ts +1 -3
- package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.js +4 -5
- package/dist/agent/console/invocation-workspace.get.d.ts +6 -0
- package/dist/{console/runtime/server → agent/console}/invocation-workspace.get.js +6 -7
- package/dist/{console/runtime/server → agent/console}/invocation.get.d.ts +4 -6
- package/dist/{console/runtime/server → agent/console}/invocation.get.js +8 -9
- package/dist/{console/runtime/server → agent/console}/invocations.get.d.ts +1 -2
- package/dist/{console/runtime/server → agent/console}/invocations.get.js +5 -6
- package/dist/agent/console/invocations.usage.d.ts +6 -0
- package/dist/agent/console/invocations.usage.js +51 -0
- package/dist/agent/console/operations.d.ts +6 -0
- package/dist/agent/console/operations.js +247 -0
- package/dist/{console/runtime/server → agent/console}/status.get.d.ts +2 -4
- package/dist/{console/runtime/server → agent/console}/status.get.js +6 -7
- package/dist/{server-W0c79AYZ.js → agent-console-CHsLxKk_.js} +4 -4
- package/dist/agent-console-FmaYpVv-.d.ts +14 -0
- package/dist/{agent-invocations.post-C3Onl2yH.js → agent-invocations.post-CF5anHY6.js} +14 -17
- package/dist/agents-DBm_PJie.js +1 -0
- package/dist/{agents-B76RICcy.js → agents-DXLHsE7x.js} +5 -6
- package/dist/{agents-C94A4N9u.d.ts → agents-Gyw4VKPt.d.ts} +0 -2
- package/dist/auth/console/auth.d.ts +25 -0
- package/dist/{console/runtime/server → auth/console}/auth.js +11 -13
- package/dist/auth/console/operations.d.ts +3 -0
- package/dist/auth/console/operations.js +135 -0
- package/dist/auth/server.js +1 -2
- package/dist/{auth-operations-GcQk0O0X.js → auth-operations-BKqoX8Ua.js} +4 -5
- package/dist/{auth-types-D3ugQ8xM.d.ts → auth-types-Cotn7406.d.ts} +4 -21
- package/dist/bin.js +8 -11
- package/dist/blob/console/operations.d.ts +3 -0
- package/dist/blob/console/operations.js +44 -0
- package/dist/blob/nuxt-image.js +1 -2
- package/dist/{blob-BcgsZtqM.js → blob-iw8pWQ6o.js} +5 -6
- package/dist/{blob-iVewd7KQ.d.ts → blob-uNin0_TV.d.ts} +1 -3
- package/dist/{browser-error-limits-CToqAD-O.js → browser-error-limits-B0yS95zt.js} +2 -4
- package/dist/cache/operations.d.ts +2 -4
- package/dist/cache/operations.js +3 -4
- package/dist/cache.d.ts +1 -3
- package/dist/cache.js +2 -3
- package/dist/{cli-config-FPHk1nbC.js → cli-config-BX8H4ZCo.js} +2 -3
- package/dist/cli-config-DgpmE_7z.js +1 -0
- package/dist/cms.js +1 -2
- package/dist/console/auth-types.d.ts +2 -2
- package/dist/console/auth.d.ts +2 -4
- package/dist/console/auth.js +2 -3
- package/dist/console/runtime/auth-operations.d.ts +4 -6
- package/dist/console/runtime/auth-operations.js +1 -2
- package/dist/console/runtime/client/account-views.d.ts +1 -3
- package/dist/console/runtime/client/account-views.js +1 -2
- package/dist/console/runtime/client/account.d.ts +1 -1
- package/dist/console/runtime/client/account.js +29 -45
- package/dist/console/runtime/client/appearance.d.ts +1 -2
- package/dist/console/runtime/client/appearance.js +1 -2
- package/dist/console/runtime/client/auth-management.ts +6 -6
- package/dist/console/runtime/client/blob-media.d.ts +2 -4
- package/dist/console/runtime/client/blob-media.js +5 -6
- package/dist/console/runtime/client/comment-thread.d.ts +1 -3
- package/dist/console/runtime/client/comment-thread.js +3 -4
- package/dist/console/runtime/client/content-heads.d.ts +1 -2
- package/dist/console/runtime/client/content-heads.js +2 -3
- package/dist/console/runtime/client/documents.d.ts +2 -2
- package/dist/console/runtime/client/documents.js +1 -2
- package/dist/console/runtime/client/editor.d.ts +3 -5
- package/dist/console/runtime/client/editor.js +1 -2
- package/dist/console/runtime/client/env-groups.d.ts +1 -3
- package/dist/console/runtime/client/env-groups.js +1 -2
- package/dist/console/runtime/client/env-status.d.ts +1 -3
- package/dist/console/runtime/client/env-status.js +1 -2
- package/dist/console/runtime/client/format.d.ts +1 -3
- package/dist/console/runtime/client/format.js +1 -2
- package/dist/console/runtime/client/invocation-deletion.d.ts +1 -2
- package/dist/console/runtime/client/invocation-deletion.js +1 -2
- package/dist/console/runtime/client/invocation.d.ts +1 -2
- package/dist/console/runtime/client/invocation.js +4 -5
- package/dist/console/runtime/client/live.d.ts +2 -4
- package/dist/console/runtime/client/live.js +1 -2
- package/dist/console/runtime/client/mcp-client.d.ts +7 -5
- package/dist/console/runtime/client/mcp-client.js +10 -5
- package/dist/console/runtime/client/media-library.d.ts +1 -1
- package/dist/console/runtime/client/media-library.js +1 -2
- package/dist/console/runtime/client/media-uploads.d.ts +2 -4
- package/dist/console/runtime/client/media-uploads.js +2 -3
- package/dist/console/runtime/client/media.d.ts +1 -1
- package/dist/console/runtime/client/media.js +1 -2
- package/dist/console/runtime/client/operation-view.d.ts +2 -4
- package/dist/console/runtime/client/operation-view.js +4 -5
- package/dist/console/runtime/client/presence.d.ts +2 -4
- package/dist/console/runtime/client/presence.js +1 -2
- package/dist/console/runtime/client/preview.d.ts +1 -3
- package/dist/console/runtime/client/preview.js +1 -2
- package/dist/console/runtime/client/problem.d.ts +2 -4
- package/dist/console/runtime/client/problem.js +3 -4
- package/dist/console/runtime/client/project-link.d.ts +1 -1
- package/dist/console/runtime/client/project-link.js +1 -2
- package/dist/console/runtime/client/project-session.d.ts +19 -10
- package/dist/console/runtime/client/project-session.js +1 -723
- package/dist/console/runtime/client/project.d.ts +1 -3
- package/dist/console/runtime/client/project.js +1 -2
- package/dist/console/runtime/client/projects.d.ts +1 -1
- package/dist/console/runtime/client/projects.js +1 -2
- package/dist/console/runtime/client/publish.d.ts +2 -4
- package/dist/console/runtime/client/publish.js +1 -2
- package/dist/console/runtime/client/rate-limit.d.ts +1 -3
- package/dist/console/runtime/client/rate-limit.js +3 -4
- package/dist/console/runtime/client/read-only.d.ts +2 -4
- package/dist/console/runtime/client/read-only.js +2 -3
- package/dist/console/runtime/client/request.d.ts +2 -2
- package/dist/console/runtime/client/request.js +1 -2
- package/dist/console/runtime/client/route-query.d.ts +4 -5
- package/dist/console/runtime/client/route-query.js +1 -2
- package/dist/console/runtime/client/schedule-run.d.ts +1 -3
- package/dist/console/runtime/client/schedule-run.js +3 -4
- package/dist/console/runtime/client/schema-form.d.ts +1 -1
- package/dist/console/runtime/client/schema-form.js +1 -2
- package/dist/console/runtime/client/sections.d.ts +1 -1
- package/dist/console/runtime/client/sections.js +1 -2
- package/dist/console/runtime/client/site-access.d.ts +83 -16
- package/dist/console/runtime/client/site-access.js +159 -32
- package/dist/console/runtime/client/site-link.d.ts +2 -0
- package/dist/console/runtime/client/site-link.js +1 -0
- package/dist/console/runtime/client/stored.d.ts +1 -3
- package/dist/console/runtime/client/stored.js +1 -2
- package/dist/console/runtime/client/toast.d.ts +1 -3
- package/dist/console/runtime/client/toast.js +1 -2
- package/dist/console/runtime/client/workflow.d.ts +1 -3
- package/dist/console/runtime/client/workflow.js +3 -4
- package/dist/console/runtime/components/console-account-home.vue +9 -7
- package/dist/console/runtime/components/console-account-link.vue +8 -5
- package/dist/console/runtime/components/console-account-setup.vue +10 -7
- package/dist/console/runtime/components/console-account-shell.vue +7 -2
- package/dist/console/runtime/components/console-account-unlink.vue +2 -3
- package/dist/console/runtime/components/console-app-settings.vue +8 -2
- package/dist/console/runtime/components/console-auth-detail.vue +1 -1
- package/dist/console/runtime/components/console-auth-event-list.vue +1 -0
- package/dist/console/runtime/components/console-document-editor.vue +3 -4
- package/dist/console/runtime/components/console-hosted-comments-embed.vue +106 -0
- package/dist/console/runtime/components/console-mcp-callback.vue +6 -1
- package/dist/console/runtime/components/console-mcp-items.vue +3 -16
- package/dist/console/runtime/components/console-site.vue +10 -8
- package/dist/console/runtime/components/console-usage.vue +2 -2
- package/dist/console/runtime/console-route.d.ts +1 -3
- package/dist/console/runtime/console-route.js +1 -2
- package/dist/console/runtime/definitions.d.ts +1 -1
- package/dist/console/runtime/definitions.js +1 -2
- package/dist/console/runtime/diagnostics.ts +14 -49
- package/dist/console/runtime/mcp-client.d.ts +2 -2
- package/dist/console/runtime/mcp-client.js +1 -2
- package/dist/console/runtime/operation-loader.d.ts +1 -0
- package/dist/console/runtime/operation-loader.js +10 -0
- package/dist/console/runtime/page-tool/account.js +26 -0
- package/dist/console/runtime/page-tool/page-tool.js +2 -2
- package/dist/console/runtime/rpc.d.ts +1 -1
- package/dist/console/runtime/rpc.js +1 -2
- package/dist/console/runtime/sections.d.ts +2 -2
- package/dist/console/runtime/sections.js +1 -2
- package/dist/console/runtime/server/access-policy.d.ts +1 -1
- package/dist/console/runtime/server/access-policy.js +1 -2
- package/dist/console/runtime/server/agent-console.d.ts +2 -0
- package/dist/console/runtime/server/agent-console.js +1 -0
- package/dist/console/runtime/server/blob.d.ts +1 -1
- package/dist/console/runtime/server/blob.js +1 -2
- package/dist/console/runtime/server/database.d.ts +1 -1
- package/dist/console/runtime/server/database.js +1 -2
- package/dist/console/runtime/server/definitions.d.ts +1 -1
- package/dist/console/runtime/server/definitions.get.d.ts +4 -6
- package/dist/console/runtime/server/definitions.get.js +5 -6
- package/dist/console/runtime/server/definitions.js +1 -2
- package/dist/console/runtime/server/development.d.ts +1 -1
- package/dist/console/runtime/server/development.js +1 -2
- package/dist/console/runtime/server/documents.d.ts +2 -2
- package/dist/console/runtime/server/documents.js +3 -3
- package/dist/console/runtime/server/entry-site-access.d.ts +3 -0
- package/dist/console/runtime/server/entry-site-access.js +4 -0
- package/dist/console/runtime/server/entry.d.ts +3 -0
- package/dist/console/runtime/server/entry.js +4 -0
- package/dist/console/runtime/server/env.d.ts +1 -3
- package/dist/console/runtime/server/env.js +1 -2
- package/dist/console/runtime/server/operation-contributions.d.ts +1 -1
- package/dist/console/runtime/server/operation-contributions.js +1 -2
- package/dist/console/runtime/server/pill.d.ts +45 -0
- package/dist/console/runtime/server/pill.js +62 -0
- package/dist/console/runtime/server/rpc.d.ts +5 -10
- package/dist/console/runtime/server/rpc.js +19 -27
- package/dist/console/runtime/server/runtime.d.ts +1 -1
- package/dist/console/runtime/server/runtime.js +1 -2
- package/dist/console/runtime/server/sections.d.ts +5 -5
- package/dist/console/runtime/server/sections.get.d.ts +1 -1
- package/dist/console/runtime/server/sections.get.js +8 -9
- package/dist/console/runtime/server/sections.js +6 -6
- package/dist/console/runtime/server/setup.d.ts +5 -5
- package/dist/console/runtime/server/setup.js +5 -5
- package/dist/console/runtime/server/site-access-operation.d.ts +7 -0
- package/dist/console/runtime/server/site-access-operation.js +36 -0
- package/dist/console/runtime/server/site-actions.d.ts +73 -0
- package/dist/console/runtime/server/site-actions.js +105 -0
- package/dist/console/runtime/server/site-entry.d.ts +16 -9
- package/dist/console/runtime/server/site-entry.js +62 -46
- package/dist/console/runtime/server/site-visitor.d.ts +17 -0
- package/dist/console/runtime/server/site-visitor.js +1 -0
- package/dist/console/runtime/server/site.d.ts +27 -0
- package/dist/console/runtime/server/site.js +1 -0
- package/dist/console/runtime/skills.d.ts +1 -3
- package/dist/console/runtime/skills.js +1 -2
- package/dist/console/server.d.ts +9 -25
- package/dist/console/server.js +8 -8
- package/dist/console/ui.d.ts +0 -10
- package/dist/console/ui.js +14 -27
- package/dist/console-lazy-views-VEjcbL4Q.js +1 -0
- package/dist/{console-route-CM2G5hiC.js → console-route-DbdnLkkF.js} +2 -3
- package/dist/console-signature--55DIKf2.js +237 -0
- package/dist/console.d.ts +1 -3
- package/dist/console.js +1 -2
- package/dist/content/console/operations.d.ts +3 -0
- package/dist/content/console/operations.js +62 -0
- package/dist/{console/runtime/server → database/console}/database.get.d.ts +2 -3
- package/dist/{console/runtime/server → database/console}/database.get.js +4 -5
- package/dist/database/console/operations.d.ts +3 -0
- package/dist/database/console/operations.js +49 -0
- package/dist/{database-UMJgnU2z.js → database-CrgBUdIx.js} +3 -4
- package/dist/{database-DC67Ipm-.d.ts → database-yFezh5U1.d.ts} +1 -3
- package/dist/{definition-catalog-BUcclwSH.js → definition-catalog-1xPPtzOx.js} +3 -4
- package/dist/definition-catalog-M5ua7JRS.js +1 -0
- package/dist/{definitions-BW6SvmMM.js → definitions-BFYqXchw.js} +1 -2
- package/dist/{definitions-DB4LbZ7T.d.ts → definitions-ChvMnA1L.d.ts} +0 -2
- package/dist/{definitions-DTytrw42.js → definitions-DGo2rNQ9.js} +5 -6
- package/dist/{definitions-Dbgxfz3I.d.ts → definitions-DRkgHKmk.d.ts} +1 -3
- package/dist/{deployment-BUshgN5Q.js → deployment-CURATxjG.js} +2 -3
- package/dist/deployment-l7RuKdEp.js +1 -0
- package/dist/{dev-peer-CHjyHYG6.js → dev-peer-CRYp01PE.js} +2 -222
- package/dist/dev-peer-CX5C9243.js +1 -0
- package/dist/{development-zLxOp-AO.js → development-DD567hhJ.js} +2 -3
- package/dist/{development-RnopiRwK.d.ts → development-I40mfD7B.d.ts} +1 -3
- package/dist/{diagnostics-DtR0TAmq.js → diagnostics-DLHqjKGe.js} +3 -9
- package/dist/diagnostics-DgGKvWzF.d.ts +7 -0
- package/dist/docs/nuxt.js +1 -2
- package/dist/doctor.d.ts +0 -6
- package/dist/doctor.js +11492 -12152
- package/dist/{documents-BDR0AkYR.d.ts → documents-A-7Ho0g0.d.ts} +12 -16
- package/dist/{documents-B4R4JSfH.js → documents-BduuZjm3.js} +6 -6
- package/dist/{documents-BASIRZ91.d.ts → documents-CApMRd4o.d.ts} +4 -7
- package/dist/{documents-BewAPY61.js → documents-D6ueeoUR.js} +17 -21
- package/dist/durability/operations.d.ts +2 -4
- package/dist/durability/operations.js +3 -4
- package/dist/{entries-DbyNPLC9.js → entries-UFs9n1MB.js} +2 -3
- package/dist/{console/runtime/server → env/console}/env.get.d.ts +2 -4
- package/dist/env/console/env.get.js +15 -0
- package/dist/env/console/operations.d.ts +3 -0
- package/dist/env/console/operations.js +12 -0
- package/dist/env/vite.d.ts +1 -0
- package/dist/env/vite.js +2 -0
- package/dist/{env-Dg1I_DWr.js → env-D-wtSupz.js} +2 -3
- package/dist/{error-diagnostics-B1yAIaSn.js → error-diagnostics-CBtvqI30.js} +2 -7
- package/dist/{error-diagnostics-C0KyI408.js → error-diagnostics-kKXseq8d.js} +5 -2
- package/dist/error-diagnostics.ts +1 -7
- package/dist/{features-CC5OcZqJ.js → features-BXRKlmtN.js} +5 -6
- package/dist/features-CD5i5I8V.js +1 -0
- package/dist/{format-BOYlanIZ.js → format-Df-bS4Ly.js} +1 -2
- package/dist/{github-login-Bi3bfjRX.js → github-login-W-vaahWP.js} +1 -2
- package/dist/{host-CkL0jjBq.js → host-DeNPYIeV.js} +1 -2
- package/dist/{http-error-Bs6e8_-8.js → http-error-BorAxJYM.js} +1 -2
- package/dist/index.d.ts +1 -7
- package/dist/index.js +5 -7
- package/dist/{inspect-DbZuP_7b.js → inspect-CWwAuL-B.js} +2 -3
- package/dist/internal/agent-invocations-libsql.js +1 -2
- package/dist/internal/disabled-redis-driver.d.ts +1 -3
- package/dist/internal/disabled-redis-driver.js +2 -3
- package/dist/internal/disabled-upstash-driver.d.ts +1 -3
- package/dist/internal/disabled-upstash-driver.js +2 -3
- package/dist/internal/test-loader.d.ts +1 -3
- package/dist/internal/test-loader.js +2 -3
- package/dist/internal/test-server.js +2 -3
- package/dist/{internal-BreyUsQ6.js → internal-0C_CC601.js} +1 -2
- package/dist/{internal-Cc9N0shU.d.ts → internal-BRNf11h3.d.ts} +14 -8
- package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
- package/dist/{invocation-page-undo-DqYcPlkQ.js → invocation-page-undo-DHbXczWY.js} +8 -7
- package/dist/invocations-B60XWNES.js +45 -0
- package/dist/{limits-BUlwWYQE.js → limits-BLo31qDR.js} +1 -2
- package/dist/logs/client.d.ts +1 -3
- package/dist/logs/client.js +1 -2
- package/dist/{console/runtime/server → logs/console}/logs.get.d.ts +3 -5
- package/dist/{console/runtime/server → logs/console}/logs.get.js +7 -8
- package/dist/logs/console/operations.d.ts +3 -0
- package/dist/logs/console/operations.js +23 -0
- package/dist/logs/host.d.ts +2 -4
- package/dist/logs/host.js +1 -2
- package/dist/logs/memory.d.ts +1 -1
- package/dist/logs/memory.js +1 -2
- package/dist/logs/source.d.ts +1 -1
- package/dist/logs/source.js +1 -2
- package/dist/logs.d.ts +2 -2
- package/dist/logs.js +2 -2
- package/dist/loopback-Bl9Cvj1k.js +139 -0
- package/dist/mcp/eval.d.ts +1 -0
- package/dist/mcp/eval.js +2 -0
- package/dist/{mcp-client-C_sEmyQw.d.ts → mcp-client-uXVvS7RL.d.ts} +5 -10
- package/dist/{media-uKX4Wy-c.d.ts → media-C79RB1oH.d.ts} +0 -2
- package/dist/{media-D3OfyKni.js → media-CNwnh6CG.js} +8 -9
- package/dist/{media-library-o8RRsnn_.js → media-library-DTC8TLsZ.js} +5 -6
- package/dist/{media-library-D9ThbXqs.d.ts → media-library-DxGu6w9z.d.ts} +0 -2
- package/dist/{memory-C54SDH_l.js → memory-D3EJS_Bp.js} +3 -4
- package/dist/{memory-2bbl4hcV.d.ts → memory-GK5ZGWrp.d.ts} +1 -3
- package/dist/{nuxt-server-auto-imports-cfTZYvgy.js → nuxt-server-auto-imports-4aT5BD4u.js} +1 -2
- package/dist/{nuxt-server-imports-75bWMeXc.js → nuxt-server-imports-BdJqiVhT.js} +1 -2
- package/dist/nuxt.d.ts +1 -3
- package/dist/nuxt.js +276 -182
- package/dist/{object-D8pRdprI.js → object-DRSmpe04.js} +1 -2
- package/dist/{operation-contributions-C3lwePQu.js → operation-contributions-BU10k2QS.js} +9 -9
- package/dist/{operation-contributions-CrdmqtJW.d.ts → operation-contributions-xwjDzj28.d.ts} +6 -7
- package/dist/{operation-definition-DxjKcCGm.js → operation-definition-D04Rdjbe.js} +7 -9
- package/dist/operation-modules-BUXlwjvd.js +1 -0
- package/dist/operation-modules-DHWkPcfS.js +139 -0
- package/dist/{operation-registry-BogGwk_I.js → operation-registry-DfQbL7vE.js} +1 -2
- package/dist/{operation-rpc-DI9txNxK.js → operation-rpc-BMdfapja.js} +3 -4
- package/dist/operations-D-7ljPqw.js +1 -0
- package/dist/{operations-TTjL_7Zc.d.ts → operations-DgFhA1WE.d.ts} +0 -4
- package/dist/{operations-CFYGXqLm.js → operations-DksTrRMb.js} +4 -5
- package/dist/operations-byxiZ2R2.js +113 -0
- package/dist/{optional-owners-O6sj4uoj.js → optional-owners-Cypch7V3.js} +4 -6
- package/dist/{out-fRNaVslw.js → out-Cw5Tvr92.js} +2933 -2301
- package/dist/{owned-paths-BnjT0FhU.js → owned-paths-MjjDftBn.js} +1 -2
- package/dist/page/pill.iife.js +2 -2
- package/dist/page-tools-BeZrtn4S.js +46 -0
- package/dist/page-tools-Chk8Gm9x.d.ts +23 -0
- package/dist/page-tools-shared-BLPidmCi.js +39 -0
- package/dist/{pathe.M-eThtNZ-J4gfe1m9.js → pathe.M-eThtNZ-D4EC7Wue.js} +1 -2
- package/dist/{plugins-DoXnU6-s.d.ts → plugins-BmkOoyIh.d.ts} +25 -110
- package/dist/{plugins-BTZQaFtZ.js → plugins-DfXcUnzN.js} +1779 -1384
- package/dist/presets/workspace.js +1 -2
- package/dist/{project-Dgyq1F1V.d.ts → project-B2qWt8on.d.ts} +3 -12
- package/dist/{project-DlWTGB7h.js → project-DRC67Uiu.js} +1 -2
- package/dist/{project-DXZRZEPX.js → project-_juMSuAS.js} +8 -11
- package/dist/{project-link-DT99MoyU.js → project-link-CJbCkOlC.js} +7 -8
- package/dist/{project-link-bNS-KROO.d.ts → project-link-Ck3vuq9w.d.ts} +2 -4
- package/dist/{project-root-v6ba4tn7.js → project-root-mAVQGZTX.js} +1 -2
- package/dist/project-session-8pN7pRo8.js +764 -0
- package/dist/{projects-CAcXztf4.js → projects-BRp0iseV.js} +1 -2
- package/dist/{projects-Ddvl9EJp.d.ts → projects-mgPxrKZr.d.ts} +0 -2
- package/dist/{registry-zw6aE2N9.js → registry-B8JE5NY-.js} +1 -2
- package/dist/{registry-CDKLACCZ.js → registry-CnPC-gNu.js} +1 -2
- package/dist/{request-CMA2UKKq.js → request-D769eiBL.js} +5 -6
- package/dist/{request-D7h3SQ92.d.ts → request-DYmjLTqP.d.ts} +2 -4
- package/dist/{request-SBLxvpyr.d.ts → request-DkoE0b2h.d.ts} +11 -4
- package/dist/{request-Cs0FqxEL.js → request-XFVx7CGC.js} +30 -9
- package/dist/{request-origin-COUkgHd6.js → request-origin-pzWr9UUu.js} +1 -2
- package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
- package/dist/{route-query-CRVWXIrc.js → route-query-BWVl6ZO6.js} +4 -5
- package/dist/routes-D02vxUSg.js +26 -0
- package/dist/{rpc-DIUA61pv.js → rpc-D3tsx5lZ.js} +1 -2
- package/dist/{rpc-7nlHSv3y.d.ts → rpc-oijgKQtD.d.ts} +0 -2
- package/dist/{runtime-YLWfdrtO.js → runtime-CAbuQGMP.js} +3 -4
- package/dist/{runtime-B-46Bawt.js → runtime-CRJsqVTa.js} +2 -3
- package/dist/{runtime-DxfJOfCd.js → runtime-DA7HJe10.js} +3 -4
- package/dist/runtime-DGvimtvc.d.ts +5 -0
- package/dist/{runtime-CX_l_78I.js → runtime-F0CTqBFx.js} +5 -6
- package/dist/{runtime-feature-guard-CuyPVGj9.js → runtime-feature-guard-BKAMRZzM.js} +6 -7
- package/dist/scan-module-B1A24jqP.js +1 -0
- package/dist/{scan-module-Df58L_6T.js → scan-module-BfZvDBxb.js} +2 -4
- package/dist/{schema-form-C-fy3xaU.d.ts → schema-form-Bl79Bdm-.d.ts} +0 -2
- package/dist/search-jgMrZJXR.js +84 -0
- package/dist/{sections-DumoLKQN.js → sections-AUGy9EkY.js} +2 -8
- package/dist/{sections-BogiCmtz.d.ts → sections-BMkFB3S-.d.ts} +4 -6
- package/dist/{sections-C83x0slv.js → sections-BNTdIEJw.js} +2 -3
- package/dist/{sections-Do7X4Nwt.d.ts → sections-DCoCa4nF.d.ts} +1 -8
- package/dist/sections-DjeAUX7o.d.ts +8 -0
- package/dist/{sections-BKUReack.js → sections-ZFAlI4JW.js} +14 -7
- package/dist/{sections.get-H46e2urg.d.ts → sections.get-BY5dClJY.d.ts} +2 -4
- package/dist/seo/runtime.d.ts +2 -5
- package/dist/seo/runtime.js +3 -5
- package/dist/{seo-CtLywyRx.d.ts → seo-CgW5uI9L.d.ts} +0 -2
- package/dist/seo.d.ts +1 -1
- package/dist/seo.js +1 -2
- package/dist/{setup-BC0P3eZy.d.ts → setup-BBnZPziq.d.ts} +5 -10
- package/dist/{setup-DNGzawFn.js → setup-yc3_WKNG.js} +4 -17
- package/dist/site-CZCIWsUQ.js +169 -0
- package/dist/site-link-Bvo2SxPo.js +58 -0
- package/dist/site-link-Dtw8MNVB.d.ts +18 -0
- package/dist/site-pages-B6J8U2Nq.js +66 -0
- package/dist/site-token-Wa7fhjwg.js +215 -0
- package/dist/site-visitor-BkhE2TA0.js +89 -0
- package/dist/skills/operations.d.ts +1 -5
- package/dist/skills/operations.js +4 -5
- package/dist/{skills-DdpSMiCI.js → skills-C1MaGEbO.js} +1 -2
- package/dist/skills.d.ts +1 -2
- package/dist/{skills.get-CRd06TTb.js → skills.get-CW8vc_Hf.js} +3 -4
- package/dist/skills.js +1 -2
- package/dist/{source-Cw3iYvJF.js → source-DYFndd0W.js} +2 -3
- package/dist/{source-S-LChQvw.d.ts → source-DemBtwla.d.ts} +0 -2
- package/dist/{stored-Dhv2qsQv.js → stored-J3TetMKf.js} +1 -2
- package/dist/task/operations.d.ts +1 -5
- package/dist/task/operations.js +3 -4
- package/dist/test/register.js +2 -3
- package/dist/test.d.ts +0 -4
- package/dist/test.js +1 -2
- package/dist/ui/vite.js +1 -2
- package/dist/usage-DBi7aOhx.js +33 -0
- package/dist/{version-dkga9imp.js → version-DUCd7Orc.js} +24 -21
- package/dist/{vite-stage-D7fe614I.js → vite-stage-Dmo4RgnK.js} +3 -5
- package/dist/{vue-router-C68IU1jM.d.ts → vue-router-plZJLlpm.d.ts} +120 -182
- package/dist/workspace/console/operations.d.ts +3 -0
- package/dist/workspace/console/operations.js +22 -0
- package/dist/{console/runtime/server → workspace/console}/workspace-files.get.d.ts +3 -5
- package/dist/{console/runtime/server → workspace/console}/workspace-files.get.js +4 -5
- package/dist/{workspace-history-B95Q-kGI.js → workspace-history-B52xib2J.js} +3 -4
- package/dist/{workspace-history-CeVwBB6Q.d.ts → workspace-history-WuxgLsi4.d.ts} +0 -2
- package/package.json +158 -149
- package/dist/agents-BhFggA26.js +0 -2
- package/dist/auth-GFIN6xSJ.d.ts +0 -120
- package/dist/cli-config-g_mbWdjT.js +0 -2
- package/dist/cloudflare-env-lookup-DKXdr4P_.js +0 -16
- package/dist/console/runtime/client/ticket.d.ts +0 -2
- package/dist/console/runtime/client/ticket.js +0 -2
- package/dist/console/runtime/page/loader.js +0 -134
- package/dist/console/runtime/server/auth.d.ts +0 -2
- package/dist/console/runtime/server/env.get.js +0 -16
- package/dist/console/runtime/server/invocation-workspace.get.d.ts +0 -8
- package/dist/console/runtime/server/mcp-client-operations.d.ts +0 -5
- package/dist/console/runtime/server/mcp-client-operations.js +0 -139
- package/dist/console/runtime/server/page-auth.d.ts +0 -18
- package/dist/console/runtime/server/page-auth.js +0 -44
- package/dist/console/runtime/server/page-tool.d.ts +0 -2
- package/dist/console/runtime/server/page-tool.js +0 -110
- package/dist/console/runtime/server/page-tools-route.d.ts +0 -2
- package/dist/console/runtime/server/page-tools-route.js +0 -5
- package/dist/console/runtime/server/search.get.d.ts +0 -4
- package/dist/console/runtime/server/search.get.js +0 -97
- package/dist/console/runtime/server/site-session.d.ts +0 -80
- package/dist/console/runtime/server/site-session.js +0 -2
- package/dist/console/runtime/server/tickets.d.ts +0 -2
- package/dist/console/runtime/server/tickets.js +0 -2
- package/dist/console/runtime/server/usage.get.d.ts +0 -10
- package/dist/console/runtime/server/usage.get.js +0 -92
- package/dist/console/runtime/site-access.d.ts +0 -2
- package/dist/console/runtime/site-access.js +0 -2
- package/dist/console-lazy-views-DXnIkdyd.js +0 -2
- package/dist/definition-catalog-og_1razf.js +0 -2
- package/dist/deployment-C2B0hBBj.js +0 -2
- package/dist/diagnostics-CjGiniKb.d.ts +0 -11
- package/dist/features-ujWsvlEH.js +0 -2
- package/dist/invocations-6jxqLkGY.js +0 -86
- package/dist/mcp-client-C91h8Taa.js +0 -1024
- package/dist/mcp-client-CTbTbn7d.js +0 -10
- package/dist/operations-5Lwd1xEI.js +0 -2
- package/dist/operations-ChEXk2ij.js +0 -853
- package/dist/page-tool-PmxH65gt.d.ts +0 -69
- package/dist/page-tools-ClgqElu-.js +0 -462
- package/dist/page-tools-DcCCtDKi.d.ts +0 -23
- package/dist/page-tools-shared-aNC9YtoI.js +0 -125
- package/dist/runtime-B_btezs1.d.ts +0 -7
- package/dist/scan-module-D_3X08mj.js +0 -2
- package/dist/secret-DELGKpCJ.js +0 -44
- package/dist/sections-CFiMNsqu.d.ts +0 -10
- package/dist/site-access-BycrwM2v.js +0 -18
- package/dist/site-access-CAiWyKOD.js +0 -2
- package/dist/site-access-DxfdOel1.d.ts +0 -55
- package/dist/site-access-L1qbvKt6.js +0 -293
- package/dist/site-session-CRwgKtTF.js +0 -300
- package/dist/skills/vitehub/SKILL.md +0 -142
- package/dist/skills/vitehub/agents/openai.yaml +0 -4
- package/dist/skills/vitehub/references/agent-definitions.md +0 -36
- package/dist/skills/vitehub/references/bundle.md +0 -57
- package/dist/skills/vitehub/references/capabilities-authority.md +0 -30
- package/dist/skills/vitehub/references/channels-triggers.md +0 -27
- package/dist/skills/vitehub/references/framework-composition.md +0 -29
- package/dist/skills/vitehub/references/preview-contract.md +0 -44
- package/dist/skills/vitehub/references/primitives/auth.md +0 -14
- package/dist/skills/vitehub/references/primitives/blob.md +0 -13
- package/dist/skills/vitehub/references/primitives/browser.md +0 -17
- package/dist/skills/vitehub/references/primitives/cache.md +0 -13
- package/dist/skills/vitehub/references/primitives/channels.md +0 -11
- package/dist/skills/vitehub/references/primitives/connections.md +0 -14
- package/dist/skills/vitehub/references/primitives/content.md +0 -13
- package/dist/skills/vitehub/references/primitives/database.md +0 -15
- package/dist/skills/vitehub/references/primitives/email.md +0 -11
- package/dist/skills/vitehub/references/primitives/env.md +0 -13
- package/dist/skills/vitehub/references/primitives/kv.md +0 -13
- package/dist/skills/vitehub/references/primitives/markdown-template.md +0 -13
- package/dist/skills/vitehub/references/primitives/queue.md +0 -14
- package/dist/skills/vitehub/references/primitives/rate-limit.md +0 -11
- package/dist/skills/vitehub/references/primitives/realtime.md +0 -19
- package/dist/skills/vitehub/references/primitives/sandbox-task.md +0 -11
- package/dist/skills/vitehub/references/primitives/sandbox.md +0 -13
- package/dist/skills/vitehub/references/primitives/schedule.md +0 -11
- package/dist/skills/vitehub/references/primitives/shell.md +0 -11
- package/dist/skills/vitehub/references/primitives/source.md +0 -11
- package/dist/skills/vitehub/references/primitives/workflow.md +0 -11
- package/dist/skills/vitehub/references/primitives/workspace.md +0 -11
- package/dist/skills/vitehub/references/project-patterns.md +0 -19
- package/dist/skills/vitehub/references/project-shapes.md +0 -81
- package/dist/skills/vitehub/references/proof-recovery.md +0 -31
- package/dist/skills/vitehub/references/sandboxes-hosts.md +0 -26
- package/dist/skills/vitehub/references/schedules-workflows-invocations.md +0 -28
- package/dist/skills/vitehub/references/server-primitives.md +0 -39
- package/dist/skills/vitehub/references/workspaces-sources-access.md +0 -26
- package/dist/ticket-DtBAstEU.js +0 -31
- package/dist/ticket-Pr_8ZtXW.d.ts +0 -14
- package/dist/tickets-DahBmKDT.js +0 -357
- package/dist/usage-CoQXs5nW.d.ts +0 -22
- package/dist/usage-index-VJAZ7a0p.js +0 -335
- package/dist/usage-jKtAgJZ0.js +0 -571
- /package/dist/{console/runtime/public/skills → console-skills}/index.json +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/SKILL.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/agents/openai.yaml +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/agent-definitions.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/bundle.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/capabilities-authority.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/channels-triggers.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/framework-composition.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/preview-contract.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/auth.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/blob.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/browser.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/cache.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/channels.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/connections.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/content.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/database.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/email.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/env.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/kv.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/markdown-template.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/queue.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/rate-limit.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/realtime.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/sandbox-task.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/sandbox.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/schedule.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/shell.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/source.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/workflow.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/workspace.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/project-patterns.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/project-shapes.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/proof-recovery.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/sandboxes-hosts.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/schedules-workflows-invocations.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/server-primitives.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/workspaces-sources-access.md +0 -0
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
//#region ../internal/src/runtime/page-tools-shared.ts
|
|
2
|
-
/**
|
|
3
|
-
* The names and the session answer that the page tools server and the browser loader share. It has no DOM and no Node
|
|
4
|
-
* code, so both sides import it.
|
|
5
|
-
*/
|
|
6
|
-
/** The query that turns the page tools on for a page. `?vitehub=<tool id>` also opens that tool. */
|
|
7
|
-
const viteHubPageToolsQuery = "vitehub";
|
|
8
|
-
/**
|
|
9
|
-
* Query parameters of links into a tool, such as `?comment=3` of Comments. Like `?vitehub`, they load the page tools,
|
|
10
|
-
* so a person who follows a link sees what it points at. The tool with that `param` opens.
|
|
11
|
-
*/
|
|
12
|
-
const viteHubPageToolsLinkParams = ["comment"];
|
|
13
|
-
/**
|
|
14
|
-
* The cookie that remembers the session route's answer for this browser: `1` when a tool allows the person, `0` when
|
|
15
|
-
* none does or the person turned the tools off. It is a hint, never a credential, and it is not HttpOnly, because the
|
|
16
|
-
* page's bootstrap script reads it.
|
|
17
|
-
*/
|
|
18
|
-
const viteHubPageToolsCookie = "vitehub-tools";
|
|
19
|
-
/**
|
|
20
|
-
* The cookie that tells page scripts that an app Auth session exists. `@vite-hub/auth` sets it to `1` next to the
|
|
21
|
-
* session cookie and clears it on sign-out. It is not HttpOnly and holds no secret.
|
|
22
|
-
*/
|
|
23
|
-
const viteHubSessionMarkerCookie = "vitehub_session";
|
|
24
|
-
const hintMaxAge = 2592e3;
|
|
25
|
-
/** The `Set-Cookie` value that stores the session route's answer for 30 days. */
|
|
26
|
-
function viteHubPageToolsHintCookie(allowed) {
|
|
27
|
-
return `${viteHubPageToolsCookie}=${allowed ? 1 : 0}; Path=/; Max-Age=${hintMaxAge}; SameSite=Lax`;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The `Set-Cookie` value that forgets the session route's answer. Auth sends it when a session starts or ends, so the
|
|
31
|
-
* next page asks the session route again for the new person.
|
|
32
|
-
*/
|
|
33
|
-
const viteHubPageToolsResetCookie = `${viteHubPageToolsCookie}=; Path=/; Max-Age=0; SameSite=Lax`;
|
|
34
|
-
/**
|
|
35
|
-
* Whether a page loads the page tools loader, from its query string and its `Cookie` header or `document.cookie`:
|
|
36
|
-
* - the `?vitehub` query, or
|
|
37
|
-
* - `vitehub-tools=1`, the session route allowed this person, or
|
|
38
|
-
* - `vitehub_session=1` without any `vitehub-tools` cookie: a person signed in and the session route has not answered
|
|
39
|
-
* for this session yet.
|
|
40
|
-
*
|
|
41
|
-
* `vitehub-tools=0` stops the last case, so a signed-in person without access causes one session request per session.
|
|
42
|
-
*/
|
|
43
|
-
function viteHubPageToolsWanted(search, cookie) {
|
|
44
|
-
const query = new URLSearchParams(search);
|
|
45
|
-
if (query.has("vitehub") || viteHubPageToolsLinkParams.some((param) => query.has(param))) return true;
|
|
46
|
-
const parts = cookie.split(";").map((part) => part.trim());
|
|
47
|
-
if (parts.includes(`vitehub-tools=1`)) return true;
|
|
48
|
-
return parts.includes(`vitehub_session=1`) && !parts.some((part) => part.startsWith(`vitehub-tools=`));
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* The URL prefix of the built page tools scripts, such as the loader. It is not `/_vitehub/page`: Nitro answers 404 for
|
|
52
|
-
* any path under a public asset prefix that has no file, and gives the whole prefix the asset cache headers.
|
|
53
|
-
*/
|
|
54
|
-
const viteHubPageToolsAssets = "/_vitehub/page/assets";
|
|
55
|
-
/**
|
|
56
|
-
* The route of the visitor check. It is public, and each tool checks the visitor itself. Its path has no auth word,
|
|
57
|
-
* such as `session`, because Vite Doctor takes a handler on such a path for an auth route without a guard.
|
|
58
|
-
*/
|
|
59
|
-
const viteHubPageSessionPath = "/_vitehub/page/tools";
|
|
60
|
-
/**
|
|
61
|
-
* The URL of the loader script, below the app base. Its version query changes when the loader changes, so caches keep
|
|
62
|
-
* it 5 minutes.
|
|
63
|
-
*/
|
|
64
|
-
const viteHubPageToolsLoader = "/_vitehub/page/assets/loader.js?v=22";
|
|
65
|
-
/** The attribute of the script that loads the page tools. A page that has it does not get a second one. */
|
|
66
|
-
const viteHubPageToolsMarker = "data-vitehub-page-tools";
|
|
67
|
-
/** The bootstrap's opening tag, so the server can recognize the generated bootstrap when it replaces it. */
|
|
68
|
-
const viteHubPageToolsInlineStart = `<script type="module" ${viteHubPageToolsMarker}>`;
|
|
69
|
-
/**
|
|
70
|
-
* The exact page tools bootstrap: an inline module script that imports `<base>/_vitehub/page/assets/loader.js` only
|
|
71
|
-
* when `viteHubPageToolsWanted()` is true in the browser. Without the hint it makes no request. Vite adds it to a
|
|
72
|
-
* single page app's `index.html`, and the server adds it to every rendered and prerendered page, so static hosts serve
|
|
73
|
-
* it too. A `nonce` goes on the tag for a Content Security Policy with nonces.
|
|
74
|
-
*/
|
|
75
|
-
function viteHubPageToolsInlineScript(base, nonce) {
|
|
76
|
-
const tools = JSON.stringify(`${viteHubPageToolsCookie}=`);
|
|
77
|
-
const hint = `${JSON.stringify([viteHubPageToolsQuery, ...viteHubPageToolsLinkParams])}.some(p=>new URLSearchParams(location.search).has(p))||c.includes(${JSON.stringify(`${viteHubPageToolsCookie}=1`)})||c.includes(${JSON.stringify(`${viteHubSessionMarkerCookie}=1`)})&&!c.some(p=>p.startsWith(${tools}))`;
|
|
78
|
-
return `${nonce ? `<script type="module" nonce="${nonce}" ${viteHubPageToolsMarker}>` : viteHubPageToolsInlineStart}const c=document.cookie.split("; ");if(${hint})import(${JSON.stringify(`${viteHubBasePath(base)}${viteHubPageToolsLoader}`)})<\/script>`;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* The path of an app base, without the trailing slash: `/portal/` and `https://cdn.example/portal/` give `/portal`.
|
|
82
|
-
* The root and relative bases (`""`, `"./"`) give `""`. The Console mounts its routes with the same rule.
|
|
83
|
-
*/
|
|
84
|
-
function viteHubBasePath(base) {
|
|
85
|
-
if (!base || base === "./") return "";
|
|
86
|
-
let pathname = base;
|
|
87
|
-
if (/^https?:\/\//.test(pathname)) try {
|
|
88
|
-
pathname = new URL(pathname).pathname;
|
|
89
|
-
} catch {
|
|
90
|
-
return "";
|
|
91
|
-
}
|
|
92
|
-
if (!pathname.startsWith("/") || pathname.startsWith("//")) return "";
|
|
93
|
-
return pathname.replace(/\/+$/, "");
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Adds the app base to a path, such as the `script` of a tool. Full URLs and protocol-relative URLs stay as they are.
|
|
97
|
-
*/
|
|
98
|
-
function withViteHubBase(base, path) {
|
|
99
|
-
return path.startsWith("/") && !path.startsWith("//") ? `${base}${path}` : path;
|
|
100
|
-
}
|
|
101
|
-
function text(value) {
|
|
102
|
-
return typeof value === "string" && value ? value : void 0;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* An account from untrusted input, or `undefined` when it has no name or its `signOut` is not a path of this origin. The
|
|
106
|
-
* browser posts to `signOut` with the session cookie, so it never goes to another site.
|
|
107
|
-
*/
|
|
108
|
-
function readViteHubPageAccount(value) {
|
|
109
|
-
if (value === null || typeof value !== "object") return void 0;
|
|
110
|
-
const name = text(Reflect.get(value, "name"));
|
|
111
|
-
const signOut = text(Reflect.get(value, "signOut"));
|
|
112
|
-
if (!name || !signOut?.startsWith("/") || signOut.startsWith("//") || signOut.includes("\\")) return void 0;
|
|
113
|
-
const account = {
|
|
114
|
-
name,
|
|
115
|
-
signOut
|
|
116
|
-
};
|
|
117
|
-
const email = text(Reflect.get(value, "email"));
|
|
118
|
-
if (email) account.email = email;
|
|
119
|
-
const image = text(Reflect.get(value, "image"));
|
|
120
|
-
if (image && /^https?:\/\//i.test(image)) account.image = image;
|
|
121
|
-
if (Reflect.get(value, "via") === "console") account.via = "console";
|
|
122
|
-
return account;
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
125
|
-
export { viteHubPageToolsHintCookie as a, viteHubPageToolsLoader as c, viteHubPageToolsResetCookie as d, viteHubPageToolsWanted as f, viteHubPageToolsAssets as i, viteHubPageToolsMarker as l, withViteHubBase as m, viteHubBasePath as n, viteHubPageToolsInlineScript as o, viteHubSessionMarkerCookie as p, viteHubPageSessionPath as r, viteHubPageToolsInlineStart as s, readViteHubPageAccount as t, viteHubPageToolsQuery as u };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
//#region src/console/runtime/server/runtime.d.ts
|
|
2
|
-
/** The generated plugin calls this at startup. `load` imports the runtime and returns its synchronous installer. */
|
|
3
|
-
declare function installConsoleRuntime(load: () => Promise<() => void>): void;
|
|
4
|
-
/** Load the Console runtime once. Without an installed runtime, there is nothing to load. */
|
|
5
|
-
declare function loadConsoleRuntime(): Promise<void>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { loadConsoleRuntime as n, installConsoleRuntime as t };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as findCalls, c as maskLiterals, d as objectProperties, f as scanModule, g as unwrapExpression, h as templateExpressionSources, i as exportNames, l as moduleTokens, m as staticValue, n as defaultExportExpression, o as findDefaultExportCall, p as staticString, r as dynamic, s as findProperty, t as argumentExpression, u as nodeText, v as walk } from "./scan-module-Df58L_6T.js";
|
|
2
|
-
export { argumentExpression, defaultExportExpression, dynamic, exportNames, findCalls, findDefaultExportCall, findProperty, maskLiterals, moduleTokens, nodeText, objectProperties, scanModule, staticString, staticValue, templateExpressionSources, unwrapExpression, walk };
|
package/dist/secret-DELGKpCJ.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { t as internalErrorDiagnostics } from "./error-diagnostics-C0KyI408.js";
|
|
2
|
-
//#region ../internal/src/secret.ts
|
|
3
|
-
const secretEncoder = new TextEncoder();
|
|
4
|
-
/**
|
|
5
|
-
* Compares a request value with an expected secret in constant time for the length of `expected`. Returns `false`
|
|
6
|
-
* when either value is missing or empty. It uses no Node API, so it also runs in Worker runtimes.
|
|
7
|
-
*/
|
|
8
|
-
function isViteHubSecretEqual(actual, expected) {
|
|
9
|
-
if (!actual || !expected) return false;
|
|
10
|
-
const left = secretEncoder.encode(actual);
|
|
11
|
-
const right = secretEncoder.encode(expected);
|
|
12
|
-
let difference = left.length ^ right.length;
|
|
13
|
-
for (let index = 0; index < right.length; index += 1) difference |= (left[index] ?? 0) ^ right[index];
|
|
14
|
-
return difference === 0;
|
|
15
|
-
}
|
|
16
|
-
/** HKDF salt for every ViteHub-derived secret. A different salt than Nuxt's keeps both derivations apart for one shared root. */
|
|
17
|
-
const viteHubSecretSalt = "vitehub";
|
|
18
|
-
function hex(buffer) {
|
|
19
|
-
return [...new Uint8Array(buffer)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
20
|
-
}
|
|
21
|
-
/** Reads the root app secret, `VITEHUB_SECRET`, from an env record. Returns `undefined` when it is not a non-empty string. */
|
|
22
|
-
function readViteHubSecret(env) {
|
|
23
|
-
const value = env.VITEHUB_SECRET;
|
|
24
|
-
return typeof value === "string" && value ? value : void 0;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Derives a 32-byte secret for one purpose from the root secret, hex-encoded. It uses HKDF-SHA256 with the salt
|
|
28
|
-
* `vitehub` and the purpose as `info`. The result is stable while the root is unchanged and distinct for every purpose.
|
|
29
|
-
* Throws a coded error when the root is shorter than 32 characters or the purpose is empty. It uses no Node API.
|
|
30
|
-
*/
|
|
31
|
-
async function deriveViteHubSecret(root, purpose) {
|
|
32
|
-
if (root.length < 32) throw internalErrorDiagnostics.INTERNAL_SECRET_TOO_SHORT({ minimum: 32 });
|
|
33
|
-
if (!purpose) throw internalErrorDiagnostics.INTERNAL_SECRET_PURPOSE_MISSING();
|
|
34
|
-
const key = await globalThis.crypto.subtle.importKey("raw", secretEncoder.encode(root), "HKDF", false, ["deriveBits"]);
|
|
35
|
-
return hex(await globalThis.crypto.subtle.deriveBits({
|
|
36
|
-
hash: "SHA-256",
|
|
37
|
-
info: secretEncoder.encode(purpose),
|
|
38
|
-
name: "HKDF",
|
|
39
|
-
salt: secretEncoder.encode(viteHubSecretSalt)
|
|
40
|
-
}, key, 256));
|
|
41
|
-
}
|
|
42
|
-
Object.freeze({ prefix: "sha256=" });
|
|
43
|
-
//#endregion
|
|
44
|
-
export { isViteHubSecretEqual as n, readViteHubSecret as r, deriveViteHubSecret as t };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { t as ConsoleProjectBuild } from "./project-Dgyq1F1V.js";
|
|
2
|
-
import { a as ConsoleSectionId } from "./sections-Do7X4Nwt.js";
|
|
3
|
-
import "./access-policy-DhsEACna.js";
|
|
4
|
-
import "./setup-BC0P3eZy.js";
|
|
5
|
-
//#region src/console/runtime/server/sections.d.ts
|
|
6
|
-
declare function getConsoleSections(): readonly ConsoleSectionId[];
|
|
7
|
-
declare function getConsoleProjectName(): string | undefined;
|
|
8
|
-
declare function getConsoleBuild(): ConsoleProjectBuild | undefined;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { getConsoleProjectName as n, getConsoleSections as r, getConsoleBuild as t };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region src/console/runtime/site-access.ts
|
|
2
|
-
/**
|
|
3
|
-
* Site access: the browsers that the Console signed in to the app, so the page tools work there, and the guest invites
|
|
4
|
-
* that sign them in. The server answers these operations in `server/site-access.ts`; the Console section reads them.
|
|
5
|
-
*/
|
|
6
|
-
const siteAccessOperations = {
|
|
7
|
-
link: "site.link",
|
|
8
|
-
sessions: "site.sessions",
|
|
9
|
-
revokeSession: "site.revoke-session",
|
|
10
|
-
invite: "site.invite",
|
|
11
|
-
invites: "site.invites",
|
|
12
|
-
revokeInvite: "site.revoke-invite",
|
|
13
|
-
grants: "site.grants"
|
|
14
|
-
};
|
|
15
|
-
/** The cookie of `GET /_vitehub` that binds a Site access link to the browser that opened that route. */
|
|
16
|
-
const siteStateCookie = "__Host-vitehub-site-state";
|
|
17
|
-
//#endregion
|
|
18
|
-
export { siteStateCookie as n, siteAccessOperations as t };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as listSessions, c as revokeSession, i as listInvites, l as withPageTools, n as linkSite, o as openSiteSession, r as listGrants, s as revokeInvite, t as inviteGuest } from "./site-access-L1qbvKt6.js";
|
|
2
|
-
export { inviteGuest, linkSite, listGrants, listInvites, listSessions, openSiteSession, revokeInvite, revokeSession, withPageTools };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//#region src/console/runtime/site-access.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Site access: the browsers that the Console signed in to the app, so the page tools work there, and the guest invites
|
|
4
|
-
* that sign them in. The server answers these operations in `server/site-access.ts`; the Console section reads them.
|
|
5
|
-
*/
|
|
6
|
-
declare const siteAccessOperations: {
|
|
7
|
-
readonly link: "site.link";
|
|
8
|
-
readonly sessions: "site.sessions";
|
|
9
|
-
readonly revokeSession: "site.revoke-session";
|
|
10
|
-
readonly invite: "site.invite";
|
|
11
|
-
readonly invites: "site.invites";
|
|
12
|
-
readonly revokeInvite: "site.revoke-invite";
|
|
13
|
-
readonly grants: "site.grants";
|
|
14
|
-
};
|
|
15
|
-
/** The cookie of `GET /_vitehub` that binds a Site access link to the browser that opened that route. */
|
|
16
|
-
declare const siteStateCookie = "__Host-vitehub-site-state";
|
|
17
|
-
/** A browser signed in to the app through Site access: a Better Auth session of a Console member or a guest. */
|
|
18
|
-
interface SiteSession {
|
|
19
|
-
id: string;
|
|
20
|
-
kind: "member" | "guest";
|
|
21
|
-
person: {
|
|
22
|
-
id: string;
|
|
23
|
-
name: string;
|
|
24
|
-
email?: string;
|
|
25
|
-
image?: string;
|
|
26
|
-
};
|
|
27
|
-
/** The roles of the person that Site access knows, such as `comments-write`, and `console` for a member. */
|
|
28
|
-
grants: string[];
|
|
29
|
-
/** Such as `Chrome · macOS`. */
|
|
30
|
-
device: string;
|
|
31
|
-
createdAt: string;
|
|
32
|
-
lastSeenAt: string;
|
|
33
|
-
expiresAt: string;
|
|
34
|
-
}
|
|
35
|
-
/** A guest invite that nobody opened yet. */
|
|
36
|
-
interface SiteInvite {
|
|
37
|
-
id: string;
|
|
38
|
-
name: string;
|
|
39
|
-
grants: string[];
|
|
40
|
-
path: string;
|
|
41
|
-
expiresAt: string;
|
|
42
|
-
createdBy: {
|
|
43
|
-
id: string;
|
|
44
|
-
name: string;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/** A role that Site access may give, such as `comments-write`. `console` is for members only. */
|
|
48
|
-
interface SiteGrant {
|
|
49
|
-
id: string;
|
|
50
|
-
label: string;
|
|
51
|
-
description?: string;
|
|
52
|
-
membersOnly?: true;
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
export { siteStateCookie as a, siteAccessOperations as i, SiteInvite as n, SiteSession as r, SiteGrant as t };
|
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import { f as readConsoleAccessGrants, m as readConsoleOperationUser } from "./access-BC9HtX_M.js";
|
|
2
|
-
import { i as consoleRequestError } from "./request-CMA2UKKq.js";
|
|
3
|
-
import { d as viteHubPageToolsResetCookie, p as viteHubSessionMarkerCookie, u as viteHubPageToolsQuery } from "./page-tools-shared-aNC9YtoI.js";
|
|
4
|
-
import "./site-access-BycrwM2v.js";
|
|
5
|
-
import { a as viteHubPageGrants } from "./page-tools-ClgqElu-.js";
|
|
6
|
-
import { a as listConsoleSiteSessions, c as requireConsoleSiteKey, l as revokeConsoleSiteSession, o as openConsoleSiteSession, r as consoleSiteKV } from "./site-session-CRwgKtTF.js";
|
|
7
|
-
import { a as base64url, f as seeOther, i as authFailure, m as ticketProblem, n as appOrigin, o as consoleInvitePrefix, r as authConsole, s as consoleRecordStore, t as appBase, u as issueConsoleTicket } from "./tickets-DahBmKDT.js";
|
|
8
|
-
//#region src/console/runtime/server/site-access.ts
|
|
9
|
-
/**
|
|
10
|
-
* Site access: the Console signs browsers in to the app, so the page tools work there without a password.
|
|
11
|
-
*
|
|
12
|
-
* - A member of the Console team opens the site from the Console, or scans a QR code with a phone. `site.link` returns
|
|
13
|
-
* a one-time link, `GET /_vitehub/rpc?ticket=`. Its redemption signs the browser in as the app user with the email
|
|
14
|
-
* of the member, made if there is none, with the `console` role and the roles of every page tool.
|
|
15
|
-
* - A member invites a guest with `site.invite`: a name, roles such as `comments-write`, and an expiry. The link works
|
|
16
|
-
* once, in one browser, and signs it in as a new user with that name and the `guest` role. Guests never get the
|
|
17
|
-
* Console.
|
|
18
|
-
*
|
|
19
|
-
* With Auth, the users, their roles, and the sessions are Better Auth's: the roles go in `user.role` of the `admin()`
|
|
20
|
-
* plugin, and a browser is a Better Auth session, which ends as the app's session settings say. Revoking a guest's
|
|
21
|
-
* browser deletes the guest. Without Auth, the browser gets the sealed `vitehub_site` cookie with the person and the
|
|
22
|
-
* roles, and the app's KV store keeps its session (see `site-session.ts`).
|
|
23
|
-
*/
|
|
24
|
-
/** The role of a Console member: the **Console** link of the page tools pill. */
|
|
25
|
-
const consoleGrant = {
|
|
26
|
-
id: "console",
|
|
27
|
-
label: "Console",
|
|
28
|
-
description: "Open the app in the ViteHub Console. Members only."
|
|
29
|
-
};
|
|
30
|
-
const guestRole = "guest";
|
|
31
|
-
/** A QR code is scanned with another device, which takes longer than a click, so its link lasts 10 minutes. */
|
|
32
|
-
const qrLinkLifetime = 600;
|
|
33
|
-
function isRequestEvent(value) {
|
|
34
|
-
return value instanceof Object && "~standard" in value;
|
|
35
|
-
}
|
|
36
|
-
function contextRequest(context) {
|
|
37
|
-
if (!context.request) throw consoleRequestError(400, "Site access needs the request of the call.");
|
|
38
|
-
return context.request;
|
|
39
|
-
}
|
|
40
|
-
/** The Auth Console of a request, or undefined in an app without Auth, where Site access uses its own cookie. */
|
|
41
|
-
async function auth(request, event) {
|
|
42
|
-
return await authConsole(request, isRequestEvent(event) ? event : void 0);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Site access refuses a link that cannot sign a browser in. With Auth, it needs the database and the `user.role` field
|
|
46
|
-
* that the redemption uses. Without Auth, it needs the secret of its cookie and a shared store.
|
|
47
|
-
*/
|
|
48
|
-
async function assertSiteAccess(request, event) {
|
|
49
|
-
const api = await auth(request, event);
|
|
50
|
-
if (api) return await unwrap(api.checkHost());
|
|
51
|
-
await requireConsoleSiteKey();
|
|
52
|
-
await consoleSiteKV();
|
|
53
|
-
}
|
|
54
|
-
/** The answer of an Auth Console call, or its failure as a Console error. */
|
|
55
|
-
async function unwrap(call) {
|
|
56
|
-
const [error, value] = await call;
|
|
57
|
-
if (error) throw await authFailure(error);
|
|
58
|
-
return value;
|
|
59
|
-
}
|
|
60
|
-
function parse(value) {
|
|
61
|
-
try {
|
|
62
|
-
const parsed = JSON.parse(value);
|
|
63
|
-
return parsed instanceof Object ? parsed : void 0;
|
|
64
|
-
} catch {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/** The path of a ticket target below the app origin, or the app base. A full URL to another origin is refused. */
|
|
69
|
-
function targetPath(record) {
|
|
70
|
-
const home = `${record.origin}${record.base}/`;
|
|
71
|
-
const path = record.target.path;
|
|
72
|
-
if (!path) return home;
|
|
73
|
-
const url = new URL(path, home);
|
|
74
|
-
return url.origin === record.origin ? url.href : void 0;
|
|
75
|
-
}
|
|
76
|
-
/** The page with `?vitehub`, which opens the pill, before its hash. A page that already has the query keeps it. */
|
|
77
|
-
function withPageTools(page) {
|
|
78
|
-
const hash = page.indexOf("#");
|
|
79
|
-
const path = hash === -1 ? page : page.slice(0, hash);
|
|
80
|
-
const query = path.indexOf("?");
|
|
81
|
-
if (query !== -1 && new URLSearchParams(path.slice(query)).has("vitehub")) return page;
|
|
82
|
-
return `${path}${query === -1 ? "?" : "&"}${viteHubPageToolsQuery}${hash === -1 ? "" : page.slice(hash)}`;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Redeem a `page.member` or `page.guest` ticket: find or make the user, add the roles, start a Better Auth session for
|
|
86
|
-
* the browser, and go to the page with `?vitehub`, which opens the pill. The `vitehub_session` marker and the reset page
|
|
87
|
-
* tools hint make the next page ask the session route again, as after a sign-in.
|
|
88
|
-
*/
|
|
89
|
-
async function openSiteSession(record, request, event) {
|
|
90
|
-
const location = targetPath(record);
|
|
91
|
-
if (!location) return ticketProblem(401, "CONSOLE_TICKET_INVALID");
|
|
92
|
-
const bound = record.target.state;
|
|
93
|
-
if (bound && bound !== await stateHash(readCookie(request, "__Host-vitehub-site-state") ?? "")) return ticketProblem(403, "CONSOLE_TICKET_MISMATCH", "This link was made for another browser.", "Open /_vitehub of the app in this browser.");
|
|
94
|
-
const guest = record.purpose === "page.guest";
|
|
95
|
-
const name = guest ? record.target.name : record.person.name ?? record.person.email;
|
|
96
|
-
if (!name) return ticketProblem(401, "CONSOLE_TICKET_INVALID");
|
|
97
|
-
const grants = (record.target.grants ?? "").split(",").filter(Boolean);
|
|
98
|
-
const roles = guest ? [guestRole, ...grants] : [consoleGrant.id, ..."grants" in record.target ? grants : viteHubPageGrants().map((grant) => grant.id)];
|
|
99
|
-
const api = await auth(request, event);
|
|
100
|
-
const headers = new Headers();
|
|
101
|
-
if (api) {
|
|
102
|
-
const user = await unwrap(api.hostUser(guest ? {
|
|
103
|
-
name,
|
|
104
|
-
roles
|
|
105
|
-
} : {
|
|
106
|
-
email: record.person.email,
|
|
107
|
-
name,
|
|
108
|
-
...record.person.image ? { image: record.person.image } : {},
|
|
109
|
-
roles,
|
|
110
|
-
owned: viteHubPageGrants().map((grant) => grant.id)
|
|
111
|
-
}));
|
|
112
|
-
for (const cookie of (await unwrap(api.hostSession(user.id, request))).getSetCookie()) headers.append("set-cookie", cookie);
|
|
113
|
-
} else {
|
|
114
|
-
const person = guest ? {
|
|
115
|
-
id: `site-guest:${record.target.invite ?? ""}`,
|
|
116
|
-
name
|
|
117
|
-
} : {
|
|
118
|
-
id: record.person.id,
|
|
119
|
-
name,
|
|
120
|
-
...record.person.email ? { email: record.person.email } : {},
|
|
121
|
-
...record.person.image ? { image: record.person.image } : {}
|
|
122
|
-
};
|
|
123
|
-
headers.append("set-cookie", await openConsoleSiteSession({
|
|
124
|
-
kind: guest ? "guest" : "member",
|
|
125
|
-
person,
|
|
126
|
-
roles,
|
|
127
|
-
userAgent: request.headers.get("user-agent") ?? "",
|
|
128
|
-
secure: record.origin.startsWith("https:")
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
const maxAge = /;\s*Max-Age=(\d+)/i.exec(headers.get("set-cookie") ?? "")?.[1];
|
|
132
|
-
headers.append("set-cookie", `${viteHubSessionMarkerCookie}=1; Path=/; SameSite=Lax${maxAge ? `; Max-Age=${maxAge}` : ""}`);
|
|
133
|
-
headers.append("set-cookie", viteHubPageToolsResetCookie);
|
|
134
|
-
return seeOther(withPageTools(location), headers);
|
|
135
|
-
}
|
|
136
|
-
/** A page path of the app, such as `/runs/42`. */
|
|
137
|
-
function pagePath(path) {
|
|
138
|
-
if (!path) return "/";
|
|
139
|
-
if (!path.startsWith("/") || path.startsWith("//")) throw consoleRequestError(400, "Use a path of the app, such as /runs/42.");
|
|
140
|
-
return path;
|
|
141
|
-
}
|
|
142
|
-
function readCookie(request, name) {
|
|
143
|
-
for (const part of (request.headers.get("cookie") ?? "").split(";")) {
|
|
144
|
-
const [key, ...value] = part.trim().split("=");
|
|
145
|
-
if (key === name) return value.join("=");
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
async function stateHash(state) {
|
|
149
|
-
return base64url(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(state))));
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* `site.link`: a one-time link that signs the browser that opens it in as you. With `qr`, it lasts 10 minutes. The roles
|
|
153
|
-
* are the `grants` that `console.authorize` returned for this call, or every page tool role. With `state`, from
|
|
154
|
-
* `GET /_vitehub`, it works only in the browser that has that state cookie.
|
|
155
|
-
*/
|
|
156
|
-
async function linkSite(context, input) {
|
|
157
|
-
await assertSiteAccess(contextRequest(context), context.event);
|
|
158
|
-
const grants = readConsoleAccessGrants(context.access);
|
|
159
|
-
if (grants) {
|
|
160
|
-
const known = new Set(viteHubPageGrants().map((grant) => grant.id));
|
|
161
|
-
const unknown = grants.filter((grant) => !known.has(grant));
|
|
162
|
-
if (unknown.length) throw consoleRequestError(500, `console.authorize returned grants that no page tool of this app gives: ${unknown.join(", ")}. Read the roles with site.grants.`);
|
|
163
|
-
}
|
|
164
|
-
const target = {
|
|
165
|
-
path: pagePath(input.path).slice(1),
|
|
166
|
-
...grants ? { grants: grants.join(",") } : {},
|
|
167
|
-
...input.state ? { state: await stateHash(input.state) } : {}
|
|
168
|
-
};
|
|
169
|
-
return await issueConsoleTicket(context, "page.member", target, input.qr ? { lifetime: qrLinkLifetime } : {});
|
|
170
|
-
}
|
|
171
|
-
function readGrants(grants) {
|
|
172
|
-
const known = new Set(viteHubPageGrants().map((grant) => grant.id));
|
|
173
|
-
const unique = [...new Set(grants)];
|
|
174
|
-
if (unique.includes(consoleGrant.id)) throw consoleRequestError(400, "Guests never get the Console. Invite them with the roles of the page tools, such as comments-write.");
|
|
175
|
-
const unknown = unique.filter((grant) => !known.has(grant));
|
|
176
|
-
if (unknown.length) throw consoleRequestError(400, `The page tools of this app give no role ${unknown.join(", ")}. Read the roles with site.grants.`);
|
|
177
|
-
if (!unique.length) throw consoleRequestError(400, "Pick at least one role.");
|
|
178
|
-
return unique;
|
|
179
|
-
}
|
|
180
|
-
/** `site.invite`: a guest invite with a name and roles. The link works once, in one browser. */
|
|
181
|
-
async function inviteGuest(context, input) {
|
|
182
|
-
const name = input.name.trim();
|
|
183
|
-
if (!name) throw consoleRequestError(400, "Give the guest a name. It is the author of their comments.");
|
|
184
|
-
const grants = readGrants(input.grants);
|
|
185
|
-
await assertSiteAccess(contextRequest(context), context.event);
|
|
186
|
-
const days = input.expiresInDays ?? 7;
|
|
187
|
-
const path = pagePath(input.path);
|
|
188
|
-
const id = base64url(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(12)));
|
|
189
|
-
const ticket = await issueConsoleTicket(context, "page.guest", {
|
|
190
|
-
invite: id,
|
|
191
|
-
name,
|
|
192
|
-
grants: grants.join(","),
|
|
193
|
-
path: path.slice(1)
|
|
194
|
-
}, { lifetime: days * 24 * 60 * 60 });
|
|
195
|
-
const user = await readConsoleOperationUser(context.access);
|
|
196
|
-
const by = user ? String(Reflect.get(user, "name") ?? Reflect.get(user, "email") ?? user.id) : "Console member";
|
|
197
|
-
return {
|
|
198
|
-
...ticket,
|
|
199
|
-
invite: {
|
|
200
|
-
id,
|
|
201
|
-
name,
|
|
202
|
-
grants,
|
|
203
|
-
path,
|
|
204
|
-
expiresAt: ticket.expiresAt,
|
|
205
|
-
createdBy: {
|
|
206
|
-
id: user?.id ?? "",
|
|
207
|
-
name: by
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
/** `site.invites`: the guest invites that nobody opened yet, newest first. */
|
|
213
|
-
async function listInvites(context) {
|
|
214
|
-
const request = contextRequest(context);
|
|
215
|
-
const rows = await (await consoleRecordStore(request, isRequestEvent(context.event) ? context.event : void 0)).list(consoleInvitePrefix);
|
|
216
|
-
const origin = appOrigin(request);
|
|
217
|
-
const base = appBase(request);
|
|
218
|
-
return { invites: rows.flatMap(({ value, expiresAt }) => {
|
|
219
|
-
const record = parse(value);
|
|
220
|
-
if (!record || record.purpose !== "page.guest" || record.origin !== origin || record.base !== base) return [];
|
|
221
|
-
return [{
|
|
222
|
-
id: record.target.invite ?? "",
|
|
223
|
-
name: record.target.name ?? "",
|
|
224
|
-
grants: (record.target.grants ?? "").split(",").filter(Boolean),
|
|
225
|
-
path: `/${record.target.path ?? ""}`,
|
|
226
|
-
expiresAt: expiresAt.toISOString(),
|
|
227
|
-
createdBy: {
|
|
228
|
-
id: record.person.id,
|
|
229
|
-
name: record.person.name ?? record.person.email ?? "Console member"
|
|
230
|
-
}
|
|
231
|
-
}];
|
|
232
|
-
}).sort((a, b) => b.expiresAt.localeCompare(a.expiresAt)) };
|
|
233
|
-
}
|
|
234
|
-
/** `site.revoke-invite`: the link of the invite stops working. */
|
|
235
|
-
async function revokeInvite(context, id) {
|
|
236
|
-
const records = await consoleRecordStore(contextRequest(context), isRequestEvent(context.event) ? context.event : void 0);
|
|
237
|
-
const row = (await records.list(consoleInvitePrefix)).find(({ value }) => parse(value)?.target.invite === id);
|
|
238
|
-
if (!row) throw consoleRequestError(404, "No open invite has this id. It was opened, revoked, or it expired.");
|
|
239
|
-
await records.remove(row.identifier);
|
|
240
|
-
return { revoked: true };
|
|
241
|
-
}
|
|
242
|
-
/** `site.sessions`: the browsers of Console members and guests, most recently used first. */
|
|
243
|
-
async function listSessions(context) {
|
|
244
|
-
const api = await auth(contextRequest(context), context.event);
|
|
245
|
-
const known = /* @__PURE__ */ new Set([consoleGrant.id, ...viteHubPageGrants().map((grant) => grant.id)]);
|
|
246
|
-
if (!api) return { sessions: await listConsoleSiteSessions(known) };
|
|
247
|
-
return { sessions: (await unwrap(api.hostSessions([consoleGrant.id, guestRole]))).map(({ id, user, roles, guest, device, createdAt, updatedAt, expiresAt }) => {
|
|
248
|
-
return {
|
|
249
|
-
id,
|
|
250
|
-
kind: guest ? "guest" : "member",
|
|
251
|
-
person: {
|
|
252
|
-
id: user.id,
|
|
253
|
-
name: user.name,
|
|
254
|
-
...guest ? {} : { email: user.email },
|
|
255
|
-
...user.image ? { image: user.image } : {}
|
|
256
|
-
},
|
|
257
|
-
grants: roles.filter((role) => known.has(role)),
|
|
258
|
-
device,
|
|
259
|
-
createdAt,
|
|
260
|
-
lastSeenAt: updatedAt,
|
|
261
|
-
expiresAt
|
|
262
|
-
};
|
|
263
|
-
}) };
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* `site.revoke-session`: the browser is signed out. A guest has one browser, so revoking it deletes the guest too. In an
|
|
267
|
-
* app without Auth, a guest is only that browser.
|
|
268
|
-
*/
|
|
269
|
-
async function revokeSession(context, id) {
|
|
270
|
-
const api = await auth(contextRequest(context), context.event);
|
|
271
|
-
if (!api) {
|
|
272
|
-
const revoked = await revokeConsoleSiteSession(id);
|
|
273
|
-
if (!revoked) throw consoleRequestError(404, "No browser has this session. It was revoked, or it expired.");
|
|
274
|
-
return {
|
|
275
|
-
revoked: true,
|
|
276
|
-
removedUser: revoked.guest
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
const { removedUser } = await unwrap(api.revokeHostSession(id));
|
|
280
|
-
return {
|
|
281
|
-
revoked: true,
|
|
282
|
-
removedUser
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
/** `site.grants`: the roles that Site access gives. `console` is for members only. */
|
|
286
|
-
function listGrants() {
|
|
287
|
-
return { grants: [{
|
|
288
|
-
...consoleGrant,
|
|
289
|
-
membersOnly: true
|
|
290
|
-
}, ...viteHubPageGrants()] };
|
|
291
|
-
}
|
|
292
|
-
//#endregion
|
|
293
|
-
export { listSessions as a, revokeSession as c, listInvites as i, withPageTools as l, linkSite as n, openSiteSession as o, listGrants as r, revokeInvite as s, inviteGuest as t };
|