@datapos/datapos-shared 0.3.470 → 0.3.472
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,6 +1,6 @@
|
|
|
1
1
|
import { ComponentConfig } from '..';
|
|
2
2
|
import { ConnectorConfig } from '.';
|
|
3
|
-
import {
|
|
3
|
+
import { DataTypeId } from '../dataView';
|
|
4
4
|
/**
|
|
5
5
|
* Connection configuration.
|
|
6
6
|
*/
|
|
@@ -78,7 +78,7 @@ interface ConnectionColumnConfig {
|
|
|
78
78
|
minValue?: string;
|
|
79
79
|
patterns?: Record<string, string>;
|
|
80
80
|
storageTypeId?: StorageDataTypeId;
|
|
81
|
-
|
|
81
|
+
DataTypeId?: DataTypeId;
|
|
82
82
|
validValueCount?: number;
|
|
83
83
|
validValues?: Record<string, string>;
|
|
84
84
|
voidValueCount?: number;
|
|
@@ -4,7 +4,7 @@ import { EngineUtilities } from '../../engine';
|
|
|
4
4
|
import { ToolConfig } from '../tool';
|
|
5
5
|
import { ConnectionDescriptionConfig, ConnectionNodeConfig } from './connection';
|
|
6
6
|
import { connectorCategoryConfigSchema, connectorConfigSchema, connectorOperationNameSchema, connectorUsageIdSchema } from './connectorConfig.schema';
|
|
7
|
-
import { DataViewPreviewConfig,
|
|
7
|
+
import { DataViewPreviewConfig, ParsingResult, ValueDelimiterId } from '../dataView';
|
|
8
8
|
/**
|
|
9
9
|
* Connector interface and constructor.
|
|
10
10
|
*/
|
|
@@ -59,11 +59,11 @@ interface ConnectorInterface extends Component {
|
|
|
59
59
|
/**
|
|
60
60
|
* Retrieve all chunks from an object for a specified connection.
|
|
61
61
|
*/
|
|
62
|
-
retrieveChunks?(options: RetrieveChunksOptions, chunk: (records:
|
|
62
|
+
retrieveChunks?(options: RetrieveChunksOptions, chunk: (records: ParsingResult[]) => void, complete: () => void): Promise<void>;
|
|
63
63
|
/**
|
|
64
64
|
* Retrieve all records from an object for a specified connection.
|
|
65
65
|
*/
|
|
66
|
-
retrieveRecords?(options: RetrieveRecordsOptions, chunk: (records:
|
|
66
|
+
retrieveRecords?(options: RetrieveRecordsOptions, chunk: (records: ParsingResult[]) => void, complete: (result: RetrieveRecordsSummary) => void): Promise<void>;
|
|
67
67
|
/**
|
|
68
68
|
* Upsert one or more records into an object for a specified connection.
|
|
69
69
|
*/
|
|
@@ -36,7 +36,7 @@ interface DataViewPreviewConfig {
|
|
|
36
36
|
fileType: FileTypeResult | undefined;
|
|
37
37
|
hasHeaders: boolean | undefined;
|
|
38
38
|
recordDelimiterId?: RecordDelimiterId;
|
|
39
|
-
records:
|
|
39
|
+
records: InferenceResult[][];
|
|
40
40
|
size: number;
|
|
41
41
|
text: string;
|
|
42
42
|
valueDelimiterId?: ValueDelimiterId;
|
|
@@ -64,28 +64,27 @@ type ObjectRecord = (NamedValueRecord | StringValueRecord | ValueRecord)[];
|
|
|
64
64
|
type NamedValueRecord = Record<string, bigint | boolean | number | string | null>;
|
|
65
65
|
type StringValueRecord = (string | null)[];
|
|
66
66
|
type ValueRecord = (bigint | boolean | number | string | null)[];
|
|
67
|
-
type
|
|
68
|
-
type
|
|
69
|
-
type
|
|
70
|
-
type
|
|
71
|
-
type
|
|
72
|
-
type
|
|
73
|
-
|
|
74
|
-
interface ParseField {
|
|
67
|
+
type DataTypeId = 'boolean' | 'numeric' | 'string' | 'temporal' | 'unknown';
|
|
68
|
+
type NumericSignId = 'negative' | 'zero' | 'positive';
|
|
69
|
+
type NumericSubtypeId = 'bigint' | 'integer' | 'decimal';
|
|
70
|
+
type NumericUnitsId = 'currency' | 'percentage' | 'plain';
|
|
71
|
+
type StringSubtypeId = 'email' | 'ipv4' | 'ipv6' | 'ulid' | 'uuid' | 'url' | 'plain';
|
|
72
|
+
type TemporalSubtypeId = 'date' | 'dateTime' | 'time';
|
|
73
|
+
interface ParsingResult {
|
|
75
74
|
value: string | null;
|
|
76
75
|
valueWasQuoted: boolean;
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
|
-
* Inferred
|
|
78
|
+
* Inferred value.
|
|
80
79
|
*/
|
|
81
|
-
type
|
|
80
|
+
type InferenceResult = BooleanInferenceResult | NumericInferenceResult | StringInferenceResult | TemporalInferenceResult | UnknownInferenceResult;
|
|
82
81
|
/**
|
|
83
82
|
* Boolean inference result.
|
|
84
83
|
*/
|
|
85
84
|
interface BooleanInferenceResult {
|
|
86
85
|
dataTypeId: 'boolean';
|
|
87
86
|
inputValue: boolean | string | undefined;
|
|
88
|
-
|
|
87
|
+
inferredValue: boolean;
|
|
89
88
|
}
|
|
90
89
|
type NumericInferenceResult = BigIntInferenceResult | NumberInferenceResult;
|
|
91
90
|
interface BigIntInferenceResult {
|
|
@@ -93,53 +92,44 @@ interface BigIntInferenceResult {
|
|
|
93
92
|
dataSubtypeId: 'bigint';
|
|
94
93
|
format: string;
|
|
95
94
|
inputValue: bigint | string | undefined;
|
|
96
|
-
|
|
95
|
+
inferredValue: bigint;
|
|
97
96
|
currencySymbolId: string | undefined;
|
|
98
97
|
decimalPlaces: number;
|
|
99
|
-
signId:
|
|
100
|
-
unitsId:
|
|
98
|
+
signId: NumericSignId;
|
|
99
|
+
unitsId: NumericUnitsId;
|
|
101
100
|
}
|
|
102
101
|
interface NumberInferenceResult {
|
|
103
102
|
dataTypeId: 'numeric';
|
|
104
103
|
dataSubtypeId: 'integer' | 'decimal';
|
|
105
104
|
format: string;
|
|
106
105
|
inputValue: number | string | undefined;
|
|
107
|
-
|
|
106
|
+
inferredValue: number;
|
|
108
107
|
currencySymbolId: string | undefined;
|
|
109
108
|
decimalPlaces: number;
|
|
110
|
-
signId:
|
|
111
|
-
unitsId:
|
|
109
|
+
signId: NumericSignId;
|
|
110
|
+
unitsId: NumericUnitsId;
|
|
112
111
|
}
|
|
113
112
|
/**
|
|
114
113
|
* String inference result.
|
|
115
114
|
*/
|
|
116
115
|
interface StringInferenceResult {
|
|
117
116
|
dataTypeId: 'string';
|
|
118
|
-
dataSubtypeId:
|
|
117
|
+
dataSubtypeId: StringSubtypeId;
|
|
119
118
|
format: undefined;
|
|
120
119
|
inputValue: string;
|
|
121
|
-
|
|
120
|
+
inferredValue: string;
|
|
122
121
|
}
|
|
123
122
|
interface TemporalInferenceResult {
|
|
124
123
|
dataTypeId: 'temporal';
|
|
125
|
-
dataSubtypeId:
|
|
124
|
+
dataSubtypeId: TemporalSubtypeId;
|
|
126
125
|
format: string;
|
|
127
126
|
inputValue: string;
|
|
128
|
-
|
|
127
|
+
inferredValue: Date;
|
|
129
128
|
}
|
|
130
129
|
interface UnknownInferenceResult {
|
|
131
130
|
dataTypeId: 'unknown';
|
|
132
131
|
inputValue: string | null | undefined;
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Schema configuration.
|
|
137
|
-
*/
|
|
138
|
-
interface SchemaConfig {
|
|
139
|
-
columnConfigs: ConnectionColumnConfig[];
|
|
140
|
-
recordDelimiterId: RecordDelimiterId;
|
|
141
|
-
records: InferredResult[][];
|
|
142
|
-
valueDelimiterId: ValueDelimiterId;
|
|
132
|
+
inferredValue: null;
|
|
143
133
|
}
|
|
144
134
|
type DataFormatId = 'dpe' | 'dtv' | 'json' | 'spss' | 'xlsx' | 'xml';
|
|
145
135
|
type RecordDelimiterId = '\n' | '\r' | '\r\n';
|
|
@@ -149,4 +139,11 @@ type ValueDelimiterId = '' | ':' | ',' | '!' | '0x1E' | ';' | ' ' | '\t' | '_' |
|
|
|
149
139
|
*/
|
|
150
140
|
declare const ORDERED_VALUE_DELIMITER_IDS: ValueDelimiterId[];
|
|
151
141
|
export { ORDERED_VALUE_DELIMITER_IDS };
|
|
152
|
-
export type {
|
|
142
|
+
export type { DataViewConfig, DataViewContentAuditConfig, DataViewInterface, DataViewLocalisedConfig, DataViewPreviewConfig, DataFormatId, DataTypeId, NumericSubtypeId, // Numeric.
|
|
143
|
+
NumericSignId, NumericUnitsId, StringSubtypeId, // String.
|
|
144
|
+
TemporalSubtypeId, // Temporal.
|
|
145
|
+
ObjectRecord, NamedValueRecord, StringValueRecord, ValueRecord, RecordDelimiterId, ValueDelimiterId, ParsingResult, InferenceResult, BooleanInferenceResult, // Boolean.
|
|
146
|
+
NumericInferenceResult, // Numeric.
|
|
147
|
+
BigIntInferenceResult, NumberInferenceResult, StringInferenceResult, // String.
|
|
148
|
+
TemporalInferenceResult, // Temporal.
|
|
149
|
+
UnknownInferenceResult };
|
|
@@ -4,7 +4,7 @@ import { ModuleConfig } from '../component/module';
|
|
|
4
4
|
import { ToolConfig } from '../component/tool';
|
|
5
5
|
import { ConnectionColumnConfig, ConnectorOperationOptions } from '../component/connector';
|
|
6
6
|
import { ContextConfig, ContextOperationOptions } from '../component/context';
|
|
7
|
-
import { DataViewContentAuditConfig,
|
|
7
|
+
import { DataViewContentAuditConfig, InferenceResult, ParsingResult, ValueDelimiterId } from '../component/dataView';
|
|
8
8
|
/**
|
|
9
9
|
* Engine runtime interface.
|
|
10
10
|
*/
|
|
@@ -43,7 +43,7 @@ interface EngineCallbackData {
|
|
|
43
43
|
* Engine utilities.
|
|
44
44
|
*/
|
|
45
45
|
interface EngineUtilities {
|
|
46
|
-
parseRecord: (columnConfigs: ConnectionColumnConfig[], record:
|
|
46
|
+
parseRecord: (columnConfigs: ConnectionColumnConfig[], record: ParsingResult[], isPreview: boolean) => InferenceResult[];
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Audit object content options and result.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.472",
|
|
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>",
|