@dpuse/dpuse-shared 1.0.213 → 1.0.214
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.
|
@@ -5,7 +5,10 @@ export { toolConfigSchema } from './toolConfig.schema';
|
|
|
5
5
|
export type ToolConfig = InferOutput<typeof toolConfigSchema>;
|
|
6
6
|
export type ParserConfig = InferOutput<typeof parserConfigSchema>;
|
|
7
7
|
export type { FilePreviewerInterface, FilePreviewResult } from './filePreviewer';
|
|
8
|
-
export type {
|
|
8
|
+
export type { BuildStructureIndexOptions, ListStructureEntriesOptions, ListStructureEntriesResult, ParserInterface } from './parser';
|
|
9
|
+
export type { ParseStreamOptions, ParseStreamSummary, ParseTextOptions, ParseTextResult, StructureCheckpoint } from './parser';
|
|
10
|
+
export type { StructureContainerKindId, StructureEntry, StructureIndex, StructureKindId, StructureNode } from './parser';
|
|
11
|
+
export type { StructuredParserInterface, StructurePath } from './parser';
|
|
9
12
|
export { parseDelimitedText, type ParseTextWithDelimiter } from './delimitedText';
|
|
10
13
|
export declare const TOOL_NAME_PREFIX = "dpuse-tool-";
|
|
11
14
|
export declare function listParserToolConfigs(toolConfigs: ToolConfig[], dataFormatId: DataFormatId): ToolConfig[];
|
|
@@ -4,9 +4,14 @@ export interface ParserInterface {
|
|
|
4
4
|
parseStream: (stream: ReadableStream<Uint8Array>, options: ParseStreamOptions) => AsyncGenerator<ParsedRecordsChunk, ParseStreamSummary, undefined>;
|
|
5
5
|
parseText: (text: string, options: ParseTextOptions) => Promise<ParseTextResult>;
|
|
6
6
|
}
|
|
7
|
+
export interface StructuredParserInterface extends ParserInterface {
|
|
8
|
+
buildStructureIndex: (stream: ReadableStream<Uint8Array>, options: BuildStructureIndexOptions) => Promise<StructureIndex>;
|
|
9
|
+
listStructureEntries: (stream: ReadableStream<Uint8Array>, options: ListStructureEntriesOptions) => Promise<ListStructureEntriesResult>;
|
|
10
|
+
}
|
|
7
11
|
export interface ParseTextOptions {
|
|
8
12
|
dataFormatId: DataFormatId;
|
|
9
13
|
isComplete: boolean;
|
|
14
|
+
structurePath?: StructurePath | undefined;
|
|
10
15
|
valueDelimiterIds: ValueDelimiterId[];
|
|
11
16
|
}
|
|
12
17
|
export interface ParseTextResult {
|
|
@@ -20,6 +25,7 @@ export interface ParseStreamOptions {
|
|
|
20
25
|
chunkSize: number | undefined;
|
|
21
26
|
dataFormatId: DataFormatId;
|
|
22
27
|
encodingId: string;
|
|
28
|
+
structurePath?: StructurePath | undefined;
|
|
23
29
|
valueDelimiterId: ValueDelimiterId;
|
|
24
30
|
}
|
|
25
31
|
export interface ParseStreamSummary extends RetrieveRecordsSummary {
|
|
@@ -29,3 +35,52 @@ export interface ParseStreamSummary extends RetrieveRecordsSummary {
|
|
|
29
35
|
lineCount: number;
|
|
30
36
|
nonUniformRecordCount: number;
|
|
31
37
|
}
|
|
38
|
+
export interface BuildStructureIndexOptions {
|
|
39
|
+
abortSignal: AbortSignal;
|
|
40
|
+
dataFormatId: DataFormatId;
|
|
41
|
+
maxDepth: number | undefined;
|
|
42
|
+
onProgress: ((byteCount: number) => void) | undefined;
|
|
43
|
+
}
|
|
44
|
+
export interface StructureIndex {
|
|
45
|
+
byteCount: number;
|
|
46
|
+
nodes: StructureNode[];
|
|
47
|
+
}
|
|
48
|
+
export interface StructureNode {
|
|
49
|
+
checkpoints: StructureCheckpoint[];
|
|
50
|
+
childCount: number;
|
|
51
|
+
endOffset: number;
|
|
52
|
+
isTableCandidate: boolean;
|
|
53
|
+
keys: string[];
|
|
54
|
+
kindId: StructureContainerKindId;
|
|
55
|
+
path: StructurePath;
|
|
56
|
+
startOffset: number;
|
|
57
|
+
}
|
|
58
|
+
export interface StructureCheckpoint {
|
|
59
|
+
itemIndex: number;
|
|
60
|
+
offset: number;
|
|
61
|
+
}
|
|
62
|
+
export type StructureContainerKindId = 'list' | 'object';
|
|
63
|
+
export type StructureKindId = StructureContainerKindId | 'boolean' | 'null' | 'number' | 'string';
|
|
64
|
+
export type StructurePath = (number | string)[];
|
|
65
|
+
export interface ListStructureEntriesOptions {
|
|
66
|
+
abortSignal: AbortSignal;
|
|
67
|
+
dataFormatId: DataFormatId;
|
|
68
|
+
entryCount: number;
|
|
69
|
+
firstItemIndex: number | undefined;
|
|
70
|
+
maxValueLength: number | undefined;
|
|
71
|
+
path: StructurePath;
|
|
72
|
+
startOffset: number;
|
|
73
|
+
}
|
|
74
|
+
export interface ListStructureEntriesResult {
|
|
75
|
+
entries: StructureEntry[];
|
|
76
|
+
isMore: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface StructureEntry {
|
|
79
|
+
childCount: number | undefined;
|
|
80
|
+
endOffset: number;
|
|
81
|
+
isValueCut: boolean;
|
|
82
|
+
key: number | string;
|
|
83
|
+
kindId: StructureKindId;
|
|
84
|
+
startOffset: number;
|
|
85
|
+
value: string | undefined;
|
|
86
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dpuse/dpuse-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.214",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Common constants, types and utilities used across DPUse projects.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"fast-check": "^4.10.2",
|
|
74
74
|
"iconv-lite": "^0.7.3",
|
|
75
75
|
"jschardet": "^4.1.0",
|
|
76
|
-
"prettier": "^3.10.
|
|
76
|
+
"prettier": "^3.10.1",
|
|
77
77
|
"sonda": "^0.14.0",
|
|
78
78
|
"typescript": "^6.0.3",
|
|
79
79
|
"vite": "^8.3.8",
|