@visus-io/notion-sdk-ts 2.0.1 → 3.0.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 +66 -23
- package/dist/api/base.api.d.ts +1 -1
- package/dist/api/blocks.api.d.ts +266 -87
- package/dist/api/comments.api.d.ts +7 -7
- package/dist/api/dataSources.api.d.ts +28 -31
- package/dist/api/dataSources.api.js +18 -19
- package/dist/api/databases.api.d.ts +27 -22
- package/dist/api/databases.api.js +18 -8
- package/dist/api/fileUploads.api.d.ts +2 -2
- package/dist/api/pages.api.d.ts +43 -38
- package/dist/api/pages.api.js +18 -8
- package/dist/api/users.api.d.ts +1 -1
- package/dist/client.d.ts +5 -3
- package/dist/client.js +7 -3
- package/dist/helpers/block.helpers.d.ts +4 -0
- package/dist/helpers/block.helpers.js +11 -0
- package/dist/helpers/parent.helpers.d.ts +2 -2
- package/dist/helpers/parent.helpers.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/models/base.model.d.ts +2 -2
- package/dist/models/block.model.d.ts +0 -1
- package/dist/models/block.model.js +0 -3
- package/dist/models/dataSource.model.d.ts +0 -4
- package/dist/models/dataSource.model.js +0 -6
- package/dist/models/database.model.d.ts +0 -4
- package/dist/models/database.model.js +0 -6
- package/dist/models/page.model.d.ts +0 -1
- package/dist/models/page.model.js +0 -3
- package/dist/schemas/block.schema.d.ts +275 -82
- package/dist/schemas/block.schema.js +165 -82
- package/dist/schemas/comment.schema.d.ts +9 -9
- package/dist/schemas/comment.schema.js +54 -20
- package/dist/schemas/dataSource.schema.d.ts +13 -14
- package/dist/schemas/dataSource.schema.js +46 -14
- package/dist/schemas/database.schema.d.ts +13 -14
- package/dist/schemas/database.schema.js +50 -17
- package/dist/schemas/emoji.schema.d.ts +1 -1
- package/dist/schemas/emoji.schema.js +37 -4
- package/dist/schemas/file.schema.d.ts +3 -3
- package/dist/schemas/file.schema.js +49 -15
- package/dist/schemas/fileUpload.schema.d.ts +3 -3
- package/dist/schemas/fileUpload.schema.js +47 -13
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/page.schema.d.ts +30 -31
- package/dist/schemas/page.schema.js +46 -13
- package/dist/schemas/pageProperties.schema.d.ts +47 -47
- package/dist/schemas/pageProperties.schema.js +162 -128
- package/dist/schemas/pagination.schema.d.ts +1 -1
- package/dist/schemas/pagination.schema.js +40 -7
- package/dist/schemas/parent.schema.d.ts +1 -1
- package/dist/schemas/parent.schema.js +51 -18
- package/dist/schemas/propertyObjects.schema.d.ts +1 -1
- package/dist/schemas/propertyObjects.schema.js +194 -161
- package/dist/schemas/richText.schema.d.ts +7 -7
- package/dist/schemas/richText.schema.js +95 -56
- package/dist/schemas/shared.schema.d.ts +15 -0
- package/dist/schemas/shared.schema.js +54 -0
- package/dist/schemas/user.schema.d.ts +3 -3
- package/dist/schemas/user.schema.js +63 -30
- package/package.json +7 -5
|
@@ -70,7 +70,7 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
|
|
|
70
70
|
block_id: import("zod").ZodUUID;
|
|
71
71
|
}, import("zod/v4/core").$strip>], "type">;
|
|
72
72
|
discussion_id: import("zod").ZodUUID;
|
|
73
|
-
created_time: import("zod").ZodISODateTime
|
|
73
|
+
created_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
74
74
|
created_by: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
75
75
|
object: import("zod").ZodLiteral<"user">;
|
|
76
76
|
id: import("zod").ZodUUID;
|
|
@@ -96,14 +96,14 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
|
|
|
96
96
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
97
97
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
98
98
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
99
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
99
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
100
100
|
}, import("zod/v4/core").$strip>>;
|
|
101
101
|
}, import("zod/v4/core").$strip>;
|
|
102
102
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
103
103
|
object: import("zod").ZodLiteral<"user">;
|
|
104
104
|
id: import("zod").ZodUUID;
|
|
105
105
|
}, import("zod/v4/core").$strip>]>;
|
|
106
|
-
last_edited_time: import("zod").ZodISODateTime
|
|
106
|
+
last_edited_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
107
107
|
rich_text: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
108
108
|
type: import("zod").ZodLiteral<"text">;
|
|
109
109
|
text: import("zod").ZodObject<{
|
|
@@ -152,8 +152,8 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
|
|
|
152
152
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
153
153
|
type: import("zod").ZodLiteral<"date">;
|
|
154
154
|
date: import("zod").ZodObject<{
|
|
155
|
-
start: import("zod").
|
|
156
|
-
end: import("zod").ZodNullable<import("zod").
|
|
155
|
+
start: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
156
|
+
end: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>>;
|
|
157
157
|
time_zone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
158
158
|
}, import("zod/v4/core").$strip>;
|
|
159
159
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -205,7 +205,7 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
|
|
|
205
205
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
206
206
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
207
207
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
208
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
208
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
209
209
|
}, import("zod/v4/core").$strip>>;
|
|
210
210
|
}, import("zod/v4/core").$strip>;
|
|
211
211
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -289,7 +289,7 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
|
|
|
289
289
|
}>;
|
|
290
290
|
file: import("zod").ZodObject<{
|
|
291
291
|
url: import("zod").ZodURL;
|
|
292
|
-
expiry_time: import("zod").ZodISODateTime
|
|
292
|
+
expiry_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
293
293
|
}, import("zod/v4/core").$strip>;
|
|
294
294
|
}, import("zod/v4/core").$strip>>>;
|
|
295
295
|
display_name: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
@@ -31,8 +31,6 @@ export interface UpdateDataSourceOptions {
|
|
|
31
31
|
icon?: unknown;
|
|
32
32
|
/** Update the data source properties schema */
|
|
33
33
|
properties?: Record<string, unknown>;
|
|
34
|
-
/** Archive or restore the data source */
|
|
35
|
-
archived?: boolean;
|
|
36
34
|
/** Move to trash or restore from trash */
|
|
37
35
|
in_trash?: boolean;
|
|
38
36
|
/** Move the data source to a different database */
|
|
@@ -77,12 +75,10 @@ export interface QueryDataSourceOptions extends PaginationParameters {
|
|
|
77
75
|
sorts?: DataSourceSort[];
|
|
78
76
|
/** Filter properties to include in results */
|
|
79
77
|
filter_properties?: string[];
|
|
80
|
-
/** Filter by archived status */
|
|
81
|
-
archived?: boolean;
|
|
82
|
-
/** Filter by trash status */
|
|
83
|
-
in_trash?: boolean;
|
|
84
78
|
/** Filter by result type (for wikis) */
|
|
85
79
|
result_type?: 'page' | 'data_source';
|
|
80
|
+
/** Filter by trash status */
|
|
81
|
+
in_trash?: boolean;
|
|
86
82
|
}
|
|
87
83
|
/**
|
|
88
84
|
* Data Sources API client for working with Notion data sources.
|
|
@@ -414,7 +410,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
414
410
|
type: import("zod").ZodLiteral<"block_id">;
|
|
415
411
|
block_id: import("zod").ZodUUID;
|
|
416
412
|
}, import("zod/v4/core").$strip>], "type">;
|
|
417
|
-
created_time: import("zod").ZodISODateTime
|
|
413
|
+
created_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
418
414
|
created_by: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
419
415
|
object: import("zod").ZodLiteral<"user">;
|
|
420
416
|
id: import("zod").ZodUUID;
|
|
@@ -440,14 +436,14 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
440
436
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
441
437
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
442
438
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
443
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
439
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
444
440
|
}, import("zod/v4/core").$strip>>;
|
|
445
441
|
}, import("zod/v4/core").$strip>;
|
|
446
442
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
447
443
|
object: import("zod").ZodLiteral<"user">;
|
|
448
444
|
id: import("zod").ZodUUID;
|
|
449
445
|
}, import("zod/v4/core").$strip>]>;
|
|
450
|
-
last_edited_time: import("zod").ZodISODateTime
|
|
446
|
+
last_edited_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
451
447
|
last_edited_by: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
452
448
|
object: import("zod").ZodLiteral<"user">;
|
|
453
449
|
id: import("zod").ZodUUID;
|
|
@@ -473,7 +469,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
473
469
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
474
470
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
475
471
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
476
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
472
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
477
473
|
}, import("zod/v4/core").$strip>>;
|
|
478
474
|
}, import("zod/v4/core").$strip>;
|
|
479
475
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -528,8 +524,8 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
528
524
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
529
525
|
type: import("zod").ZodLiteral<"date">;
|
|
530
526
|
date: import("zod").ZodObject<{
|
|
531
|
-
start: import("zod").
|
|
532
|
-
end: import("zod").ZodNullable<import("zod").
|
|
527
|
+
start: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
528
|
+
end: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>>;
|
|
533
529
|
time_zone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
534
530
|
}, import("zod/v4/core").$strip>;
|
|
535
531
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -581,7 +577,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
581
577
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
582
578
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
583
579
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
584
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
580
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
585
581
|
}, import("zod/v4/core").$strip>>;
|
|
586
582
|
}, import("zod/v4/core").$strip>;
|
|
587
583
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -703,8 +699,8 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
703
699
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
704
700
|
type: import("zod").ZodLiteral<"date">;
|
|
705
701
|
date: import("zod").ZodObject<{
|
|
706
|
-
start: import("zod").
|
|
707
|
-
end: import("zod").ZodNullable<import("zod").
|
|
702
|
+
start: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
703
|
+
end: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>>;
|
|
708
704
|
time_zone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
709
705
|
}, import("zod/v4/core").$strip>;
|
|
710
706
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -756,7 +752,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
756
752
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
757
753
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
758
754
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
759
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
755
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
760
756
|
}, import("zod/v4/core").$strip>>;
|
|
761
757
|
}, import("zod/v4/core").$strip>;
|
|
762
758
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -834,7 +830,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
834
830
|
type: import("zod").ZodLiteral<"file">;
|
|
835
831
|
file: import("zod").ZodObject<{
|
|
836
832
|
url: import("zod").ZodURL;
|
|
837
|
-
expiry_time: import("zod").ZodISODateTime
|
|
833
|
+
expiry_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
838
834
|
}, import("zod/v4/core").$strip>;
|
|
839
835
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
840
836
|
type: import("zod").ZodLiteral<"file_upload">;
|
|
@@ -854,7 +850,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
854
850
|
type: import("zod").ZodLiteral<"file">;
|
|
855
851
|
file: import("zod").ZodObject<{
|
|
856
852
|
url: import("zod").ZodURL;
|
|
857
|
-
expiry_time: import("zod").ZodISODateTime
|
|
853
|
+
expiry_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
858
854
|
}, import("zod/v4/core").$strip>;
|
|
859
855
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
860
856
|
type: import("zod").ZodLiteral<"file_upload">;
|
|
@@ -870,7 +866,6 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
870
866
|
url: import("zod").ZodURL;
|
|
871
867
|
public_url: import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>;
|
|
872
868
|
is_inline: import("zod").ZodBoolean;
|
|
873
|
-
archived: import("zod").ZodBoolean;
|
|
874
869
|
in_trash: import("zod").ZodBoolean;
|
|
875
870
|
}, import("zod/v4/core").$strip>;
|
|
876
871
|
ModelClass: typeof DataSource;
|
|
@@ -918,31 +913,33 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
|
|
|
918
913
|
*/
|
|
919
914
|
update(dataSourceId: string, options: UpdateDataSourceOptions): Promise<DataSource>;
|
|
920
915
|
/**
|
|
921
|
-
*
|
|
916
|
+
* Move a data source to trash (convenience method).
|
|
922
917
|
*
|
|
923
|
-
* @param dataSourceId - The ID of the data source to
|
|
924
|
-
* @returns The
|
|
918
|
+
* @param dataSourceId - The ID of the data source to trash
|
|
919
|
+
* @returns The trashed data source wrapped in a DataSource model
|
|
925
920
|
*/
|
|
926
|
-
|
|
921
|
+
trash(dataSourceId: string): Promise<DataSource>;
|
|
927
922
|
/**
|
|
928
|
-
* Restore
|
|
923
|
+
* Restore a data source from trash (convenience method).
|
|
929
924
|
*
|
|
930
|
-
* @param dataSourceId - The ID of the data source to restore
|
|
925
|
+
* @param dataSourceId - The ID of the data source to restore from trash
|
|
931
926
|
* @returns The restored data source wrapped in a DataSource model
|
|
932
927
|
*/
|
|
933
|
-
|
|
928
|
+
untrash(dataSourceId: string): Promise<DataSource>;
|
|
934
929
|
/**
|
|
935
|
-
* Move a data source to trash
|
|
930
|
+
* Move a data source to trash.
|
|
936
931
|
*
|
|
932
|
+
* @deprecated Use {@link trash} instead.
|
|
937
933
|
* @param dataSourceId - The ID of the data source to trash
|
|
938
934
|
* @returns The trashed data source wrapped in a DataSource model
|
|
939
935
|
*/
|
|
940
|
-
|
|
936
|
+
archive(dataSourceId: string): Promise<DataSource>;
|
|
941
937
|
/**
|
|
942
|
-
* Restore a data source
|
|
938
|
+
* Restore a trashed data source.
|
|
943
939
|
*
|
|
944
|
-
* @
|
|
940
|
+
* @deprecated Use {@link untrash} instead.
|
|
941
|
+
* @param dataSourceId - The ID of the data source to restore
|
|
945
942
|
* @returns The restored data source wrapped in a DataSource model
|
|
946
943
|
*/
|
|
947
|
-
|
|
944
|
+
restore(dataSourceId: string): Promise<DataSource>;
|
|
948
945
|
}
|
|
@@ -65,9 +65,6 @@ class DataSourcesAPI extends base_api_1.BaseAPI {
|
|
|
65
65
|
(0, validation_1.validateArrayLength)(options.filter_properties, validation_1.LIMITS.ARRAY_ELEMENTS, 'filter_properties');
|
|
66
66
|
body.filter_properties = options.filter_properties;
|
|
67
67
|
}
|
|
68
|
-
if (options?.archived !== undefined) {
|
|
69
|
-
body.archived = options.archived;
|
|
70
|
-
}
|
|
71
68
|
if (options?.in_trash !== undefined) {
|
|
72
69
|
body.in_trash = options.in_trash;
|
|
73
70
|
}
|
|
@@ -119,40 +116,42 @@ class DataSourcesAPI extends base_api_1.BaseAPI {
|
|
|
119
116
|
return this.updateResource(`/data_sources/${dataSourceId}`, options);
|
|
120
117
|
}
|
|
121
118
|
/**
|
|
122
|
-
*
|
|
119
|
+
* Move a data source to trash (convenience method).
|
|
123
120
|
*
|
|
124
|
-
* @param dataSourceId - The ID of the data source to
|
|
125
|
-
* @returns The
|
|
121
|
+
* @param dataSourceId - The ID of the data source to trash
|
|
122
|
+
* @returns The trashed data source wrapped in a DataSource model
|
|
126
123
|
*/
|
|
127
|
-
async
|
|
128
|
-
return this.update(dataSourceId, {
|
|
124
|
+
async trash(dataSourceId) {
|
|
125
|
+
return this.update(dataSourceId, { in_trash: true });
|
|
129
126
|
}
|
|
130
127
|
/**
|
|
131
|
-
* Restore
|
|
128
|
+
* Restore a data source from trash (convenience method).
|
|
132
129
|
*
|
|
133
|
-
* @param dataSourceId - The ID of the data source to restore
|
|
130
|
+
* @param dataSourceId - The ID of the data source to restore from trash
|
|
134
131
|
* @returns The restored data source wrapped in a DataSource model
|
|
135
132
|
*/
|
|
136
|
-
async
|
|
137
|
-
return this.update(dataSourceId, {
|
|
133
|
+
async untrash(dataSourceId) {
|
|
134
|
+
return this.update(dataSourceId, { in_trash: false });
|
|
138
135
|
}
|
|
139
136
|
/**
|
|
140
|
-
* Move a data source to trash
|
|
137
|
+
* Move a data source to trash.
|
|
141
138
|
*
|
|
139
|
+
* @deprecated Use {@link trash} instead.
|
|
142
140
|
* @param dataSourceId - The ID of the data source to trash
|
|
143
141
|
* @returns The trashed data source wrapped in a DataSource model
|
|
144
142
|
*/
|
|
145
|
-
async
|
|
146
|
-
return this.
|
|
143
|
+
async archive(dataSourceId) {
|
|
144
|
+
return this.trash(dataSourceId);
|
|
147
145
|
}
|
|
148
146
|
/**
|
|
149
|
-
* Restore a data source
|
|
147
|
+
* Restore a trashed data source.
|
|
150
148
|
*
|
|
151
|
-
* @
|
|
149
|
+
* @deprecated Use {@link untrash} instead.
|
|
150
|
+
* @param dataSourceId - The ID of the data source to restore
|
|
152
151
|
* @returns The restored data source wrapped in a DataSource model
|
|
153
152
|
*/
|
|
154
|
-
async
|
|
155
|
-
return this.
|
|
153
|
+
async restore(dataSourceId) {
|
|
154
|
+
return this.untrash(dataSourceId);
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
157
|
exports.DataSourcesAPI = DataSourcesAPI;
|
|
@@ -52,7 +52,7 @@ export type CreateDatabaseParent = {
|
|
|
52
52
|
};
|
|
53
53
|
/**
|
|
54
54
|
* Initial data source configuration for creating a database.
|
|
55
|
-
*
|
|
55
|
+
* As of API version 2025-09-03, databases are created with an initial data source.
|
|
56
56
|
*/
|
|
57
57
|
export interface InitialDataSource {
|
|
58
58
|
/** Data source properties schema */
|
|
@@ -91,8 +91,6 @@ export interface UpdateDatabaseOptions {
|
|
|
91
91
|
icon?: unknown;
|
|
92
92
|
/** Update the database cover */
|
|
93
93
|
cover?: unknown;
|
|
94
|
-
/** Archive or restore the database */
|
|
95
|
-
archived?: boolean;
|
|
96
94
|
/** Move to trash or restore from trash */
|
|
97
95
|
in_trash?: boolean;
|
|
98
96
|
/** Whether the database is inline */
|
|
@@ -113,7 +111,7 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
113
111
|
id: import("zod").ZodUUID;
|
|
114
112
|
name: import("zod").ZodString;
|
|
115
113
|
}, import("zod/v4/core").$strip>>;
|
|
116
|
-
created_time: import("zod").ZodISODateTime
|
|
114
|
+
created_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
117
115
|
created_by: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
118
116
|
object: import("zod").ZodLiteral<"user">;
|
|
119
117
|
id: import("zod").ZodUUID;
|
|
@@ -139,14 +137,14 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
139
137
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
140
138
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
141
139
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
142
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
140
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
143
141
|
}, import("zod/v4/core").$strip>>;
|
|
144
142
|
}, import("zod/v4/core").$strip>;
|
|
145
143
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
146
144
|
object: import("zod").ZodLiteral<"user">;
|
|
147
145
|
id: import("zod").ZodUUID;
|
|
148
146
|
}, import("zod/v4/core").$strip>]>;
|
|
149
|
-
last_edited_time: import("zod").ZodISODateTime
|
|
147
|
+
last_edited_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
150
148
|
last_edited_by: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
151
149
|
object: import("zod").ZodLiteral<"user">;
|
|
152
150
|
id: import("zod").ZodUUID;
|
|
@@ -172,7 +170,7 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
172
170
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
173
171
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
174
172
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
175
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
173
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
176
174
|
}, import("zod/v4/core").$strip>>;
|
|
177
175
|
}, import("zod/v4/core").$strip>;
|
|
178
176
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -227,8 +225,8 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
227
225
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
228
226
|
type: import("zod").ZodLiteral<"date">;
|
|
229
227
|
date: import("zod").ZodObject<{
|
|
230
|
-
start: import("zod").
|
|
231
|
-
end: import("zod").ZodNullable<import("zod").
|
|
228
|
+
start: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
229
|
+
end: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>>;
|
|
232
230
|
time_zone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
233
231
|
}, import("zod/v4/core").$strip>;
|
|
234
232
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -280,7 +278,7 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
280
278
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
281
279
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
282
280
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
283
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
281
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
284
282
|
}, import("zod/v4/core").$strip>>;
|
|
285
283
|
}, import("zod/v4/core").$strip>;
|
|
286
284
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -402,8 +400,8 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
402
400
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
403
401
|
type: import("zod").ZodLiteral<"date">;
|
|
404
402
|
date: import("zod").ZodObject<{
|
|
405
|
-
start: import("zod").
|
|
406
|
-
end: import("zod").ZodNullable<import("zod").
|
|
403
|
+
start: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
404
|
+
end: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>>;
|
|
407
405
|
time_zone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
408
406
|
}, import("zod/v4/core").$strip>;
|
|
409
407
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -455,7 +453,7 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
455
453
|
workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
456
454
|
workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
457
455
|
workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
458
|
-
max_file_upload_size_in_bytes: import("zod").
|
|
456
|
+
max_file_upload_size_in_bytes: import("zod").ZodInt;
|
|
459
457
|
}, import("zod/v4/core").$strip>>;
|
|
460
458
|
}, import("zod/v4/core").$strip>;
|
|
461
459
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -533,7 +531,7 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
533
531
|
type: import("zod").ZodLiteral<"file">;
|
|
534
532
|
file: import("zod").ZodObject<{
|
|
535
533
|
url: import("zod").ZodURL;
|
|
536
|
-
expiry_time: import("zod").ZodISODateTime
|
|
534
|
+
expiry_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
537
535
|
}, import("zod/v4/core").$strip>;
|
|
538
536
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
539
537
|
type: import("zod").ZodLiteral<"file_upload">;
|
|
@@ -553,7 +551,7 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
553
551
|
type: import("zod").ZodLiteral<"file">;
|
|
554
552
|
file: import("zod").ZodObject<{
|
|
555
553
|
url: import("zod").ZodURL;
|
|
556
|
-
expiry_time: import("zod").ZodISODateTime
|
|
554
|
+
expiry_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
557
555
|
}, import("zod/v4/core").$strip>;
|
|
558
556
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
559
557
|
type: import("zod").ZodLiteral<"file_upload">;
|
|
@@ -584,7 +582,6 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
584
582
|
block_id: import("zod").ZodUUID;
|
|
585
583
|
}, import("zod/v4/core").$strip>], "type">;
|
|
586
584
|
url: import("zod").ZodURL;
|
|
587
|
-
archived: import("zod").ZodBoolean;
|
|
588
585
|
in_trash: import("zod").ZodBoolean;
|
|
589
586
|
is_inline: import("zod").ZodBoolean;
|
|
590
587
|
public_url: import("zod").ZodNullable<import("zod").ZodURL>;
|
|
@@ -624,7 +621,7 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
624
621
|
*/
|
|
625
622
|
create(options: CreateDatabaseOptions): Promise<Database>;
|
|
626
623
|
/**
|
|
627
|
-
* Update a database's properties, title, description, or
|
|
624
|
+
* Update a database's properties, title, description, or trash status.
|
|
628
625
|
*
|
|
629
626
|
* @param databaseId - The ID of the database to update
|
|
630
627
|
* @param options - Options for updating the database
|
|
@@ -634,17 +631,25 @@ export declare class DatabasesAPI extends BaseAPI<NotionDatabase, Database> {
|
|
|
634
631
|
*/
|
|
635
632
|
update(databaseId: string, options: UpdateDatabaseOptions): Promise<Database>;
|
|
636
633
|
/**
|
|
637
|
-
*
|
|
634
|
+
* Move a database to trash (convenience method).
|
|
638
635
|
*
|
|
639
|
-
* @param databaseId - The ID of the database to
|
|
640
|
-
* @returns The
|
|
636
|
+
* @param databaseId - The ID of the database to trash
|
|
637
|
+
* @returns The trashed database wrapped in a Database model
|
|
641
638
|
*/
|
|
642
|
-
|
|
639
|
+
trash(databaseId: string): Promise<Database>;
|
|
643
640
|
/**
|
|
644
|
-
* Restore
|
|
641
|
+
* Restore a trashed database (convenience method).
|
|
645
642
|
*
|
|
646
643
|
* @param databaseId - The ID of the database to restore
|
|
647
644
|
* @returns The restored database wrapped in a Database model
|
|
648
645
|
*/
|
|
649
646
|
restore(databaseId: string): Promise<Database>;
|
|
647
|
+
/**
|
|
648
|
+
* Move a database to trash (convenience method).
|
|
649
|
+
*
|
|
650
|
+
* @deprecated Use {@link trash} instead.
|
|
651
|
+
* @param databaseId - The ID of the database to trash
|
|
652
|
+
* @returns The trashed database wrapped in a Database model
|
|
653
|
+
*/
|
|
654
|
+
archive(databaseId: string): Promise<Database>;
|
|
650
655
|
}
|
|
@@ -86,7 +86,7 @@ class DatabasesAPI extends base_api_1.BaseAPI {
|
|
|
86
86
|
return this.createResource('/databases', options);
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* Update a database's properties, title, description, or
|
|
89
|
+
* Update a database's properties, title, description, or trash status.
|
|
90
90
|
*
|
|
91
91
|
* @param databaseId - The ID of the database to update
|
|
92
92
|
* @param options - Options for updating the database
|
|
@@ -101,22 +101,32 @@ class DatabasesAPI extends base_api_1.BaseAPI {
|
|
|
101
101
|
return this.updateResource(`/databases/${databaseId}`, options);
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* Move a database to trash (convenience method).
|
|
105
105
|
*
|
|
106
|
-
* @param databaseId - The ID of the database to
|
|
107
|
-
* @returns The
|
|
106
|
+
* @param databaseId - The ID of the database to trash
|
|
107
|
+
* @returns The trashed database wrapped in a Database model
|
|
108
108
|
*/
|
|
109
|
-
async
|
|
110
|
-
return this.update(databaseId, {
|
|
109
|
+
async trash(databaseId) {
|
|
110
|
+
return this.update(databaseId, { in_trash: true });
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
-
* Restore
|
|
113
|
+
* Restore a trashed database (convenience method).
|
|
114
114
|
*
|
|
115
115
|
* @param databaseId - The ID of the database to restore
|
|
116
116
|
* @returns The restored database wrapped in a Database model
|
|
117
117
|
*/
|
|
118
118
|
async restore(databaseId) {
|
|
119
|
-
return this.update(databaseId, {
|
|
119
|
+
return this.update(databaseId, { in_trash: false });
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Move a database to trash (convenience method).
|
|
123
|
+
*
|
|
124
|
+
* @deprecated Use {@link trash} instead.
|
|
125
|
+
* @param databaseId - The ID of the database to trash
|
|
126
|
+
* @returns The trashed database wrapped in a Database model
|
|
127
|
+
*/
|
|
128
|
+
async archive(databaseId) {
|
|
129
|
+
return this.trash(databaseId);
|
|
120
130
|
}
|
|
121
131
|
}
|
|
122
132
|
exports.DatabasesAPI = DatabasesAPI;
|
|
@@ -26,8 +26,8 @@ export declare class FileUploadsAPI extends BaseAPI<NotionFileUpload, FileUpload
|
|
|
26
26
|
schema: import("zod").ZodObject<{
|
|
27
27
|
object: import("zod").ZodLiteral<"file_upload">;
|
|
28
28
|
id: import("zod").ZodUUID;
|
|
29
|
-
created_time: import("zod").ZodISODateTime
|
|
30
|
-
expiry_time: import("zod").ZodNullable<import("zod").ZodISODateTime
|
|
29
|
+
created_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
|
|
30
|
+
expiry_time: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>>;
|
|
31
31
|
status: import("zod").ZodEnum<{
|
|
32
32
|
pending: "pending";
|
|
33
33
|
uploaded: "uploaded";
|