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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/README.md +66 -921
  2. package/dist/api/base.api.d.ts +161 -0
  3. package/dist/api/base.api.js +228 -0
  4. package/dist/api/blocks.api.d.ts +3867 -4
  5. package/dist/api/blocks.api.js +16 -47
  6. package/dist/api/comments.api.d.ts +259 -4
  7. package/dist/api/comments.api.js +11 -29
  8. package/dist/api/dataSources.api.d.ts +788 -4
  9. package/dist/api/dataSources.api.js +14 -28
  10. package/dist/api/databases.api.d.ts +491 -4
  11. package/dist/api/databases.api.js +20 -45
  12. package/dist/api/fileUploads.api.d.ts +25 -3
  13. package/dist/api/fileUploads.api.js +7 -2
  14. package/dist/api/index.d.ts +0 -1
  15. package/dist/api/index.js +0 -1
  16. package/dist/api/pages.api.d.ts +864 -3
  17. package/dist/api/pages.api.js +14 -28
  18. package/dist/api/search.api.d.ts +0 -1
  19. package/dist/api/search.api.js +5 -11
  20. package/dist/api/users.api.d.ts +40 -4
  21. package/dist/api/users.api.js +12 -35
  22. package/dist/client.d.ts +0 -1
  23. package/dist/client.js +0 -1
  24. package/dist/errors.d.ts +0 -1
  25. package/dist/errors.js +0 -1
  26. package/dist/helpers/block.helpers.d.ts +4 -1
  27. package/dist/helpers/block.helpers.js +11 -1
  28. package/dist/helpers/file.helpers.d.ts +0 -1
  29. package/dist/helpers/file.helpers.js +0 -1
  30. package/dist/helpers/filter.helpers.d.ts +0 -1
  31. package/dist/helpers/filter.helpers.js +0 -1
  32. package/dist/helpers/index.d.ts +0 -1
  33. package/dist/helpers/index.js +0 -1
  34. package/dist/helpers/pagination.helpers.d.ts +0 -1
  35. package/dist/helpers/pagination.helpers.js +0 -1
  36. package/dist/helpers/parent.helpers.d.ts +0 -1
  37. package/dist/helpers/parent.helpers.js +0 -1
  38. package/dist/helpers/property.helpers.d.ts +0 -1
  39. package/dist/helpers/property.helpers.js +0 -1
  40. package/dist/helpers/richText.helpers.d.ts +0 -1
  41. package/dist/helpers/richText.helpers.js +0 -1
  42. package/dist/helpers/sort.helpers.d.ts +0 -1
  43. package/dist/helpers/sort.helpers.js +0 -1
  44. package/dist/index.d.ts +0 -1
  45. package/dist/index.js +0 -1
  46. package/dist/models/base.model.d.ts +2 -3
  47. package/dist/models/base.model.js +0 -1
  48. package/dist/models/block.model.d.ts +0 -1
  49. package/dist/models/block.model.js +0 -1
  50. package/dist/models/comment.model.d.ts +0 -1
  51. package/dist/models/comment.model.js +0 -1
  52. package/dist/models/dataSource.model.d.ts +0 -1
  53. package/dist/models/dataSource.model.js +0 -1
  54. package/dist/models/database.model.d.ts +0 -1
  55. package/dist/models/database.model.js +0 -1
  56. package/dist/models/fileUpload.model.d.ts +0 -1
  57. package/dist/models/fileUpload.model.js +0 -1
  58. package/dist/models/index.d.ts +0 -1
  59. package/dist/models/index.js +0 -1
  60. package/dist/models/page.model.d.ts +0 -1
  61. package/dist/models/page.model.js +0 -1
  62. package/dist/models/richText.model.d.ts +0 -1
  63. package/dist/models/richText.model.js +0 -1
  64. package/dist/models/user.model.d.ts +0 -1
  65. package/dist/models/user.model.js +0 -1
  66. package/dist/notion.d.ts +0 -1
  67. package/dist/notion.js +0 -1
  68. package/dist/schemas/block.schema.d.ts +261 -82
  69. package/dist/schemas/block.schema.js +157 -82
  70. package/dist/schemas/codeLanguages.d.ts +0 -1
  71. package/dist/schemas/codeLanguages.js +0 -1
  72. package/dist/schemas/colors.d.ts +0 -1
  73. package/dist/schemas/colors.js +0 -1
  74. package/dist/schemas/comment.schema.d.ts +9 -10
  75. package/dist/schemas/comment.schema.js +54 -21
  76. package/dist/schemas/dataSource.schema.d.ts +13 -14
  77. package/dist/schemas/dataSource.schema.js +46 -13
  78. package/dist/schemas/database.schema.d.ts +13 -14
  79. package/dist/schemas/database.schema.js +51 -18
  80. package/dist/schemas/emoji.schema.d.ts +1 -2
  81. package/dist/schemas/emoji.schema.js +37 -5
  82. package/dist/schemas/file.schema.d.ts +3 -4
  83. package/dist/schemas/file.schema.js +49 -16
  84. package/dist/schemas/fileUpload.schema.d.ts +3 -4
  85. package/dist/schemas/fileUpload.schema.js +47 -14
  86. package/dist/schemas/index.d.ts +1 -1
  87. package/dist/schemas/index.js +1 -1
  88. package/dist/schemas/page.schema.d.ts +30 -31
  89. package/dist/schemas/page.schema.js +47 -14
  90. package/dist/schemas/pageProperties.schema.d.ts +47 -48
  91. package/dist/schemas/pageProperties.schema.js +162 -129
  92. package/dist/schemas/pagination.schema.d.ts +1 -2
  93. package/dist/schemas/pagination.schema.js +40 -8
  94. package/dist/schemas/parent.schema.d.ts +1 -2
  95. package/dist/schemas/parent.schema.js +51 -19
  96. package/dist/schemas/propertyObjects.schema.d.ts +1 -2
  97. package/dist/schemas/propertyObjects.schema.js +194 -162
  98. package/dist/schemas/richText.schema.d.ts +7 -8
  99. package/dist/schemas/richText.schema.js +95 -57
  100. package/dist/schemas/shared.schema.d.ts +15 -0
  101. package/dist/schemas/shared.schema.js +54 -0
  102. package/dist/schemas/user.schema.d.ts +3 -4
  103. package/dist/schemas/user.schema.js +63 -31
  104. package/dist/validation.d.ts +0 -1
  105. package/dist/validation.js +0 -1
  106. package/package.json +3 -1
  107. package/dist/api/blocks.api.d.ts.map +0 -1
  108. package/dist/api/blocks.api.js.map +0 -1
  109. package/dist/api/comments.api.d.ts.map +0 -1
  110. package/dist/api/comments.api.js.map +0 -1
  111. package/dist/api/dataSources.api.d.ts.map +0 -1
  112. package/dist/api/dataSources.api.js.map +0 -1
  113. package/dist/api/databases.api.d.ts.map +0 -1
  114. package/dist/api/databases.api.js.map +0 -1
  115. package/dist/api/fileUploads.api.d.ts.map +0 -1
  116. package/dist/api/fileUploads.api.js.map +0 -1
  117. package/dist/api/index.d.ts.map +0 -1
  118. package/dist/api/index.js.map +0 -1
  119. package/dist/api/pages.api.d.ts.map +0 -1
  120. package/dist/api/pages.api.js.map +0 -1
  121. package/dist/api/search.api.d.ts.map +0 -1
  122. package/dist/api/search.api.js.map +0 -1
  123. package/dist/api/users.api.d.ts.map +0 -1
  124. package/dist/api/users.api.js.map +0 -1
  125. package/dist/client.d.ts.map +0 -1
  126. package/dist/client.js.map +0 -1
  127. package/dist/errors.d.ts.map +0 -1
  128. package/dist/errors.js.map +0 -1
  129. package/dist/helpers/block.helpers.d.ts.map +0 -1
  130. package/dist/helpers/block.helpers.js.map +0 -1
  131. package/dist/helpers/file.helpers.d.ts.map +0 -1
  132. package/dist/helpers/file.helpers.js.map +0 -1
  133. package/dist/helpers/filter.helpers.d.ts.map +0 -1
  134. package/dist/helpers/filter.helpers.js.map +0 -1
  135. package/dist/helpers/index.d.ts.map +0 -1
  136. package/dist/helpers/index.js.map +0 -1
  137. package/dist/helpers/pagination.helpers.d.ts.map +0 -1
  138. package/dist/helpers/pagination.helpers.js.map +0 -1
  139. package/dist/helpers/parent.helpers.d.ts.map +0 -1
  140. package/dist/helpers/parent.helpers.js.map +0 -1
  141. package/dist/helpers/property.helpers.d.ts.map +0 -1
  142. package/dist/helpers/property.helpers.js.map +0 -1
  143. package/dist/helpers/richText.helpers.d.ts.map +0 -1
  144. package/dist/helpers/richText.helpers.js.map +0 -1
  145. package/dist/helpers/sort.helpers.d.ts.map +0 -1
  146. package/dist/helpers/sort.helpers.js.map +0 -1
  147. package/dist/index.d.ts.map +0 -1
  148. package/dist/index.js.map +0 -1
  149. package/dist/models/base.model.d.ts.map +0 -1
  150. package/dist/models/base.model.js.map +0 -1
  151. package/dist/models/block.model.d.ts.map +0 -1
  152. package/dist/models/block.model.js.map +0 -1
  153. package/dist/models/comment.model.d.ts.map +0 -1
  154. package/dist/models/comment.model.js.map +0 -1
  155. package/dist/models/dataSource.model.d.ts.map +0 -1
  156. package/dist/models/dataSource.model.js.map +0 -1
  157. package/dist/models/database.model.d.ts.map +0 -1
  158. package/dist/models/database.model.js.map +0 -1
  159. package/dist/models/fileUpload.model.d.ts.map +0 -1
  160. package/dist/models/fileUpload.model.js.map +0 -1
  161. package/dist/models/index.d.ts.map +0 -1
  162. package/dist/models/index.js.map +0 -1
  163. package/dist/models/page.model.d.ts.map +0 -1
  164. package/dist/models/page.model.js.map +0 -1
  165. package/dist/models/richText.model.d.ts.map +0 -1
  166. package/dist/models/richText.model.js.map +0 -1
  167. package/dist/models/user.model.d.ts.map +0 -1
  168. package/dist/models/user.model.js.map +0 -1
  169. package/dist/notion.d.ts.map +0 -1
  170. package/dist/notion.js.map +0 -1
  171. package/dist/schemas/block.schema.d.ts.map +0 -1
  172. package/dist/schemas/block.schema.js.map +0 -1
  173. package/dist/schemas/codeLanguages.d.ts.map +0 -1
  174. package/dist/schemas/codeLanguages.js.map +0 -1
  175. package/dist/schemas/colors.d.ts.map +0 -1
  176. package/dist/schemas/colors.js.map +0 -1
  177. package/dist/schemas/comment.schema.d.ts.map +0 -1
  178. package/dist/schemas/comment.schema.js.map +0 -1
  179. package/dist/schemas/dataSource.schema.d.ts.map +0 -1
  180. package/dist/schemas/dataSource.schema.js.map +0 -1
  181. package/dist/schemas/database.schema.d.ts.map +0 -1
  182. package/dist/schemas/database.schema.js.map +0 -1
  183. package/dist/schemas/emoji.schema.d.ts.map +0 -1
  184. package/dist/schemas/emoji.schema.js.map +0 -1
  185. package/dist/schemas/file.schema.d.ts.map +0 -1
  186. package/dist/schemas/file.schema.js.map +0 -1
  187. package/dist/schemas/fileUpload.schema.d.ts.map +0 -1
  188. package/dist/schemas/fileUpload.schema.js.map +0 -1
  189. package/dist/schemas/index.d.ts.map +0 -1
  190. package/dist/schemas/index.js.map +0 -1
  191. package/dist/schemas/page.schema.d.ts.map +0 -1
  192. package/dist/schemas/page.schema.js.map +0 -1
  193. package/dist/schemas/pageProperties.schema.d.ts.map +0 -1
  194. package/dist/schemas/pageProperties.schema.js.map +0 -1
  195. package/dist/schemas/pagination.schema.d.ts.map +0 -1
  196. package/dist/schemas/pagination.schema.js.map +0 -1
  197. package/dist/schemas/parent.schema.d.ts.map +0 -1
  198. package/dist/schemas/parent.schema.js.map +0 -1
  199. package/dist/schemas/propertyObjects.schema.d.ts.map +0 -1
  200. package/dist/schemas/propertyObjects.schema.js.map +0 -1
  201. package/dist/schemas/richText.schema.d.ts.map +0 -1
  202. package/dist/schemas/richText.schema.js.map +0 -1
  203. package/dist/schemas/user.schema.d.ts.map +0 -1
  204. package/dist/schemas/user.schema.js.map +0 -1
  205. package/dist/validation.d.ts.map +0 -1
  206. package/dist/validation.js.map +0 -1
