@nakanoaas/notion-valibot-schema 0.9.0 → 1.0.0-rc.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.
package/README.md CHANGED
@@ -86,7 +86,7 @@ import {
86
86
  RichTextSchema,
87
87
  StatusSchema,
88
88
  MultiSelectSchema,
89
- NullableSingleDateSchema,
89
+ NullableDateSchema,
90
90
  CheckboxSchema,
91
91
  PeopleIdSchema,
92
92
  } from "@nakanoaas/notion-valibot-schema";
@@ -108,7 +108,7 @@ const TaskPageSchema = v.object({
108
108
  Tags: MultiSelectSchema(v.string()),
109
109
 
110
110
  // Map "Due Date" -> Date | null
111
- DueDate: NullableSingleDateSchema,
111
+ DueDate: NullableDateSchema,
112
112
 
113
113
  // Map "IsUrgent" -> boolean
114
114
  IsUrgent: CheckboxSchema,
@@ -146,42 +146,58 @@ const tasks = v.parse(TaskListSchema, results);
146
146
 
147
147
  > 📚 **For complete API documentation, including all available schemas and types, please visit the [JSR Documentation](https://jsr.io/@nakanoaas/notion-valibot-schema/doc).**
148
148
 
149
- | Notion Property | Schema | Transformed Output (Type) |
149
+ | Notion Property | Schema | Output Type |
150
150
  | :--- | :--- | :--- |
151
- | **Text** / Title | `TitleSchema` / `RichTextSchema` / `NullableTitleSchema` / `NullableRichTextSchema` | `string` / `string \| null` |
151
+ | **Text** / Title | `TitleSchema` / `NullableTitleSchema` | `string` / `string \| null` |
152
+ | **Rich Text** | `RichTextSchema` / `NullableRichTextSchema` | `string` / `string \| null` |
152
153
  | **Number** | `NumberSchema` / `NullableNumberSchema` | `number` / `number \| null` |
153
154
  | **Checkbox** | `CheckboxSchema` | `boolean` |
154
- | **Select** | `SelectSchema(schema)` | `Inferred<schema>` |
155
+ | **Select** | `SelectSchema(schema)` / `NullableSelectSchema(schema)` | `Inferred<schema>` / `Inferred<schema> \| null` |
155
156
  | **Multi-Select** | `MultiSelectSchema(schema)` | `Inferred<schema>[]` |
156
- | **Status** | `StatusSchema(schema)` | `Inferred<schema>` |
157
- | **Date** (Single) | `SingleDateSchema` / `NullableSingleDateSchema` | `Date` / `Date \| null` |
158
- | **Date** (Range) | `RangeDateSchema` / `NullableRangeDateSchema` | `{ start: Date; end: Date; time_zone: string \| null }` / `{ start: Date; end: Date; time_zone: string \| null } \| null` |
159
- | **Date** (Full) | `FullDateSchema` / `NullableFullDateSchema` | `{ start: Date; end: Date \| null; time_zone: string \| null }` / `{ start: Date; end: Date \| null; time_zone: string \| null } \| null` |
160
- | **Relation** | `RelationSchema` | `string[]` (Page IDs) |
161
- | **Relation** (Single) | `SingleRelationSchema` | `string` (Page ID) |
162
- | **Rollup** (Simple) | `RollupSimpleSchema(schema)` | `Inferred<schema>` |
163
- | **Rollup** (Array) | `RollupArraySchema(schema)` | `Inferred<schema>[]` |
164
- | **Rollup** (Single) | `SingleRollupArraySchema(schema)` | `Inferred<schema>` |
165
- | **Rollup** (Single, Nullable) | `NullableSingleRollupArraySchema(schema)` | `Inferred<schema> \| null` |
157
+ | **Status** | `StatusSchema(schema)` / `NullableStatusSchema(schema)` | `Inferred<schema>` / `Inferred<schema> \| null` |
158
+ | **Date** | `DateSchema` / `NullableDateSchema` | `Date` / `Date \| null` |
159
+ | **Date** (full object) | `FullDateSchema` / `NullableFullDateSchema` | `{ start: Date; end: Date \| null; time_zone: string \| null }` / same `\| null` |
160
+ | **Date** (range, end required) | `DateRangeSchema` / `NullableDateRangeSchema` | `{ start: Date; end: Date; time_zone: string \| null }` / same `\| null` |
161
+ | **Relation** | `RelationSchema` / `SingleRelationSchema` / `NullableSingleRelationSchema` | `string[]` / `string` / `string \| null` |
162
+ | **Rollup** (array) | `RollupSchema(schema)` | `Inferred<schema>[]` |
163
+ | **Rollup** (array, single) | `SingleRollupSchema(schema)` / `NullableSingleRollupSchema(schema)` | `Inferred<schema>` / `Inferred<schema> \| null` |
164
+ | **Rollup** (scalar) | `RollupScalarSchema(schema)` | `Inferred<schema>` |
166
165
  | **Formula** | `FormulaSchema(schema)` | `Inferred<schema>` |
167
- | **URL** | `UrlSchema` | `string` |
168
- | **Email** | `EmailSchema` | `string` |
169
- | **Phone** | `PhoneNumberSchema` | `string` |
170
- | **Files** | `FileSchema` | `string[]` (URLs) |
171
- | **Files** (Single) | `SingleFileSchema` / `NullableSingleFileSchema` | `string` (URL) / `string \| null` |
166
+ | **URL** | `UrlSchema` / `NullableUrlSchema` | `string` / `string \| null` |
167
+ | **Email** | `EmailSchema` / `NullableEmailSchema` | `string` / `string \| null` |
168
+ | **Phone** | `PhoneNumberSchema` / `NullablePhoneNumberSchema` | `string` / `string \| null` |
169
+ | **Files** | `FilesSchema` / `SingleFileSchema` / `NullableSingleFileSchema` | `string[]` / `string` / `string \| null` |
172
170
  | **People** (building blocks) | `UserOrGroupIdSchema` / `UserOrGroupSchema` / `UserSchema` / `PersonSchema` / `BotSchema` | Building-block object types |
173
171
  | **People** (generic) | `PeopleSchema(schema)` / `SinglePeopleSchema(schema)` / `NullableSinglePeopleSchema(schema)` | `Inferred<schema>[]` / `Inferred<schema>` / `Inferred<schema> \| null` |
174
- | **People** (convenience) | `PeopleIdSchema` / `SinglePeopleIdSchema` / `NullableSinglePeopleIdSchema` | `string[]` / `string` / `string \| null` |
175
- | **Created/Edited By** (generic) | `CreatedBySchema(schema)` / `LastEditedBySchema(schema)` | `Inferred<schema>` |
176
- | **Created/Edited By** (convenience) | `CreatedByIdSchema` / `NullableCreatedByNameSchema` / `LastEditedByIdSchema` / `NullableLastEditedByNameSchema` | `string` / `string \| null` |
177
- | **Created/Edited Time**| `CreatedTimeSchema` / `LastEditedTimeSchema` | `Date` |
178
- | **Place** | `PlaceSchema` / `NullablePlaceSchema` | `{ lat: number; lon: number; name?: string \| null; address?: string \| null }` / `{ lat: number; lon: number; name?: string \| null; address?: string \| null } \| null` |
179
- | **Unique ID** | `UniqueIdNumberSchema` / `PrefixedUniqueIdStringSchema` / `NullableUniqueIdSchema` | `number` / `string` (e.g. `"PREFIX-123"`) / `{ prefix: string \| null; number: number \| null }` |
180
- | **Verification** | `VerificationSchema` / `NullableVerificationSchema` | `{ state: "unverified" \| "verified" \| "expired"; date: DateObject \| null; verified_by: { id: string; object: "user"; name: string \| null; avatar_url: string \| null } \| null }` / same \| `null` |
172
+ | **People** (IDs only) | `PeopleIdSchema` / `SinglePeopleIdSchema` / `NullableSinglePeopleIdSchema` | `string[]` / `string` / `string \| null` |
173
+ | **Created By** | `CreatedBySchema(schema)` / `CreatedByIdSchema` / `NullableCreatedByNameSchema` | `Inferred<schema>` / `string` / `string \| null` |
174
+ | **Last Edited By** | `LastEditedBySchema(schema)` / `LastEditedByIdSchema` / `NullableLastEditedByNameSchema` | `Inferred<schema>` / `string` / `string \| null` |
175
+ | **Created / Edited Time** | `CreatedTimeSchema` / `LastEditedTimeSchema` | `Date` |
176
+ | **Place** | `PlaceSchema` / `NullablePlaceSchema` | `{ lat: number; lon: number; name?: string \| null; address?: string \| null }` / same `\| null` |
177
+ | **Unique ID** | `UniqueIdSchema` / `PrefixedUniqueIdSchema` / `FullUniqueIdSchema` | `number` / `string` (e.g. `"PREFIX-123"`) / `{ prefix: string \| null; number: number \| null }` |
178
+ | **Verification** | `VerificationSchema` / `NullableVerificationSchema` | `{ state: "unverified" \| "verified" \| "expired"; date: DateObject \| null; verified_by: UserObject \| null }` / same `\| null` |
181
179
 
182
180
  ### Advanced Schemas
183
181
 
182
+ #### Date variants
183
+
184
+ The Date property has three levels of detail depending on how much you need:
185
+
186
+ ```ts
187
+ import {
188
+ DateSchema, // start only → Date
189
+ NullableDateSchema, // start only → Date | null
190
+
191
+ FullDateSchema, // start + optional end → { start: Date; end: Date | null; time_zone }
192
+ NullableFullDateSchema, // → same | null
193
+
194
+ DateRangeSchema, // start + required end → { start: Date; end: Date; time_zone }
195
+ NullableDateRangeSchema, // → same | null
196
+ } from "@nakanoaas/notion-valibot-schema";
197
+ ```
198
+
184
199
  #### Formulas
200
+
185
201
  Formulas in Notion can return different types (string, number, boolean, date). Use `FormulaSchema` with the matching inner schema for each formula property.
186
202
 
187
203
  ```ts
@@ -190,56 +206,55 @@ import {
190
206
  BooleanFormulaSchema,
191
207
  FormulaSchema,
192
208
  NumberSchema,
193
- SingleDateSchema,
209
+ DateSchema,
194
210
  StringFormulaSchema,
195
211
  } from "@nakanoaas/notion-valibot-schema";
196
212
 
197
213
  const PageSchema = v.object({
198
214
  id: v.string(),
199
215
  properties: v.object({
200
- FormulaText: FormulaSchema(StringFormulaSchema),
201
- FormulaNumber: FormulaSchema(NumberSchema),
216
+ FormulaText: FormulaSchema(StringFormulaSchema),
217
+ FormulaNumber: FormulaSchema(NumberSchema),
202
218
  FormulaBoolean: FormulaSchema(BooleanFormulaSchema),
203
- FormulaDate: FormulaSchema(SingleDateSchema),
219
+ FormulaDate: FormulaSchema(DateSchema),
204
220
  }),
205
221
  });
206
222
 
207
223
  const page = await notion.pages.retrieve({ page_id: "..." });
208
224
  const parsed = v.parse(PageSchema, page);
209
- // parsed.properties.FormulaText: string
210
- // parsed.properties.FormulaNumber: number
225
+ // parsed.properties.FormulaText: string
226
+ // parsed.properties.FormulaNumber: number
211
227
  // parsed.properties.FormulaBoolean: boolean
212
- // parsed.properties.FormulaDate: Date
228
+ // parsed.properties.FormulaDate: Date
213
229
  ```
214
230
 
215
231
  #### Rollups
216
- Rollups are powerful but complex. We provide helpers for common rollup types.
217
232
 
218
233
  ```ts
219
- import {
220
- RollupSimpleSchema,
221
- RollupArraySchema,
222
- SingleRollupArraySchema,
223
- NullableSingleRollupArraySchema,
234
+ import {
235
+ RollupSchema, // array rollup → Inferred<schema>[]
236
+ SingleRollupSchema, // array rollup, first item → Inferred<schema>
237
+ NullableSingleRollupSchema, // array rollup, first item or null → Inferred<schema> | null
238
+ RollupScalarSchema, // scalar rollup (number / date) → Inferred<schema>
224
239
  NumberSchema,
225
- SingleDateSchema,
240
+ DateSchema,
226
241
  } from "@nakanoaas/notion-valibot-schema";
227
242
 
228
243
  const MySchema = v.object({
229
244
  // Sum/Average rollup (returns number)
230
- TotalCost: RollupSimpleSchema(NumberSchema),
231
-
245
+ TotalCost: RollupScalarSchema(NumberSchema),
246
+
232
247
  // Date rollup (returns Date)
233
- LatestMeeting: RollupSimpleSchema(SingleDateSchema),
234
-
248
+ LatestMeeting: RollupScalarSchema(DateSchema),
249
+
235
250
  // Array rollup (e.g., pulling tags from related items)
236
- AllTags: RollupArraySchema(v.string()),
237
-
251
+ AllTags: RollupSchema(v.string()),
252
+
238
253
  // Single-element array rollup (returns the one item, not an array)
239
- PrimaryTag: SingleRollupArraySchema(v.string()),
240
-
254
+ PrimaryTag: SingleRollupSchema(v.string()),
255
+
241
256
  // Single-element or empty array rollup (returns item or null)
242
- OptionalPrimaryTag: NullableSingleRollupArraySchema(v.string()),
257
+ OptionalPrimaryTag: NullableSingleRollupSchema(v.string()),
243
258
  });
244
259
  ```
245
260
 
@@ -259,7 +274,6 @@ import {
259
274
  PeopleIdSchema,
260
275
  PeopleSchema,
261
276
  PersonSchema,
262
- UserOrGroupSchema,
263
277
  UserSchema,
264
278
  } from "@nakanoaas/notion-valibot-schema";
265
279
 
@@ -269,29 +283,27 @@ const PageSchema = v.object({
269
283
  // Full person details
270
284
  People: PeopleSchema(PersonSchema),
271
285
 
272
- // IDs only (no generic needed)
286
+ // IDs only
273
287
  AssigneeIds: PeopleIdSchema,
274
288
 
275
- // created_by ID extraction
289
+ // created_by ID
276
290
  CreatedById: CreatedByIdSchema,
277
291
 
278
- // Custom user schema
292
+ // created_by full user object
279
293
  CreatedBy: CreatedBySchema(UserSchema),
280
294
  }),
281
295
  });
282
296
  ```
283
297
 
284
- ### Migration Guide (Breaking Changes)
285
-
286
- The following schemas changed from constants to generic factories:
298
+ #### Unique ID
287
299
 
288
- | Before | After |
289
- | :--- | :--- |
290
- | `PeopleSchema` | `PeopleSchema(UserOrGroupSchema)` or `PeopleSchema(PersonSchema)` |
291
- | `CreatedBySchema` | `CreatedBySchema(UserOrGroupSchema)` |
292
- | `LastEditedBySchema` | `LastEditedBySchema(UserOrGroupSchema)` |
293
-
294
- For ID-only extraction, use the convenience schemas instead: `PeopleIdSchema`, `CreatedByIdSchema`, `LastEditedByIdSchema`.
300
+ ```ts
301
+ import {
302
+ UniqueIdSchema, // → number (e.g. 123)
303
+ PrefixedUniqueIdSchema, // → string (e.g. "TASK-123"; requires prefix to be non-null)
304
+ FullUniqueIdSchema, // → { prefix: string | null; number: number | null }
305
+ } from "@nakanoaas/notion-valibot-schema";
306
+ ```
295
307
 
296
308
  ## License
297
309
 
package/dist/date.cjs CHANGED
@@ -96,12 +96,12 @@ const DateRangeObjectSchema = valibot.object({
96
96
  * @example
97
97
  * ```ts
98
98
  * import * as v from "valibot";
99
- * import { NullableSingleDateSchema } from "@nakanoaas/notion-valibot-utils";
99
+ * import { NullableDateSchema } from "@nakanoaas/notion-valibot-utils";
100
100
  *
101
101
  * const PageSchema = v.object({
102
102
  * id: v.string(),
103
103
  * properties: v.object({
104
- * Date: NullableSingleDateSchema,
104
+ * Date: NullableDateSchema,
105
105
  * }),
106
106
  * });
107
107
  *
@@ -110,7 +110,7 @@ const DateRangeObjectSchema = valibot.object({
110
110
  * // parsed.properties.Date: Date | null
111
111
  * ```
112
112
  */
113
- const NullableSingleDateSchema = valibot.pipe(valibot.object({ date: valibot.nullable(DateObjectSchema) }), valibot.transform((v) => v.date?.start ? new Date(v.date.start) : null));
113
+ const NullableDateSchema = valibot.pipe(valibot.object({ date: valibot.nullable(DateObjectSchema) }), valibot.transform((v) => v.date?.start ? new Date(v.date.start) : null));
114
114
  /**
115
115
  * Schema to extract the `date` property from a Notion page property and transform it to a `Date` object.
116
116
  *
@@ -130,12 +130,12 @@ const NullableSingleDateSchema = valibot.pipe(valibot.object({ date: valibot.nul
130
130
  * @example
131
131
  * ```ts
132
132
  * import * as v from "valibot";
133
- * import { SingleDateSchema } from "@nakanoaas/notion-valibot-utils";
133
+ * import { DateSchema } from "@nakanoaas/notion-valibot-utils";
134
134
  *
135
135
  * const PageSchema = v.object({
136
136
  * id: v.string(),
137
137
  * properties: v.object({
138
- * Date: SingleDateSchema,
138
+ * Date: DateSchema,
139
139
  * }),
140
140
  * });
141
141
  *
@@ -144,7 +144,7 @@ const NullableSingleDateSchema = valibot.pipe(valibot.object({ date: valibot.nul
144
144
  * // parsed.properties.Date: Date
145
145
  * ```
146
146
  */
147
- const SingleDateSchema = valibot.pipe(valibot.object({ date: DateObjectSchema }), valibot.transform((v) => new Date(v.date.start)));
147
+ const DateSchema = valibot.pipe(valibot.object({ date: DateObjectSchema }), valibot.transform((v) => new Date(v.date.start)));
148
148
  /**
149
149
  * Schema to extract the `date` property from a Notion page property and transform it to a date range object or `null`.
150
150
  * Requires both start and end dates.
@@ -172,12 +172,12 @@ const SingleDateSchema = valibot.pipe(valibot.object({ date: DateObjectSchema })
172
172
  * @example
173
173
  * ```ts
174
174
  * import * as v from "valibot";
175
- * import { NullableRangeDateSchema } from "@nakanoaas/notion-valibot-utils";
175
+ * import { NullableDateRangeSchema } from "@nakanoaas/notion-valibot-utils";
176
176
  *
177
177
  * const PageSchema = v.object({
178
178
  * id: v.string(),
179
179
  * properties: v.object({
180
- * DateRange: NullableRangeDateSchema,
180
+ * DateRange: NullableDateRangeSchema,
181
181
  * }),
182
182
  * });
183
183
  *
@@ -186,7 +186,7 @@ const SingleDateSchema = valibot.pipe(valibot.object({ date: DateObjectSchema })
186
186
  * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null } | null
187
187
  * ```
188
188
  */
189
- const NullableRangeDateSchema = valibot.pipe(valibot.object({ date: valibot.nullable(DateRangeObjectSchema) }), valibot.transform((v) => v.date ? {
189
+ const NullableDateRangeSchema = valibot.pipe(valibot.object({ date: valibot.nullable(DateRangeObjectSchema) }), valibot.transform((v) => v.date ? {
190
190
  start: new Date(v.date.start),
191
191
  end: new Date(v.date.end),
192
192
  time_zone: v.date.time_zone
@@ -218,12 +218,12 @@ const NullableRangeDateSchema = valibot.pipe(valibot.object({ date: valibot.null
218
218
  * @example
219
219
  * ```ts
220
220
  * import * as v from "valibot";
221
- * import { RangeDateSchema } from "@nakanoaas/notion-valibot-utils";
221
+ * import { DateRangeSchema } from "@nakanoaas/notion-valibot-utils";
222
222
  *
223
223
  * const PageSchema = v.object({
224
224
  * id: v.string(),
225
225
  * properties: v.object({
226
- * DateRange: RangeDateSchema,
226
+ * DateRange: DateRangeSchema,
227
227
  * }),
228
228
  * });
229
229
  *
@@ -232,7 +232,7 @@ const NullableRangeDateSchema = valibot.pipe(valibot.object({ date: valibot.null
232
232
  * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null }
233
233
  * ```
234
234
  */
235
- const RangeDateSchema = valibot.pipe(valibot.object({ date: DateRangeObjectSchema }), valibot.transform((v) => ({
235
+ const DateRangeSchema = valibot.pipe(valibot.object({ date: DateRangeObjectSchema }), valibot.transform((v) => ({
236
236
  start: new Date(v.date.start),
237
237
  end: new Date(v.date.end),
238
238
  time_zone: v.date.time_zone
@@ -331,11 +331,11 @@ const FullDateSchema = valibot.pipe(valibot.object({ date: DateObjectSchema }),
331
331
  })));
332
332
  //#endregion
333
333
  exports.DateObjectSchema = DateObjectSchema;
334
+ exports.DateRangeSchema = DateRangeSchema;
335
+ exports.DateSchema = DateSchema;
334
336
  exports.FullDateSchema = FullDateSchema;
337
+ exports.NullableDateRangeSchema = NullableDateRangeSchema;
338
+ exports.NullableDateSchema = NullableDateSchema;
335
339
  exports.NullableFullDateSchema = NullableFullDateSchema;
336
- exports.NullableRangeDateSchema = NullableRangeDateSchema;
337
- exports.NullableSingleDateSchema = NullableSingleDateSchema;
338
- exports.RangeDateSchema = RangeDateSchema;
339
- exports.SingleDateSchema = SingleDateSchema;
340
340
 
341
341
  //# sourceMappingURL=date.cjs.map
package/dist/date.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"date.cjs","names":["v"],"sources":["../src/date.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion date object structure.\n *\n * **Input:**\n * ```\n * {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { DateObjectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Date: v.object({\n * date: DateObjectSchema,\n * }),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Date.date: { start: string; end: string | null; time_zone: string | null }\n * ```\n *\n * @internal\n */\nexport const DateObjectSchema = v.object({\n\tstart: v.string(),\n\tend: v.nullable(v.string()),\n\ttime_zone: v.nullable(v.string()),\n});\n\n/**\n * Schema for a Notion date object structure with required end date.\n *\n * **Input:**\n * ```\n * {\n * start: string;\n * end: string;\n * time_zone: string | null;\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: string;\n * end: string;\n * time_zone: string | null;\n * }\n * ```\n *\n * @internal\n */\nconst DateRangeObjectSchema = v.object({\n\tstart: v.string(),\n\tend: v.string(),\n\ttime_zone: v.nullable(v.string()),\n});\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a `Date` object or `null`.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * } | null\n * }\n * ```\n *\n * **Output:** `Date | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSingleDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Date: NullableSingleDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Date: Date | null\n * ```\n */\nexport const NullableSingleDateSchema = v.pipe(\n\tv.object({\n\t\tdate: v.nullable(DateObjectSchema),\n\t}),\n\tv.transform((v) => (v.date?.start ? new Date(v.date.start) : null)),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a `Date` object.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * }\n * }\n * ```\n *\n * **Output:** `Date`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SingleDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Date: SingleDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Date: Date\n * ```\n */\nexport const SingleDateSchema = v.pipe(\n\tv.object({\n\t\tdate: DateObjectSchema,\n\t}),\n\tv.transform((v) => new Date(v.date.start)),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a date range object or `null`.\n * Requires both start and end dates.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string;\n * time_zone: string | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: Date;\n * end: Date;\n * time_zone: string | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableRangeDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * DateRange: NullableRangeDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null } | null\n * ```\n */\nexport const NullableRangeDateSchema = v.pipe(\n\tv.object({\n\t\tdate: v.nullable(DateRangeObjectSchema),\n\t}),\n\tv.transform((v) =>\n\t\tv.date\n\t\t\t? {\n\t\t\t\t\tstart: new Date(v.date.start),\n\t\t\t\t\tend: new Date(v.date.end),\n\t\t\t\t\ttime_zone: v.date.time_zone,\n\t\t\t\t}\n\t\t\t: null,\n\t),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a date range object.\n * Requires both start and end dates.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string;\n * time_zone: string | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: Date;\n * end: Date;\n * time_zone: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { RangeDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * DateRange: RangeDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null }\n * ```\n */\nexport const RangeDateSchema = v.pipe(\n\tv.object({\n\t\tdate: DateRangeObjectSchema,\n\t}),\n\tv.transform((v) => ({\n\t\tstart: new Date(v.date.start),\n\t\tend: new Date(v.date.end),\n\t\ttime_zone: v.date.time_zone,\n\t})),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a date range object or `null`.\n * End date is optional.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: Date;\n * end: Date | null;\n * time_zone: string | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableFullDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * DateRange: NullableFullDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.DateRange: { start: Date; end: Date | null; time_zone: string | null } | null\n * ```\n */\nexport const NullableFullDateSchema = v.pipe(\n\tv.object({\n\t\tdate: v.nullable(DateObjectSchema),\n\t}),\n\tv.transform((v) =>\n\t\tv.date\n\t\t\t? {\n\t\t\t\t\tstart: new Date(v.date.start),\n\t\t\t\t\tend: v.date.end ? new Date(v.date.end) : null,\n\t\t\t\t\ttime_zone: v.date.time_zone,\n\t\t\t\t}\n\t\t\t: null,\n\t),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a date range object.\n * End date is optional.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: Date;\n * end: Date | null;\n * time_zone: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { FullDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * DateRange: FullDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.DateRange: { start: Date; end: Date | null; time_zone: string | null }\n * ```\n */\nexport const FullDateSchema = v.pipe(\n\tv.object({\n\t\tdate: DateObjectSchema,\n\t}),\n\tv.transform((v) => ({\n\t\tstart: new Date(v.date.start),\n\t\tend: v.date.end ? new Date(v.date.end) : null,\n\t\ttime_zone: v.date.time_zone,\n\t})),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,mBAAmBA,QAAE,OAAO;CACxC,OAAOA,QAAE,OAAO;CAChB,KAAKA,QAAE,SAASA,QAAE,OAAO,CAAC;CAC1B,WAAWA,QAAE,SAASA,QAAE,OAAO,CAAC;AACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAyBD,MAAM,wBAAwBA,QAAE,OAAO;CACtC,OAAOA,QAAE,OAAO;CAChB,KAAKA,QAAE,OAAO;CACd,WAAWA,QAAE,SAASA,QAAE,OAAO,CAAC;AACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,2BAA2BA,QAAE,KACzCA,QAAE,OAAO,EACR,MAAMA,QAAE,SAAS,gBAAgB,EAClC,CAAC,GACDA,QAAE,WAAW,MAAO,EAAE,MAAM,QAAQ,IAAI,KAAK,EAAE,KAAK,KAAK,IAAI,IAAK,CACnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,mBAAmBA,QAAE,KACjCA,QAAE,OAAO,EACR,MAAM,iBACP,CAAC,GACDA,QAAE,WAAW,MAAM,IAAI,KAAK,EAAE,KAAK,KAAK,CAAC,CAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,0BAA0BA,QAAE,KACxCA,QAAE,OAAO,EACR,MAAMA,QAAE,SAAS,qBAAqB,EACvC,CAAC,GACDA,QAAE,WAAW,MACZ,EAAE,OACC;CACA,OAAO,IAAI,KAAK,EAAE,KAAK,KAAK;CAC5B,KAAK,IAAI,KAAK,EAAE,KAAK,GAAG;CACxB,WAAW,EAAE,KAAK;AACnB,IACC,IACJ,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,kBAAkBA,QAAE,KAChCA,QAAE,OAAO,EACR,MAAM,sBACP,CAAC,GACDA,QAAE,WAAW,OAAO;CACnB,OAAO,IAAI,KAAK,EAAE,KAAK,KAAK;CAC5B,KAAK,IAAI,KAAK,EAAE,KAAK,GAAG;CACxB,WAAW,EAAE,KAAK;AACnB,EAAE,CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,yBAAyBA,QAAE,KACvCA,QAAE,OAAO,EACR,MAAMA,QAAE,SAAS,gBAAgB,EAClC,CAAC,GACDA,QAAE,WAAW,MACZ,EAAE,OACC;CACA,OAAO,IAAI,KAAK,EAAE,KAAK,KAAK;CAC5B,KAAK,EAAE,KAAK,MAAM,IAAI,KAAK,EAAE,KAAK,GAAG,IAAI;CACzC,WAAW,EAAE,KAAK;AACnB,IACC,IACJ,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,iBAAiBA,QAAE,KAC/BA,QAAE,OAAO,EACR,MAAM,iBACP,CAAC,GACDA,QAAE,WAAW,OAAO;CACnB,OAAO,IAAI,KAAK,EAAE,KAAK,KAAK;CAC5B,KAAK,EAAE,KAAK,MAAM,IAAI,KAAK,EAAE,KAAK,GAAG,IAAI;CACzC,WAAW,EAAE,KAAK;AACnB,EAAE,CACH"}
1
+ {"version":3,"file":"date.cjs","names":["v"],"sources":["../src/date.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion date object structure.\n *\n * **Input:**\n * ```\n * {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { DateObjectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Date: v.object({\n * date: DateObjectSchema,\n * }),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Date.date: { start: string; end: string | null; time_zone: string | null }\n * ```\n *\n * @internal\n */\nexport const DateObjectSchema = v.object({\n\tstart: v.string(),\n\tend: v.nullable(v.string()),\n\ttime_zone: v.nullable(v.string()),\n});\n\n/**\n * Schema for a Notion date object structure with required end date.\n *\n * **Input:**\n * ```\n * {\n * start: string;\n * end: string;\n * time_zone: string | null;\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: string;\n * end: string;\n * time_zone: string | null;\n * }\n * ```\n *\n * @internal\n */\nconst DateRangeObjectSchema = v.object({\n\tstart: v.string(),\n\tend: v.string(),\n\ttime_zone: v.nullable(v.string()),\n});\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a `Date` object or `null`.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * } | null\n * }\n * ```\n *\n * **Output:** `Date | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Date: NullableDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Date: Date | null\n * ```\n */\nexport const NullableDateSchema = v.pipe(\n\tv.object({\n\t\tdate: v.nullable(DateObjectSchema),\n\t}),\n\tv.transform((v) => (v.date?.start ? new Date(v.date.start) : null)),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a `Date` object.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * }\n * }\n * ```\n *\n * **Output:** `Date`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { DateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Date: DateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Date: Date\n * ```\n */\nexport const DateSchema = v.pipe(\n\tv.object({\n\t\tdate: DateObjectSchema,\n\t}),\n\tv.transform((v) => new Date(v.date.start)),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a date range object or `null`.\n * Requires both start and end dates.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string;\n * time_zone: string | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: Date;\n * end: Date;\n * time_zone: string | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableDateRangeSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * DateRange: NullableDateRangeSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null } | null\n * ```\n */\nexport const NullableDateRangeSchema = v.pipe(\n\tv.object({\n\t\tdate: v.nullable(DateRangeObjectSchema),\n\t}),\n\tv.transform((v) =>\n\t\tv.date\n\t\t\t? {\n\t\t\t\t\tstart: new Date(v.date.start),\n\t\t\t\t\tend: new Date(v.date.end),\n\t\t\t\t\ttime_zone: v.date.time_zone,\n\t\t\t\t}\n\t\t\t: null,\n\t),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a date range object.\n * Requires both start and end dates.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string;\n * time_zone: string | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: Date;\n * end: Date;\n * time_zone: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { DateRangeSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * DateRange: DateRangeSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null }\n * ```\n */\nexport const DateRangeSchema = v.pipe(\n\tv.object({\n\t\tdate: DateRangeObjectSchema,\n\t}),\n\tv.transform((v) => ({\n\t\tstart: new Date(v.date.start),\n\t\tend: new Date(v.date.end),\n\t\ttime_zone: v.date.time_zone,\n\t})),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a date range object or `null`.\n * End date is optional.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: Date;\n * end: Date | null;\n * time_zone: string | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableFullDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * DateRange: NullableFullDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.DateRange: { start: Date; end: Date | null; time_zone: string | null } | null\n * ```\n */\nexport const NullableFullDateSchema = v.pipe(\n\tv.object({\n\t\tdate: v.nullable(DateObjectSchema),\n\t}),\n\tv.transform((v) =>\n\t\tv.date\n\t\t\t? {\n\t\t\t\t\tstart: new Date(v.date.start),\n\t\t\t\t\tend: v.date.end ? new Date(v.date.end) : null,\n\t\t\t\t\ttime_zone: v.date.time_zone,\n\t\t\t\t}\n\t\t\t: null,\n\t),\n);\n\n/**\n * Schema to extract the `date` property from a Notion page property and transform it to a date range object.\n * End date is optional.\n *\n * **Input:**\n * ```\n * {\n * date: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * start: Date;\n * end: Date | null;\n * time_zone: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { FullDateSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * DateRange: FullDateSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.DateRange: { start: Date; end: Date | null; time_zone: string | null }\n * ```\n */\nexport const FullDateSchema = v.pipe(\n\tv.object({\n\t\tdate: DateObjectSchema,\n\t}),\n\tv.transform((v) => ({\n\t\tstart: new Date(v.date.start),\n\t\tend: v.date.end ? new Date(v.date.end) : null,\n\t\ttime_zone: v.date.time_zone,\n\t})),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,mBAAmBA,QAAE,OAAO;CACxC,OAAOA,QAAE,OAAO;CAChB,KAAKA,QAAE,SAASA,QAAE,OAAO,CAAC;CAC1B,WAAWA,QAAE,SAASA,QAAE,OAAO,CAAC;AACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAyBD,MAAM,wBAAwBA,QAAE,OAAO;CACtC,OAAOA,QAAE,OAAO;CAChB,KAAKA,QAAE,OAAO;CACd,WAAWA,QAAE,SAASA,QAAE,OAAO,CAAC;AACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,qBAAqBA,QAAE,KACnCA,QAAE,OAAO,EACR,MAAMA,QAAE,SAAS,gBAAgB,EAClC,CAAC,GACDA,QAAE,WAAW,MAAO,EAAE,MAAM,QAAQ,IAAI,KAAK,EAAE,KAAK,KAAK,IAAI,IAAK,CACnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,aAAaA,QAAE,KAC3BA,QAAE,OAAO,EACR,MAAM,iBACP,CAAC,GACDA,QAAE,WAAW,MAAM,IAAI,KAAK,EAAE,KAAK,KAAK,CAAC,CAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,0BAA0BA,QAAE,KACxCA,QAAE,OAAO,EACR,MAAMA,QAAE,SAAS,qBAAqB,EACvC,CAAC,GACDA,QAAE,WAAW,MACZ,EAAE,OACC;CACA,OAAO,IAAI,KAAK,EAAE,KAAK,KAAK;CAC5B,KAAK,IAAI,KAAK,EAAE,KAAK,GAAG;CACxB,WAAW,EAAE,KAAK;AACnB,IACC,IACJ,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,kBAAkBA,QAAE,KAChCA,QAAE,OAAO,EACR,MAAM,sBACP,CAAC,GACDA,QAAE,WAAW,OAAO;CACnB,OAAO,IAAI,KAAK,EAAE,KAAK,KAAK;CAC5B,KAAK,IAAI,KAAK,EAAE,KAAK,GAAG;CACxB,WAAW,EAAE,KAAK;AACnB,EAAE,CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,yBAAyBA,QAAE,KACvCA,QAAE,OAAO,EACR,MAAMA,QAAE,SAAS,gBAAgB,EAClC,CAAC,GACDA,QAAE,WAAW,MACZ,EAAE,OACC;CACA,OAAO,IAAI,KAAK,EAAE,KAAK,KAAK;CAC5B,KAAK,EAAE,KAAK,MAAM,IAAI,KAAK,EAAE,KAAK,GAAG,IAAI;CACzC,WAAW,EAAE,KAAK;AACnB,IACC,IACJ,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,iBAAiBA,QAAE,KAC/BA,QAAE,OAAO,EACR,MAAM,iBACP,CAAC,GACDA,QAAE,WAAW,OAAO;CACnB,OAAO,IAAI,KAAK,EAAE,KAAK,KAAK;CAC5B,KAAK,EAAE,KAAK,MAAM,IAAI,KAAK,EAAE,KAAK,GAAG,IAAI;CACzC,WAAW,EAAE,KAAK;AACnB,EAAE,CACH"}
package/dist/date.d.cts CHANGED
@@ -67,12 +67,12 @@ declare const DateObjectSchema: v.ObjectSchema<{
67
67
  * @example
68
68
  * ```ts
69
69
  * import * as v from "valibot";
70
- * import { NullableSingleDateSchema } from "@nakanoaas/notion-valibot-utils";
70
+ * import { NullableDateSchema } from "@nakanoaas/notion-valibot-utils";
71
71
  *
72
72
  * const PageSchema = v.object({
73
73
  * id: v.string(),
74
74
  * properties: v.object({
75
- * Date: NullableSingleDateSchema,
75
+ * Date: NullableDateSchema,
76
76
  * }),
77
77
  * });
78
78
  *
@@ -81,7 +81,7 @@ declare const DateObjectSchema: v.ObjectSchema<{
81
81
  * // parsed.properties.Date: Date | null
82
82
  * ```
83
83
  */
84
- declare const NullableSingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
84
+ declare const NullableDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
85
85
  readonly date: v.NullableSchema<v.ObjectSchema<{
86
86
  readonly start: v.StringSchema<undefined>;
87
87
  readonly end: v.NullableSchema<v.StringSchema<undefined>, undefined>;
@@ -113,12 +113,12 @@ declare const NullableSingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchem
113
113
  * @example
114
114
  * ```ts
115
115
  * import * as v from "valibot";
116
- * import { SingleDateSchema } from "@nakanoaas/notion-valibot-utils";
116
+ * import { DateSchema } from "@nakanoaas/notion-valibot-utils";
117
117
  *
118
118
  * const PageSchema = v.object({
119
119
  * id: v.string(),
120
120
  * properties: v.object({
121
- * Date: SingleDateSchema,
121
+ * Date: DateSchema,
122
122
  * }),
123
123
  * });
124
124
  *
@@ -127,7 +127,7 @@ declare const NullableSingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchem
127
127
  * // parsed.properties.Date: Date
128
128
  * ```
129
129
  */
130
- declare const SingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
130
+ declare const DateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
131
131
  readonly date: v.ObjectSchema<{
132
132
  readonly start: v.StringSchema<undefined>;
133
133
  readonly end: v.NullableSchema<v.StringSchema<undefined>, undefined>;
@@ -167,12 +167,12 @@ declare const SingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
167
167
  * @example
168
168
  * ```ts
169
169
  * import * as v from "valibot";
170
- * import { NullableRangeDateSchema } from "@nakanoaas/notion-valibot-utils";
170
+ * import { NullableDateRangeSchema } from "@nakanoaas/notion-valibot-utils";
171
171
  *
172
172
  * const PageSchema = v.object({
173
173
  * id: v.string(),
174
174
  * properties: v.object({
175
- * DateRange: NullableRangeDateSchema,
175
+ * DateRange: NullableDateRangeSchema,
176
176
  * }),
177
177
  * });
178
178
  *
@@ -181,7 +181,7 @@ declare const SingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
181
181
  * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null } | null
182
182
  * ```
183
183
  */
184
- declare const NullableRangeDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
184
+ declare const NullableDateRangeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
185
185
  readonly date: v.NullableSchema<v.ObjectSchema<{
186
186
  readonly start: v.StringSchema<undefined>;
187
187
  readonly end: v.StringSchema<undefined>;
@@ -225,12 +225,12 @@ declare const NullableRangeDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
225
225
  * @example
226
226
  * ```ts
227
227
  * import * as v from "valibot";
228
- * import { RangeDateSchema } from "@nakanoaas/notion-valibot-utils";
228
+ * import { DateRangeSchema } from "@nakanoaas/notion-valibot-utils";
229
229
  *
230
230
  * const PageSchema = v.object({
231
231
  * id: v.string(),
232
232
  * properties: v.object({
233
- * DateRange: RangeDateSchema,
233
+ * DateRange: DateRangeSchema,
234
234
  * }),
235
235
  * });
236
236
  *
@@ -239,7 +239,7 @@ declare const NullableRangeDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
239
239
  * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null }
240
240
  * ```
241
241
  */
242
- declare const RangeDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
242
+ declare const DateRangeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
243
243
  readonly date: v.ObjectSchema<{
244
244
  readonly start: v.StringSchema<undefined>;
245
245
  readonly end: v.StringSchema<undefined>;
@@ -373,5 +373,5 @@ declare const FullDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
373
373
  time_zone: string | null;
374
374
  }>]>;
375
375
  //#endregion
376
- export { DateObjectSchema, FullDateSchema, NullableFullDateSchema, NullableRangeDateSchema, NullableSingleDateSchema, RangeDateSchema, SingleDateSchema };
376
+ export { DateObjectSchema, DateRangeSchema, DateSchema, FullDateSchema, NullableDateRangeSchema, NullableDateSchema, NullableFullDateSchema };
377
377
  //# sourceMappingURL=date.d.cts.map
package/dist/date.d.mts CHANGED
@@ -67,12 +67,12 @@ declare const DateObjectSchema: v.ObjectSchema<{
67
67
  * @example
68
68
  * ```ts
69
69
  * import * as v from "valibot";
70
- * import { NullableSingleDateSchema } from "@nakanoaas/notion-valibot-utils";
70
+ * import { NullableDateSchema } from "@nakanoaas/notion-valibot-utils";
71
71
  *
72
72
  * const PageSchema = v.object({
73
73
  * id: v.string(),
74
74
  * properties: v.object({
75
- * Date: NullableSingleDateSchema,
75
+ * Date: NullableDateSchema,
76
76
  * }),
77
77
  * });
78
78
  *
@@ -81,7 +81,7 @@ declare const DateObjectSchema: v.ObjectSchema<{
81
81
  * // parsed.properties.Date: Date | null
82
82
  * ```
83
83
  */
84
- declare const NullableSingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
84
+ declare const NullableDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
85
85
  readonly date: v.NullableSchema<v.ObjectSchema<{
86
86
  readonly start: v.StringSchema<undefined>;
87
87
  readonly end: v.NullableSchema<v.StringSchema<undefined>, undefined>;
@@ -113,12 +113,12 @@ declare const NullableSingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchem
113
113
  * @example
114
114
  * ```ts
115
115
  * import * as v from "valibot";
116
- * import { SingleDateSchema } from "@nakanoaas/notion-valibot-utils";
116
+ * import { DateSchema } from "@nakanoaas/notion-valibot-utils";
117
117
  *
118
118
  * const PageSchema = v.object({
119
119
  * id: v.string(),
120
120
  * properties: v.object({
121
- * Date: SingleDateSchema,
121
+ * Date: DateSchema,
122
122
  * }),
123
123
  * });
124
124
  *
@@ -127,7 +127,7 @@ declare const NullableSingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchem
127
127
  * // parsed.properties.Date: Date
128
128
  * ```
129
129
  */
130
- declare const SingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
130
+ declare const DateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
131
131
  readonly date: v.ObjectSchema<{
132
132
  readonly start: v.StringSchema<undefined>;
133
133
  readonly end: v.NullableSchema<v.StringSchema<undefined>, undefined>;
@@ -167,12 +167,12 @@ declare const SingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
167
167
  * @example
168
168
  * ```ts
169
169
  * import * as v from "valibot";
170
- * import { NullableRangeDateSchema } from "@nakanoaas/notion-valibot-utils";
170
+ * import { NullableDateRangeSchema } from "@nakanoaas/notion-valibot-utils";
171
171
  *
172
172
  * const PageSchema = v.object({
173
173
  * id: v.string(),
174
174
  * properties: v.object({
175
- * DateRange: NullableRangeDateSchema,
175
+ * DateRange: NullableDateRangeSchema,
176
176
  * }),
177
177
  * });
178
178
  *
@@ -181,7 +181,7 @@ declare const SingleDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
181
181
  * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null } | null
182
182
  * ```
183
183
  */
184
- declare const NullableRangeDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
184
+ declare const NullableDateRangeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
185
185
  readonly date: v.NullableSchema<v.ObjectSchema<{
186
186
  readonly start: v.StringSchema<undefined>;
187
187
  readonly end: v.StringSchema<undefined>;
@@ -225,12 +225,12 @@ declare const NullableRangeDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
225
225
  * @example
226
226
  * ```ts
227
227
  * import * as v from "valibot";
228
- * import { RangeDateSchema } from "@nakanoaas/notion-valibot-utils";
228
+ * import { DateRangeSchema } from "@nakanoaas/notion-valibot-utils";
229
229
  *
230
230
  * const PageSchema = v.object({
231
231
  * id: v.string(),
232
232
  * properties: v.object({
233
- * DateRange: RangeDateSchema,
233
+ * DateRange: DateRangeSchema,
234
234
  * }),
235
235
  * });
236
236
  *
@@ -239,7 +239,7 @@ declare const NullableRangeDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
239
239
  * // parsed.properties.DateRange: { start: Date; end: Date; time_zone: string | null }
240
240
  * ```
241
241
  */
242
- declare const RangeDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
242
+ declare const DateRangeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
243
243
  readonly date: v.ObjectSchema<{
244
244
  readonly start: v.StringSchema<undefined>;
245
245
  readonly end: v.StringSchema<undefined>;
@@ -373,5 +373,5 @@ declare const FullDateSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
373
373
  time_zone: string | null;
374
374
  }>]>;
375
375
  //#endregion
376
- export { DateObjectSchema, FullDateSchema, NullableFullDateSchema, NullableRangeDateSchema, NullableSingleDateSchema, RangeDateSchema, SingleDateSchema };
376
+ export { DateObjectSchema, DateRangeSchema, DateSchema, FullDateSchema, NullableDateRangeSchema, NullableDateSchema, NullableFullDateSchema };
377
377
  //# sourceMappingURL=date.d.mts.map