@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/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
|
@@ -14,7 +14,87 @@ const InnerVerificationSchema = valibot.variant("state", [valibot.object({
|
|
|
14
14
|
date: valibot.nullable(require_date.DateObjectSchema),
|
|
15
15
|
verified_by: valibot.nullable(require_people.PersonSchema)
|
|
16
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
|
+
*/
|
|
17
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
|
+
*/
|
|
18
98
|
const NullableVerificationSchema = valibot.pipe(valibot.object({ verification: valibot.nullable(InnerVerificationSchema) }), valibot.transform((v) => v.verification));
|
|
19
99
|
|
|
20
100
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
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\nexport const VerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: InnerVerificationSchema,\n\t}),\n\tv.transform((v) => v.verification),\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
|
|
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>;
|
package/dist/verification.d.mts
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>;
|
package/dist/verification.mjs
CHANGED
|
@@ -12,7 +12,87 @@ const InnerVerificationSchema = v.variant("state", [v.object({
|
|
|
12
12
|
date: v.nullable(DateObjectSchema),
|
|
13
13
|
verified_by: v.nullable(PersonSchema)
|
|
14
14
|
})]);
|
|
15
|
+
/**
|
|
16
|
+
* Schema to extract the `verification` object from a Notion property.
|
|
17
|
+
*
|
|
18
|
+
* **Input:**
|
|
19
|
+
* ```
|
|
20
|
+
* {
|
|
21
|
+
* verification: {
|
|
22
|
+
* state: "unverified" | "verified" | "expired";
|
|
23
|
+
* date: DateObject | null;
|
|
24
|
+
* verified_by: Person | null;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* **Output:**
|
|
30
|
+
* ```
|
|
31
|
+
* {
|
|
32
|
+
* state: "unverified" | "verified" | "expired";
|
|
33
|
+
* date: DateObject | null;
|
|
34
|
+
* verified_by: Person | null;
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* import * as v from "valibot";
|
|
41
|
+
* import { VerificationSchema } from "@nakanoaas/notion-valibot-schema";
|
|
42
|
+
*
|
|
43
|
+
* const PageSchema = v.object({
|
|
44
|
+
* id: v.string(),
|
|
45
|
+
* properties: v.object({
|
|
46
|
+
* Verification: VerificationSchema,
|
|
47
|
+
* }),
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
51
|
+
* const parsed = v.parse(PageSchema, page);
|
|
52
|
+
* // parsed.properties.Verification: { state: "unverified" | "verified" | "expired"; date: DateObject | null; verified_by: Person | null }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
15
55
|
const VerificationSchema = v.pipe(v.object({ verification: InnerVerificationSchema }), v.transform((v$1) => v$1.verification));
|
|
56
|
+
/**
|
|
57
|
+
* Schema to extract the `verification` object from a Notion property (nullable).
|
|
58
|
+
*
|
|
59
|
+
* **Input:**
|
|
60
|
+
* ```
|
|
61
|
+
* {
|
|
62
|
+
* verification: {
|
|
63
|
+
* state: "unverified" | "verified" | "expired";
|
|
64
|
+
* date: DateObject | null;
|
|
65
|
+
* verified_by: Person | null;
|
|
66
|
+
* } | null
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* **Output:**
|
|
71
|
+
* ```
|
|
72
|
+
* {
|
|
73
|
+
* state: "unverified" | "verified" | "expired";
|
|
74
|
+
* date: DateObject | null;
|
|
75
|
+
* verified_by: Person | null;
|
|
76
|
+
* } | null
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import * as v from "valibot";
|
|
82
|
+
* import { NullableVerificationSchema } from "@nakanoaas/notion-valibot-schema";
|
|
83
|
+
*
|
|
84
|
+
* const PageSchema = v.object({
|
|
85
|
+
* id: v.string(),
|
|
86
|
+
* properties: v.object({
|
|
87
|
+
* Verification: NullableVerificationSchema,
|
|
88
|
+
* }),
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
92
|
+
* const parsed = v.parse(PageSchema, page);
|
|
93
|
+
* // parsed.properties.Verification: { state: "unverified" | "verified" | "expired"; date: DateObject | null; verified_by: Person | null } | null
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
16
96
|
const NullableVerificationSchema = v.pipe(v.object({ verification: v.nullable(InnerVerificationSchema) }), v.transform((v$1) => v$1.verification));
|
|
17
97
|
|
|
18
98
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification.mjs","names":["v"],"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\nexport const VerificationSchema = v.pipe(\n\tv.object({\n\t\tverification: InnerVerificationSchema,\n\t}),\n\tv.transform((v) => v.verification),\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,0BAA0B,EAAE,QAAQ,SAAS,CAClD,EAAE,OAAO;CACR,OAAO,EAAE,QAAQ,aAAa;CAC9B,MAAM,EAAE,OAAO;CACf,aAAa,EAAE,OAAO;CACtB,CAAC,EACF,EAAE,OAAO;CACR,OAAO,EAAE,MAAM,CAAC,EAAE,QAAQ,WAAW,EAAE,EAAE,QAAQ,UAAU,CAAC,CAAC;CAC7D,MAAM,EAAE,SAAS,iBAAiB;CAClC,aAAa,EAAE,SAAS,aAAa;CACrC,CAAC,CACF,CAAC
|
|
1
|
+
{"version":3,"file":"verification.mjs","names":["v"],"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,0BAA0B,EAAE,QAAQ,SAAS,CAClD,EAAE,OAAO;CACR,OAAO,EAAE,QAAQ,aAAa;CAC9B,MAAM,EAAE,OAAO;CACf,aAAa,EAAE,OAAO;CACtB,CAAC,EACF,EAAE,OAAO;CACR,OAAO,EAAE,MAAM,CAAC,EAAE,QAAQ,WAAW,EAAE,EAAE,QAAQ,UAAU,CAAC,CAAC;CAC7D,MAAM,EAAE,SAAS,iBAAiB;CAClC,aAAa,EAAE,SAAS,aAAa;CACrC,CAAC,CACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CF,MAAa,qBAAqB,EAAE,KACnC,EAAE,OAAO,EACR,cAAc,yBACd,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,aAAa,CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CD,MAAa,6BAA6B,EAAE,KAC3C,EAAE,OAAO,EACR,cAAc,EAAE,SAAS,wBAAwB,EACjD,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,aAAa,CAClC"}
|