@nakanoaas/notion-valibot-schema 0.2.2 → 0.3.0

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 (103) hide show
  1. package/README.md +2 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +7 -13
  3. package/dist/checkbox.cjs +3 -4
  4. package/dist/checkbox.cjs.map +1 -1
  5. package/dist/checkbox.mjs +1 -2
  6. package/dist/checkbox.mjs.map +1 -1
  7. package/dist/created-by.cjs +4 -5
  8. package/dist/created-by.cjs.map +1 -1
  9. package/dist/created-by.mjs +1 -2
  10. package/dist/created-by.mjs.map +1 -1
  11. package/dist/created-time.cjs +3 -4
  12. package/dist/created-time.cjs.map +1 -1
  13. package/dist/created-time.mjs +1 -2
  14. package/dist/created-time.mjs.map +1 -1
  15. package/dist/date.cjs +3 -4
  16. package/dist/date.cjs.map +1 -1
  17. package/dist/date.mjs +1 -2
  18. package/dist/date.mjs.map +1 -1
  19. package/dist/email.cjs +3 -4
  20. package/dist/email.cjs.map +1 -1
  21. package/dist/email.mjs +1 -2
  22. package/dist/email.mjs.map +1 -1
  23. package/dist/file.cjs +164 -0
  24. package/dist/file.cjs.map +1 -0
  25. package/dist/file.d.cts +198 -0
  26. package/dist/file.d.mts +198 -0
  27. package/dist/file.mjs +160 -0
  28. package/dist/file.mjs.map +1 -0
  29. package/dist/formula.cjs +3 -4
  30. package/dist/formula.cjs.map +1 -1
  31. package/dist/formula.mjs +1 -2
  32. package/dist/formula.mjs.map +1 -1
  33. package/dist/index.cjs +27 -26
  34. package/dist/index.d.cts +2 -2
  35. package/dist/index.d.mts +2 -2
  36. package/dist/index.mjs +2 -3
  37. package/dist/last-edited-by.cjs +4 -5
  38. package/dist/last-edited-by.cjs.map +1 -1
  39. package/dist/last-edited-by.mjs +1 -2
  40. package/dist/last-edited-by.mjs.map +1 -1
  41. package/dist/last-edited-time.cjs +3 -4
  42. package/dist/last-edited-time.cjs.map +1 -1
  43. package/dist/last-edited-time.mjs +1 -2
  44. package/dist/last-edited-time.mjs.map +1 -1
  45. package/dist/multi-select.cjs +3 -4
  46. package/dist/multi-select.cjs.map +1 -1
  47. package/dist/multi-select.mjs +1 -2
  48. package/dist/multi-select.mjs.map +1 -1
  49. package/dist/number.cjs +3 -4
  50. package/dist/number.cjs.map +1 -1
  51. package/dist/number.mjs +1 -2
  52. package/dist/number.mjs.map +1 -1
  53. package/dist/people.cjs +3 -4
  54. package/dist/people.cjs.map +1 -1
  55. package/dist/people.mjs +1 -2
  56. package/dist/people.mjs.map +1 -1
  57. package/dist/phone-number.cjs +3 -4
  58. package/dist/phone-number.cjs.map +1 -1
  59. package/dist/phone-number.mjs +1 -2
  60. package/dist/phone-number.mjs.map +1 -1
  61. package/dist/place.cjs +3 -4
  62. package/dist/place.cjs.map +1 -1
  63. package/dist/place.mjs +1 -2
  64. package/dist/place.mjs.map +1 -1
  65. package/dist/relation.cjs +3 -4
  66. package/dist/relation.cjs.map +1 -1
  67. package/dist/relation.mjs +1 -2
  68. package/dist/relation.mjs.map +1 -1
  69. package/dist/rollup.cjs +4 -5
  70. package/dist/rollup.cjs.map +1 -1
  71. package/dist/rollup.mjs +1 -2
  72. package/dist/rollup.mjs.map +1 -1
  73. package/dist/select.cjs +3 -4
  74. package/dist/select.cjs.map +1 -1
  75. package/dist/select.mjs +1 -2
  76. package/dist/select.mjs.map +1 -1
  77. package/dist/status.cjs +3 -4
  78. package/dist/status.cjs.map +1 -1
  79. package/dist/status.mjs +1 -2
  80. package/dist/status.mjs.map +1 -1
  81. package/dist/text.cjs +3 -4
  82. package/dist/text.cjs.map +1 -1
  83. package/dist/text.mjs +1 -2
  84. package/dist/text.mjs.map +1 -1
  85. package/dist/unique-id.cjs +3 -4
  86. package/dist/unique-id.cjs.map +1 -1
  87. package/dist/unique-id.mjs +1 -2
  88. package/dist/unique-id.mjs.map +1 -1
  89. package/dist/url.cjs +3 -4
  90. package/dist/url.cjs.map +1 -1
  91. package/dist/url.mjs +1 -2
  92. package/dist/url.mjs.map +1 -1
  93. package/dist/verification.cjs +5 -6
  94. package/dist/verification.cjs.map +1 -1
  95. package/dist/verification.mjs +1 -2
  96. package/dist/verification.mjs.map +1 -1
  97. package/package.json +2 -2
  98. package/dist/files.cjs +0 -55
  99. package/dist/files.cjs.map +0 -1
  100. package/dist/files.d.cts +0 -70
  101. package/dist/files.d.mts +0 -70
  102. package/dist/files.mjs +0 -53
  103. package/dist/files.mjs.map +0 -1
