@nakanoaas/notion-valibot-schema 0.0.6 → 0.0.7

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.
@@ -47,6 +47,41 @@ valibot = require_rolldown_runtime.__toESM(valibot);
47
47
  */
48
48
  const CreatedBySchema = valibot.pipe(valibot.object({ created_by: require_people.PersonSchema }), valibot.transform((v) => v.created_by));
49
49
  /**
50
+ * Schema to extract the `created_by` person name from a Notion page.
51
+ *
52
+ * **Input:**
53
+ * ```
54
+ * {
55
+ * created_by: {
56
+ * id: string;
57
+ * object: "user" | "bot" | "group";
58
+ * name: string | null;
59
+ * ...
60
+ * }
61
+ * }
62
+ * ```
63
+ *
64
+ * **Output:** `string | null`
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * import * as v from "valibot";
69
+ * import { NullableCreatedByNameSchema } from "@nakanoaas/notion-valibot-schema";
70
+ *
71
+ * const PageSchema = v.object({
72
+ * id: v.string(),
73
+ * properties: v.object({
74
+ * CreatedByName: NullableCreatedByNameSchema,
75
+ * }),
76
+ * });
77
+ *
78
+ * const page = await notion.pages.retrieve({ page_id: "..." });
79
+ * const parsed = v.parse(PageSchema, page);
80
+ * // parsed.properties.CreatedByName: string | null
81
+ * ```
82
+ */
83
+ const NullableCreatedByNameSchema = valibot.pipe(valibot.object({ created_by: require_people.PersonSchema }), valibot.transform((v) => v.created_by.name));
84
+ /**
50
85
  * Schema to extract the `created_by` person ID from a Notion page.
51
86
  *
52
87
  * **Input:**
@@ -85,4 +120,5 @@ const CreatedByIdSchema = valibot.pipe(valibot.object({ created_by: require_peop
85
120
  //#endregion
86
121
  exports.CreatedByIdSchema = CreatedByIdSchema;
87
122
  exports.CreatedBySchema = CreatedBySchema;
123
+ exports.NullableCreatedByNameSchema = NullableCreatedByNameSchema;
88
124
  //# sourceMappingURL=created-by.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"created-by.cjs","names":["v","PersonSchema"],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `created_by` person object from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedBySchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedBy: CreatedBySchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedBy: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n */\nexport const CreatedBySchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by),\n);\n\n/**\n * Schema to extract the `created_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedById: CreatedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedById: string\n * ```\n */\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkBA,QAAE,KAChCA,QAAE,OAAO,EACR,YAAYC,6BACZ,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,WAAW,CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,oBAAoBA,QAAE,KAClCA,QAAE,OAAO,EACR,YAAYC,6BACZ,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,WAAW,GAAG,CACnC"}
1
+ {"version":3,"file":"created-by.cjs","names":["v","PersonSchema"],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `created_by` person object from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedBySchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedBy: CreatedBySchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedBy: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n */\nexport const CreatedBySchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by),\n);\n\n/**\n * Schema to extract the `created_by` person name from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableCreatedByNameSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedByName: NullableCreatedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedByName: string | null\n * ```\n */\nexport const NullableCreatedByNameSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.name),\n);\n\n/**\n * Schema to extract the `created_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedById: CreatedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedById: string\n * ```\n */\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkBA,QAAE,KAChCA,QAAE,OAAO,EACR,YAAYC,6BACZ,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,WAAW,CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,8BAA8BA,QAAE,KAC5CA,QAAE,OAAO,EACR,YAAYC,6BACZ,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,WAAW,KAAK,CACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,oBAAoBA,QAAE,KAClCA,QAAE,OAAO,EACR,YAAYC,6BACZ,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,WAAW,GAAG,CACnC"}
@@ -60,6 +60,53 @@ declare const CreatedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
60
60
  object: "user" | "bot" | "group";
61
61
  name: string | null;
62
62
  }>]>;
