@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/schemas/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/schemas/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,gBAAgB;;;;;;;;;iBAM3B,CAAA;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI9B,CAAA;AAGF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAA4C,CAAA"}
|
package/dist/src/schemas/page.js
CHANGED
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { RichTextArraySchema } from
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { RichTextArraySchema } from './common.js';
|
|
3
|
+
// User object schema (used in people, created_by, last_edited_by)
|
|
4
|
+
export const UserObjectSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
object: z.literal('user').optional(),
|
|
7
|
+
type: z.enum(['person', 'bot']).optional(),
|
|
8
|
+
name: z.string().optional(),
|
|
9
|
+
avatar_url: z.string().nullable(),
|
|
10
|
+
});
|
|
3
11
|
// Title property value
|
|
4
12
|
export const TitlePropertySchema = z.object({
|
|
5
|
-
|
|
13
|
+
id: z.string().optional(),
|
|
14
|
+
type: z.literal('title').optional(),
|
|
6
15
|
title: RichTextArraySchema,
|
|
7
16
|
});
|
|
8
17
|
// Rich text property value
|
|
9
18
|
export const RichTextPropertySchema = z.object({
|
|
10
|
-
|
|
19
|
+
id: z.string().optional(),
|
|
20
|
+
type: z.literal('rich_text').optional(),
|
|
11
21
|
rich_text: RichTextArraySchema,
|
|
12
22
|
});
|
|
13
23
|
// Number property value
|
|
14
24
|
export const NumberPropertySchema = z.object({
|
|
15
|
-
|
|
25
|
+
id: z.string().optional(),
|
|
26
|
+
type: z.literal('number').optional(),
|
|
16
27
|
number: z.number().nullable(),
|
|
17
28
|
});
|
|
18
29
|
// Select property value
|
|
19
30
|
export const SelectPropertySchema = z.object({
|
|
20
|
-
|
|
31
|
+
id: z.string().optional(),
|
|
32
|
+
type: z.literal('select').optional(),
|
|
21
33
|
select: z
|
|
22
34
|
.object({
|
|
23
35
|
id: z.string().optional(),
|
|
@@ -28,7 +40,8 @@ export const SelectPropertySchema = z.object({
|
|
|
28
40
|
});
|
|
29
41
|
// Multi-select property value
|
|
30
42
|
export const MultiSelectPropertySchema = z.object({
|
|
31
|
-
|
|
43
|
+
id: z.string().optional(),
|
|
44
|
+
type: z.literal('multi_select').optional(),
|
|
32
45
|
multi_select: z.array(z.object({
|
|
33
46
|
id: z.string().optional(),
|
|
34
47
|
name: z.string(),
|
|
@@ -37,7 +50,8 @@ export const MultiSelectPropertySchema = z.object({
|
|
|
37
50
|
});
|
|
38
51
|
// Status property value
|
|
39
52
|
export const StatusPropertySchema = z.object({
|
|
40
|
-
|
|
53
|
+
id: z.string().optional(),
|
|
54
|
+
type: z.literal('status').optional(),
|
|
41
55
|
status: z
|
|
42
56
|
.object({
|
|
43
57
|
id: z.string().optional(),
|
|
@@ -48,7 +62,8 @@ export const StatusPropertySchema = z.object({
|
|
|
48
62
|
});
|
|
49
63
|
// Date property value
|
|
50
64
|
export const DatePropertySchema = z.object({
|
|
51
|
-
|
|
65
|
+
id: z.string().optional(),
|
|
66
|
+
type: z.literal('date').optional(),
|
|
52
67
|
date: z
|
|
53
68
|
.object({
|
|
54
69
|
start: z.string(),
|
|
@@ -59,52 +74,57 @@ export const DatePropertySchema = z.object({
|
|
|
59
74
|
});
|
|
60
75
|
// Checkbox property value
|
|
61
76
|
export const CheckboxPropertySchema = z.object({
|
|
62
|
-
|
|
77
|
+
id: z.string().optional(),
|
|
78
|
+
type: z.literal('checkbox').optional(),
|
|
63
79
|
checkbox: z.boolean(),
|
|
64
80
|
});
|
|
65
81
|
// URL property value
|
|
66
82
|
export const UrlPropertySchema = z.object({
|
|
67
|
-
|
|
83
|
+
id: z.string().optional(),
|
|
84
|
+
type: z.literal('url').optional(),
|
|
68
85
|
url: z.string().nullable(),
|
|
69
86
|
});
|
|
70
87
|
// Email property value
|
|
71
88
|
export const EmailPropertySchema = z.object({
|
|
72
|
-
|
|
89
|
+
id: z.string().optional(),
|
|
90
|
+
type: z.literal('email').optional(),
|
|
73
91
|
email: z.string().nullable(),
|
|
74
92
|
});
|
|
75
93
|
// Phone number property value
|
|
76
94
|
export const PhoneNumberPropertySchema = z.object({
|
|
77
|
-
|
|
95
|
+
id: z.string().optional(),
|
|
96
|
+
type: z.literal('phone_number').optional(),
|
|
78
97
|
phone_number: z.string().nullable(),
|
|
79
98
|
});
|
|
80
99
|
// Relation property value
|
|
81
100
|
export const RelationPropertySchema = z.object({
|
|
82
|
-
|
|
101
|
+
id: z.string().optional(),
|
|
102
|
+
type: z.literal('relation').optional(),
|
|
83
103
|
relation: z.array(z.object({
|
|
84
104
|
id: z.string(),
|
|
85
105
|
})),
|
|
106
|
+
has_more: z.boolean().optional(),
|
|
86
107
|
});
|
|
87
108
|
// People property value
|
|
88
109
|
export const PeoplePropertySchema = z.object({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
object: z.literal("user").optional(),
|
|
93
|
-
})),
|
|
110
|
+
id: z.string().optional(),
|
|
111
|
+
type: z.literal('people').optional(),
|
|
112
|
+
people: z.array(UserObjectSchema),
|
|
94
113
|
});
|
|
95
114
|
// Files property value
|
|
96
115
|
export const FilesPropertySchema = z.object({
|
|
97
|
-
|
|
116
|
+
id: z.string().optional(),
|
|
117
|
+
type: z.literal('files').optional(),
|
|
98
118
|
files: z.array(z.union([
|
|
99
119
|
z.object({
|
|
100
|
-
type: z.literal(
|
|
120
|
+
type: z.literal('external'),
|
|
101
121
|
name: z.string(),
|
|
102
122
|
external: z.object({
|
|
103
123
|
url: z.string(),
|
|
104
124
|
}),
|
|
105
125
|
}),
|
|
106
126
|
z.object({
|
|
107
|
-
type: z.literal(
|
|
127
|
+
type: z.literal('file'),
|
|
108
128
|
name: z.string(),
|
|
109
129
|
file: z.object({
|
|
110
130
|
url: z.string(),
|
|
@@ -113,6 +133,172 @@ export const FilesPropertySchema = z.object({
|
|
|
113
133
|
}),
|
|
114
134
|
])),
|
|
115
135
|
});
|
|
136
|
+
// Created time property value (read-only)
|
|
137
|
+
export const CreatedTimePropertySchema = z.object({
|
|
138
|
+
id: z.string().optional(),
|
|
139
|
+
type: z.literal('created_time').optional(),
|
|
140
|
+
created_time: z.string(),
|
|
141
|
+
});
|
|
142
|
+
// Created by property value (read-only)
|
|
143
|
+
export const CreatedByPropertySchema = z.object({
|
|
144
|
+
id: z.string().optional(),
|
|
145
|
+
type: z.literal('created_by').optional(),
|
|
146
|
+
created_by: UserObjectSchema,
|
|
147
|
+
});
|
|
148
|
+
// Last edited time property value (read-only)
|
|
149
|
+
export const LastEditedTimePropertySchema = z.object({
|
|
150
|
+
id: z.string().optional(),
|
|
151
|
+
type: z.literal('last_edited_time').optional(),
|
|
152
|
+
last_edited_time: z.string(),
|
|
153
|
+
});
|
|
154
|
+
// Last edited by property value (read-only)
|
|
155
|
+
export const LastEditedByPropertySchema = z.object({
|
|
156
|
+
id: z.string().optional(),
|
|
157
|
+
type: z.literal('last_edited_by').optional(),
|
|
158
|
+
last_edited_by: UserObjectSchema,
|
|
159
|
+
});
|
|
160
|
+
// Formula property value (read-only)
|
|
161
|
+
export const FormulaPropertySchema = z.object({
|
|
162
|
+
id: z.string().optional(),
|
|
163
|
+
type: z.literal('formula').optional(),
|
|
164
|
+
formula: z.union([
|
|
165
|
+
z.object({
|
|
166
|
+
type: z.literal('string'),
|
|
167
|
+
string: z.string().nullable(),
|
|
168
|
+
}),
|
|
169
|
+
z.object({
|
|
170
|
+
type: z.literal('number'),
|
|
171
|
+
number: z.number().nullable(),
|
|
172
|
+
}),
|
|
173
|
+
z.object({
|
|
174
|
+
type: z.literal('boolean'),
|
|
175
|
+
boolean: z.boolean().nullable(),
|
|
176
|
+
}),
|
|
177
|
+
z.object({
|
|
178
|
+
type: z.literal('date'),
|
|
179
|
+
date: z
|
|
180
|
+
.object({
|
|
181
|
+
start: z.string(),
|
|
182
|
+
end: z.string().nullable().optional(),
|
|
183
|
+
time_zone: z.string().nullable().optional(),
|
|
184
|
+
})
|
|
185
|
+
.nullable(),
|
|
186
|
+
}),
|
|
187
|
+
]),
|
|
188
|
+
});
|
|
189
|
+
// Rollup array item schema (simplified property value for rollup results)
|
|
190
|
+
const RollupArrayItemSchema = z.union([
|
|
191
|
+
// Title
|
|
192
|
+
z.object({ type: z.literal('title'), title: RichTextArraySchema }),
|
|
193
|
+
// Rich text
|
|
194
|
+
z.object({ type: z.literal('rich_text'), rich_text: RichTextArraySchema }),
|
|
195
|
+
// Number
|
|
196
|
+
z.object({ type: z.literal('number'), number: z.number().nullable() }),
|
|
197
|
+
// Select
|
|
198
|
+
z.object({
|
|
199
|
+
type: z.literal('select'),
|
|
200
|
+
select: z.object({ name: z.string(), color: z.string().optional() }).nullable(),
|
|
201
|
+
}),
|
|
202
|
+
// Multi-select
|
|
203
|
+
z.object({
|
|
204
|
+
type: z.literal('multi_select'),
|
|
205
|
+
multi_select: z.array(z.object({ name: z.string(), color: z.string().optional() })),
|
|
206
|
+
}),
|
|
207
|
+
// Status
|
|
208
|
+
z.object({
|
|
209
|
+
type: z.literal('status'),
|
|
210
|
+
status: z.object({ name: z.string(), color: z.string().optional() }).nullable(),
|
|
211
|
+
}),
|
|
212
|
+
// Date
|
|
213
|
+
z.object({
|
|
214
|
+
type: z.literal('date'),
|
|
215
|
+
date: z
|
|
216
|
+
.object({
|
|
217
|
+
start: z.string(),
|
|
218
|
+
end: z.string().nullable().optional(),
|
|
219
|
+
time_zone: z.string().nullable().optional(),
|
|
220
|
+
})
|
|
221
|
+
.nullable(),
|
|
222
|
+
}),
|
|
223
|
+
// Checkbox
|
|
224
|
+
z.object({ type: z.literal('checkbox'), checkbox: z.boolean() }),
|
|
225
|
+
// URL
|
|
226
|
+
z.object({ type: z.literal('url'), url: z.string().nullable() }),
|
|
227
|
+
// Email
|
|
228
|
+
z.object({ type: z.literal('email'), email: z.string().nullable() }),
|
|
229
|
+
// Phone number
|
|
230
|
+
z.object({ type: z.literal('phone_number'), phone_number: z.string().nullable() }),
|
|
231
|
+
// People
|
|
232
|
+
z.object({ type: z.literal('people'), people: z.array(UserObjectSchema) }),
|
|
233
|
+
// Relation
|
|
234
|
+
z.object({ type: z.literal('relation'), relation: z.array(z.object({ id: z.string() })) }),
|
|
235
|
+
]);
|
|
236
|
+
// Rollup property value (read-only)
|
|
237
|
+
export const RollupPropertySchema = z.object({
|
|
238
|
+
id: z.string().optional(),
|
|
239
|
+
type: z.literal('rollup').optional(),
|
|
240
|
+
rollup: z.union([
|
|
241
|
+
z.object({
|
|
242
|
+
type: z.literal('number'),
|
|
243
|
+
number: z.number().nullable(),
|
|
244
|
+
function: z.string(),
|
|
245
|
+
}),
|
|
246
|
+
z.object({
|
|
247
|
+
type: z.literal('date'),
|
|
248
|
+
date: z
|
|
249
|
+
.object({
|
|
250
|
+
start: z.string(),
|
|
251
|
+
end: z.string().nullable().optional(),
|
|
252
|
+
time_zone: z.string().nullable().optional(),
|
|
253
|
+
})
|
|
254
|
+
.nullable(),
|
|
255
|
+
function: z.string(),
|
|
256
|
+
}),
|
|
257
|
+
z.object({
|
|
258
|
+
type: z.literal('array'),
|
|
259
|
+
array: z.array(RollupArrayItemSchema),
|
|
260
|
+
function: z.string(),
|
|
261
|
+
}),
|
|
262
|
+
z.object({
|
|
263
|
+
type: z.literal('unsupported'),
|
|
264
|
+
unsupported: z.object({}),
|
|
265
|
+
function: z.string(),
|
|
266
|
+
}),
|
|
267
|
+
z.object({
|
|
268
|
+
type: z.literal('incomplete'),
|
|
269
|
+
incomplete: z.object({}),
|
|
270
|
+
function: z.string(),
|
|
271
|
+
}),
|
|
272
|
+
]),
|
|
273
|
+
});
|
|
274
|
+
// Unique ID property value (read-only)
|
|
275
|
+
export const UniqueIdPropertySchema = z.object({
|
|
276
|
+
id: z.string().optional(),
|
|
277
|
+
type: z.literal('unique_id').optional(),
|
|
278
|
+
unique_id: z.object({
|
|
279
|
+
number: z.number(),
|
|
280
|
+
prefix: z.string().nullable().optional(),
|
|
281
|
+
}),
|
|
282
|
+
});
|
|
283
|
+
// Verification property value
|
|
284
|
+
export const VerificationPropertySchema = z.object({
|
|
285
|
+
id: z.string().optional(),
|
|
286
|
+
type: z.literal('verification').optional(),
|
|
287
|
+
verification: z
|
|
288
|
+
.object({
|
|
289
|
+
state: z.enum(['verified', 'unverified']),
|
|
290
|
+
verified_by: UserObjectSchema.nullable().optional(),
|
|
291
|
+
date: z
|
|
292
|
+
.object({
|
|
293
|
+
start: z.string(),
|
|
294
|
+
end: z.string().nullable().optional(),
|
|
295
|
+
time_zone: z.string().nullable().optional(),
|
|
296
|
+
})
|
|
297
|
+
.nullable()
|
|
298
|
+
.optional(),
|
|
299
|
+
})
|
|
300
|
+
.nullable(),
|
|
301
|
+
});
|
|
116
302
|
// Combined property value schema (flexible for any property type)
|
|
117
303
|
export const PropertyValueSchema = z.union([
|
|
118
304
|
TitlePropertySchema,
|
|
@@ -129,6 +315,14 @@ export const PropertyValueSchema = z.union([
|
|
|
129
315
|
RelationPropertySchema,
|
|
130
316
|
PeoplePropertySchema,
|
|
131
317
|
FilesPropertySchema,
|
|
318
|
+
CreatedTimePropertySchema,
|
|
319
|
+
CreatedByPropertySchema,
|
|
320
|
+
LastEditedTimePropertySchema,
|
|
321
|
+
LastEditedByPropertySchema,
|
|
322
|
+
FormulaPropertySchema,
|
|
323
|
+
RollupPropertySchema,
|
|
324
|
+
UniqueIdPropertySchema,
|
|
325
|
+
VerificationPropertySchema,
|
|
132
326
|
]);
|
|
133
327
|
// Properties object schema (record of property name to property value)
|
|
134
328
|
export const PropertiesSchema = z.record(z.string(), PropertyValueSchema);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.test.d.ts","sourceRoot":"","sources":["../../../src/schemas/schemas.test.ts"],"names":[],"mappings":""}
|