@visus-io/notion-sdk-ts 2.1.0 → 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 CHANGED
@@ -1,13 +1,12 @@
1
1
  # @visus-io/notion-sdk-ts
2
2
 
3
3
  [![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/visus-io/notion-sdk-ts/ci.yml?style=for-the-badge&logo=github)](https://github.com/visus-io/notion-sdk-ts/actions/workflows/ci.yaml)
4
-
5
- [![Sonar Quality Gate](https://img.shields.io/sonar/quality_gate/visus%3Anotion-sdk-ts?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarcloud&logoColor=white)](https://sonarcloud.io/summary/overall?id=visus%3Anotion-sdk-ts)
6
- [![Sonar Coverage](https://img.shields.io/sonar/coverage/visus%3Anotion-sdk-ts?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarcloud&logoColor=white)](https://sonarcloud.io/summary/overall?id=visus%3Anotion-sdk-ts)
4
+ [![Sonar Quality Gate](https://img.shields.io/sonar/quality_gate/visus%3Anotion-sdk-ts?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonar&logoColor=white)](https://sonarcloud.io/summary/overall?id=visus%3Anotion-sdk-ts)
5
+ [![Sonar Coverage](https://img.shields.io/sonar/coverage/visus%3Anotion-sdk-ts?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonar&logoColor=white)](https://sonarcloud.io/summary/overall?id=visus%3Anotion-sdk-ts)
7
6
 
8
7
  [![NPM Version](https://img.shields.io/npm/v/%40visus-io%2Fnotion-sdk-ts?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@visus-io/notion-sdk-ts)
9
8
  ![NPM Downloads](https://img.shields.io/npm/dm/%40visus-io%2Fnotion-sdk-ts?style=for-the-badge&logo=npm)
10
- ![GitHub](https://img.shields.io/github/license/visus-io/notion-sdk-ts?style=for-the-badge)
9
+ ![Static Badge](https://img.shields.io/badge/license-mit-green?style=for-the-badge)
11
10
 
12
11
  A type-safe TypeScript SDK for the Notion API with Zod validation, OOP models, and ergonomic helpers.
13
12
 
@@ -82,7 +81,7 @@ Comprehensive documentation is available in the [**GitHub Wiki**](https://github
82
81
  ### Getting Started
83
82
 
84
83
  - [**Getting Started**](https://github.com/visus-io/notion-sdk-ts/wiki/Getting-Started) - Installation, quick start, and basic configuration
85
- - [**Migration Guide**](https://github.com/visus-io/notion-sdk-ts/wiki/Migration-Guide) - Migrating to API version 2025-09-03
84
+ - [**Migration Guide**](https://github.com/visus-io/notion-sdk-ts/wiki/Migration-Guide) - Migrating between API versions
86
85
  - [**Common Use Cases**](https://github.com/visus-io/notion-sdk-ts/wiki/Common-Use-Cases) - Practical examples and workflows
87
86
 
88
87
  ### Core Concepts
@@ -105,25 +104,53 @@ Comprehensive documentation is available in the [**GitHub Wiki**](https://github
105
104
 
106
105
  ## Migration Notice
107
106
 
108
- **This SDK now defaults to Notion API version `2025-09-03`** (previously `2022-06-28`). This version introduces breaking changes for multi-source database support.
107
+ **This SDK now targets Notion API version `2026-03-11`** (upgraded from `2025-09-03` in v3.x; originally `2022-06-28` in v1.x). The API version is fixed it cannot be overridden via client options.
108
+
109
+ ### Key Changes (v3.x — 2026-03-11)
110
+
111
+ - **`archived` → `in_trash`**: Field renamed across all schemas, models, and API request bodies
112
+ - **`after` → `position` object**: `blocks.children.append()` now accepts a typed `position` union
113
+ - **`transcription` → `meeting_notes`**: Block type and helper renamed
114
+ - **`notionVersion` removed**: Use the exported `NOTION_VERSION` constant to inspect the target version
115
+
116
+ ### Quick Migration Example (v2.x → v3.x)
117
+
118
+ ```typescript
119
+ // OLD (v2.x / 2025-09-03)
120
+ console.log(page.archived);
121
+ await notion.blocks.children.append('page-id', {
122
+ children: [block.paragraph('text')],
123
+ after: 'block-id',
124
+ });
125
+ block.transcription('Transcription text');
126
+
127
+ // NEW (v3.x / 2026-03-11)
128
+ import { NOTION_VERSION } from '@visus-io/notion-sdk-ts';
129
+ console.log(page.inTrash);
130
+ await notion.blocks.children.append('page-id', {
131
+ children: [block.paragraph('text')],
132
+ position: { type: 'after_block', after_block: { id: 'block-id' } },
133
+ });
134
+ block.meetingNotes('Meeting notes text');
135
+ ```
109
136
 
110
- ### Key Changes
137
+ ### Key Changes (v2.x — 2025-09-03)
111
138
 
112
- - **Database creation:** Properties moved to `initial_data_source.properties`
113
- - **Database updates:** Use Data Sources API for property changes
114
- - **Page creation:** Requires both data source ID and database ID
115
- - **Search API:** Returns `DataSource` objects instead of `Database`
139
+ - **Database creation**: Properties moved to `initial_data_source.properties`
140
+ - **Database updates**: Use Data Sources API for property changes
141
+ - **Page creation**: Requires both data source ID and database ID
142
+ - **Search API**: Returns `DataSource` objects instead of `Database`
116
143
 
117
- ### Quick Migration Example
144
+ ### Quick Migration Example (v1.x → v2.x)
118
145
 
119
146
  ```typescript
120
- // OLD (2022-06-28)
147
+ // OLD (v1.x / 2022-06-28)
121
148
  await notion.pages.create({
122
149
  parent: parent.database('database-id'),
123
150
  properties: { Name: prop.title('Task') },
124
151
  });
125
152
 
126
- // NEW (2025-09-03)
153
+ // NEW (v2.x / 2025-09-03)
127
154
  const db = await notion.databases.retrieve('database-id');
128
155
  const dataSourceId = db.dataSources[0].id;
129
156
 
@@ -1,5 +1,5 @@
1
1
  import type { NotionClient } from '../client';
2
- import { type NotionBlock, type PaginatedList, type PaginationParameters } from '../schemas';
2
+ import { type BlockPosition, type NotionBlock, type PaginatedList, type PaginationParameters } from '../schemas';
3
3
  import { Block } from '../models';
4
4
  import { BaseAPI } from './base.api';
5
5
  /**
@@ -12,11 +12,11 @@ export interface RetrieveBlockOptions {
12
12
  /**
13
13
  * Options for appending children to a block.
14
14
  */
15
- export interface AppendBlockChildrenOptions extends PaginationParameters {
15
+ export interface AppendBlockChildrenOptions {
16
16
  /** Array of block objects to append (max 100) */
17
17
  children: unknown[];
18
- /** Position to insert the children */
19
- after?: string;
18
+ /** Position to insert the children (default: end) */
19
+ position?: BlockPosition;
20
20
  }
21
21
  /**
22
22
  * Response from appending children to a block.
@@ -35,8 +35,8 @@ export interface AppendBlockChildrenResponse {
35
35
  export interface UpdateBlockOptions {
36
36
  /** Block type-specific properties to update (depends on block type) */
37
37
  [blockType: string]: unknown;
38
- /** Archive or restore the block */
39
- archived?: boolean;
38
+ /** Move to trash or restore from trash */
39
+ in_trash?: boolean;
40
40
  }
41
41
  /**
42
42
  * Blocks API client for working with Notion blocks.
@@ -95,7 +95,7 @@ export declare class BlocksAPI extends BaseAPI<NotionBlock, Block> {
95
95
  template: "template";
96
96
  to_do: "to_do";
97
97
  toggle: "toggle";
98
- transcription: "transcription";
98
+ meeting_notes: "meeting_notes";
99
99
  unsupported: "unsupported";
100
100
  video: "video";
101
101
  }>;
@@ -165,7 +165,6 @@ export declare class BlocksAPI extends BaseAPI<NotionBlock, Block> {
165
165
  object: import("zod").ZodLiteral<"user">;
166
166
  id: import("zod").ZodUUID;
167
167
  }, import("zod/v4/core").$strip>]>;
168
- archived: import("zod").ZodBoolean;
169
168
  in_trash: import("zod").ZodBoolean;
170
169
  has_children: import("zod").ZodBoolean;
171
170
  audio: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
@@ -3706,7 +3705,7 @@ export declare class BlocksAPI extends BaseAPI<NotionBlock, Block> {
3706
3705
  }>;
3707
3706
  children: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>>;
3708
3707
  }, import("zod/v4/core").$strip>>;
3709
- transcription: import("zod").ZodOptional<import("zod").ZodObject<{
3708
+ meeting_notes: import("zod").ZodOptional<import("zod").ZodObject<{
3710
3709
  rich_text: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
3711
3710
  type: import("zod").ZodLiteral<"text">;
3712
3711
  text: 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.
@@ -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
- * Archive a data source (convenience method).
916
+ * Move a data source to trash (convenience method).
922
917
  *
923
- * @param dataSourceId - The ID of the data source to archive
924
- * @returns The archived data source wrapped in a DataSource model
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
- archive(dataSourceId: string): Promise<DataSource>;
921
+ trash(dataSourceId: string): Promise<DataSource>;
927
922
  /**
928
- * Restore an archived data source (convenience method).
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
- restore(dataSourceId: string): Promise<DataSource>;
928
+ untrash(dataSourceId: string): Promise<DataSource>;
934
929
  /**
935
- * Move a data source to trash (convenience method).
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
- trash(dataSourceId: string): Promise<DataSource>;
936
+ archive(dataSourceId: string): Promise<DataSource>;
941
937
  /**
942
- * Restore a data source from trash (convenience method).
938
+ * Restore a trashed data source.
943
939
  *
944
- * @param dataSourceId - The ID of the data source to restore from trash
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
- untrash(dataSourceId: string): Promise<DataSource>;
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
- * Archive a data source (convenience method).
119
+ * Move a data source to trash (convenience method).
123
120
  *
124
- * @param dataSourceId - The ID of the data source to archive
125
- * @returns The archived data source wrapped in a DataSource model
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 archive(dataSourceId) {
128
- return this.update(dataSourceId, { archived: true });
124
+ async trash(dataSourceId) {
125
+ return this.update(dataSourceId, { in_trash: true });
129
126
  }
130
127
  /**
131
- * Restore an archived data source (convenience method).
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 restore(dataSourceId) {
137
- return this.update(dataSourceId, { archived: false });
133
+ async untrash(dataSourceId) {
134
+ return this.update(dataSourceId, { in_trash: false });
138
135
  }
139
136
  /**
140
- * Move a data source to trash (convenience method).
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 trash(dataSourceId) {
146
- return this.update(dataSourceId, { in_trash: true });
143
+ async archive(dataSourceId) {
144
+ return this.trash(dataSourceId);
147
145
  }
148
146
  /**
149
- * Restore a data source from trash (convenience method).
147
+ * Restore a trashed data source.
150
148
  *
151
- * @param dataSourceId - The ID of the data source to restore from trash
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 untrash(dataSourceId) {
155
- return this.update(dataSourceId, { in_trash: false });
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
- * In API version 2025-09-03, databases are created with an initial data source.
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 */
@@ -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 archived status.
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
- * Archive a database (convenience method).
634
+ * Move a database to trash (convenience method).
638
635
  *
639
- * @param databaseId - The ID of the database to archive
640
- * @returns The archived database wrapped in a Database model
636
+ * @param databaseId - The ID of the database to trash
637
+ * @returns The trashed database wrapped in a Database model
641
638
  */
642
- archive(databaseId: string): Promise<Database>;
639
+ trash(databaseId: string): Promise<Database>;
643
640
  /**
644
- * Restore an archived database (convenience method).
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 archived status.
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
- * Archive a database (convenience method).
104
+ * Move a database to trash (convenience method).
105
105
  *
106
- * @param databaseId - The ID of the database to archive
107
- * @returns The archived database wrapped in a Database model
106
+ * @param databaseId - The ID of the database to trash
107
+ * @returns The trashed database wrapped in a Database model
108
108
  */
109
- async archive(databaseId) {
110
- return this.update(databaseId, { archived: true });
109
+ async trash(databaseId) {
110
+ return this.update(databaseId, { in_trash: true });
111
111
  }
112
112
  /**
113
- * Restore an archived database (convenience method).
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, { archived: false });
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;
@@ -68,8 +68,6 @@ export interface UpdatePageOptions {
68
68
  cover?: unknown;
69
69
  /** Lock or unlock the page from editing */
70
70
  is_locked?: boolean;
71
- /** Archive or restore the page */
72
- archived?: boolean;
73
71
  /** Move to trash or restore from trash */
74
72
  in_trash?: boolean;
75
73
  /** Template to apply to the page */
@@ -157,7 +155,6 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
157
155
  object: import("zod").ZodLiteral<"user">;
158
156
  id: import("zod").ZodUUID;
159
157
  }, import("zod/v4/core").$strip>]>;
160
- archived: import("zod").ZodBoolean;
161
158
  in_trash: import("zod").ZodBoolean;
162
159
  icon: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
163
160
  type: import("zod").ZodLiteral<"file">;
@@ -968,7 +965,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
968
965
  */
969
966
  create(options: CreatePageOptions): Promise<Page>;
970
967
  /**
971
- * Update a page's properties, icon, cover, or archived status.
968
+ * Update a page's properties, icon, cover, or trash status.
972
969
  *
973
970
  * @param pageId - The ID of the page to update
974
971
  * @param options - Options for updating the page
@@ -978,17 +975,25 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
978
975
  */
979
976
  update(pageId: string, options: UpdatePageOptions): Promise<Page>;
980
977
  /**
981
- * Archive a page (convenience method).
978
+ * Move a page to trash (convenience method).
982
979
  *
983
- * @param pageId - The ID of the page to archive
984
- * @returns The archived page wrapped in a Page model
980
+ * @param pageId - The ID of the page to trash
981
+ * @returns The trashed page wrapped in a Page model
985
982
  */
986
- archive(pageId: string): Promise<Page>;
983
+ trash(pageId: string): Promise<Page>;
987
984
  /**
988
- * Restore an archived page (convenience method).
985
+ * Restore a trashed page (convenience method).
989
986
  *
990
987
  * @param pageId - The ID of the page to restore
991
988
  * @returns The restored page wrapped in a Page model
992
989
  */
993
990
  restore(pageId: string): Promise<Page>;
991
+ /**
992
+ * Move a page to trash (convenience method).
993
+ *
994
+ * @deprecated Use {@link trash} instead.
995
+ * @param pageId - The ID of the page to trash
996
+ * @returns The trashed page wrapped in a Page model
997
+ */
998
+ archive(pageId: string): Promise<Page>;
994
999
  }
@@ -48,7 +48,7 @@ class PagesAPI extends base_api_1.BaseAPI {
48
48
  return this.createResource('/pages', options);
49
49
  }
50
50
  /**
51
- * Update a page's properties, icon, cover, or archived status.
51
+ * Update a page's properties, icon, cover, or trash status.
52
52
  *
53
53
  * @param pageId - The ID of the page to update
54
54
  * @param options - Options for updating the page
@@ -60,22 +60,32 @@ class PagesAPI extends base_api_1.BaseAPI {
60
60
  return this.updateResource(`/pages/${pageId}`, options);
61
61
  }
62
62
  /**
63
- * Archive a page (convenience method).
63
+ * Move a page to trash (convenience method).
64
64
  *
65
- * @param pageId - The ID of the page to archive
66
- * @returns The archived page wrapped in a Page model
65
+ * @param pageId - The ID of the page to trash
66
+ * @returns The trashed page wrapped in a Page model
67
67
  */
68
- async archive(pageId) {
69
- return this.update(pageId, { archived: true });
68
+ async trash(pageId) {
69
+ return this.update(pageId, { in_trash: true });
70
70
  }
71
71
  /**
72
- * Restore an archived page (convenience method).
72
+ * Restore a trashed page (convenience method).
73
73
  *
74
74
  * @param pageId - The ID of the page to restore
75
75
  * @returns The restored page wrapped in a Page model
76
76
  */
77
77
  async restore(pageId) {
78
- return this.update(pageId, { archived: false });
78
+ return this.update(pageId, { in_trash: false });
79
+ }
80
+ /**
81
+ * Move a page to trash (convenience method).
82
+ *
83
+ * @deprecated Use {@link trash} instead.
84
+ * @param pageId - The ID of the page to trash
85
+ * @returns The trashed page wrapped in a Page model
86
+ */
87
+ async archive(pageId) {
88
+ return this.trash(pageId);
79
89
  }
80
90
  }
81
91
  exports.PagesAPI = PagesAPI;
package/dist/client.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * The Notion API version targeted by this SDK.
3
+ * All schemas, request bodies, helpers, and models are coupled to this version.
4
+ */
5
+ export declare const NOTION_VERSION: "2026-03-11";
1
6
  /**
2
7
  * Configuration options for the Notion client.
3
8
  */
@@ -6,8 +11,6 @@ export interface NotionClientOptions {
6
11
  auth: string;
7
12
  /** Base URL for API requests (default: https://api.notion.com) */
8
13
  baseUrl?: string;
9
- /** Notion API version (default: 2025-09-03) */
10
- notionVersion?: string;
11
14
  /** Request timeout in milliseconds (default: 60000) */
12
15
  timeoutMs?: number;
13
16
  /** Custom fetch implementation (defaults to global fetch) */
@@ -32,7 +35,6 @@ export interface RequestOptions {
32
35
  export declare class NotionClient {
33
36
  private readonly auth;
34
37
  private readonly baseUrl;
35
- private readonly notionVersion;
36
38
  private readonly timeoutMs;
37
39
  private readonly fetchImpl;
38
40
  private readonly maxRetries;
package/dist/client.js CHANGED
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotionClient = void 0;
3
+ exports.NotionClient = exports.NOTION_VERSION = void 0;
4
4
  const errors_1 = require("./errors");
5
+ /**
6
+ * The Notion API version targeted by this SDK.
7
+ * All schemas, request bodies, helpers, and models are coupled to this version.
8
+ */
9
+ exports.NOTION_VERSION = '2026-03-11';
5
10
  /**
6
11
  * Base HTTP client for Notion API requests.
7
12
  */
@@ -9,7 +14,6 @@ class NotionClient {
9
14
  constructor(options) {
10
15
  this.auth = options.auth;
11
16
  this.baseUrl = options.baseUrl ?? 'https://api.notion.com';
12
- this.notionVersion = options.notionVersion ?? '2025-09-03';
13
17
  this.timeoutMs = options.timeoutMs ?? 60000;
14
18
  this.fetchImpl = options.fetch ?? fetch;
15
19
  this.maxRetries = options.maxRetries ?? 3;
@@ -120,7 +124,7 @@ class NotionClient {
120
124
  return {
121
125
  Authorization: `Bearer ${this.auth}`,
122
126
  'Content-Type': 'application/json',
123
- 'Notion-Version': this.notionVersion,
127
+ 'Notion-Version': exports.NOTION_VERSION,
124
128
  };
125
129
  }
126
130
  /**
@@ -65,7 +65,7 @@ declare function callout(text: RichTextInput, options?: CalloutOptions): BlockOb
65
65
  declare function template(text: RichTextInput, options?: {
66
66
  children?: unknown[];
67
67
  }): BlockObject;
68
- declare function transcription(text: RichTextInput, options?: {
68
+ declare function meetingNotes(text: RichTextInput, options?: {
69
69
  children?: unknown[];
70
70
  }): BlockObject;
71
71
  /** Options for code blocks. */
@@ -167,7 +167,7 @@ export declare const block: {
167
167
  quote: typeof quote;
168
168
  callout: typeof callout;
169
169
  template: typeof template;
170
- transcription: typeof transcription;
170
+ meetingNotes: typeof meetingNotes;
171
171
  code: typeof code;
172
172
  equation: typeof equation;
173
173
  image: typeof image;
@@ -170,11 +170,11 @@ function template(text, options) {
170
170
  },
171
171
  };
172
172
  }
173
- function transcription(text, options) {
173
+ function meetingNotes(text, options) {
174
174
  return {
175
175
  object: 'block',
176
- type: 'transcription',
177
- transcription: {
176
+ type: 'meeting_notes',
177
+ meeting_notes: {
178
178
  rich_text: resolveRichText(text),
179
179
  ...(options?.children ? { children: options.children } : {}),
180
180
  },
@@ -413,7 +413,7 @@ exports.block = {
413
413
  quote,
414
414
  callout,
415
415
  template,
416
- transcription,
416
+ meetingNotes,
417
417
  // Code & equation
418
418
  code,
419
419
  equation,
@@ -22,8 +22,8 @@ declare function database(databaseId: string): {
22
22
  };
23
23
  /**
24
24
  * Create a data source parent object.
25
- * In API version 2025-09-03, both data_source_id and database_id are required
26
- * when creating a page with a data source parent.
25
+ * Both data_source_id and database_id are required when creating a page
26
+ * with a data source parent.
27
27
  *
28
28
  * @example
29
29
  * ```ts
@@ -28,8 +28,8 @@ function database(databaseId) {
28
28
  }
29
29
  /**
30
30
  * Create a data source parent object.
31
- * In API version 2025-09-03, both data_source_id and database_id are required
32
- * when creating a page with a data source parent.
31
+ * Both data_source_id and database_id are required when creating a page
32
+ * with a data source parent.
33
33
  *
34
34
  * @example
35
35
  * ```ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { Notion } from './notion';
2
+ export { NOTION_VERSION } from './client';
2
3
  export type { NotionClientOptions } from './client';
3
4
  export * from './api';
4
5
  export * from './errors';
package/dist/index.js CHANGED
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Notion = void 0;
17
+ exports.NOTION_VERSION = exports.Notion = void 0;
18
18
  // Export main SDK class
19
19
  var notion_1 = require("./notion");
20
20
  Object.defineProperty(exports, "Notion", { enumerable: true, get: function () { return notion_1.Notion; } });
21
+ var client_1 = require("./client");
22
+ Object.defineProperty(exports, "NOTION_VERSION", { enumerable: true, get: function () { return client_1.NOTION_VERSION; } });
21
23
  // Export API namespaces
22
24
  __exportStar(require("./api"), exports);
23
25
  // Export error classes
@@ -10,7 +10,6 @@ export declare class Block extends BaseModel<NotionBlock> {
10
10
  get type(): NotionBlock['type'];
11
11
  get createdTime(): Date;
12
12
  get lastEditedTime(): Date;
13
- get archived(): boolean;
14
13
  get inTrash(): boolean;
15
14
  get hasChildren(): boolean;
16
15
  /**
@@ -25,9 +25,6 @@ class Block extends base_model_1.BaseModel {
25
25
  get lastEditedTime() {
26
26
  return new Date(this.data.last_edited_time);
27
27
  }
28
- get archived() {
29
- return this.data.archived;
30
- }
31
28
  get inTrash() {
32
29
  return this.data.in_trash;
33
30
  }
@@ -71,10 +71,6 @@ export declare class DataSource extends BaseModel<NotionDataSource> {
71
71
  * Returns whether the data source is inline.
72
72
  */
73
73
  get isInline(): boolean;
74
- /**
75
- * Returns the archived status.
76
- */
77
- get archived(): boolean;
78
74
  /**
79
75
  * Returns whether the data source is in trash.
80
76
  */
@@ -108,12 +108,6 @@ class DataSource extends base_model_1.BaseModel {
108
108
  get isInline() {
109
109
  return this.data.is_inline;
110
110
  }
111
- /**
112
- * Returns the archived status.
113
- */
114
- get archived() {
115
- return this.data.archived;
116
- }
117
111
  /**
118
112
  * Returns whether the data source is in trash.
119
113
  */
@@ -57,10 +57,6 @@ export declare class Database extends BaseModel<NotionDatabase> {
57
57
  * Returns the Notion URL of the database.
58
58
  */
59
59
  get url(): string;
60
- /**
61
- * Returns the archived status.
62
- */
63
- get archived(): boolean;
64
60
  /**
65
61
  * Returns whether the database is in trash.
66
62
  */
@@ -88,12 +88,6 @@ class Database extends base_model_1.BaseModel {
88
88
  get url() {
89
89
  return this.data.url;
90
90
  }
91
- /**
92
- * Returns the archived status.
93
- */
94
- get archived() {
95
- return this.data.archived;
96
- }
97
91
  /**
98
92
  * Returns whether the database is in trash.
99
93
  */
@@ -9,7 +9,6 @@ export declare class Page extends BaseModel<NotionPage> {
9
9
  get id(): string;
10
10
  get createdTime(): Date;
11
11
  get lastEditedTime(): Date;
12
- get archived(): boolean;
13
12
  get inTrash(): boolean;
14
13
  get url(): string;
15
14
  get publicUrl(): string | null;
@@ -22,9 +22,6 @@ class Page extends base_model_1.BaseModel {
22
22
  get lastEditedTime() {
23
23
  return new Date(this.data.last_edited_time);
24
24
  }
25
- get archived() {
26
- return this.data.archived;
27
- }
28
25
  get inTrash() {
29
26
  return this.data.in_trash;
30
27
  }
@@ -1,4 +1,18 @@
1
1
  import * as z from 'zod';
2
+ /**
3
+ * Position for inserting block children in the Append Block Children endpoint.
4
+ */
5
+ export declare const blockPositionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6
+ type: z.ZodLiteral<"after_block">;
7
+ after_block: z.ZodObject<{
8
+ id: z.ZodUUID;
9
+ }, z.core.$strip>;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ type: z.ZodLiteral<"start">;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ type: z.ZodLiteral<"end">;
14
+ }, z.core.$strip>], "type">;
15
+ export type BlockPosition = z.infer<typeof blockPositionSchema>;
2
16
  export declare const blockSchema: z.ZodObject<{
3
17
  object: z.ZodLiteral<"block">;
4
18
  id: z.ZodUUID;
@@ -50,7 +64,7 @@ export declare const blockSchema: z.ZodObject<{
50
64
  template: "template";
51
65
  to_do: "to_do";
52
66
  toggle: "toggle";
53
- transcription: "transcription";
67
+ meeting_notes: "meeting_notes";
54
68
  unsupported: "unsupported";
55
69
  video: "video";
56
70
  }>;
@@ -120,7 +134,6 @@ export declare const blockSchema: z.ZodObject<{
120
134
  object: z.ZodLiteral<"user">;
121
135
  id: z.ZodUUID;
122
136
  }, z.core.$strip>]>;
123
- archived: z.ZodBoolean;
124
137
  in_trash: z.ZodBoolean;
125
138
  has_children: z.ZodBoolean;
126
139
  audio: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -3661,7 +3674,7 @@ export declare const blockSchema: z.ZodObject<{
3661
3674
  }>;
3662
3675
  children: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
3663
3676
  }, z.core.$strip>>;
3664
- transcription: z.ZodOptional<z.ZodObject<{
3677
+ meeting_notes: z.ZodOptional<z.ZodObject<{
3665
3678
  rich_text: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
3666
3679
  type: z.ZodLiteral<"text">;
3667
3680
  text: z.ZodObject<{
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.blockSchema = void 0;
36
+ exports.blockSchema = exports.blockPositionSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
38
  const codeLanguages_1 = require("./codeLanguages");
39
39
  const colors_1 = require("./colors");
@@ -57,6 +57,14 @@ const getChildrenSchema = () => {
57
57
  childrenSchema ??= z.array(exports.blockSchema).optional();
58
58
  return childrenSchema;
59
59
  };
60
+ /**
61
+ * Position for inserting block children in the Append Block Children endpoint.
62
+ */
63
+ exports.blockPositionSchema = z.discriminatedUnion('type', [
64
+ z.object({ type: z.literal('after_block'), after_block: z.object({ id: z.uuid() }) }),
65
+ z.object({ type: z.literal('start') }),
66
+ z.object({ type: z.literal('end') }),
67
+ ]);
60
68
  const headingsObjectSchema = z.object({
61
69
  rich_text: richText_schema_1.richTextSchema,
62
70
  color: z.enum(colors_1.NOTION_COLORS),
@@ -100,7 +108,7 @@ exports.blockSchema = z.object({
100
108
  'template',
101
109
  'to_do',
102
110
  'toggle',
103
- 'transcription',
111
+ 'meeting_notes',
104
112
  'unsupported',
105
113
  'video',
106
114
  ]),
@@ -108,7 +116,6 @@ exports.blockSchema = z.object({
108
116
  created_by: user_schema_1.userSchema,
109
117
  last_edited_time: shared_schema_1.notionDateStringSchema,
110
118
  last_edited_by: user_schema_1.userSchema,
111
- archived: z.boolean(),
112
119
  in_trash: z.boolean(),
113
120
  has_children: z.boolean(),
114
121
  // Block-specific properties
@@ -288,7 +295,7 @@ exports.blockSchema = z.object({
288
295
  },
289
296
  })
290
297
  .optional(),
291
- transcription: z
298
+ meeting_notes: z
292
299
  .object({
293
300
  rich_text: richText_schema_1.richTextSchema,
294
301
  get children() {
@@ -785,7 +785,6 @@ export declare const dataSourceSchema: z.ZodObject<{
785
785
  url: z.ZodURL;
786
786
  public_url: z.ZodUnion<readonly [z.ZodURL, z.ZodNull]>;
787
787
  is_inline: z.ZodBoolean;
788
- archived: z.ZodBoolean;
789
788
  in_trash: z.ZodBoolean;
790
789
  }, z.core.$strip>;
791
790
  export type NotionDataSource = z.infer<typeof dataSourceSchema>;
@@ -84,8 +84,6 @@ exports.dataSourceSchema = z.object({
84
84
  public_url: z.union([z.url(), z.null()]),
85
85
  /** Whether the data source is inline */
86
86
  is_inline: z.boolean(),
87
- /** The archived status of the data source */
88
- archived: z.boolean(),
89
- /** Whether the data source has been deleted */
87
+ /** Whether the data source is in the trash */
90
88
  in_trash: z.boolean(),
91
89
  });
@@ -492,7 +492,6 @@ export declare const databaseSchema: z.ZodObject<{
492
492
  block_id: z.ZodUUID;
493
493
  }, z.core.$strip>], "type">;
494
494
  url: z.ZodURL;
495
- archived: z.ZodBoolean;
496
495
  in_trash: z.ZodBoolean;
497
496
  is_inline: z.ZodBoolean;
498
497
  public_url: z.ZodNullable<z.ZodURL>;
@@ -69,7 +69,6 @@ exports.databaseSchema = z.object({
69
69
  cover: z.nullable(file_schema_1.fileSchema),
70
70
  parent: parent_schema_1.parentSchema,
71
71
  url: z.url(),
72
- archived: z.boolean(),
73
72
  in_trash: z.boolean(),
74
73
  is_inline: z.boolean(),
75
74
  public_url: z.nullable(z.url()),
@@ -77,7 +77,6 @@ export declare const pageSchema: z.ZodObject<{
77
77
  object: z.ZodLiteral<"user">;
78
78
  id: z.ZodUUID;
79
79
  }, z.core.$strip>]>;
80
- archived: z.ZodBoolean;
81
80
  in_trash: z.ZodBoolean;
82
81
  icon: z.ZodNullable<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
83
82
  type: z.ZodLiteral<"file">;
@@ -57,7 +57,6 @@ exports.pageSchema = z.object({
57
57
  created_by: user_schema_1.userSchema,
58
58
  last_edited_time: shared_schema_1.notionDateStringSchema,
59
59
  last_edited_by: user_schema_1.userSchema,
60
- archived: z.boolean(),
61
60
  in_trash: z.boolean(),
62
61
  icon: z.nullable(z.union([file_schema_1.fileSchema, emoji_schema_1.emojiSchema])),
63
62
  cover: z.nullable(file_schema_1.fileSchema),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visus-io/notion-sdk-ts",
3
- "version": "2.1.0",
3
+ "version": "3.0.1",
4
4
  "private": false,
5
5
  "description": "TypeScript SDK for the Notion API",
6
6
  "keywords": [
@@ -63,17 +63,17 @@
63
63
  "zod": "^4.3.6"
64
64
  },
65
65
  "devDependencies": {
66
- "@commitlint/cli": "^20.4.1",
67
- "@commitlint/config-conventional": "^20.4.1",
66
+ "@commitlint/cli": "^21.0.0",
67
+ "@commitlint/config-conventional": "^21.0.0",
68
68
  "@types/node": "^25.2.1",
69
69
  "@vitest/coverage-v8": "^4.0.18",
70
- "eslint": "^9.39.2",
71
- "eslint-plugin-zod": "3.4.0",
70
+ "eslint": "^10.0.0",
71
+ "eslint-plugin-zod": "4.7.0",
72
72
  "husky": "^9.1.7",
73
73
  "lint-staged": "^16.2.7",
74
74
  "prettier": "^3.8.1",
75
75
  "prettier-plugin-packagejson": "^3.0.0",
76
- "typescript": "^5.5.3",
76
+ "typescript": "^6.0.0",
77
77
  "typescript-eslint": "^8.54.0",
78
78
  "vitest": "^4.0.18"
79
79
  },