@visus-io/notion-sdk-ts 2.1.0 → 3.0.2

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.
Files changed (37) hide show
  1. package/README.md +41 -14
  2. package/dist/api/base.api.d.ts +7 -16
  3. package/dist/api/base.api.js +5 -21
  4. package/dist/api/blocks.api.d.ts +8 -9
  5. package/dist/api/dataSources.api.d.ts +23 -19
  6. package/dist/api/dataSources.api.js +25 -24
  7. package/dist/api/databases.api.d.ts +15 -10
  8. package/dist/api/databases.api.js +20 -9
  9. package/dist/api/fileUploads.api.d.ts +6 -0
  10. package/dist/api/fileUploads.api.js +16 -1
  11. package/dist/api/pages.api.d.ts +14 -9
  12. package/dist/api/pages.api.js +18 -8
  13. package/dist/client.d.ts +6 -4
  14. package/dist/client.js +14 -4
  15. package/dist/helpers/block.helpers.d.ts +2 -2
  16. package/dist/helpers/block.helpers.js +4 -4
  17. package/dist/helpers/parent.helpers.d.ts +2 -2
  18. package/dist/helpers/parent.helpers.js +2 -2
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +3 -1
  21. package/dist/models/block.model.d.ts +0 -1
  22. package/dist/models/block.model.js +0 -3
  23. package/dist/models/dataSource.model.d.ts +0 -4
  24. package/dist/models/dataSource.model.js +0 -6
  25. package/dist/models/database.model.d.ts +0 -4
  26. package/dist/models/database.model.js +0 -6
  27. package/dist/models/page.model.d.ts +0 -1
  28. package/dist/models/page.model.js +0 -3
  29. package/dist/schemas/block.schema.d.ts +16 -3
  30. package/dist/schemas/block.schema.js +11 -4
  31. package/dist/schemas/dataSource.schema.d.ts +0 -1
  32. package/dist/schemas/dataSource.schema.js +1 -3
  33. package/dist/schemas/database.schema.d.ts +0 -1
  34. package/dist/schemas/database.schema.js +0 -1
  35. package/dist/schemas/page.schema.d.ts +0 -1
  36. package/dist/schemas/page.schema.js +0 -1
  37. package/package.json +8 -7
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
 
