@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
@@ -33,10 +33,10 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.dataSourceSchema = void 0;
36
+ exports.dataSourceTemplateListSchema = exports.dataSourceTemplateSchema = exports.dataSourceSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
- const emoji_schema_1 = require("./emoji.schema");
39
38
  const file_schema_1 = require("./file.schema");
39
+ const icon_schema_1 = require("./icon.schema");
40
40
  const parent_schema_1 = require("./parent.schema");
41
41
  const richText_schema_1 = require("./richText.schema");
42
42
  const shared_schema_1 = require("./shared.schema");
@@ -50,6 +50,8 @@ const propertyObjects_schema_1 = require("./propertyObjects.schema");
50
50
  *
51
51
  * Notion API reference:
52
52
  * https://developers.notion.com/reference/data-source
53
+ *
54
+ * @category Databases & Data Sources
53
55
  */
54
56
  exports.dataSourceSchema = z.object({
55
57
  /** Always "data_source" */
@@ -62,11 +64,11 @@ exports.dataSourceSchema = z.object({
62
64
  parent: parent_schema_1.parentSchema,
63
65
  /** Information about the database's parent (the data source's grandparent) */
64
66
  database_parent: parent_schema_1.parentSchema,
65
- /** Date and time when this data source was created (ISO 8601) */
67
+ /** Creation date and time for this data source, in ISO 8601 format */
66
68
  created_time: shared_schema_1.notionDateStringSchema,
67
69
  /** User who created the data source */
68
70
  created_by: user_schema_1.userSchema,
69
- /** Date and time when this data source was updated (ISO 8601) */
71
+ /** Last edited date and time for this data source, in ISO 8601 format */
70
72
  last_edited_time: shared_schema_1.notionDateStringSchema,
71
73
  /** User who last edited the data source */
72
74
  last_edited_by: user_schema_1.userSchema,
@@ -74,8 +76,8 @@ exports.dataSourceSchema = z.object({
74
76
  title: richText_schema_1.richTextSchema,
75
77
  /** Description of the data source as it appears in Notion */
76
78
  description: richText_schema_1.richTextSchema,
77
- /** Data source icon (File or Emoji object) */
78
- icon: z.union([file_schema_1.fileSchema, emoji_schema_1.emojiSchema]).nullable(),
79
+ /** Data source icon (File, Emoji, Native Icon, or Custom Emoji object) */
80
+ icon: icon_schema_1.iconSchema.nullable(),
79
81
  /** Data source cover image */
80
82
  cover: file_schema_1.fileSchema.nullable(),
81
83
  /** The Notion URL of the data source */
@@ -87,3 +89,26 @@ exports.dataSourceSchema = z.object({
87
89
  /** Whether the data source is in the trash */
88
90
  in_trash: z.boolean(),
89
91
  });
92
+ /**
93
+ * A single data source template reference. The List data source templates endpoint
94
+ * returns an array of these.
95
+ *
96
+ * Notion API reference:
97
+ * https://developers.notion.com/reference/list-data-source-templates
98
+ *
99
+ * @category Databases & Data Sources
100
+ */
101
+ exports.dataSourceTemplateSchema = z.object({
102
+ id: z.uuid(),
103
+ name: z.string().trim(),
104
+ is_default: z.boolean(),
105
+ });
106
+ /** Response shape of the List data source templates endpoint.
107
+ *
108
+ * @category Databases & Data Sources
109
+ */
110
+ exports.dataSourceTemplateListSchema = z.object({
111
+ templates: z.array(exports.dataSourceTemplateSchema),
112
+ has_more: z.boolean(),
113
+ next_cursor: z.string().trim().nullable(),
114
+ });
@@ -8,12 +8,21 @@ import * as z from 'zod';
8
8
  * Notion API reference:
9
9
  * https://developers.notion.com/reference/database
10
10
  */
11
- /** Data source reference with id and name. */
11
+ /** Data source reference with id and name.
12
+ *
13
+ * @category Databases & Data Sources
14
+ */
12
15
  export declare const dataSourceRefSchema: z.ZodObject<{
13
16
  id: z.ZodUUID;
14
17
  name: z.ZodString;
15
18
  }, z.core.$strip>;
19
+ /**
20
+ * @category Databases & Data Sources
21
+ */
16
22
  export type DataSourceRef = z.infer<typeof dataSourceRefSchema>;
23
+ /**
24
+ * @category Databases & Data Sources
25
+ */
17
26
  export declare const databaseSchema: z.ZodObject<{
18
27
  object: z.ZodLiteral<"database">;
19
28
  id: z.ZodUUID;
@@ -30,6 +39,7 @@ export declare const databaseSchema: z.ZodObject<{
30
39
  avatar_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodNull]>>;
31
40
  person: z.ZodObject<{
32
41
  email: z.ZodEmail;
42
+ email_verified: z.ZodOptional<z.ZodBoolean>;
33
43
  }, z.core.$strip>;
34
44
  }, z.core.$strip>, z.ZodObject<{
35
45
  object: z.ZodLiteral<"user">;
@@ -63,6 +73,7 @@ export declare const databaseSchema: z.ZodObject<{
63
73
  avatar_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodNull]>>;
64
74
  person: z.ZodObject<{
65
75
  email: z.ZodEmail;
76
+ email_verified: z.ZodOptional<z.ZodBoolean>;
66
77
  }, z.core.$strip>;
67
78
  }, z.core.$strip>, z.ZodObject<{
68
79
  object: z.ZodLiteral<"user">;
@@ -102,11 +113,11 @@ export declare const databaseSchema: z.ZodObject<{
102
113
  underline: z.ZodBoolean;
103
114
  code: z.ZodBoolean;
104
115
  color: z.ZodEnum<{
116
+ default: "default";
105
117
  blue: "blue";
106
118
  blue_background: "blue_background";
107
119
  brown: "brown";
108
120
  brown_background: "brown_background";
109
- default: "default";
110
121
  gray: "gray";
111
122
  gray_background: "gray_background";
112
123
  green: "green";
@@ -171,6 +182,7 @@ export declare const databaseSchema: z.ZodObject<{
171
182
  avatar_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodNull]>>;
172
183
  person: z.ZodObject<{
173
184
  email: z.ZodEmail;
185
+ email_verified: z.ZodOptional<z.ZodBoolean>;
174
186
  }, z.core.$strip>;
175
187
  }, z.core.$strip>, z.ZodObject<{
176
188
  object: z.ZodLiteral<"user">;
@@ -203,11 +215,11 @@ export declare const databaseSchema: z.ZodObject<{
203
215
  underline: z.ZodBoolean;
204
216
  code: z.ZodBoolean;
205
217
  color: z.ZodEnum<{
218
+ default: "default";
206
219
  blue: "blue";
207
220
  blue_background: "blue_background";
208
221
  brown: "brown";
209
222
  brown_background: "brown_background";
210
- default: "default";
211
223
  gray: "gray";
212
224
  gray_background: "gray_background";
213
225
  green: "green";
@@ -238,11 +250,11 @@ export declare const databaseSchema: z.ZodObject<{
238
250
  underline: z.ZodBoolean;
239
251
  code: z.ZodBoolean;
240
252
  color: z.ZodEnum<{
253
+ default: "default";
241
254
  blue: "blue";
242
255
  blue_background: "blue_background";
243
256
  brown: "brown";
244
257
  brown_background: "brown_background";
245
- default: "default";
246
258
  gray: "gray";
247
259
  gray_background: "gray_background";
248
260
  green: "green";
@@ -277,11 +289,11 @@ export declare const databaseSchema: z.ZodObject<{
277
289
  underline: z.ZodBoolean;
278
290
  code: z.ZodBoolean;
279
291
  color: z.ZodEnum<{
292
+ default: "default";
280
293
  blue: "blue";
281
294
  blue_background: "blue_background";
282
295
  brown: "brown";
283
296
  brown_background: "brown_background";
284
- default: "default";
285
297
  gray: "gray";
286
298
  gray_background: "gray_background";
287
299
  green: "green";
@@ -346,6 +358,7 @@ export declare const databaseSchema: z.ZodObject<{
346
358
  avatar_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodNull]>>;
347
359
  person: z.ZodObject<{
348
360
  email: z.ZodEmail;
361
+ email_verified: z.ZodOptional<z.ZodBoolean>;
349
362
  }, z.core.$strip>;
350
363
  }, z.core.$strip>, z.ZodObject<{
351
364
  object: z.ZodLiteral<"user">;
@@ -378,11 +391,11 @@ export declare const databaseSchema: z.ZodObject<{
378
391
  underline: z.ZodBoolean;
379
392
  code: z.ZodBoolean;
380
393
  color: z.ZodEnum<{
394
+ default: "default";
381
395
  blue: "blue";
382
396
  blue_background: "blue_background";
383
397
  brown: "brown";
384
398
  brown_background: "brown_background";
385
- default: "default";
386
399
  gray: "gray";
387
400
  gray_background: "gray_background";
388
401
  green: "green";
@@ -413,11 +426,11 @@ export declare const databaseSchema: z.ZodObject<{
413
426
  underline: z.ZodBoolean;
414
427
  code: z.ZodBoolean;
415
428
  color: z.ZodEnum<{
429
+ default: "default";
416
430
  blue: "blue";
417
431
  blue_background: "blue_background";
418
432
  brown: "brown";
419
433
  brown_background: "brown_background";
420
- default: "default";
421
434
  gray: "gray";
422
435
  gray_background: "gray_background";
423
436
  green: "green";
@@ -456,6 +469,30 @@ export declare const databaseSchema: z.ZodObject<{
456
469
  }, z.core.$strip>], "type">, z.ZodObject<{
457
470
  type: z.ZodLiteral<"emoji">;
458
471
  emoji: z.ZodString;
472
+ }, z.core.$strip>, z.ZodObject<{
473
+ type: z.ZodLiteral<"icon">;
474
+ icon: z.ZodObject<{
475
+ name: z.ZodString;
476
+ color: z.ZodOptional<z.ZodEnum<{
477
+ blue: "blue";
478
+ brown: "brown";
479
+ gray: "gray";
480
+ green: "green";
481
+ orange: "orange";
482
+ pink: "pink";
483
+ purple: "purple";
484
+ red: "red";
485
+ yellow: "yellow";
486
+ lightgray: "lightgray";
487
+ }>>;
488
+ }, z.core.$strip>;
489
+ }, z.core.$strip>, z.ZodObject<{
490
+ type: z.ZodLiteral<"custom_emoji">;
491
+ custom_emoji: z.ZodObject<{
492
+ id: z.ZodUUID;
493
+ name: z.ZodOptional<z.ZodString>;
494
+ url: z.ZodOptional<z.ZodURL>;
495
+ }, z.core.$strip>;
459
496
  }, z.core.$strip>]>>;
460
497
  cover: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
461
498
  type: z.ZodLiteral<"file">;
@@ -490,10 +527,17 @@ export declare const databaseSchema: z.ZodObject<{
490
527
  }, z.core.$strip>, z.ZodObject<{
491
528
  type: z.ZodLiteral<"block_id">;
492
529
  block_id: z.ZodUUID;
530
+ }, z.core.$strip>, z.ZodObject<{
531
+ type: z.ZodLiteral<"agent_id">;
532
+ agent_id: z.ZodUUID;
493
533
  }, z.core.$strip>], "type">;
494
534
  url: z.ZodURL;
495
535
  in_trash: z.ZodBoolean;
496
536
  is_inline: z.ZodBoolean;
537
+ is_locked: z.ZodOptional<z.ZodBoolean>;
497
538
  public_url: z.ZodNullable<z.ZodURL>;
498
539
  }, z.core.$strip>;
540
+ /**
541
+ * @category Databases & Data Sources
542
+ */
499
543
  export type NotionDatabase = z.infer<typeof databaseSchema>;
@@ -35,8 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.databaseSchema = exports.dataSourceRefSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
- const emoji_schema_1 = require("./emoji.schema");
39
38
  const file_schema_1 = require("./file.schema");
39
+ const icon_schema_1 = require("./icon.schema");
40
40
  const parent_schema_1 = require("./parent.schema");
41
41
  const richText_schema_1 = require("./richText.schema");
42
42
  const shared_schema_1 = require("./shared.schema");
@@ -50,11 +50,17 @@ const user_schema_1 = require("./user.schema");
50
50
  * Notion API reference:
51
51
  * https://developers.notion.com/reference/database
52
52
  */
53
- /** Data source reference with id and name. */
53
+ /** Data source reference with id and name.
54
+ *
55
+ * @category Databases & Data Sources
56
+ */
54
57
  exports.dataSourceRefSchema = z.object({
55
58
  id: z.uuid(),
56
59
  name: z.string().trim(),
57
60
  });
61
+ /**
62
+ * @category Databases & Data Sources
63
+ */
58
64
  exports.databaseSchema = z.object({
59
65
  object: z.literal('database'),
60
66
  id: z.uuid(),
@@ -65,11 +71,12 @@ exports.databaseSchema = z.object({
65
71
  last_edited_by: user_schema_1.userSchema,
66
72
  title: richText_schema_1.richTextSchema,
67
73
  description: richText_schema_1.richTextSchema,
68
- icon: z.nullable(z.union([file_schema_1.fileSchema, emoji_schema_1.emojiSchema])),
74
+ icon: z.nullable(icon_schema_1.iconSchema),
69
75
  cover: z.nullable(file_schema_1.fileSchema),
70
76
  parent: parent_schema_1.parentSchema,
71
77
  url: z.url(),
72
78
  in_trash: z.boolean(),
73
79
  is_inline: z.boolean(),
80
+ is_locked: z.boolean().optional(),
74
81
  public_url: z.nullable(z.url()),
75
82
  });
@@ -2,14 +2,19 @@ import * as z from 'zod';
2
2
  /**
3
3
  * Notion emoji object schema.
4
4
  *
5
- * Emojis can be used as icons for pages, databases, and other objects.
6
- * Contains the emoji character as a string.
5
+ * You can use emojis as icons for pages, databases, and other objects.
6
+ * This schema stores the emoji character as a string.
7
7
  *
8
8
  * Notion API reference:
9
9
  * https://developers.notion.com/reference/emoji-object
10
+ *
11
+ * @category Custom Emoji & Icons
10
12
  */
11
13
  export declare const emojiSchema: z.ZodObject<{
12
14
  type: z.ZodLiteral<"emoji">;
13
15
  emoji: z.ZodString;
14
16
  }, z.core.$strip>;
17
+ /**
18
+ * @category Custom Emoji & Icons
19
+ */
15
20
  export type NotionEmoji = z.infer<typeof emojiSchema>;
@@ -38,11 +38,13 @@ const z = __importStar(require("zod"));
38
38
  /**
39
39
  * Notion emoji object schema.
40
40
  *
41
- * Emojis can be used as icons for pages, databases, and other objects.
42
- * Contains the emoji character as a string.
41
+ * You can use emojis as icons for pages, databases, and other objects.
42
+ * This schema stores the emoji character as a string.
43
43
  *
44
44
  * Notion API reference:
45
45
  * https://developers.notion.com/reference/emoji-object
46
+ *
47
+ * @category Custom Emoji & Icons
46
48
  */
47
49
  exports.emojiSchema = z.object({
48
50
  type: z.literal('emoji'),
@@ -2,8 +2,9 @@ import * as z from 'zod';
2
2
  /**
3
3
  * Notion file object schemas.
4
4
  *
5
- * Files can be Notion-hosted (uploaded through the UI), API-uploaded (via file upload API),
6
- * or externally hosted (with a URL). Used for page/block icons, covers, and file attachments.
5
+ * Files can be Notion-hosted (uploaded through the UI), API-uploaded (via the file upload
6
+ * API), or externally hosted (with a URL). This schema applies to page and block icons,
7
+ * covers, and file attachments.
7
8
  *
8
9
  * Notion API reference:
9
10
  * https://developers.notion.com/reference/file-object
@@ -30,6 +31,9 @@ declare const externalFileSchema: z.ZodObject<{
30
31
  url: z.ZodURL;
31
32
  }, z.core.$strip>;
32
33
  }, z.core.$strip>;
34
+ /**
35
+ * @category File Uploads
36
+ */
33
37
  export declare const fileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
38
  type: z.ZodLiteral<"file">;
35
39
  file: z.ZodObject<{
@@ -47,8 +51,20 @@ export declare const fileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
51
  url: z.ZodURL;
48
52
  }, z.core.$strip>;
49
53
  }, z.core.$strip>], "type">;
54
+ /**
55
+ * @category File Uploads
56
+ */
50
57
  export type NotionFile = z.infer<typeof fileSchema>;
58
+ /**
59
+ * @category File Uploads
60
+ */
51
61
  export type NotionHostedFile = z.infer<typeof notionFileSchema>;
62
+ /**
63
+ * @category File Uploads
64
+ */
52
65
  export type UploadedFile = z.infer<typeof fileUploadSchema>;
66
+ /**
67
+ * @category File Uploads
68
+ */
53
69
  export type ExternalFile = z.infer<typeof externalFileSchema>;
54
70
  export {};
@@ -39,8 +39,9 @@ const shared_schema_1 = require("./shared.schema");
39
39
  /**
40
40
  * Notion file object schemas.
41
41
  *
42
- * Files can be Notion-hosted (uploaded through the UI), API-uploaded (via file upload API),
43
- * or externally hosted (with a URL). Used for page/block icons, covers, and file attachments.
42
+ * Files can be Notion-hosted (uploaded through the UI), API-uploaded (via the file upload
43
+ * API), or externally hosted (with a URL). This schema applies to page and block icons,
44
+ * covers, and file attachments.
44
45
  *
45
46
  * Notion API reference:
46
47
  * https://developers.notion.com/reference/file-object
@@ -67,6 +68,9 @@ const externalFileSchema = z.object({
67
68
  url: z.url(),
68
69
  }),
69
70
  });
71
+ /**
72
+ * @category File Uploads
73
+ */
70
74
  exports.fileSchema = z.discriminatedUnion('type', [
71
75
  notionFileSchema,
72
76
  fileUploadSchema,
@@ -2,11 +2,14 @@ import * as z from 'zod';
2
2
  /**
3
3
  * Notion file upload object schema.
4
4
  *
5
- * File uploads represent files uploaded to Notion via the API. They have a temporary
6
- * upload URL and can be in various states (pending, uploaded, expired, failed).
5
+ * File uploads represent files uploaded to Notion through the API. Each file upload has
6
+ * a temporary upload URL. Each file upload has one of these states: pending, uploaded,
7
+ * expired, or failed.
7
8
  *
8
9
  * Notion API reference:
9
10
  * https://developers.notion.com/reference/file-upload-object
11
+ *
12
+ * @category File Uploads
10
13
  */
11
14
  export declare const fileUploadSchema: z.ZodObject<{
12
15
  object: z.ZodLiteral<"file_upload">;
@@ -14,10 +17,10 @@ export declare const fileUploadSchema: z.ZodObject<{
14
17
  created_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
15
18
  expiry_time: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
16
19
  status: z.ZodEnum<{
20
+ failed: "failed";
17
21
  pending: "pending";
18
22
  uploaded: "uploaded";
19
23
  expired: "expired";
20
- failed: "failed";
21
24
  }>;
22
25
  filename: z.ZodString;
23
26
  content_type: z.ZodNullable<z.ZodString>;
@@ -26,4 +29,7 @@ export declare const fileUploadSchema: z.ZodObject<{
26
29
  complete_url: z.ZodString;
27
30
  file_import_result: z.ZodString;
28
31
  }, z.core.$strip>;
32
+ /**
33
+ * @category File Uploads
34
+ */
29
35
  export type NotionFileUpload = z.infer<typeof fileUploadSchema>;
@@ -39,11 +39,14 @@ const shared_schema_1 = require("./shared.schema");
39
39
  /**
40
40
  * Notion file upload object schema.
41
41
  *
42
- * File uploads represent files uploaded to Notion via the API. They have a temporary
43
- * upload URL and can be in various states (pending, uploaded, expired, failed).
42
+ * File uploads represent files uploaded to Notion through the API. Each file upload has
43
+ * a temporary upload URL. Each file upload has one of these states: pending, uploaded,
44
+ * expired, or failed.
44
45
  *
45
46
  * Notion API reference:
46
47
  * https://developers.notion.com/reference/file-upload-object
48
+ *
49
+ * @category File Uploads
47
50
  */
48
51
  exports.fileUploadSchema = z.object({
49
52
  object: z.literal('file_upload'),
@@ -0,0 +1,116 @@
1
+ import * as z from 'zod';
2
+ /**
3
+ * Notion native icon and custom emoji icon object schemas.
4
+ *
5
+ * Native icons reference one of Notion's built-in icon-picker icons by name.
6
+ * Custom emoji icons reference a workspace-managed custom emoji by id.
7
+ * Combined with `emojiSchema` and `fileSchema`, these make up the full set
8
+ * of icon object variants usable on pages, databases, data sources, and
9
+ * callout blocks.
10
+ *
11
+ * Notion API reference:
12
+ * https://developers.notion.com/reference/emoji-object
13
+ */
14
+ /** Colors available for native (icon-picker) icons.
15
+ *
16
+ * @category Custom Emoji & Icons
17
+ */
18
+ export declare const NATIVE_ICON_COLORS: readonly ["gray", "lightgray", "brown", "yellow", "orange", "green", "blue", "purple", "pink", "red"];
19
+ /**
20
+ * @category Custom Emoji & Icons
21
+ */
22
+ export type NativeIconColor = (typeof NATIVE_ICON_COLORS)[number];
23
+ /** Native (icon-picker) icon.
24
+ *
25
+ * @category Custom Emoji & Icons
26
+ */
27
+ export declare const nativeIconSchema: z.ZodObject<{
28
+ type: z.ZodLiteral<"icon">;
29
+ icon: z.ZodObject<{
30
+ name: z.ZodString;
31
+ color: z.ZodOptional<z.ZodEnum<{
32
+ blue: "blue";
33
+ brown: "brown";
34
+ gray: "gray";
35
+ green: "green";
36
+ orange: "orange";
37
+ pink: "pink";
38
+ purple: "purple";
39
+ red: "red";
40
+ yellow: "yellow";
41
+ lightgray: "lightgray";
42
+ }>>;
43
+ }, z.core.$strip>;
44
+ }, z.core.$strip>;
45
+ /**
46
+ * @category Custom Emoji & Icons
47
+ */
48
+ export type NativeIcon = z.infer<typeof nativeIconSchema>;
49
+ /** Custom emoji icon.
50
+ *
51
+ * @category Custom Emoji & Icons
52
+ */
53
+ export declare const customEmojiIconSchema: z.ZodObject<{
54
+ type: z.ZodLiteral<"custom_emoji">;
55
+ custom_emoji: z.ZodObject<{
56
+ id: z.ZodUUID;
57
+ name: z.ZodOptional<z.ZodString>;
58
+ url: z.ZodOptional<z.ZodURL>;
59
+ }, z.core.$strip>;
60
+ }, z.core.$strip>;
61
+ /**
62
+ * @category Custom Emoji & Icons
63
+ */
64
+ export type CustomEmojiIcon = z.infer<typeof customEmojiIconSchema>;
65
+ /** Shared icon schema covering all icon object variants.
66
+ *
67
+ * @category Custom Emoji & Icons
68
+ */
69
+ export declare const iconSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
70
+ type: z.ZodLiteral<"file">;
71
+ file: z.ZodObject<{
72
+ url: z.ZodURL;
73
+ expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
74
+ }, z.core.$strip>;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ type: z.ZodLiteral<"file_upload">;
77
+ file_upload: z.ZodObject<{
78
+ id: z.ZodUUID;
79
+ }, z.core.$strip>;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ type: z.ZodLiteral<"external">;
82
+ external: z.ZodObject<{
83
+ url: z.ZodURL;
84
+ }, z.core.$strip>;
85
+ }, z.core.$strip>], "type">, z.ZodObject<{
86
+ type: z.ZodLiteral<"emoji">;
87
+ emoji: z.ZodString;
88
+ }, z.core.$strip>, z.ZodObject<{
89
+ type: z.ZodLiteral<"icon">;
90
+ icon: z.ZodObject<{
91
+ name: z.ZodString;
92
+ color: z.ZodOptional<z.ZodEnum<{
93
+ blue: "blue";
94
+ brown: "brown";
95
+ gray: "gray";
96
+ green: "green";
97
+ orange: "orange";
98
+ pink: "pink";
99
+ purple: "purple";
100
+ red: "red";
101
+ yellow: "yellow";
102
+ lightgray: "lightgray";
103
+ }>>;
104
+ }, z.core.$strip>;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ type: z.ZodLiteral<"custom_emoji">;
107
+ custom_emoji: z.ZodObject<{
108
+ id: z.ZodUUID;
109
+ name: z.ZodOptional<z.ZodString>;
110
+ url: z.ZodOptional<z.ZodURL>;
111
+ }, z.core.$strip>;
112
+ }, z.core.$strip>]>;
113
+ /**
114
+ * @category Custom Emoji & Icons
115
+ */
116
+ export type NotionIcon = z.infer<typeof iconSchema>;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.iconSchema = exports.customEmojiIconSchema = exports.nativeIconSchema = exports.NATIVE_ICON_COLORS = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const emoji_schema_1 = require("./emoji.schema");
39
+ const file_schema_1 = require("./file.schema");
40
+ /**
41
+ * Notion native icon and custom emoji icon object schemas.
42
+ *
43
+ * Native icons reference one of Notion's built-in icon-picker icons by name.
44
+ * Custom emoji icons reference a workspace-managed custom emoji by id.
45
+ * Combined with `emojiSchema` and `fileSchema`, these make up the full set
46
+ * of icon object variants usable on pages, databases, data sources, and
47
+ * callout blocks.
48
+ *
49
+ * Notion API reference:
50
+ * https://developers.notion.com/reference/emoji-object
51
+ */
52
+ /** Colors available for native (icon-picker) icons.
53
+ *
54
+ * @category Custom Emoji & Icons
55
+ */
56
+ exports.NATIVE_ICON_COLORS = [
57
+ 'gray',
58
+ 'lightgray',
59
+ 'brown',
60
+ 'yellow',
61
+ 'orange',
62
+ 'green',
63
+ 'blue',
64
+ 'purple',
65
+ 'pink',
66
+ 'red',
67
+ ];
68
+ /** Native (icon-picker) icon.
69
+ *
70
+ * @category Custom Emoji & Icons
71
+ */
72
+ exports.nativeIconSchema = z.object({
73
+ type: z.literal('icon'),
74
+ icon: z.object({
75
+ name: z.string().trim(),
76
+ color: z.enum(exports.NATIVE_ICON_COLORS).optional(),
77
+ }),
78
+ });
79
+ /** Custom emoji icon.
80
+ *
81
+ * @category Custom Emoji & Icons
82
+ */
83
+ exports.customEmojiIconSchema = z.object({
84
+ type: z.literal('custom_emoji'),
85
+ custom_emoji: z.object({
86
+ id: z.uuid(),
87
+ name: z.string().trim().optional(),
88
+ url: z.url().optional(),
89
+ }),
90
+ });
91
+ /** Shared icon schema covering all icon object variants.
92
+ *
93
+ * @category Custom Emoji & Icons
94
+ */
95
+ exports.iconSchema = z.union([
96
+ file_schema_1.fileSchema,
97
+ emoji_schema_1.emojiSchema,
98
+ exports.nativeIconSchema,
99
+ exports.customEmojiIconSchema,
100
+ ]);