@nakanoaas/notion-valibot-schema 0.0.3 → 0.0.5

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.
Files changed (138) hide show
  1. package/README.md +26 -24
  2. package/dist/checkbox.cjs +29 -0
  3. package/dist/checkbox.cjs.map +1 -1
  4. package/dist/checkbox.d.cts +30 -0
  5. package/dist/checkbox.d.mts +30 -0
  6. package/dist/checkbox.mjs +29 -0
  7. package/dist/checkbox.mjs.map +1 -1
  8. package/dist/created-by.cjs +75 -0
  9. package/dist/created-by.cjs.map +1 -1
  10. package/dist/created-by.d.cts +76 -0
  11. package/dist/created-by.d.mts +76 -0
  12. package/dist/created-by.mjs +75 -0
  13. package/dist/created-by.mjs.map +1 -1
  14. package/dist/created-time.cjs +27 -0
  15. package/dist/created-time.cjs.map +1 -1
  16. package/dist/created-time.d.cts +28 -0
  17. package/dist/created-time.d.mts +28 -0
  18. package/dist/created-time.mjs +27 -0
  19. package/dist/created-time.mjs.map +1 -1
  20. package/dist/date.cjs +203 -13
  21. package/dist/date.cjs.map +1 -1
  22. package/dist/date.d.cts +214 -6
  23. package/dist/date.d.mts +214 -6
  24. package/dist/date.mjs +201 -12
  25. package/dist/date.mjs.map +1 -1
  26. package/dist/email.cjs +58 -0
  27. package/dist/email.cjs.map +1 -1
  28. package/dist/email.d.cts +59 -0
  29. package/dist/email.d.mts +59 -0
  30. package/dist/email.mjs +58 -0
  31. package/dist/email.mjs.map +1 -1
  32. package/dist/files.cjs +39 -0
  33. package/dist/files.cjs.map +1 -1
  34. package/dist/files.d.cts +40 -0
  35. package/dist/files.d.mts +40 -0
  36. package/dist/files.mjs +39 -0
  37. package/dist/files.mjs.map +1 -1
  38. package/dist/formula.cjs +72 -0
  39. package/dist/formula.cjs.map +1 -1
  40. package/dist/formula.d.cts +73 -0
  41. package/dist/formula.d.mts +73 -0
  42. package/dist/formula.mjs +72 -0
  43. package/dist/formula.mjs.map +1 -1
  44. package/dist/index.cjs +7 -3
  45. package/dist/index.d.cts +4 -4
  46. package/dist/index.d.mts +4 -4
  47. package/dist/index.mjs +4 -4
  48. package/dist/last-edited-by.cjs +68 -0
  49. package/dist/last-edited-by.cjs.map +1 -1
  50. package/dist/last-edited-by.d.cts +69 -0
  51. package/dist/last-edited-by.d.mts +69 -0
  52. package/dist/last-edited-by.mjs +68 -0
  53. package/dist/last-edited-by.mjs.map +1 -1
  54. package/dist/last-edited-time.cjs +27 -0
  55. package/dist/last-edited-time.cjs.map +1 -1
  56. package/dist/last-edited-time.d.cts +28 -0
  57. package/dist/last-edited-time.d.mts +28 -0
  58. package/dist/last-edited-time.mjs +27 -0
  59. package/dist/last-edited-time.mjs.map +1 -1
  60. package/dist/multi-select.cjs +60 -0
  61. package/dist/multi-select.cjs.map +1 -1
  62. package/dist/multi-select.d.cts +61 -0
  63. package/dist/multi-select.d.mts +61 -0
  64. package/dist/multi-select.mjs +60 -0
  65. package/dist/multi-select.mjs.map +1 -1
  66. package/dist/number.cjs +58 -0
  67. package/dist/number.cjs.map +1 -1
  68. package/dist/number.d.cts +59 -0
  69. package/dist/number.d.mts +59 -0
  70. package/dist/number.mjs +58 -0
  71. package/dist/number.mjs.map +1 -1
  72. package/dist/people.cjs +84 -0
  73. package/dist/people.cjs.map +1 -1
  74. package/dist/people.d.cts +85 -0
  75. package/dist/people.d.mts +85 -0
  76. package/dist/people.mjs +84 -0
  77. package/dist/people.mjs.map +1 -1
  78. package/dist/phone-number.cjs +58 -0
  79. package/dist/phone-number.cjs.map +1 -1
  80. package/dist/phone-number.d.cts +59 -0
  81. package/dist/phone-number.d.mts +59 -0
  82. package/dist/phone-number.mjs +58 -0
  83. package/dist/phone-number.mjs.map +1 -1
  84. package/dist/place.cjs +128 -0
  85. package/dist/place.cjs.map +1 -1
  86. package/dist/place.d.cts +85 -0
  87. package/dist/place.d.mts +85 -0
  88. package/dist/place.mjs +128 -0
  89. package/dist/place.mjs.map +1 -1
  90. package/dist/relation.cjs +137 -1
  91. package/dist/relation.cjs.map +1 -1
  92. package/dist/relation.d.cts +113 -1
  93. package/dist/relation.d.mts +113 -1
  94. package/dist/relation.mjs +136 -2
  95. package/dist/relation.mjs.map +1 -1
  96. package/dist/rollup.cjs +203 -10
  97. package/dist/rollup.cjs.map +1 -1
  98. package/dist/rollup.d.cts +201 -0
  99. package/dist/rollup.d.mts +201 -0
  100. package/dist/rollup.mjs +203 -10
  101. package/dist/rollup.mjs.map +1 -1
  102. package/dist/select.cjs +120 -0
  103. package/dist/select.cjs.map +1 -1
  104. package/dist/select.d.cts +121 -0
  105. package/dist/select.d.mts +121 -0
  106. package/dist/select.mjs +120 -0
  107. package/dist/select.mjs.map +1 -1
  108. package/dist/status.cjs +120 -0
  109. package/dist/status.cjs.map +1 -1
  110. package/dist/status.d.cts +121 -0
  111. package/dist/status.d.mts +121 -0
  112. package/dist/status.mjs +120 -0
  113. package/dist/status.mjs.map +1 -1
  114. package/dist/text.cjs +103 -3
  115. package/dist/text.cjs.map +1 -1
  116. package/dist/text.d.cts +73 -10
  117. package/dist/text.d.mts +73 -10
  118. package/dist/text.mjs +103 -3
  119. package/dist/text.mjs.map +1 -1
  120. package/dist/unique-id.cjs +73 -2
  121. package/dist/unique-id.cjs.map +1 -1
  122. package/dist/unique-id.d.cts +81 -2
  123. package/dist/unique-id.d.mts +81 -2
  124. package/dist/unique-id.mjs +72 -2
  125. package/dist/unique-id.mjs.map +1 -1
  126. package/dist/url.cjs +58 -0
  127. package/dist/url.cjs.map +1 -1
  128. package/dist/url.d.cts +59 -0
  129. package/dist/url.d.mts +59 -0
  130. package/dist/url.mjs +58 -0
  131. package/dist/url.mjs.map +1 -1
  132. package/dist/verification.cjs +82 -5
  133. package/dist/verification.cjs.map +1 -1
  134. package/dist/verification.d.cts +81 -0
  135. package/dist/verification.d.mts +81 -0
  136. package/dist/verification.mjs +82 -5
  137. package/dist/verification.mjs.map +1 -1
  138. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"formula.mjs","names":["v"],"sources":["../src/formula.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport function FormulaSchema<\n\tS extends v.GenericSchema<\n\t\t| { type: \"string\"; string: string | null }\n\t\t| { type: \"number\"; number: number | null }\n\t\t| { type: \"boolean\"; boolean: boolean | null }\n\t\t| {\n\t\t\t\ttype: \"date\";\n\t\t\t\tdate: {\n\t\t\t\t\tstart: string;\n\t\t\t\t\tend: string | null;\n\t\t\t\t\ttime_zone: string | null;\n\t\t\t\t} | null;\n\t\t },\n\t\tunknown\n\t>,\n>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tformula: schema,\n\t\t}),\n\t\t// biome-ignore lint/style/noNonNullAssertion: valibot inference is not working correctly\n\t\tv.transform((v) => v.formula!),\n\t);\n}\n"],"mappings":";;;AAEA,SAAgB,cAed,QAAW;AACZ,QAAO,EAAE,KACR,EAAE,OAAO,EACR,SAAS,QACT,CAAC,EAEF,EAAE,WAAW,QAAMA,IAAE,QAAS,CAC9B"}
