@datapos/datapos-shared 0.3.577 → 0.3.579

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