@visus-io/notion-sdk-ts 3.1.0 → 3.2.0
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 +20 -88
- 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 +10 -3
- package/dist/api/dataSources.api.js +4 -1
- package/dist/api/databases.api.d.ts +21 -8
- package/dist/api/databases.api.js +8 -4
- package/dist/api/fileUploads.api.d.ts +7 -4
- package/dist/api/fileUploads.api.js +11 -7
- package/dist/api/pages.api.d.ts +8 -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 +21 -4
- package/dist/errors.js +17 -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 +10 -3
- package/dist/models/dataSource.model.js +11 -2
- package/dist/models/database.model.d.ts +11 -3
- package/dist/models/database.model.js +14 -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 +9 -2
- package/dist/models/user.model.js +14 -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 +24 -3
- package/dist/schemas/dataSource.schema.js +15 -5
- package/dist/schemas/database.schema.d.ts +31 -1
- package/dist/schemas/database.schema.js +18 -2
- 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 +8 -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 +81 -3
- package/dist/schemas/pageProperties.schema.js +7 -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 +46 -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 +20 -16
|
@@ -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
|
|
@@ -118,6 +118,9 @@ declare const formulaPropertySchema: z.ZodObject<{
|
|
|
118
118
|
}, z.core.$strip>, z.ZodObject<{
|
|
119
119
|
type: z.ZodLiteral<"string">;
|
|
120
120
|
string: z.ZodNullable<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
122
|
+
type: z.ZodLiteral<"unsupported">;
|
|
123
|
+
unsupported: z.ZodObject<{}, z.core.$strip>;
|
|
121
124
|
}, z.core.$strip>], "type">;
|
|
122
125
|
}, z.core.$strip>;
|
|
123
126
|
/** Last edited by property. */
|
|
@@ -786,6 +789,9 @@ declare const verificationPropertySchema: z.ZodObject<{
|
|
|
786
789
|
}, z.core.$strip>>;
|
|
787
790
|
}, z.core.$strip>>;
|
|
788
791
|
}, z.core.$strip>;
|
|
792
|
+
/**
|
|
793
|
+
* @category Page Properties
|
|
794
|
+
*/
|
|
789
795
|
export declare const pagePropertiesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
790
796
|
id: z.ZodString;
|
|
791
797
|
type: z.ZodLiteral<"checkbox">;
|
|
@@ -882,6 +888,9 @@ export declare const pagePropertiesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
882
888
|
}, z.core.$strip>, z.ZodObject<{
|
|
883
889
|
type: z.ZodLiteral<"string">;
|
|
884
890
|
string: z.ZodNullable<z.ZodString>;
|
|
891
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
892
|
+
type: z.ZodLiteral<"unsupported">;
|
|
893
|
+
unsupported: z.ZodObject<{}, z.core.$strip>;
|
|
885
894
|
}, z.core.$strip>], "type">;
|
|
886
895
|
}, z.core.$strip>, z.ZodObject<{
|
|
887
896
|
id: z.ZodString;
|
|
@@ -1520,27 +1529,96 @@ export declare const pagePropertiesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
1520
1529
|
}, z.core.$strip>>;
|
|
1521
1530
|
}, z.core.$strip>>;
|
|
1522
1531
|
}, z.core.$strip>], "type">;
|
|
1532
|
+
/**
|
|
1533
|
+
* @category Page Properties
|
|
1534
|
+
*/
|
|
1523
1535
|
export type NotionPageProperties = z.infer<typeof pagePropertiesSchema>;
|
|
1536
|
+
/**
|
|
1537
|
+
* @category Page Properties
|
|
1538
|
+
*/
|
|
1524
1539
|
export type CheckboxProperty = z.infer<typeof checkboxPropertySchema>;
|
|
1540
|
+
/**
|
|
1541
|
+
* @category Page Properties
|
|
1542
|
+
*/
|
|
1525
1543
|
export type CreatedByProperty = z.infer<typeof createdByPropertySchema>;
|
|
1544
|
+
/**
|
|
1545
|
+
* @category Page Properties
|
|
1546
|
+
*/
|
|
1526
1547
|
export type CreatedTimeProperty = z.infer<typeof createdTimePropertySchema>;
|
|
1548
|
+
/**
|
|
1549
|
+
* @category Page Properties
|
|
1550
|
+
*/
|
|
1527
1551
|
export type DateProperty = z.infer<typeof datePropertySchema>;
|
|
1552
|
+
/**
|
|
1553
|
+
* @category Page Properties
|
|
1554
|
+
*/
|
|
1528
1555
|
export type EmailProperty = z.infer<typeof emailPropertySchema>;
|
|
1556
|
+
/**
|
|
1557
|
+
* @category Page Properties
|
|
1558
|
+
*/
|
|
1529
1559
|
export type FilesProperty = z.infer<typeof filesPropertySchema>;
|
|
1560
|
+
/**
|
|
1561
|
+
* @category Page Properties
|
|
1562
|
+
*/
|
|
1530
1563
|
export type FormulaProperty = z.infer<typeof formulaPropertySchema>;
|
|
1564
|
+
/**
|
|
1565
|
+
* @category Page Properties
|
|
1566
|
+
*/
|
|
1531
1567
|
export type LastEditedByProperty = z.infer<typeof lastEditedByPropertySchema>;
|
|
1568
|
+
/**
|
|
1569
|
+
* @category Page Properties
|
|
1570
|
+
*/
|
|
1532
1571
|
export type LastEditedTimeProperty = z.infer<typeof lastEditedTimePropertySchema>;
|
|
1572
|
+
/**
|
|
1573
|
+
* @category Page Properties
|
|
1574
|
+
*/
|
|
1533
1575
|
export type MultiSelectProperty = z.infer<typeof multiSelectPropertySchema>;
|
|
1576
|
+
/**
|
|
1577
|
+
* @category Page Properties
|
|
1578
|
+
*/
|
|
1534
1579
|
export type NumberProperty = z.infer<typeof numberPropertySchema>;
|
|
1580
|
+
/**
|
|
1581
|
+
* @category Page Properties
|
|
1582
|
+
*/
|
|
1535
1583
|
export type PeopleProperty = z.infer<typeof peoplePropertySchema>;
|
|
1584
|
+
/**
|
|
1585
|
+
* @category Page Properties
|
|
1586
|
+
*/
|
|
1536
1587
|
export type PhoneNumberProperty = z.infer<typeof phoneNumberPropertySchema>;
|
|
1588
|
+
/**
|
|
1589
|
+
* @category Page Properties
|
|
1590
|
+
*/
|
|
1537
1591
|
export type RelationProperty = z.infer<typeof relationPropertySchema>;
|
|
1592
|
+
/**
|
|
1593
|
+
* @category Page Properties
|
|
1594
|
+
*/
|
|
1538
1595
|
export type RichTextProperty = z.infer<typeof richTextPropertySchema>;
|
|
1596
|
+
/**
|
|
1597
|
+
* @category Page Properties
|
|
1598
|
+
*/
|
|
1539
1599
|
export type RollupProperty = z.infer<typeof rollupPropertySchema>;
|
|
1600
|
+
/**
|
|
1601
|
+
* @category Page Properties
|
|
1602
|
+
*/
|
|
1540
1603
|
export type SelectProperty = z.infer<typeof selectPropertySchema>;
|
|
1604
|
+
/**
|
|
1605
|
+
* @category Page Properties
|
|
1606
|
+
*/
|
|
1541
1607
|
export type StatusProperty = z.infer<typeof statusPropertySchema>;
|
|
1608
|
+
/**
|
|
1609
|
+
* @category Page Properties
|
|
1610
|
+
*/
|
|
1542
1611
|
export type TitleProperty = z.infer<typeof titlePropertySchema>;
|
|
1612
|
+
/**
|
|
1613
|
+
* @category Page Properties
|
|
1614
|
+
*/
|
|
1543
1615
|
export type UrlProperty = z.infer<typeof urlPropertySchema>;
|
|
1616
|
+
/**
|
|
1617
|
+
* @category Page Properties
|
|
1618
|
+
*/
|
|
1544
1619
|
export type UniqueIdProperty = z.infer<typeof uniqueIdPropertySchema>;
|
|
1620
|
+
/**
|
|
1621
|
+
* @category Page Properties
|
|
1622
|
+
*/
|
|
1545
1623
|
export type VerificationProperty = z.infer<typeof verificationPropertySchema>;
|
|
1546
1624
|
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
|
|
@@ -113,6 +113,7 @@ const formulaPropertySchema = z.object({
|
|
|
113
113
|
}),
|
|
114
114
|
z.object({ type: z.literal('number'), number: z.number().nullable() }),
|
|
115
115
|
z.object({ type: z.literal('string'), string: z.string().trim().nullable() }),
|
|
116
|
+
z.object({ type: z.literal('unsupported'), unsupported: z.object({}) }),
|
|
116
117
|
]),
|
|
117
118
|
});
|
|
118
119
|
/** Last edited by property. */
|
|
@@ -274,6 +275,9 @@ const verificationPropertySchema = z.object({
|
|
|
274
275
|
})
|
|
275
276
|
.nullable(),
|
|
276
277
|
});
|
|
278
|
+
/**
|
|
279
|
+
* @category Page Properties
|
|
280
|
+
*/
|
|
277
281
|
exports.pagePropertiesSchema = z.discriminatedUnion('type', [
|
|
278
282
|
checkboxPropertySchema,
|
|
279
283
|
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) => {
|
|
@@ -2,13 +2,16 @@ import * as z from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* Notion parent object schemas.
|
|
4
4
|
*
|
|
5
|
-
* Parent objects
|
|
5
|
+
* Parent objects identify the container of a page or block within Notion.
|
|
6
6
|
* A parent can be a database, data source, page, workspace, or block.
|
|
7
7
|
*
|
|
8
8
|
* Notion API reference:
|
|
9
9
|
* https://developers.notion.com/reference/parent-object
|
|
10
10
|
*/
|
|
11
|
-
/** Database parent.
|
|
11
|
+
/** Database parent.
|
|
12
|
+
*
|
|
13
|
+
* @category Shared Types
|
|
14
|
+
*/
|
|
12
15
|
export declare const databaseParentSchema: z.ZodObject<{
|
|
13
16
|
type: z.ZodLiteral<"database_id">;
|
|
14
17
|
database_id: z.ZodUUID;
|
|
@@ -39,6 +42,9 @@ declare const agentParentSchema: z.ZodObject<{
|
|
|
39
42
|
type: z.ZodLiteral<"agent_id">;
|
|
40
43
|
agent_id: z.ZodUUID;
|
|
41
44
|
}, z.core.$strip>;
|
|
45
|
+
/**
|
|
46
|
+
* @category Shared Types
|
|
47
|
+
*/
|
|
42
48
|
export declare const parentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
43
49
|
type: z.ZodLiteral<"database_id">;
|
|
44
50
|
database_id: z.ZodUUID;
|
|
@@ -59,11 +65,32 @@ export declare const parentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
59
65
|
type: z.ZodLiteral<"agent_id">;
|
|
60
66
|
agent_id: z.ZodUUID;
|
|
61
67
|
}, z.core.$strip>], "type">;
|
|
68
|
+
/**
|
|
69
|
+
* @category Shared Types
|
|
70
|
+
*/
|
|
62
71
|
export type NotionParent = z.infer<typeof parentSchema>;
|
|
72
|
+
/**
|
|
73
|
+
* @category Shared Types
|
|
74
|
+
*/
|
|
63
75
|
export type DatabaseParent = z.infer<typeof databaseParentSchema>;
|
|
76
|
+
/**
|
|
77
|
+
* @category Shared Types
|
|
78
|
+
*/
|
|
64
79
|
export type DataSourceParent = z.infer<typeof dataSourceParentSchema>;
|
|
80
|
+
/**
|
|
81
|
+
* @category Shared Types
|
|
82
|
+
*/
|
|
65
83
|
export type PageParent = z.infer<typeof pageParentSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* @category Shared Types
|
|
86
|
+
*/
|
|
66
87
|
export type WorkspaceParent = z.infer<typeof workspaceParentSchema>;
|
|
88
|
+
/**
|
|
89
|
+
* @category Shared Types
|
|
90
|
+
*/
|
|
67
91
|
export type BlockParent = z.infer<typeof blockParentSchema>;
|
|
92
|
+
/**
|
|
93
|
+
* @category Shared Types
|
|
94
|
+
*/
|
|
68
95
|
export type AgentParent = z.infer<typeof agentParentSchema>;
|
|
69
96
|
export {};
|
|
@@ -38,13 +38,16 @@ const z = __importStar(require("zod"));
|
|
|
38
38
|
/**
|
|
39
39
|
* Notion parent object schemas.
|
|
40
40
|
*
|
|
41
|
-
* Parent objects
|
|
41
|
+
* Parent objects identify the container of a page or block within Notion.
|
|
42
42
|
* A parent can be a database, data source, page, workspace, or block.
|
|
43
43
|
*
|
|
44
44
|
* Notion API reference:
|
|
45
45
|
* https://developers.notion.com/reference/parent-object
|
|
46
46
|
*/
|
|
47
|
-
/** Database parent.
|
|
47
|
+
/** Database parent.
|
|
48
|
+
*
|
|
49
|
+
* @category Shared Types
|
|
50
|
+
*/
|
|
48
51
|
exports.databaseParentSchema = z.object({
|
|
49
52
|
type: z.literal('database_id'),
|
|
50
53
|
database_id: z.uuid(),
|
|
@@ -75,6 +78,9 @@ const agentParentSchema = z.object({
|
|
|
75
78
|
type: z.literal('agent_id'),
|
|
76
79
|
agent_id: z.uuid(),
|
|
77
80
|
});
|
|
81
|
+
/**
|
|
82
|
+
* @category Shared Types
|
|
83
|
+
*/
|
|
78
84
|
exports.parentSchema = z.discriminatedUnion('type', [
|
|
79
85
|
exports.databaseParentSchema,
|
|
80
86
|
dataSourceParentSchema,
|
|
@@ -300,7 +300,7 @@ declare const statusPropertySchema: z.ZodObject<{
|
|
|
300
300
|
}, z.core.$strip>>;
|
|
301
301
|
}, z.core.$strip>;
|
|
302
302
|
}, z.core.$strip>;
|
|
303
|
-
/** Title property configuration (empty object)
|
|
303
|
+
/** Title property configuration (empty object). Every data source requires exactly one. */
|
|
304
304
|
declare const titlePropertySchema: z.ZodObject<{
|
|
305
305
|
type: z.ZodLiteral<"title">;
|
|
306
306
|
id: z.ZodString;
|
|
@@ -328,7 +328,9 @@ declare const uniqueIdPropertySchema: z.ZodObject<{
|
|
|
328
328
|
}, z.core.$strip>;
|
|
329
329
|
/**
|
|
330
330
|
* Discriminated union of all data source property object types.
|
|
331
|
-
*
|
|
331
|
+
* Together they define the configuration for a data source, not the values.
|
|
332
|
+
*
|
|
333
|
+
* @category Page Properties
|
|
332
334
|
*/
|
|
333
335
|
export declare const propertyObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
334
336
|
type: z.ZodLiteral<"checkbox">;
|
|
@@ -614,7 +616,11 @@ export declare const propertyObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
614
616
|
prefix: z.ZodOptional<z.ZodString>;
|
|
615
617
|
}, z.core.$strip>;
|
|
616
618
|
}, z.core.$strip>], "type">;
|
|
617
|
-
/**
|
|
619
|
+
/**
|
|
620
|
+
* Record of property objects keyed by property name.
|
|
621
|
+
*
|
|
622
|
+
* @category Page Properties
|
|
623
|
+
*/
|
|
618
624
|
export declare const propertiesObjectSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
619
625
|
type: z.ZodLiteral<"checkbox">;
|
|
620
626
|
id: z.ZodString;
|
|
@@ -899,28 +905,100 @@ export declare const propertiesObjectSchema: z.ZodRecord<z.ZodString, z.ZodDiscr
|
|
|
899
905
|
prefix: z.ZodOptional<z.ZodString>;
|
|
900
906
|
}, z.core.$strip>;
|
|
901
907
|
}, z.core.$strip>], "type">>;
|
|
908
|
+
/**
|
|
909
|
+
* @category Page Properties
|
|
910
|
+
*/
|
|
902
911
|
export type NotionPropertyObject = z.infer<typeof propertyObjectSchema>;
|
|
912
|
+
/**
|
|
913
|
+
* @category Page Properties
|
|
914
|
+
*/
|
|
903
915
|
export type NotionPropertiesObject = z.infer<typeof propertiesObjectSchema>;
|
|
916
|
+
/**
|
|
917
|
+
* @category Page Properties
|
|
918
|
+
*/
|
|
904
919
|
export type CheckboxPropertyObject = z.infer<typeof checkboxPropertySchema>;
|
|
920
|
+
/**
|
|
921
|
+
* @category Page Properties
|
|
922
|
+
*/
|
|
905
923
|
export type CreatedByPropertyObject = z.infer<typeof createdByPropertySchema>;
|
|
924
|
+
/**
|
|
925
|
+
* @category Page Properties
|
|
926
|
+
*/
|
|
906
927
|
export type CreatedTimePropertyObject = z.infer<typeof createdTimePropertySchema>;
|
|
928
|
+
/**
|
|
929
|
+
* @category Page Properties
|
|
930
|
+
*/
|
|
907
931
|
export type DatePropertyObject = z.infer<typeof datePropertySchema>;
|
|
932
|
+
/**
|
|
933
|
+
* @category Page Properties
|
|
934
|
+
*/
|
|
908
935
|
export type EmailPropertyObject = z.infer<typeof emailPropertySchema>;
|
|
936
|
+
/**
|
|
937
|
+
* @category Page Properties
|
|
938
|
+
*/
|
|
909
939
|
export type FilesPropertyObject = z.infer<typeof filesPropertySchema>;
|
|
940
|
+
/**
|
|
941
|
+
* @category Page Properties
|
|
942
|
+
*/
|
|
910
943
|
export type FormulaPropertyObject = z.infer<typeof formulaPropertySchema>;
|
|
944
|
+
/**
|
|
945
|
+
* @category Page Properties
|
|
946
|
+
*/
|
|
911
947
|
export type LastEditedByPropertyObject = z.infer<typeof lastEditedByPropertySchema>;
|
|
948
|
+
/**
|
|
949
|
+
* @category Page Properties
|
|
950
|
+
*/
|
|
912
951
|
export type LastEditedTimePropertyObject = z.infer<typeof lastEditedTimePropertySchema>;
|
|
952
|
+
/**
|
|
953
|
+
* @category Page Properties
|
|
954
|
+
*/
|
|
913
955
|
export type MultiSelectPropertyObject = z.infer<typeof multiSelectPropertySchema>;
|
|
956
|
+
/**
|
|
957
|
+
* @category Page Properties
|
|
958
|
+
*/
|
|
914
959
|
export type NumberPropertyObject = z.infer<typeof numberPropertySchema>;
|
|
960
|
+
/**
|
|
961
|
+
* @category Page Properties
|
|
962
|
+
*/
|
|
915
963
|
export type PeoplePropertyObject = z.infer<typeof peoplePropertySchema>;
|
|
964
|
+
/**
|
|
965
|
+
* @category Page Properties
|
|
966
|
+
*/
|
|
916
967
|
export type PhoneNumberPropertyObject = z.infer<typeof phoneNumberPropertySchema>;
|
|
968
|
+
/**
|
|
969
|
+
* @category Page Properties
|
|
970
|
+
*/
|
|
917
971
|
export type PlacePropertyObject = z.infer<typeof placePropertySchema>;
|
|
972
|
+
/**
|
|
973
|
+
* @category Page Properties
|
|
974
|
+
*/
|
|
918
975
|
export type RelationPropertyObject = z.infer<typeof relationPropertySchema>;
|
|
976
|
+
/**
|
|
977
|
+
* @category Page Properties
|
|
978
|
+
*/
|
|
919
979
|
export type RichTextPropertyObject = z.infer<typeof richTextPropertySchema>;
|
|
980
|
+
/**
|
|
981
|
+
* @category Page Properties
|
|
982
|
+
*/
|
|
920
983
|
export type RollupPropertyObject = z.infer<typeof rollupPropertySchema>;
|
|
984
|
+
/**
|
|
985
|
+
* @category Page Properties
|
|
986
|
+
*/
|
|
921
987
|
export type SelectPropertyObject = z.infer<typeof selectPropertySchema>;
|
|
988
|
+
/**
|
|
989
|
+
* @category Page Properties
|
|
990
|
+
*/
|
|
922
991
|
export type StatusPropertyObject = z.infer<typeof statusPropertySchema>;
|
|
992
|
+
/**
|
|
993
|
+
* @category Page Properties
|
|
994
|
+
*/
|
|
923
995
|
export type TitlePropertyObject = z.infer<typeof titlePropertySchema>;
|
|
996
|
+
/**
|
|
997
|
+
* @category Page Properties
|
|
998
|
+
*/
|
|
924
999
|
export type UrlPropertyObject = z.infer<typeof urlPropertySchema>;
|
|
1000
|
+
/**
|
|
1001
|
+
* @category Page Properties
|
|
1002
|
+
*/
|
|
925
1003
|
export type UniqueIdPropertyObject = z.infer<typeof uniqueIdPropertySchema>;
|
|
926
1004
|
export {};
|
|
@@ -36,8 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.propertiesObjectSchema = exports.propertyObjectSchema = void 0;
|
|
37
37
|
const z = __importStar(require("zod"));
|
|
38
38
|
/**
|
|
39
|
-
* Data source property objects define the schema
|
|
40
|
-
*
|
|
39
|
+
* Data source property objects define the schema and configuration for a data source.
|
|
40
|
+
* Page property values contain the actual data instead.
|
|
41
41
|
*
|
|
42
42
|
* Notion API reference:
|
|
43
43
|
* https://developers.notion.com/reference/property-object
|
|
@@ -318,7 +318,7 @@ const statusPropertySchema = z.object({
|
|
|
318
318
|
groups: z.array(statusGroupSchema),
|
|
319
319
|
}),
|
|
320
320
|
});
|
|
321
|
-
/** Title property configuration (empty object)
|
|
321
|
+
/** Title property configuration (empty object). Every data source requires exactly one. */
|
|
322
322
|
const titlePropertySchema = z.object({
|
|
323
323
|
type: z.literal('title'),
|
|
324
324
|
id: z.string().trim(),
|
|
@@ -346,7 +346,9 @@ const uniqueIdPropertySchema = z.object({
|
|
|
346
346
|
});
|
|
347
347
|
/**
|
|
348
348
|
* Discriminated union of all data source property object types.
|
|
349
|
-
*
|
|
349
|
+
* Together they define the configuration for a data source, not the values.
|
|
350
|
+
*
|
|
351
|
+
* @category Page Properties
|
|
350
352
|
*/
|
|
351
353
|
exports.propertyObjectSchema = z.discriminatedUnion('type', [
|
|
352
354
|
checkboxPropertySchema,
|
|
@@ -372,5 +374,9 @@ exports.propertyObjectSchema = z.discriminatedUnion('type', [
|
|
|
372
374
|
urlPropertySchema,
|
|
373
375
|
uniqueIdPropertySchema,
|
|
374
376
|
]);
|
|
375
|
-
/**
|
|
377
|
+
/**
|
|
378
|
+
* Record of property objects keyed by property name.
|
|
379
|
+
*
|
|
380
|
+
* @category Page Properties
|
|
381
|
+
*/
|
|
376
382
|
exports.propertiesObjectSchema = z.record(z.string().trim(), exports.propertyObjectSchema);
|
|
@@ -180,6 +180,9 @@ declare const equationRichTextSchema: z.ZodObject<{
|
|
|
180
180
|
plain_text: z.ZodString;
|
|
181
181
|
href: z.ZodNullable<z.ZodURL>;
|
|
182
182
|
}, z.core.$strip>;
|
|
183
|
+
/**
|
|
184
|
+
* @category Rich Text
|
|
185
|
+
*/
|
|
183
186
|
export declare const richTextSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
184
187
|
type: z.ZodLiteral<"text">;
|
|
185
188
|
text: z.ZodObject<{
|
|
@@ -356,8 +359,20 @@ export declare const richTextSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
356
359
|
plain_text: z.ZodString;
|
|
357
360
|
href: z.ZodNullable<z.ZodURL>;
|
|
358
361
|
}, z.core.$strip>], "type">>;
|
|
362
|
+
/**
|
|
363
|
+
* @category Rich Text
|
|
364
|
+
*/
|
|
359
365
|
export type NotionRichText = z.infer<typeof richTextSchema>;
|
|
366
|
+
/**
|
|
367
|
+
* @category Rich Text
|
|
368
|
+
*/
|
|
360
369
|
export type TextRichText = z.infer<typeof textRichTextSchema>;
|
|
370
|
+
/**
|
|
371
|
+
* @category Rich Text
|
|
372
|
+
*/
|
|
361
373
|
export type MentionRichText = z.infer<typeof mentionRichTextSchema>;
|
|
374
|
+
/**
|
|
375
|
+
* @category Rich Text
|
|
376
|
+
*/
|
|
362
377
|
export type EquationRichText = z.infer<typeof equationRichTextSchema>;
|
|
363
378
|
export {};
|
|
@@ -41,9 +41,9 @@ const user_schema_1 = require("./user.schema");
|
|
|
41
41
|
/**
|
|
42
42
|
* Notion rich text object schema.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
* three types: text
|
|
46
|
-
* and equations
|
|
44
|
+
* Notion uses rich text throughout the API for formatted text content. It supports
|
|
45
|
+
* three types: text with optional links, mentions of users, pages, dates, and other
|
|
46
|
+
* objects, and equations in LaTeX. You can style all types with annotations.
|
|
47
47
|
*
|
|
48
48
|
* Notion API reference:
|
|
49
49
|
* https://developers.notion.com/reference/rich-text
|
|
@@ -147,4 +147,7 @@ const equationRichTextSchema = z.object({
|
|
|
147
147
|
plain_text: z.string(),
|
|
148
148
|
href: z.url().nullable(),
|
|
149
149
|
});
|
|
150
|
+
/**
|
|
151
|
+
* @category Rich Text
|
|
152
|
+
*/
|
|
150
153
|
exports.richTextSchema = z.array(z.discriminatedUnion('type', [textRichTextSchema, mentionRichTextSchema, equationRichTextSchema]));
|
|
@@ -7,9 +7,12 @@ import * as z from 'zod';
|
|
|
7
7
|
/**
|
|
8
8
|
* Notion date string schema.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* This schema validates ISO 8601 date strings from the Notion API.
|
|
11
|
+
* It accepts a date-only format ("2023-02-23") and a full date-time format
|
|
12
|
+
* ("2023-02-23T00:00:00.000Z").
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* The Notion API docs describe date fields as "A date, with an optional time".
|
|
15
|
+
*
|
|
16
|
+
* @category Shared Types
|
|
14
17
|
*/
|
|
15
18
|
export declare const notionDateStringSchema: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
@@ -43,10 +43,13 @@ const z = __importStar(require("zod"));
|
|
|
43
43
|
/**
|
|
44
44
|
* Notion date string schema.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* This schema validates ISO 8601 date strings from the Notion API.
|
|
47
|
+
* It accepts a date-only format ("2023-02-23") and a full date-time format
|
|
48
|
+
* ("2023-02-23T00:00:00.000Z").
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
+
* The Notion API docs describe date fields as "A date, with an optional time".
|
|
51
|
+
*
|
|
52
|
+
* @category Shared Types
|
|
50
53
|
*/
|
|
51
54
|
exports.notionDateStringSchema = z.union([
|
|
52
55
|
z.iso.datetime(), // Full ISO 8601 datetime: "2023-02-23T00:00:00.000Z"
|