@@ -4,12 +4,19 @@ exports.PagesAPI = void 0;
4
4
  const schemas_1 = require("../schemas");
5
5
  const models_1 = require("../models");
6
6
  const validation_1 = require("../validation");
7
+ const base_api_1 = require("./base.api");
7
8
  /**
8
9
  * Pages API client for working with Notion pages.
9
10
  */
10
- class PagesAPI {
11
+ class PagesAPI extends base_api_1.BaseAPI {
11
12
  constructor(client) {
13
+ super(client);
12
14
  this.client = client;
15
+ this.config = {
16
+ schema: schemas_1.pageSchema,
17
+ ModelClass: models_1.Page,
18
+ listType: 'page',
19
+ };
13
20
  }
14
21
  /**
15
22
  * Retrieve a page by ID.
@@ -21,18 +28,10 @@ class PagesAPI {
21
28
  * @see https://developers.notion.com/reference/retrieve-a-page
22
29
  */
23
30
  async retrieve(pageId, options) {
24
- const query = {};
25
- if (options?.filter_properties) {
26
- (0, validation_1.validateArrayLength)(options.filter_properties, validation_1.LIMITS.ARRAY_ELEMENTS, 'filter_properties');
27
- query.filter_properties = options.filter_properties.join(',');
28
- }
29
- const response = await this.client.request({
30
- method: 'GET',
31
- path: `/pages/${pageId}`,
32
- query: Object.keys(query).length > 0 ? query : undefined,
33
- });
34
- const parsed = schemas_1.pageSchema.parse(response);
35
- return new models_1.Page(parsed);
31
+ const query = {
32
+ ...this.buildFilterPropertiesQuery(options?.filter_properties),
33
+ };
34
+ return this.retrieveResource(`/pages/${pageId}`, query);
36
35
  }
37
36
  /**
38
37
  * Create a new page.
@@ -46,13 +45,7 @@ class PagesAPI {
46
45
  if (options.children) {
47
46
  (0, validation_1.validateArrayLength)(options.children, validation_1.LIMITS.ARRAY_ELEMENTS, 'children');
48
47
  }
49
- const response = await this.client.request({
50
- method: 'POST',
51
- path: '/pages',
52
- body: options,
53
- });
54
- const parsed = schemas_1.pageSchema.parse(response);
55
- return new models_1.Page(parsed);
48
+ return this.createResource('/pages', options);
56
49
  }
57
50
  /**
58
51
  * Update a page's properties, icon, cover, or archived status.
@@ -64,13 +57,7 @@ class PagesAPI {
64
57
  * @see https://developers.notion.com/reference/patch-page
65
58
  */
66
59
  async update(pageId, options) {
67
- const response = await this.client.request({
68
- method: 'PATCH',
69
- path: `/pages/${pageId}`,
70
- body: options,
71
- });
72
- const parsed = schemas_1.pageSchema.parse(response);
73
- return new models_1.Page(parsed);
60
+ return this.updateResource(`/pages/${pageId}`, options);
74
61
  }
75
62
  /**
76
63
  * Archive a page (convenience method).
@@ -92,4 +79,3 @@ class PagesAPI {
92
79
  }
93
80
  }
94
81
  exports.PagesAPI = PagesAPI;
95
- //# sourceMappingURL=pages.api.js.map
@@ -57,4 +57,3 @@ export declare class SearchAPI {
57
57
  */
58
58
  query(options?: SearchOptions): Promise<PaginatedList<SearchResult>>;
59
59
  }
60
- //# sourceMappingURL=search.api.d.ts.map
@@ -20,16 +20,11 @@ class SearchAPI {
20
20
  * @see https://developers.notion.com/reference/post-search
21
21
  */
22
22
  async query(options) {
23
- const body = {};
24
- if (options?.query) {
25
- body.query = options.query;
26
- }
27
- if (options?.filter) {
28
- body.filter = options.filter;
29
- }
30
- if (options?.sort) {
31
- body.sort = options.sort;
32
- }
23
+ const body = {
24
+ ...(options?.query ? { query: options.query } : {}),
25
+ ...(options?.filter ? { filter: options.filter } : {}),
26
+ ...(options?.sort ? { sort: options.sort } : {}),
27
+ };
33
28
  if (options?.page_size) {
34
29
  body.page_size = options.page_size;
35
30
  }
@@ -63,4 +58,3 @@ class SearchAPI {
63
58
  }
64
59
  }
65
60
  exports.SearchAPI = SearchAPI;
66
- //# sourceMappingURL=search.api.js.map
@@ -1,11 +1,48 @@
1
1
  import type { NotionClient } from '../client';
2
- import { type PaginatedList, type PaginationParameters } from '../schemas';
2
+ import { type NotionUser, type PaginatedList, type PaginationParameters } from '../schemas';
3
3
  import { User } from '../models';
4
+ import { BaseAPI } from './base.api';
4
5
  /**
5
6
  * Users API client for working with Notion users.
6
7
  */
7
- export declare class UsersAPI {
8
- private readonly client;
8
+ export declare class UsersAPI extends BaseAPI<NotionUser, User> {
9
+ protected readonly client: NotionClient;
10
+ protected config: {
11
+ schema: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
12
+ object: import("zod").ZodLiteral<"user">;
13
+ id: import("zod").ZodUUID;
14
+ type: import("zod").ZodLiteral<"person">;
15
+ name: import("zod").ZodOptional<import("zod").ZodString>;
16
+ avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
17
+ person: import("zod").ZodObject<{
18
+ email: import("zod").ZodEmail;
19
+ }, import("zod/v4/core").$strip>;
20
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
21
+ object: import("zod").ZodLiteral<"user">;
22
+ id: import("zod").ZodUUID;
23
+ type: import("zod").ZodLiteral<"bot">;
24
+ name: import("zod").ZodOptional<import("zod").ZodString>;
25
+ avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
26
+ bot: import("zod").ZodObject<{
27
+ owner: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
28
+ type: import("zod").ZodLiteral<"workspace">;
29
+ workspace: import("zod").ZodLiteral<true>;
30
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
31
+ type: import("zod").ZodLiteral<"user">;
32
+ }, import("zod/v4/core").$strip>], "type">;
33
+ workspace_name: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
34
+ workspace_id: import("zod").ZodOptional<import("zod").ZodString>;
35
+ workspace_limits: import("zod").ZodOptional<import("zod").ZodObject<{
36
+ max_file_upload_size_in_bytes: import("zod").ZodInt;
37
+ }, import("zod/v4/core").$strip>>;
38
+ }, import("zod/v4/core").$strip>;
39
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
40
+ object: import("zod").ZodLiteral<"user">;
41
+ id: import("zod").ZodUUID;
42
+ }, import("zod/v4/core").$strip>]>;
43
+ ModelClass: typeof User;
44
+ listType: "user";
45
+ };
9
46
  constructor(client: NotionClient);
