@nakanoaas/notion-valibot-schema 0.2.2 → 0.6.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 (101) hide show
  1. package/README.md +33 -10
  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/files.cjs +123 -14
  24. package/dist/files.cjs.map +1 -1
  25. package/dist/files.d.cts +132 -4
  26. package/dist/files.d.mts +132 -4
  27. package/dist/files.mjs +119 -12
  28. package/dist/files.mjs.map +1 -1
  29. package/dist/formula.cjs +123 -23
  30. package/dist/formula.cjs.map +1 -1
  31. package/dist/formula.d.cts +150 -41
  32. package/dist/formula.d.mts +150 -41
  33. package/dist/formula.mjs +118 -22
  34. package/dist/formula.mjs.map +1 -1
  35. package/dist/index.cjs +32 -26
  36. package/dist/index.d.cts +4 -4
  37. package/dist/index.d.mts +4 -4
  38. package/dist/index.mjs +4 -5
  39. package/dist/last-edited-by.cjs +4 -5
  40. package/dist/last-edited-by.cjs.map +1 -1
  41. package/dist/last-edited-by.mjs +1 -2
  42. package/dist/last-edited-by.mjs.map +1 -1
  43. package/dist/last-edited-time.cjs +3 -4
  44. package/dist/last-edited-time.cjs.map +1 -1
  45. package/dist/last-edited-time.mjs +1 -2
  46. package/dist/last-edited-time.mjs.map +1 -1
  47. package/dist/multi-select.cjs +3 -4
  48. package/dist/multi-select.cjs.map +1 -1
  49. package/dist/multi-select.mjs +1 -2
  50. package/dist/multi-select.mjs.map +1 -1
  51. package/dist/number.cjs +3 -4
  52. package/dist/number.cjs.map +1 -1
  53. package/dist/number.mjs +1 -2
  54. package/dist/number.mjs.map +1 -1
  55. package/dist/people.cjs +3 -4
  56. package/dist/people.cjs.map +1 -1
  57. package/dist/people.mjs +1 -2
  58. package/dist/people.mjs.map +1 -1
  59. package/dist/phone-number.cjs +3 -4
  60. package/dist/phone-number.cjs.map +1 -1
  61. package/dist/phone-number.mjs +1 -2
  62. package/dist/phone-number.mjs.map +1 -1
  63. package/dist/place.cjs +3 -4
  64. package/dist/place.cjs.map +1 -1
  65. package/dist/place.mjs +1 -2
  66. package/dist/place.mjs.map +1 -1
  67. package/dist/relation.cjs +3 -4
  68. package/dist/relation.cjs.map +1 -1
  69. package/dist/relation.mjs +1 -2
  70. package/dist/relation.mjs.map +1 -1
  71. package/dist/rollup.cjs +70 -5
  72. package/dist/rollup.cjs.map +1 -1
  73. package/dist/rollup.d.cts +70 -1
  74. package/dist/rollup.d.mts +70 -1
  75. package/dist/rollup.mjs +67 -3
  76. package/dist/rollup.mjs.map +1 -1
  77. package/dist/select.cjs +3 -4
  78. package/dist/select.cjs.map +1 -1
  79. package/dist/select.mjs +1 -2
  80. package/dist/select.mjs.map +1 -1
  81. package/dist/status.cjs +3 -4
  82. package/dist/status.cjs.map +1 -1
  83. package/dist/status.mjs +1 -2
  84. package/dist/status.mjs.map +1 -1
  85. package/dist/text.cjs +3 -4
  86. package/dist/text.cjs.map +1 -1
  87. package/dist/text.mjs +1 -2
  88. package/dist/text.mjs.map +1 -1
  89. package/dist/unique-id.cjs +3 -4
  90. package/dist/unique-id.cjs.map +1 -1
  91. package/dist/unique-id.mjs +1 -2
  92. package/dist/unique-id.mjs.map +1 -1
  93. package/dist/url.cjs +3 -4
  94. package/dist/url.cjs.map +1 -1
  95. package/dist/url.mjs +1 -2
  96. package/dist/url.mjs.map +1 -1
  97. package/dist/verification.cjs +5 -6
  98. package/dist/verification.cjs.map +1 -1
  99. package/dist/verification.mjs +1 -2
  100. package/dist/verification.mjs.map +1 -1
  101. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"select.cjs","names":["v"],"sources":["../src/select.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `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 select values. The select property in Notion contains an object with\n * a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * select: {\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 select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: SelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusSchema = v.picklist([\"todo\", \"in-progress\", \"done\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: SelectSchema(StatusSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"todo\" | \"in-progress\" | \"done\"\n * ```\n */\nexport function SelectSchema<S extends v.GenericSchema<string>>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tselect: v.object({\n\t\t\t\tname: schema,\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.select.name!),\n\t);\n}\n\n/**\n * Schema factory to extract the `select` property from a Notion page property or `null`.\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 select values. The select property in Notion contains an object with\n * a `name` field that can be validated using the provided schema, or `null` if not set.\n *\n * **Input:**\n * ```\n * {\n * select: {\n * name: string;\n * } | null;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter, or `null`.\n * For example, if `v.string()` is passed, the output will be `string | null`.\n *\n * @param schema - A schema that validates the select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableSelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusSchema = v.picklist([\"todo\", \"in-progress\", \"done\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableSelectSchema(StatusSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"todo\" | \"in-progress\" | \"done\" | null\n * ```\n */\nexport function NullableSelectSchema<S extends v.GenericSchema<string>>(\n\tschema: S,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tselect: v.nullable(\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\tv.transform((v) => v.select?.name ?? null),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAgD,QAAW;AAC1E,QAAOA,QAAE,KACRA,QAAE,OAAO,EACR,QAAQA,QAAE,OAAO,EAChB,MAAM,QACN,CAAC,EACF,CAAC,EAEFA,QAAE,WAAW,MAAM,EAAE,OAAO,KAAM,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DF,SAAgB,qBACf,QACC;AACD,QAAOA,QAAE,KACRA,QAAE,OAAO,EACR,QAAQA,QAAE,SACTA,QAAE,OAAO,EACR,MAAM,QACN,CAAC,CACF,EACD,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,QAAQ,QAAQ,KAAK,CAC1C"}
