@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/text.d.mts
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/text.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `title` property from a Notion page property and transform it to a string.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* title: Array<{
|
|
12
|
+
* plain_text: string;
|
|
13
|
+
* }>;
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* **Output:** `string`
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import * as v from "valibot";
|
|
22
|
+
* import { TitleSchema } from "@nakanoaas/notion-valibot-utils";
|
|
23
|
+
*
|
|
24
|
+
* const PageSchema = v.object({
|
|
25
|
+
* id: v.string(),
|
|
26
|
+
* properties: v.object({
|
|
27
|
+
* Title: TitleSchema,
|
|
28
|
+
* }),
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
32
|
+
* const parsed = v.parse(PageSchema, page);
|
|
33
|
+
* // parsed.properties.Title: string
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
4
36
|
declare const TitleSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
37
|
readonly title: v.ArraySchema<v.ObjectSchema<{
|
|
6
38
|
readonly plain_text: v.StringSchema<undefined>;
|
|
@@ -10,6 +42,37 @@ declare const TitleSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
10
42
|
plain_text: string;
|
|
11
43
|
}[];
|
|
12
44
|
}, string>]>;
|
|
45
|
+
/**
|
|
46
|
+
* Schema to extract the `rich_text` property from a Notion page property and transform it to a string.
|
|
47
|
+
*
|
|
48
|
+
* **Input:**
|
|
49
|
+
* ```
|
|
50
|
+
* {
|
|
51
|
+
* rich_text: Array<{
|
|
52
|
+
* plain_text: string;
|
|
53
|
+
* }>;
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* **Output:** `string`
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import * as v from "valibot";
|
|
62
|
+
* import { RichTextSchema } from "@nakanoaas/notion-valibot-utils";
|
|
63
|
+
*
|
|
64
|
+
* const PageSchema = v.object({
|
|
65
|
+
* id: v.string(),
|
|
66
|
+
* properties: v.object({
|
|
67
|
+
* Description: RichTextSchema,
|
|
68
|
+
* }),
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
72
|
+
* const parsed = v.parse(PageSchema, page);
|
|
73
|
+
* // parsed.properties.Description: string
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
13
76
|
declare const RichTextSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
14
77
|
readonly rich_text: v.ArraySchema<v.ObjectSchema<{
|
|
15
78
|
readonly plain_text: v.StringSchema<undefined>;
|
package/dist/text.mjs
CHANGED
|
@@ -1,8 +1,108 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/text.ts
|
|
4
|
+
/**
|
|
5
|
+
* Schema for a Notion rich text array structure.
|
|
6
|
+
*
|
|
7
|
+
* **Input:**
|
|
8
|
+
* ```
|
|
9
|
+
* Array<{
|
|
10
|
+
* plain_text: string;
|
|
11
|
+
* }>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* **Output:**
|
|
15
|
+
* ```
|
|
16
|
+
* Array<{
|
|
17
|
+
* plain_text: string;
|
|
18
|
+
* }>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import * as v from "valibot";
|
|
24
|
+
* import { RichTextArraySchema } from "@nakanoaas/notion-valibot-utils";
|
|
25
|
+
*
|
|
26
|
+
* const PageSchema = v.object({
|
|
27
|
+
* id: v.string(),
|
|
28
|
+
* properties: v.object({
|
|
29
|
+
* Text: v.object({
|
|
30
|
+
* rich_text: RichTextArraySchema,
|
|
31
|
+
* }),
|
|
32
|
+
* }),
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
36
|
+
* const parsed = v.parse(PageSchema, page);
|
|
37
|
+
* // parsed.properties.Text.rich_text: Array<{ plain_text: string }>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
4
42
|
const RichTextArraySchema = v.array(v.object({ plain_text: v.string() }));
|
|
43
|
+
/**
|
|
44
|
+
* Schema to extract the `title` property from a Notion page property and transform it to a string.
|
|
45
|
+
*
|
|
46
|
+
* **Input:**
|
|
47
|
+
* ```
|
|
48
|
+
* {
|
|
49
|
+
* title: Array<{
|
|
50
|
+
* plain_text: string;
|
|
51
|
+
* }>;
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* **Output:** `string`
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import * as v from "valibot";
|
|
60
|
+
* import { TitleSchema } from "@nakanoaas/notion-valibot-utils";
|
|
61
|
+
*
|
|
62
|
+
* const PageSchema = v.object({
|
|
63
|
+
* id: v.string(),
|
|
64
|
+
* properties: v.object({
|
|
65
|
+
* Title: TitleSchema,
|
|
66
|
+
* }),
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
70
|
+
* const parsed = v.parse(PageSchema, page);
|
|
71
|
+
* // parsed.properties.Title: string
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
5
74
|
const TitleSchema = v.pipe(v.object({ title: RichTextArraySchema }), v.transform((v$1) => v$1.title.map((v$2) => v$2.plain_text).join("")));
|
|
75
|
+
/**
|
|
76
|
+
* Schema to extract the `rich_text` property from a Notion page property and transform it to a string.
|
|
77
|
+
*
|
|
78
|
+
* **Input:**
|
|
79
|
+
* ```
|
|
80
|
+
* {
|
|
81
|
+
* rich_text: Array<{
|
|
82
|
+
* plain_text: string;
|
|
83
|
+
* }>;
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* **Output:** `string`
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import * as v from "valibot";
|
|
92
|
+
* import { RichTextSchema } from "@nakanoaas/notion-valibot-utils";
|
|
93
|
+
*
|
|
94
|
+
* const PageSchema = v.object({
|
|
95
|
+
* id: v.string(),
|
|
96
|
+
* properties: v.object({
|
|
97
|
+
* Description: RichTextSchema,
|
|
98
|
+
* }),
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
102
|
+
* const parsed = v.parse(PageSchema, page);
|
|
103
|
+
* // parsed.properties.Description: string
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
6
106
|
const RichTextSchema = v.pipe(v.object({ rich_text: RichTextArraySchema }), v.transform((v$1) => v$1.rich_text.map((v$2) => v$2.plain_text).join("")));
|
|
7
107
|
|
|
8
108
|
//#endregion
|
package/dist/text.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.mjs","names":["v"],"sources":["../src/text.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nconst RichTextArraySchema = v.array(\n\tv.object({\n\t\tplain_text: v.string(),\n\t}),\n);\n\nexport const TitleSchema = v.pipe(\n\tv.object({\n\t\ttitle: RichTextArraySchema,\n\t}),\n\tv.transform((v) => v.title.map((v) => v.plain_text).join(\"\")),\n);\n\nexport const RichTextSchema = v.pipe(\n\tv.object({\n\t\trich_text: RichTextArraySchema,\n\t}),\n\tv.transform((v) => v.rich_text.map((v) => v.plain_text).join(\"\")),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.mjs","names":["v"],"sources":["../src/text.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema for a Notion rich text array structure.\n *\n * **Input:**\n * ```\n * Array<{\n * plain_text: string;\n * }>\n * ```\n *\n * **Output:**\n * ```\n * Array<{\n * plain_text: string;\n * }>\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { RichTextArraySchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Text: v.object({\n * rich_text: RichTextArraySchema,\n * }),\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Text.rich_text: Array<{ plain_text: string }>\n * ```\n *\n * @internal\n */\nconst RichTextArraySchema = v.array(\n\tv.object({\n\t\tplain_text: v.string(),\n\t}),\n);\n\n/**\n * Schema to extract the `title` property from a Notion page property and transform it to a string.\n *\n * **Input:**\n * ```\n * {\n * title: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { TitleSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Title: TitleSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Title: string\n * ```\n */\nexport const TitleSchema = v.pipe(\n\tv.object({\n\t\ttitle: RichTextArraySchema,\n\t}),\n\tv.transform((v) => v.title.map((v) => v.plain_text).join(\"\")),\n);\n\n/**\n * Schema to extract the `rich_text` property from a Notion page property and transform it to a string.\n *\n * **Input:**\n * ```\n * {\n * rich_text: Array<{\n * plain_text: string;\n * }>;\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { RichTextSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Description: RichTextSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Description: string\n * ```\n */\nexport const RichTextSchema = v.pipe(\n\tv.object({\n\t\trich_text: RichTextArraySchema,\n\t}),\n\tv.transform((v) => v.rich_text.map((v) => v.plain_text).join(\"\")),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,sBAAsB,EAAE,MAC7B,EAAE,OAAO,EACR,YAAY,EAAE,QAAQ,EACtB,CAAC,CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCD,MAAa,cAAc,EAAE,KAC5B,EAAE,OAAO,EACR,OAAO,qBACP,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,MAAM,KAAK,QAAMA,IAAE,WAAW,CAAC,KAAK,GAAG,CAAC,CAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCD,MAAa,iBAAiB,EAAE,KAC/B,EAAE,OAAO,EACR,WAAW,qBACX,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,UAAU,KAAK,QAAMA,IAAE,WAAW,CAAC,KAAK,GAAG,CAAC,CACjE"}
|
package/dist/unique-id.cjs
CHANGED
|
@@ -3,7 +3,76 @@ let valibot = require("valibot");
|
|
|
3
3
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
4
4
|
|
|
5
5
|
//#region src/unique-id.ts
|
|
6
|
+
/**
|
|
7
|
+
* Schema to extract the `unique_id` property number from a Notion page property.
|
|
8
|
+
*
|
|
9
|
+
* **Input:**
|
|
10
|
+
* ```
|
|
11
|
+
* {
|
|
12
|
+
* unique_id: {
|
|
13
|
+
* number: number;
|
|
14
|
+
* };
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* **Output:** `number`
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import * as v from "valibot";
|
|
23
|
+
* import { UniqueIdNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
24
|
+
*
|
|
25
|
+
* const PageSchema = v.object({
|
|
26
|
+
* id: v.string(),
|
|
27
|
+
* properties: v.object({
|
|
28
|
+
* ID: UniqueIdNumberSchema,
|
|
29
|
+
* }),
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
33
|
+
* const parsed = v.parse(PageSchema, page);
|
|
34
|
+
* // parsed.properties.ID: number
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
6
37
|
const UniqueIdNumberSchema = valibot.pipe(valibot.object({ unique_id: valibot.object({ number: valibot.number() }) }), valibot.transform((v) => v.unique_id.number));
|
|
38
|
+
/**
|
|
39
|
+
* Schema to extract the `unique_id` property from a Notion page property.
|
|
40
|
+
*
|
|
41
|
+
* **Input:**
|
|
42
|
+
* ```
|
|
43
|
+
* {
|
|
44
|
+
* unique_id: {
|
|
45
|
+
* prefix: string | null;
|
|
46
|
+
* number: number | null;
|
|
47
|
+
* };
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* **Output:**
|
|
52
|
+
* ```
|
|
53
|
+
* {
|
|
54
|
+
* prefix: string | null;
|
|
55
|
+
* number: number | null;
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import * as v from "valibot";
|
|
62
|
+
* import { NullableUniqueIdSchema } from "@nakanoaas/notion-valibot-utils";
|
|
63
|
+
*
|
|
64
|
+
* const PageSchema = v.object({
|
|
65
|
+
* id: v.string(),
|
|
66
|
+
* properties: v.object({
|
|
67
|
+
* ID: NullableUniqueIdSchema,
|
|
68
|
+
* }),
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
72
|
+
* const parsed = v.parse(PageSchema, page);
|
|
73
|
+
* // parsed.properties.ID: { prefix: string | null; number: number | null }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
7
76
|
const NullableUniqueIdSchema = valibot.pipe(valibot.object({ unique_id: valibot.object({
|
|
8
77
|
prefix: valibot.nullable(valibot.string()),
|
|
9
78
|
number: valibot.nullable(valibot.number())
|
package/dist/unique-id.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unique-id.cjs","names":["v"],"sources":["../src/unique-id.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const UniqueIdNumberSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tnumber: v.number(),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id.number),\n);\n\nexport const NullableUniqueIdSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tprefix: v.nullable(v.string()),\n\t\t\tnumber: v.nullable(v.number()),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unique-id.cjs","names":["v"],"sources":["../src/unique-id.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `unique_id` property number from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * number: number;\n * };\n * }\n * ```\n *\n * **Output:** `number`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UniqueIdNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: UniqueIdNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: number\n * ```\n */\nexport const UniqueIdNumberSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tnumber: v.number(),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id.number),\n);\n\n/**\n * Schema to extract the `unique_id` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * prefix: string | null;\n * number: number | null;\n * };\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * prefix: string | null;\n * number: number | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUniqueIdSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: NullableUniqueIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: { prefix: string | null; number: number | null }\n * ```\n */\nexport const NullableUniqueIdSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tprefix: v.nullable(v.string()),\n\t\t\tnumber: v.nullable(v.number()),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,uBAAuBA,QAAE,KACrCA,QAAE,OAAO,EACR,WAAWA,QAAE,OAAO,EACnB,QAAQA,QAAE,QAAQ,EAClB,CAAC,EACF,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,UAAU,OAAO,CACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCD,MAAa,yBAAyBA,QAAE,KACvCA,QAAE,OAAO,EACR,WAAWA,QAAE,OAAO;CACnB,QAAQA,QAAE,SAASA,QAAE,QAAQ,CAAC;CAC9B,QAAQA,QAAE,SAASA,QAAE,QAAQ,CAAC;CAC9B,CAAC,EACF,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,UAAU,CAC/B"}
|
package/dist/unique-id.d.cts
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/unique-id.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `unique_id` property number from a Notion page property.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* unique_id: {
|
|
12
|
+
* number: number;
|
|
13
|
+
* };
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* **Output:** `number`
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import * as v from "valibot";
|
|
22
|
+
* import { UniqueIdNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
23
|
+
*
|
|
24
|
+
* const PageSchema = v.object({
|
|
25
|
+
* id: v.string(),
|
|
26
|
+
* properties: v.object({
|
|
27
|
+
* ID: UniqueIdNumberSchema,
|
|
28
|
+
* }),
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
32
|
+
* const parsed = v.parse(PageSchema, page);
|
|
33
|
+
* // parsed.properties.ID: number
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
4
36
|
declare const UniqueIdNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
37
|
readonly unique_id: v.ObjectSchema<{
|
|
6
38
|
readonly number: v.NumberSchema<undefined>;
|
|
@@ -10,6 +42,44 @@ declare const UniqueIdNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
10
42
|
number: number;
|
|
11
43
|
};
|
|
12
44
|
}, number>]>;
|
|
45
|
+
/**
|
|
46
|
+
* Schema to extract the `unique_id` property from a Notion page property.
|
|
47
|
+
*
|
|
48
|
+
* **Input:**
|
|
49
|
+
* ```
|
|
50
|
+
* {
|
|
51
|
+
* unique_id: {
|
|
52
|
+
* prefix: string | null;
|
|
53
|
+
* number: number | null;
|
|
54
|
+
* };
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* **Output:**
|
|
59
|
+
* ```
|
|
60
|
+
* {
|
|
61
|
+
* prefix: string | null;
|
|
62
|
+
* number: number | null;
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import * as v from "valibot";
|
|
69
|
+
* import { NullableUniqueIdSchema } from "@nakanoaas/notion-valibot-utils";
|
|
70
|
+
*
|
|
71
|
+
* const PageSchema = v.object({
|
|
72
|
+
* id: v.string(),
|
|
73
|
+
* properties: v.object({
|
|
74
|
+
* ID: NullableUniqueIdSchema,
|
|
75
|
+
* }),
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
79
|
+
* const parsed = v.parse(PageSchema, page);
|
|
80
|
+
* // parsed.properties.ID: { prefix: string | null; number: number | null }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
13
83
|
declare const NullableUniqueIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
14
84
|
readonly unique_id: v.ObjectSchema<{
|
|
15
85
|
readonly prefix: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
package/dist/unique-id.d.mts
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/unique-id.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `unique_id` property number from a Notion page property.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* unique_id: {
|
|
12
|
+
* number: number;
|
|
13
|
+
* };
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* **Output:** `number`
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import * as v from "valibot";
|
|
22
|
+
* import { UniqueIdNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
23
|
+
*
|
|
24
|
+
* const PageSchema = v.object({
|
|
25
|
+
* id: v.string(),
|
|
26
|
+
* properties: v.object({
|
|
27
|
+
* ID: UniqueIdNumberSchema,
|
|
28
|
+
* }),
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
32
|
+
* const parsed = v.parse(PageSchema, page);
|
|
33
|
+
* // parsed.properties.ID: number
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
4
36
|
declare const UniqueIdNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
37
|
readonly unique_id: v.ObjectSchema<{
|
|
6
38
|
readonly number: v.NumberSchema<undefined>;
|
|
@@ -10,6 +42,44 @@ declare const UniqueIdNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
10
42
|
number: number;
|
|
11
43
|
};
|
|
12
44
|
}, number>]>;
|
|
45
|
+
/**
|
|
46
|
+
* Schema to extract the `unique_id` property from a Notion page property.
|
|
47
|
+
*
|
|
48
|
+
* **Input:**
|
|
49
|
+
* ```
|
|
50
|
+
* {
|
|
51
|
+
* unique_id: {
|
|
52
|
+
* prefix: string | null;
|
|
53
|
+
* number: number | null;
|
|
54
|
+
* };
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* **Output:**
|
|
59
|
+
* ```
|
|
60
|
+
* {
|
|
61
|
+
* prefix: string | null;
|
|
62
|
+
* number: number | null;
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import * as v from "valibot";
|
|
69
|
+
* import { NullableUniqueIdSchema } from "@nakanoaas/notion-valibot-utils";
|
|
70
|
+
*
|
|
71
|
+
* const PageSchema = v.object({
|
|
72
|
+
* id: v.string(),
|
|
73
|
+
* properties: v.object({
|
|
74
|
+
* ID: NullableUniqueIdSchema,
|
|
75
|
+
* }),
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
79
|
+
* const parsed = v.parse(PageSchema, page);
|
|
80
|
+
* // parsed.properties.ID: { prefix: string | null; number: number | null }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
13
83
|
declare const NullableUniqueIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
14
84
|
readonly unique_id: v.ObjectSchema<{
|
|
15
85
|
readonly prefix: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
package/dist/unique-id.mjs
CHANGED
|
@@ -1,7 +1,76 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/unique-id.ts
|
|
4
|
+
/**
|
|
5
|
+
* Schema to extract the `unique_id` property number from a Notion page property.
|
|
6
|
+
*
|
|
7
|
+
* **Input:**
|
|
8
|
+
* ```
|
|
9
|
+
* {
|
|
10
|
+
* unique_id: {
|
|
11
|
+
* number: number;
|
|
12
|
+
* };
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* **Output:** `number`
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import * as v from "valibot";
|
|
21
|
+
* import { UniqueIdNumberSchema } from "@nakanoaas/notion-valibot-utils";
|
|
22
|
+
*
|
|
23
|
+
* const PageSchema = v.object({
|
|
24
|
+
* id: v.string(),
|
|
25
|
+
* properties: v.object({
|
|
26
|
+
* ID: UniqueIdNumberSchema,
|
|
27
|
+
* }),
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
31
|
+
* const parsed = v.parse(PageSchema, page);
|
|
32
|
+
* // parsed.properties.ID: number
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
4
35
|
const UniqueIdNumberSchema = v.pipe(v.object({ unique_id: v.object({ number: v.number() }) }), v.transform((v$1) => v$1.unique_id.number));
|
|
36
|
+
/**
|
|
37
|
+
* Schema to extract the `unique_id` property from a Notion page property.
|
|
38
|
+
*
|
|
39
|
+
* **Input:**
|
|
40
|
+
* ```
|
|
41
|
+
* {
|
|
42
|
+
* unique_id: {
|
|
43
|
+
* prefix: string | null;
|
|
44
|
+
* number: number | null;
|
|
45
|
+
* };
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* **Output:**
|
|
50
|
+
* ```
|
|
51
|
+
* {
|
|
52
|
+
* prefix: string | null;
|
|
53
|
+
* number: number | null;
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import * as v from "valibot";
|
|
60
|
+
* import { NullableUniqueIdSchema } from "@nakanoaas/notion-valibot-utils";
|
|
61
|
+
*
|
|
62
|
+
* const PageSchema = v.object({
|
|
63
|
+
* id: v.string(),
|
|
64
|
+
* properties: v.object({
|
|
65
|
+
* ID: NullableUniqueIdSchema,
|
|
66
|
+
* }),
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
70
|
+
* const parsed = v.parse(PageSchema, page);
|
|
71
|
+
* // parsed.properties.ID: { prefix: string | null; number: number | null }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
5
74
|
const NullableUniqueIdSchema = v.pipe(v.object({ unique_id: v.object({
|
|
6
75
|
prefix: v.nullable(v.string()),
|
|
7
76
|
number: v.nullable(v.number())
|
package/dist/unique-id.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unique-id.mjs","names":["v"],"sources":["../src/unique-id.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const UniqueIdNumberSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tnumber: v.number(),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id.number),\n);\n\nexport const NullableUniqueIdSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tprefix: v.nullable(v.string()),\n\t\t\tnumber: v.nullable(v.number()),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unique-id.mjs","names":["v"],"sources":["../src/unique-id.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `unique_id` property number from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * number: number;\n * };\n * }\n * ```\n *\n * **Output:** `number`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UniqueIdNumberSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: UniqueIdNumberSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: number\n * ```\n */\nexport const UniqueIdNumberSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tnumber: v.number(),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id.number),\n);\n\n/**\n * Schema to extract the `unique_id` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * unique_id: {\n * prefix: string | null;\n * number: number | null;\n * };\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * prefix: string | null;\n * number: number | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUniqueIdSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * ID: NullableUniqueIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.ID: { prefix: string | null; number: number | null }\n * ```\n */\nexport const NullableUniqueIdSchema = v.pipe(\n\tv.object({\n\t\tunique_id: v.object({\n\t\t\tprefix: v.nullable(v.string()),\n\t\t\tnumber: v.nullable(v.number()),\n\t\t}),\n\t}),\n\tv.transform((v) => v.unique_id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,uBAAuB,EAAE,KACrC,EAAE,OAAO,EACR,WAAW,EAAE,OAAO,EACnB,QAAQ,EAAE,QAAQ,EAClB,CAAC,EACF,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,UAAU,OAAO,CACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCD,MAAa,yBAAyB,EAAE,KACvC,EAAE,OAAO,EACR,WAAW,EAAE,OAAO;CACnB,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC9B,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC9B,CAAC,EACF,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,UAAU,CAC/B"}
|
package/dist/url.cjs
CHANGED
|
@@ -3,7 +3,65 @@ let valibot = require("valibot");
|
|
|
3
3
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
4
4
|
|
|
5
5
|
//#region src/url.ts
|
|
6
|
+
/**
|
|
7
|
+
* Schema to extract the `url` property from a Notion page property or `null`.
|
|
8
|
+
*
|
|
9
|
+
* **Input:**
|
|
10
|
+
* ```
|
|
11
|
+
* {
|
|
12
|
+
* url: string | null;
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* **Output:** `string | null`
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import * as v from "valibot";
|
|
21
|
+
* import { NullableUrlSchema } from "@nakanoaas/notion-valibot-utils";
|
|
22
|
+
*
|
|
23
|
+
* const PageSchema = v.object({
|
|
24
|
+
* id: v.string(),
|
|
25
|
+
* properties: v.object({
|
|
26
|
+
* Website: NullableUrlSchema,
|
|
27
|
+
* }),
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
31
|
+
* const parsed = v.parse(PageSchema, page);
|
|
32
|
+
* // parsed.properties.Website: string | null
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
6
35
|
const NullableUrlSchema = valibot.pipe(valibot.object({ url: valibot.nullable(valibot.string()) }), valibot.transform((v) => v.url));
|
|
36
|
+
/**
|
|
37
|
+
* Schema to extract the `url` property from a Notion page property.
|
|
38
|
+
*
|
|
39
|
+
* **Input:**
|
|
40
|
+
* ```
|
|
41
|
+
* {
|
|
42
|
+
* url: string;
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* **Output:** `string`
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import * as v from "valibot";
|
|
51
|
+
* import { UrlSchema } from "@nakanoaas/notion-valibot-utils";
|
|
52
|
+
*
|
|
53
|
+
* const PageSchema = v.object({
|
|
54
|
+
* id: v.string(),
|
|
55
|
+
* properties: v.object({
|
|
56
|
+
* Website: UrlSchema,
|
|
57
|
+
* }),
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
61
|
+
* const parsed = v.parse(PageSchema, page);
|
|
62
|
+
* // parsed.properties.Website: string
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
7
65
|
const UrlSchema = valibot.pipe(valibot.object({ url: valibot.string() }), valibot.transform((v) => v.url));
|
|
8
66
|
|
|
9
67
|
//#endregion
|
package/dist/url.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.cjs","names":["v"],"sources":["../src/url.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const NullableUrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.nullable(v.string()),\n\t}),\n\tv.transform((v) => v.url),\n);\n\nexport const UrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.string(),\n\t}),\n\tv.transform((v) => v.url),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"url.cjs","names":["v"],"sources":["../src/url.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `url` property from a Notion page property or `null`.\n *\n * **Input:**\n * ```\n * {\n * url: string | null;\n * }\n * ```\n *\n * **Output:** `string | null`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableUrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: NullableUrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string | null\n * ```\n */\nexport const NullableUrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.nullable(v.string()),\n\t}),\n\tv.transform((v) => v.url),\n);\n\n/**\n * Schema to extract the `url` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * url: string;\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { UrlSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Website: UrlSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Website: string\n * ```\n */\nexport const UrlSchema = v.pipe(\n\tv.object({\n\t\turl: v.string(),\n\t}),\n\tv.transform((v) => v.url),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,oBAAoBA,QAAE,KAClCA,QAAE,OAAO,EACR,KAAKA,QAAE,SAASA,QAAE,QAAQ,CAAC,EAC3B,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,IAAI,CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,MAAa,YAAYA,QAAE,KAC1BA,QAAE,OAAO,EACR,KAAKA,QAAE,QAAQ,EACf,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,IAAI,CACzB"}
|
package/dist/url.d.cts
CHANGED
|
@@ -1,11 +1,70 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/url.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `url` property from a Notion page property or `null`.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* url: string | null;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Output:** `string | null`
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import * as v from "valibot";
|
|
20
|
+
* import { NullableUrlSchema } from "@nakanoaas/notion-valibot-utils";
|
|
21
|
+
*
|
|
22
|
+
* const PageSchema = v.object({
|
|
23
|
+
* id: v.string(),
|
|
24
|
+
* properties: v.object({
|
|
25
|
+
* Website: NullableUrlSchema,
|
|
26
|
+
* }),
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
30
|
+
* const parsed = v.parse(PageSchema, page);
|
|
31
|
+
* // parsed.properties.Website: string | null
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
4
34
|
declare const NullableUrlSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
35
|
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
6
36
|
}, undefined>, v.TransformAction<{
|
|
7
37
|
url: string | null;
|
|
8
38
|
}, string | null>]>;
|
|
39
|
+
/**
|
|
40
|
+
* Schema to extract the `url` property from a Notion page property.
|
|
41
|
+
*
|
|
42
|
+
* **Input:**
|
|
43
|
+
* ```
|
|
44
|
+
* {
|
|
45
|
+
* url: string;
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* **Output:** `string`
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import * as v from "valibot";
|
|
54
|
+
* import { UrlSchema } from "@nakanoaas/notion-valibot-utils";
|
|
55
|
+
*
|
|
56
|
+
* const PageSchema = v.object({
|
|
57
|
+
* id: v.string(),
|
|
58
|
+
* properties: v.object({
|
|
59
|
+
* Website: UrlSchema,
|
|
60
|
+
* }),
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
64
|
+
* const parsed = v.parse(PageSchema, page);
|
|
65
|
+
* // parsed.properties.Website: string
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
9
68
|
declare const UrlSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
10
69
|
readonly url: v.StringSchema<undefined>;
|
|
11
70
|
}, undefined>, v.TransformAction<{
|