@naturalcycles/js-lib 15.33.2 → 15.33.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ type ZodBranded<T, B> = T & Record<'_zod', Record<'output', B>>;
5
5
  export type ZodBrandedString<B> = ZodBranded<z.ZodString, B>;
6
6
  export type ZodBrandedInt<B> = ZodBranded<z.ZodInt, B>;
7
7
  export type ZodBrandedNumber<B> = ZodBranded<z.ZodNumber, B>;
8
+ export type ZodBrandedIsoDate = ZodBranded<z.ZodISODate, IsoDate>;
8
9
  declare function unixTimestamp(): ZodBrandedInt<UnixTimestamp>;
9
10
  declare function unixTimestamp2000(): ZodBrandedInt<UnixTimestamp>;
10
11
  declare function unixTimestampMillis(): ZodBranded<z.ZodNumber, UnixTimestampMillis>;
@@ -42,9 +42,7 @@ function semVer() {
42
42
  function isoDate() {
43
43
  return z
44
44
  .string()
45
- .refine(v => {
46
- return /^\d{4}-\d{2}-\d{2}$/.test(v);
47
- }, 'Must be a YYYY-MM-DD string')
45
+ .regex(/^\d{4}-\d{2}-\d{2}$/, { error: 'Must be a YYYY-MM-DD string' })
48
46
  .describe('IsoDate');
49
47
  }
50
48
  function email() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.33.2",
4
+ "version": "15.33.3",
5
5
  "dependencies": {
6
6
  "tslib": "^2",
7
7
  "undici": "^7",
@@ -6,6 +6,7 @@ type ZodBranded<T, B> = T & Record<'_zod', Record<'output', B>>
6
6
  export type ZodBrandedString<B> = ZodBranded<z.ZodString, B>
7
7
  export type ZodBrandedInt<B> = ZodBranded<z.ZodInt, B>
8
8
  export type ZodBrandedNumber<B> = ZodBranded<z.ZodNumber, B>
9
+ export type ZodBrandedIsoDate = ZodBranded<z.ZodISODate, IsoDate>
9
10
 
10
11
  const TS_2500 = 16725225600 // 2500-01-01
11
12
  const TS_2000 = 946684800 // 2000-01-01
@@ -56,9 +57,7 @@ function semVer(): z.ZodString {
56
57
  function isoDate(): ZodBrandedString<IsoDate> {
57
58
  return z
58
59
  .string()
59
- .refine(v => {
60
- return /^\d{4}-\d{2}-\d{2}$/.test(v)
61
- }, 'Must be a YYYY-MM-DD string')
60
+ .regex(/^\d{4}-\d{2}-\d{2}$/, { error: 'Must be a YYYY-MM-DD string' })
62
61
  .describe('IsoDate') as ZodBrandedString<IsoDate>
63
62
  }
64
63