@duplojs/utils 1.4.44 → 1.4.46
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/clean/constraint/base.d.ts +5 -5
- package/dist/clean/constraint/defaultConstraint/number.d.ts +3 -3
- package/dist/clean/constraint/defaultConstraint/string.d.ts +2 -2
- package/dist/clean/entity.d.ts +2 -2
- package/dist/clean/flag.d.ts +1 -1
- package/dist/clean/newType.d.ts +5 -5
- package/dist/clean/primitive/base.d.ts +10 -10
- package/dist/clean/repository.d.ts +1 -1
- package/dist/clean/useCase.d.ts +1 -1
- package/dist/common/hasKinds.d.ts +3 -3
- package/dist/common/hasSomeKinds.d.ts +3 -3
- package/dist/common/path/resolveFrom.d.ts +1 -1
- package/dist/dataParser/base.d.ts +2 -2
- package/dist/dataParser/baseExtended.d.ts +2 -2
- package/dist/dataParser/extended/empty.d.ts +1 -1
- package/dist/dataParser/extended/nullable.d.ts +1 -1
- package/dist/dataParser/extended/optional.d.ts +1 -1
- package/dist/dataParser/extended/recover.d.ts +1 -1
- package/dist/dataParser/parsers/array/index.d.ts +1 -1
- package/dist/dataParser/parsers/empty.d.ts +1 -1
- package/dist/dataParser/parsers/lazy.d.ts +1 -1
- package/dist/dataParser/parsers/literal.d.ts +1 -1
- package/dist/dataParser/parsers/nullable.d.ts +2 -2
- package/dist/dataParser/parsers/object/index.d.ts +3 -3
- package/dist/dataParser/parsers/optional.d.ts +3 -3
- package/dist/dataParser/parsers/pipe.d.ts +1 -1
- package/dist/dataParser/parsers/record/index.d.ts +1 -1
- package/dist/dataParser/parsers/recover.d.ts +3 -3
- package/dist/dataParser/parsers/templateLiteral/index.d.ts +1 -1
- package/dist/dataParser/parsers/transform.d.ts +1 -1
- package/dist/dataParser/parsers/tuple.d.ts +1 -1
- package/dist/dataParser/parsers/union.d.ts +1 -1
- package/dist/date/create.d.ts +1 -1
- package/dist/date/createTime.d.ts +1 -1
- package/dist/either/bool/base.cjs +6 -1
- package/dist/either/bool/base.d.ts +4 -0
- package/dist/either/bool/base.mjs +6 -2
- package/dist/either/bool/create.d.ts +6 -6
- package/dist/either/bool/falsy.cjs +9 -4
- package/dist/either/bool/falsy.d.ts +23 -15
- package/dist/either/bool/falsy.mjs +10 -6
- package/dist/either/bool/truthy.cjs +9 -4
- package/dist/either/bool/truthy.d.ts +23 -15
- package/dist/either/bool/truthy.mjs +10 -6
- package/dist/either/future/base.cjs +6 -1
- package/dist/either/future/base.d.ts +4 -0
- package/dist/either/future/base.mjs +6 -2
- package/dist/either/future/create.d.ts +8 -8
- package/dist/either/future/error.cjs +7 -2
- package/dist/either/future/error.d.ts +15 -7
- package/dist/either/future/error.mjs +8 -4
- package/dist/either/future/success.cjs +7 -2
- package/dist/either/future/success.d.ts +15 -7
- package/dist/either/future/success.mjs +8 -4
- package/dist/either/hasInformation.cjs +2 -2
- package/dist/either/hasInformation.d.ts +8 -8
- package/dist/either/hasInformation.mjs +3 -3
- package/dist/either/index.cjs +24 -0
- package/dist/either/index.mjs +23 -23
- package/dist/either/kind.cjs +6 -1
- package/dist/either/kind.d.ts +4 -0
- package/dist/either/kind.mjs +6 -2
- package/dist/either/left/create.cjs +7 -2
- package/dist/either/left/create.d.ts +14 -6
- package/dist/either/left/create.mjs +8 -4
- package/dist/either/left/error.cjs +7 -2
- package/dist/either/left/error.d.ts +14 -6
- package/dist/either/left/error.mjs +7 -3
- package/dist/either/left/fail.cjs +7 -2
- package/dist/either/left/fail.d.ts +14 -6
- package/dist/either/left/fail.mjs +7 -3
- package/dist/either/left/is.cjs +2 -2
- package/dist/either/left/is.d.ts +4 -4
- package/dist/either/left/is.mjs +4 -4
- package/dist/either/left/when.d.ts +4 -4
- package/dist/either/nullable/base.cjs +6 -1
- package/dist/either/nullable/base.d.ts +4 -0
- package/dist/either/nullable/base.mjs +6 -2
- package/dist/either/nullable/create.d.ts +5 -5
- package/dist/either/nullable/empty.cjs +9 -4
- package/dist/either/nullable/empty.d.ts +23 -15
- package/dist/either/nullable/empty.mjs +10 -6
- package/dist/either/nullable/filled.cjs +9 -4
- package/dist/either/nullable/filled.d.ts +22 -14
- package/dist/either/nullable/filled.mjs +10 -6
- package/dist/either/nullish/base.cjs +6 -1
- package/dist/either/nullish/base.d.ts +4 -0
- package/dist/either/nullish/base.mjs +6 -2
- package/dist/either/nullish/create.d.ts +5 -5
- package/dist/either/nullish/empty.cjs +9 -4
- package/dist/either/nullish/empty.d.ts +23 -15
- package/dist/either/nullish/empty.mjs +10 -6
- package/dist/either/nullish/filled.cjs +9 -4
- package/dist/either/nullish/filled.d.ts +23 -15
- package/dist/either/nullish/filled.mjs +10 -6
- package/dist/either/optional/base.cjs +6 -1
- package/dist/either/optional/base.d.ts +4 -0
- package/dist/either/optional/base.mjs +6 -2
- package/dist/either/optional/create.d.ts +5 -5
- package/dist/either/optional/empty.cjs +9 -4
- package/dist/either/optional/empty.d.ts +23 -15
- package/dist/either/optional/empty.mjs +10 -6
- package/dist/either/optional/filled.cjs +9 -4
- package/dist/either/optional/filled.d.ts +22 -14
- package/dist/either/optional/filled.mjs +10 -6
- package/dist/either/right/asyncGroup.d.ts +7 -7
- package/dist/either/right/asyncPipe.d.ts +33 -25
- package/dist/either/right/create.cjs +7 -2
- package/dist/either/right/create.d.ts +15 -7
- package/dist/either/right/create.mjs +8 -4
- package/dist/either/right/group.d.ts +8 -8
- package/dist/either/right/is.cjs +2 -2
- package/dist/either/right/is.d.ts +4 -4
- package/dist/either/right/is.mjs +4 -4
- package/dist/either/right/ok.cjs +7 -2
- package/dist/either/right/ok.d.ts +14 -6
- package/dist/either/right/ok.mjs +7 -3
- package/dist/either/right/pipe.d.ts +32 -24
- package/dist/either/right/success.cjs +7 -2
- package/dist/either/right/success.d.ts +14 -6
- package/dist/either/right/success.mjs +7 -3
- package/dist/either/right/when.d.ts +4 -4
- package/dist/either/safeCallback.cjs +14 -4
- package/dist/either/safeCallback.d.ts +33 -17
- package/dist/either/safeCallback.mjs +13 -5
- package/dist/either/whenHasInformation.cjs +1 -1
- package/dist/either/whenHasInformation.d.ts +7 -7
- package/dist/either/whenHasInformation.mjs +2 -2
- package/dist/string/isIn.d.ts +2 -2
- package/dist/string/slice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -30,13 +30,13 @@ export interface ConstraintHandler<GenericName extends string = string, GenericP
|
|
|
30
30
|
* const result = Between1And10.create(5);
|
|
31
31
|
*
|
|
32
32
|
* if (E.isRight(result)) {
|
|
33
|
-
* // result : E.
|
|
33
|
+
* // result : E.Right<"createConstrainedType", C.ConstrainedType<"between-1-10", 5>>
|
|
34
34
|
* }
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
*/
|
|
38
|
-
create<GenericData extends GenericPrimitiveValue>(data: GenericData): (DEither.
|
|
39
|
-
create<GenericPrimitive extends Primitive<GenericPrimitiveValue>>(data: GenericPrimitive): (DEither.
|
|
38
|
+
create<GenericData extends GenericPrimitiveValue>(data: GenericData): (DEither.Right<"createConstrainedType", ConstrainedType<GenericName, GenericData>> | DEither.Left<"createConstrainedTypeError", DDataParser.DataParserError>);
|
|
39
|
+
create<GenericPrimitive extends Primitive<GenericPrimitiveValue>>(data: GenericPrimitive): (DEither.Right<"createConstrainedType", (GenericPrimitive & ConstrainedType<GenericName, Unwrap<GenericPrimitive>>)> | DEither.Left<"createConstrainedTypeError", DDataParser.DataParserError>);
|
|
40
40
|
/**
|
|
41
41
|
* Creates a constrained value and throws on error.
|
|
42
42
|
*
|
|
@@ -57,7 +57,7 @@ export interface ConstraintHandler<GenericName extends string = string, GenericP
|
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
59
59
|
*/
|
|
60
|
-
createWithUnknown<GenericData extends unknown>(data: GenericData): (DEither.
|
|
60
|
+
createWithUnknown<GenericData extends unknown>(data: GenericData): (DEither.Right<"createConstrainedType", ConstrainedType<GenericName, GenericPrimitiveValue>> | DEither.Left<"createConstrainedTypeError", DDataParser.DataParserError>);
|
|
61
61
|
/**
|
|
62
62
|
* Creates a constrained value from an unknown input and throws on error.
|
|
63
63
|
*
|
|
@@ -107,7 +107,7 @@ export declare class CreateConstrainedTypeError extends CreateConstrainedTypeErr
|
|
|
107
107
|
* const result = Between1And10.create(5);
|
|
108
108
|
*
|
|
109
109
|
* if (E.isRight(result)) {
|
|
110
|
-
* // result : E.
|
|
110
|
+
* // result : E.Right<"createConstrainedType", C.ConstrainedType<"between-1-10", 5>>
|
|
111
111
|
* }
|
|
112
112
|
*
|
|
113
113
|
* const value = Between1And10.createOrThrow(7);
|
|
@@ -12,7 +12,7 @@ import * as DDataParser from "../../../dataParser";
|
|
|
12
12
|
* const result = C.Int.create(12);
|
|
13
13
|
*
|
|
14
14
|
* if (E.isRight(result)) {
|
|
15
|
-
* // result: E.
|
|
15
|
+
* // result: E.Right<"createConstrainedType", C.ConstrainedType<"int", 12>>
|
|
16
16
|
* }
|
|
17
17
|
*
|
|
18
18
|
* const value = C.Int.createOrThrow(7);
|
|
@@ -41,7 +41,7 @@ export type Int = GetConstraint<typeof Int>;
|
|
|
41
41
|
* const result = C.Positive.create(4);
|
|
42
42
|
*
|
|
43
43
|
* if (E.isRight(result)) {
|
|
44
|
-
* // result: E.
|
|
44
|
+
* // result: E.Right<"createConstrainedType", C.ConstrainedType<"positive", 4>>
|
|
45
45
|
* }
|
|
46
46
|
*
|
|
47
47
|
* const value = C.Positive.createOrThrow(10);
|
|
@@ -70,7 +70,7 @@ export type Positive = GetConstraint<typeof Positive>;
|
|
|
70
70
|
* const result = C.Negative.create(-4);
|
|
71
71
|
*
|
|
72
72
|
* if (E.isRight(result)) {
|
|
73
|
-
* // result: E.
|
|
73
|
+
* // result: E.Right<"createConstrainedType", C.ConstrainedType<"negative", -4>>
|
|
74
74
|
* }
|
|
75
75
|
*
|
|
76
76
|
* const value = C.Negative.createOrThrow(-10);
|
|
@@ -12,7 +12,7 @@ import * as DDataParser from "../../../dataParser";
|
|
|
12
12
|
* const result = C.Email.create("hello@duplojs.dev");
|
|
13
13
|
*
|
|
14
14
|
* if (E.isRight(result)) {
|
|
15
|
-
* // result: E.
|
|
15
|
+
* // result: E.Right<"createConstrainedType", C.ConstrainedType<"email", "hello@duplojs.dev">>
|
|
16
16
|
* }
|
|
17
17
|
*
|
|
18
18
|
* const email = C.Email.createOrThrow("a@b.com");
|
|
@@ -41,7 +41,7 @@ export type Email = GetConstraint<typeof Email>;
|
|
|
41
41
|
* const result = C.Url.create("https://duplojs.dev");
|
|
42
42
|
*
|
|
43
43
|
* if (E.isRight(result)) {
|
|
44
|
-
* // result: E.
|
|
44
|
+
* // result: E.Right<"createConstrainedType", C.ConstrainedType<"url", "https://duplojs.dev">>
|
|
45
45
|
* }
|
|
46
46
|
*
|
|
47
47
|
* const url = C.Url.createOrThrow("https://example.com");
|
package/dist/clean/entity.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ export interface EntityHandler<GenericName extends string = string, GenericPrope
|
|
|
85
85
|
* ```
|
|
86
86
|
*
|
|
87
87
|
*/
|
|
88
|
-
map(rawProperties: EntityRawProperties<GenericPropertiesDefinition>): (DEither.
|
|
88
|
+
map(rawProperties: EntityRawProperties<GenericPropertiesDefinition>): (DEither.Right<"createEntity", Entity<GenericName> & EntityProperties<GenericPropertiesDefinition>> | DEither.Left<"createEntityError", DDataParser.DataParserError>);
|
|
89
89
|
/**
|
|
90
90
|
* Validates raw properties and throws on error.
|
|
91
91
|
*
|
|
@@ -209,7 +209,7 @@ export interface PropertiesDefinitionParams {
|
|
|
209
209
|
* });
|
|
210
210
|
*
|
|
211
211
|
* if (E.isRight(mappedResult)) {
|
|
212
|
-
* // mappedResult: E.
|
|
212
|
+
* // mappedResult: E.Right<"createEntity", C.Entity<"User">>
|
|
213
213
|
* }
|
|
214
214
|
*
|
|
215
215
|
* ```
|
package/dist/clean/flag.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export interface Flag<GenericName extends string = string, GenericValue extends
|
|
|
91
91
|
* drinkAlcohol,
|
|
92
92
|
* ),
|
|
93
93
|
* );
|
|
94
|
-
* // E.
|
|
94
|
+
* // E.Left<"not-major", undefined> | E.Right<"not-thirsty-anymore", undefined>
|
|
95
95
|
*
|
|
96
96
|
* const flagged = User.MajorFlag.append(user, user.age);
|
|
97
97
|
* const value = User.MajorFlag.getValue(flagged);
|
package/dist/clean/newType.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ export interface NewTypeHandler<GenericName extends string = string, GenericValu
|
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
36
|
*/
|
|
37
|
-
create<const GenericData extends GenericValue>(data: GenericData): (DEither.
|
|
38
|
-
create<GenericPrimitive extends Primitive<Extract<GenericValue, EligiblePrimitive>>>(data: GenericPrimitive): (DEither.
|
|
37
|
+
create<const GenericData extends GenericValue>(data: GenericData): (DEither.Right<"createNewType", NewType<GenericName, GenericData, GenericConstrainHandler[number]["name"]>> | DEither.Left<"createNewTypeError", DDataParser.DataParserError>);
|
|
38
|
+
create<GenericPrimitive extends Primitive<Extract<GenericValue, EligiblePrimitive>>>(data: GenericPrimitive): (DEither.Right<"createNewType", (GenericPrimitive & NewType<GenericName, Unwrap<GenericPrimitive>, GenericConstrainHandler[number]["name"]>)> | DEither.Left<"createNewTypeError", DDataParser.DataParserError>);
|
|
39
39
|
/**
|
|
40
40
|
* Creates a NewType value and throws on error. Works with raw values or primitives.
|
|
41
41
|
*
|
|
@@ -60,12 +60,12 @@ export interface NewTypeHandler<GenericName extends string = string, GenericValu
|
|
|
60
60
|
* const maybe = UserId.createWithUnknown(unknownValue);
|
|
61
61
|
*
|
|
62
62
|
* if (E.isRight(maybe)) {
|
|
63
|
-
* // maybe: E.
|
|
63
|
+
* // maybe: E.Right<"createNewType", UserId>
|
|
64
64
|
* }
|
|
65
65
|
* ```
|
|
66
66
|
*
|
|
67
67
|
*/
|
|
68
|
-
createWithUnknown<GenericData extends unknown>(data: GenericData): (DEither.
|
|
68
|
+
createWithUnknown<GenericData extends unknown>(data: GenericData): (DEither.Right<"createNewType", NewType<GenericName, GenericValue, GenericConstrainHandler[number]["name"]>> | DEither.Left<"createNewTypeError", DDataParser.DataParserError>);
|
|
69
69
|
/**
|
|
70
70
|
* Creates a NewType value from an unknown input and throws on error.
|
|
71
71
|
*
|
|
@@ -125,7 +125,7 @@ export declare class CreateNewTypeError extends CreateNewTypeError_base {
|
|
|
125
125
|
* const maybe = UserId.createWithUnknown(unknownValue);
|
|
126
126
|
*
|
|
127
127
|
* if (E.isRight(maybe)) {
|
|
128
|
-
* // maybe: E.
|
|
128
|
+
* // maybe: E.Right<"createNewType", UserId>
|
|
129
129
|
* }
|
|
130
130
|
*
|
|
131
131
|
* const strictValue = UserId.createWithUnknownOrThrow(unknownValue);
|
|
@@ -14,12 +14,12 @@ export interface PrimitiveHandler<GenericValue extends EligiblePrimitive = Eligi
|
|
|
14
14
|
* const result = C.String.create("hello");
|
|
15
15
|
*
|
|
16
16
|
* if (E.isRight(result)) {
|
|
17
|
-
* // result: E.
|
|
17
|
+
* // result: E.Right<"createNewType", C.Primitive<"hello">>
|
|
18
18
|
* }
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
-
create<GenericData extends GenericValue>(data: GenericData): (DEither.
|
|
22
|
+
create<GenericData extends GenericValue>(data: GenericData): (DEither.Right<"createNewType", Primitive<GenericData>> | DEither.Left<"createNewTypeError", DDataParser.DataParserError>);
|
|
23
23
|
/**
|
|
24
24
|
* Creates a primitive value and throws on error.
|
|
25
25
|
*
|
|
@@ -36,11 +36,11 @@ export interface PrimitiveHandler<GenericValue extends EligiblePrimitive = Eligi
|
|
|
36
36
|
* ```ts
|
|
37
37
|
* const unknownValue: unknown = "world";
|
|
38
38
|
* const maybe = C.String.createWithUnknown(unknownValue);
|
|
39
|
-
* // E.
|
|
39
|
+
* // E.Left<"createNewTypeError", DataParserError> | E.Right<"createNewType", C.Primitive<string>>
|
|
40
40
|
* ```
|
|
41
41
|
*
|
|
42
42
|
*/
|
|
43
|
-
createWithUnknown<GenericData extends unknown>(data: GenericData): (DEither.
|
|
43
|
+
createWithUnknown<GenericData extends unknown>(data: GenericData): (DEither.Right<"createNewType", Primitive<GenericValue>> | DEither.Left<"createNewTypeError", DDataParser.DataParserError>);
|
|
44
44
|
/**
|
|
45
45
|
* Creates a primitive value from an unknown input and throws on error.
|
|
46
46
|
*
|
|
@@ -89,7 +89,7 @@ export declare class CreatePrimitiveError extends CreatePrimitiveError_base {
|
|
|
89
89
|
* const result = C.String.create("hello");
|
|
90
90
|
*
|
|
91
91
|
* if (E.isRight(result)) {
|
|
92
|
-
* // result: E.
|
|
92
|
+
* // result: E.Right<"createNewType", C.Primitive<"hello">>
|
|
93
93
|
* }
|
|
94
94
|
*
|
|
95
95
|
* const value = C.String.createOrThrow("world");
|
|
@@ -122,7 +122,7 @@ export type String = ReturnType<typeof String["createWithUnknownOrThrow"]>;
|
|
|
122
122
|
* const result = C.Number.create(42);
|
|
123
123
|
*
|
|
124
124
|
* if (E.isRight(result)) {
|
|
125
|
-
* // result: E.
|
|
125
|
+
* // result: E.Right<"createNewType", C.Primitive<42>>
|
|
126
126
|
* }
|
|
127
127
|
*
|
|
128
128
|
* const value = C.Number.createOrThrow(7);
|
|
@@ -155,7 +155,7 @@ export type Number = ReturnType<typeof Number["createWithUnknownOrThrow"]>;
|
|
|
155
155
|
* const result = C.BigInt.create(10n);
|
|
156
156
|
*
|
|
157
157
|
* if (E.isRight(result)) {
|
|
158
|
-
* // result: E.
|
|
158
|
+
* // result: E.Right<"createNewType", C.Primitive<10n>>
|
|
159
159
|
* }
|
|
160
160
|
*
|
|
161
161
|
* const value = C.BigInt.createOrThrow(99n);
|
|
@@ -188,7 +188,7 @@ export type BigInt = ReturnType<typeof BigInt["createWithUnknownOrThrow"]>;
|
|
|
188
188
|
* const result = C.Boolean.create(true);
|
|
189
189
|
*
|
|
190
190
|
* if (E.isRight(result)) {
|
|
191
|
-
* // result: E.
|
|
191
|
+
* // result: E.Right<"createNewType", C.Primitive<true>>
|
|
192
192
|
* }
|
|
193
193
|
*
|
|
194
194
|
* const value = C.Boolean.createOrThrow(false);
|
|
@@ -223,7 +223,7 @@ export type Boolean = ReturnType<typeof Boolean["createWithUnknownOrThrow"]>;
|
|
|
223
223
|
* const result = C.Date.create(date);
|
|
224
224
|
*
|
|
225
225
|
* if (E.isRight(result)) {
|
|
226
|
-
* // result: E.
|
|
226
|
+
* // result: E.Right<"createNewType", C.Primitive<D.TheDate>>
|
|
227
227
|
* }
|
|
228
228
|
*
|
|
229
229
|
* const value = C.Date.createOrThrow(date);
|
|
@@ -258,7 +258,7 @@ export type Date = ReturnType<typeof Date["createWithUnknownOrThrow"]>;
|
|
|
258
258
|
* const result = C.Time.create(theTime);
|
|
259
259
|
*
|
|
260
260
|
* if (E.isRight(result)) {
|
|
261
|
-
* // result: E.
|
|
261
|
+
* // result: E.Right<"createNewType", C.Primitive<D.TheTime>>
|
|
262
262
|
* }
|
|
263
263
|
*
|
|
264
264
|
* const value = C.Time.createOrThrow(theTime);
|
|
@@ -55,7 +55,7 @@ export interface RepositoryHandler<GenericRepository extends object = object> ex
|
|
|
55
55
|
*
|
|
56
56
|
* // Application Layer
|
|
57
57
|
* interface UserRepository {
|
|
58
|
-
* findById(id: User.Id): Promise<E.
|
|
58
|
+
* findById(id: User.Id): Promise<E.Success<User.Entity> | E.Fail>;
|
|
59
59
|
* }
|
|
60
60
|
*
|
|
61
61
|
* const UserRepository = C.createRepository<UserRepository>();
|
package/dist/clean/useCase.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface UseCaseHandler<GenericDependencies extends UseCaseDependencies
|
|
|
60
60
|
*
|
|
61
61
|
* // Application Layer
|
|
62
62
|
* interface UserRepository {
|
|
63
|
-
* findById(id: User.Id): Promise<E.
|
|
63
|
+
* findById(id: User.Id): Promise<E.Success<User.Entity> | E.Fail>;
|
|
64
64
|
* }
|
|
65
65
|
*
|
|
66
66
|
* const UserRepository = C.createRepository<UserRepository>();
|
|
@@ -12,13 +12,13 @@ import { type AnyTuple, type UnionToIntersection } from "./types";
|
|
|
12
12
|
* Predicate overloads (type guards) narrow the output type.
|
|
13
13
|
*
|
|
14
14
|
* ```ts
|
|
15
|
-
* const input = E.ok() as E.
|
|
15
|
+
* const input = E.ok() as E.Ok | E.Error;
|
|
16
16
|
*
|
|
17
17
|
* if (hasKinds(input, [
|
|
18
18
|
* E.eitherOkKind,
|
|
19
19
|
* E.eitherRightKind,
|
|
20
20
|
* ])) {
|
|
21
|
-
* // type: E.
|
|
21
|
+
* // type: E.Ok
|
|
22
22
|
* }
|
|
23
23
|
*
|
|
24
24
|
* const result = pipe(
|
|
@@ -31,7 +31,7 @@ import { type AnyTuple, type UnionToIntersection } from "./types";
|
|
|
31
31
|
* () => "ok",
|
|
32
32
|
* ),
|
|
33
33
|
* );
|
|
34
|
-
* // result: "ok" | E.
|
|
34
|
+
* // result: "ok" | E.Error<unknown>
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
* @see https://utils.duplojs.dev/en/v1/api/common/hasKinds
|
|
@@ -12,13 +12,13 @@ import { type AnyTuple } from "./types";
|
|
|
12
12
|
* Predicate overloads (type guards) narrow the output type.
|
|
13
13
|
*
|
|
14
14
|
* ```ts
|
|
15
|
-
* const input = E.ok() as E.
|
|
15
|
+
* const input = E.ok() as E.Ok | E.Error;
|
|
16
16
|
*
|
|
17
17
|
* if (hasSomeKinds(input, [
|
|
18
18
|
* E.eitherOkKind,
|
|
19
19
|
* E.eitherErrorKind,
|
|
20
20
|
* ])) {
|
|
21
|
-
* // type: E.
|
|
21
|
+
* // type: E.Ok | E.Error
|
|
22
22
|
* }
|
|
23
23
|
*
|
|
24
24
|
* const result = pipe(
|
|
@@ -31,7 +31,7 @@ import { type AnyTuple } from "./types";
|
|
|
31
31
|
* () => "known",
|
|
32
32
|
* ),
|
|
33
33
|
* );
|
|
34
|
-
* // result: "known" | E.
|
|
34
|
+
* // result: "known" | E.Error<unknown>
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
* @see https://utils.duplojs.dev/en/v1/api/common/hasSomeKinds
|
|
@@ -24,4 +24,4 @@ import type { AnyTuple } from "../types";
|
|
|
24
24
|
* @see https://utils.duplojs.dev/en/v1/api/common/path/resolveFrom
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
|
-
export declare function resolveFrom<GenericSegment extends string>(origin: string, segments: AnyTuple<GenericSegment>): DEither.
|
|
27
|
+
export declare function resolveFrom<GenericSegment extends string>(origin: string, segments: AnyTuple<GenericSegment>): DEither.Fail | DEither.Success<string>;
|
|
@@ -67,7 +67,7 @@ export interface DataParser<GenericDefinition extends DataParserDefinition = Dat
|
|
|
67
67
|
* @namespace DP
|
|
68
68
|
*
|
|
69
69
|
*/
|
|
70
|
-
parse(data: unknown): DEither.
|
|
70
|
+
parse(data: unknown): DEither.Success<GenericOutput> | DEither.Error<DataParserError>;
|
|
71
71
|
/**
|
|
72
72
|
* The asyncParse() method runs a data parser asynchronously and resolves to an Either with the parsed value or a DataParserError.
|
|
73
73
|
*
|
|
@@ -79,7 +79,7 @@ export interface DataParser<GenericDefinition extends DataParserDefinition = Dat
|
|
|
79
79
|
* @namespace DP
|
|
80
80
|
*
|
|
81
81
|
*/
|
|
82
|
-
asyncParse(data: unknown): Promise<DEither.
|
|
82
|
+
asyncParse(data: unknown): Promise<DEither.Success<GenericOutput> | DEither.Error<DataParserError>>;
|
|
83
83
|
/**
|
|
84
84
|
* The addChecker() method returns a new data parser with one or more additional checkers appended.
|
|
85
85
|
*
|
|
@@ -45,7 +45,7 @@ export interface DataParserExtended<GenericDefinition extends DataParserDefiniti
|
|
|
45
45
|
* @namespace DPE
|
|
46
46
|
*
|
|
47
47
|
*/
|
|
48
|
-
parse(data: unknown): DEither.
|
|
48
|
+
parse(data: unknown): DEither.Success<GenericOutput> | DEither.Error<DataParserError>;
|
|
49
49
|
/**
|
|
50
50
|
* The asyncParse() method runs an extended data parser asynchronously and resolves to an Either with the parsed value or a DataParserError.
|
|
51
51
|
*
|
|
@@ -57,7 +57,7 @@ export interface DataParserExtended<GenericDefinition extends DataParserDefiniti
|
|
|
57
57
|
* @namespace DPE
|
|
58
58
|
*
|
|
59
59
|
*/
|
|
60
|
-
asyncParse(data: unknown): Promise<DEither.
|
|
60
|
+
asyncParse(data: unknown): Promise<DEither.Success<GenericOutput> | DEither.Error<DataParserError>>;
|
|
61
61
|
/**
|
|
62
62
|
* The parseOrThrow() method runs an extended data parser synchronously and returns the parsed value or throws a DataParserThrowError.
|
|
63
63
|
*
|
|
@@ -26,7 +26,7 @@ export interface DataParserEmptyExtended<GenericDefinition extends dataParsers.D
|
|
|
26
26
|
* const parser = DPE.empty();
|
|
27
27
|
* const result = parser.parse(undefined);
|
|
28
28
|
* if (E.isRight(result)) {
|
|
29
|
-
* // E.
|
|
29
|
+
* // E.Success<undefined>
|
|
30
30
|
* }
|
|
31
31
|
*
|
|
32
32
|
* const coerceParser = DPE.coerce.empty();
|
|
@@ -42,7 +42,7 @@ export interface DataParserNullableExtended<GenericDefinition extends dataParser
|
|
|
42
42
|
* @namespace DPE
|
|
43
43
|
*
|
|
44
44
|
*/
|
|
45
|
-
export declare function nullable<GenericDataParser extends DataParser, const GenericDefinition extends Partial<Omit<dataParsers.DataParserDefinitionNullable<Output<GenericDataParser
|
|
45
|
+
export declare function nullable<GenericDataParser extends DataParser, const GenericDefinition extends Partial<Omit<dataParsers.DataParserDefinitionNullable<Output<GenericDataParser>>, "inner">> = never>(inner: GenericDataParser, definition?: GenericDefinition): DataParserNullableExtended<MergeDefinition<dataParsers.DataParserDefinitionNullable, NeverCoalescing<GenericDefinition, {}> & {
|
|
46
46
|
inner: GenericDataParser;
|
|
47
47
|
}>>;
|
|
48
48
|
export declare namespace nullable {
|
|
@@ -42,7 +42,7 @@ export interface DataParserOptionalExtended<GenericDefinition extends dataParser
|
|
|
42
42
|
* @namespace DPE
|
|
43
43
|
*
|
|
44
44
|
*/
|
|
45
|
-
export declare function optional<GenericDataParser extends DataParser, const GenericDefinition extends Partial<Omit<dataParsers.DataParserDefinitionOptional<Output<GenericDataParser
|
|
45
|
+
export declare function optional<GenericDataParser extends DataParser, const GenericDefinition extends Partial<Omit<dataParsers.DataParserDefinitionOptional<Output<GenericDataParser>>, "inner">> = never>(inner: GenericDataParser, definition?: GenericDefinition): DataParserOptionalExtended<MergeDefinition<dataParsers.DataParserDefinitionOptional, NeverCoalescing<GenericDefinition, {}> & {
|
|
46
46
|
inner: GenericDataParser;
|
|
47
47
|
}>>;
|
|
48
48
|
export declare namespace optional {
|
|
@@ -41,7 +41,7 @@ export interface DataParserRecoverExtended<GenericDefinition extends dataParsers
|
|
|
41
41
|
* @namespace DPE
|
|
42
42
|
*
|
|
43
43
|
*/
|
|
44
|
-
export declare function recover<GenericDataParser extends DataParser, GenericRecoveredValue extends
|
|
44
|
+
export declare function recover<GenericDataParser extends DataParser, GenericRecoveredValue extends Output<GenericDataParser>, const GenericDefinition extends Partial<Omit<dataParsers.DataParserDefinitionRecover, "inner" | "recoveredValue">> = never>(inner: GenericDataParser, recoveredValue: GenericRecoveredValue, definition?: GenericDefinition): DataParserRecoverExtended<MergeDefinition<dataParsers.DataParserDefinitionRecover, NeverCoalescing<GenericDefinition, {}> & {
|
|
45
45
|
inner: GenericDataParser;
|
|
46
46
|
recoveredValue: GenericRecoveredValue;
|
|
47
47
|
}>>;
|
|
@@ -8,7 +8,7 @@ export * from "./checkers";
|
|
|
8
8
|
export interface DataParserArrayCheckerCustom<GenericInput extends unknown[] = unknown[]> {
|
|
9
9
|
}
|
|
10
10
|
export type DataParserArrayCheckers<GenericInput extends unknown[] = unknown[]> = (DataParserArrayCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserArrayCheckerCustom<GenericInput>, DataParserChecker>] | DataParserCheckerArrayMin | DataParserCheckerArrayMax | CheckerRefineImplementation<GenericInput>);
|
|
11
|
-
export interface DataParserDefinitionArray extends DataParserDefinition<DataParserArrayCheckers
|
|
11
|
+
export interface DataParserDefinitionArray extends DataParserDefinition<DataParserArrayCheckers<unknown[]>> {
|
|
12
12
|
readonly element: DataParser;
|
|
13
13
|
}
|
|
14
14
|
export declare const arrayKind: import("../../../common").KindHandler<import("../../../common").KindDefinition<"@DuplojsUtilsDataParser/array", unknown>>;
|
|
@@ -33,7 +33,7 @@ export interface DataParserEmpty<GenericDefinition extends DataParserDefinitionE
|
|
|
33
33
|
* const parser = DP.empty();
|
|
34
34
|
* const result = parser.parse(undefined);
|
|
35
35
|
* if (E.isRight(result)) {
|
|
36
|
-
* // E.
|
|
36
|
+
* // E.Success<undefined>
|
|
37
37
|
* }
|
|
38
38
|
*
|
|
39
39
|
* const withCheckers = DP.empty({
|
|
@@ -6,7 +6,7 @@ import { type GetPropsWithValueExtends } from "../../object";
|
|
|
6
6
|
export interface DataParserLazyCheckerCustom<GenericInput extends unknown = unknown> {
|
|
7
7
|
}
|
|
8
8
|
export type DataParserLazyCheckers<GenericInput extends unknown = unknown> = (DataParserLazyCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserLazyCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
9
|
-
export interface DataParserDefinitionLazy extends DataParserDefinition<DataParserLazyCheckers
|
|
9
|
+
export interface DataParserDefinitionLazy extends DataParserDefinition<DataParserLazyCheckers<unknown>> {
|
|
10
10
|
getter: Memoized<DataParser>;
|
|
11
11
|
}
|
|
12
12
|
export declare const lazyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsDataParser/lazy", unknown>>;
|
|
@@ -7,7 +7,7 @@ export type LiteralValue = string | number | bigint | undefined | null | boolean
|
|
|
7
7
|
export interface DataParserLiteralCheckerCustom<GenericInput extends LiteralValue = LiteralValue> {
|
|
8
8
|
}
|
|
9
9
|
export type DataParserLiteralCheckers<GenericInput extends LiteralValue = LiteralValue> = (DataParserLiteralCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserLiteralCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
10
|
-
export interface DataParserDefinitionLiteral extends DataParserDefinition<DataParserLiteralCheckers
|
|
10
|
+
export interface DataParserDefinitionLiteral extends DataParserDefinition<DataParserLiteralCheckers<LiteralValue>> {
|
|
11
11
|
readonly value: readonly LiteralValue[];
|
|
12
12
|
}
|
|
13
13
|
export declare const literalKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsDataParser/literal", unknown>>;
|
|
@@ -6,9 +6,9 @@ import { type GetPropsWithValueExtends } from "../../object";
|
|
|
6
6
|
export interface DataParserNullableCheckerCustom<GenericInput extends unknown = unknown> {
|
|
7
7
|
}
|
|
8
8
|
export type DataParserNullableCheckers<GenericInput extends unknown = unknown> = (DataParserNullableCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserNullableCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
9
|
-
export interface DataParserDefinitionNullable<
|
|
9
|
+
export interface DataParserDefinitionNullable<GenericOutput extends unknown = unknown> extends DataParserDefinition<DataParserNullableCheckers> {
|
|
10
10
|
readonly inner: DataParser;
|
|
11
|
-
readonly coalescingValue:
|
|
11
|
+
readonly coalescingValue: GenericOutput;
|
|
12
12
|
}
|
|
13
13
|
export declare const nullableKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsDataParser/nullable", unknown>>;
|
|
14
14
|
type _DataParserNullable<GenericDefinition extends DataParserDefinitionNullable> = (DataParser<GenericDefinition, IsEqual<GenericDefinition["coalescingValue"], unknown> extends true ? Output<GenericDefinition["inner"]> | null : Output<GenericDefinition["inner"]>, Input<GenericDefinition["inner"]> | null> & Kind<typeof nullableKind.definition>);
|
|
@@ -16,10 +16,10 @@ export type DataParserObjectShapeOutput<GenericShape extends DataParserObjectSha
|
|
|
16
16
|
export type DataParserObjectShapeInput<GenericShape extends DataParserObjectShape> = {
|
|
17
17
|
-readonly [Prop in keyof GenericShape as GenericShape[Prop] extends Kind<typeof dataParserKind.definition> ? Prop : never]: Input<GenericShape[Prop]>;
|
|
18
18
|
} extends infer InferredResult extends object ? DObject.PartialKeys<InferredResult, DObject.GetPropsWithValueExtends<InferredResult, undefined>> : never;
|
|
19
|
-
export interface DataParserObjectCheckerCustom<GenericInput extends
|
|
19
|
+
export interface DataParserObjectCheckerCustom<GenericInput extends object = object> {
|
|
20
20
|
}
|
|
21
|
-
export type DataParserObjectCheckers<GenericInput extends
|
|
22
|
-
export interface DataParserDefinitionObject extends DataParserDefinition<DataParserObjectCheckers
|
|
21
|
+
export type DataParserObjectCheckers<GenericInput extends object = object> = (DataParserObjectCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserObjectCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
22
|
+
export interface DataParserDefinitionObject extends DataParserDefinition<DataParserObjectCheckers<object>> {
|
|
23
23
|
readonly shape: DataParserObjectShape;
|
|
24
24
|
readonly optimizedShape: Memoized<{
|
|
25
25
|
readonly key: string;
|
|
@@ -6,9 +6,9 @@ import { type GetPropsWithValueExtends } from "../../object";
|
|
|
6
6
|
export interface DataParserOptionalCheckerCustom<GenericInput extends unknown = unknown> {
|
|
7
7
|
}
|
|
8
8
|
export type DataParserOptionalCheckers<GenericInput extends unknown = unknown> = (DataParserOptionalCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserOptionalCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
9
|
-
export interface DataParserDefinitionOptional<
|
|
9
|
+
export interface DataParserDefinitionOptional<GenericOutput extends unknown = unknown> extends DataParserDefinition<DataParserOptionalCheckers> {
|
|
10
10
|
readonly inner: DataParser;
|
|
11
|
-
readonly coalescingValue:
|
|
11
|
+
readonly coalescingValue: GenericOutput;
|
|
12
12
|
}
|
|
13
13
|
export declare const optionalKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsDataParser/optional", unknown>>;
|
|
14
14
|
type _DataParserOptional<GenericDefinition extends DataParserDefinitionOptional> = (DataParser<GenericDefinition, IsEqual<GenericDefinition["coalescingValue"], unknown> extends true ? Output<GenericDefinition["inner"]> | undefined : Output<GenericDefinition["inner"]>, Input<GenericDefinition["inner"]> | undefined> & Kind<typeof optionalKind.definition>);
|
|
@@ -51,7 +51,7 @@ export interface DataParserOptional<GenericDefinition extends DataParserDefiniti
|
|
|
51
51
|
* @namespace DP
|
|
52
52
|
*
|
|
53
53
|
*/
|
|
54
|
-
export declare function optional<GenericDataParser extends DataParser, const GenericDefinition extends Partial<Omit<DataParserDefinitionOptional
|
|
54
|
+
export declare function optional<GenericDataParser extends DataParser, const GenericDefinition extends Partial<Omit<DataParserDefinitionOptional, "inner">> = never>(inner: GenericDataParser, definition?: GenericDefinition): DataParserOptional<MergeDefinition<DataParserDefinitionOptional, NeverCoalescing<GenericDefinition, {}> & {
|
|
55
55
|
inner: GenericDataParser;
|
|
56
56
|
}>>;
|
|
57
57
|
export declare namespace optional {
|
|
@@ -6,7 +6,7 @@ import { type GetPropsWithValueExtends } from "../../object";
|
|
|
6
6
|
export interface DataParserPipeCheckerCustom<GenericInput extends unknown = unknown> {
|
|
7
7
|
}
|
|
8
8
|
export type DataParserPipeCheckers<GenericInput extends unknown = unknown> = (DataParserPipeCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserPipeCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
9
|
-
export interface DataParserDefinitionPipe extends DataParserDefinition<DataParserPipeCheckers
|
|
9
|
+
export interface DataParserDefinitionPipe extends DataParserDefinition<DataParserPipeCheckers<unknown>> {
|
|
10
10
|
readonly input: DataParser;
|
|
11
11
|
readonly output: DataParser;
|
|
12
12
|
}
|
|
@@ -18,7 +18,7 @@ export type DataParserRecordKey = (DataParserString | DataParserTemplateLiteral
|
|
|
18
18
|
export interface DataParserRecordCheckerCustom<GenericInput extends Record<string, unknown> = Record<string, unknown>> {
|
|
19
19
|
}
|
|
20
20
|
export type DataParserRecordCheckers<GenericInput extends Record<string, unknown> = Record<string, unknown>> = (DataParserRecordCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserRecordCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
21
|
-
export interface DataParserDefinitionRecord extends DataParserDefinition<DataParserRecordCheckers
|
|
21
|
+
export interface DataParserDefinitionRecord extends DataParserDefinition<DataParserRecordCheckers<Record<string, unknown>>> {
|
|
22
22
|
readonly key: DataParserRecordKey;
|
|
23
23
|
readonly value: DataParser;
|
|
24
24
|
readonly requireKey: string[] | null;
|
|
@@ -41,9 +41,9 @@ export interface DataParserRecover<GenericDefinition extends DataParserDefinitio
|
|
|
41
41
|
* const withString = DP.recover(DP.string(), "fallback");
|
|
42
42
|
* const stringResult = withString.parse(123);
|
|
43
43
|
*
|
|
44
|
-
* const withCheckers = DP.recover(DP.string(), "fallback"
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* const withCheckers = DP.recover(DP.string(), "fallback")
|
|
45
|
+
* .addChecker(DP.checkerRefine((value) => value.length > 0));
|
|
46
|
+
*
|
|
47
47
|
* ```
|
|
48
48
|
*
|
|
49
49
|
* @see https://utils.duplojs.dev/en/v1/api/dataParser/recover
|
|
@@ -46,7 +46,7 @@ export type TemplateLiteralShapeInput<GenericTemplate extends TemplateLiteralSha
|
|
|
46
46
|
export interface DataParserTemplateLiteralCheckerCustom<GenericInput extends string = string> {
|
|
47
47
|
}
|
|
48
48
|
export type DataParserTemplateLiteralCheckers<GenericInput extends string = string> = (DataParserTemplateLiteralCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserTemplateLiteralCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
49
|
-
export interface DataParserDefinitionTemplateLiteral extends DataParserDefinition<DataParserTemplateLiteralCheckers
|
|
49
|
+
export interface DataParserDefinitionTemplateLiteral extends DataParserDefinition<DataParserTemplateLiteralCheckers<string>> {
|
|
50
50
|
readonly template: TemplateLiteralShape;
|
|
51
51
|
readonly pattern: RegExp;
|
|
52
52
|
}
|
|
@@ -7,7 +7,7 @@ import { type GetPropsWithValueExtends } from "../../object";
|
|
|
7
7
|
export interface DataParserTransformCheckerCustom<GenericInput extends unknown = unknown> {
|
|
8
8
|
}
|
|
9
9
|
export type DataParserTransformCheckers<GenericInput extends unknown = unknown> = (DataParserTransformCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserTransformCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
10
|
-
export interface DataParserDefinitionTransform extends DataParserDefinition<DataParserTransformCheckers
|
|
10
|
+
export interface DataParserDefinitionTransform extends DataParserDefinition<DataParserTransformCheckers<unknown>> {
|
|
11
11
|
readonly inner: DataParser;
|
|
12
12
|
theFunction(input: any, error: DataParserError): unknown;
|
|
13
13
|
}
|
|
@@ -22,7 +22,7 @@ export type DataParserTupleShapeInput<GenericShape extends TupleShape, GenericRe
|
|
|
22
22
|
export interface DataParserTupleCheckerCustom<GenericInput extends AnyTuple<unknown> = AnyTuple<unknown>> {
|
|
23
23
|
}
|
|
24
24
|
export type DataParserTupleCheckers<GenericInput extends AnyTuple<unknown> = AnyTuple<unknown>> = (DataParserTupleCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserTupleCheckerCustom<GenericInput>, DataParserChecker>] | DataParserCheckerArrayMin | DataParserCheckerArrayMax | CheckerRefineImplementation<GenericInput>);
|
|
25
|
-
export interface DataParserDefinitionTuple extends DataParserDefinition<DataParserTupleCheckers
|
|
25
|
+
export interface DataParserDefinitionTuple extends DataParserDefinition<DataParserTupleCheckers<AnyTuple<unknown>>> {
|
|
26
26
|
readonly shape: TupleShape;
|
|
27
27
|
readonly rest?: DataParser;
|
|
28
28
|
}
|
|
@@ -7,7 +7,7 @@ export type UnionOptions = readonly [DataParser, ...DataParser[]];
|
|
|
7
7
|
export interface DataParserUnionCheckerCustom<GenericInput extends unknown = unknown> {
|
|
8
8
|
}
|
|
9
9
|
export type DataParserUnionCheckers<GenericInput extends unknown = unknown> = (DataParserUnionCheckerCustom<GenericInput>[GetPropsWithValueExtends<DataParserUnionCheckerCustom<GenericInput>, DataParserChecker>] | CheckerRefineImplementation<GenericInput>);
|
|
10
|
-
export interface DataParserDefinitionUnion extends DataParserDefinition<DataParserUnionCheckers
|
|
10
|
+
export interface DataParserDefinitionUnion extends DataParserDefinition<DataParserUnionCheckers<unknown>> {
|
|
11
11
|
readonly options: UnionOptions;
|
|
12
12
|
}
|
|
13
13
|
export declare const unionKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsDataParser/union", unknown>>;
|
package/dist/date/create.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Hour, IsLeapYear, IsSafeYear, Millisecond, Minute, Second, TheDate
|
|
|
2
2
|
import * as DEither from "../either";
|
|
3
3
|
import type * as DString from "../string";
|
|
4
4
|
import { type And, type IsEqual, type Not, type IsExtends } from "../common";
|
|
5
|
-
export type MayBe = DEither.
|
|
5
|
+
export type MayBe = DEither.Right<"date-created", TheDate> | DEither.Left<"date-created-error", null>;
|
|
6
6
|
type SafeDate = `${number}-${MonthWithDay}`;
|
|
7
7
|
declare const SymbolForbiddenDate: unique symbol;
|
|
8
8
|
type ForbiddenDate<GenericDate extends string> = And<[
|
|
@@ -3,7 +3,7 @@ import { type maxTimeValue, type minTimeValue } from "./constants";
|
|
|
3
3
|
import { type TheTime, type SpoolingTime } from "./types";
|
|
4
4
|
import * as DEither from "../either";
|
|
5
5
|
import { type IsGreater, type IsLess } from "../number";
|
|
6
|
-
export type MayBeTime = DEither.
|
|
6
|
+
export type MayBeTime = DEither.Right<"time-created", TheTime> | DEither.Left<"time-created-error", null>;
|
|
7
7
|
type Units = "week" | "day" | "hour" | "minute" | "second" | "millisecond";
|
|
8
8
|
declare const SymbolForbiddenTime: unique symbol;
|
|
9
9
|
type ForbiddenTime<GenericInput extends number, GenericUnit extends Units> = IsEqual<GenericInput, number> extends true ? {
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var kind = require('../kind.cjs');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const boolKind = kind.createEitherKind("bool");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use boolKind
|
|
8
|
+
*/
|
|
9
|
+
const eitherBoolKind = boolKind;
|
|
6
10
|
|
|
11
|
+
exports.boolKind = boolKind;
|
|
7
12
|
exports.eitherBoolKind = eitherBoolKind;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
export declare const boolKind: import("../..").KindHandler<import("../..").KindDefinition<"@DuplojsUtilsEither/bool", unknown>>;
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated use boolKind
|
|
4
|
+
*/
|
|
1
5
|
export declare const eitherBoolKind: import("../..").KindHandler<import("../..").KindDefinition<"@DuplojsUtilsEither/bool", unknown>>;
|