@visus-io/notion-sdk-ts 2.0.1 → 3.0.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 (62) hide show
  1. package/README.md +66 -23
  2. package/dist/api/base.api.d.ts +1 -1
  3. package/dist/api/blocks.api.d.ts +266 -87
  4. package/dist/api/comments.api.d.ts +7 -7
  5. package/dist/api/dataSources.api.d.ts +28 -31
  6. package/dist/api/dataSources.api.js +18 -19
  7. package/dist/api/databases.api.d.ts +27 -22
  8. package/dist/api/databases.api.js +18 -8
  9. package/dist/api/fileUploads.api.d.ts +2 -2
  10. package/dist/api/pages.api.d.ts +43 -38
  11. package/dist/api/pages.api.js +18 -8
  12. package/dist/api/users.api.d.ts +1 -1
  13. package/dist/client.d.ts +5 -3
  14. package/dist/client.js +7 -3
  15. package/dist/helpers/block.helpers.d.ts +4 -0
  16. package/dist/helpers/block.helpers.js +11 -0
  17. package/dist/helpers/parent.helpers.d.ts +2 -2
  18. package/dist/helpers/parent.helpers.js +2 -2
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +3 -1
  21. package/dist/models/base.model.d.ts +2 -2
  22. package/dist/models/block.model.d.ts +0 -1
  23. package/dist/models/block.model.js +0 -3
  24. package/dist/models/dataSource.model.d.ts +0 -4
  25. package/dist/models/dataSource.model.js +0 -6
  26. package/dist/models/database.model.d.ts +0 -4
  27. package/dist/models/database.model.js +0 -6
  28. package/dist/models/page.model.d.ts +0 -1
  29. package/dist/models/page.model.js +0 -3
  30. package/dist/schemas/block.schema.d.ts +275 -82
  31. package/dist/schemas/block.schema.js +165 -82
  32. package/dist/schemas/comment.schema.d.ts +9 -9
  33. package/dist/schemas/comment.schema.js +54 -20
  34. package/dist/schemas/dataSource.schema.d.ts +13 -14
  35. package/dist/schemas/dataSource.schema.js +46 -14
  36. package/dist/schemas/database.schema.d.ts +13 -14
  37. package/dist/schemas/database.schema.js +50 -17
  38. package/dist/schemas/emoji.schema.d.ts +1 -1
  39. package/dist/schemas/emoji.schema.js +37 -4
  40. package/dist/schemas/file.schema.d.ts +3 -3
  41. package/dist/schemas/file.schema.js +49 -15
  42. package/dist/schemas/fileUpload.schema.d.ts +3 -3
  43. package/dist/schemas/fileUpload.schema.js +47 -13
  44. package/dist/schemas/index.d.ts +1 -0
  45. package/dist/schemas/index.js +1 -0
  46. package/dist/schemas/page.schema.d.ts +30 -31
  47. package/dist/schemas/page.schema.js +46 -13
  48. package/dist/schemas/pageProperties.schema.d.ts +47 -47
  49. package/dist/schemas/pageProperties.schema.js +162 -128
  50. package/dist/schemas/pagination.schema.d.ts +1 -1
  51. package/dist/schemas/pagination.schema.js +40 -7
  52. package/dist/schemas/parent.schema.d.ts +1 -1
  53. package/dist/schemas/parent.schema.js +51 -18
  54. package/dist/schemas/propertyObjects.schema.d.ts +1 -1
  55. package/dist/schemas/propertyObjects.schema.js +194 -161
  56. package/dist/schemas/richText.schema.d.ts +7 -7
  57. package/dist/schemas/richText.schema.js +95 -56
  58. package/dist/schemas/shared.schema.d.ts +15 -0
  59. package/dist/schemas/shared.schema.js +54 -0
  60. package/dist/schemas/user.schema.d.ts +3 -3
  61. package/dist/schemas/user.schema.js +63 -30
  62. package/package.json +7 -5
@@ -1,13 +1,47 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.blockSchema = void 0;
4
- const zod_1 = require("zod");
36
+ exports.blockSchema = exports.blockPositionSchema = void 0;
37
+ const z = __importStar(require("zod"));
5
38
  const codeLanguages_1 = require("./codeLanguages");
6
39
  const colors_1 = require("./colors");
7
40
  const emoji_schema_1 = require("./emoji.schema");