@@ -35,18 +35,6 @@ export declare abstract class BaseAPI<TResponse, TModel> {
35
35
  * return this.deleteResource(`/pages/${pageId}`);
36
36
  */
37
37
  protected deleteResource(resourcePath: string): Promise<TModel>;
38
- /**
39
- * Build filter_properties body parameter from an array of property names.
40
- *
41
- * @param filterProperties - Optional array of property names to include in the response
42
- * @returns Body object with filter_properties parameter for API requests
43
- *
44
- * @throws {NotionValidationError} If array exceeds LIMITS.ARRAY_ELEMENTS
45
- * @example
46
- * const body = this.buildFilterPropertiesBody(['Name', 'Status']);
47
- * // body will be: { filter_properties: ['Name', 'Status'] }
48
- */
49
- protected buildFilterPropertiesBody(filterProperties?: string[]): Record<string, unknown>;
50
38
  /**
51
39
  * Build pagination body parameters from PaginationParameters.
52
40
  *
@@ -61,6 +49,9 @@ export declare abstract class BaseAPI<TResponse, TModel> {
61
49
  /**
62
50
  * Build filter_properties query parameter from an array of property names.
63
51
  *
52
+ * Notion sends this as a repeated query key (`filter_properties=a&filter_properties=b`),
53
+ * not a single comma-joined value, so the array is preserved for `NotionClient` to expand.
54
+ *
64
55
  * @param filterProperties - Optional array of property names to include in the response
65
56
  * @returns Query object with filter_properties parameter for API requests
66
57
  *
@@ -68,9 +59,9 @@ export declare abstract class BaseAPI<TResponse, TModel> {
68
59
  *
69
60
  * @example
70
61
  * const query = this.buildFilterPropertiesQuery(['Name', 'Status']);
71
- * // query will be: { filter_properties: 'Name,Status' }
62
+ * // query will be: { filter_properties: ['Name', 'Status'] }
72
63
  */
73
- protected buildFilterPropertiesQuery(filterProperties?: string[]): Record<string, string>;
64
+ protected buildFilterPropertiesQuery(filterProperties?: string[]): Record<string, string[]>;
74
65
  /**
75
66
  * Build pagination query parameters from PaginationParameters.
76
67
  *
@@ -106,7 +97,7 @@ export declare abstract class BaseAPI<TResponse, TModel> {
106
97
  * @example
107
98
  * return this.retrieveResource(`/pages/${pageId}`, query);
108
99
  */
109
- protected retrieveResource(resourcePath: string, query?: Record<string, string>): Promise<TModel>;
100
+ protected retrieveResource(resourcePath: string, query?: Record<string, string | string[]>): Promise<TModel>;
110
101
  /**
111
102
  * Retrieve a paginated list of resources via GET request.
112
103
  *
@@ -120,7 +111,7 @@ export declare abstract class BaseAPI<TResponse, TModel> {
120
111
  * { page_size: '50' },
121
112
  * );
122
113
  */
123
- protected listResources(resourcePath: string, query?: Record<string, string>): Promise<PaginatedList<TModel>>;
114
+ protected listResources(resourcePath: string, query?: Record<string, string | string[]>): Promise<PaginatedList<TModel>>;
124
115
  /**
125
116
  * Update an existing resource via PATCH request.
126
117
  *
@@ -29,25 +29,6 @@ class BaseAPI {
29
29
  });
30
30
  return this.parseAndWrap(response);
31
31
  }
32
- /**
33
- * Build filter_properties body parameter from an array of property names.
34
- *
35
- * @param filterProperties - Optional array of property names to include in the response
36
- * @returns Body object with filter_properties parameter for API requests
37
- *
38
- * @throws {NotionValidationError} If array exceeds LIMITS.ARRAY_ELEMENTS
39
- * @example
40
- * const body = this.buildFilterPropertiesBody(['Name', 'Status']);
41
- * // body will be: { filter_properties: ['Name', 'Status'] }
42
- */
43
- buildFilterPropertiesBody(filterProperties) {
44
- const body = {};
45
- if (filterProperties) {
46
- (0, validation_1.validateArrayLength)(filterProperties, validation_1.LIMITS.ARRAY_ELEMENTS, 'filter_properties');
47
- body.filter_properties = filterProperties;
48
- }
49
- return body;
50
- }
51
32
  /**
52
33
  * Build pagination body parameters from PaginationParameters.
53
34
  *
@@ -71,6 +52,9 @@ class BaseAPI {
71
52
  /**
72
53
  * Build filter_properties query parameter from an array of property names.
73
54
  *
55
+ * Notion sends this as a repeated query key (`filter_properties=a&filter_properties=b`),
56
+ * not a single comma-joined value, so the array is preserved for `NotionClient` to expand.
57
+ *
74
58
  * @param filterProperties - Optional array of property names to include in the response
75
59
  * @returns Query object with filter_properties parameter for API requests
76
60
  *
@@ -78,13 +62,13 @@ class BaseAPI {
78
62
  *
79
63
  * @example
80
64
  * const query = this.buildFilterPropertiesQuery(['Name', 'Status']);
81
- * // query will be: { filter_properties: 'Name,Status' }
65
+ * // query will be: { filter_properties: ['Name', 'Status'] }
82
66
  */
83
67
  buildFilterPropertiesQuery(filterProperties) {
84
68
  const query = {};
85
69
  if (filterProperties) {
86
70
  (0, validation_1.validateArrayLength)(filterProperties, validation_1.LIMITS.ARRAY_ELEMENTS, 'filter_properties');
87
- query.filter_properties = filterProperties.join(',');
71
+ query.filter_properties = filterProperties;
88
72
  }
89
73
  return query;
90
74
  }
@@ -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,17 @@ 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
+ /** Whether to return only archived pages (true) or only non-archived pages (false, default) */
81
+ is_archived?: boolean;
82
+ /**
83
+ * Whether to return only trashed pages (true) or only non-trashed pages (false).
84
+ *
85
+ * @deprecated Use `is_archived` instead. Kept as an alias forwarded into
86
+ * `is_archived`; if both are provided, `is_archived` takes precedence.
87
+ */
88
+ in_trash?: boolean;
86
89
  }
87
90
  /**
88
91
  * Data Sources API client for working with Notion data sources.
@@ -870,7 +873,6 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
870
873
  url: import("zod").ZodURL;
871
874
  public_url: import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>;
872
875
  is_inline: import("zod").ZodBoolean;
873
- archived: import("zod").ZodBoolean;
874
876
  in_trash: import("zod").ZodBoolean;
875
877
  }, import("zod/v4/core").$strip>;
876
878
  ModelClass: typeof DataSource;
@@ -918,31 +920,33 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
918
920
  */
919
921
  update(dataSourceId: string, options: UpdateDataSourceOptions): Promise<DataSource>;
