@notionhq/custom-blocks 0.2.21 → 0.2.23

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 (70) hide show
  1. package/README.md +2 -0
  2. package/dist/bridge/SandboxBridge.d.ts +14 -18
  3. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  4. package/dist/bridge/SandboxBridge.js +59 -201
  5. package/dist/bridge/SandboxInitialization.d.ts +52 -0
  6. package/dist/bridge/SandboxInitialization.d.ts.map +1 -0
  7. package/dist/bridge/SandboxInitialization.js +217 -0
  8. package/dist/bridge/dataSources/query.d.ts.map +1 -1
  9. package/dist/bridge/dataSources/query.js +39 -23
  10. package/dist/bridge/messageInterceptor.d.ts +4 -0
  11. package/dist/bridge/messageInterceptor.d.ts.map +1 -0
  12. package/dist/bridge/messageInterceptor.js +1 -0
  13. package/dist/bridge/sandboxClient.d.ts +3 -2
  14. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  15. package/dist/bridge/sandboxClient.js +3 -5
  16. package/dist/bridge.d.ts +11 -0
  17. package/dist/bridge.d.ts.map +1 -0
  18. package/dist/bridge.js +11 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/init.d.ts +4 -38
  22. package/dist/init.d.ts.map +1 -1
  23. package/dist/init.js +4 -91
  24. package/dist/initTypes.d.ts +31 -0
  25. package/dist/initTypes.d.ts.map +1 -0
  26. package/dist/initTypes.js +18 -0
  27. package/dist/protocol/dataSources/propertySchema.d.ts +1 -1
  28. package/dist/protocol/dataSources/propertySchema.js +2 -0
  29. package/dist/protocol/dataSources/sortDirection.d.ts +3 -0
  30. package/dist/protocol/dataSources/sortDirection.js +2 -0
  31. package/dist/protocol/index.d.ts +1 -0
  32. package/dist/protocol/index.js +1 -0
  33. package/dist/protocol/manifest.d.ts +10 -3
  34. package/dist/protocol/manifest.js +5 -1
  35. package/dist/protocol/messages/connect.d.ts +9 -2
  36. package/dist/protocol/messages/hostToSandbox.d.ts +9 -5
  37. package/dist/protocol/messages/init.d.ts +10 -3
  38. package/dist/protocol/messages/queryDataSource.d.ts +300 -47
  39. package/dist/protocol/messages/queryDataSource.js +107 -9
  40. package/dist/protocol/messages/sandboxToHost.d.ts +103 -18
  41. package/dist/styles/nds.css +1 -1
  42. package/dist/types.d.ts +8 -3
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/version.js +1 -1
  45. package/docs/bridge-interceptors.md +27 -0
  46. package/docs/data-sources.md +93 -13
  47. package/docs/errors.md +3 -2
  48. package/docs/lifecycle.md +1 -1
  49. package/docs/pages.md +22 -10
  50. package/package.json +4 -4
  51. package/src/bridge/SandboxBridge.ts +74 -239
  52. package/src/bridge/SandboxInitialization.ts +295 -0
  53. package/src/bridge/dataSources/query.ts +51 -25
  54. package/src/bridge/messageInterceptor.ts +6 -0
  55. package/src/bridge/sandboxClient.ts +6 -5
  56. package/src/bridge.ts +17 -0
  57. package/src/index.ts +1 -0
  58. package/src/init.ts +8 -119
  59. package/src/initTypes.ts +43 -0
  60. package/src/styles/nds.css +1 -1
  61. package/src/styles/nds.css.metadata.json +3 -3
  62. package/src/types.ts +11 -2
  63. package/dist/bridge/primedResponses.d.ts +0 -8
  64. package/dist/bridge/primedResponses.d.ts.map +0 -1
  65. package/dist/bridge/primedResponses.js +0 -5
  66. package/dist/testing.d.ts +0 -12
  67. package/dist/testing.d.ts.map +0 -1
  68. package/dist/testing.js +0 -9
  69. package/src/bridge/primedResponses.ts +0 -11
  70. package/src/testing.ts +0 -19
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "source": "src/common/ndsTokens/public/nds-variables-scoped.css",
3
- "sourceCommit": "0c8968b38595c10dffca5c6e22fc62a9309653e6",
4
- "sha256": "62c6d69badb0ec85a4dcfdcb87a4ea81dfaec7bb3378873b36d44af3ca5323fe",
5
- "bytes": 188714
3
+ "sourceCommit": "349a7602ca079490d08b4a0694e146cb7f800ef3",
4
+ "sha256": "373edb2afe5b006c6a0b6aea13d12a2967c955cbf977bbe5bc5371f1d1fc73db",
5
+ "bytes": 275519
6
6
  }
