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.
Files changed (113) hide show
  1. package/README.md +286 -0
  2. package/dist/bridge/context.d.ts +44 -0
  3. package/dist/bridge/context.d.ts.map +1 -0
  4. package/dist/bridge/context.js +42 -0
  5. package/dist/bridge/dataSources/dataSource.d.ts +732 -0
  6. package/dist/bridge/dataSources/dataSource.d.ts.map +1 -0
  7. package/dist/bridge/dataSources/dataSource.js +37 -0
  8. package/dist/bridge/dataSources/dataSourcePage.d.ts +117 -0
  9. package/dist/bridge/dataSources/dataSourcePage.d.ts.map +1 -0
  10. package/dist/bridge/dataSources/dataSourcePage.js +13 -0
  11. package/dist/bridge/dataSources/dataSourceValue.d.ts +67 -0
  12. package/dist/bridge/dataSources/dataSourceValue.d.ts.map +1 -0
  13. package/dist/bridge/dataSources/dataSourceValue.js +14 -0
  14. package/dist/bridge/dataSources/dateValue.d.ts +158 -0
  15. package/dist/bridge/dataSources/dateValue.d.ts.map +1 -0
  16. package/dist/bridge/dataSources/dateValue.js +59 -0
  17. package/dist/bridge/dataSources/propertySchema.d.ts +191 -0
  18. package/dist/bridge/dataSources/propertySchema.d.ts.map +1 -0
  19. package/dist/bridge/dataSources/propertySchema.js +148 -0
  20. package/dist/bridge/dataSources/recordPointer.d.ts +10 -0
  21. package/dist/bridge/dataSources/recordPointer.d.ts.map +1 -0
  22. package/dist/bridge/dataSources/recordPointer.js +8 -0
  23. package/dist/bridge/ids.d.ts +21 -0
  24. package/dist/bridge/ids.d.ts.map +1 -0
  25. package/dist/bridge/ids.js +3 -0
  26. package/dist/bridge/incomingType.d.ts +10 -0
  27. package/dist/bridge/incomingType.d.ts.map +1 -0
  28. package/dist/bridge/incomingType.js +17 -0
  29. package/dist/bridge/manifest.d.ts +66 -0
  30. package/dist/bridge/manifest.d.ts.map +1 -0
  31. package/dist/bridge/manifest.js +40 -0
  32. package/dist/bridge/messages/contextChanged.d.ts +20 -0
  33. package/dist/bridge/messages/contextChanged.d.ts.map +1 -0
  34. package/dist/bridge/messages/contextChanged.js +10 -0
  35. package/dist/bridge/messages/createPage.d.ts +233 -0
  36. package/dist/bridge/messages/createPage.d.ts.map +1 -0
  37. package/dist/bridge/messages/createPage.js +45 -0
  38. package/dist/bridge/messages/createPageResult.d.ts +198 -0
  39. package/dist/bridge/messages/createPageResult.d.ts.map +1 -0
  40. package/dist/bridge/messages/createPageResult.js +20 -0
  41. package/dist/bridge/messages/dataSourcesChanged.d.ts +158 -0
  42. package/dist/bridge/messages/dataSourcesChanged.d.ts.map +1 -0
  43. package/dist/bridge/messages/dataSourcesChanged.js +13 -0
  44. package/dist/bridge/messages/getPage.d.ts +203 -0
  45. package/dist/bridge/messages/getPage.d.ts.map +1 -0
  46. package/dist/bridge/messages/getPage.js +24 -0
  47. package/dist/bridge/messages/hostToSandbox.d.ts +974 -0
  48. package/dist/bridge/messages/hostToSandbox.d.ts.map +1 -0
  49. package/dist/bridge/messages/hostToSandbox.js +24 -0
  50. package/dist/bridge/messages/init.d.ts +169 -0
  51. package/dist/bridge/messages/init.d.ts.map +1 -0
  52. package/dist/bridge/messages/init.js +17 -0
  53. package/dist/bridge/messages/invalidHostMessage.d.ts +15 -0
  54. package/dist/bridge/messages/invalidHostMessage.d.ts.map +1 -0
  55. package/dist/bridge/messages/invalidHostMessage.js +13 -0
  56. package/dist/bridge/messages/invalidSandboxMessage.d.ts +15 -0
  57. package/dist/bridge/messages/invalidSandboxMessage.d.ts.map +1 -0
  58. package/dist/bridge/messages/invalidSandboxMessage.js +13 -0
  59. package/dist/bridge/messages/queryDataSource.d.ts +13 -0
  60. package/dist/bridge/messages/queryDataSource.d.ts.map +1 -0
  61. package/dist/bridge/messages/queryDataSource.js +11 -0
  62. package/dist/bridge/messages/queryDataSourceResult.d.ts +77 -0
  63. package/dist/bridge/messages/queryDataSourceResult.d.ts.map +1 -0
  64. package/dist/bridge/messages/queryDataSourceResult.js +13 -0
  65. package/dist/bridge/messages/ready.d.ts +41 -0
  66. package/dist/bridge/messages/ready.d.ts.map +1 -0
  67. package/dist/bridge/messages/ready.js +22 -0
  68. package/dist/bridge/messages/resize.d.ts +12 -0
  69. package/dist/bridge/messages/resize.d.ts.map +1 -0
  70. package/dist/bridge/messages/resize.js +10 -0
  71. package/dist/bridge/messages/sandboxToHost.d.ts +389 -0
  72. package/dist/bridge/messages/sandboxToHost.d.ts.map +1 -0
  73. package/dist/bridge/messages/sandboxToHost.js +21 -0
  74. package/dist/bridge/messages/themeChanged.d.ts +11 -0
  75. package/dist/bridge/messages/themeChanged.d.ts.map +1 -0
  76. package/dist/bridge/messages/themeChanged.js +10 -0
  77. package/dist/bridge/messages/updatePage.d.ts +171 -0
  78. package/dist/bridge/messages/updatePage.d.ts.map +1 -0
  79. package/dist/bridge/messages/updatePage.js +14 -0
  80. package/dist/bridge/messages/updatePageResult.d.ts +197 -0
  81. package/dist/bridge/messages/updatePageResult.d.ts.map +1 -0
  82. package/dist/bridge/messages/updatePageResult.js +19 -0
  83. package/dist/bridge/pages/page.d.ts +651 -0
  84. package/dist/bridge/pages/page.d.ts.map +1 -0
  85. package/dist/bridge/pages/page.js +229 -0
  86. package/dist/bridge/pendingRequests.d.ts +14 -0
  87. package/dist/bridge/pendingRequests.d.ts.map +1 -0
  88. package/dist/bridge/pendingRequests.js +27 -0
  89. package/dist/bridge/theme.d.ts +4 -0
  90. package/dist/bridge/theme.d.ts.map +1 -0
  91. package/dist/bridge/theme.js +2 -0
  92. package/dist/host.d.ts +52 -0
  93. package/dist/host.d.ts.map +1 -0
  94. package/dist/host.js +32 -0
  95. package/dist/index.d.ts +27 -0
  96. package/dist/index.d.ts.map +1 -0
  97. package/dist/index.js +14 -0
  98. package/dist/notion.d.ts +113 -0
  99. package/dist/notion.d.ts.map +1 -0
  100. package/dist/notion.js +773 -0
  101. package/dist/pages.d.ts +23 -0
  102. package/dist/pages.d.ts.map +1 -0
  103. package/dist/pages.js +30 -0
  104. package/dist/react.d.ts +171 -0
  105. package/dist/react.d.ts.map +1 -0
  106. package/dist/react.js +284 -0
  107. package/dist/types.d.ts +124 -0
  108. package/dist/types.d.ts.map +1 -0
  109. package/dist/types.js +1 -0
  110. package/dist/utils.d.ts +9 -0
  111. package/dist/utils.d.ts.map +1 -0
  112. package/dist/utils.js +10 -0
  113. package/package.json +48 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostToSandbox.d.ts","sourceRoot":"","sources":["../../../bridge/messages/hostToSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAW5B;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAUrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
