@atikk-co-jp/notion-mcp-server 0.1.0 → 0.2.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.ja.md +95 -4
- package/README.md +95 -4
- package/dist/bin/cli.js +10 -10
- package/dist/src/converters/__tests__/block-to-markdown.test.d.ts +2 -0
- package/dist/src/converters/__tests__/block-to-markdown.test.d.ts.map +1 -0
- package/dist/src/converters/__tests__/block-to-markdown.test.js +611 -0
- package/dist/src/converters/__tests__/page-to-markdown.test.d.ts +2 -0
- package/dist/src/converters/__tests__/page-to-markdown.test.d.ts.map +1 -0
- package/dist/src/converters/__tests__/page-to-markdown.test.js +567 -0
- package/dist/src/converters/__tests__/rich-text-to-markdown.test.d.ts +2 -0
- package/dist/src/converters/__tests__/rich-text-to-markdown.test.d.ts.map +1 -0
- package/dist/src/converters/__tests__/rich-text-to-markdown.test.js +353 -0
- package/dist/src/converters/block-to-markdown.d.ts +38 -0
- package/dist/src/converters/block-to-markdown.d.ts.map +1 -0
- package/dist/src/converters/block-to-markdown.js +484 -0
- package/dist/src/converters/index.d.ts +9 -0
- package/dist/src/converters/index.d.ts.map +1 -0
- package/dist/src/converters/index.js +11 -0
- package/dist/src/converters/page-to-markdown.d.ts +64 -0
- package/dist/src/converters/page-to-markdown.d.ts.map +1 -0
- package/dist/src/converters/page-to-markdown.js +189 -0
- package/dist/src/converters/rich-text-to-markdown.d.ts +61 -0
- package/dist/src/converters/rich-text-to-markdown.d.ts.map +1 -0
- package/dist/src/converters/rich-text-to-markdown.js +95 -0
- package/dist/src/index.d.ts +6 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -5
- package/dist/src/notion-client.d.ts +58 -15
- package/dist/src/notion-client.d.ts.map +1 -1
- package/dist/src/notion-client.js +23 -13
- package/dist/src/schemas/block.d.ts +2158 -622
- package/dist/src/schemas/block.d.ts.map +1 -1
- package/dist/src/schemas/block.js +283 -76
- package/dist/src/schemas/common.d.ts +518 -6
- package/dist/src/schemas/common.d.ts.map +1 -1
- package/dist/src/schemas/common.js +120 -42
- package/dist/src/schemas/database.d.ts +687 -0
- package/dist/src/schemas/database.d.ts.map +1 -0
- package/dist/src/schemas/database.js +264 -0
- package/dist/src/schemas/filter.d.ts +509 -3
- package/dist/src/schemas/filter.d.ts.map +1 -1
- package/dist/src/schemas/filter.js +110 -13
- package/dist/src/schemas/index.d.ts +5 -4
- package/dist/src/schemas/index.d.ts.map +1 -1
- package/dist/src/schemas/index.js +7 -5
- package/dist/src/schemas/page.d.ts +2152 -19
- package/dist/src/schemas/page.d.ts.map +1 -1
- package/dist/src/schemas/page.js +216 -22
- package/dist/src/schemas/schemas.test.d.ts +2 -0
- package/dist/src/schemas/schemas.test.d.ts.map +1 -0
- package/dist/src/schemas/schemas.test.js +418 -0
- package/dist/src/server.d.ts +2 -2
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +6 -6
- package/dist/src/tools/append-block-children.d.ts +2 -2
- package/dist/src/tools/append-block-children.d.ts.map +1 -1
- package/dist/src/tools/append-block-children.js +16 -10
- package/dist/src/tools/create-comment.d.ts +2 -2
- package/dist/src/tools/create-comment.d.ts.map +1 -1
- package/dist/src/tools/create-comment.js +15 -9
- package/dist/src/tools/create-database.d.ts +4 -0
- package/dist/src/tools/create-database.d.ts.map +1 -0
- package/dist/src/tools/create-database.js +57 -0
- package/dist/src/tools/create-page.d.ts +2 -2
- package/dist/src/tools/create-page.d.ts.map +1 -1
- package/dist/src/tools/create-page.js +22 -24
- package/dist/src/tools/get-block-children.d.ts +2 -2
- package/dist/src/tools/get-block-children.d.ts.map +1 -1
- package/dist/src/tools/get-block-children.js +39 -6
- package/dist/src/tools/index.d.ts +13 -11
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +13 -9
- package/dist/src/tools/query-database.d.ts +2 -2
- package/dist/src/tools/query-database.d.ts.map +1 -1
- package/dist/src/tools/query-database.js +27 -18
- package/dist/src/tools/retrieve-page.d.ts +2 -2
- package/dist/src/tools/retrieve-page.d.ts.map +1 -1
- package/dist/src/tools/retrieve-page.js +44 -4
- package/dist/src/tools/search.d.ts +2 -2
- package/dist/src/tools/search.d.ts.map +1 -1
- package/dist/src/tools/search.js +18 -12
- package/dist/src/tools/update-database.d.ts +4 -0
- package/dist/src/tools/update-database.d.ts.map +1 -0
- package/dist/src/tools/update-database.js +74 -0
- package/dist/src/tools/update-page.d.ts +2 -2
- package/dist/src/tools/update-page.d.ts.map +1 -1
- package/dist/src/tools/update-page.js +23 -18
- package/dist/src/utils/error-handler.d.ts +1 -1
- package/dist/src/utils/error-handler.d.ts.map +1 -1
- package/dist/src/utils/error-handler.js +14 -14
- package/dist/src/utils/index.d.ts +2 -2
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -2
- package/dist/src/utils/response-formatter.d.ts +13 -1
- package/dist/src/utils/response-formatter.d.ts.map +1 -1
- package/dist/src/utils/response-formatter.js +46 -3
- package/package.json +11 -2
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
//
|
|
3
|
-
export const
|
|
4
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Color enum used in annotations and blocks
|
|
3
|
+
export const ColorSchema = z.enum([
|
|
4
|
+
'default',
|
|
5
|
+
'gray',
|
|
6
|
+
'brown',
|
|
7
|
+
'orange',
|
|
8
|
+
'yellow',
|
|
9
|
+
'green',
|
|
10
|
+
'blue',
|
|
11
|
+
'purple',
|
|
12
|
+
'pink',
|
|
13
|
+
'red',
|
|
14
|
+
'gray_background',
|
|
15
|
+
'brown_background',
|
|
16
|
+
'orange_background',
|
|
17
|
+
'yellow_background',
|
|
18
|
+
'green_background',
|
|
19
|
+
'blue_background',
|
|
20
|
+
'purple_background',
|
|
21
|
+
'pink_background',
|
|
22
|
+
'red_background',
|
|
23
|
+
]);
|
|
24
|
+
// Annotations schema
|
|
25
|
+
export const AnnotationsSchema = z.object({
|
|
26
|
+
bold: z.boolean().optional(),
|
|
27
|
+
italic: z.boolean().optional(),
|
|
28
|
+
strikethrough: z.boolean().optional(),
|
|
29
|
+
underline: z.boolean().optional(),
|
|
30
|
+
code: z.boolean().optional(),
|
|
31
|
+
color: ColorSchema.optional(),
|
|
32
|
+
});
|
|
33
|
+
// Text type rich text
|
|
34
|
+
export const TextRichTextSchema = z.object({
|
|
35
|
+
type: z.literal('text'),
|
|
5
36
|
text: z.object({
|
|
6
37
|
content: z.string(),
|
|
7
38
|
link: z
|
|
@@ -11,66 +42,113 @@ export const RichTextSchema = z.object({
|
|
|
11
42
|
.nullable()
|
|
12
43
|
.optional(),
|
|
13
44
|
}),
|
|
14
|
-
annotations:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
})
|
|
45
|
-
|
|
45
|
+
annotations: AnnotationsSchema.optional(),
|
|
46
|
+
plain_text: z.string().optional(),
|
|
47
|
+
href: z.string().nullable().optional(),
|
|
48
|
+
});
|
|
49
|
+
// Mention types
|
|
50
|
+
export const UserMentionSchema = z.object({
|
|
51
|
+
type: z.literal('user'),
|
|
52
|
+
user: z.object({
|
|
53
|
+
id: z.string(),
|
|
54
|
+
object: z.literal('user').optional(),
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
export const PageMentionSchema = z.object({
|
|
58
|
+
type: z.literal('page'),
|
|
59
|
+
page: z.object({
|
|
60
|
+
id: z.string(),
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
export const DatabaseMentionSchema = z.object({
|
|
64
|
+
type: z.literal('database'),
|
|
65
|
+
database: z.object({
|
|
66
|
+
id: z.string(),
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
export const DateMentionSchema = z.object({
|
|
70
|
+
type: z.literal('date'),
|
|
71
|
+
date: z.object({
|
|
72
|
+
start: z.string(),
|
|
73
|
+
end: z.string().nullable().optional(),
|
|
74
|
+
time_zone: z.string().nullable().optional(),
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
export const LinkPreviewMentionSchema = z.object({
|
|
78
|
+
type: z.literal('link_preview'),
|
|
79
|
+
link_preview: z.object({
|
|
80
|
+
url: z.string(),
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
export const TemplateMentionDateSchema = z.object({
|
|
84
|
+
type: z.literal('template_mention_date'),
|
|
85
|
+
template_mention_date: z.enum(['today', 'now']),
|
|
86
|
+
});
|
|
87
|
+
export const TemplateMentionUserSchema = z.object({
|
|
88
|
+
type: z.literal('template_mention_user'),
|
|
89
|
+
template_mention_user: z.literal('me'),
|
|
90
|
+
});
|
|
91
|
+
export const TemplateMentionSchema = z.object({
|
|
92
|
+
type: z.literal('template_mention'),
|
|
93
|
+
template_mention: z.union([TemplateMentionDateSchema, TemplateMentionUserSchema]),
|
|
94
|
+
});
|
|
95
|
+
export const MentionSchema = z.union([
|
|
96
|
+
UserMentionSchema,
|
|
97
|
+
PageMentionSchema,
|
|
98
|
+
DatabaseMentionSchema,
|
|
99
|
+
DateMentionSchema,
|
|
100
|
+
LinkPreviewMentionSchema,
|
|
101
|
+
TemplateMentionSchema,
|
|
102
|
+
]);
|
|
103
|
+
// Mention type rich text
|
|
104
|
+
export const MentionRichTextSchema = z.object({
|
|
105
|
+
type: z.literal('mention'),
|
|
106
|
+
mention: MentionSchema,
|
|
107
|
+
annotations: AnnotationsSchema.optional(),
|
|
108
|
+
plain_text: z.string().optional(),
|
|
109
|
+
href: z.string().nullable().optional(),
|
|
110
|
+
});
|
|
111
|
+
// Equation type rich text
|
|
112
|
+
export const EquationRichTextSchema = z.object({
|
|
113
|
+
type: z.literal('equation'),
|
|
114
|
+
equation: z.object({
|
|
115
|
+
expression: z.string(),
|
|
116
|
+
}),
|
|
117
|
+
annotations: AnnotationsSchema.optional(),
|
|
46
118
|
plain_text: z.string().optional(),
|
|
47
119
|
href: z.string().nullable().optional(),
|
|
48
120
|
});
|
|
121
|
+
// Combined Rich Text schema (supports text, mention, equation)
|
|
122
|
+
export const RichTextSchema = z.union([
|
|
123
|
+
TextRichTextSchema,
|
|
124
|
+
MentionRichTextSchema,
|
|
125
|
+
EquationRichTextSchema,
|
|
126
|
+
]);
|
|
49
127
|
export const RichTextArraySchema = z.array(RichTextSchema);
|
|
50
128
|
// Helper to create simple text rich text array
|
|
51
129
|
export const SimpleTextSchema = z.string().transform((content) => [
|
|
52
130
|
{
|
|
53
|
-
type:
|
|
131
|
+
type: 'text',
|
|
54
132
|
text: { content },
|
|
55
133
|
},
|
|
56
134
|
]);
|
|
57
135
|
// Parent schemas
|
|
58
136
|
export const DatabaseParentSchema = z.object({
|
|
59
|
-
type: z.literal(
|
|
137
|
+
type: z.literal('database_id').optional(),
|
|
60
138
|
database_id: z.string(),
|
|
61
139
|
});
|
|
62
140
|
export const PageParentSchema = z.object({
|
|
63
|
-
type: z.literal(
|
|
141
|
+
type: z.literal('page_id').optional(),
|
|
64
142
|
page_id: z.string(),
|
|
65
143
|
});
|
|
66
144
|
export const ParentSchema = z.union([DatabaseParentSchema, PageParentSchema]);
|
|
67
145
|
// Icon schemas
|
|
68
146
|
export const EmojiIconSchema = z.object({
|
|
69
|
-
type: z.literal(
|
|
147
|
+
type: z.literal('emoji'),
|
|
70
148
|
emoji: z.string(),
|
|
71
149
|
});
|
|
72
150
|
export const ExternalIconSchema = z.object({
|
|
73
|
-
type: z.literal(
|
|
151
|
+
type: z.literal('external'),
|
|
74
152
|
external: z.object({
|
|
75
153
|
url: z.string(),
|
|
76
154
|
}),
|
|
@@ -78,7 +156,7 @@ export const ExternalIconSchema = z.object({
|
|
|
78
156
|
export const IconSchema = z.union([EmojiIconSchema, ExternalIconSchema]);
|
|
79
157
|
// Cover schema
|
|
80
158
|
export const CoverSchema = z.object({
|
|
81
|
-
type: z.literal(
|
|
159
|
+
type: z.literal('external'),
|
|
82
160
|
external: z.object({
|
|
83
161
|
url: z.string(),
|
|
84
162
|
}),
|