1
+ {"version":3,"file":"formula.mjs","names":["v"],"sources":["../src/formula.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `formula` property result from a Notion page property.\n *\n * This is a generic schema factory that accepts another schema as a parameter,\n * allowing you to combine it with other schemas in this library to extract\n * typed formula results. The formula property in Notion can return different\n * types of values (string, number, boolean, or date) depending on the formula\n * configuration.\n *\n * **Input:**\n * ```\n * {\n * formula: {\n * type: \"string\" | \"number\" | \"boolean\" | \"date\";\n * string?: string | null;\n * number?: number | null;\n * boolean?: boolean | null;\n * date?: {\n * start: string;\n * end: string | null;\n * time_zone: string | null;\n * } | null;\n * }\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter.\n * For example, if `RichTextSchema` is passed, the output will be `string`.\n *\n * @param schema - A schema that validates the formula result type.\n * Must accept one of: string, number, boolean, or date formula results.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { FormulaSchema, RichTextSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * FormulaText: FormulaSchema(RichTextSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.FormulaText: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { FormulaSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for number formula\n * const NumberFormulaSchema = v.object({\n * type: v.literal(\"number\"),\n * number: v.nullable(v.number()),\n * });\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * FormulaNumber: FormulaSchema(NumberFormulaSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.FormulaNumber: { type: \"number\"; number: number | null }\n * ```\n */\nexport function FormulaSchema<\n\tS extends v.GenericSchema<\n\t\t| { type: \"string\"; string: string | null }\n\t\t| { type: \"number\"; number: number | null }\n\t\t| { type: \"boolean\"; boolean: boolean | null }\n\t\t| {\n\t\t\t\ttype: \"date\";\n\t\t\t\tdate: {\n\t\t\t\t\tstart: string;\n\t\t\t\t\tend: string | null;\n\t\t\t\t\ttime_zone: string | null;\n\t\t\t\t} | null;\n\t\t },\n\t\tunknown\n\t>,\n>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tformula: schema,\n\t\t}),\n\t\t// biome-ignore lint/style/noNonNullAssertion: valibot inference is not working correctly\n\t\tv.transform((v) => v.formula!),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,SAAgB,cAed,QAAW;AACZ,QAAO,EAAE,KACR,EAAE,OAAO,EACR,SAAS,QACT,CAAC,EAEF,EAAE,WAAW,QAAMA,IAAE,QAAS,CAC9B"}
package/dist/index.cjs CHANGED
@@ -25,17 +25,18 @@ exports.CheckboxSchema = require_checkbox.CheckboxSchema;
25
25
  exports.CreatedByIdSchema = require_created_by.CreatedByIdSchema;
26
26
  exports.CreatedBySchema = require_created_by.CreatedBySchema;
27
27
  exports.CreatedTimeSchema = require_created_time.CreatedTimeSchema;
28
+ exports.DateObjectSchema = require_date.DateObjectSchema;
29
+ exports.DateRangeSchema = require_date.DateRangeSchema;
28
30
  exports.DateSchema = require_date.DateSchema;
29
31
  exports.EmailSchema = require_email.EmailSchema;
30
32
  exports.FilesSchema = require_files.FilesSchema;
31
33
  exports.FormulaSchema = require_formula.FormulaSchema;
32
- exports.FullDateSchema = require_date.FullDateSchema;
33
34
  exports.LastEditedByIdSchema = require_last_edited_by.LastEditedByIdSchema;
34
35
  exports.LastEditedTimeSchema = require_last_edited_time.LastEditedTimeSchema;
35
36
  exports.MultiSelectSchema = require_multi_select.MultiSelectSchema;
37
+ exports.NullableDateRangeSchema = require_date.NullableDateRangeSchema;
36
38
  exports.NullableDateSchema = require_date.NullableDateSchema;
37
39
  exports.NullableEmailSchema = require_email.NullableEmailSchema;
38
- exports.NullableFullDateSchema = require_date.NullableFullDateSchema;
39
40
  exports.NullableLastEditedByNameSchema = require_last_edited_by.NullableLastEditedByNameSchema;
40
41
  exports.NullableNumberSchema = require_number.NullableNumberSchema;
41
42
  exports.NullablePhoneNumberSchema = require_phone_number.NullablePhoneNumberSchema;
@@ -43,7 +44,9 @@ exports.NullablePlaceSchema = require_place.NullablePlaceSchema;
43
44
  exports.NullableRollupDateSchema = require_rollup.NullableRollupDateSchema;
44
45
  exports.NullableRollupNumberSchema = require_rollup.NullableRollupNumberSchema;
45
46
  exports.NullableSelectSchema = require_select.NullableSelectSchema;
47
+ exports.NullableSingleRelationSchema = require_relation.NullableSingleRelationSchema;
46
48
  exports.NullableStatusSchema = require_status.NullableStatusSchema;
49
+ exports.NullableUniqueIdSchema = require_unique_id.NullableUniqueIdSchema;
47
50
  exports.NullableUrlSchema = require_url.NullableUrlSchema;
48
51
  exports.NullableVerificationSchema = require_verification.NullableVerificationSchema;
49
52
  exports.NumberSchema = require_number.NumberSchema;
@@ -57,8 +60,9 @@ exports.RollupArraySchema = require_rollup.RollupArraySchema;
57
60
  exports.RollupDateSchema = require_rollup.RollupDateSchema;
58
61
  exports.RollupNumberSchema = require_rollup.RollupNumberSchema;
59
62
  exports.SelectSchema = require_select.SelectSchema;
63
+ exports.SingleRelationSchema = require_relation.SingleRelationSchema;
60
64
  exports.StatusSchema = require_status.StatusSchema;
61
65
  exports.TitleSchema = require_text.TitleSchema;
62
- exports.UniqueIdSchema = require_unique_id.UniqueIdSchema;
66
+ exports.UniqueIdNumberSchema = require_unique_id.UniqueIdNumberSchema;
63
67
  exports.UrlSchema = require_url.UrlSchema;
64
68
  exports.VerificationSchema = require_verification.VerificationSchema;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CheckboxSchema } from "./checkbox.cjs";
