@datapos/datapos-shared 0.3.566 → 0.3.568

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,46 +1,46 @@
1
1
  class c extends Error {
2
2
  locator;
3
3
  // Logical source of the error
4
- constructor(o, s, r) {
5
- super(o, r), this.name = "DPUError", this.locator = s;
4
+ constructor(s, o, r) {
5
+ super(s, r), this.name = "DPUError", this.locator = o;
6
6
  }
7
7
  }
8
8
  class E extends c {
9
9
  body;
10
10
  // Sanitized snapshot of the response body
11
- constructor(o, s, r, t) {
12
- super(o, s, t), this.name = "APIError", this.body = l(r ?? void 0);
11
+ constructor(s, o, r, t) {
12
+ super(s, o, t), this.name = "APIError", this.body = l(r ?? void 0);
13
13
  }
14
14
  }
15
15
  class d extends c {
16
- constructor(o, s, r) {
17
- super(o, s, r), this.name = "EngineError";
16
+ constructor(s, o, r) {
17
+ super(s, o, r), this.name = "EngineError";
18
18
  }
19
19
  }
20
20
  class m extends c {
21
- constructor(o, s, r) {
22
- super(o, s, r), this.name = "ConnectorError";
21
+ constructor(s, o, r) {
22
+ super(s, o, r), this.name = "ConnectorError";
23
23
  }
24
24
  }
25
25
  class i extends c {
26
26
  body;
27
27
  // Sanitized snapshot of the response body
28
- constructor(o, s, r, t) {
29
- super(o, s, t), this.name = "FetchError", this.body = l(r ?? void 0);
28
+ constructor(s, o, r, t) {
29
+ super(s, o, t), this.name = "FetchError", this.body = l(r ?? void 0);
30
30
  }
31
31
  }
32
- async function b(e, o, s) {
33
- const r = ` - ${e.statusText}`, t = `${o} Response status '${e.status}${e.statusText ? r : ""}' received.`;
32
+ async function y(e, s, o) {
33
+ const r = ` - ${e.statusText}`, t = `${s} Response status '${e.status}${e.statusText ? r : ""}' received.`;
34
34
  let n;
35
35
  try {
36
36
  n = await e.text();
37
37
  } catch (u) {
38
38
  n = `<body unavailable: ${a(u).message}>`;
39
39
  }
40
- return new i(t, s, n);
40
+ return new i(t, o, n);
41
41
  }
42
- function y(e) {
43
- return e.map((o) => o.message).join(" ");
42
+ function b(e) {
43
+ return e.map((s) => s.message).join(" ");
44
44
  }
45
45
  function k(e) {
46
46
  try {
@@ -62,20 +62,19 @@ function a(e) {
62
62
  return new Error("Unknown error");
63
63
  }
64
64
  function h(e) {
65
- const o = /* @__PURE__ */ new Set(), s = [];
65
+ const s = /* @__PURE__ */ new Set(), o = [];
66
66
  let r = a(e);
67
- for (; r != null && !o.has(r); ) {
68
- o.add(r);
67
+ for (; r != null && !s.has(r); ) {
68
+ s.add(r);
69
69
  let t;
70
- switch (console.log("0000", r), r.name) {
70
+ switch (r.name) {
71
71
  case "APIError": {
72
72
  const n = r;
73
73
  t = { body: n.body, locator: n.locator, message: r.message, name: "APIError", stack: r.stack }, r = r.cause == null ? null : a(r.cause);
74
74
  break;
75
75
  }
76
76
  case "ConnectorError": {
77
- const n = r;
78
- console.log(1111, n.locator), t = { body: void 0, locator: n.locator, message: r.message, name: "ConnectorError", stack: r.stack }, r = r.cause == null ? null : a(r.cause);
77
+ t = { body: void 0, locator: r.locator, message: r.message, name: "ConnectorError", stack: r.stack }, r = r.cause == null ? null : a(r.cause);
79
78
  break;
80
79
  }
81
80
  case "EngineError": {
@@ -92,52 +91,52 @@ function h(e) {
92
91
  break;
93
92
  }
94
93
  case "Error":
95
- t = { body: void 0, locator: "", message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : a(r.cause);
94
+ console.log(7777, r), t = { body: void 0, locator: "", message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : a(r.cause);
96
95
  break;
97
96
  default:
98
- t = { body: void 0, locator: "", message: g(r), name: "Error", stack: void 0 }, r = null;
97
+ console.log(8888, r), t = { body: void 0, locator: "", message: g(r), name: "Error", stack: void 0 }, r = null;
99
98
  }
100
- /(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), s.push(t);
99
+ /(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), o.push(t);
101
100
  }
102
- return s;
101
+ return console.log(4444, o), o;
103
102
  }
104
103
  function p(e) {
105
104
  if (e.length === 0) return;
106
- let o;
107
- for (const s of e.toReversed()) {
105
+ let s;
106
+ for (const o of e.toReversed()) {
108
107
  let r;
109
- switch (s.name) {
108
+ switch (o.name) {
110
109
  case "APIError":
111
- r = new E(s.message, s.locator, s.body, { cause: o });
110
+ r = new E(o.message, o.locator, o.body, { cause: s });
112
111
  break;
113
112
  case "ConnectorError":
114
- console.log(2222, s.locator), r = new m(s.message, s.locator, { cause: o });
113
+ r = new m(o.message, o.locator, { cause: s });
115
114
  break;
116
115
  case "EngineError":
117
- r = new d(s.message, s.locator, { cause: o });
116
+ r = new d(o.message, o.locator, { cause: s });
118
117
  break;
119
118
  case "FetchError":
120
- r = new i(s.message, s.locator, s.body, { cause: o });
119
+ r = new i(o.message, o.locator, o.body, { cause: s });
121
120
  break;
122
121
  case "DPUError":
123
- r = new c(s.message, s.locator, { cause: o });
122
+ r = new c(o.message, o.locator, { cause: s });
124
123
  break;
125
124
  default:
126
- r = new Error(s.message, { cause: o }), r.name = s.name;
125
+ console.log(5555, o), r = new Error(o.message, { cause: s }), r.name = o.name;
127
126
  break;
128
127
  }
129
- s.stack !== void 0 && (r.stack = s.stack), o = r;
128
+ o.stack !== void 0 && (r.stack = o.stack), s = r;
130
129
  }
131
- return o;
130
+ return s;
132
131
  }
133
132
  function g(e) {
134
- let o;
133
+ let s;
135
134
  try {
136
- o = JSON.stringify(e);
135
+ s = JSON.stringify(e);
137
136
  } catch {
138
- typeof e == "symbol" ? o = e.description ?? "Unknown error" : typeof e == "bigint" ? o = e.toString() : o = "Unknown error";
137
+ typeof e == "symbol" ? s = e.description ?? "Unknown error" : typeof e == "bigint" ? s = e.toString() : s = "Unknown error";
139
138
  }
140
- return o === "" && (o = "Unknown error"), o;
139
+ return s === "" && (s = "Unknown error"), s;
141
140
  }
142
141
  function l(e) {
143
142
  if (!(e == null || e === ""))
@@ -149,8 +148,8 @@ export {
149
148
  c as DPUError,
150
149
  d as EngineError,
151
150
  i as FetchError,
152
- b as buildFetchError,
153
- y as concatenateSerialisedErrorMessages,
151
+ y as buildFetchError,
152
+ b as concatenateSerialisedErrorMessages,
154
153
  k as ignoreErrors,
155
154
  a as normalizeToError,
156
155
  h as serialiseError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.566",
3
+ "version": "0.3.568",
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>",