@datapos/datapos-shared 0.3.192 → 0.3.193

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,21 +1,21 @@
1
1
  const F = ["createObject", "dropObject", "removeRecords", "upsertRecords"], U = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"];
2
2
  function P() {
3
- function e(a, r, t) {
4
- t.textContent = "Cytoscape.js diagram goes here...";
3
+ function e(a, t, r) {
4
+ r.textContent = "Cytoscape.js diagram goes here...";
5
5
  }
6
6
  return { render: e };
7
7
  }
8
8
  function B() {
9
- function e(a, r, t) {
10
- t.textContent = "values table goes here...";
9
+ function e(a, t, r) {
10
+ r.textContent = "values table goes here...";
11
11
  }
12
12
  return { render: e };
13
13
  }
14
14
  const v = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", I = "highcharts";
15
- let b, T = !1;
15
+ let b, D = !1;
16
16
  function W() {
17
17
  async function e(n, s, m, h) {
18
- await t();
18
+ await r();
19
19
  const l = [];
20
20
  for (const c of s.data.measures)
21
21
  l.push({ type: n.options.highchartsType, name: c.name, data: c.data });
@@ -30,7 +30,7 @@ function W() {
30
30
  return { chart: u, resize: () => u.reflow(), vendorId: I };
31
31
  }
32
32
  async function a(n, s, m, h) {
33
- await Promise.all([t(), o()]);
33
+ await Promise.all([r(), o()]);
34
34
  const l = [];
35
35
  for (const c of s.data.measures)
36
36
  l.push({ type: n.options.highchartsType, name: c.name, data: c.data });
@@ -44,8 +44,8 @@ function W() {
44
44
  }, u = b.chart(m, p, h);
45
45
  return { chart: u, resize: () => u.reflow(), vendorId: I };
46
46
  }
47
- async function r(n, s, m, h) {
48
- await Promise.all([t(), o()]);
47
+ async function t(n, s, m, h) {
48
+ await Promise.all([r(), o()]);
49
49
  const l = [], p = [];
50
50
  for (let f = 0; f < s.data.measures[0].data.length; f++)
51
51
  p.push([s.data.measures[0].data[f][0], s.data.measures[1].data[f][0]]);
@@ -60,7 +60,7 @@ function W() {
60
60
  }, c = b.chart(m, u, h);
61
61
  return { chart: c, resize: () => c.reflow(), vendorId: I };
62
62
  }
63
- async function t() {
63
+ async function r() {
64
64
  if (b) return;
65
65
  const n = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", s = `${n}highcharts.src.js`, m = `${n}modules/accessibility.src.js`;
66
66
  b = (await import(
@@ -72,29 +72,28 @@ function W() {
72
72
  );
73
73
  }
74
74
  async function o() {
75
- if (T) return;
76
- await import(`${v}highcharts-more.src.js`), T = !0;
75
+ if (D) return;
76
+ await import(`${v}highcharts-more.src.js`), D = !0;
77
77
  }
78
- return { renderCartesianChart: e, renderPolarChart: a, renderRangeChart: r };
78
+ return { renderCartesianChart: e, renderPolarChart: a, renderRangeChart: t };
79
79
  }
80
80
  const A = 4, O = `https://cdn.jsdelivr.net/npm/micromark@${A}/+esm`, w = 1, N = `https://cdn.jsdelivr.net/npm/prismjs@${w}/+esm`, _ = `https://cdn.jsdelivr.net/npm/prismjs@${w}/components/prism-javascript.min.js`, C = `https://cdn.jsdelivr.net/npm/prismjs@${w}/components/prism-json.min.js`;
81
81
  let x;
82
82
  function H() {
83
83
  async function e() {
84
- return await r(), { micromark: x };
84
+ return await t(), { micromark: x };
85
85
  }
86
86
  async function a() {
87
- await r();
87
+ await t();
88
88
  }
89
- async function r() {
90
- if (x) return;
91
- x = (await Promise.all([import(
89
+ async function t() {
90
+ x || (x = (await Promise.all([import(
92
91
  /* @vite-ignore */
93
92
  O
94
93
  ), import(
95
94
  /* @vite-ignore */
96
95
  N
97
- )]))[0].micromark, await Promise.all([import(
96
+ )]))[0].micromark, !globalThis.Prism) || await Promise.all([import(
98
97
  /* @vite-ignore */
99
98
  _
100
99
  ), import(
@@ -123,63 +122,63 @@ const V = 0, z = (e) => e, X = () => Date.now(), G = {
123
122
  streamgraph: { categoryId: "streamgraph", label: { "en-gb": "Streamgraph" }, options: {} },
124
123
  values: { categoryId: "values", label: { "en-gb": "Values" }, options: {} }
125
124
  };
126
- class D extends Error {
125
+ class T extends Error {
127
126
  locator;
128
- constructor(a, r, t) {
129
- super(a, t), this.name = "DataPosError", this.locator = r, Error.captureStackTrace?.(this, new.target);
127
+ constructor(a, t, r) {
128
+ super(a, r), this.name = "DataPosError", this.locator = t, Error.captureStackTrace?.(this, new.target);
130
129
  }
131
130
  }
132
- class g extends D {
133
- constructor(a, r, t) {
134
- super(a, r, t), this.name = "ApplicationError";
131
+ class g extends T {
132
+ constructor(a, t, r) {
133
+ super(a, t, r), this.name = "ApplicationError";
135
134
  }
136
135
  }
137
136
  class J extends g {
138
- constructor(a, r, t) {
139
- super(a, r, t), this.name = "APIError";
137
+ constructor(a, t, r) {
138
+ super(a, t, r), this.name = "APIError";
140
139
  }
141
140
  }
142
141
  class K extends g {
143
- constructor(a, r, t) {
144
- super(a, r, t), this.name = "EngineError";
142
+ constructor(a, t, r) {
143
+ super(a, t, r), this.name = "EngineError";
145
144
  }
146
145
  }
147
146
  class R extends g {
148
147
  body;
149
- constructor(a, r, t, o) {
150
- super(a, r, o), this.name = "FetchError", this.body = t;
148
+ constructor(a, t, r, o) {
149
+ super(a, t, o), this.name = "FetchError", this.body = r;
151
150
  }
152
151
  }
153
152
  class L extends g {
154
153
  componentName;
155
154
  info;
156
- constructor(a, r, t, o, n) {
157
- super(a, r, n), this.name = "VueHandledError", this.info = t, this.componentName = o;
155
+ constructor(a, t, r, o, n) {
156
+ super(a, t, n), this.name = "VueHandledError", this.info = r, this.componentName = o;
158
157
  }
159
158
  }
160
159
  class q extends g {
161
- constructor(a, r, t) {
162
- super(a, r, t), this.name = "WindowHandledRuntimeError";
160
+ constructor(a, t, r) {
161
+ super(a, t, r), this.name = "WindowHandledRuntimeError";
163
162
  }
164
163
  }
165
164
  class Q extends g {
166
- constructor(a, r, t) {
167
- super(a, r, t), this.name = "WindowHandledPromiseRejectionError";
165
+ constructor(a, t, r) {
166
+ super(a, t, r), this.name = "WindowHandledPromiseRejectionError";
168
167
  }
169
168
  }
170
- class Y extends D {
171
- constructor(a, r, t) {
172
- super(a, r, t), this.name = "OperationalError";
169
+ class Y extends T {
170
+ constructor(a, t, r) {
171
+ super(a, t, r), this.name = "OperationalError";
173
172
  }
174
173
  }
175
- async function Z(e, a, r) {
176
- const t = `${a} Response status '${e.status}${e.statusText ? ` - ${e.statusText}` : ""}' received.`, o = await e.text();
177
- return new R(t, r, o);
174
+ async function Z(e, a, t) {
175
+ const r = `${a} Response status '${e.status}${e.statusText ? ` - ${e.statusText}` : ""}' received.`, o = await e.text();
176
+ return new R(r, t, o);
178
177
  }
179
178
  function ee(e) {
180
179
  return e.map((a) => a.message).join(" ");
181
180
  }
182
- function te(e, a = "Unknown error.") {
181
+ function re(e, a = "Unknown error.") {
183
182
  if (e instanceof Error) return e;
184
183
  if (typeof e == "string") return new Error(e);
185
184
  try {
@@ -188,25 +187,25 @@ function te(e, a = "Unknown error.") {
188
187
  return new Error(a);
189
188
  }
190
189
  }
191
- function re(e) {
192
- const a = /* @__PURE__ */ new Set(), r = [];
193
- let t = e;
194
- for (; t && !a.has(t); ) {
195
- a.add(t);
190
+ function te(e) {
191
+ const a = /* @__PURE__ */ new Set(), t = [];
192
+ let r = e;
193
+ for (; r && !a.has(r); ) {
194
+ a.add(r);
196
195
  let o;
197
- if (t instanceof R)
198
- o = { body: t.body, locator: t.locator, message: t.message, name: t.name, stack: t.stack }, t = t.cause;
199
- else if (t instanceof L)
200
- o = { componentName: t.componentName, info: t.info, locator: t.locator, message: t.message, name: t.name, stack: t.stack }, t = t.cause;
201
- else if (t instanceof D)
202
- o = { locator: t.locator, message: t.message, name: t.name, stack: t.stack }, t = t.cause;
203
- else if (t instanceof Error) {
204
- const n = t;
205
- o = { locator: "", message: n.message, name: n.name, stack: n.stack }, t = n.cause;
206
- } else t ? (o = { locator: "", message: String(t), name: "Error" }, t = void 0) : (o = { locator: "", message: "Unknown error.", name: "Error" }, t = void 0);
207
- /(?:\.{3}|[.!?])$/.test(o.message) || (o.message += "."), r.push(o);
196
+ if (r instanceof R)
197
+ o = { body: r.body, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
198
+ else if (r instanceof L)
199
+ o = { componentName: r.componentName, info: r.info, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
200
+ else if (r instanceof T)
201
+ o = { locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
202
+ else if (r instanceof Error) {
203
+ const n = r;
204
+ o = { locator: "", message: n.message, name: n.name, stack: n.stack }, r = n.cause;
205
+ } else r ? (o = { locator: "", message: String(r), name: "Error" }, r = void 0) : (o = { locator: "", message: "Unknown error.", name: "Error" }, r = void 0);
206
+ /(?:\.{3}|[.!?])$/.test(o.message) || (o.message += "."), t.push(o);
208
207
  }
209
- return r;
208
+ return t;
210
209
  }
211
210
  const S = "en-US", y = {}, ae = (e) => {
212
211
  switch (e) {
@@ -249,38 +248,38 @@ const S = "en-US", y = {}, ae = (e) => {
249
248
  }
250
249
  }, ne = (e) => {
251
250
  if (e) {
252
- const a = e.lastIndexOf("/"), r = e.lastIndexOf(".", a > -1 ? a : e.length);
253
- return r > -1 ? e.substring(0, r) : e;
251
+ const a = e.lastIndexOf("/"), t = e.lastIndexOf(".", a > -1 ? a : e.length);
252
+ return t > -1 ? e.substring(0, t) : e;
254
253
  }
255
254
  }, oe = (e) => {
256
255
  if (e) {
257
256
  const a = e.lastIndexOf(".");
258
257
  if (a > -1) return e.substring(a + 1);
259
258
  }
260
- }, i = (e, a = 2, r = a, t = S) => {
259
+ }, i = (e, a = 2, t = a, r = S) => {
261
260
  if (e == null) return "";
262
- const o = `${t}decimal${a}.${r}`;
261
+ const o = `${r}decimal${a}.${t}`;
263
262
  let n = y[o];
264
- return n || (n = new Intl.NumberFormat(t, {
263
+ return n || (n = new Intl.NumberFormat(r, {
265
264
  localeMatcher: "best fit",
266
265
  maximumFractionDigits: a,
267
- minimumFractionDigits: r,
266
+ minimumFractionDigits: t,
268
267
  minimumIntegerDigits: 1,
269
268
  style: "decimal",
270
269
  useGrouping: !0
271
270
  }), y[o] = n), n.format(e);
272
271
  }, se = (e) => e == null ? "" : e < 1e3 ? E(e) : e < 1e6 ? `${i(e / 1e3, 2, 0)}K` : e < 1e9 ? `${i(e / 1e6, 2, 0)}M` : e < 1e12 ? `${i(e / 1e9, 2, 0)}B` : `${i(e / 1e12, 2, 0)}T`, ie = (e) => e == null ? "" : e === 1 ? "1 byte" : e < 1024 ? `${E(e)} bytes` : e < 1048576 ? `${i(e / 1024, 2, 0)} KB` : e < 1073741824 ? `${i(e / 1048576, 2, 0)} MB` : e < 1099511627776 ? `${i(e / 1073741824, 2, 0)} GB` : `${i(e / 1099511627776, 2, 0)} TB`, le = (e) => e == null ? "" : e < 1e3 ? `${E(e)} ms` : e === 1e3 ? `${E(e)} sec` : e < 6e4 ? `${i(e / 1e3, 2, 0)} secs` : e === 6e4 ? "1 min" : e < 36e5 ? `${i(e / 6e4, 2, 0)} mins` : e === 36e5 ? "1 hr" : e < 864e5 ? `${i(e / 36e5, 2, 0)} hrs` : e === 864e5 ? "1 day" : `${i(e / 864e5, 2, 0)} days`, E = (e, a = S) => {
273
272
  if (e == null) return "";
274
- const r = `${a}decimal0.0`;
275
- let t = y[r];
276
- return t || (t = new Intl.NumberFormat(a, {
273
+ const t = `${a}decimal0.0`;
274
+ let r = y[t];
275
+ return r || (r = new Intl.NumberFormat(a, {
277
276
  localeMatcher: "best fit",
278
277
  maximumFractionDigits: 0,
279
278
  minimumFractionDigits: 0,
280
279
  minimumIntegerDigits: 1,
281
280
  style: "decimal",
282
281
  useGrouping: !0
283
- }), y[r] = t), t.format(e);
282
+ }), y[t] = r), r.format(e);
284
283
  }, ce = (e) => {
285
284
  switch (e) {
286
285
  case "csv":
@@ -305,7 +304,7 @@ const S = "en-US", y = {}, ae = (e) => {
305
304
  { id: "xml", label: { "en-gb": "XML" } }
306
305
  ], de = (e = d) => {
307
306
  const a = [];
308
- for (const r of $) a.push({ ...r, label: r.label[e] || r.label[d] || r.id });
307
+ for (const t of $) a.push({ ...t, label: t.label[e] || t.label[d] || t.id });
309
308
  return a;
310
309
  }, M = [
311
310
  { id: `
@@ -315,8 +314,8 @@ const S = "en-US", y = {}, ae = (e) => {
315
314
  `, label: { "en-gb": "Carriage Return/Newline" } }
316
315
  ], me = (e = d) => {
317
316
  const a = [];
318
- for (const r of M)
319
- a.push({ ...r, label: r.label[e] || r.label[d] || r.id });
317
+ for (const t of M)
318
+ a.push({ ...t, label: t.label[e] || t.label[d] || t.id });
320
319
  return a;
321
320
  }, j = [
322
321
  { id: ":", label: { "en-gb": "Colon" } },
@@ -332,8 +331,8 @@ const S = "en-US", y = {}, ae = (e) => {
332
331
  { id: "|", label: { "en-gb": "Vertical Bar" } }
333
332
  ], ue = (e = d) => {
334
333
  const a = [];
335
- for (const r of j)
336
- a.push({ ...r, label: r.label[e] || r.label[d] || r.id });
334
+ for (const t of j)
335
+ a.push({ ...t, label: t.label[e] || t.label[d] || t.id });
337
336
  return a;
338
337
  }, k = [
339
338
  { id: "alpha", color: "red", label: { "en-gb": "alpha" } },
@@ -346,8 +345,8 @@ const S = "en-US", y = {}, ae = (e) => {
346
345
  { id: "unavailable", color: "other", label: { "en-gb": "unavailable" } },
347
346
  { id: "underReview", color: "other", label: { "en-gb": "under-review" } }
348
347
  ], pe = (e, a = d) => {
349
- const r = k.find((t) => t.id === e);
350
- return r ? { ...r, label: r.label[a] || r.label[d] || e } : { id: e, color: "other", label: e };
348
+ const t = k.find((r) => r.id === e);
349
+ return t ? { ...t, label: t.label[a] || t.label[d] || e } : { id: e, color: "other", label: e };
351
350
  }, d = "en-gb";
352
351
  export {
353
352
  J as APIError,
@@ -379,9 +378,9 @@ export {
379
378
  me as getRecordDelimiters,
380
379
  ue as getValueDelimiters,
381
380
  ce as lookupMimeTypeForExtension,
382
- te as normalizeToError,
381
+ re as normalizeToError,
383
382
  G as presentationViewTypeMap,
384
- re as serialiseError,
383
+ te as serialiseError,
385
384
  P as useCytoscapeJS,
386
385
  B as useDataTable,
387
386
  W as useHighcharts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.192",
3
+ "version": "0.3.193",
4
4
  "description": "A TypeScript library containing common declarations and utilities used across other Data Positioning repositories.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -28,15 +28,12 @@
28
28
  "csv-parse": "^6.1.0",
29
29
  "date-fns": "^4.1.0",
30
30
  "highcharts": "^12.4.0",
31
- "markdown-it": "^14.1.0",
32
31
  "micromark": "^4.0.2",
33
32
  "nanoid": "^5.1.6",
34
- "prismjs": "^1.30.0",
35
33
  "zod": "^4.1.12"
36
34
  },
37
35
  "devDependencies": {
38
36
  "@datapos/datapos-development": "^0.3.66",
39
- "@types/markdown-it": "^14.1.2",
40
37
  "@types/node": "^24.10.0",
41
38
  "@types/prismjs": "^1.26.5",
42
39
  "@typescript-eslint/eslint-plugin": "^8.46.3",