@naturalcycles/js-lib 15.23.0 → 15.24.1

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.
@@ -1,7 +1,7 @@
1
1
  import type { ZodString } from 'zod';
2
2
  import { z } from 'zod';
3
- import type { IsoDate, UnixTimestamp, UnixTimestampMillis } from '../types.js';
4
- type ZodBranded<T, B> = T & Record<'_zod', Record<'output', number & B>>;
3
+ import type { IANATimezone, IsoDate, UnixTimestamp, UnixTimestampMillis } from '../types.js';
4
+ 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>;
@@ -20,7 +20,7 @@ declare function jwt(): z.ZodString;
20
20
  * "Slug" - a valid URL, filename, etc.
21
21
  */
22
22
  declare function slug(): z.ZodString;
23
- declare function ianaTimezone(): z.ZodEnum;
23
+ declare function ianaTimezone(): ZodBrandedString<IANATimezone>;
24
24
  type BaseDBEntityZodShape = {
25
25
  id: ZodString;
26
26
  created: ZodBrandedInt<UnixTimestamp>;
@@ -76,9 +76,10 @@ function slug() {
76
76
  .describe('Slug');
77
77
  }
78
78
  function ianaTimezone() {
79
- return (z
79
+ return z
80
80
  // UTC is added to assist unit-testing, which uses UTC by default (not technically a valid Iana timezone identifier)
81
- .enum([...Intl.supportedValuesOf('timeZone'), 'UTC']));
81
+ .enum([...Intl.supportedValuesOf('timeZone'), 'UTC'])
82
+ .describe('IANATimezone');
82
83
  }
83
84
  const baseDBEntitySchema = z.object({
84
85
  id: z.string(),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.23.0",
4
+ "version": "15.24.1",
5
5
  "dependencies": {
6
6
  "tslib": "^2",
7
7
  "zod": "^4"
@@ -1,8 +1,8 @@
1
1
  import type { ZodString } from 'zod'
2
2
  import { z } from 'zod'
3
- import type { IsoDate, UnixTimestamp, UnixTimestampMillis } from '../types.js'
3
+ import type { IANATimezone, IsoDate, UnixTimestamp, UnixTimestampMillis } from '../types.js'
4
4
 
5
- type ZodBranded<T, B> = T & Record<'_zod', Record<'output', number & B>>
5
+ 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>
@@ -98,11 +98,12 @@ function slug(): z.ZodString {
98
98
  .describe('Slug')
99
99
  }
100
100
 
101
- function ianaTimezone(): z.ZodEnum {
101
+ function ianaTimezone(): ZodBrandedString<IANATimezone> {
102
102
  return (
103
103
  z
104
104
  // UTC is added to assist unit-testing, which uses UTC by default (not technically a valid Iana timezone identifier)
105
105
  .enum([...Intl.supportedValuesOf('timeZone'), 'UTC'])
106
+ .describe('IANATimezone') as unknown as ZodBrandedString<IANATimezone>
106
107
  )
107
108
  }
108
109