@datapos/datapos-shared 0.3.395 → 0.3.398

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,9 +1,27 @@
1
- import { connectorConfigSchema as r } from "./datapos-shared.es.js";
2
- const e = (a) => {
3
- const t = Object.entries(a).filter((n) => typeof n[1] == "string");
4
- return new Map(t);
1
+ import { DEFAULT_LOCALE_CODE as a } from "./datapos-shared.es.js";
2
+ import { connectorConfigSchema as g } from "./datapos-shared.es.js";
3
+ const n = (t) => {
4
+ const o = Object.entries(t).filter((e) => typeof e[1] == "string");
5
+ return new Map(o);
6
+ }, i = [
7
+ { id: "application", labels: n({ "en-gb": "Application" }) },
8
+ { id: "curatedDataset", labels: n({ "en-gb": "Curated Dataset" }) },
9
+ { id: "database", labels: n({ "en-gb": "Database" }) },
10
+ { id: "fileStore", labels: n({ "en-gb": "File Store" }) }
11
+ ], l = (t, o, e = a) => {
12
+ const r = t.get(o);
13
+ if (r !== void 0) return r;
14
+ if (e !== o)
15
+ return t.get(e);
16
+ }, c = (t, o = a) => {
17
+ const e = i.find((r) => r.id === t);
18
+ if (e) {
19
+ const r = l(e.labels, o);
20
+ return { id: e.id, label: r ?? e.id };
21
+ }
22
+ return { id: t, label: t };
5
23
  };
6
- e({ "en-gb": "Application" }), e({ "en-gb": "Curated Dataset" }), e({ "en-gb": "Database" }), e({ "en-gb": "File Store" });
7
24
  export {
8
- r as connectorConfigSchema
25
+ g as connectorConfigSchema,
26
+ c as getConnectorCategory
9
27
  };
@@ -2,8 +2,8 @@ import { InferOutput } from 'valibot';
2
2
  import { Component } from '..';
3
3
  import { connectorConfigSchema } from './connectorConfig.schema';
4
4
  import { ToolConfig } from '../tool';
5
- import { ConnectionConfig, ConnectionDescription, ConnectionNodeConfig } from './connection';
6
5
  import { ValueDelimiterId } from '../dataView';
6
+ import { ConnectionConfig, ConnectionDescription, ConnectionNodeConfig } from './connection';
7
7
  /** Authentication method identifiers supported by a connector implementation. */
8
8
  /** Connector implementation. */
9
9
  /** Category identifiers used for grouping and filtering connectors. */
@@ -16,39 +16,42 @@ type ConnectorLocalisedConfig = Omit<ConnectorConfig, 'label' | 'description'> &
16
16
  description: string;
17
17
  };
18
18
  /** Connector runtime interface. */
19
- interface Connector extends Component {
19
+ interface ConnectorInterface extends Component {
20
20
  abortController: AbortController | undefined;
21
21
  readonly config: ConnectorConfig;
22
22
  readonly connectionConfig: ConnectionConfig;
23
23
  readonly toolConfigs: ToolConfig[];
24
- abortOperation?(connector: Connector): void;
24
+ abortOperation?(connector: ConnectorInterface): void;
25
25
  authenticateConnection?(accountId: string, windowCenterX: number, windowCenterY: number): Window;
26
- createObject?(connector: Connector, settings: CreateSettings): Promise<void>;
27
- describeConnection?(connector: Connector, settings: DescribeSettings): Promise<DescribeResult>;
28
- dropObject?(connector: Connector, settings: DropSettings): Promise<void>;
29
- findObject?(connector: Connector, findSettings: FindSettings): Promise<FindResult>;
30
- getReadableStream?(connector: Connector, getSettings: GetReadableStreamSettings): Promise<GetReadableStreamResult>;
31
- getRecord?(connector: Connector, getSettings: GetRecordSettings): Promise<GetRecordResult>;
32
- listNodes?(connector: Connector, settings: ListSettings): Promise<ListResult>;
33
- previewObject?(connector: Connector, settings: PreviewSettings): Promise<PreviewResult>;
34
- removeRecords?(connector: Connector, settings: RemoveSettings): Promise<void>;
35
- retrieveChunks?(connector: Connector, settings: RetrieveChunksSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveChunksSummary) => void): Promise<void>;
36
- retrieveRecords?(connector: Connector, settings: RetrieveRecordsSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveRecordsSummary) => void): Promise<void>;
37
- upsertRecords?(connector: Connector, settings: UpsertSettings): Promise<void>;
38
- }
39
- /** Get readable stream result and settings. */
40
- interface GetReadableStreamResult {
41
- readable?: ReadableStream<unknown>;
42
- }
43
- interface GetReadableStreamSettings extends ConnectorOperationSettings {
44
- id: string;
45
- path: string;
46
- }
26
+ createObject?(connector: ConnectorInterface, settings: CreateSettings): Promise<void>;
27
+ describeConnection?(connector: ConnectorInterface, settings: DescribeSettings): Promise<DescribeResult>;
28
+ dropObject?(connector: ConnectorInterface, settings: DropSettings): Promise<void>;
29
+ findObject?(connector: ConnectorInterface, settings: FindObjectSettings): Promise<string | undefined>;
30
+ getReadableStream?(connector: ConnectorInterface, settings: GetReadableStreamSettings): Promise<ReadableStream<Uint8Array<ArrayBuffer>>>;
31
+ getRecord?(connector: ConnectorInterface, settings: GetRecordSettings): Promise<GetRecordResult>;
32
+ listNodes?(connector: ConnectorInterface, settings: ListSettings): Promise<ListResult>;
33
+ previewObject?(connector: ConnectorInterface, settings: PreviewSettings): Promise<PreviewResult>;
34
+ removeRecords?(connector: ConnectorInterface, settings: RemoveSettings): Promise<void>;
35
+ retrieveChunks?(connector: ConnectorInterface, settings: RetrieveChunksSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveChunksSummary) => void): Promise<void>;
36
+ retrieveRecords?(connector: ConnectorInterface, settings: RetrieveRecordsSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveRecordsSummary) => void): Promise<void>;
37
+ upsertRecords?(connector: ConnectorInterface, settings: UpsertSettings): Promise<void>;
38
+ }
39
+ /** Connector operation settings. */
47
40
  interface ConnectorOperationSettings {
48
41
  accountId?: string;
49
42
  appCheckToken?: string;
50
43
  sessionAccessToken?: string;
51
44
  }
