@nakanoaas/notion-valibot-schema 0.0.4 → 0.0.5
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/dist/checkbox.cjs +29 -0
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.d.cts +30 -0
- package/dist/checkbox.d.mts +30 -0
- package/dist/checkbox.mjs +29 -0
- package/dist/checkbox.mjs.map +1 -1
- package/dist/created-by.cjs +75 -0
- package/dist/created-by.cjs.map +1 -1
- package/dist/created-by.d.cts +76 -0
- package/dist/created-by.d.mts +76 -0
- package/dist/created-by.mjs +75 -0
- package/dist/created-by.mjs.map +1 -1
- package/dist/created-time.cjs +27 -0
- package/dist/created-time.cjs.map +1 -1
- package/dist/created-time.d.cts +28 -0
- package/dist/created-time.d.mts +28 -0
- package/dist/created-time.mjs +27 -0
- package/dist/created-time.mjs.map +1 -1
- package/dist/date.cjs +188 -0
- package/dist/date.cjs.map +1 -1
- package/dist/date.d.cts +189 -0
- package/dist/date.d.mts +189 -0
- package/dist/date.mjs +188 -0
- package/dist/date.mjs.map +1 -1
- package/dist/email.cjs +58 -0
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +59 -0
- package/dist/email.d.mts +59 -0
- package/dist/email.mjs +58 -0
- package/dist/email.mjs.map +1 -1
- package/dist/files.cjs +39 -0
- package/dist/files.cjs.map +1 -1
- package/dist/files.d.cts +40 -0
- package/dist/files.d.mts +40 -0
- package/dist/files.mjs +39 -0
- package/dist/files.mjs.map +1 -1
- package/dist/formula.cjs +72 -0
- package/dist/formula.cjs.map +1 -1
- package/dist/formula.d.cts +73 -0
- package/dist/formula.d.mts +73 -0
- package/dist/formula.mjs +72 -0
- package/dist/formula.mjs.map +1 -1
- package/dist/last-edited-by.cjs +68 -0
- package/dist/last-edited-by.cjs.map +1 -1
- package/dist/last-edited-by.d.cts +69 -0
- package/dist/last-edited-by.d.mts +69 -0
- package/dist/last-edited-by.mjs +68 -0
- package/dist/last-edited-by.mjs.map +1 -1
- package/dist/last-edited-time.cjs +27 -0
- package/dist/last-edited-time.cjs.map +1 -1
- package/dist/last-edited-time.d.cts +28 -0
- package/dist/last-edited-time.d.mts +28 -0
- package/dist/last-edited-time.mjs +27 -0
- package/dist/last-edited-time.mjs.map +1 -1
- package/dist/multi-select.cjs +60 -0
- package/dist/multi-select.cjs.map +1 -1
- package/dist/multi-select.d.cts +61 -0
- package/dist/multi-select.d.mts +61 -0
- package/dist/multi-select.mjs +60 -0
- package/dist/multi-select.mjs.map +1 -1
- package/dist/number.cjs +58 -0
- package/dist/number.cjs.map +1 -1
- package/dist/number.d.cts +59 -0
- package/dist/number.d.mts +59 -0
- package/dist/number.mjs +58 -0
- package/dist/number.mjs.map +1 -1
- package/dist/people.cjs +84 -0
- package/dist/people.cjs.map +1 -1
- package/dist/people.d.cts +85 -0
- package/dist/people.d.mts +85 -0
- package/dist/people.mjs +84 -0
- package/dist/people.mjs.map +1 -1
- package/dist/phone-number.cjs +58 -0
- package/dist/phone-number.cjs.map +1 -1
- package/dist/phone-number.d.cts +59 -0
- package/dist/phone-number.d.mts +59 -0
- package/dist/phone-number.mjs +58 -0
- package/dist/phone-number.mjs.map +1 -1
- package/dist/place.cjs +128 -0
- package/dist/place.cjs.map +1 -1
- package/dist/place.d.cts +85 -0
- package/dist/place.d.mts +85 -0
- package/dist/place.mjs +128 -0
- package/dist/place.mjs.map +1 -1
- package/dist/relation.cjs +131 -0
- package/dist/relation.cjs.map +1 -1
- package/dist/relation.d.cts +94 -0
- package/dist/relation.d.mts +94 -0
- package/dist/relation.mjs +131 -0
- package/dist/relation.mjs.map +1 -1
- package/dist/rollup.cjs +200 -0
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.d.cts +201 -0
- package/dist/rollup.d.mts +201 -0
- package/dist/rollup.mjs +200 -0
- package/dist/rollup.mjs.map +1 -1
- package/dist/select.cjs +120 -0
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +121 -0
- package/dist/select.d.mts +121 -0
- package/dist/select.mjs +120 -0
- package/dist/select.mjs.map +1 -1
- package/dist/status.cjs +120 -0
- package/dist/status.cjs.map +1 -1
- package/dist/status.d.cts +121 -0
- package/dist/status.d.mts +121 -0
- package/dist/status.mjs +120 -0
- package/dist/status.mjs.map +1 -1
- package/dist/text.cjs +100 -0
- package/dist/text.cjs.map +1 -1
- package/dist/text.d.cts +63 -0
- package/dist/text.d.mts +63 -0
- package/dist/text.mjs +100 -0
- package/dist/text.mjs.map +1 -1
- package/dist/unique-id.cjs +69 -0
- package/dist/unique-id.cjs.map +1 -1
- package/dist/unique-id.d.cts +70 -0
- package/dist/unique-id.d.mts +70 -0
- package/dist/unique-id.mjs +69 -0
- package/dist/unique-id.mjs.map +1 -1
- package/dist/url.cjs +58 -0
- package/dist/url.cjs.map +1 -1
- package/dist/url.d.cts +59 -0
- package/dist/url.d.mts +59 -0
- package/dist/url.mjs +58 -0
- package/dist/url.mjs.map +1 -1
- package/dist/verification.cjs +80 -0
- package/dist/verification.cjs.map +1 -1
- package/dist/verification.d.cts +81 -0
- package/dist/verification.d.mts +81 -0
- package/dist/verification.mjs +80 -0
- package/dist/verification.mjs.map +1 -1
- package/package.json +1 -1
package/dist/number.d.mts
CHANGED
|
@@ -1,11 +1,70 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/number.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `number` property from a Notion page property.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* number: number;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Output:** `number`
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import * as v from "valibot";
|
|
20
|
+
* import { NumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
21
|
+
*
|
|
22
|
+
* const PageSchema = v.object({
|
|
23
|
+
* id: v.string(),
|
|
24
|
+
* properties: v.object({
|
|
25
|
+
* Number: NumberSchema,
|
|
26
|
+
* }),
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
30
|
+
* const parsed = v.parse(PageSchema, page);
|
|
31
|
+
* // parsed.properties.Number: number
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
4
34
|
declare const NumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
35
|
readonly number: v.NumberSchema<undefined>;
|
|
6
36
|
}, undefined>, v.TransformAction<{
|
|
7
37
|
number: number;
|
|
8
38
|
}, number>]>;
|
|
39
|
+
/**
|
|
40
|
+
* Schema to extract the `number` property from a Notion page property or `null`.
|
|
41
|
+
*
|
|
42
|
+
* **Input:**
|
|
43
|
+
* ```
|
|
44
|
+
* {
|
|
45
|
+
* number: number | null;
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* **Output:** `number | null`
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import * as v from "valibot";
|
|
54
|
+
* import { NullableNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
55
|
+
*
|
|
56
|
+
* const PageSchema = v.object({
|
|
57
|
+
* id: v.string(),
|
|
58
|
+
* properties: v.object({
|
|
59
|
+
* Number: NullableNumberSchema,
|
|
60
|
+
* }),
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
64
|
+
* const parsed = v.parse(PageSchema, page);
|
|
65
|
+
* // parsed.properties.Number: number | null
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
9
68
|
declare const NullableNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
10
69
|
readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
11
70
|
}, undefined>, v.TransformAction<{
|
package/dist/number.mjs
CHANGED
|
@@ -1,7 +1,65 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/number.ts
|
|
4
|
+
/**
|
|
5
|
+
* Schema to extract the `number` property from a Notion page property.
|
|
6
|
+
*
|
|
7
|
+
* **Input:**
|
|
8
|
+
* ```
|
|
9
|
+
* {
|
|
10
|
+
* number: number;
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* **Output:** `number`
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import * as v from "valibot";
|
|
19
|
+
* import { NumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
20
|
+
*
|
|
21
|
+
* const PageSchema = v.object({
|
|
22
|
+
* id: v.string(),
|
|
23
|
+
* properties: v.object({
|
|
24
|
+
* Number: NumberSchema,
|
|
25
|
+
* }),
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
29
|
+
* const parsed = v.parse(PageSchema, page);
|
|
30
|
+
* // parsed.properties.Number: number
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
4
33
|
const NumberSchema = v.pipe(v.object({ number: v.number() }), v.transform((v$1) => v$1.number));
|
|
34
|
+
/**
|
|
35
|
+
* Schema to extract the `number` property from a Notion page property or `null`.
|
|
36
|
+
*
|
|
37
|
+
* **Input:**
|
|
38
|
+
* ```
|
|
39
|
+
* {
|
|
40
|
+
* number: number | null;
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* **Output:** `number | null`
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* import * as v from "valibot";
|
|
49
|
+
* import { NullableNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
50
|
+
*
|
|
51
|
+
* const PageSchema = v.object({
|
|
52
|
+
* id: v.string(),
|
|
53
|
+
* properties: v.object({
|
|
54
|
+
* Number: NullableNumberSchema,
|
|
55
|
+
* }),
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
59
|
+
* const parsed = v.parse(PageSchema, page);
|
|
60
|
+
* // parsed.properties.Number: number | null
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
5
63
|
const NullableNumberSchema = v.pipe(v.object({ number: v.nullable(v.number()) }), v.transform((v$1) => v$1.number));
|
|
6
64
|
|
|
7
65
|
//#endregion
|
package/dist/number.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.mjs","names":["v"],"sources":["../src/number.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const NumberSchema = v.pipe(\n\tv.object({\n\t\tnumber: v.number(),\n\t}),\n\tv.transform((v) => v.number),\n);\n\nexport const NullableNumberSchema = v.pipe(\n\tv.object({\n\t\tnumber: v.nullable(v.number()),\n\t}),\n\tv.transform((v) => v.number),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"number.mjs","names":["v"],"sources":["../src/number.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `number` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * number: number;\n * }\n * ```\n *\n * **Output:** `number`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Number: NumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Number: number\n * ```\n */\nexport const NumberSchema = v.pipe(\n\tv.object({\n\t\tnumber: v.number(),\n\t}),\n\tv.transform((v) => v.number),\n);\n\n/**\n * Schema to extract the `number` property from a Notion page property or `null`.\n *\n * **Input:**\n * ```\n * {\n * number: number | null;\n * }\n * ```\n *\n * **Output:** `number | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Number: NullableNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Number: number | null\n * ```\n */\nexport const NullableNumberSchema = v.pipe(\n\tv.object({\n\t\tnumber: v.nullable(v.number()),\n\t}),\n\tv.transform((v) => v.number),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,eAAe,EAAE,KAC7B,EAAE,OAAO,EACR,QAAQ,EAAE,QAAQ,EAClB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,OAAO,CAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAC9B,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,OAAO,CAC5B"}
|
package/dist/people.cjs
CHANGED
|
@@ -3,6 +3,45 @@ let valibot = require("valibot");
|
|
|
3
3
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
4
4
|
|
|
5
5
|
//#region src/people.ts
|
|
6
|
+
/**
|
|
7
|
+
* Schema for a Notion person object (user, bot, or group).
|
|
8
|
+
*
|
|
9
|
+
* **Input:**
|
|
10
|
+
* ```
|
|
11
|
+
* {
|
|
12
|
+
* id: string;
|
|
13
|
+
* object: "user" | "bot" | "group";
|
|
14
|
+
* name: string | null;
|
|
15
|
+
* ...
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* **Output:**
|
|
20
|
+
* ```
|
|
21
|
+
* {
|
|
22
|
+
* id: string;
|
|
23
|
+
* object: "user" | "bot" | "group";
|
|
24
|
+
* name: string | null;
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import * as v from "valibot";
|
|
31
|
+
* import { PersonSchema } from "@nakanoaas/notion-valibot-schema";
|
|
32
|
+
*
|
|
33
|
+
* const PageSchema = v.object({
|
|
34
|
+
* id: v.string(),
|
|
35
|
+
* created_by: PersonSchema,
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
39
|
+
* const parsed = v.parse(PageSchema, page);
|
|
40
|
+
* // parsed.created_by: { id: string; object: "user" | "bot" | "group"; name: string | null }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
6
45
|
const PersonSchema = valibot.object({
|
|
7
46
|
id: valibot.string(),
|
|
8
47
|
object: valibot.picklist([
|
|
@@ -12,6 +51,51 @@ const PersonSchema = valibot.object({
|
|
|
12
51
|
]),
|
|
13
52
|
name: valibot.nullish(valibot.string(), null)
|
|
14
53
|
});
|
|
54
|
+
/**
|
|
55
|
+
* Schema to extract the `people` array from a Notion property.
|
|
56
|
+
*
|
|
57
|
+
* **Input:**
|
|
58
|
+
* ```
|
|
59
|
+
* {
|
|
60
|
+
* people: [
|
|
61
|
+
* {
|
|
62
|
+
* id: string;
|
|
63
|
+
* object: "user" | "bot" | "group";
|
|
64
|
+
* name: string | null;
|
|
65
|
+
* ...
|
|
66
|
+
* }
|
|
67
|
+
* ]
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* **Output:**
|
|
72
|
+
* ```
|
|
73
|
+
* [
|
|
74
|
+
* {
|
|
75
|
+
* id: string;
|
|
76
|
+
* object: "user" | "bot" | "group";
|
|
77
|
+
* name: string | null;
|
|
78
|
+
* }
|
|
79
|
+
* ]
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* import * as v from "valibot";
|
|
85
|
+
* import { PeopleSchema } from "@nakanoaas/notion-valibot-schema";
|
|
86
|
+
*
|
|
87
|
+
* const PageSchema = v.object({
|
|
88
|
+
* id: v.string(),
|
|
89
|
+
* properties: v.object({
|
|
90
|
+
* People: PeopleSchema,
|
|
91
|
+
* }),
|
|
92
|
+
* });
|
|
93
|
+
*
|
|
94
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
95
|
+
* const parsed = v.parse(PageSchema, page);
|
|
96
|
+
* // parsed.properties.People: Array<{ id: string; object: "user" | "bot" | "group"; name: string | null }>
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
15
99
|
const PeopleSchema = valibot.pipe(valibot.object({ people: valibot.array(PersonSchema) }), valibot.transform((v) => v.people));
|
|
16
100
|
|
|
17
101
|
//#endregion
|
package/dist/people.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"people.cjs","names":["v"],"sources":["../src/people.ts"],"sourcesContent":["import * as v from \"valibot\";\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\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":"
|
|
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"}
|
package/dist/people.d.cts
CHANGED
|
@@ -1,11 +1,96 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/people.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema for a Notion person object (user, bot, or group).
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* id: string;
|
|
12
|
+
* object: "user" | "bot" | "group";
|
|
13
|
+
* name: string | null;
|
|
14
|
+
* ...
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* **Output:**
|
|
19
|
+
* ```
|
|
20
|
+
* {
|
|
21
|
+
* id: string;
|
|
22
|
+
* object: "user" | "bot" | "group";
|
|
23
|
+
* name: string | null;
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import * as v from "valibot";
|
|
30
|
+
* import { PersonSchema } from "@nakanoaas/notion-valibot-schema";
|
|
31
|
+
*
|
|
32
|
+
* const PageSchema = v.object({
|
|
33
|
+
* id: v.string(),
|
|
34
|
+
* created_by: PersonSchema,
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
38
|
+
* const parsed = v.parse(PageSchema, page);
|
|
39
|
+
* // parsed.created_by: { id: string; object: "user" | "bot" | "group"; name: string | null }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
4
44
|
declare const PersonSchema: v.ObjectSchema<{
|
|
5
45
|
readonly id: v.StringSchema<undefined>;
|
|
6
46
|
readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
|
|
7
47
|
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
8
48
|
}, undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* Schema to extract the `people` array from a Notion property.
|
|
51
|
+
*
|
|
52
|
+
* **Input:**
|
|
53
|
+
* ```
|
|
54
|
+
* {
|
|
55
|
+
* people: [
|
|
56
|
+
* {
|
|
57
|
+
* id: string;
|
|
58
|
+
* object: "user" | "bot" | "group";
|
|
59
|
+
* name: string | null;
|
|
60
|
+
* ...
|
|
61
|
+
* }
|
|
62
|
+
* ]
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* **Output:**
|
|
67
|
+
* ```
|
|
68
|
+
* [
|
|
69
|
+
* {
|
|
70
|
+
* id: string;
|
|
71
|
+
* object: "user" | "bot" | "group";
|
|
72
|
+
* name: string | null;
|
|
73
|
+
* }
|
|
74
|
+
* ]
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* import * as v from "valibot";
|
|
80
|
+
* import { PeopleSchema } from "@nakanoaas/notion-valibot-schema";
|
|
81
|
+
*
|
|
82
|
+
* const PageSchema = v.object({
|
|
83
|
+
* id: v.string(),
|
|
84
|
+
* properties: v.object({
|
|
85
|
+
* People: PeopleSchema,
|
|
86
|
+
* }),
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
90
|
+
* const parsed = v.parse(PageSchema, page);
|
|
91
|
+
* // parsed.properties.People: Array<{ id: string; object: "user" | "bot" | "group"; name: string | null }>
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
9
94
|
declare const PeopleSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
10
95
|
readonly people: v.ArraySchema<v.ObjectSchema<{
|
|
11
96
|
readonly id: v.StringSchema<undefined>;
|
package/dist/people.d.mts
CHANGED
|
@@ -1,11 +1,96 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/people.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema for a Notion person object (user, bot, or group).
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* id: string;
|
|
12
|
+
* object: "user" | "bot" | "group";
|
|
13
|
+
* name: string | null;
|
|
14
|
+
* ...
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* **Output:**
|
|
19
|
+
* ```
|
|
20
|
+
* {
|
|
21
|
+
* id: string;
|
|
22
|
+
* object: "user" | "bot" | "group";
|
|
23
|
+
* name: string | null;
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import * as v from "valibot";
|
|
30
|
+
* import { PersonSchema } from "@nakanoaas/notion-valibot-schema";
|
|
31
|
+
*
|
|
32
|
+
* const PageSchema = v.object({
|
|
33
|
+
* id: v.string(),
|
|
34
|
+
* created_by: PersonSchema,
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
38
|
+
* const parsed = v.parse(PageSchema, page);
|
|
39
|
+
* // parsed.created_by: { id: string; object: "user" | "bot" | "group"; name: string | null }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
4
44
|
declare const PersonSchema: v.ObjectSchema<{
|
|
5
45
|
readonly id: v.StringSchema<undefined>;
|
|
6
46
|
readonly object: v.PicklistSchema<["user", "bot", "group"], undefined>;
|
|
7
47
|
readonly name: v.NullishSchema<v.StringSchema<undefined>, null>;
|
|
8
48
|
}, undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* Schema to extract the `people` array from a Notion property.
|
|
51
|
+
*
|
|
52
|
+
* **Input:**
|
|
53
|
+
* ```
|
|
54
|
+
* {
|
|
55
|
+
* people: [
|
|
56
|
+
* {
|
|
57
|
+
* id: string;
|
|
58
|
+
* object: "user" | "bot" | "group";
|
|
59
|
+
* name: string | null;
|
|
60
|
+
* ...
|
|
61
|
+
* }
|
|
62
|
+
* ]
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* **Output:**
|
|
67
|
+
* ```
|
|
68
|
+
* [
|
|
69
|
+
* {
|
|
70
|
+
* id: string;
|
|
71
|
+
* object: "user" | "bot" | "group";
|
|
72
|
+
* name: string | null;
|
|
73
|
+
* }
|
|
74
|
+
* ]
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* import * as v from "valibot";
|
|
80
|
+
* import { PeopleSchema } from "@nakanoaas/notion-valibot-schema";
|
|
81
|
+
*
|
|
82
|
+
* const PageSchema = v.object({
|
|
83
|
+
* id: v.string(),
|
|
84
|
+
* properties: v.object({
|
|
85
|
+
* People: PeopleSchema,
|
|
86
|
+
* }),
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
90
|
+
* const parsed = v.parse(PageSchema, page);
|
|
91
|
+
* // parsed.properties.People: Array<{ id: string; object: "user" | "bot" | "group"; name: string | null }>
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
9
94
|
declare const PeopleSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
10
95
|
readonly people: v.ArraySchema<v.ObjectSchema<{
|
|
11
96
|
readonly id: v.StringSchema<undefined>;
|
package/dist/people.mjs
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/people.ts
|
|
4
|
+
/**
|
|
5
|
+
* Schema for a Notion person object (user, bot, or group).
|
|
6
|
+
*
|
|
7
|
+
* **Input:**
|
|
8
|
+
* ```
|
|
9
|
+
* {
|
|
10
|
+
* id: string;
|
|
11
|
+
* object: "user" | "bot" | "group";
|
|
12
|
+
* name: string | null;
|
|
13
|
+
* ...
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* **Output:**
|
|
18
|
+
* ```
|
|
19
|
+
* {
|
|
20
|
+
* id: string;
|
|
21
|
+
* object: "user" | "bot" | "group";
|
|
22
|
+
* name: string | null;
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import * as v from "valibot";
|
|
29
|
+
* import { PersonSchema } from "@nakanoaas/notion-valibot-schema";
|
|
30
|
+
*
|
|
31
|
+
* const PageSchema = v.object({
|
|
32
|
+
* id: v.string(),
|
|
33
|
+
* created_by: PersonSchema,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
37
|
+
* const parsed = v.parse(PageSchema, page);
|
|
38
|
+
* // parsed.created_by: { id: string; object: "user" | "bot" | "group"; name: string | null }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
4
43
|
const PersonSchema = v.object({
|
|
5
44
|
id: v.string(),
|
|
6
45
|
object: v.picklist([
|
|
@@ -10,6 +49,51 @@ const PersonSchema = v.object({
|
|
|
10
49
|
]),
|
|
11
50
|
name: v.nullish(v.string(), null)
|
|
12
51
|
});
|
|
52
|
+
/**
|
|
53
|
+
* Schema to extract the `people` array from a Notion property.
|
|
54
|
+
*
|
|
55
|
+
* **Input:**
|
|
56
|
+
* ```
|
|
57
|
+
* {
|
|
58
|
+
* people: [
|
|
59
|
+
* {
|
|
60
|
+
* id: string;
|
|
61
|
+
* object: "user" | "bot" | "group";
|
|
62
|
+
* name: string | null;
|
|
63
|
+
* ...
|
|
64
|
+
* }
|
|
65
|
+
* ]
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* **Output:**
|
|
70
|
+
* ```
|
|
71
|
+
* [
|
|
72
|
+
* {
|
|
73
|
+
* id: string;
|
|
74
|
+
* object: "user" | "bot" | "group";
|
|
75
|
+
* name: string | null;
|
|
76
|
+
* }
|
|
77
|
+
* ]
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import * as v from "valibot";
|
|
83
|
+
* import { PeopleSchema } from "@nakanoaas/notion-valibot-schema";
|
|
84
|
+
*
|
|
85
|
+
* const PageSchema = v.object({
|
|
86
|
+
* id: v.string(),
|
|
87
|
+
* properties: v.object({
|
|
88
|
+
* People: PeopleSchema,
|
|
89
|
+
* }),
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
93
|
+
* const parsed = v.parse(PageSchema, page);
|
|
94
|
+
* // parsed.properties.People: Array<{ id: string; object: "user" | "bot" | "group"; name: string | null }>
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
13
97
|
const PeopleSchema = v.pipe(v.object({ people: v.array(PersonSchema) }), v.transform((v$1) => v$1.people));
|
|
14
98
|
|
|
15
99
|
//#endregion
|
package/dist/people.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"people.mjs","names":["v"],"sources":["../src/people.ts"],"sourcesContent":["import * as v from \"valibot\";\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\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":"
|
|
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"}
|
package/dist/phone-number.cjs
CHANGED
|
@@ -3,7 +3,65 @@ let valibot = require("valibot");
|
|
|
3
3
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
4
4
|
|
|
5
5
|
//#region src/phone-number.ts
|
|
6
|
+
/**
|
|
7
|
+
* Schema to extract the `phone_number` property from a Notion page property.
|
|
8
|
+
*
|
|
9
|
+
* **Input:**
|
|
10
|
+
* ```
|
|
11
|
+
* {
|
|
12
|
+
* phone_number: string;
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* **Output:** `string`
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import * as v from "valibot";
|
|
21
|
+
* import { PhoneNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
22
|
+
*
|
|
23
|
+
* const PageSchema = v.object({
|
|
24
|
+
* id: v.string(),
|
|
25
|
+
* properties: v.object({
|
|
26
|
+
* Phone: PhoneNumberSchema,
|
|
27
|
+
* }),
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
31
|
+
* const parsed = v.parse(PageSchema, page);
|
|
32
|
+
* // parsed.properties.Phone: string
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
6
35
|
const PhoneNumberSchema = valibot.pipe(valibot.object({ phone_number: valibot.string() }), valibot.transform((v) => v.phone_number));
|
|
36
|
+
/**
|
|
37
|
+
* Schema to extract the `phone_number` property from a Notion page property or `null`.
|
|
38
|
+
*
|
|
39
|
+
* **Input:**
|
|
40
|
+
* ```
|
|
41
|
+
* {
|
|
42
|
+
* phone_number: string | null;
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* **Output:** `string | null`
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import * as v from "valibot";
|
|
51
|
+
* import { NullablePhoneNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
52
|
+
*
|
|
53
|
+
* const PageSchema = v.object({
|
|
54
|
+
* id: v.string(),
|
|
55
|
+
* properties: v.object({
|
|
56
|
+
* Phone: NullablePhoneNumberSchema,
|
|
57
|
+
* }),
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
61
|
+
* const parsed = v.parse(PageSchema, page);
|
|
62
|
+
* // parsed.properties.Phone: string | null
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
7
65
|
const NullablePhoneNumberSchema = valibot.pipe(valibot.object({ phone_number: valibot.nullable(valibot.string()) }), valibot.transform((v) => v.phone_number));
|
|
8
66
|
|
|
9
67
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-number.cjs","names":["v"],"sources":["../src/phone-number.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const PhoneNumberSchema = v.pipe(\n\tv.object({\n\t\tphone_number: v.string(),\n\t}),\n\tv.transform((v) => v.phone_number),\n);\n\nexport const NullablePhoneNumberSchema = v.pipe(\n\tv.object({\n\t\tphone_number: v.nullable(v.string()),\n\t}),\n\tv.transform((v) => v.phone_number),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"phone-number.cjs","names":["v"],"sources":["../src/phone-number.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `phone_number` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * phone_number: string;\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { PhoneNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Phone: PhoneNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Phone: string\n * ```\n */\nexport const PhoneNumberSchema = v.pipe(\n\tv.object({\n\t\tphone_number: v.string(),\n\t}),\n\tv.transform((v) => v.phone_number),\n);\n\n/**\n * Schema to extract the `phone_number` property from a Notion page property or `null`.\n *\n * **Input:**\n * ```\n * {\n * phone_number: string | null;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullablePhoneNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Phone: NullablePhoneNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Phone: string | null\n * ```\n */\nexport const NullablePhoneNumberSchema = v.pipe(\n\tv.object({\n\t\tphone_number: v.nullable(v.string()),\n\t}),\n\tv.transform((v) => v.phone_number),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,oBAAoBA,QAAE,KAClCA,QAAE,OAAO,EACR,cAAcA,QAAE,QAAQ,EACxB,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,aAAa,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,MAAa,4BAA4BA,QAAE,KAC1CA,QAAE,OAAO,EACR,cAAcA,QAAE,SAASA,QAAE,QAAQ,CAAC,EACpC,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,aAAa,CAClC"}
|
package/dist/phone-number.d.cts
CHANGED
|
@@ -1,11 +1,70 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/phone-number.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `phone_number` property from a Notion page property.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* phone_number: string;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Output:** `string`
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import * as v from "valibot";
|
|
20
|
+
* import { PhoneNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
21
|
+
*
|
|
22
|
+
* const PageSchema = v.object({
|
|
23
|
+
* id: v.string(),
|
|
24
|
+
* properties: v.object({
|
|
25
|
+
* Phone: PhoneNumberSchema,
|
|
26
|
+
* }),
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
30
|
+
* const parsed = v.parse(PageSchema, page);
|
|
31
|
+
* // parsed.properties.Phone: string
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
4
34
|
declare const PhoneNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
35
|
readonly phone_number: v.StringSchema<undefined>;
|
|
6
36
|
}, undefined>, v.TransformAction<{
|
|
7
37
|
phone_number: string;
|
|
8
38
|
}, string>]>;
|
|
39
|
+
/**
|
|
40
|
+
* Schema to extract the `phone_number` property from a Notion page property or `null`.
|
|
41
|
+
*
|
|
42
|
+
* **Input:**
|
|
43
|
+
* ```
|
|
44
|
+
* {
|
|
45
|
+
* phone_number: string | null;
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* **Output:** `string | null`
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import * as v from "valibot";
|
|
54
|
+
* import { NullablePhoneNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
55
|
+
*
|
|
56
|
+
* const PageSchema = v.object({
|
|
57
|
+
* id: v.string(),
|
|
58
|
+
* properties: v.object({
|
|
59
|
+
* Phone: NullablePhoneNumberSchema,
|
|
60
|
+
* }),
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
64
|
+
* const parsed = v.parse(PageSchema, page);
|
|
65
|
+
* // parsed.properties.Phone: string | null
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
9
68
|
declare const NullablePhoneNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
10
69
|
readonly phone_number: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
11
70
|
}, undefined>, v.TransformAction<{
|