@wssto2/vue-core 0.2.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 +33 -0
- 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-CeKK8_g5.js → AdaptivePageShell.vue_vue_type_script_setup_true_lang-CvAnzdc1.js} +48 -47
- package/dist/{AlertDialog.vue_vue_type_script_setup_true_lang-e4hzkzg3.js → AlertDialog.vue_vue_type_script_setup_true_lang-CJsMUIUg.js} +1 -1
- package/dist/{AsyncSection.vue_vue_type_script_setup_true_lang-CWLB3xsR.js → AsyncSection.vue_vue_type_script_setup_true_lang-CCtthMRd.js} +4 -4
- 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-B1eZgLae.js → Button.vue_vue_type_script_setup_true_lang-CYil8h9z.js} +1 -1
- package/dist/Changes-DlT5mN9G.js +129 -0
- package/dist/CollectionPage.vue_vue_type_script_setup_true_lang-CXILftEc.js +1481 -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-DyhYHRyz.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-CvwoT1JF.js → LeaveGuardRoot.vue_vue_type_script_setup_true_lang-C2udmeEA.js} +2 -2
- package/dist/{Menu.vue_vue_type_script_setup_true_lang-CrMj6KPD.js → Menu.vue_vue_type_script_setup_true_lang-BNAjx9tj.js} +61 -57
- package/dist/{Modal.vue_vue_type_script_setup_true_lang-BQZM49gC.js → Modal.vue_vue_type_script_setup_true_lang-D7SwVPpL.js} +4 -4
- 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-ElDizaW2.js → PhotoViewer.vue_vue_type_script_setup_true_lang-B3Q4dhqJ.js} +1 -1
- 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/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/contributions.d.ts +1 -1
- package/dist/app/feature.d.ts +8 -0
- package/dist/app/index.js +259 -296
- package/dist/bottomDock-BZEiOPYZ.js +12 -0
- package/dist/button/Button.vue.d.ts +3 -3
- package/dist/button/index.js +1 -1
- 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/http.d.ts +4 -2
- package/dist/collection/index.js +74 -2428
- 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-l5T9b8Uv.js → describeError-Ctga6GcS.js} +1 -1
- 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 +1 -1
- 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/NumberCell.vue.d.ts +1 -1
- package/dist/form/NumberField.vue.d.ts +2 -2
- package/dist/form/OtpInput.vue.d.ts +2 -2
- package/dist/form/PhotoField.vue.d.ts +1 -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.js +1262 -3430
- package/dist/guards-Cd1V28oG.js +51 -0
- package/dist/http-DGGSKWvU.js +193 -0
- package/dist/i18n/index.d.ts +281 -0
- package/dist/i18n/index.js +50 -50
- 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/identity/shared/SignInTable.vue.d.ts +11 -0
- 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/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 +1 -1
- package/dist/modal/index.js +5 -5
- 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-DAkBtYkI.js → options-BXkMR63B.js} +51 -52
- package/dist/overlay/AlertDialog.vue.d.ts +3 -3
- package/dist/overlay/Popover.vue.d.ts +1 -1
- package/dist/overlay/closeOverlays.d.ts +7 -0
- package/dist/overlay/index.js +21 -20
- 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 +2 -2
- package/dist/platform/index.d.ts +2 -2
- package/dist/platform/index.js +73 -90
- 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 +1 -1
- package/dist/shell/BackofficeShell.vue.d.ts +2 -2
- package/dist/shell/NavigationList.vue.d.ts +1 -1
- 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 +507 -575
- package/dist/state/ProgressTrack.vue.d.ts +1 -1
- package/dist/state/index.js +59 -92
- package/dist/status-C9aXR-Jb.js +33 -0
- package/dist/styles.css +1 -1
- package/dist/suggestions-BJAqOj4c.js +138 -0
- package/dist/testing/index.js +1 -1
- package/dist/toast-D9Z5To38.js +13 -0
- package/dist/useCommand-BgRwnYlV.js +135 -0
- 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 +22 -5
- package/dist/NoAccess.vue_vue_type_script_setup_true_lang-OKW8pKYU.js +0 -78
- package/dist/SectionList.vue_vue_type_script_setup_true_lang-L9ita_Kx.js +0 -230
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-DZTrU8NJ.js +0 -661
- package/dist/Sheet.vue_vue_type_script_setup_true_lang-CtkJ-4e3.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/environment-D3nozt9a.js +0 -75
- package/dist/feature-DyDtyMLU.js +0 -47
- package/dist/platform-jqlKVJ2e.js +0 -244
- package/dist/toast-DvrHQ6Ag.js +0 -131
|
@@ -38,15 +38,15 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
38
38
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
39
39
|
onClick?: ((event: KeyboardEvent | MouseEvent) => any) | undefined;
|
|
40
40
|
}>, {
|
|
41
|
-
|
|
41
|
+
to: RouteLocationRaw;
|
|
42
|
+
disabled: boolean;
|
|
42
43
|
type: "button" | "submit";
|
|
44
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
43
45
|
prominence: "primary" | "secondary" | "standard" | "plain" | "link";
|
|
44
46
|
tone: "critical";
|
|
45
47
|
icon: IconName;
|
|
46
48
|
trailingIcon: IconName;
|
|
47
|
-
to: RouteLocationRaw;
|
|
48
49
|
href: string;
|
|
49
|
-
disabled: boolean;
|
|
50
50
|
processing: boolean;
|
|
51
51
|
keyboardShortcut: KeyboardShortcut;
|
|
52
52
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/dist/button/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as a, m as o, s as r, u, a as e } from "../Button.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _ as a, m as o, s as r, u, a as e } from "../Button.vue_vue_type_script_setup_true_lang-CYil8h9z.js";
|
|
2
2
|
export {
|
|
3
3
|
a as Button,
|
|
4
4
|
o as matchesShortcut,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { getCurrentInstance as p, inject as w, ref as c, shallowRef as T, computed as m, watch as C, toValue as s, onBeforeUnmount as M } from "vue";
|
|
2
|
+
import { d as k } from "./context-Ch1r4fdN.js";
|
|
3
|
+
const y = 30;
|
|
4
|
+
function O() {
|
|
5
|
+
const l = c(null), a = c(""), u = c(!0), n = T(/* @__PURE__ */ new Map()), v = c(0), r = /* @__PURE__ */ new Map();
|
|
6
|
+
let f = null, o = null;
|
|
7
|
+
const d = m(() => Array.from(n.value.values())), h = m(() => d.value.flatMap((e) => e.actions)), i = (e) => m(() => d.value.map((t) => t[e]).filter((t) => t != null).pop() ?? null);
|
|
8
|
+
return {
|
|
9
|
+
back: l,
|
|
10
|
+
title: a,
|
|
11
|
+
titleInView: u,
|
|
12
|
+
actions: h,
|
|
13
|
+
leading: i("leading"),
|
|
14
|
+
status: i("status"),
|
|
15
|
+
navTitle: i("navTitle"),
|
|
16
|
+
documentTitle: i("documentTitle"),
|
|
17
|
+
hasShell: m(() => v.value > 0),
|
|
18
|
+
claimShell() {
|
|
19
|
+
v.value++;
|
|
20
|
+
let e = !1;
|
|
21
|
+
return () => {
|
|
22
|
+
e || v.value--, e = !0;
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
claim() {
|
|
26
|
+
const e = Symbol("page-chrome-owner");
|
|
27
|
+
return {
|
|
28
|
+
setBack(t) {
|
|
29
|
+
f = e, l.value = t;
|
|
30
|
+
},
|
|
31
|
+
clearBack() {
|
|
32
|
+
f === e && (f = null, l.value = null);
|
|
33
|
+
},
|
|
34
|
+
setTitle(t) {
|
|
35
|
+
o !== e && (u.value = !0), o = e, a.value = t;
|
|
36
|
+
},
|
|
37
|
+
setTitleInView(t) {
|
|
38
|
+
o === e && (u.value = t);
|
|
39
|
+
},
|
|
40
|
+
clearTitle() {
|
|
41
|
+
o === e && (o = null, a.value = "", u.value = !0);
|
|
42
|
+
},
|
|
43
|
+
setRegistration(t) {
|
|
44
|
+
n.value = new Map(n.value).set(e, t);
|
|
45
|
+
},
|
|
46
|
+
clearRegistration() {
|
|
47
|
+
if (!n.value.has(e)) return;
|
|
48
|
+
const t = new Map(n.value);
|
|
49
|
+
t.delete(e), n.value = t;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
focusMemory: {
|
|
54
|
+
take(e) {
|
|
55
|
+
const t = r.get(e);
|
|
56
|
+
return r.delete(e), t;
|
|
57
|
+
},
|
|
58
|
+
put(e, t) {
|
|
59
|
+
r.delete(e), r.set(e, t), r.size > y && r.delete(r.keys().next().value ?? "");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const [g, R] = k("vue-core.pageChrome");
|
|
65
|
+
function P(l) {
|
|
66
|
+
const a = O();
|
|
67
|
+
return l.provide(g, a), a;
|
|
68
|
+
}
|
|
69
|
+
function b() {
|
|
70
|
+
return p() ? w(g, null) : null;
|
|
71
|
+
}
|
|
72
|
+
function S(l) {
|
|
73
|
+
const u = R().claim();
|
|
74
|
+
C(
|
|
75
|
+
() => ({
|
|
76
|
+
actions: s(l.actions) ?? [],
|
|
77
|
+
leading: s(l.leading) ?? null,
|
|
78
|
+
status: s(l.status) ?? null,
|
|
79
|
+
navTitle: s(l.navTitle) ?? null,
|
|
80
|
+
documentTitle: s(l.documentTitle) ?? null
|
|
81
|
+
}),
|
|
82
|
+
(n) => u.setRegistration(n),
|
|
83
|
+
{ immediate: !0, deep: !0 }
|
|
84
|
+
), M(() => u.clearRegistration());
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
R as a,
|
|
88
|
+
b,
|
|
89
|
+
O as c,
|
|
90
|
+
P as i,
|
|
91
|
+
g as p,
|
|
92
|
+
S as u
|
|
93
|
+
};
|
package/dist/client/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type QueryValue } from "./encode";
|
|
2
2
|
import { type ApiResult } from "./envelope";
|
|
3
3
|
import { ApiError } from "./error";
|
|
4
|
+
import type { ApiRoute } from "./route";
|
|
4
5
|
import { type Transport } from "./transport";
|
|
5
6
|
export interface RequestOptions {
|
|
6
7
|
query?: Readonly<Record<string, QueryValue>>;
|
|
@@ -34,7 +35,18 @@ export interface HttpClientOptions {
|
|
|
34
35
|
*/
|
|
35
36
|
onUnauthorized?: (context: UnauthorizedContext) => UnauthorizedDecision | Promise<UnauthorizedDecision>;
|
|
36
37
|
}
|
|
38
|
+
/** A route that takes no input (`void`, or an empty object) needs no second argument. */
|
|
39
|
+
type RequestArguments<In> = [In] extends [void] ? [input?: undefined, options?: RequestOptions] : [In] extends [Record<string, never>] ? [input?: In, options?: RequestOptions] : [input: In, options?: RequestOptions];
|
|
40
|
+
/** A route declared `void` has no body: its data is `null`. */
|
|
41
|
+
export type RouteResult<Out> = ApiResult<[Out] extends [void] ? null : Out>;
|
|
37
42
|
export interface HttpClient {
|
|
43
|
+
/**
|
|
44
|
+
* Calls a declared route: `:name` segments of the path are filled from `input` (encoded), the rest of
|
|
45
|
+
* `input` is the query for GET and DELETE and the JSON body for POST, PUT and PATCH. A missing path
|
|
46
|
+
* parameter rejects with a plain `Error` (a bug in the caller, not an answer from the server) before
|
|
47
|
+
* anything is sent. Abort, request ids and 401 handling are those of `get` and `post`.
|
|
48
|
+
*/
|
|
49
|
+
request<In, Out>(route: ApiRoute<In, Out>, ...args: RequestArguments<In>): Promise<RouteResult<Out>>;
|
|
38
50
|
get<TData = unknown, TMeta = unknown>(path: string, options?: RequestOptions): Promise<ApiResult<TData, TMeta>>;
|
|
39
51
|
post<TData = unknown, TMeta = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<ApiResult<TData, TMeta>>;
|
|
40
52
|
put<TData = unknown, TMeta = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<ApiResult<TData, TMeta>>;
|
|
@@ -43,3 +55,4 @@ export interface HttpClient {
|
|
|
43
55
|
}
|
|
44
56
|
/** A client over a transport. Nothing is global: every call of this factory is independent. */
|
|
45
57
|
export declare function createHttpClient(options?: HttpClientOptions): HttpClient;
|
|
58
|
+
export {};
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createHttpClient } from "./client";
|
|
2
|
-
export type { HttpClient, HttpClientOptions, RequestOptions, UnauthorizedContext, UnauthorizedDecision } from "./client";
|
|
2
|
+
export type { HttpClient, RouteResult, HttpClientOptions, RequestOptions, UnauthorizedContext, UnauthorizedDecision } from "./client";
|
|
3
3
|
export type { QueryValue } from "./encode";
|
|
4
4
|
export { REQUEST_ID_HEADER } from "./envelope";
|
|
5
5
|
export type { ApiResult } from "./envelope";
|
|
@@ -7,3 +7,5 @@ export { ApiError, isAborted, isApiError } from "./error";
|
|
|
7
7
|
export type { ApiErrorInit, ApiErrorKind, FieldErrors } from "./error";
|
|
8
8
|
export { fetchTransport } from "./transport";
|
|
9
9
|
export type { Transport } from "./transport";
|
|
10
|
+
export { route } from "./route";
|
|
11
|
+
export type { HttpMethod, ListResult, RawRoute, ApiRoute, RouteOptions, ViewCount } from "./route";
|
package/dist/client/index.js
CHANGED
|
@@ -1,140 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function D(t) {
|
|
14
|
-
const e = new FormData();
|
|
15
|
-
for (const [n, r] of Object.entries(t))
|
|
16
|
-
if (r != null)
|
|
17
|
-
if (Array.isArray(r))
|
|
18
|
-
for (const i of r) e.append(`${n}[]`, T(i));
|
|
19
|
-
else
|
|
20
|
-
e.append(n, T(r));
|
|
21
|
-
return e;
|
|
22
|
-
}
|
|
23
|
-
function T(t) {
|
|
24
|
-
return h(t) ? t : t instanceof Date ? t.toISOString() : typeof t == "object" && t !== null ? JSON.stringify(t) : String(t);
|
|
25
|
-
}
|
|
26
|
-
function O(t) {
|
|
27
|
-
if (t === void 0) return { body: void 0, contentType: null };
|
|
28
|
-
if (typeof t == "string" || t instanceof FormData || t instanceof URLSearchParams || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || h(t))
|
|
29
|
-
return { body: t, contentType: null };
|
|
30
|
-
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
31
|
-
const e = t;
|
|
32
|
-
if (Object.values(e).some((n) => h(n) || Array.isArray(n) && n.some(h)))
|
|
33
|
-
return { body: D(e), contentType: null };
|
|
34
|
-
}
|
|
35
|
-
return { body: JSON.stringify(t), contentType: "application/json" };
|
|
36
|
-
}
|
|
37
|
-
function q() {
|
|
38
|
-
const t = new Uint8Array(16);
|
|
39
|
-
return globalThis.crypto.getRandomValues(t), Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
40
|
-
}
|
|
41
|
-
const g = "X-Request-ID", A = (t) => typeof t == "object" && t !== null && !Array.isArray(t), m = (t) => typeof t == "string" && t !== "" ? t : null;
|
|
42
|
-
function B(t) {
|
|
43
|
-
const e = t?.errors ?? t?.fields;
|
|
44
|
-
if (!A(e)) return {};
|
|
45
|
-
const n = {};
|
|
46
|
-
for (const [r, i] of Object.entries(e))
|
|
47
|
-
Array.isArray(i) ? n[r] = i.map(String) : i != null && (n[r] = [String(i)]);
|
|
48
|
-
return n;
|
|
49
|
-
}
|
|
50
|
-
async function z(t) {
|
|
51
|
-
const e = await t.text();
|
|
52
|
-
if (e.trim() === "") return { payload: null, readable: !0 };
|
|
53
|
-
try {
|
|
54
|
-
return { payload: JSON.parse(e), readable: !0 };
|
|
55
|
-
} catch {
|
|
56
|
-
return { payload: null, readable: !1 };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function x(t, e) {
|
|
60
|
-
const n = t.headers.get(g) ?? e, { payload: r, readable: i } = await z(t), o = A(r) ? r : null;
|
|
61
|
-
if (!t.ok) {
|
|
62
|
-
const a = B(o), s = o?.params;
|
|
63
|
-
throw new p({
|
|
64
|
-
kind: U(t.status, Object.keys(a).length > 0),
|
|
65
|
-
message: m(o?.error) ?? m(o?.message) ?? `Request failed with status ${t.status}`,
|
|
66
|
-
status: t.status,
|
|
67
|
-
fields: a,
|
|
68
|
-
code: m(o?.code),
|
|
69
|
-
params: A(s) ? s : null,
|
|
70
|
-
requestId: n,
|
|
71
|
-
payload: r
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (!i)
|
|
75
|
-
throw new p({
|
|
76
|
-
kind: "malformed",
|
|
77
|
-
message: `The server answered ${t.status} with a body that is not JSON`,
|
|
78
|
-
status: t.status,
|
|
79
|
-
requestId: n
|
|
80
|
-
});
|
|
81
|
-
return o !== null && typeof o.success == "boolean" ? {
|
|
82
|
-
data: o.data ?? null,
|
|
83
|
-
meta: o.meta ?? null,
|
|
84
|
-
message: m(o.message),
|
|
85
|
-
status: t.status,
|
|
86
|
-
requestId: n
|
|
87
|
-
} : { data: r, meta: null, message: null, status: t.status, requestId: n };
|
|
88
|
-
}
|
|
89
|
-
const F = (t, e) => globalThis.fetch(t, e), H = (t) => /^[a-z][a-z0-9+.-]*:\/\//i.test(t);
|
|
90
|
-
function P(t, e, n) {
|
|
91
|
-
const r = H(e) || t === "" ? e : `${t.replace(/\/+$/, "")}/${e.replace(/^\/+/, "")}`;
|
|
92
|
-
return n === "" ? r : `${r}${r.includes("?") ? "&" : "?"}${n}`;
|
|
93
|
-
}
|
|
94
|
-
const S = (t, e) => new p({ kind: "aborted", message: "The request was cancelled", requestId: t, cause: e });
|
|
95
|
-
function J(t = {}) {
|
|
96
|
-
const { baseUrl: e = "", transport: n = F, credentials: r = "include" } = t;
|
|
97
|
-
async function i(a, s, u, d) {
|
|
98
|
-
const { signal: f } = d, l = t.requestId === !1 ? null : (t.requestId ?? q)();
|
|
99
|
-
if (f?.aborted) throw S(l, f.reason);
|
|
100
|
-
const w = O(u), y = new Headers({ Accept: "application/json" }), E = t.headers ? await t.headers() : void 0;
|
|
101
|
-
for (const c of [E, d.headers])
|
|
102
|
-
c && new Headers(c).forEach((I, R) => y.set(R, I));
|
|
103
|
-
l !== null && !y.has(g) && y.set(g, l), w.contentType !== null && !y.has("Content-Type") && y.set("Content-Type", w.contentType);
|
|
104
|
-
const j = { method: a, headers: y, credentials: r, body: w.body, signal: f }, k = P(e, s, $(d.query));
|
|
105
|
-
try {
|
|
106
|
-
const c = await n(k, j);
|
|
107
|
-
return await x(c, l);
|
|
108
|
-
} catch (c) {
|
|
109
|
-
throw b(c) ? c : f?.aborted || c instanceof Error && c.name === "AbortError" ? S(l, c) : new p({
|
|
110
|
-
kind: "network",
|
|
111
|
-
message: c instanceof Error ? c.message : "The server could not be reached",
|
|
112
|
-
requestId: l,
|
|
113
|
-
cause: c
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async function o(a, s, u, d = {}) {
|
|
118
|
-
try {
|
|
119
|
-
return await i(a, s, u, d);
|
|
120
|
-
} catch (f) {
|
|
121
|
-
if (!b(f) || f.kind !== "unauthorized" || d.handleUnauthorized === !1 || !t.onUnauthorized || await t.onUnauthorized({ error: f, method: a, path: s }) !== "retry") throw f;
|
|
122
|
-
return i(a, s, u, d);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
get: (a, s) => o("GET", a, void 0, s),
|
|
127
|
-
post: (a, s, u) => o("POST", a, s, u),
|
|
128
|
-
put: (a, s, u) => o("PUT", a, s, u),
|
|
129
|
-
patch: (a, s, u) => o("PATCH", a, s, u),
|
|
130
|
-
delete: (a, s) => o("DELETE", a, void 0, s)
|
|
131
|
-
};
|
|
132
|
-
}
|
|
1
|
+
import { R as p, c as o, f as u } from "../client-Bw0aM5Gu.js";
|
|
2
|
+
import { A as n, i as f, a as l } from "../error-CD7x0Jrz.js";
|
|
3
|
+
function s(e, i, r = {}) {
|
|
4
|
+
return { method: e, path: i, permission: r.permission, public: r.public === !0, raw: !1 };
|
|
5
|
+
}
|
|
6
|
+
s.raw = (e, i, r = {}) => ({
|
|
7
|
+
method: e,
|
|
8
|
+
path: i,
|
|
9
|
+
permission: r.permission,
|
|
10
|
+
public: r.public === !0,
|
|
11
|
+
raw: !0
|
|
12
|
+
});
|
|
133
13
|
export {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
14
|
+
n as ApiError,
|
|
15
|
+
p as REQUEST_ID_HEADER,
|
|
16
|
+
o as createHttpClient,
|
|
17
|
+
u as fetchTransport,
|
|
18
|
+
f as isAborted,
|
|
19
|
+
l as isApiError,
|
|
20
|
+
s as route
|
|
140
21
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare const types: unique symbol;
|
|
2
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
3
|
+
export interface RouteOptions {
|
|
4
|
+
/** The permission the route needs (`"tickets.ticket:view"`); the server enforces it, the client can read it for links and menus. */
|
|
5
|
+
readonly permission?: string;
|
|
6
|
+
/** True for routes that need no session. */
|
|
7
|
+
readonly public?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface RouteBase {
|
|
10
|
+
readonly method: HttpMethod;
|
|
11
|
+
/** Versioned and relative to the client's `baseUrl`; `:name` segments are filled from the input. */
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly permission?: string;
|
|
14
|
+
readonly public: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** A typed call: `In` is what `client.request` takes, `Out` what it resolves to (`void`: no body). */
|
|
17
|
+
export interface ApiRoute<In, Out> extends RouteBase {
|
|
18
|
+
readonly raw: false;
|
|
19
|
+
/** Type-only; never set. */
|
|
20
|
+
readonly [types]?: {
|
|
21
|
+
readonly in: In;
|
|
22
|
+
readonly out: Out;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** A route without a JSON answer (an event stream, a file): it keeps method and path for links, `client.request` refuses it. */
|
|
26
|
+
export interface RawRoute extends RouteBase {
|
|
27
|
+
readonly raw: true;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Declares one endpoint. go-core's generator writes these; the types come from the Go input and response.
|
|
31
|
+
*
|
|
32
|
+
* route<ShowInput, Ticket>("GET", "/v1/tickets/:id", { permission: "tickets.ticket:view" })
|
|
33
|
+
*/
|
|
34
|
+
export declare function route<In, Out>(method: HttpMethod, path: string, options?: RouteOptions): ApiRoute<In, Out>;
|
|
35
|
+
export declare namespace route {
|
|
36
|
+
var raw: (method: HttpMethod, path: string, options?: RouteOptions) => RawRoute;
|
|
37
|
+
}
|
|
38
|
+
/** One tab's count in `meta.views` (go-core `datatable.ViewCount`). */
|
|
39
|
+
export interface ViewCount {
|
|
40
|
+
readonly key: string;
|
|
41
|
+
readonly count: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The wire shape of go-core's `datatable.DatatableResult[T]`: a page of rows with its numbers.
|
|
45
|
+
* `readListPage` (`/collection`) reads it into a `ListPage` with no glue.
|
|
46
|
+
*/
|
|
47
|
+
export interface ListResult<Row> {
|
|
48
|
+
readonly data: readonly Row[];
|
|
49
|
+
readonly meta?: Readonly<Record<string, unknown>> & {
|
|
50
|
+
readonly views?: readonly ViewCount[];
|
|
51
|
+
};
|
|
52
|
+
readonly total: number;
|
|
53
|
+
readonly per_page: number;
|
|
54
|
+
readonly current_page: number;
|
|
55
|
+
readonly last_page: number;
|
|
56
|
+
readonly from: number;
|
|
57
|
+
readonly to: number;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { A, k as I, a as S } from "./error-CD7x0Jrz.js";
|
|
2
|
+
function U(t) {
|
|
3
|
+
if (!t) return "";
|
|
4
|
+
const e = new URLSearchParams();
|
|
5
|
+
for (const [a, r] of Object.entries(t))
|
|
6
|
+
if (!(r == null || r === ""))
|
|
7
|
+
if (Array.isArray(r)) for (const i of r) e.append(a, String(i));
|
|
8
|
+
else e.append(a, String(r));
|
|
9
|
+
return e.toString();
|
|
10
|
+
}
|
|
11
|
+
const g = (t) => typeof Blob < "u" && t instanceof Blob;
|
|
12
|
+
function D(t) {
|
|
13
|
+
const e = new FormData();
|
|
14
|
+
for (const [a, r] of Object.entries(t))
|
|
15
|
+
if (r != null)
|
|
16
|
+
if (Array.isArray(r))
|
|
17
|
+
for (const i of r) e.append(`${a}[]`, E(i));
|
|
18
|
+
else
|
|
19
|
+
e.append(a, E(r));
|
|
20
|
+
return e;
|
|
21
|
+
}
|
|
22
|
+
function E(t) {
|
|
23
|
+
return g(t) ? t : t instanceof Date ? t.toISOString() : typeof t == "object" && t !== null ? JSON.stringify(t) : String(t);
|
|
24
|
+
}
|
|
25
|
+
function z(t) {
|
|
26
|
+
if (t === void 0) return { body: void 0, contentType: null };
|
|
27
|
+
if (typeof t == "string" || t instanceof FormData || t instanceof URLSearchParams || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || g(t))
|
|
28
|
+
return { body: t, contentType: null };
|
|
29
|
+
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
30
|
+
const e = t;
|
|
31
|
+
if (Object.values(e).some((a) => g(a) || Array.isArray(a) && a.some(g)))
|
|
32
|
+
return { body: D(e), contentType: null };
|
|
33
|
+
}
|
|
34
|
+
return { body: JSON.stringify(t), contentType: "application/json" };
|
|
35
|
+
}
|
|
36
|
+
function v() {
|
|
37
|
+
const t = new Uint8Array(16);
|
|
38
|
+
return globalThis.crypto.getRandomValues(t), Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
39
|
+
}
|
|
40
|
+
const b = "X-Request-ID", T = (t) => typeof t == "object" && t !== null && !Array.isArray(t), w = (t) => typeof t == "string" && t !== "" ? t : null;
|
|
41
|
+
function B(t) {
|
|
42
|
+
const e = t?.errors ?? t?.fields;
|
|
43
|
+
if (!T(e)) return {};
|
|
44
|
+
const a = {};
|
|
45
|
+
for (const [r, i] of Object.entries(e))
|
|
46
|
+
Array.isArray(i) ? a[r] = i.map(String) : i != null && (a[r] = [String(i)]);
|
|
47
|
+
return a;
|
|
48
|
+
}
|
|
49
|
+
async function O(t) {
|
|
50
|
+
const e = await t.text();
|
|
51
|
+
if (e.trim() === "") return { payload: null, readable: !0 };
|
|
52
|
+
try {
|
|
53
|
+
return { payload: JSON.parse(e), readable: !0 };
|
|
54
|
+
} catch {
|
|
55
|
+
return { payload: null, readable: !1 };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function C(t, e) {
|
|
59
|
+
const a = t.headers.get(b) ?? e, { payload: r, readable: i } = await O(t), o = T(r) ? r : null;
|
|
60
|
+
if (!t.ok) {
|
|
61
|
+
const m = B(o), n = o?.params;
|
|
62
|
+
throw new A({
|
|
63
|
+
kind: I(t.status, Object.keys(m).length > 0),
|
|
64
|
+
message: w(o?.error) ?? w(o?.message) ?? `Request failed with status ${t.status}`,
|
|
65
|
+
status: t.status,
|
|
66
|
+
fields: m,
|
|
67
|
+
code: w(o?.code),
|
|
68
|
+
params: T(n) ? n : null,
|
|
69
|
+
requestId: a,
|
|
70
|
+
payload: r
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (!i)
|
|
74
|
+
throw new A({
|
|
75
|
+
kind: "malformed",
|
|
76
|
+
message: `The server answered ${t.status} with a body that is not JSON`,
|
|
77
|
+
status: t.status,
|
|
78
|
+
requestId: a
|
|
79
|
+
});
|
|
80
|
+
return o !== null && typeof o.success == "boolean" ? {
|
|
81
|
+
data: o.data ?? null,
|
|
82
|
+
meta: o.meta ?? null,
|
|
83
|
+
message: w(o.message),
|
|
84
|
+
status: t.status,
|
|
85
|
+
requestId: a
|
|
86
|
+
} : { data: r, meta: null, message: null, status: t.status, requestId: a };
|
|
87
|
+
}
|
|
88
|
+
const F = (t, e) => globalThis.fetch(t, e), H = (t) => /^[a-z][a-z0-9+.-]*:\/\//i.test(t);
|
|
89
|
+
function P(t, e, a) {
|
|
90
|
+
const r = H(e) || t === "" ? e : `${t.replace(/\/+$/, "")}/${e.replace(/^\/+/, "")}`;
|
|
91
|
+
return a === "" ? r : `${r}${r.includes("?") ? "&" : "?"}${a}`;
|
|
92
|
+
}
|
|
93
|
+
const j = (t, e) => new A({ kind: "aborted", message: "The request was cancelled", requestId: t, cause: e });
|
|
94
|
+
function x(t = {}) {
|
|
95
|
+
const { baseUrl: e = "", transport: a = F, credentials: r = "include" } = t;
|
|
96
|
+
async function i(n, s, c, u) {
|
|
97
|
+
const { signal: f } = u, y = t.requestId === !1 ? null : (t.requestId ?? v)();
|
|
98
|
+
if (f?.aborted) throw j(y, f.reason);
|
|
99
|
+
const p = z(c), l = new Headers({ Accept: "application/json" }), h = t.headers ? await t.headers() : void 0;
|
|
100
|
+
for (const d of [h, u.headers])
|
|
101
|
+
d && new Headers(d).forEach(($, q) => l.set(q, $));
|
|
102
|
+
y !== null && !l.has(b) && l.set(b, y), p.contentType !== null && !l.has("Content-Type") && l.set("Content-Type", p.contentType);
|
|
103
|
+
const k = { method: n, headers: l, credentials: r, body: p.body, signal: f }, R = P(e, s, U(u.query));
|
|
104
|
+
try {
|
|
105
|
+
const d = await a(R, k);
|
|
106
|
+
return await C(d, y);
|
|
107
|
+
} catch (d) {
|
|
108
|
+
throw S(d) ? d : f?.aborted || d instanceof Error && d.name === "AbortError" ? j(y, d) : new A({
|
|
109
|
+
kind: "network",
|
|
110
|
+
message: d instanceof Error ? d.message : "The server could not be reached",
|
|
111
|
+
requestId: y,
|
|
112
|
+
cause: d
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function o(n, s, c, u = {}) {
|
|
117
|
+
try {
|
|
118
|
+
return await i(n, s, c, u);
|
|
119
|
+
} catch (f) {
|
|
120
|
+
if (!S(f) || f.kind !== "unauthorized" || u.handleUnauthorized === !1 || !t.onUnauthorized || await t.onUnauthorized({ error: f, method: n, path: s }) !== "retry") throw f;
|
|
121
|
+
return i(n, s, c, u);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function m(n, s, c = {}) {
|
|
125
|
+
const u = typeof s == "object" && s !== null && !Array.isArray(s) ? { ...s } : {}, f = n.path.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, (p, l) => {
|
|
126
|
+
const h = u[l];
|
|
127
|
+
if (h == null || h === "")
|
|
128
|
+
throw new Error(`${n.method} ${n.path}: the input has no value for the path parameter "${l}"`);
|
|
129
|
+
return delete u[l], encodeURIComponent(String(h));
|
|
130
|
+
}), y = Object.keys(u).length > 0;
|
|
131
|
+
return n.method === "GET" || n.method === "DELETE" ? o(n.method, f, void 0, { ...c, query: { ...u, ...c.query } }) : o(n.method, f, y ? u : void 0, c);
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
// the rest-tuple overload is the public contract; the implementation takes its arguments positionally
|
|
135
|
+
request: m,
|
|
136
|
+
get: (n, s) => o("GET", n, void 0, s),
|
|
137
|
+
post: (n, s, c) => o("POST", n, s, c),
|
|
138
|
+
put: (n, s, c) => o("PUT", n, s, c),
|
|
139
|
+
patch: (n, s, c) => o("PATCH", n, s, c),
|
|
140
|
+
delete: (n, s) => o("DELETE", n, void 0, s)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
b as R,
|
|
145
|
+
x as c,
|
|
146
|
+
F as f
|
|
147
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiResult, HttpClient, QueryValue } from "../client";
|
|
1
|
+
import type { ApiResult, HttpClient, ListResult, QueryValue } from "../client";
|
|
2
2
|
import type { CollectionLoader, ListPage, CollectionQuery } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* The query parameters go-core's datatable reads: `page`, `per_page`, `order_col`, `order_dir`,
|
|
@@ -8,9 +8,11 @@ export declare function listParams(query: CollectionQuery): Record<string, Query
|
|
|
8
8
|
/**
|
|
9
9
|
* Reads a list answer into a `ListPage`. Understands go-core's envelope (`data` is the rows,
|
|
10
10
|
* `meta` has `total`, `page`, `per_page`, `last_page`, `from`, `to`, and may carry `views` and lookups)
|
|
11
|
-
* and
|
|
11
|
+
* and the shape with the numbers next to `data` (`current_page`), which is `ListResult<Row>`: pass a typed
|
|
12
|
+
* route's result (`client.request(route, input)`) and `Row` is inferred. Missing numbers are derived
|
|
12
13
|
* from what is there rather than becoming 0; `query` supplies the page and size that were asked for.
|
|
13
14
|
*/
|
|
15
|
+
export declare function readListPage<Row>(result: ApiResult<ListResult<Row>, unknown>, query: Pick<CollectionQuery, "page" | "pageSize">): ListPage<Row>;
|
|
14
16
|
export declare function readListPage<Row>(result: ApiResult<unknown, unknown>, query: Pick<CollectionQuery, "page" | "pageSize">): ListPage<Row>;
|
|
15
17
|
/**
|
|
16
18
|
* The loader of a go-core list endpoint: the common case of a feature's `api.list`.
|