@visus-io/notion-sdk-ts 3.1.1 → 3.2.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.
Files changed (50) hide show
  1. package/README.md +3 -3
  2. package/dist/api/blocks.api.d.ts +1083 -224
  3. package/dist/api/blocks.api.js +4 -0
  4. package/dist/api/comments.api.d.ts +19 -1
  5. package/dist/api/comments.api.js +1 -1
  6. package/dist/api/dataSources.api.d.ts +41 -0
  7. package/dist/api/databases.api.d.ts +52 -5
  8. package/dist/api/databases.api.js +5 -3
  9. package/dist/api/fileUploads.api.d.ts +17 -7
  10. package/dist/api/fileUploads.api.js +30 -16
  11. package/dist/api/pages.api.d.ts +49 -0
  12. package/dist/client.d.ts +33 -2
  13. package/dist/client.js +88 -21
  14. package/dist/errors.d.ts +7 -0
  15. package/dist/errors.js +7 -0
  16. package/dist/helpers/filter.helpers.d.ts +11 -4
  17. package/dist/helpers/filter.helpers.js +73 -30
  18. package/dist/helpers/pagination.helpers.d.ts +7 -2
  19. package/dist/helpers/pagination.helpers.js +26 -5
  20. package/dist/models/dataSource.model.d.ts +6 -1
  21. package/dist/models/dataSource.model.js +7 -0
  22. package/dist/models/database.model.d.ts +5 -1
  23. package/dist/models/database.model.js +6 -0
  24. package/dist/models/page.model.d.ts +20 -1
  25. package/dist/models/page.model.js +33 -2
  26. package/dist/models/user.model.d.ts +5 -0
  27. package/dist/models/user.model.js +10 -0
  28. package/dist/schemas/block.schema.d.ts +1082 -224
  29. package/dist/schemas/block.schema.js +40 -25
  30. package/dist/schemas/comment.schema.d.ts +18 -0
  31. package/dist/schemas/dataSource.schema.d.ts +41 -0
  32. package/dist/schemas/dataSource.schema.js +3 -0
  33. package/dist/schemas/database.schema.d.ts +54 -0
  34. package/dist/schemas/database.schema.js +11 -1
  35. package/dist/schemas/meetingNotesQuery.schema.d.ts +1082 -224
  36. package/dist/schemas/page.schema.d.ts +49 -0
  37. package/dist/schemas/page.schema.js +2 -1
  38. package/dist/schemas/pageMarkdown.schema.js +1 -1
  39. package/dist/schemas/pageProperties.schema.d.ts +105 -1
  40. package/dist/schemas/pageProperties.schema.js +17 -1
  41. package/dist/schemas/pagination.schema.d.ts +1 -1
  42. package/dist/schemas/propertyObjects.schema.js +2 -1
  43. package/dist/schemas/richText.schema.d.ts +36 -0
  44. package/dist/schemas/richText.schema.js +21 -0
  45. package/dist/schemas/shared.schema.d.ts +3 -7
  46. package/dist/schemas/shared.schema.js +5 -9
  47. package/dist/schemas/view.schema.d.ts +49 -0
  48. package/dist/validation.d.ts +8 -0
  49. package/dist/validation.js +16 -0
  50. package/package.json +16 -15
@@ -62,10 +62,20 @@ class Page extends base_model_1.BaseModel {
62
62
  return null;
63
63
  }
64
64
  /**
65
- * Check if the page is a child of a database.
65
+ * Check if the page is a row in a database.
66
+ *
67
+ * On API version 2025-09-03 and later, a database row has a `data_source_id`
68
+ * parent. Older responses use a `database_id` parent. This method returns `true`
69
+ * for both.
66
70
  */
67
71
  isInDatabase() {
68
- return this.data.parent.type === 'database_id';
72
+ return this.data.parent.type === 'data_source_id' || this.data.parent.type === 'database_id';
73
+ }
74
+ /**
75
+ * Check if the page is a row in a data source.
76
+ */
77
+ isInDataSource() {
78
+ return this.data.parent.type === 'data_source_id';
69
79
  }
70
80
  /**
71
81
  * Check if the page is a child of another page.
@@ -73,5 +83,26 @@ class Page extends base_model_1.BaseModel {
73
83
  isSubpage() {
74
84
  return this.data.parent.type === 'page_id';
75
85
  }
86
+ /**
87
+ * Get the parent data source ID.
88
+ * Return `null` when the parent is not a data source.
89
+ */
90
+ getParentDataSourceId() {
91
+ return this.data.parent.type === 'data_source_id' ? this.data.parent.data_source_id : null;
92
+ }
93
+ /**
94
+ * Get the parent database ID.
95
+ * A `data_source_id` parent also carries its database ID. Return `null` when the
96
+ * parent is neither a database nor a data source.
97
+ */
98
+ getParentDatabaseId() {
99
+ if (this.data.parent.type === 'database_id') {
100
+ return this.data.parent.database_id;
101
+ }
102
+ if (this.data.parent.type === 'data_source_id') {
103
+ return this.data.parent.database_id;
104
+ }
105
+ return null;
106
+ }
76
107
  }
77
108
  exports.Page = Page;
@@ -28,6 +28,11 @@ export declare class User extends BaseModel<NotionUser> {
28
28
  * Get email if this is a person user.
29
29
  */
30
30
  getEmail(): string | undefined;
31
+ /**
32
+ * Get the person's email verification status.
33
+ * Returns `undefined` when the user is not a person.
34
+ */
35
+ getEmailVerified(): boolean | undefined;
31
36
  /**
32
37
  * Get bot information if this is a bot user.
33
38
  */
@@ -48,6 +48,16 @@ class User extends base_model_1.BaseModel {
48
48
  }
49
49
  return undefined;
50
50
  }
51
+ /**
52
+ * Get the person's email verification status.
53
+ * Returns `undefined` when the user is not a person.
54
+ */
55
+ getEmailVerified() {
56
+ if (this.isPerson()) {
57
+ return this.data.person.email_verified;
58
+ }
59
+ return undefined;
60
+ }
51
61
  /**
52
62
  * Get bot information if this is a bot user.
53
63
  */