@nakanoaas/notion-valibot-schema 0.0.4 → 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 (133) hide show
  1. package/dist/checkbox.cjs +29 -0
  2. package/dist/checkbox.cjs.map +1 -1
  3. package/dist/checkbox.d.cts +30 -0
  4. package/dist/checkbox.d.mts +30 -0
  5. package/dist/checkbox.mjs +29 -0
  6. package/dist/checkbox.mjs.map +1 -1
  7. package/dist/created-by.cjs +75 -0
  8. package/dist/created-by.cjs.map +1 -1
  9. package/dist/created-by.d.cts +76 -0
  10. package/dist/created-by.d.mts +76 -0
  11. package/dist/created-by.mjs +75 -0
  12. package/dist/created-by.mjs.map +1 -1
  13. package/dist/created-time.cjs +27 -0
  14. package/dist/created-time.cjs.map +1 -1
  15. package/dist/created-time.d.cts +28 -0
  16. package/dist/created-time.d.mts +28 -0
  17. package/dist/created-time.mjs +27 -0
  18. package/dist/created-time.mjs.map +1 -1
  19. package/dist/date.cjs +188 -0
  20. package/dist/date.cjs.map +1 -1
  21. package/dist/date.d.cts +189 -0
  22. package/dist/date.d.mts +189 -0
  23. package/dist/date.mjs +188 -0
  24. package/dist/date.mjs.map +1 -1
  25. package/dist/email.cjs +58 -0
  26. package/dist/email.cjs.map +1 -1
  27. package/dist/email.d.cts +59 -0
  28. package/dist/email.d.mts +59 -0
  29. package/dist/email.mjs +58 -0
  30. package/dist/email.mjs.map +1 -1
  31. package/dist/files.cjs +39 -0
  32. package/dist/files.cjs.map +1 -1
  33. package/dist/files.d.cts +40 -0
  34. package/dist/files.d.mts +40 -0
  35. package/dist/files.mjs +39 -0
  36. package/dist/files.mjs.map +1 -1
  37. package/dist/formula.cjs +72 -0
  38. package/dist/formula.cjs.map +1 -1
  39. package/dist/formula.d.cts +73 -0
  40. package/dist/formula.d.mts +73 -0
  41. package/dist/formula.mjs +72 -0
  42. package/dist/formula.mjs.map +1 -1
  43. package/dist/last-edited-by.cjs +68 -0
  44. package/dist/last-edited-by.cjs.map +1 -1
  45. package/dist/last-edited-by.d.cts +69 -0
  46. package/dist/last-edited-by.d.mts +69 -0
  47. package/dist/last-edited-by.mjs +68 -0
  48. package/dist/last-edited-by.mjs.map +1 -1
  49. package/dist/last-edited-time.cjs +27 -0
  50. package/dist/last-edited-time.cjs.map +1 -1
  51. package/dist/last-edited-time.d.cts +28 -0
  52. package/dist/last-edited-time.d.mts +28 -0
  53. package/dist/last-edited-time.mjs +27 -0
  54. package/dist/last-edited-time.mjs.map +1 -1
  55. package/dist/multi-select.cjs +60 -0
  56. package/dist/multi-select.cjs.map +1 -1
  57. package/dist/multi-select.d.cts +61 -0
  58. package/dist/multi-select.d.mts +61 -0
  59. package/dist/multi-select.mjs +60 -0
  60. package/dist/multi-select.mjs.map +1 -1
  61. package/dist/number.cjs +58 -0
  62. package/dist/number.cjs.map +1 -1
  63. package/dist/number.d.cts +59 -0
  64. package/dist/number.d.mts +59 -0
  65. package/dist/number.mjs +58 -0
  66. package/dist/number.mjs.map +1 -1
  67. package/dist/people.cjs +84 -0
  68. package/dist/people.cjs.map +1 -1
  69. package/dist/people.d.cts +85 -0
  70. package/dist/people.d.mts +85 -0
  71. package/dist/people.mjs +84 -0
  72. package/dist/people.mjs.map +1 -1
  73. package/dist/phone-number.cjs +58 -0
  74. package/dist/phone-number.cjs.map +1 -1
  75. package/dist/phone-number.d.cts +59 -0
  76. package/dist/phone-number.d.mts +59 -0
  77. package/dist/phone-number.mjs +58 -0
  78. package/dist/phone-number.mjs.map +1 -1
  79. package/dist/place.cjs +128 -0
  80. package/dist/place.cjs.map +1 -1
  81. package/dist/place.d.cts +85 -0
  82. package/dist/place.d.mts +85 -0
  83. package/dist/place.mjs +128 -0
  84. package/dist/place.mjs.map +1 -1
  85. package/dist/relation.cjs +131 -0
  86. package/dist/relation.cjs.map +1 -1
  87. package/dist/relation.d.cts +94 -0
  88. package/dist/relation.d.mts +94 -0
  89. package/dist/relation.mjs +131 -0
  90. package/dist/relation.mjs.map +1 -1
  91. package/dist/rollup.cjs +200 -0
  92. package/dist/rollup.cjs.map +1 -1
  93. package/dist/rollup.d.cts +201 -0
  94. package/dist/rollup.d.mts +201 -0
  95. package/dist/rollup.mjs +200 -0
  96. package/dist/rollup.mjs.map +1 -1
  97. package/dist/select.cjs +120 -0
  98. package/dist/select.cjs.map +1 -1
  99. package/dist/select.d.cts +121 -0
  100. package/dist/select.d.mts +121 -0
  101. package/dist/select.mjs +120 -0
  102. package/dist/select.mjs.map +1 -1
  103. package/dist/status.cjs +120 -0
  104. package/dist/status.cjs.map +1 -1
  105. package/dist/status.d.cts +121 -0
  106. package/dist/status.d.mts +121 -0
  107. package/dist/status.mjs +120 -0
  108. package/dist/status.mjs.map +1 -1
  109. package/dist/text.cjs +100 -0
  110. package/dist/text.cjs.map +1 -1
  111. package/dist/text.d.cts +63 -0
  112. package/dist/text.d.mts +63 -0
  113. package/dist/text.mjs +100 -0
  114. package/dist/text.mjs.map +1 -1
  115. package/dist/unique-id.cjs +69 -0
  116. package/dist/unique-id.cjs.map +1 -1
  117. package/dist/unique-id.d.cts +70 -0
  118. package/dist/unique-id.d.mts +70 -0
  119. package/dist/unique-id.mjs +69 -0
  120. package/dist/unique-id.mjs.map +1 -1
  121. package/dist/url.cjs +58 -0
  122. package/dist/url.cjs.map +1 -1
  123. package/dist/url.d.cts +59 -0
  124. package/dist/url.d.mts +59 -0
  125. package/dist/url.mjs +58 -0
  126. package/dist/url.mjs.map +1 -1
  127. package/dist/verification.cjs +80 -0
  128. package/dist/verification.cjs.map +1 -1
  129. package/dist/verification.d.cts +81 -0
  130. package/dist/verification.d.mts +81 -0
  131. package/dist/verification.mjs +80 -0
  132. package/dist/verification.mjs.map +1 -1
  133. package/package.json +1 -1