10
47
  /**
11
48
  * Retrieve a user by ID.
@@ -34,4 +71,3 @@ export declare class UsersAPI {
34
71
  */
35
72
  me(): Promise<User>;
36
73
  }
37
- //# sourceMappingURL=users.api.d.ts.map
@@ -3,12 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UsersAPI = void 0;
4
4
  const schemas_1 = require("../schemas");
5
5
  const models_1 = require("../models");
6
+ const base_api_1 = require("./base.api");
6
7
  /**
7
8
  * Users API client for working with Notion users.
8
9
  */
9
- class UsersAPI {
10
+ class UsersAPI extends base_api_1.BaseAPI {
10
11
  constructor(client) {
12
+ super(client);
11
13
  this.client = client;
14
+ this.config = {
15
+ schema: schemas_1.userSchema,
16
+ ModelClass: models_1.User,
17
+ listType: 'user',
18
+ };
12
19
  }
13
20
  /**
14
21
  * Retrieve a user by ID.
@@ -19,12 +26,7 @@ class UsersAPI {
19
26
  * @see https://developers.notion.com/reference/get-user
20
27
  */
21
28
  async retrieve(userId) {
22
- const response = await this.client.request({
23
- method: 'GET',
24
- path: `/users/${userId}`,
25
- });
26
- const parsed = schemas_1.userSchema.parse(response);
27
- return new models_1.User(parsed);
29
+ return this.retrieveResource(`/users/${userId}`);
28
30
  }
29
31
  /**
30
32
  * List all users in the workspace (paginated).
@@ -35,27 +37,8 @@ class UsersAPI {
35
37
  * @see https://developers.notion.com/reference/get-users
36
38
  */
37
39
  async list(params) {
38
- const query = {};
39
- if (params?.page_size) {
40
- query.page_size = String(params.page_size);
41
- }
42
- if (params?.start_cursor) {
43
- query.start_cursor = params.start_cursor;
44
- }
45
- const response = await this.client.request({
46
- method: 'GET',
47
- path: '/users',
48
- query: Object.keys(query).length > 0 ? query : undefined,
49
- });
50
- const listSchema = (0, schemas_1.paginatedListSchema)(schemas_1.userSchema);
51
- const parsed = listSchema.parse(response);
52
- return {
53
- object: 'list',
54
- results: parsed.results.map((user) => new models_1.User(user)),
55
- next_cursor: parsed.next_cursor,
56
- has_more: parsed.has_more,
57
- type: 'user',
58
- };
40
+ const query = this.buildPaginationQuery(params);
41
+ return this.listResources('/users', query);
59
42
  }
60
43
  /**
61
44
  * Retrieve the bot user associated with the API token.
@@ -65,13 +48,7 @@ class UsersAPI {
65
48
  * @see https://developers.notion.com/reference/get-self
66
49
  */
67
50
  async me() {
68
- const response = await this.client.request({
69
- method: 'GET',
70
- path: '/users/me',
71
- });
72
- const parsed = schemas_1.userSchema.parse(response);
73
- return new models_1.User(parsed);
51
+ return this.retrieveResource('/users/me');
74
52
  }
75
53
  }
76
54
  exports.UsersAPI = UsersAPI;
77
- //# sourceMappingURL=users.api.js.map
package/dist/client.d.ts CHANGED
@@ -75,4 +75,3 @@ export declare class NotionClient {
75
75
  */
76
76
  private handleErrorResponse;
77
77
  }
78
- //# sourceMappingURL=client.d.ts.map
package/dist/client.js CHANGED
@@ -161,4 +161,3 @@ class NotionClient {
161
161
  }
162
162
  }