8
41
  const file_schema_1 = require("./file.schema");
9
42
  const parent_schema_1 = require("./parent.schema");
10
43
  const richText_schema_1 = require("./richText.schema");
44
+ const shared_schema_1 = require("./shared.schema");
11
45
  const user_schema_1 = require("./user.schema");
12
46
  /**
13
47
  * Notion block object schema.
@@ -18,17 +52,32 @@ const user_schema_1 = require("./user.schema");
18
52
  * Notion API reference:
19
53
  * https://developers.notion.com/reference/block
20
54
  */
21
- const headingsObject = zod_1.z.object({
55
+ let childrenSchema;
56
+ const getChildrenSchema = () => {
57
+ childrenSchema ??= z.array(exports.blockSchema).optional();
58
+ return childrenSchema;
59
+ };
60
+ /**
61
+ * Position for inserting block children in the Append Block Children endpoint.
62
+ */
63
+ exports.blockPositionSchema = z.discriminatedUnion('type', [
64
+ z.object({ type: z.literal('after_block'), after_block: z.object({ id: z.uuid() }) }),
65
+ z.object({ type: z.literal('start') }),
66
+ z.object({ type: z.literal('end') }),
67
+ ]);
68
+ const headingsObjectSchema = z.object({
22
69
  rich_text: richText_schema_1.richTextSchema,
23
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
24
- is_toggleable: zod_1.z.boolean(),
25
- children: zod_1.z.array(zod_1.z.any()).optional(),
70
+ color: z.enum(colors_1.NOTION_COLORS),
71
+ is_toggleable: z.boolean(),
72
+ get children() {
73
+ return getChildrenSchema();
74
+ },
26
75
  });
27
- exports.blockSchema = zod_1.z.object({
28
- object: zod_1.z.literal('block'),
29
- id: zod_1.z.uuid(),
76
+ exports.blockSchema = z.object({
77
+ object: z.literal('block'),
78
+ id: z.uuid(),
30
79
  parent: parent_schema_1.parentSchema,
31
- type: zod_1.z.enum([
80
+ type: z.enum([
32
81
  'audio',
33
82
  'bookmark',
34
83
  'breadcrumb',
@@ -59,167 +108,201 @@ exports.blockSchema = zod_1.z.object({
59
108
  'template',
60
109
  'to_do',
61
110
  'toggle',
111
+ 'meeting_notes',
62
112
  'unsupported',
63
113
  'video',
64
114
  ]),
65
- created_time: zod_1.z.iso.datetime(),
115
+ created_time: shared_schema_1.notionDateStringSchema,
66
116
  created_by: user_schema_1.userSchema,
67
- last_edited_time: zod_1.z.iso.datetime(),
117
+ last_edited_time: shared_schema_1.notionDateStringSchema,
68
118
  last_edited_by: user_schema_1.userSchema,
69
- archived: zod_1.z.boolean(),
70
- in_trash: zod_1.z.boolean(),
71
- has_children: zod_1.z.boolean(),
119
+ in_trash: z.boolean(),
120
+ has_children: z.boolean(),
72
121
  // Block-specific properties
73
122
  audio: file_schema_1.fileSchema.optional(),
74
- bookmark: zod_1.z
123
+ bookmark: z
75
124
  .object({
76
125
  caption: richText_schema_1.richTextSchema,
77
- url: zod_1.z.url(),
126
+ url: z.url(),
78
127
  })
79
128
  .optional(),
80
- breadcrumb: zod_1.z.object({}).optional(),
81
- bulleted_list_item: zod_1.z
129
+ breadcrumb: z.object({}).optional(),
130
+ bulleted_list_item: z
82
131
  .object({
83
132
  rich_text: richText_schema_1.richTextSchema,
84
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
85
- children: zod_1.z.array(zod_1.z.any()).optional(),
133
+ color: z.enum(colors_1.NOTION_COLORS),
134
+ get children() {
135
+ return getChildrenSchema();
136
+ },
86
137
  })
87
138
  .optional(),
88
- callout: zod_1.z
139
+ callout: z
89
140
  .object({
90
141
  rich_text: richText_schema_1.richTextSchema,
91
- icon: zod_1.z.union([emoji_schema_1.emojiSchema, file_schema_1.fileSchema]),
92
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
93
- children: zod_1.z.array(zod_1.z.any()).optional(),
142
+ icon: z.union([emoji_schema_1.emojiSchema, file_schema_1.fileSchema]),
143
+ color: z.enum(colors_1.NOTION_COLORS),
144
+ get children() {
145
+ return getChildrenSchema();
146
+ },
94
147
  })
95
148
  .optional(),
96
- child_database: zod_1.z
149
+ child_database: z
97
150
  .object({
98
- title: zod_1.z.string(),
151
+ title: z.string().trim(),
99
152
  })
100
153
  .optional(),
101
- child_page: zod_1.z
154
+ child_page: z
102
155
  .object({
103
- title: zod_1.z.string(),
156
+ title: z.string().trim(),
104
157
  })
105
158
  .optional(),
106
- code: zod_1.z
159
+ code: z
107
160
  .object({
108
161
  caption: richText_schema_1.richTextSchema,
109
162
  rich_text: richText_schema_1.richTextSchema,
110
- language: zod_1.z.enum(codeLanguages_1.CODE_BLOCK_LANGUAGES),
163
+ language: z.enum(codeLanguages_1.CODE_BLOCK_LANGUAGES),
164
+ })
165
+ .optional(),
166
+ column_list: z.object({}).optional(),
167
+ column: z
168
+ .object({
169
+ width_ratio: z.number().min(0).max(1).optional(),
170
+ get children() {
171
+ return getChildrenSchema();
172
+ },
111
173
  })
112
174
  .optional(),
113
- column_list: zod_1.z.object({}).optional(),
114
- column: zod_1.z
175
+ divider: z.object({}).optional(),
176
+ embed: z
115
177
  .object({
116
- width_ratio: zod_1.z.number().min(0).max(1).optional(),
117
- children: zod_1.z.array(zod_1.z.any()).optional(),
178
+ url: z.url(),
118
179
  })
119
180
  .optional(),
120
- divider: zod_1.z.object({}).optional(),
121
- embed: zod_1.z
181
+ equation: z
122
182
  .object({
123
- url: zod_1.z.url(),
183
+ // eslint-disable-next-line zod/prefer-string-schema-with-trim -- LaTeX expression must preserve whitespace from Notion API
184
+ expression: z.string(),
124
185
  })
125
186
  .optional(),
126
- equation: zod_1.z.object({ expression: zod_1.z.string() }).optional(),
127
- file: zod_1.z
187
+ file: z
128
188
  .object({
129
189
  caption: richText_schema_1.richTextSchema,
130
- type: zod_1.z.enum(['file', 'file_upload', 'external']),
190
+ type: z.enum(['file', 'file_upload', 'external']),
131
191
  file: file_schema_1.fileSchema.optional(),
132
192
  external: file_schema_1.fileSchema.optional(),
133
193
  file_upload: file_schema_1.fileSchema.optional(),
134
- name: zod_1.z.string().optional(),
194
+ name: z.string().trim().optional(),
135
195
  })
136
196
  .optional(),
137
- heading_1: headingsObject.optional(),
138
- heading_2: headingsObject.optional(),
139
- heading_3: headingsObject.optional(),
197
+ heading_1: headingsObjectSchema.optional(),
198
+ heading_2: headingsObjectSchema.optional(),
199
+ heading_3: headingsObjectSchema.optional(),
140
200
  image: file_schema_1.fileSchema.optional(),
141
- link_preview: zod_1.z.object({ url: zod_1.z.url() }).optional(),
142
- numbered_list_item: zod_1.z
201
+ link_preview: z.object({ url: z.url() }).optional(),
202
+ numbered_list_item: z
143
203
  .object({
144
204
  rich_text: richText_schema_1.richTextSchema,
145
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
146
- list_start_index: zod_1.z.number().int().optional(),
147
- list_format: zod_1.z.enum(['numbers', 'letters', 'roman']).optional(),
148
- children: zod_1.z.array(zod_1.z.any()).optional(),
205
+ color: z.enum(colors_1.NOTION_COLORS),
206
+ list_start_index: z.int().optional(),
207
+ list_format: z.enum(['numbers', 'letters', 'roman']).optional(),
208
+ get children() {
209
+ return getChildrenSchema();
210
+ },
149
211
  })
150
212
  .optional(),
151
- paragraph: zod_1.z
213
+ paragraph: z
152
214
  .object({
153
215
  rich_text: richText_schema_1.richTextSchema,
154
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
155
- children: zod_1.z.array(zod_1.z.any()).optional(),
216
+ color: z.enum(colors_1.NOTION_COLORS),
217
+ get children() {
218
+ return getChildrenSchema();
219
+ },
156
220
  })
157
221
  .optional(),
158
- pdf: zod_1.z
222
+ pdf: z
159
223
  .object({
160
224
  caption: richText_schema_1.richTextSchema,
161
- type: zod_1.z.enum(['file', 'file_upload', 'external']),
225
+ type: z.enum(['file', 'file_upload', 'external']),
162
226
  file: file_schema_1.fileSchema.optional(),
163
227
  external: file_schema_1.fileSchema.optional(),
164
228
  file_upload: file_schema_1.fileSchema.optional(),
165
- name: zod_1.z.string().optional(),
229
+ name: z.string().trim().optional(),
166
230
  })
167
231
  .optional(),
168
- quote: zod_1.z
232
+ quote: z
169
233
  .object({
170
234
  rich_text: richText_schema_1.richTextSchema,
171
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
172
- children: zod_1.z.array(zod_1.z.any()).optional(),
235
+ color: z.enum(colors_1.NOTION_COLORS),
236
+ get children() {
237
+ return getChildrenSchema();
238
+ },
173
239
  })
174
240
  .optional(),
175
- synced_block: zod_1.z
241
+ synced_block: z
176
242
  .object({
177
- synced_from: zod_1.z
243
+ synced_from: z
178
244
  .object({
179
- type: zod_1.z.literal('block_id'),
180
- block_id: zod_1.z.uuid(),
245
+ type: z.literal('block_id'),
246
+ block_id: z.uuid(),
181
247
  })
182
248
  .nullable(),
183
- children: zod_1.z.array(zod_1.z.any()).optional(),
249
+ get children() {
250
+ return getChildrenSchema();
251
+ },
184
252
  })
185
253
  .optional(),
186
- table: zod_1.z
254
+ table: z
187
255
  .object({
188
- table_width: zod_1.z.number().int(),
189
- has_column_header: zod_1.z.boolean(),
190
- has_row_header: zod_1.z.boolean(),
256
+ table_width: z.int(),
257
+ has_column_header: z.boolean(),
258
+ has_row_header: z.boolean(),
191
259
  })
192
260
  .optional(),
193
- table_of_contents: zod_1.z
261
+ table_of_contents: z
194
262
  .object({
195
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
263
+ color: z.enum(colors_1.NOTION_COLORS),
196
264
  })
197
265
  .optional(),
198
- table_row: zod_1.z
266
+ table_row: z
199
267
  .object({
200
- cells: zod_1.z.array(richText_schema_1.richTextSchema),
268
+ cells: z.array(richText_schema_1.richTextSchema),
269
+ })
270
+ .optional(),
271
+ template: z
272
+ .object({
273
+ rich_text: richText_schema_1.richTextSchema,
274
+ get children() {
275
+ return getChildrenSchema();
276
+ },
201
277
  })
202
278
  .optional(),
203
- template: zod_1.z
279
+ to_do: z
204
280
  .object({
205
281
  rich_text: richText_schema_1.richTextSchema,
206
- children: zod_1.z.array(zod_1.z.any()).optional(),
282
+ checked: z.boolean().optional(),
283
+ color: z.enum(colors_1.NOTION_COLORS),
284
+ get children() {
285
+ return getChildrenSchema();
286
+ },
207
287
  })
208
288
  .optional(),
209
- to_do: zod_1.z
289
+ toggle: z
210
290
  .object({
211
291
  rich_text: richText_schema_1.richTextSchema,
212
- checked: zod_1.z.boolean().optional(),
213
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
214
- children: zod_1.z.array(zod_1.z.any()).optional(),
292
+ color: z.enum(colors_1.NOTION_COLORS),
293
+ get children() {
294
+ return getChildrenSchema();
295
+ },
215
296
  })
216
297
  .optional(),
217
- toggle: zod_1.z
298
+ meeting_notes: z
218
299
  .object({
219
300
  rich_text: richText_schema_1.richTextSchema,
220
- color: zod_1.z.enum(colors_1.NOTION_COLORS),
221
- children: zod_1.z.array(zod_1.z.any()).optional(),
301
+ get children() {
302
+ return getChildrenSchema();
303
+ },
222
304
  })
223
305
  .optional(),
306
+ unsupported: z.object({}).optional(),
224
307
  video: file_schema_1.fileSchema.optional(),
225
308
  });
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  /** Comment attachment schema. */
3
3
  export declare const commentAttachmentSchema: z.ZodObject<{
4
4
  category: z.ZodEnum<{
@@ -10,7 +10,7 @@ export declare const commentAttachmentSchema: z.ZodObject<{
10
10
  }>;
11
11
  file: z.ZodObject<{
12
12
  url: z.ZodURL;
13
- expiry_time: z.ZodISODateTime;
13
+ expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
14
14
  }, z.core.$strip>;
15
15
  }, z.core.$strip>;
16
16
  export type CommentAttachment = z.infer<typeof commentAttachmentSchema>;
@@ -44,7 +44,7 @@ export declare const commentSchema: z.ZodObject<{
44
44
  block_id: z.ZodUUID;
45
45
  }, z.core.$strip>], "type">;
46
46
  discussion_id: z.ZodUUID;
47
- created_time: z.ZodISODateTime;
47
+ created_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
48
48
  created_by: z.ZodUnion<readonly [z.ZodObject<{
49
49
  object: z.ZodLiteral<"user">;
50
50
  id: z.ZodUUID;
@@ -70,14 +70,14 @@ export declare const commentSchema: z.ZodObject<{
70
70
  workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
71
  workspace_id: z.ZodOptional<z.ZodString>;
72
72
  workspace_limits: z.ZodOptional<z.ZodObject<{
73
- max_file_upload_size_in_bytes: z.ZodNumber;
73
+ max_file_upload_size_in_bytes: z.ZodInt;
74
74
  }, z.core.$strip>>;
75
75
  }, z.core.$strip>;
76
76
  }, z.core.$strip>, z.ZodObject<{
77
77
  object: z.ZodLiteral<"user">;
78
78
  id: z.ZodUUID;
79
79
  }, z.core.$strip>]>;
80
- last_edited_time: z.ZodISODateTime;
80
+ last_edited_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
81
81
  rich_text: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
82
82
  type: z.ZodLiteral<"text">;
83
83
  text: z.ZodObject<{
@@ -126,8 +126,8 @@ export declare const commentSchema: z.ZodObject<{
126
126
  }, z.core.$strip>, z.ZodObject<{
127
127
  type: z.ZodLiteral<"date">;
128
128
  date: z.ZodObject<{
129
- start: z.ZodString;
130
- end: z.ZodNullable<z.ZodString>;
129
+ start: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
130
+ end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
131
131
  time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
132
  }, z.core.$strip>;
133
133
  }, z.core.$strip>, z.ZodObject<{
@@ -179,7 +179,7 @@ export declare const commentSchema: z.ZodObject<{
179
179
  workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
180
  workspace_id: z.ZodOptional<z.ZodString>;
181
181
  workspace_limits: z.ZodOptional<z.ZodObject<{
182
- max_file_upload_size_in_bytes: z.ZodNumber;
182
+ max_file_upload_size_in_bytes: z.ZodInt;
183
183
  }, z.core.$strip>>;
184
184
  }, z.core.$strip>;
185
185
  }, z.core.$strip>, z.ZodObject<{
@@ -263,7 +263,7 @@ export declare const commentSchema: z.ZodObject<{
263
263
  }>;
264
264
  file: z.ZodObject<{
265
265
  url: z.ZodURL;
266
- expiry_time: z.ZodISODateTime;
266
+ expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
267
267
  }, z.core.$strip>;
268
268
  }, z.core.$strip>>>;
269
269
  display_name: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
@@ -1,9 +1,43 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.commentSchema = exports.commentDisplayNameSchema = exports.commentAttachmentSchema = void 0;
4
- const zod_1 = require("zod");
37
+ const z = __importStar(require("zod"));
5
38
  const parent_schema_1 = require("./parent.schema");
6
39
  const richText_schema_1 = require("./richText.schema");
40
+ const shared_schema_1 = require("./shared.schema");
7
41
  const user_schema_1 = require("./user.schema");
8
42
  /**
9
43
  * Notion comment object schema.
@@ -15,35 +49,35 @@ const user_schema_1 = require("./user.schema");
15
49
  * https://developers.notion.com/reference/comment-object
16
50
  */
17
51
  /** Comment attachment file schema. */
18
- const commentAttachmentFileSchema = zod_1.z.object({
19
- url: zod_1.z.url(),
20
- expiry_time: zod_1.z.iso.datetime(),
52
+ const commentAttachmentFileSchema = z.object({
53
+ url: z.url(),
54
+ expiry_time: shared_schema_1.notionDateStringSchema,
21
55
  });
22
56
  /** Comment attachment schema. */
23
- exports.commentAttachmentSchema = zod_1.z.object({
24
- category: zod_1.z.enum(['image', 'video', 'file', 'audio', 'pdf']),
57
+ exports.commentAttachmentSchema = z.object({
58
+ category: z.enum(['image', 'video', 'file', 'audio', 'pdf']),
25
59
  file: commentAttachmentFileSchema,
26
60
  });
27
61
  /** Comment display name schema (user or custom). */
28
- exports.commentDisplayNameSchema = zod_1.z.union([
29
- zod_1.z.object({
30
- type: zod_1.z.literal('user'),
31
- resolved_name: zod_1.z.string(),
62
+ exports.commentDisplayNameSchema = z.union([
63
+ z.object({
64
+ type: z.literal('user'),
65
+ resolved_name: z.string().trim(),
32
66
  }),
33
- zod_1.z.object({
34
- type: zod_1.z.literal('custom'),
35
- resolved_name: zod_1.z.string(),
67
+ z.object({
68
+ type: z.literal('custom'),
69
+ resolved_name: z.string().trim(),
36
70
  }),
37
71
  ]);
38
- exports.commentSchema = zod_1.z.object({
39
- object: zod_1.z.literal('comment'),
40
- id: zod_1.z.uuid(),
72
+ exports.commentSchema = z.object({
73
+ object: z.literal('comment'),
74
+ id: z.uuid(),
41
75
  parent: parent_schema_1.parentSchema,
42
- discussion_id: zod_1.z.uuid(),
43
- created_time: zod_1.z.iso.datetime(),
76
+ discussion_id: z.uuid(),
77
+ created_time: shared_schema_1.notionDateStringSchema,
44
78
  created_by: user_schema_1.userSchema,
45
- last_edited_time: zod_1.z.iso.datetime(),
79
+ last_edited_time: shared_schema_1.notionDateStringSchema,
46
80
  rich_text: richText_schema_1.richTextSchema,
47
- attachments: zod_1.z.array(exports.commentAttachmentSchema).optional(),
81
+ attachments: z.array(exports.commentAttachmentSchema).optional(),
48
82
  display_name: exports.commentDisplayNameSchema.optional(),
49
83
  });
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import * as z from 'zod';
2
2
  /**
3
3
  * Notion data source object schema.
4
4
  *
@@ -329,7 +329,7 @@ export declare const dataSourceSchema: z.ZodObject<{
329
329
  type: z.ZodLiteral<"block_id">;
330
330
  block_id: z.ZodUUID;
331
331
  }, z.core.$strip>], "type">;
332
- created_time: z.ZodISODateTime;
332
+ created_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
333
333
  created_by: z.ZodUnion<readonly [z.ZodObject<{
334
334
  object: z.ZodLiteral<"user">;
335
335
  id: z.ZodUUID;
@@ -355,14 +355,14 @@ export declare const dataSourceSchema: z.ZodObject<{
355
355
  workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
356
356
  workspace_id: z.ZodOptional<z.ZodString>;
357
357
  workspace_limits: z.ZodOptional<z.ZodObject<{
358
- max_file_upload_size_in_bytes: z.ZodNumber;
358
+ max_file_upload_size_in_bytes: z.ZodInt;
359
359
  }, z.core.$strip>>;
360
360
  }, z.core.$strip>;
361
361
  }, z.core.$strip>, z.ZodObject<{
362
362
  object: z.ZodLiteral<"user">;
363
363
  id: z.ZodUUID;
364
364
  }, z.core.$strip>]>;
365
- last_edited_time: z.ZodISODateTime;
365
+ last_edited_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
366
366
  last_edited_by: z.ZodUnion<readonly [z.ZodObject<{
367
367
  object: z.ZodLiteral<"user">;
368
368
  id: z.ZodUUID;
@@ -388,7 +388,7 @@ export declare const dataSourceSchema: z.ZodObject<{
388
388
  workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
389
389
  workspace_id: z.ZodOptional<z.ZodString>;
390
390
  workspace_limits: z.ZodOptional<z.ZodObject<{
391
- max_file_upload_size_in_bytes: z.ZodNumber;
391
+ max_file_upload_size_in_bytes: z.ZodInt;
392
392
  }, z.core.$strip>>;
393
393
  }, z.core.$strip>;
394
394
  }, z.core.$strip>, z.ZodObject<{
@@ -443,8 +443,8 @@ export declare const dataSourceSchema: z.ZodObject<{
443
443
  }, z.core.$strip>, z.ZodObject<{
444
444
  type: z.ZodLiteral<"date">;
445
445
  date: z.ZodObject<{
446
- start: z.ZodString;
447
- end: z.ZodNullable<z.ZodString>;
446
+ start: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
447
+ end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
448
448
  time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
449
449
  }, z.core.$strip>;
450
450
  }, z.core.$strip>, z.ZodObject<{
@@ -496,7 +496,7 @@ export declare const dataSourceSchema: z.ZodObject<{
496
496
  workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
497
497
  workspace_id: z.ZodOptional<z.ZodString>;
498
498
  workspace_limits: z.ZodOptional<z.ZodObject<{
499
- max_file_upload_size_in_bytes: z.ZodNumber;
499
+ max_file_upload_size_in_bytes: z.ZodInt;
500
500
  }, z.core.$strip>>;
501
501
  }, z.core.$strip>;
502
502
  }, z.core.$strip>, z.ZodObject<{
@@ -618,8 +618,8 @@ export declare const dataSourceSchema: z.ZodObject<{
618
618
  }, z.core.$strip>, z.ZodObject<{
619
619
  type: z.ZodLiteral<"date">;
620
620
  date: z.ZodObject<{
621
- start: z.ZodString;
622
- end: z.ZodNullable<z.ZodString>;
621
+ start: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
622
+ end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
623
623
  time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
624
624
  }, z.core.$strip>;
625
625
  }, z.core.$strip>, z.ZodObject<{
@@ -671,7 +671,7 @@ export declare const dataSourceSchema: z.ZodObject<{
671
671
  workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
672
672
  workspace_id: z.ZodOptional<z.ZodString>;
673
673
  workspace_limits: z.ZodOptional<z.ZodObject<{
674
- max_file_upload_size_in_bytes: z.ZodNumber;
674
+ max_file_upload_size_in_bytes: z.ZodInt;
675
675
  }, z.core.$strip>>;
676
676
  }, z.core.$strip>;
677
677
  }, z.core.$strip>, z.ZodObject<{
@@ -749,7 +749,7 @@ export declare const dataSourceSchema: z.ZodObject<{
749
749
  type: z.ZodLiteral<"file">;
750
750
  file: z.ZodObject<{
751
751
  url: z.ZodURL;
752
- expiry_time: z.ZodISODateTime;
752
+ expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
753
753
  }, z.core.$strip>;
754
754
  }, z.core.$strip>, z.ZodObject<{
755
755
  type: z.ZodLiteral<"file_upload">;
@@ -769,7 +769,7 @@ export declare const dataSourceSchema: z.ZodObject<{
769
769
  type: z.ZodLiteral<"file">;
770
770
  file: z.ZodObject<{
771
771
  url: z.ZodURL;
772
- expiry_time: z.ZodISODateTime;
772
+ expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
773
773
  }, z.core.$strip>;
774
774
  }, z.core.$strip>, z.ZodObject<{
775
775
  type: z.ZodLiteral<"file_upload">;
@@ -785,7 +785,6 @@ export declare const dataSourceSchema: z.ZodObject<{
785
785
  url: z.ZodURL;
786
786
  public_url: z.ZodUnion<readonly [z.ZodURL, z.ZodNull]>;
787
787
  is_inline: z.ZodBoolean;
788
- archived: z.ZodBoolean;
789
788
  in_trash: z.ZodBoolean;
790
789
  }, z.core.$strip>;
791
790
  export type NotionDataSource = z.infer<typeof dataSourceSchema>;