xmlui 0.6.2-beta.7 → 0.6.4

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.
@@ -7,7 +7,7 @@ var $ = (e, t, r) => Lr(e, typeof t != "symbol" ? t + "" : t, r), ve = (e, t, r)
7
7
  var Q = (e, t, r) => (ve(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Ee = (e, t, r) => t.has(e) ? Be("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), Ve = (e, t, r, s) => (ve(e, t, "write to private field"), s ? s.call(e, r) : t.set(e, r), r), ie = (e, t, r) => (ve(e, t, "access private method"), r);
8
8
  import { isArray as It, isObject as Nt, mapValues as Sr } from "lodash-es";
9
9
  import { delay as Dr, HttpResponse as K, http as Cr } from "msw";
10
- import { r as qr, d as Mr, m as $r, a as Ur, g as jr, o as we, T as Fr } from "./index-CKGVnDJW.mjs";
10
+ import { r as Mr, d as qr, m as $r, a as Ur, g as jr, o as we, T as Fr } from "./index-Dj3m1yCq.mjs";
11
11
  import We from "dexie";
12
12
  var Br = /(%?)(%([sdijo]))/g;
13
13
  function Vr(e, t) {
@@ -89,18 +89,18 @@ var U = async (e) => {
89
89
  }
90
90
  };
91
91
  const Xr = "[MSW]";
92
- function qe(e, ...t) {
92
+ function Me(e, ...t) {
93
93
  const r = Y(e, ...t);
94
94
  return `${Xr} ${r}`;
95
95
  }
96
96
  function zr(e, ...t) {
97
- console.warn(qe(e, ...t));
97
+ console.warn(Me(e, ...t));
98
98
  }
99
99
  function Yr(e, ...t) {
100
- console.error(qe(e, ...t));
100
+ console.error(Me(e, ...t));
101
101
  }
102
102
  const T = {
103
- formatMessage: qe,
103
+ formatMessage: Me,
104
104
  warn: zr,
105
105
  error: Yr
106
106
  };
@@ -531,7 +531,7 @@ function Dt(e, t) {
531
531
  function Ct(e) {
532
532
  return e < 300 ? "#69AB32" : e < 400 ? "#F0BB4B" : "#E95F5D";
533
533
  }
534
- function qt() {
534
+ function Mt() {
535
535
  const e = /* @__PURE__ */ new Date();
536
536
  return [e.getHours(), e.getMinutes(), e.getSeconds()].map(String).map((t) => t.slice(0, 2)).map((t) => t.padStart(2, "0")).join(":");
537
537
  }
@@ -551,7 +551,7 @@ var Tn = (e, t, r) => new Promise((s, n) => {
551
551
  }, l = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(i, a);
552
552
  l((r = r.apply(e, t)).next());
553
553
  });
554
- function Mt(e) {
554
+ function qt(e) {
555
555
  return Tn(this, null, function* () {
556
556
  const r = yield e.clone().text();
557
557
  return {
@@ -723,10 +723,10 @@ var Cn = (e, t, r) => new Promise((s, n) => {
723
723
  }, l = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(i, a);
724
724
  l((r = r.apply(e, t)).next());
725
725
  });
726
- const { message: qn } = Dn;
726
+ const { message: Mn } = Dn;
727
727
  function Ft(e) {
728
728
  return Cn(this, null, function* () {
729
- const t = e.clone(), r = yield t.text(), s = t.status || 200, n = t.statusText || qn[s] || "OK";
729
+ const t = e.clone(), r = yield t.text(), s = t.status || 200, n = t.statusText || Mn[s] || "OK";
730
730
  return {
731
731
  status: s,
732
732
  statusText: n,
@@ -735,7 +735,7 @@ function Ft(e) {
735
735
  };
736
736
  });
737
737
  }
738
- function Mn(e) {
738
+ function qn(e) {
739
739
  for (var t = [], r = 0; r < e.length; ) {
740
740
  var s = e[r];
741
741
  if (s === "*" || s === "+" || s === "?") {
@@ -805,7 +805,7 @@ function Mn(e) {
805
805
  }
806
806
  function $n(e, t) {
807
807
  t === void 0 && (t = {});
808
- for (var r = Mn(e), s = t.prefixes, n = s === void 0 ? "./" : s, i = t.delimiter, a = i === void 0 ? "/#?" : i, l = [], o = 0, c = 0, u = "", h = function(N) {
808
+ for (var r = qn(e), s = t.prefixes, n = s === void 0 ? "./" : s, i = t.delimiter, a = i === void 0 ? "/#?" : i, l = [], o = 0, c = 0, u = "", h = function(N) {
809
809
  if (c < r.length && r[c].type === N)
810
810
  return r[c++].value;
811
811
  }, d = function(N) {
@@ -829,7 +829,7 @@ function $n(e, t) {
829
829
  var I = l[l.length - 1], L = N || (I && typeof I == "string" ? I : "");
830
830
  if (I && !L)
831
831
  throw new TypeError('Must have text between two parameters, missing text after "'.concat(I.name, '"'));
832
- return !L || f(L) ? "[^".concat(q(a), "]+?") : "(?:(?!".concat(q(L), ")[^").concat(q(a), "])+?");
832
+ return !L || f(L) ? "[^".concat(M(a), "]+?") : "(?:(?!".concat(M(L), ")[^").concat(M(a), "])+?");
833
833
  }; c < r.length; ) {
834
834
  var v = h("CHAR"), E = h("NAME"), w = h("PATTERN");
835
835
  if (E || w) {
@@ -890,7 +890,7 @@ function jn(e, t, r) {
890
890
  return { path: l, index: o, params: c };
891
891
  };
892
892
  }
893
- function q(e) {
893
+ function M(e) {
894
894
  return e.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
895
895
  }
896
896
  function Bt(e) {
@@ -923,12 +923,12 @@ function Wn(e, t, r) {
923
923
  r === void 0 && (r = {});
924
924
  for (var s = r.strict, n = s === void 0 ? !1 : s, i = r.start, a = i === void 0 ? !0 : i, l = r.end, o = l === void 0 ? !0 : l, c = r.encode, u = c === void 0 ? function(I) {
925
925
  return I;
926
- } : c, h = r.delimiter, d = h === void 0 ? "/#?" : h, m = r.endsWith, f = m === void 0 ? "" : m, y = "[".concat(q(f), "]|$"), v = "[".concat(q(d), "]"), E = a ? "^" : "", w = 0, b = e; w < b.length; w++) {
926
+ } : c, h = r.delimiter, d = h === void 0 ? "/#?" : h, m = r.endsWith, f = m === void 0 ? "" : m, y = "[".concat(M(f), "]|$"), v = "[".concat(M(d), "]"), E = a ? "^" : "", w = 0, b = e; w < b.length; w++) {
927
927
  var _ = b[w];
928
928
  if (typeof _ == "string")
929
- E += q(u(_));
929
+ E += M(u(_));
930
930
  else {
931
- var P = q(u(_.prefix)), A = q(u(_.suffix));
931
+ var P = M(u(_.prefix)), A = M(u(_.suffix));
932
932
  if (_.pattern)
933
933
  if (t && t.push(_), P || A)
934
934
  if (_.modifier === "+" || _.modifier === "*") {
@@ -1223,7 +1223,7 @@ function as(e, t) {
1223
1223
  function cs(e) {
1224
1224
  delete globalThis[e];
1225
1225
  }
1226
- var Me = class {
1226
+ var qe = class {
1227
1227
  constructor(e) {
1228
1228
  this.symbol = e, this.readyState = "INACTIVE", this.emitter = new de(), this.subscriptions = [], this.logger = new Wt(e.description), this.emitter.setMaxListeners(0), this.logger.info("constructing the interceptor...");
1229
1229
  }
@@ -1313,7 +1313,7 @@ var Me = class {
1313
1313
  clearInstance() {
1314
1314
  cs(this.symbol), this.logger.info("cleared global instance!", this.symbol.description);
1315
1315
  }
1316
- }, Ne = class extends Me {
1316
+ }, Ne = class extends qe {
1317
1317
  constructor(e) {
1318
1318
  Ne.symbol = Symbol(e.name), super(Ne.symbol), this.interceptors = e.interceptors;
1319
1319
  }
@@ -1743,12 +1743,12 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
1743
1743
  }), t.size === 0 && this.store.delete(r);
1744
1744
  });
1745
1745
  }
1746
- }, pe = new Ds(), Cs = Object.defineProperty, rt = Object.getOwnPropertySymbols, qs = Object.prototype.hasOwnProperty, Ms = Object.prototype.propertyIsEnumerable, nt = (e, t, r) => t in e ? Cs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ae = (e, t) => {
1746
+ }, pe = new Ds(), Cs = Object.defineProperty, rt = Object.getOwnPropertySymbols, Ms = Object.prototype.hasOwnProperty, qs = Object.prototype.propertyIsEnumerable, nt = (e, t, r) => t in e ? Cs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ae = (e, t) => {
1747
1747
  for (var r in t || (t = {}))
1748
- qs.call(t, r) && nt(e, r, t[r]);
1748
+ Ms.call(t, r) && nt(e, r, t[r]);
1749
1749
  if (rt)
1750
1750
  for (var r of rt(t))
1751
- Ms.call(t, r) && nt(e, r, t[r]);
1751
+ qs.call(t, r) && nt(e, r, t[r]);
1752
1752
  return e;
1753
1753
  };
1754
1754
  function st() {
@@ -1847,10 +1847,10 @@ class js extends St {
1847
1847
  }
1848
1848
  log(t) {
1849
1849
  return it(this, null, function* () {
1850
- const r = se(t.request), s = yield Mt(t.request), n = yield Ft(t.response), i = Ct(n.status);
1850
+ const r = se(t.request), s = yield qt(t.request), n = yield Ft(t.response), i = Ct(n.status);
1851
1851
  console.groupCollapsed(
1852
1852
  T.formatMessage("%s %s %s (%c%s%c)"),
1853
- qt(),
1853
+ Mt(),
1854
1854
  t.request.method,
1855
1855
  r,
1856
1856
  `color:${i}`,
@@ -4199,13 +4199,13 @@ function Ci(e, t) {
4199
4199
  return;
4200
4200
  }
4201
4201
  }
4202
- var mt = Object.getOwnPropertySymbols, qi = Object.prototype.hasOwnProperty, Mi = Object.prototype.propertyIsEnumerable, $i = (e, t) => {
4202
+ var mt = Object.getOwnPropertySymbols, Mi = Object.prototype.hasOwnProperty, qi = Object.prototype.propertyIsEnumerable, $i = (e, t) => {
4203
4203
  var r = {};
4204
4204
  for (var s in e)
4205
- qi.call(e, s) && t.indexOf(s) < 0 && (r[s] = e[s]);
4205
+ Mi.call(e, s) && t.indexOf(s) < 0 && (r[s] = e[s]);
4206
4206
  if (e != null && mt)
4207
4207
  for (var s of mt(e))
4208
- t.indexOf(s) < 0 && Mi.call(e, s) && (r[s] = e[s]);
4208
+ t.indexOf(s) < 0 && qi.call(e, s) && (r[s] = e[s]);
4209
4209
  return r;
4210
4210
  }, hr = (e, t, r) => new Promise((s, n) => {
4211
4211
  var i = (o) => {
@@ -4411,10 +4411,10 @@ Consider naming this operation or using "graphql.operation()" request handler to
4411
4411
  log(t) {
4412
4412
  return yt(this, null, function* () {
4413
4413
  var r, s, n, i;
4414
- const a = yield Mt(t.request), l = yield Ft(t.response), o = Ct(l.status), c = (r = t.parsedResult) != null && r.operationName ? `${(s = t.parsedResult) == null ? void 0 : s.operationType} ${(n = t.parsedResult) == null ? void 0 : n.operationName}` : `anonymous ${(i = t.parsedResult) == null ? void 0 : i.operationType}`;
4414
+ const a = yield qt(t.request), l = yield Ft(t.response), o = Ct(l.status), c = (r = t.parsedResult) != null && r.operationName ? `${(s = t.parsedResult) == null ? void 0 : s.operationType} ${(n = t.parsedResult) == null ? void 0 : n.operationName}` : `anonymous ${(i = t.parsedResult) == null ? void 0 : i.operationType}`;
4415
4415
  console.groupCollapsed(
4416
4416
  T.formatMessage("%s %s (%c%s%c)"),
4417
- qt(),
4417
+ Mt(),
4418
4418
  `${c}`,
4419
4419
  `color:${o}`,
4420
4420
  `${l.status} ${l.statusText}`,
@@ -4646,23 +4646,23 @@ function lo() {
4646
4646
  };
4647
4647
  return e;
4648
4648
  }
4649
- var M, z, ue, Rt, vr = (Rt = class extends Promise {
4649
+ var q, z, ue, Rt, vr = (Rt = class extends Promise {
4650
4650
  constructor(t = null) {
4651
4651
  const r = lo();
4652
4652
  super((s, n) => {
4653
4653
  r(s, n), t == null || t(r.resolve, r.reject);
4654
4654
  });
4655
4655
  Ee(this, z);
4656
- Ee(this, M);
4656
+ Ee(this, q);
4657
4657
  $(this, "resolve");
4658
4658
  $(this, "reject");
4659
- Ve(this, M, r), this.resolve = Q(this, M).resolve, this.reject = Q(this, M).reject;
4659
+ Ve(this, q, r), this.resolve = Q(this, q).resolve, this.reject = Q(this, q).reject;
4660
4660
  }
4661
4661
  get state() {
4662
- return Q(this, M).state;
4662
+ return Q(this, q).state;
4663
4663
  }
4664
4664
  get rejectionReason() {
4665
- return Q(this, M).rejectionReason;
4665
+ return Q(this, q).rejectionReason;
4666
4666
  }
4667
4667
  then(t, r) {
4668
4668
  return ie(this, z, ue).call(this, super.then(t, r));
@@ -4673,7 +4673,7 @@ var M, z, ue, Rt, vr = (Rt = class extends Promise {
4673
4673
  finally(t) {
4674
4674
  return ie(this, z, ue).call(this, super.finally(t));
4675
4675
  }
4676
- }, M = new WeakMap(), z = new WeakSet(), ue = function(t) {
4676
+ }, q = new WeakMap(), z = new WeakSet(), ue = function(t) {
4677
4677
  return Object.defineProperties(t, {
4678
4678
  resolve: { configurable: !0, value: this.resolve },
4679
4679
  reject: { configurable: !0, value: this.reject }
@@ -4729,7 +4729,7 @@ function po(e) {
4729
4729
  return !1;
4730
4730
  }
4731
4731
  }
4732
- var _r = class extends Me {
4732
+ var _r = class extends qe {
4733
4733
  constructor() {
4734
4734
  super(_r.symbol);
4735
4735
  }
@@ -5322,7 +5322,7 @@ function Oo({
5322
5322
  }
5323
5323
  });
5324
5324
  }
5325
- var Ar = class extends Me {
5325
+ var Ar = class extends qe {
5326
5326
  constructor() {
5327
5327
  super(Ar.interceptorSymbol);
5328
5328
  }
@@ -5489,14 +5489,14 @@ function Co(e) {
5489
5489
  if (!["HEAD", "GET"].includes(e.method))
5490
5490
  return e.body;
5491
5491
  }
5492
- function qo(e) {
5492
+ function Mo(e) {
5493
5493
  return new Request(e.url, Se(Le({}, e), {
5494
5494
  body: Co(e)
5495
5495
  }));
5496
5496
  }
5497
- var Mo = (e, t) => (r, s) => k(void 0, null, function* () {
5497
+ var qo = (e, t) => (r, s) => k(void 0, null, function* () {
5498
5498
  var n;
5499
- const i = new Do(r.ports[0]), a = s.payload.id, l = qo(s.payload), o = l.clone();
5499
+ const i = new Do(r.ports[0]), a = s.payload.id, l = Mo(s.payload), o = l.clone();
5500
5500
  try {
5501
5501
  let c;
5502
5502
  yield yr(
@@ -5620,7 +5620,7 @@ var Bo = (e) => function(r, s) {
5620
5620
  const i = k(this, null, function* () {
5621
5621
  e.events.removeAllListeners(), e.workerChannel.on(
5622
5622
  "REQUEST",
5623
- Mo(e, r)
5623
+ qo(e, r)
5624
5624
  ), e.workerChannel.on("RESPONSE", jo(e));
5625
5625
  const a = yield Lo(
5626
5626
  r.serviceWorker.url,
@@ -5938,7 +5938,7 @@ class ea {
5938
5938
  }
5939
5939
  class ta {
5940
5940
  constructor(t, r, s) {
5941
- this.definition = t, this.db = r, this.authService = s, this.apiStateHash = {}, this.resolvedHelpers = De(t.helpers, (n) => typeof n == "string" ? (...i) => this.runFn(n, ...i) : n);
5941
+ this.definition = t, this.db = r, this.authService = s, this.apiStateHash = {}, this.resolvedHelpers = De(t.helpers, (n) => typeof n == "string" ? (...i) => this.runFn(n, ...i) : n), t.initialize && this.runFn(t.initialize);
5942
5942
  }
5943
5943
  async executeOperation(t, r, s, n) {
5944
5944
  var a;
@@ -5970,7 +5970,7 @@ class ta {
5970
5970
  localContext: s,
5971
5971
  eventArgs: r,
5972
5972
  appContext: {
5973
- ...Mr,
5973
+ ...qr,
5974
5974
  ...$r,
5975
5975
  delay: Ur,
5976
5976
  Errors: Qo,
@@ -5978,7 +5978,7 @@ class ta {
5978
5978
  getDate: jr
5979
5979
  }
5980
5980
  });
5981
- return await qr(t, n), (h = (u = n.mainThread) == null ? void 0 : u.blocks) != null && h.length ? n.mainThread.blocks[n.mainThread.blocks.length - 1].returnValue : void 0;
5981
+ return await Mr(t, n), (h = (u = n.mainThread) == null ? void 0 : u.blocks) != null && h.length ? n.mainThread.blocks[n.mainThread.blocks.length - 1].returnValue : void 0;
5982
5982
  }
5983
5983
  }
5984
5984
  function ra(e) {
@@ -6236,7 +6236,32 @@ function At(e, t) {
6236
6236
  }
6237
6237
  }), r;
6238
6238
  }
6239
- function ia(...e) {
6239
+ class ia {
6240
+ constructor(t, r = {}, s) {
6241
+ this.tables = t, this.initialData = r, this.config = s;
6242
+ }
6243
+ getItems(t) {
6244
+ throw new Error("Method not implemented.");
6245
+ }
6246
+ getItem(t, r) {
6247
+ throw new Error("Method not implemented.");
6248
+ }
6249
+ getItemById(t, r) {
6250
+ throw new Error("Method not implemented.");
6251
+ }
6252
+ deleteItems(t, r) {
6253
+ throw new Error("Method not implemented.");
6254
+ }
6255
+ insertItem(t, r) {
6256
+ throw new Error("Method not implemented.");
6257
+ }
6258
+ updateItem(t, r) {
6259
+ throw new Error("Method not implemented.");
6260
+ }
6261
+ async initialize() {
6262
+ }
6263
+ }
6264
+ function oa(...e) {
6240
6265
  const t = {};
6241
6266
  for (const r of e) {
6242
6267
  if (!Nt(r))
@@ -6247,7 +6272,7 @@ function ia(...e) {
6247
6272
  }
6248
6273
  return new Headers(t);
6249
6274
  }
6250
- class oa {
6275
+ class aa {
6251
6276
  constructor(t) {
6252
6277
  const r = JSON.parse(sessionStorage.getItem("session-logged-in-user"));
6253
6278
  this.loggedInUser = r || (t == null ? void 0 : t.defaultLoggedInUser);
@@ -6268,23 +6293,31 @@ class oa {
6268
6293
  return this.loggedInUser;
6269
6294
  }
6270
6295
  }
6271
- class aa {
6296
+ async function ca(e) {
6297
+ var t, r;
6298
+ switch (e.type) {
6299
+ case "in-memory":
6300
+ return new ia((t = e.schemaDescriptor) == null ? void 0 : t.tables, e.initialData, e.config);
6301
+ default:
6302
+ const s = new na((r = e.schemaDescriptor) == null ? void 0 : r.tables, e.initialData, e.config);
6303
+ return await s.initialize(), s;
6304
+ }
6305
+ }
6306
+ class la {
6272
6307
  constructor(t) {
6273
6308
  this.apiDef = t, this.backend = null;
6274
6309
  }
6275
6310
  async initialize() {
6276
- var i;
6277
6311
  const t = {};
6278
- Object.entries(this.apiDef.operations || {}).forEach(([a, l]) => {
6279
- t[a] = l.handler;
6312
+ Object.entries(this.apiDef.operations || {}).forEach(([i, a]) => {
6313
+ t[i] = a.handler;
6280
6314
  });
6281
- const r = new oa(this.apiDef.auth), s = new na((i = this.apiDef.schemaDescriptor) == null ? void 0 : i.tables, this.apiDef.initialData, this.apiDef.config);
6282
- await s.initialize();
6283
- const n = {
6315
+ const r = await ca(this.apiDef), s = new aa(this.apiDef.auth), n = {
6284
6316
  operations: t,
6317
+ initialize: this.apiDef.initialize,
6285
6318
  helpers: this.apiDef.helpers
6286
6319
  };
6287
- this.backend = new ta(n, s, r);
6320
+ this.backend = new ta(n, r, s);
6288
6321
  }
6289
6322
  getOperations() {
6290
6323
  return this.apiDef.operations || {};
@@ -6325,7 +6358,7 @@ class aa {
6325
6358
  await Dr();
6326
6359
  const o = new Zo(), c = new ea();
6327
6360
  try {
6328
- const h = await this.backend.executeOperation(t, l, o, c), d = h == null, m = i.successStatusCode ?? (d ? he.NoContent : he.Ok), f = ia(o.getCookieHeader(), c.getHeaders());
6361
+ const h = await this.backend.executeOperation(t, l, o, c), d = h == null, m = i.successStatusCode ?? (d ? he.NoContent : he.Ok), f = oa(o.getCookieHeader(), c.getHeaders());
6329
6362
  return h instanceof File ? (f.append("Content-type", h.type), f.append("Content-Length", h.size + ""), f.append("Content-Disposition", `attachment; filename="${h.name}"; filename*=utf-8''${h.name}`), K.arrayBuffer(await h.arrayBuffer(), {
6330
6363
  headers: f,
6331
6364
  status: m
@@ -6358,24 +6391,28 @@ class aa {
6358
6391
  };
6359
6392
  }
6360
6393
  }
6361
- function ca(e) {
6394
+ function ua(e) {
6362
6395
  const t = e.getOperations();
6363
6396
  let r = [];
6364
6397
  return Object.entries(t).forEach(([s, n]) => {
6365
6398
  let i = [n.url];
6366
6399
  It(n.url) && (i = n.url), i.forEach((a) => {
6367
6400
  r.push(
6368
- Cr[n.method](`${e.getApiUrl()}${a}`, async ({ request: l, cookies: o, params: c }) => await e.executeOperation(s, l, o, c))
6401
+ Cr[n.method](
6402
+ `${e.getApiUrl()}${a}`,
6403
+ async ({ request: l, cookies: o, params: c }) => await e.executeOperation(s, l, o, c)
6404
+ )
6369
6405
  );
6370
6406
  });
6371
6407
  }), r;
6372
6408
  }
6373
- const fa = async (e) => {
6374
- const t = new aa(e);
6375
- await t.initialize();
6376
- const r = ca(t);
6377
- return Jo(...r);
6409
+ const ya = async (e, t) => {
6410
+ const r = new la(e);
6411
+ await r.initialize();
6412
+ const s = ua(r);
6413
+ let n = t;
6414
+ return n || (n = Jo()), n.use(...s), n;
6378
6415
  };
6379
6416
  export {
6380
- fa as createApiInterceptorWorker
6417
+ ya as createApiInterceptorWorker
6381
6418
  };