@datapos/datapos-shared 0.3.304 → 0.3.306

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,17 +1,17 @@
1
- const x = ["createObject", "dropObject", "removeRecords", "upsertRecords"], N = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"];
2
- function w() {
1
+ const x = ["createObject", "dropObject", "removeRecords", "upsertRecords"], w = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"];
2
+ function N() {
3
3
  function e(n, t, r) {
4
4
  r.textContent = "Cytoscape.js diagram goes here...";
5
5
  }
6
6
  return { render: e };
7
7
  }
8
- function S() {
8
+ function y() {
9
9
  function e(n, t) {
10
10
  console.log(1111, n), console.log(2222, t), console.log(3333, t.childNodes), console.log(4444, t.children);
11
11
  }
12
12
  return { render: e };
13
13
  }
14
- const T = 0, y = (e) => e, D = () => Date.now();
14
+ const S = 0, T = (e) => e, D = () => Date.now();
15
15
  class u extends Error {
16
16
  locator;
17
17
  constructor(n, t, r) {
@@ -23,12 +23,12 @@ class l extends u {
23
23
  super(n, t, r), this.name = "ApplicationError";
24
24
  }
25
25
  }
26
- class v extends l {
26
+ class O extends l {
27
27
  constructor(n, t, r) {
28
28
  super(n, t, r), this.name = "APIError";
29
29
  }
30
30
  }
31
- class O extends l {
31
+ class $ extends l {
32
32
  constructor(n, t, r) {
33
33
  super(n, t, r), this.name = "EngineError";
34
34
  }
@@ -46,12 +46,12 @@ class g extends l {
46
46
  super(n, t, s), this.name = "VueHandledError", this.info = r, this.componentName = o;
47
47
  }
48
48
  }
49
- class $ extends l {
49
+ class I extends l {
50
50
  constructor(n, t, r) {
51
51
  super(n, t, r), this.name = "WindowHandledRuntimeError";
52
52
  }
53
53
  }
54
- class I extends l {
54
+ class v extends l {
55
55
  constructor(n, t, r) {
56
56
  super(n, t, r), this.name = "WindowHandledPromiseRejectionError";
57
57
  }
@@ -68,14 +68,18 @@ async function C(e, n, t) {
68
68
  function F(e) {
69
69
  return e.map((n) => n.message).join(" ");
70
70
  }
71
- function R(e, n = "Unknown error.") {
71
+ function R(e) {
72
72
  if (e instanceof Error) return e;
73
73
  if (typeof e == "string") return new Error(e);
74
- try {
75
- return new Error(JSON.stringify(e ?? n));
76
- } catch {
77
- return new Error(n);
78
- }
74
+ if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint") return new Error(String(e));
75
+ if (typeof e == "symbol") return new Error(e.description ?? "Unknown error");
76
+ if (e && typeof e == "object")
77
+ try {
78
+ return new Error(JSON.stringify(e));
79
+ } catch {
80
+ return new Error("Unknown error");
81
+ }
82
+ return new Error("Unknown error");
79
83
  }
80
84
  function k(e) {
81
85
  const n = /* @__PURE__ */ new Set(), t = [];
@@ -255,21 +259,21 @@ const b = [
255
259
  return t ? { ...t, label: t.label[n] || t.label[i] || e } : { id: e, color: "other", label: e };
256
260
  }, i = "en-gb";
257
261
  export {
258
- v as APIError,
262
+ O as APIError,
259
263
  l as ApplicationError,
260
264
  x as CONNECTOR_DESTINATION_OPERATIONS,
261
- N as CONNECTOR_SOURCE_OPERATIONS,
265
+ w as CONNECTOR_SOURCE_OPERATIONS,
262
266
  i as DEFAULT_LOCALE_CODE,
263
- T as DefaultTimestamp,
264
- O as EngineError,
267
+ S as DefaultTimestamp,
268
+ $ as EngineError,
265
269
  m as FetchError,
266
270
  A as OperationalError,
267
271
  g as VueError,
268
- I as WindowPromiseRejectionError,
269
- $ as WindowRuntimeError,
272
+ v as WindowPromiseRejectionError,
273
+ I as WindowRuntimeError,
270
274
  C as buildFetchError,
271
275
  F as concatenateSerialisedErrorMessages,
272
- y as convertMillisecondsToTimestamp,
276
+ T as convertMillisecondsToTimestamp,
273
277
  B as convertODataTypeIdToUsageTypeId,
274
278
  j as extractExtensionFromPath,
275
279
  M as extractNameFromPath,
@@ -286,6 +290,6 @@ export {
286
290
  W as lookupMimeTypeForExtension,
287
291
  R as normalizeToError,
288
292
  k as serialiseError,
289
- w as useCytoscapeJS,
290
- S as useDataTable
293
+ N as useCytoscapeJS,
294
+ y as useDataTable
291
295
  };
@@ -1,3 +1,4 @@
1
+ /** Interfaces/Types - Serialised error data. */
1
2
  export interface SerialisedError {
2
3
  body?: string;
3
4
  componentName?: string;
@@ -7,43 +8,56 @@ export interface SerialisedError {
7
8
  name: string;
8
9
  stack?: string;
9
10
  }
11
+ /** Classes - Base Data Positioning error. */
10
12
  declare class DataPosError extends Error {
11
13
  locator: string;
12
14
  constructor(message: string, locator: string, options?: ErrorOptions);
13
15
  }
16
+ /** Classes - Base application error. */
14
17
  export declare class ApplicationError extends DataPosError {
15
18
  constructor(message: string, locator: string, options?: ErrorOptions);
16
19
  }
20
+ /** Classes - Application Error - API error. */
17
21
  export declare class APIError extends ApplicationError {
18
22
  constructor(message: string, locator: string, options?: ErrorOptions);
19
23
  }
24
+ /** Classes - Application Error - Engine Error */
20
25
  export declare class EngineError extends ApplicationError {
21
26
  constructor(message: string, locator: string, options?: ErrorOptions);
22
27
  }
28
+ /** Classes - Application Error - Fetch error. */
23
29
  export declare class FetchError extends ApplicationError {
24
30
  body: string;
25
31
  constructor(message: string, locator: string, body: string, options?: ErrorOptions);
26
32
  }
33
+ /** Classes - Application Error - Vue error. */
27
34
  export declare class VueError extends ApplicationError {
28
35
  componentName?: string;
29
36
  info: string;
30
37
  constructor(message: string, locator: string, info: string, componentName?: string, options?: ErrorOptions);
31
38
  }
39
+ /** Classes - Application Error - Window runtime error. */
32
40
  export declare class WindowRuntimeError extends ApplicationError {
33
41
  constructor(message: string, locator: string, options?: ErrorOptions);
34
42
  }
43
+ /** Classes - Application Error - Window promise rejection error. */
35
44
  export declare class WindowPromiseRejectionError extends ApplicationError {
36
45
  constructor(message: string, locator: string, options?: ErrorOptions);
37
46
  }
47
+ /** Classes - Operational error. */
38
48
  export declare class OperationalError extends DataPosError {
39
49
  constructor(message: string, locator: string, options?: ErrorOptions);
40
50
  }
51
+ /** Utilities - Build fetch error. */
41
52
  export declare function buildFetchError(response: {
42
53
  status: number;
43
54
  statusText: string;
44
55
  text: () => Promise<string>;
45
56
  }, message: string, locator: string): Promise<FetchError>;
57
+ /** Utilities - Concatenate serialised error messages. */
46
58
  export declare function concatenateSerialisedErrorMessages(serialisedErrors: SerialisedError[]): string;
47
- export declare function normalizeToError(value: unknown, fallbackMessage?: string): Error;
59
+ /** Utilities - Normalise to error. */
60
+ export declare function normalizeToError(value: unknown): Error;
61
+ /** Utilities - Serialise error. */
48
62
  export declare function serialiseError(error?: unknown): SerialisedError[];
49
63
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.304",
3
+ "version": "0.3.306",
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>",