45
+ /** Get find object settings. */
46
+ interface FindObjectSettings extends ConnectorOperationSettings {
47
+ containerName?: string;
48
+ objectName: string;
49
+ }
50
+ /** Get readable stream settings. */
51
+ interface GetReadableStreamSettings extends ConnectorOperationSettings {
52
+ id: string;
53
+ path: string;
54
+ }
52
55
  interface CreateSettings extends ConnectorOperationSettings {
53
56
  accountId?: string;
54
57
  path: string;
@@ -61,13 +64,6 @@ interface DescribeResult {
61
64
  interface DropSettings extends ConnectorOperationSettings {
62
65
  path: string;
63
66
  }
64
- interface FindSettings extends ConnectorOperationSettings {
65
- containerName?: string;
66
- objectName: string;
67
- }
68
- interface FindResult {
69
- folderPath?: string;
70
- }
71
67
  interface GetRecordSettings extends ConnectorOperationSettings {
72
68
  id: string;
73
69
  path: string;
@@ -138,12 +134,15 @@ interface UpsertSettings extends ConnectorOperationSettings {
138
134
  records: Record<string, unknown>[];
139
135
  path: string;
140
136
  }
141
- interface ConnectorCallbackData {
142
- typeId: string;
143
- properties: Record<string, unknown>;
137
+ /** Types/Interfaces/Operations - Connector category. */
138
+ interface ConnectorCategory {
139
+ id: string;
140
+ label: string;
144
141
  }
142
+ declare const getConnectorCategory: (id: string, localeId?: import('../../index').LocaleCode) => ConnectorCategory;
145
143
  /** Exports. */
144
+ export { getConnectorCategory };
146
145
  export type { ConnectionColumnConfig, ConnectionConfig, ConnectionNodeConfig, Encoding, UsageTypeId } from './connection';
147
- export type { Connector, ConnectorCallbackData, ConnectorConfig, ConnectorLocalisedConfig, ConnectorOperationSettings };
148
- export type { CreateSettings, DropSettings, FindResult, FindSettings, GetReadableStreamResult, GetReadableStreamSettings, GetRecordResult, GetRecordSettings, ListResult, ListSettings, PreviewResult, PreviewSettings, RemoveSettings, RetrieveChunksResult, RetrieveChunksSettings, RetrieveChunksSummary, RetrieveRecordsResult, RetrieveRecordsSettings, RetrieveRecordsSummary, UpsertSettings };
146
+ export type { ConnectorConfig, ConnectorInterface, ConnectorLocalisedConfig, ConnectorOperationSettings };
147
+ export type { CreateSettings, DropSettings, FindObjectSettings, GetReadableStreamSettings, GetRecordResult, GetRecordSettings, ListResult, ListSettings, PreviewResult, PreviewSettings, RemoveSettings, RetrieveChunksResult, RetrieveChunksSettings, RetrieveChunksSummary, RetrieveRecordsResult, RetrieveRecordsSettings, RetrieveRecordsSummary, UpsertSettings };
149
148
  export { connectorConfigSchema } from './connectorConfig.schema';
@@ -1,20 +1,15 @@
1
1
  import { InferOutput } from 'valibot';
2
- import { componentConfigSchema, componentReferenceSchema, componentStatusColorIdSchema, componentStatusIdSchema, componentStatusSchema, componentTypeIdSchema } from './componentConfig.schema';
2
+ import { componentConfigSchema, componentStatusSchema } from './componentConfig.schema';
3
3
  import { LocaleCode } from '../index';
4
4
  /** Component. */
5
5
  interface Component {
6
6
  readonly config: ComponentConfig;
7
7
  }
8
- /** */
9
8
  type ComponentConfig = InferOutput<typeof componentConfigSchema>;
10
- type ComponentReference = InferOutput<typeof componentReferenceSchema>;
11
9
  type ComponentStatus = InferOutput<typeof componentStatusSchema>;
12
- type ComponentStatusColorId = InferOutput<typeof componentStatusColorIdSchema>;
13
- type ComponentStatusId = InferOutput<typeof componentStatusIdSchema>;
14
- type ComponentTypeId = InferOutput<typeof componentTypeIdSchema>;
15
10
  declare function getComponentStatus(id: string, localeId?: LocaleCode): ComponentStatus;
16
11
  /** Exports */
17
12
  export { getComponentStatus };
18
13
  export { componentConfigSchema } from './componentConfig.schema';
19
- export type { Component, ComponentConfig, ComponentReference, ComponentStatus, ComponentStatusId, ComponentTypeId, ComponentStatusColorId };
14
+ export type { Component, ComponentConfig };
20
15
  export type { ModuleConfig, ModuleTypeId } from './module';
@@ -1,6 +1,6 @@
1
1
  import { ConnectionConfig } from '../component/connector/connection';
2
2
  import { ToolConfig } from '../component/tool';
3
- import { ConnectorCallbackData, ConnectorOperationSettings, ListResult, RetrieveRecordsResult } from '../component/connector';
3
+ import { ConnectorOperationSettings, ListResult, RetrieveRecordsResult } from '../component/connector';
4
4
  import { ContextCallbackData, ContextConfig, ContextOperationSettings } from '../component/context';
5
5
  import { DataViewContentAuditConfig, DataViewPreviewConfig, EncodingConfig, ValueDelimiterId } from '../component/dataView';
6
6
  interface EngineInitialiseSettings {
@@ -19,6 +19,11 @@ interface AuditContentResult {
19
19
  contentAuditConfig: DataViewContentAuditConfig;
20
20
  }
21
21
  type ConnectorInterfaceResult = AuditContentResult | DataViewPreviewConfig | ListResult | RetrieveRecordsResult;
22
+ /** Connector callback data. */
23
+ interface ConnectorCallbackData {
24
+ typeId: string;
25
+ properties: Record<string, unknown>;
26
+ }
22
27
  type ProcessContextRequest = (id: string, contextConfig: ContextConfig, settings: ContextOperationSettings, callback?: (callbackData: ConnectorCallbackData) => void) => Promise<ContextInterfaceResult>;
23
28
  type ContextInterfaceResult = AuditContentResult | DataViewPreviewConfig | ListResult | RetrieveRecordsResult;
24
29
  type ProcessTestRequest = (settings: TestSettings) => Promise<Record<string, unknown>>;
@@ -40,4 +45,4 @@ interface EngineWorker {
40
45
  processTestRequest: ProcessTestRequest;
41
46
  }
42
47
  /** Exports. */
43
- export type { AuditContentSettings, AuditContentResult, ConnectorInterfaceResult, ContextInterfaceResult, EngineInterface, EngineWorker, EngineInitialiseSettings, TestSettings };
48
+ export type { AuditContentSettings, AuditContentResult, ConnectorCallbackData, ConnectorInterfaceResult, ContextInterfaceResult, EngineInterface, EngineWorker, EngineInitialiseSettings, TestSettings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.395",
3
+ "version": "0.3.398",
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>",
@@ -51,11 +51,6 @@
51
51
  "dist"
52
52
  ],
53
53
  "prettier": "@datapos/datapos-development/prettierrc",
54
- "peerDependencies": {
55
- "csv-parse": "^6.1.0",
56
- "date-fns": "^4.1.0",
57
- "nanoid": "^5.1.6"
58
- },
59
54
  "devDependencies": {
60
55
  "@datapos/datapos-development": "^0.3.424",
61
56
  "@datapos/eslint-config-datapos": "^1.0.28",
@@ -74,7 +69,6 @@
74
69
  "license-report-check": "^0.1.2",
75
70
  "license-report-recursive": "^6.8.2",
76
71
  "md-to-pdf": "^5.2.5",
77
- "nanoid": "^5.1.6",
78
72
  "npm-check-updates": "^19.2.0",
79
73
  "owasp-dependency-check": "^1.0.0",
80
74
  "prettier": "^3.7.4",