@datapos/datapos-shared 0.3.376 → 0.3.377

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,16 @@
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 { connectorConfigSchema as b } from "./datapos-shared.es.js";
2
+ const e = (n) => {
3
+ const o = Object.entries(n).filter((t) => typeof t[1] == "string");
4
+ return new Map(o);
5
5
  };
6
6
  e({ "en-gb": "Application" }), e({ "en-gb": "Curated Dataset" }), e({ "en-gb": "Database" }), e({ "en-gb": "File Store" });
7
+ async function c(n, o) {
8
+ const t = `datapos-tool-${o}`, a = n.toolConfigs.find((s) => s.id === t);
9
+ if (!a) throw new Error(`Connector could not load unknown tool '${o}'.`);
10
+ const l = await import(`https://engine-eu.datapos.app/tools/${o}_v${a.version}/${t}.es.js`);
11
+ return new l.Tool();
12
+ }
7
13
  export {
8
- r as connectorConfigSchema
14
+ b as connectorConfigSchema,
15
+ c as loadToolForConnector
9
16
  };
@@ -36,6 +36,14 @@ interface Connector extends Component {
36
36
  retrieveRecords?(connector: Connector, settings: RetrieveRecordsSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveRecordsSummary) => void): Promise<void>;
37
37
  upsertRecords?(connector: Connector, settings: UpsertSettings): Promise<void>;
38
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
+ }
39
47
  interface InitialiseSettings {
40
48
  connectorStorageURLPrefix: string;
41
49
  toolConfigs: ToolConfig[];
@@ -73,13 +81,6 @@ interface FindSettings extends ConnectorOperationSettings {
73
81
  interface FindResult {
74
82
  folderPath?: string;
75
83
  }
76
- interface GetReadableStreamSettings extends ConnectorOperationSettings {
77
- id: string;
78
- path: string;
79
- }
80
- interface GetReadableStreamResult {
81
- readable?: ReadableStream<unknown>;
82
- }
83
84
  interface GetRecordSettings extends ConnectorOperationSettings {
84
85
  id: string;
85
86
  path: string;
@@ -154,8 +155,11 @@ interface ConnectorCallbackData {
154
155
  typeId: string;
155
156
  properties: Record<string, unknown>;
156
157
  }
158
+ /** Load tool for connector. */
159
+ declare function loadToolForConnector<T>(connector: Connector, toolId: string): Promise<T>;
157
160
  /** Exports. */
158
161
  export type { ConnectionColumnConfig, ConnectionConfig, ConnectionNodeConfig, Encoding, UsageTypeId } from './connection';
159
162
  export type { Connector, ConnectorCallbackData, ConnectorConfig, ConnectorLocalisedConfig, ConnectorOperationSettings };
160
163
  export type { AuditContentResult, AuditContentSettings, CreateSettings, DropSettings, FindResult, FindSettings, GetReadableStreamResult, GetReadableStreamSettings, GetRecordResult, GetRecordSettings, InitialiseSettings, ListResult, ListSettings, PreviewResult, PreviewSettings, RemoveSettings, RetrieveChunksResult, RetrieveChunksSettings, RetrieveChunksSummary, RetrieveRecordsResult, RetrieveRecordsSettings, RetrieveRecordsSummary, UpsertSettings };
164
+ export { loadToolForConnector };
161
165
  export { connectorConfigSchema } from './connectorConfig.schema';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.376",
3
+ "version": "0.3.377",
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>",