@visus-io/notion-sdk-ts 3.0.2 → 3.1.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 (130) hide show
  1. package/README.md +20 -87
  2. package/dist/api/asyncTasks.api.d.ts +72 -0
  3. package/dist/api/asyncTasks.api.js +70 -0
  4. package/dist/api/base.api.d.ts +15 -4
  5. package/dist/api/base.api.js +20 -8
  6. package/dist/api/blocks.api.d.ts +435 -73
  7. package/dist/api/blocks.api.js +43 -1
  8. package/dist/api/comments.api.d.ts +42 -5
  9. package/dist/api/comments.api.js +45 -1
  10. package/dist/api/customEmojis.api.d.ts +38 -0
  11. package/dist/api/customEmojis.api.js +38 -0
  12. package/dist/api/dataSources.api.d.ts +67 -14
  13. package/dist/api/dataSources.api.js +26 -1
  14. package/dist/api/databases.api.d.ts +47 -11
  15. package/dist/api/databases.api.js +4 -1
  16. package/dist/api/fileUploads.api.d.ts +8 -5
  17. package/dist/api/fileUploads.api.js +11 -7
  18. package/dist/api/index.d.ts +3 -0
  19. package/dist/api/index.js +7 -1
  20. package/dist/api/pages.api.d.ts +144 -10
  21. package/dist/api/pages.api.js +66 -0
  22. package/dist/api/search.api.d.ts +12 -2
  23. package/dist/api/search.api.js +5 -2
  24. package/dist/api/users.api.d.ts +3 -0
  25. package/dist/api/users.api.js +2 -0
  26. package/dist/api/views.api.d.ts +286 -0
  27. package/dist/api/views.api.js +172 -0
  28. package/dist/client.d.ts +17 -17
  29. package/dist/client.js +25 -30
  30. package/dist/errors.d.ts +19 -5
  31. package/dist/errors.js +16 -4
  32. package/dist/helpers/block.helpers.d.ts +49 -5
  33. package/dist/helpers/block.helpers.js +50 -6
  34. package/dist/helpers/file.helpers.d.ts +46 -5
  35. package/dist/helpers/file.helpers.js +36 -8
  36. package/dist/helpers/filter.helpers.d.ts +8 -6
  37. package/dist/helpers/filter.helpers.js +2 -0
  38. package/dist/helpers/index.d.ts +3 -2
  39. package/dist/helpers/index.js +5 -1
  40. package/dist/helpers/pagination.helpers.d.ts +85 -13
  41. package/dist/helpers/pagination.helpers.js +114 -8
  42. package/dist/helpers/parent.helpers.d.ts +5 -3
  43. package/dist/helpers/parent.helpers.js +5 -3
  44. package/dist/helpers/property.helpers.d.ts +31 -0
  45. package/dist/helpers/property.helpers.js +30 -1
  46. package/dist/helpers/richText.helpers.d.ts +10 -5
  47. package/dist/helpers/richText.helpers.js +11 -6
  48. package/dist/helpers/sort.helpers.d.ts +2 -0
  49. package/dist/helpers/sort.helpers.js +2 -0
  50. package/dist/helpers/webhook.helpers.d.ts +54 -0
  51. package/dist/helpers/webhook.helpers.js +83 -0
  52. package/dist/models/asyncTask.model.d.ts +61 -0
  53. package/dist/models/asyncTask.model.js +91 -0
  54. package/dist/models/base.model.d.ts +16 -4
  55. package/dist/models/base.model.js +17 -5
  56. package/dist/models/block.model.d.ts +6 -2
  57. package/dist/models/block.model.js +48 -33
  58. package/dist/models/comment.model.d.ts +4 -2
  59. package/dist/models/comment.model.js +4 -2
  60. package/dist/models/customEmoji.model.d.ts +30 -0
  61. package/dist/models/customEmoji.model.js +44 -0
  62. package/dist/models/dataSource.model.d.ts +7 -5
  63. package/dist/models/dataSource.model.js +5 -3
  64. package/dist/models/database.model.d.ts +13 -5
  65. package/dist/models/database.model.js +15 -5
  66. package/dist/models/fileUpload.model.d.ts +6 -4
  67. package/dist/models/fileUpload.model.js +6 -4
  68. package/dist/models/index.d.ts +3 -0
  69. package/dist/models/index.js +7 -1
  70. package/dist/models/page.model.d.ts +8 -2
  71. package/dist/models/page.model.js +14 -4
  72. package/dist/models/richText.model.d.ts +3 -1
  73. package/dist/models/richText.model.js +3 -1
  74. package/dist/models/user.model.d.ts +4 -2
  75. package/dist/models/user.model.js +4 -2
  76. package/dist/models/view.model.d.ts +81 -0
  77. package/dist/models/view.model.js +121 -0
  78. package/dist/notion.d.ts +32 -8
  79. package/dist/notion.js +25 -4
  80. package/dist/schemas/asyncTask.schema.d.ts +53 -0
  81. package/dist/schemas/asyncTask.schema.js +88 -0
  82. package/dist/schemas/block.schema.d.ts +390 -73
  83. package/dist/schemas/block.schema.js +39 -8
  84. package/dist/schemas/codeLanguages.d.ts +7 -1
  85. package/dist/schemas/codeLanguages.js +4 -1
  86. package/dist/schemas/colors.d.ts +7 -1
  87. package/dist/schemas/colors.js +4 -1
  88. package/dist/schemas/comment.schema.d.ts +28 -5
  89. package/dist/schemas/comment.schema.js +11 -2
  90. package/dist/schemas/customEmoji.schema.d.ts +18 -0
  91. package/dist/schemas/customEmoji.schema.js +50 -0
  92. package/dist/schemas/dataSource.schema.d.ts +84 -10
  93. package/dist/schemas/dataSource.schema.js +31 -6
  94. package/dist/schemas/database.schema.d.ts +51 -7
  95. package/dist/schemas/database.schema.js +10 -3
  96. package/dist/schemas/emoji.schema.d.ts +7 -2
  97. package/dist/schemas/emoji.schema.js +4 -2
  98. package/dist/schemas/file.schema.d.ts +18 -2
  99. package/dist/schemas/file.schema.js +6 -2
  100. package/dist/schemas/fileUpload.schema.d.ts +9 -3
  101. package/dist/schemas/fileUpload.schema.js +5 -2
  102. package/dist/schemas/icon.schema.d.ts +116 -0
  103. package/dist/schemas/icon.schema.js +100 -0
  104. package/dist/schemas/index.d.ts +6 -0
  105. package/dist/schemas/index.js +6 -0
  106. package/dist/schemas/meetingNotesQuery.schema.d.ts +4198 -0
  107. package/dist/schemas/meetingNotesQuery.schema.js +67 -0
  108. package/dist/schemas/page.schema.d.ts +51 -9
  109. package/dist/schemas/page.schema.js +6 -2
  110. package/dist/schemas/pageMarkdown.schema.d.ts +70 -0
  111. package/dist/schemas/pageMarkdown.schema.js +70 -0
  112. package/dist/schemas/pageProperties.schema.d.ts +105 -21
  113. package/dist/schemas/pageProperties.schema.js +8 -6
  114. package/dist/schemas/pagination.schema.d.ts +57 -7
  115. package/dist/schemas/pagination.schema.js +25 -1
  116. package/dist/schemas/parent.schema.d.ts +39 -3
  117. package/dist/schemas/parent.schema.js +17 -5
  118. package/dist/schemas/propertyObjects.schema.d.ts +93 -15
  119. package/dist/schemas/propertyObjects.schema.js +11 -5
  120. package/dist/schemas/richText.schema.d.ts +23 -6
  121. package/dist/schemas/richText.schema.js +7 -4
  122. package/dist/schemas/shared.schema.d.ts +6 -3
  123. package/dist/schemas/shared.schema.js +6 -3
  124. package/dist/schemas/user.schema.d.ts +17 -0
  125. package/dist/schemas/user.schema.js +7 -3
  126. package/dist/schemas/view.schema.d.ts +1111 -0
  127. package/dist/schemas/view.schema.js +134 -0
  128. package/dist/validation.d.ts +11 -4
  129. package/dist/validation.js +11 -4
  130. package/package.json +6 -3
