@datapos/datapos-shared 0.3.467 → 0.3.468

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.
@@ -36,7 +36,7 @@ interface DataViewPreviewConfig {
36
36
  fileType: FileTypeResult | undefined;
37
37
  hasHeaders: boolean | undefined;
38
38
  recordDelimiterId?: RecordDelimiterId;
39
- records: ParseResult[][];
39
+ records: InferredResult[][];
40
40
  size: number;
41
41
  text: string;
42
42
  valueDelimiterId?: ValueDelimiterId;
@@ -64,17 +64,74 @@ 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 ValueDataTypeId = 'boolean' | 'numeric' | 'string' | 'temporal' | 'unknown';
68
+ type NumericValueSignId = 'negative' | 'zero' | 'positive';
69
+ type NumericValueSubtypeId = 'bigint' | 'integer' | 'decimal';
70
+ type NumericValueUnitsId = 'currency' | 'percentage' | 'plain';
71
+ type StringValueSubtypeId = 'email' | 'ipv4' | 'ipv6' | 'ulid' | 'uuid' | 'url' | 'plain';
72
+ type TemporalValueSubtypeId = 'date' | 'dateTime' | 'time';
67
73
  type ParseRecord = ParseField[];
68
74
  interface ParseField {
69
75
  value: string | null;
70
76
  valueWasQuoted: boolean;
71
77
  }
72
- type ValueDataTypeId = 'boolean' | 'numeric' | 'string' | 'temporal' | 'unknown';
73
- type NumericValueSignId = 'negative' | 'zero' | 'positive' | 'unknown';
74
- type NumericValueSubtypeId = 'bigint' | 'integer' | 'decimal' | 'unknown';
75
- type NumericValueUnitsId = 'currency' | 'percentage' | 'plain' | 'unknown';
76
- type StringValueSubtypeId = 'email' | 'ipv4' | 'ipv6' | 'ulid' | 'uuid' | 'url' | 'plain' | 'unknown';
77
- type TemporalValueSubtypeId = 'date' | 'dateTime' | 'time' | 'unknown';
78
+ /**
79
+ * Inferred result.
80
+ */
81
+ type InferredResult = BooleanInferenceResult | NumericInferenceResult | StringInferenceResult | TemporalInferenceResult | UnknownInferenceResult;
82
+ /**
83
+ * Boolean inference result.
84
+ */
85
+ interface BooleanInferenceResult {
86
+ dataTypeId: 'boolean';
87
+ inputValue: boolean | string | undefined;
88
+ parsedValue: boolean;
89
+ }
90
+ type NumericInferenceResult = BigIntInferenceResult | NumberInferenceResult;
91
+ interface BigIntInferenceResult {
92
+ dataTypeId: 'numeric';
93
+ dataSubtypeId: 'bigint';
94
+ format: string;
95
+ inputValue: bigint | string | undefined;
96
+ parsedValue: bigint;
97
+ currencySymbolId: string | undefined;
98
+ decimalPlaces: number;
99
+ signId: NumericValueSignId;
100
+ unitsId: NumericValueUnitsId;
101
+ }
102
+ interface NumberInferenceResult {
103
+ dataTypeId: 'numeric';
104
+ dataSubtypeId: 'integer' | 'decimal';
105
+ format: string;
106
+ inputValue: number | string | undefined;
107
+ parsedValue: number;
108
+ currencySymbolId: string | undefined;
109
+ decimalPlaces: number;
110
+ signId: NumericValueSignId;
111
+ unitsId: NumericValueUnitsId;
112
+ }
113
+ /**
114
+ * String inference result.
115
+ */
116
+ interface StringInferenceResult {
117
+ dataTypeId: 'string';
118
+ dataSubtypeId: StringValueSubtypeId;
119
+ format: undefined;
120
+ inputValue: string;
121
+ parsedValue: string;
122
+ }
123
+ interface TemporalInferenceResult {
124
+ dataTypeId: 'temporal';
125
+ dataSubtypeId: TemporalValueSubtypeId;
126
+ format: string;
127
+ inputValue: string;
128
+ parsedValue: Date;
129
+ }
130
+ interface UnknownInferenceResult {
131
+ dataTypeId: 'unknown';
132
+ inputValue: string | null | undefined;
133
+ parsedValue: null;
134
+ }
78
135
  type DataFormatId = 'dpe' | 'dtv' | 'json' | 'spss' | 'xlsx' | 'xml';
79
136
  type RecordDelimiterId = '\n' | '\r' | '\r\n';
80
137
  type ValueDelimiterId = '' | ':' | ',' | '!' | '0x1E' | ';' | ' ' | '\t' | '_' | '0x1F' | '|';
@@ -83,4 +140,4 @@ type ValueDelimiterId = '' | ':' | ',' | '!' | '0x1E' | ';' | ' ' | '\t' | '_' |
83
140
  */
84
141
  declare const ORDERED_VALUE_DELIMITER_IDS: ValueDelimiterId[];
85
142
  export { ORDERED_VALUE_DELIMITER_IDS };
86
- export type { DataViewConfig, DataViewContentAuditConfig, DataViewInterface, DataViewLocalisedConfig, DataViewPreviewConfig, DataFormatId, NamedValueRecord, NumericValueSignId, NumericValueSubtypeId, NumericValueUnitsId, ObjectRecord, ParseField, ParseRecord, RecordDelimiterId, StringValueRecord, StringValueSubtypeId, TemporalValueSubtypeId, ValueDataTypeId, ValueDelimiterId, ValueRecord };
143
+ export type { BigIntInferenceResult, BooleanInferenceResult, DataViewConfig, DataViewContentAuditConfig, DataViewInterface, DataViewLocalisedConfig, DataViewPreviewConfig, DataFormatId, InferredResult, NamedValueRecord, NumberInferenceResult, NumericInferenceResult, NumericValueSignId, NumericValueSubtypeId, NumericValueUnitsId, ObjectRecord, ParseField, ParseRecord, RecordDelimiterId, StringInferenceResult, StringValueRecord, StringValueSubtypeId, TemporalInferenceResult, TemporalValueSubtypeId, UnknownInferenceResult, ValueDataTypeId, ValueDelimiterId, ValueRecord };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.467",
3
+ "version": "0.3.468",
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>",