@datapos/datapos-shared 0.3.543 → 0.3.544

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