package/dist/errors.d.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  /**
2
2
  * Notion API error codes based on official documentation.
3
+ *
4
+ * @category Errors
3
5
  */
4
- export type NotionErrorCode = 'invalid_json' | 'invalid_request_url' | 'invalid_request' | 'validation_error' | 'missing_version' | 'unauthorized' | 'restricted_resource' | 'object_not_found' | 'conflict_error' | 'rate_limited' | 'internal_server_error' | 'service_unavailable' | 'database_connection_unavailable' | 'gateway_timeout';
6
+ export type NotionErrorCode = 'invalid_json' | 'invalid_request_url' | 'invalid_request' | 'validation_error' | 'missing_version' | 'unauthorized' | 'restricted_resource' | 'object_not_found' | 'conflict_error' | 'rate_limited' | 'internal_server_error' | 'service_unavailable' | 'service_overload' | 'database_connection_unavailable' | 'gateway_timeout';
5
7
  /**
6
8
  * Notion API error response structure.
9
+ *
10
+ * @category Errors
7
11
  */
8
12
  export interface NotionErrorResponse {
9
13
  object: 'error';
@@ -12,7 +16,9 @@ export interface NotionErrorResponse {
12
16
  message: string;
13
17
  }
14
18
  /**
15
- * Custom error class for Notion API errors.
19
+ * Thrown when the Notion API returns an error response.
20
+ *
21
+ * @category Errors
16
22
  */
17
23
  export declare class NotionAPIError extends Error {
18
24
  readonly status: number;
@@ -24,12 +30,16 @@ export declare class NotionAPIError extends Error {
24
30
  * Check if the error is a rate limit error.
25
31
  */
26
32
  isRateLimited(): boolean;
33
+ /**
34
+ * Check if the error is a service overload error (HTTP 529).
35
+ */
36
+ isServiceOverloaded(): boolean;
27
37
  /**
28
38
  * Check if the error is an authentication error.
29
39
  */
30
40
  isUnauthorized(): boolean;
31
41
  /**
32
- * Check if the error is a not found error.
42
+ * Check if the API could not find the requested object.
33
43
  */
34
44
  isNotFound(): boolean;
35
45
  /**
@@ -46,13 +56,17 @@ export declare class NotionAPIError extends Error {
46
56
  isRetryable(): boolean;
47
57
  }
48
58
  /**
49
- * Request timeout error.
59
+ * Thrown when a request exceeds its timeout.
60
+ *
61
+ * @category Errors
50
62
  */
51
63
  export declare class NotionRequestTimeoutError extends Error {
52
64
  constructor(message?: string);
53
65
  }
54
66
  /**
55
- * Network error (connectivity issues, DNS failure, etc.).
67
+ * Thrown when a network problem, such as a DNS failure, blocks a request.
68
+ *
69
+ * @category Errors
56
70
  */
57
71
  export declare class NotionNetworkError extends Error {
58
72
  readonly cause?: Error;
package/dist/errors.js CHANGED
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotionNetworkError = exports.NotionRequestTimeoutError = exports.NotionAPIError = void 0;
4
4
  /**
5
- * Custom error class for Notion API errors.
5
+ * Thrown when the Notion API returns an error response.
6
+ *
7
+ * @category Errors
6
8
  */
7
9
  class NotionAPIError extends Error {
8
10
  constructor(response, retryAfterMs) {
@@ -23,6 +25,12 @@ class NotionAPIError extends Error {
23
25
  isRateLimited() {
24
26
  return this.code === 'rate_limited';
25
27
  }
28
+ /**
29
+ * Check if the error is a service overload error (HTTP 529).
30
+ */
31
+ isServiceOverloaded() {
32
+ return this.code === 'service_overload';
33
+ }
26
34
  /**
27
35
  * Check if the error is an authentication error.
28
36
  */
@@ -30,7 +38,7 @@ class NotionAPIError extends Error {
30
38
  return this.code === 'unauthorized';
31
39
  }
32
40
  /**
33
- * Check if the error is a not found error.
41
+ * Check if the API could not find the requested object.
34
42
  */
35
43
  isNotFound() {
36
44
  return this.code === 'object_not_found';
@@ -56,7 +64,9 @@ class NotionAPIError extends Error {
56
64
  }
57
65
  exports.NotionAPIError = NotionAPIError;
58
66
  /**
59
- * Request timeout error.
67
+ * Thrown when a request exceeds its timeout.
68
+ *
69
+ * @category Errors
60
70
  */
61
71
  class NotionRequestTimeoutError extends Error {
62
72
  constructor(message = 'Request timed out') {
@@ -69,7 +79,9 @@ class NotionRequestTimeoutError extends Error {
69
79
  }
70
80
  exports.NotionRequestTimeoutError = NotionRequestTimeoutError;
71
81
  /**
72
- * Network error (connectivity issues, DNS failure, etc.).
82
+ * Thrown when a network problem, such as a DNS failure, blocks a request.
83
+ *
84
+ * @category Errors
73
85
  */
74
86
  class NotionNetworkError extends Error {
75
87
  constructor(message, cause) {
@@ -2,7 +2,9 @@ import type { CodeBlockLanguage, NotionColor, NotionRichText } from '../schemas'
2
2
  import { RichTextBuilder } from './richText.helpers';
3
3
  /**
4
4
  * Accepted rich text input: a plain string, a {@link RichTextBuilder}, or
5
- * a pre-built `NotionRichText` array.
5
+ * a pre-built `NotionRichText`.
6
+ *
7
+ * @category Rich Text
6
8
  */
7
9
  export type RichTextInput = string | RichTextBuilder | NotionRichText;
8
10
  /** Common options shared by text-bearing blocks. */
@@ -10,12 +12,17 @@ interface TextBlockOptions {
10
12
  color?: NotionColor;
11
13
  children?: unknown[];
12
14
  }
13
- /** The minimal block object accepted by the Notion API for creation. */
15
+ /** The Notion API accepts this minimal block object for creation. */
14
16
  interface BlockObject {
15
17
  object: 'block';
16
18
  type: string;
17
19
  [key: string]: unknown;
18
20
  }
21
+ /** Options for paragraph blocks. */
22
+ interface ParagraphOptions extends TextBlockOptions {
23
+ /** Icon for the paragraph. Applies only to paragraphs used as tab items. */
24
+ icon?: unknown;
25
+ }
19
26
  /**
20
27
  * Create a paragraph block.
21
28
  *
@@ -25,7 +32,7 @@ interface BlockObject {
25
32
  * block.paragraph(richText('Hello').bold(), { color: 'blue' })
26
33
  * ```
27
34
  */
28
- declare function paragraph(text: RichTextInput, options?: TextBlockOptions): BlockObject;
35
+ declare function paragraph(text: RichTextInput, options?: ParagraphOptions): BlockObject;
29
36
  /** Options for heading blocks. */
30
37
  interface HeadingOptions {
31
38
  color?: NotionColor;
@@ -35,6 +42,7 @@ interface HeadingOptions {
35
42
  declare function heading1(text: RichTextInput, options?: HeadingOptions): BlockObject;
36
43
  declare function heading2(text: RichTextInput, options?: HeadingOptions): BlockObject;
37
44
  declare function heading3(text: RichTextInput, options?: HeadingOptions): BlockObject;
45
+ declare function heading4(text: RichTextInput, options?: HeadingOptions): BlockObject;
38
46
  declare function bulletedListItem(text: RichTextInput, options?: TextBlockOptions): BlockObject;
39
47
  /** Options for numbered list items. */
40
48
  interface NumberedListOptions extends TextBlockOptions {
@@ -65,6 +73,14 @@ declare function callout(text: RichTextInput, options?: CalloutOptions): BlockOb
65
73
  declare function template(text: RichTextInput, options?: {
66
74
  children?: unknown[];
67
75
  }): BlockObject;
76
+ /**
77
+ * @deprecated Notion manages meeting-notes blocks on the server. Notion populates the
78
+ * real shape (`title`, `status`, and child block IDs for the summary, notes, and
79
+ * transcript). Clients do not construct this shape by hand. This helper's
80
+ * `rich_text`-based output no longer matches the `meeting_notes` shape in
81
+ * `blockSchema`. Do not use this helper to create a meeting-notes block. It remains
82
+ * only to avoid an abrupt removal from the helper surface. Do not use it in new code.
83
+ */
68
84
  declare function meetingNotes(text: RichTextInput, options?: {
69
85
  children?: unknown[];
70
86
  }): BlockObject;
@@ -115,6 +131,30 @@ declare function table(width: number, options?: TableOptions): BlockObject;
115
131
  declare function tableRow(cells: RichTextInput[]): BlockObject;
116
132
  declare function columnList(columns: unknown[][]): BlockObject;
117
133
  declare function column(children: unknown[]): BlockObject;
134
+ /**
135
+ * A single tab. Its label becomes the tab's paragraph rich text.
136
+ * Its `children` become the tab's content.
137
+ */
138
+ interface TabItem {
139
+ label: RichTextInput;
140
+ icon?: unknown;
141
+ color?: NotionColor;
142
+ children?: unknown[];
143
+ }
144
+ /**
145
+ * Create a tab block. A tab block accepts only `paragraph` blocks as direct children.
146
+ * Each tab is one paragraph. The paragraph's rich text holds the tab label. The
147
+ * paragraph's `children` hold the tab's content.
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * block.tab([
152
+ * { label: 'Overview', children: [block.paragraph('Intro text')] },
153
+ * { label: 'Details', icon: icon.emoji('📋'), children: [block.paragraph('More info')] },
154
+ * ])
155
+ * ```
156
+ */
157
+ declare function tab(tabs: TabItem[]): BlockObject;
118
158
  /**
119
159
  * Create a synced block.
120
160
  *
@@ -126,9 +166,9 @@ declare function syncedBlock(options?: {
126
166
  children?: unknown[];
127
167
  }): BlockObject;
128
168
  /**
129
- * Factory functions for constructing Notion block objects.
169
+ * Factory functions that create Notion block objects.
130
170
  *
131
- * Every function returns a plain object ready to pass to
171
+ * Every function returns a plain object. Pass this object to
132
172
  * `blocks.children.append()` or `pages.create()`.
133
173
  *
134
174
  * @example
@@ -154,12 +194,15 @@ declare function syncedBlock(options?: {
154
194
  * }),
155
195
  * ];
156
196
  * ```
197
+ *
198
+ * @category Helpers
157
199
  */
158
200
  export declare const block: {
159
201
  paragraph: typeof paragraph;
160
202
  heading1: typeof heading1;
161
203
  heading2: typeof heading2;
162
204
  heading3: typeof heading3;
205
+ heading4: typeof heading4;
163
206
  bulletedListItem: typeof bulletedListItem;
164
207
  numberedListItem: typeof numberedListItem;
165
208
  toDo: typeof toDo;
@@ -185,6 +228,7 @@ export declare const block: {
185
228
  tableRow: typeof tableRow;
186
229
  columnList: typeof columnList;
187
230
  column: typeof column;
231
+ tab: typeof tab;
188
232
  syncedBlock: typeof syncedBlock;
189
233
  };
190
234
  export {};
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.block = void 0;
4
4
  const validation_1 = require("../validation");
5
5
  const richText_helpers_1 = require("./richText.helpers");
6
- /** Resolve a {@link RichTextInput} into a `NotionRichText` array. */
6
+ /** Resolve a {@link RichTextInput} into a `NotionRichText`. */
7
7
  function resolveRichText(input) {
8
8
  if (typeof input === 'string') {
9
9
  (0, validation_1.validateStringLength)(input, validation_1.LIMITS.RICH_TEXT_CONTENT, 'Rich text content');
@@ -29,9 +29,6 @@ function resolveRichText(input) {
29
29
  }
30
30
  return input;
31
31
  }
32
- // ---------------------------------------------------------------------------
33
- // Text blocks
34
- // ---------------------------------------------------------------------------
35
32
  /**
36
33
  * Create a paragraph block.
37
34
  *
@@ -48,6 +45,7 @@ function paragraph(text, options) {
48
45
  paragraph: {
49
46
  rich_text: resolveRichText(text),
50
47
  color: options?.color ?? 'default',
48
+ ...(options?.icon ? { icon: options.icon } : {}),
51
49
  ...(options?.children ? { children: options.children } : {}),
52
50
  },
53
51
  };
@@ -88,6 +86,18 @@ function heading3(text, options) {
88
86
  },
89
87
  };
90
88
  }
89
+ function heading4(text, options) {
90
+ return {
91
+ object: 'block',
92
+ type: 'heading_4',
93
+ heading_4: {
94
+ rich_text: resolveRichText(text),
95
+ color: options?.color ?? 'default',
96
+ is_toggleable: options?.isToggleable ?? false,
97
+ ...(options?.children ? { children: options.children } : {}),
98
+ },
99
+ };
100
+ }
91
101
  function bulletedListItem(text, options) {
92
102
  return {
93
103
  object: 'block',
@@ -170,6 +180,14 @@ function template(text, options) {
170
180
  },
171
181
  };
172
182
  }
183
+ /**
184
+ * @deprecated Notion manages meeting-notes blocks on the server. Notion populates the
185
+ * real shape (`title`, `status`, and child block IDs for the summary, notes, and
186
+ * transcript). Clients do not construct this shape by hand. This helper's
187
+ * `rich_text`-based output no longer matches the `meeting_notes` shape in
188
+ * `blockSchema`. Do not use this helper to create a meeting-notes block. It remains
189
+ * only to avoid an abrupt removal from the helper surface. Do not use it in new code.
190
+ */
173
191
  function meetingNotes(text, options) {
174
192
  return {
175
193
  object: 'block',
@@ -348,6 +366,28 @@ function column(children) {
348
366
  column: { children },
349
367
  };
350
368
  }
369
+ /**
370
+ * Create a tab block. A tab block accepts only `paragraph` blocks as direct children.
371
+ * Each tab is one paragraph. The paragraph's rich text holds the tab label. The
372
+ * paragraph's `children` hold the tab's content.
373
+ *
374
+ * @example
375
+ * ```ts
376
+ * block.tab([
377
+ * { label: 'Overview', children: [block.paragraph('Intro text')] },
378
+ * { label: 'Details', icon: icon.emoji('📋'), children: [block.paragraph('More info')] },
379
+ * ])
380
+ * ```
381
+ */
382
+ function tab(tabs) {
383
+ return {
384
+ object: 'block',
385
+ type: 'tab',
386
+ tab: {
387
+ children: tabs.map((item) => paragraph(item.label, { color: item.color, icon: item.icon, children: item.children })),
388
+ },
389
+ };
390
+ }
351
391
  // ---------------------------------------------------------------------------
352
392
  // Synced blocks
353
393
  // ---------------------------------------------------------------------------
@@ -371,9 +411,9 @@ function syncedBlock(options) {
371
411
  // Public export
372
412
  // ---------------------------------------------------------------------------
373
413
  /**
374
- * Factory functions for constructing Notion block objects.
414
+ * Factory functions that create Notion block objects.
375
415
  *
376
- * Every function returns a plain object ready to pass to
416
+ * Every function returns a plain object. Pass this object to
377
417
  * `blocks.children.append()` or `pages.create()`.
378
418
  *
379
419
  * @example
@@ -399,6 +439,8 @@ function syncedBlock(options) {
399
439
  * }),
400
440
  * ];
401
441
  * ```
442
+ *
443
+ * @category Helpers
402
444
  */
403
445
  exports.block = {
404
446
  // Text blocks
@@ -406,6 +448,7 @@ exports.block = {
406
448
  heading1,
407
449
  heading2,
408
450
  heading3,
451
+ heading4,
409
452
  bulletedListItem,
410
453
  numberedListItem,
411
454
  toDo,
@@ -435,6 +478,7 @@ exports.block = {
435
478
  tableRow,
436
479
  columnList,
437
480
  column,
481
+ tab,
438
482
  // Synced
439
483
  syncedBlock,
440
484
  };
@@ -1,3 +1,4 @@
1
+ import type { NativeIconColor } from '../schemas/icon.schema';
1
2
  interface EmojiIcon {
2
3
  type: 'emoji';
3
4
  emoji: string;
@@ -14,6 +15,19 @@ interface FileUploadRef {
14
15
  id: string;
15
16
  };
16
17
  }
18
+ interface NativeIconRef {
19
+ type: 'icon';
20
+ icon: {
21
+ name: string;
22
+ color?: NativeIconColor;
23
+ };
24
+ }
25
+ interface CustomEmojiIconRef {
26
+ type: 'custom_emoji';
27
+ custom_emoji: {
28
+ id: string;
29
+ };
30
+ }
17
31
  /**
18
32
  * Create an emoji icon object.
19
33
  *
@@ -42,7 +56,26 @@ declare function externalIcon(url: string): ExternalRef;
42
56
  */
43
57
  declare function fileUploadIcon(id: string): FileUploadRef;
44
58
  /**
45
- * Helpers for constructing icon objects (emoji, external URL, or file upload).
59
+ * Create a native (icon-picker) icon object.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * icon.native('star circle', 'blue')
64
+ * ```
65
+ */
66
+ declare function nativeIcon(name: string, color?: NativeIconColor): NativeIconRef;
67
+ /**
68
+ * Create a custom emoji icon object, referencing a workspace custom emoji by id.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * icon.customEmoji('emoji-id')
73
+ * ```
74
+ */
75
+ declare function customEmojiIcon(id: string): CustomEmojiIconRef;
76
+ /**
77
+ * Helpers that create icon objects: emoji, external URL, file upload, native
78
+ * icon, or custom emoji.
46
79
  *
47
80
  * @example
48
81
  * ```ts
@@ -54,11 +87,15 @@ declare function fileUploadIcon(id: string): FileUploadRef;
54
87
  * // ...
55
88
  * });
56
89
  * ```
90
+ *
91
+ * @category Helpers
57
92
  */
58
93
  export declare const icon: {
59
94
  emoji: typeof emojiIcon;
60
95
  external: typeof externalIcon;
61
96
  fileUpload: typeof fileUploadIcon;
97
+ native: typeof nativeIcon;
98
+ customEmoji: typeof customEmojiIcon;
62
99
  };
63
100
  /**
64
101
  * Create an external cover image object.
@@ -79,7 +116,7 @@ declare function externalCover(url: string): ExternalRef;
79
116
  */
80
117
  declare function fileUploadCover(id: string): FileUploadRef;
81
118
  /**
82
- * Helpers for constructing cover image objects.
119
+ * Helpers that create cover image objects.
83
120
  *
84
121
  * @example
85
122
  * ```ts
@@ -91,6 +128,8 @@ declare function fileUploadCover(id: string): FileUploadRef;
91
128
  * // ...
92
129
  * });
93
130
  * ```
131
+ *
132
+ * @category Helpers
94
133
  */
95
134
  export declare const cover: {
96
135
  external: typeof externalCover;
@@ -115,10 +154,10 @@ declare function externalFile(url: string): ExternalRef;
115
154
  */
116
155
  declare function uploadFile(id: string): FileUploadRef;
117
156
  /**
118
- * Helpers for constructing general Notion file objects.
157
+ * Helpers that create general Notion file objects.
119
158
  *
120
- * Useful for file blocks, image blocks, audio blocks, video blocks,
121
- * and file property entries.
159
+ * Use these helpers for file blocks, image blocks, audio blocks, video
160
+ * blocks, and file property entries.
122
161
  *
123
162
  * @example
124
163
  * ```ts
@@ -127,6 +166,8 @@ declare function uploadFile(id: string): FileUploadRef;
127
166
  * notionFile.external('https://example.com/doc.pdf')
128
167
  * notionFile.upload('upload-id')
129
168
  * ```
169
+ *
170
+ * @category Helpers
130
171
  */
131
172
  export declare const notionFile: {
132
173
  external: typeof externalFile;
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- // ---------------------------------------------------------------------------
3
- // Return types
4
- // ---------------------------------------------------------------------------
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.notionFile = exports.cover = exports.icon = void 0;
7
4
  // ---------------------------------------------------------------------------
@@ -41,7 +38,30 @@ function fileUploadIcon(id) {
41
38
  return { type: 'file_upload', file_upload: { id } };
42
39
  }
43
40
  /**
44
- * Helpers for constructing icon objects (emoji, external URL, or file upload).
41
+ * Create a native (icon-picker) icon object.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * icon.native('star circle', 'blue')
46
+ * ```
47
+ */
48
+ function nativeIcon(name, color) {
49
+ return { type: 'icon', icon: { name, ...(color ? { color } : {}) } };
50
+ }
51
+ /**
52
+ * Create a custom emoji icon object, referencing a workspace custom emoji by id.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * icon.customEmoji('emoji-id')
57
+ * ```
58
+ */
59
+ function customEmojiIcon(id) {
60
+ return { type: 'custom_emoji', custom_emoji: { id } };
61
+ }
62
+ /**
63
+ * Helpers that create icon objects: emoji, external URL, file upload, native
64
+ * icon, or custom emoji.
45
65
  *
46
66
  * @example
47
67
  * ```ts
@@ -53,11 +73,15 @@ function fileUploadIcon(id) {
53
73
  * // ...
54
74
  * });
55
75
  * ```
76
+ *
77
+ * @category Helpers
56
78
  */
57
79
  exports.icon = {
58
80
  emoji: emojiIcon,
59
81
  external: externalIcon,
60
82
  fileUpload: fileUploadIcon,
83
+ native: nativeIcon,
84
+ customEmoji: customEmojiIcon,
61
85
  };
62
86
  // ---------------------------------------------------------------------------
63
87
  // Cover helpers
@@ -85,7 +109,7 @@ function fileUploadCover(id) {
85
109
  return { type: 'file_upload', file_upload: { id } };
86
110
  }
87
111
  /**
88
- * Helpers for constructing cover image objects.
112
+ * Helpers that create cover image objects.
89
113
  *
90
114
  * @example
91
115
  * ```ts
@@ -97,6 +121,8 @@ function fileUploadCover(id) {
97
121
  * // ...
98
122
  * });
99
123
  * ```
124
+ *
125
+ * @category Helpers
100
126
  */
101
127
  exports.cover = {
102
128
  external: externalCover,
@@ -128,10 +154,10 @@ function uploadFile(id) {
128
154
  return { type: 'file_upload', file_upload: { id } };
129
155
  }
130
156
  /**
131
- * Helpers for constructing general Notion file objects.
157
+ * Helpers that create general Notion file objects.
132
158
  *
133
- * Useful for file blocks, image blocks, audio blocks, video blocks,
134
- * and file property entries.
159
+ * Use these helpers for file blocks, image blocks, audio blocks, video
160
+ * blocks, and file property entries.
135
161
  *
136
162
  * @example
137
163
  * ```ts
@@ -140,6 +166,8 @@ function uploadFile(id) {
140
166
  * notionFile.external('https://example.com/doc.pdf')
141
167
  * notionFile.upload('upload-id')
142
168
  * ```
169
+ *
170
+ * @category Helpers
143
171
  */
144
172
  exports.notionFile = {
145
173
  external: externalFile,
@@ -38,8 +38,8 @@ declare class CheckboxFilter {
38
38
  declare class SelectFilter {
39
39
  private readonly property;
40
40
  constructor(property: string);
41
- equals(value: string): FilterCondition;
42
- doesNotEqual(value: string): FilterCondition;
41
+ equals(value: string | string[]): FilterCondition;
42
+ doesNotEqual(value: string | string[]): FilterCondition;
43
43
  isEmpty(): FilterCondition;
44
44
  isNotEmpty(): FilterCondition;
45
45
  }
@@ -47,8 +47,8 @@ declare class SelectFilter {
47
47
  declare class MultiSelectFilter {
48
48
  private readonly property;
49
49
  constructor(property: string);
50
- contains(value: string): FilterCondition;
51
- doesNotContain(value: string): FilterCondition;
50
+ contains(value: string | string[]): FilterCondition;
51
+ doesNotContain(value: string | string[]): FilterCondition;
52
52
  isEmpty(): FilterCondition;
53
53
  isNotEmpty(): FilterCondition;
54
54
  }
@@ -56,8 +56,8 @@ declare class MultiSelectFilter {
56
56
  declare class StatusFilter {
57
57
  private readonly property;
58
58
  constructor(property: string);
59
- equals(value: string): FilterCondition;
60
- doesNotEqual(value: string): FilterCondition;
59
+ equals(value: string | string[]): FilterCondition;
60
+ doesNotEqual(value: string | string[]): FilterCondition;
61
61
  isEmpty(): FilterCondition;
62
62
  isNotEmpty(): FilterCondition;
63
63
  }
@@ -157,6 +157,8 @@ declare function or(...conditions: FilterCondition[]): FilterCondition;
157
157
  * ),
158
158
  * });
159
159
  * ```
160
+ *
161
+ * @category Helpers
160
162
  */
161
163
  export declare const filter: {
162
164
  text: (property: string) => TextFilter;
@@ -305,6 +305,8 @@ function or(...conditions) {
305
305
  * ),
306
306
  * });
307
307
  * ```
308
+ *
309
+ * @category Helpers
308
310
  */
309
311
  exports.filter = {
310
312
  // Property filters
@@ -2,9 +2,10 @@ export { block } from './block.helpers';
2
2
  export type { RichTextInput } from './block.helpers';
3
3
  export { cover, icon, notionFile } from './file.helpers';
4
4
  export { filter } from './filter.helpers';
5
- export { paginate, paginateIterator, paginateWithMetadata } from './pagination.helpers';
6
- export type { PaginatedFetchFunction } from './pagination.helpers';
5
+ export { collectAllDataSourceRows, iterateAllDataSourceRows, paginate, paginateIterator, paginateWithMetadata, } from './pagination.helpers';
6
+ export type { PaginatedFetchFunction, WindowedFetchFunction } from './pagination.helpers';
7
7
  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
+ export { webhook } from './webhook.helpers';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sort = exports.richText = exports.RichTextBuilder = exports.prop = exports.parent = exports.paginateWithMetadata = exports.paginateIterator = exports.paginate = exports.filter = exports.notionFile = exports.icon = exports.cover = exports.block = void 0;
3
+ exports.webhook = exports.sort = exports.richText = exports.RichTextBuilder = exports.prop = exports.parent = exports.paginateWithMetadata = exports.paginateIterator = exports.paginate = exports.iterateAllDataSourceRows = exports.collectAllDataSourceRows = exports.filter = exports.notionFile = exports.icon = exports.cover = exports.block = void 0;
4
4
  var block_helpers_1 = require("./block.helpers");
5
5
  Object.defineProperty(exports, "block", { enumerable: true, get: function () { return block_helpers_1.block; } });
6
6
  var file_helpers_1 = require("./file.helpers");
@@ -10,6 +10,8 @@ Object.defineProperty(exports, "notionFile", { enumerable: true, get: function (
10
10
  var filter_helpers_1 = require("./filter.helpers");
11
11
  Object.defineProperty(exports, "filter", { enumerable: true, get: function () { return filter_helpers_1.filter; } });
12
12
  var pagination_helpers_1 = require("./pagination.helpers");
13
+ Object.defineProperty(exports, "collectAllDataSourceRows", { enumerable: true, get: function () { return pagination_helpers_1.collectAllDataSourceRows; } });
14
+ Object.defineProperty(exports, "iterateAllDataSourceRows", { enumerable: true, get: function () { return pagination_helpers_1.iterateAllDataSourceRows; } });
13
15
  Object.defineProperty(exports, "paginate", { enumerable: true, get: function () { return pagination_helpers_1.paginate; } });
14
16
  Object.defineProperty(exports, "paginateIterator", { enumerable: true, get: function () { return pagination_helpers_1.paginateIterator; } });
15
17
  Object.defineProperty(exports, "paginateWithMetadata", { enumerable: true, get: function () { return pagination_helpers_1.paginateWithMetadata; } });
@@ -22,3 +24,5 @@ Object.defineProperty(exports, "RichTextBuilder", { enumerable: true, get: funct
22
24
  Object.defineProperty(exports, "richText", { enumerable: true, get: function () { return richText_helpers_1.richText; } });
23
25
  var sort_helpers_1 = require("./sort.helpers");
24
26
  Object.defineProperty(exports, "sort", { enumerable: true, get: function () { return sort_helpers_1.sort; } });
27
+ var webhook_helpers_1 = require("./webhook.helpers");
28
+ Object.defineProperty(exports, "webhook", { enumerable: true, get: function () { return webhook_helpers_1.webhook; } });