63
+ /**
64
+ * Schema to extract the `created_by` person name from a Notion page.
65
+ *
66
+ * **Input:**
67
+ * ```
68
+ * {
69
+ * created_by: {
70
+ * id: string;
71
+ * object: "user" | "bot" | "group";
72
+ * name: string | null;
73
+ * ...
74
+ * }
75
+ * }
76
+ * ```
77
+ *
78
+ * **Output:** `string | null`
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import * as v from "valibot";
83
+ * import { NullableCreatedByNameSchema } from "@nakanoaas/notion-valibot-schema";
84
+ *
85
+ * const PageSchema = v.object({
86
+ * id: v.string(),
87
+ * properties: v.object({
88
+ * CreatedByName: NullableCreatedByNameSchema,
89
+ * }),
90
+ * });
91
+ *
92
+ * const page = await notion.pages.retrieve({ page_id: "..." });
93
+ * const parsed = v.parse(PageSchema, page);
94
+ * // parsed.properties.CreatedByName: string | null
95
+ * ```
96
+ */
97
+ declare const NullableCreatedByNameSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
98
+ readonly created_by: v.ObjectSchema<{
99
+ readonly id: v.StringSchema<undefined>;
100
+ readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
101
+ readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
102
+ }, undefined>;
103
+ }, undefined>, v.TransformAction<{
104
+ created_by: {
105
+ id: string;
106
+ object: "user" | "bot" | "group";
107
+ name: string | null;
108
+ };
109
+ }, string | null>]>;
63
110
  /**
64
111
  * Schema to extract the `created_by` person ID from a Notion page.
65
112
  *
@@ -108,5 +155,5 @@ declare const CreatedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
108
155
  };
109
156
  }, string>]>;
110
157
  //#endregion
111
- export { CreatedByIdSchema, CreatedBySchema };
158
+ export { CreatedByIdSchema, CreatedBySchema, NullableCreatedByNameSchema };
112
159
  //# sourceMappingURL=created-by.d.cts.map
@@ -60,6 +60,53 @@ declare const CreatedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
60
60
  object: "user" | "bot" | "group";
61
61
  name: string | null;
62
62
  }>]>;
63
+ /**
64
+ * Schema to extract the `created_by` person name from a Notion page.
65
+ *
66
+ * **Input:**
67
+ * ```
68
+ * {
69
+ * created_by: {
70
+ * id: string;
71
+ * object: "user" | "bot" | "group";
72
+ * name: string | null;
73
+ * ...
74
+ * }
75
+ * }
76
+ * ```
77
+ *
78
+ * **Output:** `string | null`
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import * as v from "valibot";
83
+ * import { NullableCreatedByNameSchema } from "@nakanoaas/notion-valibot-schema";
84
+ *
85
+ * const PageSchema = v.object({
86
+ * id: v.string(),
87
+ * properties: v.object({
88
+ * CreatedByName: NullableCreatedByNameSchema,
89
+ * }),
90
+ * });
91
+ *
92
+ * const page = await notion.pages.retrieve({ page_id: "..." });
93
+ * const parsed = v.parse(PageSchema, page);
94
+ * // parsed.properties.CreatedByName: string | null
95
+ * ```
96
+ */
97
+ declare const NullableCreatedByNameSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
98
+ readonly created_by: v.ObjectSchema<{
99
+ readonly id: v.StringSchema<undefined>;
100
+ readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
101
+ readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
102
+ }, undefined>;
103
+ }, undefined>, v.TransformAction<{
104
+ created_by: {
105
+ id: string;
106
+ object: "user" | "bot" | "group";
107
+ name: string | null;
108
+ };
109
+ }, string | null>]>;
63
110
  /**
64
111
  * Schema to extract the `created_by` person ID from a Notion page.
65
112
  *
@@ -108,5 +155,5 @@ declare const CreatedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
108
155
  };
109
156
  }, string>]>;
110
157
  //#endregion
111
- export { CreatedByIdSchema, CreatedBySchema };
158
+ export { CreatedByIdSchema, CreatedBySchema, NullableCreatedByNameSchema };
112
159
  //# sourceMappingURL=created-by.d.mts.map
@@ -45,6 +45,41 @@ import * as v from "valibot";
45
45
  */
46
46
  const CreatedBySchema = v.pipe(v.object({ created_by: PersonSchema }), v.transform((v$1) => v$1.created_by));
47
47
  /**
48
+ * Schema to extract the `created_by` person name from a Notion page.
49
+ *
50
+ * **Input:**
51
+ * ```
52
+ * {
53
+ * created_by: {
54
+ * id: string;
55
+ * object: "user" | "bot" | "group";
56
+ * name: string | null;
57
+ * ...
58
+ * }
59
+ * }
60
+ * ```
61
+ *
62
+ * **Output:** `string | null`
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * import * as v from "valibot";
67
+ * import { NullableCreatedByNameSchema } from "@nakanoaas/notion-valibot-schema";
68
+ *
69
+ * const PageSchema = v.object({
70
+ * id: v.string(),
71
+ * properties: v.object({
72
+ * CreatedByName: NullableCreatedByNameSchema,
73
+ * }),
74
+ * });
75
+ *
76
+ * const page = await notion.pages.retrieve({ page_id: "..." });
77
+ * const parsed = v.parse(PageSchema, page);
78
+ * // parsed.properties.CreatedByName: string | null
79
+ * ```
80
+ */
81
+ const NullableCreatedByNameSchema = v.pipe(v.object({ created_by: PersonSchema }), v.transform((v$1) => v$1.created_by.name));
82
+ /**
48
83
  * Schema to extract the `created_by` person ID from a Notion page.
49
84
  *
50
85
  * **Input:**
@@ -81,5 +116,5 @@ const CreatedBySchema = v.pipe(v.object({ created_by: PersonSchema }), v.transfo
81
116
  const CreatedByIdSchema = v.pipe(v.object({ created_by: PersonSchema }), v.transform((v$1) => v$1.created_by.id));
82
117
 
83
118
  //#endregion
84
- export { CreatedByIdSchema, CreatedBySchema };
119
+ export { CreatedByIdSchema, CreatedBySchema, NullableCreatedByNameSchema };
85
120
  //# sourceMappingURL=created-by.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"created-by.mjs","names":["v"],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `created_by` person object from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedBySchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedBy: CreatedBySchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedBy: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n */\nexport const CreatedBySchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by),\n);\n\n/**\n * Schema to extract the `created_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedById: CreatedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedById: string\n * ```\n */\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB,EAAE,KAChC,EAAE,OAAO,EACR,YAAY,cACZ,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,WAAW,CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,oBAAoB,EAAE,KAClC,EAAE,OAAO,EACR,YAAY,cACZ,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,WAAW,GAAG,CACnC"}
1
+ {"version":3,"file":"created-by.mjs","names":["v"],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `created_by` person object from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedBySchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedBy: CreatedBySchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedBy: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n */\nexport const CreatedBySchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by),\n);\n\n/**\n * Schema to extract the `created_by` person name from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableCreatedByNameSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedByName: NullableCreatedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedByName: string | null\n * ```\n */\nexport const NullableCreatedByNameSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.name),\n);\n\n/**\n * Schema to extract the `created_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedById: CreatedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedById: string\n * ```\n */\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB,EAAE,KAChC,EAAE,OAAO,EACR,YAAY,cACZ,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,WAAW,CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,8BAA8B,EAAE,KAC5C,EAAE,OAAO,EACR,YAAY,cACZ,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,WAAW,KAAK,CACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,oBAAoB,EAAE,KAClC,EAAE,OAAO,EACR,YAAY,cACZ,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,WAAW,GAAG,CACnC"}
package/dist/index.cjs CHANGED
@@ -32,8 +32,10 @@ exports.EmailSchema = require_email.EmailSchema;
32
32
  exports.FilesSchema = require_files.FilesSchema;