package/dist/text.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"text.mjs","names":[],"sources":["../src/text.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion rich text array structure.\n *\n * **Input:**\n * ```\n * Array<{\n * plain_text: string;\n * }>\n * ```\n *\n * **Output:**\n * ```\n * Array<{\n * plain_text: string;\n * }>\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { RichTextItemArraySchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Text: v.object({\n * rich_text: RichTextItemArraySchema,\n * }),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Text.rich_text: Array<{ plain_text: string }>\n * ```\n *\n * @internal\n */\nconst RichTextItemArraySchema = v.array(\n\tv.object({\n\t\tplain_text: v.string(),\n\t}),\n);\n\n/**\n * Schema to extract the `title` property from a Notion page property and transform it to a string.\n *\n * **Input:**\n * ```\n * {\n * title: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string` (non-empty)\n *\n * This schema validates that the resulting string is non-empty. Empty arrays or arrays with only empty `plain_text` values will be rejected.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { TitleSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Title: TitleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Title: string\n * ```\n */\nexport const TitleSchema = v.pipe(\n\tv.object({\n\t\ttitle: RichTextItemArraySchema,\n\t}),\n\tv.transform((v) => v.title.map((v) => v.plain_text).join(\"\")),\n\tv.nonEmpty(),\n);\n\n/**\n * Schema to extract the `title` property from a Notion page property and transform it to a string or `null`.\n *\n * **Input:**\n * ```\n * {\n * title: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * If the `title` array is empty or all `plain_text` values are empty strings, this schema returns `null`. Otherwise, it joins all `plain_text` values into a single string.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableTitleSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Title: NullableTitleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Title: string | null\n * ```\n */\nexport const NullableTitleSchema = v.pipe(\n\tv.object({\n\t\ttitle: RichTextItemArraySchema,\n\t}),\n\tv.transform((v) => v.title.map((v) => v.plain_text).join(\"\") || null),\n);\n\n/**\n * Schema to extract the `rich_text` property from a Notion page property and transform it to a string.\n *\n * **Input:**\n * ```\n * {\n * rich_text: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string` (non-empty)\n *\n * This schema validates that the resulting string is non-empty. Empty arrays or arrays with only empty `plain_text` values will be rejected.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { RichTextSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Description: RichTextSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Description: string\n * ```\n */\nexport const RichTextSchema = v.pipe(\n\tv.object({\n\t\trich_text: RichTextItemArraySchema,\n\t}),\n\tv.transform((v) => v.rich_text.map((v) => v.plain_text).join(\"\")),\n\tv.nonEmpty(),\n);\n\n/**\n * Schema to extract the `rich_text` property from a Notion page property and transform it to a string or `null`.\n *\n * **Input:**\n * ```\n * {\n * rich_text: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * If the `rich_text` array is empty or all `plain_text` values are empty strings, this schema returns `null`. Otherwise, it joins all `plain_text` values into a single string.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableRichTextSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Description: NullableRichTextSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Description: string | null\n * ```\n */\nexport const NullableRichTextSchema = v.pipe(\n\tv.object({\n\t\trich_text: RichTextItemArraySchema,\n\t}),\n\tv.transform((v) => v.rich_text.map((v) => v.plain_text).join(\"\") || null),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,0BAA0B,EAAE,MACjC,EAAE,OAAO,EACR,YAAY,EAAE,QAAQ,EACtB,CAAC,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,cAAc,EAAE,KAC5B,EAAE,OAAO,EACR,OAAO,yBACP,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,WAAW,CAAC,KAAK,GAAG,CAAC,EAC7D,EAAE,UAAU,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,sBAAsB,EAAE,KACpC,EAAE,OAAO,EACR,OAAO,yBACP,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,WAAW,CAAC,KAAK,GAAG,IAAI,KAAK,CACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,iBAAiB,EAAE,KAC/B,EAAE,OAAO,EACR,WAAW,yBACX,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,UAAU,KAAK,MAAM,EAAE,WAAW,CAAC,KAAK,GAAG,CAAC,EACjE,EAAE,UAAU,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,yBAAyB,EAAE,KACvC,EAAE,OAAO,EACR,WAAW,yBACX,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,UAAU,KAAK,MAAM,EAAE,WAAW,CAAC,KAAK,GAAG,IAAI,KAAK,CACzE"}
1
+ {"version":3,"file":"text.mjs","names":[],"sources":["../src/text.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion rich text array structure.\n *\n * **Input:**\n * ```\n * Array<{\n * plain_text: string;\n * }>\n * ```\n *\n * **Output:**\n * ```\n * Array<{\n * plain_text: string;\n * }>\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { RichTextItemArraySchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Text: v.object({\n * rich_text: RichTextItemArraySchema,\n * }),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Text.rich_text: Array<{ plain_text: string }>\n * ```\n *\n * @internal\n */\nconst RichTextItemArraySchema = v.array(\n\tv.object({\n\t\tplain_text: v.string(),\n\t}),\n);\n\n/**\n * Schema to extract the `title` property from a Notion page property and transform it to a string.\n *\n * **Input:**\n * ```\n * {\n * title: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string` (non-empty)\n *\n * This schema validates that the resulting string is non-empty. Empty arrays or arrays with only empty `plain_text` values will be rejected.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { TitleSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Title: TitleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Title: string\n * ```\n */\nexport const TitleSchema = v.pipe(\n\tv.object({\n\t\ttitle: RichTextItemArraySchema,\n\t}),\n\tv.transform((v) => v.title.map((v) => v.plain_text).join(\"\")),\n\tv.nonEmpty(),\n);\n\n/**\n * Schema to extract the `title` property from a Notion page property and transform it to a string or `null`.\n *\n * **Input:**\n * ```\n * {\n * title: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * If the `title` array is empty or all `plain_text` values are empty strings, this schema returns `null`. Otherwise, it joins all `plain_text` values into a single string.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableTitleSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Title: NullableTitleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Title: string | null\n * ```\n */\nexport const NullableTitleSchema = v.pipe(\n\tv.object({\n\t\ttitle: RichTextItemArraySchema,\n\t}),\n\tv.transform((v) => v.title.map((v) => v.plain_text).join(\"\") || null),\n);\n\n/**\n * Schema to extract the `rich_text` property from a Notion page property and transform it to a string.\n *\n * **Input:**\n * ```\n * {\n * rich_text: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string` (non-empty)\n *\n * This schema validates that the resulting string is non-empty. Empty arrays or arrays with only empty `plain_text` values will be rejected.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { RichTextSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Description: RichTextSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Description: string\n * ```\n */\nexport const RichTextSchema = v.pipe(\n\tv.object({\n\t\trich_text: RichTextItemArraySchema,\n\t}),\n\tv.transform((v) => v.rich_text.map((v) => v.plain_text).join(\"\")),\n\tv.nonEmpty(),\n);\n\n/**\n * Schema to extract the `rich_text` property from a Notion page property and transform it to a string or `null`.\n *\n * **Input:**\n * ```\n * {\n * rich_text: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * If the `rich_text` array is empty or all `plain_text` values are empty strings, this schema returns `null`. Otherwise, it joins all `plain_text` values into a single string.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableRichTextSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Description: NullableRichTextSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Description: string | null\n * ```\n */\nexport const NullableRichTextSchema = v.pipe(\n\tv.object({\n\t\trich_text: RichTextItemArraySchema,\n\t}),\n\tv.transform((v) => v.rich_text.map((v) => v.plain_text).join(\"\") || null),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,0BAA0B,EAAE,MACjC,EAAE,OAAO,EACR,YAAY,EAAE,OAAO,EACtB,CAAC,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,cAAc,EAAE,KAC5B,EAAE,OAAO,EACR,OAAO,wBACR,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC,GAC5D,EAAE,SAAS,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,sBAAsB,EAAE,KACpC,EAAE,OAAO,EACR,OAAO,wBACR,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,IAAI,CACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,iBAAiB,EAAE,KAC/B,EAAE,OAAO,EACR,WAAW,wBACZ,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,UAAU,KAAK,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC,GAChE,EAAE,SAAS,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,yBAAyB,EAAE,KACvC,EAAE,OAAO,EACR,WAAW,wBACZ,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,UAAU,KAAK,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,IAAI,CACzE"}
@@ -1,7 +1,6 @@
1
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
2
  let valibot = require("valibot");
3
- valibot = require_runtime.__toESM(valibot);
4
-
3
+ valibot = require_runtime.__toESM(valibot, 1);
5
4
  //#region src/unique-id.ts
6
5
  /**
7
6
  * Schema to extract the `unique_id` property number from a Notion page property.
@@ -77,8 +76,8 @@ const NullableUniqueIdSchema = valibot.pipe(valibot.object({ unique_id: valibot.
77
76
  prefix: valibot.nullable(valibot.string()),
78
77
  number: valibot.nullable(valibot.number())
79
78
  }) }), valibot.transform((v) => v.unique_id));
80
-
81
79
  //#endregion
82
80
  exports.NullableUniqueIdSchema = NullableUniqueIdSchema;
83
81
  exports.UniqueIdNumberSchema = UniqueIdNumberSchema;
82
+
84
83
  //# sourceMappingURL=unique-id.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"unique-id.cjs","names":["v"],"sources":["../src/unique-id.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `unique_id` property number from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * number: number;\n * };\n * }\n * ```\n *\n * **Output:** `number`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UniqueIdNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: UniqueIdNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: number\n * ```\n */\nexport const UniqueIdNumberSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tnumber: v.number(),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id.number),\n);\n\n/**\n * Schema to extract the `unique_id` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * prefix: string | null;\n * number: number | null;\n * };\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * prefix: string | null;\n * number: number | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUniqueIdSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: NullableUniqueIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: { prefix: string | null; number: number | null }\n * ```\n */\nexport const NullableUniqueIdSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tprefix: v.nullable(v.string()),\n\t\t\tnumber: v.nullable(v.number()),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,WAAWA,QAAE,OAAO,EACnB,QAAQA,QAAE,QAAQ,EAClB,CAAC,EACF,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,UAAU,OAAO,CACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCD,MAAa,yBAAyBA,QAAE,KACvCA,QAAE,OAAO,EACR,WAAWA,QAAE,OAAO;CACnB,QAAQA,QAAE,SAASA,QAAE,QAAQ,CAAC;CAC9B,QAAQA,QAAE,SAASA,QAAE,QAAQ,CAAC;CAC9B,CAAC,EACF,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,UAAU,CAC/B"}
