@notionhq/custom-blocks-dev-shell 0.1.115 → 0.1.116

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.
Files changed (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -13
  3. package/THIRD_PARTY_LICENSES.md +133 -0
  4. package/dist/assets/index-DSaseWP_.js +11 -0
  5. package/dist/assets/index-Do-x8yIt.css +2 -0
  6. package/dist/index.html +2 -2
  7. package/dist-cli/cli/published-cli.js +8467 -51
  8. package/docs/bindings.md +17 -12
  9. package/docs/bridge/changelog.md +67 -0
  10. package/docs/bridge/protocol.md +204 -0
  11. package/docs/bridge/versioning.md +38 -0
  12. package/docs/data-sources.md +49 -36
  13. package/docs/host/README.md +177 -0
  14. package/docs/host/docs/compatibility.md +68 -0
  15. package/docs/host/docs/handlers.md +199 -0
  16. package/docs/host/docs/lifecycle.md +117 -0
  17. package/package.json +5 -3
  18. package/dist/assets/index-DXzPwq_J.js +0 -11
  19. package/dist/assets/index-E1j3FxAu.css +0 -2
  20. package/dist-cli/cli/binding-cli-flags.js +0 -33
  21. package/dist-cli/cli/binding-errors.js +0 -15
  22. package/dist-cli/cli/block-csp.js +0 -84
  23. package/dist-cli/cli/build-block-registry.js +0 -30
  24. package/dist-cli/cli/convert-values.js +0 -222
  25. package/dist-cli/cli/convert.js +0 -210
  26. package/dist-cli/cli/data-source-files.js +0 -6
  27. package/dist-cli/cli/data-sources.js +0 -114
  28. package/dist-cli/cli/dev-shell-launcher.js +0 -239
  29. package/dist-cli/cli/dev-shell-run.js +0 -72
  30. package/dist-cli/cli/errors.js +0 -12
  31. package/dist-cli/cli/launcher-bindings.js +0 -144
  32. package/dist-cli/cli/materialize.js +0 -105
  33. package/dist-cli/cli/ports.js +0 -20
  34. package/dist-cli/cli/prebuilt.js +0 -23
  35. package/dist-cli/cli/runtime-error-client.js +0 -52
  36. package/dist-cli/cli/serve-ui.js +0 -110
  37. package/dist-cli/cli/shared-server.js +0 -70
  38. package/dist-cli/cli/utils.js +0 -52
  39. package/dist-cli/cli/vite-block-server.js +0 -125
  40. package/dist-cli/cli/vite-middleware.js +0 -111
  41. package/dist-cli/cli/worker-manifest.js +0 -158
  42. package/dist-cli/protocol/contrast.d.ts +0 -4
  43. package/dist-cli/protocol/contrast.js +0 -3
  44. package/dist-cli/protocol/dataSources/dataSource.d.ts +0 -786
  45. package/dist-cli/protocol/dataSources/dataSource.js +0 -66
  46. package/dist-cli/protocol/dataSources/dataSourcePage.d.ts +0 -74
  47. package/dist-cli/protocol/dataSources/dataSourcePage.js +0 -15
  48. package/dist-cli/protocol/dataSources/dataSourceValue.d.ts +0 -66
  49. package/dist-cli/protocol/dataSources/dataSourceValue.js +0 -14
  50. package/dist-cli/protocol/dataSources/dateValue.d.ts +0 -157
  51. package/dist-cli/protocol/dataSources/dateValue.js +0 -61
  52. package/dist-cli/protocol/dataSources/errors.d.ts +0 -8
  53. package/dist-cli/protocol/dataSources/errors.js +0 -7
  54. package/dist-cli/protocol/dataSources/propertySchema.d.ts +0 -200
  55. package/dist-cli/protocol/dataSources/propertySchema.js +0 -174
  56. package/dist-cli/protocol/dataSources/recordPointer.d.ts +0 -9
  57. package/dist-cli/protocol/dataSources/recordPointer.js +0 -8
  58. package/dist-cli/protocol/dataSources/sortDirection.d.ts +0 -3
  59. package/dist-cli/protocol/dataSources/sortDirection.js +0 -2
  60. package/dist-cli/protocol/errors.d.ts +0 -12
  61. package/dist-cli/protocol/errors.js +0 -6
  62. package/dist-cli/protocol/ids.d.ts +0 -31
  63. package/dist-cli/protocol/ids.js +0 -26
  64. package/dist-cli/protocol/index.d.ts +0 -53
  65. package/dist-cli/protocol/index.js +0 -53
  66. package/dist-cli/protocol/manifest.d.ts +0 -67
  67. package/dist-cli/protocol/manifest.js +0 -36
  68. package/dist-cli/protocol/messages/connect.d.ts +0 -54
  69. package/dist-cli/protocol/messages/connect.js +0 -39
  70. package/dist-cli/protocol/messages/contrastModeChanged.d.ts +0 -7
  71. package/dist-cli/protocol/messages/contrastModeChanged.js +0 -7
  72. package/dist-cli/protocol/messages/createPage.d.ts +0 -290
  73. package/dist-cli/protocol/messages/createPage.js +0 -51
  74. package/dist-cli/protocol/messages/createPageResult.d.ts +0 -897
  75. package/dist-cli/protocol/messages/createPageResult.js +0 -43
  76. package/dist-cli/protocol/messages/currentUserChanged.d.ts +0 -18
  77. package/dist-cli/protocol/messages/currentUserChanged.js +0 -9
  78. package/dist-cli/protocol/messages/dataSourcesChanged.d.ts +0 -157
  79. package/dist-cli/protocol/messages/dataSourcesChanged.js +0 -13
  80. package/dist-cli/protocol/messages/getPage.d.ts +0 -902
  81. package/dist-cli/protocol/messages/getPage.js +0 -48
  82. package/dist-cli/protocol/messages/getUser.d.ts +0 -44
  83. package/dist-cli/protocol/messages/getUser.js +0 -32
  84. package/dist-cli/protocol/messages/hostToSandbox.d.ts +0 -4385
  85. package/dist-cli/protocol/messages/hostToSandbox.js +0 -48
  86. package/dist-cli/protocol/messages/incomingType.d.ts +0 -9
  87. package/dist-cli/protocol/messages/incomingType.js +0 -17
  88. package/dist-cli/protocol/messages/init.d.ts +0 -273
  89. package/dist-cli/protocol/messages/init.js +0 -57
  90. package/dist-cli/protocol/messages/initResult.d.ts +0 -37
  91. package/dist-cli/protocol/messages/initResult.js +0 -29
  92. package/dist-cli/protocol/messages/invalidHostMessage.d.ts +0 -14
  93. package/dist-cli/protocol/messages/invalidHostMessage.js +0 -13
  94. package/dist-cli/protocol/messages/invalidSandboxMessage.d.ts +0 -14
  95. package/dist-cli/protocol/messages/invalidSandboxMessage.js +0 -13
  96. package/dist-cli/protocol/messages/isInitHandshakeMessage.d.ts +0 -4
  97. package/dist-cli/protocol/messages/isInitHandshakeMessage.js +0 -11
  98. package/dist-cli/protocol/messages/listUsers.d.ts +0 -52
  99. package/dist-cli/protocol/messages/listUsers.js +0 -33
  100. package/dist-cli/protocol/messages/messagePayload.d.ts +0 -19
  101. package/dist-cli/protocol/messages/messagePayload.js +0 -1
  102. package/dist-cli/protocol/messages/openExternalUrl.d.ts +0 -32
  103. package/dist-cli/protocol/messages/openExternalUrl.js +0 -26
  104. package/dist-cli/protocol/messages/openPage.d.ts +0 -38
  105. package/dist-cli/protocol/messages/openPage.js +0 -34
  106. package/dist-cli/protocol/messages/pageChanged.d.ts +0 -32
  107. package/dist-cli/protocol/messages/pageChanged.js +0 -9
  108. package/dist-cli/protocol/messages/parentChanged.d.ts +0 -26
  109. package/dist-cli/protocol/messages/parentChanged.js +0 -9
  110. package/dist-cli/protocol/messages/queryDataSource.d.ts +0 -1446
  111. package/dist-cli/protocol/messages/queryDataSource.js +0 -252
  112. package/dist-cli/protocol/messages/queryDataSourceResult.d.ts +0 -686
  113. package/dist-cli/protocol/messages/queryDataSourceResult.js +0 -44
  114. package/dist-cli/protocol/messages/resize.d.ts +0 -11
  115. package/dist-cli/protocol/messages/resize.js +0 -10
  116. package/dist-cli/protocol/messages/sandboxToHost.d.ts +0 -1091
  117. package/dist-cli/protocol/messages/sandboxToHost.js +0 -33
  118. package/dist-cli/protocol/messages/themeChanged.d.ts +0 -10
  119. package/dist-cli/protocol/messages/themeChanged.js +0 -10
  120. package/dist-cli/protocol/messages/unsubscribeDataSourceQuery.d.ts +0 -10
  121. package/dist-cli/protocol/messages/unsubscribeDataSourceQuery.js +0 -9
  122. package/dist-cli/protocol/messages/updatePage.d.ts +0 -271
  123. package/dist-cli/protocol/messages/updatePage.js +0 -23
  124. package/dist-cli/protocol/messages/updatePageResult.d.ts +0 -895
  125. package/dist-cli/protocol/messages/updatePageResult.js +0 -41
  126. package/dist-cli/protocol/pages/page.d.ts +0 -1422
  127. package/dist-cli/protocol/pages/page.js +0 -318
  128. package/dist-cli/protocol/parent.d.ts +0 -32
  129. package/dist-cli/protocol/parent.js +0 -13
  130. package/dist-cli/protocol/protocolVersion.d.ts +0 -8
  131. package/dist-cli/protocol/protocolVersion.js +0 -11
  132. package/dist-cli/protocol/theme.d.ts +0 -3
  133. package/dist-cli/protocol/theme.js +0 -2
  134. package/dist-cli/protocol/users/user.d.ts +0 -32
  135. package/dist-cli/protocol/users/user.js +0 -20
  136. package/dist-cli/shared/block-registry.js +0 -28
  137. package/dist-cli/shared/data-source.js +0 -22
  138. package/dist-cli/shared/runtime-config.js +0 -10
  139. package/dist-cli/shared/sample-data-source.js +0 -12
@@ -1,318 +0,0 @@
1
- /**
2
- * Notion page shapes exchanged over the custom block bridge.
3
- *
4
- * These mirror a narrow subset of Notion's public `POST /v1/pages` API, since that's the bridge
5
- * shape the host delivers for messages like `createPageResult`.
6
- */
7
- import * as v from "valibot";
8
- import { notionDateReminderSchema, notionDateTimeReminderSchema, notionDisabledReminderSchema, } from "../dataSources/dateValue.js";
9
- import { notionRecordPointerSchema } from "../dataSources/recordPointer.js";
10
- import { notionPageIdSchema } from "../ids.js";
11
- import { notionParentSchema } from "../parent.js";
12
- /**
13
- * The custom block's nearest enclosing page ancestor, carried in `init.page` and `pageChanged`.
14
- */
15
- export const customBlockPageSchema = v.variant("type", [
16
- /** The viewer cannot access the containing page; its ID and parent are not exposed. */
17
- v.object({ type: v.literal("unavailable") }),
18
- /** The viewer can access the containing page; includes its ID and parent location. */
19
- v.object({
20
- type: v.literal("page"),
21
- id: notionPageIdSchema,
22
- /**
23
- * The containing page's own parent. It lets a block distinguish a freestanding page from a
24
- * database row without a round trip. Not to be confused with the top-level `parent` runtime
25
- * value, which is the custom block's own parent.
26
- */
27
- parent: notionParentSchema,
28
- }),
29
- ]);
30
- export const notionEmojiIconSchema = v.object({
31
- type: v.literal("emoji"),
32
- emoji: v.string(),
33
- });
34
- export const notionCustomEmojiIconSchema = v.object({
35
- type: v.literal("custom_emoji"),
36
- custom_emoji: v.object({
37
- id: v.string(),
38
- name: v.optional(v.string()),
39
- url: v.optional(v.string()),
40
- }),
41
- });
42
- export const notionExternalFileSchema = v.object({
43
- type: v.literal("external"),
44
- external: v.object({ url: v.string() }),
45
- });
46
- export const notionHostedFileSchema = v.object({
47
- type: v.literal("file"),
48
- file: v.object({
49
- url: v.string(),
50
- expiry_time: v.optional(v.string()),
51
- }),
52
- });
53
- export const notionPageIconSchema = v.variant("type", [
54
- notionEmojiIconSchema,
55
- notionCustomEmojiIconSchema,
56
- notionExternalFileSchema,
57
- notionHostedFileSchema,
58
- ]);
59
- export const notionPageCoverSchema = v.variant("type", [
60
- notionExternalFileSchema,
61
- notionHostedFileSchema,
62
- ]);
63
- const nullableStringSchema = v.nullable(v.string());
64
- const notionRichTextItemSchema = v.record(v.string(), v.unknown());
65
- const notionSelectOptionInputSchema = v.union([
66
- v.object({
67
- id: v.string(),
68
- name: v.optional(v.string()),
69
- color: v.optional(v.string()),
70
- description: v.optional(nullableStringSchema),
71
- }),
72
- v.object({
73
- name: v.string(),
74
- id: v.optional(v.string()),
75
- color: v.optional(v.string()),
76
- description: v.optional(nullableStringSchema),
77
- }),
78
- ]);
79
- const dateInputEntries = {
80
- start: v.string(),
81
- end: v.optional(nullableStringSchema),
82
- time_zone: v.optional(nullableStringSchema),
83
- reminder: v.optional(v.union([notionDateTimeReminderSchema, notionDisabledReminderSchema])),
84
- };
85
- const notionDateInputSchema = v.union([
86
- v.object({
87
- ...dateInputEntries,
88
- start: v.pipe(v.string(), v.includes("T")),
89
- }),
90
- v.object({
91
- ...dateInputEntries,
92
- time_zone: v.string(),
93
- }),
94
- v.object({
95
- ...dateInputEntries,
96
- reminder: v.optional(v.union([notionDateReminderSchema, notionDisabledReminderSchema])),
97
- }),
98
- ]);
99
- const notionUserInputSchema = v.union([
100
- v.object({
101
- object: v.optional(v.literal("user")),
102
- id: v.string(),
103
- }),
104
- v.object({
105
- object: v.literal("group"),
106
- id: v.string(),
107
- name: v.optional(nullableStringSchema),
108
- }),
109
- ]);
110
- const notionRelationInputSchema = v.object({ id: v.string() });
111
- const notionFileInputSchema = v.union([
112
- v.object({
113
- type: v.literal("external"),
114
- name: v.string(),
115
- external: v.object({ url: v.string() }),
116
- }),
117
- v.object({
118
- type: v.literal("file"),
119
- name: v.string(),
120
- file: v.object({
121
- url: v.string(),
122
- expiry_time: v.optional(v.string()),
123
- }),
124
- }),
125
- ]);
126
- const notionPlaceInputSchema = v.object({
127
- lat: v.number(),
128
- lon: v.number(),
129
- name: v.optional(nullableStringSchema),
130
- address: v.optional(nullableStringSchema),
131
- aws_place_id: v.optional(nullableStringSchema),
132
- google_place_id: v.optional(nullableStringSchema),
133
- });
134
- const pagePropertyBaseSchema = {
135
- id: v.string(),
136
- };
137
- // TODO(custom-blocks): Make spaceId required for metadataActor
138
- const metadataActorSchema = v.nullable(v.object({
139
- ...notionRecordPointerSchema.entries,
140
- table: v.picklist(["notion_user", "bot", "organization_bot"]),
141
- spaceId: v.optional(v.string()),
142
- }));
143
- /**
144
- * A page property value.
145
- */
146
- export const notionPagePropertyValueSchema = v.variant("type", [
147
- v.object({
148
- ...pagePropertyBaseSchema,
149
- type: v.literal("title"),
150
- title: v.array(notionRichTextItemSchema),
151
- }),
152
- v.object({
153
- ...pagePropertyBaseSchema,
154
- type: v.literal("rich_text"),
155
- rich_text: v.array(notionRichTextItemSchema),
156
- }),
157
- v.object({
158
- ...pagePropertyBaseSchema,
159
- type: v.literal("number"),
160
- number: v.nullable(v.number()),
161
- }),
162
- v.object({
163
- ...pagePropertyBaseSchema,
164
- type: v.literal("url"),
165
- url: nullableStringSchema,
166
- }),
167
- v.object({
168
- ...pagePropertyBaseSchema,
169
- type: v.literal("email"),
170
- email: nullableStringSchema,
171
- }),
172
- v.object({
173
- ...pagePropertyBaseSchema,
174
- type: v.literal("phone_number"),
175
- phone_number: nullableStringSchema,
176
- }),
177
- v.object({
178
- ...pagePropertyBaseSchema,
179
- type: v.literal("checkbox"),
180
- checkbox: v.boolean(),
181
- }),
182
- v.object({
183
- ...pagePropertyBaseSchema,
184
- type: v.literal("select"),
185
- select: v.nullable(notionSelectOptionInputSchema),
186
- }),
187
- v.object({
188
- ...pagePropertyBaseSchema,
189
- type: v.literal("status"),
190
- status: v.nullable(notionSelectOptionInputSchema),
191
- }),
192
- v.object({
193
- ...pagePropertyBaseSchema,
194
- type: v.literal("multi_select"),
195
- multi_select: v.array(notionSelectOptionInputSchema),
196
- }),
197
- v.object({
198
- ...pagePropertyBaseSchema,
199
- type: v.literal("date"),
200
- date: v.nullable(notionDateInputSchema),
201
- }),
202
- v.object({
203
- ...pagePropertyBaseSchema,
204
- type: v.literal("people"),
205
- people: v.array(notionUserInputSchema),
206
- }),
207
- v.object({
208
- ...pagePropertyBaseSchema,
209
- type: v.literal("relation"),
210
- has_more: v.optional(v.boolean()),
211
- relation: v.array(notionRelationInputSchema),
212
- }),
213
- v.object({
214
- ...pagePropertyBaseSchema,
215
- type: v.literal("files"),
216
- files: v.array(notionFileInputSchema),
217
- }),
218
- v.object({
219
- ...pagePropertyBaseSchema,
220
- type: v.literal("place"),
221
- place: v.nullable(notionPlaceInputSchema),
222
- }),
223
- v.object({
224
- ...pagePropertyBaseSchema,
225
- type: v.literal("created_time"),
226
- created_time: nullableStringSchema,
227
- }),
228
- v.object({
229
- ...pagePropertyBaseSchema,
230
- type: v.literal("last_edited_time"),
231
- last_edited_time: nullableStringSchema,
232
- }),
233
- v.object({
234
- ...pagePropertyBaseSchema,
235
- type: v.literal("created_by"),
236
- created_by: metadataActorSchema,
237
- }),
238
- v.object({
239
- ...pagePropertyBaseSchema,
240
- type: v.literal("last_edited_by"),
241
- last_edited_by: metadataActorSchema,
242
- }),
243
- v.object({
244
- ...pagePropertyBaseSchema,
245
- type: v.literal("last_visited_time"),
246
- last_visited_time: nullableStringSchema,
247
- }),
248
- v.object({
249
- ...pagePropertyBaseSchema,
250
- type: v.literal("unique_id"),
251
- unique_id: v.string(),
252
- }),
253
- v.object({
254
- ...pagePropertyBaseSchema,
255
- type: v.literal("button"),
256
- button: v.string(),
257
- }),
258
- v.object({
259
- ...pagePropertyBaseSchema,
260
- type: v.literal("formula"),
261
- formula: v.string(),
262
- }),
263
- v.object({
264
- ...pagePropertyBaseSchema,
265
- type: v.literal("location"),
266
- location: v.string(),
267
- }),
268
- v.object({
269
- ...pagePropertyBaseSchema,
270
- type: v.literal("rollup"),
271
- rollup: v.string(),
272
- }),
273
- v.object({
274
- ...pagePropertyBaseSchema,
275
- type: v.literal("verification"),
276
- verification: v.string(),
277
- }),
278
- ]);
279
- export const notionPagePropertyWriteMapSchema = v.record(v.string(), notionPagePropertyValueSchema);
280
- export const notionPagePropertyReadMapSchema = v.record(v.string(), v.nullable(notionPagePropertyValueSchema));
281
- /**
282
- * The `Page` object returned in `createPageResult` messages.
283
- */
284
- export const notionPageDataSchema = v.object({
285
- object: v.literal("page"),
286
- id: notionPageIdSchema,
287
- parent: notionParentSchema,
288
- properties: notionPagePropertyReadMapSchema,
289
- created_by: v.optional(metadataActorSchema, null),
290
- last_edited_by: v.optional(metadataActorSchema, null),
291
- last_visited_time: v.optional(v.nullable(v.string()), null),
292
- created_time: v.optional(v.nullable(v.string()), null),
293
- last_edited_time: v.optional(v.nullable(v.string()), null),
294
- icon: v.optional(v.nullable(notionPageIconSchema), null),
295
- cover: v.optional(v.nullable(notionPageCoverSchema), null),
296
- url: v.optional(v.nullable(v.string()), null),
297
- public_url: v.optional(v.nullable(v.string()), null),
298
- /** Whether the page or an ancestor is archived. */
299
- is_archived: v.boolean(),
300
- /** Whether the page or an ancestor is in Trash. */
301
- in_trash: v.boolean(),
302
- });
303
- export const legacyNotionPageSchema = v.object({
304
- object: v.literal("page"),
305
- id: notionPageIdSchema,
306
- parent: notionParentSchema,
307
- properties: notionPagePropertyWriteMapSchema,
308
- created_time: v.optional(v.string()),
309
- last_edited_time: v.optional(v.string()),
310
- icon: v.optional(notionPageIconSchema),
311
- cover: v.optional(notionPageCoverSchema),
312
- url: v.optional(v.string()),
313
- public_url: v.optional(v.string()),
314
- /** Whether the page or an ancestor is archived. */
315
- is_archived: v.boolean(),
316
- /** Whether the page or an ancestor is in Trash. */
317
- in_trash: v.boolean(),
318
- });
@@ -1,32 +0,0 @@
1
- import * as v from "valibot";
2
- export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema<{
3
- readonly type: v.LiteralSchema<"page_id", undefined>;
4
- readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
5
- }, undefined>, v.ObjectSchema<{
6
- readonly type: v.LiteralSchema<"data_source_id", undefined>;
7
- readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
8
- }, undefined>, v.ObjectSchema<{
9
- readonly type: v.LiteralSchema<"workspace", undefined>;
10
- readonly workspace: v.LiteralSchema<true, undefined>;
11
- }, undefined>, v.ObjectSchema<{
12
- readonly type: v.LiteralSchema<"block_id", undefined>;
13
- readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
14
- }, undefined>, v.ObjectSchema<{
15
- readonly type: v.LiteralSchema<"agent_id", undefined>;
16
- readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
17
- }, undefined>, v.ObjectSchema<{
18
- readonly type: v.LiteralSchema<"unavailable", undefined>;
19
- }, undefined>], undefined>;
20
- /**
21
- * A record's parent reference.
22
- *
23
- * Uses Notion public API parent names, plus an unavailable state:
24
- * - `page_id` — parented directly under a page.
25
- * - `block_id` — parented under a non-page container block (toggle, column, callout, ...).
26
- * - `data_source_id` — parented under a collection (data source).
27
- * - `workspace` — top-level / team-rooted.
28
- * - `agent_id` — owned by an agent, such as an agent instruction page or its blocks.
29
- * - `unavailable` — the viewer cannot access the parent resource. Neither its ID nor its kind
30
- * is exposed, including when a readable child identifies the parent as a data source.
31
- */
32
- export type NotionParent = v.InferOutput<typeof notionParentSchema>;
@@ -1,13 +0,0 @@
1
- import * as v from "valibot";
2
- import { notionAgentIdSchema, notionBlockIdSchema, notionDataSourceIdSchema, notionPageIdSchema, } from "./ids.js";
3
- export const notionParentSchema = v.variant("type", [
4
- v.object({ type: v.literal("page_id"), page_id: notionPageIdSchema }),
5
- v.object({
6
- type: v.literal("data_source_id"),
7
- data_source_id: notionDataSourceIdSchema,
8
- }),
9
- v.object({ type: v.literal("workspace"), workspace: v.literal(true) }),
10
- v.object({ type: v.literal("block_id"), block_id: notionBlockIdSchema }),
11
- v.object({ type: v.literal("agent_id"), agent_id: notionAgentIdSchema }),
12
- v.object({ type: v.literal("unavailable") }),
13
- ]);
@@ -1,8 +0,0 @@
1
- /**
2
- * The protocol version that the current SDK sends in `connect`.
3
- * Increase this value for breaking wire changes. Hosts can continue to accept
4
- * older versions, so this value does not set the minimum or maximum they accept.
5
- */
6
- export declare const LATEST_BRIDGE_PROTOCOL_VERSION = 7;
7
- export declare const LEGACY_PROPERTY_SHAPE_PROTOCOL_VERSION = 6;
8
- export declare const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
@@ -1,11 +0,0 @@
1
- /**
2
- * The protocol version that the current SDK sends in `connect`.
3
- * Increase this value for breaking wire changes. Hosts can continue to accept
4
- * older versions, so this value does not set the minimum or maximum they accept.
5
- */
6
- export const LATEST_BRIDGE_PROTOCOL_VERSION = 7;
7
- // Protocol 6 introduces unified pages with name-keyed property objects.
8
- // Keep this cutoff fixed when the latest protocol version increases.
9
- export const LEGACY_PROPERTY_SHAPE_PROTOCOL_VERSION = 6;
10
- // Protocol 7 adds typed text fallbacks for previously unsupported page properties.
11
- export const TEXT_FALLBACK_PROPERTY_PROTOCOL_VERSION = 7;
@@ -1,3 +0,0 @@
1
- import * as v from "valibot";
2
- export declare const notionThemeSchema: v.PicklistSchema<["light", "dark"], undefined>;
3
- export type NotionTheme = v.InferOutput<typeof notionThemeSchema>;
@@ -1,2 +0,0 @@
1
- import * as v from "valibot";
2
- export const notionThemeSchema = v.picklist(["light", "dark"]);
@@ -1,32 +0,0 @@
1
- import * as v from "valibot";
2
- export declare const notionUserIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
3
- export type NotionUserId = v.InferOutput<typeof notionUserIdSchema>;
4
- export declare const notionUserSchema: v.ObjectSchema<{
5
- readonly object: v.LiteralSchema<"user", undefined>;
6
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
7
- readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
8
- readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
9
- readonly type: v.LiteralSchema<"person", undefined>;
10
- readonly person: v.ObjectSchema<{
11
- readonly email: v.StringSchema<undefined>;
12
- }, undefined>;
13
- }, undefined>;
14
- export type NotionUser = v.InferOutput<typeof notionUserSchema>;
15
- export declare const notionUserListSchema: v.ObjectSchema<{
16
- readonly object: v.LiteralSchema<"list", undefined>;
17
- readonly results: v.ArraySchema<v.ObjectSchema<{
18
- readonly object: v.LiteralSchema<"user", undefined>;
19
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionUserId">]>;
20
- readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
21
- readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
22
- readonly type: v.LiteralSchema<"person", undefined>;
23
- readonly person: v.ObjectSchema<{
24
- readonly email: v.StringSchema<undefined>;
25
- }, undefined>;
26
- }, undefined>, undefined>;
27
- readonly next_cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
28
- readonly has_more: v.BooleanSchema<undefined>;
29
- readonly type: v.LiteralSchema<"user", undefined>;
30
- readonly user: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
31
- }, undefined>;
32
- export type NotionUserList = v.InferOutput<typeof notionUserListSchema>;
@@ -1,20 +0,0 @@
1
- import * as v from "valibot";
2
- export const notionUserIdSchema = v.pipe(v.string(), v.brand("NotionUserId"));
3
- export const notionUserSchema = v.object({
4
- object: v.literal("user"),
5
- id: notionUserIdSchema,
6
- name: v.optional(v.string()),
7
- avatar_url: v.nullable(v.string()),
8
- type: v.literal("person"),
9
- person: v.object({
10
- email: v.string(),
11
- }),
12
- });
13
- export const notionUserListSchema = v.object({
14
- object: v.literal("list"),
15
- results: v.array(notionUserSchema),
16
- next_cursor: v.nullable(v.string()),
17
- has_more: v.boolean(),
18
- type: v.literal("user"),
19
- user: v.record(v.string(), v.unknown()),
20
- });
@@ -1,28 +0,0 @@
1
- import { manifestSchema } from "../protocol/index.js";
2
- import * as v from "valibot";
3
- /** Launcher configuration serialized to the dev shell UI. */
4
- const registryBlockSchema = v.object({
5
- key: v.string(),
6
- name: v.string(),
7
- url: v.string(),
8
- /** Invalid manifests stay unavailable so the preview can report the failure. */
9
- manifest: v.optional(manifestSchema),
10
- /** Maps each slot key to a filename in data/, including .json. Other slots use filename defaults. */
11
- sampleFilesByDataSource: v.optional(v.record(v.string(), v.string()), {}),
12
- /** Maps slot keys to declared property keys, then to sample schema keys. Overrides automatic matches. */
13
- propertyIdsByDataSource: v.optional(v.record(v.string(), v.record(v.string(), v.string())), {}),
14
- });
15
- /** Validate registry fields while retaining blocks with invalid manifests. */
16
- export function parseRegistryBlocks(input) {
17
- const metadataSchema = v.looseObject(v.omit(registryBlockSchema, ["manifest"]).entries);
18
- return v.parse(v.array(metadataSchema), input).map(block => {
19
- const parsed = v.safeParse(manifestSchema, block.manifest);
20
- if (!parsed.success) {
21
- console.warn("[dev-shell] Invalid worker manifest", {
22
- blockKey: block.key,
23
- issues: parsed.issues,
24
- });
25
- }
26
- return { ...block, manifest: parsed.success ? parsed.output : undefined };
27
- });
28
- }
@@ -1,22 +0,0 @@
1
- import { notionPropertySchemaSchema } from "../protocol/index.js";
2
- import * as v from "valibot";
3
- export const dataSourceTypeSchema = v.picklist([
4
- "built-in",
5
- "worker",
6
- "manual",
7
- "syncedFromProd",
8
- ]);
9
- const dataSourceRowSchema = v.looseObject({ id: v.string() });
10
- const dataSourcePropertiesSchema = v.record(v.string(), notionPropertySchemaSchema);
11
- /** Normalized sample data sent from the launcher to the browser. */
12
- export const dataSourceSchema = v.object({
13
- type: dataSourceTypeSchema,
14
- key: v.string(),
15
- filename: v.optional(v.string()),
16
- name: v.string(),
17
- /** Optional emoji shown alongside the source. */
18
- icon: v.optional(v.string()),
19
- schema: dataSourcePropertiesSchema,
20
- rows: v.array(dataSourceRowSchema),
21
- });
22
- const fileDataSourceSchema = v.required(dataSourceSchema, ["filename"]);
@@ -1,10 +0,0 @@
1
- import * as v from "valibot";
2
- import { parseRegistryBlocks } from "./block-registry.js";
3
- import { dataSourceSchema } from "./data-source.js";
4
- /** Configuration injected into the prebuilt UI or supplied through Vite. */
5
- export const runtimeConfigSchema = v.object({
6
- blocks: v.pipe(v.unknown(), v.transform(parseRegistryBlocks)),
7
- dataSources: v.array(dataSourceSchema),
8
- /** Filenames without .json. The UI offers bundled sources until all are present. */
9
- prebuiltFilenames: v.optional(v.array(v.string())),
10
- });
@@ -1,12 +0,0 @@
1
- /**
2
- * Select a sample data source by filename for one declared data source slot.
3
- * Use `explicitFilename` when supplied. Otherwise prefer `worker_<slotKey>.json`
4
- * over `<slotKey>.json`. Return `undefined` when no file matches.
5
- */
6
- export function selectSampleDataSource({ slotKey, sources, explicitFilename, }) {
7
- if (explicitFilename !== undefined) {
8
- return sources.find(source => `${source.filename}.json` === explicitFilename);
9
- }
10
- return (sources.find(source => source.filename === `worker_${slotKey}`) ??
11
- sources.find(source => source.filename === slotKey));
12
- }