@dpuse/dpuse-shared 1.0.228 → 1.0.230
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.
- package/README.md +8 -8
- package/dist/dpuse-shared.es.js +274 -263
- package/dist/dpuse-shared.es.js.map +1 -1
- package/dist/types/src/component/dataView/index.d.ts +2 -0
- package/dist/types/src/component/module/tool/delimitedText.d.ts +10 -3
- package/dist/types/src/component/module/tool/index.d.ts +2 -2
- package/dist/types/src/component/module/tool/parser.d.ts +4 -3
- package/package.json +1 -1
|
@@ -87,6 +87,7 @@ export interface ColumnReadingConfig extends ObjectColumnConfig {
|
|
|
87
87
|
decimalSeparatorId: DecimalSeparatorId | undefined;
|
|
88
88
|
dateOrderId: DateOrderId | undefined;
|
|
89
89
|
nullWordsAreEmpty?: boolean | undefined;
|
|
90
|
+
blankValuesAreEmpty?: boolean | undefined;
|
|
90
91
|
}
|
|
91
92
|
export type DateOrderId = 'dayFirst' | 'monthFirst';
|
|
92
93
|
export type DecimalSeparatorId = (typeof DECIMAL_SEPARATOR_IDS)[number];
|
|
@@ -160,6 +161,7 @@ export interface ColumnChoiceConfig {
|
|
|
160
161
|
decimalSeparatorId: DecimalSeparatorId | undefined;
|
|
161
162
|
isIgnored: boolean | undefined;
|
|
162
163
|
nullWordsAreEmpty: boolean | undefined;
|
|
164
|
+
blankValuesAreEmpty?: boolean | undefined;
|
|
163
165
|
}
|
|
164
166
|
type DataTypeConfig = (typeof DATA_TYPE_CONFIGS)[number];
|
|
165
167
|
export type DataTypeId = DataTypeConfig['id'];
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { ParsedRecord, SampleIssue, ValueDelimiterId } from '../../dataView';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
2
|
+
import { ParsePreviewOptions, ParsePreviewResult } from '.';
|
|
3
|
+
export interface DelimitedPreview {
|
|
4
|
+
bytes: Uint8Array;
|
|
5
|
+
encodingId: string;
|
|
6
|
+
text: string;
|
|
7
|
+
}
|
|
8
|
+
export type ParsePreviewWithDelimiter = (preview: DelimitedPreview, delimiter: ValueDelimiterId, isComplete: boolean) => Promise<{
|
|
4
9
|
issues: SampleIssue[];
|
|
5
10
|
records: ParsedRecord[];
|
|
6
11
|
}>;
|
|
@@ -11,5 +16,7 @@ export type ParseTextWithDelimiter = (text: string, delimiter: ValueDelimiterId,
|
|
|
11
16
|
* still returned, so the text can be shown as a table if the user chooses. A delimiter whose parse has issues is only
|
|
12
17
|
* used when every delimiter's does, because a wrong delimiter can itself cause a quote error. Then the one with the
|
|
13
18
|
* fewest issues is used, the first on a tie, and its issues are returned, so the user learns why the text cannot be read.
|
|
19
|
+
* The bytes are decoded once, with the decoder 'parseStream' uses, both to find the record delimiter and for a parser
|
|
20
|
+
* that reads text.
|
|
14
21
|
*/
|
|
15
|
-
export declare function
|
|
22
|
+
export declare function parseDelimitedPreview(bytes: Uint8Array, options: ParsePreviewOptions, parseWithDelimiter: ParsePreviewWithDelimiter): Promise<ParsePreviewResult>;
|
|
@@ -6,10 +6,10 @@ export type ToolConfig = InferOutput<typeof toolConfigSchema>;
|
|
|
6
6
|
export type ParserConfig = InferOutput<typeof parserConfigSchema>;
|
|
7
7
|
export type { FilePreviewerInterface, FilePreviewResult } from './filePreviewer';
|
|
8
8
|
export type { BuildStructureIndexOptions, ListStructureEntriesOptions, ListStructureEntriesResult, ParserInterface } from './parser';
|
|
9
|
-
export type {
|
|
9
|
+
export type { ParsePreviewOptions, ParsePreviewResult, ParseStreamOptions, ParseStreamSummary, StructureCheckpoint } from './parser';
|
|
10
10
|
export type { StructureContainerKindId, StructureEntry, StructureIndex, StructureKindId, StructureNode } from './parser';
|
|
11
11
|
export type { StructuredParserInterface, StructureLocator, StructurePath } from './parser';
|
|
12
|
-
export {
|
|
12
|
+
export { type DelimitedPreview, parseDelimitedPreview, type ParsePreviewWithDelimiter } from './delimitedText';
|
|
13
13
|
export declare const TOOL_NAME_PREFIX = "dpuse-tool-";
|
|
14
14
|
export declare function listParserToolConfigs(toolConfigs: ToolConfig[], dataFormatId: DataFormatId): ToolConfig[];
|
|
15
15
|
export declare function resolveParserToolConfig(toolConfigs: ToolConfig[], dataFormatId: DataFormatId, parserId?: string): ToolConfig;
|
|
@@ -2,19 +2,20 @@ import { DataFormatId, ParsedRecord, RecordDelimiterId, SampleIssue, ValueDelimi
|
|
|
2
2
|
import { ParsedRecordsChunk, RetrieveRecordsSummary } from '../connector';
|
|
3
3
|
export interface ParserInterface {
|
|
4
4
|
parseStream: (stream: ReadableStream<Uint8Array>, options: ParseStreamOptions) => AsyncGenerator<ParsedRecordsChunk, ParseStreamSummary, undefined>;
|
|
5
|
-
|
|
5
|
+
parsePreview: (bytes: Uint8Array, options: ParsePreviewOptions) => Promise<ParsePreviewResult>;
|
|
6
6
|
}
|
|
7
7
|
export interface StructuredParserInterface extends ParserInterface {
|
|
8
8
|
buildStructureIndex: (stream: ReadableStream<Uint8Array>, options: BuildStructureIndexOptions) => Promise<StructureIndex>;
|
|
9
9
|
listStructureEntries: (stream: ReadableStream<Uint8Array>, options: ListStructureEntriesOptions) => Promise<ListStructureEntriesResult>;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
11
|
+
export interface ParsePreviewOptions {
|
|
12
12
|
dataFormatId: DataFormatId;
|
|
13
|
+
encodingId: string;
|
|
13
14
|
isComplete: boolean;
|
|
14
15
|
structurePath?: StructurePath | undefined;
|
|
15
16
|
valueDelimiterIds: ValueDelimiterId[];
|
|
16
17
|
}
|
|
17
|
-
export interface
|
|
18
|
+
export interface ParsePreviewResult {
|
|
18
19
|
hasHeaders?: boolean | undefined;
|
|
19
20
|
issues: SampleIssue[];
|
|
20
21
|
parsedRecords: ParsedRecord[];
|