1
+ {"version":3,"file":"unique-id.cjs","names":["v"],"sources":["../src/unique-id.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `unique_id` property number from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * number: number;\n * };\n * }\n * ```\n *\n * **Output:** `number`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UniqueIdNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: UniqueIdNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: number\n * ```\n */\nexport const UniqueIdNumberSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tnumber: v.number(),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id.number),\n);\n\n/**\n * Schema to extract the `unique_id` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * prefix: string | null;\n * number: number | null;\n * };\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * prefix: string | null;\n * number: number | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUniqueIdSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: NullableUniqueIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: { prefix: string | null; number: number | null }\n * ```\n */\nexport const NullableUniqueIdSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tprefix: v.nullable(v.string()),\n\t\t\tnumber: v.nullable(v.number()),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,WAAWA,QAAE,OAAO,EACnB,QAAQA,QAAE,OAAO,EAClB,CAAC,EACF,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,UAAU,MAAM,CACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAa,yBAAyBA,QAAE,KACvCA,QAAE,OAAO,EACR,WAAWA,QAAE,OAAO;CACnB,QAAQA,QAAE,SAASA,QAAE,OAAO,CAAC;CAC7B,QAAQA,QAAE,SAASA,QAAE,OAAO,CAAC;AAC9B,CAAC,EACF,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,SAAS,CAC/B"}
@@ -1,5 +1,4 @@
1
1
  import * as v from "valibot";
2
-
3
2
  //#region src/unique-id.ts
4
3
  /**
5
4
  * Schema to extract the `unique_id` property number from a Notion page property.
@@ -75,7 +74,7 @@ const NullableUniqueIdSchema = v.pipe(v.object({ unique_id: v.object({
75
74
  prefix: v.nullable(v.string()),
76
75
  number: v.nullable(v.number())
77
76
  }) }), v.transform((v) => v.unique_id));
78
-
79
77
  //#endregion
80
78
  export { NullableUniqueIdSchema, UniqueIdNumberSchema };
79
+
81
80
  //# sourceMappingURL=unique-id.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"unique-id.mjs","names":[],"sources":["../src/unique-id.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `unique_id` property number from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * number: number;\n * };\n * }\n * ```\n *\n * **Output:** `number`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UniqueIdNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: UniqueIdNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: number\n * ```\n */\nexport const UniqueIdNumberSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tnumber: v.number(),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id.number),\n);\n\n/**\n * Schema to extract the `unique_id` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * prefix: string | null;\n * number: number | null;\n * };\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * prefix: string | null;\n * number: number | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUniqueIdSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: NullableUniqueIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: { prefix: string | null; number: number | null }\n * ```\n */\nexport const NullableUniqueIdSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tprefix: v.nullable(v.string()),\n\t\t\tnumber: v.nullable(v.number()),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,WAAW,EAAE,OAAO,EACnB,QAAQ,EAAE,QAAQ,EAClB,CAAC,EACF,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,UAAU,OAAO,CACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCD,MAAa,yBAAyB,EAAE,KACvC,EAAE,OAAO,EACR,WAAW,EAAE,OAAO;CACnB,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC9B,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC9B,CAAC,EACF,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,UAAU,CAC/B"}
