@datapos/datapos-shared 0.3.551 → 0.3.552

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.
@@ -10,34 +10,37 @@ class i extends c {
10
10
  class g extends i {
11
11
  }
12
12
  class u extends i {
13
+ constructor(s, o, e) {
14
+ super(s, o, e), this.name = new.target.name;
15
+ }
13
16
  }
14
17
  class l extends i {
15
18
  body;
16
19
  /** Sanitized HTTP response body. */
17
- constructor(s, o, e, n) {
18
- super(s, o, n), this.name = new.target.name, this.body = d(e ?? void 0);
20
+ constructor(s, o, e, t) {
21
+ super(s, o, t), this.name = new.target.name, this.body = d(e ?? void 0);
19
22
  }
20
23
  }
21
24
  async function y(r, s, o) {
22
- const e = ` - ${r.statusText}`, n = `${s} Response status '${r.status}${r.statusText ? e : ""}' received.`;
25
+ const e = ` - ${r.statusText}`, t = `${s} Response status '${r.status}${r.statusText ? e : ""}' received.`;
23
26
  let a;
24
27
  try {
25
28
  a = await r.text();
26
29
  } catch (f) {
27
- a = `<body unavailable: ${t(f).message}>`;
30
+ a = `<body unavailable: ${n(f).message}>`;
28
31
  }
29
- return new l(n, o, a);
32
+ return new l(t, o, a);
30
33
  }
31
34
  function b(r) {
32
35
  return r.map((s) => s.message).join(" ");
33
36
  }
34
- function k(r) {
37
+ function w(r) {
35
38
  try {
36
39
  r();
37
40
  } catch {
38
41
  }
39
42
  }
40
- function t(r) {
43
+ function n(r) {
41
44
  if (r instanceof Error) return r;
42
45
  if (typeof r == "string") return new Error(r);
43
46
  if (typeof r == "number" || typeof r == "boolean" || typeof r == "bigint") return new Error(String(r));
@@ -50,13 +53,13 @@ function t(r) {
50
53
  }
51
54
  return new Error("Unknown error");
52
55
  }
53
- function w(r) {
56
+ function k(r) {
54
57
  const s = /* @__PURE__ */ new Set(), o = [];
55
- let e = t(r);
58
+ let e = n(r);
56
59
  for (; e != null && !s.has(e); ) {
57
60
  s.add(e);
58
- let n;
59
- e instanceof l ? (n = { body: e.body, locator: e.locator, message: e.message, name: "FetchError", stack: e.stack }, e = e.cause == null ? null : t(e.cause)) : e instanceof u ? (n = { body: void 0, locator: e.locator, message: e.message, name: "EngineError", stack: e.stack }, e = e.cause == null ? null : t(e.cause)) : e instanceof c ? (n = { body: void 0, locator: e.locator, message: e.message, name: "DataPosError", stack: e.stack }, e = e.cause == null ? null : t(e.cause)) : e instanceof Error ? (n = { body: void 0, locator: "", message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : t(e.cause)) : (n = { body: void 0, locator: "", message: E(e), name: "Error", stack: void 0 }, e = null), /(?:\.{3}|[.!?])$/.test(n.message) || (n.message += "."), o.push(n);
61
+ let t;
62
+ e instanceof l ? (t = { body: e.body, locator: e.locator, message: e.message, name: "FetchError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof u ? (t = { body: void 0, locator: e.locator, message: e.message, name: "EngineError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof c ? (t = { body: void 0, locator: e.locator, message: e.message, name: "DataPosError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof Error ? (t = { body: void 0, locator: "", message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : (t = { body: void 0, locator: "", message: E(e), name: "Error", stack: void 0 }, e = null), /(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), o.push(t);
60
63
  }
61
64
  return o;
62
65
  }
@@ -116,8 +119,8 @@ export {
116
119
  l as FetchError,
117
120
  y as buildFetchError,
118
121
  b as concatenateSerialisedErrorMessages,
119
- k as ignoreErrors,
120
- t as normalizeToError,
121
- w as serialiseError,
122
+ w as ignoreErrors,
123
+ n as normalizeToError,
124
+ k as serialiseError,
122
125
  h as unserialiseError
123
126
  };
@@ -30,6 +30,7 @@ declare class APIError extends ApplicationError {
30
30
  }
31
31
  /** Represents engine or core processing failures. */
32
32
  declare class EngineError extends ApplicationError {
33
+ constructor(message: string, locator: string, options?: ErrorOptions);
33
34
  }
34
35
  /** Represents failures during HTTP requests.
35
36
  * Includes a sanitized snapshot of the response body for diagnostic purposes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.551",
3
+ "version": "0.3.552",
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>",