@cardstack/boxel-cli 0.13.0-unstable.4 → 0.13.0-unstable.6
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/bundled-realms/pretui/components/doc-report.gts +2 -2
- package/bundled-realms/pretui/components/doc-report.usage.gts +3 -3
- package/bundled-realms/pretui/components/form-field.md +1 -1
- package/bundled-realms/pretui/components/icon-button.md +1 -1
- package/bundled-realms/pretui/components/popup.md +1 -1
- package/bundled-realms/pretui/components/switch.gts +13 -0
- package/bundled-realms/pretui/components/switch.md +5 -3
- package/bundled-realms/pretui/components/theme-frame.gts +49 -22
- package/bundled-realms/pretui/components/tooltip.gts +141 -42
- package/bundled-realms/pretui/components/tooltip.md +10 -12
- package/bundled-realms/pretui/components/tooltip.usage.gts +3 -5
- package/bundled-realms/pretui/docs/structure.md +1 -1
- package/bundled-realms/pretui/internal/overlay.gts +4 -2
- package/bundled-realms/pretui/pretui-css.gts +6 -2
- package/bundled-realms/pretui/theme-scoped-css.gts +262 -0
- package/bundled-test-harness/assets/account-switch-failed-test-DwAZq6Sc.js +45 -0
- package/bundled-test-harness/assets/adapter-C_6pnsx1.js +2 -0
- package/bundled-test-harness/assets/add-field-to-card-definition-tool-test-zMYtJWBv.js +112 -0
- package/bundled-test-harness/assets/ai-assistant-create-workspace-test-CwhAV-Ow.js +130 -0
- package/bundled-test-harness/assets/ai-assistant-panel-relogin-test-DNgclkGJ.js +46 -0
- package/bundled-test-harness/assets/ai-assistant-test-DGYFiRTb.js +2223 -0
- package/bundled-test-harness/assets/ai-function-generation-test-Dj6WzKkh.js +1176 -0
- package/bundled-test-harness/assets/ai-module-creation-test-C4zhhxaZ.js +151 -0
- package/bundled-test-harness/assets/aibot-message-BShcljQ9.js +1312 -0
- package/bundled-test-harness/assets/app-DiEYqT6T.js +14146 -0
- package/bundled-test-harness/assets/apply-markdown-edit-test-CPhfeg1i.js +230 -0
- package/bundled-test-harness/assets/ask-user-picker-NVRkhKwt.js +370 -0
- package/bundled-test-harness/assets/ask-user-picker-test-SsZqFm9W.js +39 -0
- package/bundled-test-harness/assets/assistant-transcript-test-DesuBCIB.js +57 -0
- package/bundled-test-harness/assets/audio-metadata-extractor-test-8JM6oZXG.js +1176 -0
- package/bundled-test-harness/assets/authed-fetch-test-yPTMe-9V.js +73 -0
- package/bundled-test-harness/assets/avif-image-def-test-Kyknj908.js +187 -0
- package/bundled-test-harness/assets/basic-test-D9OrrMaq.js +139 -0
- package/bundled-test-harness/assets/binary-upload-dedupe-test-C0RFmHma.js +308 -0
- package/bundled-test-harness/assets/bot-registration-test-Bk2lTaCW.js +97 -0
- package/bundled-test-harness/assets/box-test-BbV9sMyU.js +50 -0
- package/bundled-test-harness/assets/brand-guide-attachments-test-z4wTsKbI.js +84 -0
- package/bundled-test-harness/assets/brand-guide-custom-css-test-BlSJE8xo.js +196 -0
- package/bundled-test-harness/assets/brand-guide-edit-test-DJ1OQ6IB.js +140 -0
- package/bundled-test-harness/assets/brand-logo-mark-field-test-ux7eetkO.js +86 -0
- package/bundled-test-harness/assets/broken-link-template-test-CqB3MWyw.js +192 -0
- package/bundled-test-harness/assets/bundled-base-modules-test-B2oNLZSJ.js +54 -0
- package/bundled-test-harness/assets/bundled-base-oracle-test-DelPfFjn.js +37 -0
- package/bundled-test-harness/assets/buried-stack-item-scroll-test-Ixsl1tS0.js +236 -0
- package/bundled-test-harness/assets/button-BvYQm_A1.js +141 -0
- package/bundled-test-harness/assets/bxl-cyclic-graph-test-p23WCLRW.js +47 -0
- package/bundled-test-harness/assets/bxl-expression-test-CVTQYT_C.js +250 -0
- package/bundled-test-harness/assets/bxl-indexing-test-D_A7X2sr.js +212 -0
- package/bundled-test-harness/assets/bxl-platform-module-test-Cltfyybp.js +71 -0
- package/bundled-test-harness/assets/can-invoke-test-CVfE1l1V.js +455 -0
- package/bundled-test-harness/assets/can-read-realm-test-CIz6WX_K.js +56 -0
- package/bundled-test-harness/assets/cancel-indexing-job-test-0LlrOgYK.js +69 -0
- package/bundled-test-harness/assets/capture-test-diHIWmh0.js +360 -0
- package/bundled-test-harness/assets/card-api-test-Ci9b0ghP.js +198 -0
- package/bundled-test-harness/assets/card-basics-test-RKQoQWZD.js +5364 -0
- package/bundled-test-harness/assets/card-chooser-paging-test-BN21sDpP.js +235 -0
- package/bundled-test-harness/assets/card-chooser-test-C9jDiIgM.js +393 -0
- package/bundled-test-harness/assets/card-context-search-results-KmkXJbmC.js +30 -0
- package/bundled-test-harness/assets/card-context-search-results-test-CpMr8OlX.js +184 -0
- package/bundled-test-harness/assets/card-def-field-def-relationships-test-D_30xak6.js +562 -0
- package/bundled-test-harness/assets/card-def-menu-items-test-ohuHc0b4.js +228 -0
- package/bundled-test-harness/assets/card-delete-test-BlsD9Xw4.js +466 -0
- package/bundled-test-harness/assets/card-error-3q1o3i0e.js +72 -0
- package/bundled-test-harness/assets/card-error-awaiting-index-test-DPgYKfbF.js +53 -0
- package/bundled-test-harness/assets/card-info-thumbnail-picker-test-CVfeJyjt.js +219 -0
- package/bundled-test-harness/assets/card-playground-test-D-7bi4PQ.js +1491 -0
- package/bundled-test-harness/assets/card-prerender-DemTfK_a.js +12939 -0
- package/bundled-test-harness/assets/card-thunk-error-test-DCBh1vRT.js +48 -0
- package/bundled-test-harness/assets/card-type-service-test-DXPrfVYk.js +161 -0
- package/bundled-test-harness/assets/check-correctness-test-DjE7r1X2.js +1093 -0
- package/bundled-test-harness/assets/check-domain-availability-test-U10xSKbY.js +98 -0
- package/bundled-test-harness/assets/chip-0r_r9SC8.js +44 -0
- package/bundled-test-harness/assets/choreo-CZUXQKjf.js +1110 -0
- package/bundled-test-harness/assets/choreo-D8RcLuoq.js +2 -0
- package/bundled-test-harness/assets/choreo-feature-reel-test-DRGloCAJ.js +155 -0
- package/bundled-test-harness/assets/choreo-gallery-build-order-test-BR-r7gaw.js +436 -0
- package/bundled-test-harness/assets/choreo-gallery-compositor-test-CWRLfcNT.js +399 -0
- package/bundled-test-harness/assets/choreo-gallery-cover-test-BT05gNKC.js +214 -0
- package/bundled-test-harness/assets/choreo-gallery-crossing-stage-test-WJ7FmjYi.js +133 -0
- package/bundled-test-harness/assets/choreo-gallery-demos-alive-test-C-yxdVT_.js +42 -0
- package/bundled-test-harness/assets/choreo-gallery-drift-test-HX1mK3od.js +620 -0
- package/bundled-test-harness/assets/choreo-gallery-escort-test-jZEVk_V4.js +187 -0
- package/bundled-test-harness/assets/choreo-gallery-films-test-DLDQzsxb.js +140 -0
- package/bundled-test-harness/assets/choreo-gallery-filter-test-BJv8KEeP.js +46 -0
- package/bundled-test-harness/assets/choreo-gallery-fold-test-BssKC8A8.js +180 -0
- package/bundled-test-harness/assets/choreo-gallery-guide-pages-test-DS41eNNV.js +114 -0
- package/bundled-test-harness/assets/choreo-gallery-guides-test-DTj7yEKp.js +321 -0
- package/bundled-test-harness/assets/choreo-gallery-hang-test-BqJLmeFF.js +426 -0
- package/bundled-test-harness/assets/choreo-gallery-highlight-test-B1Q7-ICm.js +60 -0
- package/bundled-test-harness/assets/choreo-gallery-inline-edit-test-7My9lVam.js +370 -0
- package/bundled-test-harness/assets/choreo-gallery-interruption-test-BlIAaGrw.js +176 -0
- package/bundled-test-harness/assets/choreo-gallery-lone-stack-test-C9NnYIP8.js +104 -0
- package/bundled-test-harness/assets/choreo-gallery-navigation-test-CWzXkvbW.js +193 -0
- package/bundled-test-harness/assets/choreo-gallery-playhead-transport-test-CwdiZWeI.js +111 -0
- package/bundled-test-harness/assets/choreo-gallery-poplayout-subtree-test-D55fxwTn.js +127 -0
- package/bundled-test-harness/assets/choreo-gallery-presence-modes-test-D8Wxv0lb.js +100 -0
- package/bundled-test-harness/assets/choreo-gallery-presentation-test-BLoWfp6G.js +157 -0
- package/bundled-test-harness/assets/choreo-gallery-reduced-motion-test-D5XxTBDS.js +145 -0
- package/bundled-test-harness/assets/choreo-gallery-sheet-standalone-test-DrHTTvss.js +89 -0
- package/bundled-test-harness/assets/choreo-gallery-sheet-test-BFVdnM_b.js +48 -0
- package/bundled-test-harness/assets/choreo-gallery-site-test-BhEBHdvI.js +237 -0
- package/bundled-test-harness/assets/choreo-gallery-stage-DcKKsdcu.js +256 -0
- package/bundled-test-harness/assets/choreo-gallery-stage-keyboard-test-Fcc6SC3F.js +102 -0
- package/bundled-test-harness/assets/choreo-gallery-stages-test-Cb-ADpxK.js +35 -0
- package/bundled-test-harness/assets/choreo-gallery-subdivision-test-DMJ6C9FW.js +138 -0
- package/bundled-test-harness/assets/choreo-gallery-table-plan-test-CAjSUdLJ.js +144 -0
- package/bundled-test-harness/assets/choreo-gallery-theater-test-B-3IZMj9.js +252 -0
- package/bundled-test-harness/assets/choreo-gallery-tuning-test-BVxK5Ry_.js +95 -0
- package/bundled-test-harness/assets/choreo-gallery-widget-room-test-uWBH1EKE.js +88 -0
- package/bundled-test-harness/assets/choreo-gallery-wires-test-Bo4Sd1Vn.js +148 -0
- package/bundled-test-harness/assets/client-telemetry-test-DFM4mML2.js +340 -0
- package/bundled-test-harness/assets/clip-DY6N6K67.js +92 -0
- package/bundled-test-harness/assets/clip-DzXoPdp-.js +2 -0
- package/bundled-test-harness/assets/code-block-DRE8KQZQ.js +502 -0
- package/bundled-test-harness/assets/code-ref-test-CDcqE8_C.js +163 -0
- package/bundled-test-harness/assets/code-submode-availability-test-DPTqZYYm.js +198 -0
- package/bundled-test-harness/assets/code-submode-test-AHV4mzJ4.js +1839 -0
- package/bundled-test-harness/assets/codeblocks-test-D6ijVvEL.js +418 -0
- package/bundled-test-harness/assets/codemirror-editor-test-BeAMVivu.js +1512 -0
- package/bundled-test-harness/assets/codemirror-embed-toolbar-test-Bnb7_KUT.js +366 -0
- package/bundled-test-harness/assets/color-field-test-CR6gGEqE.js +212 -0
- package/bundled-test-harness/assets/compaction-test-CjEsY0uG.js +150 -0
- package/bundled-test-harness/assets/computed-test-DtyZGgdc.js +1320 -0
- package/bundled-test-harness/assets/container-BYGZImLU.css +5101 -0
- package/bundled-test-harness/assets/container-CBZZ8uFw.js +10925 -0
- package/bundled-test-harness/assets/content-preview-components-test-BztI4fz-.js +462 -0
- package/bundled-test-harness/assets/copy-and-edit-test-Cqw7kcur.js +292 -0
- package/bundled-test-harness/assets/copy-card-test-D5m3eVEH.js +218 -0
- package/bundled-test-harness/assets/copy-file-to-realm-test-FPY-6Ddm.js +148 -0
- package/bundled-test-harness/assets/copy-source-test-9pJD-qey.js +56 -0
- package/bundled-test-harness/assets/create-file-test-DjMf88u_.js +1086 -0
- package/bundled-test-harness/assets/create-file-test-XbgOqg38.js +464 -0
- package/bundled-test-harness/assets/create-listing-modal-test-De7b4vu3.js +273 -0
- package/bundled-test-harness/assets/create-listing-pr-request-test-CBtIV0Z8.js +117 -0
- package/bundled-test-harness/assets/create-spec-test-4xR0gM7E.js +256 -0
- package/bundled-test-harness/assets/create-submission-workflow-test-DQpWrpGT.js +132 -0
- package/bundled-test-harness/assets/create-workspace-test-BQAudgpS.js +104 -0
- package/bundled-test-harness/assets/credential-fields-test-DXKBdbZD.js +200 -0
- package/bundled-test-harness/assets/csv-file-def-test-Cnp4y834.js +102 -0
- package/bundled-test-harness/assets/dashboard-CmuOhIYC.js +3628 -0
- package/bundled-test-harness/assets/dashboard-CzN49x74.css +2400 -0
- package/bundled-test-harness/assets/dashboard-add-workspace-test-T32hWB-g.js +50 -0
- package/bundled-test-harness/assets/dashboard-agents-test-BN5maCgQ.js +334 -0
- package/bundled-test-harness/assets/dashboard-archive-test-BzwUte_Z.js +128 -0
- package/bundled-test-harness/assets/dashboard-delete-test-D2Gcp81V.js +163 -0
- package/bundled-test-harness/assets/dashboard-duplicate-offer-test-BgKNIr35.js +71 -0
- package/bundled-test-harness/assets/dashboard-duplicate-test-D7JEWylc.js +222 -0
- package/bundled-test-harness/assets/dashboard-get-started-test-DOGPzGoA.js +374 -0
- package/bundled-test-harness/assets/dashboard-ir2bakJS.js +142 -0
- package/bundled-test-harness/assets/dashboard-pinned-cards-test-Bn_P9xJU.js +220 -0
- package/bundled-test-harness/assets/dashboard-publish-test-64sGQ0nG.js +70 -0
- package/bundled-test-harness/assets/dashboard-reindex-test-DJjYq1ct.js +115 -0
- package/bundled-test-harness/assets/dashboard-section-rail-test-ZkAhWu5V.js +169 -0
- package/bundled-test-harness/assets/dashboard-state-test-BbkpPB5L.js +162 -0
- package/bundled-test-harness/assets/dashboard-test-CBLdPrSt.js +545 -0
- package/bundled-test-harness/assets/dashboard-unreachable-notice-test-DFT3R1Zx.js +62 -0
- package/bundled-test-harness/assets/dashboard-workspace-test-DqBdCFo2.js +537 -0
- package/bundled-test-harness/assets/dashboard-workspaces-section-test-CH1HDfxR.js +410 -0
- package/bundled-test-harness/assets/data-file-def-preview-test-CNsZwQEJ.js +155 -0
- package/bundled-test-harness/assets/date-time-fields-test-CEFaZTnF.js +359 -0
- package/bundled-test-harness/assets/debug-message-test-Ck3BfFv3.js +117 -0
- package/bundled-test-harness/assets/declared-captures-test-C-0yPRU7.js +879 -0
- package/bundled-test-harness/assets/delete-workspace-test-CZOwGy78.js +102 -0
- package/bundled-test-harness/assets/diffing-test-BEKI905O.js +210 -0
- package/bundled-test-harness/assets/download-file-to-realm-test-C1kAGDll.js +119 -0
- package/bundled-test-harness/assets/editor-test-C9x5ZY6g.js +688 -0
- package/bundled-test-harness/assets/edits-D76-aanh.js +651 -0
- package/bundled-test-harness/assets/email-field-test-LGkrB_2B.js +75 -0
- package/bundled-test-harness/assets/enum-field-test-CPyV1J-m.js +935 -0
- package/bundled-test-harness/assets/error-display-test-bWuUtfIG.js +343 -0
- package/bundled-test-harness/assets/evaluate-module-test-CbS5h8t3.js +91 -0
- package/bundled-test-harness/assets/execute-atomic-operations-test-B4Kfco0k.js +113 -0
- package/bundled-test-harness/assets/externals-k-2ZBepK.js +4393 -0
- package/bundled-test-harness/assets/fallback-banner-live-delete-test-CuFiH1D8.js +207 -0
- package/bundled-test-harness/assets/fallback-banner-test-CqSRN7D8.js +225 -0
- package/bundled-test-harness/assets/fallback-banner-test-DQkrFE4-.js +53 -0
- package/bundled-test-harness/assets/fallback-models-test-BWekNxC0.js +161 -0
- package/bundled-test-harness/assets/fetch-card-json-test-DULUqUEu.js +61 -0
- package/bundled-test-harness/assets/field-configuration-test-BXZq28xa.js +551 -0
- package/bundled-test-harness/assets/field-markdown-domain-test-DdXCifs6.js +616 -0
- package/bundled-test-harness/assets/field-markdown-oversize-test-DouPPTHX.js +88 -0
- package/bundled-test-harness/assets/field-markdown-primitives-test-DSRGJeyl.js +365 -0
- package/bundled-test-harness/assets/field-markdown-specialized-test-DlTYLl_s.js +534 -0
- package/bundled-test-harness/assets/field-playground-test-NhS4VvoN.js +894 -0
- package/bundled-test-harness/assets/field-support-predicates-test-DWpyT1Qf.js +167 -0
- package/bundled-test-harness/assets/file-attachment-test-LwZf-BSY.js +796 -0
- package/bundled-test-harness/assets/file-chooser-panel-test-DuAqD9bn.js +153 -0
- package/bundled-test-harness/assets/file-chooser-test-CjaXXwpT.js +504 -0
- package/bundled-test-harness/assets/file-def-format-templates-test-BDs4OmHq.js +380 -0
- package/bundled-test-harness/assets/file-def-live-reload-test-BqTdnq-W.js +124 -0
- package/bundled-test-harness/assets/file-def-menu-items-test-DqdINXsD.js +138 -0
- package/bundled-test-harness/assets/file-def-navigation-test-BPGr0SQy.js +109 -0
- package/bundled-test-harness/assets/file-def-serialization-test-CvjW-FlC.js +89 -0
- package/bundled-test-harness/assets/file-def-test-C-Yv_NjS.js +216 -0
- package/bundled-test-harness/assets/file-preview-live-reload-test-MzwGwasU.js +310 -0
- package/bundled-test-harness/assets/file-resource-primitives-test-D3GmfqNs.js +255 -0
- package/bundled-test-harness/assets/file-tree-from-index-test-CfldnUgm.js +96 -0
- package/bundled-test-harness/assets/file-tree-test--0ZCPRe9.js +851 -0
- package/bundled-test-harness/assets/file-view-model-test-BDIAeBV8.js +346 -0
- package/bundled-test-harness/assets/filedef-export-shape-test-B2tgU404.js +61 -0
- package/bundled-test-harness/assets/film-Bf73ypzi.js +4074 -0
- package/bundled-test-harness/assets/film-C54lhaiU.js +2 -0
- package/bundled-test-harness/assets/film-DPcMEHYu.js +13 -0
- package/bundled-test-harness/assets/flac-audio-def-test-ByoXMoQ1.js +143 -0
- package/bundled-test-harness/assets/font-metadata-extractor-test-hawLTDTG.js +415 -0
- package/bundled-test-harness/assets/formatted-aibot-message-test-BahBj3x8.js +109 -0
- package/bundled-test-harness/assets/formatted-user-message-test-CodbrU3t.js +43 -0
- package/bundled-test-harness/assets/freestyle-test-faQhSciz.js +17 -0
- package/bundled-test-harness/assets/full-reindex-realm-test-CE5RJTIC.js +101 -0
- package/bundled-test-harness/assets/garbage-collection-test-v-3sev77.js +403 -0
- package/bundled-test-harness/assets/general-test-DKZPBtSb.js +923 -0
- package/bundled-test-harness/assets/generate-example-cards-one-shot-test-CucWyrkH.js +65 -0
- package/bundled-test-harness/assets/generic-file-def-preview-test-_EDRsebi.js +71 -0
- package/bundled-test-harness/assets/get-available-realm-identifiers-test-CV023yek.js +47 -0
- package/bundled-test-harness/assets/get-catalog-realm-identifiers-test--DOu3DyV.js +47 -0
- package/bundled-test-harness/assets/get-default-writable-realm-test-Bic8jl6R.js +54 -0
- package/bundled-test-harness/assets/get-published-realms-test-DrA5YcFN.js +71 -0
- package/bundled-test-harness/assets/get-realm-of-resource-identifier-test-jfU6SIWn.js +54 -0
- package/bundled-test-harness/assets/get-relationship-membership-state-test-Ccy2Z7MN.js +1308 -0
- package/bundled-test-harness/assets/get-user-system-card-test-Bmq2lmWv.js +67 -0
- package/bundled-test-harness/assets/gif-image-def-test-N1mMQC-X.js +188 -0
- package/bundled-test-harness/assets/glimmer-motion-and-choreo-in-cards-test-BkUDjiTs.js +160 -0
- package/bundled-test-harness/assets/glimmer-motion-and-choreo-test-DsFWCzTs.js +74 -0
- package/bundled-test-harness/assets/gts-file-def-test-BL1jpQ9J.js +100 -0
- package/bundled-test-harness/assets/head-format-preview-test-BVCaPQqc.js +158 -0
- package/bundled-test-harness/assets/helpers-Ds68JxHe.js +5 -0
- package/bundled-test-harness/assets/host-mode-service-B4bisRdR.js +262 -0
- package/bundled-test-harness/assets/host-mode-test-BmkN2PCJ.js +831 -0
- package/bundled-test-harness/assets/host-submode-test-C6SxQ796.js +1392 -0
- package/bundled-test-harness/assets/html-component-test-CNQ9wF0Q.js +65 -0
- package/bundled-test-harness/assets/html-def-test-BcaCVVQq.js +160 -0
- package/bundled-test-harness/assets/html-meta-extractor-test-BU1hjkTp.js +60 -0
- package/bundled-test-harness/assets/hydratable-card-test-CX6MWiti.js +426 -0
- package/bundled-test-harness/assets/icon-button-C1zH38Nc.js +67 -0
- package/bundled-test-harness/assets/image-metadata-extractor-test-CakSBPZ_.js +1109 -0
- package/bundled-test-harness/assets/index-changes-test-D8RtgfyG.js +367 -0
- package/bundled-test-harness/assets/index-query-engine-test-BETfoYOK.js +2593 -0
- package/bundled-test-harness/assets/index-writer-test-B_bR2fjw.js +3040 -0
- package/bundled-test-harness/assets/inspector-test-BwPXJj1S.js +2058 -0
- package/bundled-test-harness/assets/instance-filter-matcher-test-BSVCg59b.js +788 -0
- package/bundled-test-harness/assets/instantiate-card-test-BVQhZjpq.js +164 -0
- package/bundled-test-harness/assets/interact-submode-creation-and-permissions-test-DzQLG41H.js +475 -0
- package/bundled-test-harness/assets/interact-submode-setup-C5bKXq73.js +566 -0
- package/bundled-test-harness/assets/invalidate-realm-identifiers-test-Cd3dpjhB.js +99 -0
- package/bundled-test-harness/assets/invite-user-to-room-test-Brabz1tt.js +142 -0
- package/bundled-test-harness/assets/invoke-card-operation-test-C1Q1FUf4.js +333 -0
- package/bundled-test-harness/assets/isolated-render-test-BLJfS7BU.js +51 -0
- package/bundled-test-harness/assets/job-scoped-doc-cache-test-Bgv5woaB.js +181 -0
- package/bundled-test-harness/assets/job-scoped-instance-residency-test-C_bB6KpR.js +103 -0
- package/bundled-test-harness/assets/jpg-image-def-test-gdLIKocD.js +697 -0
- package/bundled-test-harness/assets/json-file-def-test-CPYMRBY-.js +95 -0
- package/bundled-test-harness/assets/key-notices-badge-test-DemslfLw.js +155 -0
- package/bundled-test-harness/assets/key-readiness-test-5tq5JycL.js +190 -0
- package/bundled-test-harness/assets/linksto-broken-link-placeholder-test-BbhDZ2PH.js +398 -0
- package/bundled-test-harness/assets/linksto-error-sentinel-test-C2t7fFPi.js +238 -0
- package/bundled-test-harness/assets/linksto-many-broken-link-placeholder-test--U_UvUty.js +354 -0
- package/bundled-test-harness/assets/linksto-many-per-slot-access-test-Dj3Xy0ZF.js +303 -0
- package/bundled-test-harness/assets/linksto-sentinel-reload-test-D0dK4Jjs.js +197 -0
- package/bundled-test-harness/assets/linksto-sentinel-roundtrip-test---IYiXok.js +260 -0
- package/bundled-test-harness/assets/linksto-singular-js-access-contract-test-CT04MhES.js +196 -0
- package/bundled-test-harness/assets/lint-and-fix-test-aadgx7rX.js +51 -0
- package/bundled-test-harness/assets/live-test-BGij_vuc.js +100 -0
- package/bundled-test-harness/assets/live-test-CppvValf.js +2 -0
- package/bundled-test-harness/assets/load-default-skills-test-Cp2m_ebp.js +74 -0
- package/bundled-test-harness/assets/loader-parallel-prefetch-test-vU_26Jqu.js +257 -0
- package/bundled-test-harness/assets/loader-test-CTaw8K_B.js +482 -0
- package/bundled-test-harness/assets/loading-test-DGGt4qZZ.js +63 -0
- package/bundled-test-harness/assets/m4a-audio-def-test-DAiReOXH.js +190 -0
- package/bundled-test-harness/assets/main-bXHwJ0CN.js +5 -0
- package/bundled-test-harness/assets/markdown-embed-chooser-modal-test-CIXq9FqR.js +470 -0
- package/bundled-test-harness/assets/markdown-embed-chooser-test-zFGh9WfP.js +334 -0
- package/bundled-test-harness/assets/markdown-embed-preview-pane-test-Byn_WFwY.js +447 -0
- package/bundled-test-harness/assets/markdown-embed-preview-test-Y3iFMttg.js +368 -0
- package/bundled-test-harness/assets/markdown-fallback-test-Br1TPkLZ.js +316 -0
- package/bundled-test-harness/assets/markdown-file-def-test-Crm2MAnq.js +380 -0
- package/bundled-test-harness/assets/markdown-helpers-test-CZ9Vvywc.js +188 -0
- package/bundled-test-harness/assets/markdown-highlighting-test-CFMkoVDl.js +244 -0
- package/bundled-test-harness/assets/markdown-preview-lOh-MyqF.js +72 -0
- package/bundled-test-harness/assets/markdown-preview-test-B8w0fFIy.js +238 -0
- package/bundled-test-harness/assets/markdown-skill-frontmatter-test-aH6HQly1.js +146 -0
- package/bundled-test-harness/assets/markdown-skill-search-test-CiNLQs-5.js +80 -0
- package/bundled-test-harness/assets/matrix-service-account-switch-sessions-test-DaA8w1Jj.js +63 -0
- package/bundled-test-harness/assets/matrix-service-boot-assembly-test-21GIlf55.js +300 -0
- package/bundled-test-harness/assets/matrix-service-personal-realm-test-jn9DUENm.js +125 -0
- package/bundled-test-harness/assets/matrix-service-realm-servers-test-eNZVJakl.js +55 -0
- package/bundled-test-harness/assets/matrix-service-realms-list-updated-test-Cabm8_dY.js +132 -0
- package/bundled-test-harness/assets/matrix-service-relogin-test-C77EFgjc.js +59 -0
- package/bundled-test-harness/assets/matrix-service-sliding-sync-test-BgM0fPiO.js +35 -0
- package/bundled-test-harness/assets/menu-Cl50TSFe.js +3561 -0
- package/bundled-test-harness/assets/message-service-subscription-test-CfEqH2jP.js +110 -0
- package/bundled-test-harness/assets/message-service-test-DsTzH1In.js +144 -0
- package/bundled-test-harness/assets/message-tool-test-C5xVfTtj.js +33 -0
- package/bundled-test-harness/assets/midi-audio-def-test-goLRCNCZ.js +182 -0
- package/bundled-test-harness/assets/migrate-skill-test-yPCbVfxG.js +161 -0
- package/bundled-test-harness/assets/mini-YXjrY_tH.js +1404 -0
- package/bundled-test-harness/assets/mini-card-chooser-test-DrllikHB.js +272 -0
- package/bundled-test-harness/assets/mini-file-chooser-test-BfqayhmI.js +201 -0
- package/bundled-test-harness/assets/mock-matrix-C7BrPS6S.js +2 -0
- package/bundled-test-harness/assets/mock-matrix-FjsXmU7-.js +15107 -0
- package/bundled-test-harness/assets/modal-BgaZavcs.js +322 -0
- package/bundled-test-harness/assets/model-cost-tier-test-BGg-sJML.js +174 -0
- package/bundled-test-harness/assets/model-file-extract-test-CjEBupY5.js +206 -0
- package/bundled-test-harness/assets/module-transpile-cache-test-XW6DDsmz.js +67 -0
- package/bundled-test-harness/assets/monaco-test-DkoRuFiQ.js +100 -0
- package/bundled-test-harness/assets/mp3-audio-def-test-v369NNsQ.js +133 -0
- package/bundled-test-harness/assets/multiple-stacks-test-CJpYPWdM.js +208 -0
- package/bundled-test-harness/assets/nested-query-field-render-test-CfDrBcUN.js +249 -0
- package/bundled-test-harness/assets/no-stacks-test-MmsJeLpz.js +48 -0
- package/bundled-test-harness/assets/number-field-test-A7B2r0M5.js +184 -0
- package/bundled-test-harness/assets/office-file-def-test-BNRvFmCB.js +263 -0
- package/bundled-test-harness/assets/office-metadata-extractor-test-zlDoEIEp.js +218 -0
- package/bundled-test-harness/assets/office-poster-capture-test-DdFEaOxR.js +203 -0
- package/bundled-test-harness/assets/ogg-audio-def-test-kk91BzQY.js +196 -0
- package/bundled-test-harness/assets/open-create-listing-modal-test-D1Dl1pov.js +131 -0
- package/bundled-test-harness/assets/open-image-in-new-tab-test-DyCmdMyO.js +52 -0
- package/bundled-test-harness/assets/open-secure-window-test-dz1vPudF.js +253 -0
- package/bundled-test-harness/assets/open-workspace-test-BvTcskzP.js +46 -0
- package/bundled-test-harness/assets/operation-lowering-test-omU66bkJ.js +2957 -0
- package/bundled-test-harness/assets/operations-invocation-test-BMj42rQe.js +523 -0
- package/bundled-test-harness/assets/operations-optimistic-test-KJLyzT8v.js +203 -0
- package/bundled-test-harness/assets/operations-query-test-J3HcnaoK.js +459 -0
- package/bundled-test-harness/assets/operations-store-reconciliation-test-CkbGBMBQ.js +406 -0
- package/bundled-test-harness/assets/operations-test-C7zXXpRW.js +2518 -0
- package/bundled-test-harness/assets/operator-mode-acceptance-test-BPolI_RD.js +1195 -0
- package/bundled-test-harness/assets/operator-mode-card-chooser-test-DjTQgizt.js +1036 -0
- package/bundled-test-harness/assets/operator-mode-links-test-DSEqy5Db.js +797 -0
- package/bundled-test-harness/assets/operator-mode-test-CB7BNDNE.js +696 -0
- package/bundled-test-harness/assets/operator-mode-ui-test-C1OhF1il.js +1045 -0
- package/bundled-test-harness/assets/overlay-D2rQi8lJ.js +427 -0
- package/bundled-test-harness/assets/overlay-menu-items-test-CPN31yBJ.js +331 -0
- package/bundled-test-harness/assets/overlays-B-qMEPhY.js +2 -0
- package/bundled-test-harness/assets/overlays-DSf2je0c.js +75 -0
- package/bundled-test-harness/assets/overlays-detached-element-test-C73nMXes.js +56 -0
- package/bundled-test-harness/assets/panel-DjrC7DxA.js +15124 -0
- package/bundled-test-harness/assets/past-sessions-test-BSIS2Hlq.js +321 -0
- package/bundled-test-harness/assets/patch-fields-test-Bp2IE0Jw.js +1014 -0
- package/bundled-test-harness/assets/patch-instance-test-DssuRGKP.js +348 -0
- package/bundled-test-harness/assets/pdf-file-def-test-Barj9ffD.js +111 -0
- package/bundled-test-harness/assets/pdf-metadata-extractor-test-B7KnXcIm.js +130 -0
- package/bundled-test-harness/assets/permission-checking-realm-test-BD4O0nen.js +306 -0
- package/bundled-test-harness/assets/persist-module-inspector-view-test-BIdbkdPr.js +60 -0
- package/bundled-test-harness/assets/persist-scroll-position-test-Bhb7wJiy.js +254 -0
- package/bundled-test-harness/assets/phone-number-field-test-C2yuCrXY.js +73 -0
- package/bundled-test-harness/assets/pill-menu-test-BIp91YXi.js +60 -0
- package/bundled-test-harness/assets/plate-CJq1veVA.js +41 -0
- package/bundled-test-harness/assets/plate-CwAvOUfL.js +2 -0
- package/bundled-test-harness/assets/player-Digk7omr.js +2 -0
- package/bundled-test-harness/assets/player-vsjosoN_.js +82 -0
- package/bundled-test-harness/assets/playground-B02e8uqB.js +58 -0
- package/bundled-test-harness/assets/plural-field-components-test-C1acuN-A.js +198 -0
- package/bundled-test-harness/assets/png-image-def-test-B9QeVo1f.js +266 -0
- package/bundled-test-harness/assets/policy-audit-confirmation-test-CeVquvc_.js +155 -0
- package/bundled-test-harness/assets/policy-scoped-search-test-SFPiIqR3.js +339 -0
- package/bundled-test-harness/assets/prerender-file-extract-test-HSJKAHyO.js +346 -0
- package/bundled-test-harness/assets/prerender-html-test-BTAcFCme.js +670 -0
- package/bundled-test-harness/assets/prerender-meta-test-Csyz2b21.js +614 -0
- package/bundled-test-harness/assets/prerender-module-test-DpTYAbmI.js +409 -0
- package/bundled-test-harness/assets/prerender-persistence-block-test-BhIt-7kK.js +124 -0
- package/bundled-test-harness/assets/prerender-pre-model-error-test-DxKPQKqx.js +61 -0
- package/bundled-test-harness/assets/prerender-serialize-cycle-test-C8V5YWQO.js +134 -0
- package/bundled-test-harness/assets/prerendered-html-read-test-Cq7JVGwg.js +191 -0
- package/bundled-test-harness/assets/pretui-components-test-Ducr9fLT.css +743 -0
- package/bundled-test-harness/assets/pretui-components-test-Hs0uyIUQ.js +992 -0
- package/bundled-test-harness/assets/pretui-primitives-CRs8NRm0.js +69 -0
- package/bundled-test-harness/assets/preview-format-test-cCqLrfdY.js +103 -0
- package/bundled-test-harness/assets/preview-test-BMqJSoR1.js +474 -0
- package/bundled-test-harness/assets/process-card-test-578tfDvr.js +94 -0
- package/bundled-test-harness/assets/profile-settings-modal-CVnNl7Yu.js +990 -0
- package/bundled-test-harness/assets/publish-realm-COoeWexp.js +82 -0
- package/bundled-test-harness/assets/publish-realm-test-a5nkx0Ov.js +210 -0
- package/bundled-test-harness/assets/query-field-barrier-test-qX3xVPfk.js +113 -0
- package/bundled-test-harness/assets/query-field-error-sentinel-test-V6JDPFLX.js +201 -0
- package/bundled-test-harness/assets/query-field-membership-status-test-CK7eDf-K.js +323 -0
- package/bundled-test-harness/assets/query-field-page-optin-test-B5YBHUvU.js +126 -0
- package/bundled-test-harness/assets/query-field-schema-test-D4SjOGlK.js +231 -0
- package/bundled-test-harness/assets/query-field-search-throttle-test-BVkm1-D8.js +154 -0
- package/bundled-test-harness/assets/query-field-stale-prerender-test-9g7hcD91.js +152 -0
- package/bundled-test-harness/assets/query-fields-test-CQYqhzpN.js +535 -0
- package/bundled-test-harness/assets/quick-look-test-CE0o6lJ4.js +139 -0
- package/bundled-test-harness/assets/read-card-for-ai-assistant-test-D0mJorwH.js +91 -0
- package/bundled-test-harness/assets/read-file-for-ai-assistant-test-B_F_2GEB.js +45 -0
- package/bundled-test-harness/assets/read-source-test-BgJV4B4F.js +67 -0
- package/bundled-test-harness/assets/read-text-file-test-DaeLzg4u.js +124 -0
- package/bundled-test-harness/assets/realm-C_a9su1j.js +2858 -0
- package/bundled-test-harness/assets/realm-api-keys-D5USFOoS.js +2 -0
- package/bundled-test-harness/assets/realm-api-keys-m_VOcixC.js +578 -0
- package/bundled-test-harness/assets/realm-api-keys-test-BVs7f5Dz.js +109 -0
- package/bundled-test-harness/assets/realm-api-keys-test-C_uZnTmq.js +588 -0
- package/bundled-test-harness/assets/realm-config-m5eccPW8.js +833 -0
- package/bundled-test-harness/assets/realm-config-policy-standing-test-Ber-IXpc.js +290 -0
- package/bundled-test-harness/assets/realm-config-routing-rule-edit-test-3Xqt5VlM.js +274 -0
- package/bundled-test-harness/assets/realm-config-settings-test-CkalhbDF.js +187 -0
- package/bundled-test-harness/assets/realm-field-test-B_PUoqnk.js +100 -0
- package/bundled-test-harness/assets/realm-indexing-test-8iLjeV_e.js +4380 -0
- package/bundled-test-harness/assets/realm-policy-fitted-test-Bptvra0U.js +206 -0
- package/bundled-test-harness/assets/realm-policy-test-DwG0qqXE.js +1141 -0
- package/bundled-test-harness/assets/realm-querying-test-Dvw26A6Q.js +1067 -0
- package/bundled-test-harness/assets/realm-server-form-agnostic-test-DrXQH0UP.js +96 -0
- package/bundled-test-harness/assets/realm-server-subscriber-test-Dkj23vQK.js +46 -0
- package/bundled-test-harness/assets/realm-service-info-test-CdRlDhj-.js +67 -0
- package/bundled-test-harness/assets/realm-test-DGYN48Qx.js +2364 -0
- package/bundled-test-harness/assets/realm-token-refresh-test-CEWATL9h.js +153 -0
- package/bundled-test-harness/assets/realm-url-tooltip-test-8ZjTNPuy.js +78 -0
- package/bundled-test-harness/assets/reasoning-test-BV49AYg2.js +221 -0
- package/bundled-test-harness/assets/recent-files-test-Dc6L6Dm4.js +450 -0
- package/bundled-test-harness/assets/reindex-realm-test-CFRSt39u.js +117 -0
- package/bundled-test-harness/assets/relationship-loading-state-test-FKbtOFUr.js +290 -0
- package/bundled-test-harness/assets/remix-card-test-CKGC_Sgq.js +58 -0
- package/bundled-test-harness/assets/rendered-markdown-DXiDN91F.js +292 -0
- package/bundled-test-harness/assets/rendered-markdown-test-n3MlXmmu.js +587 -0
- package/bundled-test-harness/assets/resident-instance-reuse-test-BjdhE6CM.js +82 -0
- package/bundled-test-harness/assets/result-tile-o6dtjgX4.js +144 -0
- package/bundled-test-harness/assets/rich-markdown-field-test-VXr6l20h.js +1647 -0
- package/bundled-test-harness/assets/room-message-test-BrjJ2wMs.js +484 -0
- package/bundled-test-harness/assets/run-P_7TsreC.js +4017 -0
- package/bundled-test-harness/assets/run-realm-code-DsBUf1si.js +2964 -0
- package/bundled-test-harness/assets/run-realm-code-test-cS0DzaKo.js +3844 -0
- package/bundled-test-harness/assets/sanitize-module-list-test-CvuOOiUY.js +85 -0
- package/bundled-test-harness/assets/save-card-skip-index-wait-test-fpJ1eq32.js +89 -0
- package/bundled-test-harness/assets/schema-editor-test-NkKjCgyf.js +785 -0
- package/bundled-test-harness/assets/schema-generation-test-Dmg3lWl7.js +28 -0
- package/bundled-test-harness/assets/scrolling-test-B0GNYGYc.js +412 -0
- package/bundled-test-harness/assets/search-adorn-test-CZebk7_y.js +136 -0
- package/bundled-test-harness/assets/search-and-choose-test-Bd4NZUup.js +154 -0
- package/bundled-test-harness/assets/search-correlation-id-test-DXKlEO55.js +139 -0
- package/bundled-test-harness/assets/search-entries-result-test-QQawA8Fm.js +234 -0
- package/bundled-test-harness/assets/search-entries-test-3DlqGPQq.js +1486 -0
- package/bundled-test-harness/assets/search-entries-tool-test-D1TvDE9D.js +504 -0
- package/bundled-test-harness/assets/search-google-images-test-DqsoQGr1.js +166 -0
- package/bundled-test-harness/assets/search-results-DGrNaPxh.js +266 -0
- package/bundled-test-harness/assets/search-results-test-CqVHYNRt.js +578 -0
- package/bundled-test-harness/assets/search-selection-menu-test-D6bIjKiH.js +108 -0
- package/bundled-test-harness/assets/search-sheet-files-test-Bf37TQXo.js +126 -0
- package/bundled-test-harness/assets/search-sheet-persistence-test-CV4_XdxR.js +131 -0
- package/bundled-test-harness/assets/search-test-Dlb-wg3a.js +2249 -0
- package/bundled-test-harness/assets/search-tool-test-BJLgVMoL.js +156 -0
- package/bundled-test-harness/assets/searchable-option-test-CcbfMqIL.js +322 -0
- package/bundled-test-harness/assets/searchable-search-doc-test-yH9fLGNS.js +1271 -0
- package/bundled-test-harness/assets/section-rail-CNFCebtT.js +113 -0
- package/bundled-test-harness/assets/section-rail-test-KNJAWWl6.js +256 -0
- package/bundled-test-harness/assets/secure-sign-in-Dyljp0Th.js +174 -0
- package/bundled-test-harness/assets/secure-sign-in-test-QnqNuTP3.js +373 -0
- package/bundled-test-harness/assets/segmented-control-DxJdoJ4Z.js +173 -0
- package/bundled-test-harness/assets/select-BiQTg2ts.js +175 -0
- package/bundled-test-harness/assets/send-ai-assistant-message-test-CAn7M2dZ.js +52 -0
- package/bundled-test-harness/assets/send-bot-trigger-event-test-qBu5E_jy.js +56 -0
- package/bundled-test-harness/assets/send-request-via-proxy-test-CLuwLBq_.js +380 -0
- package/bundled-test-harness/assets/sending-test-H0AaBSgi.js +659 -0
- package/bundled-test-harness/assets/serialization-rri-form-audit-test-hMJukiKt.js +136 -0
- package/bundled-test-harness/assets/serialization-test-W5e3wKbz.js +8758 -0
- package/bundled-test-harness/assets/set-user-system-card-test-CjgWLkNV.js +59 -0
- package/bundled-test-harness/assets/setup-CssMNvui.js +772 -0
- package/bundled-test-harness/assets/setup-D8YXvK-p.js +2 -0
- package/bundled-test-harness/assets/shared-link-target-reuse-test-D42UO8DC.js +207 -0
- package/bundled-test-harness/assets/show-card-test-CHEaS514.js +365 -0
- package/bundled-test-harness/assets/signed-capture-link-test-BgEu0F-S.js +132 -0
- package/bundled-test-harness/assets/single-stack-test-DYcu_v7Z.js +652 -0
- package/bundled-test-harness/assets/skills-test-ChmKhADX.js +648 -0
- package/bundled-test-harness/assets/skip-boot-index-guard-test-BzRIncDN.js +46 -0
- package/bundled-test-harness/assets/spec-test-BYvFR6Xb.js +1077 -0
- package/bundled-test-harness/assets/spinner-Bx9x55NA.js +49 -0
- package/bundled-test-harness/assets/src-C1hYFgVl.js +216 -0
- package/bundled-test-harness/assets/src-CIlLx7Lu.js +5 -0
- package/bundled-test-harness/assets/stick-to-bottom-resize-test-DMHsAG0v.js +56 -0
- package/bundled-test-harness/assets/store-add-test-D_9IHQjZ.js +50 -0
- package/bundled-test-harness/assets/store-module-rebuild-test-BRGZoLRV.js +454 -0
- package/bundled-test-harness/assets/store-search-test-3G8JHuj2.js +175 -0
- package/bundled-test-harness/assets/store-test-BiKKDqqW.js +3672 -0
- package/bundled-test-harness/assets/structured-theme-test-11TNsgUW.js +377 -0
- package/bundled-test-harness/assets/summarize-session-test-CwzD_ZbD.js +172 -0
- package/bundled-test-harness/assets/svg-image-def-test-zV6aMK9q.js +167 -0
- package/bundled-test-harness/assets/switch-submode-test-DQU2cP5_.js +168 -0
- package/bundled-test-harness/assets/sync-openrouter-models-test-xrXVaC2H.js +97 -0
- package/bundled-test-harness/assets/test-support-BGl3rthw.js +3 -0
- package/bundled-test-harness/assets/test-support-BcBv__98.js +99 -0
- package/bundled-test-harness/assets/tests-CmM9imwB.js +3598 -0
- package/bundled-test-harness/assets/text-file-def-test-Cyq78UFY.js +94 -0
- package/bundled-test-harness/assets/text-input-validator-test-DBj7TaM_.js +156 -0
- package/bundled-test-harness/assets/text-suggestion-test-C4XAqWqY.js +340 -0
- package/bundled-test-harness/assets/theme-card-test-dVNz4tgU.js +621 -0
- package/bundled-test-harness/assets/theme-dashboard-nav-test-DYSn5pqo.js +196 -0
- package/bundled-test-harness/assets/theme-scheme-island-test-C1WpkfEP.js +264 -0
- package/bundled-test-harness/assets/theme-scoped-css-parity-test-BVluppsE.js +176 -0
- package/bundled-test-harness/assets/titles-DCvAhECF.js +52 -0
- package/bundled-test-harness/assets/titles-ZPeArtS1.js +2 -0
- package/bundled-test-harness/assets/to-device-streaming-test-BJ4J1cXe.js +163 -0
- package/bundled-test-harness/assets/token-usage-test-WUf4r4fQ.js +160 -0
- package/bundled-test-harness/assets/tools-J_Knr_W6.js +774 -0
- package/bundled-test-harness/assets/tools-calling-test-CfqZX0Ed.js +200 -0
- package/bundled-test-harness/assets/tools-test-B4x58ZmI.js +1624 -0
- package/bundled-test-harness/assets/tools-test-Cvau5219.js +3204 -0
- package/bundled-test-harness/assets/tooltip-B0rEgyMW.css +66 -0
- package/bundled-test-harness/assets/tooltip-DvUMUgVX.js +195 -0
- package/bundled-test-harness/assets/transform-cards-test-CYQbZeD9.js +341 -0
- package/bundled-test-harness/assets/ts-file-def-preview-test-m39f8Zio.js +95 -0
- package/bundled-test-harness/assets/ts-file-def-test-xIcL5xWe.js +92 -0
- package/bundled-test-harness/assets/ttf-font-def-test-ClQ2SzFF.js +206 -0
- package/bundled-test-harness/assets/turn-settling-test-DZoL2mRT.js +160 -0
- package/bundled-test-harness/assets/turn-summary-Bmt7ZxTS.js +1039 -0
- package/bundled-test-harness/assets/unpublish-realm-test-0ToTJczx.js +102 -0
- package/bundled-test-harness/assets/update-room-skills-test-o_j8NOUV.js +240 -0
- package/bundled-test-harness/assets/use-ai-assistant-test-D7HFpxKJ.js +384 -0
- package/bundled-test-harness/assets/user-message-BAOt1hS3.js +262 -0
- package/bundled-test-harness/assets/validate-realm-test-e3xIbNLB.js +67 -0
- package/bundled-test-harness/assets/video-metadata-extractor-test-D8naLSlg.js +520 -0
- package/bundled-test-harness/assets/view-visually-test-BuhGau5E.js +335 -0
- package/bundled-test-harness/assets/virtual-network-reset-test-CgaFNGPi.js +96 -0
- package/bundled-test-harness/assets/wav-audio-def-test-CWG_UdCh.js +160 -0
- package/bundled-test-harness/assets/webp-image-def-test-sN4yw8Zu.js +226 -0
- package/bundled-test-harness/assets/workspace-0LfPqbYB.js +445 -0
- package/bundled-test-harness/assets/workspace-a11y-test-DQxYDRAP.js +197 -0
- package/bundled-test-harness/assets/workspace-actions-jGJSfl8M.js +588 -0
- package/bundled-test-harness/assets/workspace-behavior-test-BnF-bmBN.js +338 -0
- package/bundled-test-harness/assets/workspace-delete-multiple-test-D-rxPDuT.js +212 -0
- package/bundled-test-harness/assets/workspace-delete-summary-test-C2-Mve5R.js +63 -0
- package/bundled-test-harness/assets/workspace-hosting-test-BvDKdlOb.js +138 -0
- package/bundled-test-harness/assets/workspace-indexing-test-B34T3kqD.js +71 -0
- package/bundled-test-harness/assets/workspace-test-CJivgv-m.js +51 -0
- package/bundled-test-harness/assets/workspace-test-CuSRpPnQ.js +385 -0
- package/bundled-test-harness/assets/workspace-timestamp-labels-test-aWgjdbCp.js +68 -0
- package/bundled-test-harness/assets/workspace-unit-test-DHMUf2KT.js +122 -0
- package/bundled-test-harness/assets/write-binary-file-test-P-hVQuin.js +124 -0
- package/bundled-test-harness/assets/write-text-file-test-fXvJueDd.js +191 -0
- package/bundled-test-harness/assets/zip-archive-test-C2P5CUSR.js +285 -0
- package/bundled-test-harness/assets/zip-file-def-test-BfJZAmGt.js +164 -0
- package/bundled-test-harness/boxel-ui-checksum.txt +1 -1
- package/bundled-test-harness/index.html +48 -48
- package/bundled-test-harness/tests/index.html +50 -50
- package/bundled-types/boxel-ui/helpers/theme-scoped-css.ts +4 -0
- package/bundled-types/choreo/choreo.gts +58 -2
- package/bundled-types/choreo/compile.ts +5 -0
- package/bundled-types/choreo/layout-probe.ts +100 -0
- package/bundled-types/choreo/run.ts +99 -4
- package/bundled-types/host-app/components/operator-mode/dashboard/get-started.gts +152 -7
- package/bundled-types/host-app/components/operator-mode/dashboard/index.gts +2 -0
- package/bundled-types/host-app/components/operator-mode/dashboard/workspace.gts +5 -3
- package/bundled-types/host-app/components/operator-mode/dashboard-modals/workspace-modals.gts +5 -22
- package/bundled-types/host-app/components/operator-mode/host-submode/publishing-realm-popover.gts +1 -1
- package/bundled-types/host-app/components/operator-mode/host-submode.gts +111 -37
- package/bundled-types/host-app/components/operator-mode/motion/stack-motion.gts +92 -33
- package/bundled-types/host-app/components/operator-mode/publish-realm-modal.gts +1 -0
- package/bundled-types/host-app/components/operator-mode/stack-item.gts +2 -2
- package/bundled-types/host-app/components/operator-mode/stack.gts +36 -25
- package/bundled-types/host-app/components/operator-mode/submode-layout.gts +2 -2
- package/bundled-types/host-app/lib/modal-focus-trap.ts +33 -0
- package/bundled-types/host-app/lib/workspace-actions.ts +21 -0
- package/bundled-types/host-app/services/host-mode-service.ts +39 -0
- package/bundled-types/host-app/services/realm.ts +14 -0
- package/bundled-types/host-tests/helpers/dashboard.ts +67 -0
- package/package.json +1 -1
- package/bundled-test-harness/assets/account-switch-failed-test-FytUFiPO.js +0 -45
- package/bundled-test-harness/assets/adapter-DvmPwSZv.js +0 -2
- package/bundled-test-harness/assets/add-field-to-card-definition-tool-test-DN525jiY.js +0 -112
- package/bundled-test-harness/assets/ai-assistant-create-workspace-test-q3tKqVJQ.js +0 -130
- package/bundled-test-harness/assets/ai-assistant-panel-relogin-test-DgeXcCyi.js +0 -46
- package/bundled-test-harness/assets/ai-assistant-test-lDIGPKFP.js +0 -2223
- package/bundled-test-harness/assets/ai-function-generation-test-D5GbLyvL.js +0 -1176
- package/bundled-test-harness/assets/ai-module-creation-test-I3-j2beD.js +0 -151
- package/bundled-test-harness/assets/aibot-message-Dmsjifs6.js +0 -1312
- package/bundled-test-harness/assets/app-BS9_-DhN.js +0 -14146
- package/bundled-test-harness/assets/apply-markdown-edit-test-4zlwt0Db.js +0 -230
- package/bundled-test-harness/assets/ask-user-picker-Dr-0qpNr.js +0 -370
- package/bundled-test-harness/assets/ask-user-picker-test-633AFdmS.js +0 -39
- package/bundled-test-harness/assets/assistant-transcript-test-BgRnLvMg.js +0 -57
- package/bundled-test-harness/assets/audio-metadata-extractor-test-4xsQqL-0.js +0 -1176
- package/bundled-test-harness/assets/authed-fetch-test-663mT5_N.js +0 -73
- package/bundled-test-harness/assets/avif-image-def-test-h01BPIJy.js +0 -187
- package/bundled-test-harness/assets/basic-test-DiD6T-8Q.js +0 -139
- package/bundled-test-harness/assets/binary-upload-dedupe-test-CkjMPO_e.js +0 -308
- package/bundled-test-harness/assets/bot-registration-test-CFZHpwdj.js +0 -97
- package/bundled-test-harness/assets/box-test-C3pSy5ED.js +0 -50
- package/bundled-test-harness/assets/brand-guide-attachments-test-EoC_u7Vc.js +0 -84
- package/bundled-test-harness/assets/brand-guide-custom-css-test-Dn3fvblr.js +0 -196
- package/bundled-test-harness/assets/brand-guide-edit-test-NeiT3MyK.js +0 -140
- package/bundled-test-harness/assets/brand-logo-mark-field-test-C2A1EnBB.js +0 -86
- package/bundled-test-harness/assets/broken-link-template-test-CWn6V5zZ.js +0 -192
- package/bundled-test-harness/assets/bundled-base-modules-test-D7mLzpsw.js +0 -54
- package/bundled-test-harness/assets/bundled-base-oracle-test-I7xCId_k.js +0 -37
- package/bundled-test-harness/assets/buried-stack-item-scroll-test-DFBev0h-.js +0 -236
- package/bundled-test-harness/assets/button-BeSuhveJ.js +0 -207
- package/bundled-test-harness/assets/bxl-cyclic-graph-test-DPykwvvx.js +0 -47
- package/bundled-test-harness/assets/bxl-expression-test-LBWJiFb9.js +0 -250
- package/bundled-test-harness/assets/bxl-indexing-test-BuZmLk7y.js +0 -212
- package/bundled-test-harness/assets/bxl-platform-module-test-BNIvlkCM.js +0 -71
- package/bundled-test-harness/assets/can-invoke-test-t-bFIIeX.js +0 -455
- package/bundled-test-harness/assets/can-read-realm-test-2Q_MzRT9.js +0 -56
- package/bundled-test-harness/assets/cancel-indexing-job-test-QeYxEukn.js +0 -69
- package/bundled-test-harness/assets/capture-test-CJmJG8YR.js +0 -360
- package/bundled-test-harness/assets/card-api-test-B43I510H.js +0 -198
- package/bundled-test-harness/assets/card-basics-test-CBClzP2y.js +0 -5364
- package/bundled-test-harness/assets/card-chooser-paging-test-HEVzf6pR.js +0 -235
- package/bundled-test-harness/assets/card-chooser-test-GfjBRPFI.js +0 -393
- package/bundled-test-harness/assets/card-context-search-results-CoSr4EdS.js +0 -30
- package/bundled-test-harness/assets/card-context-search-results-test-BLMlZu9t.js +0 -184
- package/bundled-test-harness/assets/card-def-field-def-relationships-test-DEBOzKan.js +0 -562
- package/bundled-test-harness/assets/card-def-menu-items-test-88_h8o0D.js +0 -228
- package/bundled-test-harness/assets/card-delete-test-DKom1phy.js +0 -466
- package/bundled-test-harness/assets/card-error-awaiting-index-test-DEwgFZMP.js +0 -53
- package/bundled-test-harness/assets/card-error-r6_cXst9.js +0 -72
- package/bundled-test-harness/assets/card-info-thumbnail-picker-test-B7LiY15e.js +0 -219
- package/bundled-test-harness/assets/card-playground-test-CgyIJHui.js +0 -1491
- package/bundled-test-harness/assets/card-prerender-rPfzpIOU.js +0 -12939
- package/bundled-test-harness/assets/card-thunk-error-test-L0pvg4Ce.js +0 -48
- package/bundled-test-harness/assets/card-type-service-test-B2dhqxSD.js +0 -161
- package/bundled-test-harness/assets/check-correctness-test-DgqaLlCW.js +0 -1093
- package/bundled-test-harness/assets/check-domain-availability-test-B0hJHY5l.js +0 -98
- package/bundled-test-harness/assets/chip-D01NW3WH.js +0 -44
- package/bundled-test-harness/assets/choreo-D2Jl79RU.js +0 -1019
- package/bundled-test-harness/assets/choreo-_E8SOEe-.js +0 -2
- package/bundled-test-harness/assets/choreo-feature-reel-test-WLjsZDmS.js +0 -155
- package/bundled-test-harness/assets/choreo-gallery-build-order-test-6jnS8PsS.js +0 -436
- package/bundled-test-harness/assets/choreo-gallery-compositor-test-CbUZsVB6.js +0 -399
- package/bundled-test-harness/assets/choreo-gallery-cover-test-CbvAStgk.js +0 -214
- package/bundled-test-harness/assets/choreo-gallery-crossing-stage-test-tdjvUSa6.js +0 -133
- package/bundled-test-harness/assets/choreo-gallery-demos-alive-test-CsnM3hQK.js +0 -42
- package/bundled-test-harness/assets/choreo-gallery-drift-test-DG2LQTa7.js +0 -620
- package/bundled-test-harness/assets/choreo-gallery-escort-test-mn3-qXP1.js +0 -187
- package/bundled-test-harness/assets/choreo-gallery-films-test-BuktaC0D.js +0 -140
- package/bundled-test-harness/assets/choreo-gallery-filter-test-Dd-zpps0.js +0 -46
- package/bundled-test-harness/assets/choreo-gallery-fold-test-CWc1ijGc.js +0 -180
- package/bundled-test-harness/assets/choreo-gallery-guide-pages-test-tk2QmYPU.js +0 -114
- package/bundled-test-harness/assets/choreo-gallery-guides-test-DVbf1zM4.js +0 -321
- package/bundled-test-harness/assets/choreo-gallery-hang-test-B7EFp2dx.js +0 -426
- package/bundled-test-harness/assets/choreo-gallery-highlight-test-BFgbdesP.js +0 -60
- package/bundled-test-harness/assets/choreo-gallery-inline-edit-test-DJb8FC5R.js +0 -370
- package/bundled-test-harness/assets/choreo-gallery-interruption-test-DWyMXo5D.js +0 -176
- package/bundled-test-harness/assets/choreo-gallery-lone-stack-test-D3b8LsJ6.js +0 -104
- package/bundled-test-harness/assets/choreo-gallery-navigation-test-CjjU6Rvn.js +0 -193
- package/bundled-test-harness/assets/choreo-gallery-playhead-transport-test-Le_h3QWU.js +0 -111
- package/bundled-test-harness/assets/choreo-gallery-poplayout-subtree-test-Cp-DlWj4.js +0 -127
- package/bundled-test-harness/assets/choreo-gallery-presence-modes-test-DayS4GCJ.js +0 -100
- package/bundled-test-harness/assets/choreo-gallery-presentation-test-DeAfuFS7.js +0 -157
- package/bundled-test-harness/assets/choreo-gallery-reduced-motion-test-BgPWpggq.js +0 -145
- package/bundled-test-harness/assets/choreo-gallery-sheet-standalone-test-PzyoMNYv.js +0 -89
- package/bundled-test-harness/assets/choreo-gallery-sheet-test-CxaiNBkL.js +0 -48
- package/bundled-test-harness/assets/choreo-gallery-site-test-6xtSntS5.js +0 -237
- package/bundled-test-harness/assets/choreo-gallery-stage-E6Q5r-zU.js +0 -256
- package/bundled-test-harness/assets/choreo-gallery-stage-keyboard-test-C7aWMr9a.js +0 -102
- package/bundled-test-harness/assets/choreo-gallery-stages-test-CDWWgC61.js +0 -35
- package/bundled-test-harness/assets/choreo-gallery-subdivision-test-Bkp15XJv.js +0 -138
- package/bundled-test-harness/assets/choreo-gallery-table-plan-test-CcGRi_3O.js +0 -144
- package/bundled-test-harness/assets/choreo-gallery-theater-test-Qph5pLT_.js +0 -252
- package/bundled-test-harness/assets/choreo-gallery-tuning-test-C4DhFLVA.js +0 -95
- package/bundled-test-harness/assets/choreo-gallery-widget-room-test-LK493r1M.js +0 -88
- package/bundled-test-harness/assets/choreo-gallery-wires-test-B7SeUCc8.js +0 -148
- package/bundled-test-harness/assets/client-telemetry-test-DGmHzAFx.js +0 -340
- package/bundled-test-harness/assets/clip-BpYQPVz_.js +0 -2
- package/bundled-test-harness/assets/clip-CNaYbIwL.js +0 -92
- package/bundled-test-harness/assets/code-block-Cp2CJo5-.js +0 -502
- package/bundled-test-harness/assets/code-ref-test-C8JBHDb-.js +0 -163
- package/bundled-test-harness/assets/code-submode-availability-test-CzG1Tv6L.js +0 -198
- package/bundled-test-harness/assets/code-submode-test-BclVWjm5.js +0 -1839
- package/bundled-test-harness/assets/codeblocks-test-CmQlyxN7.js +0 -418
- package/bundled-test-harness/assets/codemirror-editor-test-B74H_yn8.js +0 -1512
- package/bundled-test-harness/assets/codemirror-embed-toolbar-test-Bz6VEysU.js +0 -366
- package/bundled-test-harness/assets/color-field-test-DMCPQKIP.js +0 -212
- package/bundled-test-harness/assets/compaction-test-saQCLBrQ.js +0 -150
- package/bundled-test-harness/assets/computed-test-C05HliJC.js +0 -1320
- package/bundled-test-harness/assets/container-Cqcwrd-m.js +0 -10857
- package/bundled-test-harness/assets/container-h3Wc26qn.css +0 -5097
- package/bundled-test-harness/assets/content-preview-components-test-DZPj4_CU.js +0 -462
- package/bundled-test-harness/assets/copy-and-edit-test-DiXTQNTF.js +0 -292
- package/bundled-test-harness/assets/copy-card-test-ys7GquUY.js +0 -218
- package/bundled-test-harness/assets/copy-file-to-realm-test-Gn0Wn4vT.js +0 -148
- package/bundled-test-harness/assets/copy-source-test-BTLrOmPm.js +0 -56
- package/bundled-test-harness/assets/create-file-test-BCeIW-Rt.js +0 -464
- package/bundled-test-harness/assets/create-file-test-DbHQ5JsS.js +0 -1086
- package/bundled-test-harness/assets/create-listing-modal-test-CeHc4ter.js +0 -273
- package/bundled-test-harness/assets/create-listing-pr-request-test-DXbJNfMh.js +0 -117
- package/bundled-test-harness/assets/create-spec-test-BDIZoyHT.js +0 -256
- package/bundled-test-harness/assets/create-submission-workflow-test-Bix5J-3A.js +0 -132
- package/bundled-test-harness/assets/create-workspace-test-BmNnLHwC.js +0 -104
- package/bundled-test-harness/assets/credential-fields-test-NK1F4QWn.js +0 -200
- package/bundled-test-harness/assets/csv-file-def-test-BSfs4TTP.js +0 -102
- package/bundled-test-harness/assets/dashboard-C4T7ffKY.js +0 -3576
- package/bundled-test-harness/assets/dashboard-CFeHuP5-.js +0 -81
- package/bundled-test-harness/assets/dashboard-DQlpW-ux.css +0 -2392
- package/bundled-test-harness/assets/dashboard-add-workspace-test--rr6objf.js +0 -50
- package/bundled-test-harness/assets/dashboard-agents-test-D1y8H4xH.js +0 -334
- package/bundled-test-harness/assets/dashboard-archive-test-bN4EQaXv.js +0 -128
- package/bundled-test-harness/assets/dashboard-delete-test-BvsASb8B.js +0 -163
- package/bundled-test-harness/assets/dashboard-duplicate-offer-test-DEsd5ZzZ.js +0 -71
- package/bundled-test-harness/assets/dashboard-duplicate-test-BnR0sTgB.js +0 -222
- package/bundled-test-harness/assets/dashboard-get-started-test-DG4uUXLv.js +0 -246
- package/bundled-test-harness/assets/dashboard-pinned-cards-test-AoGGVRAS.js +0 -220
- package/bundled-test-harness/assets/dashboard-reindex-test-BN9a96Xp.js +0 -115
- package/bundled-test-harness/assets/dashboard-section-rail-test-B3OT9V2T.js +0 -169
- package/bundled-test-harness/assets/dashboard-state-test-BY0Zqrmj.js +0 -162
- package/bundled-test-harness/assets/dashboard-test-C13oNpWt.js +0 -545
- package/bundled-test-harness/assets/dashboard-unreachable-notice-test-DZIV4x5j.js +0 -62
- package/bundled-test-harness/assets/dashboard-workspace-test-CBnOQViI.js +0 -537
- package/bundled-test-harness/assets/dashboard-workspaces-section-test-KU8ZVOYp.js +0 -396
- package/bundled-test-harness/assets/data-file-def-preview-test-CI5gcdtK.js +0 -155
- package/bundled-test-harness/assets/date-time-fields-test-D2CpR_Pb.js +0 -359
- package/bundled-test-harness/assets/debug-message-test-Df1kHesw.js +0 -117
- package/bundled-test-harness/assets/declared-captures-test-hQ43zuox.js +0 -879
- package/bundled-test-harness/assets/delete-workspace-test-BhfMKsix.js +0 -102
- package/bundled-test-harness/assets/diffing-test-CHRh55mC.js +0 -210
- package/bundled-test-harness/assets/download-file-to-realm-test-CC1HURCi.js +0 -119
- package/bundled-test-harness/assets/editor-test-DkeCv28f.js +0 -688
- package/bundled-test-harness/assets/edits-BSJqtUXM.js +0 -651
- package/bundled-test-harness/assets/email-field-test-DihK0suO.js +0 -75
- package/bundled-test-harness/assets/enum-field-test-Gja3bzt5.js +0 -935
- package/bundled-test-harness/assets/error-display-test-GhYZu7cp.js +0 -343
- package/bundled-test-harness/assets/evaluate-module-test-D_t4CiUq.js +0 -91
- package/bundled-test-harness/assets/execute-atomic-operations-test-xtou8Zeg.js +0 -113
- package/bundled-test-harness/assets/externals-B02-sD_L.js +0 -4393
- package/bundled-test-harness/assets/fallback-banner-live-delete-test-DtxzNXdE.js +0 -207
- package/bundled-test-harness/assets/fallback-banner-test-BfmiQ_68.js +0 -53
- package/bundled-test-harness/assets/fallback-banner-test-DLtTdmvn.js +0 -225
- package/bundled-test-harness/assets/fallback-models-test-BxNJxhfd.js +0 -161
- package/bundled-test-harness/assets/fetch-card-json-test-DofKbzvC.js +0 -61
- package/bundled-test-harness/assets/field-configuration-test-SUoPaXWy.js +0 -551
- package/bundled-test-harness/assets/field-markdown-domain-test-BwtR0dPP.js +0 -616
- package/bundled-test-harness/assets/field-markdown-oversize-test-D8UJcBc3.js +0 -88
- package/bundled-test-harness/assets/field-markdown-primitives-test-D5_ZdoDO.js +0 -365
- package/bundled-test-harness/assets/field-markdown-specialized-test-Dpd5hs04.js +0 -534
- package/bundled-test-harness/assets/field-playground-test-CzhYzKGv.js +0 -894
- package/bundled-test-harness/assets/field-support-predicates-test-BSvVOFth.js +0 -167
- package/bundled-test-harness/assets/file-attachment-test-fM-yFedm.js +0 -796
- package/bundled-test-harness/assets/file-chooser-panel-test-CKj8YTdY.js +0 -153
- package/bundled-test-harness/assets/file-chooser-test-Bs8jFXqa.js +0 -504
- package/bundled-test-harness/assets/file-def-format-templates-test-CxrRoWoD.js +0 -380
- package/bundled-test-harness/assets/file-def-live-reload-test-X_8YEkve.js +0 -124
- package/bundled-test-harness/assets/file-def-menu-items-test-Dx879o_o.js +0 -138
- package/bundled-test-harness/assets/file-def-navigation-test-MMI_EEO1.js +0 -109
- package/bundled-test-harness/assets/file-def-serialization-test-B5lguBQD.js +0 -89
- package/bundled-test-harness/assets/file-def-test-Di9QWcrj.js +0 -216
- package/bundled-test-harness/assets/file-preview-live-reload-test-aqx93A7c.js +0 -310
- package/bundled-test-harness/assets/file-resource-primitives-test-a5abpcSB.js +0 -255
- package/bundled-test-harness/assets/file-tree-from-index-test-CnruGxJ8.js +0 -96
- package/bundled-test-harness/assets/file-tree-test-BCyWDdSE.js +0 -851
- package/bundled-test-harness/assets/file-view-model-test-BfpLa01Y.js +0 -346
- package/bundled-test-harness/assets/filedef-export-shape-test-CQ9XbrzS.js +0 -61
- package/bundled-test-harness/assets/film-CL1zj_bJ.js +0 -2
- package/bundled-test-harness/assets/film-Dq_quZ31.js +0 -13
- package/bundled-test-harness/assets/film-xbkQa060.js +0 -4074
- package/bundled-test-harness/assets/flac-audio-def-test-BmVp9dMx.js +0 -143
- package/bundled-test-harness/assets/focus-Dm4wkM72.js +0 -306
- package/bundled-test-harness/assets/font-metadata-extractor-test-OWEh9_MS.js +0 -415
- package/bundled-test-harness/assets/formatted-aibot-message-test-BpHsWpuV.js +0 -109
- package/bundled-test-harness/assets/formatted-user-message-test-DZW5TAr0.js +0 -43
- package/bundled-test-harness/assets/freestyle-test-D_uaPU_3.js +0 -17
- package/bundled-test-harness/assets/full-reindex-realm-test-C6vHL5kC.js +0 -101
- package/bundled-test-harness/assets/garbage-collection-test-D-Ao4t2n.js +0 -403
- package/bundled-test-harness/assets/general-test-PSGI8W0z.js +0 -923
- package/bundled-test-harness/assets/generate-example-cards-one-shot-test-J-m-0E6W.js +0 -65
- package/bundled-test-harness/assets/generic-file-def-preview-test-BAsOhTYU.js +0 -71
- package/bundled-test-harness/assets/get-available-realm-identifiers-test-D5PBOr97.js +0 -47
- package/bundled-test-harness/assets/get-catalog-realm-identifiers-test-NM9UURHE.js +0 -47
- package/bundled-test-harness/assets/get-default-writable-realm-test-BxXc9a3J.js +0 -54
- package/bundled-test-harness/assets/get-published-realms-test-C8TJEc4-.js +0 -71
- package/bundled-test-harness/assets/get-realm-of-resource-identifier-test-Dt8CB6lS.js +0 -54
- package/bundled-test-harness/assets/get-relationship-membership-state-test-9_8x3myJ.js +0 -1308
- package/bundled-test-harness/assets/get-user-system-card-test-k0UO-uba.js +0 -67
- package/bundled-test-harness/assets/gif-image-def-test-BWrqPGDX.js +0 -188
- package/bundled-test-harness/assets/glimmer-motion-and-choreo-in-cards-test-BgG8QI9E.js +0 -160
- package/bundled-test-harness/assets/glimmer-motion-and-choreo-test-BKOvNyCN.js +0 -74
- package/bundled-test-harness/assets/gts-file-def-test-BCRHwDeZ.js +0 -100
- package/bundled-test-harness/assets/head-format-preview-test-DnfUhniI.js +0 -158
- package/bundled-test-harness/assets/helpers-DklkegO_.js +0 -5
- package/bundled-test-harness/assets/host-mode-service-vOfN0smp.js +0 -232
- package/bundled-test-harness/assets/host-mode-test-CCCJFz6_.js +0 -831
- package/bundled-test-harness/assets/host-submode-test-CtCfbuPA.js +0 -1342
- package/bundled-test-harness/assets/html-component-test-CWyhb5ZX.js +0 -65
- package/bundled-test-harness/assets/html-def-test-Cb8C2lUx.js +0 -160
- package/bundled-test-harness/assets/html-meta-extractor-test-BHT9Rtir.js +0 -60
- package/bundled-test-harness/assets/hydratable-card-test-DpgpdesD.js +0 -426
- package/bundled-test-harness/assets/icon-button-ABCGVF3C.js +0 -67
- package/bundled-test-harness/assets/image-metadata-extractor-test-ClhPTouq.js +0 -1109
- package/bundled-test-harness/assets/index-changes-test-CgnVr3LH.js +0 -367
- package/bundled-test-harness/assets/index-query-engine-test-CQTwju5_.js +0 -2593
- package/bundled-test-harness/assets/index-writer-test-IoVOoZT2.js +0 -3040
- package/bundled-test-harness/assets/inspector-test-BN2Ieb77.js +0 -2058
- package/bundled-test-harness/assets/instance-filter-matcher-test-Bq-_Sy89.js +0 -788
- package/bundled-test-harness/assets/instantiate-card-test-DEeDTzFV.js +0 -164
- package/bundled-test-harness/assets/interact-submode-creation-and-permissions-test-DP6kOyJS.js +0 -475
- package/bundled-test-harness/assets/interact-submode-setup-B0_cHqH-.js +0 -566
- package/bundled-test-harness/assets/invalidate-realm-identifiers-test-9uUD91Pw.js +0 -99
- package/bundled-test-harness/assets/invite-user-to-room-test-CcDA45Ac.js +0 -142
- package/bundled-test-harness/assets/invoke-card-operation-test-DmUtgueM.js +0 -333
- package/bundled-test-harness/assets/isolated-render-test-B2eXNHu6.js +0 -51
- package/bundled-test-harness/assets/job-scoped-doc-cache-test-DF9D7cOc.js +0 -181
- package/bundled-test-harness/assets/job-scoped-instance-residency-test-CSS8xUU5.js +0 -103
- package/bundled-test-harness/assets/jpg-image-def-test-voECMTht.js +0 -697
- package/bundled-test-harness/assets/json-file-def-test-8Y4KLjUC.js +0 -95
- package/bundled-test-harness/assets/key-notices-badge-test-d1mYqx0e.js +0 -155
- package/bundled-test-harness/assets/key-readiness-test-BtCg7PCk.js +0 -190
- package/bundled-test-harness/assets/linksto-broken-link-placeholder-test-CyCMbJnN.js +0 -398
- package/bundled-test-harness/assets/linksto-error-sentinel-test-BDW572-v.js +0 -238
- package/bundled-test-harness/assets/linksto-many-broken-link-placeholder-test-B4wM97hD.js +0 -354
- package/bundled-test-harness/assets/linksto-many-per-slot-access-test-BhJmtJ0_.js +0 -303
- package/bundled-test-harness/assets/linksto-sentinel-reload-test-BpBQ5V_i.js +0 -197
- package/bundled-test-harness/assets/linksto-sentinel-roundtrip-test-pkBBl4e9.js +0 -260
- package/bundled-test-harness/assets/linksto-singular-js-access-contract-test-Bb6wjUdD.js +0 -196
- package/bundled-test-harness/assets/lint-and-fix-test-CcMLn-co.js +0 -51
- package/bundled-test-harness/assets/live-test-AyBnq7BX.js +0 -2
- package/bundled-test-harness/assets/live-test-CgnAcIDw.js +0 -100
- package/bundled-test-harness/assets/load-default-skills-test-BIOwtx0Y.js +0 -74
- package/bundled-test-harness/assets/loader-parallel-prefetch-test-D5_oRSER.js +0 -257
- package/bundled-test-harness/assets/loader-test-DSc_jR1c.js +0 -482
- package/bundled-test-harness/assets/loading-test-8pldx7S-.js +0 -63
- package/bundled-test-harness/assets/m4a-audio-def-test-BDI5apzM.js +0 -190
- package/bundled-test-harness/assets/main-5kHyCkdm.js +0 -5
- package/bundled-test-harness/assets/markdown-embed-chooser-modal-test-Wud0s7WZ.js +0 -470
- package/bundled-test-harness/assets/markdown-embed-chooser-test-DVzzS-0C.js +0 -334
- package/bundled-test-harness/assets/markdown-embed-preview-pane-test-B5W_iqsi.js +0 -447
- package/bundled-test-harness/assets/markdown-embed-preview-test-CZF_s0fB.js +0 -368
- package/bundled-test-harness/assets/markdown-fallback-test-fT6BS4W7.js +0 -316
- package/bundled-test-harness/assets/markdown-file-def-test-B1aTzazR.js +0 -380
- package/bundled-test-harness/assets/markdown-helpers-test-gNKZf7Mw.js +0 -188
- package/bundled-test-harness/assets/markdown-highlighting-test-Du5_CQmD.js +0 -244
- package/bundled-test-harness/assets/markdown-preview-h-_aJhRc.js +0 -72
- package/bundled-test-harness/assets/markdown-preview-test-DJvoVsXw.js +0 -238
- package/bundled-test-harness/assets/markdown-skill-frontmatter-test-VwJi3Paj.js +0 -146
- package/bundled-test-harness/assets/markdown-skill-search-test-ysCdf0xM.js +0 -80
- package/bundled-test-harness/assets/matrix-service-account-switch-sessions-test-K2JuMy36.js +0 -63
- package/bundled-test-harness/assets/matrix-service-boot-assembly-test-CkdL_-os.js +0 -300
- package/bundled-test-harness/assets/matrix-service-personal-realm-test-Dy1DultK.js +0 -125
- package/bundled-test-harness/assets/matrix-service-realm-servers-test-DHDDKuEg.js +0 -55
- package/bundled-test-harness/assets/matrix-service-realms-list-updated-test-DcTbZpMl.js +0 -132
- package/bundled-test-harness/assets/matrix-service-relogin-test-D3NQktoa.js +0 -59
- package/bundled-test-harness/assets/matrix-service-sliding-sync-test-6CAflWOA.js +0 -35
- package/bundled-test-harness/assets/menu-kUSaJIPq.js +0 -3562
- package/bundled-test-harness/assets/message-service-subscription-test-DaQdgDWi.js +0 -110
- package/bundled-test-harness/assets/message-service-test-BsGEgM_m.js +0 -144
- package/bundled-test-harness/assets/message-tool-test-BB_4kw1V.js +0 -33
- package/bundled-test-harness/assets/midi-audio-def-test-BbbkFjqf.js +0 -182
- package/bundled-test-harness/assets/migrate-skill-test-X9xImDuq.js +0 -161
- package/bundled-test-harness/assets/mini-AwF31elJ.js +0 -1404
- package/bundled-test-harness/assets/mini-card-chooser-test-BZtrEiWu.js +0 -272
- package/bundled-test-harness/assets/mini-file-chooser-test-MIHW3kCI.js +0 -201
- package/bundled-test-harness/assets/mock-matrix-Dd8k0DNa.js +0 -15107
- package/bundled-test-harness/assets/mock-matrix-DhPN_34j.js +0 -2
- package/bundled-test-harness/assets/modal-LTh3_oHK.js +0 -322
- package/bundled-test-harness/assets/model-cost-tier-test-h1IkU9mp.js +0 -174
- package/bundled-test-harness/assets/model-file-extract-test-ntSo0wZF.js +0 -206
- package/bundled-test-harness/assets/module-transpile-cache-test-CDeRaaeP.js +0 -67
- package/bundled-test-harness/assets/monaco-test-C0Fa744D.js +0 -100
- package/bundled-test-harness/assets/mp3-audio-def-test-B4j4qR9H.js +0 -133
- package/bundled-test-harness/assets/multiple-stacks-test-BhA25ywL.js +0 -208
- package/bundled-test-harness/assets/nested-query-field-render-test-S9Y8YNKB.js +0 -249
- package/bundled-test-harness/assets/no-stacks-test-B7VciWyg.js +0 -48
- package/bundled-test-harness/assets/number-field-test-CS74lDPN.js +0 -184
- package/bundled-test-harness/assets/office-file-def-test-2cKc1pmd.js +0 -263
- package/bundled-test-harness/assets/office-metadata-extractor-test-DC8Fo-OW.js +0 -218
- package/bundled-test-harness/assets/office-poster-capture-test-Ba0_5UrT.js +0 -203
- package/bundled-test-harness/assets/ogg-audio-def-test-CIPQ1d4w.js +0 -196
- package/bundled-test-harness/assets/open-create-listing-modal-test-bmQkY5Zl.js +0 -131
- package/bundled-test-harness/assets/open-image-in-new-tab-test-DBD7_vMH.js +0 -52
- package/bundled-test-harness/assets/open-secure-window-test-BgeuYAqz.js +0 -253
- package/bundled-test-harness/assets/open-workspace-test-DRHGljV0.js +0 -46
- package/bundled-test-harness/assets/operation-lowering-test-CH1c0pSH.js +0 -2957
- package/bundled-test-harness/assets/operations-invocation-test-B1YkCLrv.js +0 -523
- package/bundled-test-harness/assets/operations-optimistic-test-DAbtOwsC.js +0 -203
- package/bundled-test-harness/assets/operations-query-test-9p1ZIDe-.js +0 -459
- package/bundled-test-harness/assets/operations-store-reconciliation-test-D0EQh3w2.js +0 -406
- package/bundled-test-harness/assets/operations-test-BQhlrfe3.js +0 -2518
- package/bundled-test-harness/assets/operator-mode-acceptance-test-DtHnonEb.js +0 -1195
- package/bundled-test-harness/assets/operator-mode-card-chooser-test-DQUxZxaq.js +0 -1036
- package/bundled-test-harness/assets/operator-mode-links-test-BJ26HllS.js +0 -797
- package/bundled-test-harness/assets/operator-mode-test-DIPDI0qt.js +0 -696
- package/bundled-test-harness/assets/operator-mode-ui-test-CfA-fAh4.js +0 -1045
- package/bundled-test-harness/assets/overlay-DecPh3nt.js +0 -123
- package/bundled-test-harness/assets/overlay-menu-items-test-C6XqjLtu.js +0 -331
- package/bundled-test-harness/assets/overlays-Ctp8ePzZ.js +0 -75
- package/bundled-test-harness/assets/overlays-CzWpSg5T.js +0 -2
- package/bundled-test-harness/assets/overlays-detached-element-test-DvL_8Bb5.js +0 -56
- package/bundled-test-harness/assets/panel-CImumikB.js +0 -15124
- package/bundled-test-harness/assets/past-sessions-test-N6riGN_I.js +0 -321
- package/bundled-test-harness/assets/patch-fields-test-D30_-KwQ.js +0 -1014
- package/bundled-test-harness/assets/patch-instance-test-C5rGscZq.js +0 -348
- package/bundled-test-harness/assets/pdf-file-def-test-DtiqGRvZ.js +0 -111
- package/bundled-test-harness/assets/pdf-metadata-extractor-test-FU02KmdV.js +0 -130
- package/bundled-test-harness/assets/permission-checking-realm-test-DqdNJDwU.js +0 -306
- package/bundled-test-harness/assets/persist-module-inspector-view-test-BHOAgPVy.js +0 -60
- package/bundled-test-harness/assets/persist-scroll-position-test-qtmS518r.js +0 -254
- package/bundled-test-harness/assets/phone-number-field-test-DhdaM7uL.js +0 -73
- package/bundled-test-harness/assets/pill-menu-test-C9Mrrepl.js +0 -60
- package/bundled-test-harness/assets/plate-9n-sXyCw.js +0 -41
- package/bundled-test-harness/assets/plate-BnZcAk-_.js +0 -2
- package/bundled-test-harness/assets/player-Cu5b4LEJ.js +0 -82
- package/bundled-test-harness/assets/player-unk2mkxV.js +0 -2
- package/bundled-test-harness/assets/playground-BwA8wFGK.js +0 -58
- package/bundled-test-harness/assets/plural-field-components-test-CFNQKETg.js +0 -198
- package/bundled-test-harness/assets/png-image-def-test-DG5Vhlqb.js +0 -266
- package/bundled-test-harness/assets/policy-audit-confirmation-test-yfKU47LR.js +0 -155
- package/bundled-test-harness/assets/policy-scoped-search-test-BjQRDYqR.js +0 -339
- package/bundled-test-harness/assets/prerender-file-extract-test-CEU4SaAZ.js +0 -346
- package/bundled-test-harness/assets/prerender-html-test-CGB3ClCS.js +0 -670
- package/bundled-test-harness/assets/prerender-meta-test-xqc4fW_0.js +0 -614
- package/bundled-test-harness/assets/prerender-module-test-CI1TmZw-.js +0 -409
- package/bundled-test-harness/assets/prerender-persistence-block-test-Da0dJO_N.js +0 -124
- package/bundled-test-harness/assets/prerender-pre-model-error-test-BVLyhk8R.js +0 -61
- package/bundled-test-harness/assets/prerender-serialize-cycle-test-glJFfxHU.js +0 -134
- package/bundled-test-harness/assets/prerendered-html-read-test-Mp4L0VHQ.js +0 -191
- package/bundled-test-harness/assets/pretui-components-test-BBpA9UnA.js +0 -991
- package/bundled-test-harness/assets/pretui-components-test-BqFq7rw_.css +0 -730
- package/bundled-test-harness/assets/preview-format-test-C55Bwcur.js +0 -103
- package/bundled-test-harness/assets/preview-test-CTAhRGU8.js +0 -474
- package/bundled-test-harness/assets/process-card-test-UjqpuxB7.js +0 -94
- package/bundled-test-harness/assets/profile-settings-modal-C8bCgTMK.js +0 -989
- package/bundled-test-harness/assets/publish-realm-ixUB4FPK.js +0 -82
- package/bundled-test-harness/assets/publish-realm-test-CrrsdL4W.js +0 -210
- package/bundled-test-harness/assets/query-field-barrier-test-DjivFE93.js +0 -113
- package/bundled-test-harness/assets/query-field-error-sentinel-test-0HwnV4Mw.js +0 -201
- package/bundled-test-harness/assets/query-field-membership-status-test-C8yTTBkc.js +0 -323
- package/bundled-test-harness/assets/query-field-page-optin-test-D4l_GcII.js +0 -126
- package/bundled-test-harness/assets/query-field-schema-test-DDbcNNm5.js +0 -231
- package/bundled-test-harness/assets/query-field-search-throttle-test-CXp50Ax0.js +0 -154
- package/bundled-test-harness/assets/query-field-stale-prerender-test-DErzt-Cv.js +0 -152
- package/bundled-test-harness/assets/query-fields-test-Dz67fdSl.js +0 -535
- package/bundled-test-harness/assets/quick-look-test-B1ijDsh_.js +0 -139
- package/bundled-test-harness/assets/read-card-for-ai-assistant-test-DJxZ16H_.js +0 -91
- package/bundled-test-harness/assets/read-file-for-ai-assistant-test-BoRQkZ8c.js +0 -45
- package/bundled-test-harness/assets/read-source-test-Bl-NjchO.js +0 -67
- package/bundled-test-harness/assets/read-text-file-test-CP37CZoo.js +0 -124
- package/bundled-test-harness/assets/realm-CaK5mkT-.js +0 -2852
- package/bundled-test-harness/assets/realm-api-keys-BNUFWbGR.js +0 -579
- package/bundled-test-harness/assets/realm-api-keys-CkshxhXC.js +0 -2
- package/bundled-test-harness/assets/realm-api-keys-test-BP8xifjn.js +0 -109
- package/bundled-test-harness/assets/realm-api-keys-test-CwdK9YXp.js +0 -588
- package/bundled-test-harness/assets/realm-config-iKwE3Htp.js +0 -833
- package/bundled-test-harness/assets/realm-config-policy-standing-test-BgVEIDnB.js +0 -290
- package/bundled-test-harness/assets/realm-config-routing-rule-edit-test-BoJoKzmX.js +0 -274
- package/bundled-test-harness/assets/realm-config-settings-test-Kxw-GHye.js +0 -187
- package/bundled-test-harness/assets/realm-field-test-CdGOxrFb.js +0 -100
- package/bundled-test-harness/assets/realm-indexing-test-CHtsBV2b.js +0 -4380
- package/bundled-test-harness/assets/realm-policy-fitted-test--DhNZSdC.js +0 -206
- package/bundled-test-harness/assets/realm-policy-test-D7714iVa.js +0 -1141
- package/bundled-test-harness/assets/realm-querying-test-Cj1ekZ0H.js +0 -1067
- package/bundled-test-harness/assets/realm-server-form-agnostic-test-CZFPNJfD.js +0 -96
- package/bundled-test-harness/assets/realm-server-subscriber-test-C86WmBp0.js +0 -46
- package/bundled-test-harness/assets/realm-service-info-test-CdgcwKDR.js +0 -67
- package/bundled-test-harness/assets/realm-test-DPoLsvKz.js +0 -2364
- package/bundled-test-harness/assets/realm-token-refresh-test-Ch35Siwi.js +0 -153
- package/bundled-test-harness/assets/realm-url-tooltip-test-x8xWOENK.js +0 -78
- package/bundled-test-harness/assets/reasoning-test-BxpE8Jvf.js +0 -221
- package/bundled-test-harness/assets/recent-files-test-DTmEzPLq.js +0 -450
- package/bundled-test-harness/assets/reindex-realm-test-BQ8KULn4.js +0 -117
- package/bundled-test-harness/assets/relationship-loading-state-test-BJoArPWf.js +0 -290
- package/bundled-test-harness/assets/remix-card-test-DsTA1KoG.js +0 -58
- package/bundled-test-harness/assets/rendered-markdown-DvukulDO.js +0 -292
- package/bundled-test-harness/assets/rendered-markdown-test-DxGptXSV.js +0 -587
- package/bundled-test-harness/assets/resident-instance-reuse-test-ZWnVu8uj.js +0 -82
- package/bundled-test-harness/assets/result-tile-CPyI6Vmv.js +0 -144
- package/bundled-test-harness/assets/rich-markdown-field-test-CdygoXIO.js +0 -1647
- package/bundled-test-harness/assets/room-message-test-D3NfMqH0.js +0 -484
- package/bundled-test-harness/assets/run-D_Px28eF.js +0 -3956
- package/bundled-test-harness/assets/run-realm-code-qWCZxmJ7.js +0 -2964
- package/bundled-test-harness/assets/run-realm-code-test-UzyeEJq6.js +0 -3844
- package/bundled-test-harness/assets/sanitize-module-list-test-Babq44bP.js +0 -85
- package/bundled-test-harness/assets/save-card-skip-index-wait-test-BcELXlQ_.js +0 -89
- package/bundled-test-harness/assets/schema-editor-test-CEvruZbt.js +0 -785
- package/bundled-test-harness/assets/schema-generation-test-hYAMdCrn.js +0 -28
- package/bundled-test-harness/assets/scrolling-test-DVIsh-_1.js +0 -412
- package/bundled-test-harness/assets/search-adorn-test-CkVhqFd0.js +0 -136
- package/bundled-test-harness/assets/search-and-choose-test-DUhOB3FV.js +0 -154
- package/bundled-test-harness/assets/search-correlation-id-test-Drn4r26N.js +0 -139
- package/bundled-test-harness/assets/search-entries-result-test-DTCRJ_wc.js +0 -234
- package/bundled-test-harness/assets/search-entries-test-CE0B47pw.js +0 -1486
- package/bundled-test-harness/assets/search-entries-tool-test-C4aG0ckM.js +0 -504
- package/bundled-test-harness/assets/search-google-images-test-LyhcB2f3.js +0 -166
- package/bundled-test-harness/assets/search-results-D4pSne0x.js +0 -266
- package/bundled-test-harness/assets/search-results-test-CRZHhqhn.js +0 -578
- package/bundled-test-harness/assets/search-selection-menu-test-B7Y3E_nj.js +0 -108
- package/bundled-test-harness/assets/search-sheet-files-test-C2y534g8.js +0 -126
- package/bundled-test-harness/assets/search-sheet-persistence-test-DePC59Bk.js +0 -131
- package/bundled-test-harness/assets/search-test-Dy8NxFkU.js +0 -2249
- package/bundled-test-harness/assets/search-tool-test-lctDaMH3.js +0 -156
- package/bundled-test-harness/assets/searchable-option-test-CE64M8oM.js +0 -322
- package/bundled-test-harness/assets/searchable-search-doc-test-C6u3mVvT.js +0 -1271
- package/bundled-test-harness/assets/section-rail-B_UQX00B.js +0 -113
- package/bundled-test-harness/assets/section-rail-test-DIda7MIw.js +0 -256
- package/bundled-test-harness/assets/secure-sign-in-CqqqfQG8.js +0 -174
- package/bundled-test-harness/assets/secure-sign-in-test-DimbVr_W.js +0 -373
- package/bundled-test-harness/assets/segmented-control-iePxSdTS.js +0 -173
- package/bundled-test-harness/assets/select-tNs6_xwW.js +0 -175
- package/bundled-test-harness/assets/send-ai-assistant-message-test-2GVrMF9Z.js +0 -52
- package/bundled-test-harness/assets/send-bot-trigger-event-test-B_3dKfGN.js +0 -56
- package/bundled-test-harness/assets/send-request-via-proxy-test-_clNWyYc.js +0 -380
- package/bundled-test-harness/assets/sending-test-DCPFXUVg.js +0 -659
- package/bundled-test-harness/assets/serialization-rri-form-audit-test-BI0zCs8Y.js +0 -136
- package/bundled-test-harness/assets/serialization-test-bjdtVlZL.js +0 -8758
- package/bundled-test-harness/assets/set-user-system-card-test-BUv1vL08.js +0 -59
- package/bundled-test-harness/assets/setup-BW1mmC7C.js +0 -772
- package/bundled-test-harness/assets/setup-DsIcFT-T.js +0 -2
- package/bundled-test-harness/assets/shared-link-target-reuse-test-9NeJEjkb.js +0 -207
- package/bundled-test-harness/assets/show-card-test-mfyLwusD.js +0 -365
- package/bundled-test-harness/assets/signed-capture-link-test-BOtKNCAM.js +0 -132
- package/bundled-test-harness/assets/single-stack-test-B4MGjaLk.js +0 -652
- package/bundled-test-harness/assets/skills-test-BuP-Yzk1.js +0 -648
- package/bundled-test-harness/assets/skip-boot-index-guard-test-Cmrx2-K7.js +0 -46
- package/bundled-test-harness/assets/spec-test-BhZDdhVQ.js +0 -1077
- package/bundled-test-harness/assets/spinner-CpIBUG9m.js +0 -49
- package/bundled-test-harness/assets/src-DGHttmW-.js +0 -216
- package/bundled-test-harness/assets/src-DaNDSbp7.js +0 -5
- package/bundled-test-harness/assets/stick-to-bottom-resize-test-Dpy3OVum.js +0 -56
- package/bundled-test-harness/assets/store-add-test-_IYS8o74.js +0 -50
- package/bundled-test-harness/assets/store-module-rebuild-test-B5VMaICy.js +0 -454
- package/bundled-test-harness/assets/store-search-test-C2VZabrH.js +0 -175
- package/bundled-test-harness/assets/store-test-D6PObxoD.js +0 -3672
- package/bundled-test-harness/assets/structured-theme-test-BHjVeMf-.js +0 -377
- package/bundled-test-harness/assets/summarize-session-test-BFtTuhe0.js +0 -172
- package/bundled-test-harness/assets/svg-image-def-test-BL6lkWUX.js +0 -167
- package/bundled-test-harness/assets/switch-submode-test-6Uv3bZMl.js +0 -168
- package/bundled-test-harness/assets/sync-openrouter-models-test-Dp9E05tL.js +0 -97
- package/bundled-test-harness/assets/test-support-DYm8XZ0E.js +0 -3
- package/bundled-test-harness/assets/test-support-DfnhiIMV.js +0 -99
- package/bundled-test-harness/assets/tests-CZk0Iag2.js +0 -3596
- package/bundled-test-harness/assets/text-file-def-test-CHdC0yIU.js +0 -94
- package/bundled-test-harness/assets/text-input-validator-test-B9ZR8XPU.js +0 -156
- package/bundled-test-harness/assets/text-suggestion-test-CGLspKFQ.js +0 -340
- package/bundled-test-harness/assets/theme-card-test-CXZvSEvG.js +0 -621
- package/bundled-test-harness/assets/theme-dashboard-nav-test-CkEE0ILk.js +0 -196
- package/bundled-test-harness/assets/theme-scheme-island-test-URXTjipF.js +0 -264
- package/bundled-test-harness/assets/titles-C6enAdIv.js +0 -2
- package/bundled-test-harness/assets/titles-Dft1HoUT.js +0 -52
- package/bundled-test-harness/assets/to-device-streaming-test-D33ZOc9o.js +0 -163
- package/bundled-test-harness/assets/token-usage-test-BHQlU4J4.js +0 -160
- package/bundled-test-harness/assets/tools-CrudqfS3.js +0 -774
- package/bundled-test-harness/assets/tools-calling-test-jo7IREau.js +0 -200
- package/bundled-test-harness/assets/tools-test-D1wMfUa0.js +0 -1624
- package/bundled-test-harness/assets/tools-test-Dn1LYsXp.js +0 -3204
- package/bundled-test-harness/assets/tooltip-8Wyz4IIn.css +0 -68
- package/bundled-test-harness/assets/tooltip-CqwLzRz5.js +0 -134
- package/bundled-test-harness/assets/transform-cards-test-BPhwPFtp.js +0 -341
- package/bundled-test-harness/assets/ts-file-def-preview-test-Bq3zTgw8.js +0 -95
- package/bundled-test-harness/assets/ts-file-def-test-GLswMl7O.js +0 -92
- package/bundled-test-harness/assets/ttf-font-def-test-DQulvUWs.js +0 -206
- package/bundled-test-harness/assets/turn-settling-test-BspmOUQP.js +0 -160
- package/bundled-test-harness/assets/turn-summary-9A8nvC0-.js +0 -1039
- package/bundled-test-harness/assets/unpublish-realm-test-SkYPEhDz.js +0 -102
- package/bundled-test-harness/assets/update-room-skills-test-cTxb-WU6.js +0 -240
- package/bundled-test-harness/assets/use-ai-assistant-test-uaqW1T_A.js +0 -384
- package/bundled-test-harness/assets/user-message-BudkIP-3.js +0 -262
- package/bundled-test-harness/assets/validate-realm-test-DxrGgH9n.js +0 -67
- package/bundled-test-harness/assets/video-metadata-extractor-test-B2pe-Iqa.js +0 -520
- package/bundled-test-harness/assets/view-visually-test-PNon6fUo.js +0 -335
- package/bundled-test-harness/assets/virtual-network-reset-test-uYJLaQHf.js +0 -96
- package/bundled-test-harness/assets/wav-audio-def-test-F4OrFFR4.js +0 -160
- package/bundled-test-harness/assets/webp-image-def-test-B0a_-Vya.js +0 -226
- package/bundled-test-harness/assets/workspace-Cyftysy9.js +0 -440
- package/bundled-test-harness/assets/workspace-a11y-test-sKiPDcbl.js +0 -197
- package/bundled-test-harness/assets/workspace-actions-BuawjFmZ.js +0 -561
- package/bundled-test-harness/assets/workspace-behavior-test-CKa-pb3T.js +0 -338
- package/bundled-test-harness/assets/workspace-delete-multiple-test-Dt2weG5R.js +0 -212
- package/bundled-test-harness/assets/workspace-delete-summary-test-CkqgFqZ8.js +0 -63
- package/bundled-test-harness/assets/workspace-hosting-test-Ci7EEtHP.js +0 -138
- package/bundled-test-harness/assets/workspace-indexing-test-BPVxxY6W.js +0 -71
- package/bundled-test-harness/assets/workspace-test-CWr7vFbg.js +0 -385
- package/bundled-test-harness/assets/workspace-test-INNpQovc.js +0 -51
- package/bundled-test-harness/assets/workspace-timestamp-labels-test-CigQb5wr.js +0 -68
- package/bundled-test-harness/assets/workspace-unit-test-BwVKpuXT.js +0 -122
- package/bundled-test-harness/assets/write-binary-file-test-BKP3gv1k.js +0 -124
- package/bundled-test-harness/assets/write-text-file-test-B6ijTKTa.js +0 -191
- package/bundled-test-harness/assets/zip-archive-test-C-PBzkTn.js +0 -285
- package/bundled-test-harness/assets/zip-file-def-test-FyCzJT-9.js +0 -164
|
@@ -0,0 +1,2858 @@
|
|
|
1
|
+
import { i as __name, r as __exportAll } from "./chunk-Rp0pCe6z.js";
|
|
2
|
+
import { n as decorateMethodV2, r as initializeDeferredDecorator, t as decorateFieldV2 } from "./runtime--fcdnjmJ-BoCBNIsz.js";
|
|
3
|
+
import { An as X_BOXEL_LOGGING_CORRELATION_ID_HEADER, Co as SupportedMimeType, Et as joinDMRoom, Gs as publishRealm, Ks as unpublishRealm, Rc as Deferred, Tt as RealmAuthClient, Us as ReadinessTimeoutError, Ws as fetchPublishabilityReport, X as realmServerAuthorizationMiddleware, Za as fetcher, at as getMatrixUsername, br as REALMS_LIST_UPDATED_EVENT_TYPE, ks as logger, qs as waitForReady } from "./runtime-common-BTaLJEw-.js";
|
|
4
|
+
import { T as rri, a as RealmPaths, s as ensureTrailingSlash, w as ri } from "./paths-C9-NYXnM.js";
|
|
5
|
+
import { O as baseRealm } from "./constants-Icc0nFW-.js";
|
|
6
|
+
import { i as v4 } from "./esm-browser-CIYLo70w.js";
|
|
7
|
+
import { t as config } from "./environment-DIUJgBKt.js";
|
|
8
|
+
import { r as setOwner } from "./owner-CP0__uFm.js";
|
|
9
|
+
import { t as getOwner } from "./owner-BT6cj890.js";
|
|
10
|
+
import { wn as associateDestroyableChild } from "./cache-DtDz7X5V-Wn8jRDfL.js";
|
|
11
|
+
import { r as service, t as Service } from "./service-LFpJ8EEP.js";
|
|
12
|
+
import { n as registerDestructor } from "./destroyable-mdLYRn_o.js";
|
|
13
|
+
import { t as isTesting } from "./runtime-9O0mNd7j.js";
|
|
14
|
+
import { n as src_default } from "./src-DPaAwa4H.js";
|
|
15
|
+
import { d as RealmServerSessionLocalStorageKey, h as SessionLocalStorageKey } from "./local-storage-keys-CS7XLz7J.js";
|
|
16
|
+
import { n as clearServiceWorkerTokens, o as syncAllTokensToServiceWorker, s as syncTokenToServiceWorker } from "./auth-service-worker-registration-DUIv5x-m.js";
|
|
17
|
+
import { l as didCancel, m as rawTimeout, n as buildTask } from "./async-arrow-runtime-STsj7E8Y.js";
|
|
18
|
+
import { a as TrackedMap, i as TrackedSet, n as TrackedObject, r as TrackedArray } from "./dist-B9tGPKZz.js";
|
|
19
|
+
import { n as tracked, t as cached } from "./tracking-800VJb8b.js";
|
|
20
|
+
import "./dist-DEVZvbin.js";
|
|
21
|
+
import { a as waitForPromise, t as buildWaiter } from "./dist-CSQ-y1Ft.js";
|
|
22
|
+
import { a as realmURLDisplayText, o as resolvedRealmURLHref } from "./realm-utils-C4Js9BAW.js";
|
|
23
|
+
import { n as reportFromRejectionEvent, t as reportFromErrorEvent } from "./error-report-BdUCQetr.js";
|
|
24
|
+
import { n as normalizeEndpoint, t as codeRefURL } from "./client-telemetry-labels-Bu3IpYiW.js";
|
|
25
|
+
import { n as maxTokenRefreshBackoffSec, t as TokenRefreshSchedule } from "./token-refresh-schedule-D8OzMzA2.js";
|
|
26
|
+
//#region app/lib/client-telemetry-env.ts
|
|
27
|
+
function now() {
|
|
28
|
+
return typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
29
|
+
}
|
|
30
|
+
function isDocumentHidden() {
|
|
31
|
+
return typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
32
|
+
}
|
|
33
|
+
function byteLength(s) {
|
|
34
|
+
try {
|
|
35
|
+
return new TextEncoder().encode(s).length;
|
|
36
|
+
} catch {
|
|
37
|
+
return s.length;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function supportedEntryTypes() {
|
|
41
|
+
return PerformanceObserver.supportedEntryTypes ?? [];
|
|
42
|
+
}
|
|
43
|
+
function nextTick() {
|
|
44
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
45
|
+
}
|
|
46
|
+
function isRenderContext() {
|
|
47
|
+
return Boolean(globalThis.__boxelRenderContext);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region app/services/client-telemetry.ts
|
|
51
|
+
var client_telemetry_exports = /* @__PURE__ */ __exportAll({
|
|
52
|
+
createServerRequestTimingMiddleware: () => createServerRequestTimingMiddleware,
|
|
53
|
+
default: () => ClientTelemetryService
|
|
54
|
+
});
|
|
55
|
+
var FLUSH_INTERVAL_MS = 1e3;
|
|
56
|
+
var KEEPALIVE_INTERVAL_MS = 25e3;
|
|
57
|
+
var HEARTBEAT_INTERVAL_MS = 100;
|
|
58
|
+
var CARD_LOAD_WATCHDOG_MS = 3e4;
|
|
59
|
+
var WEDGE_GAP_MS = 1e4;
|
|
60
|
+
var WEDGE_CORROBORATION_GRACE_MS = 120;
|
|
61
|
+
var WEDGE_CORROBORATION_RETRIES = 2;
|
|
62
|
+
var MAX_BUFFERED_EVENTS = 400;
|
|
63
|
+
var MAX_EVENTS_PER_FLUSH = 400;
|
|
64
|
+
var MAX_FLUSH_BODY_BYTES = 60 * 1024;
|
|
65
|
+
var MAX_LOADED_IDS = 50;
|
|
66
|
+
var MAX_SLOWEST_LOADS = 10;
|
|
67
|
+
var MAX_ERROR_EVENTS_PER_FLUSH = 12;
|
|
68
|
+
var MAX_FOLDED_SIGNATURES = 500;
|
|
69
|
+
var MAX_LOAF_SCRIPTS = 10;
|
|
70
|
+
var MAX_PROFILER_STACKS = 12;
|
|
71
|
+
var MAX_PROFILER_FRAMES = 32;
|
|
72
|
+
var MAX_LOAF_HISTORY = 100;
|
|
73
|
+
var MAX_PROFILER_SAMPLES = 400;
|
|
74
|
+
var PROFILER_SAMPLE_INTERVAL_MS = 50;
|
|
75
|
+
var PROFILER_HARVEST_INTERVAL_MS = 2e3;
|
|
76
|
+
var ClientTelemetryService = class extends Service {
|
|
77
|
+
static {
|
|
78
|
+
decorateFieldV2(this.prototype, "realmServer", [service]);
|
|
79
|
+
}
|
|
80
|
+
#realmServer = (initializeDeferredDecorator(this, "realmServer"), void 0);
|
|
81
|
+
static {
|
|
82
|
+
decorateFieldV2(this.prototype, "matrixService", [service]);
|
|
83
|
+
}
|
|
84
|
+
#matrixService = (initializeDeferredDecorator(this, "matrixService"), void 0);
|
|
85
|
+
static {
|
|
86
|
+
decorateFieldV2(this.prototype, "session", [service]);
|
|
87
|
+
}
|
|
88
|
+
#session = (initializeDeferredDecorator(this, "session"), void 0);
|
|
89
|
+
static {
|
|
90
|
+
decorateFieldV2(this.prototype, "store", [service]);
|
|
91
|
+
}
|
|
92
|
+
#store = (initializeDeferredDecorator(this, "store"), void 0);
|
|
93
|
+
static {
|
|
94
|
+
decorateFieldV2(this.prototype, "operatorModeStateService", [service]);
|
|
95
|
+
}
|
|
96
|
+
#operatorModeStateService = (initializeDeferredDecorator(this, "operatorModeStateService"), void 0);
|
|
97
|
+
#sessionId = v4();
|
|
98
|
+
#matrixUserId = null;
|
|
99
|
+
#buffer = [];
|
|
100
|
+
#started = false;
|
|
101
|
+
#testOptIn = false;
|
|
102
|
+
#flushTimer;
|
|
103
|
+
#heartbeatTimer;
|
|
104
|
+
#profilerHarvestTimer;
|
|
105
|
+
#loafObserver;
|
|
106
|
+
#longtaskObserver;
|
|
107
|
+
#profiler;
|
|
108
|
+
#profilerSampled;
|
|
109
|
+
#visibilityHandler;
|
|
110
|
+
#pagehideHandler;
|
|
111
|
+
#errorHandler;
|
|
112
|
+
#rejectionHandler;
|
|
113
|
+
#lastKeepaliveAt = now();
|
|
114
|
+
#maxGapSinceKeepalive = 0;
|
|
115
|
+
#lastHeartbeatAt = now();
|
|
116
|
+
#loafHistory = [];
|
|
117
|
+
#longtaskHistory = [];
|
|
118
|
+
#profilerSamples = [];
|
|
119
|
+
#lastLoadGeneration = 0;
|
|
120
|
+
#cardLoadWindowOpen = false;
|
|
121
|
+
#errorDedup = /* @__PURE__ */ new Map();
|
|
122
|
+
#foldedSignatures = /* @__PURE__ */ new Set();
|
|
123
|
+
#errorEventsSinceFlush = 0;
|
|
124
|
+
#reportingError = false;
|
|
125
|
+
constructor(owner) {
|
|
126
|
+
super(owner);
|
|
127
|
+
this.session.register(this);
|
|
128
|
+
this.start();
|
|
129
|
+
registerDestructor(this, () => this.teardown());
|
|
130
|
+
}
|
|
131
|
+
teardown() {
|
|
132
|
+
try {
|
|
133
|
+
this.#flush("teardown");
|
|
134
|
+
} finally {
|
|
135
|
+
this.stop();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
get isEnabled() {
|
|
139
|
+
return this.#started;
|
|
140
|
+
}
|
|
141
|
+
enableForTest() {
|
|
142
|
+
this.#testOptIn = true;
|
|
143
|
+
this.start();
|
|
144
|
+
}
|
|
145
|
+
drainBufferForTest() {
|
|
146
|
+
let events = this.#buffer;
|
|
147
|
+
this.#buffer = [];
|
|
148
|
+
this.#forgetErrorEvents(events);
|
|
149
|
+
return events;
|
|
150
|
+
}
|
|
151
|
+
sessionStarted() {
|
|
152
|
+
this.#captureMatrixUserId();
|
|
153
|
+
this.start();
|
|
154
|
+
}
|
|
155
|
+
resetState() {
|
|
156
|
+
try {
|
|
157
|
+
this.#flush("reset");
|
|
158
|
+
} finally {
|
|
159
|
+
this.#buffer = [];
|
|
160
|
+
this.#matrixUserId = null;
|
|
161
|
+
this.stop();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
recordEvent(evt) {
|
|
165
|
+
if (!this.#started) return;
|
|
166
|
+
try {
|
|
167
|
+
this.#push({
|
|
168
|
+
...evt,
|
|
169
|
+
ts: Date.now()
|
|
170
|
+
});
|
|
171
|
+
} catch (e) {
|
|
172
|
+
console.error("client-telemetry recordEvent failed", e);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
recordServerRequestTiming(req, response, durationMs, retried) {
|
|
176
|
+
if (!this.#started) return;
|
|
177
|
+
try {
|
|
178
|
+
let realm = response.headers.get("x-boxel-realm-url") || null;
|
|
179
|
+
let searchCache = response.headers.get("x-boxel-live-search-cache");
|
|
180
|
+
let contentLength = response.headers.get("content-length");
|
|
181
|
+
let respBytes = contentLength ? Number(contentLength) : 0;
|
|
182
|
+
let endpoint = normalizeEndpoint(req.url, req.method);
|
|
183
|
+
if (retried) for (let i = this.#buffer.length - 1; i >= 0; i--) {
|
|
184
|
+
let ev = this.#buffer[i];
|
|
185
|
+
if (ev.event_type === "server-request" && ev.endpoint === endpoint && ev.status === 401) {
|
|
186
|
+
this.#buffer.splice(i, 1);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
this.recordEvent({
|
|
191
|
+
event_type: "server-request",
|
|
192
|
+
endpoint,
|
|
193
|
+
method: req.method,
|
|
194
|
+
status: response.status,
|
|
195
|
+
duration_ms: Math.round(durationMs),
|
|
196
|
+
resp_bytes: Number.isFinite(respBytes) ? respBytes : 0,
|
|
197
|
+
correlation_id: req.headers.get("x-boxel-logging-correlation-id") || null,
|
|
198
|
+
retried,
|
|
199
|
+
realm,
|
|
200
|
+
...searchCache ? { search_cache: searchCache } : {}
|
|
201
|
+
});
|
|
202
|
+
} catch (e) {
|
|
203
|
+
console.error("client-telemetry recordServerRequestTiming failed", e);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
recordDeserialize(args) {
|
|
207
|
+
if (!this.#started) return;
|
|
208
|
+
try {
|
|
209
|
+
let { durationMs, doc, resource } = args;
|
|
210
|
+
let stamped = doc?.[Symbol.for("boxel-doc-response-bytes")];
|
|
211
|
+
let docBytes = typeof stamped === "number" ? stamped : 0;
|
|
212
|
+
let included = doc?.included;
|
|
213
|
+
let realm = typeof resource?.meta?.realmURL === "string" ? resource.meta.realmURL : null;
|
|
214
|
+
this.recordEvent({
|
|
215
|
+
event_type: "deserialize",
|
|
216
|
+
duration_ms: Math.round(durationMs),
|
|
217
|
+
doc_bytes: docBytes,
|
|
218
|
+
included_count: Array.isArray(included) ? included.length : 0,
|
|
219
|
+
card_type: codeRefURL(resource?.meta?.adoptsFrom, resource?.id),
|
|
220
|
+
realm
|
|
221
|
+
});
|
|
222
|
+
} catch (e) {
|
|
223
|
+
console.error("client-telemetry recordDeserialize failed", e);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
start() {
|
|
227
|
+
if (this.#started || !this.#isAllowed()) return;
|
|
228
|
+
this.#started = true;
|
|
229
|
+
this.#captureMatrixUserId();
|
|
230
|
+
this.#lastLoadGeneration = this.#safeLoadGeneration();
|
|
231
|
+
let n = now();
|
|
232
|
+
this.#lastKeepaliveAt = n;
|
|
233
|
+
this.#lastHeartbeatAt = n;
|
|
234
|
+
this.#maxGapSinceKeepalive = 0;
|
|
235
|
+
this.#startFlushLoop();
|
|
236
|
+
this.#startHeartbeat();
|
|
237
|
+
this.#startWedgeObservers();
|
|
238
|
+
this.#startProfiler();
|
|
239
|
+
this.#attachLifecycleListeners();
|
|
240
|
+
}
|
|
241
|
+
stop() {
|
|
242
|
+
if (!this.#started) return;
|
|
243
|
+
this.#started = false;
|
|
244
|
+
if (this.#flushTimer !== void 0) {
|
|
245
|
+
clearInterval(this.#flushTimer);
|
|
246
|
+
this.#flushTimer = void 0;
|
|
247
|
+
}
|
|
248
|
+
if (this.#heartbeatTimer !== void 0) {
|
|
249
|
+
clearInterval(this.#heartbeatTimer);
|
|
250
|
+
this.#heartbeatTimer = void 0;
|
|
251
|
+
}
|
|
252
|
+
if (this.#profilerHarvestTimer !== void 0) {
|
|
253
|
+
clearInterval(this.#profilerHarvestTimer);
|
|
254
|
+
this.#profilerHarvestTimer = void 0;
|
|
255
|
+
}
|
|
256
|
+
if (this.#loafObserver) {
|
|
257
|
+
try {
|
|
258
|
+
this.#loafObserver.disconnect();
|
|
259
|
+
} catch {}
|
|
260
|
+
this.#loafObserver = void 0;
|
|
261
|
+
}
|
|
262
|
+
if (this.#longtaskObserver) {
|
|
263
|
+
try {
|
|
264
|
+
this.#longtaskObserver.disconnect();
|
|
265
|
+
} catch {}
|
|
266
|
+
this.#longtaskObserver = void 0;
|
|
267
|
+
}
|
|
268
|
+
if (this.#profiler) {
|
|
269
|
+
let p = this.#profiler;
|
|
270
|
+
this.#profiler = void 0;
|
|
271
|
+
Promise.resolve().then(() => p.stop()).catch(() => {});
|
|
272
|
+
}
|
|
273
|
+
this.#detachLifecycleListeners();
|
|
274
|
+
this.#loafHistory = [];
|
|
275
|
+
this.#longtaskHistory = [];
|
|
276
|
+
this.#profilerSamples = [];
|
|
277
|
+
this.#cardLoadWindowOpen = false;
|
|
278
|
+
this.#errorDedup.clear();
|
|
279
|
+
this.#foldedSignatures.clear();
|
|
280
|
+
this.#errorEventsSinceFlush = 0;
|
|
281
|
+
}
|
|
282
|
+
#isAllowed() {
|
|
283
|
+
if (isRenderContext()) return false;
|
|
284
|
+
if (isTesting() && !this.#testOptIn) return false;
|
|
285
|
+
if (typeof window === "undefined" || typeof setInterval !== "function") return false;
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
#captureMatrixUserId() {
|
|
289
|
+
try {
|
|
290
|
+
this.#matrixUserId = this.matrixService.userId ?? null;
|
|
291
|
+
} catch {
|
|
292
|
+
this.#matrixUserId = null;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
#safeLoadGeneration() {
|
|
296
|
+
try {
|
|
297
|
+
return this.store.loadGeneration ?? 0;
|
|
298
|
+
} catch {
|
|
299
|
+
return 0;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
#startFlushLoop() {
|
|
303
|
+
this.#flushTimer = setInterval(() => {
|
|
304
|
+
try {
|
|
305
|
+
this.#onFlushTick();
|
|
306
|
+
} catch (e) {
|
|
307
|
+
console.error("client-telemetry flush tick failed", e);
|
|
308
|
+
}
|
|
309
|
+
}, FLUSH_INTERVAL_MS);
|
|
310
|
+
}
|
|
311
|
+
#onFlushTick() {
|
|
312
|
+
if (this.#buffer.some((e) => e.event_type !== "keepalive")) {
|
|
313
|
+
this.#flush("signal");
|
|
314
|
+
this.#lastKeepaliveAt = now();
|
|
315
|
+
this.#maxGapSinceKeepalive = 0;
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
let elapsed = now() - this.#lastKeepaliveAt;
|
|
319
|
+
if (elapsed >= KEEPALIVE_INTERVAL_MS) {
|
|
320
|
+
this.recordEvent({
|
|
321
|
+
event_type: "keepalive",
|
|
322
|
+
window_ms: Math.round(elapsed),
|
|
323
|
+
max_gap_ms: Math.round(this.#maxGapSinceKeepalive)
|
|
324
|
+
});
|
|
325
|
+
this.#lastKeepaliveAt = now();
|
|
326
|
+
this.#maxGapSinceKeepalive = 0;
|
|
327
|
+
this.#flush("keepalive");
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
#flush(_reason) {
|
|
331
|
+
if (this.#buffer.length === 0) return;
|
|
332
|
+
let token;
|
|
333
|
+
try {
|
|
334
|
+
token = this.realmServer.token;
|
|
335
|
+
} catch {
|
|
336
|
+
token = void 0;
|
|
337
|
+
}
|
|
338
|
+
if (!token) return;
|
|
339
|
+
let origin;
|
|
340
|
+
try {
|
|
341
|
+
origin = this.realmServer.url.origin;
|
|
342
|
+
} catch {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
let chunk = this.#buffer.slice(0, MAX_EVENTS_PER_FLUSH);
|
|
346
|
+
let body = this.#buildBody(chunk);
|
|
347
|
+
while (chunk.length > 1 && byteLength(body) > MAX_FLUSH_BODY_BYTES) {
|
|
348
|
+
chunk = chunk.slice(0, Math.ceil(chunk.length / 2));
|
|
349
|
+
body = this.#buildBody(chunk);
|
|
350
|
+
}
|
|
351
|
+
this.#buffer.splice(0, chunk.length);
|
|
352
|
+
this.#closeErrorWindow(chunk);
|
|
353
|
+
try {
|
|
354
|
+
globalThis.fetch(`${origin}/_client-telemetry`, {
|
|
355
|
+
method: "POST",
|
|
356
|
+
keepalive: true,
|
|
357
|
+
headers: {
|
|
358
|
+
Authorization: `Bearer ${token}`,
|
|
359
|
+
"Content-Type": "application/json"
|
|
360
|
+
},
|
|
361
|
+
body
|
|
362
|
+
}).catch(() => {});
|
|
363
|
+
} catch {}
|
|
364
|
+
}
|
|
365
|
+
#buildBody(events) {
|
|
366
|
+
let appVersion = typeof config.APP?.version === "string" ? config.APP.version : void 0;
|
|
367
|
+
return JSON.stringify({
|
|
368
|
+
v: 1,
|
|
369
|
+
session_id: this.#sessionId,
|
|
370
|
+
matrix_user_id: this.#matrixUserId,
|
|
371
|
+
env: config.hostedEnvironment,
|
|
372
|
+
...appVersion ? { app_version: appVersion } : {},
|
|
373
|
+
events
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
#push(evt) {
|
|
377
|
+
this.#buffer.push(evt);
|
|
378
|
+
if (this.#buffer.length > MAX_BUFFERED_EVENTS) this.#forgetErrorEvents(this.#buffer.splice(0, this.#buffer.length - MAX_BUFFERED_EVENTS));
|
|
379
|
+
}
|
|
380
|
+
#forgetErrorEvents(departed) {
|
|
381
|
+
if (this.#errorDedup.size > 0 && departed.length > 0) {
|
|
382
|
+
let gone = new Set(departed);
|
|
383
|
+
for (let [key, evt] of this.#errorDedup) if (gone.has(evt)) this.#errorDedup.delete(key);
|
|
384
|
+
}
|
|
385
|
+
this.#errorEventsSinceFlush = this.#errorDedup.size;
|
|
386
|
+
}
|
|
387
|
+
#onWindowError(event) {
|
|
388
|
+
if (!(event instanceof ErrorEvent)) return;
|
|
389
|
+
this.#reportError(() => reportFromErrorEvent(event));
|
|
390
|
+
}
|
|
391
|
+
#onUnhandledRejection(event) {
|
|
392
|
+
this.#reportError(() => reportFromRejectionEvent(event));
|
|
393
|
+
}
|
|
394
|
+
#reportError(buildReport) {
|
|
395
|
+
if (!this.#started || this.#reportingError || isRenderContext()) return;
|
|
396
|
+
this.#reportingError = true;
|
|
397
|
+
try {
|
|
398
|
+
let { signature, ...fields } = buildReport();
|
|
399
|
+
let key = signature;
|
|
400
|
+
let folded = 0;
|
|
401
|
+
let pending = this.#errorDedup.get(signature);
|
|
402
|
+
if (pending) {
|
|
403
|
+
pending.dedup_count++;
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
if (this.#errorEventsSinceFlush >= MAX_ERROR_EVENTS_PER_FLUSH - 1) {
|
|
407
|
+
let overflow = this.#errorDedup.get(OVERFLOW_ERROR_KEY);
|
|
408
|
+
if (overflow) {
|
|
409
|
+
overflow.dedup_count++;
|
|
410
|
+
if (!this.#foldedSignatures.has(signature) && this.#foldedSignatures.size < MAX_FOLDED_SIGNATURES) {
|
|
411
|
+
this.#foldedSignatures.add(signature);
|
|
412
|
+
overflow.folded_signatures = this.#foldedSignatures.size;
|
|
413
|
+
}
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
key = OVERFLOW_ERROR_KEY;
|
|
417
|
+
this.#foldedSignatures.clear();
|
|
418
|
+
this.#foldedSignatures.add(signature);
|
|
419
|
+
folded = 1;
|
|
420
|
+
}
|
|
421
|
+
let evt = {
|
|
422
|
+
event_type: "client-error",
|
|
423
|
+
ts: Date.now(),
|
|
424
|
+
...fields,
|
|
425
|
+
dedup_count: 1,
|
|
426
|
+
folded_signatures: folded,
|
|
427
|
+
realm: this.#currentCardContext().realm
|
|
428
|
+
};
|
|
429
|
+
this.#push(evt);
|
|
430
|
+
this.#errorDedup.set(key, evt);
|
|
431
|
+
this.#errorEventsSinceFlush++;
|
|
432
|
+
} catch (e) {
|
|
433
|
+
console.error("client-telemetry error report failed", e);
|
|
434
|
+
} finally {
|
|
435
|
+
this.#reportingError = false;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
#closeErrorWindow(sent) {
|
|
439
|
+
this.#errorDedup.delete(OVERFLOW_ERROR_KEY);
|
|
440
|
+
this.#foldedSignatures.clear();
|
|
441
|
+
this.#forgetErrorEvents(sent);
|
|
442
|
+
}
|
|
443
|
+
#startHeartbeat() {
|
|
444
|
+
this.#lastHeartbeatAt = now();
|
|
445
|
+
this.#heartbeatTimer = setInterval(() => {
|
|
446
|
+
try {
|
|
447
|
+
this.#onHeartbeat();
|
|
448
|
+
} catch (e) {
|
|
449
|
+
console.error("client-telemetry heartbeat failed", e);
|
|
450
|
+
}
|
|
451
|
+
}, HEARTBEAT_INTERVAL_MS);
|
|
452
|
+
}
|
|
453
|
+
#onHeartbeat() {
|
|
454
|
+
let n = now();
|
|
455
|
+
let gap = n - this.#lastHeartbeatAt;
|
|
456
|
+
this.#lastHeartbeatAt = n;
|
|
457
|
+
if (isDocumentHidden()) return;
|
|
458
|
+
if (gap > this.#maxGapSinceKeepalive) this.#maxGapSinceKeepalive = gap;
|
|
459
|
+
if (gap >= WEDGE_GAP_MS) {
|
|
460
|
+
let windowStart = n - gap;
|
|
461
|
+
setTimeout(() => this.#emitWedge(windowStart, n, gap), 0);
|
|
462
|
+
}
|
|
463
|
+
this.#pollCardLoad();
|
|
464
|
+
}
|
|
465
|
+
#emitWedge(windowStart, windowEnd, gap, retriesLeft = WEDGE_CORROBORATION_RETRIES) {
|
|
466
|
+
if (!this.#started) return;
|
|
467
|
+
let loafInWindow = this.#loafHistory.filter((e) => e.startTime >= windowStart && e.startTime <= windowEnd);
|
|
468
|
+
let longtasksInWindow = this.#longtaskHistory.filter((e) => e.startTime >= windowStart && e.startTime <= windowEnd);
|
|
469
|
+
if (Boolean(this.#loafObserver || this.#longtaskObserver) && loafInWindow.length === 0 && longtasksInWindow.length === 0) {
|
|
470
|
+
if (retriesLeft > 0) setTimeout(() => this.#emitWedge(windowStart, windowEnd, gap, retriesLeft - 1), WEDGE_CORROBORATION_GRACE_MS);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
let blockedMs = 0;
|
|
474
|
+
let scripts = [];
|
|
475
|
+
for (let entry of loafInWindow) {
|
|
476
|
+
blockedMs += entry.blockingDuration || 0;
|
|
477
|
+
for (let s of entry.scripts) scripts.push({
|
|
478
|
+
source_url: String(s.sourceURL ?? s.name ?? ""),
|
|
479
|
+
function_name: String(s.sourceFunctionName ?? ""),
|
|
480
|
+
char_position: Number(s.sourceCharPosition ?? -1),
|
|
481
|
+
invoker: String(s.invoker ?? ""),
|
|
482
|
+
blocking_duration_ms: Math.round(Number(s.duration ?? 0))
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
if (loafInWindow.length === 0) for (let entry of longtasksInWindow) blockedMs += entry.duration || 0;
|
|
486
|
+
scripts.sort((a, b) => b.blocking_duration_ms - a.blocking_duration_ms);
|
|
487
|
+
let topFrame = scripts[0];
|
|
488
|
+
let topFrames = scripts.slice(0, 3).map((s) => `${s.function_name || "(anonymous)"} @ ${s.source_url || "?"}:${s.char_position}`).join(" | ");
|
|
489
|
+
let longtaskCount = loafInWindow.length > 0 ? loafInWindow.length : longtasksInWindow.length;
|
|
490
|
+
let profilerStacks = this.#profilerSamplesInWindow(windowStart, windowEnd);
|
|
491
|
+
this.recordEvent({
|
|
492
|
+
event_type: "wedge",
|
|
493
|
+
duration_ms: Math.round(gap),
|
|
494
|
+
worst_gap_ms: Math.round(gap),
|
|
495
|
+
blocked_ms: Math.round(blockedMs),
|
|
496
|
+
longtask_count: longtaskCount,
|
|
497
|
+
top_frame_function: topFrame?.function_name ?? "",
|
|
498
|
+
top_frame_url: topFrame?.source_url ?? "",
|
|
499
|
+
top_frame_char: topFrame?.char_position ?? -1,
|
|
500
|
+
top_frame_blocked_ms: topFrame?.blocking_duration_ms ?? 0,
|
|
501
|
+
top_frames: topFrames,
|
|
502
|
+
loaf_scripts: scripts.slice(0, MAX_LOAF_SCRIPTS),
|
|
503
|
+
...profilerStacks.length > 0 ? { profiler_stacks: profilerStacks.slice(0, MAX_PROFILER_STACKS) } : {}
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
#pollCardLoad() {
|
|
507
|
+
let gen = this.#safeLoadGeneration();
|
|
508
|
+
if (gen < this.#lastLoadGeneration) {
|
|
509
|
+
this.#lastLoadGeneration = gen;
|
|
510
|
+
this.#cardLoadWindowOpen = false;
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
if (gen > this.#lastLoadGeneration) {
|
|
514
|
+
let startGeneration = this.#lastLoadGeneration;
|
|
515
|
+
this.#lastLoadGeneration = gen;
|
|
516
|
+
if (!this.#cardLoadWindowOpen) this.#openCardLoadWindow(startGeneration);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
#openCardLoadWindow(startGeneration) {
|
|
520
|
+
this.#cardLoadWindowOpen = true;
|
|
521
|
+
let startedAt = now();
|
|
522
|
+
let { cardId, realm } = this.#currentCardContext();
|
|
523
|
+
this.#awaitCardLoad(startGeneration, startedAt, cardId, realm);
|
|
524
|
+
}
|
|
525
|
+
async #awaitCardLoad(startGeneration, startedAt, cardId, realm) {
|
|
526
|
+
try {
|
|
527
|
+
await Promise.race([this.store.loaded(), new Promise((resolve) => setTimeout(resolve, CARD_LOAD_WATCHDOG_MS))]);
|
|
528
|
+
let loadingMs = now() - startedAt;
|
|
529
|
+
await nextTick();
|
|
530
|
+
let settleMs = now() - startedAt;
|
|
531
|
+
let endGeneration = this.#safeLoadGeneration();
|
|
532
|
+
let numLoads = Math.max(0, endGeneration - startGeneration);
|
|
533
|
+
let recent = this.#recentCardDocLoads().filter((r) => (r.generation ?? 0) > startGeneration);
|
|
534
|
+
let loadedIds = recent.map((r) => r.url).slice(0, MAX_LOADED_IDS);
|
|
535
|
+
let slowest = [...recent].sort((a, b) => b.ms - a.ms).slice(0, MAX_SLOWEST_LOADS).map((r) => ({
|
|
536
|
+
id: r.url,
|
|
537
|
+
ms: Math.round(r.ms),
|
|
538
|
+
outcome: r.outcome ?? "ok"
|
|
539
|
+
}));
|
|
540
|
+
this.recordEvent({
|
|
541
|
+
event_type: "card-load",
|
|
542
|
+
card_id: cardId,
|
|
543
|
+
realm,
|
|
544
|
+
loading_ms: Math.round(loadingMs),
|
|
545
|
+
settle_ms: Math.round(settleMs),
|
|
546
|
+
num_loads: numLoads,
|
|
547
|
+
loaded_ids: loadedIds,
|
|
548
|
+
slowest_loads: slowest
|
|
549
|
+
});
|
|
550
|
+
} catch (e) {
|
|
551
|
+
console.error("client-telemetry card-load window failed", e);
|
|
552
|
+
} finally {
|
|
553
|
+
this.#cardLoadWindowOpen = false;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
#currentCardContext() {
|
|
557
|
+
let cardId = "";
|
|
558
|
+
let realm = null;
|
|
559
|
+
try {
|
|
560
|
+
let items = this.operatorModeStateService.topMostStackItems();
|
|
561
|
+
cardId = items[items.length - 1]?.id ?? "";
|
|
562
|
+
} catch {
|
|
563
|
+
cardId = "";
|
|
564
|
+
}
|
|
565
|
+
try {
|
|
566
|
+
realm = this.operatorModeStateService.realmURL ?? null;
|
|
567
|
+
} catch {
|
|
568
|
+
realm = null;
|
|
569
|
+
}
|
|
570
|
+
return {
|
|
571
|
+
cardId,
|
|
572
|
+
realm
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
#recentCardDocLoads() {
|
|
576
|
+
try {
|
|
577
|
+
return this.store.recentCardDocLoads();
|
|
578
|
+
} catch {
|
|
579
|
+
return [];
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
#startWedgeObservers() {
|
|
583
|
+
if (typeof PerformanceObserver === "undefined") return;
|
|
584
|
+
let supported = supportedEntryTypes();
|
|
585
|
+
if (supported.includes("long-animation-frame")) try {
|
|
586
|
+
this.#loafObserver = new PerformanceObserver((list) => {
|
|
587
|
+
for (let entry of list.getEntries()) {
|
|
588
|
+
let e = entry;
|
|
589
|
+
this.#loafHistory.push({
|
|
590
|
+
startTime: e.startTime,
|
|
591
|
+
duration: e.duration,
|
|
592
|
+
blockingDuration: e.blockingDuration ?? 0,
|
|
593
|
+
scripts: Array.isArray(e.scripts) ? e.scripts : []
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
if (this.#loafHistory.length > MAX_LOAF_HISTORY) this.#loafHistory.splice(0, this.#loafHistory.length - MAX_LOAF_HISTORY);
|
|
597
|
+
});
|
|
598
|
+
this.#loafObserver.observe({
|
|
599
|
+
type: "long-animation-frame",
|
|
600
|
+
buffered: true
|
|
601
|
+
});
|
|
602
|
+
} catch {
|
|
603
|
+
this.#loafObserver = void 0;
|
|
604
|
+
}
|
|
605
|
+
else if (supported.includes("longtask")) try {
|
|
606
|
+
this.#longtaskObserver = new PerformanceObserver((list) => {
|
|
607
|
+
for (let entry of list.getEntries()) this.#longtaskHistory.push({
|
|
608
|
+
startTime: entry.startTime,
|
|
609
|
+
duration: entry.duration
|
|
610
|
+
});
|
|
611
|
+
if (this.#longtaskHistory.length > MAX_LOAF_HISTORY) this.#longtaskHistory.splice(0, this.#longtaskHistory.length - MAX_LOAF_HISTORY);
|
|
612
|
+
});
|
|
613
|
+
this.#longtaskObserver.observe({
|
|
614
|
+
type: "longtask",
|
|
615
|
+
buffered: true
|
|
616
|
+
});
|
|
617
|
+
} catch {
|
|
618
|
+
this.#longtaskObserver = void 0;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
#profilerSampledIn() {
|
|
622
|
+
if (this.#profilerSampled === void 0) {
|
|
623
|
+
let cfg = config;
|
|
624
|
+
if (cfg.clientTelemetryProfiler === false) this.#profilerSampled = false;
|
|
625
|
+
else {
|
|
626
|
+
let rate = typeof cfg.clientTelemetryProfilerSampleRate === "number" ? cfg.clientTelemetryProfilerSampleRate : config.environment === "production" ? .05 : 1;
|
|
627
|
+
this.#profilerSampled = rate >= 1 ? true : rate <= 0 ? false : Math.random() < rate;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return this.#profilerSampled;
|
|
631
|
+
}
|
|
632
|
+
#startProfiler() {
|
|
633
|
+
if (!this.#profilerSampledIn()) return;
|
|
634
|
+
let ProfilerCtor = globalThis.Profiler;
|
|
635
|
+
if (typeof ProfilerCtor !== "function") return;
|
|
636
|
+
if (!this.#spawnProfiler(ProfilerCtor)) return;
|
|
637
|
+
this.#profilerHarvestTimer = setInterval(() => {
|
|
638
|
+
this.#harvestProfiler(ProfilerCtor);
|
|
639
|
+
}, PROFILER_HARVEST_INTERVAL_MS);
|
|
640
|
+
}
|
|
641
|
+
#spawnProfiler(ProfilerCtor) {
|
|
642
|
+
try {
|
|
643
|
+
this.#profiler = new ProfilerCtor({
|
|
644
|
+
sampleInterval: PROFILER_SAMPLE_INTERVAL_MS,
|
|
645
|
+
maxBufferSize: 1e4
|
|
646
|
+
});
|
|
647
|
+
return true;
|
|
648
|
+
} catch {
|
|
649
|
+
this.#profiler = void 0;
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
async #harvestProfiler(ProfilerCtor) {
|
|
654
|
+
if (!this.#profiler) return;
|
|
655
|
+
let old = this.#profiler;
|
|
656
|
+
this.#spawnProfiler(ProfilerCtor);
|
|
657
|
+
try {
|
|
658
|
+
let trace = await old.stop();
|
|
659
|
+
this.#ingestProfilerTrace(trace);
|
|
660
|
+
} catch {}
|
|
661
|
+
}
|
|
662
|
+
#ingestProfilerTrace(trace) {
|
|
663
|
+
if (!this.#started) return;
|
|
664
|
+
let t = trace;
|
|
665
|
+
if (!t?.samples || !t.stacks || !t.frames) return;
|
|
666
|
+
let { frames, stacks, samples } = t;
|
|
667
|
+
for (let sample of samples) {
|
|
668
|
+
let stackFrames = [];
|
|
669
|
+
let stackId = sample.stackId;
|
|
670
|
+
let guard = 0;
|
|
671
|
+
while (stackId != null && guard++ < MAX_PROFILER_FRAMES) {
|
|
672
|
+
let stack = stacks[stackId];
|
|
673
|
+
if (!stack) break;
|
|
674
|
+
let frame = frames[stack.frameId];
|
|
675
|
+
stackFrames.push(frame?.name || "(anonymous)");
|
|
676
|
+
stackId = stack.parentId;
|
|
677
|
+
}
|
|
678
|
+
this.#profilerSamples.push({
|
|
679
|
+
sample_ms: sample.timestamp,
|
|
680
|
+
frames: stackFrames
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
if (this.#profilerSamples.length > MAX_PROFILER_SAMPLES) this.#profilerSamples.splice(0, this.#profilerSamples.length - MAX_PROFILER_SAMPLES);
|
|
684
|
+
}
|
|
685
|
+
#profilerSamplesInWindow(windowStart, windowEnd) {
|
|
686
|
+
return this.#profilerSamples.filter((s) => s.sample_ms >= windowStart && s.sample_ms <= windowEnd);
|
|
687
|
+
}
|
|
688
|
+
#attachLifecycleListeners() {
|
|
689
|
+
if (typeof window === "undefined" || !window.addEventListener) return;
|
|
690
|
+
this.#pagehideHandler = () => this.#flush("pagehide");
|
|
691
|
+
this.#visibilityHandler = () => {
|
|
692
|
+
if (typeof document === "undefined") return;
|
|
693
|
+
if (document.visibilityState === "hidden") this.#flush("hidden");
|
|
694
|
+
else {
|
|
695
|
+
this.#lastHeartbeatAt = now();
|
|
696
|
+
this.#lastLoadGeneration = this.#safeLoadGeneration();
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
this.#errorHandler = (event) => this.#onWindowError(event);
|
|
700
|
+
this.#rejectionHandler = (event) => this.#onUnhandledRejection(event);
|
|
701
|
+
window.addEventListener("pagehide", this.#pagehideHandler);
|
|
702
|
+
window.addEventListener("visibilitychange", this.#visibilityHandler);
|
|
703
|
+
window.addEventListener("error", this.#errorHandler);
|
|
704
|
+
window.addEventListener("unhandledrejection", this.#rejectionHandler);
|
|
705
|
+
}
|
|
706
|
+
#detachLifecycleListeners() {
|
|
707
|
+
if (typeof window === "undefined" || !window.removeEventListener) return;
|
|
708
|
+
if (this.#pagehideHandler) {
|
|
709
|
+
window.removeEventListener("pagehide", this.#pagehideHandler);
|
|
710
|
+
this.#pagehideHandler = void 0;
|
|
711
|
+
}
|
|
712
|
+
if (this.#visibilityHandler) {
|
|
713
|
+
window.removeEventListener("visibilitychange", this.#visibilityHandler);
|
|
714
|
+
this.#visibilityHandler = void 0;
|
|
715
|
+
}
|
|
716
|
+
if (this.#errorHandler) {
|
|
717
|
+
window.removeEventListener("error", this.#errorHandler);
|
|
718
|
+
this.#errorHandler = void 0;
|
|
719
|
+
}
|
|
720
|
+
if (this.#rejectionHandler) {
|
|
721
|
+
window.removeEventListener("unhandledrejection", this.#rejectionHandler);
|
|
722
|
+
this.#rejectionHandler = void 0;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
var requestAttemptCounts = /* @__PURE__ */ new WeakMap();
|
|
727
|
+
function isMatrixRequest(req) {
|
|
728
|
+
try {
|
|
729
|
+
return new URL(req.url).pathname.startsWith("/_matrix/");
|
|
730
|
+
} catch {
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
function readsCorrelationId(owner, req) {
|
|
735
|
+
if (isMatrixRequest(req)) return false;
|
|
736
|
+
let url;
|
|
737
|
+
try {
|
|
738
|
+
url = new URL(req.url);
|
|
739
|
+
} catch {
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
if (typeof window !== "undefined" && url.origin === window.location.origin) return true;
|
|
743
|
+
let network = owner.lookup("service:network");
|
|
744
|
+
let real = (virtual) => {
|
|
745
|
+
try {
|
|
746
|
+
return network?.virtualNetwork.mapURL(virtual, "virtual-to-real");
|
|
747
|
+
} catch {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
let servesThis = (candidate) => Boolean(candidate && (candidate.origin === url.origin || real(candidate)?.origin === url.origin));
|
|
752
|
+
if (servesThis(owner.lookup("service:realm-server")?.url)) return true;
|
|
753
|
+
if (URL.canParse(config.resolvedBaseRealmURL) && new URL(config.resolvedBaseRealmURL).origin === url.origin) return true;
|
|
754
|
+
let realm = owner.lookup("service:realm");
|
|
755
|
+
try {
|
|
756
|
+
if (realm?.realmOf(url)) return true;
|
|
757
|
+
} catch {}
|
|
758
|
+
for (let key of realm?.realms.keys() ?? []) {
|
|
759
|
+
let realmURL;
|
|
760
|
+
try {
|
|
761
|
+
realmURL = URL.canParse(key) ? new URL(key) : network?.virtualNetwork.toURL(key);
|
|
762
|
+
} catch {
|
|
763
|
+
continue;
|
|
764
|
+
}
|
|
765
|
+
if (servesThis(realmURL)) return true;
|
|
766
|
+
}
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
function createServerRequestTimingMiddleware(owner) {
|
|
770
|
+
return async (req, next) => {
|
|
771
|
+
if (isRenderContext()) return next(req);
|
|
772
|
+
let telemetry;
|
|
773
|
+
try {
|
|
774
|
+
telemetry = owner.lookup("service:client-telemetry");
|
|
775
|
+
} catch {
|
|
776
|
+
return next(req);
|
|
777
|
+
}
|
|
778
|
+
if (!telemetry?.isEnabled) return next(req);
|
|
779
|
+
let attempt = (requestAttemptCounts.get(req) ?? 0) + 1;
|
|
780
|
+
requestAttemptCounts.set(req, attempt);
|
|
781
|
+
if (readsCorrelationId(owner, req) && !req.headers.get("x-boxel-logging-correlation-id")) try {
|
|
782
|
+
req.headers.set(X_BOXEL_LOGGING_CORRELATION_ID_HEADER, v4());
|
|
783
|
+
} catch {}
|
|
784
|
+
let start = now();
|
|
785
|
+
let response = await next(req);
|
|
786
|
+
telemetry.recordServerRequestTiming(req, response, now() - start, attempt > 1);
|
|
787
|
+
return response;
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
var OVERFLOW_ERROR_KEY = "overflow";
|
|
791
|
+
//#endregion
|
|
792
|
+
//#region app/utils/assert-never.ts
|
|
793
|
+
var assert_never_exports = /* @__PURE__ */ __exportAll({ assertNever: () => assertNever });
|
|
794
|
+
function assertNever(value) {
|
|
795
|
+
return /* @__PURE__ */ new Error(`should never happen ${value}`);
|
|
796
|
+
}
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region app/services/realm-server.ts
|
|
799
|
+
var realm_server_exports = /* @__PURE__ */ __exportAll({
|
|
800
|
+
default: () => RealmServerService,
|
|
801
|
+
realmClaimsFromRawToken: () => realmClaimsFromRawToken
|
|
802
|
+
});
|
|
803
|
+
var { hostsOwnAssets, resolvedBaseRealmURL } = config;
|
|
804
|
+
var REALM_EVENT_ROOMS_FIRST_RETRY_MS = 2e3;
|
|
805
|
+
var REALM_EVENT_ROOMS_MAX_RETRY_MS = 6e4;
|
|
806
|
+
var REALM_EVENT_ROOMS_PER_REQUEST = 100;
|
|
807
|
+
var RealmServerService = class extends Service {
|
|
808
|
+
static {
|
|
809
|
+
decorateFieldV2(this.prototype, "messageService", [service]);
|
|
810
|
+
}
|
|
811
|
+
#messageService = (initializeDeferredDecorator(this, "messageService"), void 0);
|
|
812
|
+
static {
|
|
813
|
+
decorateFieldV2(this.prototype, "network", [service]);
|
|
814
|
+
}
|
|
815
|
+
#network = (initializeDeferredDecorator(this, "network"), void 0);
|
|
816
|
+
static {
|
|
817
|
+
decorateFieldV2(this.prototype, "session", [service]);
|
|
818
|
+
}
|
|
819
|
+
#session = (initializeDeferredDecorator(this, "session"), void 0);
|
|
820
|
+
static {
|
|
821
|
+
decorateFieldV2(this.prototype, "realm", [service]);
|
|
822
|
+
}
|
|
823
|
+
#realm = (initializeDeferredDecorator(this, "realm"), void 0);
|
|
824
|
+
static {
|
|
825
|
+
decorateFieldV2(this.prototype, "realmServer", [service]);
|
|
826
|
+
}
|
|
827
|
+
#realmServer = (initializeDeferredDecorator(this, "realmServer"), void 0);
|
|
828
|
+
auth = { type: "anonymous" };
|
|
829
|
+
client;
|
|
830
|
+
availableRealms = new TrackedArray([{
|
|
831
|
+
type: "base",
|
|
832
|
+
url: baseRealm.url
|
|
833
|
+
}]);
|
|
834
|
+
userCatalogPickList = new TrackedArray([]);
|
|
835
|
+
archivedRealmsList = new TrackedArray([]);
|
|
836
|
+
archivedRealmsFetched = false;
|
|
837
|
+
unreachableRealmServersList = new TrackedArray([]);
|
|
838
|
+
_ready = new Deferred();
|
|
839
|
+
eventSubscribers = /* @__PURE__ */ new Map();
|
|
840
|
+
realmEventRoomsPending = /* @__PURE__ */ new Set();
|
|
841
|
+
realmEventRoomsRequested = /* @__PURE__ */ new Set();
|
|
842
|
+
realmEventRoomsRetryMs = REALM_EVENT_ROOMS_FIRST_RETRY_MS;
|
|
843
|
+
constructor(owner) {
|
|
844
|
+
super(owner);
|
|
845
|
+
this.session.register(this);
|
|
846
|
+
this.fetchCatalogRealms();
|
|
847
|
+
this.messageService.onFirstSubscription((realm) => this.joinRealmEventRoom(realm));
|
|
848
|
+
this.subscribeEvent(REALMS_LIST_UPDATED_EVENT_TYPE, async () => {
|
|
849
|
+
this.reaskRealmEventRooms();
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
get ready() {
|
|
853
|
+
return this._ready.promise;
|
|
854
|
+
}
|
|
855
|
+
get canFetch() {
|
|
856
|
+
return this.client !== void 0 || this.auth.type === "logged-in";
|
|
857
|
+
}
|
|
858
|
+
resetState() {
|
|
859
|
+
let catalogRealms = this.availableRealms.filter((realm) => realm.type === "catalog");
|
|
860
|
+
this.logout();
|
|
861
|
+
this.availableRealms = new TrackedArray([{
|
|
862
|
+
type: "base",
|
|
863
|
+
url: baseRealm.url
|
|
864
|
+
}, ...catalogRealms]);
|
|
865
|
+
this.archivedRealmsList.splice(0, this.archivedRealmsList.length);
|
|
866
|
+
this.archivedRealmsFetched = false;
|
|
867
|
+
this.unreachableRealmServersList.splice(0, this.unreachableRealmServersList.length);
|
|
868
|
+
this.joinRealmEventRoomsTask.cancelAll();
|
|
869
|
+
this.retryRealmEventRoomsTask.cancelAll();
|
|
870
|
+
this.realmEventRoomsPending.clear();
|
|
871
|
+
this.realmEventRoomsRequested.clear();
|
|
872
|
+
this.realmEventRoomsRetryMs = REALM_EVENT_ROOMS_FIRST_RETRY_MS;
|
|
873
|
+
this._ready = new Deferred();
|
|
874
|
+
this._ready.fulfill();
|
|
875
|
+
}
|
|
876
|
+
get hasClient() {
|
|
877
|
+
return Boolean(this.client);
|
|
878
|
+
}
|
|
879
|
+
setClient(client) {
|
|
880
|
+
this.client = client;
|
|
881
|
+
let stored = src_default.localStorage.getItem(sessionLocalStorageKey) || void 0;
|
|
882
|
+
let storedUser = stored ? realmClaimsFromRawToken(stored)?.user : void 0;
|
|
883
|
+
let userId = client.getUserId();
|
|
884
|
+
if (stored && userId && storedUser !== userId) stored = void 0;
|
|
885
|
+
this.token = stored;
|
|
886
|
+
}
|
|
887
|
+
async createStripeSession(email) {
|
|
888
|
+
let url = new URL(`${this.url.href}_stripe-session`);
|
|
889
|
+
url.searchParams.set("email", email);
|
|
890
|
+
let response = await this.network.fetch(url.href, {
|
|
891
|
+
method: "POST",
|
|
892
|
+
headers: {
|
|
893
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
894
|
+
"Content-Type": "application/json",
|
|
895
|
+
Authorization: `Bearer ${this.token}`
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
if (!response.ok) {
|
|
899
|
+
let err = `Could not create Stripe session: ${response.status} - ${await response.text()}`;
|
|
900
|
+
console.error(err);
|
|
901
|
+
throw new Error(err);
|
|
902
|
+
}
|
|
903
|
+
return response;
|
|
904
|
+
}
|
|
905
|
+
async createRealm(args) {
|
|
906
|
+
await this.login();
|
|
907
|
+
let response = await this.network.fetch(`${this.url.href}_create-realm`, {
|
|
908
|
+
method: "POST",
|
|
909
|
+
headers: {
|
|
910
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
911
|
+
"Content-Type": "application/json",
|
|
912
|
+
Authorization: `Bearer ${this.token}`
|
|
913
|
+
},
|
|
914
|
+
body: JSON.stringify({ data: {
|
|
915
|
+
type: "realm",
|
|
916
|
+
attributes: args
|
|
917
|
+
} })
|
|
918
|
+
});
|
|
919
|
+
if (!response.ok) {
|
|
920
|
+
let err = `Could not create realm with endpoint '${args.endpoint}': ${response.status} - ${await response.text()}`;
|
|
921
|
+
console.error(err);
|
|
922
|
+
throw new Error(err);
|
|
923
|
+
}
|
|
924
|
+
let { data: { id: realmURL } } = await response.json();
|
|
925
|
+
return new URL(realmURL);
|
|
926
|
+
}
|
|
927
|
+
async deleteRealm(realmURL) {
|
|
928
|
+
await this.login();
|
|
929
|
+
let response = await this.network.fetch(`${this.url.href}_delete-realm`, {
|
|
930
|
+
method: "DELETE",
|
|
931
|
+
headers: {
|
|
932
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
933
|
+
"Content-Type": "application/json",
|
|
934
|
+
Authorization: `Bearer ${this.token}`
|
|
935
|
+
},
|
|
936
|
+
body: JSON.stringify({ data: {
|
|
937
|
+
type: "realm",
|
|
938
|
+
id: realmURL
|
|
939
|
+
} })
|
|
940
|
+
});
|
|
941
|
+
if (!response.ok) {
|
|
942
|
+
let err = `Could not delete realm '${realmURL}': ${response.status} - ${await response.text()}`;
|
|
943
|
+
console.error(err);
|
|
944
|
+
throw new Error(err);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
async archiveRealm(realmURL) {
|
|
948
|
+
await this.login();
|
|
949
|
+
let response = await this.network.fetch(`${this.url.href}_archive-realm`, {
|
|
950
|
+
method: "POST",
|
|
951
|
+
headers: {
|
|
952
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
953
|
+
"Content-Type": SupportedMimeType.JSONAPI,
|
|
954
|
+
Authorization: `Bearer ${this.token}`
|
|
955
|
+
},
|
|
956
|
+
body: JSON.stringify({ data: {
|
|
957
|
+
type: "realm",
|
|
958
|
+
id: realmURL
|
|
959
|
+
} })
|
|
960
|
+
});
|
|
961
|
+
if (!response.ok) {
|
|
962
|
+
let err = `Could not archive realm '${realmURL}': ${response.status} - ${await response.text()}`;
|
|
963
|
+
console.error(err);
|
|
964
|
+
throw new Error(err);
|
|
965
|
+
}
|
|
966
|
+
let identifier = ri(realmURL);
|
|
967
|
+
await this.setAvailableRealmIdentifiers(this.userRealmIdentifiers.filter((url) => url !== identifier));
|
|
968
|
+
try {
|
|
969
|
+
await this.fetchArchivedRealms({ force: true });
|
|
970
|
+
} catch (err) {
|
|
971
|
+
console.error(`Failed to refresh archived realms after archiving`, err);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
async unarchiveRealm(realmURL) {
|
|
975
|
+
await this.login();
|
|
976
|
+
let response = await this.network.fetch(`${this.url.href}_unarchive-realm`, {
|
|
977
|
+
method: "POST",
|
|
978
|
+
headers: {
|
|
979
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
980
|
+
"Content-Type": SupportedMimeType.JSONAPI,
|
|
981
|
+
Authorization: `Bearer ${this.token}`
|
|
982
|
+
},
|
|
983
|
+
body: JSON.stringify({ data: {
|
|
984
|
+
type: "realm",
|
|
985
|
+
id: realmURL
|
|
986
|
+
} })
|
|
987
|
+
});
|
|
988
|
+
if (!response.ok) {
|
|
989
|
+
let err = `Could not restore realm '${realmURL}': ${response.status} - ${await response.text()}`;
|
|
990
|
+
console.error(err);
|
|
991
|
+
throw new Error(err);
|
|
992
|
+
}
|
|
993
|
+
let identifier = ri(realmURL);
|
|
994
|
+
let index = this.archivedRealmsList.findIndex((realm) => ri(realm.url) === identifier);
|
|
995
|
+
if (index >= 0) this.archivedRealmsList.splice(index, 1);
|
|
996
|
+
await this.setAvailableRealmIdentifiers([identifier, ...this.userRealmIdentifiers]);
|
|
997
|
+
}
|
|
998
|
+
endSecureWindowSessions() {
|
|
999
|
+
let token = this.token;
|
|
1000
|
+
if (!token) return;
|
|
1001
|
+
this.network.fetch(`${this.url.href}_secure-sessions?client=window`, {
|
|
1002
|
+
method: "DELETE",
|
|
1003
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
1004
|
+
keepalive: true,
|
|
1005
|
+
signal: AbortSignal.timeout(secureWindowSignOutTimeoutMs)
|
|
1006
|
+
}).then((response) => {
|
|
1007
|
+
if (!response.ok) console.warn(`Could not sign the secure window out: ${response.status}`);
|
|
1008
|
+
}).catch((e) => {
|
|
1009
|
+
console.warn(`Could not sign the secure window out: ${e}`);
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
logout() {
|
|
1013
|
+
this.loginTask.cancelAll();
|
|
1014
|
+
this.tokenRefresher.cancelAll();
|
|
1015
|
+
this.refreshSchedule.reset();
|
|
1016
|
+
this.token = void 0;
|
|
1017
|
+
this.client = void 0;
|
|
1018
|
+
this.loggingIn = void 0;
|
|
1019
|
+
this.reauthenticating = void 0;
|
|
1020
|
+
this.auth = { type: "anonymous" };
|
|
1021
|
+
this.availableRealms.splice(0, this.availableRealms.length, {
|
|
1022
|
+
type: "base",
|
|
1023
|
+
url: baseRealm.url
|
|
1024
|
+
});
|
|
1025
|
+
this.userCatalogPickList.splice(0, this.userCatalogPickList.length);
|
|
1026
|
+
this.unreachableRealmServersList.splice(0, this.unreachableRealmServersList.length);
|
|
1027
|
+
src_default.localStorage.removeItem(sessionLocalStorageKey);
|
|
1028
|
+
}
|
|
1029
|
+
async fetchTokensForAccessibleRealms() {
|
|
1030
|
+
await this.login();
|
|
1031
|
+
let response = await this.network.fetch(`${this.url.href}_realm-auth?include-public=true`, {
|
|
1032
|
+
method: "POST",
|
|
1033
|
+
headers: {
|
|
1034
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1035
|
+
"Content-Type": "application/json",
|
|
1036
|
+
Authorization: `Bearer ${this.token}`
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
if (!response.ok) {
|
|
1040
|
+
let responseText = await response.text();
|
|
1041
|
+
if (config.environment === "development" && responseText.includes("User in JWT not found")) console.error("\x1B[1m\x1B[31m%s\x1B[0m", "Failed to login to realms due to missing entry in the users table. It is likely the user setup is incomplete - run pnpm register-all in matrix package");
|
|
1042
|
+
throw new Error(`Failed to fetch tokens for accessible realms: ${response.status} - ${responseText}`);
|
|
1043
|
+
}
|
|
1044
|
+
return response.json();
|
|
1045
|
+
}
|
|
1046
|
+
async fetchUserRealmsFromTrustedServers(trustedServerURLs) {
|
|
1047
|
+
if (trustedServerURLs.length === 0) return [];
|
|
1048
|
+
this.assertOwnRealmServer(trustedServerURLs);
|
|
1049
|
+
await this.login();
|
|
1050
|
+
let results = await Promise.allSettled(trustedServerURLs.map((serverURL) => this.fetchUserRealmsFromServer(serverURL)));
|
|
1051
|
+
let realmURLs = [];
|
|
1052
|
+
results.forEach((result, index) => {
|
|
1053
|
+
let normalizedServerURL = ensureTrailingSlash(trustedServerURLs[index]);
|
|
1054
|
+
if (result.status === "fulfilled") {
|
|
1055
|
+
realmURLs.push(...result.value);
|
|
1056
|
+
this.markRealmServerReachable(normalizedServerURL);
|
|
1057
|
+
} else {
|
|
1058
|
+
this.markRealmServerUnreachable(normalizedServerURL);
|
|
1059
|
+
console.error(`Failed to fetch user realms from trusted server ${normalizedServerURL}`, result.reason);
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
return [...new Set(realmURLs)];
|
|
1063
|
+
}
|
|
1064
|
+
async fetchUserRealmsFromServer(serverURL) {
|
|
1065
|
+
let normalizedServerURL = ensureTrailingSlash(serverURL);
|
|
1066
|
+
let response = await this.network.fetch(`${normalizedServerURL}_realm-auth?include-public=false`, {
|
|
1067
|
+
method: "POST",
|
|
1068
|
+
headers: {
|
|
1069
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1070
|
+
"Content-Type": "application/json",
|
|
1071
|
+
Authorization: `Bearer ${this.token}`
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
if (!response.ok) {
|
|
1075
|
+
let responseText = await response.text();
|
|
1076
|
+
throw new Error(`Failed to fetch user realms from trusted server ${normalizedServerURL}: ${response.status} - ${responseText}`);
|
|
1077
|
+
}
|
|
1078
|
+
let tokens = await response.json();
|
|
1079
|
+
return Object.keys(tokens);
|
|
1080
|
+
}
|
|
1081
|
+
get unreachableRealmServers() {
|
|
1082
|
+
return [...this.unreachableRealmServersList];
|
|
1083
|
+
}
|
|
1084
|
+
static {
|
|
1085
|
+
decorateMethodV2(this.prototype, "unreachableRealmServers", [cached]);
|
|
1086
|
+
}
|
|
1087
|
+
markRealmServerUnreachable(serverURL) {
|
|
1088
|
+
if (!this.unreachableRealmServersList.includes(serverURL)) this.unreachableRealmServersList.push(serverURL);
|
|
1089
|
+
}
|
|
1090
|
+
markRealmServerReachable(serverURL) {
|
|
1091
|
+
let index = this.unreachableRealmServersList.indexOf(serverURL);
|
|
1092
|
+
if (index >= 0) this.unreachableRealmServersList.splice(index, 1);
|
|
1093
|
+
}
|
|
1094
|
+
get availableRealmIdentifiers() {
|
|
1095
|
+
return this.availableRealms.map((r) => ri(r.url));
|
|
1096
|
+
}
|
|
1097
|
+
static {
|
|
1098
|
+
decorateMethodV2(this.prototype, "availableRealmIdentifiers", [cached]);
|
|
1099
|
+
}
|
|
1100
|
+
assertOwnRealmServer(realmServerURLs) {
|
|
1101
|
+
let normalizedOwnRealmServerURL = this.normalizeRealmServerURL(this.realmServer.url.href);
|
|
1102
|
+
let normalizedRealmServerURLs = [...new Set(realmServerURLs.map((url) => this.normalizeRealmServerURL(url)))];
|
|
1103
|
+
if (realmServerURLs.length === 0) throw new Error(`Unable to determine realm server to use`);
|
|
1104
|
+
if (normalizedRealmServerURLs.length > 1 || normalizedRealmServerURLs[0] !== normalizedOwnRealmServerURL) throw new Error(`Multi-realm server support is not yet implemented: don't know how to provide auth token for different realm servers: ${normalizedRealmServerURLs.join()} (own realm server: ${normalizedOwnRealmServerURL})`);
|
|
1105
|
+
}
|
|
1106
|
+
getRealmServersForRealms(realms) {
|
|
1107
|
+
let sessionTokens = this.readSessionTokens();
|
|
1108
|
+
let realmServerURLs = /* @__PURE__ */ new Set();
|
|
1109
|
+
for (let realmURL of realms) {
|
|
1110
|
+
let normalizedRealmURL = ensureTrailingSlash(realmURL);
|
|
1111
|
+
let resolvedRealmURL = resolvedRealmURLHref(this.network.virtualNetwork, normalizedRealmURL);
|
|
1112
|
+
if (isTesting() && new URL(resolvedRealmURL).origin === "http://test-realm") continue;
|
|
1113
|
+
let [token] = this.sessionTokensFor(sessionTokens, realmURL);
|
|
1114
|
+
if (!token) continue;
|
|
1115
|
+
let claims = realmClaimsFromRawToken(token);
|
|
1116
|
+
if (claims?.realmServerURL) realmServerURLs.add(this.normalizeRealmServerURL(claims.realmServerURL));
|
|
1117
|
+
}
|
|
1118
|
+
if (realmServerURLs.size === 0) realmServerURLs.add(this.normalizeRealmServerURL(this.url.href));
|
|
1119
|
+
return [...realmServerURLs];
|
|
1120
|
+
}
|
|
1121
|
+
readSessionTokens() {
|
|
1122
|
+
let sessionStr = src_default.localStorage.getItem("boxel-session") ?? "{}";
|
|
1123
|
+
try {
|
|
1124
|
+
return JSON.parse(sessionStr);
|
|
1125
|
+
} catch {
|
|
1126
|
+
return {};
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
normalizeRealmServerURL(url) {
|
|
1130
|
+
let normalizedURL = ensureTrailingSlash(url);
|
|
1131
|
+
if (isTesting()) {
|
|
1132
|
+
if (new URL(normalizedURL).origin === "http://test-realm") return ensureTrailingSlash(new URL(resolvedBaseRealmURL).origin);
|
|
1133
|
+
}
|
|
1134
|
+
return normalizedURL;
|
|
1135
|
+
}
|
|
1136
|
+
get userRealmIdentifiers() {
|
|
1137
|
+
return this.availableRealms.filter((r) => r.type === "user").map((r) => ri(r.url));
|
|
1138
|
+
}
|
|
1139
|
+
static {
|
|
1140
|
+
decorateMethodV2(this.prototype, "userRealmIdentifiers", [cached]);
|
|
1141
|
+
}
|
|
1142
|
+
get catalogRealmIdentifiers() {
|
|
1143
|
+
return this.availableRealms.filter((r) => r.type === "catalog").map((r) => ri(r.url));
|
|
1144
|
+
}
|
|
1145
|
+
static {
|
|
1146
|
+
decorateMethodV2(this.prototype, "catalogRealmIdentifiers", [cached]);
|
|
1147
|
+
}
|
|
1148
|
+
get userCatalogPicks() {
|
|
1149
|
+
return [...this.userCatalogPickList];
|
|
1150
|
+
}
|
|
1151
|
+
get userCatalogRealmIdentifiers() {
|
|
1152
|
+
return this.availableRealms.filter((r) => r.type === "user-catalog").map((r) => ri(r.url));
|
|
1153
|
+
}
|
|
1154
|
+
static {
|
|
1155
|
+
decorateMethodV2(this.prototype, "userCatalogRealmIdentifiers", [cached]);
|
|
1156
|
+
}
|
|
1157
|
+
get displayedCatalogRealmIdentifiers() {
|
|
1158
|
+
return [...this.catalogRealmIdentifiers, ...this.userCatalogRealmIdentifiers];
|
|
1159
|
+
}
|
|
1160
|
+
static {
|
|
1161
|
+
decorateMethodV2(this.prototype, "displayedCatalogRealmIdentifiers", [cached]);
|
|
1162
|
+
}
|
|
1163
|
+
get archivedRealms() {
|
|
1164
|
+
return [...this.archivedRealmsList];
|
|
1165
|
+
}
|
|
1166
|
+
static {
|
|
1167
|
+
decorateMethodV2(this.prototype, "archivedRealms", [cached]);
|
|
1168
|
+
}
|
|
1169
|
+
get isArchivedRealmsFetched() {
|
|
1170
|
+
return this.archivedRealmsFetched;
|
|
1171
|
+
}
|
|
1172
|
+
get availableRealmIndexCardIds() {
|
|
1173
|
+
return this.availableRealmIdentifiers.map((url) => `${url}index`);
|
|
1174
|
+
}
|
|
1175
|
+
static {
|
|
1176
|
+
decorateMethodV2(this.prototype, "availableRealmIndexCardIds", [cached]);
|
|
1177
|
+
}
|
|
1178
|
+
async authenticateToAllAccessibleRealms() {
|
|
1179
|
+
let tokens = await this.fetchTokensForAccessibleRealms();
|
|
1180
|
+
await this.ensureJoinedSessionRoom(tokens);
|
|
1181
|
+
for (let [realmURL, token] of Object.entries(tokens)) this.realm.getOrCreateRealmResource(realmURL, token);
|
|
1182
|
+
this.joinRealmEventRoomsTask.perform();
|
|
1183
|
+
}
|
|
1184
|
+
joinRealmEventRoom(realmIdentifier) {
|
|
1185
|
+
let realmURL = ensureTrailingSlash(resolvedRealmURLHref(this.network.virtualNetwork, realmIdentifier));
|
|
1186
|
+
if (this.realmEventRoomsRequested.has(realmURL)) return;
|
|
1187
|
+
this.realmEventRoomsRequested.add(realmURL);
|
|
1188
|
+
this.realmEventRoomsPending.add(realmURL);
|
|
1189
|
+
this.joinRealmEventRoomsTask.perform();
|
|
1190
|
+
}
|
|
1191
|
+
reaskRealmEventRooms() {
|
|
1192
|
+
this.realmEventRoomsRequested.clear();
|
|
1193
|
+
for (let realm of this.messageService.subscribedRealms()) this.joinRealmEventRoom(realm);
|
|
1194
|
+
}
|
|
1195
|
+
joinRealmEventRoomsTask = buildTask(() => ({
|
|
1196
|
+
context: this,
|
|
1197
|
+
generator: function* () {
|
|
1198
|
+
yield rawTimeout(0);
|
|
1199
|
+
let client = this.client;
|
|
1200
|
+
if (!client || this.realmEventRoomsPending.size === 0) return;
|
|
1201
|
+
let realms = [...this.realmEventRoomsPending].slice(0, REALM_EVENT_ROOMS_PER_REQUEST);
|
|
1202
|
+
for (let realm of realms) this.realmEventRoomsPending.delete(realm);
|
|
1203
|
+
try {
|
|
1204
|
+
yield this.login();
|
|
1205
|
+
let response = yield this.network.fetch(`${this.url.href}_realm-event-rooms`, {
|
|
1206
|
+
method: "POST",
|
|
1207
|
+
headers: {
|
|
1208
|
+
Accept: SupportedMimeType.JSON,
|
|
1209
|
+
"Content-Type": "application/json",
|
|
1210
|
+
Authorization: `Bearer ${this.token}`
|
|
1211
|
+
},
|
|
1212
|
+
body: JSON.stringify({ realms })
|
|
1213
|
+
});
|
|
1214
|
+
let { rooms } = response.ok || response.status === 503 ? yield response.json() : {};
|
|
1215
|
+
for (let roomId of new Set(Object.values(rooms ?? {}))) yield client.joinRoom(roomId);
|
|
1216
|
+
if (!response.ok) throw new Error(`${response.status} from _realm-event-rooms`);
|
|
1217
|
+
this.realmEventRoomsRetryMs = REALM_EVENT_ROOMS_FIRST_RETRY_MS;
|
|
1218
|
+
if (this.realmEventRoomsPending.size > 0) this.joinRealmEventRoomsTask.perform();
|
|
1219
|
+
} catch (e) {
|
|
1220
|
+
for (let realm of realms) this.realmEventRoomsPending.add(realm);
|
|
1221
|
+
console.warn(`Unable to join the realm event rooms of ${realms}`, e);
|
|
1222
|
+
let retryMs = this.realmEventRoomsRetryMs;
|
|
1223
|
+
this.realmEventRoomsRetryMs = Math.min(retryMs * 2, REALM_EVENT_ROOMS_MAX_RETRY_MS);
|
|
1224
|
+
this.retryRealmEventRoomsTask.perform(retryMs);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}), { keepLatest: true }, "joinRealmEventRoomsTask", null);
|
|
1228
|
+
retryRealmEventRoomsTask = buildTask(() => ({
|
|
1229
|
+
context: this,
|
|
1230
|
+
generator: function* (ms) {
|
|
1231
|
+
yield rawTimeout(ms);
|
|
1232
|
+
this.joinRealmEventRoomsTask.perform();
|
|
1233
|
+
}
|
|
1234
|
+
}), null, "retryRealmEventRoomsTask", "restartable");
|
|
1235
|
+
async ensureJoinedSessionRoom(tokens) {
|
|
1236
|
+
if (!this.client) throw new Error(`Cannot check joined rooms without matrix client`);
|
|
1237
|
+
let { joined_rooms } = await this.client.getJoinedRooms();
|
|
1238
|
+
let joinedRoomSet = new Set(joined_rooms ?? []);
|
|
1239
|
+
for (let [_realmURL, token] of Object.entries(tokens)) {
|
|
1240
|
+
let { sessionRoom } = claimsFromRawToken$1(token);
|
|
1241
|
+
if (!joinedRoomSet.has(sessionRoom)) {
|
|
1242
|
+
await joinDMRoom(this.client, sessionRoom);
|
|
1243
|
+
joinedRoomSet.add(sessionRoom);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
async setAvailableRealmIdentifiers(userRealmIdentifiers) {
|
|
1248
|
+
await this._ready.promise;
|
|
1249
|
+
this.removeEntries("user", "user-catalog");
|
|
1250
|
+
userRealmIdentifiers.forEach((userRealmIdentifier) => {
|
|
1251
|
+
if (!this.availableRealms.find((r) => r.url === userRealmIdentifier)) this.availableRealms.push({
|
|
1252
|
+
type: "user",
|
|
1253
|
+
url: userRealmIdentifier
|
|
1254
|
+
});
|
|
1255
|
+
});
|
|
1256
|
+
this.addUserCatalogEntries();
|
|
1257
|
+
}
|
|
1258
|
+
setUserCatalogRealmIdentifiers(userCatalogRealmIdentifiers) {
|
|
1259
|
+
this.userCatalogPickList.splice(0, this.userCatalogPickList.length, ...userCatalogRealmIdentifiers);
|
|
1260
|
+
this.removeEntries("user-catalog");
|
|
1261
|
+
this.addUserCatalogEntries();
|
|
1262
|
+
}
|
|
1263
|
+
removeEntries(...types) {
|
|
1264
|
+
for (let i = this.availableRealms.length - 1; i >= 0; i--) if (types.includes(this.availableRealms[i].type)) this.availableRealms.splice(i, 1);
|
|
1265
|
+
}
|
|
1266
|
+
addUserCatalogEntries() {
|
|
1267
|
+
for (let url of this.userCatalogPickList) if (!this.availableRealms.find((r) => r.url === url)) this.availableRealms.push({
|
|
1268
|
+
type: "user-catalog",
|
|
1269
|
+
url
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
async fetchPublicRealms() {
|
|
1273
|
+
await this.login();
|
|
1274
|
+
let response = await this.network.fetch(`${this.url.href}_public-realms`, { headers: {
|
|
1275
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1276
|
+
Authorization: `Bearer ${this.token}`
|
|
1277
|
+
} });
|
|
1278
|
+
if (!response.ok) throw new Error(`Failed to fetch public realms for realm server ${this.url.origin}: ${response.status}`);
|
|
1279
|
+
let { data } = await response.json();
|
|
1280
|
+
return data.map(({ id, attributes }) => ({
|
|
1281
|
+
url: id,
|
|
1282
|
+
...attributes
|
|
1283
|
+
}));
|
|
1284
|
+
}
|
|
1285
|
+
async fetchCatalogRealms() {
|
|
1286
|
+
if (this.catalogRealmIdentifiers.length > 0) return;
|
|
1287
|
+
let response = await this.network.fetch(`${this.url.origin}/_catalog-realms`);
|
|
1288
|
+
if (response.status !== 200) throw new Error(`Failed to fetch public realms for realm server ${this.url.origin}: ${response.status}`);
|
|
1289
|
+
let { data } = await response.json();
|
|
1290
|
+
this.removeEntries("user-catalog");
|
|
1291
|
+
data.forEach((publicRealm) => {
|
|
1292
|
+
if (!this.availableRealms.find((r) => r.url === publicRealm.id)) this.availableRealms.push({
|
|
1293
|
+
type: "catalog",
|
|
1294
|
+
url: publicRealm.id
|
|
1295
|
+
});
|
|
1296
|
+
});
|
|
1297
|
+
this.addUserCatalogEntries();
|
|
1298
|
+
this._ready.fulfill();
|
|
1299
|
+
}
|
|
1300
|
+
async fetchArchivedRealms(opts) {
|
|
1301
|
+
if (this.archivedRealmsFetched && !opts?.force) return;
|
|
1302
|
+
await this.login();
|
|
1303
|
+
let response = await this.network.fetch(`${this.url.origin}/_archived-realms`, { headers: {
|
|
1304
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1305
|
+
Authorization: `Bearer ${this.token}`
|
|
1306
|
+
} });
|
|
1307
|
+
if (!response.ok) throw new Error(`Failed to fetch archived realms for realm server ${this.url.origin}: ${response.status}`);
|
|
1308
|
+
let { data } = await response.json();
|
|
1309
|
+
let archived = (data ?? []).filter((entry) => Boolean(entry?.id)).map((entry) => ({
|
|
1310
|
+
url: ensureTrailingSlash(entry.id),
|
|
1311
|
+
name: entry.attributes?.name ?? entry.id,
|
|
1312
|
+
iconURL: entry.attributes?.iconURL ?? null,
|
|
1313
|
+
backgroundURL: entry.attributes?.backgroundURL ?? null,
|
|
1314
|
+
archivedAt: entry.attributes?.archivedAt ?? null
|
|
1315
|
+
}));
|
|
1316
|
+
this.archivedRealmsList.splice(0, this.archivedRealmsList.length, ...archived);
|
|
1317
|
+
this.archivedRealmsFetched = true;
|
|
1318
|
+
}
|
|
1319
|
+
async fetchRealmInfos(realmUrls) {
|
|
1320
|
+
if (realmUrls.length === 0) return {
|
|
1321
|
+
data: [],
|
|
1322
|
+
publicReadableRealms: /* @__PURE__ */ new Set()
|
|
1323
|
+
};
|
|
1324
|
+
let uniqueRealmUrls = Array.from(new Set(realmUrls));
|
|
1325
|
+
let realmServerURLs = this.getRealmServersForRealms(uniqueRealmUrls);
|
|
1326
|
+
this.assertOwnRealmServer(realmServerURLs);
|
|
1327
|
+
let [realmServerURL] = realmServerURLs;
|
|
1328
|
+
await this.login();
|
|
1329
|
+
let infoURL = new URL("_federated-info", realmServerURL);
|
|
1330
|
+
let response = await this.authedFetch(infoURL.href, {
|
|
1331
|
+
method: "QUERY",
|
|
1332
|
+
headers: {
|
|
1333
|
+
Accept: SupportedMimeType.RealmInfo,
|
|
1334
|
+
"Content-Type": "application/json"
|
|
1335
|
+
},
|
|
1336
|
+
body: JSON.stringify({ realms: uniqueRealmUrls })
|
|
1337
|
+
});
|
|
1338
|
+
if (!response.ok) {
|
|
1339
|
+
let responseText = await response.text();
|
|
1340
|
+
throw new Error(`Failed to fetch federated realm info: ${response.status} - ${responseText}`);
|
|
1341
|
+
}
|
|
1342
|
+
let publicReadableRealms = /* @__PURE__ */ new Set();
|
|
1343
|
+
let publicReadableHeader = response.headers.get("x-boxel-realms-public-readable");
|
|
1344
|
+
if (publicReadableHeader) for (let value of publicReadableHeader.split(",")) {
|
|
1345
|
+
let trimmed = value.trim();
|
|
1346
|
+
if (trimmed) publicReadableRealms.add(ensureTrailingSlash(trimmed));
|
|
1347
|
+
}
|
|
1348
|
+
return {
|
|
1349
|
+
data: (await response.json()).data ?? [],
|
|
1350
|
+
publicReadableRealms
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
async fetchRealmIndexCounts(realmUrls) {
|
|
1354
|
+
if (realmUrls.length === 0) return [];
|
|
1355
|
+
let uniqueRealmUrls = Array.from(new Set(realmUrls));
|
|
1356
|
+
let realmServerURLs = this.getRealmServersForRealms(uniqueRealmUrls);
|
|
1357
|
+
this.assertOwnRealmServer(realmServerURLs);
|
|
1358
|
+
let [realmServerURL] = realmServerURLs;
|
|
1359
|
+
await this.login();
|
|
1360
|
+
let countsURL = new URL("_federated-index-counts", realmServerURL);
|
|
1361
|
+
let response = await this.authedFetch(countsURL.href, {
|
|
1362
|
+
method: "QUERY",
|
|
1363
|
+
headers: {
|
|
1364
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1365
|
+
"Content-Type": "application/json"
|
|
1366
|
+
},
|
|
1367
|
+
body: JSON.stringify({ realms: uniqueRealmUrls })
|
|
1368
|
+
});
|
|
1369
|
+
if (!response.ok) {
|
|
1370
|
+
let responseText = await response.text();
|
|
1371
|
+
throw new Error(`Failed to fetch realm index counts: ${response.status} - ${responseText}`);
|
|
1372
|
+
}
|
|
1373
|
+
return (await response.json()).data ?? [];
|
|
1374
|
+
}
|
|
1375
|
+
async fetchCardTypeSummaries(realmUrls, options) {
|
|
1376
|
+
if (realmUrls.length === 0) return {
|
|
1377
|
+
data: [],
|
|
1378
|
+
meta: { page: { total: 0 } }
|
|
1379
|
+
};
|
|
1380
|
+
let uniqueRealmUrls = Array.from(new Set(realmUrls));
|
|
1381
|
+
let realmServerURLs = this.getRealmServersForRealms(uniqueRealmUrls);
|
|
1382
|
+
this.assertOwnRealmServer(realmServerURLs);
|
|
1383
|
+
let [realmServerURL] = realmServerURLs;
|
|
1384
|
+
await this.login();
|
|
1385
|
+
let typesURL = new URL("_federated-types", realmServerURL);
|
|
1386
|
+
let body = { realms: uniqueRealmUrls };
|
|
1387
|
+
if (options?.searchKey) body.searchKey = options.searchKey;
|
|
1388
|
+
if (options?.page) body.page = options.page;
|
|
1389
|
+
let response = await this.authedFetch(typesURL.href, {
|
|
1390
|
+
method: "QUERY",
|
|
1391
|
+
headers: {
|
|
1392
|
+
Accept: SupportedMimeType.CardTypeSummary,
|
|
1393
|
+
"Content-Type": "application/json"
|
|
1394
|
+
},
|
|
1395
|
+
body: JSON.stringify(body)
|
|
1396
|
+
});
|
|
1397
|
+
if (!response.ok) {
|
|
1398
|
+
let responseText = await response.text();
|
|
1399
|
+
throw new Error(`Failed to fetch federated card type summaries: ${response.status} - ${responseText}`);
|
|
1400
|
+
}
|
|
1401
|
+
let json = await response.json();
|
|
1402
|
+
return {
|
|
1403
|
+
data: json.data ?? [],
|
|
1404
|
+
meta: json.meta ?? { page: { total: 0 } }
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
async handleEvent(event) {
|
|
1408
|
+
let claims = await this.getClaims();
|
|
1409
|
+
if (event.room_id !== claims.sessionRoom || !event.content) return;
|
|
1410
|
+
let realmServerEvent = JSON.parse(event.content.body);
|
|
1411
|
+
let subscribers = this.eventSubscribers.get(realmServerEvent.eventType);
|
|
1412
|
+
if (subscribers) await Promise.all(subscribers.map(async (subscriber) => {
|
|
1413
|
+
try {
|
|
1414
|
+
await subscriber(realmServerEvent.data);
|
|
1415
|
+
} catch (err) {
|
|
1416
|
+
console.error(`realm-server event subscriber for ${realmServerEvent.eventType} failed`, err);
|
|
1417
|
+
}
|
|
1418
|
+
}));
|
|
1419
|
+
}
|
|
1420
|
+
subscribeEvent(eventType, subscriber) {
|
|
1421
|
+
if (!this.eventSubscribers.has(eventType)) this.eventSubscribers.set(eventType, []);
|
|
1422
|
+
this.eventSubscribers.get(eventType).push(subscriber);
|
|
1423
|
+
}
|
|
1424
|
+
get url() {
|
|
1425
|
+
if (isTesting()) return new URL(config.realmServerURL);
|
|
1426
|
+
let url;
|
|
1427
|
+
if (hostsOwnAssets) url = new URL(resolvedBaseRealmURL).origin;
|
|
1428
|
+
else url = globalThis.location.origin;
|
|
1429
|
+
return new URL(url);
|
|
1430
|
+
}
|
|
1431
|
+
async getClaims() {
|
|
1432
|
+
if (!this.claims) await this.login();
|
|
1433
|
+
if (!this.claims) throw new Error("Failed to get realm server token claims");
|
|
1434
|
+
return this.claims;
|
|
1435
|
+
}
|
|
1436
|
+
get claims() {
|
|
1437
|
+
if (this.auth.type === "logged-in") return this.auth.claims;
|
|
1438
|
+
}
|
|
1439
|
+
get token() {
|
|
1440
|
+
if (this.auth.type === "logged-in") return this.auth.token;
|
|
1441
|
+
}
|
|
1442
|
+
set token(value) {
|
|
1443
|
+
if (value) this.auth = {
|
|
1444
|
+
type: "logged-in",
|
|
1445
|
+
token: value,
|
|
1446
|
+
claims: claimsFromRawToken$1(value)
|
|
1447
|
+
};
|
|
1448
|
+
else this.auth = { type: "anonymous" };
|
|
1449
|
+
src_default.localStorage.setItem(sessionLocalStorageKey, value ?? "");
|
|
1450
|
+
this.tokenRefresher.perform();
|
|
1451
|
+
}
|
|
1452
|
+
tokenRefresher = buildTask(() => ({
|
|
1453
|
+
context: this,
|
|
1454
|
+
generator: function* () {
|
|
1455
|
+
if (!this.claims || !this.token) return;
|
|
1456
|
+
let { exp } = this.claims;
|
|
1457
|
+
let refreshMs = this.refreshSchedule.refreshDelayMs(this.token, exp, (delayMs) => console.error(`RealmServerService - the session minted by ${this.url.href} expires at ${(/* @__PURE__ */ new Date(exp * 1e3)).toISOString()}, too soon to schedule a refresh; minting again in ${delayMs / 1e3}s`));
|
|
1458
|
+
yield this.waitForTokenRefresh(refreshMs);
|
|
1459
|
+
if (!this.loggingIn) {
|
|
1460
|
+
this.loggingIn = this.loginTask.perform();
|
|
1461
|
+
yield this.loggingIn;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
}), null, "tokenRefresher", "restartable");
|
|
1465
|
+
waitForTokenRefresh(ms) {
|
|
1466
|
+
return rawTimeout(ms);
|
|
1467
|
+
}
|
|
1468
|
+
refreshSchedule = new TokenRefreshSchedule();
|
|
1469
|
+
loggingIn;
|
|
1470
|
+
async login() {
|
|
1471
|
+
if (this.auth.type === "logged-in") return;
|
|
1472
|
+
if (!this.loggingIn) this.loggingIn = this.loginTask.perform();
|
|
1473
|
+
await this.loggingIn;
|
|
1474
|
+
}
|
|
1475
|
+
loginTask = buildTask(() => ({
|
|
1476
|
+
context: this,
|
|
1477
|
+
generator: function* () {
|
|
1478
|
+
try {
|
|
1479
|
+
if (!this.client) throw new Error(`Cannot login to realm server without matrix client`);
|
|
1480
|
+
let token = yield new RealmAuthClient(this.url, this.client, this.network.authedFetch.bind(this.network), { authWithRealmServer: true }).getJWT();
|
|
1481
|
+
this.refreshSchedule.minted(token);
|
|
1482
|
+
this.token = token;
|
|
1483
|
+
} catch (e) {
|
|
1484
|
+
if (!this.client) throw e;
|
|
1485
|
+
console.error(`RealmServerService - failed to login to realm: ${e.message}`, e);
|
|
1486
|
+
this.token = void 0;
|
|
1487
|
+
} finally {
|
|
1488
|
+
this.loggingIn = void 0;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
}), null, "loginTask", null);
|
|
1492
|
+
async authedFetch(url, options = {}) {
|
|
1493
|
+
const headers = new Headers(options.headers);
|
|
1494
|
+
headers.set("Authorization", `Bearer ${await this.getToken()}`);
|
|
1495
|
+
return await this.network.fetch(url, {
|
|
1496
|
+
...options,
|
|
1497
|
+
headers
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
maybeAuthedFetch(url, options = {}) {
|
|
1501
|
+
const headers = new Headers(options.headers);
|
|
1502
|
+
if (this.token) headers.set("Authorization", `Bearer ${this.token}`);
|
|
1503
|
+
return this.network.fetch(url, {
|
|
1504
|
+
...options,
|
|
1505
|
+
headers
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
maybeAuthedFetchForRealms(url, realms, options = {}) {
|
|
1509
|
+
return this.fetcherForRealms(realms)(url, options);
|
|
1510
|
+
}
|
|
1511
|
+
fetcherForRealms(realms) {
|
|
1512
|
+
let timingMiddleware = this.serverRequestTimingMiddleware ??= createServerRequestTimingMiddleware(getOwner(this));
|
|
1513
|
+
return fetcher(this.network.fetch, [realmServerAuthorizationMiddleware(this, realms), timingMiddleware], this.network.virtualNetwork);
|
|
1514
|
+
}
|
|
1515
|
+
serverRequestTimingMiddleware;
|
|
1516
|
+
tokenForRealms(realms) {
|
|
1517
|
+
let sessionToken = this.token;
|
|
1518
|
+
if (sessionToken && !isTokenExpired(sessionToken)) return sessionToken;
|
|
1519
|
+
return this.getRealmTokenForRealms(realms);
|
|
1520
|
+
}
|
|
1521
|
+
async reauthenticateRealmServer(rejectedToken) {
|
|
1522
|
+
if (this.reauthenticating) return this.reauthenticating;
|
|
1523
|
+
if (rejectedToken && this.token && this.token !== rejectedToken) return this.token;
|
|
1524
|
+
if (!this.hasClient) return;
|
|
1525
|
+
this.reauthenticating = (async () => {
|
|
1526
|
+
try {
|
|
1527
|
+
if (!this.loggingIn) this.loggingIn = this.loginTask.perform();
|
|
1528
|
+
await this.loggingIn;
|
|
1529
|
+
return this.token;
|
|
1530
|
+
} catch (e) {
|
|
1531
|
+
console.error(`RealmServerService - failed to reauthenticate to realm server: ${e.message}`, e);
|
|
1532
|
+
return;
|
|
1533
|
+
} finally {
|
|
1534
|
+
this.reauthenticating = void 0;
|
|
1535
|
+
}
|
|
1536
|
+
})();
|
|
1537
|
+
return this.reauthenticating;
|
|
1538
|
+
}
|
|
1539
|
+
reauthenticating;
|
|
1540
|
+
async requestForward(args) {
|
|
1541
|
+
await this.login();
|
|
1542
|
+
let { timeoutMs, signal: callerSignal, ...forwardedRequest } = args;
|
|
1543
|
+
let deadline;
|
|
1544
|
+
let deadlineTimer;
|
|
1545
|
+
if (timeoutMs != null && timeoutMs > 0) {
|
|
1546
|
+
deadline = new AbortController();
|
|
1547
|
+
deadlineTimer = setTimeout(() => deadline.abort(), timeoutMs);
|
|
1548
|
+
}
|
|
1549
|
+
let signal = deadline && callerSignal ? AbortSignal.any([deadline.signal, callerSignal]) : deadline?.signal ?? callerSignal;
|
|
1550
|
+
let responded = false;
|
|
1551
|
+
try {
|
|
1552
|
+
const response = await this.network.fetch(`${this.url.href}_request-forward`, {
|
|
1553
|
+
method: "POST",
|
|
1554
|
+
headers: {
|
|
1555
|
+
Accept: "application/json",
|
|
1556
|
+
"Content-Type": "application/json",
|
|
1557
|
+
Authorization: `Bearer ${this.token}`
|
|
1558
|
+
},
|
|
1559
|
+
body: JSON.stringify(forwardedRequest),
|
|
1560
|
+
signal
|
|
1561
|
+
});
|
|
1562
|
+
responded = true;
|
|
1563
|
+
clearTimeout(deadlineTimer);
|
|
1564
|
+
deadlineTimer = void 0;
|
|
1565
|
+
if (!response.ok) {
|
|
1566
|
+
const errorText = await response.text();
|
|
1567
|
+
throw new Error(`Request forward failed: ${response.status} - ${errorText}`);
|
|
1568
|
+
}
|
|
1569
|
+
return response;
|
|
1570
|
+
} catch (e) {
|
|
1571
|
+
if (!responded && deadline?.signal.aborted) throw new Error(`Request forward timed out after ${timeoutMs}ms`);
|
|
1572
|
+
throw e;
|
|
1573
|
+
} finally {
|
|
1574
|
+
clearTimeout(deadlineTimer);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
async registerBot(username) {
|
|
1578
|
+
await this.login();
|
|
1579
|
+
let response = await this.network.fetch(`${this.url.href}_bot-registration`, {
|
|
1580
|
+
method: "POST",
|
|
1581
|
+
headers: {
|
|
1582
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1583
|
+
"Content-Type": "application/vnd.api+json",
|
|
1584
|
+
Authorization: `Bearer ${this.token}`
|
|
1585
|
+
},
|
|
1586
|
+
body: JSON.stringify({ data: {
|
|
1587
|
+
type: "bot-registration",
|
|
1588
|
+
attributes: { username }
|
|
1589
|
+
} })
|
|
1590
|
+
});
|
|
1591
|
+
if (!response.ok) {
|
|
1592
|
+
let err = `Could not register bot: ${response.status} - ${await response.text()}`;
|
|
1593
|
+
console.error(err);
|
|
1594
|
+
throw new Error(err);
|
|
1595
|
+
}
|
|
1596
|
+
return { botRegistrationId: (await response.json()).data.id };
|
|
1597
|
+
}
|
|
1598
|
+
async unregisterBot(botRegistrationId) {
|
|
1599
|
+
await this.login();
|
|
1600
|
+
if (!botRegistrationId) throw new Error("botRegistrationId is required");
|
|
1601
|
+
let response = await this.network.fetch(`${this.url.href}_bot-registration`, {
|
|
1602
|
+
method: "DELETE",
|
|
1603
|
+
headers: {
|
|
1604
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1605
|
+
"Content-Type": "application/vnd.api+json",
|
|
1606
|
+
Authorization: `Bearer ${this.token}`
|
|
1607
|
+
},
|
|
1608
|
+
body: JSON.stringify({ data: {
|
|
1609
|
+
type: "bot-registration",
|
|
1610
|
+
id: botRegistrationId
|
|
1611
|
+
} })
|
|
1612
|
+
});
|
|
1613
|
+
if (!response.ok) {
|
|
1614
|
+
let err = `Could not unregister bot: ${response.status} - ${await response.text()}`;
|
|
1615
|
+
console.error(err);
|
|
1616
|
+
throw new Error(err);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
async getBotRegistrations() {
|
|
1620
|
+
await this.login();
|
|
1621
|
+
let response = await this.network.fetch(`${this.url.href}_bot-registrations`, {
|
|
1622
|
+
method: "GET",
|
|
1623
|
+
headers: {
|
|
1624
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1625
|
+
Authorization: `Bearer ${this.token}`
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
if (!response.ok) {
|
|
1629
|
+
let err = `Could not fetch bot registrations: ${response.status} - ${await response.text()}`;
|
|
1630
|
+
console.error(err);
|
|
1631
|
+
throw new Error(err);
|
|
1632
|
+
}
|
|
1633
|
+
return (await response.json()).data.map((entry) => ({
|
|
1634
|
+
botRegistrationId: entry.id,
|
|
1635
|
+
username: entry.attributes.username,
|
|
1636
|
+
createdAt: entry.attributes.createdAt
|
|
1637
|
+
}));
|
|
1638
|
+
}
|
|
1639
|
+
get realmClient() {
|
|
1640
|
+
return {
|
|
1641
|
+
realmServerURL: ensureTrailingSlash(this.url.href),
|
|
1642
|
+
config: {
|
|
1643
|
+
spaceDomain: config.publishedRealmBoxelSpaceDomain,
|
|
1644
|
+
siteDomain: config.publishedRealmBoxelSiteDomain
|
|
1645
|
+
},
|
|
1646
|
+
authedFetch: (url, init) => this.authedFetch(url, init)
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
async publishRealm(sourceRealmURL, publishedRealmURL) {
|
|
1650
|
+
await this.login();
|
|
1651
|
+
return publishRealm(this.realmClient, {
|
|
1652
|
+
sourceRealmURL,
|
|
1653
|
+
publishedRealmURL
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
async unpublishRealm(publishedRealmURL) {
|
|
1657
|
+
await this.login();
|
|
1658
|
+
return unpublishRealm(this.realmClient, { publishedRealmURL });
|
|
1659
|
+
}
|
|
1660
|
+
async waitForRealmReady(publishedRealmURL, opts) {
|
|
1661
|
+
await this.login();
|
|
1662
|
+
return waitForReady(this.realmClient, {
|
|
1663
|
+
publishedRealmURL,
|
|
1664
|
+
timeoutMs: opts?.timeoutMs,
|
|
1665
|
+
pollIntervalMs: opts?.pollIntervalMs,
|
|
1666
|
+
onProgress: opts?.onProgress,
|
|
1667
|
+
awaitPrerenderHtml: true
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
async checkDomainAvailability(subdomain) {
|
|
1671
|
+
await this.login();
|
|
1672
|
+
let url = new URL(`${this.url.href}_check-boxel-domain-availability`);
|
|
1673
|
+
url.searchParams.set("subdomain", subdomain);
|
|
1674
|
+
let response = await this.realmServer.authedFetch(url.href, {
|
|
1675
|
+
method: "GET",
|
|
1676
|
+
headers: { Accept: "application/json" }
|
|
1677
|
+
});
|
|
1678
|
+
if (!response.ok) {
|
|
1679
|
+
let errorText = await response.text();
|
|
1680
|
+
throw new Error(`Check site name availability failed: ${response.status} - ${errorText}`);
|
|
1681
|
+
}
|
|
1682
|
+
return await response.json();
|
|
1683
|
+
}
|
|
1684
|
+
async fetchBoxelClaimedDomain(sourceRealmURL) {
|
|
1685
|
+
await this.login();
|
|
1686
|
+
let url = new URL(`${this.url.href}_boxel-claimed-domains`);
|
|
1687
|
+
url.searchParams.set("source_realm_url", sourceRealmURL);
|
|
1688
|
+
let response = await this.authedFetch(url.href, {
|
|
1689
|
+
method: "GET",
|
|
1690
|
+
headers: { Accept: SupportedMimeType.JSONAPI }
|
|
1691
|
+
});
|
|
1692
|
+
if (response.status === 404) return null;
|
|
1693
|
+
if (!response.ok) {
|
|
1694
|
+
let errorText = await response.text();
|
|
1695
|
+
throw new Error(`Fetch claimed domain failed: ${response.status} - ${errorText}`);
|
|
1696
|
+
}
|
|
1697
|
+
let { data: { id, attributes } } = await response.json();
|
|
1698
|
+
return {
|
|
1699
|
+
id,
|
|
1700
|
+
hostname: attributes.hostname,
|
|
1701
|
+
subdomain: attributes.subdomain,
|
|
1702
|
+
sourceRealmURL: attributes.sourceRealmURL
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
1705
|
+
async allocateUnlistedPath(sourceRealmURL, options = {}) {
|
|
1706
|
+
await this.login();
|
|
1707
|
+
let response = await this.authedFetch(`${this.url.href}_unlisted-realm-path`, {
|
|
1708
|
+
method: "POST",
|
|
1709
|
+
headers: {
|
|
1710
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1711
|
+
"Content-Type": "application/json"
|
|
1712
|
+
},
|
|
1713
|
+
body: JSON.stringify({
|
|
1714
|
+
sourceRealmURL,
|
|
1715
|
+
regenerate: options.regenerate ?? false
|
|
1716
|
+
})
|
|
1717
|
+
});
|
|
1718
|
+
if (!response.ok) {
|
|
1719
|
+
let errorText = await response.text();
|
|
1720
|
+
throw new Error(`Allocate unlisted link failed: ${response.status} - ${errorText}`);
|
|
1721
|
+
}
|
|
1722
|
+
let { data: { attributes } } = await response.json();
|
|
1723
|
+
return {
|
|
1724
|
+
sourceRealmURL: attributes.sourceRealmURL,
|
|
1725
|
+
slug: attributes.slug
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1728
|
+
async deleteBoxelClaimedDomain(claimedDomainId) {
|
|
1729
|
+
await this.login();
|
|
1730
|
+
let response = await this.authedFetch(`${this.url.href}_boxel-claimed-domains/${claimedDomainId}`, { method: "DELETE" });
|
|
1731
|
+
if (response.status === 204) return;
|
|
1732
|
+
if (!response.ok) {
|
|
1733
|
+
let errorText = await response.text();
|
|
1734
|
+
throw new Error(`Delete claimed domain failed: ${response.status} - ${errorText}`);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
async claimBoxelDomain(sourceRealmURL, hostname) {
|
|
1738
|
+
const requestBody = { data: {
|
|
1739
|
+
type: "claimed-domain",
|
|
1740
|
+
attributes: {
|
|
1741
|
+
source_realm_url: sourceRealmURL,
|
|
1742
|
+
hostname
|
|
1743
|
+
}
|
|
1744
|
+
} };
|
|
1745
|
+
const response = await this.realmServer.authedFetch(`${this.url.href}_boxel-claimed-domains`, {
|
|
1746
|
+
method: "POST",
|
|
1747
|
+
headers: {
|
|
1748
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1749
|
+
"Content-Type": "application/json"
|
|
1750
|
+
},
|
|
1751
|
+
body: JSON.stringify(requestBody)
|
|
1752
|
+
});
|
|
1753
|
+
if (!response.ok) throw new Error(await response.text());
|
|
1754
|
+
return response.json();
|
|
1755
|
+
}
|
|
1756
|
+
async createGitHubPR(params) {
|
|
1757
|
+
await this.login();
|
|
1758
|
+
const response = await this.authedFetch(`${this.url.href}_github-pr`, {
|
|
1759
|
+
method: "POST",
|
|
1760
|
+
headers: {
|
|
1761
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
1762
|
+
"Content-Type": "application/json"
|
|
1763
|
+
},
|
|
1764
|
+
body: JSON.stringify({ data: {
|
|
1765
|
+
type: "github-pr",
|
|
1766
|
+
attributes: params
|
|
1767
|
+
} })
|
|
1768
|
+
});
|
|
1769
|
+
if (!response.ok) {
|
|
1770
|
+
const errorText = await response.text();
|
|
1771
|
+
let errorMessage;
|
|
1772
|
+
try {
|
|
1773
|
+
errorMessage = JSON.parse(errorText).errors?.[0]?.detail || errorText;
|
|
1774
|
+
} catch {
|
|
1775
|
+
errorMessage = errorText;
|
|
1776
|
+
}
|
|
1777
|
+
throw new Error(`GitHub PR creation failed: ${response.status} - ${errorMessage}`);
|
|
1778
|
+
}
|
|
1779
|
+
const { data } = await response.json();
|
|
1780
|
+
return data.attributes;
|
|
1781
|
+
}
|
|
1782
|
+
async getToken() {
|
|
1783
|
+
if (!this.token) await this.login();
|
|
1784
|
+
if (!this.token) throw new Error("Failed to get realm server token");
|
|
1785
|
+
return this.token;
|
|
1786
|
+
}
|
|
1787
|
+
sessionTokensFor(sessionTokens, realm) {
|
|
1788
|
+
let { virtualNetwork } = this.network;
|
|
1789
|
+
let normalized = ensureTrailingSlash(realm);
|
|
1790
|
+
let spellings = new Set([
|
|
1791
|
+
normalized,
|
|
1792
|
+
realm,
|
|
1793
|
+
...virtualNetwork.equivalentURLForms(resolvedRealmURLHref(virtualNetwork, normalized))
|
|
1794
|
+
]);
|
|
1795
|
+
return [...new Set([...spellings].map((spelling) => sessionTokens[spelling]).filter((token) => Boolean(token)))];
|
|
1796
|
+
}
|
|
1797
|
+
getRealmTokenForRealms(realms) {
|
|
1798
|
+
let sessionTokens = this.readSessionTokens();
|
|
1799
|
+
for (let realmURL of realms) {
|
|
1800
|
+
let token = this.sessionTokensFor(sessionTokens, realmURL).find((candidate) => !isTokenExpired(candidate));
|
|
1801
|
+
if (token) return token;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
var sessionLocalStorageKey = RealmServerSessionLocalStorageKey;
|
|
1806
|
+
var secureWindowSignOutTimeoutMs = 1e4;
|
|
1807
|
+
function claimsFromRawToken$1(rawToken) {
|
|
1808
|
+
let [_header, payload] = rawToken.split(".");
|
|
1809
|
+
return JSON.parse(atob(payload));
|
|
1810
|
+
}
|
|
1811
|
+
__name(claimsFromRawToken$1, "claimsFromRawToken");
|
|
1812
|
+
function isTokenExpired(rawToken) {
|
|
1813
|
+
let exp = realmClaimsFromRawToken(rawToken)?.exp;
|
|
1814
|
+
return !Number.isFinite(exp) || exp * 1e3 <= Date.now();
|
|
1815
|
+
}
|
|
1816
|
+
function realmClaimsFromRawToken(rawToken) {
|
|
1817
|
+
try {
|
|
1818
|
+
let [_header, payload] = rawToken.split(".");
|
|
1819
|
+
return JSON.parse(atob(payload));
|
|
1820
|
+
} catch {
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
//#endregion
|
|
1825
|
+
//#region app/services/realm.ts
|
|
1826
|
+
var realm_exports = /* @__PURE__ */ __exportAll({
|
|
1827
|
+
PublishPendingError: () => PublishPendingError,
|
|
1828
|
+
UNKNOWN_REALM_NAME: () => UNKNOWN_REALM_NAME,
|
|
1829
|
+
claimsFromRawToken: () => claimsFromRawToken,
|
|
1830
|
+
default: () => RealmService,
|
|
1831
|
+
maxTokenRefreshBackoffSec: () => maxTokenRefreshBackoffSec,
|
|
1832
|
+
minTokenRefreshIntervalSec: () => 30,
|
|
1833
|
+
tokenRefreshPeriodSec: () => 300
|
|
1834
|
+
});
|
|
1835
|
+
var log = logger("service:realm");
|
|
1836
|
+
var indexingWaiter = buildWaiter("realm:incremental-indexing");
|
|
1837
|
+
var sessionWaiter = buildWaiter("realm:session-login");
|
|
1838
|
+
var UNKNOWN_REALM_NAME = "Unknown Workspace";
|
|
1839
|
+
var INDEX_COUNTS_RETRY_MS = 5e3;
|
|
1840
|
+
var PublishPendingError = class extends Error {
|
|
1841
|
+
constructor(options) {
|
|
1842
|
+
super("Published, but the site is taking longer than usual to finish rendering. It goes live when rendering finishes.", options);
|
|
1843
|
+
this.name = "PublishPendingError";
|
|
1844
|
+
}
|
|
1845
|
+
};
|
|
1846
|
+
var RealmResource = class {
|
|
1847
|
+
static {
|
|
1848
|
+
decorateFieldV2(this.prototype, "matrixService", [service]);
|
|
1849
|
+
}
|
|
1850
|
+
#matrixService = (initializeDeferredDecorator(this, "matrixService"), void 0);
|
|
1851
|
+
static {
|
|
1852
|
+
decorateFieldV2(this.prototype, "network", [service]);
|
|
1853
|
+
}
|
|
1854
|
+
#network = (initializeDeferredDecorator(this, "network"), void 0);
|
|
1855
|
+
static {
|
|
1856
|
+
decorateFieldV2(this.prototype, "messageService", [service]);
|
|
1857
|
+
}
|
|
1858
|
+
#messageService = (initializeDeferredDecorator(this, "messageService"), void 0);
|
|
1859
|
+
static {
|
|
1860
|
+
decorateFieldV2(this.prototype, "realmServer", [service]);
|
|
1861
|
+
}
|
|
1862
|
+
#realmServer = (initializeDeferredDecorator(this, "realmServer"), void 0);
|
|
1863
|
+
static {
|
|
1864
|
+
decorateFieldV2(this.prototype, "info", [tracked]);
|
|
1865
|
+
}
|
|
1866
|
+
#info = (initializeDeferredDecorator(this, "info"), void 0);
|
|
1867
|
+
static {
|
|
1868
|
+
decorateFieldV2(this.prototype, "realmPermissions", [tracked]);
|
|
1869
|
+
}
|
|
1870
|
+
#realmPermissions = (initializeDeferredDecorator(this, "realmPermissions"), void 0);
|
|
1871
|
+
indexingWaiterToken = null;
|
|
1872
|
+
static {
|
|
1873
|
+
decorateFieldV2(this.prototype, "auth", [tracked], function() {
|
|
1874
|
+
return { type: "anonymous" };
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
#auth = (initializeDeferredDecorator(this, "auth"), void 0);
|
|
1878
|
+
subscription;
|
|
1879
|
+
static {
|
|
1880
|
+
decorateFieldV2(this.prototype, "_isPublishing", [tracked], function() {
|
|
1881
|
+
return false;
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
#_isPublishing = (initializeDeferredDecorator(this, "_isPublishing"), void 0);
|
|
1885
|
+
_publishingRealms = new TrackedArray();
|
|
1886
|
+
_publishProgress = new TrackedMap();
|
|
1887
|
+
_unPublishingRealms = new TrackedArray();
|
|
1888
|
+
constructor(realmURL, token, realmService) {
|
|
1889
|
+
this.realmURL = realmURL;
|
|
1890
|
+
this.realmService = realmService;
|
|
1891
|
+
this.token = token;
|
|
1892
|
+
registerDestructor(this, () => {
|
|
1893
|
+
if (this.subscription) this.subscription.unsubscribe();
|
|
1894
|
+
if (this.indexingWaiterToken) {
|
|
1895
|
+
indexingWaiter.endAsync(this.indexingWaiterToken);
|
|
1896
|
+
this.indexingWaiterToken = null;
|
|
1897
|
+
}
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
get isLoggedIn() {
|
|
1901
|
+
return this.auth.type === "logged-in";
|
|
1902
|
+
}
|
|
1903
|
+
get url() {
|
|
1904
|
+
return this.realmURL;
|
|
1905
|
+
}
|
|
1906
|
+
get token() {
|
|
1907
|
+
if (this.auth.type === "logged-in") return this.auth.token;
|
|
1908
|
+
}
|
|
1909
|
+
set token(value) {
|
|
1910
|
+
if (value) this.auth = {
|
|
1911
|
+
type: "logged-in",
|
|
1912
|
+
token: value,
|
|
1913
|
+
claims: claimsFromRawToken(value)
|
|
1914
|
+
};
|
|
1915
|
+
else this.auth = { type: "anonymous" };
|
|
1916
|
+
SessionStorage.persist(this.realmURL, value);
|
|
1917
|
+
this.tokenRefresher.perform();
|
|
1918
|
+
}
|
|
1919
|
+
get isPublic() {
|
|
1920
|
+
return this.info?.isPublic;
|
|
1921
|
+
}
|
|
1922
|
+
get claims() {
|
|
1923
|
+
if (this.auth.type === "logged-in") return this.auth.claims;
|
|
1924
|
+
}
|
|
1925
|
+
get realmClient() {
|
|
1926
|
+
let userId = this.claims?.user;
|
|
1927
|
+
return {
|
|
1928
|
+
realmServerURL: ensureTrailingSlash(this.realmServer.url.href),
|
|
1929
|
+
config: {
|
|
1930
|
+
spaceDomain: config.publishedRealmBoxelSpaceDomain,
|
|
1931
|
+
siteDomain: config.publishedRealmBoxelSiteDomain
|
|
1932
|
+
},
|
|
1933
|
+
matrixUsername: userId ? getMatrixUsername(userId) : void 0,
|
|
1934
|
+
authedFetch: (url, init) => this.network.authedFetch(url, init)
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
get canRead() {
|
|
1938
|
+
return !!this.isPublic || !!this.claims?.permissions?.includes("read");
|
|
1939
|
+
}
|
|
1940
|
+
get canWrite() {
|
|
1941
|
+
return !!this.claims?.permissions?.includes("write");
|
|
1942
|
+
}
|
|
1943
|
+
get isRealmOwner() {
|
|
1944
|
+
return !!this.claims?.permissions?.includes("realm-owner");
|
|
1945
|
+
}
|
|
1946
|
+
loggingIn;
|
|
1947
|
+
refreshSchedule = new TokenRefreshSchedule();
|
|
1948
|
+
async login() {
|
|
1949
|
+
if (this.auth.type === "logged-in") {
|
|
1950
|
+
await this.subscribe();
|
|
1951
|
+
return;
|
|
1952
|
+
}
|
|
1953
|
+
if (!this.loggingIn) this.loggingIn = this.loginTask.perform();
|
|
1954
|
+
await this.loggingIn;
|
|
1955
|
+
await this.subscribe();
|
|
1956
|
+
}
|
|
1957
|
+
async subscribe() {
|
|
1958
|
+
if (this.subscription) return;
|
|
1959
|
+
if (!this.fetchingInfo) await this.fetchInfo();
|
|
1960
|
+
this.subscription = { unsubscribe: this.messageService.subscribe(this.realmURL, (event) => {
|
|
1961
|
+
if (!this.info) {
|
|
1962
|
+
console.warn(`No realm info exists for ${this.realmURL} when trying to set indexing status`);
|
|
1963
|
+
return;
|
|
1964
|
+
}
|
|
1965
|
+
if (event.eventName !== "index") return;
|
|
1966
|
+
let data = event;
|
|
1967
|
+
switch (data.indexType) {
|
|
1968
|
+
case "incremental-index-initiation":
|
|
1969
|
+
this.info.isIndexing = true;
|
|
1970
|
+
if (!this.indexingWaiterToken) this.indexingWaiterToken = indexingWaiter.beginAsync(void 0, this.realmURL);
|
|
1971
|
+
break;
|
|
1972
|
+
case "full":
|
|
1973
|
+
case "incremental":
|
|
1974
|
+
this.info.isIndexing = false;
|
|
1975
|
+
if (this.indexingWaiterToken) {
|
|
1976
|
+
indexingWaiter.endAsync(this.indexingWaiterToken);
|
|
1977
|
+
this.indexingWaiterToken = null;
|
|
1978
|
+
}
|
|
1979
|
+
if (data.indexType === "incremental" && data.invalidations.includes(`${this.realmURL}realm`)) this.refreshInfo();
|
|
1980
|
+
if (data.indexType === "incremental" && this.info) this.info.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1981
|
+
this.realmService.markIndexCountsStale(this.realmURL);
|
|
1982
|
+
break;
|
|
1983
|
+
default: throw assertNever(data);
|
|
1984
|
+
}
|
|
1985
|
+
}) };
|
|
1986
|
+
}
|
|
1987
|
+
loginTask = buildTask(() => ({
|
|
1988
|
+
context: this,
|
|
1989
|
+
generator: function* () {
|
|
1990
|
+
let sessionWaiterToken = sessionWaiter.beginAsync();
|
|
1991
|
+
try {
|
|
1992
|
+
let token = yield this.matrixService.createRealmSession(new URL(this.realmURL));
|
|
1993
|
+
this.refreshSchedule.minted(token);
|
|
1994
|
+
this.token = token;
|
|
1995
|
+
} catch (e) {
|
|
1996
|
+
console.error(`RealmService - Failed to login to realm: ${e.message}`, e);
|
|
1997
|
+
this.token = void 0;
|
|
1998
|
+
const event = new CustomEvent("boxel-auth-error", { detail: e });
|
|
1999
|
+
globalThis.dispatchEvent(event);
|
|
2000
|
+
} finally {
|
|
2001
|
+
this.loggingIn = void 0;
|
|
2002
|
+
sessionWaiter.endAsync(sessionWaiterToken);
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
}), null, "loginTask", null);
|
|
2006
|
+
logout() {
|
|
2007
|
+
this.clearRealmSession();
|
|
2008
|
+
this.refreshSchedule.reset();
|
|
2009
|
+
src_default.localStorage.removeItem(SessionLocalStorageKey);
|
|
2010
|
+
syncTokenToServiceWorker(this.realmURL, void 0);
|
|
2011
|
+
}
|
|
2012
|
+
clearRealmSession() {
|
|
2013
|
+
this.auth = { type: "anonymous" };
|
|
2014
|
+
SessionStorage.remove(this.realmURL);
|
|
2015
|
+
syncTokenToServiceWorker(this.realmURL, void 0);
|
|
2016
|
+
this.loginTask.cancelAll();
|
|
2017
|
+
this.tokenRefresher.cancelAll();
|
|
2018
|
+
this.loggingIn = void 0;
|
|
2019
|
+
this.fetchInfoTask.cancelAll();
|
|
2020
|
+
this.fetchingInfo = void 0;
|
|
2021
|
+
this.fetchRealmPermissionsTask.cancelAll();
|
|
2022
|
+
}
|
|
2023
|
+
fetchingInfo;
|
|
2024
|
+
async fetchInfo() {
|
|
2025
|
+
if (!this.fetchingInfo) this.fetchingInfo = this.fetchInfoTask.perform();
|
|
2026
|
+
try {
|
|
2027
|
+
await this.fetchingInfo;
|
|
2028
|
+
} catch (error) {
|
|
2029
|
+
if (!didCancel(error)) throw error;
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
fetchInfoTask = buildTask(() => ({
|
|
2033
|
+
context: this,
|
|
2034
|
+
generator: function* () {
|
|
2035
|
+
try {
|
|
2036
|
+
if (this.info) return;
|
|
2037
|
+
yield this.realmService.waitForBulkInfoIfNeeded();
|
|
2038
|
+
if (this.info) return;
|
|
2039
|
+
yield this.realmService.prefetchRealmInfos([this.realmURL]);
|
|
2040
|
+
if (this.info) return;
|
|
2041
|
+
let { info, isPublic } = yield this.fetchInfoFromServer();
|
|
2042
|
+
this.info = new TrackedObject({
|
|
2043
|
+
...info,
|
|
2044
|
+
isIndexing: false,
|
|
2045
|
+
isPublic
|
|
2046
|
+
});
|
|
2047
|
+
} finally {
|
|
2048
|
+
this.fetchingInfo = void 0;
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
}), null, "fetchInfoTask", "drop");
|
|
2052
|
+
async fetchInfoFromServer() {
|
|
2053
|
+
let headers = {
|
|
2054
|
+
Accept: SupportedMimeType.RealmInfo,
|
|
2055
|
+
...this.auth.type === "logged-in" ? { Authorization: `Bearer ${this.token}` } : {}
|
|
2056
|
+
};
|
|
2057
|
+
let response;
|
|
2058
|
+
try {
|
|
2059
|
+
response = await this.network.authedFetch(`${this.realmURL}_info`, {
|
|
2060
|
+
method: "QUERY",
|
|
2061
|
+
headers: {
|
|
2062
|
+
...headers,
|
|
2063
|
+
"Content-Type": "application/json"
|
|
2064
|
+
},
|
|
2065
|
+
body: JSON.stringify({ realms: [this.realmURL] })
|
|
2066
|
+
});
|
|
2067
|
+
} catch (error) {
|
|
2068
|
+
if (isTesting()) console.warn(`[realm-service] realm info fetch failed ${JSON.stringify({
|
|
2069
|
+
realmURL: this.realmURL,
|
|
2070
|
+
error: String(error)
|
|
2071
|
+
})}`);
|
|
2072
|
+
throw error;
|
|
2073
|
+
}
|
|
2074
|
+
if (response.status !== 200) {
|
|
2075
|
+
let responseText = await response.text();
|
|
2076
|
+
if (isTesting()) console.warn(`[realm-service] realm info fetch bad status ${JSON.stringify({
|
|
2077
|
+
realmURL: this.realmURL,
|
|
2078
|
+
status: response.status,
|
|
2079
|
+
responseText
|
|
2080
|
+
})}`);
|
|
2081
|
+
throw new Error(`Failed to fetch realm info for ${this.realmURL}: ${response.status}`);
|
|
2082
|
+
}
|
|
2083
|
+
let json = await waitForPromise(response.json());
|
|
2084
|
+
let realmData = Array.isArray(json.data) ? json.data[0] : json.data;
|
|
2085
|
+
return {
|
|
2086
|
+
info: {
|
|
2087
|
+
url: realmData.id,
|
|
2088
|
+
...realmData.attributes
|
|
2089
|
+
},
|
|
2090
|
+
isPublic: Boolean(response.headers.get("x-boxel-realm-public-readable") || response.headers.get("x-boxel-realms-public-readable"))
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
refreshInfo() {
|
|
2094
|
+
return this.refreshInfoTask.perform();
|
|
2095
|
+
}
|
|
2096
|
+
refreshInfoTask = buildTask(() => ({
|
|
2097
|
+
context: this,
|
|
2098
|
+
generator: function* () {
|
|
2099
|
+
if (!this.info) {
|
|
2100
|
+
yield this.fetchInfo();
|
|
2101
|
+
return;
|
|
2102
|
+
}
|
|
2103
|
+
let { info, isPublic } = yield this.fetchInfoFromServer();
|
|
2104
|
+
Object.assign(this.info, info, {
|
|
2105
|
+
isPublic,
|
|
2106
|
+
lastPublishedAt: this.info.lastPublishedAt
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
}), null, "refreshInfoTask", "restartable");
|
|
2110
|
+
async fetchRealmPermissions() {
|
|
2111
|
+
return await this.fetchRealmPermissionsTask.perform();
|
|
2112
|
+
}
|
|
2113
|
+
fetchRealmPermissionsTask = buildTask(() => ({
|
|
2114
|
+
context: this,
|
|
2115
|
+
generator: function* () {
|
|
2116
|
+
if (this.realmPermissions !== void 0) return this.realmPermissions;
|
|
2117
|
+
yield this.loginTask.perform();
|
|
2118
|
+
let headers = {
|
|
2119
|
+
Accept: SupportedMimeType.Permissions,
|
|
2120
|
+
Authorization: `Bearer ${this.token}`
|
|
2121
|
+
};
|
|
2122
|
+
let response = yield this.network.authedFetch(`${this.realmURL}_permissions`, { headers });
|
|
2123
|
+
if (response.status === 403) {
|
|
2124
|
+
this.realmPermissions = null;
|
|
2125
|
+
return;
|
|
2126
|
+
} else if (response.status !== 200) throw new Error(`Failed to fetch realm permissions for ${this.realmURL}: ${response.status}`);
|
|
2127
|
+
let json = yield waitForPromise(response.json());
|
|
2128
|
+
this.realmPermissions = json.data.attributes.permissions;
|
|
2129
|
+
return this.realmPermissions;
|
|
2130
|
+
}
|
|
2131
|
+
}), null, "fetchRealmPermissionsTask", "drop");
|
|
2132
|
+
async fetchPrivateDependencyReport() {
|
|
2133
|
+
await this.loginTask.perform();
|
|
2134
|
+
return waitForPromise(fetchPublishabilityReport(this.realmClient, { realmURL: this.realmURL }));
|
|
2135
|
+
}
|
|
2136
|
+
tokenRefresher = buildTask(() => ({
|
|
2137
|
+
context: this,
|
|
2138
|
+
generator: function* () {
|
|
2139
|
+
if (globalThis.__boxelRenderContext || !this.claims || !this.token) return;
|
|
2140
|
+
let { exp } = this.claims;
|
|
2141
|
+
let refreshMs = this.refreshSchedule.refreshDelayMs(this.token, exp, (delayMs) => console.error(`RealmService - the session minted for ${this.realmURL} expires at ${(/* @__PURE__ */ new Date(exp * 1e3)).toISOString()}, too soon to schedule a refresh; minting again in ${delayMs / 1e3}s`));
|
|
2142
|
+
yield this.realmService.waitForTokenRefresh(refreshMs);
|
|
2143
|
+
if (!this.loggingIn) {
|
|
2144
|
+
this.loggingIn = this.loginTask.perform();
|
|
2145
|
+
yield this.loggingIn;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
}), null, "tokenRefresher", "restartable");
|
|
2149
|
+
async publish(urls) {
|
|
2150
|
+
if (this._isPublishing) return;
|
|
2151
|
+
try {
|
|
2152
|
+
this._isPublishing = true;
|
|
2153
|
+
let accepted = [];
|
|
2154
|
+
const publishPromises = urls.map(async (url) => {
|
|
2155
|
+
if (this._publishingRealms.includes(url)) return;
|
|
2156
|
+
this._publishingRealms.push(url);
|
|
2157
|
+
try {
|
|
2158
|
+
let result = await this.realmServer.publishRealm(this.url, url);
|
|
2159
|
+
accepted.push(result);
|
|
2160
|
+
try {
|
|
2161
|
+
await this.realmServer.waitForRealmReady(result.publishedRealmURL, { onProgress: (progress) => this._publishProgress.set(url, progress) });
|
|
2162
|
+
} catch (error) {
|
|
2163
|
+
if (error instanceof ReadinessTimeoutError && error.stage === "prerender-html" && !error.stalled) throw new PublishPendingError({ cause: error });
|
|
2164
|
+
throw error;
|
|
2165
|
+
}
|
|
2166
|
+
return result;
|
|
2167
|
+
} catch (error) {
|
|
2168
|
+
console.error(`Error publishing to URL ${url}:`, error);
|
|
2169
|
+
throw error;
|
|
2170
|
+
} finally {
|
|
2171
|
+
this._publishingRealms.splice(this._publishingRealms.indexOf(url), 1);
|
|
2172
|
+
this._publishProgress.delete(url);
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2175
|
+
const results = await Promise.allSettled(publishPromises);
|
|
2176
|
+
if (this.info) {
|
|
2177
|
+
let lastPublishedAt = Object.fromEntries(accepted.map((result) => [result.publishedRealmURL, result.lastPublishedAt]));
|
|
2178
|
+
this.info = {
|
|
2179
|
+
...this.info,
|
|
2180
|
+
lastPublishedAt: {
|
|
2181
|
+
...this.info.lastPublishedAt && typeof this.info.lastPublishedAt === "object" ? this.info.lastPublishedAt : {},
|
|
2182
|
+
...lastPublishedAt
|
|
2183
|
+
}
|
|
2184
|
+
};
|
|
2185
|
+
}
|
|
2186
|
+
return results;
|
|
2187
|
+
} catch (error) {
|
|
2188
|
+
console.error(`Error publishing to URLs ${urls}:`, error);
|
|
2189
|
+
return;
|
|
2190
|
+
} finally {
|
|
2191
|
+
this._isPublishing = false;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
get isPublishing() {
|
|
2195
|
+
return this._isPublishing;
|
|
2196
|
+
}
|
|
2197
|
+
get isPublishingToAnyRealms() {
|
|
2198
|
+
return this._publishingRealms.length > 0;
|
|
2199
|
+
}
|
|
2200
|
+
get publishingRealms() {
|
|
2201
|
+
return this._publishingRealms;
|
|
2202
|
+
}
|
|
2203
|
+
publishProgress(publishedRealmURL) {
|
|
2204
|
+
return this._publishProgress.get(publishedRealmURL);
|
|
2205
|
+
}
|
|
2206
|
+
async unpublish(url) {
|
|
2207
|
+
if (this._unPublishingRealms.includes(url)) return;
|
|
2208
|
+
try {
|
|
2209
|
+
this._unPublishingRealms.push(url);
|
|
2210
|
+
await this.realmServer.unpublishRealm(url);
|
|
2211
|
+
if (this.info && this.info.lastPublishedAt && typeof this.info.lastPublishedAt === "object") {
|
|
2212
|
+
delete this.info.lastPublishedAt[url];
|
|
2213
|
+
this.info = { ...this.info };
|
|
2214
|
+
}
|
|
2215
|
+
} catch (error) {
|
|
2216
|
+
console.error(`Error unpublishing from URL ${url}:`, error);
|
|
2217
|
+
throw error;
|
|
2218
|
+
} finally {
|
|
2219
|
+
this._unPublishingRealms.splice(this._unPublishingRealms.indexOf(url), 1);
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
isUnpublishingAnyRealms = () => {
|
|
2223
|
+
return this._unPublishingRealms.length > 0;
|
|
2224
|
+
};
|
|
2225
|
+
isUnpublishingRealm = (publishedRealmURL) => {
|
|
2226
|
+
return this._unPublishingRealms.includes(publishedRealmURL);
|
|
2227
|
+
};
|
|
2228
|
+
};
|
|
2229
|
+
var RealmService = class extends Service {
|
|
2230
|
+
static {
|
|
2231
|
+
decorateFieldV2(this.prototype, "realmServer", [service]);
|
|
2232
|
+
}
|
|
2233
|
+
#realmServer = (initializeDeferredDecorator(this, "realmServer"), void 0);
|
|
2234
|
+
static {
|
|
2235
|
+
decorateFieldV2(this.prototype, "matrixService", [service]);
|
|
2236
|
+
}
|
|
2237
|
+
#matrixService = (initializeDeferredDecorator(this, "matrixService"), void 0);
|
|
2238
|
+
static {
|
|
2239
|
+
decorateFieldV2(this.prototype, "network", [service]);
|
|
2240
|
+
}
|
|
2241
|
+
#network = (initializeDeferredDecorator(this, "network"), void 0);
|
|
2242
|
+
static {
|
|
2243
|
+
decorateFieldV2(this.prototype, "session", [service]);
|
|
2244
|
+
}
|
|
2245
|
+
#session = (initializeDeferredDecorator(this, "session"), void 0);
|
|
2246
|
+
_realms = this.restoreSessions();
|
|
2247
|
+
currentKnownRealms = new TrackedSet();
|
|
2248
|
+
reauthentications = /* @__PURE__ */ new Map();
|
|
2249
|
+
bulkInfoPromise;
|
|
2250
|
+
indexCountsByRealm = new TrackedMap();
|
|
2251
|
+
inFlightIndexCounts = /* @__PURE__ */ new Set();
|
|
2252
|
+
staleIndexCounts = /* @__PURE__ */ new Set();
|
|
2253
|
+
static {
|
|
2254
|
+
decorateFieldV2(this.prototype, "indexCountsEpoch", [tracked], function() {
|
|
2255
|
+
return 0;
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
#indexCountsEpoch = (initializeDeferredDecorator(this, "indexCountsEpoch"), void 0);
|
|
2259
|
+
realmPathsCache = /* @__PURE__ */ new Map();
|
|
2260
|
+
realmOfCache = /* @__PURE__ */ new Map();
|
|
2261
|
+
lastRestoredSessionsString = null;
|
|
2262
|
+
static {
|
|
2263
|
+
decorateFieldV2(this.prototype, "identifyRealmTracker", [tracked], function() {
|
|
2264
|
+
return 0;
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
#identifyRealmTracker = (initializeDeferredDecorator(this, "identifyRealmTracker"), void 0);
|
|
2268
|
+
constructor(owner) {
|
|
2269
|
+
super(owner);
|
|
2270
|
+
this.session.register(this);
|
|
2271
|
+
}
|
|
2272
|
+
get realms() {
|
|
2273
|
+
return this._realms;
|
|
2274
|
+
}
|
|
2275
|
+
resetState() {
|
|
2276
|
+
this.logout();
|
|
2277
|
+
this._realms = /* @__PURE__ */ new Map();
|
|
2278
|
+
this.currentKnownRealms = new TrackedSet();
|
|
2279
|
+
this.reauthentications.clear();
|
|
2280
|
+
this.bulkInfoPromise = void 0;
|
|
2281
|
+
this.identifyRealmTracker++;
|
|
2282
|
+
this.realmPathsCache.clear();
|
|
2283
|
+
this.realmOfCache.clear();
|
|
2284
|
+
this.lastRestoredSessionsString = null;
|
|
2285
|
+
}
|
|
2286
|
+
async waitForBulkInfoIfNeeded() {
|
|
2287
|
+
if (this.bulkInfoPromise) await this.bulkInfoPromise;
|
|
2288
|
+
}
|
|
2289
|
+
async ensureRealmMeta(realmURL) {
|
|
2290
|
+
await this.getOrCreateRealmResource(realmURL).fetchInfo();
|
|
2291
|
+
}
|
|
2292
|
+
async login(realmURL) {
|
|
2293
|
+
await this.getOrCreateRealmResource(realmURL).login();
|
|
2294
|
+
}
|
|
2295
|
+
async prefetchRealmInfos(realmUrls) {
|
|
2296
|
+
let uniqueRealmUrls = Array.from(new Set(realmUrls));
|
|
2297
|
+
if (uniqueRealmUrls.length === 0) return;
|
|
2298
|
+
if (!this.realmServer.hasClient) return;
|
|
2299
|
+
if (this.bulkInfoPromise) await this.bulkInfoPromise;
|
|
2300
|
+
let missingRealmUrls = uniqueRealmUrls.filter((realmURL) => {
|
|
2301
|
+
return !this.knownRealm(realmURL, { tracked: false })?.info;
|
|
2302
|
+
});
|
|
2303
|
+
if (missingRealmUrls.length === 0) return;
|
|
2304
|
+
let bulkPromise = (async () => {
|
|
2305
|
+
try {
|
|
2306
|
+
let { data, publicReadableRealms } = await this.realmServer.fetchRealmInfos(missingRealmUrls);
|
|
2307
|
+
let publicReadableSet = new Set(Array.from(publicReadableRealms).map((realmURL) => ensureTrailingSlash(realmURL)));
|
|
2308
|
+
for (let entry of data) {
|
|
2309
|
+
let realmURL = ensureTrailingSlash(entry.id);
|
|
2310
|
+
this.applyRealmInfo(entry.id, entry.attributes, publicReadableSet.has(realmURL));
|
|
2311
|
+
}
|
|
2312
|
+
} catch (error) {
|
|
2313
|
+
log.warn(`Failed to prefetch realm info: ${error}`);
|
|
2314
|
+
}
|
|
2315
|
+
})();
|
|
2316
|
+
this.bulkInfoPromise = bulkPromise;
|
|
2317
|
+
try {
|
|
2318
|
+
await bulkPromise;
|
|
2319
|
+
} finally {
|
|
2320
|
+
if (this.bulkInfoPromise === bulkPromise) this.bulkInfoPromise = void 0;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
indexCounts(realmURL) {
|
|
2324
|
+
return this.indexCountsByRealm.get(ensureTrailingSlash(String(realmURL)));
|
|
2325
|
+
}
|
|
2326
|
+
get indexCountsRevision() {
|
|
2327
|
+
return this.indexCountsEpoch;
|
|
2328
|
+
}
|
|
2329
|
+
markIndexCountsStale(realmURL) {
|
|
2330
|
+
let key = ensureTrailingSlash(realmURL);
|
|
2331
|
+
if (!this.indexCountsByRealm.has(key) && !this.inFlightIndexCounts.has(key)) return;
|
|
2332
|
+
this.staleIndexCounts.add(key);
|
|
2333
|
+
this.indexCountsEpoch++;
|
|
2334
|
+
}
|
|
2335
|
+
loadIndexCounts(realmURLs) {
|
|
2336
|
+
let wanted = Array.from(new Set(realmURLs.map((realmURL) => ensureTrailingSlash(realmURL)))).filter((realmURL) => (!this.indexCountsByRealm.has(realmURL) || this.staleIndexCounts.has(realmURL)) && !this.inFlightIndexCounts.has(realmURL));
|
|
2337
|
+
if (wanted.length === 0) return;
|
|
2338
|
+
for (let realmURL of wanted) {
|
|
2339
|
+
this.staleIndexCounts.delete(realmURL);
|
|
2340
|
+
this.inFlightIndexCounts.add(realmURL);
|
|
2341
|
+
}
|
|
2342
|
+
(async () => {
|
|
2343
|
+
try {
|
|
2344
|
+
let data = await this.realmServer.fetchRealmIndexCounts(wanted);
|
|
2345
|
+
if (this.isDestroyed) return;
|
|
2346
|
+
let returned = /* @__PURE__ */ new Set();
|
|
2347
|
+
for (let entry of data) {
|
|
2348
|
+
let key = ensureTrailingSlash(entry.id);
|
|
2349
|
+
returned.add(key);
|
|
2350
|
+
this.indexCountsByRealm.set(key, entry.attributes);
|
|
2351
|
+
}
|
|
2352
|
+
for (let realmURL of wanted) if (!returned.has(realmURL)) this.staleIndexCounts.add(realmURL);
|
|
2353
|
+
} catch (error) {
|
|
2354
|
+
log.warn(`Failed to fetch realm index counts: ${error}`);
|
|
2355
|
+
if (!this.isDestroyed) for (let realmURL of wanted) this.staleIndexCounts.add(realmURL);
|
|
2356
|
+
} finally {
|
|
2357
|
+
if (!this.isDestroyed) {
|
|
2358
|
+
for (let realmURL of wanted) this.inFlightIndexCounts.delete(realmURL);
|
|
2359
|
+
if (wanted.some((realmURL) => this.staleIndexCounts.has(realmURL))) this.scheduleIndexCountsRetry();
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
})();
|
|
2363
|
+
}
|
|
2364
|
+
indexCountsRetryTimer;
|
|
2365
|
+
scheduleIndexCountsRetry() {
|
|
2366
|
+
if (this.indexCountsRetryTimer != null || this.isDestroyed) return;
|
|
2367
|
+
this.indexCountsRetryTimer = setTimeout(() => {
|
|
2368
|
+
this.indexCountsRetryTimer = void 0;
|
|
2369
|
+
if (this.isDestroyed || this.staleIndexCounts.size === 0) return;
|
|
2370
|
+
this.indexCountsEpoch++;
|
|
2371
|
+
}, INDEX_COUNTS_RETRY_MS);
|
|
2372
|
+
}
|
|
2373
|
+
willDestroy() {
|
|
2374
|
+
super.willDestroy();
|
|
2375
|
+
if (this.indexCountsRetryTimer != null) {
|
|
2376
|
+
clearTimeout(this.indexCountsRetryTimer);
|
|
2377
|
+
this.indexCountsRetryTimer = void 0;
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
applyRealmInfo(realmURL, info, isPublic) {
|
|
2381
|
+
let resource = this.getOrCreateRealmResource(realmURL);
|
|
2382
|
+
let isIndexing = resource.info?.isIndexing ?? false;
|
|
2383
|
+
resource.info = new TrackedObject({
|
|
2384
|
+
url: realmURL,
|
|
2385
|
+
...info,
|
|
2386
|
+
isIndexing,
|
|
2387
|
+
isPublic
|
|
2388
|
+
});
|
|
2389
|
+
}
|
|
2390
|
+
restoreSessionsFromStorage({ startingVisit = false } = {}) {
|
|
2391
|
+
let sessionsString = src_default.localStorage.getItem(SessionLocalStorageKey);
|
|
2392
|
+
if (!startingVisit && sessionsString === this.lastRestoredSessionsString) return;
|
|
2393
|
+
if (!sessionsString && !startingVisit) {
|
|
2394
|
+
this.lastRestoredSessionsString = sessionsString;
|
|
2395
|
+
return;
|
|
2396
|
+
}
|
|
2397
|
+
let tokens = sessionsString ? JSON.parse(sessionsString) : {};
|
|
2398
|
+
this.lastRestoredSessionsString = sessionsString;
|
|
2399
|
+
if (startingVisit) this.dropSessionsNotCarriedBy(tokens);
|
|
2400
|
+
for (let [realmURL, token] of Object.entries(tokens)) {
|
|
2401
|
+
let resource = this.getOrCreateRealmResource(realmURL, token, { exact: true });
|
|
2402
|
+
if (token && resource.token !== token) resource.token = token;
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
dropSessionsNotCarriedBy(tokens) {
|
|
2406
|
+
let vn = this.network.virtualNetwork;
|
|
2407
|
+
let carried = new Set(Object.keys(tokens).map((realmURL) => vn.unresolveURL(realmURL)));
|
|
2408
|
+
let stale = [...this._realms].filter(([realmURL, resource]) => resource.token && !carried.has(vn.unresolveURL(realmURL))).map(([realmURL]) => realmURL);
|
|
2409
|
+
for (let realmURL of stale) this.removeRealm(realmURL);
|
|
2410
|
+
}
|
|
2411
|
+
info = (url) => {
|
|
2412
|
+
url = this.toLookupURL(url);
|
|
2413
|
+
let resource = this.knownRealm(url, { tracked: false });
|
|
2414
|
+
if (!resource) {
|
|
2415
|
+
this.identifyRealm.perform(url).catch((error) => this.swallowBackgroundInfoError(url, "identify", error));
|
|
2416
|
+
this.identifyRealmTracker;
|
|
2417
|
+
return {
|
|
2418
|
+
name: UNKNOWN_REALM_NAME,
|
|
2419
|
+
backgroundURL: null,
|
|
2420
|
+
iconURL: null,
|
|
2421
|
+
showAsCatalog: null,
|
|
2422
|
+
visibility: "private",
|
|
2423
|
+
publishable: null,
|
|
2424
|
+
isIndexing: false,
|
|
2425
|
+
isPublic: false,
|
|
2426
|
+
lastPublishedAt: null,
|
|
2427
|
+
createdAt: null,
|
|
2428
|
+
updatedAt: null
|
|
2429
|
+
};
|
|
2430
|
+
}
|
|
2431
|
+
if (!resource.info) {
|
|
2432
|
+
resource.fetchInfo().catch((error) => this.swallowBackgroundInfoError(url, "fetchInfo", error));
|
|
2433
|
+
return {
|
|
2434
|
+
name: UNKNOWN_REALM_NAME,
|
|
2435
|
+
backgroundURL: null,
|
|
2436
|
+
iconURL: null,
|
|
2437
|
+
showAsCatalog: null,
|
|
2438
|
+
visibility: "private",
|
|
2439
|
+
publishable: null,
|
|
2440
|
+
isIndexing: false,
|
|
2441
|
+
isPublic: false,
|
|
2442
|
+
lastPublishedAt: null,
|
|
2443
|
+
createdAt: null,
|
|
2444
|
+
updatedAt: null
|
|
2445
|
+
};
|
|
2446
|
+
} else return resource.info;
|
|
2447
|
+
};
|
|
2448
|
+
swallowBackgroundInfoError(url, op, error) {
|
|
2449
|
+
if (didCancel(error)) return;
|
|
2450
|
+
log.warn(`background realm-info ${op} failed for ${url}: ${error}`);
|
|
2451
|
+
if (isTesting() && op === "identify") console.warn(`[realm-service] background realm-info load failed ${JSON.stringify({
|
|
2452
|
+
realmURL: url,
|
|
2453
|
+
op,
|
|
2454
|
+
error: String(error)
|
|
2455
|
+
})}`);
|
|
2456
|
+
}
|
|
2457
|
+
async allUsersPermissions(url) {
|
|
2458
|
+
url = this.toLookupURL(url);
|
|
2459
|
+
let resource = this.knownRealm(url);
|
|
2460
|
+
if (!resource) await this.identifyRealm.perform(url);
|
|
2461
|
+
return await resource?.fetchRealmPermissions();
|
|
2462
|
+
}
|
|
2463
|
+
removeRealm(url) {
|
|
2464
|
+
let resource = this._realms.get(url);
|
|
2465
|
+
if (resource) resource.clearRealmSession();
|
|
2466
|
+
else {
|
|
2467
|
+
SessionStorage.remove(url);
|
|
2468
|
+
syncTokenToServiceWorker(url, void 0);
|
|
2469
|
+
}
|
|
2470
|
+
this._realms.delete(url);
|
|
2471
|
+
this.currentKnownRealms.delete(url);
|
|
2472
|
+
}
|
|
2473
|
+
isPublic = (url) => {
|
|
2474
|
+
return this.knownRealm(url)?.isPublic ?? false;
|
|
2475
|
+
};
|
|
2476
|
+
canRead = (url) => {
|
|
2477
|
+
return this.knownRealm(url)?.canRead ?? false;
|
|
2478
|
+
};
|
|
2479
|
+
canWrite = (url) => {
|
|
2480
|
+
return this.knownRealm(url)?.canWrite ?? false;
|
|
2481
|
+
};
|
|
2482
|
+
isRealmOwner = (url) => {
|
|
2483
|
+
return this.knownRealm(url)?.isRealmOwner ?? false;
|
|
2484
|
+
};
|
|
2485
|
+
canPublish = (url) => {
|
|
2486
|
+
return this.isRealmOwner(url) && this.info(url).publishable === true;
|
|
2487
|
+
};
|
|
2488
|
+
isInfoLoaded = (realm) => {
|
|
2489
|
+
return this.knownRealm(this.toLookupURL(realm))?.info !== void 0;
|
|
2490
|
+
};
|
|
2491
|
+
url = (url) => {
|
|
2492
|
+
return this.knownRealm(url)?.url;
|
|
2493
|
+
};
|
|
2494
|
+
permissions = (url) => {
|
|
2495
|
+
let self = this;
|
|
2496
|
+
return {
|
|
2497
|
+
get canRead() {
|
|
2498
|
+
return self.canRead(url);
|
|
2499
|
+
},
|
|
2500
|
+
get canWrite() {
|
|
2501
|
+
return self.canWrite(url);
|
|
2502
|
+
}
|
|
2503
|
+
};
|
|
2504
|
+
};
|
|
2505
|
+
meta = (url) => {
|
|
2506
|
+
let self = this;
|
|
2507
|
+
return {
|
|
2508
|
+
get info() {
|
|
2509
|
+
return self.info(url);
|
|
2510
|
+
},
|
|
2511
|
+
get canWrite() {
|
|
2512
|
+
return self.canWrite(url);
|
|
2513
|
+
}
|
|
2514
|
+
};
|
|
2515
|
+
};
|
|
2516
|
+
get allRealmsInfo() {
|
|
2517
|
+
const realmsMeta = Object.create(null);
|
|
2518
|
+
for (const [url, _resource] of this.realms.entries()) realmsMeta[url] = this.meta(url);
|
|
2519
|
+
return realmsMeta;
|
|
2520
|
+
}
|
|
2521
|
+
realmOf(input) {
|
|
2522
|
+
let id = input instanceof URL ? rri(input.href) : input;
|
|
2523
|
+
let cached = this.realmOfCache.get(id);
|
|
2524
|
+
if (cached !== void 0) {
|
|
2525
|
+
if (this.realms.has(cached)) return ri(cached);
|
|
2526
|
+
this.realmOfCache.delete(id);
|
|
2527
|
+
}
|
|
2528
|
+
let best = this.knownRealmKey(id);
|
|
2529
|
+
if (best !== void 0) {
|
|
2530
|
+
this.realmOfCache.set(id, best);
|
|
2531
|
+
return ri(best);
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
realmURLOf(urlInRealm) {
|
|
2535
|
+
this.identifyRealmTracker;
|
|
2536
|
+
return this.knownRealmKey(this.toLookupURL(urlInRealm));
|
|
2537
|
+
}
|
|
2538
|
+
realmURLTextOf = (urlInRealm) => {
|
|
2539
|
+
let realmURL = this.realmURLOf(urlInRealm);
|
|
2540
|
+
return realmURL ? realmURLDisplayText(this.network.virtualNetwork, realmURL) : void 0;
|
|
2541
|
+
};
|
|
2542
|
+
realmForSessionRoomId(sessionRoomId) {
|
|
2543
|
+
return Array.from(this.realms.values()).find((r) => r.claims?.sessionRoom === sessionRoomId);
|
|
2544
|
+
}
|
|
2545
|
+
get defaultWritableRealm() {
|
|
2546
|
+
let maybePersonalRealm = `${this.realmServer.url.href}${this.matrixService.userName}/personal/`;
|
|
2547
|
+
if (Object.keys(this.allRealmsInfo).find((r) => r === maybePersonalRealm)) return {
|
|
2548
|
+
path: maybePersonalRealm,
|
|
2549
|
+
info: this.allRealmsInfo[maybePersonalRealm].info
|
|
2550
|
+
};
|
|
2551
|
+
let first = Object.entries(this.allRealmsInfo).filter(([, i]) => i.canWrite).sort(([, i], [, j]) => i.info.name.localeCompare(j.info.name))[0];
|
|
2552
|
+
if (!first) {
|
|
2553
|
+
log.debug(`No writable realms found, known realms and writability: ${Object.keys(this.allRealmsInfo).map((realmUrl) => `${realmUrl}: ${this.allRealmsInfo[realmUrl].canWrite}`).join(", ")}`);
|
|
2554
|
+
return null;
|
|
2555
|
+
}
|
|
2556
|
+
return {
|
|
2557
|
+
path: first[0],
|
|
2558
|
+
info: first[1].info
|
|
2559
|
+
};
|
|
2560
|
+
}
|
|
2561
|
+
static {
|
|
2562
|
+
decorateMethodV2(this.prototype, "defaultWritableRealm", [cached]);
|
|
2563
|
+
}
|
|
2564
|
+
get defaultReadableRealm() {
|
|
2565
|
+
if (this.defaultWritableRealm) return this.defaultWritableRealm;
|
|
2566
|
+
let allRealmsInfoEntries = Object.entries(this.allRealmsInfo);
|
|
2567
|
+
if (allRealmsInfoEntries.length > 0) {
|
|
2568
|
+
let firstMeta = allRealmsInfoEntries[0];
|
|
2569
|
+
return {
|
|
2570
|
+
path: firstMeta[0],
|
|
2571
|
+
info: firstMeta[1].info
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
return {
|
|
2575
|
+
path: config.resolvedBaseRealmURL,
|
|
2576
|
+
info: this.info(config.resolvedBaseRealmURL)
|
|
2577
|
+
};
|
|
2578
|
+
}
|
|
2579
|
+
static {
|
|
2580
|
+
decorateMethodV2(this.prototype, "defaultReadableRealm", [cached]);
|
|
2581
|
+
}
|
|
2582
|
+
token = (url) => {
|
|
2583
|
+
let resource = this.knownRealm(url, { tracked: false });
|
|
2584
|
+
if (!resource && globalThis.__boxelRenderContext && !isTesting()) {
|
|
2585
|
+
this.restoreSessionsFromStorage();
|
|
2586
|
+
resource = this.knownRealm(url, { tracked: false });
|
|
2587
|
+
}
|
|
2588
|
+
return resource?.token;
|
|
2589
|
+
};
|
|
2590
|
+
logout() {
|
|
2591
|
+
for (let realm of this.realms.values()) realm.logout();
|
|
2592
|
+
this.bulkInfoPromise = void 0;
|
|
2593
|
+
clearServiceWorkerTokens();
|
|
2594
|
+
}
|
|
2595
|
+
dropSessionsNotFor(userId) {
|
|
2596
|
+
for (let resource of this.realms.values()) {
|
|
2597
|
+
let user = resource.claims?.user;
|
|
2598
|
+
if (user && user !== userId) resource.clearRealmSession();
|
|
2599
|
+
}
|
|
2600
|
+
for (let [realmURL, token] of Object.entries(SessionStorage.getAll() ?? {})) {
|
|
2601
|
+
let user = token ? realmClaimsFromRawToken(token)?.user : void 0;
|
|
2602
|
+
if (user && user !== userId) {
|
|
2603
|
+
SessionStorage.remove(realmURL);
|
|
2604
|
+
syncTokenToServiceWorker(realmURL, void 0);
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
this.lastRestoredSessionsString = null;
|
|
2608
|
+
}
|
|
2609
|
+
waitForTokenRefresh(ms) {
|
|
2610
|
+
return rawTimeout(ms);
|
|
2611
|
+
}
|
|
2612
|
+
async publish(realmURL, publishedRealmURLs) {
|
|
2613
|
+
return await this.getOrCreateRealmResource(realmURL).publish(publishedRealmURLs);
|
|
2614
|
+
}
|
|
2615
|
+
async fetchPrivateDependencyReport(realmURL) {
|
|
2616
|
+
return await this.getOrCreateRealmResource(realmURL).fetchPrivateDependencyReport();
|
|
2617
|
+
}
|
|
2618
|
+
async unpublish(realmURL, publishedRealmURL) {
|
|
2619
|
+
return await this.getOrCreateRealmResource(realmURL).unpublish(publishedRealmURL);
|
|
2620
|
+
}
|
|
2621
|
+
async cancelIndexingJob(realmURL) {
|
|
2622
|
+
let normalizedRealmURL = ensureTrailingSlash(realmURL);
|
|
2623
|
+
let resource = this.getOrCreateRealmResource(normalizedRealmURL);
|
|
2624
|
+
await resource.login();
|
|
2625
|
+
let headers = new Headers({ Accept: SupportedMimeType.JSON });
|
|
2626
|
+
if (resource.token) headers.set("Authorization", `Bearer ${resource.token}`);
|
|
2627
|
+
let response = await this.network.fetch(`${normalizedRealmURL}_cancel-indexing-job`, {
|
|
2628
|
+
method: "POST",
|
|
2629
|
+
headers
|
|
2630
|
+
});
|
|
2631
|
+
if (response.status === 204) return;
|
|
2632
|
+
let errorText = await response.text();
|
|
2633
|
+
throw new Error(`Cancel indexing job failed: ${response.status} - ${errorText}`);
|
|
2634
|
+
}
|
|
2635
|
+
beginIndexingAnimation(resource) {
|
|
2636
|
+
let wasIndexing = resource.info?.isIndexing ?? false;
|
|
2637
|
+
if (resource.info) resource.info.isIndexing = true;
|
|
2638
|
+
return wasIndexing;
|
|
2639
|
+
}
|
|
2640
|
+
restoreIndexingAnimation(resource, wasIndexing) {
|
|
2641
|
+
if (resource.info) resource.info.isIndexing = wasIndexing;
|
|
2642
|
+
}
|
|
2643
|
+
async reindex(realmURL) {
|
|
2644
|
+
let normalizedRealmURL = ensureTrailingSlash(realmURL);
|
|
2645
|
+
let resource = this.getOrCreateRealmResource(normalizedRealmURL);
|
|
2646
|
+
await resource.login();
|
|
2647
|
+
await resource.fetchInfo();
|
|
2648
|
+
let wasIndexing = this.beginIndexingAnimation(resource);
|
|
2649
|
+
try {
|
|
2650
|
+
let headers = new Headers({ Accept: SupportedMimeType.JSON });
|
|
2651
|
+
if (resource.token) headers.set("Authorization", `Bearer ${resource.token}`);
|
|
2652
|
+
let response = await this.network.fetch(`${normalizedRealmURL}_reindex`, {
|
|
2653
|
+
method: "POST",
|
|
2654
|
+
headers
|
|
2655
|
+
});
|
|
2656
|
+
if (response.status === 204) return;
|
|
2657
|
+
let errorText = await response.text();
|
|
2658
|
+
throw new Error(`Reindex realm failed: ${response.status} - ${errorText}`);
|
|
2659
|
+
} catch (error) {
|
|
2660
|
+
this.restoreIndexingAnimation(resource, wasIndexing);
|
|
2661
|
+
throw error;
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
async fullReindex(realmURL) {
|
|
2665
|
+
let normalizedRealmURL = ensureTrailingSlash(realmURL);
|
|
2666
|
+
let resource = this.getOrCreateRealmResource(normalizedRealmURL);
|
|
2667
|
+
await resource.login();
|
|
2668
|
+
await resource.fetchInfo();
|
|
2669
|
+
let wasIndexing = this.beginIndexingAnimation(resource);
|
|
2670
|
+
try {
|
|
2671
|
+
let headers = new Headers({ Accept: SupportedMimeType.JSON });
|
|
2672
|
+
if (resource.token) headers.set("Authorization", `Bearer ${resource.token}`);
|
|
2673
|
+
let response = await this.network.fetch(`${normalizedRealmURL}_full-reindex`, {
|
|
2674
|
+
method: "POST",
|
|
2675
|
+
headers
|
|
2676
|
+
});
|
|
2677
|
+
if (response.status === 204) return;
|
|
2678
|
+
let errorText = await response.text();
|
|
2679
|
+
throw new Error(`Full reindex realm failed: ${response.status} - ${errorText}`);
|
|
2680
|
+
} catch (error) {
|
|
2681
|
+
this.restoreIndexingAnimation(resource, wasIndexing);
|
|
2682
|
+
throw error;
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
async invalidateUrls(realmURL, urls) {
|
|
2686
|
+
let normalizedRealmURL = ensureTrailingSlash(realmURL);
|
|
2687
|
+
let resource = this.getOrCreateRealmResource(normalizedRealmURL);
|
|
2688
|
+
await resource.login();
|
|
2689
|
+
let headers = new Headers({
|
|
2690
|
+
Accept: SupportedMimeType.JSONAPI,
|
|
2691
|
+
"Content-Type": SupportedMimeType.JSONAPI
|
|
2692
|
+
});
|
|
2693
|
+
if (resource.token) headers.set("Authorization", `Bearer ${resource.token}`);
|
|
2694
|
+
let dedupedUrls = [...new Set(urls)];
|
|
2695
|
+
let response = await this.network.fetch(`${normalizedRealmURL}_invalidate`, {
|
|
2696
|
+
method: "POST",
|
|
2697
|
+
headers,
|
|
2698
|
+
body: JSON.stringify({ data: {
|
|
2699
|
+
type: "invalidation-request",
|
|
2700
|
+
attributes: { urls: dedupedUrls }
|
|
2701
|
+
} })
|
|
2702
|
+
});
|
|
2703
|
+
if (response.status === 204) return;
|
|
2704
|
+
let errorText = await response.text();
|
|
2705
|
+
throw new Error(`Invalidate urls failed: ${response.status} - ${errorText}`);
|
|
2706
|
+
}
|
|
2707
|
+
isUnpublishingAnyRealms = (realmURL) => {
|
|
2708
|
+
return this.getOrCreateRealmResource(realmURL).isUnpublishingAnyRealms();
|
|
2709
|
+
};
|
|
2710
|
+
isUnpublishingRealm = (realmURL, publishedRealmURL) => {
|
|
2711
|
+
return this.getOrCreateRealmResource(realmURL).isUnpublishingRealm(publishedRealmURL);
|
|
2712
|
+
};
|
|
2713
|
+
isPublishing = (realmURL) => {
|
|
2714
|
+
return this.getOrCreateRealmResource(realmURL).isPublishing;
|
|
2715
|
+
};
|
|
2716
|
+
publishingRealms = (realmURL) => {
|
|
2717
|
+
return this.getOrCreateRealmResource(realmURL).publishingRealms;
|
|
2718
|
+
};
|
|
2719
|
+
publishProgress = (realmURL, publishedRealmURL) => {
|
|
2720
|
+
return this.getOrCreateRealmResource(realmURL).publishProgress(publishedRealmURL);
|
|
2721
|
+
};
|
|
2722
|
+
toLookupURL(url) {
|
|
2723
|
+
let vn = this.network.virtualNetwork;
|
|
2724
|
+
return vn.isRegisteredPrefix(url) ? vn.toURL(url).href : url;
|
|
2725
|
+
}
|
|
2726
|
+
knownRealmKey(id) {
|
|
2727
|
+
let vn = this.network.virtualNetwork;
|
|
2728
|
+
let normalizedId = vn.unresolveURL(id);
|
|
2729
|
+
let best;
|
|
2730
|
+
let bestLength = -1;
|
|
2731
|
+
for (let key of this.realms.keys()) {
|
|
2732
|
+
let normalizedKey = vn.unresolveURL(key);
|
|
2733
|
+
if (normalizedKey.length > bestLength && this.contains(normalizedKey, normalizedId)) {
|
|
2734
|
+
best = key;
|
|
2735
|
+
bestLength = normalizedKey.length;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
return best;
|
|
2739
|
+
}
|
|
2740
|
+
contains(realm, id) {
|
|
2741
|
+
let paths = this.realmPathsCache.get(realm);
|
|
2742
|
+
if (!paths) {
|
|
2743
|
+
paths = new RealmPaths(ri(realm));
|
|
2744
|
+
this.realmPathsCache.set(realm, paths);
|
|
2745
|
+
}
|
|
2746
|
+
return paths.inRealm(id);
|
|
2747
|
+
}
|
|
2748
|
+
knownRealm(url, { tracked = true } = {}) {
|
|
2749
|
+
if (!url) {
|
|
2750
|
+
if (tracked) this.currentKnownRealms.size;
|
|
2751
|
+
return;
|
|
2752
|
+
}
|
|
2753
|
+
let key = this.knownRealmKey(url);
|
|
2754
|
+
if (key) return this.realms.get(key);
|
|
2755
|
+
if (tracked) this.currentKnownRealms.has(url);
|
|
2756
|
+
}
|
|
2757
|
+
async reauthenticate(realmURL) {
|
|
2758
|
+
let inProgressAuthentication = this.reauthentications.get(realmURL);
|
|
2759
|
+
if (inProgressAuthentication) return inProgressAuthentication;
|
|
2760
|
+
let deferred = new Deferred();
|
|
2761
|
+
deferred.promise.catch(() => {});
|
|
2762
|
+
this.reauthentications.set(realmURL, deferred.promise);
|
|
2763
|
+
try {
|
|
2764
|
+
let resource = this.getOrCreateRealmResource(realmURL);
|
|
2765
|
+
resource.clearRealmSession();
|
|
2766
|
+
await resource.login();
|
|
2767
|
+
let result = resource.token;
|
|
2768
|
+
deferred.fulfill(result);
|
|
2769
|
+
return result;
|
|
2770
|
+
} catch (e) {
|
|
2771
|
+
deferred.reject(e);
|
|
2772
|
+
throw e;
|
|
2773
|
+
} finally {
|
|
2774
|
+
this.reauthentications.delete(realmURL);
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
createRealmResource(realmURL, token) {
|
|
2778
|
+
let resource = new RealmResource(realmURL, token, this);
|
|
2779
|
+
setOwner(resource, getOwner(this));
|
|
2780
|
+
associateDestroyableChild(this, resource);
|
|
2781
|
+
return resource;
|
|
2782
|
+
}
|
|
2783
|
+
getOrCreateRealmResource(realmURL, token = void 0, { exact = false } = {}) {
|
|
2784
|
+
let resource = exact ? this.registeredRealm(realmURL) : this.knownRealm(realmURL, { tracked: false });
|
|
2785
|
+
if (resource && !resource?.token && token) resource.token = token;
|
|
2786
|
+
if (!resource) {
|
|
2787
|
+
resource = this.createRealmResource(realmURL, token);
|
|
2788
|
+
this._realms.set(realmURL, resource);
|
|
2789
|
+
let normalizedRealm = this.network.virtualNetwork.unresolveURL(realmURL);
|
|
2790
|
+
for (let id of this.realmOfCache.keys()) if (this.contains(normalizedRealm, this.network.virtualNetwork.unresolveURL(id))) this.realmOfCache.delete(id);
|
|
2791
|
+
this.currentKnownRealms.add(realmURL);
|
|
2792
|
+
}
|
|
2793
|
+
return resource;
|
|
2794
|
+
}
|
|
2795
|
+
registeredRealm(realmURL) {
|
|
2796
|
+
let vn = this.network.virtualNetwork;
|
|
2797
|
+
let identity = vn.unresolveURL(realmURL);
|
|
2798
|
+
for (let [key, resource] of this._realms) if (key === realmURL || vn.unresolveURL(key) === identity) return resource;
|
|
2799
|
+
}
|
|
2800
|
+
identifyRealm = buildTask(() => ({
|
|
2801
|
+
context: this,
|
|
2802
|
+
generator: function* (url) {
|
|
2803
|
+
if (this.knownRealm(url, { tracked: false })) return;
|
|
2804
|
+
let realmURL = (yield this.network.authedFetch(url, {
|
|
2805
|
+
method: "HEAD",
|
|
2806
|
+
headers: { Accept: SupportedMimeType.CardJson }
|
|
2807
|
+
})).headers.get("x-boxel-realm-url");
|
|
2808
|
+
if (realmURL) {
|
|
2809
|
+
this.getOrCreateRealmResource(realmURL);
|
|
2810
|
+
this.identifyRealmTracker = 0;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
}), {
|
|
2814
|
+
maxConcurrency: 1,
|
|
2815
|
+
enqueue: true
|
|
2816
|
+
}, "identifyRealm", null);
|
|
2817
|
+
restoreSessions() {
|
|
2818
|
+
let sessions = /* @__PURE__ */ new Map();
|
|
2819
|
+
let tokens = SessionStorage.getAll();
|
|
2820
|
+
if (tokens) {
|
|
2821
|
+
syncAllTokensToServiceWorker(tokens);
|
|
2822
|
+
for (let [realmURL, token] of Object.entries(tokens)) {
|
|
2823
|
+
let resource = this.createRealmResource(realmURL, token);
|
|
2824
|
+
sessions.set(realmURL, resource);
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
return sessions;
|
|
2828
|
+
}
|
|
2829
|
+
};
|
|
2830
|
+
function claimsFromRawToken(rawToken) {
|
|
2831
|
+
let [_header, payload] = rawToken.split(".");
|
|
2832
|
+
return JSON.parse(atob(payload));
|
|
2833
|
+
}
|
|
2834
|
+
var SessionStorage = {
|
|
2835
|
+
getAll() {
|
|
2836
|
+
let sessionsString = src_default.localStorage.getItem(SessionLocalStorageKey);
|
|
2837
|
+
if (sessionsString) return JSON.parse(sessionsString);
|
|
2838
|
+
},
|
|
2839
|
+
persist(realmURL, token) {
|
|
2840
|
+
let sessionStr = src_default.localStorage.getItem("boxel-session") ?? "{}";
|
|
2841
|
+
let session = JSON.parse(sessionStr);
|
|
2842
|
+
if (session[realmURL] !== token) {
|
|
2843
|
+
session[realmURL] = token;
|
|
2844
|
+
src_default.localStorage.setItem(SessionLocalStorageKey, JSON.stringify(session));
|
|
2845
|
+
}
|
|
2846
|
+
syncTokenToServiceWorker(realmURL, token);
|
|
2847
|
+
},
|
|
2848
|
+
remove(realmURL) {
|
|
2849
|
+
let sessionStr = src_default.localStorage.getItem("boxel-session") ?? "{}";
|
|
2850
|
+
let session = JSON.parse(sessionStr);
|
|
2851
|
+
if (realmURL in session) {
|
|
2852
|
+
delete session[realmURL];
|
|
2853
|
+
src_default.localStorage.setItem(SessionLocalStorageKey, JSON.stringify(session));
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
};
|
|
2857
|
+
//#endregion
|
|
2858
|
+
export { realm_exports as a, assert_never_exports as c, claimsFromRawToken as i, client_telemetry_exports as l, RealmService as n, realm_server_exports as o, UNKNOWN_REALM_NAME as r, assertNever as s, PublishPendingError as t, createServerRequestTimingMiddleware as u };
|