33
33
  exports.FormulaSchema = require_formula.FormulaSchema;
34
34
  exports.LastEditedByIdSchema = require_last_edited_by.LastEditedByIdSchema;
35
+ exports.LastEditedBySchema = require_last_edited_by.LastEditedBySchema;
35
36
  exports.LastEditedTimeSchema = require_last_edited_time.LastEditedTimeSchema;
36
37
  exports.MultiSelectSchema = require_multi_select.MultiSelectSchema;
38
+ exports.NullableCreatedByNameSchema = require_created_by.NullableCreatedByNameSchema;
37
39
  exports.NullableDateRangeSchema = require_date.NullableDateRangeSchema;
38
40
  exports.NullableDateSchema = require_date.NullableDateSchema;
39
41
  exports.NullableEmailSchema = require_email.NullableEmailSchema;
@@ -50,6 +52,7 @@ exports.NullableUniqueIdSchema = require_unique_id.NullableUniqueIdSchema;
50
52
  exports.NullableUrlSchema = require_url.NullableUrlSchema;
51
53
  exports.NullableVerificationSchema = require_verification.NullableVerificationSchema;
52
54
  exports.NumberSchema = require_number.NumberSchema;
55
+ exports.PeopleIdSchema = require_people.PeopleIdSchema;
53
56
  exports.PeopleSchema = require_people.PeopleSchema;
54
57
  exports.PersonSchema = require_people.PersonSchema;
55
58
  exports.PhoneNumberSchema = require_phone_number.PhoneNumberSchema;
package/dist/index.d.cts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { CheckboxSchema } from "./checkbox.cjs";
2
- import { CreatedByIdSchema, CreatedBySchema } from "./created-by.cjs";
2
+ import { CreatedByIdSchema, CreatedBySchema, NullableCreatedByNameSchema } from "./created-by.cjs";
3
3
  import { CreatedTimeSchema } from "./created-time.cjs";
4
4
  import { DateObjectSchema, DateRangeSchema, DateSchema, NullableDateRangeSchema, NullableDateSchema } from "./date.cjs";
5
5
  import { EmailSchema, NullableEmailSchema } from "./email.cjs";
6
6
  import { FilesSchema } from "./files.cjs";
7
7
  import { FormulaSchema } from "./formula.cjs";
8
- import { LastEditedByIdSchema, NullableLastEditedByNameSchema } from "./last-edited-by.cjs";
8
+ import { LastEditedByIdSchema, LastEditedBySchema, NullableLastEditedByNameSchema } from "./last-edited-by.cjs";
9
9
  import { LastEditedTimeSchema } from "./last-edited-time.cjs";
10
10
  import { MultiSelectSchema } from "./multi-select.cjs";
11
11
  import { NullableNumberSchema, NumberSchema } from "./number.cjs";
12
- import { PeopleSchema, PersonSchema } from "./people.cjs";
12
+ import { PeopleIdSchema, PeopleSchema, PersonSchema } from "./people.cjs";
13
13
  import { NullablePhoneNumberSchema, PhoneNumberSchema } from "./phone-number.cjs";
14
14
  import { NullablePlaceSchema, PlaceSchema } from "./place.cjs";
15
15
  import { NullableSingleRelationSchema, RelationSchema, SingleRelationSchema } from "./relation.cjs";
@@ -20,4 +20,4 @@ import { RichTextSchema, TitleSchema } from "./text.cjs";
20
20
  import { NullableUniqueIdSchema, UniqueIdNumberSchema } from "./unique-id.cjs";
21
21
  import { NullableUrlSchema, UrlSchema } from "./url.cjs";
22
22
  import { NullableVerificationSchema, VerificationSchema } from "./verification.cjs";
23
- export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
23
+ export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableCreatedByNameSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
package/dist/index.d.mts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { CheckboxSchema } from "./checkbox.mjs";
2
- import { CreatedByIdSchema, CreatedBySchema } from "./created-by.mjs";
2
+ import { CreatedByIdSchema, CreatedBySchema, NullableCreatedByNameSchema } from "./created-by.mjs";
3
3
  import { CreatedTimeSchema } from "./created-time.mjs";
4
4
  import { DateObjectSchema, DateRangeSchema, DateSchema, NullableDateRangeSchema, NullableDateSchema } from "./date.mjs";
5
5
  import { EmailSchema, NullableEmailSchema } from "./email.mjs";
6
6
  import { FilesSchema } from "./files.mjs";
7
7
  import { FormulaSchema } from "./formula.mjs";
8
- import { LastEditedByIdSchema, NullableLastEditedByNameSchema } from "./last-edited-by.mjs";
8
+ import { LastEditedByIdSchema, LastEditedBySchema, NullableLastEditedByNameSchema } from "./last-edited-by.mjs";
9
9
  import { LastEditedTimeSchema } from "./last-edited-time.mjs";
10
10
  import { MultiSelectSchema } from "./multi-select.mjs";
11
11
  import { NullableNumberSchema, NumberSchema } from "./number.mjs";
12
- import { PeopleSchema, PersonSchema } from "./people.mjs";
12
+ import { PeopleIdSchema, PeopleSchema, PersonSchema } from "./people.mjs";
13
13
  import { NullablePhoneNumberSchema, PhoneNumberSchema } from "./phone-number.mjs";
14
14
  import { NullablePlaceSchema, PlaceSchema } from "./place.mjs";
15
15
  import { NullableSingleRelationSchema, RelationSchema, SingleRelationSchema } from "./relation.mjs";
