@datapos/datapos-shared 0.3.544 → 0.3.545

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.
@@ -1,11 +1,11 @@
1
- class c extends Error {
1
+ class i extends Error {
2
2
  locator;
3
3
  /** Logical source of the error. */
4
- constructor(o, n, r) {
5
- super(o, r), this.name = new.target.name, this.locator = n;
4
+ constructor(o, n, e) {
5
+ super(o, e), this.name = new.target.name, this.locator = n;
6
6
  }
7
7
  }
8
- class s extends c {
8
+ class s extends i {
9
9
  }
10
10
  class f extends s {
11
11
  }
@@ -14,91 +14,91 @@ class u extends s {
14
14
  class l extends s {
15
15
  body;
16
16
  /** Sanitized HTTP response body. */
17
- constructor(o, n, r, t) {
18
- super(o, n, t), this.name = new.target.name, this.body = E(r ?? void 0);
17
+ constructor(o, n, e, t) {
18
+ super(o, n, t), this.name = new.target.name, this.body = E(e ?? void 0);
19
19
  }
20
20
  }
21
- class m extends c {
21
+ class m extends i {
22
22
  }
23
23
  class y extends s {
24
24
  componentName;
25
25
  /** Vue component name, if available. */
26
26
  info;
27
27
  /** Vue error info string. */
28
- constructor(o, n, r, t, a) {
29
- super(o, n, a), this.name = new.target.name, this.info = r, this.componentName = t;
28
+ constructor(o, n, e, t, a) {
29
+ super(o, n, a), this.name = new.target.name, this.info = e, this.componentName = t;
30
30
  }
31
31
  }
32
32
  class b extends s {
33
33
  }
34
34
  class k extends s {
35
35
  }
36
- async function p(e, o, n) {
37
- const r = ` - ${e.statusText}`, t = `${o} Response status '${e.status}${e.statusText ? r : ""}' received.`;
36
+ async function p(r, o, n) {
37
+ const e = ` - ${r.statusText}`, t = `${o} Response status '${r.status}${r.statusText ? e : ""}' received.`;
38
38
  let a;
39
39
  try {
40
- a = await e.text();
40
+ a = await r.text();
41
41
  } catch (d) {
42
- a = `<body unavailable: ${i(d).message}>`;
42
+ a = `<body unavailable: ${c(d).message}>`;
43
43
  }
44
44
  return new l(t, n, a);
45
45
  }
46
- function h(e) {
47
- return e.map((o) => o.message).join(" ");
46
+ function h(r) {
47
+ return r.map((o) => o.message).join(" ");
48
48
  }
49
- function x(e) {
49
+ function x(r) {
50
50
  try {
51
- e();
51
+ r();
52
52
  } catch {
53
53
  }
54
54
  }
55
- function i(e) {
56
- if (e instanceof Error) return e;
57
- if (typeof e == "string") return new Error(e);
58
- if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint") return new Error(String(e));
59
- if (typeof e == "symbol") return new Error(e.description ?? "Unknown error");
60
- if (typeof e == "object")
55
+ function c(r) {
56
+ if (r instanceof Error) return r;
57
+ if (typeof r == "string") return new Error(r);
58
+ if (typeof r == "number" || typeof r == "boolean" || typeof r == "bigint") return new Error(String(r));
59
+ if (typeof r == "symbol") return new Error(r.description ?? "Unknown error");
60
+ if (typeof r == "object")
61
61
  try {
62
- return new Error(JSON.stringify(e));
62
+ return new Error(JSON.stringify(r));
63
63
  } catch {
64
64
  return new Error("Unknown error");
65
65
  }
66
66
  return new Error("Unknown error");
67
67
  }
68
- function R(e) {
68
+ function R(r) {
69
69
  const o = /* @__PURE__ */ new Set(), n = [];
70
- let r = i(e);
71
- for (; r != null && !o.has(r); ) {
72
- o.add(r);
70
+ let e = c(r);
71
+ for (; e != null && !o.has(e); ) {
72
+ o.add(e);
73
73
  let t;
74
- r instanceof l ? (t = { body: r.body, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : i(r.cause)) : r instanceof c ? (t = { body: void 0, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : i(r.cause)) : r instanceof Error ? (t = { body: void 0, locator: "", message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : i(r.cause)) : (t = { body: void 0, locator: "", message: g(r), name: "Error", stack: void 0 }, r = null), /(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), n.push(t);
74
+ e instanceof l ? (t = { body: e.body, locator: e.locator, message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : c(e.cause)) : e instanceof i ? (t = { body: void 0, locator: e.locator, message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : c(e.cause)) : e instanceof Error ? (t = { body: void 0, locator: "", message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : c(e.cause)) : (t = { body: void 0, locator: "", message: g(e), name: "Error", stack: void 0 }, e = null), /(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), n.push(t);
75
75
  }
76
76
  return n;
77
77
  }
78
- function O(e) {
79
- if (e.length === 0) return;
78
+ function O(r) {
79
+ if (r.length === 0) return;
80
80
  let o;
81
- console.log(1111, e);
82
- for (const n of e.toReversed()) {
81
+ console.log(1111, r);
82
+ for (const n of r.toReversed()) {
83
83
  console.log(2222, n);
84
- let r;
84
+ let e;
85
85
  if (n.body !== void 0)
86
- r = new l(n.message, n.locator, n.body, { cause: o });
86
+ e = new l(n.message, n.locator, n.body, { cause: o });
87
87
  else if (n.locator === "")
88
- r = new Error(n.message, { cause: o }), r.name = n.name;
88
+ e = new Error(n.message, { cause: o }), e.name = n.name;
89
89
  else
90
90
  switch (n.name) {
91
91
  case "APIError":
92
- r = new f(n.message, n.locator, { cause: o });
92
+ e = new f(n.message, n.locator, { cause: o });
93
93
  break;
94
94
  case "EngineError":
95
- r = new u(n.message, n.locator, { cause: o });
95
+ e = new u(n.message, n.locator, { cause: o });
96
96
  break;
97
97
  case "ApplicationError":
98
- r = new s(n.message, n.locator, { cause: o });
98
+ e = new s(n.message, n.locator, { cause: o });
99
99
  break;
100
100
  case "OperationalError":
101
- r = new m(n.message, n.locator, { cause: o });
101
+ e = new m(n.message, n.locator, { cause: o });
102
102
  break;
103
103
  // case 'WindowHandledRuntimeError':
104
104
  // error = new WindowHandledRuntimeError(serialised.message, serialised.locator, { cause });
@@ -107,25 +107,25 @@ function O(e) {
107
107
  // error = new WindowHandledPromiseRejectionError(serialised.message, serialised.locator, { cause });
108
108
  // break;
109
109
  default:
110
- r = new c(n.message, n.locator, { cause: o });
110
+ e = new i(n.message, n.locator, { cause: o });
111
111
  break;
112
112
  }
113
- n.stack !== void 0 && (r.stack = n.stack), o = r;
113
+ console.log(3333, e), n.stack !== void 0 && (e.stack = n.stack), o = e;
114
114
  }
115
115
  return o;
116
116
  }
117
- function g(e) {
117
+ function g(r) {
118
118
  let o;
119
119
  try {
120
- o = JSON.stringify(e);
120
+ o = JSON.stringify(r);
121
121
  } catch {
122
- typeof e == "symbol" ? o = e.description ?? "Unknown error" : typeof e == "bigint" ? o = e.toString() : o = "Unknown error";
122
+ typeof r == "symbol" ? o = r.description ?? "Unknown error" : typeof r == "bigint" ? o = r.toString() : o = "Unknown error";
123
123
  }
124
124
  return o === "" && (o = "Unknown error"), o;
125
125
  }
126
- function E(e) {
127
- if (!(e == null || e === ""))
128
- return e.length > 2048 ? `${e.slice(0, 2048)}... [truncated]` : e;
126
+ function E(r) {
127
+ if (!(r == null || r === ""))
128
+ return r.length > 2048 ? `${r.slice(0, 2048)}... [truncated]` : r;
129
129
  }
130
130
  export {
131
131
  f as APIError,
@@ -139,7 +139,7 @@ export {
139
139
  p as buildFetchError,
140
140
  h as concatenateSerialisedErrorMessages,
141
141
  x as ignoreErrors,
142
- i as normalizeToError,
142
+ c as normalizeToError,
143
143
  R as serialiseError,
144
144
  O as unserialiseError
145
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.544",
3
+ "version": "0.3.545",
4
4
  "description": "A library containing common constants, types and utilities used across all Data Positioning projects.",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Terrell <terrell.jm@gmail.com>",