@visus-io/notion-sdk-ts 2.0.1 → 2.1.0
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 +25 -9
- package/dist/api/base.api.d.ts +1 -1
- package/dist/api/blocks.api.d.ts +260 -80
- package/dist/api/comments.api.d.ts +7 -7
- package/dist/api/dataSources.api.d.ts +12 -12
- package/dist/api/databases.api.d.ts +12 -12
- package/dist/api/fileUploads.api.d.ts +2 -2
- package/dist/api/pages.api.d.ts +29 -29
- package/dist/api/users.api.d.ts +1 -1
- package/dist/helpers/block.helpers.d.ts +4 -0
- package/dist/helpers/block.helpers.js +11 -0
- package/dist/models/base.model.d.ts +2 -2
- package/dist/schemas/block.schema.d.ts +261 -81
- package/dist/schemas/block.schema.js +157 -81
- 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 -13
- package/dist/schemas/dataSource.schema.js +46 -12
- package/dist/schemas/database.schema.d.ts +13 -13
- package/dist/schemas/database.schema.js +51 -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 -30
- package/dist/schemas/page.schema.js +47 -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 +3 -1
|
@@ -1,11 +1,45 @@
|
|
|
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.dataSourceSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const emoji_schema_1 = require("./emoji.schema");
|
|
6
39
|
const file_schema_1 = require("./file.schema");
|
|
7
40
|
const parent_schema_1 = require("./parent.schema");
|
|
8
41
|
const richText_schema_1 = require("./richText.schema");
|
|
42
|
+
const shared_schema_1 = require("./shared.schema");
|
|
9
43
|
const user_schema_1 = require("./user.schema");
|
|
10
44
|
const propertyObjects_schema_1 = require("./propertyObjects.schema");
|
|
11
45
|
/**
|
|
@@ -17,11 +51,11 @@ const propertyObjects_schema_1 = require("./propertyObjects.schema");
|
|
|
17
51
|
* Notion API reference:
|
|
18
52
|
* https://developers.notion.com/reference/data-source
|
|
19
53
|
*/
|
|
20
|
-
exports.dataSourceSchema =
|
|
54
|
+
exports.dataSourceSchema = z.object({
|
|
21
55
|
/** Always "data_source" */
|
|
22
|
-
object:
|
|
56
|
+
object: z.literal('data_source'),
|
|
23
57
|
/** Unique identifier for the data source */
|
|
24
|
-
id:
|
|
58
|
+
id: z.uuid(),
|
|
25
59
|
/** Schema of properties for the data source as they appear in Notion */
|
|
26
60
|
properties: propertyObjects_schema_1.propertiesObjectSchema,
|
|
27
61
|
/** Information about the data source's parent database */
|
|
@@ -29,11 +63,11 @@ exports.dataSourceSchema = zod_1.z.object({
|
|
|
29
63
|
/** Information about the database's parent (the data source's grandparent) */
|
|
30
64
|
database_parent: parent_schema_1.parentSchema,
|
|
31
65
|
/** Date and time when this data source was created (ISO 8601) */
|
|
32
|
-
created_time:
|
|
66
|
+
created_time: shared_schema_1.notionDateStringSchema,
|
|
33
67
|
/** User who created the data source */
|
|
34
68
|
created_by: user_schema_1.userSchema,
|
|
35
69
|
/** Date and time when this data source was updated (ISO 8601) */
|
|
36
|
-
last_edited_time:
|
|
70
|
+
last_edited_time: shared_schema_1.notionDateStringSchema,
|
|
37
71
|
/** User who last edited the data source */
|
|
38
72
|
last_edited_by: user_schema_1.userSchema,
|
|
39
73
|
/** Name of the data source as it appears in Notion */
|
|
@@ -41,17 +75,17 @@ exports.dataSourceSchema = zod_1.z.object({
|
|
|
41
75
|
/** Description of the data source as it appears in Notion */
|
|
42
76
|
description: richText_schema_1.richTextSchema,
|
|
43
77
|
/** Data source icon (File or Emoji object) */
|
|
44
|
-
icon:
|
|
78
|
+
icon: z.union([file_schema_1.fileSchema, emoji_schema_1.emojiSchema]).nullable(),
|
|
45
79
|
/** Data source cover image */
|
|
46
80
|
cover: file_schema_1.fileSchema.nullable(),
|
|
47
81
|
/** The Notion URL of the data source */
|
|
48
|
-
url:
|
|
82
|
+
url: z.url(),
|
|
49
83
|
/** The public URL if published, otherwise null */
|
|
50
|
-
public_url:
|
|
84
|
+
public_url: z.union([z.url(), z.null()]),
|
|
51
85
|
/** Whether the data source is inline */
|
|
52
|
-
is_inline:
|
|
86
|
+
is_inline: z.boolean(),
|
|
53
87
|
/** The archived status of the data source */
|
|
54
|
-
archived:
|
|
88
|
+
archived: z.boolean(),
|
|
55
89
|
/** Whether the data source has been deleted */
|
|
56
|
-
in_trash:
|
|
90
|
+
in_trash: z.boolean(),
|
|
57
91
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Notion database object schema.
|
|
4
4
|
*
|
|
@@ -21,7 +21,7 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
21
21
|
id: z.ZodUUID;
|
|
22
22
|
name: z.ZodString;
|
|
23
23
|
}, z.core.$strip>>;
|
|
24
|
-
created_time: z.ZodISODateTime
|
|
24
|
+
created_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
25
25
|
created_by: z.ZodUnion<readonly [z.ZodObject<{
|
|
26
26
|
object: z.ZodLiteral<"user">;
|
|
27
27
|
id: z.ZodUUID;
|
|
@@ -47,14 +47,14 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
47
47
|
workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
48
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
49
49
|
workspace_limits: z.ZodOptional<z.ZodObject<{
|
|
50
|
-
max_file_upload_size_in_bytes: z.
|
|
50
|
+
max_file_upload_size_in_bytes: z.ZodInt;
|
|
51
51
|
}, z.core.$strip>>;
|
|
52
52
|
}, z.core.$strip>;
|
|
53
53
|
}, z.core.$strip>, z.ZodObject<{
|
|
54
54
|
object: z.ZodLiteral<"user">;
|
|
55
55
|
id: z.ZodUUID;
|
|
56
56
|
}, z.core.$strip>]>;
|
|
57
|
-
last_edited_time: z.ZodISODateTime
|
|
57
|
+
last_edited_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
58
58
|
last_edited_by: z.ZodUnion<readonly [z.ZodObject<{
|
|
59
59
|
object: z.ZodLiteral<"user">;
|
|
60
60
|
id: z.ZodUUID;
|
|
@@ -80,7 +80,7 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
80
80
|
workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
81
81
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
82
82
|
workspace_limits: z.ZodOptional<z.ZodObject<{
|
|
83
|
-
max_file_upload_size_in_bytes: z.
|
|
83
|
+
max_file_upload_size_in_bytes: z.ZodInt;
|
|
84
84
|
}, z.core.$strip>>;
|
|
85
85
|
}, z.core.$strip>;
|
|
86
86
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -135,8 +135,8 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
135
135
|
}, z.core.$strip>, z.ZodObject<{
|
|
136
136
|
type: z.ZodLiteral<"date">;
|
|
137
137
|
date: z.ZodObject<{
|
|
138
|
-
start: z.
|
|
139
|
-
end: z.ZodNullable<z.
|
|
138
|
+
start: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
139
|
+
end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
|
|
140
140
|
time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
141
|
}, z.core.$strip>;
|
|
142
142
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -188,7 +188,7 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
188
188
|
workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
189
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
190
190
|
workspace_limits: z.ZodOptional<z.ZodObject<{
|
|
191
|
-
max_file_upload_size_in_bytes: z.
|
|
191
|
+
max_file_upload_size_in_bytes: z.ZodInt;
|
|
192
192
|
}, z.core.$strip>>;
|
|
193
193
|
}, z.core.$strip>;
|
|
194
194
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -310,8 +310,8 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
310
310
|
}, z.core.$strip>, z.ZodObject<{
|
|
311
311
|
type: z.ZodLiteral<"date">;
|
|
312
312
|
date: z.ZodObject<{
|
|
313
|
-
start: z.
|
|
314
|
-
end: z.ZodNullable<z.
|
|
313
|
+
start: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
314
|
+
end: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
|
|
315
315
|
time_zone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
316
316
|
}, z.core.$strip>;
|
|
317
317
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -363,7 +363,7 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
363
363
|
workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
364
364
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
365
365
|
workspace_limits: z.ZodOptional<z.ZodObject<{
|
|
366
|
-
max_file_upload_size_in_bytes: z.
|
|
366
|
+
max_file_upload_size_in_bytes: z.ZodInt;
|
|
367
367
|
}, z.core.$strip>>;
|
|
368
368
|
}, z.core.$strip>;
|
|
369
369
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -441,7 +441,7 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
441
441
|
type: z.ZodLiteral<"file">;
|
|
442
442
|
file: z.ZodObject<{
|
|
443
443
|
url: z.ZodURL;
|
|
444
|
-
expiry_time: z.ZodISODateTime
|
|
444
|
+
expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
445
445
|
}, z.core.$strip>;
|
|
446
446
|
}, z.core.$strip>, z.ZodObject<{
|
|
447
447
|
type: z.ZodLiteral<"file_upload">;
|
|
@@ -461,7 +461,7 @@ export declare const databaseSchema: z.ZodObject<{
|
|
|
461
461
|
type: z.ZodLiteral<"file">;
|
|
462
462
|
file: z.ZodObject<{
|
|
463
463
|
url: z.ZodURL;
|
|
464
|
-
expiry_time: z.ZodISODateTime
|
|
464
|
+
expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
465
465
|
}, z.core.$strip>;
|
|
466
466
|
}, z.core.$strip>, z.ZodObject<{
|
|
467
467
|
type: z.ZodLiteral<"file_upload">;
|
|
@@ -1,11 +1,45 @@
|
|
|
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.databaseSchema = exports.dataSourceRefSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const emoji_schema_1 = require("./emoji.schema");
|
|
6
39
|
const file_schema_1 = require("./file.schema");
|
|
7
40
|
const parent_schema_1 = require("./parent.schema");
|
|
8
41
|
const richText_schema_1 = require("./richText.schema");
|
|
42
|
+
const shared_schema_1 = require("./shared.schema");
|
|
9
43
|
const user_schema_1 = require("./user.schema");
|
|
10
44
|
/**
|
|
11
45
|
* Notion database object schema.
|
|
@@ -17,26 +51,26 @@ const user_schema_1 = require("./user.schema");
|
|
|
17
51
|
* https://developers.notion.com/reference/database
|
|
18
52
|
*/
|
|
19
53
|
/** Data source reference with id and name. */
|
|
20
|
-
exports.dataSourceRefSchema =
|
|
21
|
-
id:
|
|
22
|
-
name:
|
|
54
|
+
exports.dataSourceRefSchema = z.object({
|
|
55
|
+
id: z.uuid(),
|
|
56
|
+
name: z.string().trim(),
|
|
23
57
|
});
|
|
24
|
-
exports.databaseSchema =
|
|
25
|
-
object:
|
|
26
|
-
id:
|
|
27
|
-
data_sources:
|
|
28
|
-
created_time:
|
|
58
|
+
exports.databaseSchema = z.object({
|
|
59
|
+
object: z.literal('database'),
|
|
60
|
+
id: z.uuid(),
|
|
61
|
+
data_sources: z.array(exports.dataSourceRefSchema),
|
|
62
|
+
created_time: shared_schema_1.notionDateStringSchema,
|
|
29
63
|
created_by: user_schema_1.userSchema,
|
|
30
|
-
last_edited_time:
|
|
64
|
+
last_edited_time: shared_schema_1.notionDateStringSchema,
|
|
31
65
|
last_edited_by: user_schema_1.userSchema,
|
|
32
66
|
title: richText_schema_1.richTextSchema,
|
|
33
67
|
description: richText_schema_1.richTextSchema,
|
|
34
|
-
icon:
|
|
35
|
-
cover:
|
|
68
|
+
icon: z.nullable(z.union([file_schema_1.fileSchema, emoji_schema_1.emojiSchema])),
|
|
69
|
+
cover: z.nullable(file_schema_1.fileSchema),
|
|
36
70
|
parent: parent_schema_1.parentSchema,
|
|
37
|
-
url:
|
|
38
|
-
archived:
|
|
39
|
-
in_trash:
|
|
40
|
-
is_inline:
|
|
41
|
-
public_url:
|
|
71
|
+
url: z.url(),
|
|
72
|
+
archived: z.boolean(),
|
|
73
|
+
in_trash: z.boolean(),
|
|
74
|
+
is_inline: z.boolean(),
|
|
75
|
+
public_url: z.nullable(z.url()),
|
|
42
76
|
});
|
|
@@ -1,7 +1,40 @@
|
|
|
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.emojiSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
/**
|
|
6
39
|
* Notion emoji object schema.
|
|
7
40
|
*
|
|
@@ -11,7 +44,7 @@ const zod_1 = require("zod");
|
|
|
11
44
|
* Notion API reference:
|
|
12
45
|
* https://developers.notion.com/reference/emoji-object
|
|
13
46
|
*/
|
|
14
|
-
exports.emojiSchema =
|
|
15
|
-
type:
|
|
16
|
-
emoji:
|
|
47
|
+
exports.emojiSchema = z.object({
|
|
48
|
+
type: z.literal('emoji'),
|
|
49
|
+
emoji: z.string().trim(),
|
|
17
50
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Notion file object schemas.
|
|
4
4
|
*
|
|
@@ -13,7 +13,7 @@ declare const notionFileSchema: z.ZodObject<{
|
|
|
13
13
|
type: z.ZodLiteral<"file">;
|
|
14
14
|
file: z.ZodObject<{
|
|
15
15
|
url: z.ZodURL;
|
|
16
|
-
expiry_time: z.ZodISODateTime
|
|
16
|
+
expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
19
|
/** API-uploaded file. */
|
|
@@ -34,7 +34,7 @@ export declare const fileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
34
34
|
type: z.ZodLiteral<"file">;
|
|
35
35
|
file: z.ZodObject<{
|
|
36
36
|
url: z.ZodURL;
|
|
37
|
-
expiry_time: z.ZodISODateTime
|
|
37
|
+
expiry_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
}, z.core.$strip>, z.ZodObject<{
|
|
40
40
|
type: z.ZodLiteral<"file_upload">;
|
|
@@ -1,7 +1,41 @@
|
|
|
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.fileSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
const shared_schema_1 = require("./shared.schema");
|
|
5
39
|
/**
|
|
6
40
|
* Notion file object schemas.
|
|
7
41
|
*
|
|
@@ -12,28 +46,28 @@ const zod_1 = require("zod");
|
|
|
12
46
|
* https://developers.notion.com/reference/file-object
|
|
13
47
|
*/
|
|
14
48
|
/** Notion-hosted file. */
|
|
15
|
-
const notionFileSchema =
|
|
16
|
-
type:
|
|
17
|
-
file:
|
|
18
|
-
url:
|
|
19
|
-
expiry_time:
|
|
49
|
+
const notionFileSchema = z.object({
|
|
50
|
+
type: z.literal('file'),
|
|
51
|
+
file: z.object({
|
|
52
|
+
url: z.url(),
|
|
53
|
+
expiry_time: shared_schema_1.notionDateStringSchema,
|
|
20
54
|
}),
|
|
21
55
|
});
|
|
22
56
|
/** API-uploaded file. */
|
|
23
|
-
const fileUploadSchema =
|
|
24
|
-
type:
|
|
25
|
-
file_upload:
|
|
26
|
-
id:
|
|
57
|
+
const fileUploadSchema = z.object({
|
|
58
|
+
type: z.literal('file_upload'),
|
|
59
|
+
file_upload: z.object({
|
|
60
|
+
id: z.uuid(),
|
|
27
61
|
}),
|
|
28
62
|
});
|
|
29
63
|
/** Externally hosted file. */
|
|
30
|
-
const externalFileSchema =
|
|
31
|
-
type:
|
|
32
|
-
external:
|
|
33
|
-
url:
|
|
64
|
+
const externalFileSchema = z.object({
|
|
65
|
+
type: z.literal('external'),
|
|
66
|
+
external: z.object({
|
|
67
|
+
url: z.url(),
|
|
34
68
|
}),
|
|
35
69
|
});
|
|
36
|
-
exports.fileSchema =
|
|
70
|
+
exports.fileSchema = z.discriminatedUnion('type', [
|
|
37
71
|
notionFileSchema,
|
|
38
72
|
fileUploadSchema,
|
|
39
73
|
externalFileSchema,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Notion file upload object schema.
|
|
4
4
|
*
|
|
@@ -11,8 +11,8 @@ import { z } from 'zod';
|
|
|
11
11
|
export declare const fileUploadSchema: z.ZodObject<{
|
|
12
12
|
object: z.ZodLiteral<"file_upload">;
|
|
13
13
|
id: z.ZodUUID;
|
|
14
|
-
created_time: z.ZodISODateTime
|
|
15
|
-
expiry_time: z.ZodNullable<z.ZodISODateTime
|
|
14
|
+
created_time: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
15
|
+
expiry_time: z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
|
|
16
16
|
status: z.ZodEnum<{
|
|
17
17
|
pending: "pending";
|
|
18
18
|
uploaded: "uploaded";
|
|
@@ -1,7 +1,41 @@
|
|
|
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.fileUploadSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
const shared_schema_1 = require("./shared.schema");
|
|
5
39
|
/**
|
|
6
40
|
* Notion file upload object schema.
|
|
7
41
|
*
|
|
@@ -11,16 +45,16 @@ const zod_1 = require("zod");
|
|
|
11
45
|
* Notion API reference:
|
|
12
46
|
* https://developers.notion.com/reference/file-upload-object
|
|
13
47
|
*/
|
|
14
|
-
exports.fileUploadSchema =
|
|
15
|
-
object:
|
|
16
|
-
id:
|
|
17
|
-
created_time:
|
|
18
|
-
expiry_time:
|
|
19
|
-
status:
|
|
20
|
-
filename:
|
|
21
|
-
content_type:
|
|
22
|
-
content_length:
|
|
23
|
-
upload_url:
|
|
24
|
-
complete_url:
|
|
25
|
-
file_import_result:
|
|
48
|
+
exports.fileUploadSchema = z.object({
|
|
49
|
+
object: z.literal('file_upload'),
|
|
50
|
+
id: z.uuid(),
|
|
51
|
+
created_time: shared_schema_1.notionDateStringSchema,
|
|
52
|
+
expiry_time: shared_schema_1.notionDateStringSchema.nullable(),
|
|
53
|
+
status: z.enum(['pending', 'uploaded', 'expired', 'failed']),
|
|
54
|
+
filename: z.string().trim(),
|
|
55
|
+
content_type: z.string().trim().nullable(),
|
|
56
|
+
content_length: z.number().nullable(),
|
|
57
|
+
upload_url: z.string().trim(),
|
|
58
|
+
complete_url: z.string().trim(),
|
|
59
|
+
file_import_result: z.string().trim(),
|
|
26
60
|
});
|
package/dist/schemas/index.d.ts
CHANGED
package/dist/schemas/index.js
CHANGED
|
@@ -29,4 +29,5 @@ __exportStar(require("./propertyObjects.schema"), exports);
|
|
|
29
29
|
__exportStar(require("./pagination.schema"), exports);
|
|
30
30
|
__exportStar(require("./parent.schema"), exports);
|
|
31
31
|
__exportStar(require("./richText.schema"), exports);
|
|
32
|
+
__exportStar(require("./shared.schema"), exports);
|
|
32
33
|
__exportStar(require("./user.schema"), exports);
|