@@ -20,4 +20,4 @@ import { RichTextSchema, TitleSchema } from "./text.mjs";
20
20
  import { NullableUniqueIdSchema, UniqueIdNumberSchema } from "./unique-id.mjs";
21
21
  import { NullableUrlSchema, UrlSchema } from "./url.mjs";
22
22
  import { NullableVerificationSchema, VerificationSchema } from "./verification.mjs";
23
- export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
23
+ export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableCreatedByNameSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { CheckboxSchema } from "./checkbox.mjs";
2
- import { PeopleSchema, PersonSchema } from "./people.mjs";
3
- import { CreatedByIdSchema, CreatedBySchema } from "./created-by.mjs";
2
+ import { PeopleIdSchema, PeopleSchema, PersonSchema } from "./people.mjs";
3
+ import { CreatedByIdSchema, CreatedBySchema, NullableCreatedByNameSchema } from "./created-by.mjs";
4
4
  import { CreatedTimeSchema } from "./created-time.mjs";
5
5
  import { DateObjectSchema, DateRangeSchema, DateSchema, NullableDateRangeSchema, NullableDateSchema } from "./date.mjs";
6
6
  import { EmailSchema, NullableEmailSchema } from "./email.mjs";
7
7
  import { FilesSchema } from "./files.mjs";
8
8
  import { FormulaSchema } from "./formula.mjs";
9
- import { LastEditedByIdSchema, NullableLastEditedByNameSchema } from "./last-edited-by.mjs";
9
+ import { LastEditedByIdSchema, LastEditedBySchema, NullableLastEditedByNameSchema } from "./last-edited-by.mjs";
10
10
  import { LastEditedTimeSchema } from "./last-edited-time.mjs";
11
11
  import { MultiSelectSchema } from "./multi-select.mjs";
12
12
  import { NullableNumberSchema, NumberSchema } from "./number.mjs";
@@ -21,4 +21,4 @@ import { NullableUniqueIdSchema, UniqueIdNumberSchema } from "./unique-id.mjs";
21
21
  import { NullableUrlSchema, UrlSchema } from "./url.mjs";
22
22
  import { NullableVerificationSchema, VerificationSchema } from "./verification.mjs";
23
23
 
24
- export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedTimeSchema, MultiSelectSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
24
+ export { CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, DateRangeSchema, DateSchema, EmailSchema, FilesSchema, FormulaSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableCreatedByNameSchema, NullableDateRangeSchema, NullableDateSchema, NullableEmailSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleRelationSchema, NullableStatusSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, SelectSchema, SingleRelationSchema, StatusSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
@@ -5,6 +5,48 @@ valibot = require_rolldown_runtime.__toESM(valibot);
5
5
 
6
6
  //#region src/last-edited-by.ts
7
7
  /**
8
+ * Schema to extract the `last_edited_by` person object from a Notion page.
9
+ *
10
+ * **Input:**
11
+ * ```
12
+ * {
13
+ * last_edited_by: {
14
+ * id: string;
15
+ * object: "user" | "bot" | "group";
16
+ * name: string | null;
17
+ * ...
18
+ * }
19
+ * }
20
+ * ```
21
+ *
22
+ * **Output:**
23
+ * ```
24
+ * {
25
+ * id: string;
26
+ * object: "user" | "bot" | "group";
27
+ * name: string | null;
28
+ * }
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * import * as v from "valibot";
34
+ * import { LastEditedBySchema } from "@nakanoaas/notion-valibot-schema";
35
+ *
36
+ * const PageSchema = v.object({
37
+ * id: v.string(),
38
+ * properties: v.object({
39
+ * LastEditedBy: LastEditedBySchema,
40
+ * }),
41
+ * });
42
+ *
43
+ * const page = await notion.pages.retrieve({ page_id: "..." });
44
+ * const parsed = v.parse(PageSchema, page);
45
+ * // parsed.properties.LastEditedBy: { id: string; object: "user" | "bot" | "group"; name: string | null }
46
+ * ```
47
+ */
48
+ const LastEditedBySchema = valibot.pipe(valibot.object({ last_edited_by: require_people.PersonSchema }), valibot.transform((v) => v.last_edited_by));
49
+ /**
8
50
  * Schema to extract the `last_edited_by` person name from a Notion page.
9
51
  *
10
52
  * **Input:**
@@ -77,5 +119,6 @@ const LastEditedByIdSchema = valibot.pipe(valibot.object({ last_edited_by: requi
77
119
 
78
120
  //#endregion
79
121
  exports.LastEditedByIdSchema = LastEditedByIdSchema;
122
+ exports.LastEditedBySchema = LastEditedBySchema;
80
123
  exports.NullableLastEditedByNameSchema = NullableLastEditedByNameSchema;
81
124
  //# sourceMappingURL=last-edited-by.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"last-edited-by.cjs","names":["v","PersonSchema"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `last_edited_by` person name from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableLastEditedByNameSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedByName: NullableLastEditedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedByName: string | null\n * ```\n */\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.name),\n);\n\n/**\n * Schema to extract the `last_edited_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedById: LastEditedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedById: string\n * ```\n */\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,iCAAiCA,QAAE,KAC/CA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,KAAK,CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,GAAG,CACvC"}
1
+ {"version":3,"file":"last-edited-by.cjs","names":["v","PersonSchema"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `last_edited_by` person object from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedBySchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedBy: LastEditedBySchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedBy: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n */\nexport const LastEditedBySchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by),\n);\n\n/**\n * Schema to extract the `last_edited_by` person name from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableLastEditedByNameSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedByName: NullableLastEditedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedByName: string | null\n * ```\n */\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.name),\n);\n\n/**\n * Schema to extract the `last_edited_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedById: LastEditedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedById: string\n * ```\n */\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,qBAAqBA,QAAE,KACnCA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,CACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,iCAAiCA,QAAE,KAC/CA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,KAAK,CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,gBAAgBC,6BAChB,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,eAAe,GAAG,CACvC"}
@@ -2,6 +2,64 @@ import * as v from "valibot";
2
2
 