2
2
  import { CreatedByIdSchema, CreatedBySchema } from "./created-by.cjs";
3
3
  import { CreatedTimeSchema } from "./created-time.cjs";
4
- import { DateSchema, FullDateSchema, NullableDateSchema, NullableFullDateSchema } from "./date.cjs";
4
+ import { DateObjectSchema, DateRangeSchema, DateSchema, NullableDateRangeSchema, NullableDateSchema } from "./date.cjs";
5
5
  import { EmailSchema, NullableEmailSchema } from "./email.cjs";
6
6
  import { FilesSchema } from "./files.cjs";
7
7
  import { FormulaSchema } from "./formula.cjs";
@@ -12,12 +12,12 @@ import { NullableNumberSchema, NumberSchema } from "./number.cjs";
12
12
  import { PeopleSchema, PersonSchema } from "./people.cjs";
13
13
  import { NullablePhoneNumberSchema, PhoneNumberSchema } from "./phone-number.cjs";
14
14
  import { NullablePlaceSchema, PlaceSchema } from "./place.cjs";
15
- import { RelationSchema } from "./relation.cjs";
15
+ import { NullableSingleRelationSchema, RelationSchema, SingleRelationSchema } from "./relation.cjs";
16
16
  import { NullableRollupDateSchema, NullableRollupNumberSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema } from "./rollup.cjs";