920
922
  /**
921
- * Archive a data source (convenience method).
923
+ * Move a data source to trash (convenience method).
922
924
  *
923
- * @param dataSourceId - The ID of the data source to archive
924
- * @returns The archived data source wrapped in a DataSource model
925
+ * @param dataSourceId - The ID of the data source to trash
926
+ * @returns The trashed data source wrapped in a DataSource model
925
927
  */
926
- archive(dataSourceId: string): Promise<DataSource>;
928
+ trash(dataSourceId: string): Promise<DataSource>;
927
929
  /**
928
- * Restore an archived data source (convenience method).
930
+ * Restore a data source from trash (convenience method).
929
931
  *
930
- * @param dataSourceId - The ID of the data source to restore
932
+ * @param dataSourceId - The ID of the data source to restore from trash
931
933
  * @returns The restored data source wrapped in a DataSource model
932
934
  */
933
- restore(dataSourceId: string): Promise<DataSource>;
935
+ untrash(dataSourceId: string): Promise<DataSource>;
934
936
  /**
935
- * Move a data source to trash (convenience method).
937
+ * Move a data source to trash.
936
938
  *
939
+ * @deprecated Use {@link trash} instead.
937
940
  * @param dataSourceId - The ID of the data source to trash
938
941
  * @returns The trashed data source wrapped in a DataSource model
939
942
  */
940
- trash(dataSourceId: string): Promise<DataSource>;
943
+ archive(dataSourceId: string): Promise<DataSource>;
941
944
  /**
942
- * Restore a data source from trash (convenience method).
945
+ * Restore a trashed data source.
943
946
  *
944
- * @param dataSourceId - The ID of the data source to restore from trash
947
+ * @deprecated Use {@link untrash} instead.
948
+ * @param dataSourceId - The ID of the data source to restore
945
949
  * @returns The restored data source wrapped in a DataSource model
946
950
  */
947
- untrash(dataSourceId: string): Promise<DataSource>;
951
+ restore(dataSourceId: string): Promise<DataSource>;
948
952
  }