3
3
  //#region src/last-edited-by.d.ts
4
4
 
5
+ /**
6
+ * Schema to extract the `last_edited_by` person object from a Notion page.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * last_edited_by: {
12
+ * id: string;
13
+ * object: "user" | "bot" | "group";
14
+ * name: string | null;
15
+ * ...
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * **Output:**
21
+ * ```
22
+ * {
23
+ * id: string;
24
+ * object: "user" | "bot" | "group";
25
+ * name: string | null;
26
+ * }
27
+ * ```
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import * as v from "valibot";
32
+ * import { LastEditedBySchema } from "@nakanoaas/notion-valibot-schema";
33
+ *
34
+ * const PageSchema = v.object({
35
+ * id: v.string(),
36
+ * properties: v.object({
37
+ * LastEditedBy: LastEditedBySchema,
38
+ * }),
39
+ * });
40
+ *
41
+ * const page = await notion.pages.retrieve({ page_id: "..." });
42
+ * const parsed = v.parse(PageSchema, page);
43
+ * // parsed.properties.LastEditedBy: { id: string; object: "user" | "bot" | "group"; name: string | null }
44
+ * ```
45
+ */
46
+ declare const LastEditedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
47
+ readonly last_edited_by: v.ObjectSchema<{
48
+ readonly id: v.StringSchema<undefined>;
49
+ readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
50
+ readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
51
+ }, undefined>;
52
+ }, undefined>, v.TransformAction<{
53
+ last_edited_by: {
54
+ id: string;
55
+ object: "user" | "bot" | "group";
56
+ name: string | null;
57
+ };
58
+ }, {
59
+ id: string;
60
+ object: "user" | "bot" | "group";
61
+ name: string | null;
62
+ }>]>;
5
63
  /**
6
64
  * Schema to extract the `last_edited_by` person name from a Notion page.
7
65
  *
@@ -97,5 +155,5 @@ declare const LastEditedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
97
155
  };
98
156
  }, string>]>;
99
157
  //#endregion
100
- export { LastEditedByIdSchema, NullableLastEditedByNameSchema };
158
+ export { LastEditedByIdSchema, LastEditedBySchema, NullableLastEditedByNameSchema };
101
159
  //# sourceMappingURL=last-edited-by.d.cts.map
@@ -2,6 +2,64 @@ import * as v from "valibot";
2
2
 
3
3
  //#region src/last-edited-by.d.ts
4
4
 
5
+ /**
6
+ * Schema to extract the `last_edited_by` person object from a Notion page.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * last_edited_by: {
12
+ * id: string;
13
+ * object: "user" | "bot" | "group";
14
+ * name: string | null;
15
+ * ...
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * **Output:**
21
+ * ```
22
+ * {
23
+ * id: string;
24
+ * object: "user" | "bot" | "group";
25
+ * name: string | null;
26
+ * }
27
+ * ```
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import * as v from "valibot";
32
+ * import { LastEditedBySchema } from "@nakanoaas/notion-valibot-schema";
33
+ *
34
+ * const PageSchema = v.object({
35
+ * id: v.string(),
36
+ * properties: v.object({
37
+ * LastEditedBy: LastEditedBySchema,
38
+ * }),
39
+ * });
40
+ *
41
+ * const page = await notion.pages.retrieve({ page_id: "..." });
42
+ * const parsed = v.parse(PageSchema, page);
43
+ * // parsed.properties.LastEditedBy: { id: string; object: "user" | "bot" | "group"; name: string | null }
44
+ * ```
45
+ */
46
+ declare const LastEditedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
47
+ readonly last_edited_by: v.ObjectSchema<{
48
+ readonly id: v.StringSchema<undefined>;
49
+ readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
50
+ readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
51
+ }, undefined>;
52
+ }, undefined>, v.TransformAction<{
53
+ last_edited_by: {
54
+ id: string;
55
+ object: "user" | "bot" | "group";
56
+ name: string | null;
57
+ };
58
+ }, {
59
+ id: string;
60
+ object: "user" | "bot" | "group";
61
+ name: string | null;
62
+ }>]>;
5
63
  /**
6
64
  * Schema to extract the `last_edited_by` person name from a Notion page.
7
65
  *
@@ -97,5 +155,5 @@ declare const LastEditedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
97
155
  };
98
156
  }, string>]>;
99
157
  //#endregion
100
- export { LastEditedByIdSchema, NullableLastEditedByNameSchema };
158
+ export { LastEditedByIdSchema, LastEditedBySchema, NullableLastEditedByNameSchema };
101
159
  //# sourceMappingURL=last-edited-by.d.mts.map
@@ -3,6 +3,48 @@ import * as v from "valibot";
3
3
 
4
4
  //#region src/last-edited-by.ts
5
5
  /**
6
+ * Schema to extract the `last_edited_by` person object from a Notion page.
7
+ *
8
+ * **Input:**
9
+ * ```
10
+ * {
11
+ * last_edited_by: {
12
+ * id: string;
13
+ * object: "user" | "bot" | "group";
14
+ * name: string | null;
15
+ * ...
16
+ * }
17
+ * }
18
+ * ```
19
+ *
20
+ * **Output:**
21
+ * ```
22
+ * {
23
+ * id: string;
24
+ * object: "user" | "bot" | "group";
25
+ * name: string | null;
26
+ * }
27
+ * ```
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import * as v from "valibot";
32
+ * import { LastEditedBySchema } from "@nakanoaas/notion-valibot-schema";
33
+ *
34
+ * const PageSchema = v.object({
35
+ * id: v.string(),
36
+ * properties: v.object({
37
+ * LastEditedBy: LastEditedBySchema,
38
+ * }),
39
+ * });
40
+ *
41
+ * const page = await notion.pages.retrieve({ page_id: "..." });
42
+ * const parsed = v.parse(PageSchema, page);
43
+ * // parsed.properties.LastEditedBy: { id: string; object: "user" | "bot" | "group"; name: string | null }
44
+ * ```
45
+ */
46
+ const LastEditedBySchema = v.pipe(v.object({ last_edited_by: PersonSchema }), v.transform((v$1) => v$1.last_edited_by));
47
+ /**
6
48
  * Schema to extract the `last_edited_by` person name from a Notion page.
7
49
  *
8
50
  * **Input:**
@@ -74,5 +116,5 @@ const NullableLastEditedByNameSchema = v.pipe(v.object({ last_edited_by: PersonS
74
116
  const LastEditedByIdSchema = v.pipe(v.object({ last_edited_by: PersonSchema }), v.transform((v$1) => v$1.last_edited_by.id));
75
117
 
76
118
  //#endregion
77
- export { LastEditedByIdSchema, NullableLastEditedByNameSchema };
119
+ export { LastEditedByIdSchema, LastEditedBySchema, NullableLastEditedByNameSchema };
78
120
  //# sourceMappingURL=last-edited-by.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"last-edited-by.mjs","names":["v"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `last_edited_by` person name from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableLastEditedByNameSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedByName: NullableLastEditedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedByName: string | null\n * ```\n */\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.name),\n);\n\n/**\n * Schema to extract the `last_edited_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedById: LastEditedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedById: string\n * ```\n */\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,iCAAiC,EAAE,KAC/C,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,KAAK,CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,GAAG,CACvC"}
