@flattype/shared 1.10.0 → 1.12.0
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/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -28,9 +28,26 @@ interface EncodeOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
refs?: boolean;
|
|
30
30
|
}
|
|
31
|
+
/** A problem lenient decoding repaired, and where it was. */
|
|
32
|
+
interface FlatWarning {
|
|
33
|
+
/** What was wrong and what was done, e.g. `Expected 5 values, got 4: the missing values are null`. */
|
|
34
|
+
message: string;
|
|
35
|
+
line: number;
|
|
36
|
+
column: number;
|
|
37
|
+
}
|
|
31
38
|
interface DecodeOptions {
|
|
32
39
|
/** Throw on malformed input (default). Set `false` to recover what it can, e.g. from LLM output. */
|
|
33
40
|
strict?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* With `strict: false`: drop any line that can't be read (prose around data, a path that conflicts) as if
|
|
43
|
+
* it weren't there, instead of throwing. That's what `fromModelOutput` uses. Default `false`.
|
|
44
|
+
*/
|
|
45
|
+
skipInvalidLines?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* With `strict: false`: called for every problem that was repaired (a missing value, a short row, a skipped
|
|
48
|
+
* line…), with its line and column, so you can tell the user where the data is wrong.
|
|
49
|
+
*/
|
|
50
|
+
onWarning?: (warning: FlatWarning) => void;
|
|
34
51
|
/** Called for every value after decoding, bottom-up, exactly like the second argument of `JSON.parse`. */
|
|
35
52
|
reviver?: Reviver;
|
|
36
53
|
/**
|
|
@@ -65,4 +82,4 @@ interface Decoder {
|
|
|
65
82
|
end(): JsonValue;
|
|
66
83
|
}
|
|
67
84
|
|
|
68
|
-
export type { DecodeOptions, Decoder, DecoderOptions, Delimiter, EncodeOptions, FlatLeaf, FlatRecord, JsonPrimitive, JsonValue, Replacer, Reviver, TableRow };
|
|
85
|
+
export type { DecodeOptions, Decoder, DecoderOptions, Delimiter, EncodeOptions, FlatLeaf, FlatRecord, FlatWarning, JsonPrimitive, JsonValue, Replacer, Reviver, TableRow };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,9 +28,26 @@ interface EncodeOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
refs?: boolean;
|
|
30
30
|
}
|
|
31
|
+
/** A problem lenient decoding repaired, and where it was. */
|
|
32
|
+
interface FlatWarning {
|
|
33
|
+
/** What was wrong and what was done, e.g. `Expected 5 values, got 4: the missing values are null`. */
|
|
34
|
+
message: string;
|
|
35
|
+
line: number;
|
|
36
|
+
column: number;
|
|
37
|
+
}
|
|
31
38
|
interface DecodeOptions {
|
|
32
39
|
/** Throw on malformed input (default). Set `false` to recover what it can, e.g. from LLM output. */
|
|
33
40
|
strict?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* With `strict: false`: drop any line that can't be read (prose around data, a path that conflicts) as if
|
|
43
|
+
* it weren't there, instead of throwing. That's what `fromModelOutput` uses. Default `false`.
|
|
44
|
+
*/
|
|
45
|
+
skipInvalidLines?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* With `strict: false`: called for every problem that was repaired (a missing value, a short row, a skipped
|
|
48
|
+
* line…), with its line and column, so you can tell the user where the data is wrong.
|
|
49
|
+
*/
|
|
50
|
+
onWarning?: (warning: FlatWarning) => void;
|
|
34
51
|
/** Called for every value after decoding, bottom-up, exactly like the second argument of `JSON.parse`. */
|
|
35
52
|
reviver?: Reviver;
|
|
36
53
|
/**
|
|
@@ -65,4 +82,4 @@ interface Decoder {
|
|
|
65
82
|
end(): JsonValue;
|
|
66
83
|
}
|
|
67
84
|
|
|
68
|
-
export type { DecodeOptions, Decoder, DecoderOptions, Delimiter, EncodeOptions, FlatLeaf, FlatRecord, JsonPrimitive, JsonValue, Replacer, Reviver, TableRow };
|
|
85
|
+
export type { DecodeOptions, Decoder, DecoderOptions, Delimiter, EncodeOptions, FlatLeaf, FlatRecord, FlatWarning, JsonPrimitive, JsonValue, Replacer, Reviver, TableRow };
|