@visus-io/notion-sdk-ts 3.1.0 → 3.1.1
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 +17 -85
- package/dist/api/asyncTasks.api.d.ts +5 -3
- package/dist/api/asyncTasks.api.js +5 -3
- package/dist/api/base.api.d.ts +15 -4
- package/dist/api/base.api.js +19 -8
- package/dist/api/blocks.api.d.ts +2 -0
- package/dist/api/blocks.api.js +5 -2
- package/dist/api/comments.api.d.ts +2 -0
- package/dist/api/comments.api.js +2 -0
- package/dist/api/customEmojis.api.d.ts +2 -0
- package/dist/api/customEmojis.api.js +2 -0
- package/dist/api/dataSources.api.d.ts +5 -3
- package/dist/api/dataSources.api.js +4 -1
- package/dist/api/databases.api.d.ts +7 -5
- package/dist/api/databases.api.js +4 -1
- package/dist/api/fileUploads.api.d.ts +7 -4
- package/dist/api/fileUploads.api.js +11 -7
- package/dist/api/pages.api.d.ts +5 -3
- package/dist/api/pages.api.js +5 -3
- package/dist/api/search.api.d.ts +4 -2
- package/dist/api/search.api.js +5 -2
- package/dist/api/users.api.d.ts +2 -0
- package/dist/api/users.api.js +2 -0
- package/dist/api/views.api.d.ts +15 -13
- package/dist/api/views.api.js +10 -7
- package/dist/client.d.ts +17 -17
- package/dist/client.js +22 -27
- package/dist/errors.d.ts +14 -4
- package/dist/errors.js +10 -4
- package/dist/helpers/block.helpers.d.ts +22 -15
- package/dist/helpers/block.helpers.js +14 -12
- package/dist/helpers/file.helpers.d.ts +12 -6
- package/dist/helpers/file.helpers.js +12 -6
- package/dist/helpers/filter.helpers.d.ts +2 -0
- package/dist/helpers/filter.helpers.js +2 -0
- package/dist/helpers/pagination.helpers.d.ts +52 -36
- package/dist/helpers/pagination.helpers.js +49 -29
- package/dist/helpers/parent.helpers.d.ts +5 -3
- package/dist/helpers/parent.helpers.js +5 -3
- package/dist/helpers/property.helpers.d.ts +2 -0
- package/dist/helpers/property.helpers.js +3 -1
- package/dist/helpers/richText.helpers.d.ts +10 -5
- package/dist/helpers/richText.helpers.js +11 -6
- package/dist/helpers/sort.helpers.d.ts +2 -0
- package/dist/helpers/sort.helpers.js +2 -0
- package/dist/helpers/webhook.helpers.d.ts +14 -12
- package/dist/helpers/webhook.helpers.js +17 -15
- package/dist/models/asyncTask.model.d.ts +8 -6
- package/dist/models/asyncTask.model.js +8 -6
- package/dist/models/base.model.d.ts +16 -4
- package/dist/models/base.model.js +17 -5
- package/dist/models/block.model.d.ts +6 -2
- package/dist/models/block.model.js +48 -36
- package/dist/models/comment.model.d.ts +4 -2
- package/dist/models/comment.model.js +4 -2
- package/dist/models/customEmoji.model.d.ts +7 -5
- package/dist/models/customEmoji.model.js +7 -5
- package/dist/models/dataSource.model.d.ts +4 -2
- package/dist/models/dataSource.model.js +4 -2
- package/dist/models/database.model.d.ts +6 -2
- package/dist/models/database.model.js +8 -4
- package/dist/models/fileUpload.model.d.ts +6 -4
- package/dist/models/fileUpload.model.js +6 -4
- package/dist/models/page.model.d.ts +6 -2
- package/dist/models/page.model.js +8 -4
- package/dist/models/richText.model.d.ts +3 -1
- package/dist/models/richText.model.js +3 -1
- package/dist/models/user.model.d.ts +4 -2
- package/dist/models/user.model.js +4 -2
- package/dist/models/view.model.d.ts +9 -7
- package/dist/models/view.model.js +9 -7
- package/dist/notion.d.ts +6 -1
- package/dist/notion.js +6 -1
- package/dist/schemas/asyncTask.schema.d.ts +11 -0
- package/dist/schemas/asyncTask.schema.js +5 -0
- package/dist/schemas/block.schema.d.ts +12 -1
- package/dist/schemas/block.schema.js +6 -1
- package/dist/schemas/codeLanguages.d.ts +7 -1
- package/dist/schemas/codeLanguages.js +4 -1
- package/dist/schemas/colors.d.ts +7 -1
- package/dist/schemas/colors.js +4 -1
- package/dist/schemas/comment.schema.d.ts +20 -2
- package/dist/schemas/comment.schema.js +11 -2
- package/dist/schemas/customEmoji.schema.d.ts +5 -0
- package/dist/schemas/customEmoji.schema.js +2 -0
- package/dist/schemas/dataSource.schema.d.ts +19 -3
- package/dist/schemas/dataSource.schema.js +12 -5
- package/dist/schemas/database.schema.d.ts +13 -1
- package/dist/schemas/database.schema.js +7 -1
- package/dist/schemas/emoji.schema.d.ts +7 -2
- package/dist/schemas/emoji.schema.js +4 -2
- package/dist/schemas/file.schema.d.ts +18 -2
- package/dist/schemas/file.schema.js +6 -2
- package/dist/schemas/fileUpload.schema.d.ts +8 -2
- package/dist/schemas/fileUpload.schema.js +5 -2
- package/dist/schemas/icon.schema.d.ts +28 -4
- package/dist/schemas/icon.schema.js +16 -4
- package/dist/schemas/meetingNotesQuery.schema.d.ts +13 -2
- package/dist/schemas/meetingNotesQuery.schema.js +7 -2
- package/dist/schemas/page.schema.d.ts +5 -0
- package/dist/schemas/page.schema.js +2 -0
- package/dist/schemas/pageMarkdown.schema.d.ts +15 -4
- package/dist/schemas/pageMarkdown.schema.js +9 -4
- package/dist/schemas/pageProperties.schema.d.ts +75 -3
- package/dist/schemas/pageProperties.schema.js +6 -3
- package/dist/schemas/pagination.schema.d.ts +33 -10
- package/dist/schemas/pagination.schema.js +12 -5
- package/dist/schemas/parent.schema.d.ts +29 -2
- package/dist/schemas/parent.schema.js +8 -2
- package/dist/schemas/propertyObjects.schema.d.ts +81 -3
- package/dist/schemas/propertyObjects.schema.js +11 -5
- package/dist/schemas/richText.schema.d.ts +15 -0
- package/dist/schemas/richText.schema.js +6 -3
- package/dist/schemas/shared.schema.d.ts +6 -3
- package/dist/schemas/shared.schema.js +6 -3
- package/dist/schemas/user.schema.d.ts +15 -0
- package/dist/schemas/user.schema.js +5 -2
- package/dist/schemas/view.schema.d.ts +43 -9
- package/dist/schemas/view.schema.js +28 -9
- package/dist/validation.d.ts +11 -4
- package/dist/validation.js +11 -4
- package/package.json +5 -2
|
@@ -38,11 +38,13 @@ const z = __importStar(require("zod"));
|
|
|
38
38
|
/**
|
|
39
39
|
* Notion emoji object schema.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* You can use emojis as icons for pages, databases, and other objects.
|
|
42
|
+
* This schema stores the emoji character as a string.
|
|
43
43
|
*
|
|
44
44
|
* Notion API reference:
|
|
45
45
|
* https://developers.notion.com/reference/emoji-object
|
|
46
|
+
*
|
|
47
|
+
* @category Custom Emoji & Icons
|
|
46
48
|
*/
|
|
47
49
|
exports.emojiSchema = z.object({
|
|
48
50
|
type: z.literal('emoji'),
|
|
@@ -2,8 +2,9 @@ import * as z from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* Notion file object schemas.
|
|
4
4
|
*
|
|
5
|
-
* Files can be Notion-hosted (uploaded through the UI), API-uploaded (via file upload
|
|
6
|
-
* or externally hosted (with a URL).
|
|
5
|
+
* Files can be Notion-hosted (uploaded through the UI), API-uploaded (via the file upload
|
|
6
|
+
* API), or externally hosted (with a URL). This schema applies to page and block icons,
|
|
7
|
+
* covers, and file attachments.
|
|
7
8
|
*
|
|
8
9
|
* Notion API reference:
|
|
9
10
|
* https://developers.notion.com/reference/file-object
|
|
@@ -30,6 +31,9 @@ declare const externalFileSchema: z.ZodObject<{
|
|
|
30
31
|
url: z.ZodURL;
|
|
31
32
|
}, z.core.$strip>;
|
|
32
33
|
}, z.core.$strip>;
|
|
34
|
+
/**
|
|
35
|
+
* @category File Uploads
|
|
36
|
+
*/
|
|
33
37
|
export declare const fileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
38
|
type: z.ZodLiteral<"file">;
|
|
35
39
|
file: z.ZodObject<{
|
|
@@ -47,8 +51,20 @@ export declare const fileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
47
51
|
url: z.ZodURL;
|
|
48
52
|
}, z.core.$strip>;
|
|
49
53
|
}, z.core.$strip>], "type">;
|
|
54
|
+
/**
|
|
55
|
+
* @category File Uploads
|
|
56
|
+
*/
|
|
50
57
|
export type NotionFile = z.infer<typeof fileSchema>;
|
|
58
|
+
/**
|
|
59
|
+
* @category File Uploads
|
|
60
|
+
*/
|
|
51
61
|
export type NotionHostedFile = z.infer<typeof notionFileSchema>;
|
|
62
|
+
/**
|
|
63
|
+
* @category File Uploads
|
|
64
|
+
*/
|
|
52
65
|
export type UploadedFile = z.infer<typeof fileUploadSchema>;
|
|
66
|
+
/**
|
|
67
|
+
* @category File Uploads
|
|
68
|
+
*/
|
|
53
69
|
export type ExternalFile = z.infer<typeof externalFileSchema>;
|
|
54
70
|
export {};
|
|
@@ -39,8 +39,9 @@ const shared_schema_1 = require("./shared.schema");
|
|
|
39
39
|
/**
|
|
40
40
|
* Notion file object schemas.
|
|
41
41
|
*
|
|
42
|
-
* Files can be Notion-hosted (uploaded through the UI), API-uploaded (via file upload
|
|
43
|
-
* or externally hosted (with a URL).
|
|
42
|
+
* Files can be Notion-hosted (uploaded through the UI), API-uploaded (via the file upload
|
|
43
|
+
* API), or externally hosted (with a URL). This schema applies to page and block icons,
|
|
44
|
+
* covers, and file attachments.
|
|
44
45
|
*
|
|
45
46
|
* Notion API reference:
|
|
46
47
|
* https://developers.notion.com/reference/file-object
|
|
@@ -67,6 +68,9 @@ const externalFileSchema = z.object({
|
|
|
67
68
|
url: z.url(),
|
|
68
69
|
}),
|
|
69
70
|
});
|
|
71
|
+
/**
|
|
72
|
+
* @category File Uploads
|
|
73
|
+
*/
|
|
70
74
|
exports.fileSchema = z.discriminatedUnion('type', [
|
|
71
75
|
notionFileSchema,
|
|
72
76
|
fileUploadSchema,
|
|
@@ -2,11 +2,14 @@ import * as z from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* Notion file upload object schema.
|
|
4
4
|
*
|
|
5
|
-
* File uploads represent files uploaded to Notion
|
|
6
|
-
* upload URL
|
|
5
|
+
* File uploads represent files uploaded to Notion through the API. Each file upload has
|
|
6
|
+
* a temporary upload URL. Each file upload has one of these states: pending, uploaded,
|
|
7
|
+
* expired, or failed.
|
|
7
8
|
*
|
|
8
9
|
* Notion API reference:
|
|
9
10
|
* https://developers.notion.com/reference/file-upload-object
|
|
11
|
+
*
|
|
12
|
+
* @category File Uploads
|
|
10
13
|
*/
|
|
11
14
|
export declare const fileUploadSchema: z.ZodObject<{
|
|
12
15
|
object: z.ZodLiteral<"file_upload">;
|
|
@@ -26,4 +29,7 @@ export declare const fileUploadSchema: z.ZodObject<{
|
|
|
26
29
|
complete_url: z.ZodString;
|
|
27
30
|
file_import_result: z.ZodString;
|
|
28
31
|
}, z.core.$strip>;
|
|
32
|
+
/**
|
|
33
|
+
* @category File Uploads
|
|
34
|
+
*/
|
|
29
35
|
export type NotionFileUpload = z.infer<typeof fileUploadSchema>;
|
|
@@ -39,11 +39,14 @@ const shared_schema_1 = require("./shared.schema");
|
|
|
39
39
|
/**
|
|
40
40
|
* Notion file upload object schema.
|
|
41
41
|
*
|
|
42
|
-
* File uploads represent files uploaded to Notion
|
|
43
|
-
* upload URL
|
|
42
|
+
* File uploads represent files uploaded to Notion through the API. Each file upload has
|
|
43
|
+
* a temporary upload URL. Each file upload has one of these states: pending, uploaded,
|
|
44
|
+
* expired, or failed.
|
|
44
45
|
*
|
|
45
46
|
* Notion API reference:
|
|
46
47
|
* https://developers.notion.com/reference/file-upload-object
|
|
48
|
+
*
|
|
49
|
+
* @category File Uploads
|
|
47
50
|
*/
|
|
48
51
|
exports.fileUploadSchema = z.object({
|
|
49
52
|
object: z.literal('file_upload'),
|
|
@@ -11,10 +11,19 @@ import * as z from 'zod';
|
|
|
11
11
|
* Notion API reference:
|
|
12
12
|
* https://developers.notion.com/reference/emoji-object
|
|
13
13
|
*/
|
|
14
|
-
/** Colors available for native (icon-picker) icons.
|
|
14
|
+
/** Colors available for native (icon-picker) icons.
|
|
15
|
+
*
|
|
16
|
+
* @category Custom Emoji & Icons
|
|
17
|
+
*/
|
|
15
18
|
export declare const NATIVE_ICON_COLORS: readonly ["gray", "lightgray", "brown", "yellow", "orange", "green", "blue", "purple", "pink", "red"];
|
|
19
|
+
/**
|
|
20
|
+
* @category Custom Emoji & Icons
|
|
21
|
+
*/
|
|
16
22
|
export type NativeIconColor = (typeof NATIVE_ICON_COLORS)[number];
|
|
17
|
-
/** Native (icon-picker) icon.
|
|
23
|
+
/** Native (icon-picker) icon.
|
|
24
|
+
*
|
|
25
|
+
* @category Custom Emoji & Icons
|
|
26
|
+
*/
|
|
18
27
|
export declare const nativeIconSchema: z.ZodObject<{
|
|
19
28
|
type: z.ZodLiteral<"icon">;
|
|
20
29
|
icon: z.ZodObject<{
|
|
@@ -33,8 +42,14 @@ export declare const nativeIconSchema: z.ZodObject<{
|
|
|
33
42
|
}>>;
|
|
34
43
|
}, z.core.$strip>;
|
|
35
44
|
}, z.core.$strip>;
|
|
45
|
+
/**
|
|
46
|
+
* @category Custom Emoji & Icons
|
|
47
|
+
*/
|
|
36
48
|
export type NativeIcon = z.infer<typeof nativeIconSchema>;
|
|
37
|
-
/** Custom emoji icon.
|
|
49
|
+
/** Custom emoji icon.
|
|
50
|
+
*
|
|
51
|
+
* @category Custom Emoji & Icons
|
|
52
|
+
*/
|
|
38
53
|
export declare const customEmojiIconSchema: z.ZodObject<{
|
|
39
54
|
type: z.ZodLiteral<"custom_emoji">;
|
|
40
55
|
custom_emoji: z.ZodObject<{
|
|
@@ -43,8 +58,14 @@ export declare const customEmojiIconSchema: z.ZodObject<{
|
|
|
43
58
|
url: z.ZodOptional<z.ZodURL>;
|
|
44
59
|
}, z.core.$strip>;
|
|
45
60
|
}, z.core.$strip>;
|
|
61
|
+
/**
|
|
62
|
+
* @category Custom Emoji & Icons
|
|
63
|
+
*/
|
|
46
64
|
export type CustomEmojiIcon = z.infer<typeof customEmojiIconSchema>;
|
|
47
|
-
/** Shared icon schema covering all icon object variants.
|
|
65
|
+
/** Shared icon schema covering all icon object variants.
|
|
66
|
+
*
|
|
67
|
+
* @category Custom Emoji & Icons
|
|
68
|
+
*/
|
|
48
69
|
export declare const iconSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
70
|
type: z.ZodLiteral<"file">;
|
|
50
71
|
file: z.ZodObject<{
|
|
@@ -89,4 +110,7 @@ export declare const iconSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z
|
|
|
89
110
|
url: z.ZodOptional<z.ZodURL>;
|
|
90
111
|
}, z.core.$strip>;
|
|
91
112
|
}, z.core.$strip>]>;
|
|
113
|
+
/**
|
|
114
|
+
* @category Custom Emoji & Icons
|
|
115
|
+
*/
|
|
92
116
|
export type NotionIcon = z.infer<typeof iconSchema>;
|
|
@@ -49,7 +49,10 @@ const file_schema_1 = require("./file.schema");
|
|
|
49
49
|
* Notion API reference:
|
|
50
50
|
* https://developers.notion.com/reference/emoji-object
|
|
51
51
|
*/
|
|
52
|
-
/** Colors available for native (icon-picker) icons.
|
|
52
|
+
/** Colors available for native (icon-picker) icons.
|
|
53
|
+
*
|
|
54
|
+
* @category Custom Emoji & Icons
|
|
55
|
+
*/
|
|
53
56
|
exports.NATIVE_ICON_COLORS = [
|
|
54
57
|
'gray',
|
|
55
58
|
'lightgray',
|
|
@@ -62,7 +65,10 @@ exports.NATIVE_ICON_COLORS = [
|
|
|
62
65
|
'pink',
|
|
63
66
|
'red',
|
|
64
67
|
];
|
|
65
|
-
/** Native (icon-picker) icon.
|
|
68
|
+
/** Native (icon-picker) icon.
|
|
69
|
+
*
|
|
70
|
+
* @category Custom Emoji & Icons
|
|
71
|
+
*/
|
|
66
72
|
exports.nativeIconSchema = z.object({
|
|
67
73
|
type: z.literal('icon'),
|
|
68
74
|
icon: z.object({
|
|
@@ -70,7 +76,10 @@ exports.nativeIconSchema = z.object({
|
|
|
70
76
|
color: z.enum(exports.NATIVE_ICON_COLORS).optional(),
|
|
71
77
|
}),
|
|
72
78
|
});
|
|
73
|
-
/** Custom emoji icon.
|
|
79
|
+
/** Custom emoji icon.
|
|
80
|
+
*
|
|
81
|
+
* @category Custom Emoji & Icons
|
|
82
|
+
*/
|
|
74
83
|
exports.customEmojiIconSchema = z.object({
|
|
75
84
|
type: z.literal('custom_emoji'),
|
|
76
85
|
custom_emoji: z.object({
|
|
@@ -79,7 +88,10 @@ exports.customEmojiIconSchema = z.object({
|
|
|
79
88
|
url: z.url().optional(),
|
|
80
89
|
}),
|
|
81
90
|
});
|
|
82
|
-
/** Shared icon schema covering all icon object variants.
|
|
91
|
+
/** Shared icon schema covering all icon object variants.
|
|
92
|
+
*
|
|
93
|
+
* @category Custom Emoji & Icons
|
|
94
|
+
*/
|
|
83
95
|
exports.iconSchema = z.union([
|
|
84
96
|
file_schema_1.fileSchema,
|
|
85
97
|
emoji_schema_1.emojiSchema,
|
|
@@ -4,12 +4,20 @@ import * as z from 'zod';
|
|
|
4
4
|
*
|
|
5
5
|
* Notion API reference:
|
|
6
6
|
* https://developers.notion.com/reference/query-meeting-notes
|
|
7
|
+
*
|
|
8
|
+
* @category Pages
|
|
7
9
|
*/
|
|
8
10
|
export declare const MEETING_NOTES_QUERY_PROPERTIES: readonly ["title", "attendees", "created_time", "created_by", "last_edited_time", "last_edited_by"];
|
|
11
|
+
/**
|
|
12
|
+
* @category Pages
|
|
13
|
+
*/
|
|
9
14
|
export type MeetingNotesQueryProperty = (typeof MEETING_NOTES_QUERY_PROPERTIES)[number];
|
|
10
15
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
16
|
+
* This response shape is non-standard. It has no `object` field and no `next_cursor`
|
|
17
|
+
* field. The `limit` parameter alone controls pagination, up to 50 results per request,
|
|
18
|
+
* with no cursor.
|
|
19
|
+
*
|
|
20
|
+
* @category Pages
|
|
13
21
|
*/
|
|
14
22
|
export declare const meetingNotesQueryResponseSchema: z.ZodObject<{
|
|
15
23
|
results: z.ZodArray<z.ZodObject<{
|
|
@@ -4184,4 +4192,7 @@ export declare const meetingNotesQueryResponseSchema: z.ZodObject<{
|
|
|
4184
4192
|
}>;
|
|
4185
4193
|
}, z.core.$strip>>;
|
|
4186
4194
|
}, z.core.$strip>;
|
|
4195
|
+
/**
|
|
4196
|
+
* @category Pages
|
|
4197
|
+
*/
|
|
4187
4198
|
export type MeetingNotesQueryResponse = z.infer<typeof meetingNotesQueryResponseSchema>;
|
|
@@ -42,6 +42,8 @@ const pagination_schema_1 = require("./pagination.schema");
|
|
|
42
42
|
*
|
|
43
43
|
* Notion API reference:
|
|
44
44
|
* https://developers.notion.com/reference/query-meeting-notes
|
|
45
|
+
*
|
|
46
|
+
* @category Pages
|
|
45
47
|
*/
|
|
46
48
|
exports.MEETING_NOTES_QUERY_PROPERTIES = [
|
|
47
49
|
'title',
|
|
@@ -52,8 +54,11 @@ exports.MEETING_NOTES_QUERY_PROPERTIES = [
|
|
|
52
54
|
'last_edited_by',
|
|
53
55
|
];
|
|
54
56
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
+
* This response shape is non-standard. It has no `object` field and no `next_cursor`
|
|
58
|
+
* field. The `limit` parameter alone controls pagination, up to 50 results per request,
|
|
59
|
+
* with no cursor.
|
|
60
|
+
*
|
|
61
|
+
* @category Pages
|
|
57
62
|
*/
|
|
58
63
|
exports.meetingNotesQueryResponseSchema = z.object({
|
|
59
64
|
results: z.array(block_schema_1.blockSchema),
|
|
@@ -7,6 +7,8 @@ import * as z from 'zod';
|
|
|
7
7
|
*
|
|
8
8
|
* Notion API reference:
|
|
9
9
|
* https://developers.notion.com/reference/page
|
|
10
|
+
*
|
|
11
|
+
* @category Pages
|
|
10
12
|
*/
|
|
11
13
|
export declare const pageSchema: z.ZodObject<{
|
|
12
14
|
object: z.ZodLiteral<"page">;
|
|
@@ -900,4 +902,7 @@ export declare const pageSchema: z.ZodObject<{
|
|
|
900
902
|
url: z.ZodURL;
|
|
901
903
|
public_url: z.ZodNullable<z.ZodURL>;
|
|
902
904
|
}, z.core.$strip>;
|
|
905
|
+
/**
|
|
906
|
+
* @category Pages
|
|
907
|
+
*/
|
|
903
908
|
export type NotionPage = z.infer<typeof pageSchema>;
|
|
@@ -7,6 +7,8 @@ import * as z from 'zod';
|
|
|
7
7
|
*
|
|
8
8
|
* Notion API reference:
|
|
9
9
|
* https://developers.notion.com/guides/data-apis/working-with-markdown-content
|
|
10
|
+
*
|
|
11
|
+
* @category Pages
|
|
10
12
|
*/
|
|
11
13
|
export declare const pageMarkdownSchema: z.ZodObject<{
|
|
12
14
|
object: z.ZodLiteral<"page_markdown">;
|
|
@@ -15,12 +17,18 @@ export declare const pageMarkdownSchema: z.ZodObject<{
|
|
|
15
17
|
truncated: z.ZodBoolean;
|
|
16
18
|
unknown_block_ids: z.ZodArray<z.ZodUUID>;
|
|
17
19
|
}, z.core.$strip>;
|
|
20
|
+
/**
|
|
21
|
+
* @category Pages
|
|
22
|
+
*/
|
|
18
23
|
export type PageMarkdown = z.infer<typeof pageMarkdownSchema>;
|
|
19
24
|
/**
|
|
20
|
-
* `PATCH /v1/pages/{page_id}/markdown` returns `pageMarkdownSchema` synchronously
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
25
|
+
* `PATCH /v1/pages/{page_id}/markdown` returns `pageMarkdownSchema` synchronously. If
|
|
26
|
+
* `allow_async: true` triggers async processing, it returns an `async_task` handle
|
|
27
|
+
* instead. Poll the handle through {@link AsyncTasksAPI}. Both response bodies carry a
|
|
28
|
+
* literal `object` field, so you can discriminate between them without checking the
|
|
29
|
+
* HTTP status code.
|
|
30
|
+
*
|
|
31
|
+
* @category Pages
|
|
24
32
|
*/
|
|
25
33
|
export declare const markdownContentResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
34
|
object: z.ZodLiteral<"page_markdown">;
|
|
@@ -56,4 +64,7 @@ export declare const markdownContentResponseSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
56
64
|
message: z.ZodString;
|
|
57
65
|
}, z.core.$strip>>;
|
|
58
66
|
}, z.core.$strip>], "object">;
|
|
67
|
+
/**
|
|
68
|
+
* @category Pages
|
|
69
|
+
*/
|
|
59
70
|
export type MarkdownContentResponse = z.infer<typeof markdownContentResponseSchema>;
|
|
@@ -44,6 +44,8 @@ const asyncTask_schema_1 = require("./asyncTask.schema");
|
|
|
44
44
|
*
|
|
45
45
|
* Notion API reference:
|
|
46
46
|
* https://developers.notion.com/guides/data-apis/working-with-markdown-content
|
|
47
|
+
*
|
|
48
|
+
* @category Pages
|
|
47
49
|
*/
|
|
48
50
|
exports.pageMarkdownSchema = z.object({
|
|
49
51
|
object: z.literal('page_markdown'),
|
|
@@ -54,10 +56,13 @@ exports.pageMarkdownSchema = z.object({
|
|
|
54
56
|
unknown_block_ids: z.array(z.uuid()).max(100),
|
|
55
57
|
});
|
|
56
58
|
/**
|
|
57
|
-
* `PATCH /v1/pages/{page_id}/markdown` returns `pageMarkdownSchema` synchronously
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* `PATCH /v1/pages/{page_id}/markdown` returns `pageMarkdownSchema` synchronously. If
|
|
60
|
+
* `allow_async: true` triggers async processing, it returns an `async_task` handle
|
|
61
|
+
* instead. Poll the handle through {@link AsyncTasksAPI}. Both response bodies carry a
|
|
62
|
+
* literal `object` field, so you can discriminate between them without checking the
|
|
63
|
+
* HTTP status code.
|
|
64
|
+
*
|
|
65
|
+
* @category Pages
|
|
61
66
|
*/
|
|
62
67
|
exports.markdownContentResponseSchema = z.discriminatedUnion('object', [
|
|
63
68
|
exports.pageMarkdownSchema,
|
|
@@ -2,9 +2,9 @@ import * as z from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* Page property value schemas.
|
|
4
4
|
*
|
|
5
|
-
* These define the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* These schemas define the data values in page properties (database columns).
|
|
6
|
+
* Property objects define the schema and configuration instead.
|
|
7
|
+
* This file supports 22 property types, including title, rich text, number, and select.
|
|
8
8
|
*
|
|
9
9
|
* Notion API reference:
|
|
10
10
|
* https://developers.notion.com/reference/page-property-values
|
|
@@ -786,6 +786,9 @@ declare const verificationPropertySchema: z.ZodObject<{
|
|
|
786
786
|
}, z.core.$strip>>;
|
|
787
787
|
}, z.core.$strip>>;
|
|
788
788
|
}, z.core.$strip>;
|
|
789
|
+
/**
|
|
790
|
+
* @category Page Properties
|
|
791
|
+
*/
|
|
789
792
|
export declare const pagePropertiesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
790
793
|
id: z.ZodString;
|
|
791
794
|
type: z.ZodLiteral<"checkbox">;
|
|
@@ -1520,27 +1523,96 @@ export declare const pagePropertiesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
1520
1523
|
}, z.core.$strip>>;
|
|
1521
1524
|
}, z.core.$strip>>;
|
|
1522
1525
|
}, z.core.$strip>], "type">;
|
|
1526
|
+
/**
|
|
1527
|
+
* @category Page Properties
|
|
1528
|
+
*/
|
|
1523
1529
|
export type NotionPageProperties = z.infer<typeof pagePropertiesSchema>;
|
|
1530
|
+
/**
|
|
1531
|
+
* @category Page Properties
|
|
1532
|
+
*/
|
|
1524
1533
|
export type CheckboxProperty = z.infer<typeof checkboxPropertySchema>;
|
|
1534
|
+
/**
|
|
1535
|
+
* @category Page Properties
|
|
1536
|
+
*/
|
|
1525
1537
|
export type CreatedByProperty = z.infer<typeof createdByPropertySchema>;
|
|
1538
|
+
/**
|
|
1539
|
+
* @category Page Properties
|
|
1540
|
+
*/
|
|
1526
1541
|
export type CreatedTimeProperty = z.infer<typeof createdTimePropertySchema>;
|
|
1542
|
+
/**
|
|
1543
|
+
* @category Page Properties
|
|
1544
|
+
*/
|
|
1527
1545
|
export type DateProperty = z.infer<typeof datePropertySchema>;
|
|
1546
|
+
/**
|
|
1547
|
+
* @category Page Properties
|
|
1548
|
+
*/
|
|
1528
1549
|
export type EmailProperty = z.infer<typeof emailPropertySchema>;
|
|
1550
|
+
/**
|
|
1551
|
+
* @category Page Properties
|
|
1552
|
+
*/
|
|
1529
1553
|
export type FilesProperty = z.infer<typeof filesPropertySchema>;
|
|
1554
|
+
/**
|
|
1555
|
+
* @category Page Properties
|
|
1556
|
+
*/
|
|
1530
1557
|
export type FormulaProperty = z.infer<typeof formulaPropertySchema>;
|
|
1558
|
+
/**
|
|
1559
|
+
* @category Page Properties
|
|
1560
|
+
*/
|
|
1531
1561
|
export type LastEditedByProperty = z.infer<typeof lastEditedByPropertySchema>;
|
|
1562
|
+
/**
|
|
1563
|
+
* @category Page Properties
|
|
1564
|
+
*/
|
|
1532
1565
|
export type LastEditedTimeProperty = z.infer<typeof lastEditedTimePropertySchema>;
|
|
1566
|
+
/**
|
|
1567
|
+
* @category Page Properties
|
|
1568
|
+
*/
|
|
1533
1569
|
export type MultiSelectProperty = z.infer<typeof multiSelectPropertySchema>;
|
|
1570
|
+
/**
|
|
1571
|
+
* @category Page Properties
|
|
1572
|
+
*/
|
|
1534
1573
|
export type NumberProperty = z.infer<typeof numberPropertySchema>;
|
|
1574
|
+
/**
|
|
1575
|
+
* @category Page Properties
|
|
1576
|
+
*/
|
|
1535
1577
|
export type PeopleProperty = z.infer<typeof peoplePropertySchema>;
|
|
1578
|
+
/**
|
|
1579
|
+
* @category Page Properties
|
|
1580
|
+
*/
|
|
1536
1581
|
export type PhoneNumberProperty = z.infer<typeof phoneNumberPropertySchema>;
|
|
1582
|
+
/**
|
|
1583
|
+
* @category Page Properties
|
|
1584
|
+
*/
|
|
1537
1585
|
export type RelationProperty = z.infer<typeof relationPropertySchema>;
|
|
1586
|
+
/**
|
|
1587
|
+
* @category Page Properties
|
|
1588
|
+
*/
|
|
1538
1589
|
export type RichTextProperty = z.infer<typeof richTextPropertySchema>;
|
|
1590
|
+
/**
|
|
1591
|
+
* @category Page Properties
|
|
1592
|
+
*/
|
|
1539
1593
|
export type RollupProperty = z.infer<typeof rollupPropertySchema>;
|
|
1594
|
+
/**
|
|
1595
|
+
* @category Page Properties
|
|
1596
|
+
*/
|
|
1540
1597
|
export type SelectProperty = z.infer<typeof selectPropertySchema>;
|
|
1598
|
+
/**
|
|
1599
|
+
* @category Page Properties
|
|
1600
|
+
*/
|
|
1541
1601
|
export type StatusProperty = z.infer<typeof statusPropertySchema>;
|
|
1602
|
+
/**
|
|
1603
|
+
* @category Page Properties
|
|
1604
|
+
*/
|
|
1542
1605
|
export type TitleProperty = z.infer<typeof titlePropertySchema>;
|
|
1606
|
+
/**
|
|
1607
|
+
* @category Page Properties
|
|
1608
|
+
*/
|
|
1543
1609
|
export type UrlProperty = z.infer<typeof urlPropertySchema>;
|
|
1610
|
+
/**
|
|
1611
|
+
* @category Page Properties
|
|
1612
|
+
*/
|
|
1544
1613
|
export type UniqueIdProperty = z.infer<typeof uniqueIdPropertySchema>;
|
|
1614
|
+
/**
|
|
1615
|
+
* @category Page Properties
|
|
1616
|
+
*/
|
|
1545
1617
|
export type VerificationProperty = z.infer<typeof verificationPropertySchema>;
|
|
1546
1618
|
export {};
|
|
@@ -42,9 +42,9 @@ const user_schema_1 = require("./user.schema");
|
|
|
42
42
|
/**
|
|
43
43
|
* Page property value schemas.
|
|
44
44
|
*
|
|
45
|
-
* These define the
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* These schemas define the data values in page properties (database columns).
|
|
46
|
+
* Property objects define the schema and configuration instead.
|
|
47
|
+
* This file supports 22 property types, including title, rich text, number, and select.
|
|
48
48
|
*
|
|
49
49
|
* Notion API reference:
|
|
50
50
|
* https://developers.notion.com/reference/page-property-values
|
|
@@ -274,6 +274,9 @@ const verificationPropertySchema = z.object({
|
|
|
274
274
|
})
|
|
275
275
|
.nullable(),
|
|
276
276
|
});
|
|
277
|
+
/**
|
|
278
|
+
* @category Page Properties
|
|
279
|
+
*/
|
|
277
280
|
exports.pagePropertiesSchema = z.discriminatedUnion('type', [
|
|
278
281
|
checkboxPropertySchema,
|
|
279
282
|
createdByPropertySchema,
|
|
@@ -3,28 +3,38 @@ import * as z from 'zod';
|
|
|
3
3
|
* Pagination schemas and utilities.
|
|
4
4
|
*
|
|
5
5
|
* The Notion API uses cursor-based pagination for list endpoints. Responses include
|
|
6
|
-
* results, a next_cursor, and has_more flag. This file provides reusable schemas
|
|
7
|
-
* and types
|
|
6
|
+
* results, a next_cursor, and a has_more flag. This file provides reusable schemas
|
|
7
|
+
* and types to work with paginated responses.
|
|
8
8
|
*
|
|
9
9
|
* Notion API reference:
|
|
10
10
|
* https://developers.notion.com/reference/intro#pagination
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
13
|
* Paginated list response type.
|
|
14
|
-
* As of API version 2025-09-03, 'data_source' and
|
|
15
|
-
* instead of 'database' and 'page_or_database'
|
|
14
|
+
* As of API version 2025-09-03, search results use 'data_source' and
|
|
15
|
+
* 'page_or_data_source' instead of 'database' and 'page_or_database'.
|
|
16
|
+
*
|
|
17
|
+
* @category Pagination
|
|
16
18
|
*/
|
|
17
19
|
export type PaginatedListType = 'block' | 'comment' | 'custom_emoji' | 'database' | 'data_source' | 'page' | 'page_or_database' | 'page_or_data_source' | 'property_item' | 'user' | 'view';
|
|
18
20
|
/**
|
|
19
|
-
* Reasons a query can be
|
|
20
|
-
*
|
|
21
|
+
* Reasons why a query result can be incomplete even when `has_more` is `false`.
|
|
22
|
+
* This happens only when a query hits the 10,000-result pagination depth cap.
|
|
23
|
+
*
|
|
24
|
+
* @category Pagination
|
|
21
25
|
*/
|
|
22
26
|
export declare const REQUEST_STATUS_INCOMPLETE_REASONS: readonly ["query_result_limit_reached"];
|
|
27
|
+
/**
|
|
28
|
+
* @category Pagination
|
|
29
|
+
*/
|
|
23
30
|
export type RequestStatusIncompleteReason = (typeof REQUEST_STATUS_INCOMPLETE_REASONS)[number];
|
|
24
31
|
/**
|
|
25
|
-
*
|
|
26
|
-
* view, and meeting-notes queries cap at 10,000 results. Callers that need
|
|
27
|
-
* detect this
|
|
32
|
+
* This schema flags a truncated query even though `has_more` is `false`. For example,
|
|
33
|
+
* data source, view, and meeting-notes queries cap at 10,000 results. Callers that need
|
|
34
|
+
* every row must detect this. Then they must re-query with a narrower filter (see the
|
|
35
|
+
* pagination helpers).
|
|
36
|
+
*
|
|
37
|
+
* @category Pagination
|
|
28
38
|
*/
|
|
29
39
|
export declare const requestStatusSchema: z.ZodObject<{
|
|
30
40
|
type: z.ZodLiteral<"incomplete">;
|
|
@@ -32,9 +42,14 @@ export declare const requestStatusSchema: z.ZodObject<{
|
|
|
32
42
|
query_result_limit_reached: "query_result_limit_reached";
|
|
33
43
|
}>;
|
|
34
44
|
}, z.core.$strip>;
|
|
45
|
+
/**
|
|
46
|
+
* @category Pagination
|
|
47
|
+
*/
|
|
35
48
|
export type RequestStatus = z.infer<typeof requestStatusSchema>;
|
|
36
49
|
/**
|
|
37
50
|
* Base paginated list response schema.
|
|
51
|
+
*
|
|
52
|
+
* @category Pagination
|
|
38
53
|
*/
|
|
39
54
|
export declare const paginatedListSchema: <T extends z.ZodTypeAny>(resultSchema: T) => z.ZodObject<{
|
|
40
55
|
object: z.ZodLiteral<"list">;
|
|
@@ -63,15 +78,23 @@ export declare const paginatedListSchema: <T extends z.ZodTypeAny>(resultSchema:
|
|
|
63
78
|
}, z.core.$strip>;
|
|
64
79
|
/**
|
|
65
80
|
* Pagination parameters for requests.
|
|
81
|
+
*
|
|
82
|
+
* @category Pagination
|
|
66
83
|
*/
|
|
67
84
|
export interface PaginationParameters {
|
|
68
85
|
/** The number of items to return (default: 100, max: 100) */
|
|
69
86
|
page_size?: number;
|
|
70
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* The cursor value from a previous response.
|
|
89
|
+
* Pass it to continue pagination.
|
|
90
|
+
* The SDK treats `null` the same as omitted.
|
|
91
|
+
*/
|
|
71
92
|
start_cursor?: string | null;
|
|
72
93
|
}
|
|
73
94
|
/**
|
|
74
95
|
* Helper to create paginated response type.
|
|
96
|
+
*
|
|
97
|
+
* @category Pagination
|
|
75
98
|
*/
|
|
76
99
|
export type PaginatedList<T> = {
|
|
77
100
|
object: 'list';
|
|
@@ -36,14 +36,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.paginatedListSchema = exports.requestStatusSchema = exports.REQUEST_STATUS_INCOMPLETE_REASONS = void 0;
|
|
37
37
|
const z = __importStar(require("zod"));
|
|
38
38
|
/**
|
|
39
|
-
* Reasons a query can be
|
|
40
|
-
*
|
|
39
|
+
* Reasons why a query result can be incomplete even when `has_more` is `false`.
|
|
40
|
+
* This happens only when a query hits the 10,000-result pagination depth cap.
|
|
41
|
+
*
|
|
42
|
+
* @category Pagination
|
|
41
43
|
*/
|
|
42
44
|
exports.REQUEST_STATUS_INCOMPLETE_REASONS = ['query_result_limit_reached'];
|
|
43
45
|
/**
|
|
44
|
-
*
|
|
45
|
-
* view, and meeting-notes queries cap at 10,000 results. Callers that need
|
|
46
|
-
* detect this
|
|
46
|
+
* This schema flags a truncated query even though `has_more` is `false`. For example,
|
|
47
|
+
* data source, view, and meeting-notes queries cap at 10,000 results. Callers that need
|
|
48
|
+
* every row must detect this. Then they must re-query with a narrower filter (see the
|
|
49
|
+
* pagination helpers).
|
|
50
|
+
*
|
|
51
|
+
* @category Pagination
|
|
47
52
|
*/
|
|
48
53
|
exports.requestStatusSchema = z.object({
|
|
49
54
|
type: z.literal('incomplete'),
|
|
@@ -51,6 +56,8 @@ exports.requestStatusSchema = z.object({
|
|
|
51
56
|
});
|
|
52
57
|
/**
|
|
53
58
|
* Base paginated list response schema.
|
|
59
|
+
*
|
|
60
|
+
* @category Pagination
|
|
54
61
|
*/
|
|
55
62
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
56
63
|
const paginatedListSchema = (resultSchema) => {
|