@datapos/datapos-shared 0.3.110 → 0.3.116

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
- const R = 0, L = (e) => e, F = () => Date.now(), _ = {
1
+ import { promises as x } 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 k() {
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 O() {
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 v = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", E = "highcharts";
33
- let b, w = !1;
34
- function M() {
33
+ const S = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", I = "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 g = {
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
- }, m = b.chart(u, g, h);
48
- return { chart: m, resize: () => m.reflow(), vendorId: E };
48
+ }, g = b.chart(u, m, h);
49
+ return { chart: g, resize: () => g.reflow(), vendorId: I };
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 g = {
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
- }, m = b.chart(u, g, h);
63
- return { chart: m, resize: () => m.reflow(), vendorId: E };
63
+ }, g = b.chart(u, m, h);
64
+ return { chart: g, resize: () => g.reflow(), vendorId: I };
64
65
  }
65
66
  async function a(n, s, u, h) {
66
67
  await Promise.all([r(), o()]);
67
- const l = [], g = [];
68
+ const l = [], m = [];
68
69
  for (let f = 0; f < s.data.measures[0].data.length; f++)
69
- g.push([s.data.measures[0].data[f][0], s.data.measures[1].data[f][0]]);
70
- l.push({ type: n.options.highchartsType, name: "Unknown", data: g });
71
- const m = {
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, m, h);
79
- return { chart: c, resize: () => c.reflow(), vendorId: E };
79
+ }, c = b.chart(u, g, h);
80
+ return { chart: c, resize: () => c.reflow(), vendorId: I };
80
81
  }
81
82
  async function r() {
82
83
  if (b) return;
@@ -90,68 +91,68 @@ function M() {
90
91
  );
91
92
  }
92
93
  async function o() {
93
- if (w) return;
94
- await import(`${v}highcharts-more.src.js`), w = !0;
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
  }