17
17
  import { NullableSelectSchema, SelectSchema } from "./select.cjs";
18
18
  import { NullableStatusSchema, StatusSchema } from "./status.cjs";
19
19
  import { RichTextSchema, TitleSchema } from "./text.cjs";
20
- import { UniqueIdSchema } from "./unique-id.cjs";
20
+ import { NullableUniqueIdSchema, UniqueIdNumberSchema } from "./unique-id.cjs";
21
21
  import { NullableUrlSchema, UrlSchema } from "./url.cjs";
22
22
  import { NullableVerificationSchema, VerificationSchema } from "./verification.cjs";
23
- export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableStatusSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, StatusSchema, TitleSchema, UniqueIdSchema, UrlSchema, VerificationSchema };
23
+ export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CheckboxSchema } from "./checkbox.mjs";
2
2
  import { CreatedByIdSchema, CreatedBySchema } from "./created-by.mjs";
3
3
  import { CreatedTimeSchema } from "./created-time.mjs";
4
- import { DateSchema, FullDateSchema, NullableDateSchema, NullableFullDateSchema } from "./date.mjs";
4
+ import { DateObjectSchema, DateRangeSchema, DateSchema, NullableDateRangeSchema, NullableDateSchema } from "./date.mjs";
5
5
  import { EmailSchema, NullableEmailSchema } from "./email.mjs";
6
6
  import { FilesSchema } from "./files.mjs";
7
7
  import { FormulaSchema } from "./formula.mjs";
@@ -12,12 +12,12 @@ import { NullableNumberSchema, NumberSchema } from "./number.mjs";
12
12
  import { PeopleSchema, PersonSchema } from "./people.mjs";
13
13
  import { NullablePhoneNumberSchema, PhoneNumberSchema } from "./phone-number.mjs";
14
14
  import { NullablePlaceSchema, PlaceSchema } from "./place.mjs";
15
- import { RelationSchema } from "./relation.mjs";
15
+ import { NullableSingleRelationSchema, RelationSchema, SingleRelationSchema } from "./relation.mjs";
16
16
  import { NullableRollupDateSchema, NullableRollupNumberSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema } from "./rollup.mjs";
17
17
  import { NullableSelectSchema, SelectSchema } from "./select.mjs";
18
18
  import { NullableStatusSchema, StatusSchema } from "./status.mjs";
19
19
  import { RichTextSchema, TitleSchema } from "./text.mjs";
20
- import { UniqueIdSchema } from "./unique-id.mjs";
20
+ import { NullableUniqueIdSchema, UniqueIdNumberSchema } from "./unique-id.mjs";
21
21
  import { NullableUrlSchema, UrlSchema } from "./url.mjs";
22
22
  import { NullableVerificationSchema, VerificationSchema } from "./verification.mjs";
23
- export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableStatusSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, StatusSchema, TitleSchema, UniqueIdSchema, UrlSchema, VerificationSchema };
23
+ export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { CheckboxSchema } from "./checkbox.mjs";
2
2
  import { PeopleSchema, PersonSchema } from "./people.mjs";
3
3
  import { CreatedByIdSchema, CreatedBySchema } from "./created-by.mjs";
4
4
  import { CreatedTimeSchema } from "./created-time.mjs";
5
- import { DateSchema, FullDateSchema, NullableDateSchema, NullableFullDateSchema } from "./date.mjs";
5
+ import { DateObjectSchema, DateRangeSchema, DateSchema, NullableDateRangeSchema, NullableDateSchema } from "./date.mjs";
6
6
  import { EmailSchema, NullableEmailSchema } from "./email.mjs";
7
7
  import { FilesSchema } from "./files.mjs";
8
8
  import { FormulaSchema } from "./formula.mjs";
@@ -12,13 +12,13 @@ import { MultiSelectSchema } from "./multi-select.mjs";
12
12
  import { NullableNumberSchema, NumberSchema } from "./number.mjs";
