@notionhq/custom-blocks 0.2.20 → 0.2.22

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 (66) 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 +30 -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/messages/hostToSandbox.d.ts +0 -3
  34. package/dist/protocol/messages/init.d.ts +1 -1
  35. package/dist/protocol/messages/queryDataSource.d.ts +259 -47
  36. package/dist/protocol/messages/queryDataSource.js +94 -8
  37. package/dist/protocol/messages/sandboxToHost.d.ts +80 -16
  38. package/dist/styles/nds.css +1 -1
  39. package/dist/types.d.ts +5 -3
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/version.js +1 -1
  42. package/docs/bridge-interceptors.md +27 -0
  43. package/docs/data-sources.md +80 -13
  44. package/docs/errors.md +2 -0
  45. package/docs/pages.md +22 -10
  46. package/package.json +4 -4
  47. package/src/bridge/SandboxBridge.ts +74 -239
  48. package/src/bridge/SandboxInitialization.ts +295 -0
  49. package/src/bridge/dataSources/query.ts +38 -25
  50. package/src/bridge/messageInterceptor.ts +6 -0
  51. package/src/bridge/sandboxClient.ts +6 -5
  52. package/src/bridge.ts +17 -0
  53. package/src/index.ts +1 -0
  54. package/src/init.ts +8 -119
  55. package/src/initTypes.ts +43 -0
  56. package/src/styles/nds.css +1 -1
  57. package/src/styles/nds.css.metadata.json +3 -3
  58. package/src/types.ts +6 -2
  59. package/dist/bridge/primedResponses.d.ts +0 -8
  60. package/dist/bridge/primedResponses.d.ts.map +0 -1
  61. package/dist/bridge/primedResponses.js +0 -5
  62. package/dist/testing.d.ts +0 -12
  63. package/dist/testing.d.ts.map +0 -1
  64. package/dist/testing.js +0 -9
  65. package/src/bridge/primedResponses.ts +0 -11
  66. 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,7 @@ import type {
38
39
  CustomBlockOptionFilterOperator,
39
40
  CustomBlockPeopleFilterOperator,
40
41
  CustomBlockPersonFilterValue,
42
+ CustomBlockStatusFilterOperator,
41
43
  CustomBlockTextFilterOperator,
42
44
  } from "@notionhq/custom-blocks-protocol/messages/queryDataSource.js"
43
45
  import type { CustomBlockQueryDataSourceErrorInfo } from "@notionhq/custom-blocks-protocol/messages/queryDataSourceResult.js"
@@ -138,6 +140,8 @@ export type NotionDataSourceCheckboxFilterOperator =
138
140
  ExclusiveUnion<CustomBlockCheckboxFilterOperator>
139
141
  export type NotionDataSourceOptionFilterOperator =
140
142
  ExclusiveUnion<CustomBlockOptionFilterOperator>
143
+ export type NotionDataSourceStatusFilterOperator =
144
+ ExclusiveUnion<CustomBlockStatusFilterOperator>
141
145
  export type NotionDataSourceContainsFilterOperator =
142
146
  ExclusiveUnion<CustomBlockContainsFilterOperator>
143
147
  export type NotionDataSourceDateFilterOperator =
@@ -163,14 +167,14 @@ export type NotionDataSourcePropertyFilter = NotionDataSourcePropertyAddress &
163
167
  | { checkbox: NotionDataSourceCheckboxFilterOperator }
164
168
  | { select: NotionDataSourceOptionFilterOperator }
165
169
  | { multi_select: NotionDataSourceContainsFilterOperator }
166
- | { status: NotionDataSourceOptionFilterOperator }
170
+ | { status: NotionDataSourceStatusFilterOperator }
167
171
  | { date: NotionDataSourceDateFilterOperator }
168
172
  | { people: NotionDataSourcePeopleFilterOperator }
169
173
  | { created_by: NotionDataSourceCreatedByFilterOperator }
170
174
  >
171
175
 
172
176
  export type NotionDataSourceSort = NotionDataSourcePropertyAddress & {
173
- direction: "ascending" | "descending"
177
+ direction: NotionSortDirection
174
178
  }
175
179
 
176
180
  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
- }