@duplojs/utils 1.5.1 → 1.5.2

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.
Files changed (42) hide show
  1. package/dist/array/is.d.ts +1 -1
  2. package/dist/clean/primitive/base.d.ts +1 -1
  3. package/dist/common/formData.cjs +91 -0
  4. package/dist/common/formData.d.ts +11 -0
  5. package/dist/common/formData.mjs +88 -0
  6. package/dist/common/index.d.ts +2 -0
  7. package/dist/common/kind.d.ts +3 -0
  8. package/dist/dataParser/base.d.ts +5 -1
  9. package/dist/dataParser/baseExtended.d.ts +5 -1
  10. package/dist/dataParser/extended/array.d.ts +1 -1
  11. package/dist/dataParser/extended/bigint.d.ts +2 -2
  12. package/dist/dataParser/extended/boolean.d.ts +2 -2
  13. package/dist/dataParser/extended/date.d.ts +2 -3
  14. package/dist/dataParser/extended/empty.d.ts +2 -2
  15. package/dist/dataParser/extended/lazy.d.ts +1 -1
  16. package/dist/dataParser/extended/literal.d.ts +2 -2
  17. package/dist/dataParser/extended/nil.d.ts +2 -2
  18. package/dist/dataParser/extended/nullable.d.ts +2 -2
  19. package/dist/dataParser/extended/number.d.ts +2 -2
  20. package/dist/dataParser/extended/object.d.ts +2 -2
  21. package/dist/dataParser/extended/optional.d.ts +2 -2
  22. package/dist/dataParser/extended/pipe.d.ts +1 -1
  23. package/dist/dataParser/extended/recover.d.ts +1 -1
  24. package/dist/dataParser/extended/string.d.ts +2 -2
  25. package/dist/dataParser/extended/templateLiteral.d.ts +2 -2
  26. package/dist/dataParser/extended/time.d.ts +2 -2
  27. package/dist/dataParser/extended/transform.d.ts +1 -1
  28. package/dist/dataParser/extended/tuple.cjs +4 -0
  29. package/dist/dataParser/extended/tuple.d.ts +96 -2
  30. package/dist/dataParser/extended/tuple.mjs +4 -0
  31. package/dist/dataParser/extended/unknown.d.ts +2 -2
  32. package/dist/dataParser/identifier.d.ts +2 -20
  33. package/dist/dataParser/parsers/array/index.d.ts +1 -1
  34. package/dist/dataParser/parsers/record/index.d.ts +3 -3
  35. package/dist/dataParser/parsers/transform.d.ts +2 -1
  36. package/dist/dataParser/parsers/tuple.d.ts +12 -6
  37. package/dist/dataParser/parsers/union.d.ts +1 -1
  38. package/dist/index.cjs +3 -0
  39. package/dist/index.mjs +1 -0
  40. package/dist/metadata.json +9 -0
  41. package/dist/object/fromEntries.d.ts +1 -1
  42. package/package.json +1 -1
@@ -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 extends any[] ? GenericValue : never;
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, DDate.TheDate | `date${number}-` | `date${number}+` | globalThis.Date>;
242
+ export declare const Date: PrimitiveHandler<DDate.TheDate, DDate.TheDate | globalThis.Date | `date${number}-` | `date${number}+`>;
243
243
  export type Date = ReturnType<typeof Date["createWithUnknownOrThrow"]>;