163
163
  exports.NotionClient = NotionClient;
164
- //# sourceMappingURL=client.js.map
package/dist/errors.d.ts CHANGED
@@ -58,4 +58,3 @@ export declare class NotionNetworkError extends Error {
58
58
  readonly cause?: Error;
59
59
  constructor(message: string, cause?: Error);
60
60
  }
61
- //# sourceMappingURL=errors.d.ts.map
package/dist/errors.js CHANGED
@@ -82,4 +82,3 @@ class NotionNetworkError extends Error {
82
82
  }
83
83
  }
84
84
  exports.NotionNetworkError = NotionNetworkError;
85
- //# sourceMappingURL=errors.js.map
@@ -65,6 +65,9 @@ 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?: {
69
+ children?: unknown[];
70
+ }): BlockObject;
68
71
  /** Options for code blocks. */
69
72
  interface CodeOptions {
70
73
  caption?: RichTextInput;
@@ -164,6 +167,7 @@ export declare const block: {
164
167
  quote: typeof quote;
165
168
  callout: typeof callout;
166
169
  template: typeof template;
170
+ transcription: typeof transcription;
167
171
  code: typeof code;
168
172
  equation: typeof equation;
169
173
  image: typeof image;
@@ -184,4 +188,3 @@ export declare const block: {
184
188
  syncedBlock: typeof syncedBlock;
185
189
  };
186
190
  export {};
187
- //# sourceMappingURL=block.helpers.d.ts.map
@@ -170,6 +170,16 @@ function template(text, options) {
170
170
  },
171
171
  };
172
172
  }
