@nakanoaas/notion-valibot-schema 0.0.3 → 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/README.md +26 -24
- 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 +203 -13
- package/dist/date.cjs.map +1 -1
- package/dist/date.d.cts +214 -6
- package/dist/date.d.mts +214 -6
- package/dist/date.mjs +201 -12
- 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/index.cjs +7 -3
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- 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 +137 -1
- package/dist/relation.cjs.map +1 -1
- package/dist/relation.d.cts +113 -1
- package/dist/relation.d.mts +113 -1
- package/dist/relation.mjs +136 -2
- package/dist/relation.mjs.map +1 -1
- package/dist/rollup.cjs +203 -10
- 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 +203 -10
- 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 +103 -3
- package/dist/text.cjs.map +1 -1
- package/dist/text.d.cts +73 -10
- package/dist/text.d.mts +73 -10
- package/dist/text.mjs +103 -3
- package/dist/text.mjs.map +1 -1
- package/dist/unique-id.cjs +73 -2
- package/dist/unique-id.cjs.map +1 -1
- package/dist/unique-id.d.cts +81 -2
- package/dist/unique-id.d.mts +81 -2
- package/dist/unique-id.mjs +72 -2
- 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 +82 -5
- 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 +82 -5
- package/dist/verification.mjs.map +1 -1
- package/package.json +1 -1
package/dist/unique-id.d.mts
CHANGED
|
@@ -1,7 +1,86 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/unique-id.d.ts
|
|
4
|
-
|
|
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
|
+
*/
|
|
36
|
+
declare const UniqueIdNumberSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
37
|
+
readonly unique_id: v.ObjectSchema<{
|
|
38
|
+
readonly number: v.NumberSchema<undefined>;
|
|
39
|
+
}, undefined>;
|
|
40
|
+
}, undefined>, v.TransformAction<{
|
|
41
|
+
unique_id: {
|
|
42
|
+
number: number;
|
|
43
|
+
};
|
|
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
|
+
*/
|
|
83
|
+
declare const NullableUniqueIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
84
|
readonly unique_id: v.ObjectSchema<{
|
|
6
85
|
readonly prefix: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
7
86
|
readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
@@ -16,5 +95,5 @@ declare const UniqueIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
16
95
|
number: number | null;
|
|
17
96
|
}>]>;
|
|
18
97
|
//#endregion
|
|
19
|
-
export {
|
|
98
|
+
export { NullableUniqueIdSchema, UniqueIdNumberSchema };
|
|
20
99
|
//# sourceMappingURL=unique-id.d.mts.map
|
package/dist/unique-id.mjs
CHANGED
|
@@ -1,11 +1,81 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/unique-id.ts
|
|
4
|
-
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
74
|
+
const NullableUniqueIdSchema = v.pipe(v.object({ unique_id: v.object({
|
|
5
75
|
prefix: v.nullable(v.string()),
|
|
6
76
|
number: v.nullable(v.number())
|
|
7
77
|
}) }), v.transform((v$1) => v$1.unique_id));
|
|
8
78
|
|
|
9
79
|
//#endregion
|
|
10
|
-
export {
|
|
80
|
+
export { NullableUniqueIdSchema, UniqueIdNumberSchema };
|
|
11
81
|
//# sourceMappingURL=unique-id.mjs.map
|
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
|
|
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<{
|
package/dist/url.d.mts
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<{
|
package/dist/url.mjs
CHANGED
|
@@ -1,7 +1,65 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/url.ts
|
|
4
|
+
/**
|
|
5
|
+
* Schema to extract the `url` property from a Notion page property or `null`.
|
|
6
|
+
*
|
|
7
|
+
* **Input:**
|
|
8
|
+
* ```
|
|
9
|
+
* {
|
|
10
|
+
* url: string | null;
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* **Output:** `string | null`
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import * as v from "valibot";
|
|
19
|
+
* import { NullableUrlSchema } from "@nakanoaas/notion-valibot-utils";
|
|
20
|
+
*
|
|
21
|
+
* const PageSchema = v.object({
|
|
22
|
+
* id: v.string(),
|
|
23
|
+
* properties: v.object({
|
|
24
|
+
* Website: NullableUrlSchema,
|
|
25
|
+
* }),
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
29
|
+
* const parsed = v.parse(PageSchema, page);
|
|
30
|
+
* // parsed.properties.Website: string | null
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
4
33
|
const NullableUrlSchema = v.pipe(v.object({ url: v.nullable(v.string()) }), v.transform((v$1) => v$1.url));
|
|
34
|
+
/**
|
|
35
|
+
* Schema to extract the `url` property from a Notion page property.
|
|
36
|
+
*
|
|
37
|
+
* **Input:**
|
|
38
|
+
* ```
|
|
39
|
+
* {
|
|
40
|
+
* url: string;
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* **Output:** `string`
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* import * as v from "valibot";
|
|
49
|
+
* import { UrlSchema } from "@nakanoaas/notion-valibot-utils";
|
|
50
|
+
*
|
|
51
|
+
* const PageSchema = v.object({
|
|
52
|
+
* id: v.string(),
|
|
53
|
+
* properties: v.object({
|
|
54
|
+
* Website: UrlSchema,
|
|
55
|
+
* }),
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
59
|
+
* const parsed = v.parse(PageSchema, page);
|
|
60
|
+
* // parsed.properties.Website: string
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
5
63
|
const UrlSchema = v.pipe(v.object({ url: v.string() }), v.transform((v$1) => v$1.url));
|
|
6
64
|
|
|
7
65
|
//#endregion
|
package/dist/url.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.mjs","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.mjs","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,oBAAoB,EAAE,KAClC,EAAE,OAAO,EACR,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAC3B,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,IAAI,CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,MAAa,YAAY,EAAE,KAC1B,EAAE,OAAO,EACR,KAAK,EAAE,QAAQ,EACf,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,IAAI,CACzB"}
|
package/dist/verification.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_people = require('./people.cjs');
|
|
3
|
+
const require_date = require('./date.cjs');
|
|
3
4
|
let valibot = require("valibot");
|
|
4
5
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
5
6
|
|
|
@@ -10,14 +11,90 @@ const InnerVerificationSchema = valibot.variant("state", [valibot.object({
|
|
|
10
11
|
verified_by: valibot.null_()
|
|
11
12
|
}), valibot.object({
|
|
12
13
|
state: valibot.union([valibot.literal("verified"), valibot.literal("expired")]),
|
|
13
|
-
date: valibot.nullable(
|
|
14
|
-
start: valibot.string(),
|
|
15
|
-
end: valibot.nullable(valibot.string()),
|
|
16
|
-
time_zone: valibot.nullable(valibot.string())
|
|
17
|
-
})),
|
|
14
|
+
date: valibot.nullable(require_date.DateObjectSchema),
|
|
18
15
|
verified_by: valibot.nullable(require_people.PersonSchema)
|
|
19
16
|
})]);
|
|
17
|
+
/**
|
|
18
|
+
* Schema to extract the `verification` object from a Notion property.
|
|
19
|
+
*
|
|
20
|
+
* **Input:**
|
|
21
|
+
* ```
|
|
22
|
+
* {
|
|
23
|
+
* verification: {
|
|
24
|
+
* state: "unverified" | "verified" | "expired";
|
|
25
|
+
* date: DateObject | null;
|
|
26
|
+
* verified_by: Person | null;
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* **Output:**
|
|
32
|
+
* ```
|
|
33
|
+
* {
|
|
34
|
+
* state: "unverified" | "verified" | "expired";
|
|
35
|
+
* date: DateObject | null;
|
|
36
|
+
* verified_by: Person | null;
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import * as v from "valibot";
|
|
43
|
+
* import { VerificationSchema } from "@nakanoaas/notion-valibot-schema";
|
|
44
|
+
*
|
|
45
|
+
* const PageSchema = v.object({
|
|
46
|
+
* id: v.string(),
|
|
47
|
+
* properties: v.object({
|
|
48
|
+
* Verification: VerificationSchema,
|
|
49
|
+
* }),
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
53
|
+
* const parsed = v.parse(PageSchema, page);
|
|
54
|
+
* // parsed.properties.Verification: { state: "unverified" | "verified" | "expired"; date: DateObject | null; verified_by: Person | null }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
20
57
|
const VerificationSchema = valibot.pipe(valibot.object({ verification: InnerVerificationSchema }), valibot.transform((v) => v.verification));
|
|
58
|
+
/**
|
|
59
|
+
* Schema to extract the `verification` object from a Notion property (nullable).
|
|
60
|
+
*
|
|
61
|
+
* **Input:**
|
|
62
|
+
* ```
|
|
63
|
+
* {
|
|
64
|
+
* verification: {
|
|
65
|
+
* state: "unverified" | "verified" | "expired";
|
|
66
|
+
* date: DateObject | null;
|
|
67
|
+
* verified_by: Person | null;
|
|
68
|
+
* } | null
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* **Output:**
|
|
73
|
+
* ```
|
|
74
|
+
* {
|
|
75
|
+
* state: "unverified" | "verified" | "expired";
|
|
76
|
+
* date: DateObject | null;
|
|
77
|
+
* verified_by: Person | null;
|
|
78
|
+
* } | null
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import * as v from "valibot";
|
|
84
|
+
* import { NullableVerificationSchema } from "@nakanoaas/notion-valibot-schema";
|
|
85
|
+
*
|
|
86
|
+
* const PageSchema = v.object({
|
|
87
|
+
* id: v.string(),
|
|
88
|
+
* properties: v.object({
|
|
89
|
+
* Verification: NullableVerificationSchema,
|
|
90
|
+
* }),
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
94
|
+
* const parsed = v.parse(PageSchema, page);
|
|
95
|
+
* // parsed.properties.Verification: { state: "unverified" | "verified" | "expired"; date: DateObject | null; verified_by: Person | null } | null
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
21
98
|
const NullableVerificationSchema = valibot.pipe(valibot.object({ verification: valibot.nullable(InnerVerificationSchema) }), valibot.transform((v) => v.verification));
|
|
22
99
|
|
|
23
100
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification.cjs","names":["v","PersonSchema"],"sources":["../src/verification.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\nconst InnerVerificationSchema = v.variant(\"state\", [\n\tv.object({\n\t\tstate: v.literal(\"unverified\"),\n\t\tdate: v.null_(),\n\t\tverified_by: v.null_(),\n\t}),\n\tv.object({\n\t\tstate: v.union([v.literal(\"verified\"), v.literal(\"expired\")]),\n\t\tdate: v.nullable(
|
|
1
|
+
{"version":3,"file":"verification.cjs","names":["v","DateObjectSchema","PersonSchema"],"sources":["../src/verification.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { DateObjectSchema } from \"./date\";\nimport { PersonSchema } from \"./people\";\n\nconst InnerVerificationSchema = v.variant(\"state\", [\n\tv.object({\n\t\tstate: v.literal(\"unverified\"),\n\t\tdate: v.null_(),\n\t\tverified_by: v.null_(),\n\t}),\n\tv.object({\n\t\tstate: v.union([v.literal(\"verified\"), v.literal(\"expired\")]),\n\t\tdate: v.nullable(DateObjectSchema),\n\t\tverified_by: v.nullable(PersonSchema),\n\t}),\n]);\n\n/**\n * Schema to extract the `verification` object from a Notion property.\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { VerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: VerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null }\n * ```\n */\nexport const VerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: InnerVerificationSchema,\n\t}),\n\tv.transform((v) => v.verification),\n);\n\n/**\n * Schema to extract the `verification` object from a Notion property (nullable).\n *\n * **Input:**\n * ```\n * {\n * verification: {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * state: \"unverified\" | \"verified\" | \"expired\";\n * date: DateObject | null;\n * verified_by: Person | null;\n * } | null\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { NullableVerificationSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Verification: NullableVerificationSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Verification: { state: \"unverified\" | \"verified\" | \"expired\"; date: DateObject | null; verified_by: Person | null } | null\n * ```\n */\nexport const NullableVerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: v.nullable(InnerVerificationSchema),\n\t}),\n\tv.transform((v) => v.verification),\n);\n"],"mappings":";;;;;;;AAKA,MAAM,0BAA0BA,QAAE,QAAQ,SAAS,CAClDA,QAAE,OAAO;CACR,OAAOA,QAAE,QAAQ,aAAa;CAC9B,MAAMA,QAAE,OAAO;CACf,aAAaA,QAAE,OAAO;CACtB,CAAC,EACFA,QAAE,OAAO;CACR,OAAOA,QAAE,MAAM,CAACA,QAAE,QAAQ,WAAW,EAAEA,QAAE,QAAQ,UAAU,CAAC,CAAC;CAC7D,MAAMA,QAAE,SAASC,8BAAiB;CAClC,aAAaD,QAAE,SAASE,4BAAa;CACrC,CAAC,CACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CF,MAAa,qBAAqBF,QAAE,KACnCA,QAAE,OAAO,EACR,cAAc,yBACd,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,aAAa,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CD,MAAa,6BAA6BA,QAAE,KAC3CA,QAAE,OAAO,EACR,cAAcA,QAAE,SAAS,wBAAwB,EACjD,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,aAAa,CAClC"}
|
package/dist/verification.d.cts
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/verification.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `verification` object from a Notion property.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* verification: {
|
|
12
|
+
* state: "unverified" | "verified" | "expired";
|
|
13
|
+
* date: DateObject | null;
|
|
14
|
+
* verified_by: Person | null;
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* **Output:**
|
|
20
|
+
* ```
|
|
21
|
+
* {
|
|
22
|
+
* state: "unverified" | "verified" | "expired";
|
|
23
|
+
* date: DateObject | null;
|
|
24
|
+
* verified_by: Person | null;
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import * as v from "valibot";
|
|
31
|
+
* import { VerificationSchema } from "@nakanoaas/notion-valibot-schema";
|
|
32
|
+
*
|
|
33
|
+
* const PageSchema = v.object({
|
|
34
|
+
* id: v.string(),
|
|
35
|
+
* properties: v.object({
|
|
36
|
+
* Verification: VerificationSchema,
|
|
37
|
+
* }),
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
41
|
+
* const parsed = v.parse(PageSchema, page);
|
|
42
|
+
* // parsed.properties.Verification: { state: "unverified" | "verified" | "expired"; date: DateObject | null; verified_by: Person | null }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
4
45
|
declare const VerificationSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
46
|
readonly verification: v.VariantSchema<"state", [v.ObjectSchema<{
|
|
6
47
|
readonly state: v.LiteralSchema<"unverified", undefined>;
|
|
@@ -54,6 +95,46 @@ declare const VerificationSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
54
95
|
name: string | null;
|
|
55
96
|
} | null;
|
|
56
97
|
}>]>;
|
|
98
|
+
/**
|
|
99
|
+
* Schema to extract the `verification` object from a Notion property (nullable).
|
|
100
|
+
*
|
|
101
|
+
* **Input:**
|
|
102
|
+
* ```
|
|
103
|
+
* {
|
|
104
|
+
* verification: {
|
|
105
|
+
* state: "unverified" | "verified" | "expired";
|
|
106
|
+
* date: DateObject | null;
|
|
107
|
+
* verified_by: Person | null;
|
|
108
|
+
* } | null
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* **Output:**
|
|
113
|
+
* ```
|
|
114
|
+
* {
|
|
115
|
+
* state: "unverified" | "verified" | "expired";
|
|
116
|
+
* date: DateObject | null;
|
|
117
|
+
* verified_by: Person | null;
|
|
118
|
+
* } | null
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import * as v from "valibot";
|
|
124
|
+
* import { NullableVerificationSchema } from "@nakanoaas/notion-valibot-schema";
|
|
125
|
+
*
|
|
126
|
+
* const PageSchema = v.object({
|
|
127
|
+
* id: v.string(),
|
|
128
|
+
* properties: v.object({
|
|
129
|
+
* Verification: NullableVerificationSchema,
|
|
130
|
+
* }),
|
|
131
|
+
* });
|
|
132
|
+
*
|
|
133
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
134
|
+
* const parsed = v.parse(PageSchema, page);
|
|
135
|
+
* // parsed.properties.Verification: { state: "unverified" | "verified" | "expired"; date: DateObject | null; verified_by: Person | null } | null
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
57
138
|
declare const NullableVerificationSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
58
139
|
readonly verification: v.NullableSchema<v.VariantSchema<"state", [v.ObjectSchema<{
|
|
59
140
|
readonly state: v.LiteralSchema<"unverified", undefined>;
|