1
+ {"version":3,"file":"select.cjs","names":["v"],"sources":["../src/select.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `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 select values. The select property in Notion contains an object with\n * a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * select: {\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 select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: SelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusSchema = v.picklist([\"todo\", \"in-progress\", \"done\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: SelectSchema(StatusSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"todo\" | \"in-progress\" | \"done\"\n * ```\n */\nexport function SelectSchema<S extends v.GenericSchema<string>>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tselect: v.object({\n\t\t\t\tname: schema,\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.select.name!),\n\t);\n}\n\n/**\n * Schema factory to extract the `select` property from a Notion page property or `null`.\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 select values. The select property in Notion contains an object with\n * a `name` field that can be validated using the provided schema, or `null` if not set.\n *\n * **Input:**\n * ```\n * {\n * select: {\n * name: string;\n * } | null;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter, or `null`.\n * For example, if `v.string()` is passed, the output will be `string | null`.\n *\n * @param schema - A schema that validates the select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableSelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusSchema = v.picklist([\"todo\", \"in-progress\", \"done\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableSelectSchema(StatusSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"todo\" | \"in-progress\" | \"done\" | null\n * ```\n */\nexport function NullableSelectSchema<S extends v.GenericSchema<string>>(\n\tschema: S,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tselect: v.nullable(\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\tv.transform((v) => v.select?.name ?? null),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAgD,QAAW;CAC1E,OAAOA,QAAE,KACRA,QAAE,OAAO,EACR,QAAQA,QAAE,OAAO,EAChB,MAAM,OACP,CAAC,EACF,CAAC,GAEDA,QAAE,WAAW,MAAM,EAAE,OAAO,IAAK,CAClC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,qBACf,QACC;CACD,OAAOA,QAAE,KACRA,QAAE,OAAO,EACR,QAAQA,QAAE,SACTA,QAAE,OAAO,EACR,MAAM,OACP,CAAC,CACF,EACD,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,QAAQ,QAAQ,IAAI,CAC1C;AACD"}
package/dist/select.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as v from "valibot";
2
-
3
2
  //#region src/select.ts
4
3
  /**
5
4
  * Schema factory to extract the `select` property from a Notion page property.
@@ -127,7 +126,7 @@ function SelectSchema(schema) {
127
126
  function NullableSelectSchema(schema) {
128
127
  return v.pipe(v.object({ select: v.nullable(v.object({ name: schema })) }), v.transform((v) => v.select?.name ?? null));
129
128
  }
130
-
131
129
  //#endregion
132
130
  export { NullableSelectSchema, SelectSchema };
131
+
133
132
  //# sourceMappingURL=select.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.mjs","names":[],"sources":["../src/select.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `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 select values. The select property in Notion contains an object with\n * a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * select: {\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 select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: SelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusSchema = v.picklist([\"todo\", \"in-progress\", \"done\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: SelectSchema(StatusSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"todo\" | \"in-progress\" | \"done\"\n * ```\n */\nexport function SelectSchema<S extends v.GenericSchema<string>>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tselect: v.object({\n\t\t\t\tname: schema,\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.select.name!),\n\t);\n}\n\n/**\n * Schema factory to extract the `select` property from a Notion page property or `null`.\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 select values. The select property in Notion contains an object with\n * a `name` field that can be validated using the provided schema, or `null` if not set.\n *\n * **Input:**\n * ```\n * {\n * select: {\n * name: string;\n * } | null;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter, or `null`.\n * For example, if `v.string()` is passed, the output will be `string | null`.\n *\n * @param schema - A schema that validates the select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableSelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusSchema = v.picklist([\"todo\", \"in-progress\", \"done\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableSelectSchema(StatusSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"todo\" | \"in-progress\" | \"done\" | null\n * ```\n */\nexport function NullableSelectSchema<S extends v.GenericSchema<string>>(\n\tschema: S,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tselect: v.nullable(\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\tv.transform((v) => v.select?.name ?? null),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAgD,QAAW;AAC1E,QAAO,EAAE,KACR,EAAE,OAAO,EACR,QAAQ,EAAE,OAAO,EAChB,MAAM,QACN,CAAC,EACF,CAAC,EAEF,EAAE,WAAW,MAAM,EAAE,OAAO,KAAM,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DF,SAAgB,qBACf,QACC;AACD,QAAO,EAAE,KACR,EAAE,OAAO,EACR,QAAQ,EAAE,SACT,EAAE,OAAO,EACR,MAAM,QACN,CAAC,CACF,EACD,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,QAAQ,QAAQ,KAAK,CAC1C"}
1
+ {"version":3,"file":"select.mjs","names":[],"sources":["../src/select.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `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 select values. The select property in Notion contains an object with\n * a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * select: {\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 select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: SelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { SelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusSchema = v.picklist([\"todo\", \"in-progress\", \"done\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: SelectSchema(StatusSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"todo\" | \"in-progress\" | \"done\"\n * ```\n */\nexport function SelectSchema<S extends v.GenericSchema<string>>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tselect: v.object({\n\t\t\t\tname: schema,\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.select.name!),\n\t);\n}\n\n/**\n * Schema factory to extract the `select` property from a Notion page property or `null`.\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 select values. The select property in Notion contains an object with\n * a `name` field that can be validated using the provided schema, or `null` if not set.\n *\n * **Input:**\n * ```\n * {\n * select: {\n * name: string;\n * } | null;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter, or `null`.\n * For example, if `v.string()` is passed, the output will be `string | null`.\n *\n * @param schema - A schema that validates the select option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableSelectSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableSelectSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusSchema = v.picklist([\"todo\", \"in-progress\", \"done\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableSelectSchema(StatusSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"todo\" | \"in-progress\" | \"done\" | null\n * ```\n */\nexport function NullableSelectSchema<S extends v.GenericSchema<string>>(\n\tschema: S,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tselect: v.nullable(\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\tv.transform((v) => v.select?.name ?? null),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAgD,QAAW;CAC1E,OAAO,EAAE,KACR,EAAE,OAAO,EACR,QAAQ,EAAE,OAAO,EAChB,MAAM,OACP,CAAC,EACF,CAAC,GAED,EAAE,WAAW,MAAM,EAAE,OAAO,IAAK,CAClC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,qBACf,QACC;CACD,OAAO,EAAE,KACR,EAAE,OAAO,EACR,QAAQ,EAAE,SACT,EAAE,OAAO,EACR,MAAM,OACP,CAAC,CACF,EACD,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,QAAQ,QAAQ,IAAI,CAC1C;AACD"}
package/dist/status.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/status.ts
6
5
  /**
7
6
  * Schema factory to extract the `status` property from a Notion page property.
@@ -129,8 +128,8 @@ function StatusSchema(schema) {
129
128
  function NullableStatusSchema(schema) {
130
129
  return valibot.pipe(valibot.object({ status: valibot.nullable(valibot.object({ name: schema })) }), valibot.transform((v) => v.status?.name ?? null));
131
130
  }
132
-
133
131
  //#endregion
134
132
  exports.NullableStatusSchema = NullableStatusSchema;
135
133
  exports.StatusSchema = StatusSchema;
134
+
136
135
  //# sourceMappingURL=status.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"status.cjs","names":["v"],"sources":["../src/status.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `status` 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 status values. The status property in Notion contains an object with\n * a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * status: {\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 status option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { StatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: StatusSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { StatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusOptionSchema = v.picklist([\"not-started\", \"in-progress\", \"completed\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: StatusSchema(StatusOptionSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"not-started\" | \"in-progress\" | \"completed\"\n * ```\n */\nexport function StatusSchema<S extends v.GenericSchema<string>>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tstatus: v.object({\n\t\t\t\tname: schema,\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.status.name!),\n\t);\n}\n\n/**\n * Schema factory to extract the `status` property from a Notion page property or `null`.\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 status values. The status property in Notion contains an object with\n * a `name` field that can be validated using the provided schema, or `null` if not set.\n *\n * **Input:**\n * ```\n * {\n * status: {\n * name: string;\n * } | null;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter, or `null`.\n * For example, if `v.string()` is passed, the output will be `string | null`.\n *\n * @param schema - A schema that validates the status option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableStatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableStatusSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableStatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusOptionSchema = v.picklist([\"not-started\", \"in-progress\", \"completed\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableStatusSchema(StatusOptionSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"not-started\" | \"in-progress\" | \"completed\" | null\n * ```\n */\nexport function NullableStatusSchema<S extends v.GenericSchema<string>>(\n\tschema: S,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tstatus: v.nullable(\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\tv.transform((v) => v.status?.name ?? null),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAgD,QAAW;AAC1E,QAAOA,QAAE,KACRA,QAAE,OAAO,EACR,QAAQA,QAAE,OAAO,EAChB,MAAM,QACN,CAAC,EACF,CAAC,EAEFA,QAAE,WAAW,MAAM,EAAE,OAAO,KAAM,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DF,SAAgB,qBACf,QACC;AACD,QAAOA,QAAE,KACRA,QAAE,OAAO,EACR,QAAQA,QAAE,SACTA,QAAE,OAAO,EACR,MAAM,QACN,CAAC,CACF,EACD,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,QAAQ,QAAQ,KAAK,CAC1C"}
1
+ {"version":3,"file":"status.cjs","names":["v"],"sources":["../src/status.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `status` 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 status values. The status property in Notion contains an object with\n * a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * status: {\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 status option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { StatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: StatusSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { StatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusOptionSchema = v.picklist([\"not-started\", \"in-progress\", \"completed\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: StatusSchema(StatusOptionSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"not-started\" | \"in-progress\" | \"completed\"\n * ```\n */\nexport function StatusSchema<S extends v.GenericSchema<string>>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tstatus: v.object({\n\t\t\t\tname: schema,\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.status.name!),\n\t);\n}\n\n/**\n * Schema factory to extract the `status` property from a Notion page property or `null`.\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 status values. The status property in Notion contains an object with\n * a `name` field that can be validated using the provided schema, or `null` if not set.\n *\n * **Input:**\n * ```\n * {\n * status: {\n * name: string;\n * } | null;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter, or `null`.\n * For example, if `v.string()` is passed, the output will be `string | null`.\n *\n * @param schema - A schema that validates the status option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableStatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableStatusSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableStatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusOptionSchema = v.picklist([\"not-started\", \"in-progress\", \"completed\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableStatusSchema(StatusOptionSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"not-started\" | \"in-progress\" | \"completed\" | null\n * ```\n */\nexport function NullableStatusSchema<S extends v.GenericSchema<string>>(\n\tschema: S,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tstatus: v.nullable(\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\tv.transform((v) => v.status?.name ?? null),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAgD,QAAW;CAC1E,OAAOA,QAAE,KACRA,QAAE,OAAO,EACR,QAAQA,QAAE,OAAO,EAChB,MAAM,OACP,CAAC,EACF,CAAC,GAEDA,QAAE,WAAW,MAAM,EAAE,OAAO,IAAK,CAClC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,qBACf,QACC;CACD,OAAOA,QAAE,KACRA,QAAE,OAAO,EACR,QAAQA,QAAE,SACTA,QAAE,OAAO,EACR,MAAM,OACP,CAAC,CACF,EACD,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,QAAQ,QAAQ,IAAI,CAC1C;AACD"}
package/dist/status.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as v from "valibot";
2
-
3
2
  //#region src/status.ts
4
3
  /**
5
4
  * Schema factory to extract the `status` property from a Notion page property.
@@ -127,7 +126,7 @@ function StatusSchema(schema) {
127
126
  function NullableStatusSchema(schema) {
128
127
  return v.pipe(v.object({ status: v.nullable(v.object({ name: schema })) }), v.transform((v) => v.status?.name ?? null));
129
128
  }
130
-
131
129
  //#endregion
132
130
  export { NullableStatusSchema, StatusSchema };
131
+
133
132
  //# sourceMappingURL=status.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"status.mjs","names":[],"sources":["../src/status.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `status` 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 status values. The status property in Notion contains an object with\n * a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * status: {\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 status option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { StatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: StatusSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { StatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusOptionSchema = v.picklist([\"not-started\", \"in-progress\", \"completed\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: StatusSchema(StatusOptionSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"not-started\" | \"in-progress\" | \"completed\"\n * ```\n */\nexport function StatusSchema<S extends v.GenericSchema<string>>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tstatus: v.object({\n\t\t\t\tname: schema,\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.status.name!),\n\t);\n}\n\n/**\n * Schema factory to extract the `status` property from a Notion page property or `null`.\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 status values. The status property in Notion contains an object with\n * a `name` field that can be validated using the provided schema, or `null` if not set.\n *\n * **Input:**\n * ```\n * {\n * status: {\n * name: string;\n * } | null;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter, or `null`.\n * For example, if `v.string()` is passed, the output will be `string | null`.\n *\n * @param schema - A schema that validates the status option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableStatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableStatusSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableStatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusOptionSchema = v.picklist([\"not-started\", \"in-progress\", \"completed\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableStatusSchema(StatusOptionSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"not-started\" | \"in-progress\" | \"completed\" | null\n * ```\n */\nexport function NullableStatusSchema<S extends v.GenericSchema<string>>(\n\tschema: S,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tstatus: v.nullable(\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\tv.transform((v) => v.status?.name ?? null),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAgD,QAAW;AAC1E,QAAO,EAAE,KACR,EAAE,OAAO,EACR,QAAQ,EAAE,OAAO,EAChB,MAAM,QACN,CAAC,EACF,CAAC,EAEF,EAAE,WAAW,MAAM,EAAE,OAAO,KAAM,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DF,SAAgB,qBACf,QACC;AACD,QAAO,EAAE,KACR,EAAE,OAAO,EACR,QAAQ,EAAE,SACT,EAAE,OAAO,EACR,MAAM,QACN,CAAC,CACF,EACD,CAAC,EACF,EAAE,WAAW,MAAM,EAAE,QAAQ,QAAQ,KAAK,CAC1C"}
1
+ {"version":3,"file":"status.mjs","names":[],"sources":["../src/status.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema factory to extract the `status` 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 status values. The status property in Notion contains an object with\n * a `name` field that can be validated using the provided schema.\n *\n * **Input:**\n * ```\n * {\n * status: {\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 status option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { StatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: StatusSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { StatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusOptionSchema = v.picklist([\"not-started\", \"in-progress\", \"completed\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: StatusSchema(StatusOptionSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"not-started\" | \"in-progress\" | \"completed\"\n * ```\n */\nexport function StatusSchema<S extends v.GenericSchema<string>>(schema: S) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tstatus: v.object({\n\t\t\t\tname: schema,\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.status.name!),\n\t);\n}\n\n/**\n * Schema factory to extract the `status` property from a Notion page property or `null`.\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 status values. The status property in Notion contains an object with\n * a `name` field that can be validated using the provided schema, or `null` if not set.\n *\n * **Input:**\n * ```\n * {\n * status: {\n * name: string;\n * } | null;\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter, or `null`.\n * For example, if `v.string()` is passed, the output will be `string | null`.\n *\n * @param schema - A schema that validates the status option name.\n * Must accept a string value.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableStatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableStatusSchema(v.string()),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: string | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableStatusSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * // Custom schema for enum values\n * const StatusOptionSchema = v.picklist([\"not-started\", \"in-progress\", \"completed\"]);\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Status: NullableStatusSchema(StatusOptionSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Status: \"not-started\" | \"in-progress\" | \"completed\" | null\n * ```\n */\nexport function NullableStatusSchema<S extends v.GenericSchema<string>>(\n\tschema: S,\n) {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tstatus: v.nullable(\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\tv.transform((v) => v.status?.name ?? null),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAgD,QAAW;CAC1E,OAAO,EAAE,KACR,EAAE,OAAO,EACR,QAAQ,EAAE,OAAO,EAChB,MAAM,OACP,CAAC,EACF,CAAC,GAED,EAAE,WAAW,MAAM,EAAE,OAAO,IAAK,CAClC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,qBACf,QACC;CACD,OAAO,EAAE,KACR,EAAE,OAAO,EACR,QAAQ,EAAE,SACT,EAAE,OAAO,EACR,MAAM,OACP,CAAC,CACF,EACD,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,QAAQ,QAAQ,IAAI,CAC1C;AACD"}
package/dist/text.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/text.ts
6
5
  /**
7
6
  * Schema for a Notion rich text array structure.
@@ -178,10 +177,10 @@ const RichTextSchema = valibot.pipe(valibot.object({ rich_text: RichTextItemArra
178
177
  * ```
179
178
  */
180
179
  const NullableRichTextSchema = valibot.pipe(valibot.object({ rich_text: RichTextItemArraySchema }), valibot.transform((v) => v.rich_text.map((v) => v.plain_text).join("") || null));
181
-
182
180
  //#endregion
183
181
  exports.NullableRichTextSchema = NullableRichTextSchema;
184
182
  exports.NullableTitleSchema = NullableTitleSchema;
185
183
  exports.RichTextSchema = RichTextSchema;
186
184
  exports.TitleSchema = TitleSchema;
185
+
187
186
  //# sourceMappingURL=text.cjs.map
package/dist/text.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"text.cjs","names":["v"],"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,0BAA0BA,QAAE,MACjCA,QAAE,OAAO,EACR,YAAYA,QAAE,QAAQ,EACtB,CAAC,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,cAAcA,QAAE,KAC5BA,QAAE,OAAO,EACR,OAAO,yBACP,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,WAAW,CAAC,KAAK,GAAG,CAAC,EAC7DA,QAAE,UAAU,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,sBAAsBA,QAAE,KACpCA,QAAE,OAAO,EACR,OAAO,yBACP,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,WAAW,CAAC,KAAK,GAAG,IAAI,KAAK,CACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,iBAAiBA,QAAE,KAC/BA,QAAE,OAAO,EACR,WAAW,yBACX,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,UAAU,KAAK,MAAM,EAAE,WAAW,CAAC,KAAK,GAAG,CAAC,EACjEA,QAAE,UAAU,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,MAAa,yBAAyBA,QAAE,KACvCA,QAAE,OAAO,EACR,WAAW,yBACX,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,UAAU,KAAK,MAAM,EAAE,WAAW,CAAC,KAAK,GAAG,IAAI,KAAK,CACzE"}
1
+ {"version":3,"file":"text.cjs","names":["v"],"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,0BAA0BA,QAAE,MACjCA,QAAE,OAAO,EACR,YAAYA,QAAE,OAAO,EACtB,CAAC,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,cAAcA,QAAE,KAC5BA,QAAE,OAAO,EACR,OAAO,wBACR,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC,GAC5DA,QAAE,SAAS,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,sBAAsBA,QAAE,KACpCA,QAAE,OAAO,EACR,OAAO,wBACR,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,MAAM,KAAK,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,IAAI,CACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,iBAAiBA,QAAE,KAC/BA,QAAE,OAAO,EACR,WAAW,wBACZ,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,UAAU,KAAK,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC,GAChEA,QAAE,SAAS,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,yBAAyBA,QAAE,KACvCA,QAAE,OAAO,EACR,WAAW,wBACZ,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,UAAU,KAAK,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,IAAI,CACzE"}
package/dist/text.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as v from "valibot";
2
-
3
2
  //#region src/text.ts
4
3
  /**
5
4
  * Schema for a Notion rich text array structure.
@@ -176,7 +175,7 @@ const RichTextSchema = v.pipe(v.object({ rich_text: RichTextItemArraySchema }),
176
175
  * ```
177
176
  */
178
177
  const NullableRichTextSchema = v.pipe(v.object({ rich_text: RichTextItemArraySchema }), v.transform((v) => v.rich_text.map((v) => v.plain_text).join("") || null));
179
-
180
178
  //#endregion
181
179
  export { NullableRichTextSchema, NullableTitleSchema, RichTextSchema, TitleSchema };
180
+
182
181
  //# sourceMappingURL=text.mjs.map
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.6.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",
@@ -42,9 +42,9 @@
42
42
  "devDependencies": {
43
43
  "@biomejs/biome": "^2.3.7",
44
44
  "@notionhq/client": "^5.6.0",
45
- "@types/node": "^24.10.1",
46
- "tsdown": "^0.20.1",
47
- "typescript": "^5.9.3",
45
+ "@types/node": "^25.9.2",
46
+ "tsdown": "^0.22.2",
47
+ "typescript": "^6.0.3",
48
48
  "vitest": "^4.0.16"
49
49
  },
50
50
  "scripts": {