173
+ function transcription(text, options) {
174
+ return {
175
+ object: 'block',
176
+ type: 'transcription',
177
+ transcription: {
178
+ rich_text: resolveRichText(text),
179
+ ...(options?.children ? { children: options.children } : {}),
180
+ },
181
+ };
182
+ }
173
183
  function code(content, language, options) {
174
184
  return {
175
185
  object: 'block',
@@ -403,6 +413,7 @@ exports.block = {
403
413
  quote,
404
414
  callout,
405
415
  template,
416
+ transcription,
406
417
  // Code & equation
407
418
  code,
408
419
  equation,
@@ -427,4 +438,3 @@ exports.block = {
427
438
  // Synced
428
439
  syncedBlock,
429
440
  };
430
- //# sourceMappingURL=block.helpers.js.map
@@ -133,4 +133,3 @@ export declare const notionFile: {
133
133
  upload: typeof uploadFile;
134
134
  };
135
135
  export {};
136
- //# sourceMappingURL=file.helpers.d.ts.map
@@ -145,4 +145,3 @@ exports.notionFile = {
145
145
  external: externalFile,
146
146
  upload: uploadFile,
147
147
  };
148
- //# sourceMappingURL=file.helpers.js.map
@@ -180,4 +180,3 @@ export declare const filter: {
180
180
  or: typeof or;
181
181
  };
182
182
  export {};
183
- //# sourceMappingURL=filter.helpers.d.ts.map
@@ -330,4 +330,3 @@ exports.filter = {
330
330
  and,
331
331
  or,
332
332
  };
333
- //# sourceMappingURL=filter.helpers.js.map
@@ -8,4 +8,3 @@ export { parent } from './parent.helpers';
8
8
  export { prop } from './property.helpers';
9
9
  export { RichTextBuilder, richText } from './richText.helpers';
10
10
  export { sort } from './sort.helpers';
11
- //# sourceMappingURL=index.d.ts.map
@@ -22,4 +22,3 @@ Object.defineProperty(exports, "RichTextBuilder", { enumerable: true, get: funct
22
22
  Object.defineProperty(exports, "richText", { enumerable: true, get: function () { return richText_helpers_1.richText; } });
23
23
  var sort_helpers_1 = require("./sort.helpers");
24
24
  Object.defineProperty(exports, "sort", { enumerable: true, get: function () { return sort_helpers_1.sort; } });
25
- //# sourceMappingURL=index.js.map
@@ -149,4 +149,3 @@ export declare function paginateWithMetadata<T>(fetchPage: PaginatedFetchFunctio
149
149
  pageCount: number;
150
150
  totalCount: number;
151
151
  }>;
152
- //# sourceMappingURL=pagination.helpers.d.ts.map
@@ -143,4 +143,3 @@ async function paginateWithMetadata(fetchPage) {
143
143
  totalCount: items.length,
144
144
  };
145
145
  }
146
- //# sourceMappingURL=pagination.helpers.js.map
@@ -95,4 +95,3 @@ export declare const parent: {
95
95
  block: typeof blockParent;
96
96
  };
97
97
  export {};
98
- //# sourceMappingURL=parent.helpers.d.ts.map
@@ -102,4 +102,3 @@ exports.parent = {
102
102
  workspace,
103
103
  block: blockParent,
104
104
  };
105
- //# sourceMappingURL=parent.helpers.js.map
@@ -245,4 +245,3 @@ export declare const prop: {
245
245
  files: typeof files;
246
246
  };
247
247
  export {};
248
- //# sourceMappingURL=property.helpers.d.ts.map
@@ -269,4 +269,3 @@ exports.prop = {
269
269
  people,
270
270
  files,
271
271
  };
272
- //# sourceMappingURL=property.helpers.js.map
@@ -147,4 +147,3 @@ export declare const richText: typeof createRichText & {
147
147
  join: typeof join;
148
148
  };
149
149
  export {};
150
- //# sourceMappingURL=richText.helpers.d.ts.map
@@ -279,4 +279,3 @@ exports.richText = Object.assign(createRichText, {
279
279
  equation,
280
280
  join,
281
281
  });
282
- //# sourceMappingURL=richText.helpers.js.map
@@ -66,4 +66,3 @@ export declare const sort: {
66
66
  lastEditedTime: () => TimestampSortBuilder;
67
67
  };
68
68
  export {};
69
- //# sourceMappingURL=sort.helpers.d.ts.map
@@ -77,4 +77,3 @@ exports.sort = {
77
77
  */
78
78
  lastEditedTime: () => new TimestampSortBuilder('last_edited_time'),
79
79
  };
80
- //# sourceMappingURL=sort.helpers.js.map
package/dist/index.d.ts CHANGED
@@ -6,4 +6,3 @@ export * from './validation';
6
6
  export * from './schemas';
7
7
  export * from './models';
8
8
  export * from './helpers';
9
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -30,4 +30,3 @@ __exportStar(require("./schemas"), exports);
30
30
  __exportStar(require("./models"), exports);
31
31
  // Export helpers
32
32
  __exportStar(require("./helpers"), exports);
33
- //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
- import type { ZodType } from 'zod';
1
+ import type * as z from 'zod';
2
2
  /**
3
3
  * Base model class providing common functionality for all Notion models.
4
4
  * Models wrap validated data from schemas with methods and business logic.
5
5
  */
6
6
  export declare abstract class BaseModel<T> {
7
7
  protected readonly data: T;
8
- protected constructor(data: T, schema: ZodType<T>);
8
+ protected constructor(data: T, schema: z.ZodType<T>);
9
9
  /**
10
10
  * Returns the raw validated data as a plain object.
11
11
  */
@@ -19,4 +19,3 @@ export declare abstract class BaseModel<T> {
19
19
  */
20
20
  abstract get id(): string;
21
21
  }
22
- //# sourceMappingURL=base.model.d.ts.map
@@ -17,4 +17,3 @@ class BaseModel {
17
17
  }
18
18
  }
19
19
  exports.BaseModel = BaseModel;
20
- //# sourceMappingURL=base.model.js.map
@@ -30,4 +30,3 @@ export declare class Block extends BaseModel<NotionBlock> {
30
30
  */
31
31
  getPlainText(): string | null;
32
32
  }
33
- //# sourceMappingURL=block.model.d.ts.map
@@ -93,4 +93,3 @@ class Block extends base_model_1.BaseModel {
93
93
  }
94
94
  }
95
95
  exports.Block = Block;
96
- //# sourceMappingURL=block.model.js.map
@@ -70,4 +70,3 @@ export declare class Comment extends BaseModel<NotionComment> {
70
70
  */
71
71
  hasBlockParent(): boolean;
72
72
  }
73
- //# sourceMappingURL=comment.model.d.ts.map
@@ -108,4 +108,3 @@ class Comment extends base_model_1.BaseModel {
108
108
  }
109
109
  }
110
110
  exports.Comment = Comment;
111
- //# sourceMappingURL=comment.model.js.map
@@ -104,4 +104,3 @@ export declare class DataSource extends BaseModel<NotionDataSource> {
104
104
  */
105
105
  hasProperty(name: string): boolean;
106
106
  }
107
- //# sourceMappingURL=dataSource.model.d.ts.map
@@ -161,4 +161,3 @@ class DataSource extends base_model_1.BaseModel {
161
161
  }
162
162
  }
163
163
  exports.DataSource = DataSource;
164
- //# sourceMappingURL=dataSource.model.js.map
@@ -94,4 +94,3 @@ export declare class Database extends BaseModel<NotionDatabase> {
94
94
  */
95
95
  hasWorkspaceParent(): boolean;
96
96
  }
97
- //# sourceMappingURL=database.model.d.ts.map
@@ -144,4 +144,3 @@ class Database extends base_model_1.BaseModel {
144
144
  }
145
145
  }
