@wssto2/vue-core 0.5.4 → 0.7.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.
Files changed (168) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +6 -1
  3. package/dist/{AccessGate.vue_vue_type_script_setup_true_lang-DZ9GcLC1.js → AccessGate.vue_vue_type_script_setup_true_lang-CkomzGrt.js} +1 -1
  4. package/dist/{AccountMenuItem.vue_vue_type_script_setup_true_lang-CPeNxh5K.js → AccountMenuItem.vue_vue_type_script_setup_true_lang-BIYgaihv.js} +1 -1
  5. package/dist/{ActionRow.vue_vue_type_script_setup_true_lang-Bv-APkGf.js → ActionRow.vue_vue_type_script_setup_true_lang-Cg1lhpcA.js} +2 -2
  6. package/dist/{Activity-DUjDaPfP.js → Activity-CW2TOQAY.js} +9 -9
  7. package/dist/{AdaptivePageShell.vue_vue_type_script_setup_true_lang-GUTIXuNd.js → AdaptivePageShell.vue_vue_type_script_setup_true_lang-9Lt1XggN.js} +3 -3
  8. package/dist/{AlertDialog.vue_vue_type_script_setup_true_lang-whA4WLdl.js → AlertDialog.vue_vue_type_script_setup_true_lang-BvGc1Rfl.js} +1 -1
  9. package/dist/{AsyncSection.vue_vue_type_script_setup_true_lang-B0NfvG3B.js → AsyncSection.vue_vue_type_script_setup_true_lang-GxAsImnO.js} +4 -4
  10. package/dist/{Banner.vue_vue_type_script_setup_true_lang-DSStj_5z.js → Banner.vue_vue_type_script_setup_true_lang-sv0phngk.js} +1 -1
  11. package/dist/{Button.vue_vue_type_script_setup_true_lang-CL9Qh5yq.js → Button.vue_vue_type_script_setup_true_lang-DQq_0P0p.js} +1 -1
  12. package/dist/{Changes-B0tZO6BZ.js → Changes-BCaVkeZg.js} +8 -8
  13. package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-o_Pj-JcD.js → CollectionPage.vue_vue_type_script_setup_true_lang-BmXnfM5f.js} +17 -16
  14. package/dist/{DataTable.vue_vue_type_script_setup_true_lang-BEvz5zqo.js → DataTable.vue_vue_type_script_setup_true_lang-DRWrCRLr.js} +1 -1
  15. package/dist/{DateField.vue_vue_type_script_setup_true_lang-CDg31ZU7.js → DateField.vue_vue_type_script_setup_true_lang-DmYp54mq.js} +3 -3
  16. package/dist/{DeadLetters-IgVHao84.js → DeadLetters-DUM_bsL-.js} +8 -7
  17. package/dist/{DiscardChangesModal.vue_vue_type_script_setup_true_lang-D1arePCZ.js → DiscardChangesModal.vue_vue_type_script_setup_true_lang-DcihJfpk.js} +1 -1
  18. package/dist/{EmptyState.vue_vue_type_script_setup_true_lang-50p-Mp8I.js → EmptyState.vue_vue_type_script_setup_true_lang-DbZiO2RF.js} +1 -1
  19. package/dist/{FormErrors.vue_vue_type_script_setup_true_lang-D7edzNTL.js → FormErrors.vue_vue_type_script_setup_true_lang-DJiK8iqo.js} +1 -1
  20. package/dist/{FormGroup.vue_vue_type_script_setup_true_lang-CSgT4ITL.js → FormGroup.vue_vue_type_script_setup_true_lang-BTADNpwB.js} +2 -2
  21. package/dist/{FormView.vue_vue_type_script_setup_true_lang-D31Hk3pJ.js → FormView.vue_vue_type_script_setup_true_lang-Ncl9DmFB.js} +2 -2
  22. package/dist/{General-C40HxupS.js → General-Dsh0TJ5w.js} +8 -8
  23. package/dist/{HeaderAction.vue_vue_type_script_setup_true_lang-Cgji-Jrr.js → HeaderAction.vue_vue_type_script_setup_true_lang-Da59TLBh.js} +2 -2
  24. package/dist/{Icon.vue_vue_type_script_lang-D7oC-d-S.js → Icon.vue_vue_type_script_lang-BhhsFYwp.js} +45 -42
  25. package/dist/{IconTile.vue_vue_type_script_setup_true_lang-_FXvaj93.js → IconTile.vue_vue_type_script_setup_true_lang-BmxCuUZ9.js} +1 -1
  26. package/dist/IncidentRecord-C9zrjNrp.js +405 -0
  27. package/dist/IncidentsList-ClQOjd5c.js +140 -0
  28. package/dist/KeyValue.vue_vue_type_script_setup_true_lang-wcZcvnow.js +35 -0
  29. package/dist/{LeaveGuardRoot.vue_vue_type_script_setup_true_lang-Cv7KlA5y.js → LeaveGuardRoot.vue_vue_type_script_setup_true_lang-ChIsmnts.js} +1 -1
  30. package/dist/{Menu.vue_vue_type_script_setup_true_lang-DsFOeCVe.js → Menu.vue_vue_type_script_setup_true_lang-ldLdJ5Q-.js} +1 -1
  31. package/dist/{MenuButton.vue_vue_type_script_setup_true_lang-AGbN9r5q.js → MenuButton.vue_vue_type_script_setup_true_lang-C-XRr5f2.js} +1 -1
  32. package/dist/{Modal.vue_vue_type_script_setup_true_lang-DpBb8ans.js → Modal.vue_vue_type_script_setup_true_lang-4MsnTWyx.js} +2 -2
  33. package/dist/{NewRolePage-Bhy8KJO1.js → NewRolePage-Bw2_jXcQ.js} +9 -8
  34. package/dist/{NoAccess.vue_vue_type_script_setup_true_lang-DWxq-MTM.js → NoAccess.vue_vue_type_script_setup_true_lang-BHzZtZ50.js} +1 -1
  35. package/dist/{NumberField.vue_vue_type_script_setup_true_lang-BdS7BxuS.js → NumberField.vue_vue_type_script_setup_true_lang-C3nw944P.js} +1 -1
  36. package/dist/{PageBar.vue_vue_type_script_setup_true_lang-B7qdEeej.js → PageBar.vue_vue_type_script_setup_true_lang-DPpcZxuT.js} +1 -1
  37. package/dist/{Panel.vue_vue_type_script_setup_true_lang-BA0u_DtS.js → Panel.vue_vue_type_script_setup_true_lang-D_Wg42hu.js} +1 -1
  38. package/dist/PersonAccess.vue_vue_type_script_setup_true_lang-07pq4SrY.js +600 -0
  39. package/dist/{PhotoViewer.vue_vue_type_script_setup_true_lang-CY5EZiyK.js → PhotoViewer.vue_vue_type_script_setup_true_lang-Cj0hSMk9.js} +1 -1
  40. package/dist/{ProfilePage-Bf7dFzGd.js → ProfilePage-CJIztbx3.js} +19 -19
  41. package/dist/{RecordHeader.vue_vue_type_script_setup_true_lang-fmx0f8xi.js → RecordHeader.vue_vue_type_script_setup_true_lang-DPm9q1P_.js} +2 -2
  42. package/dist/{ResourcePage.vue_vue_type_script_setup_true_lang-BFBGvevP.js → ResourcePage.vue_vue_type_script_setup_true_lang-Cm3tx76N.js} +5 -5
  43. package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-C6oloGIh.js → RoleEditor.vue_vue_type_script_setup_true_lang-DuQR8hFf.js} +35 -34
  44. package/dist/{RolePage-BjbvciTg.js → RolePage-Yv6m6u7o.js} +43 -41
  45. package/dist/{RolesPage-DzVOgF4z.js → RolesPage-TibtzxzQ.js} +34 -32
  46. package/dist/{SectionList.vue_vue_type_script_setup_true_lang-wyW7n3Uq.js → SectionList.vue_vue_type_script_setup_true_lang-DAnZbfWA.js} +3 -3
  47. package/dist/{SectionNavigator.vue_vue_type_script_setup_true_lang-Ci04hApd.js → SectionNavigator.vue_vue_type_script_setup_true_lang-ivdGWUeF.js} +5 -5
  48. package/dist/{SegmentedField.vue_vue_type_script_setup_true_lang-DXe_iOS8.js → SegmentedField.vue_vue_type_script_setup_true_lang-ChfDFAA2.js} +1 -1
  49. package/dist/{SelectField.vue_vue_type_script_setup_true_lang-BN4vzvV9.js → SelectField.vue_vue_type_script_setup_true_lang-iJm8qmjT.js} +7 -7
  50. package/dist/ServiceAccountDialog.vue_vue_type_script_setup_true_lang-D2Xj5mr7.js +126 -0
  51. package/dist/ServiceAccountRecord-Ct3TrSqZ.js +511 -0
  52. package/dist/ServiceAccountsList-CaXEp73j.js +137 -0
  53. package/dist/{SessionList.vue_vue_type_script_setup_true_lang-PuWIK-Wa.js → SessionList.vue_vue_type_script_setup_true_lang-BEKTaL0g.js} +4 -4
  54. package/dist/{Sessions-CRUObe5G.js → Sessions-Bg4Zk9Gf.js} +6 -6
  55. package/dist/{SettingsPage-C0qEC0uI.js → SettingsPage-Brq9U4tJ.js} +19 -19
  56. package/dist/{Sheet.vue_vue_type_script_setup_true_lang-DgOFV4fa.js → Sheet.vue_vue_type_script_setup_true_lang-sh9YD0Pm.js} +1 -1
  57. package/dist/{SignIn-Uy0Jujzz.js → SignIn-DB5LRNlB.js} +7 -7
  58. package/dist/{SignInPage-CpVZfrLZ.js → SignInPage-Ts-iTaC1.js} +6 -6
  59. package/dist/{SignIns-Cp5Gx2dk.js → SignIns-bCvvmCHF.js} +6 -6
  60. package/dist/{SwipeActions.vue_vue_type_script_setup_true_lang-BJIA2JfI.js → SwipeActions.vue_vue_type_script_setup_true_lang-D8SiC0G7.js} +1 -1
  61. package/dist/{SwitchField.vue_vue_type_script_setup_true_lang-Dj5Aq8QT.js → SwitchField.vue_vue_type_script_setup_true_lang-BMA2YXTZ.js} +1 -1
  62. package/dist/{Tabs.vue_vue_type_script_setup_true_lang-CcMcE38r.js → Tabs.vue_vue_type_script_setup_true_lang-tpkGp98F.js} +1 -1
  63. package/dist/{TextField.vue_vue_type_script_setup_true_lang-BwfNNQEz.js → TextField.vue_vue_type_script_setup_true_lang-7IAl4eAE.js} +3 -3
  64. package/dist/{TextareaField.vue_vue_type_script_setup_true_lang-aT1P8Xqr.js → TextareaField.vue_vue_type_script_setup_true_lang-Dyh4Hhyl.js} +1 -1
  65. package/dist/{TimeField.vue_vue_type_script_setup_true_lang-jPKPE1hc.js → TimeField.vue_vue_type_script_setup_true_lang-BwoE08jT.js} +3 -3
  66. package/dist/{Timestamp.vue_vue_type_script_setup_true_lang-CutyQkJb.js → Timestamp.vue_vue_type_script_setup_true_lang-u53rHMFG.js} +1 -1
  67. package/dist/{UserRecord-DbSMnTbj.js → UserRecord-DgK9FsvV.js} +30 -30
  68. package/dist/{UsersList-9MicE2pG.js → UsersList-Due2ZkbO.js} +14 -14
  69. package/dist/{ViewTabs.vue_vue_type_script_setup_true_lang-BJIoZAlH.js → ViewTabs.vue_vue_type_script_setup_true_lang-BjdDXE3T.js} +1 -1
  70. package/dist/access/api.d.ts +7 -8
  71. package/dist/access/context.d.ts +2 -7
  72. package/dist/access/feature.d.ts +0 -8
  73. package/dist/access/index.js +47 -15
  74. package/dist/app/application.d.ts +2 -0
  75. package/dist/app/index.js +13 -427
  76. package/dist/application-D8Nm17zA.js +420 -0
  77. package/dist/button/index.js +1 -1
  78. package/dist/client/client.d.ts +7 -0
  79. package/dist/client/index.d.ts +1 -1
  80. package/dist/client/index.js +5 -4
  81. package/dist/client-CZgikXPG.js +151 -0
  82. package/dist/collection/index.js +55 -63
  83. package/dist/content/index.js +37 -66
  84. package/dist/{contributions-fx5q5n1u.js → contributions-BQ9dZoRw.js} +1 -1
  85. package/dist/controls/index.js +4 -4
  86. package/dist/datePresets-DB13HHHd.js +17 -0
  87. package/dist/definition-C7QuyV3i.js +54 -0
  88. package/dist/form/index.js +590 -615
  89. package/dist/{guards-D4mXf_2X.js → guards-BFCulig0.js} +1 -1
  90. package/dist/http-nz92KjdS.js +42 -0
  91. package/dist/i18n/index.js +36 -36
  92. package/dist/icon/core.d.ts +3 -0
  93. package/dist/icon/index.js +1 -1
  94. package/dist/identity/index.d.ts +7 -0
  95. package/dist/identity/index.js +19 -15
  96. package/dist/identity/serviceaccounts/ApiKeysPanel.vue.d.ts +17 -0
  97. package/dist/identity/serviceaccounts/CreatedApiKeyDialog.vue.d.ts +53 -0
  98. package/dist/identity/serviceaccounts/NewApiKeyDialog.vue.d.ts +24 -0
  99. package/dist/identity/serviceaccounts/ServiceAccountDialog.vue.d.ts +22 -0
  100. package/dist/identity/serviceaccounts/ServiceAccountRecord.vue.d.ts +2 -0
  101. package/dist/identity/serviceaccounts/ServiceAccountsList.vue.d.ts +2 -0
  102. package/dist/identity/serviceaccounts/access.d.ts +4 -0
  103. package/dist/identity/serviceaccounts/api.d.ts +27 -0
  104. package/dist/identity/serviceaccounts/context.d.ts +14 -0
  105. package/dist/identity/serviceaccounts/feature.d.ts +23 -0
  106. package/dist/identity/serviceaccounts/form.d.ts +4 -0
  107. package/dist/identity/serviceaccounts/messages.d.ts +11 -0
  108. package/dist/identity/serviceaccounts/routes.d.ts +22 -0
  109. package/dist/incidents/IncidentRecord.vue.d.ts +2 -0
  110. package/dist/incidents/IncidentsList.vue.d.ts +2 -0
  111. package/dist/incidents/Person.vue.d.ts +7 -0
  112. package/dist/incidents/ReportDialog.vue.d.ts +21 -0
  113. package/dist/incidents/ReportHost.vue.d.ts +2 -0
  114. package/dist/incidents/ReportMenuItem.vue.d.ts +2 -0
  115. package/dist/incidents/access.d.ts +6 -0
  116. package/dist/incidents/api.d.ts +27 -0
  117. package/dist/incidents/clientErrorReporter.d.ts +38 -0
  118. package/dist/incidents/context.d.ts +7 -0
  119. package/dist/incidents/feature.d.ts +20 -0
  120. package/dist/incidents/form.d.ts +16 -0
  121. package/dist/incidents/index.d.ts +9 -0
  122. package/dist/incidents/index.js +8 -0
  123. package/dist/incidents/look.d.ts +6 -0
  124. package/dist/incidents/routes.d.ts +21 -0
  125. package/dist/{index-Ok29ucE3.js → index-CXTJ_1NV.js} +191 -168
  126. package/dist/index-D5_GAqjA.js +340 -0
  127. package/dist/{index-C-oM_Mnf.js → index-i-cTTVxo.js} +10 -10
  128. package/dist/index.d.ts +1 -1
  129. package/dist/index.js +1 -1
  130. package/dist/internal/copyText.d.ts +5 -0
  131. package/dist/modal/index.js +5 -5
  132. package/dist/modules/incident/entities.d.ts +84 -0
  133. package/dist/modules/incident/routes.d.ts +54 -0
  134. package/dist/modules/incident/schemas.d.ts +48 -0
  135. package/dist/modules/serviceaccount/entities.d.ts +127 -0
  136. package/dist/modules/serviceaccount/routes.d.ts +58 -0
  137. package/dist/modules/serviceaccount/schemas.d.ts +49 -0
  138. package/dist/{navigation-Bc5EQ_Si.js → navigation-BSC9X7FM.js} +1 -1
  139. package/dist/{neighbors-Bv6vnWlW.js → neighbors-BKzihEGQ.js} +1 -1
  140. package/dist/notifications/index.js +1 -1
  141. package/dist/{options-Bu0XbEpN.js → options-QuOkMKVZ.js} +4 -4
  142. package/dist/overlay/index.js +4 -4
  143. package/dist/page/index.js +7 -7
  144. package/dist/phone/index.js +2 -2
  145. package/dist/platform/index.js +3 -3
  146. package/dist/{platform-Dx6STiwY.js → platform-Dr4iY3b8.js} +1 -1
  147. package/dist/refusals-COPr15XZ.js +135 -0
  148. package/dist/resource/index.js +1 -1
  149. package/dist/router/index.js +4 -4
  150. package/dist/routes-CVckt7Pj.js +19 -0
  151. package/dist/{rowLayout-BBFyLbOl.js → rowLayout-Cz-K7jeo.js} +5 -5
  152. package/dist/{sections-B0HxIOC2.js → sections-BXg4_ZhO.js} +1 -1
  153. package/dist/shell/index.js +9 -9
  154. package/dist/state/index.js +4 -4
  155. package/dist/state-ChVIjayU.js +102 -0
  156. package/dist/{status-C78NpXyB.js → status-DZ4eSnAS.js} +9 -8
  157. package/dist/styles.css +1 -1
  158. package/dist/{suggestions-ClyLexMO.js → suggestions-niXd1oOl.js} +1 -1
  159. package/dist/testing/index.js +1 -1
  160. package/dist/{useCommand-DyuPTosF.js → useCommand-BIZX1ReM.js} +4 -4
  161. package/dist/{useGroupSheet-C2NyqWRp.js → useGroupSheet-DxXzdKo3.js} +5 -5
  162. package/dist/useRecordDialog-BLVSz7g3.js +30 -0
  163. package/dist/{useResourceForm-CJfl8rj_.js → useResourceForm-DYuYT_on.js} +1 -1
  164. package/dist/{useTypedEntry-C7k7Dyl-.js → useTypedEntry-CKuGqWT8.js} +2 -2
  165. package/package.json +6 -2
  166. package/dist/client-BHPFfBj3.js +0 -147
  167. package/dist/http-CdQowFlW.js +0 -194
  168. package/dist/index-BdGnA1Jh.js +0 -765