1
+ {"version":3,"file":"last-edited-by.mjs","names":["v"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `last_edited_by` person object from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedBySchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedBy: LastEditedBySchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedBy: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n */\nexport const LastEditedBySchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by),\n);\n\n/**\n * Schema to extract the `last_edited_by` person name from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableLastEditedByNameSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedByName: NullableLastEditedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedByName: string | null\n * ```\n */\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.name),\n);\n\n/**\n * Schema to extract the `last_edited_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { LastEditedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * LastEditedById: LastEditedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.LastEditedById: string\n * ```\n */\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,qBAAqB,EAAE,KACnC,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,CACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,iCAAiC,EAAE,KAC/C,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,KAAK,CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,gBAAgB,cAChB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,eAAe,GAAG,CACvC"}
package/dist/people.cjs CHANGED
@@ -97,8 +97,49 @@ const PersonSchema = valibot.object({
97
97
  * ```
98
98
  */
99
99
  const PeopleSchema = valibot.pipe(valibot.object({ people: valibot.array(PersonSchema) }), valibot.transform((v) => v.people));
100
+ /**
101
+ * Schema to extract the `people` array of IDs from a Notion property.
102
+ *
103
+ * **Input:**
104
+ * ```
105
+ * {
106
+ * people: [
107
+ * {
108
+ * id: string;
109
+ * object: "user" | "bot" | "group";
110
+ * name: string | null;
111
+ * ...
112
+ * }
113
+ * ]
114
+ * }
115
+ * ```
116
+ *
117
+ * **Output:**
118
+ * ```
119
+ * [string]
120
+ * ```
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * import * as v from "valibot";
125
+ * import { PeopleIdSchema } from "@nakanoaas/notion-valibot-schema";
126
+ *
127
+ * const PageSchema = v.object({
128
+ * id: v.string(),
129
+ * properties: v.object({
130
+ * People: PeopleIdSchema,
131
+ * }),
132
+ * });
133
+ *
134
+ * const page = await notion.pages.retrieve({ page_id: "..." });
135
+ * const parsed = v.parse(PageSchema, page);
136
+ * // parsed.properties.People: [string]
137
+ * ```
138
+ */
139
+ const PeopleIdSchema = valibot.pipe(valibot.object({ people: valibot.array(PersonSchema) }), valibot.transform((v) => v.people.map((p) => p.id)));
100
140
 
101
141
  //#endregion
142
+ exports.PeopleIdSchema = PeopleIdSchema;
102
143
  exports.PeopleSchema = PeopleSchema;
103
144
  exports.PersonSchema = PersonSchema;
104
145
  //# sourceMappingURL=people.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"people.cjs","names":["v"],"sources":["../src/people.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion person object (user, bot, or group).\n *\n * **Input:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PersonSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * created_by: PersonSchema,\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.created_by: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n *\n * @internal\n */\nexport const PersonSchema = v.object({\n\tid: v.string(),\n\tobject: v.picklist([\"user\", \"bot\", \"group\"]),\n\tname: v.nullish(v.string(), null),\n});\n\n/**\n * Schema to extract the `people` array from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * people: [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ]\n * }\n * ```\n *\n * **Output:**\n * ```\n * [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ]\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PeopleSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * People: PeopleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.People: Array<{ id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }>\n * ```\n */\nexport const PeopleSchema = v.pipe(\n\tv.object({\n\t\tpeople: v.array(PersonSchema),\n\t}),\n\tv.transform((v) => v.people),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,eAAeA,QAAE,OAAO;CACpC,IAAIA,QAAE,QAAQ;CACd,QAAQA,QAAE,SAAS;EAAC;EAAQ;EAAO;EAAQ,CAAC;CAC5C,MAAMA,QAAE,QAAQA,QAAE,QAAQ,EAAE,KAAK;CACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CF,MAAa,eAAeA,QAAE,KAC7BA,QAAE,OAAO,EACR,QAAQA,QAAE,MAAM,aAAa,EAC7B,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,OAAO,CAC5B"}
1
+ {"version":3,"file":"people.cjs","names":["v"],"sources":["../src/people.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion person object (user, bot, or group).\n *\n * **Input:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PersonSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * created_by: PersonSchema,\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.created_by: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n *\n * @internal\n */\nexport const PersonSchema = v.object({\n\tid: v.string(),\n\tobject: v.picklist([\"user\", \"bot\", \"group\"]),\n\tname: v.nullish(v.string(), null),\n});\n\n/**\n * Schema to extract the `people` array from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * people: [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ]\n * }\n * ```\n *\n * **Output:**\n * ```\n * [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ]\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PeopleSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * People: PeopleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.People: Array<{ id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }>\n * ```\n */\nexport const PeopleSchema = v.pipe(\n\tv.object({\n\t\tpeople: v.array(PersonSchema),\n\t}),\n\tv.transform((v) => v.people),\n);\n\n/**\n * Schema to extract the `people` array of IDs from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * people: [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ]\n * }\n * ```\n *\n * **Output:**\n * ```\n * [string]\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PeopleIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * People: PeopleIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.People: [string]\n * ```\n */\nexport const PeopleIdSchema = v.pipe(\n\tv.object({\n\t\tpeople: v.array(PersonSchema),\n\t}),\n\tv.transform((v) => v.people.map((p) => p.id)),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,eAAeA,QAAE,OAAO;CACpC,IAAIA,QAAE,QAAQ;CACd,QAAQA,QAAE,SAAS;EAAC;EAAQ;EAAO;EAAQ,CAAC;CAC5C,MAAMA,QAAE,QAAQA,QAAE,QAAQ,EAAE,KAAK;CACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CF,MAAa,eAAeA,QAAE,KAC7BA,QAAE,OAAO,EACR,QAAQA,QAAE,MAAM,aAAa,EAC7B,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,OAAO,CAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCD,MAAa,iBAAiBA,QAAE,KAC/BA,QAAE,OAAO,EACR,QAAQA,QAAE,MAAM,aAAa,EAC7B,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,OAAO,KAAK,MAAM,EAAE,GAAG,CAAC,CAC7C"}
package/dist/people.d.cts CHANGED
@@ -108,6 +108,58 @@ declare const PeopleSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
108
108
  object: "user" | "bot" | "group";
109
109
  name: string | null;
110
110
  }[]>]>;
111
+ /**
112
+ * Schema to extract the `people` array of IDs from a Notion property.
113
+ *
114
+ * **Input:**
115
+ * ```
116
+ * {
117
+ * people: [
118
+ * {
119
+ * id: string;
120
+ * object: "user" | "bot" | "group";
121
+ * name: string | null;
122
+ * ...
123
+ * }
124
+ * ]
125
+ * }
126
+ * ```
127
+ *
128
+ * **Output:**
129
+ * ```
130
+ * [string]
131
+ * ```
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * import * as v from "valibot";
136
+ * import { PeopleIdSchema } from "@nakanoaas/notion-valibot-schema";
137
+ *
138
+ * const PageSchema = v.object({
139
+ * id: v.string(),
140
+ * properties: v.object({
141
+ * People: PeopleIdSchema,
142
+ * }),
143
+ * });
144
+ *
145
+ * const page = await notion.pages.retrieve({ page_id: "..." });
146
+ * const parsed = v.parse(PageSchema, page);
147
+ * // parsed.properties.People: [string]
148
+ * ```
149
+ */
150
+ declare const PeopleIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
151
+ readonly people: v.ArraySchema<v.ObjectSchema<{
152
+ readonly id: v.StringSchema<undefined>;
153
+ readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
154
+ readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
155
+ }, undefined>, undefined>;
156
+ }, undefined>, v.TransformAction<{
157
+ people: {
158
+ id: string;
159
+ object: "user" | "bot" | "group";
160
+ name: string | null;
161
+ }[];
162
+ }, string[]>]>;
111
163
  //#endregion
