@datapos/datapos-shared 0.3.95 → 0.3.96

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,4 +1,4 @@
1
- const C = 0, R = (e) => e, F = () => Date.now(), L = {
1
+ const R = 0, F = (e) => e, L = () => Date.now(), k = {
2
2
  cartesian_area: { categoryId: "cartesian", typeId: "area", label: { "en-gb": "Area" }, options: { highchartsType: "area" } },
3
3
  cartesian_bar: { categoryId: "cartesian", typeId: "bar", label: { "en-gb": "Bar" }, options: { highchartsType: "bar" } },
4
4
  cartesian_column: { categoryId: "cartesian", typeId: "column", label: { "en-gb": "Column" }, options: { highchartsType: "column" } },
@@ -14,63 +14,63 @@ const C = 0, R = (e) => e, F = () => Date.now(), L = {
14
14
  streamgraph: { categoryId: "streamgraph", label: { "en-gb": "Streamgraph" }, options: {} },
15
15
  values: { categoryId: "values", label: { "en-gb": "Values" }, options: {} }
16
16
  };
17
- class x extends Error {
17
+ class I extends Error {
18
18
  locator;
19
19
  constructor(t, a, r) {
20
20
  super(t, r), this.name = "DataPosError", this.locator = a, Error.captureStackTrace?.(this, new.target);
21
21
  }
22
22
  }
23
- class m extends x {
23
+ class p extends I {
24
24
  constructor(t, a, r) {
25
25
  super(t, a, r), this.name = "ApplicationError";
26
26
  }
27
27
  }
28
- class k extends m {
28
+ class O extends p {
29
29
  constructor(t, a, r) {
30
30
  super(t, a, r), this.name = "APIError";
31
31
  }
32
32
  }
33
- class M extends m {
33
+ class _ extends p {
34
34
  constructor(t, a, r) {
35
35
  super(t, a, r), this.name = "EngineError";
36
36
  }
37
37
  }
38
- class w extends m {
38
+ class D extends p {
39
39
  body;
40
40
  constructor(t, a, r, o) {
41
41
  super(t, a, o), this.name = "FetchError", this.body = r;
42
42
  }
43
43
  }
44
- class T extends m {
44
+ class v extends p {
45
45
  componentName;
46
46
  info;
47
47
  constructor(t, a, r, o, n) {
48
48
  super(t, a, n), this.name = "VueHandledError", this.info = r, this.componentName = o;
49
49
  }
50
50
  }
51
- class O extends m {
51
+ class M extends p {
52
52
  constructor(t, a, r) {
53
53
  super(t, a, r), this.name = "WindowHandledRuntimeError";
54
54
  }
55
55
  }
56
- class _ extends m {
56
+ class U extends p {
57
57
  constructor(t, a, r) {
58
58
  super(t, a, r), this.name = "WindowHandledPromiseRejectionError";
59
59
  }
60
60
  }
61
- class U extends x {
61
+ class B extends I {
62
62
  constructor(t, a, r) {
63
63
  super(t, a, r), this.name = "OperationalError";
64
64
  }
65
65
  }
66
- async function B(e, t, a) {
66
+ async function j(e, t, a) {
67
67
  const r = `${t} Response status '${e.status}${e.statusText ? ` - ${e.statusText}` : ""}' received.`, o = await e.text();
68
- return new w(r, a, o);
68
+ return new D(r, a, o);
69
69
  }
70
- function j(e) {
70
+ function H(e) {
71
71
  return e.map((t) => t.message).join(" ");
72
72
  }
73
- function H(e, t = "Unknown error.") {
73
+ function W(e, t = "Unknown error.") {
74
74
  if (e instanceof Error) return e;
75
75
  if (typeof e == "string") return new Error(e);
76
76
  try {
@@ -79,17 +79,17 @@ function H(e, t = "Unknown error.") {
79
79
  return new Error(t);
80
80
  }
81
81
  }
82
- function V(e) {
82
+ function z(e) {
83
83
  const t = /* @__PURE__ */ new Set(), a = [];
84
84
  let r = e;
85
85
  for (; r && !t.has(r); ) {
86
86
  t.add(r);
87
87
  let o;
88
- if (r instanceof w)
88
+ if (r instanceof D)
89
89
  o = { body: r.body, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
90
- else if (r instanceof T)
90
+ else if (r instanceof v)
91
91
  o = { componentName: r.componentName, info: r.info, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
92
- else if (r instanceof x)
92
+ else if (r instanceof I)
93
93
  o = { locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
94
94
  else if (r instanceof Error) {
95
95
  const n = r;
@@ -99,63 +99,65 @@ function V(e) {
99
99
  }
100
100
  return a;
101
101
  }
102
- function W() {
102
+ function V() {
103
103
  function e(t, a, r) {
104
104
  r.textContent = "Cytoscape.js diagram goes here...";
105
105
  }
106
106
  return { render: e };
107
107
  }
108
- function z() {
108
+ function X() {
109
109
  function e(t, a, r) {
110
110
  r.textContent = "values table goes here...";
111
111
  }
112
112
  return { render: e };
113
113
  }
114
- const v = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", E = "highcharts";
115
- let b, I = !1;
116
- function X() {
117
- async function e(n, s, u, g) {
114
+ const S = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", E = "highcharts";
115
+ let b, w = !1;
116
+ function G() {
117
+ async function e(n, s, u, h) {
118
118
  await r();
119
119
  const l = [];
120
- for (const h of s.data.measures)
121
- l.push({ type: n.options.highchartsType, name: h.name, data: getMeasureValues([h.id]) });
122
- const p = {
120
+ for (const c of s.data.measures)
121
+ l.push({ type: n.options.highchartsType, name: c.name, data: c.data });
122
+ const g = {
123
123
  chart: { type: n.options.highchartsType },
124
124
  plotOptions: { series: { borderColor: "#333" } },
125
125
  series: l,
126
126
  title: { text: s.title.text },
127
127
  xAxis: { categories: s.data.categoryLabels },
128
128
  yAxis: { title: { text: s.data.name } }
129
- }, c = b.chart(u, p, g);
130
- return { chart: c, resize: () => c.reflow(), vendorId: E };
129
+ }, m = b.chart(u, g, h);
130
+ return { chart: m, resize: () => m.reflow(), vendorId: E };
131
131
  }
132
- async function t(n, s, u, g) {
132
+ async function t(n, s, u, h) {
133
133
  await Promise.all([r(), o()]);
134
134
  const l = [];
135
- for (const h of s.data.measures)
136
- l.push({ type: n.options.highchartsType, name: h.name, data: getMeasureValues([h.id]) });
137
- const p = {
135
+ for (const c of s.data.measures)
136
+ l.push({ type: n.options.highchartsType, name: c.name, data: c.data });
137
+ const g = {
138
138
  chart: { polar: !0 },
139
139
  plotOptions: { series: { borderColor: "#333" } },
140
140
  series: l,
141
141
  title: { text: s.title.text },
142
142
  xAxis: { categories: s.data.categoryLabels },
143
143
  yAxis: { title: { text: s.data.name } }
144
- }, c = b.chart(u, p, g);
145
- return { chart: c, resize: () => c.reflow(), vendorId: E };
144
+ }, m = b.chart(u, g, h);
145
+ return { chart: m, resize: () => m.reflow(), vendorId: E };
146
146
  }
147
- async function a(n, s, u, g) {
147
+ async function a(n, s, u, h) {
148
148
  await Promise.all([r(), o()]);
149
- const l = [];
150
- l.push({ type: n.options.highchartsType, name: "Unknown", data: getMeasureValues([s.data.measures[0].id, s.data.measures[1].id]) });
151
- const p = {
149
+ const l = [], g = [];
150
+ for (let f = 0; f++; f < s.data.measures[0].data.length)
151
+ g.push([s.data.measures[0].data[f], s.data.measures[1].data[f]]);
152
+ l.push({ type: n.options.highchartsType, name: "Unknown", data: g });
153
+ const m = {
152
154
  chart: { type: n.options.highchartsType, inverted: n.options.inverted },
153
155
  plotOptions: { series: { borderColor: "#333" } },
154
156
  series: l,
155
157
  title: { text: s.title.text },
156
158
  xAxis: { categories: s.data.categoryLabels },
157
159
  yAxis: { title: { text: s.data.name } }
158
- }, c = b.chart(u, p, g);
160
+ }, c = b.chart(u, m, h);
159
161
  return { chart: c, resize: () => c.reflow(), vendorId: E };
160
162
  }
161
163
  async function r() {
@@ -170,12 +172,12 @@ function X() {
170
172
  );
171
173
  }
172
174
  async function o() {
173
- if (I) return;
174
- await import(`${v}highcharts-more.src.js`), I = !0;
175
+ if (w) return;
176
+ await import(`${S}highcharts-more.src.js`), w = !0;
175
177
  }
176
178
  return { renderCartesianChart: e, renderPolarChart: t, renderRangeChart: a };
177
179
  }
178
- const D = "en-US", f = {}, G = (e) => {
180
+ const T = "en-US", y = {}, P = (e) => {
179
181
  switch (e) {
180
182
  case "Edm.Binary":
181
183
  return "unknown";
@@ -214,20 +216,20 @@ const D = "en-US", f = {}, G = (e) => {
214
216
  default:
215
217
  return "unknown";
216
218
  }
217
- }, P = (e) => {
219
+ }, J = (e) => {
218
220
  if (e) {
219
221
  const t = e.lastIndexOf("/"), a = e.lastIndexOf(".", t > -1 ? t : e.length);
220
222
  return a > -1 ? e.substring(0, a) : e;
221
223
  }
222
- }, J = (e) => {
224
+ }, K = (e) => {
223
225
  if (e) {
224
226
  const t = e.lastIndexOf(".");
225
227
  if (t > -1) return e.substring(t + 1);
226
228
  }
227
- }, i = (e, t = 2, a = t, r = D) => {
229
+ }, i = (e, t = 2, a = t, r = T) => {
228
230
  if (e == null) return "";
229
231
  const o = `${r}decimal${t}.${a}`;
230
- let n = f[o];
232
+ let n = y[o];
231
233
  return n || (n = new Intl.NumberFormat(r, {
232
234
  localeMatcher: "best fit",
233
235
  maximumFractionDigits: t,
@@ -235,11 +237,11 @@ const D = "en-US", f = {}, G = (e) => {
235
237
  minimumIntegerDigits: 1,
236
238
  style: "decimal",
237
239
  useGrouping: !0
238
- }), f[o] = n), n.format(e);
239
- }, K = (e) => e == null ? "" : e < 1e3 ? y(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`, q = (e) => e == null ? "" : e === 1 ? "1 byte" : e < 1024 ? `${y(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`, Q = (e) => e == null ? "" : e < 1e3 ? `${y(e)} ms` : e === 1e3 ? `${y(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`, y = (e, t = D) => {
240
+ }), y[o] = n), n.format(e);
241
+ }, q = (e) => e == null ? "" : e < 1e3 ? x(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`, Q = (e) => e == null ? "" : e === 1 ? "1 byte" : e < 1024 ? `${x(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`, Y = (e) => e == null ? "" : e < 1e3 ? `${x(e)} ms` : e === 1e3 ? `${x(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`, x = (e, t = T) => {
240
242
  if (e == null) return "";
241
243
  const a = `${t}decimal0.0`;
242
- let r = f[a];
244
+ let r = y[a];
243
245
  return r || (r = new Intl.NumberFormat(t, {
244
246
  localeMatcher: "best fit",
245
247
  maximumFractionDigits: 0,
@@ -247,8 +249,8 @@ const D = "en-US", f = {}, G = (e) => {
247
249
  minimumIntegerDigits: 1,
248
250
  style: "decimal",
249
251
  useGrouping: !0
250
- }), f[a] = r), r.format(e);
251
- }, Y = (e) => {
252
+ }), y[a] = r), r.format(e);
253
+ }, Z = (e) => {
252
254
  switch (e) {
253
255
  case "csv":
254
256
  return "text/csv";
@@ -262,7 +264,7 @@ const D = "en-US", f = {}, G = (e) => {
262
264
  default:
263
265
  return "application/octet-stream";
264
266
  }
265
- }, S = [
267
+ }, A = [
266
268
  { id: "dtv", label: { "en-gb": "Delimited Text" } },
267
269
  { id: "e/e", label: { "en-gb": "Entity/Event" } },
268
270
  { id: "jsonArray", label: { "en-gb": "JSON Array" } },
@@ -270,22 +272,22 @@ const D = "en-US", f = {}, G = (e) => {
270
272
  { id: "xls", label: { "en-gb": "XLS" } },
271
273
  { id: "xlsx", label: { "en-gb": "XLSX" } },
272
274
  { id: "xml", label: { "en-gb": "XML" } }
273
- ], Z = (e = d) => {
275
+ ], ee = (e = d) => {
274
276
  const t = [];
275
- for (const a of S) t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
277
+ for (const a of A) t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
276
278
  return t;
277
- }, A = [
279
+ }, N = [
278
280
  { id: `
279
281
  `, label: { "en-gb": "Newline" } },
280
282
  { id: "\r", label: { "en-gb": "Carriage Return" } },
281
283
  { id: `\r
282
284
  `, label: { "en-gb": "Carriage Return/Newline" } }
283
- ], ee = (e = d) => {
285
+ ], re = (e = d) => {
284
286
  const t = [];
285
- for (const a of A)
287
+ for (const a of N)
286
288
  t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
287
289
  return t;
288
- }, N = [
290
+ }, $ = [
289
291
  { id: ":", label: { "en-gb": "Colon" } },
290
292
  { id: ",", label: { "en-gb": "Comma" } },
291
293
  { id: "!", label: { "en-gb": "Exclamation Mark" } },
@@ -297,12 +299,12 @@ const D = "en-US", f = {}, G = (e) => {
297
299
  { id: "_", label: { "en-gb": "Underscore" } },
298
300
  { id: "0x1F", label: { "en-gb": "Unit Separator" } },
299
301
  { id: "|", label: { "en-gb": "Vertical Bar" } }
300
- ], re = (e = d) => {
302
+ ], te = (e = d) => {
301
303
  const t = [];
302
- for (const a of N)
304
+ for (const a of $)
303
305
  t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
304
306
  return t;
305
- }, $ = [
307
+ }, C = [
306
308
  { id: "alpha", color: "red", label: { "en-gb": "alpha" } },
307
309
  { id: "beta", color: "amber", label: { "en-gb": "beta" } },
308
310
  { id: "generalAvailability", color: "green", label: { "en-gb": "" } },
@@ -312,42 +314,42 @@ const D = "en-US", f = {}, G = (e) => {
312
314
  { id: "releaseCandidate", color: "green", label: { "en-gb": "release-candidate" } },
313
315
  { id: "unavailable", color: "other", label: { "en-gb": "unavailable" } },
314
316
  { id: "underReview", color: "other", label: { "en-gb": "under-review" } }
315
- ], te = (e, t = d) => {
316
- const a = $.find((r) => r.id === e);
317
+ ], ae = (e, t = d) => {
318
+ const a = C.find((r) => r.id === e);
317
319
  return a ? { ...a, label: a.label[t] || a.label[d] || e } : { id: e, color: "other", label: e };
318
320
  }, d = "en-gb";
319
321
  export {
320
- k as APIError,
321
- m as ApplicationError,
322
+ O as APIError,
323
+ p as ApplicationError,
322
324
  d as DEFAULT_LOCALE_CODE,
323
- C as DefaultTimestamp,
324
- M as EngineError,
325
- w as FetchError,
326
- U as OperationalError,
327
- T as VueError,
328
- _ as WindowPromiseRejectionError,
329
- O as WindowRuntimeError,
330
- B as buildFetchError,
331
- j as concatenateSerialisedErrorMessages,
332
- R as convertMillisecondsToTimestamp,
333
- G as convertODataTypeIdToUsageTypeId,
334
- J as extractExtensionFromPath,
335
- P as extractNameFromPath,
325
+ R as DefaultTimestamp,
326
+ _ as EngineError,
327
+ D as FetchError,
328
+ B as OperationalError,
329
+ v as VueError,
330
+ U as WindowPromiseRejectionError,
331
+ M as WindowRuntimeError,
332
+ j as buildFetchError,
333
+ H as concatenateSerialisedErrorMessages,
334
+ F as convertMillisecondsToTimestamp,
335
+ P as convertODataTypeIdToUsageTypeId,
336
+ K as extractExtensionFromPath,
337
+ J as extractNameFromPath,
336
338
  i as formatNumberAsDecimalNumber,
337
- Q as formatNumberAsDuration,
338
- K as formatNumberAsSize,
339
- q as formatNumberAsStorageSize,
340
- y as formatNumberAsWholeNumber,
341
- te as getComponentStatus,
342
- F as getCurrentTimestamp,
343
- Z as getDataFormats,
344
- ee as getRecordDelimiters,
345
- re as getValueDelimiters,
346
- Y as lookupMimeTypeForExtension,
347
- H as normalizeToError,
348
- L as presentationViewTypeMap,
349
- V as serialiseError,
350
- W as useCytoscapeJS,
351
- z as useDataTable,
352
- X as useHighcharts
339
+ Y as formatNumberAsDuration,
340
+ q as formatNumberAsSize,
341
+ Q as formatNumberAsStorageSize,
342
+ x as formatNumberAsWholeNumber,
343
+ ae as getComponentStatus,
344
+ L as getCurrentTimestamp,
345
+ ee as getDataFormats,
346
+ re as getRecordDelimiters,
347
+ te as getValueDelimiters,
348
+ Z as lookupMimeTypeForExtension,
349
+ W as normalizeToError,
350
+ k as presentationViewTypeMap,
351
+ z as serialiseError,
352
+ V as useCytoscapeJS,
353
+ X as useDataTable,
354
+ G as useHighcharts
353
355
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@datapos/datapos-shared",
3
3
  "license": "MIT",
4
4
  "private": false,
5
- "version": "0.3.95",
5
+ "version": "0.3.96",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"