@railway-ts/pipelines 0.1.20 → 0.1.21

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.
@@ -701,6 +701,18 @@ declare function nonEmpty(message?: string): Validator<string>;
701
701
  * @returns A validator that checks if a string is a valid email
702
702
  */
703
703
  declare function email(message?: string): Validator<string>;
704
+ /**
705
+ * Create a validator that ensures a string is a valid URL.
706
+ *
707
+ * @example
708
+ * const validate = url();
709
+ * validate('https://example.com'); // ok("https://example.com")
710
+ * validate('not-a-url'); // err([{ path: [], message: 'Invalid URL format' }])
711
+ *
712
+ * @param message - Custom error message
713
+ * @returns A validator that checks if a string is a valid URL
714
+ */
715
+ declare function url(message?: string): Validator<string>;
704
716
  /**
705
717
  * Create a validator that ensures a string is a valid phone number.
706
718
  * Accepts common formats including international (+), spaces, dashes, and parentheses.
@@ -1116,4 +1128,4 @@ declare namespace StandardSchemaV1 {
1116
1128
  declare function toStandardSchema<O>(validator: Validator<unknown, O>): StandardSchemaV1<unknown, O>;
1117
1129
  declare function toStandardSchema<O>(validator: MaybeAsyncValidator<unknown, O>): StandardSchemaV1<unknown, O>;
1118
1130
 
1119
- export { type AsyncValidator, type InferSchemaType, type MaybeAsyncValidator, ROOT_ERROR_KEY, type Schema, StandardSchemaV1, type SyncSchema, type ValidationError, type ValidationResult, type Validator, type ValidatorMapOutput, array, between, bigint, boolean, chain, chainAsync, date, dateRange, discriminatedUnion, divisibleBy, email, emptyAsOptional, enumValue, finite, formatErrors, futureDate, integer, 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, validate, validateAndFormatResult };
1131
+ export { type AsyncValidator, type InferSchemaType, type MaybeAsyncValidator, ROOT_ERROR_KEY, type Schema, StandardSchemaV1, type SyncSchema, type ValidationError, type ValidationResult, type Validator, type ValidatorMapOutput, array, between, bigint, boolean, chain, chainAsync, date, dateRange, discriminatedUnion, divisibleBy, email, emptyAsOptional, enumValue, finite, formatErrors, futureDate, integer, 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, validate, validateAndFormatResult };
@@ -701,6 +701,18 @@ declare function nonEmpty(message?: string): Validator<string>;
701
701
  * @returns A validator that checks if a string is a valid email
702
702
  */
703
703
  declare function email(message?: string): Validator<string>;
704
+ /**
705
+ * Create a validator that ensures a string is a valid URL.
706
+ *
707
+ * @example
708
+ * const validate = url();
709
+ * validate('https://example.com'); // ok("https://example.com")
710
+ * validate('not-a-url'); // err([{ path: [], message: 'Invalid URL format' }])
711
+ *
712
+ * @param message - Custom error message
713
+ * @returns A validator that checks if a string is a valid URL
714
+ */
715
+ declare function url(message?: string): Validator<string>;
704
716
  /**
705
717
  * Create a validator that ensures a string is a valid phone number.
706
718
  * Accepts common formats including international (+), spaces, dashes, and parentheses.
@@ -1116,4 +1128,4 @@ declare namespace StandardSchemaV1 {
1116
1128
  declare function toStandardSchema<O>(validator: Validator<unknown, O>): StandardSchemaV1<unknown, O>;
1117
1129
  declare function toStandardSchema<O>(validator: MaybeAsyncValidator<unknown, O>): StandardSchemaV1<unknown, O>;
1118
1130
 
1119
- export { type AsyncValidator, type InferSchemaType, type MaybeAsyncValidator, ROOT_ERROR_KEY, type Schema, StandardSchemaV1, type SyncSchema, type ValidationError, type ValidationResult, type Validator, type ValidatorMapOutput, array, between, bigint, boolean, chain, chainAsync, date, dateRange, discriminatedUnion, divisibleBy, email, emptyAsOptional, enumValue, finite, formatErrors, futureDate, integer, 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, validate, validateAndFormatResult };
1131
+ export { type AsyncValidator, type InferSchemaType, type MaybeAsyncValidator, ROOT_ERROR_KEY, type Schema, StandardSchemaV1, type SyncSchema, type ValidationError, type ValidationResult, type Validator, type ValidatorMapOutput, array, between, bigint, boolean, chain, chainAsync, date, dateRange, discriminatedUnion, divisibleBy, email, emptyAsOptional, enumValue, finite, formatErrors, futureDate, integer, 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, validate, validateAndFormatResult };
@@ -271,6 +271,16 @@ function email(message = "Invalid email format") {
271
271
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
272
272
  return pattern(emailRegex, message);
273
273
  }
274
+ function url(message = "Invalid URL format") {
275
+ return (value, path = []) => {
276
+ try {
277
+ new URL(value);
278
+ return ok(value);
279
+ } catch {
280
+ return err([{ path, message }]);
281
+ }
282
+ };
283
+ }
274
284
  function phoneNumber(message = "Invalid phone number format") {
275
285
  const phoneRegex = /^\+?[\d\s\-()]{8,20}$/;
276
286
  return (value, path = []) => {
@@ -933,6 +943,6 @@ function toStandardSchema(validator) {
933
943
  };
934
944
  }
935
945
 
936
- export { ROOT_ERROR_KEY, array, between, bigint, boolean, chain, chainAsync, date, dateRange, discriminatedUnion, divisibleBy, email, emptyAsOptional, enumValue, finite, formatErrors, futureDate, integer, 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, validate, validateAndFormatResult };
946
+ export { ROOT_ERROR_KEY, array, between, bigint, boolean, chain, chainAsync, date, dateRange, discriminatedUnion, divisibleBy, email, emptyAsOptional, enumValue, finite, formatErrors, futureDate, integer, 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, validate, validateAndFormatResult };
937
947
  //# sourceMappingURL=index.mjs.map
938
948
  //# sourceMappingURL=index.mjs.map