@nakanoaas/notion-valibot-schema 0.6.0 → 0.7.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.
- package/README.md +63 -4
- package/dist/created-by.cjs +30 -26
- package/dist/created-by.cjs.map +1 -1
- package/dist/created-by.d.cts +35 -48
- package/dist/created-by.d.mts +35 -48
- package/dist/created-by.mjs +31 -27
- package/dist/created-by.mjs.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/last-edited-by.cjs +27 -25
- package/dist/last-edited-by.cjs.map +1 -1
- package/dist/last-edited-by.d.cts +29 -44
- package/dist/last-edited-by.d.mts +29 -44
- package/dist/last-edited-by.mjs +28 -26
- package/dist/last-edited-by.mjs.map +1 -1
- package/dist/people.cjs +320 -38
- package/dist/people.cjs.map +1 -1
- package/dist/people.d.cts +331 -53
- package/dist/people.d.mts +331 -53
- package/dist/people.mjs +313 -39
- package/dist/people.mjs.map +1 -1
- package/dist/verification.cjs +7 -7
- package/dist/verification.cjs.map +1 -1
- package/dist/verification.d.cts +18 -12
- package/dist/verification.d.mts +18 -12
- package/dist/verification.mjs +8 -8
- package/dist/verification.mjs.map +1 -1
- package/package.json +1 -1
package/dist/created-by.mjs
CHANGED
|
@@ -1,48 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UserOrGroupIdSchema, UserOrGroupSchema } from "./people.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/created-by.ts
|
|
4
4
|
/**
|
|
5
|
-
* Schema to extract the `created_by` person
|
|
5
|
+
* Schema to extract the `created_by` person ID from a Notion page.
|
|
6
6
|
*
|
|
7
7
|
* **Input:**
|
|
8
8
|
* ```
|
|
9
9
|
* {
|
|
10
10
|
* created_by: {
|
|
11
11
|
* id: string;
|
|
12
|
-
* object: "user" | "
|
|
12
|
+
* object: "user" | "group";
|
|
13
13
|
* name: string | null;
|
|
14
14
|
* ...
|
|
15
15
|
* }
|
|
16
16
|
* }
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
|
-
* **Output:**
|
|
20
|
-
* ```
|
|
21
|
-
* {
|
|
22
|
-
* id: string;
|
|
23
|
-
* object: "user" | "bot" | "group";
|
|
24
|
-
* name: string | null;
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
19
|
+
* **Output:** `string`
|
|
27
20
|
*
|
|
28
21
|
* @example
|
|
29
22
|
* ```ts
|
|
30
23
|
* import * as v from "valibot";
|
|
31
|
-
* import {
|
|
24
|
+
* import { CreatedByIdSchema } from "@nakanoaas/notion-valibot-schema";
|
|
32
25
|
*
|
|
33
26
|
* const PageSchema = v.object({
|
|
34
27
|
* id: v.string(),
|
|
35
28
|
* properties: v.object({
|
|
36
|
-
*
|
|
29
|
+
* "Created By": CreatedByIdSchema,
|
|
37
30
|
* }),
|
|
38
31
|
* });
|
|
39
32
|
*
|
|
40
33
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
41
34
|
* const parsed = v.parse(PageSchema, page);
|
|
42
|
-
* // parsed.properties
|
|
35
|
+
* // parsed.properties["Created By"]: string
|
|
43
36
|
* ```
|
|
44
37
|
*/
|
|
45
|
-
const
|
|
38
|
+
const CreatedByIdSchema = v.pipe(v.object({ created_by: UserOrGroupIdSchema }), v.transform((v) => v.created_by.id));
|
|
46
39
|
/**
|
|
47
40
|
* Schema to extract the `created_by` person name from a Notion page.
|
|
48
41
|
*
|
|
@@ -51,7 +44,7 @@ const CreatedBySchema = v.pipe(v.object({ created_by: PersonSchema }), v.transfo
|
|
|
51
44
|
* {
|
|
52
45
|
* created_by: {
|
|
53
46
|
* id: string;
|
|
54
|
-
* object: "user" | "
|
|
47
|
+
* object: "user" | "group";
|
|
55
48
|
* name: string | null;
|
|
56
49
|
* ...
|
|
57
50
|
* }
|
|
@@ -68,51 +61,62 @@ const CreatedBySchema = v.pipe(v.object({ created_by: PersonSchema }), v.transfo
|
|
|
68
61
|
* const PageSchema = v.object({
|
|
69
62
|
* id: v.string(),
|
|
70
63
|
* properties: v.object({
|
|
71
|
-
*
|
|
64
|
+
* "Created By": NullableCreatedByNameSchema,
|
|
72
65
|
* }),
|
|
73
66
|
* });
|
|
74
67
|
*
|
|
75
68
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
76
69
|
* const parsed = v.parse(PageSchema, page);
|
|
77
|
-
* // parsed.properties
|
|
70
|
+
* // parsed.properties["Created By"]: string | null
|
|
78
71
|
* ```
|
|
79
72
|
*/
|
|
80
|
-
const NullableCreatedByNameSchema = v.pipe(v.object({ created_by:
|
|
73
|
+
const NullableCreatedByNameSchema = v.pipe(v.object({ created_by: UserOrGroupSchema }), v.transform((v) => v.created_by.name));
|
|
81
74
|
/**
|
|
82
|
-
* Schema to extract the `created_by` person
|
|
75
|
+
* Schema factory to extract the `created_by` person object from a Notion page.
|
|
76
|
+
*
|
|
77
|
+
* This is a generic schema factory that accepts another schema as a parameter,
|
|
78
|
+
* allowing you to combine it with building-block schemas such as
|
|
79
|
+
* `UserOrGroupSchema`, `UserSchema`, or `PersonSchema`.
|
|
83
80
|
*
|
|
84
81
|
* **Input:**
|
|
85
82
|
* ```
|
|
86
83
|
* {
|
|
87
84
|
* created_by: {
|
|
88
85
|
* id: string;
|
|
89
|
-
* object: "user" | "
|
|
90
|
-
* name
|
|
86
|
+
* object: "user" | "group";
|
|
87
|
+
* name?: string | null;
|
|
91
88
|
* ...
|
|
92
89
|
* }
|
|
93
90
|
* }
|
|
94
91
|
* ```
|
|
95
92
|
*
|
|
96
|
-
* **Output:**
|
|
93
|
+
* **Output:** The output type depends on the schema passed as a parameter.
|
|
94
|
+
*
|
|
95
|
+
* @param schema - A schema that validates the `created_by` user or group object.
|
|
97
96
|
*
|
|
98
97
|
* @example
|
|
99
98
|
* ```ts
|
|
100
99
|
* import * as v from "valibot";
|
|
101
|
-
* import {
|
|
100
|
+
* import {
|
|
101
|
+
* CreatedBySchema,
|
|
102
|
+
* UserOrGroupSchema,
|
|
103
|
+
* } from "@nakanoaas/notion-valibot-schema";
|
|
102
104
|
*
|
|
103
105
|
* const PageSchema = v.object({
|
|
104
106
|
* id: v.string(),
|
|
105
107
|
* properties: v.object({
|
|
106
|
-
*
|
|
108
|
+
* "Created By": CreatedBySchema(UserOrGroupSchema),
|
|
107
109
|
* }),
|
|
108
110
|
* });
|
|
109
111
|
*
|
|
110
112
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
111
113
|
* const parsed = v.parse(PageSchema, page);
|
|
112
|
-
* // parsed.properties
|
|
114
|
+
* // parsed.properties["Created By"]: { id: string; object: "user" | "group"; name: string | null }
|
|
113
115
|
* ```
|
|
114
116
|
*/
|
|
115
|
-
|
|
117
|
+
function CreatedBySchema(schema) {
|
|
118
|
+
return v.pipe(v.object({ created_by: schema }), v.transform((v) => v.created_by));
|
|
119
|
+
}
|
|
116
120
|
//#endregion
|
|
117
121
|
export { CreatedByIdSchema, CreatedBySchema, NullableCreatedByNameSchema };
|
|
118
122
|
|
package/dist/created-by.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"created-by.mjs","names":[],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"created-by.mjs","names":[],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { UserOrGroupIdSchema, UserOrGroupSchema } from \"./people\";\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\" | \"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 * \"Created By\": CreatedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties[\"Created By\"]: string\n * ```\n */\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: UserOrGroupIdSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\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\" | \"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 * \"Created By\": NullableCreatedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties[\"Created By\"]: string | null\n * ```\n */\nexport const NullableCreatedByNameSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: UserOrGroupSchema,\n\t}),\n\tv.transform((v) => v.created_by.name),\n);\n\n/**\n * Schema factory to extract the `created_by` person object from a Notion page.\n *\n * This is a generic schema factory that accepts another schema as a parameter,\n * allowing you to combine it with building-block schemas such as\n * `UserOrGroupSchema`, `UserSchema`, or `PersonSchema`.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"group\";\n * name?: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter.\n *\n * @param schema - A schema that validates the `created_by` user or group object.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import {\n * CreatedBySchema,\n * UserOrGroupSchema,\n * } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * \"Created By\": CreatedBySchema(UserOrGroupSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties[\"Created By\"]: { id: string; object: \"user\" | \"group\"; name: string | null }\n * ```\n */\nexport function CreatedBySchema<\n\tS extends v.GenericSchema<{ id: string; object: \"user\" | \"group\" }, unknown>,\n>(\n\tschema: S,\n): v.GenericSchema<{ created_by: v.InferInput<S> }, v.InferOutput<S>> {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tcreated_by: schema,\n\t\t}),\n\t\tv.transform((v) => v.created_by),\n\t) as v.GenericSchema<{ created_by: v.InferInput<S> }, v.InferOutput<S>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,oBAAoB,EAAE,KAClC,EAAE,OAAO,EACR,YAAY,oBACb,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,WAAW,EAAE,CACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,8BAA8B,EAAE,KAC5C,EAAE,OAAO,EACR,YAAY,kBACb,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,WAAW,IAAI,CACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,gBAGf,QACqE;CACrE,OAAO,EAAE,KACR,EAAE,OAAO,EACR,YAAY,OACb,CAAC,GACD,EAAE,WAAW,MAAM,EAAE,UAAU,CAChC;AACD"}
|
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ const require_unique_id = require("./unique-id.cjs");
|
|
|
22
22
|
const require_url = require("./url.cjs");
|
|
23
23
|
const require_verification = require("./verification.cjs");
|
|
24
24
|
exports.BooleanFormulaSchema = require_formula.BooleanFormulaSchema;
|
|
25
|
+
exports.BotSchema = require_people.BotSchema;
|
|
25
26
|
exports.CheckboxSchema = require_checkbox.CheckboxSchema;
|
|
26
27
|
exports.CreatedByIdSchema = require_created_by.CreatedByIdSchema;
|
|
27
28
|
exports.CreatedBySchema = require_created_by.CreatedBySchema;
|
|
@@ -50,6 +51,8 @@ exports.NullableRollupNumberSchema = require_rollup.NullableRollupNumberSchema;
|
|
|
50
51
|
exports.NullableSelectSchema = require_select.NullableSelectSchema;
|
|
51
52
|
exports.NullableSingleDateSchema = require_date.NullableSingleDateSchema;
|
|
52
53
|
exports.NullableSingleFileSchema = require_files.NullableSingleFileSchema;
|
|
54
|
+
exports.NullableSinglePeopleIdSchema = require_people.NullableSinglePeopleIdSchema;
|
|
55
|
+
exports.NullableSinglePeopleSchema = require_people.NullableSinglePeopleSchema;
|
|
53
56
|
exports.NullableSingleRelationSchema = require_relation.NullableSingleRelationSchema;
|
|
54
57
|
exports.NullableSingleRollupArraySchema = require_rollup.NullableSingleRollupArraySchema;
|
|
55
58
|
exports.NullableStatusSchema = require_status.NullableStatusSchema;
|
|
@@ -74,6 +77,8 @@ exports.RollupSimpleSchema = require_rollup.RollupSimpleSchema;
|
|
|
74
77
|
exports.SelectSchema = require_select.SelectSchema;
|
|
75
78
|
exports.SingleDateSchema = require_date.SingleDateSchema;
|
|
76
79
|
exports.SingleFileSchema = require_files.SingleFileSchema;
|
|
80
|
+
exports.SinglePeopleIdSchema = require_people.SinglePeopleIdSchema;
|
|
81
|
+
exports.SinglePeopleSchema = require_people.SinglePeopleSchema;
|
|
77
82
|
exports.SingleRelationSchema = require_relation.SingleRelationSchema;
|
|
78
83
|
exports.SingleRollupArraySchema = require_rollup.SingleRollupArraySchema;
|
|
79
84
|
exports.StatusSchema = require_status.StatusSchema;
|
|
@@ -81,4 +86,7 @@ exports.StringFormulaSchema = require_formula.StringFormulaSchema;
|
|
|
81
86
|
exports.TitleSchema = require_text.TitleSchema;
|
|
82
87
|
exports.UniqueIdNumberSchema = require_unique_id.UniqueIdNumberSchema;
|
|
83
88
|
exports.UrlSchema = require_url.UrlSchema;
|
|
89
|
+
exports.UserOrGroupIdSchema = require_people.UserOrGroupIdSchema;
|
|
90
|
+
exports.UserOrGroupSchema = require_people.UserOrGroupSchema;
|
|
91
|
+
exports.UserSchema = require_people.UserSchema;
|
|
84
92
|
exports.VerificationSchema = require_verification.VerificationSchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -9,7 +9,7 @@ import { LastEditedByIdSchema, LastEditedBySchema, NullableLastEditedByNameSchem
|
|
|
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 { PeopleIdSchema, PeopleSchema, PersonSchema } from "./people.cjs";
|
|
12
|
+
import { BotSchema, NullableSinglePeopleIdSchema, NullableSinglePeopleSchema, PeopleIdSchema, PeopleSchema, PersonSchema, SinglePeopleIdSchema, SinglePeopleSchema, UserOrGroupIdSchema, UserOrGroupSchema, UserSchema } 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 { NullableRichTextSchema, NullableTitleSchema, RichTextSchema, TitleSchem
|
|
|
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 { BooleanFormulaSchema, CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, EmailSchema, FileSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableBooleanFormulaSchema, NullableCreatedByNameSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRangeDateSchema, NullableRichTextSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleDateSchema, NullableSingleFileSchema, NullableSingleRelationSchema, NullableSingleRollupArraySchema, NullableStatusSchema, NullableStringFormulaSchema, NullableTitleSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RangeDateSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, RollupSimpleSchema, SelectSchema, SingleDateSchema, SingleFileSchema, SingleRelationSchema, SingleRollupArraySchema, StatusSchema, StringFormulaSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
|
|
23
|
+
export { BooleanFormulaSchema, BotSchema, CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, EmailSchema, FileSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableBooleanFormulaSchema, NullableCreatedByNameSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRangeDateSchema, NullableRichTextSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleDateSchema, NullableSingleFileSchema, NullableSinglePeopleIdSchema, NullableSinglePeopleSchema, NullableSingleRelationSchema, NullableSingleRollupArraySchema, NullableStatusSchema, NullableStringFormulaSchema, NullableTitleSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RangeDateSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, RollupSimpleSchema, SelectSchema, SingleDateSchema, SingleFileSchema, SinglePeopleIdSchema, SinglePeopleSchema, SingleRelationSchema, SingleRollupArraySchema, StatusSchema, StringFormulaSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, UserOrGroupIdSchema, UserOrGroupSchema, UserSchema, VerificationSchema };
|
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ import { LastEditedByIdSchema, LastEditedBySchema, NullableLastEditedByNameSchem
|
|
|
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 { PeopleIdSchema, PeopleSchema, PersonSchema } from "./people.mjs";
|
|
12
|
+
import { BotSchema, NullableSinglePeopleIdSchema, NullableSinglePeopleSchema, PeopleIdSchema, PeopleSchema, PersonSchema, SinglePeopleIdSchema, SinglePeopleSchema, UserOrGroupIdSchema, UserOrGroupSchema, UserSchema } 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 { NullableRichTextSchema, NullableTitleSchema, RichTextSchema, TitleSchem
|
|
|
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 { BooleanFormulaSchema, CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, EmailSchema, FileSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableBooleanFormulaSchema, NullableCreatedByNameSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRangeDateSchema, NullableRichTextSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleDateSchema, NullableSingleFileSchema, NullableSingleRelationSchema, NullableSingleRollupArraySchema, NullableStatusSchema, NullableStringFormulaSchema, NullableTitleSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RangeDateSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, RollupSimpleSchema, SelectSchema, SingleDateSchema, SingleFileSchema, SingleRelationSchema, SingleRollupArraySchema, StatusSchema, StringFormulaSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
|
|
23
|
+
export { BooleanFormulaSchema, BotSchema, CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, EmailSchema, FileSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableBooleanFormulaSchema, NullableCreatedByNameSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRangeDateSchema, NullableRichTextSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleDateSchema, NullableSingleFileSchema, NullableSinglePeopleIdSchema, NullableSinglePeopleSchema, NullableSingleRelationSchema, NullableSingleRollupArraySchema, NullableStatusSchema, NullableStringFormulaSchema, NullableTitleSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RangeDateSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, RollupSimpleSchema, SelectSchema, SingleDateSchema, SingleFileSchema, SinglePeopleIdSchema, SinglePeopleSchema, SingleRelationSchema, SingleRollupArraySchema, StatusSchema, StringFormulaSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, UserOrGroupIdSchema, UserOrGroupSchema, UserSchema, VerificationSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CheckboxSchema } from "./checkbox.mjs";
|
|
2
|
-
import { PeopleIdSchema, PeopleSchema, PersonSchema } from "./people.mjs";
|
|
2
|
+
import { BotSchema, NullableSinglePeopleIdSchema, NullableSinglePeopleSchema, PeopleIdSchema, PeopleSchema, PersonSchema, SinglePeopleIdSchema, SinglePeopleSchema, UserOrGroupIdSchema, UserOrGroupSchema, UserSchema } from "./people.mjs";
|
|
3
3
|
import { CreatedByIdSchema, CreatedBySchema, NullableCreatedByNameSchema } from "./created-by.mjs";
|
|
4
4
|
import { CreatedTimeSchema } from "./created-time.mjs";
|
|
5
5
|
import { DateObjectSchema, FullDateSchema, NullableFullDateSchema, NullableRangeDateSchema, NullableSingleDateSchema, RangeDateSchema, SingleDateSchema } from "./date.mjs";
|
|
@@ -20,4 +20,4 @@ import { NullableRichTextSchema, NullableTitleSchema, RichTextSchema, TitleSchem
|
|
|
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 { BooleanFormulaSchema, CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, EmailSchema, FileSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableBooleanFormulaSchema, NullableCreatedByNameSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRangeDateSchema, NullableRichTextSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleDateSchema, NullableSingleFileSchema, NullableSingleRelationSchema, NullableSingleRollupArraySchema, NullableStatusSchema, NullableStringFormulaSchema, NullableTitleSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RangeDateSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, RollupSimpleSchema, SelectSchema, SingleDateSchema, SingleFileSchema, SingleRelationSchema, SingleRollupArraySchema, StatusSchema, StringFormulaSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, VerificationSchema };
|
|
23
|
+
export { BooleanFormulaSchema, BotSchema, CheckboxSchema, CreatedByIdSchema, CreatedBySchema, CreatedTimeSchema, DateObjectSchema, EmailSchema, FileSchema, FormulaSchema, FullDateSchema, LastEditedByIdSchema, LastEditedBySchema, LastEditedTimeSchema, MultiSelectSchema, NullableBooleanFormulaSchema, NullableCreatedByNameSchema, NullableEmailSchema, NullableFullDateSchema, NullableLastEditedByNameSchema, NullableNumberSchema, NullablePhoneNumberSchema, NullablePlaceSchema, NullableRangeDateSchema, NullableRichTextSchema, NullableRollupDateSchema, NullableRollupNumberSchema, NullableSelectSchema, NullableSingleDateSchema, NullableSingleFileSchema, NullableSinglePeopleIdSchema, NullableSinglePeopleSchema, NullableSingleRelationSchema, NullableSingleRollupArraySchema, NullableStatusSchema, NullableStringFormulaSchema, NullableTitleSchema, NullableUniqueIdSchema, NullableUrlSchema, NullableVerificationSchema, NumberSchema, PeopleIdSchema, PeopleSchema, PersonSchema, PhoneNumberSchema, PlaceSchema, RangeDateSchema, RelationSchema, RichTextSchema, RollupArraySchema, RollupDateSchema, RollupNumberSchema, RollupSimpleSchema, SelectSchema, SingleDateSchema, SingleFileSchema, SinglePeopleIdSchema, SinglePeopleSchema, SingleRelationSchema, SingleRollupArraySchema, StatusSchema, StringFormulaSchema, TitleSchema, UniqueIdNumberSchema, UrlSchema, UserOrGroupIdSchema, UserOrGroupSchema, UserSchema, VerificationSchema };
|
package/dist/last-edited-by.cjs
CHANGED
|
@@ -4,47 +4,51 @@ let valibot = require("valibot");
|
|
|
4
4
|
valibot = require_runtime.__toESM(valibot, 1);
|
|
5
5
|
//#region src/last-edited-by.ts
|
|
6
6
|
/**
|
|
7
|
-
* Schema to extract the `last_edited_by` person object from a Notion page.
|
|
7
|
+
* Schema factory to extract the `last_edited_by` person object from a Notion page.
|
|
8
|
+
*
|
|
9
|
+
* This is a generic schema factory that accepts another schema as a parameter,
|
|
10
|
+
* allowing you to combine it with building-block schemas such as
|
|
11
|
+
* `UserOrGroupSchema`, `UserSchema`, or `PersonSchema`.
|
|
8
12
|
*
|
|
9
13
|
* **Input:**
|
|
10
14
|
* ```
|
|
11
15
|
* {
|
|
12
16
|
* last_edited_by: {
|
|
13
17
|
* id: string;
|
|
14
|
-
* object: "user" | "
|
|
15
|
-
* name
|
|
18
|
+
* object: "user" | "group";
|
|
19
|
+
* name?: string | null;
|
|
16
20
|
* ...
|
|
17
21
|
* }
|
|
18
22
|
* }
|
|
19
23
|
* ```
|
|
20
24
|
*
|
|
21
|
-
* **Output:**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* id: string;
|
|
25
|
-
* object: "user" | "bot" | "group";
|
|
26
|
-
* name: string | null;
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
25
|
+
* **Output:** The output type depends on the schema passed as a parameter.
|
|
26
|
+
*
|
|
27
|
+
* @param schema - A schema that validates the `last_edited_by` user or group object.
|
|
29
28
|
*
|
|
30
29
|
* @example
|
|
31
30
|
* ```ts
|
|
32
31
|
* import * as v from "valibot";
|
|
33
|
-
* import {
|
|
32
|
+
* import {
|
|
33
|
+
* LastEditedBySchema,
|
|
34
|
+
* UserOrGroupSchema,
|
|
35
|
+
* } from "@nakanoaas/notion-valibot-schema";
|
|
34
36
|
*
|
|
35
37
|
* const PageSchema = v.object({
|
|
36
38
|
* id: v.string(),
|
|
37
39
|
* properties: v.object({
|
|
38
|
-
*
|
|
40
|
+
* "Last Edited By": LastEditedBySchema(UserOrGroupSchema),
|
|
39
41
|
* }),
|
|
40
42
|
* });
|
|
41
43
|
*
|
|
42
44
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
43
45
|
* const parsed = v.parse(PageSchema, page);
|
|
44
|
-
* // parsed.properties
|
|
46
|
+
* // parsed.properties["Last Edited By"]: { id: string; object: "user" | "group"; name: string | null }
|
|
45
47
|
* ```
|
|
46
48
|
*/
|
|
47
|
-
|
|
49
|
+
function LastEditedBySchema(schema) {
|
|
50
|
+
return valibot.pipe(valibot.object({ last_edited_by: schema }), valibot.transform((v) => v.last_edited_by));
|
|
51
|
+
}
|
|
48
52
|
/**
|
|
49
53
|
* Schema to extract the `last_edited_by` person name from a Notion page.
|
|
50
54
|
*
|
|
@@ -53,8 +57,8 @@ const LastEditedBySchema = valibot.pipe(valibot.object({ last_edited_by: require
|
|
|
53
57
|
* {
|
|
54
58
|
* last_edited_by: {
|
|
55
59
|
* id: string;
|
|
56
|
-
* object: "user" | "
|
|
57
|
-
* name
|
|
60
|
+
* object: "user" | "group";
|
|
61
|
+
* name?: string | null;
|
|
58
62
|
* ...
|
|
59
63
|
* }
|
|
60
64
|
* }
|
|
@@ -70,16 +74,16 @@ const LastEditedBySchema = valibot.pipe(valibot.object({ last_edited_by: require
|
|
|
70
74
|
* const PageSchema = v.object({
|
|
71
75
|
* id: v.string(),
|
|
72
76
|
* properties: v.object({
|
|
73
|
-
*
|
|
77
|
+
* "Last Edited By": NullableLastEditedByNameSchema,
|
|
74
78
|
* }),
|
|
75
79
|
* });
|
|
76
80
|
*
|
|
77
81
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
78
82
|
* const parsed = v.parse(PageSchema, page);
|
|
79
|
-
* // parsed.properties
|
|
83
|
+
* // parsed.properties["Last Edited By"]: string | null
|
|
80
84
|
* ```
|
|
81
85
|
*/
|
|
82
|
-
const NullableLastEditedByNameSchema = valibot.pipe(valibot.object({ last_edited_by: require_people.
|
|
86
|
+
const NullableLastEditedByNameSchema = valibot.pipe(valibot.object({ last_edited_by: require_people.UserOrGroupSchema }), valibot.transform((v) => v.last_edited_by.name));
|
|
83
87
|
/**
|
|
84
88
|
* Schema to extract the `last_edited_by` person ID from a Notion page.
|
|
85
89
|
*
|
|
@@ -88,8 +92,6 @@ const NullableLastEditedByNameSchema = valibot.pipe(valibot.object({ last_edited
|
|
|
88
92
|
* {
|
|
89
93
|
* last_edited_by: {
|
|
90
94
|
* id: string;
|
|
91
|
-
* object: "user" | "bot" | "group";
|
|
92
|
-
* name: string | null;
|
|
93
95
|
* ...
|
|
94
96
|
* }
|
|
95
97
|
* }
|
|
@@ -105,16 +107,16 @@ const NullableLastEditedByNameSchema = valibot.pipe(valibot.object({ last_edited
|
|
|
105
107
|
* const PageSchema = v.object({
|
|
106
108
|
* id: v.string(),
|
|
107
109
|
* properties: v.object({
|
|
108
|
-
*
|
|
110
|
+
* "Last Edited By": LastEditedByIdSchema,
|
|
109
111
|
* }),
|
|
110
112
|
* });
|
|
111
113
|
*
|
|
112
114
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
113
115
|
* const parsed = v.parse(PageSchema, page);
|
|
114
|
-
* // parsed.properties
|
|
116
|
+
* // parsed.properties["Last Edited By"]: string
|
|
115
117
|
* ```
|
|
116
118
|
*/
|
|
117
|
-
const LastEditedByIdSchema = valibot.pipe(valibot.object({ last_edited_by: require_people.
|
|
119
|
+
const LastEditedByIdSchema = valibot.pipe(valibot.object({ last_edited_by: require_people.UserOrGroupIdSchema }), valibot.transform((v) => v.last_edited_by.id));
|
|
118
120
|
//#endregion
|
|
119
121
|
exports.LastEditedByIdSchema = LastEditedByIdSchema;
|
|
120
122
|
exports.LastEditedBySchema = LastEditedBySchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"last-edited-by.cjs","names":["v","
|
|
1
|
+
{"version":3,"file":"last-edited-by.cjs","names":["v","UserOrGroupSchema","UserOrGroupIdSchema"],"sources":["../src/last-edited-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { UserOrGroupIdSchema, UserOrGroupSchema } from \"./people\";\n\n/**\n * Schema factory to extract the `last_edited_by` person object from a Notion page.\n *\n * This is a generic schema factory that accepts another schema as a parameter,\n * allowing you to combine it with building-block schemas such as\n * `UserOrGroupSchema`, `UserSchema`, or `PersonSchema`.\n *\n * **Input:**\n * ```\n * {\n * last_edited_by: {\n * id: string;\n * object: \"user\" | \"group\";\n * name?: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** The output type depends on the schema passed as a parameter.\n *\n * @param schema - A schema that validates the `last_edited_by` user or group object.\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import {\n * LastEditedBySchema,\n * UserOrGroupSchema,\n * } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * \"Last Edited By\": LastEditedBySchema(UserOrGroupSchema),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties[\"Last Edited By\"]: { id: string; object: \"user\" | \"group\"; name: string | null }\n * ```\n */\nexport function LastEditedBySchema<\n\tS extends v.GenericSchema<{ id: string; object: \"user\" | \"group\" }, unknown>,\n>(\n\tschema: S,\n): v.GenericSchema<{ last_edited_by: v.InferInput<S> }, v.InferOutput<S>> {\n\treturn v.pipe(\n\t\tv.object({\n\t\t\tlast_edited_by: schema,\n\t\t}),\n\t\tv.transform((v) => v.last_edited_by),\n\t) as v.GenericSchema<{ last_edited_by: v.InferInput<S> }, v.InferOutput<S>>;\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\" | \"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 * \"Last Edited By\": NullableLastEditedByNameSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties[\"Last Edited By\"]: string | null\n * ```\n */\nexport const NullableLastEditedByNameSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: UserOrGroupSchema,\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 * ...\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 * \"Last Edited By\": LastEditedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties[\"Last Edited By\"]: string\n * ```\n */\nexport const LastEditedByIdSchema = v.pipe(\n\tv.object({\n\t\tlast_edited_by: UserOrGroupIdSchema,\n\t}),\n\tv.transform((v) => v.last_edited_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,mBAGf,QACyE;CACzE,OAAOA,QAAE,KACRA,QAAE,OAAO,EACR,gBAAgB,OACjB,CAAC,GACDA,QAAE,WAAW,MAAM,EAAE,cAAc,CACpC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,iCAAiCA,QAAE,KAC/CA,QAAE,OAAO,EACR,gBAAgBC,eAAAA,kBACjB,CAAC,GACDD,QAAE,WAAW,MAAM,EAAE,eAAe,IAAI,CACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,gBAAgBE,eAAAA,oBACjB,CAAC,GACDF,QAAE,WAAW,MAAM,EAAE,eAAe,EAAE,CACvC"}
|
|
@@ -2,63 +2,54 @@ import * as v from "valibot";
|
|
|
2
2
|
|
|
3
3
|
//#region src/last-edited-by.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* Schema to extract the `last_edited_by` person object from a Notion page.
|
|
5
|
+
* Schema factory to extract the `last_edited_by` person object from a Notion page.
|
|
6
|
+
*
|
|
7
|
+
* This is a generic schema factory that accepts another schema as a parameter,
|
|
8
|
+
* allowing you to combine it with building-block schemas such as
|
|
9
|
+
* `UserOrGroupSchema`, `UserSchema`, or `PersonSchema`.
|
|
6
10
|
*
|
|
7
11
|
* **Input:**
|
|
8
12
|
* ```
|
|
9
13
|
* {
|
|
10
14
|
* last_edited_by: {
|
|
11
15
|
* id: string;
|
|
12
|
-
* object: "user" | "
|
|
13
|
-
* name
|
|
16
|
+
* object: "user" | "group";
|
|
17
|
+
* name?: string | null;
|
|
14
18
|
* ...
|
|
15
19
|
* }
|
|
16
20
|
* }
|
|
17
21
|
* ```
|
|
18
22
|
*
|
|
19
|
-
* **Output:**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* id: string;
|
|
23
|
-
* object: "user" | "bot" | "group";
|
|
24
|
-
* name: string | null;
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
23
|
+
* **Output:** The output type depends on the schema passed as a parameter.
|
|
24
|
+
*
|
|
25
|
+
* @param schema - A schema that validates the `last_edited_by` user or group object.
|
|
27
26
|
*
|
|
28
27
|
* @example
|
|
29
28
|
* ```ts
|
|
30
29
|
* import * as v from "valibot";
|
|
31
|
-
* import {
|
|
30
|
+
* import {
|
|
31
|
+
* LastEditedBySchema,
|
|
32
|
+
* UserOrGroupSchema,
|
|
33
|
+
* } from "@nakanoaas/notion-valibot-schema";
|
|
32
34
|
*
|
|
33
35
|
* const PageSchema = v.object({
|
|
34
36
|
* id: v.string(),
|
|
35
37
|
* properties: v.object({
|
|
36
|
-
*
|
|
38
|
+
* "Last Edited By": LastEditedBySchema(UserOrGroupSchema),
|
|
37
39
|
* }),
|
|
38
40
|
* });
|
|
39
41
|
*
|
|
40
42
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
41
43
|
* const parsed = v.parse(PageSchema, page);
|
|
42
|
-
* // parsed.properties
|
|
44
|
+
* // parsed.properties["Last Edited By"]: { id: string; object: "user" | "group"; name: string | null }
|
|
43
45
|
* ```
|
|
44
46
|
*/
|
|
45
|
-
declare
|
|
46
|
-
readonly last_edited_by: v.ObjectSchema<{
|
|
47
|
-
readonly id: v.StringSchema<undefined>;
|
|
48
|
-
readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
|
|
49
|
-
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
50
|
-
}, undefined>;
|
|
51
|
-
}, undefined>, v.TransformAction<{
|
|
52
|
-
last_edited_by: {
|
|
53
|
-
id: string;
|
|
54
|
-
object: "user" | "bot" | "group";
|
|
55
|
-
name: string | null;
|
|
56
|
-
};
|
|
57
|
-
}, {
|
|
47
|
+
declare function LastEditedBySchema<S extends v.GenericSchema<{
|
|
58
48
|
id: string;
|
|
59
|
-
object: "user" | "
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
object: "user" | "group";
|
|
50
|
+
}, unknown>>(schema: S): v.GenericSchema<{
|
|
51
|
+
last_edited_by: v.InferInput<S>;
|
|
52
|
+
}, v.InferOutput<S>>;
|
|
62
53
|
/**
|
|
63
54
|
* Schema to extract the `last_edited_by` person name from a Notion page.
|
|
64
55
|
*
|
|
@@ -67,8 +58,8 @@ declare const LastEditedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
67
58
|
* {
|
|
68
59
|
* last_edited_by: {
|
|
69
60
|
* id: string;
|
|
70
|
-
* object: "user" | "
|
|
71
|
-
* name
|
|
61
|
+
* object: "user" | "group";
|
|
62
|
+
* name?: string | null;
|
|
72
63
|
* ...
|
|
73
64
|
* }
|
|
74
65
|
* }
|
|
@@ -84,25 +75,25 @@ declare const LastEditedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
84
75
|
* const PageSchema = v.object({
|
|
85
76
|
* id: v.string(),
|
|
86
77
|
* properties: v.object({
|
|
87
|
-
*
|
|
78
|
+
* "Last Edited By": NullableLastEditedByNameSchema,
|
|
88
79
|
* }),
|
|
89
80
|
* });
|
|
90
81
|
*
|
|
91
82
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
92
83
|
* const parsed = v.parse(PageSchema, page);
|
|
93
|
-
* // parsed.properties
|
|
84
|
+
* // parsed.properties["Last Edited By"]: string | null
|
|
94
85
|
* ```
|
|
95
86
|
*/
|
|
96
87
|
declare const NullableLastEditedByNameSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
97
88
|
readonly last_edited_by: v.ObjectSchema<{
|
|
98
89
|
readonly id: v.StringSchema<undefined>;
|
|
99
|
-
readonly object: v.PicklistSchema<["user", "
|
|
90
|
+
readonly object: v.PicklistSchema<["user", "group"], undefined>;
|
|
100
91
|
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
101
92
|
}, undefined>;
|
|
102
93
|
}, undefined>, v.TransformAction<{
|
|
103
94
|
last_edited_by: {
|
|
104
95
|
id: string;
|
|
105
|
-
object: "user" | "
|
|
96
|
+
object: "user" | "group";
|
|
106
97
|
name: string | null;
|
|
107
98
|
};
|
|
108
99
|
}, string | null>]>;
|
|
@@ -114,8 +105,6 @@ declare const NullableLastEditedByNameSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
114
105
|
* {
|
|
115
106
|
* last_edited_by: {
|
|
116
107
|
* id: string;
|
|
117
|
-
* object: "user" | "bot" | "group";
|
|
118
|
-
* name: string | null;
|
|
119
108
|
* ...
|
|
120
109
|
* }
|
|
121
110
|
* }
|
|
@@ -131,26 +120,22 @@ declare const NullableLastEditedByNameSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
131
120
|
* const PageSchema = v.object({
|
|
132
121
|
* id: v.string(),
|
|
133
122
|
* properties: v.object({
|
|
134
|
-
*
|
|
123
|
+
* "Last Edited By": LastEditedByIdSchema,
|
|
135
124
|
* }),
|
|
136
125
|
* });
|
|
137
126
|
*
|
|
138
127
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
139
128
|
* const parsed = v.parse(PageSchema, page);
|
|
140
|
-
* // parsed.properties
|
|
129
|
+
* // parsed.properties["Last Edited By"]: string
|
|
141
130
|
* ```
|
|
142
131
|
*/
|
|
143
132
|
declare const LastEditedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
144
133
|
readonly last_edited_by: v.ObjectSchema<{
|
|
145
134
|
readonly id: v.StringSchema<undefined>;
|
|
146
|
-
readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
|
|
147
|
-
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
148
135
|
}, undefined>;
|
|
149
136
|
}, undefined>, v.TransformAction<{
|
|
150
137
|
last_edited_by: {
|
|
151
138
|
id: string;
|
|
152
|
-
object: "user" | "bot" | "group";
|
|
153
|
-
name: string | null;
|
|
154
139
|
};
|
|
155
140
|
}, string>]>;
|
|
156
141
|
//#endregion
|