@nakanoaas/notion-valibot-schema 0.3.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 +95 -14
- 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/{file.cjs → files.cjs} +6 -6
- package/dist/files.cjs.map +1 -0
- package/dist/{file.d.cts → files.d.cts} +6 -6
- package/dist/{file.d.mts → files.d.mts} +6 -6
- package/dist/{file.mjs → files.mjs} +6 -6
- package/dist/files.mjs.map +1 -0
- package/dist/formula.cjs +120 -19
- package/dist/formula.cjs.map +1 -1
- package/dist/formula.d.cts +150 -41
- package/dist/formula.d.mts +150 -41
- package/dist/formula.mjs +117 -20
- package/dist/formula.mjs.map +1 -1
- package/dist/index.cjs +17 -4
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- 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/rollup.cjs +66 -0
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.d.cts +70 -1
- package/dist/rollup.d.mts +70 -1
- package/dist/rollup.mjs +66 -1
- package/dist/rollup.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 +3 -3
- package/dist/file.cjs.map +0 -1
- package/dist/file.mjs.map +0 -1
package/dist/people.d.cts
CHANGED
|
@@ -2,14 +2,15 @@ import * as v from "valibot";
|
|
|
2
2
|
|
|
3
3
|
//#region src/people.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Minimal schema for a Notion user or group ID.
|
|
6
|
+
*
|
|
7
|
+
* Use this when only the `id` field is needed, such as in ID-extraction
|
|
8
|
+
* convenience schemas (`PeopleIdSchema`, `CreatedByIdSchema`, etc.).
|
|
6
9
|
*
|
|
7
10
|
* **Input:**
|
|
8
11
|
* ```
|
|
9
12
|
* {
|
|
10
13
|
* id: string;
|
|
11
|
-
* object: "user" | "bot" | "group";
|
|
12
|
-
* name: string | null;
|
|
13
14
|
* ...
|
|
14
15
|
* }
|
|
15
16
|
* ```
|
|
@@ -18,7 +19,34 @@ import * as v from "valibot";
|
|
|
18
19
|
* ```
|
|
19
20
|
* {
|
|
20
21
|
* id: string;
|
|
21
|
-
*
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const UserOrGroupIdSchema: v.ObjectSchema<{
|
|
26
|
+
readonly id: v.StringSchema<undefined>;
|
|
27
|
+
}, undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Schema for a Notion user or group object.
|
|
30
|
+
*
|
|
31
|
+
* Validates `id`, `object` (`"user"` | `"group"`), and `name`.
|
|
32
|
+
* Bots in the Notion API use `object: "user"` with `type: "bot"`, so they
|
|
33
|
+
* are accepted by this schema as well.
|
|
34
|
+
*
|
|
35
|
+
* **Input:**
|
|
36
|
+
* ```
|
|
37
|
+
* {
|
|
38
|
+
* id: string;
|
|
39
|
+
* object: "user" | "group";
|
|
40
|
+
* name?: string | null;
|
|
41
|
+
* ...
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* **Output:**
|
|
46
|
+
* ```
|
|
47
|
+
* {
|
|
48
|
+
* id: string;
|
|
49
|
+
* object: "user" | "group";
|
|
22
50
|
* name: string | null;
|
|
23
51
|
* }
|
|
24
52
|
* ```
|
|
@@ -26,87 +54,154 @@ import * as v from "valibot";
|
|
|
26
54
|
* @example
|
|
27
55
|
* ```ts
|
|
28
56
|
* import * as v from "valibot";
|
|
29
|
-
* import {
|
|
57
|
+
* import { PeopleSchema, UserOrGroupSchema } from "@nakanoaas/notion-valibot-schema";
|
|
30
58
|
*
|
|
31
59
|
* const PageSchema = v.object({
|
|
32
60
|
* id: v.string(),
|
|
33
|
-
*
|
|
61
|
+
* properties: v.object({
|
|
62
|
+
* Assignees: PeopleSchema(UserOrGroupSchema),
|
|
63
|
+
* }),
|
|
34
64
|
* });
|
|
35
65
|
*
|
|
36
66
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
37
67
|
* const parsed = v.parse(PageSchema, page);
|
|
38
|
-
* // parsed.
|
|
68
|
+
* // parsed.properties.Assignees: Array<{ id: string; object: "user" | "group"; name: string | null }>
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare const UserOrGroupSchema: v.ObjectSchema<{
|
|
72
|
+
readonly id: v.StringSchema<undefined>;
|
|
73
|
+
readonly object: v.PicklistSchema<["user", "group"], undefined>;
|
|
74
|
+
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
75
|
+
}, undefined>;
|
|
76
|
+
/**
|
|
77
|
+
* Schema for a Notion user object.
|
|
78
|
+
*
|
|
79
|
+
* **Input:**
|
|
80
|
+
* ```
|
|
81
|
+
* {
|
|
82
|
+
* id: string;
|
|
83
|
+
* object: "user";
|
|
84
|
+
* name?: string | null;
|
|
85
|
+
* avatar_url?: string | null;
|
|
86
|
+
* ...
|
|
87
|
+
* }
|
|
39
88
|
* ```
|
|
40
89
|
*
|
|
41
|
-
*
|
|
90
|
+
* **Output:**
|
|
91
|
+
* ```
|
|
92
|
+
* {
|
|
93
|
+
* id: string;
|
|
94
|
+
* object: "user";
|
|
95
|
+
* name: string | null;
|
|
96
|
+
* avatar_url: string | null;
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
42
99
|
*/
|
|
43
|
-
declare const
|
|
100
|
+
declare const UserSchema: v.ObjectSchema<{
|
|
44
101
|
readonly id: v.StringSchema<undefined>;
|
|
45
|
-
readonly object: v.
|
|
102
|
+
readonly object: v.LiteralSchema<"user", undefined>;
|
|
46
103
|
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
104
|
+
readonly avatar_url: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
47
105
|
}, undefined>;
|
|
48
106
|
/**
|
|
49
|
-
* Schema
|
|
107
|
+
* Schema for a Notion person user object.
|
|
108
|
+
*
|
|
109
|
+
* Validates a user with `type: "person"` and the nested `person.email` field.
|
|
110
|
+
* Use with `PeopleSchema`, `SinglePeopleSchema`, or `CreatedBySchema` when
|
|
111
|
+
* full person details are needed.
|
|
50
112
|
*
|
|
51
113
|
* **Input:**
|
|
52
114
|
* ```
|
|
53
115
|
* {
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
116
|
+
* id: string;
|
|
117
|
+
* object: "user";
|
|
118
|
+
* name?: string | null;
|
|
119
|
+
* avatar_url?: string | null;
|
|
120
|
+
* type: "person";
|
|
121
|
+
* person: {
|
|
122
|
+
* email?: string;
|
|
123
|
+
* };
|
|
124
|
+
* ...
|
|
62
125
|
* }
|
|
63
126
|
* ```
|
|
64
127
|
*
|
|
65
128
|
* **Output:**
|
|
66
129
|
* ```
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
130
|
+
* {
|
|
131
|
+
* id: string;
|
|
132
|
+
* object: "user";
|
|
133
|
+
* name: string | null;
|
|
134
|
+
* avatar_url: string | null;
|
|
135
|
+
* type: "person";
|
|
136
|
+
* person: {
|
|
137
|
+
* email?: string;
|
|
138
|
+
* };
|
|
139
|
+
* }
|
|
74
140
|
* ```
|
|
75
141
|
*
|
|
76
142
|
* @example
|
|
77
143
|
* ```ts
|
|
78
144
|
* import * as v from "valibot";
|
|
79
|
-
* import { PeopleSchema } from "@nakanoaas/notion-valibot-schema";
|
|
145
|
+
* import { PeopleSchema, PersonSchema } from "@nakanoaas/notion-valibot-schema";
|
|
80
146
|
*
|
|
81
147
|
* const PageSchema = v.object({
|
|
82
148
|
* id: v.string(),
|
|
83
149
|
* properties: v.object({
|
|
84
|
-
* People: PeopleSchema,
|
|
150
|
+
* People: PeopleSchema(PersonSchema),
|
|
85
151
|
* }),
|
|
86
152
|
* });
|
|
87
153
|
*
|
|
88
154
|
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
89
155
|
* const parsed = v.parse(PageSchema, page);
|
|
90
|
-
* // parsed.properties.People: Array<{ id: string; object: "user"
|
|
156
|
+
* // parsed.properties.People: Array<{ id: string; object: "user"; name: string | null; ... }>
|
|
91
157
|
* ```
|
|
92
158
|
*/
|
|
93
|
-
declare const
|
|
94
|
-
readonly
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
159
|
+
declare const PersonSchema: v.ObjectSchema<{
|
|
160
|
+
readonly id: v.StringSchema<undefined>;
|
|
161
|
+
readonly object: v.LiteralSchema<"user", undefined>;
|
|
162
|
+
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
163
|
+
readonly avatar_url: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
164
|
+
readonly type: v.LiteralSchema<"person", undefined>;
|
|
165
|
+
readonly person: v.ObjectSchema<{
|
|
166
|
+
readonly email: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
167
|
+
}, undefined>;
|
|
168
|
+
}, undefined>;
|
|
169
|
+
/**
|
|
170
|
+
* Schema for a Notion bot user object.
|
|
171
|
+
*
|
|
172
|
+
* **Input:**
|
|
173
|
+
* ```
|
|
174
|
+
* {
|
|
175
|
+
* id: string;
|
|
176
|
+
* object: "bot";
|
|
177
|
+
* name?: string | null;
|
|
178
|
+
* avatar_url?: string | null;
|
|
179
|
+
* type: "bot";
|
|
180
|
+
* bot: unknown;
|
|
181
|
+
* ...
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* **Output:**
|
|
186
|
+
* ```
|
|
187
|
+
* {
|
|
188
|
+
* id: string;
|
|
189
|
+
* object: "bot";
|
|
190
|
+
* name: string | null;
|
|
191
|
+
* avatar_url: string | null;
|
|
192
|
+
* type: "bot";
|
|
193
|
+
* bot: unknown;
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
declare const BotSchema: v.ObjectSchema<{
|
|
198
|
+
readonly id: v.StringSchema<undefined>;
|
|
199
|
+
readonly object: v.LiteralSchema<"bot", undefined>;
|
|
200
|
+
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
201
|
+
readonly avatar_url: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
202
|
+
readonly type: v.LiteralSchema<"bot", undefined>;
|
|
203
|
+
readonly bot: v.AnySchema;
|
|
204
|
+
}, undefined>;
|
|
110
205
|
/**
|
|
111
206
|
* Schema to extract the `people` array of IDs from a Notion property.
|
|
112
207
|
*
|
|
@@ -116,8 +211,6 @@ declare const PeopleSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
116
211
|
* people: [
|
|
117
212
|
* {
|
|
118
213
|
* id: string;
|
|
119
|
-
* object: "user" | "bot" | "group";
|
|
120
|
-
* name: string | null;
|
|
121
214
|
* ...
|
|
122
215
|
* }
|
|
123
216
|
* ]
|
|
@@ -149,16 +242,201 @@ declare const PeopleSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
149
242
|
declare const PeopleIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
150
243
|
readonly people: v.ArraySchema<v.ObjectSchema<{
|
|
151
244
|
readonly id: v.StringSchema<undefined>;
|
|
152
|
-
readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
|
|
153
|
-
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
154
245
|
}, undefined>, undefined>;
|
|
155
246
|
}, undefined>, v.TransformAction<{
|
|
156
247
|
people: {
|
|
157
248
|
id: string;
|
|
158
|
-
object: "user" | "bot" | "group";
|
|
159
|
-
name: string | null;
|
|
160
249
|
}[];
|
|
161
250
|
}, string[]>]>;
|
|
251
|
+
/**
|
|
252
|
+
* Schema to extract a single person ID from a Notion `people` property.
|
|
253
|
+
*
|
|
254
|
+
* Expects exactly one entry in the `people` array.
|
|
255
|
+
*
|
|
256
|
+
* **Input:**
|
|
257
|
+
* ```
|
|
258
|
+
* {
|
|
259
|
+
* people: [{ id: string; ... }]
|
|
260
|
+
* }
|
|
261
|
+
* ```
|
|
262
|
+
*
|
|
263
|
+
* **Output:** `string`
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* import * as v from "valibot";
|
|
268
|
+
* import { SinglePeopleIdSchema } from "@nakanoaas/notion-valibot-schema";
|
|
269
|
+
*
|
|
270
|
+
* const PageSchema = v.object({
|
|
271
|
+
* id: v.string(),
|
|
272
|
+
* properties: v.object({
|
|
273
|
+
* Owner: SinglePeopleIdSchema,
|
|
274
|
+
* }),
|
|
275
|
+
* });
|
|
276
|
+
*
|
|
277
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
278
|
+
* const parsed = v.parse(PageSchema, page);
|
|
279
|
+
* // parsed.properties.Owner: string
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
declare const SinglePeopleIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
283
|
+
readonly people: v.TupleSchema<[v.ObjectSchema<{
|
|
284
|
+
readonly id: v.StringSchema<undefined>;
|
|
285
|
+
}, undefined>], undefined>;
|
|
286
|
+
}, undefined>, v.TransformAction<{
|
|
287
|
+
people: [{
|
|
288
|
+
id: string;
|
|
289
|
+
}];
|
|
290
|
+
}, string>]>;
|
|
291
|
+
/**
|
|
292
|
+
* Schema to extract a single person ID or `null` from a Notion `people` property.
|
|
293
|
+
*
|
|
294
|
+
* Returns the first entry's ID, or `null` when the array is empty.
|
|
295
|
+
*
|
|
296
|
+
* **Input:**
|
|
297
|
+
* ```
|
|
298
|
+
* {
|
|
299
|
+
* people: Array<{ id: string; ... }>
|
|
300
|
+
* }
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
303
|
+
* **Output:** `string | null`
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```ts
|
|
307
|
+
* import * as v from "valibot";
|
|
308
|
+
* import { NullableSinglePeopleIdSchema } from "@nakanoaas/notion-valibot-schema";
|
|
309
|
+
*
|
|
310
|
+
* const PageSchema = v.object({
|
|
311
|
+
* id: v.string(),
|
|
312
|
+
* properties: v.object({
|
|
313
|
+
* Owner: NullableSinglePeopleIdSchema,
|
|
314
|
+
* }),
|
|
315
|
+
* });
|
|
316
|
+
*
|
|
317
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
318
|
+
* const parsed = v.parse(PageSchema, page);
|
|
319
|
+
* // parsed.properties.Owner: string | null
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
declare const NullableSinglePeopleIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
323
|
+
readonly people: v.ArraySchema<v.ObjectSchema<{
|
|
324
|
+
readonly id: v.StringSchema<undefined>;
|
|
325
|
+
}, undefined>, undefined>;
|
|
326
|
+
}, undefined>, v.TransformAction<{
|
|
327
|
+
people: {
|
|
328
|
+
id: string;
|
|
329
|
+
}[];
|
|
330
|
+
}, string | null>]>;
|
|
331
|
+
/**
|
|
332
|
+
* Schema factory to extract the `people` array from a Notion property.
|
|
333
|
+
*
|
|
334
|
+
* **Input:**
|
|
335
|
+
* ```
|
|
336
|
+
* {
|
|
337
|
+
* people: Array<InferredInput<schema>>
|
|
338
|
+
* }
|
|
339
|
+
* ```
|
|
340
|
+
*
|
|
341
|
+
* **Output:** `InferredOutput<schema>[]`
|
|
342
|
+
*
|
|
343
|
+
* @param schema - A schema that validates each person object in the `people` array.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* import * as v from "valibot";
|
|
348
|
+
* import { PeopleSchema, PersonSchema } from "@nakanoaas/notion-valibot-schema";
|
|
349
|
+
*
|
|
350
|
+
* const PageSchema = v.object({
|
|
351
|
+
* id: v.string(),
|
|
352
|
+
* properties: v.object({
|
|
353
|
+
* People: PeopleSchema(PersonSchema),
|
|
354
|
+
* }),
|
|
355
|
+
* });
|
|
356
|
+
*
|
|
357
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
358
|
+
* const parsed = v.parse(PageSchema, page);
|
|
359
|
+
* // parsed.properties.People: InferredOutput<typeof PersonSchema>[]
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
declare function PeopleSchema<S extends v.GenericSchema<object, unknown>>(schema: S): v.GenericSchema<{
|
|
363
|
+
people: v.InferInput<S>[];
|
|
364
|
+
}, v.InferOutput<S>[]>;
|
|
365
|
+
/**
|
|
366
|
+
* Schema factory to extract a single person from a Notion `people` property.
|
|
367
|
+
*
|
|
368
|
+
* Expects exactly one entry in the `people` array.
|
|
369
|
+
*
|
|
370
|
+
* **Input:**
|
|
371
|
+
* ```
|
|
372
|
+
* {
|
|
373
|
+
* people: [InferredInput<schema>]
|
|
374
|
+
* }
|
|
375
|
+
* ```
|
|
376
|
+
*
|
|
377
|
+
* **Output:** `InferredOutput<schema>`
|
|
378
|
+
*
|
|
379
|
+
* @param schema - A schema that validates the person object in the `people` array.
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```ts
|
|
383
|
+
* import * as v from "valibot";
|
|
384
|
+
* import { PersonSchema, SinglePeopleSchema } from "@nakanoaas/notion-valibot-schema";
|
|
385
|
+
*
|
|
386
|
+
* const PageSchema = v.object({
|
|
387
|
+
* id: v.string(),
|
|
388
|
+
* properties: v.object({
|
|
389
|
+
* Owner: SinglePeopleSchema(PersonSchema),
|
|
390
|
+
* }),
|
|
391
|
+
* });
|
|
392
|
+
*
|
|
393
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
394
|
+
* const parsed = v.parse(PageSchema, page);
|
|
395
|
+
* // parsed.properties.Owner: InferredOutput<typeof PersonSchema>
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
declare function SinglePeopleSchema<S extends v.GenericSchema<object, unknown>>(schema: S): v.GenericSchema<{
|
|
399
|
+
people: [v.InferInput<S>];
|
|
400
|
+
}, v.InferOutput<S>>;
|
|
401
|
+
/**
|
|
402
|
+
* Schema factory to extract a single person or `null` from a Notion `people` property.
|
|
403
|
+
*
|
|
404
|
+
* Returns the first entry, or `null` when the array is empty.
|
|
405
|
+
*
|
|
406
|
+
* **Input:**
|
|
407
|
+
* ```
|
|
408
|
+
* {
|
|
409
|
+
* people: Array<InferredInput<schema>>
|
|
410
|
+
* }
|
|
411
|
+
* ```
|
|
412
|
+
*
|
|
413
|
+
* **Output:** `InferredOutput<schema> | null`
|
|
414
|
+
*
|
|
415
|
+
* @param schema - A schema that validates each person object in the `people` array.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```ts
|
|
419
|
+
* import * as v from "valibot";
|
|
420
|
+
* import {
|
|
421
|
+
* NullableSinglePeopleSchema,
|
|
422
|
+
* UserOrGroupSchema,
|
|
423
|
+
* } from "@nakanoaas/notion-valibot-schema";
|
|
424
|
+
*
|
|
425
|
+
* const PageSchema = v.object({
|
|
426
|
+
* id: v.string(),
|
|
427
|
+
* properties: v.object({
|
|
428
|
+
* Owner: NullableSinglePeopleSchema(UserOrGroupSchema),
|
|
429
|
+
* }),
|
|
430
|
+
* });
|
|
431
|
+
*
|
|
432
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
433
|
+
* const parsed = v.parse(PageSchema, page);
|
|
434
|
+
* // parsed.properties.Owner: { id: string; object: "user" | "group"; name: string | null } | null
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
declare function NullableSinglePeopleSchema<S extends v.GenericSchema<object, unknown>>(schema: S): v.GenericSchema<{
|
|
438
|
+
people: v.InferInput<S>[];
|
|
439
|
+
}, v.InferOutput<S> | null>;
|
|
162
440
|
//#endregion
|
|
163
|
-
export { PeopleIdSchema, PeopleSchema, PersonSchema };
|
|
441
|
+
export { BotSchema, NullableSinglePeopleIdSchema, NullableSinglePeopleSchema, PeopleIdSchema, PeopleSchema, PersonSchema, SinglePeopleIdSchema, SinglePeopleSchema, UserOrGroupIdSchema, UserOrGroupSchema, UserSchema };
|
|
164
442
|
//# sourceMappingURL=people.d.cts.map
|