@datapos/datapos-shared 0.3.114 → 0.3.117
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,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { promises as y } from "fs";
|
|
2
|
+
const L = 0, O = (e) => e, _ = () => Date.now(), k = {
|
|
2
3
|
cartesian_areaLine: { categoryId: "cartesian", typeId: "areaLine", label: { "en-gb": "Area Line" }, options: { highchartsType: "area" } },
|
|
3
4
|
cartesian_areaSpline: { categoryId: "cartesian", typeId: "areaSpline", label: { "en-gb": "Area Spline" }, options: { highchartsType: "area" } },
|
|
4
5
|
cartesian_bar: { categoryId: "cartesian", typeId: "bar", label: { "en-gb": "Bar" }, options: { highchartsType: "bar" } },
|
|
@@ -17,66 +18,66 @@ const R = 0, L = (e) => e, F = () => Date.now(), _ = {
|
|
|
17
18
|
streamgraph: { categoryId: "streamgraph", label: { "en-gb": "Streamgraph" }, options: {} },
|
|
18
19
|
values: { categoryId: "values", label: { "en-gb": "Values" }, options: {} }
|
|
19
20
|
};
|
|
20
|
-
function
|
|
21
|
+
function M() {
|
|
21
22
|
function e(t, a, r) {
|
|
22
23
|
r.textContent = "Cytoscape.js diagram goes here...";
|
|
23
24
|
}
|
|
24
25
|
return { render: e };
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function U() {
|
|
27
28
|
function e(t, a, r) {
|
|
28
29
|
r.textContent = "values table goes here...";
|
|
29
30
|
}
|
|
30
31
|
return { render: e };
|
|
31
32
|
}
|
|
32
|
-
const
|
|
33
|
-
let b,
|
|
34
|
-
function
|
|
33
|
+
const S = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", w = "highcharts";
|
|
34
|
+
let b, T = !1;
|
|
35
|
+
function j() {
|
|
35
36
|
async function e(n, s, u, h) {
|
|
36
37
|
await r();
|
|
37
38
|
const l = [];
|
|
38
39
|
for (const c of s.data.measures)
|
|
39
40
|
l.push({ type: n.options.highchartsType, name: c.name, data: c.data });
|
|
40
|
-
const
|
|
41
|
+
const m = {
|
|
41
42
|
chart: { type: n.options.highchartsType },
|
|
42
43
|
plotOptions: { series: { borderColor: "#333" } },
|
|
43
44
|
series: l,
|
|
44
45
|
title: { text: s.title.text },
|
|
45
46
|
xAxis: { categories: s.data.categoryLabels },
|
|
46
47
|
yAxis: { title: { text: s.data.name } }
|
|
47
|
-
},
|
|
48
|
-
return { chart:
|
|
48
|
+
}, g = b.chart(u, m, h);
|
|
49
|
+
return { chart: g, resize: () => g.reflow(), vendorId: w };
|
|
49
50
|
}
|
|
50
51
|
async function t(n, s, u, h) {
|
|
51
52
|
await Promise.all([r(), o()]);
|
|
52
53
|
const l = [];
|
|
53
54
|
for (const c of s.data.measures)
|
|
54
55
|
l.push({ type: n.options.highchartsType, name: c.name, data: c.data });
|
|
55
|
-
const
|
|
56
|
+
const m = {
|
|
56
57
|
chart: { polar: !0 },
|
|
57
58
|
plotOptions: { series: { borderColor: "#333" } },
|
|
58
59
|
series: l,
|
|
59
60
|
title: { text: s.title.text },
|
|
60
61
|
xAxis: { categories: s.data.categoryLabels },
|
|
61
62
|
yAxis: { title: { text: s.data.name } }
|
|
62
|
-
},
|
|
63
|
-
return { chart:
|
|
63
|
+
}, g = b.chart(u, m, h);
|
|
64
|
+
return { chart: g, resize: () => g.reflow(), vendorId: w };
|
|
64
65
|
}
|
|
65
66
|
async function a(n, s, u, h) {
|
|
66
67
|
await Promise.all([r(), o()]);
|
|
67
|
-
const l = [],
|
|
68
|
+
const l = [], m = [];
|
|
68
69
|
for (let f = 0; f < s.data.measures[0].data.length; f++)
|
|
69
|
-
|
|
70
|
-
l.push({ type: n.options.highchartsType, name: "Unknown", data:
|
|
71
|
-
const
|
|
70
|
+
m.push([s.data.measures[0].data[f][0], s.data.measures[1].data[f][0]]);
|
|
71
|
+
l.push({ type: n.options.highchartsType, name: "Unknown", data: m });
|
|
72
|
+
const g = {
|
|
72
73
|
chart: { type: n.options.highchartsType, inverted: n.options.inverted },
|
|
73
74
|
plotOptions: { series: { borderColor: "#333" } },
|
|
74
75
|
series: l,
|
|
75
76
|
title: { text: s.title.text },
|
|
76
77
|
xAxis: { categories: s.data.categoryLabels },
|
|
77
78
|
yAxis: { title: { text: s.data.name } }
|
|
78
|
-
}, c = b.chart(u,
|
|
79
|
-
return { chart: c, resize: () => c.reflow(), vendorId:
|
|
79
|
+
}, c = b.chart(u, g, h);
|
|
80
|
+
return { chart: c, resize: () => c.reflow(), vendorId: w };
|
|
80
81
|
}
|
|
81
82
|
async function r() {
|
|
82
83
|
if (b) return;
|
|
@@ -90,8 +91,8 @@ function M() {
|
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
async function o() {
|
|
93
|
-
if (
|
|
94
|
-
await import(`${
|
|
94
|
+
if (T) return;
|
|
95
|
+
await import(`${S}highcharts-more.src.js`), T = !0;
|
|
95
96
|
}
|
|
96
97
|
return { renderCartesianChart: e, renderPolarChart: t, renderRangeChart: a };
|
|
97
98
|
}
|
|
@@ -106,52 +107,52 @@ class p extends I {
|
|
|
106
107
|
super(t, a, r), this.name = "ApplicationError";
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
class
|
|
110
|
+
class B extends p {
|
|
110
111
|
constructor(t, a, r) {
|
|
111
112
|
super(t, a, r), this.name = "APIError";
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
class
|
|
115
|
+
class H extends p {
|
|
115
116
|
constructor(t, a, r) {
|
|
116
117
|
super(t, a, r), this.name = "EngineError";
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
|
-
class
|
|
120
|
+
class D extends p {
|
|
120
121
|
body;
|
|
121
122
|
constructor(t, a, r, o) {
|
|
122
123
|
super(t, a, o), this.name = "FetchError", this.body = r;
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
class
|
|
126
|
+
class N extends p {
|
|
126
127
|
componentName;
|
|
127
128
|
info;
|
|
128
129
|
constructor(t, a, r, o, n) {
|
|
129
130
|
super(t, a, n), this.name = "VueHandledError", this.info = r, this.componentName = o;
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
class
|
|
133
|
+
class J extends p {
|
|
133
134
|
constructor(t, a, r) {
|
|
134
135
|
super(t, a, r), this.name = "WindowHandledRuntimeError";
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
class
|
|
138
|
+
class W extends p {
|
|
138
139
|
constructor(t, a, r) {
|
|
139
140
|
super(t, a, r), this.name = "WindowHandledPromiseRejectionError";
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
|
-
class
|
|
143
|
+
class z extends I {
|
|
143
144
|
constructor(t, a, r) {
|
|
144
145
|
super(t, a, r), this.name = "OperationalError";
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
|
-
async function
|
|
148
|
+
async function P(e, t, a) {
|
|
148
149
|
const r = `${t} Response status '${e.status}${e.statusText ? ` - ${e.statusText}` : ""}' received.`, o = await e.text();
|
|
149
|
-
return new
|
|
150
|
+
return new D(r, a, o);
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
+
function V(e) {
|
|
152
153
|
return e.map((t) => t.message).join(" ");
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
+
function X(e, t = "Unknown error.") {
|
|
155
156
|
if (e instanceof Error) return e;
|
|
156
157
|
if (typeof e == "string") return new Error(e);
|
|
157
158
|
try {
|
|
@@ -160,15 +161,15 @@ function V(e, t = "Unknown error.") {
|
|
|
160
161
|
return new Error(t);
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
+
function G(e) {
|
|
164
165
|
const t = /* @__PURE__ */ new Set(), a = [];
|
|
165
166
|
let r = e;
|
|
166
167
|
for (; r && !t.has(r); ) {
|
|
167
168
|
t.add(r);
|
|
168
169
|
let o;
|
|
169
|
-
if (r instanceof
|
|
170
|
+
if (r instanceof D)
|
|
170
171
|
o = { body: r.body, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
|
|
171
|
-
else if (r instanceof
|
|
172
|
+
else if (r instanceof N)
|
|
172
173
|
o = { componentName: r.componentName, info: r.info, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
|
|
173
174
|
else if (r instanceof I)
|
|
174
175
|
o = { locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
|
|
@@ -180,7 +181,7 @@ function X(e) {
|
|
|
180
181
|
}
|
|
181
182
|
return a;
|
|
182
183
|
}
|
|
183
|
-
const
|
|
184
|
+
const v = "en-US", x = {}, K = (e) => {
|
|
184
185
|
switch (e) {
|
|
185
186
|
case "Edm.Binary":
|
|
186
187
|
return "unknown";
|
|
@@ -219,20 +220,20 @@ const D = "en-US", y = {}, G = (e) => {
|
|
|
219
220
|
default:
|
|
220
221
|
return "unknown";
|
|
221
222
|
}
|
|
222
|
-
},
|
|
223
|
+
}, Z = (e) => {
|
|
223
224
|
if (e) {
|
|
224
225
|
const t = e.lastIndexOf("/"), a = e.lastIndexOf(".", t > -1 ? t : e.length);
|
|
225
226
|
return a > -1 ? e.substring(0, a) : e;
|
|
226
227
|
}
|
|
227
|
-
},
|
|
228
|
+
}, q = (e) => {
|
|
228
229
|
if (e) {
|
|
229
230
|
const t = e.lastIndexOf(".");
|
|
230
231
|
if (t > -1) return e.substring(t + 1);
|
|
231
232
|
}
|
|
232
|
-
}, i = (e, t = 2, a = t, r =
|
|
233
|
+
}, i = (e, t = 2, a = t, r = v) => {
|
|
233
234
|
if (e == null) return "";
|
|
234
235
|
const o = `${r}decimal${t}.${a}`;
|
|
235
|
-
let n =
|
|
236
|
+
let n = x[o];
|
|
236
237
|
return n || (n = new Intl.NumberFormat(r, {
|
|
237
238
|
localeMatcher: "best fit",
|
|
238
239
|
maximumFractionDigits: t,
|
|
@@ -240,11 +241,11 @@ const D = "en-US", y = {}, G = (e) => {
|
|
|
240
241
|
minimumIntegerDigits: 1,
|
|
241
242
|
style: "decimal",
|
|
242
243
|
useGrouping: !0
|
|
243
|
-
}),
|
|
244
|
-
},
|
|
244
|
+
}), x[o] = n), n.format(e);
|
|
245
|
+
}, Q = (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`, Y = (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`, ee = (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, t = v) => {
|
|
245
246
|
if (e == null) return "";
|
|
246
247
|
const a = `${t}decimal0.0`;
|
|
247
|
-
let r =
|
|
248
|
+
let r = x[a];
|
|
248
249
|
return r || (r = new Intl.NumberFormat(t, {
|
|
249
250
|
localeMatcher: "best fit",
|
|
250
251
|
maximumFractionDigits: 0,
|
|
@@ -252,8 +253,8 @@ const D = "en-US", y = {}, G = (e) => {
|
|
|
252
253
|
minimumIntegerDigits: 1,
|
|
253
254
|
style: "decimal",
|
|
254
255
|
useGrouping: !0
|
|
255
|
-
}),
|
|
256
|
-
},
|
|
256
|
+
}), x[a] = r), r.format(e);
|
|
257
|
+
}, re = (e) => {
|
|
257
258
|
switch (e) {
|
|
258
259
|
case "csv":
|
|
259
260
|
return "text/csv";
|
|
@@ -275,19 +276,19 @@ const D = "en-US", y = {}, G = (e) => {
|
|
|
275
276
|
{ id: "xls", label: { "en-gb": "XLS" } },
|
|
276
277
|
{ id: "xlsx", label: { "en-gb": "XLSX" } },
|
|
277
278
|
{ id: "xml", label: { "en-gb": "XML" } }
|
|
278
|
-
],
|
|
279
|
+
], te = (e = d) => {
|
|
279
280
|
const t = [];
|
|
280
281
|
for (const a of A) t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
|
|
281
282
|
return t;
|
|
282
|
-
},
|
|
283
|
+
}, C = [
|
|
283
284
|
{ id: `
|
|
284
285
|
`, label: { "en-gb": "Newline" } },
|
|
285
286
|
{ id: "\r", label: { "en-gb": "Carriage Return" } },
|
|
286
287
|
{ id: `\r
|
|
287
288
|
`, label: { "en-gb": "Carriage Return/Newline" } }
|
|
288
|
-
],
|
|
289
|
+
], ae = (e = d) => {
|
|
289
290
|
const t = [];
|
|
290
|
-
for (const a of
|
|
291
|
+
for (const a of C)
|
|
291
292
|
t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
|
|
292
293
|
return t;
|
|
293
294
|
}, $ = [
|
|
@@ -302,12 +303,12 @@ const D = "en-US", y = {}, G = (e) => {
|
|
|
302
303
|
{ id: "_", label: { "en-gb": "Underscore" } },
|
|
303
304
|
{ id: "0x1F", label: { "en-gb": "Unit Separator" } },
|
|
304
305
|
{ id: "|", label: { "en-gb": "Vertical Bar" } }
|
|
305
|
-
],
|
|
306
|
+
], ne = (e = d) => {
|
|
306
307
|
const t = [];
|
|
307
308
|
for (const a of $)
|
|
308
309
|
t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
|
|
309
310
|
return t;
|
|
310
|
-
},
|
|
311
|
+
}, R = [
|
|
311
312
|
{ id: "alpha", color: "red", label: { "en-gb": "alpha" } },
|
|
312
313
|
{ id: "beta", color: "amber", label: { "en-gb": "beta" } },
|
|
313
314
|
{ id: "generalAvailability", color: "green", label: { "en-gb": "" } },
|
|
@@ -317,42 +318,52 @@ const D = "en-US", y = {}, G = (e) => {
|
|
|
317
318
|
{ id: "releaseCandidate", color: "green", label: { "en-gb": "release-candidate" } },
|
|
318
319
|
{ id: "unavailable", color: "other", label: { "en-gb": "unavailable" } },
|
|
319
320
|
{ id: "underReview", color: "other", label: { "en-gb": "under-review" } }
|
|
320
|
-
],
|
|
321
|
-
const a =
|
|
321
|
+
], oe = (e, t = d) => {
|
|
322
|
+
const a = R.find((r) => r.id === e);
|
|
322
323
|
return a ? { ...a, label: a.label[t] || a.label[d] || e } : { id: e, color: "other", label: e };
|
|
323
|
-
}
|
|
324
|
+
};
|
|
325
|
+
async function se() {
|
|
326
|
+
try {
|
|
327
|
+
const e = await JSON.parse(await y.readFile("package.json", "utf8")), t = await JSON.parse(await y.readFile("config.json", "utf8")), a = await y.readFile("src/index.ts", "utf8"), r = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, o = [...a.matchAll(r)].filter((n) => !n[1] && n[2] !== "constructor").map((n) => n[2]);
|
|
328
|
+
await y.writeFile("configNEW.json", JSON.stringify({ ...t, id: e.name, interfaces: o, version: e.version }, void 0, 4), "utf8");
|
|
329
|
+
} catch (e) {
|
|
330
|
+
console.warn("Error building connector configuration.", e);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const d = "en-gb";
|
|
324
334
|
export {
|
|
325
|
-
|
|
335
|
+
B as APIError,
|
|
326
336
|
p as ApplicationError,
|
|
327
337
|
d as DEFAULT_LOCALE_CODE,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
P as
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
K as
|
|
340
|
-
|
|
338
|
+
L as DefaultTimestamp,
|
|
339
|
+
H as EngineError,
|
|
340
|
+
D as FetchError,
|
|
341
|
+
z as OperationalError,
|
|
342
|
+
N as VueError,
|
|
343
|
+
W as WindowPromiseRejectionError,
|
|
344
|
+
J as WindowRuntimeError,
|
|
345
|
+
se as buildConnectorConfig,
|
|
346
|
+
P as buildFetchError,
|
|
347
|
+
V as concatenateSerialisedErrorMessages,
|
|
348
|
+
O as convertMillisecondsToTimestamp,
|
|
349
|
+
K as convertODataTypeIdToUsageTypeId,
|
|
350
|
+
q as extractExtensionFromPath,
|
|
351
|
+
Z as extractNameFromPath,
|
|
341
352
|
i as formatNumberAsDecimalNumber,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
ee as formatNumberAsDuration,
|
|
354
|
+
Q as formatNumberAsSize,
|
|
355
|
+
Y as formatNumberAsStorageSize,
|
|
356
|
+
E as formatNumberAsWholeNumber,
|
|
357
|
+
oe as getComponentStatus,
|
|
358
|
+
_ as getCurrentTimestamp,
|
|
359
|
+
te as getDataFormats,
|
|
360
|
+
ae as getRecordDelimiters,
|
|
361
|
+
ne as getValueDelimiters,
|
|
362
|
+
re as lookupMimeTypeForExtension,
|
|
363
|
+
X as normalizeToError,
|
|
364
|
+
k as presentationViewTypeMap,
|
|
365
|
+
G as serialiseError,
|
|
366
|
+
M as useCytoscapeJS,
|
|
367
|
+
U as useDataTable,
|
|
368
|
+
j as useHighcharts
|
|
358
369
|
};
|
|
@@ -57,3 +57,4 @@ export { formatNumberAsDecimalNumber, formatNumberAsDuration, formatNumberAsSize
|
|
|
57
57
|
export { getDataFormats, getRecordDelimiters, getValueDelimiters } from './component/dataView';
|
|
58
58
|
export { getComponentStatus } from './component';
|
|
59
59
|
export { lookupMimeTypeForExtension } from './utilities';
|
|
60
|
+
export { buildConnectorConfig } from './devUtilities';
|
|
@@ -28,7 +28,7 @@ export interface ConnectorModuleConfig extends ModuleConfig {
|
|
|
28
28
|
vendorHomeURL?: string;
|
|
29
29
|
}
|
|
30
30
|
type ConnectorModuleCategoryId = 'application' | 'curatedDataset' | 'database' | 'fileStore';
|
|
31
|
-
type ConnectorModuleInterface = 'abortOperation' | 'authenticateConnection' | 'createObject' | 'describeConnection' | 'dropObject' | 'findObject' | 'getRecord' | 'listNodes' | 'previewObject' | 'removeRecords' | 'retrieveRecords' | 'upsertRecords';
|
|
31
|
+
export type ConnectorModuleInterface = 'abortOperation' | 'authenticateConnection' | 'createObject' | 'describeConnection' | 'dropObject' | 'findObject' | 'getRecord' | 'listNodes' | 'previewObject' | 'removeRecords' | 'retrieveRecords' | 'upsertRecords';
|
|
32
32
|
type ConnectorModuleUsageId = 'bidirectional' | 'destination' | 'source';
|
|
33
33
|
export interface ContextModuleConfig extends ModuleConfig {
|
|
34
34
|
interfaces: ContextModuleInterface[];
|
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.
|
|
5
|
+
"version": "0.3.117",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"npm-check-updates": "^19.1.2",
|
|
35
35
|
"prettier": "^3.6.2",
|
|
36
36
|
"retire": "^5.3.0",
|
|
37
|
+
"type-fest": "^5.2.0",
|
|
37
38
|
"typescript": "^5.9.3",
|
|
38
39
|
"vite": "^7.2.1",
|
|
39
40
|
"vite-plugin-dts": "^4.5.4"
|