13
13
  import { NullablePhoneNumberSchema, PhoneNumberSchema } from "./phone-number.mjs";
14
14
  import { NullablePlaceSchema, PlaceSchema } from "./place.mjs";
15
- import { RelationSchema } from "./relation.mjs";
15
+ import { NullableSingleRelationSchema, RelationSchema, SingleRelationSchema } from "./relation.mjs";
16
16
  import { NullableRollupDateSchema, NullableRollupNumberSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema } from "./rollup.mjs";
17
17
  import { NullableSelectSchema, SelectSchema } from "./select.mjs";
18
18
  import { NullableStatusSchema, StatusSchema } from "./status.mjs";
19
19
  import { RichTextSchema, TitleSchema } from "./text.mjs";
20
- import { UniqueIdSchema } from "./unique-id.mjs";
20
+ import { NullableUniqueIdSchema, UniqueIdNumberSchema } from "./unique-id.mjs";
21
21
  import { NullableUrlSchema, UrlSchema } from "./url.mjs";
22
22
  import { NullableVerificationSchema, VerificationSchema } from "./verification.mjs";
23
23
 
24
- export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableStatusSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, StatusSchema, TitleSchema, UniqueIdSchema, UrlSchema, VerificationSchema };
24
+ export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
@@ -4,7 +4,75 @@ let valibot = require("valibot");
4
4
  valibot = require_rolldown_runtime.__toESM(valibot);
5
5
 
6
6
  //#region src/last-edited-by.ts
7
+ /**
8
+ * Schema to extract the `last_edited_by` person name from a Notion page.
9
+ *
10
+ * **Input:**
11
+ * ```
12
+ * {
13
+ * last_edited_by: {
14
+ * id: string;
15
+ * object: "user" | "bot" | "group";
16
+ * name: string | null;
17
+ * ...
18
+ * }
19
+ * }
20
+ * ```
21
+ *
22
+ * **Output:** `string | null`
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import * as v from "valibot";
27
+ * import { NullableLastEditedByNameSchema } from "@nakanoaas/notion-valibot-schema";
28
+ *
29
+ * const PageSchema = v.object({
30
+ * id: v.string(),
31
+ * properties: v.object({
32
+ * LastEditedByName: NullableLastEditedByNameSchema,
33
+ * }),
34
+ * });
35
+ *
36
+ * const page = await notion.pages.retrieve({ page_id: "..." });
37
+ * const parsed = v.parse(PageSchema, page);
38
+ * // parsed.properties.LastEditedByName: string | null
39
+ * ```
40
+ */
7
41
  const NullableLastEditedByNameSchema = valibot.pipe(valibot.object({ last_edited_by: require_people.PersonSchema }), valibot.transform((v) => v.last_edited_by.name));
42
+ /**
43
+ * Schema to extract the `last_edited_by` person ID from a Notion page.
44
+ *
45
+ * **Input:**
46
+ * ```
47
+ * {
48
+ * last_edited_by: {
49
+ * id: string;
50
+ * object: "user" | "bot" | "group";
51
+ * name: string | null;
52
+ * ...
53
+ * }
54
+ * }
55
+ * ```
56
+ *
57
+ * **Output:** `string`
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * import * as v from "valibot";
62
+ * import { LastEditedByIdSchema } from "@nakanoaas/notion-valibot-schema";
63
+ *
64
+ * const PageSchema = v.object({
65
+ * id: v.string(),
66
+ * properties: v.object({
67
+ * LastEditedById: LastEditedByIdSchema,
68
+ * }),
69
+ * });
70
+ *
71
+ * const page = await notion.pages.retrieve({ page_id: "..." });
72
+ * const parsed = v.parse(PageSchema, page);
73
+ * // parsed.properties.LastEditedById: string
74
+ * ```
75
+ */
8
76
  const LastEditedByIdSchema = valibot.pipe(valibot.object({ last_edited_by: require_people.PersonSchema }), valibot.transform((v) => v.last_edited_by.id));
9
77
 