@@ -61,22 +61,21 @@ class DataSourcesAPI extends base_api_1.BaseAPI {
61
61
  if (options?.start_cursor) {
62
62
  body.start_cursor = options.start_cursor;
63
63
  }
64
- if (options?.filter_properties) {
65
- (0, validation_1.validateArrayLength)(options.filter_properties, validation_1.LIMITS.ARRAY_ELEMENTS, 'filter_properties');
66
- body.filter_properties = options.filter_properties;
64
+ if (options?.in_trash !== undefined && options?.is_archived === undefined) {
65
+ console.warn('[notion-sdk-ts] QueryDataSourceOptions.in_trash is deprecated, use is_archived instead.');
67
66
  }
68
- if (options?.archived !== undefined) {
69
- body.archived = options.archived;
70
- }
71
- if (options?.in_trash !== undefined) {
72
- body.in_trash = options.in_trash;
67
+ const isArchived = options?.is_archived ?? options?.in_trash;
68
+ if (isArchived !== undefined) {
69
+ body.is_archived = isArchived;
73
70
  }
74
71
  if (options?.result_type) {
75
72
  body.result_type = options.result_type;
76
73
  }
74
+ const query = this.buildFilterPropertiesQuery(options?.filter_properties);
77
75
  const response = await this.client.request({
78
76
  method: 'POST',
79
77
  path: `/data_sources/${dataSourceId}/query`,
78
+ query: Object.keys(query).length > 0 ? query : undefined,
80
79
  body: Object.keys(body).length > 0 ? body : undefined,
81
80
  });
82
81
  const listSchema = (0, schemas_1.paginatedListSchema)(schemas_1.pageSchema);
@@ -119,40 +118,42 @@ class DataSourcesAPI extends base_api_1.BaseAPI {
119
118
  return this.updateResource(`/data_sources/${dataSourceId}`, options);
120
119
  }
121
120
  /**
122
- * Archive a data source (convenience method).
121
+ * Move a data source to trash (convenience method).
123
122
  *
124
- * @param dataSourceId - The ID of the data source to archive
125
- * @returns The archived data source wrapped in a DataSource model
123
+ * @param dataSourceId - The ID of the data source to trash
124
+ * @returns The trashed data source wrapped in a DataSource model
126
125
  */
127
- async archive(dataSourceId) {
128
- return this.update(dataSourceId, { archived: true });
126
+ async trash(dataSourceId) {
127
+ return this.update(dataSourceId, { in_trash: true });
129
128
  }
130
129
  /**
131
- * Restore an archived data source (convenience method).
130
+ * Restore a data source from trash (convenience method).
132
131
  *
133
- * @param dataSourceId - The ID of the data source to restore
132
+ * @param dataSourceId - The ID of the data source to restore from trash
134
133
  * @returns The restored data source wrapped in a DataSource model
135
134
  */
136
- async restore(dataSourceId) {
137
- return this.update(dataSourceId, { archived: false });
135
+ async untrash(dataSourceId) {
136
+ return this.update(dataSourceId, { in_trash: false });
138
137
  }
139
138
  /**
140
- * Move a data source to trash (convenience method).
139
+ * Move a data source to trash.
141
140
  *
141
+ * @deprecated Use {@link trash} instead.
142
142
  * @param dataSourceId - The ID of the data source to trash
143
143
  * @returns The trashed data source wrapped in a DataSource model
144
144
  */
145
- async trash(dataSourceId) {
146
- return this.update(dataSourceId, { in_trash: true });
145
+ async archive(dataSourceId) {
146
+ return this.trash(dataSourceId);
147
147
  }
148
148
  /**
149
- * Restore a data source from trash (convenience method).
149
+ * Restore a trashed data source.
150
150
  *
151
- * @param dataSourceId - The ID of the data source to restore from trash
151
+ * @deprecated Use {@link untrash} instead.
152
+ * @param dataSourceId - The ID of the data source to restore
152
153
  * @returns The restored data source wrapped in a DataSource model
153
154
  */
154
- async untrash(dataSourceId) {
155
- return this.update(dataSourceId, { in_trash: false });
155
+ async restore(dataSourceId) {
156
+ return this.untrash(dataSourceId);
156
157
  }
157
158
  }
158
159
  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
  }
@@ -48,11 +48,12 @@ class DatabasesAPI extends base_api_1.BaseAPI {
48
48
  ...(options?.filter ? { filter: options.filter } : {}),
49
49
  ...(options?.sorts ? { sorts: options.sorts } : {}),
50
50
  ...this.buildPaginationBody(options),
51
- ...this.buildFilterPropertiesBody(options?.filter_properties),
52
51
  };
52
+ const query = this.buildFilterPropertiesQuery(options?.filter_properties);
53
53
  const response = await this.client.request({
54
54
  method: 'POST',
55
55
  path: `/databases/${databaseId}/query`,
56
+ query: Object.keys(query).length > 0 ? query : undefined,
56
57
  body: Object.keys(body).length > 0 ? body : undefined,
57
58
  });
58
59
  const listSchema = (0, schemas_1.paginatedListSchema)(schemas_1.pageSchema);
@@ -86,7 +87,7 @@ class DatabasesAPI extends base_api_1.BaseAPI {
86
87
  return this.createResource('/databases', options);
87
88
  }
88
89
  /**
89
- * Update a database's properties, title, description, or archived status.
90
+ * Update a database's properties, title, description, or trash status.
90
91
  *
91
92
  * @param databaseId - The ID of the database to update
92
93
  * @param options - Options for updating the database
@@ -101,22 +102,32 @@ class DatabasesAPI extends base_api_1.BaseAPI {
101
102
  return this.updateResource(`/databases/${databaseId}`, options);
102
103
  }
103
104
  /**
104
- * Archive a database (convenience method).
105
+ * Move a database to trash (convenience method).
105
106
  *
106
- * @param databaseId - The ID of the database to archive
107
- * @returns The archived database wrapped in a Database model
107
+ * @param databaseId - The ID of the database to trash
108
+ * @returns The trashed database wrapped in a Database model
108
109
  */
109
- async archive(databaseId) {
110
- return this.update(databaseId, { archived: true });
110
+ async trash(databaseId) {
111
+ return this.update(databaseId, { in_trash: true });
111
112
  }
112
113
  /**
113
- * Restore an archived database (convenience method).
114
+ * Restore a trashed database (convenience method).
114
115
  *
115
116
  * @param databaseId - The ID of the database to restore
116
117
  * @returns The restored database wrapped in a Database model
117
118
  */
118
119
  async restore(databaseId) {
119
- return this.update(databaseId, { archived: false });
120
+ return this.update(databaseId, { in_trash: false });
121
+ }
122
+ /**
123
+ * Move a database to trash (convenience method).
124
+ *
125
+ * @deprecated Use {@link trash} instead.
126
+ * @param databaseId - The ID of the database to trash
127
+ * @returns The trashed database wrapped in a Database model
128
+ */
129
+ async archive(databaseId) {
130
+ return this.trash(databaseId);
120
131
  }
121
132
  }
122
133
  exports.DatabasesAPI = DatabasesAPI;
@@ -73,6 +73,12 @@ export declare class FileUploadsAPI extends BaseAPI<NotionFileUpload, FileUpload
73
73
  * @see https://developers.notion.com/reference/complete-a-file-upload
74
74
  */
75
75
  complete(completeUrl: string): Promise<FileUpload>;
76
+ /**
77
+ * Extracts the request path from a complete URL, accepting both absolute
78
+ * URLs (e.g. `https://api.notion.com/v1/file_uploads/.../complete`) and
79
+ * relative paths (e.g. `/v1/file_uploads/.../complete` or the path alone).
80
+ */
81
+ private static toRequestPath;
76
82
  /**
77
83
  * Helper method to upload a file in one call.
78
84
  * This combines initiate, upload, and complete steps.
@@ -66,12 +66,27 @@ class FileUploadsAPI extends base_api_1.BaseAPI {
66
66
  async complete(completeUrl) {
67
67
  const response = await this.client.request({
68
68
  method: 'POST',
69
- path: completeUrl.replace(/^https:\/\/api\.notion\.com\/v1/, ''),
69
+ path: FileUploadsAPI.toRequestPath(completeUrl),
70
70
  body: {},
71
71
  });
72
72
  const parsed = schemas_1.fileUploadSchema.parse(response);
73
73
  return new models_1.FileUpload(parsed);
74
74
  }
75
+ /**
76
+ * Extracts the request path from a complete URL, accepting both absolute
77
+ * URLs (e.g. `https://api.notion.com/v1/file_uploads/.../complete`) and
78
+ * relative paths (e.g. `/v1/file_uploads/.../complete` or the path alone).
79
+ */
80
+ static toRequestPath(completeUrl) {
81
+ let path;
82
+ try {
83
+ path = new URL(completeUrl).pathname;
84
+ }
85
+ catch {
86
+ path = completeUrl;
87
+ }
88
+ return path.replace(/^\/v1/, '');
89
+ }
75
90
  /**
76
91
  * Helper method to upload a file in one call.
77
92
  * This combines initiate, upload, and complete steps.
@@ -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) */
@@ -23,7 +26,7 @@ export interface NotionClientOptions {
23
26
  export interface RequestOptions {
24
27
  method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
25
28
  path: string;
26
- query?: Record<string, string | number | boolean | undefined>;
29
+ query?: Record<string, string | number | boolean | string[] | undefined>;
27
30
  body?: unknown;
28
31
  }
29
32
  /**
@@ -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;
@@ -106,7 +110,13 @@ class NotionClient {
106
110
  const url = new URL(`${this.baseUrl}/v1${path}`);
107
111
  if (query) {
108
112
  Object.entries(query).forEach(([key, value]) => {
109
- if (value !== undefined) {
113
+ if (value === undefined) {
114
+ return;
115
+ }
116
+ if (Array.isArray(value)) {
117
+ value.forEach((item) => url.searchParams.append(key, item));
118
+ }
119
+ else {
110
120
  url.searchParams.append(key, String(value));
111
121
  }
112
122
  });
@@ -120,7 +130,7 @@ class NotionClient {
120
130
  return {
121
131
  Authorization: `Bearer ${this.auth}`,
122
132
  'Content-Type': 'application/json',
123
- 'Notion-Version': this.notionVersion,
133
+ 'Notion-Version': exports.NOTION_VERSION,
124
134
  };
125
135
  }
126
136
  /**
@@ -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.2",
4
4
  "private": false,
5
5
  "description": "TypeScript SDK for the Notion API",
6
6
  "keywords": [
@@ -37,7 +37,7 @@
37
37
  "LICENSE"
38
38
  ],
39
39
  "scripts": {
40
- "build": "tsc",
40
+ "build": "tsc -p tsconfig.build.json",
41
41
  "format": "prettier --write .",
42
42
  "format:check": "prettier --check .",
43
43
  "lint": "eslint .",
@@ -63,17 +63,18 @@
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.8.0",
72
72
  "husky": "^9.1.7",
73
73
  "lint-staged": "^16.2.7",
74
+ "msw": "2.15.0",
74
75
  "prettier": "^3.8.1",
75
76
  "prettier-plugin-packagejson": "^3.0.0",
76
- "typescript": "^5.5.3",
77
+ "typescript": "^6.0.0",
77
78
  "typescript-eslint": "^8.54.0",
78
79
  "vitest": "^4.0.18"
79
80
  },