98
- class I extends Error {
99
+ class w extends Error {
99
100
  locator;
100
101
  constructor(t, a, r) {
101
102
  super(t, r), this.name = "DataPosError", this.locator = a, Error.captureStackTrace?.(this, new.target);
102
103
  }
103
104
  }
104
- class p extends I {
105
+ class p extends w {
105
106
  constructor(t, a, r) {
106
107
  super(t, a, r), this.name = "ApplicationError";
107
108
  }
108
109
  }
109
- class U extends p {
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 B extends p {
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 T extends p {
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 S extends p {
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 j extends p {
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 H extends p {
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 W extends I {
143
+ class z extends w {
143
144
  constructor(t, a, r) {
144
145
  super(t, a, r), this.name = "OperationalError";
145
146
  }
146
147
  }
147
- async function z(e, t, a) {
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 T(r, a, o);
150
+ return new D(r, a, o);
150
151
  }
151
- function P(e) {
152
+ function V(e) {
152
153
  return e.map((t) => t.message).join(" ");
153
154
  }
154
- function V(e, t = "Unknown error.") {
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,17 +161,17 @@ function V(e, t = "Unknown error.") {
160
161
  return new Error(t);
161
162
  }
162
163
  }
163
- function X(e) {
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 T)
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 S)
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
- else if (r instanceof I)
174
+ else if (r instanceof w)
174
175
  o = { locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
175
176
  else if (r instanceof Error) {
176
177
  const n = r;
@@ -180,7 +181,15 @@ function X(e) {
180
181
  }
181
182
  return a;
182
183
  }
183
- const D = "en-US", y = {}, G = (e) => {
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
193
  switch (e) {
185
194
  case "Edm.Binary":
186
195
  return "unknown";
@@ -219,17 +228,17 @@ const D = "en-US", y = {}, G = (e) => {
219
228
  default:
220
229
  return "unknown";
221
230
  }
222
- }, J = (e) => {
231
+ }, Q = (e) => {
223
232
  if (e) {
224
233
  const t = e.lastIndexOf("/"), a = e.lastIndexOf(".", t > -1 ? t : e.length);
225
234
  return a > -1 ? e.substring(0, a) : e;
226
235
  }
227
- }, K = (e) => {
236
+ }, Y = (e) => {
228
237
  if (e) {
229
238
  const t = e.lastIndexOf(".");
230
239
  if (t > -1) return e.substring(t + 1);
231
240
  }
232
- }, i = (e, t = 2, a = t, r = D) => {
241
+ }, i = (e, t = 2, a = t, r = v) => {
233
242
  if (e == null) return "";
234
243
  const o = `${r}decimal${t}.${a}`;
235
244
  let n = y[o];
@@ -241,7 +250,7 @@ const D = "en-US", y = {}, G = (e) => {
241
250
  style: "decimal",
242
251
  useGrouping: !0
243
252
  }), y[o] = n), n.format(e);
244
- }, 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 = D) => {
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) => {
245
254
  if (e == null) return "";
246
255
  const a = `${t}decimal0.0`;
247
256
  let r = y[a];
@@ -253,7 +262,7 @@ const D = "en-US", y = {}, G = (e) => {
253
262
  style: "decimal",
254
263
  useGrouping: !0
255
264
  }), y[a] = r), r.format(e);
256
- }, Z = (e) => {
265
+ }, te = (e) => {
257
266
  switch (e) {
258
267
  case "csv":
259
268
  return "text/csv";
@@ -275,19 +284,19 @@ const D = "en-US", y = {}, G = (e) => {
275
284
  { id: "xls", label: { "en-gb": "XLS" } },
276
285
  { id: "xlsx", label: { "en-gb": "XLSX" } },
277
286
  { id: "xml", label: { "en-gb": "XML" } }
278
- ], ee = (e = d) => {
287
+ ], ae = (e = d) => {
279
288
  const t = [];
280
289
  for (const a of A) t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
281
290
  return t;
282
- }, N = [
291
+ }, C = [
283
292
  { id: `
284
293
  `, label: { "en-gb": "Newline" } },
285
294
  { id: "\r", label: { "en-gb": "Carriage Return" } },
286
295
  { id: `\r
287
296
  `, label: { "en-gb": "Carriage Return/Newline" } }
288
- ], re = (e = d) => {
297
+ ], ne = (e = d) => {
289
298
  const t = [];
290
- for (const a of N)
299
+ for (const a of C)
291
300
  t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
292
301
  return t;
293
302
  }, $ = [
@@ -302,12 +311,12 @@ const D = "en-US", y = {}, G = (e) => {
302
311
  { id: "_", label: { "en-gb": "Underscore" } },
303
312
  { id: "0x1F", label: { "en-gb": "Unit Separator" } },
304
313
  { id: "|", label: { "en-gb": "Vertical Bar" } }
305
- ], te = (e = d) => {
314
+ ], oe = (e = d) => {
306
315
  const t = [];
307
316
  for (const a of $)
308
317
  t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
309
318
  return t;
310
- }, C = [
319
+ }, R = [
311
320
  { id: "alpha", color: "red", label: { "en-gb": "alpha" } },
312
321
  { id: "beta", color: "amber", label: { "en-gb": "beta" } },
313
322
  { id: "generalAvailability", color: "green", label: { "en-gb": "" } },
@@ -317,42 +326,43 @@ const D = "en-US", y = {}, G = (e) => {
317
326
  { id: "releaseCandidate", color: "green", label: { "en-gb": "release-candidate" } },
318
327
  { id: "unavailable", color: "other", label: { "en-gb": "unavailable" } },
319
328
  { id: "underReview", color: "other", label: { "en-gb": "under-review" } }
320
- ], ae = (e, t = d) => {
321
- const a = C.find((r) => r.id === e);
329
+ ], se = (e, t = d) => {
330
+ const a = R.find((r) => r.id === e);
322
331
  return a ? { ...a, label: a.label[t] || a.label[d] || e } : { id: e, color: "other", label: e };
323
332
  }, d = "en-gb";
324
333
  export {
325
- U as APIError,
334
+ B as APIError,
326
335
  p as ApplicationError,
327
336
  d as DEFAULT_LOCALE_CODE,
328
- R as DefaultTimestamp,
329
- B as EngineError,
330
- T as FetchError,
331
- W as OperationalError,
332
- S as VueError,
333
- H as WindowPromiseRejectionError,
334
- j as WindowRuntimeError,
335
- z as buildFetchError,
336
- P as concatenateSerialisedErrorMessages,
337
- L as convertMillisecondsToTimestamp,
338
- G as convertODataTypeIdToUsageTypeId,
339
- K as extractExtensionFromPath,
340
- J as extractNameFromPath,
337
+ L as DefaultTimestamp,
338
+ H as EngineError,
339
+ D as FetchError,
340
+ z as OperationalError,
341
+ N as VueError,
342
+ W as WindowPromiseRejectionError,
343
+ J as WindowRuntimeError,
344
+ K as buildConnectorConfig,
345
+ P as buildFetchError,
346
+ V as concatenateSerialisedErrorMessages,
347
+ O as convertMillisecondsToTimestamp,
348
+ q as convertODataTypeIdToUsageTypeId,
349
+ Y as extractExtensionFromPath,
350
+ Q as extractNameFromPath,
341
351
  i as formatNumberAsDecimalNumber,
342
- Y as formatNumberAsDuration,
343
- q as formatNumberAsSize,
344
- Q as formatNumberAsStorageSize,
345
- x as formatNumberAsWholeNumber,
346
- ae as getComponentStatus,
347
- F as getCurrentTimestamp,
348
- ee as getDataFormats,
349
- re as getRecordDelimiters,
350
- te as getValueDelimiters,
351
- Z as lookupMimeTypeForExtension,
352
- V as normalizeToError,
353
- _ as presentationViewTypeMap,
354
- X as serialiseError,
355
- k as useCytoscapeJS,
356
- O as useDataTable,
357
- M as useHighcharts
352
+ re as formatNumberAsDuration,
353
+ Z as formatNumberAsSize,
354
+ ee as formatNumberAsStorageSize,
355
+ E as formatNumberAsWholeNumber,
356
+ se as getComponentStatus,
357
+ _ as getCurrentTimestamp,
358
+ ae as getDataFormats,
359
+ ne as getRecordDelimiters,
360
+ oe as getValueDelimiters,
361
+ te as lookupMimeTypeForExtension,
362
+ X as normalizeToError,
363
+ k as presentationViewTypeMap,
364
+ G as serialiseError,
365
+ M as useCytoscapeJS,
366
+ U as useDataTable,
367
+ j as useHighcharts
358
368
  };
@@ -35,6 +35,10 @@ export interface ConnectorConfig extends ComponentConfig {
35
35
  vendorHomeURL?: string;
36
36
  version: string;
37
37
  }
38
+ export type ConnectorLocalisedConfig = Omit<ConnectorConfig, 'label' | 'description'> & {
39
+ label: string;
40
+ description: string;
41
+ };
38
42
  export type ConnectorImplementation = {
39
43
  activeConnectionCount?: number;
40
44
  canDescribe?: boolean;
@@ -44,10 +48,6 @@ export type ConnectorImplementation = {
44
48
  maxConnectionCount?: number;
45
49
  params?: Record<string, string>[];
46
50
  };
47
- export type ConnectorLocalisedConfig = Omit<ConnectorConfig, 'label' | 'description'> & {
48
- label: string;
49
- description: string;
50
- };
51
51
  export type ConnectorTools = {
52
52
  csvParse: typeof csvParse;
53
53
  dataPos: {
@@ -3,6 +3,7 @@ export interface Context {
3
3
  readonly config: ContextConfig;
4
4
  list(settings?: ContextListSettings): Promise<ContextListResult>;
5
5
  }
6
+ export type ContextOperationSettings = {};
6
7
  export type ContextListSettings = {};
7
8
  export type ContextListResult = {
8
9
  models: ContextModelGroupConfig[];
@@ -1,4 +1,4 @@
1
- import { PreviewColumn } from './Z_PreviewColumn';
1
+ import { PreviewColumn } from '../../Z_PreviewColumn';
2
2
  export type ParsedValue = {
3
3
  isValid: boolean;
4
4
  value: bigint | boolean | number | string | null;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Build connector configuration.
3
+ */
4
+ export declare function buildConnectorConfig(): Promise<void>;
@@ -1,7 +1,7 @@
1
- import { ConnectionConfig } from './component/connector/connection';
2
- import { AuditContentResult, ConnectorCallbackData, ConnectorOperationSettings, InitialiseSettings, ListResult, RetrieveResult } from './component/connector';
3
- import { ContextCallbackData, ContextConfig, ContextOperationSettings } from './component/context';
4
- import { DataViewPreviewConfig, EncodingConfig } from './component/dataView';
1
+ import { ConnectionConfig } from '../component/connector/connection';
2
+ import { AuditContentResult, ConnectorCallbackData, ConnectorOperationSettings, InitialiseSettings, ListResult, RetrieveResult } from '../component/connector';
3
+ import { ContextCallbackData, ContextConfig, ContextOperationSettings } from '../component/context';
4
+ import { DataViewPreviewConfig, EncodingConfig } from '../component/dataView';
5
5
  type InitialiseEngine = (settings: InitialiseSettings) => Promise<void>;
6
6
  type ProcessConnectorRequest = (id: string, connectionConfig: ConnectionConfig, settings: ConnectorOperationSettings, callback?: ((callbackData: ContextCallbackData) => void) | undefined) => Promise<ContextInterfaceResult>;
7
7
  export type ContextInterfaceResult = AuditContentResult | DataViewPreviewConfig | ListResult | RetrieveResult;
@@ -49,6 +49,7 @@ 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';
52
53
  export { buildFetchError, concatenateSerialisedErrorMessages, normalizeToError, serialiseError } from './errors';
53
54
  export { convertMillisecondsToTimestamp, getCurrentTimestamp } from './timestamp';
54
55
  export { convertODataTypeIdToUsageTypeId } from './utilities';
@@ -1,5 +1,5 @@
1
- import { ContextModelGroupConfig } from './component/context';
2
- import { LocalisedString } from './index';
1
+ import { ContextModelGroupConfig } from '../component/context';
2
+ import { LocalisedString } from '../index';
3
3
  interface ModuleConfig {
4
4
  id: string;
5
5
  label: Partial<LocalisedString>;
@@ -1,2 +1,5 @@
1
+ /**
2
+ * Vite configuration.
3
+ */
1
4
  declare const _default: import('vite').UserConfig;
2
5
  export default _default;
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.110",
5
+ "version": "0.3.116",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"
@@ -35,7 +35,7 @@
35
35
  "prettier": "^3.6.2",
36
36
  "retire": "^5.3.0",
37
37
  "typescript": "^5.9.3",
38
- "vite": "^7.1.12",
38
+ "vite": "^7.2.1",
39
39
  "vite-plugin-dts": "^4.5.4"
40
40
  },
41
41
  "scripts": {