@@ -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"}
@@ -3,6 +3,66 @@ let valibot = require("valibot");
3
3
  valibot = require_rolldown_runtime.__toESM(valibot);
4
4
 
5
5
  //#region src/multi-select.ts
6
+ /**
7
+ * Schema factory to extract the `multi_select` property from a Notion page property.
8
+ *
9
+ * This is a generic schema factory that accepts another schema as a parameter,
10
+ * allowing you to combine it with other schemas in this library to extract
11
+ * typed multi-select values. The multi-select property in Notion contains an
12
+ * array of objects with a `name` field that can be validated using the provided schema.
13
+ *
14
+ * **Input:**
15
+ * ```
16
+ * {
17
+ * multi_select: Array<{
18
+ * name: string;
19
+ * }>;
20
+ * }
21
+ * ```
22
+ *
23
+ * **Output:** The output type depends on the schema passed as a parameter.
24
+ * For example, if `v.string()` is passed, the output will be `string[]`.
25
+ *
26
+ * @param schema - A schema that validates the multi-select option name.
27
+ * Must accept a string value.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import * as v from "valibot";
32
+ * import { MultiSelectSchema } from "@nakanoaas/notion-valibot-utils";
33
+ *
34
+ * const PageSchema = v.object({
35
+ * id: v.string(),
36
+ * properties: v.object({
37
+ * Tags: MultiSelectSchema(v.string()),
38
+ * }),
39
+ * });
40
+ *
41
+ * const page = await notion.pages.retrieve({ page_id: "..." });
42
+ * const parsed = v.parse(PageSchema, page);
43
+ * // parsed.properties.Tags: string[]
44
+ * ```
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * import * as v from "valibot";
49
+ * import { MultiSelectSchema } from "@nakanoaas/notion-valibot-utils";
50
+ *
51
+ * // Custom schema for enum values
52
+ * const TagSchema = v.picklist(["urgent", "important", "normal"]);
53
+ *
54
+ * const PageSchema = v.object({
55
+ * id: v.string(),
56
+ * properties: v.object({
57
+ * Tags: MultiSelectSchema(TagSchema),
58
+ * }),
59
+ * });
60
+ *
61
+ * const page = await notion.pages.retrieve({ page_id: "..." });
62
+ * const parsed = v.parse(PageSchema, page);
63
+ * // parsed.properties.Tags: ("urgent" | "important" | "normal")[]
64
+ * ```
65
+ */
6
66
  function MultiSelectSchema(schema) {
7
67
  return valibot.pipe(valibot.object({ multi_select: valibot.array(valibot.object({ name: schema })) }), valibot.transform((v) => v.multi_select.map((v$1) => v$1.name)));
8
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"multi-select.cjs","names":["v"],"sources":["../src/multi-select.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport function MultiSelectSchema<T extends v.GenericSchema<string>>(\n\tschema: T,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tmulti_select: v.array(\n\t\t\t\tv.object({\n\t\t\t\t\tname: schema,\n\t\t\t\t}),\n\t\t\t),\n\t\t}),\n\t\t// biome-ignore lint/style/noNonNullAssertion: valibot inference is not working correctly\n\t\tv.transform((v) => v.multi_select.map((v) => v.name!)),\n\t);\n}\n"],"mappings":";;;;;AAEA,SAAgB,kBACf,QACC;AACD,QAAOA,QAAE,KACRA,QAAE,OAAO,EACR,cAAcA,QAAE,MACfA,QAAE,OAAO,EACR,MAAM,QACN,CAAC,CACF,EACD,CAAC,EAEFA,QAAE,WAAW,MAAM,EAAE,aAAa,KAAK,QAAMA,IAAE,KAAM,CAAC,CACtD"}
1
+ {"version":3,"file":"multi-select.cjs","names":["v"],"sources":["../src/multi-select.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `multi_select` property 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 multi-select values. The multi-select property in Notion contains an\n * array of objects with a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * multi_select: Array<{\n * name: string;\n * }>;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter.\n * For example, if `v.string()` is passed, the output will be `string[]`.\n *\n * @param schema - A schema that validates the multi-select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { MultiSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Tags: MultiSelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Tags: string[]\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { MultiSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const TagSchema = v.picklist([\"urgent\", \"important\", \"normal\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Tags: MultiSelectSchema(TagSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Tags: (\"urgent\" | \"important\" | \"normal\")[]\n * ```\n */\nexport function MultiSelectSchema<T extends v.GenericSchema<string>>(\n\tschema: T,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tmulti_select: v.array(\n\t\t\t\tv.object({\n\t\t\t\t\tname: schema,\n\t\t\t\t}),\n\t\t\t),\n\t\t}),\n\t\t// biome-ignore lint/style/noNonNullAssertion: valibot inference is not working correctly\n\t\tv.transform((v) => v.multi_select.map((v) => v.name!)),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,kBACf,QACC;AACD,QAAOA,QAAE,KACRA,QAAE,OAAO,EACR,cAAcA,QAAE,MACfA,QAAE,OAAO,EACR,MAAM,QACN,CAAC,CACF,EACD,CAAC,EAEFA,QAAE,WAAW,MAAM,EAAE,aAAa,KAAK,QAAMA,IAAE,KAAM,CAAC,CACtD"}
@@ -1,6 +1,67 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/multi-select.d.ts
4
+
5
+ /**
6
+ * Schema factory to extract the `multi_select` property from a Notion page property.
7
+ *
8
+ * This is a generic schema factory that accepts another schema as a parameter,
9
+ * allowing you to combine it with other schemas in this library to extract
10
+ * typed multi-select values. The multi-select property in Notion contains an
11
+ * array of objects with a `name` field that can be validated using the provided schema.
12
+ *
13
+ * **Input:**
14
+ * ```
15
+ * {
16
+ * multi_select: Array<{
17
+ * name: string;
18
+ * }>;
19
+ * }
20
+ * ```
21
+ *
22
+ * **Output:** The output type depends on the schema passed as a parameter.
23
+ * For example, if `v.string()` is passed, the output will be `string[]`.
24
+ *
25
+ * @param schema - A schema that validates the multi-select option name.
26
+ * Must accept a string value.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import * as v from "valibot";
31
+ * import { MultiSelectSchema } from "@nakanoaas/notion-valibot-utils";
32
+ *
33
+ * const PageSchema = v.object({
34
+ * id: v.string(),
35
+ * properties: v.object({
36
+ * Tags: MultiSelectSchema(v.string()),
37
+ * }),
38
+ * });
39
+ *
40
+ * const page = await notion.pages.retrieve({ page_id: "..." });
41
+ * const parsed = v.parse(PageSchema, page);
42
+ * // parsed.properties.Tags: string[]
43
+ * ```
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * import * as v from "valibot";
48
+ * import { MultiSelectSchema } from "@nakanoaas/notion-valibot-utils";
49
+ *
50
+ * // Custom schema for enum values
51
+ * const TagSchema = v.picklist(["urgent", "important", "normal"]);
52
+ *
53
+ * const PageSchema = v.object({
54
+ * id: v.string(),
55
+ * properties: v.object({
56
+ * Tags: MultiSelectSchema(TagSchema),
57
+ * }),
58
+ * });
59
+ *
60
+ * const page = await notion.pages.retrieve({ page_id: "..." });
61
+ * const parsed = v.parse(PageSchema, page);
62
+ * // parsed.properties.Tags: ("urgent" | "important" | "normal")[]
63
+ * ```
64
+ */
4
65
  declare function MultiSelectSchema<T extends v.GenericSchema<string>>(schema: T): v.SchemaWithPipe<readonly [v.ObjectSchema<{
5
66
  readonly multi_select: v.ArraySchema<v.ObjectSchema<{
6
67
  readonly name: T;
@@ -1,6 +1,67 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/multi-select.d.ts
4
+
5
+ /**
6
+ * Schema factory to extract the `multi_select` property from a Notion page property.
7
+ *
8
+ * This is a generic schema factory that accepts another schema as a parameter,
9
+ * allowing you to combine it with other schemas in this library to extract
10
+ * typed multi-select values. The multi-select property in Notion contains an
11
+ * array of objects with a `name` field that can be validated using the provided schema.
12
+ *
13
+ * **Input:**
14
+ * ```
15
+ * {
16
+ * multi_select: Array<{
17
+ * name: string;
18
+ * }>;
19
+ * }
20
+ * ```
21
+ *
22
+ * **Output:** The output type depends on the schema passed as a parameter.
23
+ * For example, if `v.string()` is passed, the output will be `string[]`.
24
+ *
25
+ * @param schema - A schema that validates the multi-select option name.
26
+ * Must accept a string value.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import * as v from "valibot";
31
+ * import { MultiSelectSchema } from "@nakanoaas/notion-valibot-utils";
32
+ *
33
+ * const PageSchema = v.object({
34
+ * id: v.string(),
35
+ * properties: v.object({
36
+ * Tags: MultiSelectSchema(v.string()),
37
+ * }),
38
+ * });
39
+ *
40
+ * const page = await notion.pages.retrieve({ page_id: "..." });
41
+ * const parsed = v.parse(PageSchema, page);
42
+ * // parsed.properties.Tags: string[]
43
+ * ```
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * import * as v from "valibot";
48
+ * import { MultiSelectSchema } from "@nakanoaas/notion-valibot-utils";
49
+ *
50
+ * // Custom schema for enum values
51
+ * const TagSchema = v.picklist(["urgent", "important", "normal"]);
52
+ *
53
+ * const PageSchema = v.object({
54
+ * id: v.string(),
55
+ * properties: v.object({
56
+ * Tags: MultiSelectSchema(TagSchema),
57
+ * }),
58
+ * });
59
+ *
60
+ * const page = await notion.pages.retrieve({ page_id: "..." });
61
+ * const parsed = v.parse(PageSchema, page);
62
+ * // parsed.properties.Tags: ("urgent" | "important" | "normal")[]
63
+ * ```
64
+ */
4
65
  declare function MultiSelectSchema<T extends v.GenericSchema<string>>(schema: T): v.SchemaWithPipe<readonly [v.ObjectSchema<{
5
66
  readonly multi_select: v.ArraySchema<v.ObjectSchema<{
6
67
  readonly name: T;
@@ -1,6 +1,66 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/multi-select.ts
4
+ /**
5
+ * Schema factory to extract the `multi_select` property from a Notion page property.
6
+ *
7
+ * This is a generic schema factory that accepts another schema as a parameter,
8
+ * allowing you to combine it with other schemas in this library to extract
9
+ * typed multi-select values. The multi-select property in Notion contains an
10
+ * array of objects with a `name` field that can be validated using the provided schema.
11
+ *
12
+ * **Input:**
13
+ * ```
14
+ * {
15
+ * multi_select: Array<{
16
+ * name: string;
17
+ * }>;
18
+ * }
19
+ * ```
20
+ *
21
+ * **Output:** The output type depends on the schema passed as a parameter.
22
+ * For example, if `v.string()` is passed, the output will be `string[]`.
23
+ *
24
+ * @param schema - A schema that validates the multi-select option name.
25
+ * Must accept a string value.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import * as v from "valibot";
30
+ * import { MultiSelectSchema } from "@nakanoaas/notion-valibot-utils";
31
+ *
32
+ * const PageSchema = v.object({
33
+ * id: v.string(),
34
+ * properties: v.object({
35
+ * Tags: MultiSelectSchema(v.string()),
36
+ * }),
37
+ * });
38
+ *
39
+ * const page = await notion.pages.retrieve({ page_id: "..." });
40
+ * const parsed = v.parse(PageSchema, page);
41
+ * // parsed.properties.Tags: string[]
42
+ * ```
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * import * as v from "valibot";
47
+ * import { MultiSelectSchema } from "@nakanoaas/notion-valibot-utils";
48
+ *
49
+ * // Custom schema for enum values
50
+ * const TagSchema = v.picklist(["urgent", "important", "normal"]);
51
+ *
52
+ * const PageSchema = v.object({
53
+ * id: v.string(),
54
+ * properties: v.object({
55
+ * Tags: MultiSelectSchema(TagSchema),
56
+ * }),
57
+ * });
58
+ *
59
+ * const page = await notion.pages.retrieve({ page_id: "..." });
60
+ * const parsed = v.parse(PageSchema, page);
61
+ * // parsed.properties.Tags: ("urgent" | "important" | "normal")[]
62
+ * ```
63
+ */
4
64
  function MultiSelectSchema(schema) {
5
65
  return v.pipe(v.object({ multi_select: v.array(v.object({ name: schema })) }), v.transform((v$1) => v$1.multi_select.map((v$2) => v$2.name)));
6
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"multi-select.mjs","names":["v"],"sources":["../src/multi-select.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport function MultiSelectSchema<T extends v.GenericSchema<string>>(\n\tschema: T,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tmulti_select: v.array(\n\t\t\t\tv.object({\n\t\t\t\t\tname: schema,\n\t\t\t\t}),\n\t\t\t),\n\t\t}),\n\t\t// biome-ignore lint/style/noNonNullAssertion: valibot inference is not working correctly\n\t\tv.transform((v) => v.multi_select.map((v) => v.name!)),\n\t);\n}\n"],"mappings":";;;AAEA,SAAgB,kBACf,QACC;AACD,QAAO,EAAE,KACR,EAAE,OAAO,EACR,cAAc,EAAE,MACf,EAAE,OAAO,EACR,MAAM,QACN,CAAC,CACF,EACD,CAAC,EAEF,EAAE,WAAW,QAAMA,IAAE,aAAa,KAAK,QAAMA,IAAE,KAAM,CAAC,CACtD"}
1
+ {"version":3,"file":"multi-select.mjs","names":["v"],"sources":["../src/multi-select.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `multi_select` property 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 multi-select values. The multi-select property in Notion contains an\n * array of objects with a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * multi_select: Array<{\n * name: string;\n * }>;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter.\n * For example, if `v.string()` is passed, the output will be `string[]`.\n *\n * @param schema - A schema that validates the multi-select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { MultiSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Tags: MultiSelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Tags: string[]\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { MultiSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const TagSchema = v.picklist([\"urgent\", \"important\", \"normal\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Tags: MultiSelectSchema(TagSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Tags: (\"urgent\" | \"important\" | \"normal\")[]\n * ```\n */\nexport function MultiSelectSchema<T extends v.GenericSchema<string>>(\n\tschema: T,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tmulti_select: v.array(\n\t\t\t\tv.object({\n\t\t\t\t\tname: schema,\n\t\t\t\t}),\n\t\t\t),\n\t\t}),\n\t\t// biome-ignore lint/style/noNonNullAssertion: valibot inference is not working correctly\n\t\tv.transform((v) => v.multi_select.map((v) => v.name!)),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,kBACf,QACC;AACD,QAAO,EAAE,KACR,EAAE,OAAO,EACR,cAAc,EAAE,MACf,EAAE,OAAO,EACR,MAAM,QACN,CAAC,CACF,EACD,CAAC,EAEF,EAAE,WAAW,QAAMA,IAAE,aAAa,KAAK,QAAMA,IAAE,KAAM,CAAC,CACtD"}
package/dist/number.cjs CHANGED
@@ -3,7 +3,65 @@ let valibot = require("valibot");
3
3
  valibot = require_rolldown_runtime.__toESM(valibot);
4
4
 
5
5
  //#region src/number.ts
6
+ /**
7
+ * Schema to extract the `number` property from a Notion page property.
8
+ *
9
+ * **Input:**
10
+ * ```
11
+ * {
12
+ * number: number;
13
+ * }
14
+ * ```
15
+ *
16
+ * **Output:** `number`
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * import * as v from "valibot";
21
+ * import { NumberSchema } from "@nakanoaas/notion-valibot-utils";
22
+ *
23
+ * const PageSchema = v.object({
24
+ * id: v.string(),
25
+ * properties: v.object({
26
+ * Number: NumberSchema,
27
+ * }),
28
+ * });
29
+ *
30
+ * const page = await notion.pages.retrieve({ page_id: "..." });
31
+ * const parsed = v.parse(PageSchema, page);
32
+ * // parsed.properties.Number: number
33
+ * ```
34
+ */
6
35
  const NumberSchema = valibot.pipe(valibot.object({ number: valibot.number() }), valibot.transform((v) => v.number));
36
+ /**
37
+ * Schema to extract the `number` property from a Notion page property or `null`.
38
+ *
39
+ * **Input:**
40
+ * ```
41
+ * {
42
+ * number: number | null;
43
+ * }
44
+ * ```
45
+ *
46
+ * **Output:** `number | null`
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * import * as v from "valibot";
51
+ * import { NullableNumberSchema } from "@nakanoaas/notion-valibot-utils";
52
+ *
53
+ * const PageSchema = v.object({
54
+ * id: v.string(),
55
+ * properties: v.object({
56
+ * Number: NullableNumberSchema,
57
+ * }),
58
+ * });
59
+ *
60
+ * const page = await notion.pages.retrieve({ page_id: "..." });
61
+ * const parsed = v.parse(PageSchema, page);
62
+ * // parsed.properties.Number: number | null
63
+ * ```
64
+ */
7
65
  const NullableNumberSchema = valibot.pipe(valibot.object({ number: valibot.nullable(valibot.number()) }), valibot.transform((v) => v.number));
8
66
 
9
67
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"number.cjs","names":["v"],"sources":["../src/number.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const NumberSchema = v.pipe(\n\tv.object({\n\t\tnumber: v.number(),\n\t}),\n\tv.transform((v) => v.number),\n);\n\nexport const NullableNumberSchema = v.pipe(\n\tv.object({\n\t\tnumber: v.nullable(v.number()),\n\t}),\n\tv.transform((v) => v.number),\n);\n"],"mappings":";;;;;AAEA,MAAa,eAAeA,QAAE,KAC7BA,QAAE,OAAO,EACR,QAAQA,QAAE,QAAQ,EAClB,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,OAAO,CAC5B;AAED,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,QAAQA,QAAE,SAASA,QAAE,QAAQ,CAAC,EAC9B,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,OAAO,CAC5B"}
1
+ {"version":3,"file":"number.cjs","names":["v"],"sources":["../src/number.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `number` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * number: number;\n * }\n * ```\n *\n * **Output:** `number`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Number: NumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Number: number\n * ```\n */\nexport const NumberSchema = v.pipe(\n\tv.object({\n\t\tnumber: v.number(),\n\t}),\n\tv.transform((v) => v.number),\n);\n\n/**\n * Schema to extract the `number` property from a Notion page property or `null`.\n *\n * **Input:**\n * ```\n * {\n * number: number | null;\n * }\n * ```\n *\n * **Output:** `number | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Number: NullableNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Number: number | null\n * ```\n */\nexport const NullableNumberSchema = v.pipe(\n\tv.object({\n\t\tnumber: v.nullable(v.number()),\n\t}),\n\tv.transform((v) => v.number),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,eAAeA,QAAE,KAC7BA,QAAE,OAAO,EACR,QAAQA,QAAE,QAAQ,EAClB,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,OAAO,CAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,QAAQA,QAAE,SAASA,QAAE,QAAQ,CAAC,EAC9B,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,OAAO,CAC5B"}
package/dist/number.d.cts CHANGED
@@ -1,11 +1,70 @@
1
1
  import * as v from "valibot";
2
2
 
3
3
  //#region src/number.d.ts
4
+
5
+ /**
6
+ * Schema to extract the `number` property from a Notion page property.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * number: number;
12
+ * }
13
+ * ```
14
+ *
15
+ * **Output:** `number`
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import * as v from "valibot";
20
+ * import { NumberSchema } from "@nakanoaas/notion-valibot-utils";
21
+ *
22
+ * const PageSchema = v.object({
23
+ * id: v.string(),
24
+ * properties: v.object({
25
+ * Number: NumberSchema,
26
+ * }),
27
+ * });
28
+ *
29
+ * const page = await notion.pages.retrieve({ page_id: "..." });
30
+ * const parsed = v.parse(PageSchema, page);
31
+ * // parsed.properties.Number: number
32
+ * ```
33
+ */
4
34
  declare const NumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
5
35
  readonly number: v.NumberSchema<undefined>;
6
36
  }, undefined>, v.TransformAction<{
7
37
  number: number;
8
38
  }, number>]>;
39
+ /**
40
+ * Schema to extract the `number` property from a Notion page property or `null`.
41
+ *
42
+ * **Input:**
43
+ * ```
44
+ * {
45
+ * number: number | null;
46
+ * }
47
+ * ```
48
+ *
49
+ * **Output:** `number | null`
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * import * as v from "valibot";
54
+ * import { NullableNumberSchema } from "@nakanoaas/notion-valibot-utils";
55
+ *
56
+ * const PageSchema = v.object({
57
+ * id: v.string(),
58
+ * properties: v.object({
59
+ * Number: NullableNumberSchema,
60
+ * }),
61
+ * });
62
+ *
63
+ * const page = await notion.pages.retrieve({ page_id: "..." });
64
+ * const parsed = v.parse(PageSchema, page);
65
+ * // parsed.properties.Number: number | null
66
+ * ```
67
+ */
9
68
  declare const NullableNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
10
69
  readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
11
70
  }, undefined>, v.TransformAction<{