@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.
- package/README.md +66 -23
- package/dist/api/base.api.d.ts +1 -1
- package/dist/api/blocks.api.d.ts +266 -87
- package/dist/api/comments.api.d.ts +7 -7
- package/dist/api/dataSources.api.d.ts +28 -31
- package/dist/api/dataSources.api.js +18 -19
- package/dist/api/databases.api.d.ts +27 -22
- package/dist/api/databases.api.js +18 -8
- package/dist/api/fileUploads.api.d.ts +2 -2
- package/dist/api/pages.api.d.ts +43 -38
- package/dist/api/pages.api.js +18 -8
- package/dist/api/users.api.d.ts +1 -1
- package/dist/client.d.ts +5 -3
- package/dist/client.js +7 -3
- package/dist/helpers/block.helpers.d.ts +4 -0
- package/dist/helpers/block.helpers.js +11 -0
- package/dist/helpers/parent.helpers.d.ts +2 -2
- package/dist/helpers/parent.helpers.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/models/base.model.d.ts +2 -2
- package/dist/models/block.model.d.ts +0 -1
- package/dist/models/block.model.js +0 -3
- package/dist/models/dataSource.model.d.ts +0 -4
- package/dist/models/dataSource.model.js +0 -6
- package/dist/models/database.model.d.ts +0 -4
- package/dist/models/database.model.js +0 -6
- package/dist/models/page.model.d.ts +0 -1
- package/dist/models/page.model.js +0 -3
- package/dist/schemas/block.schema.d.ts +275 -82
- package/dist/schemas/block.schema.js +165 -82
- package/dist/schemas/comment.schema.d.ts +9 -9
- package/dist/schemas/comment.schema.js +54 -20
- package/dist/schemas/dataSource.schema.d.ts +13 -14
- package/dist/schemas/dataSource.schema.js +46 -14
- package/dist/schemas/database.schema.d.ts +13 -14
- package/dist/schemas/database.schema.js +50 -17
- package/dist/schemas/emoji.schema.d.ts +1 -1
- package/dist/schemas/emoji.schema.js +37 -4
- package/dist/schemas/file.schema.d.ts +3 -3
- package/dist/schemas/file.schema.js +49 -15
- package/dist/schemas/fileUpload.schema.d.ts +3 -3
- package/dist/schemas/fileUpload.schema.js +47 -13
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/page.schema.d.ts +30 -31
- package/dist/schemas/page.schema.js +46 -13
- package/dist/schemas/pageProperties.schema.d.ts +47 -47
- package/dist/schemas/pageProperties.schema.js +162 -128
- package/dist/schemas/pagination.schema.d.ts +1 -1
- package/dist/schemas/pagination.schema.js +40 -7
- package/dist/schemas/parent.schema.d.ts +1 -1
- package/dist/schemas/parent.schema.js +51 -18
- package/dist/schemas/propertyObjects.schema.d.ts +1 -1
- package/dist/schemas/propertyObjects.schema.js +194 -161
- package/dist/schemas/richText.schema.d.ts +7 -7
- package/dist/schemas/richText.schema.js +95 -56
- package/dist/schemas/shared.schema.d.ts +15 -0
- package/dist/schemas/shared.schema.js +54 -0
- package/dist/schemas/user.schema.d.ts +3 -3
- package/dist/schemas/user.schema.js +63 -30
- 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
|
|
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
|
-
|
|
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:
|
|
24
|
-
is_toggleable:
|
|
25
|
-
children
|
|
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 =
|
|
28
|
-
object:
|
|
29
|
-
id:
|
|
76
|
+
exports.blockSchema = z.object({
|
|
77
|
+
object: z.literal('block'),
|
|
78
|
+
id: z.uuid(),
|
|
30
79
|
parent: parent_schema_1.parentSchema,
|
|
31
|
-
type:
|
|
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:
|
|
115
|
+
created_time: shared_schema_1.notionDateStringSchema,
|
|
66
116
|
created_by: user_schema_1.userSchema,
|
|
67
|
-
last_edited_time:
|
|
117
|
+
last_edited_time: shared_schema_1.notionDateStringSchema,
|
|
68
118
|
last_edited_by: user_schema_1.userSchema,
|
|
69
|
-
|
|
70
|
-
|
|
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:
|
|
123
|
+
bookmark: z
|
|
75
124
|
.object({
|
|
76
125
|
caption: richText_schema_1.richTextSchema,
|
|
77
|
-
url:
|
|
126
|
+
url: z.url(),
|
|
78
127
|
})
|
|
79
128
|
.optional(),
|
|
80
|
-
breadcrumb:
|
|
81
|
-
bulleted_list_item:
|
|
129
|
+
breadcrumb: z.object({}).optional(),
|
|
130
|
+
bulleted_list_item: z
|
|
82
131
|
.object({
|
|
83
132
|
rich_text: richText_schema_1.richTextSchema,
|
|
84
|
-
color:
|
|
85
|
-
children
|
|
133
|
+
color: z.enum(colors_1.NOTION_COLORS),
|
|
134
|
+
get children() {
|
|
135
|
+
return getChildrenSchema();
|
|
136
|
+
},
|
|
86
137
|
})
|
|
87
138
|
.optional(),
|
|
88
|
-
callout:
|
|
139
|
+
callout: z
|
|
89
140
|
.object({
|
|
90
141
|
rich_text: richText_schema_1.richTextSchema,
|
|
91
|
-
icon:
|
|
92
|
-
color:
|
|
93
|
-
children
|
|
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:
|
|
149
|
+
child_database: z
|
|
97
150
|
.object({
|
|
98
|
-
title:
|
|
151
|
+
title: z.string().trim(),
|
|
99
152
|
})
|
|
100
153
|
.optional(),
|
|
101
|
-
child_page:
|
|
154
|
+
child_page: z
|
|
102
155
|
.object({
|
|
103
|
-
title:
|
|
156
|
+
title: z.string().trim(),
|
|
104
157
|
})
|
|
105
158
|
.optional(),
|
|
106
|
-
code:
|
|
159
|
+
code: z
|
|
107
160
|
.object({
|
|
108
161
|
caption: richText_schema_1.richTextSchema,
|
|
109
162
|
rich_text: richText_schema_1.richTextSchema,
|
|
110
|
-
language:
|
|
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
|
-
|
|
114
|
-
|
|
175
|
+
divider: z.object({}).optional(),
|
|
176
|
+
embed: z
|
|
115
177
|
.object({
|
|
116
|
-
|
|
117
|
-
children: zod_1.z.array(zod_1.z.any()).optional(),
|
|
178
|
+
url: z.url(),
|
|
118
179
|
})
|
|
119
180
|
.optional(),
|
|
120
|
-
|
|
121
|
-
embed: zod_1.z
|
|
181
|
+
equation: z
|
|
122
182
|
.object({
|
|
123
|
-
|
|
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
|
-
|
|
127
|
-
file: zod_1.z
|
|
187
|
+
file: z
|
|
128
188
|
.object({
|
|
129
189
|
caption: richText_schema_1.richTextSchema,
|
|
130
|
-
type:
|
|
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:
|
|
194
|
+
name: z.string().trim().optional(),
|
|
135
195
|
})
|
|
136
196
|
.optional(),
|
|
137
|
-
heading_1:
|
|
138
|
-
heading_2:
|
|
139
|
-
heading_3:
|
|
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:
|
|
142
|
-
numbered_list_item:
|
|
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:
|
|
146
|
-
list_start_index:
|
|
147
|
-
list_format:
|
|
148
|
-
children
|
|
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:
|
|
213
|
+
paragraph: z
|
|
152
214
|
.object({
|
|
153
215
|
rich_text: richText_schema_1.richTextSchema,
|
|
154
|
-
color:
|
|
155
|
-
children
|
|
216
|
+
color: z.enum(colors_1.NOTION_COLORS),
|
|
217
|
+
get children() {
|
|
218
|
+
return getChildrenSchema();
|
|
219
|
+
},
|
|
156
220
|
})
|
|
157
221
|
.optional(),
|
|
158
|
-
pdf:
|
|
222
|
+
pdf: z
|
|
159
223
|
.object({
|
|
160
224
|
caption: richText_schema_1.richTextSchema,
|
|
161
|
-
type:
|
|
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:
|
|
229
|
+
name: z.string().trim().optional(),
|
|
166
230
|
})
|
|
167
231
|
.optional(),
|
|
168
|
-
quote:
|
|
232
|
+
quote: z
|
|
169
233
|
.object({
|
|
170
234
|
rich_text: richText_schema_1.richTextSchema,
|
|
171
|
-
color:
|
|
172
|
-
children
|
|
235
|
+
color: z.enum(colors_1.NOTION_COLORS),
|
|
236
|
+
get children() {
|
|
237
|
+
return getChildrenSchema();
|
|
238
|
+
},
|
|
173
239
|
})
|
|
174
240
|
.optional(),
|
|
175
|
-
synced_block:
|
|
241
|
+
synced_block: z
|
|
176
242
|
.object({
|
|
177
|
-
synced_from:
|
|
243
|
+
synced_from: z
|
|
178
244
|
.object({
|
|
179
|
-
type:
|
|
180
|
-
block_id:
|
|
245
|
+
type: z.literal('block_id'),
|
|
246
|
+
block_id: z.uuid(),
|
|
181
247
|
})
|
|
182
248
|
.nullable(),
|
|
183
|
-
children
|
|
249
|
+
get children() {
|
|
250
|
+
return getChildrenSchema();
|
|
251
|
+
},
|
|
184
252
|
})
|
|
185
253
|
.optional(),
|
|
186
|
-
table:
|
|
254
|
+
table: z
|
|
187
255
|
.object({
|
|
188
|
-
table_width:
|
|
189
|
-
has_column_header:
|
|
190
|
-
has_row_header:
|
|
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:
|
|
261
|
+
table_of_contents: z
|
|
194
262
|
.object({
|
|
195
|
-
color:
|
|
263
|
+
color: z.enum(colors_1.NOTION_COLORS),
|
|
196
264
|
})
|
|
197
265
|
.optional(),
|
|
198
|
-
table_row:
|
|
266
|
+
table_row: z
|
|
199
267
|
.object({
|
|
200
|
-
cells:
|
|
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
|
-
|
|
279
|
+
to_do: z
|
|
204
280
|
.object({
|
|
205
281
|
rich_text: richText_schema_1.richTextSchema,
|
|
206
|
-
|
|
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
|
-
|
|
289
|
+
toggle: z
|
|
210
290
|
.object({
|
|
211
291
|
rich_text: richText_schema_1.richTextSchema,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
292
|
+
color: z.enum(colors_1.NOTION_COLORS),
|
|
293
|
+
get children() {
|
|
294
|
+
return getChildrenSchema();
|
|
295
|
+
},
|
|
215
296
|
})
|
|
216
297
|
.optional(),
|
|
217
|
-
|
|
298
|
+
meeting_notes: z
|
|
218
299
|
.object({
|
|
219
300
|
rich_text: richText_schema_1.richTextSchema,
|
|
220
|
-
|
|
221
|
-
|
|
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
|
|
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.
|
|
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.
|
|
130
|
-
end: z.ZodNullable<z.
|
|
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.
|
|
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
|
|
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 =
|
|
19
|
-
url:
|
|
20
|
-
expiry_time:
|
|
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 =
|
|
24
|
-
category:
|
|
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 =
|
|
29
|
-
|
|
30
|
-
type:
|
|
31
|
-
resolved_name:
|
|
62
|
+
exports.commentDisplayNameSchema = z.union([
|
|
63
|
+
z.object({
|
|
64
|
+
type: z.literal('user'),
|
|
65
|
+
resolved_name: z.string().trim(),
|
|
32
66
|
}),
|
|
33
|
-
|
|
34
|
-
type:
|
|
35
|
-
resolved_name:
|
|
67
|
+
z.object({
|
|
68
|
+
type: z.literal('custom'),
|
|
69
|
+
resolved_name: z.string().trim(),
|
|
36
70
|
}),
|
|
37
71
|
]);
|
|
38
|
-
exports.commentSchema =
|
|
39
|
-
object:
|
|
40
|
-
id:
|
|
72
|
+
exports.commentSchema = z.object({
|
|
73
|
+
object: z.literal('comment'),
|
|
74
|
+
id: z.uuid(),
|
|
41
75
|
parent: parent_schema_1.parentSchema,
|
|
42
|
-
discussion_id:
|
|
43
|
-
created_time:
|
|
76
|
+
discussion_id: z.uuid(),
|
|
77
|
+
created_time: shared_schema_1.notionDateStringSchema,
|
|
44
78
|
created_by: user_schema_1.userSchema,
|
|
45
|
-
last_edited_time:
|
|
79
|
+
last_edited_time: shared_schema_1.notionDateStringSchema,
|
|
46
80
|
rich_text: richText_schema_1.richTextSchema,
|
|
47
|
-
attachments:
|
|
81
|
+
attachments: z.array(exports.commentAttachmentSchema).optional(),
|
|
48
82
|
display_name: exports.commentDisplayNameSchema.optional(),
|
|
49
83
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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.
|
|
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.
|
|
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.
|
|
447
|
-
end: z.ZodNullable<z.
|
|
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.
|
|
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.
|
|
622
|
-
end: z.ZodNullable<z.
|
|
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.
|
|
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>;
|