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,191 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* Hex-token identifiers for Notion's named colors. Mirrors the public API's
|
|
4
|
+
* `select.options[].color` enum
|
|
5
|
+
* (https://developers.notion.com/reference/property-object#select).
|
|
6
|
+
*/
|
|
7
|
+
export declare const notionPropertyColorSchema: v.PicklistSchema<["default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red", "gray_background", "brown_background", "orange_background", "yellow_background", "green_background", "blue_background", "purple_background", "pink_background", "red_background", "default_background"], undefined>;
|
|
8
|
+
export type NotionPropertyColor = v.InferOutput<typeof notionPropertyColorSchema>;
|
|
9
|
+
export declare const notionPropertyOptionSchema: v.ObjectSchema<{
|
|
10
|
+
readonly id: v.StringSchema<undefined>;
|
|
11
|
+
readonly name: v.StringSchema<undefined>;
|
|
12
|
+
readonly color: v.OptionalSchema<v.PicklistSchema<["default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red", "gray_background", "brown_background", "orange_background", "yellow_background", "green_background", "blue_background", "purple_background", "pink_background", "red_background", "default_background"], undefined>, undefined>;
|
|
13
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
14
|
+
}, undefined>;
|
|
15
|
+
export type NotionPropertyOption = v.InferOutput<typeof notionPropertyOptionSchema>;
|
|
16
|
+
export declare const notionStatusGroupSchema: v.ObjectSchema<{
|
|
17
|
+
readonly id: v.StringSchema<undefined>;
|
|
18
|
+
readonly name: v.StringSchema<undefined>;
|
|
19
|
+
readonly color: v.OptionalSchema<v.PicklistSchema<["default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red", "gray_background", "brown_background", "orange_background", "yellow_background", "green_background", "blue_background", "purple_background", "pink_background", "red_background", "default_background"], undefined>, undefined>;
|
|
20
|
+
readonly option_ids: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
21
|
+
}, undefined>;
|
|
22
|
+
export type NotionStatusGroup = v.InferOutput<typeof notionStatusGroupSchema>;
|
|
23
|
+
export declare const notionDualPropertySchema: v.ObjectSchema<{
|
|
24
|
+
readonly synced_property_id: v.StringSchema<undefined>;
|
|
25
|
+
readonly synced_property_name: v.StringSchema<undefined>;
|
|
26
|
+
}, undefined>;
|
|
27
|
+
export type NotionDualProperty = v.InferOutput<typeof notionDualPropertySchema>;
|
|
28
|
+
/**
|
|
29
|
+
* Every Notion property type the bridge speaks, in a single readable list.
|
|
30
|
+
* Mirrors the Notion public API
|
|
31
|
+
* [property object](https://developers.notion.com/reference/property-object)
|
|
32
|
+
* type field. Internal-only types (`button`, `verification`,
|
|
33
|
+
* `last_visited_time`, `location`) and the four built-ins (`created_time`,
|
|
34
|
+
* `last_edited_time`, `created_by`, `last_edited_by`) are included under their
|
|
35
|
+
* bridge-native names.
|
|
36
|
+
*/
|
|
37
|
+
export declare const NOTION_PROPERTY_TYPES: readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"];
|
|
38
|
+
export declare const notionPropertyTypeSchema: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* String literal union of every supported Notion property type. Same set as
|
|
41
|
+
* the discriminator in `NotionPropertySchema` — split out so the manifest
|
|
42
|
+
* can declare expected property types without dragging in the per-type
|
|
43
|
+
* payload shapes.
|
|
44
|
+
*/
|
|
45
|
+
export type NotionPropertyType = v.InferOutput<typeof notionPropertyTypeSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* Per-property schema as exposed by the host over the custom-block bridge.
|
|
48
|
+
* The `type` discriminator must be one of {@link NOTION_PROPERTY_TYPES}.
|
|
49
|
+
*/
|
|
50
|
+
export declare const notionPropertySchemaSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
51
|
+
readonly type: v.LiteralSchema<"title", undefined>;
|
|
52
|
+
readonly name: v.StringSchema<undefined>;
|
|
53
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
54
|
+
}, undefined>, v.ObjectSchema<{
|
|
55
|
+
readonly type: v.LiteralSchema<"rich_text", undefined>;
|
|
56
|
+
readonly name: v.StringSchema<undefined>;
|
|
57
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
58
|
+
}, undefined>, v.ObjectSchema<{
|
|
59
|
+
readonly type: v.LiteralSchema<"number", undefined>;
|
|
60
|
+
readonly name: v.StringSchema<undefined>;
|
|
61
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
62
|
+
}, undefined>, v.ObjectSchema<{
|
|
63
|
+
readonly type: v.LiteralSchema<"checkbox", undefined>;
|
|
64
|
+
readonly name: v.StringSchema<undefined>;
|
|
65
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
66
|
+
}, undefined>, v.ObjectSchema<{
|
|
67
|
+
readonly type: v.LiteralSchema<"url", undefined>;
|
|
68
|
+
readonly name: v.StringSchema<undefined>;
|
|
69
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
70
|
+
}, undefined>, v.ObjectSchema<{
|
|
71
|
+
readonly type: v.LiteralSchema<"email", undefined>;
|
|
72
|
+
readonly name: v.StringSchema<undefined>;
|
|
73
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
74
|
+
}, undefined>, v.ObjectSchema<{
|
|
75
|
+
readonly type: v.LiteralSchema<"phone_number", undefined>;
|
|
76
|
+
readonly name: v.StringSchema<undefined>;
|
|
77
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
78
|
+
}, undefined>, v.ObjectSchema<{
|
|
79
|
+
readonly type: v.LiteralSchema<"select", undefined>;
|
|
80
|
+
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
81
|
+
readonly id: v.StringSchema<undefined>;
|
|
82
|
+
readonly name: v.StringSchema<undefined>;
|
|
83
|
+
readonly color: v.OptionalSchema<v.PicklistSchema<["default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red", "gray_background", "brown_background", "orange_background", "yellow_background", "green_background", "blue_background", "purple_background", "pink_background", "red_background", "default_background"], undefined>, undefined>;
|
|
84
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
85
|
+
}, undefined>, undefined>;
|
|
86
|
+
readonly name: v.StringSchema<undefined>;
|
|
87
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
88
|
+
}, undefined>, v.ObjectSchema<{
|
|
89
|
+
readonly type: v.LiteralSchema<"multi_select", undefined>;
|
|
90
|
+
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
91
|
+
readonly id: v.StringSchema<undefined>;
|
|
92
|
+
readonly name: v.StringSchema<undefined>;
|
|
93
|
+
readonly color: v.OptionalSchema<v.PicklistSchema<["default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red", "gray_background", "brown_background", "orange_background", "yellow_background", "green_background", "blue_background", "purple_background", "pink_background", "red_background", "default_background"], undefined>, undefined>;
|
|
94
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
95
|
+
}, undefined>, undefined>;
|
|
96
|
+
readonly name: v.StringSchema<undefined>;
|
|
97
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
98
|
+
}, undefined>, v.ObjectSchema<{
|
|
99
|
+
readonly type: v.LiteralSchema<"status", undefined>;
|
|
100
|
+
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
101
|
+
readonly id: v.StringSchema<undefined>;
|
|
102
|
+
readonly name: v.StringSchema<undefined>;
|
|
103
|
+
readonly color: v.OptionalSchema<v.PicklistSchema<["default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red", "gray_background", "brown_background", "orange_background", "yellow_background", "green_background", "blue_background", "purple_background", "pink_background", "red_background", "default_background"], undefined>, undefined>;
|
|
104
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
105
|
+
}, undefined>, undefined>;
|
|
106
|
+
readonly groups: v.ArraySchema<v.ObjectSchema<{
|
|
107
|
+
readonly id: v.StringSchema<undefined>;
|
|
108
|
+
readonly name: v.StringSchema<undefined>;
|
|
109
|
+
readonly color: v.OptionalSchema<v.PicklistSchema<["default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red", "gray_background", "brown_background", "orange_background", "yellow_background", "green_background", "blue_background", "purple_background", "pink_background", "red_background", "default_background"], undefined>, undefined>;
|
|
110
|
+
readonly option_ids: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
111
|
+
}, undefined>, undefined>;
|
|
112
|
+
readonly name: v.StringSchema<undefined>;
|
|
113
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
114
|
+
}, undefined>, v.ObjectSchema<{
|
|
115
|
+
readonly type: v.LiteralSchema<"date", undefined>;
|
|
116
|
+
readonly name: v.StringSchema<undefined>;
|
|
117
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
118
|
+
}, undefined>, v.ObjectSchema<{
|
|
119
|
+
readonly type: v.LiteralSchema<"people", undefined>;
|
|
120
|
+
readonly name: v.StringSchema<undefined>;
|
|
121
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
122
|
+
}, undefined>, v.ObjectSchema<{
|
|
123
|
+
readonly type: v.LiteralSchema<"files", undefined>;
|
|
124
|
+
readonly name: v.StringSchema<undefined>;
|
|
125
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
126
|
+
}, undefined>, v.ObjectSchema<{
|
|
127
|
+
readonly type: v.LiteralSchema<"unique_id", undefined>;
|
|
128
|
+
readonly name: v.StringSchema<undefined>;
|
|
129
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
130
|
+
}, undefined>, v.ObjectSchema<{
|
|
131
|
+
readonly type: v.LiteralSchema<"relation", undefined>;
|
|
132
|
+
readonly data_source_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
133
|
+
readonly dual_property: v.OptionalSchema<v.ObjectSchema<{
|
|
134
|
+
readonly synced_property_id: v.StringSchema<undefined>;
|
|
135
|
+
readonly synced_property_name: v.StringSchema<undefined>;
|
|
136
|
+
}, undefined>, undefined>;
|
|
137
|
+
readonly name: v.StringSchema<undefined>;
|
|
138
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
139
|
+
}, undefined>, v.ObjectSchema<{
|
|
140
|
+
readonly type: v.LiteralSchema<"place", undefined>;
|
|
141
|
+
readonly name: v.StringSchema<undefined>;
|
|
142
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
143
|
+
}, undefined>, v.ObjectSchema<{
|
|
144
|
+
readonly type: v.LiteralSchema<"formula", undefined>;
|
|
145
|
+
readonly name: v.StringSchema<undefined>;
|
|
146
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
147
|
+
}, undefined>, v.ObjectSchema<{
|
|
148
|
+
readonly type: v.LiteralSchema<"rollup", undefined>;
|
|
149
|
+
readonly name: v.StringSchema<undefined>;
|
|
150
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
151
|
+
}, undefined>, v.ObjectSchema<{
|
|
152
|
+
readonly type: v.LiteralSchema<"button", undefined>;
|
|
153
|
+
readonly name: v.StringSchema<undefined>;
|
|
154
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
155
|
+
}, undefined>, v.ObjectSchema<{
|
|
156
|
+
readonly type: v.LiteralSchema<"verification", undefined>;
|
|
157
|
+
readonly name: v.StringSchema<undefined>;
|
|
158
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
159
|
+
}, undefined>, v.ObjectSchema<{
|
|
160
|
+
readonly type: v.LiteralSchema<"last_visited_time", undefined>;
|
|
161
|
+
readonly name: v.StringSchema<undefined>;
|
|
162
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
163
|
+
}, undefined>, v.ObjectSchema<{
|
|
164
|
+
readonly type: v.LiteralSchema<"location", undefined>;
|
|
165
|
+
readonly name: v.StringSchema<undefined>;
|
|
166
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
167
|
+
}, undefined>, v.ObjectSchema<{
|
|
168
|
+
readonly type: v.LiteralSchema<"created_time", undefined>;
|
|
169
|
+
readonly name: v.StringSchema<undefined>;
|
|
170
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
171
|
+
}, undefined>, v.ObjectSchema<{
|
|
172
|
+
readonly type: v.LiteralSchema<"last_edited_time", undefined>;
|
|
173
|
+
readonly name: v.StringSchema<undefined>;
|
|
174
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
175
|
+
}, undefined>, v.ObjectSchema<{
|
|
176
|
+
readonly type: v.LiteralSchema<"created_by", undefined>;
|
|
177
|
+
readonly name: v.StringSchema<undefined>;
|
|
178
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
179
|
+
}, undefined>, v.ObjectSchema<{
|
|
180
|
+
readonly type: v.LiteralSchema<"last_edited_by", undefined>;
|
|
181
|
+
readonly name: v.StringSchema<undefined>;
|
|
182
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
183
|
+
}, undefined>], undefined>;
|
|
184
|
+
export type NotionPropertySchema = v.InferOutput<typeof notionPropertySchemaSchema>;
|
|
185
|
+
/**
|
|
186
|
+
* The four synthetic built-in property IDs the host always includes in every
|
|
187
|
+
* data source's `propertySchemasById` and every row's `propertiesById`.
|
|
188
|
+
*/
|
|
189
|
+
export declare const NOTION_BUILTIN_PROPERTY_IDS: readonly ["created_time", "last_edited_time", "created_by", "last_edited_by"];
|
|
190
|
+
export type NotionBuiltinPropertyId = (typeof NOTION_BUILTIN_PROPERTY_IDS)[number];
|
|
191
|
+
//# sourceMappingURL=propertySchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertySchema.d.ts","sourceRoot":"","sources":["../../../bridge/dataSources/propertySchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,iUAqBpC,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAC9C,OAAO,yBAAyB,CAChC,CAAA;AAED,eAAO,MAAM,0BAA0B;;;;;aAKrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA;AAED,eAAO,MAAM,uBAAuB;;;;;aAKlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E,eAAO,MAAM,wBAAwB;;;aAGnC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAO/E;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,4UA2BxB,CAAA;AAEV,eAAO,MAAM,wBAAwB,yWAAoC,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAiDrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,+EAK9B,CAAA;AAEV,MAAM,MAAM,uBAAuB,GAClC,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* Hex-token identifiers for Notion's named colors. Mirrors the public API's
|
|
4
|
+
* `select.options[].color` enum
|
|
5
|
+
* (https://developers.notion.com/reference/property-object#select).
|
|
6
|
+
*/
|
|
7
|
+
export const notionPropertyColorSchema = v.picklist([
|
|
8
|
+
"default",
|
|
9
|
+
"gray",
|
|
10
|
+
"brown",
|
|
11
|
+
"orange",
|
|
12
|
+
"yellow",
|
|
13
|
+
"green",
|
|
14
|
+
"blue",
|
|
15
|
+
"purple",
|
|
16
|
+
"pink",
|
|
17
|
+
"red",
|
|
18
|
+
"gray_background",
|
|
19
|
+
"brown_background",
|
|
20
|
+
"orange_background",
|
|
21
|
+
"yellow_background",
|
|
22
|
+
"green_background",
|
|
23
|
+
"blue_background",
|
|
24
|
+
"purple_background",
|
|
25
|
+
"pink_background",
|
|
26
|
+
"red_background",
|
|
27
|
+
"default_background",
|
|
28
|
+
]);
|
|
29
|
+
export const notionPropertyOptionSchema = v.object({
|
|
30
|
+
id: v.string(),
|
|
31
|
+
name: v.string(),
|
|
32
|
+
color: v.optional(notionPropertyColorSchema),
|
|
33
|
+
description: v.optional(v.string()),
|
|
34
|
+
});
|
|
35
|
+
export const notionStatusGroupSchema = v.object({
|
|
36
|
+
id: v.string(),
|
|
37
|
+
name: v.string(),
|
|
38
|
+
color: v.optional(notionPropertyColorSchema),
|
|
39
|
+
option_ids: v.array(v.string()),
|
|
40
|
+
});
|
|
41
|
+
export const notionDualPropertySchema = v.object({
|
|
42
|
+
synced_property_id: v.string(),
|
|
43
|
+
synced_property_name: v.string(),
|
|
44
|
+
});
|
|
45
|
+
const baseProp = v.object({
|
|
46
|
+
name: v.string(),
|
|
47
|
+
description: v.optional(v.string()),
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Every Notion property type the bridge speaks, in a single readable list.
|
|
51
|
+
* Mirrors the Notion public API
|
|
52
|
+
* [property object](https://developers.notion.com/reference/property-object)
|
|
53
|
+
* type field. Internal-only types (`button`, `verification`,
|
|
54
|
+
* `last_visited_time`, `location`) and the four built-ins (`created_time`,
|
|
55
|
+
* `last_edited_time`, `created_by`, `last_edited_by`) are included under their
|
|
56
|
+
* bridge-native names.
|
|
57
|
+
*/
|
|
58
|
+
export const NOTION_PROPERTY_TYPES = [
|
|
59
|
+
"title",
|
|
60
|
+
"rich_text",
|
|
61
|
+
"number",
|
|
62
|
+
"checkbox",
|
|
63
|
+
"url",
|
|
64
|
+
"email",
|
|
65
|
+
"phone_number",
|
|
66
|
+
"select",
|
|
67
|
+
"multi_select",
|
|
68
|
+
"status",
|
|
69
|
+
"date",
|
|
70
|
+
"people",
|
|
71
|
+
"files",
|
|
72
|
+
"unique_id",
|
|
73
|
+
"relation",
|
|
74
|
+
"place",
|
|
75
|
+
"formula",
|
|
76
|
+
"rollup",
|
|
77
|
+
"button",
|
|
78
|
+
"verification",
|
|
79
|
+
"last_visited_time",
|
|
80
|
+
"location",
|
|
81
|
+
"created_time",
|
|
82
|
+
"last_edited_time",
|
|
83
|
+
"created_by",
|
|
84
|
+
"last_edited_by",
|
|
85
|
+
];
|
|
86
|
+
export const notionPropertyTypeSchema = v.picklist(NOTION_PROPERTY_TYPES);
|
|
87
|
+
/**
|
|
88
|
+
* Per-property schema as exposed by the host over the custom-block bridge.
|
|
89
|
+
* The `type` discriminator must be one of {@link NOTION_PROPERTY_TYPES}.
|
|
90
|
+
*/
|
|
91
|
+
export const notionPropertySchemaSchema = v.variant("type", [
|
|
92
|
+
v.object({ ...baseProp.entries, type: v.literal("title") }),
|
|
93
|
+
v.object({ ...baseProp.entries, type: v.literal("rich_text") }),
|
|
94
|
+
v.object({ ...baseProp.entries, type: v.literal("number") }),
|
|
95
|
+
v.object({ ...baseProp.entries, type: v.literal("checkbox") }),
|
|
96
|
+
v.object({ ...baseProp.entries, type: v.literal("url") }),
|
|
97
|
+
v.object({ ...baseProp.entries, type: v.literal("email") }),
|
|
98
|
+
v.object({ ...baseProp.entries, type: v.literal("phone_number") }),
|
|
99
|
+
v.object({
|
|
100
|
+
...baseProp.entries,
|
|
101
|
+
type: v.literal("select"),
|
|
102
|
+
options: v.array(notionPropertyOptionSchema),
|
|
103
|
+
}),
|
|
104
|
+
v.object({
|
|
105
|
+
...baseProp.entries,
|
|
106
|
+
type: v.literal("multi_select"),
|
|
107
|
+
options: v.array(notionPropertyOptionSchema),
|
|
108
|
+
}),
|
|
109
|
+
v.object({
|
|
110
|
+
...baseProp.entries,
|
|
111
|
+
type: v.literal("status"),
|
|
112
|
+
options: v.array(notionPropertyOptionSchema),
|
|
113
|
+
groups: v.array(notionStatusGroupSchema),
|
|
114
|
+
}),
|
|
115
|
+
v.object({ ...baseProp.entries, type: v.literal("date") }),
|
|
116
|
+
v.object({ ...baseProp.entries, type: v.literal("people") }),
|
|
117
|
+
v.object({ ...baseProp.entries, type: v.literal("files") }),
|
|
118
|
+
v.object({ ...baseProp.entries, type: v.literal("unique_id") }),
|
|
119
|
+
v.object({
|
|
120
|
+
...baseProp.entries,
|
|
121
|
+
type: v.literal("relation"),
|
|
122
|
+
data_source_id: v.optional(v.string()),
|
|
123
|
+
dual_property: v.optional(notionDualPropertySchema),
|
|
124
|
+
}),
|
|
125
|
+
v.object({ ...baseProp.entries, type: v.literal("place") }),
|
|
126
|
+
v.object({ ...baseProp.entries, type: v.literal("formula") }),
|
|
127
|
+
v.object({ ...baseProp.entries, type: v.literal("rollup") }),
|
|
128
|
+
// Internal-only types passed through under their bridge-native names.
|
|
129
|
+
v.object({ ...baseProp.entries, type: v.literal("button") }),
|
|
130
|
+
v.object({ ...baseProp.entries, type: v.literal("verification") }),
|
|
131
|
+
v.object({ ...baseProp.entries, type: v.literal("last_visited_time") }),
|
|
132
|
+
v.object({ ...baseProp.entries, type: v.literal("location") }),
|
|
133
|
+
// Synthetic built-ins. The host always emits one of each per data source.
|
|
134
|
+
v.object({ ...baseProp.entries, type: v.literal("created_time") }),
|
|
135
|
+
v.object({ ...baseProp.entries, type: v.literal("last_edited_time") }),
|
|
136
|
+
v.object({ ...baseProp.entries, type: v.literal("created_by") }),
|
|
137
|
+
v.object({ ...baseProp.entries, type: v.literal("last_edited_by") }),
|
|
138
|
+
]);
|
|
139
|
+
/**
|
|
140
|
+
* The four synthetic built-in property IDs the host always includes in every
|
|
141
|
+
* data source's `propertySchemasById` and every row's `propertiesById`.
|
|
142
|
+
*/
|
|
143
|
+
export const NOTION_BUILTIN_PROPERTY_IDS = [
|
|
144
|
+
"created_time",
|
|
145
|
+
"last_edited_time",
|
|
146
|
+
"created_by",
|
|
147
|
+
"last_edited_by",
|
|
148
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* A pointer to a record in a database.
|
|
4
|
+
*/
|
|
5
|
+
export declare const notionRecordPointerSchema: v.ObjectSchema<{
|
|
6
|
+
readonly id: v.StringSchema<undefined>;
|
|
7
|
+
readonly table: v.StringSchema<undefined>;
|
|
8
|
+
}, undefined>;
|
|
9
|
+
export type NotionRecordPointer = v.InferOutput<typeof notionRecordPointerSchema>;
|
|
10
|
+
//# sourceMappingURL=recordPointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordPointer.d.ts","sourceRoot":"","sources":["../../../bridge/dataSources/recordPointer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;aAGpC,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAC9C,OAAO,yBAAyB,CAChC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
declare const notionDataSourceIdBrand: unique symbol;
|
|
3
|
+
declare const notionSpaceIdBrand: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Branded Notion data source ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
6
|
+
* but the brand keeps data source IDs from being accidentally mixed with other IDs in TypeScript.
|
|
7
|
+
*/
|
|
8
|
+
export type NotionDataSourceId = string & {
|
|
9
|
+
readonly [notionDataSourceIdBrand]: "NotionDataSourceId";
|
|
10
|
+
};
|
|
11
|
+
export declare const notionDataSourceIdSchema: v.CustomSchema<NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* Branded Notion workspace/space ID. Host payloads and SDK APIs use plain strings at runtime,
|
|
14
|
+
* but the brand keeps space IDs from being accidentally mixed with other IDs in TypeScript.
|
|
15
|
+
*/
|
|
16
|
+
export type NotionSpaceId = string & {
|
|
17
|
+
readonly [notionSpaceIdBrand]: "NotionSpaceId";
|
|
18
|
+
};
|
|
19
|
+
export declare const notionSpaceIdSchema: v.CustomSchema<NotionSpaceId, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../bridge/ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,MAAM,CAAA;AACpD,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAA;AAE/C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IACzC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,EAAE,oBAAoB,CAAA;CACxD,CAAA;AAED,eAAO,MAAM,wBAAwB,+EAGpC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IACpC,QAAQ,CAAC,CAAC,kBAAkB,CAAC,EAAE,eAAe,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,mBAAmB,0EAG/B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the `type` field off an inbound bridge message, if any.
|
|
3
|
+
*
|
|
4
|
+
* Used by both sides of the bridge after the canonical message schema rejects a payload. We still
|
|
5
|
+
* want to know what type the sender claimed to be sending so we can (a) avoid NACK loops on
|
|
6
|
+
* `invalidHostMessage` / `invalidSandboxMessage` and (b) include the type in the failure reason
|
|
7
|
+
* for debugging.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readIncomingType(data: unknown): string | undefined;
|
|
10
|
+
//# sourceMappingURL=incomingType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incomingType.d.ts","sourceRoot":"","sources":["../../bridge/incomingType.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAUlE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the `type` field off an inbound bridge message, if any.
|
|
3
|
+
*
|
|
4
|
+
* Used by both sides of the bridge after the canonical message schema rejects a payload. We still
|
|
5
|
+
* want to know what type the sender claimed to be sending so we can (a) avoid NACK loops on
|
|
6
|
+
* `invalidHostMessage` / `invalidSandboxMessage` and (b) include the type in the failure reason
|
|
7
|
+
* for debugging.
|
|
8
|
+
*/
|
|
9
|
+
export function readIncomingType(data) {
|
|
10
|
+
if (typeof data === "object" &&
|
|
11
|
+
data !== null &&
|
|
12
|
+
"type" in data &&
|
|
13
|
+
typeof data.type === "string") {
|
|
14
|
+
return data.type;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* User-authored manifest declaring the data sources the custom block expects.
|
|
4
|
+
* Lives at `custom_blocks.json` in the project root and is forwarded to the host with
|
|
5
|
+
* the bridge `ready` message so the host can pre-bind data sources, surface
|
|
6
|
+
* configuration UI, etc. The `notionCustomBlock` Vite plugin from
|
|
7
|
+
* `ncblock/vite` wires the JSON file into the dev server and
|
|
8
|
+
* the build output.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Decorative icon attached to a manifest data source. Mirrors the
|
|
12
|
+
* `emoji` / `external` icon variants the public Notion API uses, so the host
|
|
13
|
+
* can render a recognizable affordance next to the slot in setup UI.
|
|
14
|
+
*/
|
|
15
|
+
export declare const manifestIconSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
16
|
+
readonly type: v.LiteralSchema<"emoji", undefined>;
|
|
17
|
+
readonly emoji: v.StringSchema<undefined>;
|
|
18
|
+
}, undefined>, v.ObjectSchema<{
|
|
19
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
20
|
+
readonly url: v.StringSchema<undefined>;
|
|
21
|
+
}, undefined>], undefined>;
|
|
22
|
+
export type ManifestIcon = v.InferOutput<typeof manifestIconSchema>;
|
|
23
|
+
export declare const manifestPropertySchema: v.ObjectSchema<{
|
|
24
|
+
readonly name: v.StringSchema<undefined>;
|
|
25
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
26
|
+
readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
|
|
27
|
+
}, undefined>;
|
|
28
|
+
export type ManifestProperty = v.InferOutput<typeof manifestPropertySchema>;
|
|
29
|
+
export declare const manifestDataSourceSchema: v.ObjectSchema<{
|
|
30
|
+
readonly name: v.StringSchema<undefined>;
|
|
31
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
32
|
+
readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
33
|
+
readonly type: v.LiteralSchema<"emoji", undefined>;
|
|
34
|
+
readonly emoji: v.StringSchema<undefined>;
|
|
35
|
+
}, undefined>, v.ObjectSchema<{
|
|
36
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
37
|
+
readonly url: v.StringSchema<undefined>;
|
|
38
|
+
}, undefined>], undefined>, undefined>;
|
|
39
|
+
readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
40
|
+
readonly name: v.StringSchema<undefined>;
|
|
41
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
42
|
+
readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
|
|
43
|
+
}, undefined>, undefined>, {}>;
|
|
44
|
+
}, undefined>;
|
|
45
|
+
export type ManifestDataSource = v.InferOutput<typeof manifestDataSourceSchema>;
|
|
46
|
+
export declare const manifestSchema: v.ObjectSchema<{
|
|
47
|
+
readonly version: v.LiteralSchema<1, undefined>;
|
|
48
|
+
readonly dataSources: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
49
|
+
readonly name: v.StringSchema<undefined>;
|
|
50
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
51
|
+
readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
52
|
+
readonly type: v.LiteralSchema<"emoji", undefined>;
|
|
53
|
+
readonly emoji: v.StringSchema<undefined>;
|
|
54
|
+
}, undefined>, v.ObjectSchema<{
|
|
55
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
56
|
+
readonly url: v.StringSchema<undefined>;
|
|
57
|
+
}, undefined>], undefined>, undefined>;
|
|
58
|
+
readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
59
|
+
readonly name: v.StringSchema<undefined>;
|
|
60
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
61
|
+
readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
|
|
62
|
+
}, undefined>, undefined>, {}>;
|
|
63
|
+
}, undefined>, undefined>;
|
|
64
|
+
}, undefined>;
|
|
65
|
+
export type CustomBlockManifest = v.InferOutput<typeof manifestSchema>;
|
|
66
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../bridge/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;;;;;;GAOG;AAEH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;0BAS7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE,eAAO,MAAM,sBAAsB;;;;aAIjC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE3E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;aAKnC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE/E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;aAGzB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionPropertyTypeSchema } from "./dataSources/propertySchema";
|
|
3
|
+
/**
|
|
4
|
+
* User-authored manifest declaring the data sources the custom block expects.
|
|
5
|
+
* Lives at `custom_blocks.json` in the project root and is forwarded to the host with
|
|
6
|
+
* the bridge `ready` message so the host can pre-bind data sources, surface
|
|
7
|
+
* configuration UI, etc. The `notionCustomBlock` Vite plugin from
|
|
8
|
+
* `ncblock/vite` wires the JSON file into the dev server and
|
|
9
|
+
* the build output.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Decorative icon attached to a manifest data source. Mirrors the
|
|
13
|
+
* `emoji` / `external` icon variants the public Notion API uses, so the host
|
|
14
|
+
* can render a recognizable affordance next to the slot in setup UI.
|
|
15
|
+
*/
|
|
16
|
+
export const manifestIconSchema = v.variant("type", [
|
|
17
|
+
v.object({
|
|
18
|
+
type: v.literal("emoji"),
|
|
19
|
+
emoji: v.string(),
|
|
20
|
+
}),
|
|
21
|
+
v.object({
|
|
22
|
+
type: v.literal("external"),
|
|
23
|
+
url: v.string(),
|
|
24
|
+
}),
|
|
25
|
+
]);
|
|
26
|
+
export const manifestPropertySchema = v.object({
|
|
27
|
+
name: v.string(),
|
|
28
|
+
description: v.optional(v.string()),
|
|
29
|
+
type: notionPropertyTypeSchema,
|
|
30
|
+
});
|
|
31
|
+
export const manifestDataSourceSchema = v.object({
|
|
32
|
+
name: v.string(),
|
|
33
|
+
description: v.optional(v.string()),
|
|
34
|
+
icon: v.optional(manifestIconSchema),
|
|
35
|
+
properties: v.optional(v.record(v.string(), manifestPropertySchema), {}),
|
|
36
|
+
});
|
|
37
|
+
export const manifestSchema = v.object({
|
|
38
|
+
version: v.literal(1),
|
|
39
|
+
dataSources: v.record(v.string(), manifestDataSourceSchema),
|
|
40
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/**
|
|
3
|
+
* Message sent by the host whenever the custom block's position in the block tree changes (e.g. it
|
|
4
|
+
* is moved into a different parent block, or its enclosing page changes).
|
|
5
|
+
*/
|
|
6
|
+
export declare const contextChangedMessageSchema: v.ObjectSchema<{
|
|
7
|
+
readonly type: v.LiteralSchema<"contextChanged", undefined>;
|
|
8
|
+
readonly context: v.ObjectSchema<{
|
|
9
|
+
readonly customBlockId: v.StringSchema<undefined>;
|
|
10
|
+
readonly parent: v.ObjectSchema<{
|
|
11
|
+
readonly id: v.StringSchema<undefined>;
|
|
12
|
+
readonly type: v.StringSchema<undefined>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
readonly page: v.ObjectSchema<{
|
|
15
|
+
readonly id: v.StringSchema<undefined>;
|
|
16
|
+
}, undefined>;
|
|
17
|
+
}, undefined>;
|
|
18
|
+
}, undefined>;
|
|
19
|
+
export type ContextChangedMessage = v.InferOutput<typeof contextChangedMessageSchema>;
|
|
20
|
+
//# sourceMappingURL=contextChanged.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextChanged.d.ts","sourceRoot":"","sources":["../../../bridge/messages/contextChanged.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;aAGtC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,WAAW,CAChD,OAAO,2BAA2B,CAClC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionCustomBlockContextSchema } from "../context";
|
|
3
|
+
/**
|
|
4
|
+
* Message sent by the host whenever the custom block's position in the block tree changes (e.g. it
|
|
5
|
+
* is moved into a different parent block, or its enclosing page changes).
|
|
6
|
+
*/
|
|
7
|
+
export const contextChangedMessageSchema = v.object({
|
|
8
|
+
type: v.literal("contextChanged"),
|
|
9
|
+
context: notionCustomBlockContextSchema,
|
|
10
|
+
});
|