ncblock 0.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 +286 -0
- package/dist/bridge/context.d.ts +44 -0
- package/dist/bridge/context.d.ts.map +1 -0
- package/dist/bridge/context.js +42 -0
- package/dist/bridge/dataSources/dataSource.d.ts +732 -0
- package/dist/bridge/dataSources/dataSource.d.ts.map +1 -0
- package/dist/bridge/dataSources/dataSource.js +37 -0
- package/dist/bridge/dataSources/dataSourcePage.d.ts +117 -0
- package/dist/bridge/dataSources/dataSourcePage.d.ts.map +1 -0
- package/dist/bridge/dataSources/dataSourcePage.js +13 -0
- package/dist/bridge/dataSources/dataSourceValue.d.ts +67 -0
- package/dist/bridge/dataSources/dataSourceValue.d.ts.map +1 -0
- package/dist/bridge/dataSources/dataSourceValue.js +14 -0
- package/dist/bridge/dataSources/dateValue.d.ts +158 -0
- package/dist/bridge/dataSources/dateValue.d.ts.map +1 -0
- package/dist/bridge/dataSources/dateValue.js +59 -0
- package/dist/bridge/dataSources/propertySchema.d.ts +191 -0
- package/dist/bridge/dataSources/propertySchema.d.ts.map +1 -0
- package/dist/bridge/dataSources/propertySchema.js +148 -0
- package/dist/bridge/dataSources/recordPointer.d.ts +10 -0
- package/dist/bridge/dataSources/recordPointer.d.ts.map +1 -0
- package/dist/bridge/dataSources/recordPointer.js +8 -0
- package/dist/bridge/ids.d.ts +21 -0
- package/dist/bridge/ids.d.ts.map +1 -0
- package/dist/bridge/ids.js +3 -0
- package/dist/bridge/incomingType.d.ts +10 -0
- package/dist/bridge/incomingType.d.ts.map +1 -0
- package/dist/bridge/incomingType.js +17 -0
- package/dist/bridge/manifest.d.ts +66 -0
- package/dist/bridge/manifest.d.ts.map +1 -0
- package/dist/bridge/manifest.js +40 -0
- package/dist/bridge/messages/contextChanged.d.ts +20 -0
- package/dist/bridge/messages/contextChanged.d.ts.map +1 -0
- package/dist/bridge/messages/contextChanged.js +10 -0
- package/dist/bridge/messages/createPage.d.ts +233 -0
- package/dist/bridge/messages/createPage.d.ts.map +1 -0
- package/dist/bridge/messages/createPage.js +45 -0
- package/dist/bridge/messages/createPageResult.d.ts +198 -0
- package/dist/bridge/messages/createPageResult.d.ts.map +1 -0
- package/dist/bridge/messages/createPageResult.js +20 -0
- package/dist/bridge/messages/dataSourcesChanged.d.ts +158 -0
- package/dist/bridge/messages/dataSourcesChanged.d.ts.map +1 -0
- package/dist/bridge/messages/dataSourcesChanged.js +13 -0
- package/dist/bridge/messages/getPage.d.ts +203 -0
- package/dist/bridge/messages/getPage.d.ts.map +1 -0
- package/dist/bridge/messages/getPage.js +24 -0
- package/dist/bridge/messages/hostToSandbox.d.ts +974 -0
- package/dist/bridge/messages/hostToSandbox.d.ts.map +1 -0
- package/dist/bridge/messages/hostToSandbox.js +24 -0
- package/dist/bridge/messages/init.d.ts +169 -0
- package/dist/bridge/messages/init.d.ts.map +1 -0
- package/dist/bridge/messages/init.js +17 -0
- package/dist/bridge/messages/invalidHostMessage.d.ts +15 -0
- package/dist/bridge/messages/invalidHostMessage.d.ts.map +1 -0
- package/dist/bridge/messages/invalidHostMessage.js +13 -0
- package/dist/bridge/messages/invalidSandboxMessage.d.ts +15 -0
- package/dist/bridge/messages/invalidSandboxMessage.d.ts.map +1 -0
- package/dist/bridge/messages/invalidSandboxMessage.js +13 -0
- package/dist/bridge/messages/queryDataSource.d.ts +13 -0
- package/dist/bridge/messages/queryDataSource.d.ts.map +1 -0
- package/dist/bridge/messages/queryDataSource.js +11 -0
- package/dist/bridge/messages/queryDataSourceResult.d.ts +77 -0
- package/dist/bridge/messages/queryDataSourceResult.d.ts.map +1 -0
- package/dist/bridge/messages/queryDataSourceResult.js +13 -0
- package/dist/bridge/messages/ready.d.ts +41 -0
- package/dist/bridge/messages/ready.d.ts.map +1 -0
- package/dist/bridge/messages/ready.js +22 -0
- package/dist/bridge/messages/resize.d.ts +12 -0
- package/dist/bridge/messages/resize.d.ts.map +1 -0
- package/dist/bridge/messages/resize.js +10 -0
- package/dist/bridge/messages/sandboxToHost.d.ts +389 -0
- package/dist/bridge/messages/sandboxToHost.d.ts.map +1 -0
- package/dist/bridge/messages/sandboxToHost.js +21 -0
- package/dist/bridge/messages/themeChanged.d.ts +11 -0
- package/dist/bridge/messages/themeChanged.d.ts.map +1 -0
- package/dist/bridge/messages/themeChanged.js +10 -0
- package/dist/bridge/messages/updatePage.d.ts +171 -0
- package/dist/bridge/messages/updatePage.d.ts.map +1 -0
- package/dist/bridge/messages/updatePage.js +14 -0
- package/dist/bridge/messages/updatePageResult.d.ts +197 -0
- package/dist/bridge/messages/updatePageResult.d.ts.map +1 -0
- package/dist/bridge/messages/updatePageResult.js +19 -0
- package/dist/bridge/pages/page.d.ts +651 -0
- package/dist/bridge/pages/page.d.ts.map +1 -0
- package/dist/bridge/pages/page.js +229 -0
- package/dist/bridge/pendingRequests.d.ts +14 -0
- package/dist/bridge/pendingRequests.d.ts.map +1 -0
- package/dist/bridge/pendingRequests.js +27 -0
- package/dist/bridge/theme.d.ts +4 -0
- package/dist/bridge/theme.d.ts.map +1 -0
- package/dist/bridge/theme.js +2 -0
- package/dist/host.d.ts +52 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +32 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/notion.d.ts +113 -0
- package/dist/notion.d.ts.map +1 -0
- package/dist/notion.js +773 -0
- package/dist/pages.d.ts +23 -0
- package/dist/pages.d.ts.map +1 -0
- package/dist/pages.js +30 -0
- package/dist/react.d.ts +171 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +284 -0
- package/dist/types.d.ts +124 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +10 -0
- package/package.json +48 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import type { NotionDataSourceId } from "../ids";
|
|
3
|
+
import type { NotionPageId } from "../pages/page";
|
|
4
|
+
/**
|
|
5
|
+
* Describes where the newly created page should be inserted.
|
|
6
|
+
* - `start` / `end` (default): prepend / append to the request's `parent`
|
|
7
|
+
* page's children.
|
|
8
|
+
* - `before` / `after`: insert as a sibling of the anchor block identified by
|
|
9
|
+
* `blockId`, using the anchor's own structural parent. The anchor can be
|
|
10
|
+
* nested anywhere below the page (inside a toggle, column, callout, etc.).
|
|
11
|
+
*/
|
|
12
|
+
export declare const notionCreatePagePositionSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
13
|
+
readonly type: v.LiteralSchema<"start", undefined>;
|
|
14
|
+
}, undefined>, v.ObjectSchema<{
|
|
15
|
+
readonly type: v.LiteralSchema<"end", undefined>;
|
|
16
|
+
}, undefined>, v.ObjectSchema<{
|
|
17
|
+
readonly type: v.LiteralSchema<"before", undefined>;
|
|
18
|
+
readonly blockId: v.StringSchema<undefined>;
|
|
19
|
+
}, undefined>, v.ObjectSchema<{
|
|
20
|
+
readonly type: v.LiteralSchema<"after", undefined>;
|
|
21
|
+
readonly blockId: v.StringSchema<undefined>;
|
|
22
|
+
}, undefined>], undefined>;
|
|
23
|
+
export type NotionCreatePagePosition = v.InferOutput<typeof notionCreatePagePositionSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Parent accepted by the outbound `createPage` bridge message.
|
|
26
|
+
*
|
|
27
|
+
* Mirrors Notion's public API `POST /v1/pages` parent shape: `page_id` for a page-parented child,
|
|
28
|
+
* `data_source_id` for a database row. `data_source_id` is the internal collection ID.
|
|
29
|
+
*
|
|
30
|
+
* The SDK additionally accepts a higher-level `data_source_key` variant that resolves to
|
|
31
|
+
* `data_source_id` locally, using the `dataSources` mapping.
|
|
32
|
+
*/
|
|
33
|
+
export declare const createPageParentSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
34
|
+
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
35
|
+
readonly page_id: v.StringSchema<undefined>;
|
|
36
|
+
}, undefined>, v.ObjectSchema<{
|
|
37
|
+
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
38
|
+
readonly data_source_id: v.StringSchema<undefined>;
|
|
39
|
+
}, undefined>], undefined>;
|
|
40
|
+
export type CreatePageMessageParent = {
|
|
41
|
+
type: "page_id";
|
|
42
|
+
page_id: NotionPageId;
|
|
43
|
+
} | {
|
|
44
|
+
type: "data_source_id";
|
|
45
|
+
data_source_id: NotionDataSourceId;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Message sent by the sandbox to ask the host to create a new page on its behalf.
|
|
49
|
+
* The payload mirrors Notion's public `POST /v1/pages` API.
|
|
50
|
+
*/
|
|
51
|
+
export declare const createPageMessageSchema: v.ObjectSchema<{
|
|
52
|
+
readonly type: v.LiteralSchema<"createPage", undefined>;
|
|
53
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
54
|
+
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
55
|
+
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
56
|
+
readonly page_id: v.StringSchema<undefined>;
|
|
57
|
+
}, undefined>, v.ObjectSchema<{
|
|
58
|
+
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
59
|
+
readonly data_source_id: v.StringSchema<undefined>;
|
|
60
|
+
}, undefined>], undefined>;
|
|
61
|
+
readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
62
|
+
readonly type: v.LiteralSchema<"title", undefined>;
|
|
63
|
+
readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
64
|
+
readonly id: v.StringSchema<undefined>;
|
|
65
|
+
}, undefined>, v.ObjectSchema<{
|
|
66
|
+
readonly type: v.LiteralSchema<"rich_text", undefined>;
|
|
67
|
+
readonly rich_text: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
68
|
+
readonly id: v.StringSchema<undefined>;
|
|
69
|
+
}, undefined>, v.ObjectSchema<{
|
|
70
|
+
readonly type: v.LiteralSchema<"number", undefined>;
|
|
71
|
+
readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
72
|
+
readonly id: v.StringSchema<undefined>;
|
|
73
|
+
}, undefined>, v.ObjectSchema<{
|
|
74
|
+
readonly type: v.LiteralSchema<"url", undefined>;
|
|
75
|
+
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
76
|
+
readonly id: v.StringSchema<undefined>;
|
|
77
|
+
}, undefined>, v.ObjectSchema<{
|
|
78
|
+
readonly type: v.LiteralSchema<"email", undefined>;
|
|
79
|
+
readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
80
|
+
readonly id: v.StringSchema<undefined>;
|
|
81
|
+
}, undefined>, v.ObjectSchema<{
|
|
82
|
+
readonly type: v.LiteralSchema<"phone_number", undefined>;
|
|
83
|
+
readonly phone_number: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
84
|
+
readonly id: v.StringSchema<undefined>;
|
|
85
|
+
}, undefined>, v.ObjectSchema<{
|
|
86
|
+
readonly type: v.LiteralSchema<"checkbox", undefined>;
|
|
87
|
+
readonly checkbox: v.BooleanSchema<undefined>;
|
|
88
|
+
readonly id: v.StringSchema<undefined>;
|
|
89
|
+
}, undefined>, v.ObjectSchema<{
|
|
90
|
+
readonly type: v.LiteralSchema<"select", undefined>;
|
|
91
|
+
readonly select: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
|
|
92
|
+
readonly id: v.StringSchema<undefined>;
|
|
93
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
94
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
95
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
96
|
+
}, undefined>, v.ObjectSchema<{
|
|
97
|
+
readonly name: v.StringSchema<undefined>;
|
|
98
|
+
readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
99
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
100
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
101
|
+
}, undefined>], undefined>, undefined>;
|
|
102
|
+
readonly id: v.StringSchema<undefined>;
|
|
103
|
+
}, undefined>, v.ObjectSchema<{
|
|
104
|
+
readonly type: v.LiteralSchema<"status", undefined>;
|
|
105
|
+
readonly status: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
|
|
106
|
+
readonly id: v.StringSchema<undefined>;
|
|
107
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
108
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
109
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
110
|
+
}, undefined>, v.ObjectSchema<{
|
|
111
|
+
readonly name: v.StringSchema<undefined>;
|
|
112
|
+
readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
113
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
114
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
115
|
+
}, undefined>], undefined>, undefined>;
|
|
116
|
+
readonly id: v.StringSchema<undefined>;
|
|
117
|
+
}, undefined>, v.ObjectSchema<{
|
|
118
|
+
readonly type: v.LiteralSchema<"multi_select", undefined>;
|
|
119
|
+
readonly multi_select: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
|
|
120
|
+
readonly id: v.StringSchema<undefined>;
|
|
121
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
122
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
123
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
124
|
+
}, undefined>, v.ObjectSchema<{
|
|
125
|
+
readonly name: v.StringSchema<undefined>;
|
|
126
|
+
readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
127
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
128
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
129
|
+
}, undefined>], undefined>, undefined>;
|
|
130
|
+
readonly id: v.StringSchema<undefined>;
|
|
131
|
+
}, undefined>, v.ObjectSchema<{
|
|
132
|
+
readonly type: v.LiteralSchema<"date", undefined>;
|
|
133
|
+
readonly date: v.NullableSchema<v.ObjectSchema<{
|
|
134
|
+
readonly start: v.StringSchema<undefined>;
|
|
135
|
+
readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
136
|
+
readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
137
|
+
}, undefined>, undefined>;
|
|
138
|
+
readonly id: v.StringSchema<undefined>;
|
|
139
|
+
}, undefined>, v.ObjectSchema<{
|
|
140
|
+
readonly type: v.LiteralSchema<"people", undefined>;
|
|
141
|
+
readonly people: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
|
|
142
|
+
readonly object: v.OptionalSchema<v.LiteralSchema<"user", undefined>, undefined>;
|
|
143
|
+
readonly id: v.StringSchema<undefined>;
|
|
144
|
+
}, undefined>, v.ObjectSchema<{
|
|
145
|
+
readonly object: v.LiteralSchema<"group", undefined>;
|
|
146
|
+
readonly id: v.StringSchema<undefined>;
|
|
147
|
+
readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
148
|
+
}, undefined>], undefined>, undefined>;
|
|
149
|
+
readonly id: v.StringSchema<undefined>;
|
|
150
|
+
}, undefined>, v.ObjectSchema<{
|
|
151
|
+
readonly type: v.LiteralSchema<"relation", undefined>;
|
|
152
|
+
readonly has_more: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
153
|
+
readonly relation: v.ArraySchema<v.ObjectSchema<{
|
|
154
|
+
readonly id: v.StringSchema<undefined>;
|
|
155
|
+
}, undefined>, undefined>;
|
|
156
|
+
readonly id: v.StringSchema<undefined>;
|
|
157
|
+
}, undefined>, v.ObjectSchema<{
|
|
158
|
+
readonly type: v.LiteralSchema<"files", undefined>;
|
|
159
|
+
readonly files: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
|
|
160
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
161
|
+
readonly name: v.StringSchema<undefined>;
|
|
162
|
+
readonly external: v.ObjectSchema<{
|
|
163
|
+
readonly url: v.StringSchema<undefined>;
|
|
164
|
+
}, undefined>;
|
|
165
|
+
}, undefined>, v.ObjectSchema<{
|
|
166
|
+
readonly type: v.LiteralSchema<"file", undefined>;
|
|
167
|
+
readonly name: v.StringSchema<undefined>;
|
|
168
|
+
readonly file: v.ObjectSchema<{
|
|
169
|
+
readonly url: v.StringSchema<undefined>;
|
|
170
|
+
readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
171
|
+
}, undefined>;
|
|
172
|
+
}, undefined>], undefined>, undefined>;
|
|
173
|
+
readonly id: v.StringSchema<undefined>;
|
|
174
|
+
}, undefined>, v.ObjectSchema<{
|
|
175
|
+
readonly type: v.LiteralSchema<"place", undefined>;
|
|
176
|
+
readonly place: v.NullableSchema<v.ObjectSchema<{
|
|
177
|
+
readonly lat: v.NumberSchema<undefined>;
|
|
178
|
+
readonly lon: v.NumberSchema<undefined>;
|
|
179
|
+
readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
180
|
+
readonly address: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
181
|
+
readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
182
|
+
readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
183
|
+
}, undefined>, undefined>;
|
|
184
|
+
readonly id: v.StringSchema<undefined>;
|
|
185
|
+
}, undefined>], undefined>, undefined>;
|
|
186
|
+
readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
187
|
+
readonly type: v.LiteralSchema<"emoji", undefined>;
|
|
188
|
+
readonly emoji: v.StringSchema<undefined>;
|
|
189
|
+
}, undefined>, v.ObjectSchema<{
|
|
190
|
+
readonly type: v.LiteralSchema<"custom_emoji", undefined>;
|
|
191
|
+
readonly custom_emoji: v.ObjectSchema<{
|
|
192
|
+
readonly id: v.StringSchema<undefined>;
|
|
193
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
194
|
+
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
195
|
+
}, undefined>;
|
|
196
|
+
}, undefined>, v.ObjectSchema<{
|
|
197
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
198
|
+
readonly external: v.ObjectSchema<{
|
|
199
|
+
readonly url: v.StringSchema<undefined>;
|
|
200
|
+
}, undefined>;
|
|
201
|
+
}, undefined>, v.ObjectSchema<{
|
|
202
|
+
readonly type: v.LiteralSchema<"file", undefined>;
|
|
203
|
+
readonly file: v.ObjectSchema<{
|
|
204
|
+
readonly url: v.StringSchema<undefined>;
|
|
205
|
+
readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
206
|
+
}, undefined>;
|
|
207
|
+
}, undefined>], undefined>, undefined>;
|
|
208
|
+
readonly cover: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
209
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
210
|
+
readonly external: v.ObjectSchema<{
|
|
211
|
+
readonly url: v.StringSchema<undefined>;
|
|
212
|
+
}, undefined>;
|
|
213
|
+
}, undefined>, v.ObjectSchema<{
|
|
214
|
+
readonly type: v.LiteralSchema<"file", undefined>;
|
|
215
|
+
readonly file: v.ObjectSchema<{
|
|
216
|
+
readonly url: v.StringSchema<undefined>;
|
|
217
|
+
readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
218
|
+
}, undefined>;
|
|
219
|
+
}, undefined>], undefined>, undefined>;
|
|
220
|
+
readonly position: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
221
|
+
readonly type: v.LiteralSchema<"start", undefined>;
|
|
222
|
+
}, undefined>, v.ObjectSchema<{
|
|
223
|
+
readonly type: v.LiteralSchema<"end", undefined>;
|
|
224
|
+
}, undefined>, v.ObjectSchema<{
|
|
225
|
+
readonly type: v.LiteralSchema<"before", undefined>;
|
|
226
|
+
readonly blockId: v.StringSchema<undefined>;
|
|
227
|
+
}, undefined>, v.ObjectSchema<{
|
|
228
|
+
readonly type: v.LiteralSchema<"after", undefined>;
|
|
229
|
+
readonly blockId: v.StringSchema<undefined>;
|
|
230
|
+
}, undefined>], undefined>, undefined>;
|
|
231
|
+
}, undefined>;
|
|
232
|
+
export type CreatePageMessage = v.InferOutput<typeof createPageMessageSchema>;
|
|
233
|
+
//# sourceMappingURL=createPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPage.d.ts","sourceRoot":"","sources":["../../../bridge/messages/createPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAOjD;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;0BAKzC,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CACnD,OAAO,8BAA8B,CACrC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;0BAMjC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAChC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,cAAc,EAAE,kBAAkB,CAAA;CAAE,CAAA;AAEjE;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAQlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionPageCoverSchema, notionPageIconSchema, notionPagePropertyWriteMapSchema, } from "../pages/page";
|
|
3
|
+
/**
|
|
4
|
+
* Describes where the newly created page should be inserted.
|
|
5
|
+
* - `start` / `end` (default): prepend / append to the request's `parent`
|
|
6
|
+
* page's children.
|
|
7
|
+
* - `before` / `after`: insert as a sibling of the anchor block identified by
|
|
8
|
+
* `blockId`, using the anchor's own structural parent. The anchor can be
|
|
9
|
+
* nested anywhere below the page (inside a toggle, column, callout, etc.).
|
|
10
|
+
*/
|
|
11
|
+
export const notionCreatePagePositionSchema = v.variant("type", [
|
|
12
|
+
v.object({ type: v.literal("start") }),
|
|
13
|
+
v.object({ type: v.literal("end") }),
|
|
14
|
+
v.object({ type: v.literal("before"), blockId: v.string() }),
|
|
15
|
+
v.object({ type: v.literal("after"), blockId: v.string() }),
|
|
16
|
+
]);
|
|
17
|
+
/**
|
|
18
|
+
* Parent accepted by the outbound `createPage` bridge message.
|
|
19
|
+
*
|
|
20
|
+
* Mirrors Notion's public API `POST /v1/pages` parent shape: `page_id` for a page-parented child,
|
|
21
|
+
* `data_source_id` for a database row. `data_source_id` is the internal collection ID.
|
|
22
|
+
*
|
|
23
|
+
* The SDK additionally accepts a higher-level `data_source_key` variant that resolves to
|
|
24
|
+
* `data_source_id` locally, using the `dataSources` mapping.
|
|
25
|
+
*/
|
|
26
|
+
export const createPageParentSchema = v.variant("type", [
|
|
27
|
+
v.object({ type: v.literal("page_id"), page_id: v.string() }),
|
|
28
|
+
v.object({
|
|
29
|
+
type: v.literal("data_source_id"),
|
|
30
|
+
data_source_id: v.string(),
|
|
31
|
+
}),
|
|
32
|
+
]);
|
|
33
|
+
/**
|
|
34
|
+
* Message sent by the sandbox to ask the host to create a new page on its behalf.
|
|
35
|
+
* The payload mirrors Notion's public `POST /v1/pages` API.
|
|
36
|
+
*/
|
|
37
|
+
export const createPageMessageSchema = v.object({
|
|
38
|
+
type: v.literal("createPage"),
|
|
39
|
+
requestId: v.string(),
|
|
40
|
+
parent: createPageParentSchema,
|
|
41
|
+
properties: notionPagePropertyWriteMapSchema,
|
|
42
|
+
icon: v.optional(notionPageIconSchema),
|
|
43
|
+
cover: v.optional(notionPageCoverSchema),
|
|
44
|
+
position: v.optional(notionCreatePagePositionSchema),
|
|
45
|
+
});
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* Message sent by the host in response to a sandbox `createPage` request.
|
|
4
|
+
*/
|
|
5
|
+
export declare const createPageResultMessageSchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
6
|
+
readonly type: v.LiteralSchema<"createPageResult", undefined>;
|
|
7
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
8
|
+
readonly status: v.LiteralSchema<"success", undefined>;
|
|
9
|
+
/** The newly created page. */
|
|
10
|
+
readonly page: v.ObjectSchema<{
|
|
11
|
+
readonly object: v.LiteralSchema<"page", undefined>;
|
|
12
|
+
readonly id: v.StringSchema<undefined>;
|
|
13
|
+
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
14
|
+
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
15
|
+
readonly page_id: v.StringSchema<undefined>;
|
|
16
|
+
}, undefined>, v.ObjectSchema<{
|
|
17
|
+
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
18
|
+
readonly data_source_id: v.StringSchema<undefined>;
|
|
19
|
+
}, undefined>, v.ObjectSchema<{
|
|
20
|
+
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
21
|
+
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
22
|
+
}, undefined>, v.ObjectSchema<{
|
|
23
|
+
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
24
|
+
readonly block_id: v.StringSchema<undefined>;
|
|
25
|
+
}, undefined>], undefined>;
|
|
26
|
+
readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
27
|
+
readonly type: v.LiteralSchema<"title", undefined>;
|
|
28
|
+
readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
29
|
+
readonly id: v.StringSchema<undefined>;
|
|
30
|
+
}, undefined>, v.ObjectSchema<{
|
|
31
|
+
readonly type: v.LiteralSchema<"rich_text", undefined>;
|
|
32
|
+
readonly rich_text: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
33
|
+
readonly id: v.StringSchema<undefined>;
|
|
34
|
+
}, undefined>, v.ObjectSchema<{
|
|
35
|
+
readonly type: v.LiteralSchema<"number", undefined>;
|
|
36
|
+
readonly number: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
37
|
+
readonly id: v.StringSchema<undefined>;
|
|
38
|
+
}, undefined>, v.ObjectSchema<{
|
|
39
|
+
readonly type: v.LiteralSchema<"url", undefined>;
|
|
40
|
+
readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
41
|
+
readonly id: v.StringSchema<undefined>;
|
|
42
|
+
}, undefined>, v.ObjectSchema<{
|
|
43
|
+
readonly type: v.LiteralSchema<"email", undefined>;
|
|
44
|
+
readonly email: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
45
|
+
readonly id: v.StringSchema<undefined>;
|
|
46
|
+
}, undefined>, v.ObjectSchema<{
|
|
47
|
+
readonly type: v.LiteralSchema<"phone_number", undefined>;
|
|
48
|
+
readonly phone_number: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
49
|
+
readonly id: v.StringSchema<undefined>;
|
|
50
|
+
}, undefined>, v.ObjectSchema<{
|
|
51
|
+
readonly type: v.LiteralSchema<"checkbox", undefined>;
|
|
52
|
+
readonly checkbox: v.BooleanSchema<undefined>;
|
|
53
|
+
readonly id: v.StringSchema<undefined>;
|
|
54
|
+
}, undefined>, v.ObjectSchema<{
|
|
55
|
+
readonly type: v.LiteralSchema<"select", undefined>;
|
|
56
|
+
readonly select: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
|
|
57
|
+
readonly id: v.StringSchema<undefined>;
|
|
58
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
59
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
60
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
61
|
+
}, undefined>, v.ObjectSchema<{
|
|
62
|
+
readonly name: v.StringSchema<undefined>;
|
|
63
|
+
readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
64
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
65
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
66
|
+
}, undefined>], undefined>, undefined>;
|
|
67
|
+
readonly id: v.StringSchema<undefined>;
|
|
68
|
+
}, undefined>, v.ObjectSchema<{
|
|
69
|
+
readonly type: v.LiteralSchema<"status", undefined>;
|
|
70
|
+
readonly status: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
|
|
71
|
+
readonly id: v.StringSchema<undefined>;
|
|
72
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
73
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
74
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
75
|
+
}, undefined>, v.ObjectSchema<{
|
|
76
|
+
readonly name: v.StringSchema<undefined>;
|
|
77
|
+
readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
78
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
79
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
80
|
+
}, undefined>], undefined>, undefined>;
|
|
81
|
+
readonly id: v.StringSchema<undefined>;
|
|
82
|
+
}, undefined>, v.ObjectSchema<{
|
|
83
|
+
readonly type: v.LiteralSchema<"multi_select", undefined>;
|
|
84
|
+
readonly multi_select: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
|
|
85
|
+
readonly id: v.StringSchema<undefined>;
|
|
86
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
87
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
88
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
89
|
+
}, undefined>, v.ObjectSchema<{
|
|
90
|
+
readonly name: v.StringSchema<undefined>;
|
|
91
|
+
readonly id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
92
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
93
|
+
readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
94
|
+
}, undefined>], undefined>, undefined>;
|
|
95
|
+
readonly id: v.StringSchema<undefined>;
|
|
96
|
+
}, undefined>, v.ObjectSchema<{
|
|
97
|
+
readonly type: v.LiteralSchema<"date", undefined>;
|
|
98
|
+
readonly date: v.NullableSchema<v.ObjectSchema<{
|
|
99
|
+
readonly start: v.StringSchema<undefined>;
|
|
100
|
+
readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
101
|
+
readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
102
|
+
}, undefined>, undefined>;
|
|
103
|
+
readonly id: v.StringSchema<undefined>;
|
|
104
|
+
}, undefined>, v.ObjectSchema<{
|
|
105
|
+
readonly type: v.LiteralSchema<"people", undefined>;
|
|
106
|
+
readonly people: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
|
|
107
|
+
readonly object: v.OptionalSchema<v.LiteralSchema<"user", undefined>, undefined>;
|
|
108
|
+
readonly id: v.StringSchema<undefined>;
|
|
109
|
+
}, undefined>, v.ObjectSchema<{
|
|
110
|
+
readonly object: v.LiteralSchema<"group", undefined>;
|
|
111
|
+
readonly id: v.StringSchema<undefined>;
|
|
112
|
+
readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
113
|
+
}, undefined>], undefined>, undefined>;
|
|
114
|
+
readonly id: v.StringSchema<undefined>;
|
|
115
|
+
}, undefined>, v.ObjectSchema<{
|
|
116
|
+
readonly type: v.LiteralSchema<"relation", undefined>;
|
|
117
|
+
readonly has_more: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
118
|
+
readonly relation: v.ArraySchema<v.ObjectSchema<{
|
|
119
|
+
readonly id: v.StringSchema<undefined>;
|
|
120
|
+
}, undefined>, undefined>;
|
|
121
|
+
readonly id: v.StringSchema<undefined>;
|
|
122
|
+
}, undefined>, v.ObjectSchema<{
|
|
123
|
+
readonly type: v.LiteralSchema<"files", undefined>;
|
|
124
|
+
readonly files: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
|
|
125
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
126
|
+
readonly name: v.StringSchema<undefined>;
|
|
127
|
+
readonly external: v.ObjectSchema<{
|
|
128
|
+
readonly url: v.StringSchema<undefined>;
|
|
129
|
+
}, undefined>;
|
|
130
|
+
}, undefined>, v.ObjectSchema<{
|
|
131
|
+
readonly type: v.LiteralSchema<"file", undefined>;
|
|
132
|
+
readonly name: v.StringSchema<undefined>;
|
|
133
|
+
readonly file: v.ObjectSchema<{
|
|
134
|
+
readonly url: v.StringSchema<undefined>;
|
|
135
|
+
readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
136
|
+
}, undefined>;
|
|
137
|
+
}, undefined>], undefined>, undefined>;
|
|
138
|
+
readonly id: v.StringSchema<undefined>;
|
|
139
|
+
}, undefined>, v.ObjectSchema<{
|
|
140
|
+
readonly type: v.LiteralSchema<"place", undefined>;
|
|
141
|
+
readonly place: v.NullableSchema<v.ObjectSchema<{
|
|
142
|
+
readonly lat: v.NumberSchema<undefined>;
|
|
143
|
+
readonly lon: v.NumberSchema<undefined>;
|
|
144
|
+
readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
145
|
+
readonly address: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
146
|
+
readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
147
|
+
readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
148
|
+
}, undefined>, undefined>;
|
|
149
|
+
readonly id: v.StringSchema<undefined>;
|
|
150
|
+
}, undefined>], undefined>, undefined>;
|
|
151
|
+
readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
152
|
+
readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
153
|
+
readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
154
|
+
readonly type: v.LiteralSchema<"emoji", undefined>;
|
|
155
|
+
readonly emoji: v.StringSchema<undefined>;
|
|
156
|
+
}, undefined>, v.ObjectSchema<{
|
|
157
|
+
readonly type: v.LiteralSchema<"custom_emoji", undefined>;
|
|
158
|
+
readonly custom_emoji: v.ObjectSchema<{
|
|
159
|
+
readonly id: v.StringSchema<undefined>;
|
|
160
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
161
|
+
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
162
|
+
}, undefined>;
|
|
163
|
+
}, undefined>, v.ObjectSchema<{
|
|
164
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
165
|
+
readonly external: v.ObjectSchema<{
|
|
166
|
+
readonly url: v.StringSchema<undefined>;
|
|
167
|
+
}, undefined>;
|
|
168
|
+
}, undefined>, v.ObjectSchema<{
|
|
169
|
+
readonly type: v.LiteralSchema<"file", undefined>;
|
|
170
|
+
readonly file: v.ObjectSchema<{
|
|
171
|
+
readonly url: v.StringSchema<undefined>;
|
|
172
|
+
readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
173
|
+
}, undefined>;
|
|
174
|
+
}, undefined>], undefined>, undefined>;
|
|
175
|
+
readonly cover: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
176
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
177
|
+
readonly external: v.ObjectSchema<{
|
|
178
|
+
readonly url: v.StringSchema<undefined>;
|
|
179
|
+
}, undefined>;
|
|
180
|
+
}, undefined>, v.ObjectSchema<{
|
|
181
|
+
readonly type: v.LiteralSchema<"file", undefined>;
|
|
182
|
+
readonly file: v.ObjectSchema<{
|
|
183
|
+
readonly url: v.StringSchema<undefined>;
|
|
184
|
+
readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
185
|
+
}, undefined>;
|
|
186
|
+
}, undefined>], undefined>, undefined>;
|
|
187
|
+
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
188
|
+
readonly public_url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
189
|
+
readonly in_trash: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
190
|
+
}, undefined>;
|
|
191
|
+
}, undefined>, v.ObjectSchema<{
|
|
192
|
+
readonly type: v.LiteralSchema<"createPageResult", undefined>;
|
|
193
|
+
readonly requestId: v.StringSchema<undefined>;
|
|
194
|
+
readonly status: v.LiteralSchema<"error", undefined>;
|
|
195
|
+
readonly error: v.StringSchema<undefined>;
|
|
196
|
+
}, undefined>], undefined>;
|
|
197
|
+
export type CreatePageResultMessage = v.InferOutput<typeof createPageResultMessageSchema>;
|
|
198
|
+
//# sourceMappingURL=createPageResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPageResult.d.ts","sourceRoot":"","sources":["../../../bridge/messages/createPageResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;IAKxC,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAS9B,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,6BAA6B,CACpC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionPageSchema } from "../pages/page";
|
|
3
|
+
/**
|
|
4
|
+
* Message sent by the host in response to a sandbox `createPage` request.
|
|
5
|
+
*/
|
|
6
|
+
export const createPageResultMessageSchema = v.variant("status", [
|
|
7
|
+
v.object({
|
|
8
|
+
type: v.literal("createPageResult"),
|
|
9
|
+
requestId: v.string(),
|
|
10
|
+
status: v.literal("success"),
|
|
11
|
+
/** The newly created page. */
|
|
12
|
+
page: notionPageSchema,
|
|
13
|
+
}),
|
|
14
|
+
v.object({
|
|
15
|
+
type: v.literal("createPageResult"),
|
|
16
|
+
requestId: v.string(),
|
|
17
|
+
status: v.literal("error"),
|
|
18
|
+
error: v.string(),
|
|
19
|
+
}),
|
|
20
|
+
]);
|