146
146
  exports.Database = Database;
147
- //# sourceMappingURL=database.model.js.map
@@ -66,4 +66,3 @@ export declare class FileUpload extends BaseModel<NotionFileUpload> {
66
66
  */
67
67
  isFailed(): boolean;
68
68
  }
69
- //# sourceMappingURL=fileUpload.model.d.ts.map
@@ -102,4 +102,3 @@ class FileUpload extends base_model_1.BaseModel {
102
102
  }
103
103
  }
104
104
  exports.FileUpload = FileUpload;
105
- //# sourceMappingURL=fileUpload.model.js.map
@@ -7,4 +7,3 @@ export { FileUpload } from './fileUpload.model';
7
7
  export { Page } from './page.model';
8
8
  export { RichText } from './richText.model';
9
9
  export { User } from './user.model';
10
- //# sourceMappingURL=index.d.ts.map
@@ -19,4 +19,3 @@ var richText_model_1 = require("./richText.model");
19
19
  Object.defineProperty(exports, "RichText", { enumerable: true, get: function () { return richText_model_1.RichText; } });
20
20
  var user_model_1 = require("./user.model");
21
21
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return user_model_1.User; } });
22
- //# sourceMappingURL=index.js.map
@@ -31,4 +31,3 @@ export declare class Page extends BaseModel<NotionPage> {
31
31
  */
32
32
  isSubpage(): boolean;
33
33
  }
