@datapos/datapos-shared 0.3.116 → 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,4 @@
1
- import { promises as x } from "fs";
1
+ import { promises as y } from "fs";
2
2
  const L = 0, O = (e) => e, _ = () => Date.now(), k = {
3
3
  cartesian_areaLine: { categoryId: "cartesian", typeId: "areaLine", label: { "en-gb": "Area Line" }, options: { highchartsType: "area" } },
4
4
  cartesian_areaSpline: { categoryId: "cartesian", typeId: "areaSpline", label: { "en-gb": "Area Spline" }, options: { highchartsType: "area" } },
@@ -30,7 +30,7 @@ function U() {
30
30
  }
31
31
  return { render: e };
32
32
  }
33
- const S = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", I = "highcharts";
33
+ const S = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", w = "highcharts";
34
34
  let b, T = !1;
35
35
  function j() {
36
36
  async function e(n, s, u, h) {
@@ -46,7 +46,7 @@ function j() {
46
46
  xAxis: { categories: s.data.categoryLabels },
47
47
  yAxis: { title: { text: s.data.name } }
48
48
  }, g = b.chart(u, m, h);
49
- return { chart: g, resize: () => g.reflow(), vendorId: I };
49
+ return { chart: g, resize: () => g.reflow(), vendorId: w };
50
50
  }
51
51
  async function t(n, s, u, h) {
52
52
  await Promise.all([r(), o()]);
@@ -61,7 +61,7 @@ function j() {
61
61
  xAxis: { categories: s.data.categoryLabels },
62
62
  yAxis: { title: { text: s.data.name } }
63
63
  }, g = b.chart(u, m, h);
64
- return { chart: g, resize: () => g.reflow(), vendorId: I };
64
+ return { chart: g, resize: () => g.reflow(), vendorId: w };
65
65
  }
66
66
  async function a(n, s, u, h) {
67
67
  await Promise.all([r(), o()]);
@@ -77,7 +77,7 @@ function j() {
77
77
  xAxis: { categories: s.data.categoryLabels },
78
78
  yAxis: { title: { text: s.data.name } }
79
79
  }, c = b.chart(u, g, h);
80
- return { chart: c, resize: () => c.reflow(), vendorId: I };
80
+ return { chart: c, resize: () => c.reflow(), vendorId: w };
81
81
  }
82
82
  async function r() {
83
83
  if (b) return;
@@ -96,13 +96,13 @@ function j() {
96
96
  }
97
97
  return { renderCartesianChart: e, renderPolarChart: t, renderRangeChart: a };
98
98
  }
99
- class w extends Error {
99
+ class I extends Error {
100
100
  locator;
101
101
  constructor(t, a, r) {
102
102
  super(t, r), this.name = "DataPosError", this.locator = a, Error.captureStackTrace?.(this, new.target);
103
103
  }
104
104
  }
105
- class p extends w {
105
+ class p extends I {
106
106
  constructor(t, a, r) {
107
107
  super(t, a, r), this.name = "ApplicationError";
108
108
  }
@@ -140,7 +140,7 @@ class W extends p {
140
140
  super(t, a, r), this.name = "WindowHandledPromiseRejectionError";
141
141
  }
142
142
  }
143
- class z extends w {
143
+ class z extends I {
144
144
  constructor(t, a, r) {
145
145
  super(t, a, r), this.name = "OperationalError";
146
146
  }
@@ -171,7 +171,7 @@ function G(e) {
171
171
  o = { body: r.body, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
172
172
  else if (r instanceof N)
173
173
  o = { componentName: r.componentName, info: r.info, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
174
- else if (r instanceof w)
174
+ else if (r instanceof I)
175
175
  o = { locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
176
176
  else if (r instanceof Error) {
177
177
  const n = r;
@@ -181,15 +181,7 @@ function G(e) {
181
181
  }
182
182
  return a;
183
183
  }
184
- async function K() {
185
- try {
186
- const e = await JSON.parse(await x.readFile("config.json", "utf8")), t = await JSON.parse(await x.readFile("package.json", "utf8"));
187
- await x.writeFile("configNEW.json", JSON.stringify({ ...e, id: t.name, version: t.version }, void 0, 4));
188
- } catch (e) {
189
- console.warn("Error building connector configuration.", e);
190
- }
191
- }
192
- const v = "en-US", y = {}, q = (e) => {
184
+ const v = "en-US", x = {}, K = (e) => {
193
185
  switch (e) {
194
186
  case "Edm.Binary":
195
187
  return "unknown";
@@ -228,12 +220,12 @@ const v = "en-US", y = {}, q = (e) => {
228
220
  default:
229
221
  return "unknown";
230
222
  }
231
- }, Q = (e) => {
223
+ }, Z = (e) => {
232
224
  if (e) {
233
225
  const t = e.lastIndexOf("/"), a = e.lastIndexOf(".", t > -1 ? t : e.length);
234
226
  return a > -1 ? e.substring(0, a) : e;
235
227
  }
236
- }, Y = (e) => {
228
+ }, q = (e) => {
237
229
  if (e) {
238
230
  const t = e.lastIndexOf(".");
239
231
  if (t > -1) return e.substring(t + 1);
@@ -241,7 +233,7 @@ const v = "en-US", y = {}, q = (e) => {
241
233
  }, i = (e, t = 2, a = t, r = v) => {
242
234
  if (e == null) return "";
243
235
  const o = `${r}decimal${t}.${a}`;
244
- let n = y[o];
236
+ let n = x[o];
245
237
  return n || (n = new Intl.NumberFormat(r, {
246
238
  localeMatcher: "best fit",
247
239
  maximumFractionDigits: t,
@@ -249,11 +241,11 @@ const v = "en-US", y = {}, q = (e) => {
249
241
  minimumIntegerDigits: 1,
250
242
  style: "decimal",
251
243
  useGrouping: !0
252
- }), y[o] = n), n.format(e);
253
- }, Z = (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`, ee = (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`, re = (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) => {
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) => {
254
246
  if (e == null) return "";
255
247
  const a = `${t}decimal0.0`;
256
- let r = y[a];
248
+ let r = x[a];
257
249
  return r || (r = new Intl.NumberFormat(t, {
258
250
  localeMatcher: "best fit",
259
251
  maximumFractionDigits: 0,
@@ -261,8 +253,8 @@ const v = "en-US", y = {}, q = (e) => {
261
253
  minimumIntegerDigits: 1,
262
254
  style: "decimal",
263
255
  useGrouping: !0
264
- }), y[a] = r), r.format(e);
265
- }, te = (e) => {
256
+ }), x[a] = r), r.format(e);
257
+ }, re = (e) => {
266
258
  switch (e) {
267
259
  case "csv":
268
260
  return "text/csv";
@@ -284,7 +276,7 @@ const v = "en-US", y = {}, q = (e) => {
284
276
  { id: "xls", label: { "en-gb": "XLS" } },
285
277
  { id: "xlsx", label: { "en-gb": "XLSX" } },
286
278
  { id: "xml", label: { "en-gb": "XML" } }
287
- ], ae = (e = d) => {
279
+ ], te = (e = d) => {
288
280
  const t = [];
289
281
  for (const a of A) t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
290
282
  return t;
@@ -294,7 +286,7 @@ const v = "en-US", y = {}, q = (e) => {
294
286
  { id: "\r", label: { "en-gb": "Carriage Return" } },
295
287
  { id: `\r
296
288
  `, label: { "en-gb": "Carriage Return/Newline" } }
297
- ], ne = (e = d) => {
289
+ ], ae = (e = d) => {
298
290
  const t = [];
299
291
  for (const a of C)
300
292
  t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
@@ -311,7 +303,7 @@ const v = "en-US", y = {}, q = (e) => {
311
303
  { id: "_", label: { "en-gb": "Underscore" } },
312
304
  { id: "0x1F", label: { "en-gb": "Unit Separator" } },
313
305
  { id: "|", label: { "en-gb": "Vertical Bar" } }
314
- ], oe = (e = d) => {
306
+ ], ne = (e = d) => {
315
307
  const t = [];
316
308
  for (const a of $)
317
309
  t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
@@ -326,10 +318,19 @@ const v = "en-US", y = {}, q = (e) => {
326
318
  { id: "releaseCandidate", color: "green", label: { "en-gb": "release-candidate" } },
327
319
  { id: "unavailable", color: "other", label: { "en-gb": "unavailable" } },
328
320
  { id: "underReview", color: "other", label: { "en-gb": "under-review" } }
329
- ], se = (e, t = d) => {
321
+ ], oe = (e, t = d) => {
330
322
  const a = R.find((r) => r.id === e);
331
323
  return a ? { ...a, label: a.label[t] || a.label[d] || e } : { id: e, color: "other", label: e };
332
- }, d = "en-gb";
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";
333
334
  export {
334
335
  B as APIError,
335
336
  p as ApplicationError,
@@ -341,24 +342,24 @@ export {
341
342
  N as VueError,
342
343
  W as WindowPromiseRejectionError,
343
344
  J as WindowRuntimeError,
344
- K as buildConnectorConfig,
345
+ se as buildConnectorConfig,
345
346
  P as buildFetchError,
346
347
  V as concatenateSerialisedErrorMessages,
347
348
  O as convertMillisecondsToTimestamp,
348
- q as convertODataTypeIdToUsageTypeId,
349
- Y as extractExtensionFromPath,
350
- Q as extractNameFromPath,
349
+ K as convertODataTypeIdToUsageTypeId,
350
+ q as extractExtensionFromPath,
351
+ Z as extractNameFromPath,
351
352
  i as formatNumberAsDecimalNumber,
352
- re as formatNumberAsDuration,
353
- Z as formatNumberAsSize,
354
- ee as formatNumberAsStorageSize,
353
+ ee as formatNumberAsDuration,
354
+ Q as formatNumberAsSize,
355
+ Y as formatNumberAsStorageSize,
355
356
  E as formatNumberAsWholeNumber,
356
- se as getComponentStatus,
357
+ oe as getComponentStatus,
357
358
  _ as getCurrentTimestamp,
358
- ae as getDataFormats,
359
- ne as getRecordDelimiters,
360
- oe as getValueDelimiters,
361
- te as lookupMimeTypeForExtension,
359
+ te as getDataFormats,
360
+ ae as getRecordDelimiters,
361
+ ne as getValueDelimiters,
362
+ re as lookupMimeTypeForExtension,
362
363
  X as normalizeToError,
363
364
  k as presentationViewTypeMap,
364
365
  G as serialiseError,
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Build connector configuration.
2
+ * Development utilities.
3
3
  */
4
4
  export declare function buildConnectorConfig(): Promise<void>;
@@ -49,7 +49,6 @@ export { type CytoscapeJSView, useCytoscapeJS } from './composables/useCytoscape
49
49
  export { useDataTable } from './composables/useDataTable';
50
50
  export { type HighchartsView, useHighcharts } from './composables/useHighcharts';
51
51
  export { APIError, ApplicationError, EngineError, FetchError, OperationalError, VueError, WindowRuntimeError, WindowPromiseRejectionError } from './errors';
52
- export { buildConnectorConfig } from './devOps';
53
52
  export { buildFetchError, concatenateSerialisedErrorMessages, normalizeToError, serialiseError } from './errors';
54
53
  export { convertMillisecondsToTimestamp, getCurrentTimestamp } from './timestamp';
55
54
  export { convertODataTypeIdToUsageTypeId } from './utilities';
@@ -58,3 +57,4 @@ export { formatNumberAsDecimalNumber, formatNumberAsDuration, formatNumberAsSize
58
57
  export { getDataFormats, getRecordDelimiters, getValueDelimiters } from './component/dataView';
59
58
  export { getComponentStatus } from './component';
60
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.116",
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"