@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/checkbox.cjs
CHANGED
|
@@ -3,6 +3,35 @@ let valibot = require("valibot");
|
|
|
3
3
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
4
4
|
|
|
5
5
|
//#region src/checkbox.ts
|
|
6
|
+
/**
|
|
7
|
+
* Schema to extract the `checkbox` property from a Notion page property.
|
|
8
|
+
*
|
|
9
|
+
* **Input:**
|
|
10
|
+
* ```
|
|
11
|
+
* {
|
|
12
|
+
* checkbox: boolean;
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* **Output:** `boolean`
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import * as v from "valibot";
|
|
21
|
+
* import { CheckboxSchema } from "@nakanoaas/notion-valibot-utils";
|
|
22
|
+
*
|
|
23
|
+
* const PageSchema = v.object({
|
|
24
|
+
* id: v.string(),
|
|
25
|
+
* properties: v.object({
|
|
26
|
+
* Checkbox: CheckboxSchema,
|
|
27
|
+
* }),
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
31
|
+
* const parsed = v.parse(PageSchema, page);
|
|
32
|
+
* // parsed.properties.Checkbox: boolean
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
6
35
|
const CheckboxSchema = valibot.pipe(valibot.object({ checkbox: valibot.boolean() }), valibot.transform((v) => v.checkbox));
|
|
7
36
|
|
|
8
37
|
//#endregion
|
package/dist/checkbox.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.cjs","names":["v"],"sources":["../src/checkbox.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const CheckboxSchema = v.pipe(\n\tv.object({\n\t\tcheckbox: v.boolean(),\n\t}),\n\tv.transform((v) => v.checkbox),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkbox.cjs","names":["v"],"sources":["../src/checkbox.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `checkbox` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * checkbox: boolean;\n * }\n * ```\n *\n * **Output:** `boolean`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CheckboxSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Checkbox: CheckboxSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Checkbox: boolean\n * ```\n */\nexport const CheckboxSchema = v.pipe(\n\tv.object({\n\t\tcheckbox: v.boolean(),\n\t}),\n\tv.transform((v) => v.checkbox),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,iBAAiBA,QAAE,KAC/BA,QAAE,OAAO,EACR,UAAUA,QAAE,SAAS,EACrB,CAAC,EACFA,QAAE,WAAW,MAAM,EAAE,SAAS,CAC9B"}
|
package/dist/checkbox.d.cts
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/checkbox.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `checkbox` property from a Notion page property.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* checkbox: boolean;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Output:** `boolean`
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import * as v from "valibot";
|
|
20
|
+
* import { CheckboxSchema } from "@nakanoaas/notion-valibot-utils";
|
|
21
|
+
*
|
|
22
|
+
* const PageSchema = v.object({
|
|
23
|
+
* id: v.string(),
|
|
24
|
+
* properties: v.object({
|
|
25
|
+
* Checkbox: CheckboxSchema,
|
|
26
|
+
* }),
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
30
|
+
* const parsed = v.parse(PageSchema, page);
|
|
31
|
+
* // parsed.properties.Checkbox: boolean
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
4
34
|
declare const CheckboxSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
35
|
readonly checkbox: v.BooleanSchema<undefined>;
|
|
6
36
|
}, undefined>, v.TransformAction<{
|
package/dist/checkbox.d.mts
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/checkbox.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `checkbox` property from a Notion page property.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* checkbox: boolean;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Output:** `boolean`
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import * as v from "valibot";
|
|
20
|
+
* import { CheckboxSchema } from "@nakanoaas/notion-valibot-utils";
|
|
21
|
+
*
|
|
22
|
+
* const PageSchema = v.object({
|
|
23
|
+
* id: v.string(),
|
|
24
|
+
* properties: v.object({
|
|
25
|
+
* Checkbox: CheckboxSchema,
|
|
26
|
+
* }),
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
30
|
+
* const parsed = v.parse(PageSchema, page);
|
|
31
|
+
* // parsed.properties.Checkbox: boolean
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
4
34
|
declare const CheckboxSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
35
|
readonly checkbox: v.BooleanSchema<undefined>;
|
|
6
36
|
}, undefined>, v.TransformAction<{
|
package/dist/checkbox.mjs
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/checkbox.ts
|
|
4
|
+
/**
|
|
5
|
+
* Schema to extract the `checkbox` property from a Notion page property.
|
|
6
|
+
*
|
|
7
|
+
* **Input:**
|
|
8
|
+
* ```
|
|
9
|
+
* {
|
|
10
|
+
* checkbox: boolean;
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* **Output:** `boolean`
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import * as v from "valibot";
|
|
19
|
+
* import { CheckboxSchema } from "@nakanoaas/notion-valibot-utils";
|
|
20
|
+
*
|
|
21
|
+
* const PageSchema = v.object({
|
|
22
|
+
* id: v.string(),
|
|
23
|
+
* properties: v.object({
|
|
24
|
+
* Checkbox: CheckboxSchema,
|
|
25
|
+
* }),
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
29
|
+
* const parsed = v.parse(PageSchema, page);
|
|
30
|
+
* // parsed.properties.Checkbox: boolean
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
4
33
|
const CheckboxSchema = v.pipe(v.object({ checkbox: v.boolean() }), v.transform((v$1) => v$1.checkbox));
|
|
5
34
|
|
|
6
35
|
//#endregion
|
package/dist/checkbox.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.mjs","names":["v"],"sources":["../src/checkbox.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const CheckboxSchema = v.pipe(\n\tv.object({\n\t\tcheckbox: v.boolean(),\n\t}),\n\tv.transform((v) => v.checkbox),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkbox.mjs","names":["v"],"sources":["../src/checkbox.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `checkbox` property from a Notion page property.\n *\n * **Input:**\n * ```\n * {\n * checkbox: boolean;\n * }\n * ```\n *\n * **Output:** `boolean`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CheckboxSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * Checkbox: CheckboxSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.Checkbox: boolean\n * ```\n */\nexport const CheckboxSchema = v.pipe(\n\tv.object({\n\t\tcheckbox: v.boolean(),\n\t}),\n\tv.transform((v) => v.checkbox),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,iBAAiB,EAAE,KAC/B,EAAE,OAAO,EACR,UAAU,EAAE,SAAS,EACrB,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,SAAS,CAC9B"}
|
package/dist/created-by.cjs
CHANGED
|
@@ -4,7 +4,82 @@ let valibot = require("valibot");
|
|
|
4
4
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
5
5
|
|
|
6
6
|
//#region src/created-by.ts
|
|
7
|
+
/**
|
|
8
|
+
* Schema to extract the `created_by` person object from a Notion page.
|
|
9
|
+
*
|
|
10
|
+
* **Input:**
|
|
11
|
+
* ```
|
|
12
|
+
* {
|
|
13
|
+
* created_by: {
|
|
14
|
+
* id: string;
|
|
15
|
+
* object: "user" | "bot" | "group";
|
|
16
|
+
* name: string | null;
|
|
17
|
+
* ...
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* **Output:**
|
|
23
|
+
* ```
|
|
24
|
+
* {
|
|
25
|
+
* id: string;
|
|
26
|
+
* object: "user" | "bot" | "group";
|
|
27
|
+
* name: string | null;
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import * as v from "valibot";
|
|
34
|
+
* import { CreatedBySchema } from "@nakanoaas/notion-valibot-schema";
|
|
35
|
+
*
|
|
36
|
+
* const PageSchema = v.object({
|
|
37
|
+
* id: v.string(),
|
|
38
|
+
* properties: v.object({
|
|
39
|
+
* CreatedBy: CreatedBySchema,
|
|
40
|
+
* }),
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
44
|
+
* const parsed = v.parse(PageSchema, page);
|
|
45
|
+
* // parsed.properties.CreatedBy: { id: string; object: "user" | "bot" | "group"; name: string | null }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
7
48
|
const CreatedBySchema = valibot.pipe(valibot.object({ created_by: require_people.PersonSchema }), valibot.transform((v) => v.created_by));
|
|
49
|
+
/**
|
|
50
|
+
* Schema to extract the `created_by` person ID from a Notion page.
|
|
51
|
+
*
|
|
52
|
+
* **Input:**
|
|
53
|
+
* ```
|
|
54
|
+
* {
|
|
55
|
+
* created_by: {
|
|
56
|
+
* id: string;
|
|
57
|
+
* object: "user" | "bot" | "group";
|
|
58
|
+
* name: string | null;
|
|
59
|
+
* ...
|
|
60
|
+
* }
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* **Output:** `string`
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import * as v from "valibot";
|
|
69
|
+
* import { CreatedByIdSchema } from "@nakanoaas/notion-valibot-schema";
|
|
70
|
+
*
|
|
71
|
+
* const PageSchema = v.object({
|
|
72
|
+
* id: v.string(),
|
|
73
|
+
* properties: v.object({
|
|
74
|
+
* CreatedById: CreatedByIdSchema,
|
|
75
|
+
* }),
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
79
|
+
* const parsed = v.parse(PageSchema, page);
|
|
80
|
+
* // parsed.properties.CreatedById: string
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
8
83
|
const CreatedByIdSchema = valibot.pipe(valibot.object({ created_by: require_people.PersonSchema }), valibot.transform((v) => v.created_by.id));
|
|
9
84
|
|
|
10
85
|
//#endregion
|
package/dist/created-by.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"created-by.cjs","names":["v","PersonSchema"],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\nexport const CreatedBySchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by),\n);\n\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"created-by.cjs","names":["v","PersonSchema"],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `created_by` person object from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedBySchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedBy: CreatedBySchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedBy: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n */\nexport const CreatedBySchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by),\n);\n\n/**\n * Schema to extract the `created_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedById: CreatedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedById: string\n * ```\n */\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkBA,QAAE,KAChCA,QAAE,OAAO,EACR,YAAYC,6BACZ,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,WAAW,CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,oBAAoBA,QAAE,KAClCA,QAAE,OAAO,EACR,YAAYC,6BACZ,CAAC,EACFD,QAAE,WAAW,MAAM,EAAE,WAAW,GAAG,CACnC"}
|
package/dist/created-by.d.cts
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/created-by.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `created_by` person object from a Notion page.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* created_by: {
|
|
12
|
+
* id: string;
|
|
13
|
+
* object: "user" | "bot" | "group";
|
|
14
|
+
* name: string | null;
|
|
15
|
+
* ...
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* **Output:**
|
|
21
|
+
* ```
|
|
22
|
+
* {
|
|
23
|
+
* id: string;
|
|
24
|
+
* object: "user" | "bot" | "group";
|
|
25
|
+
* name: string | null;
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import * as v from "valibot";
|
|
32
|
+
* import { CreatedBySchema } from "@nakanoaas/notion-valibot-schema";
|
|
33
|
+
*
|
|
34
|
+
* const PageSchema = v.object({
|
|
35
|
+
* id: v.string(),
|
|
36
|
+
* properties: v.object({
|
|
37
|
+
* CreatedBy: CreatedBySchema,
|
|
38
|
+
* }),
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
42
|
+
* const parsed = v.parse(PageSchema, page);
|
|
43
|
+
* // parsed.properties.CreatedBy: { id: string; object: "user" | "bot" | "group"; name: string | null }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
4
46
|
declare const CreatedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
47
|
readonly created_by: v.ObjectSchema<{
|
|
6
48
|
readonly id: v.StringSchema<undefined>;
|
|
@@ -18,6 +60,40 @@ declare const CreatedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
18
60
|
object: "user" | "bot" | "group";
|
|
19
61
|
name: string | null;
|
|
20
62
|
}>]>;
|
|
63
|
+
/**
|
|
64
|
+
* Schema to extract the `created_by` person ID from a Notion page.
|
|
65
|
+
*
|
|
66
|
+
* **Input:**
|
|
67
|
+
* ```
|
|
68
|
+
* {
|
|
69
|
+
* created_by: {
|
|
70
|
+
* id: string;
|
|
71
|
+
* object: "user" | "bot" | "group";
|
|
72
|
+
* name: string | null;
|
|
73
|
+
* ...
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* **Output:** `string`
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import * as v from "valibot";
|
|
83
|
+
* import { CreatedByIdSchema } from "@nakanoaas/notion-valibot-schema";
|
|
84
|
+
*
|
|
85
|
+
* const PageSchema = v.object({
|
|
86
|
+
* id: v.string(),
|
|
87
|
+
* properties: v.object({
|
|
88
|
+
* CreatedById: CreatedByIdSchema,
|
|
89
|
+
* }),
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
93
|
+
* const parsed = v.parse(PageSchema, page);
|
|
94
|
+
* // parsed.properties.CreatedById: string
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
21
97
|
declare const CreatedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
22
98
|
readonly created_by: v.ObjectSchema<{
|
|
23
99
|
readonly id: v.StringSchema<undefined>;
|
package/dist/created-by.d.mts
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/created-by.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `created_by` person object from a Notion page.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* created_by: {
|
|
12
|
+
* id: string;
|
|
13
|
+
* object: "user" | "bot" | "group";
|
|
14
|
+
* name: string | null;
|
|
15
|
+
* ...
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* **Output:**
|
|
21
|
+
* ```
|
|
22
|
+
* {
|
|
23
|
+
* id: string;
|
|
24
|
+
* object: "user" | "bot" | "group";
|
|
25
|
+
* name: string | null;
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import * as v from "valibot";
|
|
32
|
+
* import { CreatedBySchema } from "@nakanoaas/notion-valibot-schema";
|
|
33
|
+
*
|
|
34
|
+
* const PageSchema = v.object({
|
|
35
|
+
* id: v.string(),
|
|
36
|
+
* properties: v.object({
|
|
37
|
+
* CreatedBy: CreatedBySchema,
|
|
38
|
+
* }),
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
42
|
+
* const parsed = v.parse(PageSchema, page);
|
|
43
|
+
* // parsed.properties.CreatedBy: { id: string; object: "user" | "bot" | "group"; name: string | null }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
4
46
|
declare const CreatedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
47
|
readonly created_by: v.ObjectSchema<{
|
|
6
48
|
readonly id: v.StringSchema<undefined>;
|
|
@@ -18,6 +60,40 @@ declare const CreatedBySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
18
60
|
object: "user" | "bot" | "group";
|
|
19
61
|
name: string | null;
|
|
20
62
|
}>]>;
|
|
63
|
+
/**
|
|
64
|
+
* Schema to extract the `created_by` person ID from a Notion page.
|
|
65
|
+
*
|
|
66
|
+
* **Input:**
|
|
67
|
+
* ```
|
|
68
|
+
* {
|
|
69
|
+
* created_by: {
|
|
70
|
+
* id: string;
|
|
71
|
+
* object: "user" | "bot" | "group";
|
|
72
|
+
* name: string | null;
|
|
73
|
+
* ...
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* **Output:** `string`
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import * as v from "valibot";
|
|
83
|
+
* import { CreatedByIdSchema } from "@nakanoaas/notion-valibot-schema";
|
|
84
|
+
*
|
|
85
|
+
* const PageSchema = v.object({
|
|
86
|
+
* id: v.string(),
|
|
87
|
+
* properties: v.object({
|
|
88
|
+
* CreatedById: CreatedByIdSchema,
|
|
89
|
+
* }),
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
93
|
+
* const parsed = v.parse(PageSchema, page);
|
|
94
|
+
* // parsed.properties.CreatedById: string
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
21
97
|
declare const CreatedByIdSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
22
98
|
readonly created_by: v.ObjectSchema<{
|
|
23
99
|
readonly id: v.StringSchema<undefined>;
|
package/dist/created-by.mjs
CHANGED
|
@@ -2,7 +2,82 @@ import { PersonSchema } from "./people.mjs";
|
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
|
|
4
4
|
//#region src/created-by.ts
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `created_by` person object from a Notion page.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* created_by: {
|
|
12
|
+
* id: string;
|
|
13
|
+
* object: "user" | "bot" | "group";
|
|
14
|
+
* name: string | null;
|
|
15
|
+
* ...
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* **Output:**
|
|
21
|
+
* ```
|
|
22
|
+
* {
|
|
23
|
+
* id: string;
|
|
24
|
+
* object: "user" | "bot" | "group";
|
|
25
|
+
* name: string | null;
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import * as v from "valibot";
|
|
32
|
+
* import { CreatedBySchema } from "@nakanoaas/notion-valibot-schema";
|
|
33
|
+
*
|
|
34
|
+
* const PageSchema = v.object({
|
|
35
|
+
* id: v.string(),
|
|
36
|
+
* properties: v.object({
|
|
37
|
+
* CreatedBy: CreatedBySchema,
|
|
38
|
+
* }),
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
42
|
+
* const parsed = v.parse(PageSchema, page);
|
|
43
|
+
* // parsed.properties.CreatedBy: { id: string; object: "user" | "bot" | "group"; name: string | null }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
5
46
|
const CreatedBySchema = v.pipe(v.object({ created_by: PersonSchema }), v.transform((v$1) => v$1.created_by));
|
|
47
|
+
/**
|
|
48
|
+
* Schema to extract the `created_by` person ID from a Notion page.
|
|
49
|
+
*
|
|
50
|
+
* **Input:**
|
|
51
|
+
* ```
|
|
52
|
+
* {
|
|
53
|
+
* created_by: {
|
|
54
|
+
* id: string;
|
|
55
|
+
* object: "user" | "bot" | "group";
|
|
56
|
+
* name: string | null;
|
|
57
|
+
* ...
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* **Output:** `string`
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import * as v from "valibot";
|
|
67
|
+
* import { CreatedByIdSchema } from "@nakanoaas/notion-valibot-schema";
|
|
68
|
+
*
|
|
69
|
+
* const PageSchema = v.object({
|
|
70
|
+
* id: v.string(),
|
|
71
|
+
* properties: v.object({
|
|
72
|
+
* CreatedById: CreatedByIdSchema,
|
|
73
|
+
* }),
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
77
|
+
* const parsed = v.parse(PageSchema, page);
|
|
78
|
+
* // parsed.properties.CreatedById: string
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
6
81
|
const CreatedByIdSchema = v.pipe(v.object({ created_by: PersonSchema }), v.transform((v$1) => v$1.created_by.id));
|
|
7
82
|
|
|
8
83
|
//#endregion
|
package/dist/created-by.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"created-by.mjs","names":["v"],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\nexport const CreatedBySchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by),\n);\n\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"created-by.mjs","names":["v"],"sources":["../src/created-by.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nimport { PersonSchema } from \"./people\";\n\n/**\n * Schema to extract the `created_by` person object from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:**\n * ```\n * {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * }\n * ```\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedBySchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedBy: CreatedBySchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedBy: { id: string; object: \"user\" | \"bot\" | \"group\"; name: string | null }\n * ```\n */\nexport const CreatedBySchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by),\n);\n\n/**\n * Schema to extract the `created_by` person ID from a Notion page.\n *\n * **Input:**\n * ```\n * {\n * created_by: {\n * id: string;\n * object: \"user\" | \"bot\" | \"group\";\n * name: string | null;\n * ...\n * }\n * }\n * ```\n *\n * **Output:** `string`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedByIdSchema } from \"@nakanoaas/notion-valibot-schema\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * properties: v.object({\n * CreatedById: CreatedByIdSchema,\n * }),\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.properties.CreatedById: string\n * ```\n */\nexport const CreatedByIdSchema = v.pipe(\n\tv.object({\n\t\tcreated_by: PersonSchema,\n\t}),\n\tv.transform((v) => v.created_by.id),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB,EAAE,KAChC,EAAE,OAAO,EACR,YAAY,cACZ,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,WAAW,CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAa,oBAAoB,EAAE,KAClC,EAAE,OAAO,EACR,YAAY,cACZ,CAAC,EACF,EAAE,WAAW,QAAMA,IAAE,WAAW,GAAG,CACnC"}
|
package/dist/created-time.cjs
CHANGED
|
@@ -3,6 +3,33 @@ let valibot = require("valibot");
|
|
|
3
3
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
4
4
|
|
|
5
5
|
//#region src/created-time.ts
|
|
6
|
+
/**
|
|
7
|
+
* Schema to extract the `created_time` property from a Notion page and transform it to a `Date` object.
|
|
8
|
+
*
|
|
9
|
+
* **Input:**
|
|
10
|
+
* ```
|
|
11
|
+
* {
|
|
12
|
+
* created_time: string;
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* **Output:** `Date`
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import * as v from "valibot";
|
|
21
|
+
* import { CreatedTimeSchema } from "@nakanoaas/notion-valibot-utils";
|
|
22
|
+
*
|
|
23
|
+
* const PageSchema = v.object({
|
|
24
|
+
* id: v.string(),
|
|
25
|
+
* created_time: CreatedTimeSchema,
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
29
|
+
* const parsed = v.parse(PageSchema, page);
|
|
30
|
+
* // parsed.created_time: Date
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
6
33
|
const CreatedTimeSchema = valibot.pipe(valibot.object({ created_time: valibot.string() }), valibot.transform((v) => new Date(v.created_time)));
|
|
7
34
|
|
|
8
35
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"created-time.cjs","names":["v"],"sources":["../src/created-time.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const CreatedTimeSchema = v.pipe(\n\tv.object({\n\t\tcreated_time: v.string(),\n\t}),\n\tv.transform((v) => new Date(v.created_time)),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"created-time.cjs","names":["v"],"sources":["../src/created-time.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `created_time` property from a Notion page and transform it to a `Date` object.\n *\n * **Input:**\n * ```\n * {\n * created_time: string;\n * }\n * ```\n *\n * **Output:** `Date`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedTimeSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * created_time: CreatedTimeSchema,\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.created_time: Date\n * ```\n */\nexport const CreatedTimeSchema = v.pipe(\n\tv.object({\n\t\tcreated_time: v.string(),\n\t}),\n\tv.transform((v) => new Date(v.created_time)),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,oBAAoBA,QAAE,KAClCA,QAAE,OAAO,EACR,cAAcA,QAAE,QAAQ,EACxB,CAAC,EACFA,QAAE,WAAW,MAAM,IAAI,KAAK,EAAE,aAAa,CAAC,CAC5C"}
|
package/dist/created-time.d.cts
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/created-time.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `created_time` property from a Notion page and transform it to a `Date` object.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* created_time: string;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Output:** `Date`
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import * as v from "valibot";
|
|
20
|
+
* import { CreatedTimeSchema } from "@nakanoaas/notion-valibot-utils";
|
|
21
|
+
*
|
|
22
|
+
* const PageSchema = v.object({
|
|
23
|
+
* id: v.string(),
|
|
24
|
+
* created_time: CreatedTimeSchema,
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
28
|
+
* const parsed = v.parse(PageSchema, page);
|
|
29
|
+
* // parsed.created_time: Date
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
4
32
|
declare const CreatedTimeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
33
|
readonly created_time: v.StringSchema<undefined>;
|
|
6
34
|
}, undefined>, v.TransformAction<{
|
package/dist/created-time.d.mts
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/created-time.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Schema to extract the `created_time` property from a Notion page and transform it to a `Date` object.
|
|
7
|
+
*
|
|
8
|
+
* **Input:**
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* created_time: string;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Output:** `Date`
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import * as v from "valibot";
|
|
20
|
+
* import { CreatedTimeSchema } from "@nakanoaas/notion-valibot-utils";
|
|
21
|
+
*
|
|
22
|
+
* const PageSchema = v.object({
|
|
23
|
+
* id: v.string(),
|
|
24
|
+
* created_time: CreatedTimeSchema,
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
28
|
+
* const parsed = v.parse(PageSchema, page);
|
|
29
|
+
* // parsed.created_time: Date
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
4
32
|
declare const CreatedTimeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
5
33
|
readonly created_time: v.StringSchema<undefined>;
|
|
6
34
|
}, undefined>, v.TransformAction<{
|
package/dist/created-time.mjs
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
3
|
//#region src/created-time.ts
|
|
4
|
+
/**
|
|
5
|
+
* Schema to extract the `created_time` property from a Notion page and transform it to a `Date` object.
|
|
6
|
+
*
|
|
7
|
+
* **Input:**
|
|
8
|
+
* ```
|
|
9
|
+
* {
|
|
10
|
+
* created_time: string;
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* **Output:** `Date`
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import * as v from "valibot";
|
|
19
|
+
* import { CreatedTimeSchema } from "@nakanoaas/notion-valibot-utils";
|
|
20
|
+
*
|
|
21
|
+
* const PageSchema = v.object({
|
|
22
|
+
* id: v.string(),
|
|
23
|
+
* created_time: CreatedTimeSchema,
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const page = await notion.pages.retrieve({ page_id: "..." });
|
|
27
|
+
* const parsed = v.parse(PageSchema, page);
|
|
28
|
+
* // parsed.created_time: Date
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
4
31
|
const CreatedTimeSchema = v.pipe(v.object({ created_time: v.string() }), v.transform((v$1) => new Date(v$1.created_time)));
|
|
5
32
|
|
|
6
33
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"created-time.mjs","names":["v"],"sources":["../src/created-time.ts"],"sourcesContent":["import * as v from \"valibot\";\n\nexport const CreatedTimeSchema = v.pipe(\n\tv.object({\n\t\tcreated_time: v.string(),\n\t}),\n\tv.transform((v) => new Date(v.created_time)),\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"created-time.mjs","names":["v"],"sources":["../src/created-time.ts"],"sourcesContent":["import * as v from \"valibot\";\n\n/**\n * Schema to extract the `created_time` property from a Notion page and transform it to a `Date` object.\n *\n * **Input:**\n * ```\n * {\n * created_time: string;\n * }\n * ```\n *\n * **Output:** `Date`\n *\n * @example\n * ```ts\n * import * as v from \"valibot\";\n * import { CreatedTimeSchema } from \"@nakanoaas/notion-valibot-utils\";\n *\n * const PageSchema = v.object({\n * id: v.string(),\n * created_time: CreatedTimeSchema,\n * });\n *\n * const page = await notion.pages.retrieve({ page_id: \"...\" });\n * const parsed = v.parse(PageSchema, page);\n * // parsed.created_time: Date\n * ```\n */\nexport const CreatedTimeSchema = v.pipe(\n\tv.object({\n\t\tcreated_time: v.string(),\n\t}),\n\tv.transform((v) => new Date(v.created_time)),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,oBAAoB,EAAE,KAClC,EAAE,OAAO,EACR,cAAc,EAAE,QAAQ,EACxB,CAAC,EACF,EAAE,WAAW,QAAM,IAAI,KAAKA,IAAE,aAAa,CAAC,CAC5C"}
|