@@ -0,0 +1,24 @@
1
+ import * as v from "valibot";
2
+ import { contextChangedMessageSchema } from "./contextChanged";
3
+ import { createPageResultMessageSchema } from "./createPageResult";
4
+ import { dataSourcesChangedMessageSchema } from "./dataSourcesChanged";
5
+ import { getPageResultMessageSchema } from "./getPage";
6
+ import { initMessageSchema } from "./init";
7
+ import { invalidSandboxMessageSchema } from "./invalidSandboxMessage";
8
+ import { queryDataSourceResultMessageSchema } from "./queryDataSourceResult";
9
+ import { themeChangedMessageSchema } from "./themeChanged";
10
+ import { updatePageResultMessageSchema } from "./updatePageResult";
11
+ /**
12
+ * Discriminated union of every message the host is allowed to send the sandbox.
13
+ */
14
+ export const hostToSandboxMessageSchema = v.variant("type", [
15
+ initMessageSchema,
16
+ themeChangedMessageSchema,
17
+ contextChangedMessageSchema,
18
+ dataSourcesChangedMessageSchema,
19
+ queryDataSourceResultMessageSchema,
20
+ createPageResultMessageSchema,
21
+ getPageResultMessageSchema,
22
+ updatePageResultMessageSchema,
23
+ invalidSandboxMessageSchema,
24
+ ]);
@@ -0,0 +1,169 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Initialization message sent by the host to the sandbox exactly once, in response to the
4
+ * sandbox's `ready` message. After init, live updates flow through narrower messages
5
+ * (`themeChanged`, `contextChanged`, `dataSourcesChanged`).
6
+ */
7
+ export declare const initMessageSchema: v.ObjectSchema<{
8
+ readonly type: v.LiteralSchema<"init", undefined>;
9
+ readonly theme: v.PicklistSchema<["light", "dark"], undefined>;
10
+ readonly context: v.ObjectSchema<{
11
+ readonly customBlockId: v.StringSchema<undefined>;
12
+ readonly parent: v.ObjectSchema<{
13
+ readonly id: v.StringSchema<undefined>;
14
+ readonly type: v.StringSchema<undefined>;
15
+ }, undefined>;
16
+ readonly page: v.ObjectSchema<{
17
+ readonly id: v.StringSchema<undefined>;
18
+ }, undefined>;
19
+ }, undefined>;
20
+ readonly dataSources: v.ObjectSchema<{
21
+ readonly bindings: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
22
+ readonly collectionPointer: v.OptionalSchema<v.ObjectSchema<{
23
+ readonly id: v.CustomSchema<import("../ids").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>;
24
+ readonly table: v.StringSchema<undefined>;
25
+ readonly spaceId: v.OptionalSchema<v.CustomSchema<import("../ids").NotionSpaceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
26
+ }, undefined>, undefined>;
27
+ readonly collectionSchema: v.OptionalSchema<v.ObjectSchema<{
28
+ readonly id: v.OptionalSchema<v.CustomSchema<import("../ids").NotionDataSourceId, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
29
+ readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
30
+ readonly type: v.LiteralSchema<"title", undefined>;
31
+ readonly name: v.StringSchema<undefined>;
32
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
33
+ }, undefined>, v.ObjectSchema<{
34
+ readonly type: v.LiteralSchema<"rich_text", undefined>;
35
+ readonly name: v.StringSchema<undefined>;
36
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
37
+ }, undefined>, v.ObjectSchema<{
38
+ readonly type: v.LiteralSchema<"number", undefined>;
39
+ readonly name: v.StringSchema<undefined>;
40
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
41
+ }, undefined>, v.ObjectSchema<{
42
+ readonly type: v.LiteralSchema<"checkbox", undefined>;
43
+ readonly name: v.StringSchema<undefined>;
44
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
45
+ }, undefined>, v.ObjectSchema<{
46
+ readonly type: v.LiteralSchema<"url", undefined>;
47
+ readonly name: v.StringSchema<undefined>;
48
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
49
+ }, undefined>, v.ObjectSchema<{
50
+ readonly type: v.LiteralSchema<"email", undefined>;
51
+ readonly name: v.StringSchema<undefined>;
52
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
53
+ }, undefined>, v.ObjectSchema<{
54
+ readonly type: v.LiteralSchema<"phone_number", undefined>;
55
+ readonly name: v.StringSchema<undefined>;
56
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
57
+ }, undefined>, v.ObjectSchema<{
58
+ readonly type: v.LiteralSchema<"select", undefined>;
59
+ readonly options: v.ArraySchema<v.ObjectSchema<{
60
+ readonly id: v.StringSchema<undefined>;
61
+ readonly name: v.StringSchema<undefined>;
62
+ 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>;
63
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
64
+ }, undefined>, undefined>;
65
+ readonly name: v.StringSchema<undefined>;
66
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
67
+ }, undefined>, v.ObjectSchema<{
68
+ readonly type: v.LiteralSchema<"multi_select", undefined>;
69
+ readonly options: v.ArraySchema<v.ObjectSchema<{
70
+ readonly id: v.StringSchema<undefined>;
71
+ readonly name: v.StringSchema<undefined>;
72
+ 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>;
73
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
74
+ }, undefined>, undefined>;
75
+ readonly name: v.StringSchema<undefined>;
76
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
77
+ }, undefined>, v.ObjectSchema<{
78
+ readonly type: v.LiteralSchema<"status", undefined>;
79
+ readonly options: v.ArraySchema<v.ObjectSchema<{
80
+ readonly id: v.StringSchema<undefined>;
81
+ readonly name: v.StringSchema<undefined>;
82
+ 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>;
83
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
84
+ }, undefined>, undefined>;
85
+ readonly groups: v.ArraySchema<v.ObjectSchema<{
86
+ readonly id: v.StringSchema<undefined>;
87
+ readonly name: v.StringSchema<undefined>;
88
+ 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>;
89
+ readonly option_ids: v.ArraySchema<v.StringSchema<undefined>, undefined>;
90
+ }, undefined>, undefined>;
91
+ readonly name: v.StringSchema<undefined>;
92
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
93
+ }, undefined>, v.ObjectSchema<{
94
+ readonly type: v.LiteralSchema<"date", undefined>;
95
+ readonly name: v.StringSchema<undefined>;
96
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
97
+ }, undefined>, v.ObjectSchema<{
98
+ readonly type: v.LiteralSchema<"people", undefined>;
99
+ readonly name: v.StringSchema<undefined>;
100
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
101
+ }, undefined>, v.ObjectSchema<{
102
+ readonly type: v.LiteralSchema<"files", undefined>;
103
+ readonly name: v.StringSchema<undefined>;
104
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
105
+ }, undefined>, v.ObjectSchema<{
106
+ readonly type: v.LiteralSchema<"unique_id", undefined>;
107
+ readonly name: v.StringSchema<undefined>;
108
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
109
+ }, undefined>, v.ObjectSchema<{
110
+ readonly type: v.LiteralSchema<"relation", undefined>;
111
+ readonly data_source_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
112
+ readonly dual_property: v.OptionalSchema<v.ObjectSchema<{
113
+ readonly synced_property_id: v.StringSchema<undefined>;
114
+ readonly synced_property_name: v.StringSchema<undefined>;
115
+ }, undefined>, 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<"place", 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<"formula", 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<"rollup", 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<"button", undefined>;
132
+ readonly name: v.StringSchema<undefined>;
133
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
134
+ }, undefined>, v.ObjectSchema<{
135
+ readonly type: v.LiteralSchema<"verification", undefined>;
136
+ readonly name: v.StringSchema<undefined>;
137
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
138
+ }, undefined>, v.ObjectSchema<{
139
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
140
+ readonly name: v.StringSchema<undefined>;
141
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
142
+ }, undefined>, v.ObjectSchema<{
143
+ readonly type: v.LiteralSchema<"location", undefined>;
144
+ readonly name: v.StringSchema<undefined>;
145
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
146
+ }, undefined>, v.ObjectSchema<{
147
+ readonly type: v.LiteralSchema<"created_time", undefined>;
148
+ readonly name: v.StringSchema<undefined>;
149
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
150
+ }, undefined>, v.ObjectSchema<{
151
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
152
+ readonly name: v.StringSchema<undefined>;
153
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
154
+ }, undefined>, v.ObjectSchema<{
155
+ readonly type: v.LiteralSchema<"created_by", undefined>;
156
+ readonly name: v.StringSchema<undefined>;
157
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
158
+ }, undefined>, v.ObjectSchema<{
159
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
160
+ readonly name: v.StringSchema<undefined>;
161
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
162
+ }, undefined>], undefined>, undefined>;
163
+ }, undefined>, undefined>;
164
+ readonly propertyIdsByKey: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
165
+ }, undefined>, undefined>;
166
+ }, undefined>;
167
+ }, undefined>;
168
+ export type InitMessage = v.InferOutput<typeof initMessageSchema>;
169
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../bridge/messages/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAK5B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAO5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ import * as v from "valibot";
2
+ import { notionCustomBlockContextSchema } from "../context";
3
+ import { notionDataSourceBindingsSchema } from "../dataSources/dataSource";
4
+ import { notionThemeSchema } from "../theme";
5
+ /**
6
+ * Initialization message sent by the host to the sandbox exactly once, in response to the
7
+ * sandbox's `ready` message. After init, live updates flow through narrower messages
8
+ * (`themeChanged`, `contextChanged`, `dataSourcesChanged`).
9
+ */
10
+ export const initMessageSchema = v.object({
11
+ type: v.literal("init"),
12
+ theme: notionThemeSchema,
13
+ context: notionCustomBlockContextSchema,
14
+ dataSources: v.object({
15
+ bindings: notionDataSourceBindingsSchema,
16
+ }),
17
+ });
@@ -0,0 +1,15 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Sent by the sandbox back to the host when an inbound host-to-sandbox message could not be parsed
4
+ * (unknown `type`, schema mismatch, etc.). The host should never reply to an `invalidHostMessage`
5
+ * with another bridge error message.
6
+ */
7
+ export declare const invalidHostMessageSchema: v.ObjectSchema<{
8
+ readonly type: v.LiteralSchema<"invalidHostMessage", undefined>;
9
+ /**
10
+ * A human-readable string intended for sandbox-side logging. It has no structured contract.
11
+ */
12
+ readonly reason: v.StringSchema<undefined>;
13
+ }, undefined>;
14
+ export type InvalidHostMessage = v.InferOutput<typeof invalidHostMessageSchema>;
15
+ //# sourceMappingURL=invalidHostMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalidHostMessage.d.ts","sourceRoot":"","sources":["../../../bridge/messages/invalidHostMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;IAEpC;;OAEG;;aAEF,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Sent by the sandbox back to the host when an inbound host-to-sandbox message could not be parsed
4
+ * (unknown `type`, schema mismatch, etc.). The host should never reply to an `invalidHostMessage`
5
+ * with another bridge error message.
6
+ */
7
+ export const invalidHostMessageSchema = v.object({
8
+ type: v.literal("invalidHostMessage"),
9
+ /**
10
+ * A human-readable string intended for sandbox-side logging. It has no structured contract.
11
+ */
12
+ reason: v.string(),
13
+ });
@@ -0,0 +1,15 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Sent by the host back to the sandbox when an inbound sandbox-to-host message could not be parsed
4
+ * (unknown `type`, schema mismatch, etc.). The sandbox should never reply to an
5
+ * `invalidSandboxMessage` with another bridge error message.
6
+ */
7
+ export declare const invalidSandboxMessageSchema: v.ObjectSchema<{
8
+ readonly type: v.LiteralSchema<"invalidSandboxMessage", undefined>;
9
+ /**
10
+ * A human-readable string intended for sandbox-side logging. It has no structured contract.
11
+ */
12
+ readonly reason: v.StringSchema<undefined>;
13
+ }, undefined>;
14
+ export type InvalidSandboxMessage = v.InferOutput<typeof invalidSandboxMessageSchema>;
15
+ //# sourceMappingURL=invalidSandboxMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalidSandboxMessage.d.ts","sourceRoot":"","sources":["../../../bridge/messages/invalidSandboxMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;IAEvC;;OAEG;;aAEF,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,WAAW,CAChD,OAAO,2BAA2B,CAClC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Sent by the host back to the sandbox when an inbound sandbox-to-host message could not be parsed
4
+ * (unknown `type`, schema mismatch, etc.). The sandbox should never reply to an
5
+ * `invalidSandboxMessage` with another bridge error message.
6
+ */
7
+ export const invalidSandboxMessageSchema = v.object({
8
+ type: v.literal("invalidSandboxMessage"),
9
+ /**
10
+ * A human-readable string intended for sandbox-side logging. It has no structured contract.
11
+ */
12
+ reason: v.string(),
13
+ });
@@ -0,0 +1,13 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Message sent by the sandbox to ask the host to load (or reload) a data
4
+ * source with a given page size.
5
+ */
6
+ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
7
+ readonly type: v.LiteralSchema<"queryDataSource", undefined>;
8
+ readonly requestId: v.StringSchema<undefined>;
9
+ readonly key: v.StringSchema<undefined>;
10
+ readonly limit: v.NumberSchema<undefined>;
11
+ }, undefined>;
12
+ export type QueryDataSourceMessage = v.InferOutput<typeof queryDataSourceMessageSchema>;
13
+ //# sourceMappingURL=queryDataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryDataSource.d.ts","sourceRoot":"","sources":["../../../bridge/messages/queryDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;aAKvC,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,WAAW,CACjD,OAAO,4BAA4B,CACnC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Message sent by the sandbox to ask the host to load (or reload) a data
4
+ * source with a given page size.
5
+ */
6
+ export const queryDataSourceMessageSchema = v.object({
7
+ type: v.literal("queryDataSource"),
8
+ requestId: v.string(),
9
+ key: v.string(),
10
+ limit: v.number(),
11
+ });
@@ -0,0 +1,77 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Message sent by the host to the sandbox in response to a `queryDataSource` request.
4
+ */
5
+ export declare const queryDataSourceResultMessageSchema: v.ObjectSchema<{
6
+ readonly type: v.LiteralSchema<"queryDataSourceResult", undefined>;
7
+ readonly requestId: v.StringSchema<undefined>;
8
+ readonly key: v.StringSchema<undefined>;
9
+ readonly items: v.ArraySchema<v.ObjectSchema<{
10
+ readonly id: v.StringSchema<undefined>;
11
+ readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
12
+ readonly type: v.LiteralSchema<"date", undefined>;
13
+ readonly start_date: v.StringSchema<undefined>;
14
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
15
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
16
+ readonly value: v.NumberSchema<undefined>;
17
+ readonly time: v.StringSchema<undefined>;
18
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
19
+ }, undefined>, v.ObjectSchema<{
20
+ readonly unit: v.LiteralSchema<"none", undefined>;
21
+ }, undefined>], undefined>, undefined>;
22
+ }, undefined>, v.ObjectSchema<{
23
+ readonly type: v.LiteralSchema<"daterange", undefined>;
24
+ readonly start_date: v.StringSchema<undefined>;
25
+ readonly end_date: v.StringSchema<undefined>;
26
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
27
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
28
+ readonly value: v.NumberSchema<undefined>;
29
+ readonly time: v.StringSchema<undefined>;
30
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
31
+ }, undefined>, v.ObjectSchema<{
32
+ readonly unit: v.LiteralSchema<"none", undefined>;
33
+ }, undefined>], undefined>, undefined>;
34
+ }, undefined>, v.ObjectSchema<{
35
+ readonly type: v.LiteralSchema<"datetime", undefined>;
36
+ readonly start_date: v.StringSchema<undefined>;
37
+ readonly start_time: v.StringSchema<undefined>;
38
+ readonly time_zone: v.StringSchema<undefined>;
39
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
40
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
41
+ readonly value: v.NumberSchema<undefined>;
42
+ readonly time: v.StringSchema<undefined>;
43
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
44
+ }, undefined>, v.ObjectSchema<{
45
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
46
+ readonly value: v.NumberSchema<undefined>;
47
+ }, undefined>], undefined>, v.ObjectSchema<{
48
+ readonly unit: v.LiteralSchema<"none", undefined>;
49
+ }, undefined>], undefined>, undefined>;
50
+ }, undefined>, v.ObjectSchema<{
51
+ readonly type: v.LiteralSchema<"datetimerange", undefined>;
52
+ readonly start_date: v.StringSchema<undefined>;
53
+ readonly start_time: v.StringSchema<undefined>;
54
+ readonly end_date: v.StringSchema<undefined>;
55
+ readonly end_time: v.StringSchema<undefined>;
56
+ readonly time_zone: v.StringSchema<undefined>;
57
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
58
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
59
+ readonly value: v.NumberSchema<undefined>;
60
+ readonly time: v.StringSchema<undefined>;
61
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
62
+ }, undefined>, v.ObjectSchema<{
63
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
64
+ readonly value: v.NumberSchema<undefined>;
65
+ }, undefined>], undefined>, v.ObjectSchema<{
66
+ readonly unit: v.LiteralSchema<"none", undefined>;
67
+ }, undefined>], undefined>, undefined>;
68
+ }, undefined>], undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ArraySchema<v.ObjectSchema<{
69
+ readonly id: v.StringSchema<undefined>;
70
+ readonly table: v.StringSchema<undefined>;
71
+ }, undefined>, undefined>], undefined>, undefined>, undefined>;
72
+ }, undefined>, undefined>;
73
+ readonly hasMore: v.BooleanSchema<undefined>;
74
+ readonly error: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
75
+ }, undefined>;
76
+ export type QueryDataSourceResultMessage = v.InferOutput<typeof queryDataSourceResultMessageSchema>;
77
+ //# sourceMappingURL=queryDataSourceResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryDataSourceResult.d.ts","sourceRoot":"","sources":["../../../bridge/messages/queryDataSourceResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAO7C,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,WAAW,CACvD,OAAO,kCAAkC,CACzC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import * as v from "valibot";
2
+ import { notionDataSourcePageBridgeSchema } from "../dataSources/dataSourcePage";
3
+ /**
4
+ * Message sent by the host to the sandbox in response to a `queryDataSource` request.
5
+ */
6
+ export const queryDataSourceResultMessageSchema = v.object({
7
+ type: v.literal("queryDataSourceResult"),
8
+ requestId: v.string(),
9
+ key: v.string(),
10
+ items: v.array(notionDataSourcePageBridgeSchema),
11
+ hasMore: v.boolean(),
12
+ error: v.optional(v.string()),
13
+ });
@@ -0,0 +1,41 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * First message the sandbox sends after mount, kicking off the bridge handshake. The host replies
4
+ * with `init`.
5
+ */
6
+ export declare const readyMessageSchema: v.ObjectSchema<{
7
+ readonly type: v.LiteralSchema<"ready", undefined>;
8
+ /**
9
+ * Used to ensure that the host and client are using the same version of the bridge protocol. A
10
+ * single host needs to support multiple custom blocks built with different versions of the bridge
11
+ * protocol. Increment this number any time a breaking change is made to the bridge protocol.
12
+ */
13
+ readonly bridgeProtocolVersion: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
14
+ /**
15
+ * The data sources and settings the custom block expects. A sandbox sends `null` if it has no
16
+ * manifest-declared data requirements. `null` is used (rather than `undefined`) so the
17
+ * wire-level distinction between "explicitly no manifest" and "field omitted" survives
18
+ * `postMessage` serialization and runtime validation on the host.
19
+ */
20
+ readonly manifest: v.UnionSchema<[v.ObjectSchema<{
21
+ readonly version: v.LiteralSchema<1, undefined>;
22
+ readonly dataSources: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
23
+ readonly name: v.StringSchema<undefined>;
24
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
25
+ readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
26
+ readonly type: v.LiteralSchema<"emoji", undefined>;
27
+ readonly emoji: v.StringSchema<undefined>;
28
+ }, undefined>, v.ObjectSchema<{
29
+ readonly type: v.LiteralSchema<"external", undefined>;
30
+ readonly url: v.StringSchema<undefined>;
31
+ }, undefined>], undefined>, undefined>;
32
+ readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
33
+ readonly name: v.StringSchema<undefined>;
34
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
35
+ 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>;
36
+ }, undefined>, undefined>, {}>;
37
+ }, undefined>, undefined>;
38
+ }, undefined>, v.NullSchema<undefined>], undefined>;
39
+ }, undefined>;
40
+ export type ReadyMessage = v.InferOutput<typeof readyMessageSchema>;
41
+ //# sourceMappingURL=ready.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ready.d.ts","sourceRoot":"","sources":["../../../bridge/messages/ready.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;IAE9B;;;;OAIG;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;;aAEF,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
@@ -0,0 +1,22 @@
1
+ import * as v from "valibot";
2
+ import { manifestSchema } from "../manifest";
3
+ /**
4
+ * First message the sandbox sends after mount, kicking off the bridge handshake. The host replies
5
+ * with `init`.
6
+ */
7
+ export const readyMessageSchema = v.object({
8
+ type: v.literal("ready"),
9
+ /**
10
+ * Used to ensure that the host and client are using the same version of the bridge protocol. A
11
+ * single host needs to support multiple custom blocks built with different versions of the bridge
12
+ * protocol. Increment this number any time a breaking change is made to the bridge protocol.
13
+ */
14
+ bridgeProtocolVersion: v.optional(v.number()),
15
+ /**
16
+ * The data sources and settings the custom block expects. A sandbox sends `null` if it has no
17
+ * manifest-declared data requirements. `null` is used (rather than `undefined`) so the
18
+ * wire-level distinction between "explicitly no manifest" and "field omitted" survives
19
+ * `postMessage` serialization and runtime validation on the host.
20
+ */
21
+ manifest: v.union([manifestSchema, v.null_()]),
22
+ });
@@ -0,0 +1,12 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Message sent by the sandbox whenever its measured content height changes, so the host can resize
4
+ * the surrounding iframe to match. The host is free to clamp the value or ignore it. The sandbox
5
+ * always reports the most recent measurement.
6
+ */
7
+ export declare const resizeMessageSchema: v.ObjectSchema<{
8
+ readonly type: v.LiteralSchema<"resize", undefined>;
9
+ readonly height: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
10
+ }, undefined>;
11
+ export type ResizeMessage = v.InferOutput<typeof resizeMessageSchema>;
12
+ //# sourceMappingURL=resize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../../bridge/messages/resize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;aAG9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Message sent by the sandbox whenever its measured content height changes, so the host can resize
4
+ * the surrounding iframe to match. The host is free to clamp the value or ignore it. The sandbox
5
+ * always reports the most recent measurement.
6
+ */
7
+ export const resizeMessageSchema = v.object({
8
+ type: v.literal("resize"),
9
+ height: v.pipe(v.number(), v.finite(), v.minValue(0)),
10
+ });