@duplojs/utils 1.5.1 → 1.5.3
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/array/is.d.ts +1 -1
- package/dist/clean/primitive/base.d.ts +1 -1
- package/dist/common/formData.cjs +105 -0
- package/dist/common/formData.d.ts +69 -0
- package/dist/common/formData.mjs +102 -0
- package/dist/common/index.d.ts +2 -0
- package/dist/common/kind.d.ts +3 -0
- package/dist/dataParser/base.d.ts +5 -1
- package/dist/dataParser/baseExtended.d.ts +5 -1
- package/dist/dataParser/extended/array.d.ts +1 -1
- package/dist/dataParser/extended/bigint.d.ts +2 -2
- package/dist/dataParser/extended/boolean.d.ts +2 -2
- package/dist/dataParser/extended/date.d.ts +2 -3
- package/dist/dataParser/extended/empty.d.ts +2 -2
- package/dist/dataParser/extended/lazy.d.ts +1 -1
- package/dist/dataParser/extended/literal.d.ts +2 -2
- package/dist/dataParser/extended/nil.d.ts +2 -2
- package/dist/dataParser/extended/nullable.d.ts +2 -2
- package/dist/dataParser/extended/number.d.ts +2 -2
- package/dist/dataParser/extended/object.d.ts +2 -2
- package/dist/dataParser/extended/optional.d.ts +2 -2
- package/dist/dataParser/extended/pipe.d.ts +1 -1
- package/dist/dataParser/extended/recover.d.ts +1 -1
- package/dist/dataParser/extended/string.d.ts +2 -2
- package/dist/dataParser/extended/templateLiteral.d.ts +2 -2
- package/dist/dataParser/extended/time.d.ts +2 -2
- package/dist/dataParser/extended/transform.d.ts +1 -1
- package/dist/dataParser/extended/tuple.cjs +4 -0
- package/dist/dataParser/extended/tuple.d.ts +96 -2
- package/dist/dataParser/extended/tuple.mjs +4 -0
- package/dist/dataParser/extended/unknown.d.ts +2 -2
- package/dist/dataParser/identifier.d.ts +2 -20
- package/dist/dataParser/parsers/array/index.d.ts +1 -1
- package/dist/dataParser/parsers/record/index.d.ts +3 -3
- package/dist/dataParser/parsers/transform.d.ts +2 -1
- package/dist/dataParser/parsers/tuple.d.ts +12 -6
- package/dist/dataParser/parsers/union.d.ts +1 -1
- package/dist/date/createOrThrow.cjs +1 -1
- package/dist/date/createOrThrow.mjs +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.mjs +1 -0
- package/dist/metadata.json +9 -0
- package/dist/object/fromEntries.d.ts +1 -1
- package/package.json +1 -1
package/dist/array/is.d.ts
CHANGED
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
* @namespace A
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
export declare function is<GenericValue extends unknown>(arg: GenericValue): arg is GenericValue
|
|
26
|
+
export declare function is<GenericValue extends unknown>(arg: GenericValue): arg is Extract<GenericValue, readonly any[]>;
|
|
@@ -239,7 +239,7 @@ export type Boolean = ReturnType<typeof Boolean["createWithUnknownOrThrow"]>;
|
|
|
239
239
|
* @namespace C
|
|
240
240
|
*
|
|
241
241
|
*/
|
|
242
|
-
export declare const Date: PrimitiveHandler<DDate.TheDate,
|
|
242
|
+
export declare const Date: PrimitiveHandler<DDate.TheDate, `date${number}-` | `date${number}+` | DDate.TheDate | globalThis.Date>;
|
|
243
243
|
export type Date = ReturnType<typeof Date["createWithUnknownOrThrow"]>;
|
|
244
244
|
/**
|
|
245
245
|
* Business primitive for duration values (`TheTime`).
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var escapeRegExp = require('./escapeRegExp.cjs');
|
|
4
|
+
var theTime = require('../date/theTime.cjs');
|
|
5
|
+
var theDate = require('../date/theDate.cjs');
|
|
6
|
+
|
|
7
|
+
const separator = "/*\\";
|
|
8
|
+
const firstElementInPathRegex = new RegExp(`^((?:(?!${escapeRegExp.escapeRegExp(separator)}).)*)(?:${escapeRegExp.escapeRegExp(separator)})?`);
|
|
9
|
+
const getIndexRegex = /^\[(\d+)\]$/;
|
|
10
|
+
const invalidEntryRegex = /__proto__|constructor|prototype/;
|
|
11
|
+
class TheFormData extends FormData {
|
|
12
|
+
inputValues;
|
|
13
|
+
constructor(inputValues) {
|
|
14
|
+
super();
|
|
15
|
+
this.inputValues = inputValues;
|
|
16
|
+
for (const entry of TheFormData.toFlatEntries(inputValues)) {
|
|
17
|
+
this.append(entry[0], entry[1]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
static *toFlatEntries(value, path) {
|
|
21
|
+
if (typeof value === "string"
|
|
22
|
+
|| value instanceof theTime.TheTime
|
|
23
|
+
|| value instanceof theDate.TheDate
|
|
24
|
+
|| typeof value === "number"
|
|
25
|
+
|| typeof value === "boolean") {
|
|
26
|
+
yield [path ?? "", value.toString()];
|
|
27
|
+
}
|
|
28
|
+
else if (value instanceof File) {
|
|
29
|
+
yield [path ?? "", value];
|
|
30
|
+
}
|
|
31
|
+
else if (value === null) {
|
|
32
|
+
yield [path ?? "", "null"];
|
|
33
|
+
}
|
|
34
|
+
else if (value === undefined) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
else if (value instanceof Array) {
|
|
38
|
+
for (let index = 0; index < value.length; index++) {
|
|
39
|
+
const entriesIterator = this.toFlatEntries(value[index], path === undefined
|
|
40
|
+
? `[${index}]`
|
|
41
|
+
: `${path}${separator}[${index}]`);
|
|
42
|
+
for (const entry of entriesIterator) {
|
|
43
|
+
yield entry;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
for (const key in value) {
|
|
49
|
+
const entriesIterator = this.toFlatEntries(value[key], path === undefined
|
|
50
|
+
? key
|
|
51
|
+
: `${path}${separator}${key}`);
|
|
52
|
+
for (const entry of entriesIterator) {
|
|
53
|
+
yield entry;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
static fromEntries(iterable, arrayMaxIndex) {
|
|
59
|
+
const constructObject = (object, path, value) => {
|
|
60
|
+
const firstElement = path.match(firstElementInPathRegex)[1];
|
|
61
|
+
const index = firstElement.match(getIndexRegex)?.[1];
|
|
62
|
+
if (index && Number(index) > arrayMaxIndex) {
|
|
63
|
+
return object;
|
|
64
|
+
}
|
|
65
|
+
let currentObject = object;
|
|
66
|
+
if (currentObject === undefined) {
|
|
67
|
+
if (index !== undefined) {
|
|
68
|
+
currentObject = [];
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
currentObject = {};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (firstElement === path) {
|
|
75
|
+
currentObject[(index ?? firstElement)] = value;
|
|
76
|
+
return currentObject;
|
|
77
|
+
}
|
|
78
|
+
currentObject[(index ?? firstElement)] = constructObject(currentObject[(index ?? firstElement)], path.replace(firstElementInPathRegex, ""), value);
|
|
79
|
+
return currentObject;
|
|
80
|
+
};
|
|
81
|
+
let result = undefined;
|
|
82
|
+
for (const entry of iterable) {
|
|
83
|
+
if (invalidEntryRegex.test(entry[0])) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
result = constructObject(result, entry[0], entry[1]);
|
|
87
|
+
}
|
|
88
|
+
return result ?? {};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
static "new"(inputValues) {
|
|
94
|
+
return new TheFormData(inputValues);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* {@include common/createFormData/index.md}
|
|
99
|
+
*/
|
|
100
|
+
function createFormData(inputValues) {
|
|
101
|
+
return TheFormData.new(inputValues);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
exports.TheFormData = TheFormData;
|
|
105
|
+
exports.createFormData = createFormData;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as DDate from "../date";
|
|
2
|
+
export type EligibleFormDataValue = (boolean | number | null | string | File | undefined | DDate.TheDate | DDate.TheTime | {
|
|
3
|
+
[key: string]: EligibleFormDataValue;
|
|
4
|
+
} | EligibleFormDataValue[]);
|
|
5
|
+
export declare class TheFormData<GenericValues extends Record<string, EligibleFormDataValue>> extends FormData {
|
|
6
|
+
readonly inputValues: GenericValues;
|
|
7
|
+
private constructor();
|
|
8
|
+
static toFlatEntries(value: EligibleFormDataValue, path?: string): Iterable<[string, string | File], void>;
|
|
9
|
+
static fromEntries(iterable: Iterable<[string, unknown]>, arrayMaxIndex: number): object;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates an extended `FormData` instance from nested values and provides helpers to flatten or rebuild entries.
|
|
13
|
+
*
|
|
14
|
+
* **Supported call styles:**
|
|
15
|
+
* - Classic: `createFormData(inputValues)` -> returns a `TheFormData` instance
|
|
16
|
+
*
|
|
17
|
+
* The returned instance extends native `FormData` and stores the original object in `inputValues`.
|
|
18
|
+
* Supported values are `string`, `File`, `boolean`, `number`, `null`, `undefined`, `DDate.TheDate`, `DDate.TheTime`, objects, and arrays.
|
|
19
|
+
* At flatten time, non-`File` values are serialized to strings (`null` becomes `"null"`).
|
|
20
|
+
* For backend reconstruction, use `TheFormData.fromEntries(...)` to rebuild nested objects from flattened form-data keys.
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* const created = createFormData(
|
|
24
|
+
* {
|
|
25
|
+
* profile: {
|
|
26
|
+
* name: "Ada",
|
|
27
|
+
* tags: ["core", "utils"],
|
|
28
|
+
* },
|
|
29
|
+
* enabled: true,
|
|
30
|
+
* retryCount: 2,
|
|
31
|
+
* optionalValue: null,
|
|
32
|
+
* createdDate: DDate.createOrThrow(1735689600000),
|
|
33
|
+
* createdTime: DDate.createTimeOrThrow(45000000),
|
|
34
|
+
* },
|
|
35
|
+
* );
|
|
36
|
+
* const flattenedName = created.get("profile/*\\name");
|
|
37
|
+
* // flattenedName: "Ada"
|
|
38
|
+
* const flattenedEnabled = created.get("enabled");
|
|
39
|
+
* // flattenedEnabled: "true"
|
|
40
|
+
* const flattenedNull = created.get("optionalValue");
|
|
41
|
+
* // flattenedNull: "null"
|
|
42
|
+
*
|
|
43
|
+
* const flatEntries = Array.from(
|
|
44
|
+
* TheFormData.toFlatEntries({
|
|
45
|
+
* tags: ["core", "utils"],
|
|
46
|
+
* time: DDate.createTimeOrThrow(31500000),
|
|
47
|
+
* }),
|
|
48
|
+
* );
|
|
49
|
+
* // flatEntries: [["tags/*\\[0]", "core"], ["tags/*\\[1]", "utils"], ["time", "time31500000+"]]
|
|
50
|
+
*
|
|
51
|
+
* const rebuilt = TheFormData.fromEntries(
|
|
52
|
+
* [
|
|
53
|
+
* ["profile/*\\name", "Ada"],
|
|
54
|
+
* ["profile/*\\tags/*\\[0]", "core"],
|
|
55
|
+
* ["enabled", "true"],
|
|
56
|
+
* ],
|
|
57
|
+
* 10,
|
|
58
|
+
* );
|
|
59
|
+
* // rebuilt: { profile: { name: "Ada", tags: ["core"] }, enabled: "true" }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* - `TheFormData.toFlatEntries(...)` flattens nested objects/arrays into path keys using the `/*\` separator.
|
|
64
|
+
* - `TheFormData.fromEntries(...)` ignores `__proto__`, `constructor`, and `prototype` paths for safety.
|
|
65
|
+
*
|
|
66
|
+
* @see https://utils.duplojs.dev/en/v1/api/common/createFormData
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
export declare function createFormData<GenericValues extends Record<string, EligibleFormDataValue>>(inputValues: GenericValues): TheFormData<GenericValues>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { escapeRegExp } from './escapeRegExp.mjs';
|
|
2
|
+
import { TheTime } from '../date/theTime.mjs';
|
|
3
|
+
import { TheDate } from '../date/theDate.mjs';
|
|
4
|
+
|
|
5
|
+
const separator = "/*\\";
|
|
6
|
+
const firstElementInPathRegex = new RegExp(`^((?:(?!${escapeRegExp(separator)}).)*)(?:${escapeRegExp(separator)})?`);
|
|
7
|
+
const getIndexRegex = /^\[(\d+)\]$/;
|
|
8
|
+
const invalidEntryRegex = /__proto__|constructor|prototype/;
|
|
9
|
+
class TheFormData extends FormData {
|
|
10
|
+
inputValues;
|
|
11
|
+
constructor(inputValues) {
|
|
12
|
+
super();
|
|
13
|
+
this.inputValues = inputValues;
|
|
14
|
+
for (const entry of TheFormData.toFlatEntries(inputValues)) {
|
|
15
|
+
this.append(entry[0], entry[1]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static *toFlatEntries(value, path) {
|
|
19
|
+
if (typeof value === "string"
|
|
20
|
+
|| value instanceof TheTime
|
|
21
|
+
|| value instanceof TheDate
|
|
22
|
+
|| typeof value === "number"
|
|
23
|
+
|| typeof value === "boolean") {
|
|
24
|
+
yield [path ?? "", value.toString()];
|
|
25
|
+
}
|
|
26
|
+
else if (value instanceof File) {
|
|
27
|
+
yield [path ?? "", value];
|
|
28
|
+
}
|
|
29
|
+
else if (value === null) {
|
|
30
|
+
yield [path ?? "", "null"];
|
|
31
|
+
}
|
|
32
|
+
else if (value === undefined) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
else if (value instanceof Array) {
|
|
36
|
+
for (let index = 0; index < value.length; index++) {
|
|
37
|
+
const entriesIterator = this.toFlatEntries(value[index], path === undefined
|
|
38
|
+
? `[${index}]`
|
|
39
|
+
: `${path}${separator}[${index}]`);
|
|
40
|
+
for (const entry of entriesIterator) {
|
|
41
|
+
yield entry;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
for (const key in value) {
|
|
47
|
+
const entriesIterator = this.toFlatEntries(value[key], path === undefined
|
|
48
|
+
? key
|
|
49
|
+
: `${path}${separator}${key}`);
|
|
50
|
+
for (const entry of entriesIterator) {
|
|
51
|
+
yield entry;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static fromEntries(iterable, arrayMaxIndex) {
|
|
57
|
+
const constructObject = (object, path, value) => {
|
|
58
|
+
const firstElement = path.match(firstElementInPathRegex)[1];
|
|
59
|
+
const index = firstElement.match(getIndexRegex)?.[1];
|
|
60
|
+
if (index && Number(index) > arrayMaxIndex) {
|
|
61
|
+
return object;
|
|
62
|
+
}
|
|
63
|
+
let currentObject = object;
|
|
64
|
+
if (currentObject === undefined) {
|
|
65
|
+
if (index !== undefined) {
|
|
66
|
+
currentObject = [];
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
currentObject = {};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (firstElement === path) {
|
|
73
|
+
currentObject[(index ?? firstElement)] = value;
|
|
74
|
+
return currentObject;
|
|
75
|
+
}
|
|
76
|
+
currentObject[(index ?? firstElement)] = constructObject(currentObject[(index ?? firstElement)], path.replace(firstElementInPathRegex, ""), value);
|
|
77
|
+
return currentObject;
|
|
78
|
+
};
|
|
79
|
+
let result = undefined;
|
|
80
|
+
for (const entry of iterable) {
|
|
81
|
+
if (invalidEntryRegex.test(entry[0])) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
result = constructObject(result, entry[0], entry[1]);
|
|
85
|
+
}
|
|
86
|
+
return result ?? {};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
static "new"(inputValues) {
|
|
92
|
+
return new TheFormData(inputValues);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* {@include common/createFormData/index.md}
|
|
97
|
+
*/
|
|
98
|
+
function createFormData(inputValues) {
|
|
99
|
+
return TheFormData.new(inputValues);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { TheFormData, createFormData };
|
package/dist/common/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* - predicates and guards (`when`, `whenNot`, `whenElse`, `and`, `or`, `isType`, `asserts`, `instanceOf`)
|
|
17
17
|
* - control flow (`loop`, `asyncLoop`, `asyncRetry`, `sleep`, `memo`)
|
|
18
18
|
* - promise utilities (`externalPromise`, `promiseObject`)
|
|
19
|
+
* - form-data utilities (`createFormData`, `TheFormData.fromEntries`, `TheFormData.toFlatEntries`)
|
|
19
20
|
* - string and value conversions (`stringToMillisecond`, `stringToBytes`, `escapeRegExp`, `toRegExp`)
|
|
20
21
|
* - wrappers and kinds (`wrapValue`, `unwrap`, `toWrappedValue`, `hasKinds`, `hasSomeKinds`)
|
|
21
22
|
*
|
|
@@ -67,6 +68,7 @@ export * from "./override";
|
|
|
67
68
|
export * from "./errorKindNamespace";
|
|
68
69
|
export * from "./truthy";
|
|
69
70
|
export * from "./falsy";
|
|
71
|
+
export * from "./formData";
|
|
70
72
|
export * from "./hasSomeKinds";
|
|
71
73
|
export * from "./hasKinds";
|
|
72
74
|
export * from "./toCurriedPredicate";
|
package/dist/common/kind.d.ts
CHANGED
|
@@ -36,6 +36,9 @@ export type GetKindValue<GenericKindHandler extends KindHandler, GenericObject e
|
|
|
36
36
|
export type GetKindHandler<GenericObject extends Kind<any>> = {
|
|
37
37
|
[Prop in keyof GenericObject[SymbolKind]]: KindHandler<KindDefinition<Adaptor<Prop, string>, GenericObject[SymbolKind][Prop]>>;
|
|
38
38
|
}[keyof GenericObject[SymbolKind]];
|
|
39
|
+
export interface GetKind<GenericObject extends Kind<any>> {
|
|
40
|
+
[SymbolKind]: GenericObject[SymbolKind];
|
|
41
|
+
}
|
|
39
42
|
export declare const keyKindPrefix = "@duplojs/utils/kind/";
|
|
40
43
|
type ForbiddenKindCharacters<GenericValue extends string> = ForbiddenString<GenericValue, "@" | "/">;
|
|
41
44
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GetKindHandler, type GetKindValue, type IsEqual, type Kind, type KindHandler, type OverrideHandler, type RemoveKind } from "../common";
|
|
1
|
+
import { type GetKind, type GetKindHandler, type GetKindValue, type IsEqual, type Kind, type KindHandler, type OverrideHandler, type RemoveKind } from "../common";
|
|
2
2
|
import { SymbolDataParserErrorIssue, SymbolDataParserErrorPromiseIssue, type DataParserError } from "./error";
|
|
3
3
|
import * as DEither from "../either";
|
|
4
4
|
export declare const SymbolDataParserErrorLabel = "SymbolDataParserError";
|
|
@@ -257,4 +257,8 @@ export declare namespace dataParserInit {
|
|
|
257
257
|
export type Output<GenericDataParser extends DataParser> = GetKindValue<typeof dataParserKind, GenericDataParser>["output"];
|
|
258
258
|
export type Input<GenericDataParser extends DataParser> = GetKindValue<typeof dataParserKind, GenericDataParser>["input"];
|
|
259
259
|
export type Contract<GenericOutput extends unknown, GenericInput extends unknown = GenericOutput> = DataParser<DataParserDefinition, GenericOutput, GenericInput>;
|
|
260
|
+
export type AdvancedContract<GenericDataParser extends DataParser> = (GetKind<GenericDataParser> & Omit<RemoveKind<DataParser>, "addChecker" | "clone" | "definition"> & Pick<GenericDataParser, "definition"> & {
|
|
261
|
+
addChecker(...args: never): AdvancedContract<GenericDataParser>;
|
|
262
|
+
clone(): AdvancedContract<GenericDataParser>;
|
|
263
|
+
});
|
|
260
264
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Kind, type NeverCoalescing, type AnyFunction, type SimplifyTopLevel, type AnyValue, type OverrideHandler } from "../common";
|
|
1
|
+
import { type Kind, type NeverCoalescing, type AnyFunction, type SimplifyTopLevel, type AnyValue, type OverrideHandler, type GetKind, type RemoveKind } from "../common";
|
|
2
2
|
import { type MergeDefinition } from "./types";
|
|
3
3
|
import { type Output, type DataParser, type DataParserDefinition } from "./base";
|
|
4
4
|
import type * as DEither from "../either";
|
|
@@ -416,4 +416,8 @@ export declare namespace dataParserExtendedInit {
|
|
|
416
416
|
var overrideHandler: OverrideHandler<DataParserExtended<DataParserDefinition<import("./base").DataParserChecker<import("./base").DataParserCheckerDefinition, unknown>>, unknown, unknown>>;
|
|
417
417
|
}
|
|
418
418
|
export type ContractExtended<GenericOutput extends unknown, GenericInput extends unknown = GenericOutput> = DataParserExtended<DataParserDefinition, GenericOutput, GenericInput>;
|
|
419
|
+
export type AdvancedContractExtended<GenericDataParser extends DataParserExtended> = (GetKind<GenericDataParser> & Omit<RemoveKind<DataParserExtended>, "addChecker" | "clone" | "definition"> & Pick<GenericDataParser, "definition"> & {
|
|
420
|
+
addChecker(...args: never): AdvancedContractExtended<GenericDataParser>;
|
|
421
|
+
clone(): AdvancedContractExtended<GenericDataParser>;
|
|
422
|
+
});
|
|
419
423
|
export {};
|
|
@@ -3,7 +3,7 @@ import { type DataParserExtended } from "../baseExtended";
|
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
5
|
import { type Input, type Output, type DataParser } from "../base";
|
|
6
|
-
type _DataParserArrayExtended<GenericDefinition extends dataParsers.DataParserDefinitionArray> = (Kind<typeof dataParsers.arrayKind.definition> & DataParserExtended<GenericDefinition, Output<GenericDefinition
|
|
6
|
+
type _DataParserArrayExtended<GenericDefinition extends dataParsers.DataParserDefinitionArray> = (Kind<typeof dataParsers.arrayKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserArray<GenericDefinition>>, Input<dataParsers.DataParserArray<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserArrayExtended<GenericDefinition extends dataParsers.DataParserDefinitionArray = dataParsers.DataParserDefinitionArray> extends _DataParserArrayExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserArrayCheckers<Output<this>>,
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserBigIntExtended<GenericDefinition extends dataParsers.DataParserDefinitionBigInt> = (Kind<typeof dataParsers.bigIntKind.definition> & DataParserExtended<GenericDefinition,
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserBigIntExtended<GenericDefinition extends dataParsers.DataParserDefinitionBigInt> = (Kind<typeof dataParsers.bigIntKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserBigInt<GenericDefinition>>, Input<dataParsers.DataParserBigInt<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserBigIntExtended<GenericDefinition extends dataParsers.DataParserDefinitionBigInt = dataParsers.DataParserDefinitionBigInt> extends _DataParserBigIntExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserBigIntCheckers,
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserBooleanExtended<GenericDefinition extends dataParsers.DataParserDefinitionBoolean> = (Kind<typeof dataParsers.booleanKind.definition> & DataParserExtended<GenericDefinition,
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserBooleanExtended<GenericDefinition extends dataParsers.DataParserDefinitionBoolean> = (Kind<typeof dataParsers.booleanKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserBoolean<GenericDefinition>>, Input<dataParsers.DataParserBoolean<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserBooleanExtended<GenericDefinition extends dataParsers.DataParserDefinitionBoolean = dataParsers.DataParserDefinitionBoolean> extends _DataParserBooleanExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserBooleanCheckers,
|
|
@@ -2,9 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
|
|
7
|
-
type _DataParserDateExtended<GenericDefinition extends dataParsers.DataParserDefinitionDate> = (Kind<typeof dataParsers.dateKind.definition> & DataParserExtended<GenericDefinition, TheDate, TheDate>);
|
|
5
|
+
import { type Output, type Input } from "../base";
|
|
6
|
+
type _DataParserDateExtended<GenericDefinition extends dataParsers.DataParserDefinitionDate> = (Kind<typeof dataParsers.dateKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserDate<GenericDefinition>>, Input<dataParsers.DataParserDate<GenericDefinition>>>);
|
|
8
7
|
export interface DataParserDateExtended<GenericDefinition extends dataParsers.DataParserDefinitionDate = dataParsers.DataParserDefinitionDate> extends _DataParserDateExtended<GenericDefinition> {
|
|
9
8
|
addChecker<GenericChecker extends readonly [
|
|
10
9
|
dataParsers.DataParserDateCheckers,
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserEmptyExtended<GenericDefinition extends dataParsers.DataParserDefinitionEmpty> = (Kind<typeof dataParsers.emptyKind.definition> & DataParserExtended<GenericDefinition,
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserEmptyExtended<GenericDefinition extends dataParsers.DataParserDefinitionEmpty> = (Kind<typeof dataParsers.emptyKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserEmpty<GenericDefinition>>, Input<dataParsers.DataParserEmpty<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserEmptyExtended<GenericDefinition extends dataParsers.DataParserDefinitionEmpty = dataParsers.DataParserDefinitionEmpty> extends _DataParserEmptyExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserEmptyCheckers,
|
|
@@ -3,7 +3,7 @@ import { type DataParserExtended } from "../baseExtended";
|
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
5
|
import { type Input, type Output, type DataParser } from "../base";
|
|
6
|
-
type _DataParserLazyExtended<GenericDefinition extends dataParsers.DataParserDefinitionLazy> = (Kind<typeof dataParsers.lazyKind.definition> & DataParserExtended<GenericDefinition, Output<GenericDefinition
|
|
6
|
+
type _DataParserLazyExtended<GenericDefinition extends dataParsers.DataParserDefinitionLazy> = (Kind<typeof dataParsers.lazyKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserLazy<GenericDefinition>>, Input<dataParsers.DataParserLazy<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserLazyExtended<GenericDefinition extends dataParsers.DataParserDefinitionLazy = dataParsers.DataParserDefinitionLazy> extends _DataParserLazyExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserLazyCheckers<Output<this>>,
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserLiteralExtended<GenericDefinition extends dataParsers.DataParserDefinitionLiteral> = (Kind<typeof dataParsers.literalKind.definition> & DataParserExtended<GenericDefinition, GenericDefinition
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserLiteralExtended<GenericDefinition extends dataParsers.DataParserDefinitionLiteral> = (Kind<typeof dataParsers.literalKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserLiteral<GenericDefinition>>, Input<dataParsers.DataParserLiteral<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserLiteralExtended<GenericDefinition extends dataParsers.DataParserDefinitionLiteral = dataParsers.DataParserDefinitionLiteral> extends _DataParserLiteralExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserLiteralCheckers<Output<this>>,
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserNilExtended<GenericDefinition extends dataParsers.DataParserDefinitionNil> = (Kind<typeof dataParsers.nilKind.definition> & DataParserExtended<GenericDefinition,
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserNilExtended<GenericDefinition extends dataParsers.DataParserDefinitionNil> = (Kind<typeof dataParsers.nilKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserNil<GenericDefinition>>, Input<dataParsers.DataParserNil<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserNilExtended<GenericDefinition extends dataParsers.DataParserDefinitionNil = dataParsers.DataParserDefinitionNil> extends _DataParserNilExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserNilCheckers,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type FixDeepFunctionInfer, type
|
|
1
|
+
import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing, type SimplifyTopLevel } from "../../common";
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
5
|
import { type Input, type Output, type DataParser } from "../base";
|
|
6
|
-
type _DataParserNullableExtended<GenericDefinition extends dataParsers.DataParserDefinitionNullable> = (Kind<typeof dataParsers.nullableKind.definition> & DataParserExtended<GenericDefinition,
|
|
6
|
+
type _DataParserNullableExtended<GenericDefinition extends dataParsers.DataParserDefinitionNullable> = (Kind<typeof dataParsers.nullableKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserNullable<GenericDefinition>>, Input<dataParsers.DataParserNullable<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserNullableExtended<GenericDefinition extends dataParsers.DataParserDefinitionNullable = dataParsers.DataParserDefinitionNullable> extends _DataParserNullableExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserNullableCheckers<Output<this>>,
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserNumberExtended<GenericDefinition extends dataParsers.DataParserDefinitionNumber> = (Kind<typeof dataParsers.numberKind.definition> & DataParserExtended<GenericDefinition,
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserNumberExtended<GenericDefinition extends dataParsers.DataParserDefinitionNumber> = (Kind<typeof dataParsers.numberKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserNumber<GenericDefinition>>, Input<dataParsers.DataParserNumber<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserNumberExtended<GenericDefinition extends dataParsers.DataParserDefinitionNumber = dataParsers.DataParserDefinitionNumber> extends _DataParserNumberExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserNumberCheckers,
|
|
@@ -2,9 +2,9 @@ import { type Adaptor, type FixDeepFunctionInfer, type Kind, type NeverCoalescin
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
6
|
import { type AssignObjects } from "../../object";
|
|
7
|
-
type _DataParserObjectExtended<GenericDefinition extends dataParsers.DataParserDefinitionObject> = (Kind<typeof dataParsers.objectKind.definition> & DataParserExtended<GenericDefinition, dataParsers.
|
|
7
|
+
type _DataParserObjectExtended<GenericDefinition extends dataParsers.DataParserDefinitionObject> = (Kind<typeof dataParsers.objectKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserObject<GenericDefinition>>, Input<dataParsers.DataParserObject<GenericDefinition>>>);
|
|
8
8
|
export interface DataParserObjectExtended<GenericDefinition extends dataParsers.DataParserDefinitionObject = dataParsers.DataParserDefinitionObject> extends _DataParserObjectExtended<GenericDefinition> {
|
|
9
9
|
addChecker<GenericChecker extends readonly [
|
|
10
10
|
dataParsers.DataParserObjectCheckers<Output<this>>,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type FixDeepFunctionInfer, type
|
|
1
|
+
import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing, type SimplifyTopLevel } from "../../common";
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
5
|
import { type Input, type Output, type DataParser } from "../base";
|
|
6
|
-
type _DataParserOptionalExtended<GenericDefinition extends dataParsers.DataParserDefinitionOptional> = (Kind<typeof dataParsers.optionalKind.definition> & DataParserExtended<GenericDefinition,
|
|
6
|
+
type _DataParserOptionalExtended<GenericDefinition extends dataParsers.DataParserDefinitionOptional> = (Kind<typeof dataParsers.optionalKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserOptional<GenericDefinition>>, Input<dataParsers.DataParserOptional<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserOptionalExtended<GenericDefinition extends dataParsers.DataParserDefinitionOptional = dataParsers.DataParserDefinitionOptional> extends _DataParserOptionalExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserOptionalCheckers<Output<this>>,
|
|
@@ -3,7 +3,7 @@ import { type DataParserExtended } from "../baseExtended";
|
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
5
|
import { type Input, type Output, type DataParser } from "../base";
|
|
6
|
-
type _DataParserPipeExtended<GenericDefinition extends dataParsers.DataParserDefinitionPipe> = (Kind<typeof dataParsers.pipeKind.definition> & DataParserExtended<GenericDefinition, Output<GenericDefinition
|
|
6
|
+
type _DataParserPipeExtended<GenericDefinition extends dataParsers.DataParserDefinitionPipe> = (Kind<typeof dataParsers.pipeKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserPipe<GenericDefinition>>, Input<dataParsers.DataParserPipe<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserPipeExtended<GenericDefinition extends dataParsers.DataParserDefinitionPipe = dataParsers.DataParserDefinitionPipe> extends _DataParserPipeExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserPipeCheckers<Output<this>>,
|
|
@@ -3,7 +3,7 @@ import { type DataParserExtended } from "../baseExtended";
|
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
5
|
import { type Input, type Output, type DataParser } from "../base";
|
|
6
|
-
type _DataParserRecoverExtended<GenericDefinition extends dataParsers.DataParserDefinitionRecover> = (Kind<typeof dataParsers.recoverKind.definition> & DataParserExtended<GenericDefinition, GenericDefinition
|
|
6
|
+
type _DataParserRecoverExtended<GenericDefinition extends dataParsers.DataParserDefinitionRecover> = (Kind<typeof dataParsers.recoverKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserRecover<GenericDefinition>>, Input<dataParsers.DataParserRecover<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserRecoverExtended<GenericDefinition extends dataParsers.DataParserDefinitionRecover = dataParsers.DataParserDefinitionRecover> extends _DataParserRecoverExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserRecoverCheckers<Output<this>>,
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserStringExtended<GenericDefinition extends dataParsers.DataParserDefinitionString> = (Kind<typeof dataParsers.stringKind.definition> & DataParserExtended<GenericDefinition,
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserStringExtended<GenericDefinition extends dataParsers.DataParserDefinitionString> = (Kind<typeof dataParsers.stringKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserString<GenericDefinition>>, Input<dataParsers.DataParserString<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserStringExtended<GenericDefinition extends dataParsers.DataParserDefinitionString = dataParsers.DataParserDefinitionString> extends _DataParserStringExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserStringCheckers,
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserTemplateLiteralExtended<GenericDefinition extends dataParsers.DataParserDefinitionTemplateLiteral> = (Kind<typeof dataParsers.templateLiteralKind.definition> & DataParserExtended<GenericDefinition, dataParsers.
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserTemplateLiteralExtended<GenericDefinition extends dataParsers.DataParserDefinitionTemplateLiteral> = (Kind<typeof dataParsers.templateLiteralKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserTemplateLiteral<GenericDefinition>>, Input<dataParsers.DataParserTemplateLiteral<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserTemplateLiteralExtended<GenericDefinition extends dataParsers.DataParserDefinitionTemplateLiteral = dataParsers.DataParserDefinitionTemplateLiteral> extends _DataParserTemplateLiteralExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserTemplateLiteralCheckers<Output<this>>,
|
|
@@ -2,9 +2,9 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
6
|
import { type TheTime } from "../../date";
|
|
7
|
-
type _DataParserTimeExtended<GenericDefinition extends dataParsers.DataParserDefinitionTime> = (Kind<typeof dataParsers.timeKind.definition> & DataParserExtended<GenericDefinition,
|
|
7
|
+
type _DataParserTimeExtended<GenericDefinition extends dataParsers.DataParserDefinitionTime> = (Kind<typeof dataParsers.timeKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserTime<GenericDefinition>>, Input<dataParsers.DataParserTime<GenericDefinition>>>);
|
|
8
8
|
export interface DataParserTimeExtended<GenericDefinition extends dataParsers.DataParserDefinitionTime = dataParsers.DataParserDefinitionTime> extends _DataParserTimeExtended<GenericDefinition> {
|
|
9
9
|
addChecker<GenericChecker extends readonly [
|
|
10
10
|
dataParsers.DataParserTimeCheckers,
|
|
@@ -4,7 +4,7 @@ import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
5
|
import { type DataParser, type Input, type Output } from "../base";
|
|
6
6
|
import { type DataParserError } from "../error";
|
|
7
|
-
type _DataParserTransformExtended<GenericDefinition extends dataParsers.DataParserDefinitionTransform> = (Kind<typeof dataParsers.transformKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserTransform<GenericDefinition>>, Input<GenericDefinition
|
|
7
|
+
type _DataParserTransformExtended<GenericDefinition extends dataParsers.DataParserDefinitionTransform> = (Kind<typeof dataParsers.transformKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserTransform<GenericDefinition>>, Input<dataParsers.DataParserTransform<GenericDefinition>>>);
|
|
8
8
|
export interface DataParserTransformExtended<GenericDefinition extends dataParsers.DataParserDefinitionTransform = dataParsers.DataParserDefinitionTransform> extends _DataParserTransformExtended<GenericDefinition> {
|
|
9
9
|
addChecker<GenericChecker extends readonly [
|
|
10
10
|
dataParsers.DataParserTransformCheckers<Output<this>>,
|
|
@@ -17,6 +17,10 @@ function tuple(shape, definition) {
|
|
|
17
17
|
max(self, max$1, definition) {
|
|
18
18
|
return self.addChecker(max.checkerArrayMax(max$1, definition));
|
|
19
19
|
},
|
|
20
|
+
rest: (self, dataParser) => tuple(self.definition.shape, {
|
|
21
|
+
...self.definition,
|
|
22
|
+
rest: dataParser,
|
|
23
|
+
}),
|
|
20
24
|
}, tuple.overrideHandler);
|
|
21
25
|
return self;
|
|
22
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../../common";
|
|
1
|
+
import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing, type SimplifyTopLevel } from "../../common";
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
|
-
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
3
|
+
import { type AddCheckersToDefinition, type MergeDefinition, type DataParsers } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
5
|
import { type Input, type Output } from "../base";
|
|
6
6
|
type _DataParserTupleExtended<GenericDefinition extends dataParsers.DataParserDefinitionTuple> = (Kind<typeof dataParsers.tupleKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserTuple<GenericDefinition>>, Input<dataParsers.DataParserTuple<GenericDefinition>>>);
|
|
@@ -13,8 +13,102 @@ export interface DataParserTupleExtended<GenericDefinition extends dataParsers.D
|
|
|
13
13
|
...dataParsers.DataParserTupleCheckers<Output<this>>[]
|
|
14
14
|
], GenericChecker>): DataParserTupleExtended<AddCheckersToDefinition<GenericDefinition, GenericChecker>>;
|
|
15
15
|
refine(theFunction: (input: Output<this>) => boolean, definition?: Partial<Omit<dataParsers.DataParserCheckerDefinitionRefine, "theFunction">>): DataParserTupleExtended<AddCheckersToDefinition<GenericDefinition, readonly [dataParsers.CheckerRefineImplementation<Output<this>>]>>;
|
|
16
|
+
/**
|
|
17
|
+
* Adds a minimum length checker to a tuple parser.
|
|
18
|
+
*
|
|
19
|
+
* **Supported call styles:**
|
|
20
|
+
* - Method: `dataParser.min(min, definition?)` -> returns a tuple parser
|
|
21
|
+
*
|
|
22
|
+
* Ensures the parsed tuple has at least the given number of items.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const parser = DPE.tuple([DPE.string(), DPE.number()]).min(2);
|
|
26
|
+
* const result = parser.parse(["id", 42]);
|
|
27
|
+
* if (E.isRight(result)) {
|
|
28
|
+
* const value = unwrap(result);
|
|
29
|
+
* // value: [string, number]
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* const withRest = DPE.tuple([DPE.string()], { rest: DPE.number() }).min(2);
|
|
33
|
+
* const withRestResult = withRest.parse(["a", 1, 2]);
|
|
34
|
+
*
|
|
35
|
+
* const withMessage = DPE.tuple(
|
|
36
|
+
* [DPE.boolean()],
|
|
37
|
+
* ).min(1, { errorMessage: "tuple.too-short" });
|
|
38
|
+
* const withMessageResult = withMessage.parse([true]);
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @see https://utils.duplojs.dev/en/v1/api/dataParser/tuple
|
|
42
|
+
*
|
|
43
|
+
* @namespace DPE
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
16
46
|
min(min: number, definition?: Partial<Omit<dataParsers.DataParserCheckerDefinitionArrayMin, "min">>): DataParserTupleExtended<AddCheckersToDefinition<GenericDefinition, readonly [dataParsers.DataParserCheckerArrayMin]>>;
|
|
47
|
+
/**
|
|
48
|
+
* Adds a maximum length checker to a tuple parser.
|
|
49
|
+
*
|
|
50
|
+
* **Supported call styles:**
|
|
51
|
+
* - Method: `dataParser.max(max, definition?)` -> returns a tuple parser
|
|
52
|
+
*
|
|
53
|
+
* Ensures the parsed tuple has at most the given number of items.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* const parser = DPE.tuple([DPE.string(), DPE.number()]).max(2);
|
|
57
|
+
* const result = parser.parse(["id", 42]);
|
|
58
|
+
* if (E.isRight(result)) {
|
|
59
|
+
* const value = unwrap(result);
|
|
60
|
+
* // value: [string, number]
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* const withRest = DPE.tuple([DPE.string()], { rest: DPE.number() }).max(3);
|
|
64
|
+
* const withRestResult = withRest.parse(["a", 1, 2]);
|
|
65
|
+
*
|
|
66
|
+
* const withMessage = DPE.tuple(
|
|
67
|
+
* [DPE.boolean(), DPE.boolean()],
|
|
68
|
+
* ).max(2, { errorMessage: "tuple.too-long" });
|
|
69
|
+
* const withMessageResult = withMessage.parse([true, false]);
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @see https://utils.duplojs.dev/en/v1/api/dataParser/tuple
|
|
73
|
+
*
|
|
74
|
+
* @namespace DPE
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
17
77
|
max(max: number, definition?: Partial<Omit<dataParsers.DataParserCheckerDefinitionArrayMax, "max">>): DataParserTupleExtended<AddCheckersToDefinition<GenericDefinition, readonly [dataParsers.DataParserCheckerArrayMax]>>;
|
|
78
|
+
/**
|
|
79
|
+
* Adds or replaces the rest parser of a tuple parser.
|
|
80
|
+
*
|
|
81
|
+
* **Supported call styles:**
|
|
82
|
+
* - Method: `dataParser.rest(dataParser)` -> returns a tuple parser
|
|
83
|
+
*
|
|
84
|
+
* Returns a new tuple parser where items after the fixed shape are validated by the provided parser.
|
|
85
|
+
*
|
|
86
|
+
* ```ts
|
|
87
|
+
* const parser = DPE.tuple([DPE.string()]).rest(DPE.number());
|
|
88
|
+
* const result = parser.parse(["id", 1, 2]);
|
|
89
|
+
* if (E.isRight(result)) {
|
|
90
|
+
* const value = unwrap(result);
|
|
91
|
+
* // value: [string, ...number[]]
|
|
92
|
+
* }
|
|
93
|
+
*
|
|
94
|
+
* const boolTail = DPE.tuple([DPE.boolean()]).rest(DPE.boolean());
|
|
95
|
+
* const boolTailResult = boolTail.parse([true, false, true]);
|
|
96
|
+
*
|
|
97
|
+
* const chained = DPE.tuple([DPE.string()])
|
|
98
|
+
* .rest(DPE.number())
|
|
99
|
+
* .min(2)
|
|
100
|
+
* .max(4);
|
|
101
|
+
* const chainedResult = chained.parse(["a", 1, 2]);
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @see https://utils.duplojs.dev/en/v1/api/dataParser/tuple
|
|
105
|
+
*
|
|
106
|
+
* @namespace DPE
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
109
|
+
rest<GenericDataParser extends DataParsers>(dataParser: GenericDataParser): DataParserTupleExtended<SimplifyTopLevel<Omit<GenericDefinition, "rest"> & {
|
|
110
|
+
readonly rest: GenericDataParser;
|
|
111
|
+
}>>;
|
|
18
112
|
}
|
|
19
113
|
/**
|
|
20
114
|
* Creates an extended data parser for tuples with a fixed shape.
|
|
@@ -15,6 +15,10 @@ function tuple(shape, definition) {
|
|
|
15
15
|
max(self, max, definition) {
|
|
16
16
|
return self.addChecker(checkerArrayMax(max, definition));
|
|
17
17
|
},
|
|
18
|
+
rest: (self, dataParser) => tuple(self.definition.shape, {
|
|
19
|
+
...self.definition,
|
|
20
|
+
rest: dataParser,
|
|
21
|
+
}),
|
|
18
22
|
}, tuple.overrideHandler);
|
|
19
23
|
return self;
|
|
20
24
|
}
|
|
@@ -2,8 +2,8 @@ import { type FixDeepFunctionInfer, type Kind, type NeverCoalescing } from "../.
|
|
|
2
2
|
import { type DataParserExtended } from "../baseExtended";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../types";
|
|
4
4
|
import * as dataParsers from "../parsers";
|
|
5
|
-
import { type Output } from "../base";
|
|
6
|
-
type _DataParserUnknownExtended<GenericDefinition extends dataParsers.DataParserDefinitionUnknown> = (Kind<typeof dataParsers.unknownKind.definition> & DataParserExtended<GenericDefinition,
|
|
5
|
+
import { type Input, type Output } from "../base";
|
|
6
|
+
type _DataParserUnknownExtended<GenericDefinition extends dataParsers.DataParserDefinitionUnknown> = (Kind<typeof dataParsers.unknownKind.definition> & DataParserExtended<GenericDefinition, Output<dataParsers.DataParserUnknown<GenericDefinition>>, Input<dataParsers.DataParserUnknown<GenericDefinition>>>);
|
|
7
7
|
export interface DataParserUnknownExtended<GenericDefinition extends dataParsers.DataParserDefinitionUnknown = dataParsers.DataParserDefinitionUnknown> extends _DataParserUnknownExtended<GenericDefinition> {
|
|
8
8
|
addChecker<GenericChecker extends readonly [
|
|
9
9
|
dataParsers.DataParserUnknownCheckers,
|
|
@@ -42,7 +42,7 @@ export declare const identifier: {
|
|
|
42
42
|
input: boolean;
|
|
43
43
|
output: boolean;
|
|
44
44
|
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
45
|
-
input:
|
|
45
|
+
input: `date${number}-` | `date${number}+` | import("../date").TheDate | Date;
|
|
46
46
|
output: import("../date").TheDate;
|
|
47
47
|
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
48
48
|
input: number | import("../date").TheTime | `time${number}-` | `time${number}+`;
|
|
@@ -56,15 +56,6 @@ export declare const identifier: {
|
|
|
56
56
|
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
57
57
|
input: Record<never, unknown>;
|
|
58
58
|
output: Record<never, unknown>;
|
|
59
|
-
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
60
|
-
input: unknown[];
|
|
61
|
-
output: unknown[];
|
|
62
|
-
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
63
|
-
input: import("../date").TheDate;
|
|
64
|
-
output: import("../date").TheDate;
|
|
65
|
-
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
66
|
-
input: import("../date").TheTime;
|
|
67
|
-
output: import("../date").TheTime;
|
|
68
59
|
}>>, GenericInput extends unknown, GenericGroupedKind extends import("../common").UnionToIntersection<GenericKindHandler extends import("../common").KindHandler<import("../common").KindDefinition<string, unknown>> ? import("../common").Kind<GenericKindHandler["definition"], GenericKindHandler["definition"]["value"]> : never>>(kind: GenericKindHandler | GenericKindHandler[]): (input: GenericInput) => input is (import("../common").IsEqual<import("../common").IsEqual<false | (GenericInput extends any ? import("../common").IsEqual<GenericInput, DataParser<import("./base").DataParserDefinition<import("./base").DataParserChecker<import("./base").DataParserCheckerDefinition, unknown>>, unknown, unknown>> : never), boolean>, true> extends true ? Extract<DataParser<import("./base").DataParserDefinition<import("./base").DataParserChecker<import("./base").DataParserCheckerDefinition, unknown>>, unknown, unknown>, GenericGroupedKind> | Extract<import("./parsers").DataParserString<import("./parsers").DataParserDefinitionString>, GenericGroupedKind> | Extract<import("./parsers").DataParserObject<import("./parsers").DataParserDefinitionObject>, GenericGroupedKind> | Extract<import("./parsers").DataParserNumber<import("./parsers").DataParserDefinitionNumber>, GenericGroupedKind> | Extract<import("./parsers").DataParserLiteral<import("./parsers").DataParserDefinitionLiteral>, GenericGroupedKind> | Extract<import("./parsers").DataParserUnion<import("./parsers").DataParserDefinitionUnion>, GenericGroupedKind> | Extract<import("./parsers").DataParserArray<import("./parsers").DataParserDefinitionArray>, GenericGroupedKind> | Extract<import("./parsers").DataParserBigInt<import("./parsers").DataParserDefinitionBigInt>, GenericGroupedKind> | Extract<import("./parsers").DataParserTuple<import("./parsers").DataParserDefinitionTuple>, GenericGroupedKind> | Extract<import("./parsers").DataParserTransform<import("./parsers").DataParserDefinitionTransform>, GenericGroupedKind> | Extract<import("./parsers").DataParserBoolean<import("./parsers").DataParserDefinitionBoolean>, GenericGroupedKind> | Extract<import("./parsers").DataParserDate<import("./parsers").DataParserDefinitionDate>, GenericGroupedKind> | Extract<import("./parsers").DataParserTime<import("./parsers").DataParserDefinitionTime>, GenericGroupedKind> | Extract<import("./parsers").DataParserNil<import("./parsers").DataParserDefinitionNil>, GenericGroupedKind> | Extract<import("./parsers").DataParserEmpty<import("./parsers").DataParserDefinitionEmpty>, GenericGroupedKind> | Extract<import("./parsers").DataParserTemplateLiteral<import("./parsers").DataParserDefinitionTemplateLiteral>, GenericGroupedKind> | Extract<import("./parsers").DataParserPipe<import("./parsers").DataParserDefinitionPipe>, GenericGroupedKind> | Extract<import("./parsers").DataParserNullable<import("./parsers").DataParserDefinitionNullable<unknown>>, GenericGroupedKind> | Extract<import("./parsers").DataParserOptional<import("./parsers").DataParserDefinitionOptional<unknown>>, GenericGroupedKind> | Extract<import("./parsers").DataParserLazy<import("./parsers").DataParserDefinitionLazy>, GenericGroupedKind> | Extract<import("./parsers").DataParserUnknown<import("./parsers").DataParserDefinitionUnknown>, GenericGroupedKind> | Extract<import("./parsers").DataParserRecord<import("./parsers").DataParserDefinitionRecord>, GenericGroupedKind> | Extract<import("./parsers").DataParserRecover<import("./parsers").DataParserDefinitionRecover>, GenericGroupedKind> | Extract<import("./baseExtended").DataParserExtended<import("./base").DataParserDefinition<import("./base").DataParserChecker<import("./base").DataParserCheckerDefinition, unknown>>, unknown, unknown>, GenericGroupedKind> | Extract<import("./extended").DataParserStringExtended<import("./parsers").DataParserDefinitionString>, GenericGroupedKind> | Extract<import("./extended").DataParserObjectExtended<import("./parsers").DataParserDefinitionObject>, GenericGroupedKind> | Extract<import("./extended").DataParserNumberExtended<import("./parsers").DataParserDefinitionNumber>, GenericGroupedKind> | Extract<import("./extended").DataParserLiteralExtended<import("./parsers").DataParserDefinitionLiteral>, GenericGroupedKind> | Extract<import("./extended").DataParserUnionExtended<import("./parsers").DataParserDefinitionUnion>, GenericGroupedKind> | Extract<import("./extended").DataParserArrayExtended<import("./parsers").DataParserDefinitionArray>, GenericGroupedKind> | Extract<import("./extended").DataParserBigIntExtended<import("./parsers").DataParserDefinitionBigInt>, GenericGroupedKind> | Extract<import("./extended").DataParserTupleExtended<import("./parsers").DataParserDefinitionTuple>, GenericGroupedKind> | Extract<import("./extended").DataParserTransformExtended<import("./parsers").DataParserDefinitionTransform>, GenericGroupedKind> | Extract<import("./extended").DataParserBooleanExtended<import("./parsers").DataParserDefinitionBoolean>, GenericGroupedKind> | Extract<import("./extended").DataParserDateExtended<import("./parsers").DataParserDefinitionDate>, GenericGroupedKind> | Extract<import("./extended").DataParserTimeExtended<import("./parsers").DataParserDefinitionTime>, GenericGroupedKind> | Extract<import("./extended").DataParserNilExtended<import("./parsers").DataParserDefinitionNil>, GenericGroupedKind> | Extract<import("./extended").DataParserEmptyExtended<import("./parsers").DataParserDefinitionEmpty>, GenericGroupedKind> | Extract<import("./extended").DataParserTemplateLiteralExtended<import("./parsers").DataParserDefinitionTemplateLiteral>, GenericGroupedKind> | Extract<import("./extended").DataParserPipeExtended<import("./parsers").DataParserDefinitionPipe>, GenericGroupedKind> | Extract<import("./extended").DataParserNullableExtended<import("./parsers").DataParserDefinitionNullable<unknown>>, GenericGroupedKind> | Extract<import("./extended").DataParserOptionalExtended<import("./parsers").DataParserDefinitionOptional<unknown>>, GenericGroupedKind> | Extract<import("./extended").DataParserLazyExtended<import("./parsers").DataParserDefinitionLazy>, GenericGroupedKind> | Extract<import("./extended").DataParserUnknownExtended<import("./parsers").DataParserDefinitionUnknown>, GenericGroupedKind> | Extract<import("./extended").DataParserRecordExtended<import("./parsers").DataParserDefinitionRecord>, GenericGroupedKind> | Extract<import("./extended").DataParserRecoverExtended<import("./parsers").DataParserDefinitionRecover>, GenericGroupedKind> : never) | Extract<GenericInput, GenericGroupedKind>;
|
|
69
60
|
<GenericKindHandler extends import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/bigint", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/extended", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/boolean", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/date", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/time", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/empty", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/nil", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/number", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/string", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/array", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/transform", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/union", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/pipe", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/nullable", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/optional", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/recover", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/lazy", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/literal", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/object", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/record", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/template-literal", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/tuple", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/unknown", unknown>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
70
61
|
input: string;
|
|
@@ -100,7 +91,7 @@ export declare const identifier: {
|
|
|
100
91
|
input: boolean;
|
|
101
92
|
output: boolean;
|
|
102
93
|
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
103
|
-
input:
|
|
94
|
+
input: `date${number}-` | `date${number}+` | import("../date").TheDate | Date;
|
|
104
95
|
output: import("../date").TheDate;
|
|
105
96
|
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
106
97
|
input: number | import("../date").TheTime | `time${number}-` | `time${number}+`;
|
|
@@ -114,14 +105,5 @@ export declare const identifier: {
|
|
|
114
105
|
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
115
106
|
input: Record<never, unknown>;
|
|
116
107
|
output: Record<never, unknown>;
|
|
117
|
-
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
118
|
-
input: unknown[];
|
|
119
|
-
output: unknown[];
|
|
120
|
-
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
121
|
-
input: import("../date").TheDate;
|
|
122
|
-
output: import("../date").TheDate;
|
|
123
|
-
}>> | import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/base", {
|
|
124
|
-
input: import("../date").TheTime;
|
|
125
|
-
output: import("../date").TheTime;
|
|
126
108
|
}>>, GenericInput extends unknown, GenericGroupedKind extends import("../common").UnionToIntersection<GenericKindHandler extends import("../common").KindHandler<import("../common").KindDefinition<string, unknown>> ? import("../common").Kind<GenericKindHandler["definition"], GenericKindHandler["definition"]["value"]> : never>>(input: GenericInput, kind: GenericKindHandler | GenericKindHandler[]): input is (import("../common").IsEqual<import("../common").IsEqual<false | (GenericInput extends any ? import("../common").IsEqual<GenericInput, DataParser<import("./base").DataParserDefinition<import("./base").DataParserChecker<import("./base").DataParserCheckerDefinition, unknown>>, unknown, unknown>> : never), boolean>, true> extends true ? Extract<DataParser<import("./base").DataParserDefinition<import("./base").DataParserChecker<import("./base").DataParserCheckerDefinition, unknown>>, unknown, unknown>, GenericGroupedKind> | Extract<import("./parsers").DataParserString<import("./parsers").DataParserDefinitionString>, GenericGroupedKind> | Extract<import("./parsers").DataParserObject<import("./parsers").DataParserDefinitionObject>, GenericGroupedKind> | Extract<import("./parsers").DataParserNumber<import("./parsers").DataParserDefinitionNumber>, GenericGroupedKind> | Extract<import("./parsers").DataParserLiteral<import("./parsers").DataParserDefinitionLiteral>, GenericGroupedKind> | Extract<import("./parsers").DataParserUnion<import("./parsers").DataParserDefinitionUnion>, GenericGroupedKind> | Extract<import("./parsers").DataParserArray<import("./parsers").DataParserDefinitionArray>, GenericGroupedKind> | Extract<import("./parsers").DataParserBigInt<import("./parsers").DataParserDefinitionBigInt>, GenericGroupedKind> | Extract<import("./parsers").DataParserTuple<import("./parsers").DataParserDefinitionTuple>, GenericGroupedKind> | Extract<import("./parsers").DataParserTransform<import("./parsers").DataParserDefinitionTransform>, GenericGroupedKind> | Extract<import("./parsers").DataParserBoolean<import("./parsers").DataParserDefinitionBoolean>, GenericGroupedKind> | Extract<import("./parsers").DataParserDate<import("./parsers").DataParserDefinitionDate>, GenericGroupedKind> | Extract<import("./parsers").DataParserTime<import("./parsers").DataParserDefinitionTime>, GenericGroupedKind> | Extract<import("./parsers").DataParserNil<import("./parsers").DataParserDefinitionNil>, GenericGroupedKind> | Extract<import("./parsers").DataParserEmpty<import("./parsers").DataParserDefinitionEmpty>, GenericGroupedKind> | Extract<import("./parsers").DataParserTemplateLiteral<import("./parsers").DataParserDefinitionTemplateLiteral>, GenericGroupedKind> | Extract<import("./parsers").DataParserPipe<import("./parsers").DataParserDefinitionPipe>, GenericGroupedKind> | Extract<import("./parsers").DataParserNullable<import("./parsers").DataParserDefinitionNullable<unknown>>, GenericGroupedKind> | Extract<import("./parsers").DataParserOptional<import("./parsers").DataParserDefinitionOptional<unknown>>, GenericGroupedKind> | Extract<import("./parsers").DataParserLazy<import("./parsers").DataParserDefinitionLazy>, GenericGroupedKind> | Extract<import("./parsers").DataParserUnknown<import("./parsers").DataParserDefinitionUnknown>, GenericGroupedKind> | Extract<import("./parsers").DataParserRecord<import("./parsers").DataParserDefinitionRecord>, GenericGroupedKind> | Extract<import("./parsers").DataParserRecover<import("./parsers").DataParserDefinitionRecover>, GenericGroupedKind> | Extract<import("./baseExtended").DataParserExtended<import("./base").DataParserDefinition<import("./base").DataParserChecker<import("./base").DataParserCheckerDefinition, unknown>>, unknown, unknown>, GenericGroupedKind> | Extract<import("./extended").DataParserStringExtended<import("./parsers").DataParserDefinitionString>, GenericGroupedKind> | Extract<import("./extended").DataParserObjectExtended<import("./parsers").DataParserDefinitionObject>, GenericGroupedKind> | Extract<import("./extended").DataParserNumberExtended<import("./parsers").DataParserDefinitionNumber>, GenericGroupedKind> | Extract<import("./extended").DataParserLiteralExtended<import("./parsers").DataParserDefinitionLiteral>, GenericGroupedKind> | Extract<import("./extended").DataParserUnionExtended<import("./parsers").DataParserDefinitionUnion>, GenericGroupedKind> | Extract<import("./extended").DataParserArrayExtended<import("./parsers").DataParserDefinitionArray>, GenericGroupedKind> | Extract<import("./extended").DataParserBigIntExtended<import("./parsers").DataParserDefinitionBigInt>, GenericGroupedKind> | Extract<import("./extended").DataParserTupleExtended<import("./parsers").DataParserDefinitionTuple>, GenericGroupedKind> | Extract<import("./extended").DataParserTransformExtended<import("./parsers").DataParserDefinitionTransform>, GenericGroupedKind> | Extract<import("./extended").DataParserBooleanExtended<import("./parsers").DataParserDefinitionBoolean>, GenericGroupedKind> | Extract<import("./extended").DataParserDateExtended<import("./parsers").DataParserDefinitionDate>, GenericGroupedKind> | Extract<import("./extended").DataParserTimeExtended<import("./parsers").DataParserDefinitionTime>, GenericGroupedKind> | Extract<import("./extended").DataParserNilExtended<import("./parsers").DataParserDefinitionNil>, GenericGroupedKind> | Extract<import("./extended").DataParserEmptyExtended<import("./parsers").DataParserDefinitionEmpty>, GenericGroupedKind> | Extract<import("./extended").DataParserTemplateLiteralExtended<import("./parsers").DataParserDefinitionTemplateLiteral>, GenericGroupedKind> | Extract<import("./extended").DataParserPipeExtended<import("./parsers").DataParserDefinitionPipe>, GenericGroupedKind> | Extract<import("./extended").DataParserNullableExtended<import("./parsers").DataParserDefinitionNullable<unknown>>, GenericGroupedKind> | Extract<import("./extended").DataParserOptionalExtended<import("./parsers").DataParserDefinitionOptional<unknown>>, GenericGroupedKind> | Extract<import("./extended").DataParserLazyExtended<import("./parsers").DataParserDefinitionLazy>, GenericGroupedKind> | Extract<import("./extended").DataParserUnknownExtended<import("./parsers").DataParserDefinitionUnknown>, GenericGroupedKind> | Extract<import("./extended").DataParserRecordExtended<import("./parsers").DataParserDefinitionRecord>, GenericGroupedKind> | Extract<import("./extended").DataParserRecoverExtended<import("./parsers").DataParserDefinitionRecover>, GenericGroupedKind> : never) | Extract<GenericInput, GenericGroupedKind>;
|
|
127
109
|
};
|
|
@@ -53,7 +53,7 @@ export interface DataParserArray<GenericDefinition extends DataParserDefinitionA
|
|
|
53
53
|
*
|
|
54
54
|
*/
|
|
55
55
|
export declare function array<GenericElement extends DataParser, const GenericDefinition extends Partial<Omit<DataParserDefinitionArray, "element">> = never>(element: GenericElement, definition?: GenericDefinition): DataParserArray<MergeDefinition<DataParserDefinitionArray, NeverCoalescing<GenericDefinition, {}> & {
|
|
56
|
-
element: GenericElement;
|
|
56
|
+
readonly element: GenericElement;
|
|
57
57
|
}>>;
|
|
58
58
|
export declare namespace array {
|
|
59
59
|
var overrideHandler: import("../../../common").OverrideHandler<DataParserArray<DataParserDefinitionArray>>;
|
|
@@ -24,9 +24,9 @@ export interface DataParserDefinitionRecord extends DataParserDefinition<DataPar
|
|
|
24
24
|
readonly requireKey: string[] | null;
|
|
25
25
|
}
|
|
26
26
|
export declare const recordKind: import("../../../common").KindHandler<import("../../../common").KindDefinition<"@DuplojsUtilsDataParser/record", unknown>>;
|
|
27
|
-
export type DataParserRecordShapeOutput<GenericDataParserKey extends DataParserRecordKey, GenericDataParserValue extends DataParser> = Extract<Record<Output<GenericDataParserKey> extends infer InferredKey extends string | number ? `${InferredKey}` : never, Output<GenericDataParserValue> extends infer InferredValue ? InferredValue : never>, any
|
|
28
|
-
export type DataParserRecordShapeInput<GenericDataParserKey extends DataParserRecordKey, GenericDataParserValue extends DataParser> = Extract<Record<Input<GenericDataParserKey> extends infer InferredKey extends string | number ? `${InferredKey}` : never, Input<GenericDataParserValue> extends infer InferredValue ? InferredValue : never>, any
|
|
29
|
-
type _DataParserRecord<GenericDefinition extends DataParserDefinitionRecord> = (DataParser<GenericDefinition, DataParserRecordShapeOutput<GenericDefinition["key"], GenericDefinition["value"]
|
|
27
|
+
export type DataParserRecordShapeOutput<GenericDataParserKey extends DataParserRecordKey, GenericDataParserValue extends DataParser> = Extract<Record<Output<GenericDataParserKey> extends infer InferredKey extends string | number ? `${InferredKey}` : never, Output<GenericDataParserValue> extends infer InferredValue ? InferredValue : never>, any> extends infer InferredOutput extends Record<string, unknown> ? TemplateLiteralContainLargeType<Adaptor<keyof InferredOutput, string>> extends true ? Partial<InferredOutput> : InferredOutput : never;
|
|
28
|
+
export type DataParserRecordShapeInput<GenericDataParserKey extends DataParserRecordKey, GenericDataParserValue extends DataParser> = Extract<Record<Input<GenericDataParserKey> extends infer InferredKey extends string | number ? `${InferredKey}` : never, Input<GenericDataParserValue> extends infer InferredValue ? InferredValue : never>, any> extends infer InferredInput extends Record<string, unknown> ? TemplateLiteralContainLargeType<Adaptor<keyof InferredInput, string>> extends true ? Partial<InferredInput> : InferredInput : never;
|
|
29
|
+
type _DataParserRecord<GenericDefinition extends DataParserDefinitionRecord> = (DataParser<GenericDefinition, DataParserRecordShapeOutput<GenericDefinition["key"], GenericDefinition["value"]>, DataParserRecordShapeInput<GenericDefinition["key"], GenericDefinition["value"]>> & Kind<typeof recordKind.definition>);
|
|
30
30
|
export interface DataParserRecord<GenericDefinition extends DataParserDefinitionRecord = DataParserDefinitionRecord> extends _DataParserRecord<GenericDefinition> {
|
|
31
31
|
addChecker<GenericChecker extends readonly [
|
|
32
32
|
DataParserRecordCheckers<Output<this>>,
|
|
@@ -12,7 +12,8 @@ export interface DataParserDefinitionTransform extends DataParserDefinition<Data
|
|
|
12
12
|
theFunction(input: any, error: DataParserError): unknown;
|
|
13
13
|
}
|
|
14
14
|
export declare const transformKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsDataParser/transform", unknown>>;
|
|
15
|
-
type
|
|
15
|
+
export type DataParserTransformOutput<GenericTheFunction extends DataParserDefinitionTransform["theFunction"]> = Exclude<Awaited<ReturnType<GenericTheFunction>>, SymbolDataParserError | SymbolDataParserErrorIssue | SymbolDataParserErrorPromiseIssue>;
|
|
16
|
+
type _DataParserTransform<GenericDefinition extends DataParserDefinitionTransform> = (DataParser<GenericDefinition, DataParserTransformOutput<GenericDefinition["theFunction"]>, Input<GenericDefinition["inner"]>> & Kind<typeof transformKind.definition>);
|
|
16
17
|
export interface DataParserTransform<GenericDefinition extends DataParserDefinitionTransform = DataParserDefinitionTransform> extends _DataParserTransform<GenericDefinition> {
|
|
17
18
|
addChecker<GenericChecker extends readonly [
|
|
18
19
|
DataParserTransformCheckers<Output<this>>,
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { type UnionContain, type IsEqual, type Kind, type Adaptor, type NeverCoalescing, type FixDeepFunctionInfer, type AnyTuple } from "../../common";
|
|
1
|
+
import { type UnionContain, type IsEqual, type Kind, type Adaptor, type NeverCoalescing, type FixDeepFunctionInfer, type AnyTuple, type Or } from "../../common";
|
|
2
2
|
import { type DataParserDefinition, type DataParser, type Output, type Input, type DataParserChecker } from "../base";
|
|
3
3
|
import { type AddCheckersToDefinition, type MergeDefinition } from "../../dataParser/types";
|
|
4
4
|
import { type DataParserCheckerArrayMax, type DataParserCheckerArrayMin } from "./array";
|
|
5
5
|
import { type CheckerRefineImplementation } from "./refine";
|
|
6
6
|
import { type GetPropsWithValueExtends } from "../../object";
|
|
7
7
|
export type TupleShape = readonly [DataParser, ...DataParser[]];
|
|
8
|
-
export type DataParserTupleShapeOutput<GenericShape extends TupleShape, GenericRest extends DataParser | undefined> = IsEqual<GenericShape, TupleShape> extends true ? TupleShape : GenericShape extends [
|
|
8
|
+
export type DataParserTupleShapeOutput<GenericShape extends TupleShape, GenericRest extends DataParser | undefined> = IsEqual<GenericShape, TupleShape> extends true ? TupleShape : GenericShape extends readonly [
|
|
9
9
|
infer InferredFirst extends DataParser,
|
|
10
10
|
...infer InferredRest extends DataParser[]
|
|
11
11
|
] ? [
|
|
12
12
|
Output<InferredFirst>,
|
|
13
|
+
...(Exclude<InferredRest, TupleShape> extends infer InferredShapeRest extends readonly any[] ? IsEqual<InferredShapeRest[number], never> extends true ? [] : Output<InferredShapeRest[number]>[] : []),
|
|
13
14
|
...(InferredRest extends TupleShape ? DataParserTupleShapeOutput<InferredRest, GenericRest> : UnionContain<GenericRest, undefined> extends true ? [] : Output<Adaptor<GenericRest, DataParser>>[])
|
|
14
15
|
] : never;
|
|
15
|
-
export type DataParserTupleShapeInput<GenericShape extends TupleShape, GenericRest extends DataParser | undefined> = IsEqual<GenericShape, TupleShape> extends true ? TupleShape : GenericShape extends [
|
|
16
|
+
export type DataParserTupleShapeInput<GenericShape extends TupleShape, GenericRest extends DataParser | undefined> = IsEqual<GenericShape, TupleShape> extends true ? TupleShape : GenericShape extends readonly [
|
|
16
17
|
infer InferredFirst extends DataParser,
|
|
17
18
|
...infer InferredRest extends DataParser[]
|
|
18
19
|
] ? [
|
|
19
20
|
Input<InferredFirst>,
|
|
20
|
-
...(InferredRest extends
|
|
21
|
+
...(Exclude<InferredRest, TupleShape> extends infer InferredShapeRest extends readonly any[] ? IsEqual<InferredShapeRest[number], never> extends true ? [] : Input<InferredShapeRest[number]>[] : []),
|
|
22
|
+
...(InferredRest extends TupleShape ? DataParserTupleShapeInput<InferredRest, GenericRest> : UnionContain<GenericRest, undefined> extends true ? [] : Input<Adaptor<GenericRest, DataParser>>[])
|
|
21
23
|
] : never;
|
|
22
24
|
export interface DataParserTupleCheckerCustom<GenericInput extends AnyTuple<unknown> = AnyTuple<unknown>> {
|
|
23
25
|
}
|
|
@@ -63,8 +65,12 @@ export interface DataParserTuple<GenericDefinition extends DataParserDefinitionT
|
|
|
63
65
|
* @namespace DP
|
|
64
66
|
*
|
|
65
67
|
*/
|
|
66
|
-
export declare function tuple<GenericShape extends TupleShape, const GenericDefinition extends Partial<Omit<DataParserDefinitionTuple, "shape">> = never>(shape: GenericShape, definition?: GenericDefinition): DataParserTuple<MergeDefinition<DataParserDefinitionTuple, NeverCoalescing<GenericDefinition, {}> & {
|
|
67
|
-
shape: GenericShape;
|
|
68
|
+
export declare function tuple<const GenericShape extends TupleShape, const GenericDefinition extends Partial<Omit<DataParserDefinitionTuple, "shape">> = never>(shape: GenericShape, definition?: GenericDefinition): DataParserTuple<MergeDefinition<DataParserDefinitionTuple, NeverCoalescing<GenericDefinition, {}> & {
|
|
69
|
+
readonly shape: GenericShape;
|
|
70
|
+
readonly rest: Or<[
|
|
71
|
+
IsEqual<GenericDefinition["rest"], unknown>,
|
|
72
|
+
IsEqual<GenericDefinition, never>
|
|
73
|
+
]> extends true ? undefined : GenericDefinition["rest"];
|
|
68
74
|
}>>;
|
|
69
75
|
export declare namespace tuple {
|
|
70
76
|
var overrideHandler: import("../../common").OverrideHandler<DataParserTuple<DataParserDefinitionTuple>>;
|
|
@@ -53,7 +53,7 @@ export interface DataParserUnion<GenericDefinition extends DataParserDefinitionU
|
|
|
53
53
|
*
|
|
54
54
|
*/
|
|
55
55
|
export declare function union<GenericOptions extends UnionOptions, const GenericDefinition extends Partial<Omit<DataParserDefinitionUnion, "options">> = never>(options: GenericOptions, definition?: GenericDefinition): DataParserUnion<MergeDefinition<DataParserDefinitionUnion, NeverCoalescing<GenericDefinition, {}> & {
|
|
56
|
-
options: GenericOptions;
|
|
56
|
+
readonly options: GenericOptions;
|
|
57
57
|
}>>;
|
|
58
58
|
export declare namespace union {
|
|
59
59
|
var overrideHandler: import("../../common").OverrideHandler<DataParserUnion<DataParserDefinitionUnion>>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var create = require('./create.cjs');
|
|
4
4
|
var kind = require('../common/kind.cjs');
|
|
5
|
+
var errorKindNamespace = require('../common/errorKindNamespace.cjs');
|
|
5
6
|
var is = require('../either/left/is.cjs');
|
|
6
7
|
var unwrap = require('../common/unwrap.cjs');
|
|
7
|
-
var errorKindNamespace = require('../common/errorKindNamespace.cjs');
|
|
8
8
|
|
|
9
9
|
class CreateTheDateError extends kind.kindHeritage("create-the-date-error", errorKindNamespace.createErrorKind("create-the-date-error"), Error) {
|
|
10
10
|
input;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { create } from './create.mjs';
|
|
2
2
|
import { kindHeritage } from '../common/kind.mjs';
|
|
3
|
+
import { createErrorKind } from '../common/errorKindNamespace.mjs';
|
|
3
4
|
import { isLeft } from '../either/left/is.mjs';
|
|
4
5
|
import { unwrap } from '../common/unwrap.mjs';
|
|
5
|
-
import { createErrorKind } from '../common/errorKindNamespace.mjs';
|
|
6
6
|
|
|
7
7
|
class CreateTheDateError extends kindHeritage("create-the-date-error", createErrorKind("create-the-date-error"), Error) {
|
|
8
8
|
input;
|
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ var override = require('./common/override.cjs');
|
|
|
56
56
|
var errorKindNamespace = require('./common/errorKindNamespace.cjs');
|
|
57
57
|
var truthy = require('./common/truthy.cjs');
|
|
58
58
|
var falsy = require('./common/falsy.cjs');
|
|
59
|
+
var formData = require('./common/formData.cjs');
|
|
59
60
|
var hasSomeKinds = require('./common/hasSomeKinds.cjs');
|
|
60
61
|
var hasKinds = require('./common/hasKinds.cjs');
|
|
61
62
|
var toCurriedPredicate = require('./common/toCurriedPredicate.cjs');
|
|
@@ -147,6 +148,8 @@ exports.createOverride = override.createOverride;
|
|
|
147
148
|
exports.createErrorKind = errorKindNamespace.createErrorKind;
|
|
148
149
|
exports.truthy = truthy.truthy;
|
|
149
150
|
exports.falsy = falsy.falsy;
|
|
151
|
+
exports.TheFormData = formData.TheFormData;
|
|
152
|
+
exports.createFormData = formData.createFormData;
|
|
150
153
|
exports.hasSomeKinds = hasSomeKinds.hasSomeKinds;
|
|
151
154
|
exports.hasKinds = hasKinds.hasKinds;
|
|
152
155
|
exports.toCurriedPredicate = toCurriedPredicate.toCurriedPredicate;
|
package/dist/index.mjs
CHANGED
|
@@ -78,6 +78,7 @@ export { createOverride } from './common/override.mjs';
|
|
|
78
78
|
export { createErrorKind } from './common/errorKindNamespace.mjs';
|
|
79
79
|
export { truthy } from './common/truthy.mjs';
|
|
80
80
|
export { falsy } from './common/falsy.mjs';
|
|
81
|
+
export { TheFormData, createFormData } from './common/formData.mjs';
|
|
81
82
|
export { hasSomeKinds } from './common/hasSomeKinds.mjs';
|
|
82
83
|
export { hasKinds } from './common/hasKinds.mjs';
|
|
83
84
|
export { toCurriedPredicate } from './common/toCurriedPredicate.mjs';
|
package/dist/metadata.json
CHANGED
|
@@ -43,5 +43,5 @@ type ComputeEntries<GenericEntry extends ObjectEntry> = UnionContain<ObjectKey,
|
|
|
43
43
|
* @namespace O
|
|
44
44
|
*
|
|
45
45
|
*/
|
|
46
|
-
export declare function fromEntries<GenericKey extends ObjectKey, const GenericEntry extends readonly [GenericKey, unknown]>(entries:
|
|
46
|
+
export declare function fromEntries<GenericKey extends ObjectKey, const GenericEntry extends readonly [GenericKey, unknown]>(entries: Iterable<GenericEntry>): ComputeEntries<GenericEntry>;
|
|
47
47
|
export {};
|