112
- export { PeopleSchema, PersonSchema };
164
+ export { PeopleIdSchema, PeopleSchema, PersonSchema };
113
165
  //# sourceMappingURL=people.d.cts.map
package/dist/people.d.mts CHANGED
@@ -108,6 +108,58 @@ declare const PeopleSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
108
108
  object: "user" | "bot" | "group";
109
109
  name: string | null;
110
110
  }[]>]>;
111
+ /**
112
+ * Schema to extract the `people` array of IDs from a Notion property.
113
+ *
114
+ * **Input:**
115
+ * ```
116
+ * {
117
+ * people: [
118
+ * {
119
+ * id: string;
120
+ * object: "user" | "bot" | "group";
121
+ * name: string | null;
122
+ * ...
123
+ * }
124
+ * ]
125
+ * }
126
+ * ```
127
+ *
128
+ * **Output:**
129
+ * ```
130
+ * [string]
131
+ * ```
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * import * as v from "valibot";
136
+ * import { PeopleIdSchema } from "@nakanoaas/notion-valibot-schema";
137
+ *
138
+ * const PageSchema = v.object({
139
+ * id: v.string(),
140
+ * properties: v.object({
141
+ * People: PeopleIdSchema,
142
+ * }),
143
+ * });
144
+ *
145
+ * const page = await notion.pages.retrieve({ page_id: "..." });
146
+ * const parsed = v.parse(PageSchema, page);
147
+ * // parsed.properties.People: [string]
148
+ * ```
149
+ */
150
+ declare const PeopleIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
151
+ readonly people: v.ArraySchema<v.ObjectSchema<{
152
+ readonly id: v.StringSchema<undefined>;
153
+ readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
154
+ readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
155
+ }, undefined>, undefined>;
156
+ }, undefined>, v.TransformAction<{
157
+ people: {
158
+ id: string;
159
+ object: "user" | "bot" | "group";
160
+ name: string | null;
161
+ }[];
162
+ }, string[]>]>;
111
163
  //#endregion
