@hiai-gg/docsmint 2.0.4 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -5
- package/dist/backend/index.js +94475 -92073
- package/dist/backend-account-runtime-cleanup.js +293 -292
- package/dist/backend-api-key-facade.js +6 -5
- package/dist/backend-pipeline-cancellation.js +287 -286
- package/dist/client.d.ts +33 -7
- package/dist/client.js +55 -1
- package/dist/frontend/CategoryDialog-CVJi5PJu.js +602 -0
- package/dist/frontend/{ConfirmDialog-B1MjKlVQ.js → ConfirmDialog-0JwB8mKN.js} +5 -8
- package/dist/frontend/{CreateSnapshotDialog-BTMoPFdj.js → CreateSnapshotDialog-BLrtuYs5.js} +63 -68
- package/dist/frontend/{DatePicker-Bmjko3X7.js → DatePicker-BwSb8TRv.js} +17 -29
- package/dist/frontend/{DeleteDialog-BkfIeKXO.js → DeleteDialog-s7Dr6bXg.js} +51 -56
- package/dist/frontend/{FolderNode-Do8pIfyA.js → FolderNode-Y7cV9xeX.js} +105 -106
- package/dist/frontend/{FolderTreeSelector-FyxhcHjr.js → FolderTreeSelector-BR3lYmPU.js} +18 -20
- package/dist/frontend/HiAiEditor-BQERr-cd.js +3077 -0
- package/dist/frontend/{HiaiDocsExtensionProvider-Cc3yzW5I.js → HiaiDocsExtensionProvider-A2nGddUR.js} +2 -3
- package/dist/frontend/{Icon-3EYzvNyk.js → Icon-CiHcxcpv.js} +1 -2
- package/dist/frontend/SettingsDialog-BvS74JZu.js +978 -0
- package/dist/frontend/{ShareDialog-Ddvl7xvb.js → ShareDialog-Bo50h_Oe.js} +23 -25
- package/dist/frontend/Sidebar-i0kbanpg.js +2123 -0
- package/dist/frontend/{TagCreateDialog-DQmMJe_E.js → TagCreateDialog-DhKfsfv3.js} +78 -86
- package/dist/frontend/action_cancel-BdsWzQKU.js +4 -0
- package/dist/frontend/action_close-CVhfLPRQ.js +4 -0
- package/dist/frontend/action_create-ByaroO1_.js +4 -0
- package/dist/frontend/action_delete-SRloglWY.js +4 -0
- package/dist/frontend/action_go_to-DO1bicF-.js +4 -0
- package/dist/frontend/action_loading-iQ0KsN6i.js +4 -0
- package/dist/frontend/action_save-DeqrZQwV.js +4 -0
- package/dist/frontend/api/attachments.js +1 -2
- package/dist/frontend/api/categories.js +1 -2
- package/dist/frontend/api/documents.js +1 -2
- package/dist/frontend/api/folders.js +1 -2
- package/dist/frontend/api/settings.js +1 -2
- package/dist/frontend/api/share.js +1 -2
- package/dist/frontend/api/tags.js +1 -2
- package/dist/frontend/{api-keys-DIwAdYkg.js → api-keys-B63imiLr.js} +2 -3
- package/dist/frontend/app-shell.js +55 -79
- package/dist/frontend/{attachments-C225gTA7.js → attachments-Bfly-sam.js} +2 -3
- package/dist/frontend/{auth-client-CXR-7mIO.js → auth-client-Dx7d9Tzo.js} +409 -343
- package/dist/frontend/{bundle-mjs-CZ3g1Uzr.js → bundle-mjs-clTO1WW-.js} +5 -23
- package/dist/frontend/{camera-DtgHzfVI.js → camera-DsdOPOcD.js} +2 -3
- package/dist/frontend/{categories-C8AAkhCR.js → categories-CusvHb5Y.js} +3 -4
- package/dist/frontend/{categories_update_error-4aSI8PTr.js → categories_update_error-Cn8DBBHv.js} +2 -3
- package/dist/frontend/{check-DVx65aSv.js → check-DiMZRkKS.js} +2 -3
- package/dist/frontend/{chevron-down-C2tbZ8Ol.js → chevron-down-CxFrMFDJ.js} +2 -3
- package/dist/frontend/{circle-check-BAN-D7yg.js → circle-check-B4F_qgPx.js} +2 -3
- package/dist/frontend/{client-GbtOH90i.js → client-BDdDd84W.js} +1 -2
- package/dist/frontend/{clipboard-Cgzxc0_R.js → clipboard-Dt1oW6nm.js} +1 -2
- package/dist/frontend/{clock-ByiB0SwQ.js → clock-dcpueRk-.js} +2 -3
- package/dist/frontend/collaboration.js +6 -12
- package/dist/frontend/components/category-dialog.js +1 -2
- package/dist/frontend/components/create-snapshot-dialog.js +1 -2
- package/dist/frontend/components/delete-dialog.js +1 -2
- package/dist/frontend/components/editor/compact-editor.js +2 -3
- package/dist/frontend/components/editor/document-editor.js +1 -2
- package/dist/frontend/components/editor/document-title.js +3 -4
- package/dist/frontend/components/editor/docx-serializer.js +123 -167
- package/dist/frontend/components/editor/extensions.js +1 -2
- package/dist/frontend/components/editor/markdown-toggle.js +5 -6
- package/dist/frontend/components/editor/markdown.js +1 -2
- package/dist/frontend/components/folder-node.js +1 -2
- package/dist/frontend/components/folder-tree-selector.js +1 -2
- package/dist/frontend/components/save-as-dialog.js +86 -90
- package/dist/frontend/components/settings.js +1 -2
- package/dist/frontend/components/share-dialog.js +1 -2
- package/dist/frontend/components/sidebar.js +1 -2
- package/dist/frontend/components/tag-create-dialog.js +1 -2
- package/dist/frontend/components/version-history.js +177 -180
- package/dist/frontend/{context-D0zPFXZ4.js → context-BguSRnCt.js} +1 -2
- package/dist/frontend/{copy-CRzvfZGb.js → copy-Bag46YaR.js} +2 -3
- package/dist/frontend/dashboard.js +666 -690
- package/dist/frontend/{db-Dya0HRhS.js → db-B1ZV452J.js} +22 -39
- package/dist/frontend/{dialog-a_ZcpEC5.js → dialog-C0Bpok1d.js} +10 -18
- package/dist/frontend/{dist-CcHOStsA.js → dist-BlcV_BOY.js} +2 -3
- package/dist/frontend/{dist-qd_OnyUC.js → dist-DjId3RKL.js} +8 -21
- package/dist/frontend/dist-Dl9qg10h.js +301 -0
- package/dist/frontend/{dndzone-CDhrbpTg.js → dndzone-C62yjeG3.js} +38 -53
- package/dist/frontend/doc-tabs.js +1 -2
- package/dist/frontend/doc_title_label-BOuZzvqv.js +4 -0
- package/dist/frontend/doc_title_placeholder-ZxpdWWEn.js +4 -0
- package/dist/frontend/{document-drop-coordinator-Da7HcXgv.js → document-drop-coordinator-C_o93kKW.js} +3 -4
- package/dist/frontend/document-drop-coordinator.js +1 -2
- package/dist/frontend/{documents-CwCs1rA7.js → documents-CDJb8dv-.js} +4 -8
- package/dist/frontend/{dropdown-menu-DrHYReIC.js → dropdown-menu-B3nk2aM-.js} +13 -24
- package/dist/frontend/{editor-content-sanitizer-CWjqiz0T.js → editor-content-sanitizer-5MjSVPVn.js} +1 -2
- package/dist/frontend/editor-preferences.js +1 -2
- package/dist/frontend/{editor-preferences.svelte-Bt_A9k7n.js → editor-preferences.svelte-BpTE4mbz.js} +3 -5
- package/dist/frontend/{editorExtensions-DPR-CjMu.js → editorExtensions-DbiFj4tn.js} +3 -4
- package/dist/frontend/{editor_markdown_placeholder-BIWDUF1E.js → editor_markdown_placeholder-BztIY9Ci.js} +2 -3
- package/dist/frontend/{ellipsis-vertical-qxNgoXu-.js → ellipsis-vertical-Oymsv1R4.js} +2 -3
- package/dist/frontend/{error_dismiss-Dx_JbRjs.js → error_dismiss-C651ZdWI.js} +2 -3
- package/dist/frontend/error_generic-BlWqOE-a.js +4 -0
- package/dist/frontend/extension.js +1 -2
- package/dist/frontend/{folder-D74E-Kdp.js → folder-BpmB_sAy.js} +3 -5
- package/dist/frontend/folder-refresh.js +1 -2
- package/dist/frontend/{folders-CC0UWkZH.js → folders-DgKSovXa.js} +2 -3
- package/dist/frontend/{folders_rename-BJo4Gipq.js → folders_rename-Cxbg5GIw.js} +2 -3
- package/dist/frontend/frontend.css +1 -1
- package/dist/frontend/i18n.js +144 -145
- package/dist/frontend/{identity-BOA7Jejv.js → identity-B7HeOzDJ.js} +4 -5
- package/dist/frontend/{input-Q_7qCfnU.js → input-CbeB9220.js} +2 -3
- package/dist/frontend/keyboard.js +1 -2
- package/dist/frontend/{keyboard.svelte-CApmX0vl.js → keyboard.svelte-BBUdhTsM.js} +2 -3
- package/dist/frontend/{label-Dj8FDEhf.js → label-CfBWf3gI.js} +2 -3
- package/dist/frontend/{lib-aUbBbIW2.js → lib-CITdCbKa.js} +176 -365
- package/dist/frontend/{loader-circle-D3t5NkvC.js → loader-circle-skKwfRCB.js} +2 -3
- package/dist/frontend/markdown-6E9TWC6V.js +11 -0
- package/dist/frontend/offline/identity.js +1 -2
- package/dist/frontend/{popper-layer-force-mount-CNtiLgbV.js → popper-layer-force-mount-BG0eyrCk.js} +112 -284
- package/dist/frontend/{resolve-BG4HgzpN.js → resolve-DbT-KhGZ.js} +2 -3
- package/dist/frontend/{rolldown-runtime-DArdT4gl.js → rolldown-runtime-CwxnZyOB.js} +2 -3
- package/dist/frontend/{rotate-ccw-B1ybQ8oQ.js → rotate-ccw-DAUX7np7.js} +2 -3
- package/dist/frontend/{route-context-DYQlUfzL.js → route-context-6OHiGtfb.js} +2 -4
- package/dist/frontend/{runtime-CwWSo6c9.js → runtime-CGUiMzK6.js} +1 -2
- package/dist/frontend/{schemas-1Na35n71.js → schemas-YXxhj5o8.js} +850 -880
- package/dist/frontend/scroll_to_top_aria-lJc2RSx_.js +4 -0
- package/dist/frontend/{search-preferences-B1GdbdUc.js → search-preferences-DuLDczRu.js} +1 -2
- package/dist/frontend/search.js +277 -292
- package/dist/frontend/{search_title-DOC0cPlQ.js → search_title-BETwQYJq.js} +2 -3
- package/dist/frontend/{select-value-BkI1W1bn.js → select-value-BY5Hw6Rl.js} +28 -65
- package/dist/frontend/{settings-BRcYFQa_.js → settings-DyePuqjp.js} +3 -4
- package/dist/frontend/{share-D5yo0JOh.js → share-3gWTTYvH.js} +2 -3
- package/dist/frontend/{share-context-BJ4GF4yT.js → share-context-C2xyVP9M.js} +29 -37
- package/dist/frontend/{share_copied-DPxVzfWh.js → share_copied-BuAnmpbz.js} +2 -3
- package/dist/frontend/{share_toggle_password-DdxfIjj1.js → share_toggle_password-LEYUeHWr.js} +2 -3
- package/dist/frontend/shared-document.js +27 -36
- package/dist/frontend/{sidebar_uncategorized-qJ2_Aonf.js → sidebar_uncategorized-C5PGOflV.js} +2 -3
- package/dist/frontend/{sort_relevance-DwYX5MO9.js → sort_relevance-DpCVLby_.js} +2 -3
- package/dist/frontend/{subfolders-refresh-store.svelte-DxP21a1c.js → subfolders-refresh-store.svelte-CeyqvNpu.js} +1 -2
- package/dist/frontend/{tag-qbTBLj-g.js → tag-Wdfe0rKU.js} +3 -5
- package/dist/frontend/{tag-store.svelte-ogVCMCbv.js → tag-store.svelte-C9VYWqLQ.js} +2 -3
- package/dist/frontend/{tags-CF_cqzSV.js → tags-DlDVothf.js} +3 -4
- package/dist/frontend/{tags_load_error-BKjA1pI0.js → tags_load_error-BINNpPPV.js} +2 -3
- package/dist/frontend/{tags_new-BiNAJ9Bx.js → tags_new-Dw0Uy43-.js} +2 -3
- package/dist/frontend/{textarea-BNK0LFUK.js → textarea-D6emvAwM.js} +2 -3
- package/dist/frontend/theme.js +2 -3
- package/dist/frontend/{theme.svelte-BRdxXd-B.js → theme.svelte-BiXvrqwh.js} +7 -23
- package/dist/frontend/{theme_system-BBNUhYKh.js → theme_system-YIfa_2Xt.js} +2 -3
- package/dist/frontend/utils/clipboard.js +1 -2
- package/dist/frontend/utils/dndzone.js +1 -2
- package/dist/frontend/{utils-BovMJHdA.js → utils-CnAmIMwr.js} +2 -3
- package/dist/frontend/utils-DH0uqK40.js +6 -0
- package/dist/frontend/utils.js +1 -2
- package/dist/frontend/version_create_snapshot-D8xjbuCq.js +4 -0
- package/dist/frontend/{version_restored_from-dVRN3Zdk.js → version_restored_from-DYFFSuQj.js} +2 -3
- package/dist/frontend/{version_snapshot_label_placeholder-DrMikux0.js → version_snapshot_label_placeholder-BhKq1NQ7.js} +2 -3
- package/dist/frontend/{weekday_we-C5H_M-df.js → weekday_we-BxbzNVWR.js} +2 -3
- package/dist/frontend/{x-CvSSnrjl.js → x-CBUgPygC.js} +2 -3
- package/dist/frontend/{yjs-VUcKqaKW.js → yjs-BbwnvxgY.js} +9 -23
- package/dist/frontend-ssr/api/attachments.js +2 -3
- package/dist/frontend-ssr/api/categories.js +1 -2
- package/dist/frontend-ssr/api/documents.js +1 -2
- package/dist/frontend-ssr/api/folders.js +1 -2
- package/dist/frontend-ssr/api/settings.js +1 -2
- package/dist/frontend-ssr/api/share.js +2 -3
- package/dist/frontend-ssr/api/tags.js +1 -2
- package/dist/frontend-ssr/app-shell.js +19 -28
- package/dist/frontend-ssr/assets/{CategoryDialog-DuZLLlt7.js → CategoryDialog-2CCX508O.js} +17 -20
- package/dist/frontend-ssr/assets/{ConfirmDialog-0WVu9BCE.js → ConfirmDialog-Cc6lcY1N.js} +8 -14
- package/dist/frontend-ssr/assets/{CreateSnapshotDialog-3vhDTFNu.js → CreateSnapshotDialog-BB8fXF9W.js} +9 -10
- package/dist/frontend-ssr/assets/{DatePicker-t12leL2Y.js → DatePicker-CfzKzipR.js} +9 -15
- package/dist/frontend-ssr/assets/{DeleteDialog-B0AU1fJR.js → DeleteDialog-DRU4UgOW.js} +4 -5
- package/dist/frontend-ssr/assets/{FolderNode-C-B-s8x1.js → FolderNode-Dg_5-orQ.js} +11 -12
- package/dist/frontend-ssr/assets/{FolderTreeSelector-DdQuEcj0.js → FolderTreeSelector-D0reTdFS.js} +5 -7
- package/dist/frontend-ssr/assets/{HiAiEditor-Bj6tiE97.js → HiAiEditor-DeHWAIj-.js} +44 -69
- package/dist/frontend-ssr/assets/{HiaiDocsExtensionProvider-BRKWmcDd.js → HiaiDocsExtensionProvider-D6cGL-9s.js} +2 -3
- package/dist/frontend-ssr/assets/{Icon-DE_3EnuF.js → Icon-CrIRbT5O.js} +4 -8
- package/dist/frontend-ssr/assets/{SettingsDialog-h4SFwpUa.js → SettingsDialog-BpHY3IMb.js} +29 -40
- package/dist/frontend-ssr/assets/{ShareDialog-CpE9zd_f.js → ShareDialog-CY40nWZJ.js} +7 -9
- package/dist/frontend-ssr/assets/{Sidebar-BFBpsd3L.js → Sidebar-fpYk5MGO.js} +55 -63
- package/dist/frontend-ssr/assets/{TagCreateDialog-DBHO1DPU.js → TagCreateDialog-C2tpdEuj.js} +13 -14
- package/dist/frontend-ssr/assets/{action_cancel-OVgQDP5Q.js → action_cancel-CsBbxW0m.js} +2 -3
- package/dist/frontend-ssr/assets/{action_close-DagDyMXk.js → action_close-lFKBqBwg.js} +2 -3
- package/dist/frontend-ssr/assets/{action_create-hqJWjyqh.js → action_create-BV4ZOcQW.js} +2 -3
- package/dist/frontend-ssr/assets/{action_delete-B1-16jSo.js → action_delete-CNmRhKQP.js} +2 -3
- package/dist/frontend-ssr/assets/{action_go_to-DQScgw7P.js → action_go_to-tN5I26xM.js} +2 -3
- package/dist/frontend-ssr/assets/{action_save-Bx7vlLZI.js → action_save-YCfMiKb4.js} +2 -3
- package/dist/frontend-ssr/assets/{api-keys-CHOrbU-Q.js → api-keys-G6oimJIv.js} +2 -3
- package/dist/frontend-ssr/assets/{auth-client-BC4hSFKF.js → auth-client-BnnnJDAb.js} +368 -256
- package/dist/frontend-ssr/assets/{camera-B6ldo_Js.js → camera-OYNSMvMd.js} +2 -3
- package/dist/frontend-ssr/assets/{categories-C_dxFoHi.js → categories-bBPviKjl.js} +2 -3
- package/dist/frontend-ssr/assets/{categories_update_error-DkKgsqdD.js → categories_update_error-Bfx5vtvt.js} +11 -21
- package/dist/frontend-ssr/assets/{chevron-down-DQcr6JUc.js → chevron-down-DB6YsSbQ.js} +2 -3
- package/dist/frontend-ssr/assets/{chevron-right-9szrliZx.js → chevron-right-DOt2uY6b.js} +2 -3
- package/dist/frontend-ssr/assets/{circle-check-BgP9MRRv.js → circle-check-DQhTm9YR.js} +2 -3
- package/dist/frontend-ssr/assets/{client-rfwQYYHY.js → client-B2AniXwV.js} +1 -2
- package/dist/frontend-ssr/assets/{clipboard-CXOaoz2W.js → clipboard-CXKnyYba.js} +1 -2
- package/dist/frontend-ssr/assets/{clock-roNtGlT6.js → clock-B08dVWtf.js} +2 -3
- package/dist/frontend-ssr/assets/{context-Bi_mO-NS.js → context-C_xxvxnR.js} +1 -2
- package/dist/frontend-ssr/assets/{copy-BYqYnBIQ.js → copy-2jsznHar.js} +2 -3
- package/dist/frontend-ssr/assets/{db-C3rFdTZa.js → db-BEKLU5Fc.js} +2 -3
- package/dist/frontend-ssr/assets/{dialog-SqCnTT43.js → dialog-C6U-DqLr.js} +9 -17
- package/dist/frontend-ssr/assets/{dist-CaZQ1FhA.js → dist-DqXTz_zE.js} +9 -12
- package/dist/frontend-ssr/assets/{dist-CqxHwOlp.js → dist-ip9bPdma.js} +3 -6
- package/dist/frontend-ssr/assets/{dndzone-CnTCMhPd.js → dndzone-Dx3jt_e4.js} +4 -6
- package/dist/frontend-ssr/assets/{doc_title_label-Ev_ltlh3.js → doc_title_label-CE_l-Gum.js} +2 -3
- package/dist/frontend-ssr/assets/{doc_title_placeholder-DSHpUb7w.js → doc_title_placeholder-7_i7PtG6.js} +2 -3
- package/dist/frontend-ssr/assets/{document-drop-coordinator-CEaYACsC.js → document-drop-coordinator-BVytYy2K.js} +1 -2
- package/dist/frontend-ssr/assets/{documents-CEuA1V6N.js → documents-B_wpQFTh.js} +2 -3
- package/dist/frontend-ssr/assets/{dropdown-menu-CE6U0f1b.js → dropdown-menu-BS5fcN9l.js} +12 -23
- package/dist/frontend-ssr/assets/{editor-content-sanitizer-Gjm93iR-.js → editor-content-sanitizer-CIdFjBSC.js} +1 -2
- package/dist/frontend-ssr/assets/{editor-preferences.svelte-iI5jJM1x.js → editor-preferences.svelte-CdAXTd-I.js} +2 -4
- package/dist/frontend-ssr/assets/{editorExtensions-rhletNji.js → editorExtensions-2O7O2Nhv.js} +2 -3
- package/dist/frontend-ssr/assets/{editor_markdown_placeholder-BpezdkOr.js → editor_markdown_placeholder-CAeLJjFT.js} +3 -5
- package/dist/frontend-ssr/assets/{editor_toolbar_undo-CKJAOqv2.js → editor_toolbar_undo-CVCfQIS1.js} +29 -57
- package/dist/frontend-ssr/assets/{ellipsis-vertical-Cg1MrZsl.js → ellipsis-vertical-IFHt2NM1.js} +2 -3
- package/dist/frontend-ssr/assets/{error_generic-DTK0kwxT.js → error_generic-BB80i0Vk.js} +3 -5
- package/dist/frontend-ssr/assets/{folder-DHB-CEcQ.js → folder-CXa1_bm5.js} +2 -3
- package/dist/frontend-ssr/assets/{folders-BOXeb9hz.js → folders-CTLqWbMm.js} +2 -3
- package/dist/frontend-ssr/assets/{folders_rename-DvciOb6K.js → folders_rename-ydbfwQlj.js} +7 -13
- package/dist/frontend-ssr/assets/{identity-DNIo1bgc.js → identity-DTz1SQwC.js} +2 -3
- package/dist/frontend-ssr/assets/{input-DVrBVPgs.js → input-Bxw9sFF0.js} +2 -3
- package/dist/frontend-ssr/assets/{keyboard.svelte-BgF47N3L.js → keyboard.svelte-njehUCm3.js} +1 -2
- package/dist/frontend-ssr/assets/{label-vtCK3pTp.js → label-CMWedjs6.js} +2 -3
- package/dist/frontend-ssr/assets/{loader-circle-D3NWhCif.js → loader-circle-zbKj9Qb-.js} +2 -3
- package/dist/frontend-ssr/assets/{markdown-Co31-Tl2.js → markdown-BmIhDQp7.js} +2 -3
- package/dist/frontend-ssr/assets/{popper-layer-force-mount-C4dMMt-f.js → popper-layer-force-mount-CSHZsG2E.js} +78 -156
- package/dist/frontend-ssr/assets/{resolve-BqHozBXl.js → resolve-Wqdff4CL.js} +1 -2
- package/dist/frontend-ssr/assets/{rotate-ccw-DNf3nwMD.js → rotate-ccw-B7SaTFWf.js} +2 -3
- package/dist/frontend-ssr/assets/{route-context-BPRerEtZ.js → route-context-BsqLFt5Y.js} +2 -4
- package/dist/frontend-ssr/assets/{runtime-O78RzRqx.js → runtime-BX6-jTn_.js} +1 -2
- package/dist/frontend-ssr/assets/{scroll_to_top_aria-BN4ZfOnM.js → scroll_to_top_aria-CAYSiGHO.js} +2 -3
- package/dist/frontend-ssr/assets/{search_title-CKUsQDT0.js → search_title-C7NVXXq3.js} +2 -3
- package/dist/frontend-ssr/assets/{search_toggle_filters-hS9rvQhC.js → search_toggle_filters-Bq_YVD8s.js} +15 -29
- package/dist/frontend-ssr/assets/{select-value-Ce5c_fuA.js → select-value-TgslfiUB.js} +18 -34
- package/dist/frontend-ssr/assets/{settings-DWCpfCPj.js → settings-B1MA_FjO.js} +3 -4
- package/dist/frontend-ssr/assets/{share-context-B4UpvTSw.js → share-context-RVh8AExX.js} +17 -22
- package/dist/frontend-ssr/assets/{share_copied-BxU9rjXG.js → share_copied-CrwEwkb3.js} +31 -61
- package/dist/frontend-ssr/assets/{share_toggle_password-C6OmroqR.js → share_toggle_password-Co56z0Ha.js} +11 -21
- package/dist/frontend-ssr/assets/{sidebar_uncategorized-Dx-LTd5w.js → sidebar_uncategorized-COWdmZ3d.js} +6 -11
- package/dist/frontend-ssr/assets/{subfolders-refresh-store.svelte-CXHxQWKh.js → subfolders-refresh-store.svelte-LxG18U0n.js} +1 -2
- package/dist/frontend-ssr/assets/{tag-Cqv0fWVG.js → tag-BGhtDKpP.js} +3 -5
- package/dist/frontend-ssr/assets/{tag-store.svelte-QRysvGKe.js → tag-store.svelte-CUUgAaDD.js} +2 -3
- package/dist/frontend-ssr/assets/{tags-BBCoFYro.js → tags-C7u-LBsl.js} +2 -3
- package/dist/frontend-ssr/assets/{tags_load_error-CPrc6Gzs.js → tags_load_error-DW4FbHvr.js} +19 -37
- package/dist/frontend-ssr/assets/{tags_new-VmMr9v2V.js → tags_new-Dr3ByMPZ.js} +4 -7
- package/dist/frontend-ssr/assets/{textarea-BdjOJJVb.js → textarea-Bz5Tz4rw.js} +2 -3
- package/dist/frontend-ssr/assets/{theme.svelte-D6bbaJ9m.js → theme.svelte-CdHah46l.js} +3 -5
- package/dist/frontend-ssr/assets/{theme_system-BucaNntV.js → theme_system-E97FASeq.js} +19 -37
- package/dist/frontend-ssr/assets/{utils-DvZnctjz.js → utils-085zSPe5.js} +1 -2
- package/dist/frontend-ssr/assets/{utils-D3X7I8nz.js → utils-DF6CmRDX.js} +1 -2
- package/dist/frontend-ssr/assets/{version_create_snapshot-COHzwjle.js → version_create_snapshot-DeeYB7bb.js} +2 -3
- package/dist/frontend-ssr/assets/{version_restored_from-CertjFDl.js → version_restored_from-CTt2LM4A.js} +13 -25
- package/dist/frontend-ssr/assets/{version_snapshot_label_placeholder-Cy_rMCij.js → version_snapshot_label_placeholder-BbGD9YuN.js} +12 -23
- package/dist/frontend-ssr/assets/{weekday_we-DrI3U230.js → weekday_we-BzGQ-iFc.js} +22 -43
- package/dist/frontend-ssr/collaboration.js +2 -4
- package/dist/frontend-ssr/components/category-dialog.js +1 -2
- package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -2
- package/dist/frontend-ssr/components/delete-dialog.js +1 -2
- package/dist/frontend-ssr/components/editor/compact-editor.js +2 -3
- package/dist/frontend-ssr/components/editor/document-editor.js +1 -2
- package/dist/frontend-ssr/components/editor/document-title.js +3 -4
- package/dist/frontend-ssr/components/editor/docx-serializer.js +1 -2
- package/dist/frontend-ssr/components/editor/extensions.js +1 -2
- package/dist/frontend-ssr/components/editor/markdown-toggle.js +4 -5
- package/dist/frontend-ssr/components/editor/markdown.js +1 -2
- package/dist/frontend-ssr/components/folder-node.js +1 -2
- package/dist/frontend-ssr/components/folder-tree-selector.js +1 -2
- package/dist/frontend-ssr/components/save-as-dialog.js +12 -13
- package/dist/frontend-ssr/components/settings.js +1 -2
- package/dist/frontend-ssr/components/share-dialog.js +1 -2
- package/dist/frontend-ssr/components/sidebar.js +1 -2
- package/dist/frontend-ssr/components/tag-create-dialog.js +1 -2
- package/dist/frontend-ssr/components/version-history.js +18 -21
- package/dist/frontend-ssr/dashboard.js +64 -88
- package/dist/frontend-ssr/doc-tabs.js +1 -2
- package/dist/frontend-ssr/document-drop-coordinator.js +1 -2
- package/dist/frontend-ssr/editor-preferences.js +1 -2
- package/dist/frontend-ssr/extension.js +1 -2
- package/dist/frontend-ssr/folder-refresh.js +1 -2
- package/dist/frontend-ssr/i18n.js +315 -603
- package/dist/frontend-ssr/keyboard.js +1 -2
- package/dist/frontend-ssr/offline/identity.js +1 -2
- package/dist/frontend-ssr/search.js +17 -20
- package/dist/frontend-ssr/shared-document.js +5 -8
- package/dist/frontend-ssr/theme.js +2 -3
- package/dist/frontend-ssr/utils/clipboard.js +1 -2
- package/dist/frontend-ssr/utils/dndzone.js +1 -2
- package/dist/frontend-ssr/utils.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lifecycle-runtime.js +3998 -17872
- package/dist/mcp-cli.js +357 -78
- package/dist/mcp-server.d.ts +92 -23
- package/dist/mcp-server.js +525 -78
- package/dist/types.d.ts +68 -1
- package/package.json +5 -5
- package/packages/cli/src/index.ts +1 -1
- package/packages/db/src/schema.ts +3 -1
- package/server.json +2 -2
- package/dist/frontend/CategoryDialog-CJeAYxcd.js +0 -630
- package/dist/frontend/HiAiEditor-DDpfdQEg.js +0 -3129
- package/dist/frontend/SettingsDialog-DzlYW50I.js +0 -991
- package/dist/frontend/Sidebar-rFiVen96.js +0 -2149
- package/dist/frontend/action_cancel-Cuxsznzz.js +0 -5
- package/dist/frontend/action_close-BJm_52wm.js +0 -5
- package/dist/frontend/action_create-CtBQrRuj.js +0 -5
- package/dist/frontend/action_delete-BXBIzvn0.js +0 -5
- package/dist/frontend/action_go_to-VmK5jmEk.js +0 -5
- package/dist/frontend/action_loading-BLCGJVA9.js +0 -5
- package/dist/frontend/action_save-BRN2Z_GP.js +0 -5
- package/dist/frontend/dist-DcHl92QO.js +0 -316
- package/dist/frontend/doc_title_label-DS9jSIh2.js +0 -5
- package/dist/frontend/doc_title_placeholder-DBQpM1aH.js +0 -5
- package/dist/frontend/error_generic-CzNtmBT4.js +0 -5
- package/dist/frontend/markdown-O9YJA70S.js +0 -12
- package/dist/frontend/scroll_to_top_aria-CvkNF_Hu.js +0 -5
- package/dist/frontend/utils-BlHvR6OL.js +0 -7
- package/dist/frontend/version_create_snapshot-3bu-0qzH.js +0 -5
|
@@ -3,7 +3,7 @@ import { env } from "@better-auth/core/env";
|
|
|
3
3
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
4
4
|
import { isSafeUrlScheme } from "@better-auth/core/utils/url";
|
|
5
5
|
import { capitalizeFirstLetter, toKebabCase } from "@better-auth/core/utils/string";
|
|
6
|
-
|
|
6
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
7
7
|
var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
8
8
|
var now$1 = () => Math.floor(Date.now() / 1e3);
|
|
9
9
|
var WindowBroadcastChannel = class {
|
|
@@ -45,8 +45,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
|
45
45
|
if (!globalThis[kBroadcastChannel]) globalThis[kBroadcastChannel] = new WindowBroadcastChannel(name);
|
|
46
46
|
return globalThis[kBroadcastChannel];
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/client/equality.mjs
|
|
48
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/equality.mjs
|
|
50
49
|
function isPlainObject$1(value) {
|
|
51
50
|
if (typeof value !== "object" || value === null) return false;
|
|
52
51
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -85,8 +84,7 @@ function withEquality(store, isEqual) {
|
|
|
85
84
|
if (isEqual(store.value, newValue)) abort();
|
|
86
85
|
});
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
87
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
90
88
|
var kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
91
89
|
var WindowFocusManager = class {
|
|
92
90
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -114,8 +112,7 @@ function getGlobalFocusManager() {
|
|
|
114
112
|
if (!globalThis[kFocusManager]) globalThis[kFocusManager] = new WindowFocusManager();
|
|
115
113
|
return globalThis[kFocusManager];
|
|
116
114
|
}
|
|
117
|
-
|
|
118
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/client/online-manager.mjs
|
|
115
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/online-manager.mjs
|
|
119
116
|
var kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
120
117
|
var WindowOnlineManager = class {
|
|
121
118
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -146,14 +143,7 @@ function getGlobalOnlineManager() {
|
|
|
146
143
|
if (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();
|
|
147
144
|
return globalThis[kOnlineManager];
|
|
148
145
|
}
|
|
149
|
-
|
|
150
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/client/parser.mjs
|
|
151
|
-
var PROTO_POLLUTION_PATTERNS = {
|
|
152
|
-
proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
|
|
153
|
-
constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
|
|
154
|
-
protoShort: /"__proto__"\s*:/,
|
|
155
|
-
constructorShort: /"constructor"\s*:/
|
|
156
|
-
};
|
|
146
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/parser.mjs
|
|
157
147
|
var JSON_SIGNATURE = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
158
148
|
var SPECIAL_VALUES = {
|
|
159
149
|
true: true,
|
|
@@ -189,14 +179,10 @@ function betterJSONParse(value, options = {}) {
|
|
|
189
179
|
if (strict) throw new SyntaxError("[better-json] Invalid JSON");
|
|
190
180
|
return value;
|
|
191
181
|
}
|
|
192
|
-
if (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {
|
|
193
|
-
const matches = pattern.test(trimmed);
|
|
194
|
-
if (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);
|
|
195
|
-
return matches;
|
|
196
|
-
}) && strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
|
|
197
182
|
try {
|
|
198
183
|
const secureReviver = (key, value) => {
|
|
199
184
|
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
185
|
+
if (strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
|
|
200
186
|
if (warnings) console.warn(`[better-json] Dropping "${key}" key to prevent prototype pollution`);
|
|
201
187
|
return;
|
|
202
188
|
}
|
|
@@ -215,8 +201,14 @@ function betterJSONParse(value, options = {}) {
|
|
|
215
201
|
function parseJSON(value, options = { strict: true }) {
|
|
216
202
|
return betterJSONParse(value, options);
|
|
217
203
|
}
|
|
218
|
-
|
|
219
|
-
|
|
204
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/query-atom.mjs
|
|
205
|
+
var kAuthQuery = Symbol.for("better-auth:auth-query");
|
|
206
|
+
function createAuthQueryAtom(initialValue) {
|
|
207
|
+
const queryAtom = atom(initialValue);
|
|
208
|
+
Object.defineProperty(queryAtom, kAuthQuery, { value: true });
|
|
209
|
+
return queryAtom;
|
|
210
|
+
}
|
|
211
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
220
212
|
var now = () => Math.floor(Date.now() / 1e3);
|
|
221
213
|
/**
|
|
222
214
|
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
@@ -342,8 +334,7 @@ function createSessionRefreshManager(opts) {
|
|
|
342
334
|
broadcastSessionUpdate
|
|
343
335
|
};
|
|
344
336
|
}
|
|
345
|
-
|
|
346
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/utils/url.mjs
|
|
337
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/utils/url.mjs
|
|
347
338
|
var SLASH_CHAR_CODE = "/".charCodeAt(0);
|
|
348
339
|
function trimTrailingSlashes(value) {
|
|
349
340
|
let end = value.length;
|
|
@@ -420,8 +411,7 @@ function getOrigin(url) {
|
|
|
420
411
|
return null;
|
|
421
412
|
}
|
|
422
413
|
}
|
|
423
|
-
|
|
424
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
414
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
425
415
|
var redirectPlugin = {
|
|
426
416
|
id: "redirect",
|
|
427
417
|
name: "Redirect",
|
|
@@ -435,8 +425,7 @@ var redirectPlugin = {
|
|
|
435
425
|
}
|
|
436
426
|
} }
|
|
437
427
|
};
|
|
438
|
-
|
|
439
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/client/session-atom.mjs
|
|
428
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/session-atom.mjs
|
|
440
429
|
var isServer = () => typeof window === "undefined";
|
|
441
430
|
var SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;
|
|
442
431
|
function hydrateSessionAtom(sessionAtom, session) {
|
|
@@ -479,7 +468,7 @@ function getSessionAtom($fetch, options) {
|
|
|
479
468
|
freshUntil = 0;
|
|
480
469
|
});
|
|
481
470
|
const refetch = (queryParams) => fetchSession(queryParams);
|
|
482
|
-
const session =
|
|
471
|
+
const session = createAuthQueryAtom({
|
|
483
472
|
data: null,
|
|
484
473
|
error: null,
|
|
485
474
|
isPending: true,
|
|
@@ -609,8 +598,7 @@ function getSessionAtom($fetch, options) {
|
|
|
609
598
|
broadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)
|
|
610
599
|
};
|
|
611
600
|
}
|
|
612
|
-
|
|
613
|
-
//#region ../node_modules/.bun/defu@6.1.7/node_modules/defu/dist/defu.mjs
|
|
601
|
+
// ../node_modules/.bun/defu@6.1.7/node_modules/defu/dist/defu.mjs
|
|
614
602
|
function isPlainObject(value) {
|
|
615
603
|
if (value === null || typeof value !== "object") return false;
|
|
616
604
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -637,28 +625,7 @@ function createDefu(merger) {
|
|
|
637
625
|
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
638
626
|
}
|
|
639
627
|
var defu = createDefu();
|
|
640
|
-
|
|
641
|
-
//#region ../node_modules/.bun/@better-fetch+fetch@1.3.1/node_modules/@better-fetch/fetch/dist/index.js
|
|
642
|
-
var __defProp = Object.defineProperty;
|
|
643
|
-
var __defProps = Object.defineProperties;
|
|
644
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
645
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
646
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
647
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
648
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
649
|
-
enumerable: true,
|
|
650
|
-
configurable: true,
|
|
651
|
-
writable: true,
|
|
652
|
-
value
|
|
653
|
-
}) : obj[key] = value;
|
|
654
|
-
var __spreadValues = (a, b) => {
|
|
655
|
-
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
656
|
-
if (__getOwnPropSymbols) {
|
|
657
|
-
for (var prop of __getOwnPropSymbols(b)) if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
658
|
-
}
|
|
659
|
-
return a;
|
|
660
|
-
};
|
|
661
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
628
|
+
// ../node_modules/.bun/@better-fetch+fetch@1.3.3/node_modules/@better-fetch/fetch/dist/index.js
|
|
662
629
|
var BetterFetchError = class extends Error {
|
|
663
630
|
constructor(status, statusText, error) {
|
|
664
631
|
super(statusText || status.toString(), { cause: error });
|
|
@@ -669,31 +636,32 @@ var BetterFetchError = class extends Error {
|
|
|
669
636
|
}
|
|
670
637
|
};
|
|
671
638
|
var initializePlugins = async (url, options) => {
|
|
672
|
-
var _a, _b, _c, _d, _e, _f;
|
|
673
639
|
let opts = options || {};
|
|
674
640
|
const hooks = {
|
|
675
|
-
onRequest: [options
|
|
676
|
-
onResponse: [options
|
|
677
|
-
onSuccess: [options
|
|
678
|
-
onError: [options
|
|
679
|
-
onRetry: [options
|
|
641
|
+
onRequest: [options === null || options === void 0 ? void 0 : options.onRequest],
|
|
642
|
+
onResponse: [options === null || options === void 0 ? void 0 : options.onResponse],
|
|
643
|
+
onSuccess: [options === null || options === void 0 ? void 0 : options.onSuccess],
|
|
644
|
+
onError: [options === null || options === void 0 ? void 0 : options.onError],
|
|
645
|
+
onRetry: [options === null || options === void 0 ? void 0 : options.onRetry]
|
|
680
646
|
};
|
|
681
|
-
if (!options || !(options
|
|
647
|
+
if (!options || !(options === null || options === void 0 ? void 0 : options.plugins)) return {
|
|
682
648
|
url,
|
|
683
649
|
options: opts,
|
|
684
650
|
hooks
|
|
685
651
|
};
|
|
686
|
-
for (const plugin of (options
|
|
652
|
+
for (const plugin of (options === null || options === void 0 ? void 0 : options.plugins) || []) {
|
|
653
|
+
var _plugin$hooks, _plugin$hooks2, _plugin$hooks3, _plugin$hooks4, _plugin$hooks5;
|
|
687
654
|
if (plugin.init) {
|
|
688
|
-
|
|
655
|
+
var _plugin$init;
|
|
656
|
+
const pluginRes = await ((_plugin$init = plugin.init) === null || _plugin$init === void 0 ? void 0 : _plugin$init.call(plugin, url.toString(), opts));
|
|
689
657
|
opts = pluginRes.options || opts;
|
|
690
658
|
url = pluginRes.url;
|
|
691
659
|
}
|
|
692
|
-
hooks.onRequest.push((
|
|
693
|
-
hooks.onResponse.push((
|
|
694
|
-
hooks.onSuccess.push((
|
|
695
|
-
hooks.onError.push((
|
|
696
|
-
hooks.onRetry.push((
|
|
660
|
+
hooks.onRequest.push((_plugin$hooks = plugin.hooks) === null || _plugin$hooks === void 0 ? void 0 : _plugin$hooks.onRequest);
|
|
661
|
+
hooks.onResponse.push((_plugin$hooks2 = plugin.hooks) === null || _plugin$hooks2 === void 0 ? void 0 : _plugin$hooks2.onResponse);
|
|
662
|
+
hooks.onSuccess.push((_plugin$hooks3 = plugin.hooks) === null || _plugin$hooks3 === void 0 ? void 0 : _plugin$hooks3.onSuccess);
|
|
663
|
+
hooks.onError.push((_plugin$hooks4 = plugin.hooks) === null || _plugin$hooks4 === void 0 ? void 0 : _plugin$hooks4.onError);
|
|
664
|
+
hooks.onRetry.push((_plugin$hooks5 = plugin.hooks) === null || _plugin$hooks5 === void 0 ? void 0 : _plugin$hooks5.onRetry);
|
|
697
665
|
}
|
|
698
666
|
return {
|
|
699
667
|
url,
|
|
@@ -737,10 +705,139 @@ function createRetryStrategy(options) {
|
|
|
737
705
|
default: throw new Error("Invalid retry strategy");
|
|
738
706
|
}
|
|
739
707
|
}
|
|
708
|
+
var methods = [
|
|
709
|
+
"get",
|
|
710
|
+
"post",
|
|
711
|
+
"put",
|
|
712
|
+
"patch",
|
|
713
|
+
"delete"
|
|
714
|
+
];
|
|
715
|
+
function parseMethodModifier(path) {
|
|
716
|
+
if (!path.startsWith("@")) return {
|
|
717
|
+
method: void 0,
|
|
718
|
+
path
|
|
719
|
+
};
|
|
720
|
+
const separator = path.indexOf("/");
|
|
721
|
+
const method = path.slice(1, separator === -1 ? void 0 : separator);
|
|
722
|
+
if (!methods.includes(method)) return {
|
|
723
|
+
method: void 0,
|
|
724
|
+
path
|
|
725
|
+
};
|
|
726
|
+
return {
|
|
727
|
+
method,
|
|
728
|
+
path: separator === -1 ? path : path.slice(separator + 1)
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Matches the scheme, `//` and host at the start of a URL that names its own
|
|
733
|
+
* host, such as `https://example.com` in `https://example.com/users`.
|
|
734
|
+
*
|
|
735
|
+
* @see https://www.rfc-editor.org/rfc/rfc3986#section-3
|
|
736
|
+
*/
|
|
737
|
+
var ORIGIN_RE = /^[a-z][a-z\d+.-]*:\/\/[^/?#]+/i;
|
|
738
|
+
/**
|
|
739
|
+
* Matches the slashes at the start of a path, such as `///` in `///users`.
|
|
740
|
+
*/
|
|
741
|
+
var LEADING_SLASHES_RE = /^\/+/;
|
|
742
|
+
/**
|
|
743
|
+
* Removes every slash at the end, so `"a//"` becomes `"a"`. A loop rather than
|
|
744
|
+
* a regex, as a pattern anchored at the end backtracks over a long run of
|
|
745
|
+
* slashes.
|
|
746
|
+
*/
|
|
747
|
+
function withoutTrailingSlashes(value) {
|
|
748
|
+
let end = value.length;
|
|
749
|
+
while (end > 0 && value[end - 1] === "/") end--;
|
|
750
|
+
return value.slice(0, end);
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Splits at the first occurrence of the separator, so a separator inside the
|
|
754
|
+
* remainder is kept. `"a?b?c"` splits into `"a"` and `"b?c"`.
|
|
755
|
+
*/
|
|
756
|
+
function splitOnce(value, separator) {
|
|
757
|
+
const index = value.indexOf(separator);
|
|
758
|
+
if (index === -1) return [value, void 0];
|
|
759
|
+
return [value.slice(0, index), value.slice(index + 1)];
|
|
760
|
+
}
|
|
761
|
+
var isReservedPathSegment = (value) => value === "." || value === "..";
|
|
762
|
+
var encodeLiteralPathSegment = (segment) => segment.split(":").map((part) => encodeURIComponent(part)).join(":");
|
|
763
|
+
function resolvePathSegment(segment, pathParams) {
|
|
764
|
+
const pathParam = pathParams.get(segment);
|
|
765
|
+
if (pathParam === void 0) return encodeLiteralPathSegment(segment);
|
|
766
|
+
if (isReservedPathSegment(pathParam)) throw new TypeError("Path parameters cannot be reserved path segments");
|
|
767
|
+
return encodeURIComponent(pathParam);
|
|
768
|
+
}
|
|
769
|
+
function getPathParams(path, params) {
|
|
770
|
+
const pathParams = /* @__PURE__ */ new Map();
|
|
771
|
+
if (params) if (Array.isArray(params)) {
|
|
772
|
+
const paramPaths = path.split("/").filter((p) => p.startsWith(":"));
|
|
773
|
+
for (const [index, key] of paramPaths.entries()) {
|
|
774
|
+
const value = params[index];
|
|
775
|
+
pathParams.set(key, String(value));
|
|
776
|
+
}
|
|
777
|
+
} else for (const [key, value] of Object.entries(params)) pathParams.set(`:${key}`, String(value));
|
|
778
|
+
return pathParams;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Replaces `:name` segments with their encoded params.
|
|
782
|
+
*/
|
|
783
|
+
function fillPath(path, params) {
|
|
784
|
+
const pathParams = getPathParams(path, params);
|
|
785
|
+
return path.split("/").map((segment) => resolvePathSegment(segment, pathParams)).join("/");
|
|
786
|
+
}
|
|
787
|
+
function serializeQuery(urlQuery, query) {
|
|
788
|
+
const queryParams = new URLSearchParams(urlQuery);
|
|
789
|
+
for (const [key, value] of Object.entries(query || {})) {
|
|
790
|
+
if (value == null) continue;
|
|
791
|
+
let serializedValue;
|
|
792
|
+
if (typeof value === "string") serializedValue = value;
|
|
793
|
+
else if (Array.isArray(value)) {
|
|
794
|
+
for (const val of value) queryParams.append(key, val);
|
|
795
|
+
continue;
|
|
796
|
+
} else serializedValue = JSON.stringify(value);
|
|
797
|
+
queryParams.set(key, serializedValue);
|
|
798
|
+
}
|
|
799
|
+
const queryParamString = queryParams.toString();
|
|
800
|
+
return queryParamString.length > 0 ? `?${queryParamString}`.replace(/\+/g, "%20") : "";
|
|
801
|
+
}
|
|
802
|
+
function withoutBase(input, baseURL) {
|
|
803
|
+
if (!baseURL) return input;
|
|
804
|
+
const basePath = `${withoutTrailingSlashes(baseURL)}/`;
|
|
805
|
+
return input.startsWith(basePath) ? input.slice(basePath.length) : input;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Appends a path and query to a base as strings, with exactly one slash at the
|
|
809
|
+
* boundary. The path never decides the scheme or host. The base's own query
|
|
810
|
+
* comes first, and its fragment is dropped as it belongs to the base document.
|
|
811
|
+
*/
|
|
812
|
+
function joinURL(base, path, urlQuery, query) {
|
|
813
|
+
const [baseWithoutHash] = splitOnce(base, "#");
|
|
814
|
+
const [basePath, baseQuery = ""] = splitOnce(baseWithoutHash, "?");
|
|
815
|
+
const relativePath = path.replace(LEADING_SLASHES_RE, "");
|
|
816
|
+
const search = serializeQuery(`${baseQuery}&${urlQuery !== null && urlQuery !== void 0 ? urlQuery : ""}`, query);
|
|
817
|
+
const href = `${withoutTrailingSlashes(basePath)}/${relativePath}${search}`;
|
|
818
|
+
return ORIGIN_RE.test(href) ? new URL(href) : href;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Normalize URL
|
|
822
|
+
*/
|
|
823
|
+
function getURL$1(url, option) {
|
|
824
|
+
var _input$match, _ref;
|
|
825
|
+
const { baseURL, params, query } = option || {
|
|
826
|
+
query: {},
|
|
827
|
+
params: {},
|
|
828
|
+
baseURL: ""
|
|
829
|
+
};
|
|
830
|
+
const { path: requestPath } = parseMethodModifier(url);
|
|
831
|
+
const input = requestPath === url ? url : `/${requestPath}`;
|
|
832
|
+
const origin = (_input$match = input.match(ORIGIN_RE)) === null || _input$match === void 0 ? void 0 : _input$match[0];
|
|
833
|
+
const [path, urlQuery] = splitOnce(origin ? input.slice(origin.length) : withoutBase(input, baseURL), "?");
|
|
834
|
+
const filledPath = fillPath(path, params);
|
|
835
|
+
return joinURL((_ref = origin !== null && origin !== void 0 ? origin : baseURL) !== null && _ref !== void 0 ? _ref : "", filledPath, urlQuery, query);
|
|
836
|
+
}
|
|
740
837
|
var getAuthHeader = async (options) => {
|
|
741
838
|
const headers = {};
|
|
742
839
|
const getValue = async (value) => typeof value === "function" ? await value() : value;
|
|
743
|
-
if (options
|
|
840
|
+
if (options === null || options === void 0 ? void 0 : options.auth) {
|
|
744
841
|
if (options.auth.type === "Bearer") {
|
|
745
842
|
const token = await getValue(options.auth.token);
|
|
746
843
|
if (!token) return headers;
|
|
@@ -752,7 +849,7 @@ var getAuthHeader = async (options) => {
|
|
|
752
849
|
} else if (options.auth.type === "Custom") {
|
|
753
850
|
const [prefix, value] = await Promise.all([getValue(options.auth.prefix), getValue(options.auth.value)]);
|
|
754
851
|
if (!value) return headers;
|
|
755
|
-
headers["authorization"] = `${prefix
|
|
852
|
+
headers["authorization"] = `${prefix !== null && prefix !== void 0 ? prefix : ""} ${value}`;
|
|
756
853
|
}
|
|
757
854
|
}
|
|
758
855
|
return headers;
|
|
@@ -800,7 +897,7 @@ function isFunction(value) {
|
|
|
800
897
|
return typeof value === "function";
|
|
801
898
|
}
|
|
802
899
|
function getFetch(options) {
|
|
803
|
-
if (options
|
|
900
|
+
if (options === null || options === void 0 ? void 0 : options.customFetchImpl) return options.customFetchImpl;
|
|
804
901
|
if (typeof globalThis !== "undefined" && isFunction(globalThis.fetch)) return globalThis.fetch;
|
|
805
902
|
if (typeof window !== "undefined" && isFunction(window.fetch)) return window.fetch;
|
|
806
903
|
throw new Error("No fetch implementation found");
|
|
@@ -820,9 +917,9 @@ function mergeHeaders(...sources) {
|
|
|
820
917
|
return merged;
|
|
821
918
|
}
|
|
822
919
|
async function getHeaders(opts) {
|
|
823
|
-
const headers = new Headers(mergeHeaders(opts
|
|
920
|
+
const headers = new Headers(mergeHeaders(opts === null || opts === void 0 ? void 0 : opts.headers, await getAuthHeader(opts)));
|
|
824
921
|
if (!headers.has("content-type")) {
|
|
825
|
-
const contentType = detectContentType(opts
|
|
922
|
+
const contentType = detectContentType(opts === null || opts === void 0 ? void 0 : opts.body);
|
|
826
923
|
if (contentType) headers.set("content-type", contentType);
|
|
827
924
|
}
|
|
828
925
|
return headers;
|
|
@@ -844,18 +941,14 @@ function getBody(options, headers) {
|
|
|
844
941
|
return JSON.stringify(body);
|
|
845
942
|
}
|
|
846
943
|
function getMethod$1(url, options) {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
if (
|
|
850
|
-
|
|
851
|
-
if (!methods.includes(pMethod)) return (options == null ? void 0 : options.body) ? "POST" : "GET";
|
|
852
|
-
return pMethod.toUpperCase();
|
|
853
|
-
}
|
|
854
|
-
return (options == null ? void 0 : options.body) ? "POST" : "GET";
|
|
944
|
+
if (options === null || options === void 0 ? void 0 : options.method) return options.method.toUpperCase();
|
|
945
|
+
const { method } = parseMethodModifier(url);
|
|
946
|
+
if (method) return method.toUpperCase();
|
|
947
|
+
return (options === null || options === void 0 ? void 0 : options.body) ? "POST" : "GET";
|
|
855
948
|
}
|
|
856
949
|
function getTimeout(options, controller) {
|
|
857
950
|
let abortTimeout;
|
|
858
|
-
if (!(options
|
|
951
|
+
if (!(options === null || options === void 0 ? void 0 : options.signal) && (options === null || options === void 0 ? void 0 : options.timeout)) abortTimeout = setTimeout(() => controller === null || controller === void 0 ? void 0 : controller.abort(), options === null || options === void 0 ? void 0 : options.timeout);
|
|
859
952
|
return {
|
|
860
953
|
abortTimeout,
|
|
861
954
|
clearTimeout: () => {
|
|
@@ -863,11 +956,11 @@ function getTimeout(options, controller) {
|
|
|
863
956
|
}
|
|
864
957
|
};
|
|
865
958
|
}
|
|
866
|
-
var ValidationError = class
|
|
959
|
+
var ValidationError = class ValidationError extends Error {
|
|
867
960
|
constructor(issues, message) {
|
|
868
961
|
super(message || JSON.stringify(issues, null, 2));
|
|
869
962
|
this.issues = issues;
|
|
870
|
-
Object.setPrototypeOf(this,
|
|
963
|
+
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
871
964
|
}
|
|
872
965
|
};
|
|
873
966
|
async function parseStandardSchema(schema, input) {
|
|
@@ -875,186 +968,100 @@ async function parseStandardSchema(schema, input) {
|
|
|
875
968
|
if (result.issues) throw new ValidationError(result.issues);
|
|
876
969
|
return result.value;
|
|
877
970
|
}
|
|
878
|
-
|
|
879
|
-
"
|
|
880
|
-
"
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
var applySchemaPlugin = (config) => ({
|
|
886
|
-
id: "apply-schema",
|
|
887
|
-
name: "Apply Schema",
|
|
888
|
-
version: "1.0.0",
|
|
889
|
-
async init(url, options) {
|
|
890
|
-
var _a, _b, _c, _d;
|
|
891
|
-
const schema = ((_b = (_a = config.plugins) == null ? void 0 : _a.find((plugin) => {
|
|
892
|
-
var _a2;
|
|
893
|
-
return ((_a2 = plugin.schema) == null ? void 0 : _a2.config) ? url.startsWith(plugin.schema.config.baseURL || "") || url.startsWith(plugin.schema.config.prefix || "") : false;
|
|
894
|
-
})) == null ? void 0 : _b.schema) || config.schema;
|
|
895
|
-
if (schema) {
|
|
896
|
-
let urlKey = url;
|
|
897
|
-
if ((_c = schema.config) == null ? void 0 : _c.prefix) {
|
|
898
|
-
if (urlKey.startsWith(schema.config.prefix)) {
|
|
899
|
-
urlKey = urlKey.replace(schema.config.prefix, "");
|
|
900
|
-
if (schema.config.baseURL) url = url.replace(schema.config.prefix, schema.config.baseURL);
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
if ((_d = schema.config) == null ? void 0 : _d.baseURL) {
|
|
904
|
-
if (urlKey.startsWith(schema.config.baseURL)) urlKey = urlKey.replace(schema.config.baseURL, "");
|
|
905
|
-
}
|
|
906
|
-
if (urlKey.startsWith("/") && urlKey.charAt(1) === "@") urlKey = urlKey.substring(1);
|
|
907
|
-
const keySchema = schema.schema[urlKey];
|
|
908
|
-
if (keySchema) {
|
|
909
|
-
let validatedHeaders = options == null ? void 0 : options.headers;
|
|
910
|
-
if (keySchema.headers && !(options == null ? void 0 : options.disableValidation)) {
|
|
911
|
-
const normalizedHeaders = {};
|
|
912
|
-
if (options == null ? void 0 : options.headers) {
|
|
913
|
-
if (options.headers instanceof Headers) options.headers.forEach((value, key) => {
|
|
914
|
-
normalizedHeaders[key.toLowerCase()] = value;
|
|
915
|
-
});
|
|
916
|
-
else if (typeof options.headers === "object") {
|
|
917
|
-
for (const [key, value] of Object.entries(options.headers)) if (value !== null && value !== void 0) normalizedHeaders[key.toLowerCase()] = value;
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
const validated = await parseStandardSchema(keySchema.headers, normalizedHeaders);
|
|
921
|
-
const finalHeaders = {};
|
|
922
|
-
for (const [key, value] of Object.entries(validated)) finalHeaders[key.toLowerCase()] = value;
|
|
923
|
-
validatedHeaders = finalHeaders;
|
|
924
|
-
}
|
|
925
|
-
let opts = __spreadProps(__spreadValues({}, options), {
|
|
926
|
-
method: keySchema.method,
|
|
927
|
-
output: keySchema.output,
|
|
928
|
-
headers: validatedHeaders
|
|
929
|
-
});
|
|
930
|
-
if (!(options == null ? void 0 : options.disableValidation)) opts = __spreadProps(__spreadValues({}, opts), {
|
|
931
|
-
body: keySchema.input ? await parseStandardSchema(keySchema.input, options == null ? void 0 : options.body) : options == null ? void 0 : options.body,
|
|
932
|
-
params: keySchema.params ? await parseStandardSchema(keySchema.params, options == null ? void 0 : options.params) : options == null ? void 0 : options.params,
|
|
933
|
-
query: keySchema.query ? await parseStandardSchema(keySchema.query, options == null ? void 0 : options.query) : options == null ? void 0 : options.query
|
|
934
|
-
});
|
|
935
|
-
return {
|
|
936
|
-
url,
|
|
937
|
-
options: opts
|
|
938
|
-
};
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
return {
|
|
942
|
-
url,
|
|
943
|
-
options
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
});
|
|
947
|
-
var createFetch = (config) => {
|
|
948
|
-
async function $fetch(url, options) {
|
|
949
|
-
const opts = __spreadProps(__spreadValues(__spreadValues({}, config), options), {
|
|
950
|
-
headers: mergeHeaders(config == null ? void 0 : config.headers, options == null ? void 0 : options.headers),
|
|
951
|
-
plugins: [
|
|
952
|
-
...(config == null ? void 0 : config.plugins) || [],
|
|
953
|
-
applySchemaPlugin(config || {}),
|
|
954
|
-
...(options == null ? void 0 : options.plugins) || []
|
|
955
|
-
]
|
|
956
|
-
});
|
|
957
|
-
if (config == null ? void 0 : config.catchAllError) try {
|
|
958
|
-
return await betterFetch(url, opts);
|
|
959
|
-
} catch (error) {
|
|
960
|
-
return {
|
|
961
|
-
data: null,
|
|
962
|
-
error: {
|
|
963
|
-
status: 500,
|
|
964
|
-
statusText: "Fetch Error",
|
|
965
|
-
message: "Fetch related error. Captured by catchAllError option. See error property for more details.",
|
|
966
|
-
error
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
return await betterFetch(url, opts);
|
|
971
|
-
}
|
|
972
|
-
return $fetch;
|
|
973
|
-
};
|
|
974
|
-
var isReservedPathSegment = (value) => value === "." || value === "..";
|
|
975
|
-
function encodePathSegment(segment, pathParams) {
|
|
976
|
-
let pathSegment = segment;
|
|
977
|
-
for (const [key, value] of pathParams) pathSegment = pathSegment.replace(key, value);
|
|
978
|
-
if (isReservedPathSegment(pathSegment)) throw new TypeError("Path parameters cannot be reserved path segments");
|
|
979
|
-
return encodeURIComponent(pathSegment);
|
|
971
|
+
function _typeof(o) {
|
|
972
|
+
"@babel/helpers - typeof";
|
|
973
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
974
|
+
return typeof o;
|
|
975
|
+
} : function(o) {
|
|
976
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
977
|
+
}, _typeof(o);
|
|
980
978
|
}
|
|
981
|
-
function
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
if (url.startsWith("@")) {
|
|
989
|
-
const m = url.toString().split("@")[1].split("/")[0];
|
|
990
|
-
if (methods.includes(m)) url = url.replace(`@${m}/`, "/");
|
|
979
|
+
function toPrimitive(t, r) {
|
|
980
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
981
|
+
var e = t[Symbol.toPrimitive];
|
|
982
|
+
if (void 0 !== e) {
|
|
983
|
+
var i = e.call(t, r || "default");
|
|
984
|
+
if ("object" != _typeof(i)) return i;
|
|
985
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
991
986
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
987
|
+
return ("string" === r ? String : Number)(t);
|
|
988
|
+
}
|
|
989
|
+
function toPropertyKey(t) {
|
|
990
|
+
var i = toPrimitive(t, "string");
|
|
991
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
992
|
+
}
|
|
993
|
+
function _defineProperty(e, r, t) {
|
|
994
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
995
|
+
value: t,
|
|
996
|
+
enumerable: !0,
|
|
997
|
+
configurable: !0,
|
|
998
|
+
writable: !0
|
|
999
|
+
}) : e[r] = t, e;
|
|
1000
|
+
}
|
|
1001
|
+
function ownKeys(e, r) {
|
|
1002
|
+
var t = Object.keys(e);
|
|
1003
|
+
if (Object.getOwnPropertySymbols) {
|
|
1004
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1005
|
+
r && (o = o.filter(function(r) {
|
|
1006
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
1007
|
+
})), t.push.apply(t, o);
|
|
1004
1008
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1009
|
+
return t;
|
|
1010
|
+
}
|
|
1011
|
+
function _objectSpread2(e) {
|
|
1012
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1013
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1014
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
1015
|
+
_defineProperty(e, r, t[r]);
|
|
1016
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
1017
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
1018
|
+
});
|
|
1014
1019
|
}
|
|
1015
|
-
|
|
1016
|
-
path = path.replace(/^\/+/, "");
|
|
1017
|
-
let queryParamString = queryParams.toString();
|
|
1018
|
-
queryParamString = queryParamString.length > 0 ? `?${queryParamString}`.replace(/\+/g, "%20") : "";
|
|
1019
|
-
if (!basePath.startsWith("http")) return `${basePath}${path}${queryParamString}`;
|
|
1020
|
-
return new URL(`${path}${queryParamString}`, basePath);
|
|
1020
|
+
return e;
|
|
1021
1021
|
}
|
|
1022
1022
|
var betterFetch = async (url, options) => {
|
|
1023
|
-
var
|
|
1023
|
+
var _opts$signal, _options$body, _options$jsonParser;
|
|
1024
1024
|
const { hooks, url: __url, options: opts } = await initializePlugins(url, options);
|
|
1025
1025
|
const fetch = getFetch(opts);
|
|
1026
1026
|
const controller = new AbortController();
|
|
1027
|
-
const signal = (
|
|
1028
|
-
const _url =
|
|
1027
|
+
const signal = (_opts$signal = opts.signal) !== null && _opts$signal !== void 0 ? _opts$signal : controller.signal;
|
|
1028
|
+
const _url = getURL$1(__url, opts);
|
|
1029
1029
|
const headers = await getHeaders(opts);
|
|
1030
1030
|
const body = getBody(opts, headers);
|
|
1031
1031
|
const method = getMethod$1(__url, opts);
|
|
1032
|
-
const context =
|
|
1032
|
+
const context = _objectSpread2(_objectSpread2({}, opts), {}, {
|
|
1033
1033
|
url: _url,
|
|
1034
1034
|
headers,
|
|
1035
1035
|
body,
|
|
1036
1036
|
method,
|
|
1037
1037
|
signal
|
|
1038
1038
|
});
|
|
1039
|
+
/**
|
|
1040
|
+
* Run all on request hooks
|
|
1041
|
+
*/
|
|
1039
1042
|
for (const onRequest of hooks.onRequest) if (onRequest) {
|
|
1040
1043
|
const res = await onRequest(context);
|
|
1041
1044
|
if (typeof res === "object" && res !== null) Object.assign(context, res);
|
|
1042
1045
|
}
|
|
1043
|
-
if ("pipeTo" in context && typeof context.pipeTo === "function" || typeof (
|
|
1046
|
+
if ("pipeTo" in context && typeof context.pipeTo === "function" || typeof (options === null || options === void 0 || (_options$body = options.body) === null || _options$body === void 0 ? void 0 : _options$body.pipe) === "function") {
|
|
1044
1047
|
if (!("duplex" in context)) context.duplex = "half";
|
|
1045
1048
|
}
|
|
1046
|
-
const { clearTimeout
|
|
1049
|
+
const { clearTimeout } = getTimeout(opts, controller);
|
|
1047
1050
|
let response = await fetch(context.url, context);
|
|
1048
|
-
|
|
1051
|
+
clearTimeout();
|
|
1049
1052
|
const responseContext = {
|
|
1050
1053
|
response,
|
|
1051
1054
|
request: context
|
|
1052
1055
|
};
|
|
1053
1056
|
for (const onResponse of hooks.onResponse) if (onResponse) {
|
|
1054
|
-
|
|
1057
|
+
var _options$hookOptions;
|
|
1058
|
+
const r = await onResponse(_objectSpread2(_objectSpread2({}, responseContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions = options.hookOptions) === null || _options$hookOptions === void 0 ? void 0 : _options$hookOptions.cloneResponse) ? response.clone() : response }));
|
|
1055
1059
|
if (r instanceof Response) response = r;
|
|
1056
1060
|
else if (typeof r === "object" && r !== null) response = r.response;
|
|
1057
1061
|
}
|
|
1062
|
+
/**
|
|
1063
|
+
* OK Branch
|
|
1064
|
+
*/
|
|
1058
1065
|
if (response.ok) {
|
|
1059
1066
|
if (!(context.method !== "HEAD")) return {
|
|
1060
1067
|
data: "",
|
|
@@ -1067,54 +1074,164 @@ var betterFetch = async (url, options) => {
|
|
|
1067
1074
|
request: context
|
|
1068
1075
|
};
|
|
1069
1076
|
if (responseType === "json" || responseType === "text") {
|
|
1077
|
+
var _context$jsonParser;
|
|
1070
1078
|
const text = await response.text();
|
|
1071
|
-
successContext.data = await ((
|
|
1079
|
+
successContext.data = await ((_context$jsonParser = context.jsonParser) !== null && _context$jsonParser !== void 0 ? _context$jsonParser : jsonParse)(text);
|
|
1072
1080
|
} else successContext.data = await response[responseType]();
|
|
1073
|
-
|
|
1081
|
+
/**
|
|
1082
|
+
* Parse the data if the output schema is defined
|
|
1083
|
+
*/
|
|
1084
|
+
if (context === null || context === void 0 ? void 0 : context.output) {
|
|
1074
1085
|
if (context.output && !context.disableValidation) successContext.data = await parseStandardSchema(context.output, successContext.data);
|
|
1075
1086
|
}
|
|
1076
|
-
for (const onSuccess of hooks.onSuccess) if (onSuccess)
|
|
1077
|
-
|
|
1087
|
+
for (const onSuccess of hooks.onSuccess) if (onSuccess) {
|
|
1088
|
+
var _options$hookOptions2;
|
|
1089
|
+
await onSuccess(_objectSpread2(_objectSpread2({}, successContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions2 = options.hookOptions) === null || _options$hookOptions2 === void 0 ? void 0 : _options$hookOptions2.cloneResponse) ? response.clone() : response }));
|
|
1090
|
+
}
|
|
1091
|
+
if (options === null || options === void 0 ? void 0 : options.throw) return successContext.data;
|
|
1078
1092
|
return {
|
|
1079
1093
|
data: successContext.data,
|
|
1080
1094
|
error: null
|
|
1081
1095
|
};
|
|
1082
1096
|
}
|
|
1083
|
-
const parser = (
|
|
1097
|
+
const parser = (_options$jsonParser = options === null || options === void 0 ? void 0 : options.jsonParser) !== null && _options$jsonParser !== void 0 ? _options$jsonParser : jsonParse;
|
|
1084
1098
|
const responseText = await response.text();
|
|
1085
1099
|
const isJSONResponse = isJSONParsable(responseText);
|
|
1086
1100
|
const errorObject = isJSONResponse ? await parser(responseText) : null;
|
|
1101
|
+
/**
|
|
1102
|
+
* Error Branch
|
|
1103
|
+
*/
|
|
1087
1104
|
const errorContext = {
|
|
1088
1105
|
response,
|
|
1089
1106
|
responseText,
|
|
1090
1107
|
request: context,
|
|
1091
|
-
error:
|
|
1108
|
+
error: _objectSpread2(_objectSpread2({}, errorObject), {}, {
|
|
1092
1109
|
status: response.status,
|
|
1093
1110
|
statusText: response.statusText
|
|
1094
1111
|
})
|
|
1095
1112
|
};
|
|
1096
|
-
for (const onError of hooks.onError) if (onError)
|
|
1097
|
-
|
|
1113
|
+
for (const onError of hooks.onError) if (onError) {
|
|
1114
|
+
var _options$hookOptions3;
|
|
1115
|
+
await onError(_objectSpread2(_objectSpread2({}, errorContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions3 = options.hookOptions) === null || _options$hookOptions3 === void 0 ? void 0 : _options$hookOptions3.cloneResponse) ? response.clone() : response }));
|
|
1116
|
+
}
|
|
1117
|
+
if (options === null || options === void 0 ? void 0 : options.retry) {
|
|
1118
|
+
var _options$retryAttempt;
|
|
1098
1119
|
const retryStrategy = createRetryStrategy(options.retry);
|
|
1099
|
-
const _retryAttempt = (
|
|
1120
|
+
const _retryAttempt = (_options$retryAttempt = options.retryAttempt) !== null && _options$retryAttempt !== void 0 ? _options$retryAttempt : 0;
|
|
1100
1121
|
if (await retryStrategy.shouldAttemptRetry(_retryAttempt, response)) {
|
|
1101
1122
|
for (const onRetry of hooks.onRetry) if (onRetry) await onRetry(responseContext);
|
|
1102
1123
|
const delay = retryStrategy.getDelay(_retryAttempt);
|
|
1103
1124
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1104
|
-
return await betterFetch(url,
|
|
1125
|
+
return await betterFetch(url, _objectSpread2(_objectSpread2({}, options), {}, { retryAttempt: _retryAttempt + 1 }));
|
|
1105
1126
|
}
|
|
1106
1127
|
}
|
|
1107
|
-
if (options
|
|
1128
|
+
if (options === null || options === void 0 ? void 0 : options.throw) throw new BetterFetchError(response.status, response.statusText, isJSONResponse ? errorObject : responseText);
|
|
1108
1129
|
return {
|
|
1109
1130
|
data: null,
|
|
1110
|
-
error:
|
|
1131
|
+
error: _objectSpread2(_objectSpread2({}, errorObject), {}, {
|
|
1111
1132
|
status: response.status,
|
|
1112
1133
|
statusText: response.statusText
|
|
1113
1134
|
})
|
|
1114
1135
|
};
|
|
1115
1136
|
};
|
|
1116
|
-
|
|
1117
|
-
|
|
1137
|
+
var applySchemaPlugin = (config) => ({
|
|
1138
|
+
id: "apply-schema",
|
|
1139
|
+
name: "Apply Schema",
|
|
1140
|
+
version: "1.0.0",
|
|
1141
|
+
async init(url, options) {
|
|
1142
|
+
var _config$plugins;
|
|
1143
|
+
let opts = _objectSpread2(_objectSpread2({}, options), config.query !== void 0 && { query: _objectSpread2(_objectSpread2({}, config.query), options === null || options === void 0 ? void 0 : options.query) });
|
|
1144
|
+
const schema = ((_config$plugins = config.plugins) === null || _config$plugins === void 0 || (_config$plugins = _config$plugins.find((plugin) => {
|
|
1145
|
+
var _plugin$schema;
|
|
1146
|
+
return ((_plugin$schema = plugin.schema) === null || _plugin$schema === void 0 ? void 0 : _plugin$schema.config) ? url.startsWith(plugin.schema.config.baseURL || "") || url.startsWith(plugin.schema.config.prefix || "") : false;
|
|
1147
|
+
})) === null || _config$plugins === void 0 ? void 0 : _config$plugins.schema) || config.schema;
|
|
1148
|
+
if (schema) {
|
|
1149
|
+
var _schema$config, _schema$config2;
|
|
1150
|
+
let urlKey = url;
|
|
1151
|
+
if ((_schema$config = schema.config) === null || _schema$config === void 0 ? void 0 : _schema$config.prefix) {
|
|
1152
|
+
if (urlKey.startsWith(schema.config.prefix)) {
|
|
1153
|
+
urlKey = urlKey.replace(schema.config.prefix, "");
|
|
1154
|
+
if (schema.config.baseURL) url = url.replace(schema.config.prefix, schema.config.baseURL);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
if ((_schema$config2 = schema.config) === null || _schema$config2 === void 0 ? void 0 : _schema$config2.baseURL) {
|
|
1158
|
+
if (urlKey.startsWith(schema.config.baseURL)) urlKey = urlKey.replace(schema.config.baseURL, "");
|
|
1159
|
+
}
|
|
1160
|
+
if (urlKey.startsWith("/") && urlKey.charAt(1) === "@") urlKey = urlKey.substring(1);
|
|
1161
|
+
const keySchema = schema.schema[urlKey];
|
|
1162
|
+
if (keySchema) {
|
|
1163
|
+
var _keySchema$method;
|
|
1164
|
+
const { method: schemaMethod, path } = parseMethodModifier(urlKey);
|
|
1165
|
+
if (schemaMethod) url = url.slice(0, url.length - urlKey.length) + path;
|
|
1166
|
+
let validatedHeaders = options === null || options === void 0 ? void 0 : options.headers;
|
|
1167
|
+
if (keySchema.headers && !(options === null || options === void 0 ? void 0 : options.disableValidation)) {
|
|
1168
|
+
const normalizedHeaders = {};
|
|
1169
|
+
if (options === null || options === void 0 ? void 0 : options.headers) {
|
|
1170
|
+
if (options.headers instanceof Headers) options.headers.forEach((value, key) => {
|
|
1171
|
+
normalizedHeaders[key.toLowerCase()] = value;
|
|
1172
|
+
});
|
|
1173
|
+
else if (typeof options.headers === "object") {
|
|
1174
|
+
for (const [key, value] of Object.entries(options.headers)) if (value !== null && value !== void 0) normalizedHeaders[key.toLowerCase()] = value;
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
const validated = await parseStandardSchema(keySchema.headers, normalizedHeaders);
|
|
1178
|
+
const finalHeaders = {};
|
|
1179
|
+
for (const [key, value] of Object.entries(validated)) finalHeaders[key.toLowerCase()] = value;
|
|
1180
|
+
validatedHeaders = finalHeaders;
|
|
1181
|
+
}
|
|
1182
|
+
const method = (_keySchema$method = keySchema.method) !== null && _keySchema$method !== void 0 ? _keySchema$method : schemaMethod;
|
|
1183
|
+
opts = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, opts), method !== void 0 && { method }), keySchema.output !== void 0 && { output: keySchema.output }), validatedHeaders !== void 0 && { headers: validatedHeaders });
|
|
1184
|
+
if (!(options === null || options === void 0 ? void 0 : options.disableValidation)) {
|
|
1185
|
+
if (keySchema.query) {
|
|
1186
|
+
opts.query = await parseStandardSchema(keySchema.query, options === null || options === void 0 ? void 0 : options.query);
|
|
1187
|
+
if (opts.query !== null && typeof opts.query === "object") {
|
|
1188
|
+
const defaults = _objectSpread2({}, config.query);
|
|
1189
|
+
for (const key of Object.keys(defaults)) if ((options === null || options === void 0 ? void 0 : options.query) && Object.prototype.hasOwnProperty.call(options.query, key)) defaults[key] = options.query[key];
|
|
1190
|
+
opts.query = _objectSpread2(_objectSpread2({}, defaults), opts.query);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
opts = _objectSpread2(_objectSpread2({}, opts), {}, {
|
|
1194
|
+
body: keySchema.input ? await parseStandardSchema(keySchema.input, options === null || options === void 0 ? void 0 : options.body) : options === null || options === void 0 ? void 0 : options.body,
|
|
1195
|
+
params: keySchema.params ? await parseStandardSchema(keySchema.params, options === null || options === void 0 ? void 0 : options.params) : options === null || options === void 0 ? void 0 : options.params
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
return {
|
|
1199
|
+
url,
|
|
1200
|
+
options: opts
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
return _objectSpread2({ url }, (options !== void 0 || config.query !== void 0) && { options: opts });
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
var createFetch = (config) => {
|
|
1208
|
+
async function $fetch(url, options) {
|
|
1209
|
+
const opts = _objectSpread2(_objectSpread2(_objectSpread2({}, config), options), {}, {
|
|
1210
|
+
headers: mergeHeaders(config === null || config === void 0 ? void 0 : config.headers, options === null || options === void 0 ? void 0 : options.headers),
|
|
1211
|
+
plugins: [
|
|
1212
|
+
...(config === null || config === void 0 ? void 0 : config.plugins) || [],
|
|
1213
|
+
applySchemaPlugin(config || {}),
|
|
1214
|
+
...(options === null || options === void 0 ? void 0 : options.plugins) || []
|
|
1215
|
+
]
|
|
1216
|
+
});
|
|
1217
|
+
if (config === null || config === void 0 ? void 0 : config.catchAllError) try {
|
|
1218
|
+
return await betterFetch(url, opts);
|
|
1219
|
+
} catch (error) {
|
|
1220
|
+
return {
|
|
1221
|
+
data: null,
|
|
1222
|
+
error: {
|
|
1223
|
+
status: 500,
|
|
1224
|
+
statusText: "Fetch Error",
|
|
1225
|
+
message: "Fetch related error. Captured by catchAllError option. See error property for more details.",
|
|
1226
|
+
error
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
return await betterFetch(url, opts);
|
|
1231
|
+
}
|
|
1232
|
+
return $fetch;
|
|
1233
|
+
};
|
|
1234
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/config.mjs
|
|
1118
1235
|
var resolvePublicAuthUrl = (basePath) => {
|
|
1119
1236
|
if (typeof process === "undefined") return void 0;
|
|
1120
1237
|
const path = basePath ?? "/api/auth";
|
|
@@ -1129,6 +1246,7 @@ var resolvePublicAuthUrl = (basePath) => {
|
|
|
1129
1246
|
} catch {}
|
|
1130
1247
|
}
|
|
1131
1248
|
};
|
|
1249
|
+
var matchesSessionSignal = (path) => path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/revoke-other-sessions" || path === "/change-email" || path === "/change-password";
|
|
1132
1250
|
var getClientConfig = (options, loadEnv) => {
|
|
1133
1251
|
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
1134
1252
|
const baseURL = getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? "/api/auth";
|
|
@@ -1182,9 +1300,7 @@ var getClientConfig = (options, loadEnv) => {
|
|
|
1182
1300
|
};
|
|
1183
1301
|
const atomListeners = [{
|
|
1184
1302
|
signal: "$sessionSignal",
|
|
1185
|
-
matcher
|
|
1186
|
-
return path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/revoke-other-sessions" || path === "/change-email" || path === "/change-password";
|
|
1187
|
-
},
|
|
1303
|
+
matcher: matchesSessionSignal,
|
|
1188
1304
|
callback(path) {
|
|
1189
1305
|
if (path === "/sign-out") broadcastSessionUpdate("signout");
|
|
1190
1306
|
else if (path === "/update-user" || path === "/update-session") broadcastSessionUpdate("updateUser");
|
|
@@ -1214,17 +1330,16 @@ var getClientConfig = (options, loadEnv) => {
|
|
|
1214
1330
|
pluginPathMethods,
|
|
1215
1331
|
atomListeners,
|
|
1216
1332
|
hydrateSession,
|
|
1333
|
+
$sessionSignal,
|
|
1217
1334
|
$fetch,
|
|
1218
1335
|
$store
|
|
1219
1336
|
};
|
|
1220
1337
|
};
|
|
1221
|
-
|
|
1222
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
1338
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
1223
1339
|
function isAtom(value) {
|
|
1224
1340
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
1225
1341
|
}
|
|
1226
|
-
|
|
1227
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/client/proxy.mjs
|
|
1342
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/proxy.mjs
|
|
1228
1343
|
function getMethod(path, knownPathMethods, args) {
|
|
1229
1344
|
const method = knownPathMethods[path];
|
|
1230
1345
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -1298,8 +1413,7 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
|
|
|
1298
1413
|
}
|
|
1299
1414
|
return createProxy();
|
|
1300
1415
|
}
|
|
1301
|
-
|
|
1302
|
-
//#region ../node_modules/.bun/better-auth@1.7.2+7ee5f890295c53f0/node_modules/better-auth/dist/client/vanilla.mjs
|
|
1416
|
+
// ../node_modules/.bun/better-auth@1.7.15+951101794207a33e/node_modules/better-auth/dist/client/vanilla.mjs
|
|
1303
1417
|
function createAuthClient(options) {
|
|
1304
1418
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
1305
1419
|
const resolvedHooks = {};
|
|
@@ -1312,9 +1426,7 @@ function createAuthClient(options) {
|
|
|
1312
1426
|
$store
|
|
1313
1427
|
}, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
1314
1428
|
}
|
|
1315
|
-
|
|
1316
|
-
//#region src/lib/auth-client.ts
|
|
1429
|
+
// src/lib/auth-client.ts
|
|
1317
1430
|
var authClient = createAuthClient({ baseURL: typeof window !== "undefined" ? window.location.origin : "" });
|
|
1318
1431
|
var { signIn, signUp, signOut, getSession } = authClient;
|
|
1319
|
-
//#endregion
|
|
1320
1432
|
export { getSession as n, signOut as r, authClient as t };
|