10
78
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"last-edited-by.cjs","names":["v","PersonSchema"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.name),\n);\n\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;;;AAIA,MAAa,iCAAiCA,QAAE,KAC/CA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,KAAK,CACzC;AAED,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,GAAG,CACvC"}
1
+ {"version":3,"file":"last-edited-by.cjs","names":["v","PersonSchema"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `last_edited_by` person name from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableLastEditedByNameSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedByName: NullableLastEditedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedByName: string | null\n * ```\n */\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.name),\n);\n\n/**\n * Schema to extract the `last_edited_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedById: LastEditedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedById: string\n * ```\n */\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,iCAAiCA,QAAE,KAC/CA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,KAAK,CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,GAAG,CACvC"}
@@ -1,6 +1,41 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/last-edited-by.d.ts
4
+
5
+ /**
6
+ * Schema to extract the `last_edited_by` person name from a Notion page.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * last_edited_by: {
12
+ * id: string;
13
+ * object: "user" | "bot" | "group";
14
+ * name: string | null;
15
+ * ...
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * **Output:** `string | null`
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import * as v from "valibot";
25
+ * import { NullableLastEditedByNameSchema } from "@nakanoaas/notion-valibot-schema";
26
+ *
27
+ * const PageSchema = v.object({
28
+ * id: v.string(),
29
+ * properties: v.object({
30
+ * LastEditedByName: NullableLastEditedByNameSchema,
31
+ * }),
32
+ * });
33
+ *
34
+ * const page = await notion.pages.retrieve({ page_id: "..." });
35
+ * const parsed = v.parse(PageSchema, page);
36
+ * // parsed.properties.LastEditedByName: string | null
37
+ * ```
38
+ */
4
39
  declare const NullableLastEditedByNameSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
5
40
  readonly last_edited_by: v.ObjectSchema<{
6
41
  readonly id: v.StringSchema<undefined>;
@@ -14,6 +49,40 @@ declare const NullableLastEditedByNameSchema: v.SchemaWithPipe<readonly [v.Objec
14
49
  name: string | null;
15
50
  };
16
51
  }, string | null>]>;
52
+ /**
53
+ * Schema to extract the `last_edited_by` person ID from a Notion page.
54
+ *
55
+ * **Input:**
56
+ * ```
57
+ * {
58
+ * last_edited_by: {
59
+ * id: string;
60
+ * object: "user" | "bot" | "group";
61
+ * name: string | null;
62
+ * ...
63
+ * }
64
+ * }
65
+ * ```
66
+ *
67
+ * **Output:** `string`
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * import * as v from "valibot";
72
+ * import { LastEditedByIdSchema } from "@nakanoaas/notion-valibot-schema";
73
+ *
74
+ * const PageSchema = v.object({
75
+ * id: v.string(),
76
+ * properties: v.object({
77
+ * LastEditedById: LastEditedByIdSchema,
78
+ * }),
79
+ * });
80
+ *
81
+ * const page = await notion.pages.retrieve({ page_id: "..." });
82
+ * const parsed = v.parse(PageSchema, page);
83
+ * // parsed.properties.LastEditedById: string
84
+ * ```
85
+ */
17
86
  declare const LastEditedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
18
87
  readonly last_edited_by: v.ObjectSchema<{
19
88
  readonly id: v.StringSchema<undefined>;
@@ -1,6 +1,41 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/last-edited-by.d.ts
4
+
5
+ /**
6
+ * Schema to extract the `last_edited_by` person name from a Notion page.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * last_edited_by: {
12
+ * id: string;
13
+ * object: "user" | "bot" | "group";
14
+ * name: string | null;
15
+ * ...
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * **Output:** `string | null`
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import * as v from "valibot";
25
+ * import { NullableLastEditedByNameSchema } from "@nakanoaas/notion-valibot-schema";
26
+ *
27
+ * const PageSchema = v.object({
28
+ * id: v.string(),
29
+ * properties: v.object({
30
+ * LastEditedByName: NullableLastEditedByNameSchema,
31
+ * }),
32
+ * });
33
+ *
34
+ * const page = await notion.pages.retrieve({ page_id: "..." });
35
+ * const parsed = v.parse(PageSchema, page);
36
+ * // parsed.properties.LastEditedByName: string | null
37
+ * ```
38
+ */
4
39
  declare const NullableLastEditedByNameSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
5
40
  readonly last_edited_by: v.ObjectSchema<{
6
41
  readonly id: v.StringSchema<undefined>;
@@ -14,6 +49,40 @@ declare const NullableLastEditedByNameSchema: v.SchemaWithPipe<readonly [v.Objec
14
49
  name: string | null;
15
50
  };
16
51
  }, string | null>]>;
52
+ /**
53
+ * Schema to extract the `last_edited_by` person ID from a Notion page.
54
+ *
55
+ * **Input:**
56
+ * ```
57
+ * {
58
+ * last_edited_by: {
59
+ * id: string;
60
+ * object: "user" | "bot" | "group";
61
+ * name: string | null;
62
+ * ...
63
+ * }
64
+ * }
65
+ * ```
66
+ *
67
+ * **Output:** `string`
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * import * as v from "valibot";
72
+ * import { LastEditedByIdSchema } from "@nakanoaas/notion-valibot-schema";
73
+ *
74
+ * const PageSchema = v.object({
75
+ * id: v.string(),
76
+ * properties: v.object({
77
+ * LastEditedById: LastEditedByIdSchema,
78
+ * }),
79
+ * });
80
+ *
81
+ * const page = await notion.pages.retrieve({ page_id: "..." });
82
+ * const parsed = v.parse(PageSchema, page);
83
+ * // parsed.properties.LastEditedById: string
84
+ * ```
85
+ */
17
86
  declare const LastEditedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
18
87
  readonly last_edited_by: v.ObjectSchema<{
19
88
  readonly id: v.StringSchema<undefined>;
@@ -2,7 +2,75 @@ import { PersonSchema } from "./people.mjs";
2
2
  import * as v from "valibot";
3
3
 
4
4
  //#region src/last-edited-by.ts
5
+ /**
6
+ * Schema to extract the `last_edited_by` person name from a Notion page.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * last_edited_by: {
12
+ * id: string;
13
+ * object: "user" | "bot" | "group";
14
+ * name: string | null;
15
+ * ...
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * **Output:** `string | null`
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import * as v from "valibot";
25
+ * import { NullableLastEditedByNameSchema } from "@nakanoaas/notion-valibot-schema";
26
+ *
27
+ * const PageSchema = v.object({
28
+ * id: v.string(),
29
+ * properties: v.object({
30
+ * LastEditedByName: NullableLastEditedByNameSchema,
31
+ * }),
32
+ * });
33
+ *
34
+ * const page = await notion.pages.retrieve({ page_id: "..." });
35
+ * const parsed = v.parse(PageSchema, page);
36
+ * // parsed.properties.LastEditedByName: string | null
37
+ * ```
38
+ */
5
39
  const NullableLastEditedByNameSchema = v.pipe(v.object({ last_edited_by: PersonSchema }), v.transform((v$1) => v$1.last_edited_by.name));
40
+ /**
41
+ * Schema to extract the `last_edited_by` person ID from a Notion page.
42
+ *
43
+ * **Input:**
44
+ * ```
45
+ * {
46
+ * last_edited_by: {
47
+ * id: string;
48
+ * object: "user" | "bot" | "group";
49
+ * name: string | null;
50
+ * ...
51
+ * }
52
+ * }
53
+ * ```
54
+ *
55
+ * **Output:** `string`
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * import * as v from "valibot";
60
+ * import { LastEditedByIdSchema } from "@nakanoaas/notion-valibot-schema";
61
+ *
62
+ * const PageSchema = v.object({
63
+ * id: v.string(),
64
+ * properties: v.object({
65
+ * LastEditedById: LastEditedByIdSchema,
66
+ * }),
67
+ * });
68
+ *
69
+ * const page = await notion.pages.retrieve({ page_id: "..." });
70
+ * const parsed = v.parse(PageSchema, page);
71
+ * // parsed.properties.LastEditedById: string
72
+ * ```
73
+ */
6
74
  const LastEditedByIdSchema = v.pipe(v.object({ last_edited_by: PersonSchema }), v.transform((v$1) => v$1.last_edited_by.id));
7
75
 
8
76
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"last-edited-by.mjs","names":["v"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.name),\n);\n\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;AAIA,MAAa,iCAAiC,EAAE,KAC/C,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,KAAK,CACzC;AAED,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,GAAG,CACvC"}
1
+ {"version":3,"file":"last-edited-by.mjs","names":["v"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `last_edited_by` person name from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableLastEditedByNameSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedByName: NullableLastEditedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedByName: string | null\n * ```\n */\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.name),\n);\n\n/**\n * Schema to extract the `last_edited_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedById: LastEditedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedById: string\n * ```\n */\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,iCAAiC,EAAE,KAC/C,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,KAAK,CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,GAAG,CACvC"}
@@ -3,6 +3,33 @@ let valibot = require("valibot");
3
3
  valibot = require_rolldown_runtime.__toESM(valibot);
4
4
 
5
5
  //#region src/last-edited-time.ts
6
+ /**
7
+ * Schema to extract the `last_edited_time` property from a Notion page and transform it to a `Date` object.
8
+ *
9
+ * **Input:**
10
+ * ```
11
+ * {
12
+ * last_edited_time: string;
13
+ * }
14
+ * ```
15
+ *
16
+ * **Output:** `Date`
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * import * as v from "valibot";
21
+ * import { LastEditedTimeSchema } from "@nakanoaas/notion-valibot-utils";
22
+ *
23
+ * const PageSchema = v.object({
24
+ * id: v.string(),
25
+ * last_edited_time: LastEditedTimeSchema,
26
+ * });
27
+ *
28
+ * const page = await notion.pages.retrieve({ page_id: "..." });
29
+ * const parsed = v.parse(PageSchema, page);
30
+ * // parsed.last_edited_time: Date
31
+ * ```
32
+ */
6
33
  const LastEditedTimeSchema = valibot.pipe(valibot.object({ last_edited_time: valibot.string() }), valibot.transform((v) => new Date(v.last_edited_time)));
7
34
 
8
35
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"last-edited-time.cjs","names":["v"],"sources":["../src/last-edited-time.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const LastEditedTimeSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_time: v.string(),\n\t}),\n\tv.transform((v) => new Date(v.last_edited_time)),\n);\n"],"mappings":";;;;;AAEA,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,kBAAkBA,QAAE,QAAQ,EAC5B,CAAC,EACFA,QAAE,WAAW,MAAM,IAAI,KAAK,EAAE,iBAAiB,CAAC,CAChD"}
1
+ {"version":3,"file":"last-edited-time.cjs","names":["v"],"sources":["../src/last-edited-time.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `last_edited_time` property from a Notion page and transform it to a `Date` object.\n *\n * **Input:**\n * ```\n * {\n * last_edited_time: string;\n * }\n * ```\n *\n * **Output:** `Date`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedTimeSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * last_edited_time: LastEditedTimeSchema,\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.last_edited_time: Date\n * ```\n */\nexport const LastEditedTimeSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_time: v.string(),\n\t}),\n\tv.transform((v) => new Date(v.last_edited_time)),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,kBAAkBA,QAAE,QAAQ,EAC5B,CAAC,EACFA,QAAE,WAAW,MAAM,IAAI,KAAK,EAAE,iBAAiB,CAAC,CAChD"}
@@ -1,6 +1,34 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/last-edited-time.d.ts
4
+
5
+ /**
6
+ * Schema to extract the `last_edited_time` property from a Notion page and transform it to a `Date` object.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * last_edited_time: string;
12
+ * }
13
+ * ```
14
+ *
15
+ * **Output:** `Date`
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import * as v from "valibot";
20
+ * import { LastEditedTimeSchema } from "@nakanoaas/notion-valibot-utils";
21
+ *
22
+ * const PageSchema = v.object({
23
+ * id: v.string(),
24
+ * last_edited_time: LastEditedTimeSchema,
25
+ * });
26
+ *
27
+ * const page = await notion.pages.retrieve({ page_id: "..." });
28
+ * const parsed = v.parse(PageSchema, page);
29
+ * // parsed.last_edited_time: Date
30
+ * ```
31
+ */
4
32
  declare const LastEditedTimeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
5
33
  readonly last_edited_time: v.StringSchema<undefined>;
6
34
  }, undefined>, v.TransformAction<{
@@ -1,6 +1,34 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/last-edited-time.d.ts
4
+
5
+ /**
6
+ * Schema to extract the `last_edited_time` property from a Notion page and transform it to a `Date` object.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * last_edited_time: string;
12
+ * }
13
+ * ```
14
+ *
15
+ * **Output:** `Date`
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import * as v from "valibot";
20
+ * import { LastEditedTimeSchema } from "@nakanoaas/notion-valibot-utils";
21
+ *
22
+ * const PageSchema = v.object({
23
+ * id: v.string(),
24
+ * last_edited_time: LastEditedTimeSchema,
25
+ * });
26
+ *
27
+ * const page = await notion.pages.retrieve({ page_id: "..." });
28
+ * const parsed = v.parse(PageSchema, page);
29
+ * // parsed.last_edited_time: Date
30
+ * ```
31
+ */
4
32
  declare const LastEditedTimeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
5
33
  readonly last_edited_time: v.StringSchema<undefined>;
6
34
  }, undefined>, v.TransformAction<{
@@ -1,6 +1,33 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/last-edited-time.ts
4
+ /**
5
+ * Schema to extract the `last_edited_time` property from a Notion page and transform it to a `Date` object.
6
+ *
7
+ * **Input:**
8
+ * ```
9
+ * {
10
+ * last_edited_time: string;
11
+ * }
12
+ * ```
13
+ *
14
+ * **Output:** `Date`
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import * as v from "valibot";
19
+ * import { LastEditedTimeSchema } from "@nakanoaas/notion-valibot-utils";
20
+ *
21
+ * const PageSchema = v.object({
22
+ * id: v.string(),
23
+ * last_edited_time: LastEditedTimeSchema,
24
+ * });
25
+ *
26
+ * const page = await notion.pages.retrieve({ page_id: "..." });
27
+ * const parsed = v.parse(PageSchema, page);
28
+ * // parsed.last_edited_time: Date
29
+ * ```
30
+ */
4
31
  const LastEditedTimeSchema = v.pipe(v.object({ last_edited_time: v.string() }), v.transform((v$1) => new Date(v$1.last_edited_time)));
5
32
 
6
33
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"last-edited-time.mjs","names":["v"],"sources":["../src/last-edited-time.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const LastEditedTimeSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_time: v.string(),\n\t}),\n\tv.transform((v) => new Date(v.last_edited_time)),\n);\n"],"mappings":";;;AAEA,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,kBAAkB,EAAE,QAAQ,EAC5B,CAAC,EACF,EAAE,WAAW,QAAM,IAAI,KAAKA,IAAE,iBAAiB,CAAC,CAChD"}
1
+ {"version":3,"file":"last-edited-time.mjs","names":["v"],"sources":["../src/last-edited-time.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `last_edited_time` property from a Notion page and transform it to a `Date` object.\n *\n * **Input:**\n * ```\n * {\n * last_edited_time: string;\n * }\n * ```\n *\n * **Output:** `Date`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedTimeSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * last_edited_time: LastEditedTimeSchema,\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.last_edited_time: Date\n * ```\n */\nexport const LastEditedTimeSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_time: v.string(),\n\t}),\n\tv.transform((v) => new Date(v.last_edited_time)),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,kBAAkB,EAAE,QAAQ,EAC5B,CAAC,EACF,EAAE,WAAW,QAAM,IAAI,KAAKA,IAAE,iBAAiB,CAAC,CAChD"}