112
- export { PeopleSchema, PersonSchema };
164
+ export { PeopleIdSchema, PeopleSchema, PersonSchema };
113
165
  //# sourceMappingURL=people.d.mts.map
package/dist/people.mjs CHANGED
@@ -95,7 +95,47 @@ const PersonSchema = v.object({
95
95
  * ```
96
96
  */
97
97
  const PeopleSchema = v.pipe(v.object({ people: v.array(PersonSchema) }), v.transform((v$1) => v$1.people));
98
+ /**
99
+ * Schema to extract the `people` array of IDs from a Notion property.
100
+ *
101
+ * **Input:**
102
+ * ```
103
+ * {
104
+ * people: [
105
+ * {
106
+ * id: string;
107
+ * object: "user" | "bot" | "group";
108
+ * name: string | null;
109
+ * ...
110
+ * }
111
+ * ]
112
+ * }
113
+ * ```
114
+ *
115
+ * **Output:**
116
+ * ```
117
+ * [string]
118
+ * ```
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * import * as v from "valibot";
123
+ * import { PeopleIdSchema } from "@nakanoaas/notion-valibot-schema";
124
+ *
125
+ * const PageSchema = v.object({
126
+ * id: v.string(),
127
+ * properties: v.object({
128
+ * People: PeopleIdSchema,
129
+ * }),
130
+ * });
131
+ *
132
+ * const page = await notion.pages.retrieve({ page_id: "..." });
133
+ * const parsed = v.parse(PageSchema, page);
134
+ * // parsed.properties.People: [string]
135
+ * ```
136
+ */
137
+ const PeopleIdSchema = v.pipe(v.object({ people: v.array(PersonSchema) }), v.transform((v$1) => v$1.people.map((p) => p.id)));
98
138
 
99
139
  //#endregion
100
- export { PeopleSchema, PersonSchema };
140
+ export { PeopleIdSchema, PeopleSchema, PersonSchema };
101
141
  //# sourceMappingURL=people.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"people.mjs","names":["v"],"sources":["../src/people.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion person object (user, bot, or group).\n *\n * **Input:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PersonSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * created_by: PersonSchema,\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.created_by: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n *\n * @internal\n */\nexport const PersonSchema = v.object({\n\tid: v.string(),\n\tobject: v.picklist([\"user\", \"bot\", \"group\"]),\n\tname: v.nullish(v.string(), null),\n});\n\n/**\n * Schema to extract the `people` array from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * people: [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ]\n * }\n * ```\n *\n * **Output:**\n * ```\n * [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ]\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PeopleSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * People: PeopleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.People: Array<{ id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }>\n * ```\n */\nexport const PeopleSchema = v.pipe(\n\tv.object({\n\t\tpeople: v.array(PersonSchema),\n\t}),\n\tv.transform((v) => v.people),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,eAAe,EAAE,OAAO;CACpC,IAAI,EAAE,QAAQ;CACd,QAAQ,EAAE,SAAS;EAAC;EAAQ;EAAO;EAAQ,CAAC;CAC5C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK;CACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CF,MAAa,eAAe,EAAE,KAC7B,EAAE,OAAO,EACR,QAAQ,EAAE,MAAM,aAAa,EAC7B,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,OAAO,CAC5B"}
1
+ {"version":3,"file":"people.mjs","names":["v"],"sources":["../src/people.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion person object (user, bot, or group).\n *\n * **Input:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PersonSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * created_by: PersonSchema,\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.created_by: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n *\n * @internal\n */\nexport const PersonSchema = v.object({\n\tid: v.string(),\n\tobject: v.picklist([\"user\", \"bot\", \"group\"]),\n\tname: v.nullish(v.string(), null),\n});\n\n/**\n * Schema to extract the `people` array from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * people: [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ]\n * }\n * ```\n *\n * **Output:**\n * ```\n * [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ]\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PeopleSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * People: PeopleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.People: Array<{ id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }>\n * ```\n */\nexport const PeopleSchema = v.pipe(\n\tv.object({\n\t\tpeople: v.array(PersonSchema),\n\t}),\n\tv.transform((v) => v.people),\n);\n\n/**\n * Schema to extract the `people` array of IDs from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * people: [\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * ]\n * }\n * ```\n *\n * **Output:**\n * ```\n * [string]\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PeopleIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * People: PeopleIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.People: [string]\n * ```\n */\nexport const PeopleIdSchema = v.pipe(\n\tv.object({\n\t\tpeople: v.array(PersonSchema),\n\t}),\n\tv.transform((v) => v.people.map((p) => p.id)),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,eAAe,EAAE,OAAO;CACpC,IAAI,EAAE,QAAQ;CACd,QAAQ,EAAE,SAAS;EAAC;EAAQ;EAAO;EAAQ,CAAC;CAC5C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK;CACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CF,MAAa,eAAe,EAAE,KAC7B,EAAE,OAAO,EACR,QAAQ,EAAE,MAAM,aAAa,EAC7B,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,OAAO,CAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCD,MAAa,iBAAiB,EAAE,KAC/B,EAAE,OAAO,EACR,QAAQ,EAAE,MAAM,aAAa,EAC7B,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,OAAO,KAAK,MAAM,EAAE,GAAG,CAAC,CAC7C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nakanoaas/notion-valibot-schema",
3
- "version": "0.0.6",
4
- "description": "A small collection of Valibot schemas for the Notion API",
3
+ "version": "0.0.7",
4
+ "description": "Turn Notion's nested API responses into clean, typed JavaScript values.",
5
5
  "author": "Nakano as a Service",
6
6
  "license": "MIT",
7
7
  "type": "module",