@visus-io/notion-sdk-ts 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/blocks.api.d.ts +1083 -224
- package/dist/api/blocks.api.js +4 -0
- package/dist/api/comments.api.d.ts +19 -1
- package/dist/api/comments.api.js +1 -1
- package/dist/api/dataSources.api.d.ts +36 -0
- package/dist/api/databases.api.d.ts +36 -0
- package/dist/api/databases.api.js +1 -0
- package/dist/api/fileUploads.api.d.ts +17 -7
- package/dist/api/fileUploads.api.js +30 -16
- package/dist/api/pages.api.d.ts +46 -0
- package/dist/client.d.ts +33 -2
- package/dist/client.js +88 -21
- package/dist/helpers/filter.helpers.d.ts +11 -4
- package/dist/helpers/filter.helpers.js +73 -30
- package/dist/helpers/pagination.helpers.d.ts +7 -2
- package/dist/helpers/pagination.helpers.js +26 -5
- package/dist/models/page.model.d.ts +20 -1
- package/dist/models/page.model.js +33 -2
- package/dist/schemas/block.schema.d.ts +1082 -224
- package/dist/schemas/block.schema.js +40 -25
- package/dist/schemas/comment.schema.d.ts +18 -0
- package/dist/schemas/dataSource.schema.d.ts +36 -0
- package/dist/schemas/database.schema.d.ts +36 -0
- package/dist/schemas/meetingNotesQuery.schema.d.ts +1082 -224
- package/dist/schemas/page.schema.d.ts +46 -0
- package/dist/schemas/page.schema.js +2 -1
- package/dist/schemas/pageMarkdown.schema.js +1 -1
- package/dist/schemas/pageProperties.schema.d.ts +99 -1
- package/dist/schemas/pageProperties.schema.js +16 -1
- package/dist/schemas/pagination.schema.d.ts +1 -1
- package/dist/schemas/propertyObjects.schema.js +2 -1
- package/dist/schemas/richText.schema.d.ts +36 -0
- package/dist/schemas/richText.schema.js +21 -0
- package/dist/schemas/shared.schema.d.ts +3 -7
- package/dist/schemas/shared.schema.js +5 -9
- package/dist/schemas/view.schema.d.ts +46 -0
- package/dist/validation.d.ts +8 -0
- package/dist/validation.js +16 -0
- package/package.json +1 -1
|
@@ -37,7 +37,6 @@ exports.blockSchema = exports.blockPositionSchema = void 0;
|
|
|
37
37
|
const z = __importStar(require("zod"));
|
|
38
38
|
const codeLanguages_1 = require("./codeLanguages");
|
|
39
39
|
const colors_1 = require("./colors");
|
|
40
|
-
const file_schema_1 = require("./file.schema");
|
|
41
40
|
const icon_schema_1 = require("./icon.schema");
|
|
42
41
|
const parent_schema_1 = require("./parent.schema");
|
|
43
42
|
const richText_schema_1 = require("./richText.schema");
|
|
@@ -47,7 +46,7 @@ const user_schema_1 = require("./user.schema");
|
|
|
47
46
|
* Notion block object schema.
|
|
48
47
|
*
|
|
49
48
|
* Blocks are the individual pieces of content that make up pages. Notion supports
|
|
50
|
-
*
|
|
49
|
+
* many block types, including paragraphs, headings, lists, media, and more.
|
|
51
50
|
*
|
|
52
51
|
* Notion API reference:
|
|
53
52
|
* https://developers.notion.com/reference/block
|
|
@@ -75,6 +74,26 @@ const headingsObjectSchema = z.object({
|
|
|
75
74
|
return getChildrenSchema();
|
|
76
75
|
},
|
|
77
76
|
});
|
|
77
|
+
/**
|
|
78
|
+
* Content of a media block (`audio`, `image`, `video`, `file`, `pdf`). The file-object
|
|
79
|
+
* body is inlined, so `external` is `{ url }`, not a full nested file object.
|
|
80
|
+
*
|
|
81
|
+
* The `type` field names which body object is present. The schema rejects a value
|
|
82
|
+
* whose `type` has no matching `file`, `external`, or `file_upload` object.
|
|
83
|
+
*/
|
|
84
|
+
const mediaBlockContentSchema = z
|
|
85
|
+
.object({
|
|
86
|
+
caption: richText_schema_1.richTextSchema.default([]),
|
|
87
|
+
type: z.enum(['file', 'file_upload', 'external']),
|
|
88
|
+
file: z.object({ url: z.url(), expiry_time: shared_schema_1.notionDateStringSchema }).optional(),
|
|
89
|
+
external: z.object({ url: z.url() }).optional(),
|
|
90
|
+
file_upload: z.object({ id: z.uuid() }).optional(),
|
|
91
|
+
name: z.string().trim().optional(),
|
|
92
|
+
})
|
|
93
|
+
.refine((value) => value[value.type] !== undefined, {
|
|
94
|
+
error: 'A media block must include the file object that matches its `type`.',
|
|
95
|
+
path: ['type'],
|
|
96
|
+
});
|
|
78
97
|
/**
|
|
79
98
|
* @category Blocks
|
|
80
99
|
*/
|
|
@@ -103,6 +122,7 @@ exports.blockSchema = z.object({
|
|
|
103
122
|
'heading_4',
|
|
104
123
|
'image',
|
|
105
124
|
'link_preview',
|
|
125
|
+
'link_to_page',
|
|
106
126
|
'numbered_list_item',
|
|
107
127
|
'paragraph',
|
|
108
128
|
'pdf',
|
|
@@ -126,7 +146,7 @@ exports.blockSchema = z.object({
|
|
|
126
146
|
in_trash: z.boolean(),
|
|
127
147
|
has_children: z.boolean(),
|
|
128
148
|
// Block-specific properties
|
|
129
|
-
audio:
|
|
149
|
+
audio: mediaBlockContentSchema.optional(),
|
|
130
150
|
bookmark: z
|
|
131
151
|
.object({
|
|
132
152
|
caption: richText_schema_1.richTextSchema,
|
|
@@ -197,22 +217,26 @@ exports.blockSchema = z.object({
|
|
|
197
217
|
expression: z.string(),
|
|
198
218
|
})
|
|
199
219
|
.optional(),
|
|
200
|
-
file:
|
|
201
|
-
.object({
|
|
202
|
-
caption: richText_schema_1.richTextSchema,
|
|
203
|
-
type: z.enum(['file', 'file_upload', 'external']),
|
|
204
|
-
file: file_schema_1.fileSchema.optional(),
|
|
205
|
-
external: file_schema_1.fileSchema.optional(),
|
|
206
|
-
file_upload: file_schema_1.fileSchema.optional(),
|
|
207
|
-
name: z.string().trim().optional(),
|
|
208
|
-
})
|
|
209
|
-
.optional(),
|
|
220
|
+
file: mediaBlockContentSchema.optional(),
|
|
210
221
|
heading_1: headingsObjectSchema.optional(),
|
|
211
222
|
heading_2: headingsObjectSchema.optional(),
|
|
212
223
|
heading_3: headingsObjectSchema.optional(),
|
|
213
224
|
heading_4: headingsObjectSchema.optional(),
|
|
214
|
-
image:
|
|
225
|
+
image: mediaBlockContentSchema.optional(),
|
|
215
226
|
link_preview: z.object({ url: z.url() }).optional(),
|
|
227
|
+
link_to_page: z
|
|
228
|
+
.object({
|
|
229
|
+
type: z.enum(['page_id', 'data_source_id', 'database_id', 'comment_id']),
|
|
230
|
+
page_id: z.uuid().optional(),
|
|
231
|
+
data_source_id: z.uuid().optional(),
|
|
232
|
+
database_id: z.uuid().optional(),
|
|
233
|
+
comment_id: z.uuid().optional(),
|
|
234
|
+
})
|
|
235
|
+
.refine((value) => value[value.type] !== undefined, {
|
|
236
|
+
error: 'A link_to_page block must include the ID field that matches its `type`.',
|
|
237
|
+
path: ['type'],
|
|
238
|
+
})
|
|
239
|
+
.optional(),
|
|
216
240
|
numbered_list_item: z
|
|
217
241
|
.object({
|
|
218
242
|
rich_text: richText_schema_1.richTextSchema,
|
|
@@ -234,16 +258,7 @@ exports.blockSchema = z.object({
|
|
|
234
258
|
},
|
|
235
259
|
})
|
|
236
260
|
.optional(),
|
|
237
|
-
pdf:
|
|
238
|
-
.object({
|
|
239
|
-
caption: richText_schema_1.richTextSchema,
|
|
240
|
-
type: z.enum(['file', 'file_upload', 'external']),
|
|
241
|
-
file: file_schema_1.fileSchema.optional(),
|
|
242
|
-
external: file_schema_1.fileSchema.optional(),
|
|
243
|
-
file_upload: file_schema_1.fileSchema.optional(),
|
|
244
|
-
name: z.string().trim().optional(),
|
|
245
|
-
})
|
|
246
|
-
.optional(),
|
|
261
|
+
pdf: mediaBlockContentSchema.optional(),
|
|
247
262
|
quote: z
|
|
248
263
|
.object({
|
|
249
264
|
rich_text: richText_schema_1.richTextSchema,
|
|
@@ -335,5 +350,5 @@ exports.blockSchema = z.object({
|
|
|
335
350
|
})
|
|
336
351
|
.optional(),
|
|
337
352
|
unsupported: z.object({}).optional(),
|
|
338
|
-
video:
|
|
353
|
+
video: mediaBlockContentSchema.optional(),
|
|
339
354
|
});
|
|
@@ -138,10 +138,23 @@ export declare const commentSchema: z.ZodObject<{
|
|
|
138
138
|
}, z.core.$strip>, z.ZodObject<{
|
|
139
139
|
type: z.ZodLiteral<"mention">;
|
|
140
140
|
mention: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
141
|
+
type: z.ZodLiteral<"custom_emoji">;
|
|
142
|
+
custom_emoji: z.ZodObject<{
|
|
143
|
+
id: z.ZodUUID;
|
|
144
|
+
name: z.ZodString;
|
|
145
|
+
url: z.ZodURL;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
141
148
|
type: z.ZodLiteral<"database">;
|
|
142
149
|
database: z.ZodObject<{
|
|
143
150
|
id: z.ZodUUID;
|
|
144
151
|
}, z.core.$strip>;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
type: z.ZodLiteral<"data_source">;
|
|
154
|
+
data_source: z.ZodObject<{
|
|
155
|
+
id: z.ZodUUID;
|
|
156
|
+
database_id: z.ZodOptional<z.ZodUUID>;
|
|
157
|
+
}, z.core.$strip>;
|
|
145
158
|
}, z.core.$strip>, z.ZodObject<{
|
|
146
159
|
type: z.ZodLiteral<"date">;
|
|
147
160
|
date: z.ZodObject<{
|
|
@@ -149,6 +162,11 @@ export declare const commentSchema: z.ZodObject<{
|
|
|
149
162
|
end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
|
|
150
163
|
time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
151
164
|
}, z.core.$strip>;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"link_mention">;
|
|
167
|
+
link_mention: z.ZodObject<{
|
|
168
|
+
href: z.ZodString;
|
|
169
|
+
}, z.core.$loose>;
|
|
152
170
|
}, z.core.$strip>, z.ZodObject<{
|
|
153
171
|
type: z.ZodLiteral<"link_preview">;
|
|
154
172
|
link_preview: z.ZodObject<{
|
|
@@ -446,10 +446,23 @@ export declare const dataSourceSchema: z.ZodObject<{
|
|
|
446
446
|
}, z.core.$strip>, z.ZodObject<{
|
|
447
447
|
type: z.ZodLiteral<"mention">;
|
|
448
448
|
mention: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
449
|
+
type: z.ZodLiteral<"custom_emoji">;
|
|
450
|
+
custom_emoji: z.ZodObject<{
|
|
451
|
+
id: z.ZodUUID;
|
|
452
|
+
name: z.ZodString;
|
|
453
|
+
url: z.ZodURL;
|
|
454
|
+
}, z.core.$strip>;
|
|
455
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
449
456
|
type: z.ZodLiteral<"database">;
|
|
450
457
|
database: z.ZodObject<{
|
|
451
458
|
id: z.ZodUUID;
|
|
452
459
|
}, z.core.$strip>;
|
|
460
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
461
|
+
type: z.ZodLiteral<"data_source">;
|
|
462
|
+
data_source: z.ZodObject<{
|
|
463
|
+
id: z.ZodUUID;
|
|
464
|
+
database_id: z.ZodOptional<z.ZodUUID>;
|
|
465
|
+
}, z.core.$strip>;
|
|
453
466
|
}, z.core.$strip>, z.ZodObject<{
|
|
454
467
|
type: z.ZodLiteral<"date">;
|
|
455
468
|
date: z.ZodObject<{
|
|
@@ -457,6 +470,11 @@ export declare const dataSourceSchema: z.ZodObject<{
|
|
|
457
470
|
end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
|
|
458
471
|
time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
459
472
|
}, z.core.$strip>;
|
|
473
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
474
|
+
type: z.ZodLiteral<"link_mention">;
|
|
475
|
+
link_mention: z.ZodObject<{
|
|
476
|
+
href: z.ZodString;
|
|
477
|
+
}, z.core.$loose>;
|
|
460
478
|
}, z.core.$strip>, z.ZodObject<{
|
|
461
479
|
type: z.ZodLiteral<"link_preview">;
|
|
462
480
|
link_preview: z.ZodObject<{
|
|
@@ -622,10 +640,23 @@ export declare const dataSourceSchema: z.ZodObject<{
|
|
|
622
640
|
}, z.core.$strip>, z.ZodObject<{
|
|
623
641
|
type: z.ZodLiteral<"mention">;
|
|
624
642
|
mention: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
643
|
+
type: z.ZodLiteral<"custom_emoji">;
|
|
644
|
+
custom_emoji: z.ZodObject<{
|
|
645
|
+
id: z.ZodUUID;
|
|
646
|
+
name: z.ZodString;
|
|
647
|
+
url: z.ZodURL;
|
|
648
|
+
}, z.core.$strip>;
|
|
649
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
625
650
|
type: z.ZodLiteral<"database">;
|
|
626
651
|
database: z.ZodObject<{
|
|
627
652
|
id: z.ZodUUID;
|
|
628
653
|
}, z.core.$strip>;
|
|
654
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
655
|
+
type: z.ZodLiteral<"data_source">;
|
|
656
|
+
data_source: z.ZodObject<{
|
|
657
|
+
id: z.ZodUUID;
|
|
658
|
+
database_id: z.ZodOptional<z.ZodUUID>;
|
|
659
|
+
}, z.core.$strip>;
|
|
629
660
|
}, z.core.$strip>, z.ZodObject<{
|
|
630
661
|
type: z.ZodLiteral<"date">;
|
|
631
662
|
date: z.ZodObject<{
|
|
@@ -633,6 +664,11 @@ export declare const dataSourceSchema: z.ZodObject<{
|
|
|
633
664
|
end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
|
|
634
665
|
time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
635
666
|
}, z.core.$strip>;
|
|
667
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
668
|
+
type: z.ZodLiteral<"link_mention">;
|
|
669
|
+
link_mention: z.ZodObject<{
|
|
670
|
+
href: z.ZodString;
|
|
671
|
+
}, z.core.$loose>;
|
|
636
672
|
}, z.core.$strip>, z.ZodObject<{
|
|
637
673
|
type: z.ZodLiteral<"link_preview">;
|
|
638
674
|
link_preview: z.ZodObject<{
|
|
@@ -152,10 +152,23 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
152
152
|
}, z.core.$strip>, z.ZodObject<{
|
|
153
153
|
type: z.ZodLiteral<"mention">;
|
|
154
154
|
mention: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
155
|
+
type: z.ZodLiteral<"custom_emoji">;
|
|
156
|
+
custom_emoji: z.ZodObject<{
|
|
157
|
+
id: z.ZodUUID;
|
|
158
|
+
name: z.ZodString;
|
|
159
|
+
url: z.ZodURL;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
155
162
|
type: z.ZodLiteral<"database">;
|
|
156
163
|
database: z.ZodObject<{
|
|
157
164
|
id: z.ZodUUID;
|
|
158
165
|
}, z.core.$strip>;
|
|
166
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
167
|
+
type: z.ZodLiteral<"data_source">;
|
|
168
|
+
data_source: z.ZodObject<{
|
|
169
|
+
id: z.ZodUUID;
|
|
170
|
+
database_id: z.ZodOptional<z.ZodUUID>;
|
|
171
|
+
}, z.core.$strip>;
|
|
159
172
|
}, z.core.$strip>, z.ZodObject<{
|
|
160
173
|
type: z.ZodLiteral<"date">;
|
|
161
174
|
date: z.ZodObject<{
|
|
@@ -163,6 +176,11 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
163
176
|
end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
|
|
164
177
|
time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
165
178
|
}, z.core.$strip>;
|
|
179
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
180
|
+
type: z.ZodLiteral<"link_mention">;
|
|
181
|
+
link_mention: z.ZodObject<{
|
|
182
|
+
href: z.ZodString;
|
|
183
|
+
}, z.core.$loose>;
|
|
166
184
|
}, z.core.$strip>, z.ZodObject<{
|
|
167
185
|
type: z.ZodLiteral<"link_preview">;
|
|
168
186
|
link_preview: z.ZodObject<{
|
|
@@ -328,10 +346,23 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
328
346
|
}, z.core.$strip>, z.ZodObject<{
|
|
329
347
|
type: z.ZodLiteral<"mention">;
|
|
330
348
|
mention: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
349
|
+
type: z.ZodLiteral<"custom_emoji">;
|
|
350
|
+
custom_emoji: z.ZodObject<{
|
|
351
|
+
id: z.ZodUUID;
|
|
352
|
+
name: z.ZodString;
|
|
353
|
+
url: z.ZodURL;
|
|
354
|
+
}, z.core.$strip>;
|
|
355
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
331
356
|
type: z.ZodLiteral<"database">;
|
|
332
357
|
database: z.ZodObject<{
|
|
333
358
|
id: z.ZodUUID;
|
|
334
359
|
}, z.core.$strip>;
|
|
360
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
361
|
+
type: z.ZodLiteral<"data_source">;
|
|
362
|
+
data_source: z.ZodObject<{
|
|
363
|
+
id: z.ZodUUID;
|
|
364
|
+
database_id: z.ZodOptional<z.ZodUUID>;
|
|
365
|
+
}, z.core.$strip>;
|
|
335
366
|
}, z.core.$strip>, z.ZodObject<{
|
|
336
367
|
type: z.ZodLiteral<"date">;
|
|
337
368
|
date: z.ZodObject<{
|
|
@@ -339,6 +370,11 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
339
370
|
end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
|
|
340
371
|
time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
341
372
|
}, z.core.$strip>;
|
|
373
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
374
|
+
type: z.ZodLiteral<"link_mention">;
|
|
375
|
+
link_mention: z.ZodObject<{
|
|
376
|
+
href: z.ZodString;
|
|
377
|
+
}, z.core.$loose>;
|
|
342
378
|
}, z.core.$strip>, z.ZodObject<{
|
|
343
379
|
type: z.ZodLiteral<"link_preview">;
|
|
344
380
|
link_preview: z.ZodObject<{
|