@@ -0,0 +1,30 @@
1
+ import { shallowRef as t } from "vue";
2
+ import { u as o } from "./useCommand-BIZX1ReM.js";
3
+ function f(r) {
4
+ const u = t(null);
5
+ let n = null;
6
+ const a = o({
7
+ ...r,
8
+ done: r.done ? (e) => r.done?.(e, { editing: n }) : void 0,
9
+ run(e, l) {
10
+ const d = n = u.value;
11
+ if (d === null) return r.create(e, l);
12
+ if (!r.update) throw new Error("useRecordDialog: edit() needs an `update`.");
13
+ return r.update(d, e, l);
14
+ }
15
+ });
16
+ return {
17
+ command: a,
18
+ form: a.form,
19
+ editing: u,
20
+ create(e) {
21
+ u.value = null, a.present(e);
22
+ },
23
+ edit(e) {
24
+ u.value = e, a.present(r.toValues?.(e));
25
+ }
26
+ };
27
+ }
28
+ export {
29
+ f as u
30
+ };
@@ -1,5 +1,5 @@
1
1
  import { shallowRef as v, watch as m, computed as f } from "vue";
2
- import { u as i, c as h } from "./FormErrors.vue_vue_type_script_setup_true_lang-D7edzNTL.js";
2
+ import { u as i, c as h } from "./FormErrors.vue_vue_type_script_setup_true_lang-DJiK8iqo.js";
3
3
  function b(u) {
4
4
  const t = i(u), r = v(null), s = v(!1);
5
5
  let n = null;
@@ -2,8 +2,8 @@ import { defineComponent as K, ref as L, watch as re, computed as _, openBlock a
2
2
  import { i as W } from "./intlLocale-CeRU44qJ.js";
3
3
  import { useI18n as X } from "vue-i18n";
4
4
  import { u as Me } from "./format-D8X4zsx6.js";
5
- import { _ as Oe } from "./Sheet.vue_vue_type_script_setup_true_lang-DgOFV4fa.js";
6
- import { _ as F } from "./Icon.vue_vue_type_script_lang-D7oC-d-S.js";
5
+ import { _ as Oe } from "./Sheet.vue_vue_type_script_setup_true_lang-sh9YD0Pm.js";
6
+ import { _ as F } from "./Icon.vue_vue_type_script_lang-BhhsFYwp.js";
7
7
  import { a as We } from "./mediaQuery-CygcXmFW.js";
8
8
  const Re = /^(\d{4})-(\d{2})-(\d{2})$/, Ve = 864e5, R = (e, t = 2) => String(e).padStart(t, "0"), He = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Be = (e) => e % 4 === 0 && e % 100 !== 0 || e % 400 === 0, se = (e, t) => t === 2 && Be(e) ? 29 : He[t - 1] ?? 0;
9
9
  function O(e, t, a) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wssto2/vue-core",
3
- "version": "0.5.4",
4
- "goCore": "v1.8.0",
3
+ "version": "0.7.0",
4
+ "goCore": "v1.11.0",
5
5
  "description": "Shared Vue 3 library for go-core applications: app shell, list / record / form pages and their controls.",
6
6
  "keywords": [
7
7
  "vue",
@@ -121,6 +121,10 @@
121
121
  "types": "./dist/notifications/index.d.ts",
122
122
  "import": "./dist/notifications/index.js"
123
123
  },
124
+ "./incidents": {
125
+ "types": "./dist/incidents/index.d.ts",
126
+ "import": "./dist/incidents/index.js"
127
+ },
124
128
  "./push-worker": {
125
129
  "types": "./dist/push-worker/index.d.ts",
126
130
  "import": "./dist/push-worker/index.js"
@@ -1,147 +0,0 @@
1
- import { A, k as I, i as S } from "./error-Bb_dr_Ay.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,194 +0,0 @@
1
- import { hasInjectionContext as $, inject as _, watch as O } from "vue";
2
- import { g as j } from "./platform-Dx6STiwY.js";
3
- const k = [5, 8, 10, 15, 25, 50, 100], A = 25;
4
- function X(e) {
5
- const t = `defineCollection("${e.id}")`;
6
- if (typeof e.id != "string" || e.id.trim() === "") throw new Error("defineCollection: `id` must be a non-empty string.");
7
- if (!Number.isInteger(e.stateVersion) || e.stateVersion < 1) throw new Error(`${t}: \`stateVersion\` must be a positive integer.`);
8
- if (typeof e.load != "function") throw new Error(`${t}: \`load\` must be a function.`);
9
- if (typeof e.key != "function") throw new Error(`${t}: \`key\` must be a function.`);
10
- const s = {
11
- sorts: e.query?.sorts ? [...e.query.sorts] : null,
12
- filters: e.query?.filters ? [...e.query.filters] : null,
13
- views: e.query?.views ? [...e.query.views] : null,
14
- sensitive: [...e.query?.sensitive ?? []],
15
- pageSizes: [...e.query?.pageSizes ?? k],
16
- search: e.query?.search ?? !0
17
- };
18
- if (s.pageSizes.length === 0 || s.pageSizes.some((c) => !Number.isInteger(c) || c < 1))
19
- throw new Error(`${t}: \`query.pageSizes\` must list positive integers.`);
20
- for (const c of s.sensitive)
21
- if (s.filters && !s.filters.includes(c)) throw new Error(`${t}: sensitive filter "${c}" is not in \`query.filters\`.`);
22
- const r = e.defaults ?? {}, o = r.pageSize ?? (s.pageSizes.includes(A) ? A : s.pageSizes[0]);
23
- if (!s.pageSizes.includes(o)) throw new Error(`${t}: default page size ${o} is not one of ${s.pageSizes.join(", ")}.`);
24
- const n = r.sort ?? null;
25
- if (n !== null && s.sorts && !s.sorts.includes(n)) throw new Error(`${t}: default sort "${n}" is not in \`query.sorts\`.`);
26
- const i = r.view ?? null;
27
- if (i !== null && s.views && !s.views.includes(i)) throw new Error(`${t}: default view "${i}" is not in \`query.views\`.`);
28
- const a = Object.fromEntries(Object.entries(r.filters ?? {}).filter(([, c]) => c !== void 0 && c !== ""));
29
- for (const c of Object.keys(a))
30
- if (s.filters && !s.filters.includes(c)) throw new Error(`${t}: default filter "${c}" is not in \`query.filters\`.`);
31
- const l = r.page ?? 1;
32
- if (!Number.isInteger(l) || l < 1) throw new Error(`${t}: default page must be a positive integer.`);
33
- const f = r.direction ?? "asc";
34
- if (f !== "asc" && f !== "desc") throw new Error(`${t}: default direction must be "asc" or "desc".`);
35
- return Object.freeze({
36
- id: e.id,
37
- stateVersion: e.stateVersion,
38
- load: e.load,
39
- key: e.key,
40
- defaults: Object.freeze({
41
- page: l,
42
- pageSize: o,
43
- sort: n,
44
- direction: f,
45
- search: r.search ?? "",
46
- view: i,
47
- filters: Object.freeze(a)
48
- }),
49
- contract: Object.freeze(s),
50
- migrate: e.migrate
51
- });
52
- }
53
- const F = "from";
54
- function G(e, t) {
55
- if (typeof e == "string") {
56
- const s = new URLSearchParams(t).toString(), r = e.indexOf("#"), o = r === -1 ? e : e.slice(0, r);
57
- return `${o}${o.includes("?") ? "&" : "?"}${s}${r === -1 ? "" : e.slice(r)}`;
58
- }
59
- return { ...e, query: { ...e.query, ...t } };
60
- }
61
- function J(e) {
62
- if (!$()) return;
63
- const t = _(j, null);
64
- t && O(
65
- () => {
66
- const s = t.session.state.value;
67
- return s.status === "authenticated" ? s.user.id : null;
68
- },
69
- e,
70
- { flush: "sync" }
71
- );
72
- }
73
- const I = 4096, T = 200, N = 32, C = 1e6, S = /^[A-Za-z0-9_.-]{1,64}$/;
74
- function M(e) {
75
- let t = "";
76
- for (const s of new TextEncoder().encode(e)) t += String.fromCharCode(s);
77
- return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
78
- }
79
- function x(e) {
80
- const t = e.replace(/-/g, "+").replace(/_/g, "/"), s = atob(t.padEnd(Math.ceil(t.length / 4) * 4, "="));
81
- return new TextDecoder("utf-8", { fatal: !0 }).decode(Uint8Array.from(s, (r) => r.charCodeAt(0)));
82
- }
83
- const E = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
84
- function d(e, t = T) {
85
- return typeof e == "string" && e.length <= t ? e : null;
86
- }
87
- function z(e, t, s) {
88
- const { contract: r } = e, o = s ?? e.defaults, n = typeof t.p == "number" && Number.isInteger(t.p) && t.p >= 1 && t.p <= C ? t.p : o.page, i = typeof t.l == "number" && r.pageSizes.includes(t.l) ? t.l : o.pageSize;
89
- let a = o.sort;
90
- const l = d(t.c, 64);
91
- l !== null && (r.sorts ? r.sorts.includes(l) : S.test(l)) && (a = l);
92
- const f = t.d === "asc" || t.d === "desc" ? t.d : o.direction, c = d(t.s) ?? o.search;
93
- let g = o.view;
94
- const p = d(t.w, 64);
95
- t.w === "" ? g = null : p !== null && (r.views ? r.views.includes(p) : S.test(p)) && (g = p);
96
- const h = E(t.f) ? {} : { ...o.filters };
97
- if (E(t.f)) {
98
- let w = 0;
99
- for (const [m, y] of Object.entries(t.f)) {
100
- if (++w > N) break;
101
- if (!(r.filters ? r.filters.includes(m) : S.test(m)) || r.sensitive.includes(m)) continue;
102
- const v = typeof y == "number" || typeof y == "boolean" ? String(y) : d(y);
103
- v !== null && v !== "" && (h[m] = v);
104
- }
105
- }
106
- return { page: n, pageSize: i, sort: a, direction: f, search: c, view: g, filters: h };
107
- }
108
- function Z(e, t, s) {
109
- const r = { v: e.stateVersion, p: t.page, l: t.pageSize };
110
- t.sort && (r.c = t.sort), r.d = t.direction, (t.search || s && e.defaults.search !== s.search) && (r.s = t.search), (t.view || s && e.defaults.view !== s.view) && (r.w = t.view ?? "");
111
- const o = Object.fromEntries(
112
- Object.entries(t.filters).filter(([n, i]) => i !== void 0 && i !== "" && !e.contract.sensitive.includes(n))
113
- );
114
- return (Object.keys(o).length > 0 || Object.keys(e.defaults.filters).length > 0 || Object.keys(s?.filters ?? {}).length > 0) && (r.f = o), M(JSON.stringify(r));
115
- }
116
- function L(e, t, s) {
117
- const r = t.v === void 0 ? e.stateVersion : t.v;
118
- if (typeof r != "number" || !Number.isInteger(r)) return null;
119
- if (r === e.stateVersion) return z(e, t, s);
120
- const o = e.migrate?.(t, r);
121
- return o ? z(e, o, s) : null;
122
- }
123
- function B(e, t, s) {
124
- if (typeof t != "string" || t === "" || t.length > I) return null;
125
- let r;
126
- try {
127
- r = JSON.parse(x(t));
128
- } catch {
129
- return null;
130
- }
131
- return E(r) ? L(e, r, s) : null;
132
- }
133
- function K(e) {
134
- return JSON.stringify([
135
- e.page,
136
- e.pageSize,
137
- e.sort,
138
- e.direction,
139
- e.search,
140
- e.view,
141
- Object.entries(e.filters).sort(([t], [s]) => t.localeCompare(s))
142
- ]);
143
- }
144
- const b = (e) => typeof e == "object" && e !== null && !Array.isArray(e), u = (...e) => {
145
- for (const t of e) if (typeof t == "number" && Number.isFinite(t)) return t;
146
- return null;
147
- };
148
- function P(e) {
149
- return {
150
- // Filters first: the reserved names below always win, a filter called "page" cannot break paging.
151
- ...e.filters,
152
- page: e.page,
153
- per_page: e.pageSize,
154
- order_col: e.sort,
155
- order_dir: e.sort ? e.direction : null,
156
- search: e.search,
157
- view: e.view
158
- };
159
- }
160
- function V(e, t) {
161
- const s = e.data, r = b(s) && Array.isArray(s.data), o = Array.isArray(s) ? s : r ? s.data : [], n = r ? s : {}, i = b(e.meta) ? e.meta : b(n.meta) ? n.meta : {}, a = u(n.per_page, i.per_page) ?? t.pageSize, l = u(n.total, i.total) ?? o.length, f = u(n.current_page, i.page, i.current_page) ?? t.page, c = u(n.last_page, i.last_page) ?? (l === 0 ? 0 : Math.ceil(l / Math.max(1, a))), g = u(n.from, i.from) ?? (o.length === 0 ? 0 : (f - 1) * a + 1), p = u(n.to, i.to) ?? (o.length === 0 ? 0 : g + o.length - 1), h = Array.isArray(i.views) ? i.views : Array.isArray(n.views) ? n.views : void 0;
162
- return {
163
- rows: o,
164
- total: l,
165
- page: f,
166
- pageSize: a,
167
- lastPage: c,
168
- from: g,
169
- to: p,
170
- views: h?.filter(b).flatMap((w) => typeof w.key == "string" ? [{ key: w.key, count: u(w.count) ?? void 0 }] : []),
171
- meta: i,
172
- requestId: e.requestId
173
- };
174
- }
175
- function Q(e, t, s = {}) {
176
- return async (r, { signal: o }) => {
177
- const n = await e.get(t, { query: s.params ? s.params(r) : P(r), signal: o });
178
- return V(n, r);
179
- };
180
- }
181
- export {
182
- k as D,
183
- F as L,
184
- X as a,
185
- L as b,
186
- B as d,
187
- Z as e,
188
- Q as h,
189
- P as l,
190
- J as o,
191
- K as q,
192
- V as r,
193
- G as w
194
- };