@railway-ts/pipelines 0.1.28 → 0.1.30
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/composition/index.d.cts +2 -1
- package/dist/composition/index.d.ts +2 -1
- package/dist/option/index.cjs +3 -5
- package/dist/option/index.cjs.map +1 -1
- package/dist/option/index.d.cts +1 -1
- package/dist/option/index.d.ts +1 -1
- package/dist/option/index.mjs +3 -5
- package/dist/option/index.mjs.map +1 -1
- package/dist/result/index.cjs +3 -5
- package/dist/result/index.cjs.map +1 -1
- package/dist/result/index.d.cts +2 -1
- package/dist/result/index.d.ts +2 -1
- package/dist/result/index.mjs +3 -5
- package/dist/result/index.mjs.map +1 -1
- package/dist/schema/index.cjs +8 -12
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +2 -1
- package/dist/schema/index.d.ts +2 -1
- package/dist/schema/index.mjs +8 -12
- package/dist/schema/index.mjs.map +1 -1
- package/package.json +14 -14
package/dist/schema/index.d.cts
CHANGED
|
@@ -1262,4 +1262,5 @@ declare namespace StandardSchemaV1 {
|
|
|
1262
1262
|
declare function toStandardSchema<O>(validator: Validator<unknown, O>): StandardSchemaV1<unknown, O>;
|
|
1263
1263
|
declare function toStandardSchema<O>(validator: MaybeAsyncValidator<unknown, O>): StandardSchemaV1<unknown, O>;
|
|
1264
1264
|
|
|
1265
|
-
export {
|
|
1265
|
+
export { ROOT_ERROR_KEY, StandardSchemaV1, array, between, bigint, boolean, chain, chainAsync, date, dateRange, discriminatedUnion, divisibleBy, email, emptyAsOptional, enumValue, finite, formatErrors, futureDate, integer, is, isoDate, isoDateTime, isoDuration, isoTime, literal, matches, max, maxItems, maxLength, min, minItems, minLength, negative, nonEmpty, nonZero, notEmpty, nullable, number, object, oneOf, optional, parseBigInt, parseBool, parseDate, parseEnum, parseISODate, parseJSON, parseNumber, parseString, parseURL, pastDate, pattern, phoneNumber, positive, precision, refine, refineAsync, refineAt, refineAtAsync, required, string, stringEnum, toStandardSchema, todayOrFuture, transform, tuple, tupleOf, union, unique, url, uuid, validate, validateAndFormatResult, when, whenAsync };
|
|
1266
|
+
export type { AsyncValidator, InferSchemaType, MaybeAsyncValidator, Schema, SyncSchema, ValidateOptions, ValidationError, ValidationResult, Validator, ValidatorMapOutput };
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1262,4 +1262,5 @@ declare namespace StandardSchemaV1 {
|
|
|
1262
1262
|
declare function toStandardSchema<O>(validator: Validator<unknown, O>): StandardSchemaV1<unknown, O>;
|
|
1263
1263
|
declare function toStandardSchema<O>(validator: MaybeAsyncValidator<unknown, O>): StandardSchemaV1<unknown, O>;
|
|
1264
1264
|
|
|
1265
|
-
export {
|
|
1265
|
+
export { ROOT_ERROR_KEY, StandardSchemaV1, array, between, bigint, boolean, chain, chainAsync, date, dateRange, discriminatedUnion, divisibleBy, email, emptyAsOptional, enumValue, finite, formatErrors, futureDate, integer, is, isoDate, isoDateTime, isoDuration, isoTime, literal, matches, max, maxItems, maxLength, min, minItems, minLength, negative, nonEmpty, nonZero, notEmpty, nullable, number, object, oneOf, optional, parseBigInt, parseBool, parseDate, parseEnum, parseISODate, parseJSON, parseNumber, parseString, parseURL, pastDate, pattern, phoneNumber, positive, precision, refine, refineAsync, refineAt, refineAtAsync, required, string, stringEnum, toStandardSchema, todayOrFuture, transform, tuple, tupleOf, union, unique, url, uuid, validate, validateAndFormatResult, when, whenAsync };
|
|
1266
|
+
export type { AsyncValidator, InferSchemaType, MaybeAsyncValidator, Schema, SyncSchema, ValidateOptions, ValidationError, ValidationResult, Validator, ValidatorMapOutput };
|
package/dist/schema/index.mjs
CHANGED
|
@@ -23,10 +23,9 @@ function match(result, patterns) {
|
|
|
23
23
|
if (isOk(result)) {
|
|
24
24
|
const okFn = patterns.ok;
|
|
25
25
|
return okFn(result.value);
|
|
26
|
-
} else {
|
|
27
|
-
const errFn = patterns.err;
|
|
28
|
-
return errFn(result.error);
|
|
29
26
|
}
|
|
27
|
+
const errFn = patterns.err;
|
|
28
|
+
return errFn(result.error);
|
|
30
29
|
}
|
|
31
30
|
function fromTry(f) {
|
|
32
31
|
try {
|
|
@@ -196,9 +195,8 @@ function formatErrors(errors) {
|
|
|
196
195
|
const formattedPath = error.path.reduce((path, segment, index) => {
|
|
197
196
|
if (/^\d+$/.test(segment)) {
|
|
198
197
|
return `${path}[${segment}]`;
|
|
199
|
-
} else {
|
|
200
|
-
return index === 0 ? segment : `${path}.${segment}`;
|
|
201
198
|
}
|
|
199
|
+
return index === 0 ? segment : `${path}.${segment}`;
|
|
202
200
|
}, "");
|
|
203
201
|
acc[formattedPath || ROOT_ERROR_KEY] = error.message;
|
|
204
202
|
return acc;
|
|
@@ -700,7 +698,7 @@ function divisibleBy(divisor, message = `Must be divisible by ${divisor}`) {
|
|
|
700
698
|
function precision(maxDecimalPlaces, message = `Must have at most ${maxDecimalPlaces} decimal places`) {
|
|
701
699
|
return (value, path = []) => {
|
|
702
700
|
const str = value.toString();
|
|
703
|
-
const decimalPlaces = (str.split(".")[1] || "").length;
|
|
701
|
+
const decimalPlaces = (str.split(".", 2)[1] || "").length;
|
|
704
702
|
if (decimalPlaces > maxDecimalPlaces) {
|
|
705
703
|
return err([{ path, message }]);
|
|
706
704
|
}
|
|
@@ -797,9 +795,7 @@ function parseDate(message = "Must be a valid date") {
|
|
|
797
795
|
return ok(value);
|
|
798
796
|
}
|
|
799
797
|
let dateValue;
|
|
800
|
-
if (typeof value === "string") {
|
|
801
|
-
dateValue = new Date(value);
|
|
802
|
-
} else if (typeof value === "number") {
|
|
798
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
803
799
|
dateValue = new Date(value);
|
|
804
800
|
} else {
|
|
805
801
|
return err([{ path, message }]);
|
|
@@ -817,10 +813,10 @@ function parseBool(message = "Must be a valid boolean value") {
|
|
|
817
813
|
}
|
|
818
814
|
if (typeof value === "string") {
|
|
819
815
|
const normalized = value.toLowerCase().trim();
|
|
820
|
-
if (
|
|
816
|
+
if (["true", "1", "yes"].includes(normalized)) {
|
|
821
817
|
return ok(true);
|
|
822
818
|
}
|
|
823
|
-
if (
|
|
819
|
+
if (["false", "0", "no"].includes(normalized)) {
|
|
824
820
|
return ok(false);
|
|
825
821
|
}
|
|
826
822
|
}
|
|
@@ -908,7 +904,7 @@ function date(message = "Must be a Date object") {
|
|
|
908
904
|
return ok(value);
|
|
909
905
|
};
|
|
910
906
|
}
|
|
911
|
-
function dateRange(min2, max2, message = `Must be between ${min2.toISOString().split("T")[0]} and ${max2.toISOString().split("T")[0]}`) {
|
|
907
|
+
function dateRange(min2, max2, message = `Must be between ${min2.toISOString().split("T", 1)[0]} and ${max2.toISOString().split("T", 1)[0]}`) {
|
|
912
908
|
return (value, path = []) => {
|
|
913
909
|
if (value < min2 || value > max2) {
|
|
914
910
|
return err([{ path, message }]);
|