@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
|
@@ -5,10 +5,12 @@ const base_model_1 = require("./base.model");
|
|
|
5
5
|
const schemas_1 = require("../schemas");
|
|
6
6
|
/**
|
|
7
7
|
* Page model wrapping a validated Notion page object with helper methods.
|
|
8
|
+
*
|
|
9
|
+
* @category Pages
|
|
8
10
|
*/
|
|
9
11
|
class Page extends base_model_1.BaseModel {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data, schemas_1.pageSchema);
|
|
12
|
+
constructor(data, trusted) {
|
|
13
|
+
super(data, schemas_1.pageSchema, trusted);
|
|
12
14
|
}
|
|
13
15
|
get object() {
|
|
14
16
|
return this.data.object;
|
|
@@ -17,10 +19,12 @@ class Page extends base_model_1.BaseModel {
|
|
|
17
19
|
return this.data.id;
|
|
18
20
|
}
|
|
19
21
|
get createdTime() {
|
|
20
|
-
|
|
22
|
+
this.cachedCreatedTimeMs ??= new Date(this.data.created_time).getTime();
|
|
23
|
+
return new Date(this.cachedCreatedTimeMs);
|
|
21
24
|
}
|
|
22
25
|
get lastEditedTime() {
|
|
23
|
-
|
|
26
|
+
this.cachedLastEditedTimeMs ??= new Date(this.data.last_edited_time).getTime();
|
|
27
|
+
return new Date(this.cachedLastEditedTimeMs);
|
|
24
28
|
}
|
|
25
29
|
get inTrash() {
|
|
26
30
|
return this.data.in_trash;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type NotionRichText } from '../schemas';
|
|
2
2
|
/**
|
|
3
|
-
* RichText helper class
|
|
3
|
+
* RichText helper class to work with Notion rich text arrays.
|
|
4
|
+
*
|
|
5
|
+
* @category Rich Text
|
|
4
6
|
*/
|
|
5
7
|
export declare class RichText {
|
|
6
8
|
private readonly data;
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RichText = void 0;
|
|
4
4
|
const schemas_1 = require("../schemas");
|
|
5
5
|
/**
|
|
6
|
-
* RichText helper class
|
|
6
|
+
* RichText helper class to work with Notion rich text arrays.
|
|
7
|
+
*
|
|
8
|
+
* @category Rich Text
|
|
7
9
|
*/
|
|
8
10
|
class RichText {
|
|
9
11
|
constructor(data) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { BaseModel } from './base.model';
|
|
1
|
+
import { BaseModel, type TRUSTED } from './base.model';
|
|
2
2
|
import { type BotUser, type NotionUser, type PersonUser } from '../schemas';
|
|
3
3
|
/**
|
|
4
4
|
* User model wrapping a validated Notion user object with helper methods.
|
|
5
|
+
*
|
|
6
|
+
* @category Users
|
|
5
7
|
*/
|
|
6
8
|
export declare class User extends BaseModel<NotionUser> {
|
|
7
|
-
constructor(data: unknown);
|
|
9
|
+
constructor(data: unknown, trusted?: typeof TRUSTED);
|
|
8
10
|
get object(): string;
|
|
9
11
|
get id(): string;
|
|
10
12
|
get type(): 'person' | 'bot' | undefined;
|
|
@@ -5,10 +5,12 @@ const base_model_1 = require("./base.model");
|
|
|
5
5
|
const schemas_1 = require("../schemas");
|
|
6
6
|
/**
|
|
7
7
|
* User model wrapping a validated Notion user object with helper methods.
|
|
8
|
+
*
|
|
9
|
+
* @category Users
|
|
8
10
|
*/
|
|
9
11
|
class User extends base_model_1.BaseModel {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data, schemas_1.userSchema);
|
|
12
|
+
constructor(data, trusted) {
|
|
13
|
+
super(data, schemas_1.userSchema, trusted);
|
|
12
14
|
}
|
|
13
15
|
get object() {
|
|
14
16
|
return this.data.object;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { BaseModel } from './base.model';
|
|
1
|
+
import { BaseModel, type TRUSTED } from './base.model';
|
|
2
2
|
import { type NotionParent, type NotionUser, type NotionView, type ViewConfiguration, type ViewType } from '../schemas';
|
|
3
3
|
/**
|
|
4
4
|
* View model class with helper methods.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* A view controls how a database or data source shows its rows, for example as a
|
|
7
|
+
* table, board, or calendar.
|
|
8
|
+
*
|
|
9
|
+
* @category Views
|
|
8
10
|
*/
|
|
9
11
|
export declare class View extends BaseModel<NotionView> {
|
|
10
|
-
constructor(data: NotionView);
|
|
12
|
+
constructor(data: NotionView, trusted?: typeof TRUSTED);
|
|
11
13
|
/**
|
|
12
14
|
* Returns "view" - the object type.
|
|
13
15
|
*/
|
|
@@ -29,7 +31,7 @@ export declare class View extends BaseModel<NotionView> {
|
|
|
29
31
|
*/
|
|
30
32
|
get name(): string;
|
|
31
33
|
/**
|
|
32
|
-
* Returns the view type
|
|
34
|
+
* Returns the view type, for example table, board, or calendar.
|
|
33
35
|
*/
|
|
34
36
|
get type(): ViewType;
|
|
35
37
|
/**
|
|
@@ -69,11 +71,11 @@ export declare class View extends BaseModel<NotionView> {
|
|
|
69
71
|
*/
|
|
70
72
|
get url(): string;
|
|
71
73
|
/**
|
|
72
|
-
* Returns the
|
|
74
|
+
* Returns the widget ID, if a dashboard shows this view as a widget.
|
|
73
75
|
*/
|
|
74
76
|
get dashboardViewId(): string | undefined;
|
|
75
77
|
/**
|
|
76
|
-
* Returns whether
|
|
78
|
+
* Returns whether a dashboard shows this view as a widget.
|
|
77
79
|
*/
|
|
78
80
|
isWidgetView(): boolean;
|
|
79
81
|
}
|
|
@@ -6,12 +6,14 @@ const schemas_1 = require("../schemas");
|
|
|
6
6
|
/**
|
|
7
7
|
* View model class with helper methods.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* A view controls how a database or data source shows its rows, for example as a
|
|
10
|
+
* table, board, or calendar.
|
|
11
|
+
*
|
|
12
|
+
* @category Views
|
|
11
13
|
*/
|
|
12
14
|
class View extends base_model_1.BaseModel {
|
|
13
|
-
constructor(data) {
|
|
14
|
-
super(data, schemas_1.viewSchema);
|
|
15
|
+
constructor(data, trusted) {
|
|
16
|
+
super(data, schemas_1.viewSchema, trusted);
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Returns "view" - the object type.
|
|
@@ -44,7 +46,7 @@ class View extends base_model_1.BaseModel {
|
|
|
44
46
|
return this.data.name;
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
47
|
-
* Returns the view type
|
|
49
|
+
* Returns the view type, for example table, board, or calendar.
|
|
48
50
|
*/
|
|
49
51
|
get type() {
|
|
50
52
|
return this.data.type;
|
|
@@ -104,13 +106,13 @@ class View extends base_model_1.BaseModel {
|
|
|
104
106
|
return this.data.url;
|
|
105
107
|
}
|
|
106
108
|
/**
|
|
107
|
-
* Returns the
|
|
109
|
+
* Returns the widget ID, if a dashboard shows this view as a widget.
|
|
108
110
|
*/
|
|
109
111
|
get dashboardViewId() {
|
|
110
112
|
return this.data.dashboard_view_id;
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
113
|
-
* Returns whether
|
|
115
|
+
* Returns whether a dashboard shows this view as a widget.
|
|
114
116
|
*/
|
|
115
117
|
isWidgetView() {
|
|
116
118
|
return this.data.dashboard_view_id !== undefined;
|
package/dist/notion.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type NotionClientOptions } from './client';
|
|
2
2
|
import { AsyncTasksAPI, BlocksAPI, CommentsAPI, CustomEmojisAPI, DatabasesAPI, DataSourcesAPI, FileUploadsAPI, PagesAPI, SearchAPI, UsersAPI, ViewsAPI } from './api';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* The public entry point for the SDK.
|
|
5
|
+
*
|
|
6
|
+
* Create one `Notion` instance, then call its API properties, such as
|
|
7
|
+
* `pages` or `blocks`, to reach Notion endpoints.
|
|
5
8
|
*
|
|
6
9
|
* @example
|
|
7
10
|
* ```typescript
|
|
@@ -46,6 +49,8 @@ import { AsyncTasksAPI, BlocksAPI, CommentsAPI, CustomEmojisAPI, DatabasesAPI, D
|
|
|
46
49
|
*
|
|
47
50
|
* const emojis = await notion.customEmojis.list();
|
|
48
51
|
* ```
|
|
52
|
+
*
|
|
53
|
+
* @category Client & Core
|
|
49
54
|
*/
|
|
50
55
|
export declare class Notion {
|
|
51
56
|
private readonly client;
|
package/dist/notion.js
CHANGED
|
@@ -4,7 +4,10 @@ exports.Notion = void 0;
|
|
|
4
4
|
const client_1 = require("./client");
|
|
5
5
|
const api_1 = require("./api");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* The public entry point for the SDK.
|
|
8
|
+
*
|
|
9
|
+
* Create one `Notion` instance, then call its API properties, such as
|
|
10
|
+
* `pages` or `blocks`, to reach Notion endpoints.
|
|
8
11
|
*
|
|
9
12
|
* @example
|
|
10
13
|
* ```typescript
|
|
@@ -49,6 +52,8 @@ const api_1 = require("./api");
|
|
|
49
52
|
*
|
|
50
53
|
* const emojis = await notion.customEmojis.list();
|
|
51
54
|
* ```
|
|
55
|
+
*
|
|
56
|
+
* @category Client & Core
|
|
52
57
|
*/
|
|
53
58
|
class Notion {
|
|
54
59
|
constructor(options) {
|
|
@@ -8,9 +8,17 @@ import * as z from 'zod';
|
|
|
8
8
|
*
|
|
9
9
|
* Notion API reference:
|
|
10
10
|
* https://developers.notion.com/reference/retrieve-async-task
|
|
11
|
+
*
|
|
12
|
+
* @category Async Tasks
|
|
11
13
|
*/
|
|
12
14
|
export declare const ASYNC_TASK_STATUSES: readonly ["queued", "running", "retrying", "succeeded", "failed"];
|
|
15
|
+
/**
|
|
16
|
+
* @category Async Tasks
|
|
17
|
+
*/
|
|
13
18
|
export type AsyncTaskStatus = (typeof ASYNC_TASK_STATUSES)[number];
|
|
19
|
+
/**
|
|
20
|
+
* @category Async Tasks
|
|
21
|
+
*/
|
|
14
22
|
export declare const asyncTaskSchema: z.ZodObject<{
|
|
15
23
|
object: z.ZodLiteral<"async_task">;
|
|
16
24
|
id: z.ZodUUID;
|
|
@@ -39,4 +47,7 @@ export declare const asyncTaskSchema: z.ZodObject<{
|
|
|
39
47
|
message: z.ZodString;
|
|
40
48
|
}, z.core.$strip>>;
|
|
41
49
|
}, z.core.$strip>;
|
|
50
|
+
/**
|
|
51
|
+
* @category Async Tasks
|
|
52
|
+
*/
|
|
42
53
|
export type NotionAsyncTask = z.infer<typeof asyncTaskSchema>;
|
|
@@ -45,6 +45,8 @@ const shared_schema_1 = require("./shared.schema");
|
|
|
45
45
|
*
|
|
46
46
|
* Notion API reference:
|
|
47
47
|
* https://developers.notion.com/reference/retrieve-async-task
|
|
48
|
+
*
|
|
49
|
+
* @category Async Tasks
|
|
48
50
|
*/
|
|
49
51
|
exports.ASYNC_TASK_STATUSES = [
|
|
50
52
|
'queued',
|
|
@@ -66,6 +68,9 @@ const asyncTaskErrorSchema = z.object({
|
|
|
66
68
|
code: z.string().trim(),
|
|
67
69
|
message: z.string().trim(),
|
|
68
70
|
});
|
|
71
|
+
/**
|
|
72
|
+
* @category Async Tasks
|
|
73
|
+
*/
|
|
69
74
|
exports.asyncTaskSchema = z.object({
|
|
70
75
|
object: z.literal('async_task'),
|
|
71
76
|
id: z.uuid(),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
* Position
|
|
3
|
+
* Position to insert block children in the Append Block Children endpoint.
|
|
4
|
+
*
|
|
5
|
+
* @category Blocks
|
|
4
6
|
*/
|
|
5
7
|
export declare const blockPositionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
8
|
type: z.ZodLiteral<"after_block">;
|
|
@@ -12,7 +14,13 @@ export declare const blockPositionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
12
14
|
}, z.core.$strip>, z.ZodObject<{
|
|
13
15
|
type: z.ZodLiteral<"end">;
|
|
14
16
|
}, z.core.$strip>], "type">;
|
|
17
|
+
/**
|
|
18
|
+
* @category Blocks
|
|
19
|
+
*/
|
|
15
20
|
export type BlockPosition = z.infer<typeof blockPositionSchema>;
|
|
21
|
+
/**
|
|
22
|
+
* @category Blocks
|
|
23
|
+
*/
|
|
16
24
|
export declare const blockSchema: z.ZodObject<{
|
|
17
25
|
object: z.ZodLiteral<"block">;
|
|
18
26
|
id: z.ZodUUID;
|
|
@@ -4177,4 +4185,7 @@ export declare const blockSchema: z.ZodObject<{
|
|
|
4177
4185
|
}, z.core.$strip>;
|
|
4178
4186
|
}, z.core.$strip>], "type">>;
|
|
4179
4187
|
}, z.core.$strip>;
|
|
4188
|
+
/**
|
|
4189
|
+
* @category Blocks
|
|
4190
|
+
*/
|
|
4180
4191
|
export type NotionBlock = z.infer<typeof blockSchema>;
|
|
@@ -58,7 +58,9 @@ const getChildrenSchema = () => {
|
|
|
58
58
|
return childrenSchema;
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
|
-
* Position
|
|
61
|
+
* Position to insert block children in the Append Block Children endpoint.
|
|
62
|
+
*
|
|
63
|
+
* @category Blocks
|
|
62
64
|
*/
|
|
63
65
|
exports.blockPositionSchema = z.discriminatedUnion('type', [
|
|
64
66
|
z.object({ type: z.literal('after_block'), after_block: z.object({ id: z.uuid() }) }),
|
|
@@ -73,6 +75,9 @@ const headingsObjectSchema = z.object({
|
|
|
73
75
|
return getChildrenSchema();
|
|
74
76
|
},
|
|
75
77
|
});
|
|
78
|
+
/**
|
|
79
|
+
* @category Blocks
|
|
80
|
+
*/
|
|
76
81
|
exports.blockSchema = z.object({
|
|
77
82
|
object: z.literal('block'),
|
|
78
83
|
id: z.uuid(),
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
/** All programming languages supported by Notion code blocks.
|
|
1
|
+
/** All programming languages supported by Notion code blocks.
|
|
2
|
+
*
|
|
3
|
+
* @category Blocks
|
|
4
|
+
*/
|
|
2
5
|
export declare const CODE_BLOCK_LANGUAGES: readonly ["abap", "arduino", "bash", "basic", "c", "clojure", "coffeescript", "c++", "c#", "css", "dart", "diff", "docker", "elixir", "elm", "erlang", "flow", "fortran", "f#", "gherkin", "glsl", "go", "graphql", "groovy", "haskell", "html", "java", "javascript", "json", "julia", "kotlin", "latex", "less", "lisp", "livescript", "lua", "makefile", "markdown", "markup", "matlab", "mermaid", "nix", "objective-c", "ocaml", "pascal", "perl", "php", "plain text", "powershell", "prolog", "protobuf", "python", "r", "reason", "ruby", "rust", "sass", "scala", "scheme", "scss", "shell", "sql", "swift", "typescript", "vb.net", "verilog", "vhdl", "visual basic", "webassembly", "xml", "yaml", "java/c/c++/c#"];
|
|
6
|
+
/**
|
|
7
|
+
* @category Blocks
|
|
8
|
+
*/
|
|
3
9
|
export type CodeBlockLanguage = (typeof CODE_BLOCK_LANGUAGES)[number];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CODE_BLOCK_LANGUAGES = void 0;
|
|
4
|
-
/** All programming languages supported by Notion code blocks.
|
|
4
|
+
/** All programming languages supported by Notion code blocks.
|
|
5
|
+
*
|
|
6
|
+
* @category Blocks
|
|
7
|
+
*/
|
|
5
8
|
exports.CODE_BLOCK_LANGUAGES = [
|
|
6
9
|
'abap',
|
|
7
10
|
'arduino',
|
package/dist/schemas/colors.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
/** All color options supported by Notion.
|
|
1
|
+
/** All color options supported by Notion.
|
|
2
|
+
*
|
|
3
|
+
* @category Shared Types
|
|
4
|
+
*/
|
|
2
5
|
export declare const NOTION_COLORS: readonly ["blue", "blue_background", "brown", "brown_background", "default", "gray", "gray_background", "green", "green_background", "orange", "orange_background", "pink", "pink_background", "purple", "purple_background", "red", "red_background", "yellow", "yellow_background"];
|
|
6
|
+
/**
|
|
7
|
+
* @category Shared Types
|
|
8
|
+
*/
|
|
3
9
|
export type NotionColor = (typeof NOTION_COLORS)[number];
|
package/dist/schemas/colors.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NOTION_COLORS = void 0;
|
|
4
|
-
/** All color options supported by Notion.
|
|
4
|
+
/** All color options supported by Notion.
|
|
5
|
+
*
|
|
6
|
+
* @category Shared Types
|
|
7
|
+
*/
|
|
5
8
|
exports.NOTION_COLORS = [
|
|
6
9
|
'blue',
|
|
7
10
|
'blue_background',
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
/** Comment attachment schema.
|
|
2
|
+
/** Comment attachment schema.
|
|
3
|
+
*
|
|
4
|
+
* @category Comments
|
|
5
|
+
*/
|
|
3
6
|
export declare const commentAttachmentSchema: z.ZodObject<{
|
|
4
7
|
category: z.ZodEnum<{
|
|
5
8
|
file: "file";
|
|
@@ -13,8 +16,14 @@ export declare const commentAttachmentSchema: z.ZodObject<{
|
|
|
13
16
|
expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
14
17
|
}, z.core.$strip>;
|
|
15
18
|
}, z.core.$strip>;
|
|
19
|
+
/**
|
|
20
|
+
* @category Comments
|
|
21
|
+
*/
|
|
16
22
|
export type CommentAttachment = z.infer<typeof commentAttachmentSchema>;
|
|
17
|
-
/** Comment display name schema (user or custom).
|
|
23
|
+
/** Comment display name schema (user or custom).
|
|
24
|
+
*
|
|
25
|
+
* @category Comments
|
|
26
|
+
*/
|
|
18
27
|
export declare const commentDisplayNameSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
19
28
|
type: z.ZodLiteral<"user">;
|
|
20
29
|
resolved_name: z.ZodString;
|
|
@@ -22,7 +31,13 @@ export declare const commentDisplayNameSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
22
31
|
type: z.ZodLiteral<"custom">;
|
|
23
32
|
resolved_name: z.ZodString;
|
|
24
33
|
}, z.core.$strip>]>;
|
|
34
|
+
/**
|
|
35
|
+
* @category Comments
|
|
36
|
+
*/
|
|
25
37
|
export type CommentDisplayName = z.infer<typeof commentDisplayNameSchema>;
|
|
38
|
+
/**
|
|
39
|
+
* @category Comments
|
|
40
|
+
*/
|
|
26
41
|
export declare const commentSchema: z.ZodObject<{
|
|
27
42
|
object: z.ZodLiteral<"comment">;
|
|
28
43
|
id: z.ZodUUID;
|
|
@@ -279,4 +294,7 @@ export declare const commentSchema: z.ZodObject<{
|
|
|
279
294
|
resolved_name: z.ZodString;
|
|
280
295
|
}, z.core.$strip>]>>;
|
|
281
296
|
}, z.core.$strip>;
|
|
297
|
+
/**
|
|
298
|
+
* @category Comments
|
|
299
|
+
*/
|
|
282
300
|
export type NotionComment = z.infer<typeof commentSchema>;
|
|
@@ -53,12 +53,18 @@ const commentAttachmentFileSchema = z.object({
|
|
|
53
53
|
url: z.url(),
|
|
54
54
|
expiry_time: shared_schema_1.notionDateStringSchema,
|
|
55
55
|
});
|
|
56
|
-
/** Comment attachment schema.
|
|
56
|
+
/** Comment attachment schema.
|
|
57
|
+
*
|
|
58
|
+
* @category Comments
|
|
59
|
+
*/
|
|
57
60
|
exports.commentAttachmentSchema = z.object({
|
|
58
61
|
category: z.enum(['image', 'video', 'file', 'audio', 'pdf']),
|
|
59
62
|
file: commentAttachmentFileSchema,
|
|
60
63
|
});
|
|
61
|
-
/** Comment display name schema (user or custom).
|
|
64
|
+
/** Comment display name schema (user or custom).
|
|
65
|
+
*
|
|
66
|
+
* @category Comments
|
|
67
|
+
*/
|
|
62
68
|
exports.commentDisplayNameSchema = z.union([
|
|
63
69
|
z.object({
|
|
64
70
|
type: z.literal('user'),
|
|
@@ -69,6 +75,9 @@ exports.commentDisplayNameSchema = z.union([
|
|
|
69
75
|
resolved_name: z.string().trim(),
|
|
70
76
|
}),
|
|
71
77
|
]);
|
|
78
|
+
/**
|
|
79
|
+
* @category Comments
|
|
80
|
+
*/
|
|
72
81
|
exports.commentSchema = z.object({
|
|
73
82
|
object: z.literal('comment'),
|
|
74
83
|
id: z.uuid(),
|
|
@@ -4,10 +4,15 @@ import * as z from 'zod';
|
|
|
4
4
|
*
|
|
5
5
|
* Notion API reference:
|
|
6
6
|
* https://developers.notion.com/reference/list-custom-emojis
|
|
7
|
+
*
|
|
8
|
+
* @category Custom Emoji & Icons
|
|
7
9
|
*/
|
|
8
10
|
export declare const customEmojiSchema: z.ZodObject<{
|
|
9
11
|
id: z.ZodUUID;
|
|
10
12
|
name: z.ZodString;
|
|
11
13
|
url: z.ZodURL;
|
|
12
14
|
}, z.core.$strip>;
|
|
15
|
+
/**
|
|
16
|
+
* @category Custom Emoji & Icons
|
|
17
|
+
*/
|
|
13
18
|
export type NotionCustomEmoji = z.infer<typeof customEmojiSchema>;
|
|
@@ -7,6 +7,8 @@ import * as z from 'zod';
|
|
|
7
7
|
*
|
|
8
8
|
* Notion API reference:
|
|
9
9
|
* https://developers.notion.com/reference/data-source
|
|
10
|
+
*
|
|
11
|
+
* @category Databases & Data Sources
|
|
10
12
|
*/
|
|
11
13
|
export declare const dataSourceSchema: z.ZodObject<{
|
|
12
14
|
object: z.ZodLiteral<"data_source">;
|
|
@@ -821,21 +823,32 @@ export declare const dataSourceSchema: z.ZodObject<{
|
|
|
821
823
|
is_inline: z.ZodBoolean;
|
|
822
824
|
in_trash: z.ZodBoolean;
|
|
823
825
|
}, z.core.$strip>;
|
|
826
|
+
/**
|
|
827
|
+
* @category Databases & Data Sources
|
|
828
|
+
*/
|
|
824
829
|
export type NotionDataSource = z.infer<typeof dataSourceSchema>;
|
|
825
830
|
/**
|
|
826
|
-
* A single data source template reference
|
|
827
|
-
*
|
|
831
|
+
* A single data source template reference. The List data source templates endpoint
|
|
832
|
+
* returns an array of these.
|
|
828
833
|
*
|
|
829
834
|
* Notion API reference:
|
|
830
835
|
* https://developers.notion.com/reference/list-data-source-templates
|
|
836
|
+
*
|
|
837
|
+
* @category Databases & Data Sources
|
|
831
838
|
*/
|
|
832
839
|
export declare const dataSourceTemplateSchema: z.ZodObject<{
|
|
833
840
|
id: z.ZodUUID;
|
|
834
841
|
name: z.ZodString;
|
|
835
842
|
is_default: z.ZodBoolean;
|
|
836
843
|
}, z.core.$strip>;
|
|
844
|
+
/**
|
|
845
|
+
* @category Databases & Data Sources
|
|
846
|
+
*/
|
|
837
847
|
export type DataSourceTemplate = z.infer<typeof dataSourceTemplateSchema>;
|
|
838
|
-
/** Response shape of the List data source templates endpoint.
|
|
848
|
+
/** Response shape of the List data source templates endpoint.
|
|
849
|
+
*
|
|
850
|
+
* @category Databases & Data Sources
|
|
851
|
+
*/
|
|
839
852
|
export declare const dataSourceTemplateListSchema: z.ZodObject<{
|
|
840
853
|
templates: z.ZodArray<z.ZodObject<{
|
|
841
854
|
id: z.ZodUUID;
|
|
@@ -845,4 +858,7 @@ export declare const dataSourceTemplateListSchema: z.ZodObject<{
|
|
|
845
858
|
has_more: z.ZodBoolean;
|
|
846
859
|
next_cursor: z.ZodNullable<z.ZodString>;
|
|
847
860
|
}, z.core.$strip>;
|
|
861
|
+
/**
|
|
862
|
+
* @category Databases & Data Sources
|
|
863
|
+
*/
|
|
848
864
|
export type DataSourceTemplateList = z.infer<typeof dataSourceTemplateListSchema>;
|
|
@@ -50,6 +50,8 @@ const propertyObjects_schema_1 = require("./propertyObjects.schema");
|
|
|
50
50
|
*
|
|
51
51
|
* Notion API reference:
|
|
52
52
|
* https://developers.notion.com/reference/data-source
|
|
53
|
+
*
|
|
54
|
+
* @category Databases & Data Sources
|
|
53
55
|
*/
|
|
54
56
|
exports.dataSourceSchema = z.object({
|
|
55
57
|
/** Always "data_source" */
|
|
@@ -62,11 +64,11 @@ exports.dataSourceSchema = z.object({
|
|
|
62
64
|
parent: parent_schema_1.parentSchema,
|
|
63
65
|
/** Information about the database's parent (the data source's grandparent) */
|
|
64
66
|
database_parent: parent_schema_1.parentSchema,
|
|
65
|
-
/**
|
|
67
|
+
/** Creation date and time for this data source, in ISO 8601 format */
|
|
66
68
|
created_time: shared_schema_1.notionDateStringSchema,
|
|
67
69
|
/** User who created the data source */
|
|
68
70
|
created_by: user_schema_1.userSchema,
|
|
69
|
-
/**
|
|
71
|
+
/** Last edited date and time for this data source, in ISO 8601 format */
|
|
70
72
|
last_edited_time: shared_schema_1.notionDateStringSchema,
|
|
71
73
|
/** User who last edited the data source */
|
|
72
74
|
last_edited_by: user_schema_1.userSchema,
|
|
@@ -88,18 +90,23 @@ exports.dataSourceSchema = z.object({
|
|
|
88
90
|
in_trash: z.boolean(),
|
|
89
91
|
});
|
|
90
92
|
/**
|
|
91
|
-
* A single data source template reference
|
|
92
|
-
*
|
|
93
|
+
* A single data source template reference. The List data source templates endpoint
|
|
94
|
+
* returns an array of these.
|
|
93
95
|
*
|
|
94
96
|
* Notion API reference:
|
|
95
97
|
* https://developers.notion.com/reference/list-data-source-templates
|
|
98
|
+
*
|
|
99
|
+
* @category Databases & Data Sources
|
|
96
100
|
*/
|
|
97
101
|
exports.dataSourceTemplateSchema = z.object({
|
|
98
102
|
id: z.uuid(),
|
|
99
103
|
name: z.string().trim(),
|
|
100
104
|
is_default: z.boolean(),
|
|
101
105
|
});
|
|
102
|
-
/** Response shape of the List data source templates endpoint.
|
|
106
|
+
/** Response shape of the List data source templates endpoint.
|
|
107
|
+
*
|
|
108
|
+
* @category Databases & Data Sources
|
|
109
|
+
*/
|
|
103
110
|
exports.dataSourceTemplateListSchema = z.object({
|
|
104
111
|
templates: z.array(exports.dataSourceTemplateSchema),
|
|
105
112
|
has_more: z.boolean(),
|
|
@@ -8,12 +8,21 @@ import * as z from 'zod';
|
|
|
8
8
|
* Notion API reference:
|
|
9
9
|
* https://developers.notion.com/reference/database
|
|
10
10
|
*/
|
|
11
|
-
/** Data source reference with id and name.
|
|
11
|
+
/** Data source reference with id and name.
|
|
12
|
+
*
|
|
13
|
+
* @category Databases & Data Sources
|
|
14
|
+
*/
|
|
12
15
|
export declare const dataSourceRefSchema: z.ZodObject<{
|
|
13
16
|
id: z.ZodUUID;
|
|
14
17
|
name: z.ZodString;
|
|
15
18
|
}, z.core.$strip>;
|
|
19
|
+
/**
|
|
20
|
+
* @category Databases & Data Sources
|
|
21
|
+
*/
|
|
16
22
|
export type DataSourceRef = z.infer<typeof dataSourceRefSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* @category Databases & Data Sources
|
|
25
|
+
*/
|
|
17
26
|
export declare const databaseSchema: z.ZodObject<{
|
|
18
27
|
object: z.ZodLiteral<"database">;
|
|
19
28
|
id: z.ZodUUID;
|
|
@@ -528,4 +537,7 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
528
537
|
is_locked: z.ZodOptional<z.ZodBoolean>;
|
|
529
538
|
public_url: z.ZodNullable<z.ZodURL>;
|
|
530
539
|
}, z.core.$strip>;
|
|
540
|
+
/**
|
|
541
|
+
* @category Databases & Data Sources
|
|
542
|
+
*/
|
|
531
543
|
export type NotionDatabase = z.infer<typeof databaseSchema>;
|
|
@@ -50,11 +50,17 @@ const user_schema_1 = require("./user.schema");
|
|
|
50
50
|
* Notion API reference:
|
|
51
51
|
* https://developers.notion.com/reference/database
|
|
52
52
|
*/
|
|
53
|
-
/** Data source reference with id and name.
|
|
53
|
+
/** Data source reference with id and name.
|
|
54
|
+
*
|
|
55
|
+
* @category Databases & Data Sources
|
|
56
|
+
*/
|
|
54
57
|
exports.dataSourceRefSchema = z.object({
|
|
55
58
|
id: z.uuid(),
|
|
56
59
|
name: z.string().trim(),
|
|
57
60
|
});
|
|
61
|
+
/**
|
|
62
|
+
* @category Databases & Data Sources
|
|
63
|
+
*/
|
|
58
64
|
exports.databaseSchema = z.object({
|
|
59
65
|
object: z.literal('database'),
|
|
60
66
|
id: z.uuid(),
|
|
@@ -2,14 +2,19 @@ import * as z from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* Notion emoji object schema.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* You can use emojis as icons for pages, databases, and other objects.
|
|
6
|
+
* This schema stores the emoji character as a string.
|
|
7
7
|
*
|
|
8
8
|
* Notion API reference:
|
|
9
9
|
* https://developers.notion.com/reference/emoji-object
|
|
10
|
+
*
|
|
11
|
+
* @category Custom Emoji & Icons
|
|
10
12
|
*/
|
|
11
13
|
export declare const emojiSchema: z.ZodObject<{
|
|
12
14
|
type: z.ZodLiteral<"emoji">;
|
|
13
15
|
emoji: z.ZodString;
|
|
14
16
|
}, z.core.$strip>;
|
|
17
|
+
/**
|
|
18
|
+
* @category Custom Emoji & Icons
|
|
19
|
+
*/
|
|
15
20
|
export type NotionEmoji = z.infer<typeof emojiSchema>;
|