@datapos/datapos-shared 0.3.333 → 0.3.334

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,5 +1,5 @@
1
1
  import { ComponentConfig } from '..';
2
- import { ConnectorConfig } from '.';
2
+ import { ConnectorConfig } from './types';
3
3
  export interface ConnectionAuthorizationConfig {
4
4
  accessToken: string;
5
5
  accountId: string;
@@ -1,177 +1,11 @@
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
- }
1
+ /**
2
+ * Connector composables, constants, errors, types/interfaces and utilities.
3
+ */
4
+ export type * from './types';
60
5
  /** Constants */
61
6
  export declare const CONNECTOR_DESTINATION_OPERATIONS: string[];
62
7
  export declare const CONNECTOR_SOURCE_OPERATIONS: string[];
63
8
  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
- type DescribeSettings = ConnectorOperationSettings;
86
- 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;
175
9
  properties: Record<string, unknown>;
176
10
  }
177
11
  /** Exposures */
@@ -0,0 +1,174 @@
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,5 +1,5 @@
1
1
  import { ConnectionConfig } from '../component/connector/connection';
2
- import { AuditContentResult, ConnectorCallbackData, ConnectorOperationSettings, InitialiseSettings, ListResult, RetrieveResult } from '../component/connector';
2
+ import { AuditContentResult, ConnectorCallbackData, ConnectorOperationSettings, InitialiseSettings, ListResult, RetrieveResult } from '../component/connector/types';
3
3
  import { Component, ModuleConfig } from '../component';
4
4
  import { ContextCallbackData, ContextConfig, ContextOperationSettings } from '../component/context';
5
5
  import { DataViewPreviewConfig, EncodingConfig } from '../component/dataView';
@@ -10,11 +10,11 @@ export { componentConfigSchema } from './component';
10
10
  /** Constants - Connector */
11
11
  export { CONNECTOR_DESTINATION_OPERATIONS, CONNECTOR_SOURCE_OPERATIONS } from './component/connector';
12
12
  /** 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';
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
14
  /** Interfaces/Types - Connection */
15
15
  export type { ConnectionAuthorizationConfig, ConnectionColumnConfig, ConnectionConfig, ConnectionNodeConfig, DPAFileSystemFileHandle, Encoding, StorageTypeId, UsageTypeId } from './component/connector/connection';
16
16
  /** Schemas - Connector */
17
- export { connectorConfigSchema } from './component/connector';
17
+ export { connectorConfigSchema } from './component/connector/connectorConfig.schema';
18
18
  /** Interfaces/Types - Context. */
19
19
  export { contextConfigSchema } from './component/context';
20
20
  export type { Context, ContextConfig, ContextLocalisedConfig, ContextListSettings, ContextListResult, ContextOperation, ContextCallbackData } from './component/context';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.333",
3
+ "version": "0.3.334",
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>",