@datapos/datapos-shared 0.3.334 → 0.3.335

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,3 @@
1
- const D = "en-gb";
2
1
  let j;
3
2
  // @__NO_SIDE_EFFECTS__
4
3
  function H(e) {
@@ -132,11 +131,11 @@ function B(e) {
132
131
  };
133
132
  }
134
133
  // @__NO_SIDE_EFFECTS__
135
- function w(e, r) {
134
+ function D(e, r) {
136
135
  return {
137
136
  kind: "schema",
138
137
  type: "literal",
139
- reference: w,
138
+ reference: D,
140
139
  expects: /* @__PURE__ */ U(e),
141
140
  async: !1,
142
141
  literal: e,
@@ -375,7 +374,7 @@ function G(e, r) {
375
374
  }
376
375
  };
377
376
  }
378
- const v = (e) => /* @__PURE__ */ G(e.map((r) => /* @__PURE__ */ w(r))), te = /* @__PURE__ */ b({
377
+ const v = (e) => /* @__PURE__ */ G(e.map((r) => /* @__PURE__ */ D(r))), te = /* @__PURE__ */ b({
379
378
  "en-au": /* @__PURE__ */ l(),
380
379
  "en-gb": /* @__PURE__ */ l(),
381
380
  "en-us": /* @__PURE__ */ l(),
@@ -452,7 +451,7 @@ const oe = /* @__PURE__ */ b({
452
451
  }), E = (e) => {
453
452
  const r = Object.entries(e).filter((t) => typeof t[1] == "string");
454
453
  return new Map(r);
455
- }, ie = (e, r, t = D) => {
454
+ }, ie = (e, r, t = I) => {
456
455
  const n = e.get(r);
457
456
  if (n !== void 0) return n;
458
457
  if (t !== r)
@@ -467,7 +466,7 @@ const oe = /* @__PURE__ */ b({
467
466
  { id: "releaseCandidate", color: "green", labels: E({ "en-gb": "release-candidate" }) },
468
467
  { id: "unavailable", color: "other", labels: E({ "en-gb": "unavailable" }) },
469
468
  { id: "underReview", color: "other", labels: E({ "en-gb": "under-review" }) }
470
- ], ke = (e, r = D) => {
469
+ ], ke = (e, r = I) => {
471
470
  const t = ae.find((n) => n.id === e);
472
471
  if (t) {
473
472
  const n = ie(t.labels, r);
@@ -499,7 +498,7 @@ const oe = /* @__PURE__ */ b({
499
498
  params: /* @__PURE__ */ f(/* @__PURE__ */ x(/* @__PURE__ */ R(/* @__PURE__ */ l(), /* @__PURE__ */ l())))
500
499
  }), De = /* @__PURE__ */ b({
501
500
  ...$,
502
- typeId: /* @__PURE__ */ w("connector"),
501
+ typeId: /* @__PURE__ */ D("connector"),
503
502
  category: /* @__PURE__ */ y(/* @__PURE__ */ b({ id: /* @__PURE__ */ l(), label: /* @__PURE__ */ l() })),
504
503
  categoryId: ce,
505
504
  implementations: /* @__PURE__ */ R(/* @__PURE__ */ l(), de),
@@ -515,12 +514,12 @@ const oe = /* @__PURE__ */ b({
515
514
  O({ "en-gb": "Application" }), O({ "en-gb": "Curated Dataset" }), O({ "en-gb": "Database" }), O({ "en-gb": "File Store" });
516
515
  const fe = v(["list"]), me = /* @__PURE__ */ b({
517
516
  ...T,
518
- typeId: /* @__PURE__ */ w("contextModelGroup"),
517
+ typeId: /* @__PURE__ */ D("contextModelGroup"),
519
518
  modelRefs: /* @__PURE__ */ x(P),
520
519
  order: /* @__PURE__ */ k()
521
520
  }), Oe = /* @__PURE__ */ b({
522
521
  ...$,
523
- typeId: /* @__PURE__ */ w("context"),
522
+ typeId: /* @__PURE__ */ D("context"),
524
523
  models: /* @__PURE__ */ x(me),
525
524
  operations: /* @__PURE__ */ x(fe)
526
525
  });
@@ -530,40 +529,40 @@ class F extends Error {
530
529
  super(r, n), this.name = "DataPosError", this.locator = t;
531
530
  }
532
531
  }
533
- class I extends F {
532
+ class w extends F {
534
533
  constructor(r, t, n) {
535
534
  super(r, t, n), this.name = "ApplicationError";
536
535
  }
537
536
  }
538
- class Ce extends I {
537
+ class Ce extends w {
539
538
  constructor(r, t, n) {
540
539
  super(r, t, n), this.name = "APIError";
541
540
  }
542
541
  }
543
- class Me extends I {
542
+ class Me extends w {
544
543
  constructor(r, t, n) {
545
544
  super(r, t, n), this.name = "EngineError";
546
545
  }
547
546
  }
548
- class z extends I {
547
+ class z extends w {
549
548
  body;
550
549
  constructor(r, t, n, s) {
551
550
  super(r, t, s), this.name = "FetchError", this.body = n;
552
551
  }
553
552
  }
554
- class be extends I {
553
+ class be extends w {
555
554
  componentName;
556
555
  info;
557
556
  constructor(r, t, n, s, o) {
558
557
  super(r, t, o), this.name = "VueHandledError", this.info = n, this.componentName = s;
559
558
  }
560
559
  }
561
- class Ne extends I {
560
+ class Ne extends w {
562
561
  constructor(r, t, n) {
563
562
  super(r, t, n), this.name = "WindowHandledRuntimeError";
564
563
  }
565
564
  }
566
- class je extends I {
565
+ class je extends w {
567
566
  constructor(r, t, n) {
568
567
  super(r, t, n), this.name = "WindowHandledPromiseRejectionError";
569
568
  }
@@ -616,7 +615,7 @@ function Fe(e) {
616
615
  }
617
616
  const ye = v(["list", "render", "setColorMode"]), Le = /* @__PURE__ */ b({
618
617
  ...$,
619
- typeId: /* @__PURE__ */ w("presenter"),
618
+ typeId: /* @__PURE__ */ D("presenter"),
620
619
  presentations: /* @__PURE__ */ x(P),
621
620
  operations: /* @__PURE__ */ x(ye)
622
621
  });
@@ -735,7 +734,7 @@ function Ke(e) {
735
734
  return "application/octet-stream";
736
735
  }
737
736
  }
738
- const c = (e) => new Map(Object.entries(e)), L = (e, r, t = D) => {
737
+ const c = (e) => new Map(Object.entries(e)), L = (e, r, t = I) => {
739
738
  const n = e.get(r);
740
739
  if (n !== void 0) return n;
741
740
  if (t !== r)
@@ -748,7 +747,7 @@ const c = (e) => new Map(Object.entries(e)), L = (e, r, t = D) => {
748
747
  { id: "xls", labels: c({ "en-gb": "XLS" }) },
749
748
  { id: "xlsx", labels: c({ "en-gb": "XLSX" }) },
750
749
  { id: "xml", labels: c({ "en-gb": "XML" }) }
751
- ], We = (e = D) => {
750
+ ], We = (e = I) => {
752
751
  const r = [];
753
752
  for (const t of ve) {
754
753
  const n = L(t.labels, e);
@@ -761,7 +760,7 @@ const c = (e) => new Map(Object.entries(e)), L = (e, r, t = D) => {
761
760
  { id: "\r", labels: c({ "en-gb": "Carriage Return" }) },
762
761
  { id: `\r
763
762
  `, labels: c({ "en-gb": "Carriage Return/Newline" }) }
764
- ], Xe = (e = D) => {
763
+ ], Xe = (e = I) => {
765
764
  const r = [];
766
765
  for (const t of Ee) {
767
766
  const n = L(t.labels, e);
@@ -780,20 +779,20 @@ const c = (e) => new Map(Object.entries(e)), L = (e, r, t = D) => {
780
779
  { id: "_", labels: c({ "en-gb": "Underscore" }) },
781
780
  { id: "0x1F", labels: c({ "en-gb": "Unit Separator" }) },
782
781
  { id: "|", labels: c({ "en-gb": "Vertical Bar" }) }
783
- ], Je = (e = D) => {
782
+ ], Je = (e = I) => {
784
783
  const r = [];
785
784
  for (const t of xe) {
786
785
  const n = L(t.labels, e);
787
786
  r.push({ id: t.id, label: n ?? t.id });
788
787
  }
789
788
  return r;
790
- };
789
+ }, I = "en-gb";
791
790
  export {
792
791
  Ce as APIError,
793
- I as ApplicationError,
792
+ w as ApplicationError,
794
793
  we as CONNECTOR_DESTINATION_OPERATIONS,
795
794
  Ie as CONNECTOR_SOURCE_OPERATIONS,
796
- D as DEFAULT_LOCALE_CODE,
795
+ I as DEFAULT_LOCALE_CODE,
797
796
  Me as EngineError,
798
797
  z as FetchError,
799
798
  Ae as OperationalError,
@@ -1,5 +1,5 @@
1
1
  import { ComponentConfig } from '..';
2
- import { ConnectorConfig } from './types';
2
+ import { ConnectorConfig } from '.';
3
3
  export interface ConnectionAuthorizationConfig {
4
4
  accessToken: string;
5
5
  accountId: string;
@@ -1,11 +1,177 @@
1
- /**
2
- * Connector composables, constants, errors, types/interfaces and utilities.
3
- */
4
- export type * from './types';
1
+ import { parse as csvParse } from 'csv-parse/browser/esm';
2
+ import { parse as dateFnsParse } from 'date-fns';
3
+ import { InferOutput } from 'valibot';
4
+ import { nanoid } from 'nanoid';
5
+ import { Component } from '..';
6
+ import { buildFetchError, OperationalError } from '../../errors';
7
+ import { ConnectionConfig, ConnectionDescription, ConnectionNodeConfig } from './connection';
8
+ import { connectorCategoryIdSchema, connectorConfigSchema, connectorImplementationSchema, connectorOperationNameSchema, connectorUsageIdSchema } from './connectorConfig.schema';
9
+ import { DataViewContentAuditConfig, ValueDelimiterId } from '../dataView';
10
+ import { extractExtensionFromPath, extractNameFromPath, lookupMimeTypeForExtension } from '../../utilities';
11
+ /** Interfaces/Types - Connector category identifier. */
12
+ export type ConnectorCategoryId = InferOutput<typeof connectorCategoryIdSchema>;
13
+ /** Interfaces/Types - Connector operation name. */
14
+ export type ConnectorOperationName = InferOutput<typeof connectorOperationNameSchema>;
15
+ /** Interfaces/Types - Connector usage identifier. */
16
+ export type ConnectorUsageId = InferOutput<typeof connectorUsageIdSchema>;
17
+ /** Interfaces/Types - Connector implementation. */
18
+ export type ConnectorImplementation = InferOutput<typeof connectorImplementationSchema>;
19
+ /** Interfaces/Types - Connector configuration. */
20
+ export type ConnectorConfig = InferOutput<typeof connectorConfigSchema>;
21
+ export type ConnectorLocalisedConfig = Omit<ConnectorConfig, 'label' | 'description'> & {
22
+ label: string;
23
+ description: string;
24
+ };
25
+ /** Interfaces/Types - Connector. */
26
+ export interface Connector extends Component {
27
+ abortController?: AbortController;
28
+ readonly config: ConnectorConfig;
29
+ readonly connectionConfig: ConnectionConfig;
30
+ readonly tools: ConnectorTools;
31
+ abortOperation?(connector: Connector): void;
32
+ authenticateConnection?(accountId: string, windowCenterX: number, windowCenterY: number): Window;
33
+ createObject?(connector: Connector, settings: CreateSettings): Promise<void>;
34
+ describeConnection?(connector: Connector, settings: DescribeSettings): Promise<DescribeResult>;
35
+ dropObject?(connector: Connector, settings: DropSettings): Promise<void>;
36
+ findObject?(connector: Connector, findSettings: FindSettings): Promise<FindResult>;
37
+ getReadableStream?(connector: Connector, getSettings: GetReadableStreamSettings): Promise<GetReadableStreamResult>;
38
+ getRecord?(connector: Connector, getSettings: GetRecordSettings): Promise<GetRecordResult>;
39
+ listNodes?(connector: Connector, settings: ListSettings): Promise<ListResult>;
40
+ previewObject?(connector: Connector, settings: PreviewSettings): Promise<PreviewResult>;
41
+ removeRecords?(connector: Connector, settings: RemoveSettings): Promise<void>;
42
+ retrieveChunks?(connector: Connector, settings: RetrieveChunksSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveChunksSummary) => void): Promise<void>;
43
+ retrieveRecords?(connector: Connector, settings: RetrieveRecordsSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveRecordsSummary) => void): Promise<void>;
44
+ upsertRecords?(connector: Connector, settings: UpsertSettings): Promise<void>;
45
+ }
46
+ export interface ConnectorTools {
47
+ csvParse: typeof csvParse;
48
+ dataPos: {
49
+ buildFetchError: typeof buildFetchError;
50
+ extractExtensionFromPath: typeof extractExtensionFromPath;
51
+ extractNameFromPath: typeof extractNameFromPath;
52
+ lookupMimeTypeForExtension: typeof lookupMimeTypeForExtension;
53
+ OperationalError: typeof OperationalError;
54
+ };
55
+ dateFns: {
56
+ parse: typeof dateFnsParse;
57
+ };
58
+ nanoid: typeof nanoid;
59
+ }
5
60
  /** Constants */
6
61
  export declare const CONNECTOR_DESTINATION_OPERATIONS: string[];
7
62
  export declare const CONNECTOR_SOURCE_OPERATIONS: string[];
8
63
  export interface InitialiseSettings {
64
+ connectorStorageURLPrefix: string;
65
+ }
66
+ export interface ConnectorOperationSettings {
67
+ accountId?: string;
68
+ appCheckToken?: string;
69
+ sessionAccessToken?: string;
70
+ }
71
+ export interface AuditContentSettings extends ConnectorOperationSettings {
72
+ chunkSize?: number;
73
+ encodingId: string;
74
+ path: string;
75
+ valueDelimiterId: ValueDelimiterId;
76
+ }
77
+ export interface AuditContentResult {
78
+ contentAuditConfig: DataViewContentAuditConfig;
79
+ }
80
+ export interface CreateSettings extends ConnectorOperationSettings {
81
+ accountId?: string;
82
+ path: string;
83
+ structure: string;
84
+ }
85
+ export type DescribeSettings = ConnectorOperationSettings;
86
+ export interface DescribeResult {
87
+ description: ConnectionDescription;
88
+ }
89
+ export interface DropSettings extends ConnectorOperationSettings {
90
+ path: string;
91
+ }
92
+ export interface FindSettings extends ConnectorOperationSettings {
93
+ containerName?: string;
94
+ objectName: string;
95
+ }
96
+ export interface FindResult {
97
+ folderPath?: string;
98
+ }
99
+ export interface GetReadableStreamSettings extends ConnectorOperationSettings {
100
+ id: string;
101
+ path: string;
102
+ }
103
+ export interface GetReadableStreamResult {
104
+ readable?: ReadableStream<unknown>;
105
+ }
106
+ export interface GetRecordSettings extends ConnectorOperationSettings {
107
+ id: string;
108
+ path: string;
109
+ }
110
+ export interface GetRecordResult {
111
+ record?: string[] | Record<string, unknown>;
112
+ }
113
+ export interface ListSettings extends ConnectorOperationSettings {
114
+ folderPath: string;
115
+ limit?: number;
116
+ offset?: number;
117
+ totalCount?: number;
118
+ }
119
+ export interface ListResult {
120
+ cursor: string | number | undefined;
121
+ connectionNodeConfigs: ConnectionNodeConfig[];
122
+ isMore: boolean;
123
+ totalCount: number;
124
+ }
125
+ export interface PreviewSettings extends ConnectorOperationSettings {
126
+ chunkSize?: number;
127
+ extension?: string;
128
+ path: string;
129
+ }
130
+ export interface PreviewResult {
131
+ data: Record<string, unknown>[] | Uint8Array;
132
+ typeId: 'jsonArray' | 'uint8Array';
133
+ }
134
+ export interface RemoveSettings extends ConnectorOperationSettings {
135
+ keys: string[];
136
+ path: string;
137
+ }
138
+ export interface RetrieveChunksSettings extends ConnectorOperationSettings {
139
+ chunkSize?: number;
140
+ encodingId: string;
141
+ path: string;
142
+ valueDelimiterId: ValueDelimiterId;
143
+ }
144
+ export interface RetrieveRecordsSettings extends ConnectorOperationSettings {
145
+ chunkSize?: number;
146
+ encodingId: string;
147
+ path: string;
148
+ valueDelimiterId: ValueDelimiterId;
149
+ }
150
+ export interface RetrieveRecordsResult {
151
+ records: (string[] | Record<string, unknown>)[];
152
+ }
153
+ export interface RetrieveChunksSummary {
154
+ byteCount: number;
155
+ commentLineCount: number;
156
+ emptyLineCount: number;
157
+ invalidFieldLengthCount: number;
158
+ lineCount: number;
159
+ recordCount: number;
160
+ }
161
+ export interface RetrieveRecordsSummary {
162
+ byteCount: number;
163
+ commentLineCount: number;
164
+ emptyLineCount: number;
165
+ invalidFieldLengthCount: number;
166
+ lineCount: number;
167
+ recordCount: number;
168
+ }
169
+ export interface UpsertSettings extends ConnectorOperationSettings {
170
+ records: Record<string, unknown>[];
171
+ path: string;
172
+ }
173
+ export interface ConnectorCallbackData {
174
+ typeId: string;
9
175
  properties: Record<string, unknown>;
10
176
  }
11
177
  /** Exposures */
@@ -1,6 +1,6 @@
1
1
  import { InferOutput } from 'valibot';
2
2
  import { contextConfigSchema } from './contextConfig.schema';
3
- import { LocalisedString } from '../../locales';
3
+ import { LocalisedString } from '../../index';
4
4
  import { Component, ComponentConfig, ComponentReference, ModuleConfig } from '..';
5
5
  export interface Context extends Component {
6
6
  readonly config: ContextConfig;
@@ -54,20 +54,20 @@ interface DataFormat {
54
54
  id: string;
55
55
  label: string;
56
56
  }
57
- export declare const getDataFormat: (id: string, localeId?: import('../../locales').LocaleCode) => DataFormat;
58
- export declare const getDataFormats: (localeId?: import('../../locales').LocaleCode) => DataFormat[];
57
+ export declare const getDataFormat: (id: string, localeId?: import('../../index').LocaleCode) => DataFormat;
58
+ export declare const getDataFormats: (localeId?: import('../../index').LocaleCode) => DataFormat[];
59
59
  interface RecordDelimiter {
60
60
  id: string;
61
61
  label: string;
62
62
  }
63
- export declare const getRecordDelimiter: (id: string, localeId?: import('../../locales').LocaleCode) => RecordDelimiter;
64
- export declare const getRecordDelimiters: (localeId?: import('../../locales').LocaleCode) => RecordDelimiter[];
63
+ export declare const getRecordDelimiter: (id: string, localeId?: import('../../index').LocaleCode) => RecordDelimiter;
64
+ export declare const getRecordDelimiters: (localeId?: import('../../index').LocaleCode) => RecordDelimiter[];
65
65
  interface ValueDelimiter {
66
66
  id: string;
67
67
  label: string;
68
68
  }
69
- export declare const getValueDelimiter: (id: string, localeId?: import('../../locales').LocaleCode) => ValueDelimiter;
70
- export declare const getValueDelimiters: (localeId?: import('../../locales').LocaleCode) => ValueDelimiter[];
69
+ export declare const getValueDelimiter: (id: string, localeId?: import('../../index').LocaleCode) => ValueDelimiter;
70
+ export declare const getValueDelimiters: (localeId?: import('../../index').LocaleCode) => ValueDelimiter[];
71
71
  export type ParsedValue = bigint | boolean | number | string | null;
72
72
  export type DataFormatId = 'dtv' | 'e/e' | 'jsonArray' | 'spss' | 'xls' | 'xlsx' | 'xml';
73
73
  export type RecordDelimiterId = '\n' | '\r' | '\r\n';
@@ -1,6 +1,6 @@
1
1
  import { InferOutput } from 'valibot';
2
2
  import { componentConfigSchema, componentStatusColorIdSchema, componentStatusIdSchema, componentStatusSchema, componentTypeIdSchema } from './componentConfig.schema';
3
- import { LocaleCode, LocalisedString } from '../locales';
3
+ import { LocaleCode, LocalisedString } from '../index';
4
4
  export interface Component {
5
5
  readonly config: ComponentConfig;
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { ConnectionConfig } from '../component/connector/connection';
2
- import { AuditContentResult, ConnectorCallbackData, ConnectorOperationSettings, InitialiseSettings, ListResult, RetrieveResult } from '../component/connector/types';
2
+ import { AuditContentResult, ConnectorCallbackData, ConnectorOperationSettings, InitialiseSettings, ListResult, RetrieveRecordsResult } from '../component/connector';
3
3
  import { Component, ModuleConfig } from '../component';
4
4
  import { ContextCallbackData, ContextConfig, ContextOperationSettings } from '../component/context';
5
5
  import { DataViewPreviewConfig, EncodingConfig } from '../component/dataView';
@@ -8,9 +8,9 @@ export interface EngineConfig extends ModuleConfig {
8
8
  }
9
9
  type InitialiseEngine = (settings: InitialiseSettings) => Promise<void>;
10
10
  type ProcessConnectorRequest = (id: string, connectionConfig: ConnectionConfig, settings: ConnectorOperationSettings, callback?: (callbackData: ContextCallbackData) => void) => Promise<ConnectorInterfaceResult>;
11
- export type ConnectorInterfaceResult = AuditContentResult | DataViewPreviewConfig | ListResult | RetrieveResult;
11
+ export type ConnectorInterfaceResult = AuditContentResult | DataViewPreviewConfig | ListResult | RetrieveRecordsResult;
12
12
  type ProcessContextRequest = (id: string, contextConfig: ContextConfig, settings: ContextOperationSettings, callback?: (callbackData: ConnectorCallbackData) => void) => Promise<ContextInterfaceResult>;
13
- export type ContextInterfaceResult = AuditContentResult | DataViewPreviewConfig | ListResult | RetrieveResult;
13
+ export type ContextInterfaceResult = AuditContentResult | DataViewPreviewConfig | ListResult | RetrieveRecordsResult;
14
14
  type ProcessTestRequest = (settings: TestSettings) => Promise<Record<string, unknown>>;
15
15
  export interface TestSettings {
16
16
  action?: string;
@@ -2,7 +2,8 @@
2
2
  * Shared composables, constants, errors, interfaces, schemas, types and utilities.
3
3
  */
4
4
  /** Interfaces/Types */
5
- export type { LocaleCode, LocalisedString } from './locales';
5
+ export type LocaleCode = 'en-au' | 'en-gb' | 'en-us' | 'es-es';
6
+ export type LocalisedString = Record<LocaleCode, string>;
6
7
  /** Interfaces/Types - Component */
7
8
  export type { ComponentConfig, ComponentReference, ComponentStatus, ComponentStatusId, ComponentTypeId, ModuleConfig, ModuleTypeId, ComponentStatusColorId } from './component';
8
9
  /** Schemas - Component */
@@ -10,7 +11,7 @@ export { componentConfigSchema } from './component';
10
11
  /** Constants - Connector */
11
12
  export { CONNECTOR_DESTINATION_OPERATIONS, CONNECTOR_SOURCE_OPERATIONS } from './component/connector';
12
13
  /** Interfaces/Types Component - Connector */
13
- export type { AuditContentResult, AuditContentSettings, Connector, ConnectorCallbackData, ConnectorConfig, ConnectorImplementation, ConnectorLocalisedConfig, ConnectorOperationName, ConnectorOperationSettings, ConnectorTools, ConnectorUsageId, CreateSettings, DropSettings, FindResult, FindSettings, GetReadableStreamResult, GetReadableStreamSettings, GetRecordResult, GetRecordSettings, InitialiseSettings, ListResult, ListSettings, PreviewResult, PreviewSettings, RemoveSettings, RetrieveChunksSettings, RetrieveChunksSummary, RetrieveRecordsResult, RetrieveRecordsSettings, RetrieveRecordsSummary, UpsertSettings } from './component/connector/types';
14
+ export type { AuditContentResult, AuditContentSettings, Connector, ConnectorCallbackData, ConnectorConfig, ConnectorImplementation, ConnectorLocalisedConfig, ConnectorOperationName, ConnectorOperationSettings, ConnectorTools, ConnectorUsageId, CreateSettings, DropSettings, FindResult, FindSettings, GetReadableStreamResult, GetReadableStreamSettings, GetRecordResult, GetRecordSettings, InitialiseSettings, ListResult, ListSettings, PreviewResult, PreviewSettings, RemoveSettings, RetrieveChunksSettings, RetrieveChunksSummary, RetrieveRecordsResult, RetrieveRecordsSettings, RetrieveRecordsSummary, UpsertSettings } from './component/connector';
14
15
  /** Interfaces/Types - Connection */
15
16
  export type { ConnectionAuthorizationConfig, ConnectionColumnConfig, ConnectionConfig, ConnectionNodeConfig, DPAFileSystemFileHandle, Encoding, StorageTypeId, UsageTypeId } from './component/connector/connection';
16
17
  /** Schemas - Connector */
@@ -61,7 +62,7 @@ export type { ToolConfig } from './component/tool';
61
62
  export { type CytoscapeJSView, useCytoscapeJS } from './composables/useCytoscapeJS';
62
63
  export { useDataTable } from './composables/useDataTable';
63
64
  /** Constants */
64
- export { DEFAULT_LOCALE_CODE } from './locales';
65
+ export declare const DEFAULT_LOCALE_CODE: LocaleCode;
65
66
  /** Utilities */
66
67
  export { convertODataTypeIdToUsageTypeId } from './utilities';
67
68
  export { extractExtensionFromPath, extractNameFromPath } from './utilities';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.334",
3
+ "version": "0.3.335",
4
4
  "description": "A library containing common constants, types and utilities used across all Data Positioning projects.",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Terrell <terrell.jm@gmail.com>",
@@ -1,174 +0,0 @@
1
- import { parse as csvParse } from 'csv-parse/browser/esm';
2
- import { parse as dateFnsParse } from 'date-fns';
3
- import { InferOutput } from 'valibot';
4
- import { nanoid } from 'nanoid';
5
- import { Component } from '..';
6
- import { ConnectionConfig, ConnectionDescription, ConnectionNodeConfig } from './connection';
7
- import { connectorCategoryIdSchema, connectorConfigSchema, connectorImplementationSchema, connectorOperationNameSchema, connectorUsageIdSchema } from './connectorConfig.schema';
8
- import { DataViewContentAuditConfig, ValueDelimiterId } from '../dataView';
9
- import { buildFetchError, OperationalError } from '../../errors';
10
- import { extractExtensionFromPath, extractNameFromPath, lookupMimeTypeForExtension } from '../../utilities';
11
- /** Interfaces/Types - Connector category identifier. */
12
- export type ConnectorCategoryId = InferOutput<typeof connectorCategoryIdSchema>;
13
- /** Interfaces/Types - Connector operation name. */
14
- export type ConnectorOperationName = InferOutput<typeof connectorOperationNameSchema>;
15
- /** Interfaces/Types - Connector usage identifier. */
16
- export type ConnectorUsageId = InferOutput<typeof connectorUsageIdSchema>;
17
- /** Interfaces/Types - Connector implementation. */
18
- export type ConnectorImplementation = InferOutput<typeof connectorImplementationSchema>;
19
- /** Interfaces/Types - Connector configuration. */
20
- export type ConnectorConfig = InferOutput<typeof connectorConfigSchema>;
21
- export type ConnectorLocalisedConfig = Omit<ConnectorConfig, 'label' | 'description'> & {
22
- label: string;
23
- description: string;
24
- };
25
- /** Interfaces/Types - Connector. */
26
- export interface Connector extends Component {
27
- abortController?: AbortController;
28
- readonly config: ConnectorConfig;
29
- readonly connectionConfig: ConnectionConfig;
30
- readonly tools: ConnectorTools;
31
- abortOperation?(connector: Connector): void;
32
- authenticateConnection?(accountId: string, windowCenterX: number, windowCenterY: number): Window;
33
- createObject?(connector: Connector, settings: CreateSettings): Promise<void>;
34
- describeConnection?(connector: Connector, settings: DescribeSettings): Promise<DescribeResult>;
35
- dropObject?(connector: Connector, settings: DropSettings): Promise<void>;
36
- findObject?(connector: Connector, findSettings: FindSettings): Promise<FindResult>;
37
- getReadableStream?(connector: Connector, getSettings: GetReadableStreamSettings): Promise<GetReadableStreamResult>;
38
- getRecord?(connector: Connector, getSettings: GetRecordSettings): Promise<GetRecordResult>;
39
- listNodes?(connector: Connector, settings: ListSettings): Promise<ListResult>;
40
- previewObject?(connector: Connector, settings: PreviewSettings): Promise<PreviewResult>;
41
- removeRecords?(connector: Connector, settings: RemoveSettings): Promise<void>;
42
- retrieveChunks?(connector: Connector, settings: RetrieveChunksSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveChunksSummary) => void): Promise<void>;
43
- retrieveRecords?(connector: Connector, settings: RetrieveRecordsSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveRecordsSummary) => void): Promise<void>;
44
- upsertRecords?(connector: Connector, settings: UpsertSettings): Promise<void>;
45
- }
46
- export interface ConnectorTools {
47
- csvParse: typeof csvParse;
48
- dataPos: {
49
- buildFetchError: typeof buildFetchError;
50
- extractExtensionFromPath: typeof extractExtensionFromPath;
51
- extractNameFromPath: typeof extractNameFromPath;
52
- lookupMimeTypeForExtension: typeof lookupMimeTypeForExtension;
53
- OperationalError: typeof OperationalError;
54
- };
55
- dateFns: {
56
- parse: typeof dateFnsParse;
57
- };
58
- nanoid: typeof nanoid;
59
- }
60
- export interface InitialiseSettings {
61
- connectorStorageURLPrefix: string;
62
- }
63
- export interface ConnectorOperationSettings {
64
- accountId?: string;
65
- appCheckToken?: string;
66
- sessionAccessToken?: string;
67
- }
68
- export interface AuditContentSettings extends ConnectorOperationSettings {
69
- chunkSize?: number;
70
- encodingId: string;
71
- path: string;
72
- valueDelimiterId: ValueDelimiterId;
73
- }
74
- export interface AuditContentResult {
75
- contentAuditConfig: DataViewContentAuditConfig;
76
- }
77
- export interface CreateSettings extends ConnectorOperationSettings {
78
- accountId?: string;
79
- path: string;
80
- structure: string;
81
- }
82
- export type DescribeSettings = ConnectorOperationSettings;
83
- export interface DescribeResult {
84
- description: ConnectionDescription;
85
- }
86
- export interface DropSettings extends ConnectorOperationSettings {
87
- path: string;
88
- }
89
- export interface FindSettings extends ConnectorOperationSettings {
90
- containerName?: string;
91
- objectName: string;
92
- }
93
- export interface FindResult {
94
- folderPath?: string;
95
- }
96
- export interface GetReadableStreamSettings extends ConnectorOperationSettings {
97
- id: string;
98
- path: string;
99
- }
100
- export interface GetReadableStreamResult {
101
- readable?: ReadableStream<unknown>;
102
- }
103
- export interface GetRecordSettings extends ConnectorOperationSettings {
104
- id: string;
105
- path: string;
106
- }
107
- export interface GetRecordResult {
108
- record?: string[] | Record<string, unknown>;
109
- }
110
- export interface ListSettings extends ConnectorOperationSettings {
111
- folderPath: string;
112
- limit?: number;
113
- offset?: number;
114
- totalCount?: number;
115
- }
116
- export interface ListResult {
117
- cursor: string | number | undefined;
118
- connectionNodeConfigs: ConnectionNodeConfig[];
119
- isMore: boolean;
120
- totalCount: number;
121
- }
122
- export interface PreviewSettings extends ConnectorOperationSettings {
123
- chunkSize?: number;
124
- extension?: string;
125
- path: string;
126
- }
127
- export interface PreviewResult {
128
- data: Record<string, unknown>[] | Uint8Array;
129
- typeId: 'jsonArray' | 'uint8Array';
130
- }
131
- export interface RemoveSettings extends ConnectorOperationSettings {
132
- keys: string[];
133
- path: string;
134
- }
135
- export interface RetrieveChunksSettings extends ConnectorOperationSettings {
136
- chunkSize?: number;
137
- encodingId: string;
138
- path: string;
139
- valueDelimiterId: ValueDelimiterId;
140
- }
141
- export interface RetrieveRecordsSettings extends ConnectorOperationSettings {
142
- chunkSize?: number;
143
- encodingId: string;
144
- path: string;
145
- valueDelimiterId: ValueDelimiterId;
146
- }
147
- export interface RetrieveRecordsResult {
148
- records: (string[] | Record<string, unknown>)[];
149
- }
150
- export interface RetrieveChunksSummary {
151
- byteCount: number;
152
- commentLineCount: number;
153
- emptyLineCount: number;
154
- invalidFieldLengthCount: number;
155
- lineCount: number;
156
- recordCount: number;
157
- }
158
- export interface RetrieveRecordsSummary {
159
- byteCount: number;
160
- commentLineCount: number;
161
- emptyLineCount: number;
162
- invalidFieldLengthCount: number;
163
- lineCount: number;
164
- recordCount: number;
165
- }
166
- export type RetrieveResult = RetrieveRecordsResult;
167
- export interface UpsertSettings extends ConnectorOperationSettings {
168
- records: Record<string, unknown>[];
169
- path: string;
170
- }
171
- export interface ConnectorCallbackData {
172
- typeId: string;
173
- properties: Record<string, unknown>;
174
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Locale-related types and defaults shared across modules.
3
- */
4
- export type LocaleCode = 'en-au' | 'en-gb' | 'en-us' | 'es-es';
5
- export type LocalisedString = Record<LocaleCode, string>;
6
- /** Fallback locale used whenever a more specific locale is unavailable. */
7
- export declare const DEFAULT_LOCALE_CODE: LocaleCode;