@datapos/datapos-shared 0.3.73 → 0.3.77

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,58 +1,58 @@
1
- const h = 0, x = (e) => e, w = () => Date.now();
2
- class d extends Error {
1
+ const x = 0, w = (e) => e, D = () => Date.now();
2
+ class u extends Error {
3
3
  locator;
4
4
  constructor(t, n, r) {
5
5
  super(t, r), this.name = "DataPosError", this.locator = n, Error.captureStackTrace?.(this, new.target);
6
6
  }
7
7
  }
8
- class i extends d {
8
+ class l extends u {
9
9
  constructor(t, n, r) {
10
10
  super(t, n, r), this.name = "ApplicationError";
11
11
  }
12
12
  }
13
- class N extends i {
13
+ class N extends l {
14
14
  constructor(t, n, r) {
15
15
  super(t, n, r), this.name = "APIError";
16
16
  }
17
17
  }
18
- class S extends i {
18
+ class S extends l {
19
19
  constructor(t, n, r) {
20
20
  super(t, n, r), this.name = "EngineError";
21
21
  }
22
22
  }
23
- class u extends i {
23
+ class m extends l {
24
24
  body;
25
25
  constructor(t, n, r, a) {
26
26
  super(t, n, a), this.name = "FetchError", this.body = r;
27
27
  }
28
28
  }
29
- class f extends i {
29
+ class g extends l {
30
30
  componentName;
31
31
  info;
32
32
  constructor(t, n, r, a, s) {
33
33
  super(t, n, s), this.name = "VueHandledError", this.info = r, this.componentName = a;
34
34
  }
35
35
  }
36
- class y extends i {
36
+ class y extends l {
37
37
  constructor(t, n, r) {
38
38
  super(t, n, r), this.name = "WindowHandledRuntimeError";
39
39
  }
40
40
  }
41
- class D extends i {
41
+ class $ extends l {
42
42
  constructor(t, n, r) {
43
43
  super(t, n, r), this.name = "WindowHandledPromiseRejectionError";
44
44
  }
45
45
  }
46
- class $ extends d {
46
+ class v extends u {
47
47
  constructor(t, n, r) {
48
48
  super(t, n, r), this.name = "OperationalError";
49
49
  }
50
50
  }
51
- async function v(e, t, n) {
51
+ async function T(e, t, n) {
52
52
  const r = `${t} Response status '${e.status}${e.statusText ? ` - ${e.statusText}` : ""}' received.`, a = await e.text();
53
- return new u(r, n, a);
53
+ return new m(r, n, a);
54
54
  }
55
- function T(e) {
55
+ function F(e) {
56
56
  return e.map((t) => t.message).join(" ");
57
57
  }
58
58
  function I(e, t = "Unknown error.") {
@@ -64,17 +64,17 @@ function I(e, t = "Unknown error.") {
64
64
  return new Error(t);
65
65
  }
66
66
  }
67
- function F(e) {
67
+ function A(e) {
68
68
  const t = /* @__PURE__ */ new Set(), n = [];
69
69
  let r = e;
70
70
  for (; r && !t.has(r); ) {
71
71
  t.add(r);
72
72
  let a;
73
- if (r instanceof u)
73
+ if (r instanceof m)
74
74
  a = { body: r.body, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
75
- else if (r instanceof f)
75
+ else if (r instanceof g)
76
76
  a = { componentName: r.componentName, info: r.info, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
77
- else if (r instanceof d)
77
+ else if (r instanceof u)
78
78
  a = { locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
79
79
  else if (r instanceof Error) {
80
80
  const s = r;
@@ -84,7 +84,7 @@ function F(e) {
84
84
  }
85
85
  return n;
86
86
  }
87
- const m = "en-US", l = {}, k = (e) => {
87
+ const f = "en-US", c = {}, k = (e) => {
88
88
  switch (e) {
89
89
  case "Edm.Binary":
90
90
  return "unknown";
@@ -123,7 +123,7 @@ const m = "en-US", l = {}, k = (e) => {
123
123
  default:
124
124
  return "unknown";
125
125
  }
126
- }, A = (e) => {
126
+ }, O = (e) => {
127
127
  if (e) {
128
128
  const t = e.lastIndexOf("/"), n = e.lastIndexOf(".", t > -1 ? t : e.length);
129
129
  return n > -1 ? e.substring(0, n) : e;
@@ -133,10 +133,10 @@ const m = "en-US", l = {}, k = (e) => {
133
133
  const t = e.lastIndexOf(".");
134
134
  if (t > -1) return e.substring(t + 1);
135
135
  }
136
- }, o = (e, t = 2, n = t, r = m) => {
136
+ }, o = (e, t = 2, n = t, r = f) => {
137
137
  if (e == null) return "";
138
138
  const a = `${r}decimal${t}.${n}`;
139
- let s = l[a];
139
+ let s = c[a];
140
140
  return s || (s = new Intl.NumberFormat(r, {
141
141
  localeMatcher: "best fit",
142
142
  maximumFractionDigits: t,
@@ -144,11 +144,11 @@ const m = "en-US", l = {}, k = (e) => {
144
144
  minimumIntegerDigits: 1,
145
145
  style: "decimal",
146
146
  useGrouping: !0
147
- }), l[a] = s), s.format(e);
148
- }, M = (e) => e == null ? "" : e < 1e3 ? c(e) : e < 1e6 ? `${o(e / 1e3, 2, 0)}K` : e < 1e9 ? `${o(e / 1e6, 2, 0)}M` : e < 1e12 ? `${o(e / 1e9, 2, 0)}B` : `${o(e / 1e12, 2, 0)}T`, R = (e) => e == null ? "" : e === 1 ? "1 byte" : e < 1024 ? `${c(e)} bytes` : e < 1048576 ? `${o(e / 1024, 2, 0)} KB` : e < 1073741824 ? `${o(e / 1048576, 2, 0)} MB` : e < 1099511627776 ? `${o(e / 1073741824, 2, 0)} GB` : `${o(e / 1099511627776, 2, 0)} TB`, O = (e) => e == null ? "" : e < 1e3 ? `${c(e)} ms` : e === 1e3 ? `${c(e)} sec` : e < 6e4 ? `${o(e / 1e3, 2, 0)} secs` : e === 6e4 ? "1 min" : e < 36e5 ? `${o(e / 6e4, 2, 0)} mins` : e === 36e5 ? "1 hr" : e < 864e5 ? `${o(e / 36e5, 2, 0)} hrs` : e === 864e5 ? "1 day" : `${o(e / 864e5, 2, 0)} days`, c = (e, t = m) => {
147
+ }), c[a] = s), s.format(e);
148
+ }, C = (e) => e == null ? "" : e < 1e3 ? d(e) : e < 1e6 ? `${o(e / 1e3, 2, 0)}K` : e < 1e9 ? `${o(e / 1e6, 2, 0)}M` : e < 1e12 ? `${o(e / 1e9, 2, 0)}B` : `${o(e / 1e12, 2, 0)}T`, M = (e) => e == null ? "" : e === 1 ? "1 byte" : e < 1024 ? `${d(e)} bytes` : e < 1048576 ? `${o(e / 1024, 2, 0)} KB` : e < 1073741824 ? `${o(e / 1048576, 2, 0)} MB` : e < 1099511627776 ? `${o(e / 1073741824, 2, 0)} GB` : `${o(e / 1099511627776, 2, 0)} TB`, R = (e) => e == null ? "" : e < 1e3 ? `${d(e)} ms` : e === 1e3 ? `${d(e)} sec` : e < 6e4 ? `${o(e / 1e3, 2, 0)} secs` : e === 6e4 ? "1 min" : e < 36e5 ? `${o(e / 6e4, 2, 0)} mins` : e === 36e5 ? "1 hr" : e < 864e5 ? `${o(e / 36e5, 2, 0)} hrs` : e === 864e5 ? "1 day" : `${o(e / 864e5, 2, 0)} days`, d = (e, t = f) => {
149
149
  if (e == null) return "";
150
150
  const n = `${t}decimal0.0`;
151
- let r = l[n];
151
+ let r = c[n];
152
152
  return r || (r = new Intl.NumberFormat(t, {
153
153
  localeMatcher: "best fit",
154
154
  maximumFractionDigits: 0,
@@ -156,8 +156,8 @@ const m = "en-US", l = {}, k = (e) => {
156
156
  minimumIntegerDigits: 1,
157
157
  style: "decimal",
158
158
  useGrouping: !0
159
- }), l[n] = r), r.format(e);
160
- }, C = (e) => {
159
+ }), c[n] = r), r.format(e);
160
+ }, L = (e) => {
161
161
  switch (e) {
162
162
  case "csv":
163
163
  return "text/csv";
@@ -171,85 +171,88 @@ const m = "en-US", l = {}, k = (e) => {
171
171
  default:
172
172
  return "application/octet-stream";
173
173
  }
174
- }, p = [
175
- { id: "dtv", label: { en: "Delimited Text" } },
176
- { id: "e/e", label: { en: "Entity/Event" } },
177
- { id: "jsonArray", label: { en: "JSON Array" } },
178
- { id: "spss", label: { en: "SPSS" } },
179
- { id: "xls", label: { en: "XLS" } },
180
- { id: "xlsx", label: { en: "XLSX" } },
181
- { id: "xml", label: { en: "XML" } }
182
- ], U = (e = "en") => {
174
+ }, b = [
175
+ { id: "dtv", label: { "en-gb": "Delimited Text" } },
176
+ { id: "e/e", label: { "en-gb": "Entity/Event" } },
177
+ { id: "jsonArray", label: { "en-gb": "JSON Array" } },
178
+ { id: "spss", label: { "en-gb": "SPSS" } },
179
+ { id: "xls", label: { "en-gb": "XLS" } },
180
+ { id: "xlsx", label: { "en-gb": "XLSX" } },
181
+ { id: "xml", label: { "en-gb": "XML" } }
182
+ ], U = (e = i) => {
183
183
  const t = [];
184
- for (const n of p) t.push({ ...n, label: n.label[e] || n.label.en || n.id });
184
+ for (const n of b) t.push({ ...n, label: n.label[e] || n.label[i] || n.id });
185
185
  return t;
186
- }, E = [
186
+ }, p = [
187
187
  { id: `
188
- `, label: { en: "Newline" } },
189
- { id: "\r", label: { en: "Carriage Return" } },
188
+ `, label: { "en-gb": "Newline" } },
189
+ { id: "\r", label: { "en-gb": "Carriage Return" } },
190
190
  { id: `\r
191
- `, label: { en: "Carriage Return/Newline" } }
192
- ], W = (e = "en") => {
191
+ `, label: { "en-gb": "Carriage Return/Newline" } }
192
+ ], W = (e = i) => {
193
193
  const t = [];
194
- for (const n of E) t.push({ ...n, label: n.label[e] || n.label.en || n.id });
194
+ for (const n of p)
195
+ t.push({ ...n, label: n.label[e] || n.label[i] || n.id });
195
196
  return t;
196
- }, b = [
197
- { id: ":", label: { en: "Colon" } },
198
- { id: ",", label: { en: "Comma" } },
199
- { id: "!", label: { en: "Exclamation Mark" } },
200
- // { id: '', label: { en: 'Other' } }, // TODO: Maybe set this to a 'not printing' or special ascii character when there is a user supplied delimited, rather than ''?
201
- { id: "0x1E", label: { en: "Record Separator" } },
202
- { id: ";", label: { en: "Semicolon" } },
203
- { id: " ", label: { en: "Space" } },
204
- { id: " ", label: { en: "Tab" } },
205
- { id: "_", label: { en: "Underscore" } },
206
- { id: "0x1F", label: { en: "Unit Separator" } },
207
- { id: "|", label: { en: "Vertical Bar" } }
208
- ], j = (e = "en") => {
197
+ }, E = [
198
+ { id: ":", label: { "en-gb": "Colon" } },
199
+ { id: ",", label: { "en-gb": "Comma" } },
200
+ { id: "!", label: { "en-gb": "Exclamation Mark" } },
201
+ // { id: '', label: { 'en-gb': 'Other' } }, // TODO: Maybe set this to a 'not printing' or special ascii character when there is a user supplied delimited, rather than ''?
202
+ { id: "0x1E", label: { "en-gb": "Record Separator" } },
203
+ { id: ";", label: { "en-gb": "Semicolon" } },
204
+ { id: " ", label: { "en-gb": "Space" } },
205
+ { id: " ", label: { "en-gb": "Tab" } },
206
+ { id: "_", label: { "en-gb": "Underscore" } },
207
+ { id: "0x1F", label: { "en-gb": "Unit Separator" } },
208
+ { id: "|", label: { "en-gb": "Vertical Bar" } }
209
+ ], j = (e = i) => {
209
210
  const t = [];
210
- for (const n of b) t.push({ ...n, label: n.label[e] || n.label.en || n.id });
211
+ for (const n of E)
212
+ t.push({ ...n, label: n.label[e] || n.label[i] || n.id });
211
213
  return t;
212
- }, g = [
213
- { id: "alpha", color: "red", label: { en: "alpha" } },
214
- { id: "beta", color: "amber", label: { en: "beta" } },
215
- { id: "generalAvailability", label: { en: "" } },
216
- { id: "notApplicable", label: { en: "not-applicable" } },
217
- { id: "preAlpha", color: "red", label: { en: "pre-alpha" } },
218
- { id: "proposed", color: "other", label: { en: "proposed" } },
219
- { id: "releaseCandidate", label: { en: "release-candidate" } },
220
- { id: "unavailable", color: "other", label: { en: "unavailable" } },
221
- { id: "underReview", color: "other", label: { en: "under-review" } }
222
- ], G = (e, t = "en") => {
223
- const n = g.find((r) => r.id === e);
224
- return n ? { ...n, label: n.label[t] || n.label.en || e } : { id: e, color: "other", label: e };
225
- };
214
+ }, h = [
215
+ { id: "alpha", color: "red", label: { "en-gb": "alpha" } },
216
+ { id: "beta", color: "amber", label: { "en-gb": "beta" } },
217
+ { id: "generalAvailability", color: "green", label: { "en-gb": "" } },
218
+ { id: "notApplicable", color: "green", label: { "en-gb": "not-applicable" } },
219
+ { id: "preAlpha", color: "red", label: { "en-gb": "pre-alpha" } },
220
+ { id: "proposed", color: "other", label: { "en-gb": "proposed" } },
221
+ { id: "releaseCandidate", color: "green", label: { "en-gb": "release-candidate" } },
222
+ { id: "unavailable", color: "other", label: { "en-gb": "unavailable" } },
223
+ { id: "underReview", color: "other", label: { "en-gb": "under-review" } }
224
+ ], G = (e, t = i) => {
225
+ const n = h.find((r) => r.id === e);
226
+ return n ? { ...n, label: n.label[t] || n.label[i] || e } : { id: e, color: "other", label: e };
227
+ }, i = "en-gb";
226
228
  export {
227
229
  N as APIError,
228
- i as ApplicationError,
229
- h as DefaultTimestamp,
230
+ l as ApplicationError,
231
+ i as DEFAULT_LOCALE_CODE,
232
+ x as DefaultTimestamp,
230
233
  S as EngineError,
231
- u as FetchError,
232
- $ as OperationalError,
233
- f as VueError,
234
- D as WindowPromiseRejectionError,
234
+ m as FetchError,
235
+ v as OperationalError,
236
+ g as VueError,
237
+ $ as WindowPromiseRejectionError,
235
238
  y as WindowRuntimeError,
236
- v as buildFetchError,
237
- T as concatenateSerialisedErrorMessages,
238
- x as convertMillisecondsToTimestamp,
239
+ T as buildFetchError,
240
+ F as concatenateSerialisedErrorMessages,
241
+ w as convertMillisecondsToTimestamp,
239
242
  k as convertODataTypeIdToUsageTypeId,
240
243
  B as extractExtensionFromPath,
241
- A as extractNameFromPath,
244
+ O as extractNameFromPath,
242
245
  o as formatNumberAsDecimalNumber,
243
- O as formatNumberAsDuration,
244
- M as formatNumberAsSize,
245
- R as formatNumberAsStorageSize,
246
- c as formatNumberAsWholeNumber,
246
+ R as formatNumberAsDuration,
247
+ C as formatNumberAsSize,
248
+ M as formatNumberAsStorageSize,
249
+ d as formatNumberAsWholeNumber,
247
250
  G as getComponentStatus,
248
- w as getCurrentTimestamp,
251
+ D as getCurrentTimestamp,
249
252
  U as getDataFormats,
250
253
  W as getRecordDelimiters,
251
254
  j as getValueDelimiters,
252
- C as lookupMimeTypeForExtension,
255
+ L as lookupMimeTypeForExtension,
253
256
  I as normalizeToError,
254
- F as serialiseError
257
+ A as serialiseError
255
258
  };
@@ -1,9 +1,10 @@
1
1
  import { Timestamp } from './timestamp';
2
+ import { LocaleCode, StatusColorId } from './index';
2
3
  export interface ComponentConfig {
3
- description: Record<string, string>;
4
+ description: Record<LocaleCode, string>;
4
5
  firstCreatedAt?: Timestamp;
5
6
  id: string;
6
- label: Record<string, string>;
7
+ label: Record<LocaleCode, string>;
7
8
  lastUpdatedAt?: Timestamp;
8
9
  icon?: string;
9
10
  iconDark?: string;
@@ -13,14 +14,13 @@ export interface ComponentConfig {
13
14
  }
14
15
  export interface ComponentRef {
15
16
  id: string;
16
- label: Record<string, string>;
17
+ label: Record<LocaleCode, string>;
17
18
  }
18
- export type ComponentTypeId = 'app' | 'connection' | 'connector' | 'dimension' | 'engine' | 'focus' | 'model' | 'dataView' | 'eventQuery' | 'presentation' | 'presenter' | 'recipe' | 'tutorial';
19
- export type StatusColorId = 'amber' | 'red' | 'other';
20
- export type ComponentStatusId = 'alpha' | 'beta' | 'generalAvailability' | 'notApplicable' | 'preAlpha' | 'proposed' | 'releaseCandidate' | 'unavailable' | 'underReview';
21
19
  export type ComponentStatus = {
22
20
  id: string;
23
- color?: StatusColorId;
21
+ color: StatusColorId;
24
22
  label: string;
25
23
  };
24
+ export type ComponentStatusId = 'alpha' | 'beta' | 'generalAvailability' | 'notApplicable' | 'preAlpha' | 'proposed' | 'releaseCandidate' | 'unavailable' | 'underReview';
26
25
  export declare const getComponentStatus: (id: string, localeId?: string) => ComponentStatus;
26
+ export type ComponentTypeId = 'app' | 'engine' | 'connector' | 'connectorConnection' | 'context' | 'contextFocus' | 'contextFocusModel' | 'contextFocusModelDimension' | 'contextFocusModelDimensionHierarchy' | 'contextFocusModelEntity' | 'contextFocusModelEntityDataItems' | 'contextFocusModelEntityEvent' | 'contextFocusModelEntityPrimaryMeasure' | 'contextFocusModelSecondaryMeasure' | 'dataView' | 'dimension' | 'eventQuery' | 'presenter' | 'presenterPresentation' | 'informer' | 'informerDocument';
@@ -2,9 +2,9 @@ import { parse as csvParse } from 'csv-parse/browser/esm';
2
2
  import { parse as dateFnsParse } from 'date-fns';
3
3
  import { nanoid } from 'nanoid';
4
4
  import { ComponentConfig } from './component';
5
- import { convertMillisecondsToTimestamp } from '.';
6
5
  import { buildFetchError, OperationalError } from './errors';
7
6
  import { ConnectionConfig, ConnectionDescription, ConnectionNodeConfig } from './connection';
7
+ import { convertMillisecondsToTimestamp } from '.';
8
8
  import { DataViewContentAuditConfig, ValueDelimiterId } from './dataView';
9
9
  import { extractExtensionFromPath, extractNameFromPath, lookupMimeTypeForExtension } from './utilities';
10
10
  export interface Connector {
@@ -1,7 +1,8 @@
1
+ export declare const DEFAULT_LOCALE_CODE = "en-gb";
1
2
  export { DefaultTimestamp } from './timestamp';
2
- export type { ComponentConfig, ComponentRef, ComponentStatus, ComponentStatusId, ComponentTypeId, StatusColorId } from './component';
3
- export type { ConnectionAuthorizationConfig, ConnectionColumnConfig, ConnectionConfig, ConnectionNodeConfig } from './connection';
4
- export type { DPAFileSystemFileHandle, Encoding, StorageTypeId, UsageTypeId } from './connection';
3
+ export type LocaleCode = 'en-au' | 'en-gb' | 'en-us' | 'es-es';
4
+ export type StatusColorId = 'amber' | 'green' | 'red' | 'other';
5
+ export type { ComponentConfig, ComponentRef, ComponentStatus, ComponentStatusId, ComponentTypeId } from './component';
5
6
  export type { AuditContentResult, AuditContentSettings } from './connector';
6
7
  export type { Connector, ConnectorCallbackData, ConnectorConfig, ConnectorImplementation, ConnectorOperationSettings, ConnectorLocalisedConfig, ConnectorTools } from './connector';
7
8
  export type { CreateSettings } from './connector';
@@ -14,6 +15,8 @@ export type { PreviewResult, PreviewSettings } from './connector';
14
15
  export type { RemoveSettings } from './connector';
15
16
  export type { RetrieveResult, RetrieveSettings, RetrieveSummary } from './connector';
16
17
  export type { UpsertSettings } from './connector';
18
+ export type { ConnectionAuthorizationConfig, ConnectionColumnConfig, ConnectionConfig, ConnectionNodeConfig } from './connection';
19
+ export type { DPAFileSystemFileHandle, Encoding, StorageTypeId, UsageTypeId } from './connection';
17
20
  export type { Context, ContextConfig, ContextFocusConfig, ContextFocusConfigListResult, ContextFocusConfigListSettings, ContextModelConfig, ContextDimensionConfig, ContextDimensionGroupConfig, ContextEntityCharacteristicConfig, ContextEntityGroupConfig, ContextEntityComputationConfig, ContextSecondaryMeasureGroupConfig, ContextViewGroupConfig, ContextFocusLocalisedConfig } from './context';
18
21
  export type { ContextEntityConfig, ContextEntityEventConfig, ContextHierarchyConfig, ContextViewConfig, Event } from './context';
19
22
  export type { DataFormatId, EncodingConfig, RecordDelimiterId, ValueDelimiterId } from './dataView';
@@ -23,6 +26,7 @@ export type { ConnectorInterfaceResult, ContextInterfaceResult, Engine, EngineWo
23
26
  export type { SerialisedError } from './errors';
24
27
  export type { EventQueryConfig, EventQueryLocalisedConfig } from './eventQuery';
25
28
  export type { Presenter, PresenterConfig, PresenterItemConfig, PresenterLocalisedConfig, PresenterTools } from './presenter';
29
+ export type { PresentationView } from './presenter';
26
30
  export type { Recipe, RecipeConfig, RecipeLocalisedConfig } from './recipe';
27
31
  export type { ServiceData } from './service';
28
32
  export type { StateConfig } from './state';
@@ -9,6 +9,10 @@ export interface Presenter {
9
9
  export type PresenterTools = {
10
10
  markdownIt: typeof markdownIt;
11
11
  };
12
+ export interface PresentationView {
13
+ resize: () => void;
14
+ vendorId: string;
15
+ }
12
16
  export interface PresenterConfig extends ComponentConfig {
13
17
  version: string;
14
18
  }
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.73",
5
+ "version": "0.3.77",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"