package/src/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { NotionCollectionSchema } from "@notionhq/custom-blocks-protocol/dataSources/dataSource.js"
2
2
  import type { NotionDataSourceValue } from "@notionhq/custom-blocks-protocol/dataSources/dataSourceValue.js"
3
3
  import type { NotionPropertySchema } from "@notionhq/custom-blocks-protocol/dataSources/propertySchema.js"
4
+ import type { NotionSortDirection } from "@notionhq/custom-blocks-protocol/dataSources/sortDirection.js"
4
5
  import type {
5
6
  NotionDataSourceId,
6
7
  NotionPageId,
@@ -38,6 +39,8 @@ import type {
38
39
  CustomBlockOptionFilterOperator,
39
40
  CustomBlockPeopleFilterOperator,
40
41
  CustomBlockPersonFilterValue,
42
+ CustomBlockRelationFilterOperator,
43
+ CustomBlockStatusFilterOperator,
41
44
  CustomBlockTextFilterOperator,
42
45
  } from "@notionhq/custom-blocks-protocol/messages/queryDataSource.js"
43
46
  import type { CustomBlockQueryDataSourceErrorInfo } from "@notionhq/custom-blocks-protocol/messages/queryDataSourceResult.js"
@@ -138,6 +141,8 @@ export type NotionDataSourceCheckboxFilterOperator =
138
141
  ExclusiveUnion<CustomBlockCheckboxFilterOperator>
139
142
  export type NotionDataSourceOptionFilterOperator =
140
143
  ExclusiveUnion<CustomBlockOptionFilterOperator>
144
+ export type NotionDataSourceStatusFilterOperator =
145
+ ExclusiveUnion<CustomBlockStatusFilterOperator>
141
146
  export type NotionDataSourceContainsFilterOperator =
142
147
  ExclusiveUnion<CustomBlockContainsFilterOperator>
143
148
  export type NotionDataSourceDateFilterOperator =
@@ -148,6 +153,9 @@ export type NotionDataSourcePersonFilterValue = CustomBlockPersonFilterValue
148
153
  export type NotionDataSourcePeopleFilterOperator =
149
154
  ExclusiveUnion<CustomBlockPeopleFilterOperator>
150
155
 
156
+ export type NotionDataSourceRelationFilterOperator =
157
+ ExclusiveUnion<CustomBlockRelationFilterOperator>
158
+
151
159
  export type NotionDataSourcePropertyAddress =
152
160
  | { key: string; propertyId?: never }
153
161
  | { propertyId: string; key?: never }
@@ -163,14 +171,15 @@ export type NotionDataSourcePropertyFilter = NotionDataSourcePropertyAddress &
163
171
  | { checkbox: NotionDataSourceCheckboxFilterOperator }
164
172
  | { select: NotionDataSourceOptionFilterOperator }
165
173
  | { multi_select: NotionDataSourceContainsFilterOperator }
166
- | { status: NotionDataSourceOptionFilterOperator }
174
+ | { status: NotionDataSourceStatusFilterOperator }
167
175
  | { date: NotionDataSourceDateFilterOperator }
168
176
  | { people: NotionDataSourcePeopleFilterOperator }
177
+ | { relation: NotionDataSourceRelationFilterOperator }
169
178
  | { created_by: NotionDataSourceCreatedByFilterOperator }
170
179
  >
171
180
 
172
181
  export type NotionDataSourceSort = NotionDataSourcePropertyAddress & {
173
- direction: "ascending" | "descending"
182
+ direction: NotionSortDirection
174
183
  }
175
184
 
176
185
  export type NotionDataSourceFilter = ExclusiveUnion<
@@ -1,8 +0,0 @@
1
- import type { BridgeMessagePayload } from "../protocol/index.js";
2
- import type { PrimeableHostToSandboxMessage } from "../protocol/messages/hostToSandbox.js";
3
- /**
4
- * Shared across sandbox bridge instances. Each result type holds one response;
5
- * consuming it removes it, and priming it again replaces the previous response.
6
- */
7
- export declare const globalPrimedResponsesCache: Map<"createPageResult" | "getPageResult" | "getUserResult" | "listUsersResult" | "openPageResult" | "queryDataSourceResult" | "updatePageResult", BridgeMessagePayload<PrimeableHostToSandboxMessage>>;
8
- //# sourceMappingURL=primedResponses.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"primedResponses.d.ts","sourceRoot":"","sources":["../../src/bridge/primedResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAA;AAE/G;;;GAGG;AACH,eAAO,MAAM,0BAA0B,wMAGpC,CAAA"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Shared across sandbox bridge instances. Each result type holds one response;
3
- * consuming it removes it, and priming it again replaces the previous response.
4
- */
5
- export const globalPrimedResponsesCache = new Map();
package/dist/testing.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { BridgeMessagePayload } from "./protocol/index.js";
2
- import type { PrimeableHostToSandboxMessage } from "./protocol/messages/hostToSandbox.js";
3
- /**
4
- * Injects a one-use response for SDK tests and verification fixtures. The next
5
- * matching request receives it locally without reaching the host; later requests
6
- * use the host normally unless another response is primed.
7
- */
8
- export declare function primeNextResponse<T extends PrimeableHostToSandboxMessage>({ expectedType, response, }: {
9
- expectedType: T["type"];
10
- response: BridgeMessagePayload<T>;
11
- }): void;
12
- //# sourceMappingURL=testing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAA;AAI/G;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,6BAA6B,EAAE,EAC1E,YAAY,EACZ,QAAQ,GACR,EAAE;IACF,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IACvB,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAA;CACjC,QAEA"}
package/dist/testing.js DELETED
@@ -1,9 +0,0 @@
1
- import { globalPrimedResponsesCache } from "./bridge/primedResponses.js";
2
- /**
3
- * Injects a one-use response for SDK tests and verification fixtures. The next
4
- * matching request receives it locally without reaching the host; later requests
5
- * use the host normally unless another response is primed.
6
- */
7
- export function primeNextResponse({ expectedType, response, }) {
8
- globalPrimedResponsesCache.set(expectedType, response);
9
- }
@@ -1,11 +0,0 @@
1
- import type { BridgeMessagePayload } from "@notionhq/custom-blocks-protocol"
2
- import type { PrimeableHostToSandboxMessage } from "@notionhq/custom-blocks-protocol/messages/hostToSandbox.js"
3
-
4
- /**
5
- * Shared across sandbox bridge instances. Each result type holds one response;
6
- * consuming it removes it, and priming it again replaces the previous response.
7
- */
8
- export const globalPrimedResponsesCache = new Map<
9
- PrimeableHostToSandboxMessage["type"],
10
- BridgeMessagePayload<PrimeableHostToSandboxMessage>
11
- >()
package/src/testing.ts DELETED
@@ -1,19 +0,0 @@
1
- import type { BridgeMessagePayload } from "@notionhq/custom-blocks-protocol"
2
- import type { PrimeableHostToSandboxMessage } from "@notionhq/custom-blocks-protocol/messages/hostToSandbox.js"
3
-
4
- import { globalPrimedResponsesCache } from "./bridge/primedResponses.js"
5
-
6
- /**
7
- * Injects a one-use response for SDK tests and verification fixtures. The next
8
- * matching request receives it locally without reaching the host; later requests
9
- * use the host normally unless another response is primed.
10
- */
11
- export function primeNextResponse<T extends PrimeableHostToSandboxMessage>({
12
- expectedType,
13
- response,
14
- }: {
15
- expectedType: T["type"]
16
- response: BridgeMessagePayload<T>
17
- }) {
18
- globalPrimedResponsesCache.set(expectedType, response)
19
- }