@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,8 +1,42 @@
|
|
|
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.richTextSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const colors_1 = require("./colors");
|
|
39
|
+
const shared_schema_1 = require("./shared.schema");
|
|
6
40
|
const user_schema_1 = require("./user.schema");
|
|
7
41
|
/**
|
|
8
42
|
* Notion rich text object schema.
|
|
@@ -15,66 +49,67 @@ const user_schema_1 = require("./user.schema");
|
|
|
15
49
|
* https://developers.notion.com/reference/rich-text
|
|
16
50
|
*/
|
|
17
51
|
/** Annotations for rich text. */
|
|
18
|
-
const annotationsSchema =
|
|
19
|
-
bold:
|
|
20
|
-
italic:
|
|
21
|
-
strikethrough:
|
|
22
|
-
underline:
|
|
23
|
-
code:
|
|
24
|
-
color:
|
|
52
|
+
const annotationsSchema = z.object({
|
|
53
|
+
bold: z.boolean(),
|
|
54
|
+
italic: z.boolean(),
|
|
55
|
+
strikethrough: z.boolean(),
|
|
56
|
+
underline: z.boolean(),
|
|
57
|
+
code: z.boolean(),
|
|
58
|
+
color: z.enum(colors_1.NOTION_COLORS),
|
|
25
59
|
});
|
|
26
60
|
/** Text content with optional link. */
|
|
27
|
-
const textContentSchema =
|
|
28
|
-
content
|
|
29
|
-
|
|
61
|
+
const textContentSchema = z.object({
|
|
62
|
+
// eslint-disable-next-line zod/prefer-string-schema-with-trim -- content must preserve whitespace from Notion API
|
|
63
|
+
content: z.string(),
|
|
64
|
+
link: z.object({ url: z.url() }).nullable(),
|
|
30
65
|
});
|
|
31
66
|
/** Mention types. */
|
|
32
|
-
const databaseMentionSchema =
|
|
33
|
-
type:
|
|
34
|
-
database:
|
|
35
|
-
id:
|
|
67
|
+
const databaseMentionSchema = z.object({
|
|
68
|
+
type: z.literal('database'),
|
|
69
|
+
database: z.object({
|
|
70
|
+
id: z.uuid(),
|
|
36
71
|
}),
|
|
37
72
|
});
|
|
38
|
-
const dateMentionSchema =
|
|
39
|
-
type:
|
|
40
|
-
date:
|
|
41
|
-
start:
|
|
42
|
-
end:
|
|
43
|
-
time_zone:
|
|
73
|
+
const dateMentionSchema = z.object({
|
|
74
|
+
type: z.literal('date'),
|
|
75
|
+
date: z.object({
|
|
76
|
+
start: shared_schema_1.notionDateStringSchema,
|
|
77
|
+
end: shared_schema_1.notionDateStringSchema.nullable(),
|
|
78
|
+
time_zone: z.string().trim().nullable().optional(),
|
|
44
79
|
}),
|
|
45
80
|
});
|
|
46
|
-
const linkPreviewMentionSchema =
|
|
47
|
-
type:
|
|
48
|
-
link_preview:
|
|
49
|
-
url:
|
|
81
|
+
const linkPreviewMentionSchema = z.object({
|
|
82
|
+
type: z.literal('link_preview'),
|
|
83
|
+
link_preview: z.object({
|
|
84
|
+
url: z.url(),
|
|
50
85
|
}),
|
|
51
86
|
});
|
|
52
|
-
const pageMentionSchema =
|
|
53
|
-
type:
|
|
54
|
-
page:
|
|
55
|
-
id:
|
|
87
|
+
const pageMentionSchema = z.object({
|
|
88
|
+
type: z.literal('page'),
|
|
89
|
+
page: z.object({
|
|
90
|
+
id: z.uuid(),
|
|
56
91
|
}),
|
|
57
92
|
});
|
|
58
|
-
const templateMentionDateSchema =
|
|
59
|
-
type:
|
|
60
|
-
template_mention_date:
|
|
93
|
+
const templateMentionDateSchema = z.object({
|
|
94
|
+
type: z.literal('template_mention_date'),
|
|
95
|
+
template_mention_date: z.enum(['today', 'now']),
|
|
61
96
|
});
|
|
62
|
-
const templateMentionUserSchema =
|
|
63
|
-
type:
|
|
64
|
-
template_mention_user:
|
|
97
|
+
const templateMentionUserSchema = z.object({
|
|
98
|
+
type: z.literal('template_mention_user'),
|
|
99
|
+
template_mention_user: z.literal('me'),
|
|
65
100
|
});
|
|
66
|
-
const templateMentionSchema =
|
|
67
|
-
type:
|
|
68
|
-
template_mention:
|
|
101
|
+
const templateMentionSchema = z.object({
|
|
102
|
+
type: z.literal('template_mention'),
|
|
103
|
+
template_mention: z.discriminatedUnion('type', [
|
|
69
104
|
templateMentionDateSchema,
|
|
70
105
|
templateMentionUserSchema,
|
|
71
106
|
]),
|
|
72
107
|
});
|
|
73
|
-
const userMentionSchema =
|
|
74
|
-
type:
|
|
108
|
+
const userMentionSchema = z.object({
|
|
109
|
+
type: z.literal('user'),
|
|
75
110
|
user: user_schema_1.userSchema,
|
|
76
111
|
});
|
|
77
|
-
const mentionSchema =
|
|
112
|
+
const mentionSchema = z.discriminatedUnion('type', [
|
|
78
113
|
databaseMentionSchema,
|
|
79
114
|
dateMentionSchema,
|
|
80
115
|
linkPreviewMentionSchema,
|
|
@@ -83,29 +118,33 @@ const mentionSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
83
118
|
userMentionSchema,
|
|
84
119
|
]);
|
|
85
120
|
/** Text rich text type. */
|
|
86
|
-
const textRichTextSchema =
|
|
87
|
-
type:
|
|
121
|
+
const textRichTextSchema = z.object({
|
|
122
|
+
type: z.literal('text'),
|
|
88
123
|
text: textContentSchema,
|
|
89
124
|
annotations: annotationsSchema,
|
|
90
|
-
plain_text
|
|
91
|
-
|
|
125
|
+
// eslint-disable-next-line zod/prefer-string-schema-with-trim -- plain_text must preserve whitespace from Notion API
|
|
126
|
+
plain_text: z.string(),
|
|
127
|
+
href: z.url().nullable(),
|
|
92
128
|
});
|
|
93
129
|
/** Mention rich text type. */
|
|
94
|
-
const mentionRichTextSchema =
|
|
95
|
-
type:
|
|
130
|
+
const mentionRichTextSchema = z.object({
|
|
131
|
+
type: z.literal('mention'),
|
|
96
132
|
mention: mentionSchema,
|
|
97
133
|
annotations: annotationsSchema,
|
|
98
|
-
plain_text
|
|
99
|
-
|
|
134
|
+
// eslint-disable-next-line zod/prefer-string-schema-with-trim -- plain_text must preserve whitespace from Notion API
|
|
135
|
+
plain_text: z.string(),
|
|
136
|
+
href: z.url().nullable(),
|
|
100
137
|
});
|
|
101
138
|
/** Equation rich text type. */
|
|
102
|
-
const equationRichTextSchema =
|
|
103
|
-
type:
|
|
104
|
-
equation:
|
|
105
|
-
expression
|
|
139
|
+
const equationRichTextSchema = z.object({
|
|
140
|
+
type: z.literal('equation'),
|
|
141
|
+
equation: z.object({
|
|
142
|
+
// eslint-disable-next-line zod/prefer-string-schema-with-trim -- LaTeX expression must preserve whitespace from Notion API
|
|
143
|
+
expression: z.string(),
|
|
106
144
|
}),
|
|
107
145
|
annotations: annotationsSchema,
|
|
108
|
-
plain_text
|
|
109
|
-
|
|
146
|
+
// eslint-disable-next-line zod/prefer-string-schema-with-trim -- plain_text must preserve whitespace from Notion API
|
|
147
|
+
plain_text: z.string(),
|
|
148
|
+
href: z.url().nullable(),
|
|
110
149
|
});
|
|
111
|
-
exports.richTextSchema =
|
|
150
|
+
exports.richTextSchema = z.array(z.discriminatedUnion('type', [textRichTextSchema, mentionRichTextSchema, equationRichTextSchema]));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Shared schema definitions used across multiple schema files.
|
|
4
|
+
*
|
|
5
|
+
* This file contains common schemas to avoid circular dependencies.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Notion date string schema.
|
|
9
|
+
*
|
|
10
|
+
* Validates ISO 8601 date strings as returned by the Notion API.
|
|
11
|
+
* Accepts both date-only format ("2023-02-23") and full datetime format ("2023-02-23T00:00:00.000Z").
|
|
12
|
+
*
|
|
13
|
+
* According to Notion API docs, date fields contain "A date, with an optional time".
|
|
14
|
+
*/
|
|
15
|
+
export declare const notionDateStringSchema: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.notionDateStringSchema = void 0;
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
/**
|
|
39
|
+
* Shared schema definitions used across multiple schema files.
|
|
40
|
+
*
|
|
41
|
+
* This file contains common schemas to avoid circular dependencies.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Notion date string schema.
|
|
45
|
+
*
|
|
46
|
+
* Validates ISO 8601 date strings as returned by the Notion API.
|
|
47
|
+
* Accepts both date-only format ("2023-02-23") and full datetime format ("2023-02-23T00:00:00.000Z").
|
|
48
|
+
*
|
|
49
|
+
* According to Notion API docs, date fields contain "A date, with an optional time".
|
|
50
|
+
*/
|
|
51
|
+
exports.notionDateStringSchema = z.union([
|
|
52
|
+
z.iso.datetime(), // Full ISO 8601 datetime: "2023-02-23T00:00:00.000Z"
|
|
53
|
+
z.iso.date(), // Date only: "2023-02-23"
|
|
54
|
+
]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from 'zod';
|
|
2
2
|
/** Person user with email. */
|
|
3
3
|
declare const personUserSchema: z.ZodObject<{
|
|
4
4
|
object: z.ZodLiteral<"user">;
|
|
@@ -27,7 +27,7 @@ declare const botUserSchema: z.ZodObject<{
|
|
|
27
27
|
workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
28
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
29
29
|
workspace_limits: z.ZodOptional<z.ZodObject<{
|
|
30
|
-
max_file_upload_size_in_bytes: z.
|
|
30
|
+
max_file_upload_size_in_bytes: z.ZodInt;
|
|
31
31
|
}, z.core.$strip>>;
|
|
32
32
|
}, z.core.$strip>;
|
|
33
33
|
}, z.core.$strip>;
|
|
@@ -61,7 +61,7 @@ export declare const userSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
61
61
|
workspace_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
62
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
63
63
|
workspace_limits: z.ZodOptional<z.ZodObject<{
|
|
64
|
-
max_file_upload_size_in_bytes: z.
|
|
64
|
+
max_file_upload_size_in_bytes: z.ZodInt;
|
|
65
65
|
}, z.core.$strip>>;
|
|
66
66
|
}, z.core.$strip>;
|
|
67
67
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -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.userSchema = void 0;
|
|
4
|
-
const
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
/**
|
|
6
39
|
* Notion user object schemas.
|
|
7
40
|
*
|
|
@@ -12,47 +45,47 @@ const zod_1 = require("zod");
|
|
|
12
45
|
* https://developers.notion.com/reference/user
|
|
13
46
|
*/
|
|
14
47
|
/** Bot owner information. */
|
|
15
|
-
const botOwnerSchema =
|
|
16
|
-
|
|
17
|
-
type:
|
|
18
|
-
workspace:
|
|
48
|
+
const botOwnerSchema = z.discriminatedUnion('type', [
|
|
49
|
+
z.object({
|
|
50
|
+
type: z.literal('workspace'),
|
|
51
|
+
workspace: z.literal(true),
|
|
19
52
|
}),
|
|
20
|
-
|
|
21
|
-
type:
|
|
53
|
+
z.object({
|
|
54
|
+
type: z.literal('user'),
|
|
22
55
|
}),
|
|
23
56
|
]);
|
|
24
57
|
/** Person user with email. */
|
|
25
|
-
const personUserSchema =
|
|
26
|
-
object:
|
|
27
|
-
id:
|
|
28
|
-
type:
|
|
29
|
-
name:
|
|
30
|
-
avatar_url:
|
|
31
|
-
person:
|
|
32
|
-
email:
|
|
58
|
+
const personUserSchema = z.object({
|
|
59
|
+
object: z.literal('user'),
|
|
60
|
+
id: z.uuid(),
|
|
61
|
+
type: z.literal('person'),
|
|
62
|
+
name: z.string().trim().optional(),
|
|
63
|
+
avatar_url: z.union([z.url(), z.null()]).optional(),
|
|
64
|
+
person: z.object({
|
|
65
|
+
email: z.email(),
|
|
33
66
|
}),
|
|
34
67
|
});
|
|
35
68
|
/** Bot user with owner and workspace information. */
|
|
36
|
-
const botUserSchema =
|
|
37
|
-
object:
|
|
38
|
-
id:
|
|
39
|
-
type:
|
|
40
|
-
name:
|
|
41
|
-
avatar_url:
|
|
42
|
-
bot:
|
|
69
|
+
const botUserSchema = z.object({
|
|
70
|
+
object: z.literal('user'),
|
|
71
|
+
id: z.uuid(),
|
|
72
|
+
type: z.literal('bot'),
|
|
73
|
+
name: z.string().trim().optional(),
|
|
74
|
+
avatar_url: z.union([z.url(), z.null()]).optional(),
|
|
75
|
+
bot: z.object({
|
|
43
76
|
owner: botOwnerSchema,
|
|
44
|
-
workspace_name:
|
|
45
|
-
workspace_id:
|
|
46
|
-
workspace_limits:
|
|
77
|
+
workspace_name: z.string().trim().nullable().optional(),
|
|
78
|
+
workspace_id: z.string().trim().optional(),
|
|
79
|
+
workspace_limits: z
|
|
47
80
|
.object({
|
|
48
|
-
max_file_upload_size_in_bytes:
|
|
81
|
+
max_file_upload_size_in_bytes: z.int(),
|
|
49
82
|
})
|
|
50
83
|
.optional(),
|
|
51
84
|
}),
|
|
52
85
|
});
|
|
53
86
|
/** Partial user (only object and id, used in created_by/last_edited_by). */
|
|
54
|
-
const partialUserSchema =
|
|
55
|
-
object:
|
|
56
|
-
id:
|
|
87
|
+
const partialUserSchema = z.object({
|
|
88
|
+
object: z.literal('user'),
|
|
89
|
+
id: z.uuid(),
|
|
57
90
|
});
|
|
58
|
-
exports.userSchema =
|
|
91
|
+
exports.userSchema = z.union([personUserSchema, botUserSchema, partialUserSchema]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visus-io/notion-sdk-ts",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "TypeScript SDK for the Notion API",
|
|
6
6
|
"keywords": [
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"@types/node": "^25.2.1",
|
|
69
69
|
"@vitest/coverage-v8": "^4.0.18",
|
|
70
70
|
"eslint": "^9.39.2",
|
|
71
|
+
"eslint-plugin-zod": "3.4.0",
|
|
71
72
|
"husky": "^9.1.7",
|
|
72
73
|
"lint-staged": "^16.2.7",
|
|
73
74
|
"prettier": "^3.8.1",
|
|
@@ -77,6 +78,7 @@
|
|
|
77
78
|
"vitest": "^4.0.18"
|
|
78
79
|
},
|
|
79
80
|
"engines": {
|
|
81
|
+
"bun": ">=1.3.10",
|
|
80
82
|
"node": ">=18.0.0"
|
|
81
83
|
}
|
|
82
84
|
}
|