34
- //# sourceMappingURL=page.model.d.ts.map
@@ -68,4 +68,3 @@ class Page extends base_model_1.BaseModel {
68
68
  }
69
69
  }
70
70
  exports.Page = Page;
71
- //# sourceMappingURL=page.model.js.map
@@ -31,4 +31,3 @@ export declare class RichText {
31
31
  toJSON(): NotionRichText;
32
32
  private escapeHTML;
33
33
  }
34
- //# sourceMappingURL=richText.model.d.ts.map
@@ -111,4 +111,3 @@ class RichText {
111
111
  }
112
112
  }
113
113
  exports.RichText = RichText;
114
- //# sourceMappingURL=richText.model.js.map
@@ -43,4 +43,3 @@ export declare class User extends BaseModel<NotionUser> {
43
43
  };
44
44
  } | undefined;
45
45
  }
46
- //# sourceMappingURL=user.model.d.ts.map
@@ -57,4 +57,3 @@ class User extends base_model_1.BaseModel {
57
57
  }
58
58
  }
59
59
  exports.User = User;
60
- //# sourceMappingURL=user.model.js.map
package/dist/notion.d.ts CHANGED
@@ -54,4 +54,3 @@ export declare class Notion {
54
54
  readonly fileUploads: FileUploadsAPI;
55
55
  constructor(options: NotionClientOptions);
56
56
  }
57
- //# sourceMappingURL=notion.d.ts.map
package/dist/notion.js CHANGED
@@ -51,4 +51,3 @@ class Notion {
51
51
  }
52
52
  }
53
53
  exports.Notion = Notion;
54
- //# sourceMappingURL=notion.js.map