244
244
  /**
245
245
  * Business primitive for duration values (`TheTime`).
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ var escapeRegExp = require('./escapeRegExp.cjs');
4
+
5
+ const separator = "/*\\";
6
+ const firstElementInPathRegex = new RegExp(`^((?:(?!${escapeRegExp.escapeRegExp(separator)}).)*)(?:${escapeRegExp.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 File) {
21
+ yield [path ?? "", value];
22
+ }
23
+ else if (value === undefined) {
24
+ return;
25
+ }
26
+ else if (value instanceof Array) {
27
+ for (let index = 0; index < value.length; index++) {
28
+ const entriesIterator = this.toFlatEntries(value[index], path === undefined
29
+ ? `[${index}]`
30
+ : `${path}${separator}[${index}]`);
31
+ for (const entry of entriesIterator) {
32
+ yield entry;
33
+ }
34
+ }
35
+ }
36
+ else {
37
+ for (const key in value) {
38
+ const entriesIterator = this.toFlatEntries(value[key], path === undefined
39
+ ? key
40
+ : `${path}${separator}${key}`);
41
+ for (const entry of entriesIterator) {
42
+ yield entry;
43
+ }
44
+ }
45
+ }
46
+ }
47
+ static fromEntries(iterable, arrayMaxIndex) {
48
+ const constructObject = (object, path, value) => {
49
+ const firstElement = path.match(firstElementInPathRegex)[1];
50
+ const index = firstElement.match(getIndexRegex)?.[1];
51
+ if (index && Number(index) > arrayMaxIndex) {
52
+ return object;
53
+ }
54
+ let currentObject = object;
55
+ if (currentObject === undefined) {
56
+ if (index !== undefined) {
57
+ currentObject = [];
58
+ }
59
+ else {
60
+ currentObject = {};
61
+ }
62
+ }
63
+ if (firstElement === path) {
64
+ currentObject[(index ?? firstElement)] = value;
65
+ return currentObject;
66
+ }
67
+ currentObject[(index ?? firstElement)] = constructObject(currentObject[(index ?? firstElement)], path.replace(firstElementInPathRegex, ""), value);
68
+ return currentObject;
69
+ };
70
+ let result = undefined;
71
+ for (const entry of iterable) {
72
+ if (invalidEntryRegex.test(entry[0])) {
73
+ continue;
74
+ }
75
+ result = constructObject(result, entry[0], entry[1]);
76
+ }
77
+ return result ?? {};
78
+ }
79
+ /**
80
+ * @internal
81
+ */
82
+ static "new"(inputValues) {
83
+ return new TheFormData(inputValues);
84
+ }
85
+ }
86
+ function createFormData(inputValues) {
87
+ return TheFormData.new(inputValues);
88
+ }
89
+
90
+ exports.TheFormData = TheFormData;
91
+ exports.createFormData = createFormData;
@@ -0,0 +1,11 @@
1
+ type EligibleFormDataValue = (string | File | undefined | {
2
+ [key: string]: EligibleFormDataValue;
3
+ } | EligibleFormDataValue[]);
4
+ export declare class TheFormData<GenericValues extends Record<string, EligibleFormDataValue>> extends FormData {
5
+ readonly inputValues: GenericValues;
6
+ private constructor();
7
+ static toFlatEntries(value: EligibleFormDataValue, path?: string): Iterable<[string, string | File]>;
8
+ static fromEntries(iterable: Iterable<[string, unknown]>, arrayMaxIndex: number): object;
9
+ }
10
+ export declare function createFormData<GenericValues extends Record<string, EligibleFormDataValue>>(inputValues: GenericValues): TheFormData<GenericValues>;
11
+ export {};
@@ -0,0 +1,88 @@
1
+ import { escapeRegExp } from './escapeRegExp.mjs';
2
+
3
+ const separator = "/*\\";
4
+ const firstElementInPathRegex = new RegExp(`^((?:(?!${escapeRegExp(separator)}).)*)(?:${escapeRegExp(separator)})?`);
5
+ const getIndexRegex = /^\[(\d+)\]$/;
6
+ const invalidEntryRegex = /__proto__|constructor|prototype/;
7
+ class TheFormData extends FormData {
8
+ inputValues;
9
+ constructor(inputValues) {
10
+ super();
11
+ this.inputValues = inputValues;
12
+ for (const entry of TheFormData.toFlatEntries(inputValues)) {
13
+ this.append(entry[0], entry[1]);
14
+ }
15
+ }
16
+ static *toFlatEntries(value, path) {
17
+ if (typeof value === "string"
18
+ || value instanceof File) {
19
+ yield [path ?? "", value];
20
+ }
21
+ else if (value === undefined) {
22
+ return;
23
+ }
24
+ else if (value instanceof Array) {
25
+ for (let index = 0; index < value.length; index++) {
26
+ const entriesIterator = this.toFlatEntries(value[index], path === undefined
27
+ ? `[${index}]`
28
+ : `${path}${separator}[${index}]`);
29
+ for (const entry of entriesIterator) {
30
+ yield entry;
31
+ }
32
+ }
33
+ }
34
+ else {
35
+ for (const key in value) {
36
+ const entriesIterator = this.toFlatEntries(value[key], path === undefined
37
+ ? key
38
+ : `${path}${separator}${key}`);
39
+ for (const entry of entriesIterator) {
40
+ yield entry;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ static fromEntries(iterable, arrayMaxIndex) {
46
+ const constructObject = (object, path, value) => {
47
+ const firstElement = path.match(firstElementInPathRegex)[1];
48
+ const index = firstElement.match(getIndexRegex)?.[1];
49
+ if (index && Number(index) > arrayMaxIndex) {
50
+ return object;
51
+ }
52
+ let currentObject = object;
53
+ if (currentObject === undefined) {
54
+ if (index !== undefined) {
55
+ currentObject = [];
56
+ }
57
+ else {
58
+ currentObject = {};
59
+ }
60
+ }
61
+ if (firstElement === path) {
62
+ currentObject[(index ?? firstElement)] = value;
63
+ return currentObject;
64
+ }
65
+ currentObject[(index ?? firstElement)] = constructObject(currentObject[(index ?? firstElement)], path.replace(firstElementInPathRegex, ""), value);
66
+ return currentObject;
67
+ };
68
+ let result = undefined;
69
+ for (const entry of iterable) {
70
+ if (invalidEntryRegex.test(entry[0])) {
71
+ continue;
72
+ }
73
+ result = constructObject(result, entry[0], entry[1]);
74
+ }
75
+ return result ?? {};
76
+ }
77
+ /**
78
+ * @internal
79
+ */
80
+ static "new"(inputValues) {
81
+ return new TheFormData(inputValues);
82
+ }
83
+ }
84
+ function createFormData(inputValues) {
85
+ return TheFormData.new(inputValues);
86
+ }
87
+
88
+ export { TheFormData, createFormData };
@@ -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";
@@ -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["element"]>[], Input<GenericDefinition["element"]>[]>);
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, bigint, bigint>);
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, boolean, boolean>);
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
- import { type TheDate } from "../../date";
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, undefined, undefined>);
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["getter"]["value"]>, Input<GenericDefinition["getter"]["value"]>>);
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["value"][number], GenericDefinition["value"][number]>);
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, null, null>);
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 IsEqual, type Kind, type NeverCoalescing, type SimplifyTopLevel } from "../../common";
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, IsEqual<GenericDefinition["coalescingValue"], unknown> extends true ? Output<GenericDefinition["inner"]> | null : Output<GenericDefinition["inner"]>, Input<GenericDefinition["inner"]> | null>);
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, number, number>);
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.DataParserObjectShapeOutput<GenericDefinition["shape"]>, dataParsers.DataParserObjectShapeInput<GenericDefinition["shape"]>>);
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 IsEqual, type Kind, type NeverCoalescing, type SimplifyTopLevel } from "../../common";
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, IsEqual<GenericDefinition["coalescingValue"], unknown> extends true ? Output<GenericDefinition["inner"]> | undefined : Output<GenericDefinition["inner"]>, Input<GenericDefinition["inner"]> | undefined>);
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["output"]>, Input<GenericDefinition["input"]>>);
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["recoveredValue"], Input<GenericDefinition["inner"]>>);
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, string, string>);
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.TemplateLiteralShapeOutput<GenericDefinition["template"]>, dataParsers.TemplateLiteralShapeInput<GenericDefinition["template"]>>);
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, TheTime, TheTime>);
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["inner"]>>);
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, unknown, unknown>);
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: import("../date").TheDate | `date${number}-` | `date${number}+` | Date;
45
+ input: import("../date").TheDate | Date | `date${number}-` | `date${number}+`;
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: import("../date").TheDate | `date${number}-` | `date${number}+` | Date;
94
+ input: import("../date").TheDate | Date | `date${number}-` | `date${number}+`;
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"]> extends infer InferredOutput extends Record<string, unknown> ? TemplateLiteralContainLargeType<Adaptor<keyof InferredOutput, string>> extends true ? Partial<InferredOutput> : InferredOutput : never, DataParserRecordShapeInput<GenericDefinition["key"], GenericDefinition["value"]> extends infer InferredInput extends Record<string, unknown> ? TemplateLiteralContainLargeType<Adaptor<keyof InferredInput, string>> extends true ? Partial<InferredInput> : InferredInput : never> & Kind<typeof recordKind.definition>);
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 _DataParserTransform<GenericDefinition extends DataParserDefinitionTransform> = (DataParser<GenericDefinition, Exclude<Awaited<ReturnType<GenericDefinition["theFunction"]>>, SymbolDataParserError | SymbolDataParserErrorIssue | SymbolDataParserErrorPromiseIssue>, Input<GenericDefinition["inner"]>> & Kind<typeof transformKind.definition>);
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 TupleShape ? DataParserTupleShapeOutput<InferredRest, GenericRest> : UnionContain<GenericRest, undefined> extends true ? [] : Input<Adaptor<GenericRest, DataParser>>[])
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>>;
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';
@@ -1322,6 +1322,15 @@
1322
1322
  {
1323
1323
  "name": "falsy.mjs"
1324
1324
  },
1325
+ {
1326
+ "name": "formData.cjs"
1327
+ },
1328
+ {
1329
+ "name": "formData.d.ts"
1330
+ },
1331
+ {
1332
+ "name": "formData.mjs"
1333
+ },
1325
1334
  {
1326
1335
  "name": "forward.cjs"
1327
1336
  },
@@ -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: readonly GenericEntry[]): ComputeEntries<GenericEntry>;
46
+ export declare function fromEntries<GenericKey extends ObjectKey, const GenericEntry extends readonly [GenericKey, unknown]>(entries: Iterable<GenericEntry>): ComputeEntries<GenericEntry>;
47
47
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duplojs/utils",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "author": {
5
5
  "name": "mathcovax",
6
6
  "url": "https://github.com/mathcovax"