@wssto2/vue-core 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -9
- package/dist/AccessGate.vue_vue_type_script_setup_true_lang-DKX3PH2n.js +22 -0
- package/dist/AccountMenuItem.vue_vue_type_script_setup_true_lang-DIGqTLwd.js +76 -0
- package/dist/ActionRow.vue_vue_type_script_setup_true_lang-B7Lpfkf6.js +45 -0
- package/dist/Activity-DviO0VQ8.js +156 -0
- package/dist/{AdaptivePageShell.vue_vue_type_script_setup_true_lang-CKghARkW.js → AdaptivePageShell.vue_vue_type_script_setup_true_lang-CvAnzdc1.js} +48 -47
- package/dist/{AlertDialog.vue_vue_type_script_setup_true_lang-BZb4qKXo.js → AlertDialog.vue_vue_type_script_setup_true_lang-CJsMUIUg.js} +2 -2
- package/dist/{AsyncSection.vue_vue_type_script_setup_true_lang-B82bl36A.js → AsyncSection.vue_vue_type_script_setup_true_lang-CCtthMRd.js} +4 -4
- package/dist/Badge.vue_vue_type_script_setup_true_lang-DJyZc0C7.js +51 -0
- package/dist/{Banner.vue_vue_type_script_setup_true_lang-n_wGPIIu.js → Banner.vue_vue_type_script_setup_true_lang-Cib_YYpr.js} +1 -1
- package/dist/{BottomDock.vue_vue_type_script_setup_true_lang-DhlMnPC2.js → BottomDock.vue_vue_type_script_setup_true_lang-CjN7xYEr.js} +1 -1
- package/dist/Button.vue_vue_type_script_setup_true_lang-CYil8h9z.js +182 -0
- package/dist/Changes-DlT5mN9G.js +129 -0
- package/dist/CollectionPage.vue_vue_type_script_setup_true_lang-CXILftEc.js +1481 -0
- package/dist/CountryFlag.vue_vue_type_script_setup_true_lang-Kry_vPPZ.js +299 -0
- package/dist/DataTable.vue_vue_type_script_setup_true_lang-DSYgS9lC.js +52 -0
- package/dist/DateField.vue_vue_type_script_setup_true_lang-DMVjNsaM.js +1099 -0
- package/dist/{DiscardChangesModal.vue_vue_type_script_setup_true_lang-Bx5O1RZJ.js → DiscardChangesModal.vue_vue_type_script_setup_true_lang-Cb3xJI1x.js} +1 -1
- package/dist/{EmptyState.vue_vue_type_script_setup_true_lang-BeGpHMUP.js → EmptyState.vue_vue_type_script_setup_true_lang-C2ZYIT9F.js} +1 -1
- package/dist/FormErrors.vue_vue_type_script_setup_true_lang-DVgNBQ8p.js +276 -0
- package/dist/FormGroup.vue_vue_type_script_setup_true_lang-0mfG8TkU.js +136 -0
- package/dist/FormView.vue_vue_type_script_setup_true_lang-Bz2m3AtF.js +38 -0
- package/dist/General-BD-Hcz0a.js +145 -0
- package/dist/{Icon.vue_vue_type_script_lang-DtC4_mkz.js → Icon.vue_vue_type_script_lang-VvcV2Bzo.js} +46 -33
- package/dist/{IconTile.vue_vue_type_script_setup_true_lang-Csfv6Sel.js → IconTile.vue_vue_type_script_setup_true_lang-D7QgnUyN.js} +1 -1
- package/dist/KeyValue.vue_vue_type_script_setup_true_lang-wcZcvnow.js +35 -0
- package/dist/{LeaveGuardRoot.vue_vue_type_script_setup_true_lang-DH6EB8br.js → LeaveGuardRoot.vue_vue_type_script_setup_true_lang-C2udmeEA.js} +2 -2
- package/dist/{Menu.vue_vue_type_script_setup_true_lang-D44EHXQZ.js → Menu.vue_vue_type_script_setup_true_lang-BNAjx9tj.js} +61 -57
- package/dist/{Modal.vue_vue_type_script_setup_true_lang-DYQgaUtj.js → Modal.vue_vue_type_script_setup_true_lang-D7SwVPpL.js} +139 -129
- package/dist/NewRolePage-Dla4YnMs.js +42 -0
- package/dist/NoAccess.vue_vue_type_script_setup_true_lang-8m9cNptR.js +31 -0
- package/dist/NumberField.vue_vue_type_script_setup_true_lang-CYRg7Kfg.js +113 -0
- package/dist/OtpInput.vue_vue_type_script_setup_true_lang-gp4FfWAH.js +95 -0
- package/dist/PageBar.vue_vue_type_script_setup_true_lang-Cfr5xsJx.js +47 -0
- package/dist/{Panel.vue_vue_type_script_setup_true_lang-BQmv3cLb.js → Panel.vue_vue_type_script_setup_true_lang-BCRxRK4D.js} +1 -1
- package/dist/{PhotoViewer.vue_vue_type_script_setup_true_lang-DDVQXJRB.js → PhotoViewer.vue_vue_type_script_setup_true_lang-B3Q4dhqJ.js} +2 -2
- package/dist/Popover.vue_vue_type_script_setup_true_lang-Dx-tDhNE.js +125 -0
- package/dist/ProfilePage-OJMQ8cr8.js +691 -0
- package/dist/{ProgressTrack.vue_vue_type_script_setup_true_lang-1DDaNs2W.js → ProgressTrack.vue_vue_type_script_setup_true_lang-B6Prw9hi.js} +2 -2
- package/dist/RecordHeader.vue_vue_type_script_setup_true_lang-DKsaKlAq.js +64 -0
- package/dist/ResourcePage.vue_vue_type_script_setup_true_lang-CJcKa9SW.js +173 -0
- package/dist/RoleEditor.vue_vue_type_script_setup_true_lang-DuEPOmjI.js +299 -0
- package/dist/RolePage-bZzv_E4l.js +315 -0
- package/dist/RolesPage-BniZv0nB.js +115 -0
- package/dist/SectionIntro.vue_vue_type_script_setup_true_lang-CZtPrmXD.js +23 -0
- package/dist/SectionList.vue_vue_type_script_setup_true_lang-BKP_bge8.js +148 -0
- package/dist/SectionNavigator.vue_vue_type_script_setup_true_lang-BgGEGxSI.js +314 -0
- package/dist/SegmentedField.vue_vue_type_script_setup_true_lang-BZ9UdgA1.js +58 -0
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-BiGaEKBQ.js +422 -0
- package/dist/SessionList.vue_vue_type_script_setup_true_lang-DUQpr7gb.js +111 -0
- package/dist/Sessions-Co5-xdeb.js +96 -0
- package/dist/Sheet.vue_vue_type_script_setup_true_lang-bHYzx7-J.js +142 -0
- package/dist/SignIn-BWwFbxki.js +140 -0
- package/dist/SignInPage-FnLtoi2q.js +60 -0
- package/dist/SignInTable.vue_vue_type_script_setup_true_lang-Dnx3T_42.js +79 -0
- package/dist/SignIns-3UcI64_h.js +66 -0
- package/dist/SwipeActions.vue_vue_type_script_setup_true_lang-4I8m27ol.js +93 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-BeGaydRr.js +155 -0
- package/dist/TextField.vue_vue_type_script_setup_true_lang-C_FMf3Vc.js +269 -0
- package/dist/TextareaField.vue_vue_type_script_setup_true_lang-CU3KTKIJ.js +127 -0
- package/dist/{Timestamp.vue_vue_type_script_setup_true_lang-CSY_mMm1.js → Timestamp.vue_vue_type_script_setup_true_lang-1RJGKxbD.js} +1 -1
- package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-BJWPVyfT.js → Tooltip.vue_vue_type_script_setup_true_lang-OOD_XNWx.js} +1 -1
- package/dist/UserRecord-Ci8HfwbX.js +267 -0
- package/dist/UsersList-vEJ-cgkT.js +155 -0
- package/dist/ViewTabs.vue_vue_type_script_setup_true_lang-ByqTU2JT.js +28 -0
- package/dist/access/AddRoleDialog.vue.d.ts +19 -0
- package/dist/access/BindingRow.vue.d.ts +19 -0
- package/dist/access/EffectiveAccess.vue.d.ts +12 -0
- package/dist/access/NewRolePage.vue.d.ts +2 -0
- package/dist/access/PermissionTree.vue.d.ts +13 -0
- package/dist/access/PersonAccess.vue.d.ts +21 -0
- package/dist/access/ReplaceRoleDialog.vue.d.ts +17 -0
- package/dist/access/RoleCompareDialog.vue.d.ts +14 -0
- package/dist/access/RoleEditor.vue.d.ts +28 -0
- package/dist/access/RolePage.vue.d.ts +2 -0
- package/dist/access/RolesPage.vue.d.ts +2 -0
- package/dist/access/api.d.ts +26 -0
- package/dist/access/catalogue.d.ts +64 -0
- package/dist/access/context.d.ts +20 -0
- package/dist/access/effective.d.ts +42 -0
- package/dist/access/feature.d.ts +27 -0
- package/dist/access/index.d.ts +13 -0
- package/dist/access/index.js +15 -0
- package/dist/access/labels.d.ts +35 -0
- package/dist/access/refusals.d.ts +6 -0
- package/dist/access/routes.d.ts +45 -0
- package/dist/access/scopes.d.ts +20 -0
- package/dist/app/application.d.ts +5 -0
- package/dist/app/contributions.d.ts +1 -1
- package/dist/app/environment.d.ts +2 -0
- package/dist/app/feature.d.ts +8 -0
- package/dist/app/index.js +260 -294
- package/dist/bottomDock-BZEiOPYZ.js +12 -0
- package/dist/button/Button.vue.d.ts +3 -3
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +5 -3
- package/dist/button/shortcut.d.ts +28 -2
- package/dist/chrome-BS3xJcad.js +93 -0
- package/dist/client/client.d.ts +13 -0
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +19 -138
- package/dist/client/route.d.ts +59 -0
- package/dist/client-Bw0aM5Gu.js +147 -0
- package/dist/closeOverlays-CjVsIrpL.js +8 -0
- package/dist/collection/CollectionPage.vue.d.ts +1 -0
- package/dist/collection/CollectionRows.vue.d.ts +59 -0
- package/dist/collection/CollectionTable.vue.d.ts +1 -1
- package/dist/collection/DataTable.vue.d.ts +47 -0
- package/dist/collection/RowActions.vue.d.ts +19 -0
- package/dist/collection/columns.d.ts +2 -0
- package/dist/collection/http.d.ts +4 -2
- package/dist/collection/index.d.ts +4 -2
- package/dist/collection/index.js +87 -2299
- package/dist/collection/rowLayout.d.ts +10 -0
- package/dist/collection/slots.d.ts +6 -3
- package/dist/content/index.js +37 -66
- package/dist/contributions-CDDg3fKp.js +26 -0
- package/dist/controls/DateButton.vue.d.ts +1 -1
- package/dist/controls/PopupButton.vue.d.ts +1 -1
- package/dist/controls/index.js +11 -10
- package/dist/defineRoutes-BGAdiIrt.js +19 -0
- package/dist/describeError-Ctga6GcS.js +41 -0
- package/dist/dialogStack-DZZg55w0.js +31 -0
- package/dist/environment-Dva-SG8D.js +6 -0
- package/dist/{error-Bb_dr_Ay.js → error-CD7x0Jrz.js} +2 -2
- package/dist/feature-DdUAfyi4.js +25 -0
- package/dist/fieldMessages-C3Rpbktw.js +25 -0
- package/dist/form/CheckboxField.vue.d.ts +1 -1
- package/dist/form/CommandDialog.vue.d.ts +13 -2
- package/dist/form/DateField.vue.d.ts +1 -1
- package/dist/form/DateTimeField.vue.d.ts +1 -1
- package/dist/form/EditorPage.vue.d.ts +1 -1
- package/dist/form/Field.vue.d.ts +1 -1
- package/dist/form/FileField.vue.d.ts +1 -1
- package/dist/form/FormGroup.vue.d.ts +1 -1
- package/dist/form/FormGroupButton.vue.d.ts +1 -1
- package/dist/form/FormRow.vue.d.ts +1 -1
- package/dist/form/I18nField.vue.d.ts +3 -3
- package/dist/form/MoneyField.vue.d.ts +1 -1
- package/dist/form/MonthYearField.vue.d.ts +1 -1
- package/dist/form/MultiSelectField.vue.d.ts +4 -1
- package/dist/form/NumberCell.vue.d.ts +1 -1
- package/dist/form/NumberField.vue.d.ts +8 -2
- package/dist/form/OptionList.vue.d.ts +6 -2
- package/dist/form/OtpInput.vue.d.ts +2 -2
- package/dist/form/PhotoField.vue.d.ts +1 -1
- package/dist/form/SelectField.vue.d.ts +4 -1
- package/dist/form/SwitchField.vue.d.ts +1 -1
- package/dist/form/TextField.vue.d.ts +3 -3
- package/dist/form/TextareaField.vue.d.ts +3 -3
- package/dist/form/TimeField.vue.d.ts +1 -1
- package/dist/form/date/DatePickerSheet.vue.d.ts +1 -1
- package/dist/form/date/MonthYearPanel.vue.d.ts +1 -1
- package/dist/form/index.d.ts +2 -0
- package/dist/form/index.js +1273 -3509
- package/dist/form/suggestions.d.ts +11 -0
- package/dist/form/useOptions.d.ts +60 -0
- package/dist/guards-Cd1V28oG.js +51 -0
- package/dist/http-DGGSKWvU.js +193 -0
- package/dist/i18n/describeError.d.ts +31 -0
- package/dist/i18n/index.d.ts +307 -0
- package/dist/i18n/index.js +54 -52
- package/dist/icon/core.d.ts +13 -0
- package/dist/icon/index.js +1 -1
- package/dist/identity/ImpersonationBanner.vue.d.ts +2 -0
- package/dist/identity/LocaleSync.vue.d.ts +2 -0
- package/dist/identity/SessionExpiry.vue.d.ts +2 -0
- package/dist/identity/SignInAsButton.vue.d.ts +15 -0
- package/dist/identity/SignInPage.vue.d.ts +2 -0
- package/dist/identity/context.d.ts +7 -0
- package/dist/identity/feature.d.ts +16 -0
- package/dist/identity/fieldMessages.d.ts +15 -0
- package/dist/identity/index.d.ts +16 -0
- package/dist/identity/index.js +18 -0
- package/dist/identity/profile/DetailsPanel.vue.d.ts +11 -0
- package/dist/identity/profile/EmailChangeDialog.vue.d.ts +14 -0
- package/dist/identity/profile/EmailPanel.vue.d.ts +11 -0
- package/dist/identity/profile/PanelActions.vue.d.ts +17 -0
- package/dist/identity/profile/PasswordPanel.vue.d.ts +2 -0
- package/dist/identity/profile/ProfileMenuItem.vue.d.ts +2 -0
- package/dist/identity/profile/ProfilePage.vue.d.ts +2 -0
- package/dist/identity/profile/SessionsPanel.vue.d.ts +2 -0
- package/dist/identity/profile/SignInsPanel.vue.d.ts +2 -0
- package/dist/identity/profile/VerifyCode.vue.d.ts +49 -0
- package/dist/identity/profile/routes.d.ts +13 -0
- package/dist/identity/session.d.ts +30 -0
- package/dist/identity/shared/ActionRow.vue.d.ts +20 -0
- package/dist/identity/shared/ChangeFeed.vue.d.ts +11 -0
- package/dist/identity/shared/PageBar.vue.d.ts +12 -0
- package/dist/identity/shared/SectionIntro.vue.d.ts +16 -0
- package/dist/identity/shared/SessionList.vue.d.ts +19 -0
- package/dist/{phone/CountryFlag.vue.d.ts → identity/shared/SignInTable.vue.d.ts} +5 -4
- package/dist/identity/shared/ViewTabs.vue.d.ts +23 -0
- package/dist/identity/shared/signInEvents.d.ts +9 -0
- package/dist/identity/signIn.d.ts +27 -0
- package/dist/identity/useSignInForm.d.ts +20 -0
- package/dist/identity/user.d.ts +6 -0
- package/dist/identity/users/DeactivateDialog.vue.d.ts +18 -0
- package/dist/identity/users/NewUserDialog.vue.d.ts +9 -0
- package/dist/identity/users/SetPasswordDialog.vue.d.ts +16 -0
- package/dist/identity/users/UserRecord.vue.d.ts +2 -0
- package/dist/identity/users/UsersList.vue.d.ts +2 -0
- package/dist/identity/users/access.d.ts +4 -0
- package/dist/identity/users/context.d.ts +9 -0
- package/dist/identity/users/feature.d.ts +34 -0
- package/dist/identity/users/languages.d.ts +4 -0
- package/dist/identity/users/list.d.ts +8 -0
- package/dist/identity/users/person.d.ts +26 -0
- package/dist/identity/users/personSections.d.ts +22 -0
- package/dist/identity/users/routes.d.ts +22 -0
- package/dist/identity/users/sections/Activity.vue.d.ts +2 -0
- package/dist/identity/users/sections/Changes.vue.d.ts +2 -0
- package/dist/identity/users/sections/General.vue.d.ts +2 -0
- package/dist/identity/users/sections/Sessions.vue.d.ts +2 -0
- package/dist/identity/users/sections/SignIn.vue.d.ts +2 -0
- package/dist/identity/users/sections/SignIns.vue.d.ts +2 -0
- package/dist/identity/users/status.d.ts +4 -0
- package/dist/index-B2dbYZR9.js +706 -0
- package/dist/index-BAcl44SC.js +459 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/CountryFlag.vue.d.ts +10 -0
- package/dist/internal/languageName.d.ts +2 -0
- package/dist/keepAlive-WYQGRhuz.js +48 -0
- package/dist/languageName-CItV_SOv.js +11 -0
- package/dist/languages-BShG9LpE.js +10 -0
- package/dist/leaveGuard-Cc8yeLxM.js +72 -0
- package/dist/modal/Modal.vue.d.ts +4 -0
- package/dist/modal/ShortcutHelp.vue.d.ts +2 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +64 -6
- package/dist/modal/placement.d.ts +22 -0
- package/dist/modules/access/entities.d.ts +112 -0
- package/dist/modules/access/routes.d.ts +67 -0
- package/dist/modules/access/schemas.d.ts +73 -0
- package/dist/modules/identity/entities.d.ts +150 -0
- package/dist/modules/identity/routes.d.ts +118 -0
- package/dist/modules/identity/schemas.d.ts +145 -0
- package/dist/{navigation-B33ikiCS.js → navigation-BPWa63ge.js} +21 -20
- package/dist/neighbors-D0WRBxXI.js +86 -0
- package/dist/{options-CjSz2dQK.js → options-BXkMR63B.js} +48 -49
- package/dist/overlay/AlertDialog.vue.d.ts +3 -3
- package/dist/overlay/Popover.vue.d.ts +4 -1
- package/dist/overlay/closeOverlays.d.ts +7 -0
- package/dist/overlay/dialogStack.d.ts +9 -0
- package/dist/overlay/index.d.ts +1 -1
- package/dist/overlay/index.js +20 -18
- package/dist/page/AdaptivePageShell.vue.d.ts +2 -2
- package/dist/page/ResourceHeader.vue.d.ts +2 -2
- package/dist/page/index.js +99 -457
- package/dist/phone/PhoneField.vue.d.ts +2 -2
- package/dist/phone/index.js +247 -540
- package/dist/platform/AccessGate.vue.d.ts +50 -0
- package/dist/platform/index.d.ts +4 -2
- package/dist/platform/index.js +38 -35
- package/dist/platform/platform.d.ts +2 -2
- package/dist/platform/session.d.ts +22 -1
- package/dist/platform-hunMqFdB.js +255 -0
- package/dist/resource/index.js +8 -248
- package/dist/routeResource-DstM0hvf.js +82 -0
- package/dist/router/guards.d.ts +7 -1
- package/dist/router/index.js +23 -37
- package/dist/router/navigation.d.ts +1 -1
- package/dist/rowLayout-BI7a3Kom.js +603 -0
- package/dist/sectionIndex-BS0ic5W7.js +86 -0
- package/dist/{sections-LtxV5Mtk.js → sections-BEqW1dOc.js} +1 -1
- package/dist/shell/AccountMenuItem.vue.d.ts +4 -1
- package/dist/shell/BackofficeShell.vue.d.ts +2 -2
- package/dist/shell/ShellBrand.vue.d.ts +1 -1
- package/dist/shell/backofficeShell.d.ts +1 -1
- package/dist/shell/identity.d.ts +1 -1
- package/dist/shell/index.js +476 -532
- package/dist/state/Badge.vue.d.ts +17 -10
- package/dist/state/ProgressTrack.vue.d.ts +1 -1
- package/dist/state/hue.d.ts +8 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/state/index.js +34 -31
- package/dist/state/useLoad.d.ts +41 -0
- package/dist/status-C9aXR-Jb.js +33 -0
- package/dist/styles.css +1 -1
- package/dist/suggestions-BJAqOj4c.js +138 -0
- package/dist/testing/app.d.ts +61 -0
- package/dist/testing/async.d.ts +12 -0
- package/dist/testing/collection.d.ts +18 -0
- package/dist/testing/format.d.ts +9 -0
- package/dist/testing/i18n.d.ts +16 -0
- package/dist/testing/index.d.ts +14 -0
- package/dist/testing/index.js +178 -0
- package/dist/testing/media.d.ts +23 -0
- package/dist/testing/platform.d.ts +40 -0
- package/dist/testing/transport.d.ts +40 -0
- package/dist/toast-D9Z5To38.js +13 -0
- package/dist/useCommand-BgRwnYlV.js +135 -0
- package/dist/{useDialog-wmyNx2j_.js → useDialog-CXR3hN0G.js} +1 -1
- package/dist/useLoad-CYRVx6HW.js +39 -0
- package/dist/useResourceForm-Bgc9jMcu.js +52 -0
- package/dist/useSaveChrome-chi6D3HY.js +25 -0
- package/dist/useSheetDrag-OsD6Eb6I.js +72 -0
- package/package.json +26 -5
- package/src/styles/theme.css +60 -0
- package/dist/Badge.vue_vue_type_script_setup_true_lang-DKc6ugmr.js +0 -31
- package/dist/Button.vue_vue_type_script_setup_true_lang-3f0emVNU.js +0 -141
- package/dist/NoAccess.vue_vue_type_script_setup_true_lang-OKW8pKYU.js +0 -78
- package/dist/SectionList.vue_vue_type_script_setup_true_lang-DGcKX_OJ.js +0 -230
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-SyFWE33A.js +0 -422
- package/dist/Sheet.vue_vue_type_script_setup_true_lang-BLBD5ps8.js +0 -210
- package/dist/SwipeActions.vue_vue_type_script_setup_true_lang-CGTuEnTv.js +0 -243
- package/dist/chrome-D9pwD6iS.js +0 -101
- package/dist/dialogStack-DiTG1rZc.js +0 -26
- package/dist/environment-D3nozt9a.js +0 -75
- package/dist/feature-DyDtyMLU.js +0 -47
- package/dist/platform-jqlKVJ2e.js +0 -244
- package/dist/toast-BTeX0r66.js +0 -129
- /package/dist/{phone → internal}/flagLoaders.d.ts +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Permission } from "./index";
|
|
2
|
+
/** Exactly one of `permission`, `any` or `all`; the others are not allowed, so two requirements cannot be mixed. */
|
|
3
|
+
export type AccessGateProps = {
|
|
4
|
+
permission: Permission;
|
|
5
|
+
any?: never;
|
|
6
|
+
all?: never;
|
|
7
|
+
} | {
|
|
8
|
+
permission?: never;
|
|
9
|
+
any: readonly Permission[];
|
|
10
|
+
all?: never;
|
|
11
|
+
} | {
|
|
12
|
+
permission?: never;
|
|
13
|
+
any?: never;
|
|
14
|
+
all: readonly Permission[];
|
|
15
|
+
};
|
|
16
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
17
|
+
permission: Permission;
|
|
18
|
+
any?: never;
|
|
19
|
+
all?: never;
|
|
20
|
+
} | {
|
|
21
|
+
permission?: never;
|
|
22
|
+
any: readonly Permission[];
|
|
23
|
+
all?: never;
|
|
24
|
+
} | {
|
|
25
|
+
permission?: never;
|
|
26
|
+
any?: never;
|
|
27
|
+
all: readonly Permission[];
|
|
28
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
29
|
+
permission: Permission;
|
|
30
|
+
any?: never;
|
|
31
|
+
all?: never;
|
|
32
|
+
} | {
|
|
33
|
+
permission?: never;
|
|
34
|
+
any: readonly Permission[];
|
|
35
|
+
all?: never;
|
|
36
|
+
} | {
|
|
37
|
+
permission?: never;
|
|
38
|
+
any?: never;
|
|
39
|
+
all: readonly Permission[];
|
|
40
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
41
|
+
default?: (props: {}) => any;
|
|
42
|
+
} & {
|
|
43
|
+
fallback?: (props: {}) => any;
|
|
44
|
+
}>;
|
|
45
|
+
export default _default;
|
|
46
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
47
|
+
new (): {
|
|
48
|
+
$slots: S;
|
|
49
|
+
};
|
|
50
|
+
};
|
package/dist/platform/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export { httpSessionAdapter, parseSessionPayload } from "./httpSession";
|
|
|
9
9
|
export type { HttpSessionOptions, UserParser } from "./httpSession";
|
|
10
10
|
export { createPlatform, installPlatform, platformKey, usePlatform } from "./platform";
|
|
11
11
|
export type { Platform, PlatformOptions } from "./platform";
|
|
12
|
-
export { beforeSignOutTimeout, createSession } from "./session";
|
|
13
|
-
export type { BeforeSignOutHook, Session, SessionAdapter, SessionEnd, SessionOptions, SessionSnapshot, SessionState, SessionUser } from "./session";
|
|
12
|
+
export { beforeSignOutTimeout, createSession, heldSession } from "./session";
|
|
13
|
+
export type { BeforeSignOutHook, Session, SessionAdapter, SessionEnd, SessionImpersonator, SessionOptions, SessionSnapshot, SessionState, SessionUser } from "./session";
|
|
14
14
|
/**
|
|
15
15
|
* The permission identifiers of the application. The library declares none: an app adds its own by
|
|
16
16
|
* augmenting this interface (declaration merging, like `IconRegistry`), so route metadata and
|
|
@@ -24,3 +24,5 @@ export interface PermissionRegistry {
|
|
|
24
24
|
}
|
|
25
25
|
/** Every permission identifier the application declared; any string until it declares some. */
|
|
26
26
|
export type Permission = keyof PermissionRegistry extends never ? string : Extract<keyof PermissionRegistry, string>;
|
|
27
|
+
export { default as AccessGate } from "./AccessGate.vue";
|
|
28
|
+
export type { AccessGateProps } from "./AccessGate.vue";
|
package/dist/platform/index.js
CHANGED
|
@@ -4,28 +4,29 @@ var B = (s) => {
|
|
|
4
4
|
};
|
|
5
5
|
var E = (s, t, e) => t in s ? N(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
6
6
|
var $ = (s, t, e) => E(s, typeof t != "symbol" ? t + "" : t, e), w = (s, t, e) => t.has(s) || B("Cannot " + e);
|
|
7
|
-
var o = (s, t, e) => (w(s, t, "read from private field"), e ? e.call(s) : t.get(s)), h = (s, t, e) => t.has(s) ? B("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), f = (s, t, e,
|
|
8
|
-
import { b as J, c as L, a as M, d as T, h as q,
|
|
7
|
+
var o = (s, t, e) => (w(s, t, "read from private field"), e ? e.call(s) : t.get(s)), h = (s, t, e) => t.has(s) ? B("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), f = (s, t, e, r) => (w(s, t, "write to private field"), r ? r.call(s, e) : t.set(s, e), e), u = (s, t, e) => (w(s, t, "access private method"), e);
|
|
8
|
+
import { b as J, c as L, a as M, d as T, h as q, e as F, i as G, p as K, f as _, g as z, u as D } from "../platform-hunMqFdB.js";
|
|
9
9
|
import { M as Q, d as R } from "../context-Ch1r4fdN.js";
|
|
10
|
+
import { _ as V } from "../AccessGate.vue_vue_type_script_setup_true_lang-DKX3PH2n.js";
|
|
10
11
|
class d extends Error {
|
|
11
|
-
constructor(e,
|
|
12
|
-
super(
|
|
12
|
+
constructor(e, r = [], n) {
|
|
13
|
+
super(r.length > 0 ? `${e}: ${r.join("; ")}` : e);
|
|
13
14
|
$(this, "issues");
|
|
14
15
|
$(this, "cause");
|
|
15
|
-
this.name = "BootstrapError", this.issues =
|
|
16
|
+
this.name = "BootstrapError", this.issues = r, this.cause = n?.cause;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
const x = (s) => s === null ? "null" : Array.isArray(s) ? "array" : typeof s,
|
|
19
|
+
const x = (s) => s === null ? "null" : Array.isArray(s) ? "array" : typeof s, S = (s) => typeof s == "object" && s !== null && !Array.isArray(s);
|
|
19
20
|
var a, c, p, m, l, g;
|
|
20
21
|
const b = class b {
|
|
21
22
|
/** @internal use the `fields` passed to `extend`. */
|
|
22
|
-
constructor(t, e,
|
|
23
|
+
constructor(t, e, r, n = !1) {
|
|
23
24
|
h(this, l);
|
|
24
25
|
h(this, a);
|
|
25
26
|
h(this, c);
|
|
26
27
|
h(this, p);
|
|
27
28
|
h(this, m);
|
|
28
|
-
f(this, a, t), f(this, c, e), f(this, p,
|
|
29
|
+
f(this, a, t), f(this, c, e), f(this, p, r), f(this, m, n);
|
|
29
30
|
}
|
|
30
31
|
/** Records a problem with `key`; for values `raw` returns that the application validates itself. */
|
|
31
32
|
fail(t, e) {
|
|
@@ -36,59 +37,60 @@ const b = class b {
|
|
|
36
37
|
return o(this, a)[t];
|
|
37
38
|
}
|
|
38
39
|
string(t, ...e) {
|
|
39
|
-
return u(this, l, g).call(this, t, "string", (
|
|
40
|
+
return u(this, l, g).call(this, t, "string", (r) => typeof r == "string", e);
|
|
40
41
|
}
|
|
41
42
|
number(t, ...e) {
|
|
42
|
-
return u(this, l, g).call(this, t, "number", (
|
|
43
|
+
return u(this, l, g).call(this, t, "number", (r) => typeof r == "number" && Number.isFinite(r), e);
|
|
43
44
|
}
|
|
44
45
|
boolean(t, ...e) {
|
|
45
|
-
return u(this, l, g).call(this, t, "boolean", (
|
|
46
|
+
return u(this, l, g).call(this, t, "boolean", (r) => typeof r == "boolean", e);
|
|
46
47
|
}
|
|
47
48
|
stringList(t, ...e) {
|
|
48
|
-
return u(this, l, g).call(this, t, "array of strings", (
|
|
49
|
+
return u(this, l, g).call(this, t, "array of strings", (r) => Array.isArray(r) && r.every((n) => typeof n == "string"), e);
|
|
49
50
|
}
|
|
50
51
|
/** A nested object, read with the same checks; issues are reported as `parent.child`. */
|
|
51
52
|
section(t) {
|
|
52
53
|
const e = o(this, a)[t];
|
|
53
|
-
return
|
|
54
|
+
return S(e) ? new b(e, `${o(this, c)}${t}.`, o(this, p)) : (this.fail(t, `expected object, got ${x(e)}`), new b({}, `${o(this, c)}${t}.`, o(this, p), !0));
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
|
-
a = new WeakMap(), c = new WeakMap(), p = new WeakMap(), m = new WeakMap(), l = new WeakSet(), g = function(t, e,
|
|
57
|
+
a = new WeakMap(), c = new WeakMap(), p = new WeakMap(), m = new WeakMap(), l = new WeakSet(), g = function(t, e, r, n) {
|
|
57
58
|
const i = o(this, a)[t];
|
|
58
|
-
return i === void 0 &&
|
|
59
|
+
return i === void 0 && n.length > 0 ? n[0] : r(i) ? i : (this.fail(t, `expected ${e}, got ${i === void 0 ? "nothing (missing)" : x(i)}`), null);
|
|
59
60
|
};
|
|
60
61
|
let A = b;
|
|
61
62
|
function O(s, t) {
|
|
62
|
-
if (!
|
|
63
|
+
if (!S(s))
|
|
63
64
|
throw new d("Invalid bootstrap config", [`expected a JSON object, got ${x(s)}`]);
|
|
64
|
-
const e = [],
|
|
65
|
-
|
|
65
|
+
const e = [], r = new A(s, "", e), n = r.string("locale");
|
|
66
|
+
n === "" && r.fail("locale", "must not be empty");
|
|
66
67
|
const i = {
|
|
67
|
-
apiBase:
|
|
68
|
-
locale:
|
|
69
|
-
appName:
|
|
70
|
-
capabilities:
|
|
71
|
-
}, y = t?.(
|
|
68
|
+
apiBase: r.string("api_base", ""),
|
|
69
|
+
locale: n,
|
|
70
|
+
appName: r.string("app_name", null),
|
|
71
|
+
capabilities: r.stringList("capabilities", [])
|
|
72
|
+
}, y = t?.(r) ?? {};
|
|
72
73
|
if (e.length > 0) throw new d("Invalid bootstrap config", e);
|
|
73
74
|
return { ...y, ...i };
|
|
74
75
|
}
|
|
75
76
|
function C(s = {}) {
|
|
76
|
-
const { element: t = "app-state", extend: e } = s,
|
|
77
|
-
if (!
|
|
77
|
+
const { element: t = "app-state", extend: e } = s, r = typeof t == "string" ? document.getElementById(t) : t, n = typeof t == "string" ? `#${t}` : "the given element";
|
|
78
|
+
if (!r)
|
|
78
79
|
throw new d(
|
|
79
|
-
`Bootstrap config not found: the page has no ${
|
|
80
|
+
`Bootstrap config not found: the page has no ${n} element (expected <script id="app-state" type="application/json">)`
|
|
80
81
|
);
|
|
81
|
-
const i =
|
|
82
|
-
if (i === "") throw new d(`Bootstrap config is empty: ${
|
|
82
|
+
const i = r.textContent?.trim() ?? "";
|
|
83
|
+
if (i === "") throw new d(`Bootstrap config is empty: ${n} has no content`);
|
|
83
84
|
let y;
|
|
84
85
|
try {
|
|
85
86
|
y = JSON.parse(i);
|
|
86
|
-
} catch (
|
|
87
|
-
throw new d(`Bootstrap config in ${
|
|
87
|
+
} catch (j) {
|
|
88
|
+
throw new d(`Bootstrap config in ${n} is not valid JSON`, [], { cause: j });
|
|
88
89
|
}
|
|
89
90
|
return O(y, e);
|
|
90
91
|
}
|
|
91
92
|
export {
|
|
93
|
+
V as AccessGate,
|
|
92
94
|
d as BootstrapError,
|
|
93
95
|
A as BootstrapFields,
|
|
94
96
|
Q as MissingContextError,
|
|
@@ -97,12 +99,13 @@ export {
|
|
|
97
99
|
M as createPlatform,
|
|
98
100
|
T as createSession,
|
|
99
101
|
R as defineFeatureContext,
|
|
100
|
-
q as
|
|
101
|
-
F as
|
|
102
|
+
q as heldSession,
|
|
103
|
+
F as httpSessionAdapter,
|
|
104
|
+
G as installPlatform,
|
|
102
105
|
O as parseBootstrap,
|
|
103
106
|
K as parseNavigation,
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
_ as parseSessionPayload,
|
|
108
|
+
z as platformKey,
|
|
106
109
|
C as readBootstrap,
|
|
107
|
-
|
|
110
|
+
D as usePlatform
|
|
108
111
|
};
|
|
@@ -27,11 +27,11 @@ export interface PlatformOptions<U extends SessionUser, C extends BootstrapConfi
|
|
|
27
27
|
session?: SessionAdapter<U> | ((http: HttpClient) => SessionAdapter<U>);
|
|
28
28
|
/**
|
|
29
29
|
* Called once when a request is answered 401 while signed in, before the session is given up
|
|
30
|
-
* (concurrent 401s share one call). Renew it (for example a refresh-token call, then
|
|
30
|
+
* (concurrent 401s share one call). Renew it with the platform's client (for example a refresh-token call, then
|
|
31
31
|
* `session.refresh()`) and return true: the failed request is sent again. False or a throw expires
|
|
32
32
|
* the session. Without it a 401 expires the session at once.
|
|
33
33
|
*/
|
|
34
|
-
renewSession?: (session: Session<U
|
|
34
|
+
renewSession?: (session: Session<U>, http: HttpClient) => Promise<boolean>;
|
|
35
35
|
/** Called after a 401 expired a signed-in session: the application decides (usually: go to the login page). */
|
|
36
36
|
onSessionExpired?: () => void;
|
|
37
37
|
/** Called with the failure of a session load or of a before-sign-out hook. */
|
|
@@ -5,9 +5,16 @@ import type { NavigationNode } from "./navigation";
|
|
|
5
5
|
export interface SessionUser {
|
|
6
6
|
readonly id: number | string;
|
|
7
7
|
}
|
|
8
|
+
/** The real person behind a session in which somebody signed in as another (go-core `login-as`). */
|
|
9
|
+
export interface SessionImpersonator {
|
|
10
|
+
readonly id: number | string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
}
|
|
8
13
|
/** What the server says about a session. */
|
|
9
14
|
export interface SessionSnapshot<U extends SessionUser = SessionUser> {
|
|
10
15
|
readonly user: U;
|
|
16
|
+
/** Set while the user was signed in as by somebody else: who that really is. Absent for a person's own session. */
|
|
17
|
+
readonly impersonator?: SessionImpersonator;
|
|
11
18
|
/** When the session's access token expires, if the server says; renewing it is the application's effect. */
|
|
12
19
|
readonly expiresAt: Date | null;
|
|
13
20
|
readonly access: AccessSnapshot;
|
|
@@ -25,9 +32,12 @@ export type SessionState<U extends SessionUser = SessionUser> =
|
|
|
25
32
|
readonly status: "unknown";
|
|
26
33
|
} | {
|
|
27
34
|
readonly status: "loading";
|
|
28
|
-
}
|
|
35
|
+
}
|
|
36
|
+
/** `previous` is what the session was, kept when it `expired` while someone was working: the page may stay on screen while they sign in again. */
|
|
37
|
+
| {
|
|
29
38
|
readonly status: "anonymous";
|
|
30
39
|
readonly reason: SessionEnd;
|
|
40
|
+
readonly previous?: SessionSnapshot<U>;
|
|
31
41
|
} | ({
|
|
32
42
|
readonly status: "authenticated";
|
|
33
43
|
} & SessionSnapshot<U>)
|
|
@@ -36,6 +46,11 @@ export type SessionState<U extends SessionUser = SessionUser> =
|
|
|
36
46
|
readonly status: "failed";
|
|
37
47
|
readonly error: unknown;
|
|
38
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* The session as the page around it should still show it: the signed-in one, or the one that just
|
|
51
|
+
* expired (its user, access and menu stay on screen while the person signs in again); null otherwise.
|
|
52
|
+
*/
|
|
53
|
+
export declare function heldSession<U extends SessionUser>(state: SessionState<U>): SessionSnapshot<U> | null;
|
|
39
54
|
/** The seam to a backend: how to ask who is signed in and how to end the session. */
|
|
40
55
|
export interface SessionAdapter<U extends SessionUser = SessionUser> {
|
|
41
56
|
/** The current session, or null when there is none (not signed in). Reject for failures; honour `signal`. */
|
|
@@ -70,6 +85,12 @@ export interface Session<U extends SessionUser = SessionUser> {
|
|
|
70
85
|
* ends the session on the server; rejects if that call fails. Concurrent calls share one sign-out.
|
|
71
86
|
*/
|
|
72
87
|
signOut(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Whether an expired session keeps what it was (`previous` on the anonymous state), so the page and its shell can
|
|
90
|
+
* stay on screen while the person signs in again. Off by default; `createApplication` turns it on when a feature
|
|
91
|
+
* has a prompt for it (`holdsExpiredSession`).
|
|
92
|
+
*/
|
|
93
|
+
holdExpired(enabled: boolean): void;
|
|
73
94
|
/**
|
|
74
95
|
* Adds a hook `signOut()` runs while the user is still signed in. Returns the function that removes it: a
|
|
75
96
|
* session effect returns it as its stop, so the hook lives exactly as long as the effect.
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { c as P } from "./client-Bw0aM5Gu.js";
|
|
2
|
+
import { d as k } from "./context-Ch1r4fdN.js";
|
|
3
|
+
import { a as x, A as q } from "./error-CD7x0Jrz.js";
|
|
4
|
+
import { shallowRef as U } from "vue";
|
|
5
|
+
const _ = (e, n) => e.level === n.level && e.id === n.id, z = (e, n) => Object.prototype.hasOwnProperty.call(e, n);
|
|
6
|
+
function C(e, n = {}) {
|
|
7
|
+
const t = n.covers ?? _;
|
|
8
|
+
function o(r) {
|
|
9
|
+
const s = e();
|
|
10
|
+
return !s || !z(s.permissions, r) || s.unavailable.includes(r) ? null : s.permissions[r] ?? null;
|
|
11
|
+
}
|
|
12
|
+
function a(r, s) {
|
|
13
|
+
const i = o(r);
|
|
14
|
+
return i ? s ? (i.clauses.length > 0 ? i.clauses.map((c) => c.scope) : [i.scope]).some((c) => t(c, s)) : !0 : !1;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
get root() {
|
|
18
|
+
return e()?.root ?? !1;
|
|
19
|
+
},
|
|
20
|
+
can: a,
|
|
21
|
+
canAny: (r) => r.some((s) => a(s)),
|
|
22
|
+
canAll: (r) => r.every((s) => a(s)),
|
|
23
|
+
held: o
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const A = ["own", "own_location", "all"], m = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
|
|
27
|
+
function $(e, n, t) {
|
|
28
|
+
return !m(e) || typeof e.level != "string" ? (t.push(`${n}: expected { level: string, id?: number }`), { level: "" }) : (e.id !== void 0 && typeof e.id != "number" && t.push(`${n}.id: expected number`), typeof e.id == "number" ? { level: e.level, id: e.id } : { level: e.level });
|
|
29
|
+
}
|
|
30
|
+
function S(e, n, t) {
|
|
31
|
+
return typeof e == "string" && A.includes(e) ? e : (t.push(`${n}: expected one of ${A.join(", ")}`), "own");
|
|
32
|
+
}
|
|
33
|
+
function I(e) {
|
|
34
|
+
const n = [], t = {}, o = { root: !1, permissions: {}, unavailable: [] };
|
|
35
|
+
if (!m(e)) return { snapshot: o, issues: ["access: expected an object"] };
|
|
36
|
+
if (!m(e.permissions)) n.push("access.permissions: expected an object");
|
|
37
|
+
else
|
|
38
|
+
for (const [r, s] of Object.entries(e.permissions)) {
|
|
39
|
+
const i = `access.permissions.${r}`;
|
|
40
|
+
if (!m(s)) {
|
|
41
|
+
n.push(`${i}: expected an object`);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const u = (Array.isArray(s.clauses) ? s.clauses : []).map((c, y) => {
|
|
45
|
+
const l = `${i}.clauses[${y}]`;
|
|
46
|
+
if (!m(c))
|
|
47
|
+
return n.push(`${l}: expected an object`), { scope: { level: "" }, qualifier: "own" };
|
|
48
|
+
const f = { scope: $(c.scope, `${l}.scope`, n), qualifier: S(c.qualifier, `${l}.qualifier`, n) };
|
|
49
|
+
return typeof c.role == "string" ? { ...f, role: c.role } : f;
|
|
50
|
+
});
|
|
51
|
+
t[r] = {
|
|
52
|
+
scope: $(s.scope, `${i}.scope`, n),
|
|
53
|
+
qualifier: S(s.qualifier, `${i}.qualifier`, n),
|
|
54
|
+
clauses: u
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const a = e.unavailable ?? [];
|
|
58
|
+
return (!Array.isArray(a) || !a.every((r) => typeof r == "string")) && n.push("access.unavailable: expected an array of strings"), {
|
|
59
|
+
snapshot: {
|
|
60
|
+
root: e.root === !0,
|
|
61
|
+
permissions: t,
|
|
62
|
+
unavailable: Array.isArray(a) ? a.filter((r) => typeof r == "string") : []
|
|
63
|
+
},
|
|
64
|
+
issues: n
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const T = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
|
|
68
|
+
function j(e, n, t = "navigation") {
|
|
69
|
+
return Array.isArray(e) ? e.flatMap((o, a) => {
|
|
70
|
+
const r = `${t}[${a}]`;
|
|
71
|
+
if (!T(o) || typeof o.i18n != "string")
|
|
72
|
+
return n.push(`${r}: expected an object with an i18n key`), [];
|
|
73
|
+
for (const i of ["icon", "route"])
|
|
74
|
+
o[i] != null && typeof o[i] != "string" && n.push(`${r}.${i}: expected a string`);
|
|
75
|
+
const s = o.children == null ? void 0 : j(o.children, n, `${r}.children`);
|
|
76
|
+
return [
|
|
77
|
+
{
|
|
78
|
+
i18n: o.i18n,
|
|
79
|
+
...typeof o.icon == "string" && { icon: o.icon },
|
|
80
|
+
...typeof o.route == "string" && { route: o.route },
|
|
81
|
+
...s && { children: s }
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
}) : (n.push(`${t}: expected an array`), []);
|
|
85
|
+
}
|
|
86
|
+
const b = (e) => typeof e == "object" && e !== null && !Array.isArray(e), N = (e) => {
|
|
87
|
+
if (b(e) && (typeof e.id == "number" || typeof e.id == "string")) return { id: e.id };
|
|
88
|
+
throw new TypeError("expected an object with a numeric or string id");
|
|
89
|
+
};
|
|
90
|
+
function B(e, n = N) {
|
|
91
|
+
const t = [];
|
|
92
|
+
if (!b(e)) throw O(["expected an object"]);
|
|
93
|
+
let o = null;
|
|
94
|
+
try {
|
|
95
|
+
o = n(e.user);
|
|
96
|
+
} catch (u) {
|
|
97
|
+
t.push(`user: ${u instanceof Error ? u.message : "invalid"}`);
|
|
98
|
+
}
|
|
99
|
+
let a = null;
|
|
100
|
+
if (e.expires_at !== void 0 && e.expires_at !== null) {
|
|
101
|
+
const u = typeof e.expires_at == "string" ? new Date(e.expires_at) : null;
|
|
102
|
+
u === null || Number.isNaN(u.getTime()) ? t.push("expires_at: expected an ISO date-time string") : a = u;
|
|
103
|
+
}
|
|
104
|
+
let r;
|
|
105
|
+
if (e.impersonator !== void 0 && e.impersonator !== null) {
|
|
106
|
+
const u = e.impersonator;
|
|
107
|
+
b(u) && (typeof u.id == "number" || typeof u.id == "string") && typeof u.name == "string" ? r = { id: u.id, name: u.name } : t.push("impersonator: expected { id, name }");
|
|
108
|
+
}
|
|
109
|
+
const s = I(e.access);
|
|
110
|
+
t.push(...s.issues);
|
|
111
|
+
const i = e.navigation === void 0 || e.navigation === null ? void 0 : j(e.navigation, t);
|
|
112
|
+
if (o === null || t.length > 0) throw O(t);
|
|
113
|
+
return { user: o, expiresAt: a, access: s.snapshot, ...r && { impersonator: r }, ...i && { navigation: i } };
|
|
114
|
+
}
|
|
115
|
+
const O = (e) => new q({ kind: "malformed", message: `Unreadable session payload: ${e.join("; ")}` });
|
|
116
|
+
function F(e, n = {}) {
|
|
117
|
+
const { mePath: t = "/auth/me", signOutPath: o = "/auth/logout", parseUser: a } = n;
|
|
118
|
+
return {
|
|
119
|
+
async load(r) {
|
|
120
|
+
try {
|
|
121
|
+
const { data: s } = await e.get(t, { signal: r, handleUnauthorized: !1 });
|
|
122
|
+
return B(s, a);
|
|
123
|
+
} catch (s) {
|
|
124
|
+
if (x(s) && s.kind === "unauthorized") return null;
|
|
125
|
+
throw s;
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
async signOut() {
|
|
129
|
+
try {
|
|
130
|
+
await e.post(o, void 0, { handleUnauthorized: !1 });
|
|
131
|
+
} catch (r) {
|
|
132
|
+
if (!(x(r) && r.kind === "unauthorized")) throw r;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function E(e) {
|
|
138
|
+
return e.status === "authenticated" ? e : e.status === "anonymous" && e.reason === "expired" ? e.previous ?? null : null;
|
|
139
|
+
}
|
|
140
|
+
const w = 3e3;
|
|
141
|
+
function H(e, n = {}) {
|
|
142
|
+
const t = U({ status: "unknown" });
|
|
143
|
+
let o = 0;
|
|
144
|
+
const a = new Set(n.beforeSignOut ? [n.beforeSignOut] : []);
|
|
145
|
+
let r = !1, s = null, i = null;
|
|
146
|
+
function u() {
|
|
147
|
+
o++, i?.controller.abort(), i = null;
|
|
148
|
+
}
|
|
149
|
+
async function c(l) {
|
|
150
|
+
const f = new AbortController();
|
|
151
|
+
let h;
|
|
152
|
+
const g = new Promise((d) => {
|
|
153
|
+
h = setTimeout(() => {
|
|
154
|
+
f.abort(), n.onError?.(new Error(`A before-sign-out hook did not finish within ${w} ms; signing out without it.`)), d();
|
|
155
|
+
}, w);
|
|
156
|
+
}), v = Promise.all(
|
|
157
|
+
[...a].map(async (d) => {
|
|
158
|
+
try {
|
|
159
|
+
await d(l, f.signal);
|
|
160
|
+
} catch (p) {
|
|
161
|
+
n.onError?.(p);
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
).then(() => {
|
|
165
|
+
});
|
|
166
|
+
await Promise.race([v, g]), clearTimeout(h);
|
|
167
|
+
}
|
|
168
|
+
function y() {
|
|
169
|
+
if (i) return i.promise;
|
|
170
|
+
const l = o, f = new AbortController(), h = t.value, g = E(h) !== null;
|
|
171
|
+
g || (t.value = { status: "loading" });
|
|
172
|
+
const v = async () => {
|
|
173
|
+
try {
|
|
174
|
+
const p = await e.load(f.signal);
|
|
175
|
+
if (o !== l) return t.value;
|
|
176
|
+
t.value = p ? { status: "authenticated", ...p } : { status: "anonymous", reason: "none" };
|
|
177
|
+
} catch (p) {
|
|
178
|
+
if (o !== l) return t.value;
|
|
179
|
+
n.onError?.(p), t.value = g ? h : { status: "failed", error: p };
|
|
180
|
+
} finally {
|
|
181
|
+
o === l && (i = null);
|
|
182
|
+
}
|
|
183
|
+
return t.value;
|
|
184
|
+
}, d = Promise.resolve().then(v);
|
|
185
|
+
return i = { controller: f, promise: d }, d;
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
state: t,
|
|
189
|
+
restore: () => t.value.status === "unknown" || t.value.status === "failed" ? y() : i?.promise ?? Promise.resolve(t.value),
|
|
190
|
+
refresh: y,
|
|
191
|
+
establish(l) {
|
|
192
|
+
u(), t.value = { status: "authenticated", ...l };
|
|
193
|
+
},
|
|
194
|
+
expire() {
|
|
195
|
+
if (t.value.status !== "authenticated") return;
|
|
196
|
+
const { status: l, ...f } = t.value;
|
|
197
|
+
u(), t.value = r && !t.value.impersonator ? { status: "anonymous", reason: "expired", previous: f } : { status: "anonymous", reason: "expired" }, n.onExpired?.();
|
|
198
|
+
},
|
|
199
|
+
signOut() {
|
|
200
|
+
return s ?? (s = (async () => {
|
|
201
|
+
try {
|
|
202
|
+
const l = t.value;
|
|
203
|
+
l.status === "authenticated" && a.size > 0 && await c(l.user), u(), t.value = { status: "anonymous", reason: "signedOut" }, await e.signOut();
|
|
204
|
+
} finally {
|
|
205
|
+
s = null;
|
|
206
|
+
}
|
|
207
|
+
})()), s;
|
|
208
|
+
},
|
|
209
|
+
holdExpired(l) {
|
|
210
|
+
r = l;
|
|
211
|
+
},
|
|
212
|
+
onBeforeSignOut(l) {
|
|
213
|
+
return a.add(l), () => void a.delete(l);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function M(e) {
|
|
218
|
+
let n = null;
|
|
219
|
+
const t = P({
|
|
220
|
+
baseUrl: e.config.apiBase,
|
|
221
|
+
transport: e.transport,
|
|
222
|
+
headers: e.headers,
|
|
223
|
+
credentials: e.credentials,
|
|
224
|
+
requestId: e.requestId,
|
|
225
|
+
async onUnauthorized() {
|
|
226
|
+
return r.state.value.status !== "authenticated" ? "fail" : e.renewSession && (n ?? (n = e.renewSession(r, t).then(
|
|
227
|
+
(i) => i,
|
|
228
|
+
() => !1
|
|
229
|
+
).finally(() => {
|
|
230
|
+
n = null;
|
|
231
|
+
})), await n) ? "retry" : (r.expire(), "fail");
|
|
232
|
+
}
|
|
233
|
+
}), o = e.session ?? ((i) => F(i)), a = typeof o == "function" ? o(t) : o, r = H(a, { onError: e.onSessionError, onExpired: e.onSessionExpired, beforeSignOut: e.beforeSignOut }), s = C(
|
|
234
|
+
() => E(r.state.value)?.access ?? null,
|
|
235
|
+
{ covers: e.covers }
|
|
236
|
+
);
|
|
237
|
+
return { config: e.config, http: t, session: r, access: s };
|
|
238
|
+
}
|
|
239
|
+
const [Q, G] = k("platform");
|
|
240
|
+
function J(e, n) {
|
|
241
|
+
e.provide(Q, n);
|
|
242
|
+
}
|
|
243
|
+
export {
|
|
244
|
+
M as a,
|
|
245
|
+
w as b,
|
|
246
|
+
C as c,
|
|
247
|
+
H as d,
|
|
248
|
+
F as e,
|
|
249
|
+
B as f,
|
|
250
|
+
Q as g,
|
|
251
|
+
E as h,
|
|
252
|
+
J as i,
|
|
253
|
+
j as p,
|
|
254
|
+
G as u
|
|
255
|
+
};
|