1
+ {"version":3,"file":"unique-id.mjs","names":[],"sources":["../src/unique-id.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `unique_id` property number from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * number: number;\n * };\n * }\n * ```\n *\n * **Output:** `number`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UniqueIdNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: UniqueIdNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: number\n * ```\n */\nexport const UniqueIdNumberSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tnumber: v.number(),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id.number),\n);\n\n/**\n * Schema to extract the `unique_id` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * prefix: string | null;\n * number: number | null;\n * };\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * prefix: string | null;\n * number: number | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUniqueIdSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: NullableUniqueIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: { prefix: string | null; number: number | null }\n * ```\n */\nexport const NullableUniqueIdSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tprefix: v.nullable(v.string()),\n\t\t\tnumber: v.nullable(v.number()),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,WAAW,EAAE,OAAO,EACnB,QAAQ,EAAE,OAAO,EAClB,CAAC,EACF,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,UAAU,MAAM,CACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAa,yBAAyB,EAAE,KACvC,EAAE,OAAO,EACR,WAAW,EAAE,OAAO;CACnB,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;CAC7B,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;AAC9B,CAAC,EACF,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,SAAS,CAC/B"}
package/dist/url.cjs CHANGED
@@ -1,7 +1,6 @@
1
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
2
  let valibot = require("valibot");
3
- valibot = require_runtime.__toESM(valibot);
4
-
3
+ valibot = require_runtime.__toESM(valibot, 1);
5
4
  //#region src/url.ts
6
5
  /**
7
6
  * Schema to extract the `url` property from a Notion page property or `null`.
@@ -63,8 +62,8 @@ const NullableUrlSchema = valibot.pipe(valibot.object({ url: valibot.nullable(va
63
62
  * ```
64
63
  */
65
64
  const UrlSchema = valibot.pipe(valibot.object({ url: valibot.string() }), valibot.transform((v) => v.url));
66
-
67
65
  //#endregion
68
66
  exports.NullableUrlSchema = NullableUrlSchema;
69
67
  exports.UrlSchema = UrlSchema;
68
+
70
69
  //# sourceMappingURL=url.cjs.map
package/dist/url.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"url.cjs","names":["v"],"sources":["../src/url.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `url` property from a Notion page property or `null`.\n *\n * **Input:**\n * ```\n * {\n * url: string | null;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: NullableUrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string | null\n * ```\n */\nexport const NullableUrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.nullable(v.string()),\n\t}),\n\tv.transform((v) => v.url),\n);\n\n/**\n * Schema to extract the `url` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * url: string;\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: UrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string\n * ```\n */\nexport const UrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.string(),\n\t}),\n\tv.transform((v) => v.url),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,oBAAoBA,QAAE,KAClCA,QAAE,OAAO,EACR,KAAKA,QAAE,SAASA,QAAE,QAAQ,CAAC,EAC3B,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,IAAI,CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,MAAa,YAAYA,QAAE,KAC1BA,QAAE,OAAO,EACR,KAAKA,QAAE,QAAQ,EACf,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,IAAI,CACzB"}
1
+ {"version":3,"file":"url.cjs","names":["v"],"sources":["../src/url.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `url` property from a Notion page property or `null`.\n *\n * **Input:**\n * ```\n * {\n * url: string | null;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: NullableUrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string | null\n * ```\n */\nexport const NullableUrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.nullable(v.string()),\n\t}),\n\tv.transform((v) => v.url),\n);\n\n/**\n * Schema to extract the `url` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * url: string;\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: UrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string\n * ```\n */\nexport const UrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.string(),\n\t}),\n\tv.transform((v) => v.url),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,oBAAoBA,QAAE,KAClCA,QAAE,OAAO,EACR,KAAKA,QAAE,SAASA,QAAE,OAAO,CAAC,EAC3B,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,GAAG,CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,YAAYA,QAAE,KAC1BA,QAAE,OAAO,EACR,KAAKA,QAAE,OAAO,EACf,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,GAAG,CACzB"}
package/dist/url.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as v from "valibot";
2
-
3
2
  //#region src/url.ts
4
3
  /**
5
4
  * Schema to extract the `url` property from a Notion page property or `null`.
@@ -61,7 +60,7 @@ const NullableUrlSchema = v.pipe(v.object({ url: v.nullable(v.string()) }), v.tr
61
60
  * ```
62
61
  */
63
62
  const UrlSchema = v.pipe(v.object({ url: v.string() }), v.transform((v) => v.url));
64
-
65
63
  //#endregion
66
64
  export { NullableUrlSchema, UrlSchema };
65
+
67
66
  //# sourceMappingURL=url.mjs.map
package/dist/url.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"url.mjs","names":[],"sources":["../src/url.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `url` property from a Notion page property or `null`.\n *\n * **Input:**\n * ```\n * {\n * url: string | null;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: NullableUrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string | null\n * ```\n */\nexport const NullableUrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.nullable(v.string()),\n\t}),\n\tv.transform((v) => v.url),\n);\n\n/**\n * Schema to extract the `url` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * url: string;\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: UrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string\n * ```\n */\nexport const UrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.string(),\n\t}),\n\tv.transform((v) => v.url),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,oBAAoB,EAAE,KAClC,EAAE,OAAO,EACR,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAC3B,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,IAAI,CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,MAAa,YAAY,EAAE,KAC1B,EAAE,OAAO,EACR,KAAK,EAAE,QAAQ,EACf,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,IAAI,CACzB"}
1
+ {"version":3,"file":"url.mjs","names":[],"sources":["../src/url.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `url` property from a Notion page property or `null`.\n *\n * **Input:**\n * ```\n * {\n * url: string | null;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: NullableUrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string | null\n * ```\n */\nexport const NullableUrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.nullable(v.string()),\n\t}),\n\tv.transform((v) => v.url),\n);\n\n/**\n * Schema to extract the `url` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * url: string;\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: UrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string\n * ```\n */\nexport const UrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.string(),\n\t}),\n\tv.transform((v) => v.url),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,oBAAoB,EAAE,KAClC,EAAE,OAAO,EACR,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAC3B,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,GAAG,CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,YAAY,EAAE,KAC1B,EAAE,OAAO,EACR,KAAK,EAAE,OAAO,EACf,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,GAAG,CACzB"}
@@ -1,9 +1,8 @@
1
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
- const require_people = require('./people.cjs');
3
- const require_date = require('./date.cjs');
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
+ const require_people = require("./people.cjs");
3
+ const require_date = require("./date.cjs");
4
4
  let valibot = require("valibot");
5
- valibot = require_runtime.__toESM(valibot);
6
-
5
+ valibot = require_runtime.__toESM(valibot, 1);
7
6
  //#region src/verification.ts
8
7
  const InnerVerificationSchema = valibot.variant("state", [valibot.object({
9
8
  state: valibot.literal("unverified"),
@@ -96,8 +95,8 @@ const VerificationSchema = valibot.pipe(valibot.object({ verification: InnerVeri
96
95
  * ```
97
96
  */
98
97
  const NullableVerificationSchema = valibot.pipe(valibot.object({ verification: valibot.nullable(InnerVerificationSchema) }), valibot.transform((v) => v.verification));
99
-
100
98
  //#endregion
101
99
  exports.NullableVerificationSchema = NullableVerificationSchema;
102
100
  exports.VerificationSchema = VerificationSchema;
101
+
103
102
  //# sourceMappingURL=verification.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"verification.cjs","names":["v","DateObjectSchema","PersonSchema"],"sources":["../src/verification.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { DateObjectSchema } from \"./date\";\nimport { PersonSchema } from \"./people\";\n\nconst InnerVerificationSchema = v.variant(\"state\", [\n\tv.object({\n\t\tstate: v.literal(\"unverified\"),\n\t\tdate: v.null_(),\n\t\tverified_by: v.null_(),\n\t}),\n\tv.object({\n\t\tstate: v.union([v.literal(\"verified\"), v.literal(\"expired\")]),\n\t\tdate: v.nullable(DateObjectSchema),\n\t\tverified_by: v.nullable(PersonSchema),\n\t}),\n]);\n\n/**\n * Schema to extract the `verification` object from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { VerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: VerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null }\n * ```\n */\nexport const VerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: InnerVerificationSchema,\n\t}),\n\tv.transform((v) => v.verification),\n);\n\n/**\n * Schema to extract the `verification` object from a Notion property (nullable).\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableVerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: NullableVerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null } | null\n * ```\n */\nexport const NullableVerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: v.nullable(InnerVerificationSchema),\n\t}),\n\tv.transform((v) => v.verification),\n);\n"],"mappings":";;;;;;;AAKA,MAAM,0BAA0BA,QAAE,QAAQ,SAAS,CAClDA,QAAE,OAAO;CACR,OAAOA,QAAE,QAAQ,aAAa;CAC9B,MAAMA,QAAE,OAAO;CACf,aAAaA,QAAE,OAAO;CACtB,CAAC,EACFA,QAAE,OAAO;CACR,OAAOA,QAAE,MAAM,CAACA,QAAE,QAAQ,WAAW,EAAEA,QAAE,QAAQ,UAAU,CAAC,CAAC;CAC7D,MAAMA,QAAE,SAASC,8BAAiB;CAClC,aAAaD,QAAE,SAASE,4BAAa;CACrC,CAAC,CACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CF,MAAa,qBAAqBF,QAAE,KACnCA,QAAE,OAAO,EACR,cAAc,yBACd,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,aAAa,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CD,MAAa,6BAA6BA,QAAE,KAC3CA,QAAE,OAAO,EACR,cAAcA,QAAE,SAAS,wBAAwB,EACjD,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,aAAa,CAClC"}
1
+ {"version":3,"file":"verification.cjs","names":["v","DateObjectSchema","PersonSchema"],"sources":["../src/verification.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { DateObjectSchema } from \"./date\";\nimport { PersonSchema } from \"./people\";\n\nconst InnerVerificationSchema = v.variant(\"state\", [\n\tv.object({\n\t\tstate: v.literal(\"unverified\"),\n\t\tdate: v.null_(),\n\t\tverified_by: v.null_(),\n\t}),\n\tv.object({\n\t\tstate: v.union([v.literal(\"verified\"), v.literal(\"expired\")]),\n\t\tdate: v.nullable(DateObjectSchema),\n\t\tverified_by: v.nullable(PersonSchema),\n\t}),\n]);\n\n/**\n * Schema to extract the `verification` object from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { VerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: VerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null }\n * ```\n */\nexport const VerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: InnerVerificationSchema,\n\t}),\n\tv.transform((v) => v.verification),\n);\n\n/**\n * Schema to extract the `verification` object from a Notion property (nullable).\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableVerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: NullableVerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null } | null\n * ```\n */\nexport const NullableVerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: v.nullable(InnerVerificationSchema),\n\t}),\n\tv.transform((v) => v.verification),\n);\n"],"mappings":";;;;;;AAKA,MAAM,0BAA0BA,QAAE,QAAQ,SAAS,CAClDA,QAAE,OAAO;CACR,OAAOA,QAAE,QAAQ,YAAY;CAC7B,MAAMA,QAAE,MAAM;CACd,aAAaA,QAAE,MAAM;AACtB,CAAC,GACDA,QAAE,OAAO;CACR,OAAOA,QAAE,MAAM,CAACA,QAAE,QAAQ,UAAU,GAAGA,QAAE,QAAQ,SAAS,CAAC,CAAC;CAC5D,MAAMA,QAAE,SAASC,aAAAA,gBAAgB;CACjC,aAAaD,QAAE,SAASE,eAAAA,YAAY;AACrC,CAAC,CACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CD,MAAa,qBAAqBF,QAAE,KACnCA,QAAE,OAAO,EACR,cAAc,wBACf,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,YAAY,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,6BAA6BA,QAAE,KAC3CA,QAAE,OAAO,EACR,cAAcA,QAAE,SAAS,uBAAuB,EACjD,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,YAAY,CAClC"}
@@ -1,7 +1,6 @@
1
1
  import { PersonSchema } from "./people.mjs";
2
2
  import { DateObjectSchema } from "./date.mjs";
3
3
  import * as v from "valibot";
4
-
5
4
  //#region src/verification.ts
6
5
  const InnerVerificationSchema = v.variant("state", [v.object({
7
6
  state: v.literal("unverified"),
@@ -94,7 +93,7 @@ const VerificationSchema = v.pipe(v.object({ verification: InnerVerificationSche
94
93
  * ```
95
94
  */
96
95
  const NullableVerificationSchema = v.pipe(v.object({ verification: v.nullable(InnerVerificationSchema) }), v.transform((v) => v.verification));
97
-
98
96
  //#endregion
99
97
  export { NullableVerificationSchema, VerificationSchema };
98
+
100
99
  //# sourceMappingURL=verification.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"verification.mjs","names":[],"sources":["../src/verification.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { DateObjectSchema } from \"./date\";\nimport { PersonSchema } from \"./people\";\n\nconst InnerVerificationSchema = v.variant(\"state\", [\n\tv.object({\n\t\tstate: v.literal(\"unverified\"),\n\t\tdate: v.null_(),\n\t\tverified_by: v.null_(),\n\t}),\n\tv.object({\n\t\tstate: v.union([v.literal(\"verified\"), v.literal(\"expired\")]),\n\t\tdate: v.nullable(DateObjectSchema),\n\t\tverified_by: v.nullable(PersonSchema),\n\t}),\n]);\n\n/**\n * Schema to extract the `verification` object from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { VerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: VerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null }\n * ```\n */\nexport const VerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: InnerVerificationSchema,\n\t}),\n\tv.transform((v) => v.verification),\n);\n\n/**\n * Schema to extract the `verification` object from a Notion property (nullable).\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableVerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: NullableVerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null } | null\n * ```\n */\nexport const NullableVerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: v.nullable(InnerVerificationSchema),\n\t}),\n\tv.transform((v) => v.verification),\n);\n"],"mappings":";;;;;AAKA,MAAM,0BAA0B,EAAE,QAAQ,SAAS,CAClD,EAAE,OAAO;CACR,OAAO,EAAE,QAAQ,aAAa;CAC9B,MAAM,EAAE,OAAO;CACf,aAAa,EAAE,OAAO;CACtB,CAAC,EACF,EAAE,OAAO;CACR,OAAO,EAAE,MAAM,CAAC,EAAE,QAAQ,WAAW,EAAE,EAAE,QAAQ,UAAU,CAAC,CAAC;CAC7D,MAAM,EAAE,SAAS,iBAAiB;CAClC,aAAa,EAAE,SAAS,aAAa;CACrC,CAAC,CACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CF,MAAa,qBAAqB,EAAE,KACnC,EAAE,OAAO,EACR,cAAc,yBACd,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,aAAa,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CD,MAAa,6BAA6B,EAAE,KAC3C,EAAE,OAAO,EACR,cAAc,EAAE,SAAS,wBAAwB,EACjD,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,aAAa,CAClC"}
1
+ {"version":3,"file":"verification.mjs","names":[],"sources":["../src/verification.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { DateObjectSchema } from \"./date\";\nimport { PersonSchema } from \"./people\";\n\nconst InnerVerificationSchema = v.variant(\"state\", [\n\tv.object({\n\t\tstate: v.literal(\"unverified\"),\n\t\tdate: v.null_(),\n\t\tverified_by: v.null_(),\n\t}),\n\tv.object({\n\t\tstate: v.union([v.literal(\"verified\"), v.literal(\"expired\")]),\n\t\tdate: v.nullable(DateObjectSchema),\n\t\tverified_by: v.nullable(PersonSchema),\n\t}),\n]);\n\n/**\n * Schema to extract the `verification` object from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { VerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: VerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null }\n * ```\n */\nexport const VerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: InnerVerificationSchema,\n\t}),\n\tv.transform((v) => v.verification),\n);\n\n/**\n * Schema to extract the `verification` object from a Notion property (nullable).\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableVerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: NullableVerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null } | null\n * ```\n */\nexport const NullableVerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: v.nullable(InnerVerificationSchema),\n\t}),\n\tv.transform((v) => v.verification),\n);\n"],"mappings":";;;;AAKA,MAAM,0BAA0B,EAAE,QAAQ,SAAS,CAClD,EAAE,OAAO;CACR,OAAO,EAAE,QAAQ,YAAY;CAC7B,MAAM,EAAE,MAAM;CACd,aAAa,EAAE,MAAM;AACtB,CAAC,GACD,EAAE,OAAO;CACR,OAAO,EAAE,MAAM,CAAC,EAAE,QAAQ,UAAU,GAAG,EAAE,QAAQ,SAAS,CAAC,CAAC;CAC5D,MAAM,EAAE,SAAS,gBAAgB;CACjC,aAAa,EAAE,SAAS,YAAY;AACrC,CAAC,CACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CD,MAAa,qBAAqB,EAAE,KACnC,EAAE,OAAO,EACR,cAAc,wBACf,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,YAAY,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,6BAA6B,EAAE,KAC3C,EAAE,OAAO,EACR,cAAc,EAAE,SAAS,uBAAuB,EACjD,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,YAAY,CAClC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakanoaas/notion-valibot-schema",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Turn Notion's nested API responses into clean, typed JavaScript values.",
5
5
  "author": "Nakano as a Service",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "@biomejs/biome": "^2.3.7",
44
44
  "@notionhq/client": "^5.6.0",
45
45
  "@types/node": "^24.10.1",
46
- "tsdown": "^0.20.1",
46
+ "tsdown": "^0.22.2",
47
47
  "typescript": "^5.9.3",
48
48
  "vitest": "^4.0.16"
49
49
  },
package/dist/files.cjs DELETED
@@ -1,55 +0,0 @@
1
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
- let valibot = require("valibot");
3
- valibot = require_runtime.__toESM(valibot);
4
-
5
- //#region src/files.ts
6
- /**
7
- * Schema to extract the `files` property from a Notion page property and transform it to an array of URLs.
8
- *
9
- * **Input:**
10
- * ```
11
- * {
12
- * files: Array<{
13
- * type: "file";
14
- * file: {
15
- * url: string;
16
- * };
17
- * } | {
18
- * type: "external";
19
- * external: {
20
- * url: string;
21
- * };
22
- * }>;
23
- * }
24
- * ```
25
- *
26
- * **Output:** `string[]`
27
- *
28
- * @example
29
- * ```ts
30
- * import * as v from "valibot";
31
- * import { FilesSchema } from "@nakanoaas/notion-valibot-utils";
32
- *
33
- * const PageSchema = v.object({
34
- * id: v.string(),
35
- * properties: v.object({
36
- * Files: FilesSchema,
37
- * }),
38
- * });
39
- *
40
- * const page = await notion.pages.retrieve({ page_id: "..." });
41
- * const parsed = v.parse(PageSchema, page);
42
- * // parsed.properties.Files: string[]
43
- * ```
44
- */
45
- const FilesSchema = valibot.pipe(valibot.object({ files: valibot.array(valibot.variant("type", [valibot.object({
46
- type: valibot.literal("file"),
47
- file: valibot.object({ url: valibot.string() })
48
- }), valibot.object({
49
- type: valibot.literal("external"),
50
- external: valibot.object({ url: valibot.string() })
51
- })])) }), valibot.transform((v) => v.files.map((v) => v.type === "file" ? v.file.url : v.external.url)));
52
-
53
- //#endregion
54
- exports.FilesSchema = FilesSchema;
55
- //# sourceMappingURL=files.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"files.cjs","names":["v"],"sources":["../src/files.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `files` property from a Notion page property and transform it to an array of URLs.\n *\n * **Input:**\n * ```\n * {\n * files: Array<{\n * type: \"file\";\n * file: {\n * url: string;\n * };\n * } | {\n * type: \"external\";\n * external: {\n * url: string;\n * };\n * }>;\n * }\n * ```\n *\n * **Output:** `string[]`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { FilesSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Files: FilesSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Files: string[]\n * ```\n */\nexport const FilesSchema = v.pipe(\n\tv.object({\n\t\tfiles: v.array(\n\t\t\tv.variant(\"type\", [\n\t\t\t\tv.object({\n\t\t\t\t\ttype: v.literal(\"file\"),\n\t\t\t\t\tfile: v.object({\n\t\t\t\t\t\turl: v.string(),\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t\tv.object({\n\t\t\t\t\ttype: v.literal(\"external\"),\n\t\t\t\t\texternal: v.object({\n\t\t\t\t\t\turl: v.string(),\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t]),\n\t\t),\n\t}),\n\tv.transform((v) =>\n\t\tv.files.map((v) => (v.type === \"file\" ? v.file.url : v.external.url)),\n\t),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,cAAcA,QAAE,KAC5BA,QAAE,OAAO,EACR,OAAOA,QAAE,MACRA,QAAE,QAAQ,QAAQ,CACjBA,QAAE,OAAO;CACR,MAAMA,QAAE,QAAQ,OAAO;CACvB,MAAMA,QAAE,OAAO,EACd,KAAKA,QAAE,QAAQ,EACf,CAAC;CACF,CAAC,EACFA,QAAE,OAAO;CACR,MAAMA,QAAE,QAAQ,WAAW;CAC3B,UAAUA,QAAE,OAAO,EAClB,KAAKA,QAAE,QAAQ,EACf,CAAC;CACF,CAAC,CACF,CAAC,CACF,EACD,CAAC,EACFA,QAAE,WAAW,MACZ,EAAE,MAAM,KAAK,MAAO,EAAE,SAAS,SAAS,EAAE,KAAK,MAAM,EAAE,SAAS,IAAK,CACrE,CACD"}
package/dist/files.d.cts DELETED
@@ -1,70 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/files.d.ts
4
- /**
5
- * Schema to extract the `files` property from a Notion page property and transform it to an array of URLs.
6
- *
7
- * **Input:**
8
- * ```
9
- * {
10
- * files: Array<{
11
- * type: "file";
12
- * file: {
13
- * url: string;
14
- * };
15
- * } | {
16
- * type: "external";
17
- * external: {
18
- * url: string;
19
- * };
20
- * }>;
21
- * }
22
- * ```
23
- *
24
- * **Output:** `string[]`
25
- *
26
- * @example
27
- * ```ts
28
- * import * as v from "valibot";
29
- * import { FilesSchema } from "@nakanoaas/notion-valibot-utils";
30
- *
31
- * const PageSchema = v.object({
32
- * id: v.string(),
33
- * properties: v.object({
34
- * Files: FilesSchema,
35
- * }),
36
- * });
37
- *
38
- * const page = await notion.pages.retrieve({ page_id: "..." });
39
- * const parsed = v.parse(PageSchema, page);
40
- * // parsed.properties.Files: string[]
41
- * ```
42
- */
43
- declare const FilesSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
44
- readonly files: v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
45
- readonly type: v.LiteralSchema<"file", undefined>;
46
- readonly file: v.ObjectSchema<{
47
- readonly url: v.StringSchema<undefined>;
48
- }, undefined>;
49
- }, undefined>, v.ObjectSchema<{
50
- readonly type: v.LiteralSchema<"external", undefined>;
51
- readonly external: v.ObjectSchema<{
52
- readonly url: v.StringSchema<undefined>;
53
- }, undefined>;
54
- }, undefined>], undefined>, undefined>;
55
- }, undefined>, v.TransformAction<{
56
- files: ({
57
- type: "file";
58
- file: {
59
- url: string;
60
- };
61
- } | {
62
- type: "external";
63
- external: {
64
- url: string;
65
- };
66
- })[];
67
- }, string[]>]>;
68
- //#endregion
69
- export { FilesSchema };
70
- //# sourceMappingURL=files.d.cts.map
package/dist/files.d.mts DELETED
@@ -1,70 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/files.d.ts
4
- /**
5
- * Schema to extract the `files` property from a Notion page property and transform it to an array of URLs.
6
- *
7
- * **Input:**
8
- * ```
9
- * {
10
- * files: Array<{
11
- * type: "file";
12
- * file: {
13
- * url: string;
14
- * };
15
- * } | {
16
- * type: "external";
17
- * external: {
18
- * url: string;
19
- * };
20
- * }>;
21
- * }
22
- * ```
23
- *
24
- * **Output:** `string[]`
25
- *
26
- * @example
27
- * ```ts
28
- * import * as v from "valibot";
29
- * import { FilesSchema } from "@nakanoaas/notion-valibot-utils";
30
- *
31
- * const PageSchema = v.object({
32
- * id: v.string(),
33
- * properties: v.object({
34
- * Files: FilesSchema,
35
- * }),
36
- * });
37
- *
38
- * const page = await notion.pages.retrieve({ page_id: "..." });
39
- * const parsed = v.parse(PageSchema, page);
40
- * // parsed.properties.Files: string[]
41
- * ```
42
- */
43
- declare const FilesSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
44
- readonly files: v.ArraySchema<v.VariantSchema<"type", [v.ObjectSchema<{
45
- readonly type: v.LiteralSchema<"file", undefined>;
46
- readonly file: v.ObjectSchema<{
47
- readonly url: v.StringSchema<undefined>;
48
- }, undefined>;
49
- }, undefined>, v.ObjectSchema<{
50
- readonly type: v.LiteralSchema<"external", undefined>;
51
- readonly external: v.ObjectSchema<{
52
- readonly url: v.StringSchema<undefined>;
53
- }, undefined>;
54
- }, undefined>], undefined>, undefined>;
55
- }, undefined>, v.TransformAction<{
56
- files: ({
57
- type: "file";
58
- file: {
59
- url: string;
60
- };
61
- } | {
62
- type: "external";
63
- external: {
64
- url: string;
65
- };
66
- })[];
67
- }, string[]>]>;
68
- //#endregion
69
- export { FilesSchema };
70
- //# sourceMappingURL=files.d.mts.map
package/dist/files.mjs DELETED
@@ -1,53 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/files.ts
4
- /**
5
- * Schema to extract the `files` property from a Notion page property and transform it to an array of URLs.
6
- *
7
- * **Input:**
8
- * ```
9
- * {
10
- * files: Array<{
11
- * type: "file";
12
- * file: {
13
- * url: string;
14
- * };
15
- * } | {
16
- * type: "external";
17
- * external: {
18
- * url: string;
19
- * };
20
- * }>;
21
- * }
22
- * ```
23
- *
24
- * **Output:** `string[]`
25
- *
26
- * @example
27
- * ```ts
28
- * import * as v from "valibot";
29
- * import { FilesSchema } from "@nakanoaas/notion-valibot-utils";
30
- *
31
- * const PageSchema = v.object({
32
- * id: v.string(),
33
- * properties: v.object({
34
- * Files: FilesSchema,
35
- * }),
36
- * });
37
- *
38
- * const page = await notion.pages.retrieve({ page_id: "..." });
39
- * const parsed = v.parse(PageSchema, page);
40
- * // parsed.properties.Files: string[]
41
- * ```
42
- */
43
- const FilesSchema = v.pipe(v.object({ files: v.array(v.variant("type", [v.object({
44
- type: v.literal("file"),
45
- file: v.object({ url: v.string() })
46
- }), v.object({
47
- type: v.literal("external"),
48
- external: v.object({ url: v.string() })
49
- })])) }), v.transform((v) => v.files.map((v) => v.type === "file" ? v.file.url : v.external.url)));
50
-
51
- //#endregion
52
- export { FilesSchema };
53
- //# sourceMappingURL=files.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"files.mjs","names":[],"sources":["../src/files.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `files` property from a Notion page property and transform it to an array of URLs.\n *\n * **Input:**\n * ```\n * {\n * files: Array<{\n * type: \"file\";\n * file: {\n * url: string;\n * };\n * } | {\n * type: \"external\";\n * external: {\n * url: string;\n * };\n * }>;\n * }\n * ```\n *\n * **Output:** `string[]`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { FilesSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Files: FilesSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Files: string[]\n * ```\n */\nexport const FilesSchema = v.pipe(\n\tv.object({\n\t\tfiles: v.array(\n\t\t\tv.variant(\"type\", [\n\t\t\t\tv.object({\n\t\t\t\t\ttype: v.literal(\"file\"),\n\t\t\t\t\tfile: v.object({\n\t\t\t\t\t\turl: v.string(),\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t\tv.object({\n\t\t\t\t\ttype: v.literal(\"external\"),\n\t\t\t\t\texternal: v.object({\n\t\t\t\t\t\turl: v.string(),\n\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t\t]),\n\t\t),\n\t}),\n\tv.transform((v) =>\n\t\tv.files.map((v) => (v.type === \"file\" ? v.file.url : v.external.url)),\n\t),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,cAAc,EAAE,KAC5B,EAAE,OAAO,EACR,OAAO,EAAE,MACR,EAAE,QAAQ,QAAQ,CACjB,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,OAAO;CACvB,MAAM,EAAE,OAAO,EACd,KAAK,EAAE,QAAQ,EACf,CAAC;CACF,CAAC,EACF,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,WAAW;CAC3B,UAAU,EAAE,OAAO,EAClB,KAAK,EAAE,QAAQ,EACf,CAAC;CACF,CAAC,CACF,CAAC,CACF,EACD,CAAC,EACF,EAAE,WAAW,MACZ,EAAE,MAAM,KAAK,MAAO,EAAE,SAAS,SAAS,EAAE,KAAK,MAAM,EAAE,SAAS,IAAK,CACrE,CACD"}