@notionhq/custom-blocks 0.1.34 → 0.1.36
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 +2 -4
- package/dist/autoResize.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.d.ts +1 -0
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +256 -221
- package/dist/bridge/appearance.d.ts.map +1 -1
- package/dist/bridge/dataSources/query.d.ts +2 -1
- package/dist/bridge/dataSources/query.d.ts.map +1 -1
- package/dist/bridge/dataSources/query.js +296 -161
- package/dist/bridge/dataSources/resolve.d.ts.map +1 -1
- package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -1
- package/dist/bridge/hostState.d.ts.map +1 -1
- package/dist/bridge/loadManifest.d.ts.map +1 -1
- package/dist/bridge/pendingRequests.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.d.ts.map +1 -1
- package/dist/customBlock.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +1 -1
- package/dist/protocol/contrast.d.ts +0 -1
- package/dist/protocol/dataSources/dataSource.d.ts +0 -1
- package/dist/protocol/dataSources/dataSourcePage.d.ts +0 -1
- package/dist/protocol/dataSources/dataSourceValue.d.ts +0 -1
- package/dist/protocol/dataSources/dateValue.d.ts +0 -1
- package/dist/protocol/dataSources/errors.d.ts +0 -1
- package/dist/protocol/dataSources/propertySchema.d.ts +7 -1
- package/dist/protocol/dataSources/propertySchema.js +17 -0
- package/dist/protocol/dataSources/recordPointer.d.ts +0 -1
- package/dist/protocol/errors.d.ts +0 -1
- package/dist/protocol/ids.d.ts +0 -1
- package/dist/protocol/incomingType.d.ts +0 -1
- package/dist/protocol/index.d.ts +0 -1
- package/dist/protocol/manifest.d.ts +0 -1
- package/dist/protocol/messagePayload.d.ts +0 -1
- package/dist/protocol/messages/connect.d.ts +0 -1
- package/dist/protocol/messages/contrastModeChanged.d.ts +0 -1
- package/dist/protocol/messages/createPage.d.ts +0 -1
- package/dist/protocol/messages/createPage.js +0 -1
- package/dist/protocol/messages/createPageResult.d.ts +0 -1
- package/dist/protocol/messages/currentUserChanged.d.ts +0 -1
- package/dist/protocol/messages/dataSourcesChanged.d.ts +0 -1
- package/dist/protocol/messages/getPage.d.ts +0 -1
- package/dist/protocol/messages/getUser.d.ts +0 -1
- package/dist/protocol/messages/hostToSandbox.d.ts +3 -1
- package/dist/protocol/messages/init.d.ts +0 -1
- package/dist/protocol/messages/initResult.d.ts +0 -1
- package/dist/protocol/messages/invalidHostMessage.d.ts +0 -1
- package/dist/protocol/messages/invalidSandboxMessage.d.ts +0 -1
- package/dist/protocol/messages/listUsers.d.ts +0 -1
- package/dist/protocol/messages/pageChanged.d.ts +0 -1
- package/dist/protocol/messages/parentChanged.d.ts +0 -1
- package/dist/protocol/messages/queryDataSource.d.ts +15 -1
- package/dist/protocol/messages/queryDataSource.js +8 -0
- package/dist/protocol/messages/queryDataSourceResult.d.ts +1 -2
- package/dist/protocol/messages/resize.d.ts +0 -1
- package/dist/protocol/messages/sandboxToHost.d.ts +4 -1
- package/dist/protocol/messages/themeChanged.d.ts +0 -1
- package/dist/protocol/messages/updatePage.d.ts +0 -1
- package/dist/protocol/messages/updatePageResult.d.ts +0 -1
- package/dist/protocol/pages/page.d.ts +0 -1
- package/dist/protocol/pages/page.js +0 -1
- package/dist/protocol/parent.d.ts +0 -1
- package/dist/protocol/protocolVersion.d.ts +0 -1
- package/dist/protocol/theme.d.ts +0 -1
- package/dist/protocol/users/user.d.ts +0 -1
- package/dist/react/DebugMessageLog.d.ts.map +1 -1
- package/dist/react/NotionCustomBlock.css +0 -11
- package/dist/react/NotionCustomBlock.d.ts.map +1 -1
- package/dist/react/NotionCustomBlock.js +14 -3
- package/dist/react/NotionTokenScope.d.ts.map +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/standalonePreview.d.ts.map +1 -1
- package/dist/react/useCustomBlockAutoResize.d.ts.map +1 -1
- package/dist/react/useCustomBlockInit.d.ts.map +1 -1
- package/dist/react/useDataSource.d.ts +1 -1
- package/dist/react/useDataSource.d.ts.map +1 -1
- package/dist/react/useDataSource.js +1 -1
- package/dist/react/useHostState.d.ts.map +1 -1
- package/dist/react/useRuntimeState.d.ts.map +1 -1
- package/dist/testing.d.ts +17 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +13 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/docs/data-sources.md +13 -1
- package/package.json +5 -6
- package/src/bridge/SandboxBridge.ts +49 -5
- package/src/bridge/dataSources/query.ts +394 -170
- package/src/init.ts +2 -1
- package/src/react/NotionCustomBlock.css +0 -11
- package/src/react/NotionCustomBlock.tsx +28 -10
- package/src/react/useDataSource.ts +1 -1
- package/src/testing.ts +26 -0
- package/src/types.ts +8 -1
- package/dist/protocol/contrast.d.ts.map +0 -1
- package/dist/protocol/dataSources/dataSource.d.ts.map +0 -1
- package/dist/protocol/dataSources/dataSourcePage.d.ts.map +0 -1
- package/dist/protocol/dataSources/dataSourceValue.d.ts.map +0 -1
- package/dist/protocol/dataSources/dateValue.d.ts.map +0 -1
- package/dist/protocol/dataSources/errors.d.ts.map +0 -1
- package/dist/protocol/dataSources/propertySchema.d.ts.map +0 -1
- package/dist/protocol/dataSources/recordPointer.d.ts.map +0 -1
- package/dist/protocol/errors.d.ts.map +0 -1
- package/dist/protocol/ids.d.ts.map +0 -1
- package/dist/protocol/incomingType.d.ts.map +0 -1
- package/dist/protocol/index.d.ts.map +0 -1
- package/dist/protocol/manifest.d.ts.map +0 -1
- package/dist/protocol/messagePayload.d.ts.map +0 -1
- package/dist/protocol/messages/connect.d.ts.map +0 -1
- package/dist/protocol/messages/contrastModeChanged.d.ts.map +0 -1
- package/dist/protocol/messages/createPage.d.ts.map +0 -1
- package/dist/protocol/messages/createPageResult.d.ts.map +0 -1
- package/dist/protocol/messages/currentUserChanged.d.ts.map +0 -1
- package/dist/protocol/messages/dataSourcesChanged.d.ts.map +0 -1
- package/dist/protocol/messages/getPage.d.ts.map +0 -1
- package/dist/protocol/messages/getUser.d.ts.map +0 -1
- package/dist/protocol/messages/hostToSandbox.d.ts.map +0 -1
- package/dist/protocol/messages/init.d.ts.map +0 -1
- package/dist/protocol/messages/initResult.d.ts.map +0 -1
- package/dist/protocol/messages/invalidHostMessage.d.ts.map +0 -1
- package/dist/protocol/messages/invalidSandboxMessage.d.ts.map +0 -1
- package/dist/protocol/messages/listUsers.d.ts.map +0 -1
- package/dist/protocol/messages/pageChanged.d.ts.map +0 -1
- package/dist/protocol/messages/parentChanged.d.ts.map +0 -1
- package/dist/protocol/messages/queryDataSource.d.ts.map +0 -1
- package/dist/protocol/messages/queryDataSourceResult.d.ts.map +0 -1
- package/dist/protocol/messages/resize.d.ts.map +0 -1
- package/dist/protocol/messages/sandboxToHost.d.ts.map +0 -1
- package/dist/protocol/messages/themeChanged.d.ts.map +0 -1
- package/dist/protocol/messages/updatePage.d.ts.map +0 -1
- package/dist/protocol/messages/updatePageResult.d.ts.map +0 -1
- package/dist/protocol/pages/page.d.ts.map +0 -1
- package/dist/protocol/parent.d.ts.map +0 -1
- package/dist/protocol/protocolVersion.d.ts.map +0 -1
- package/dist/protocol/theme.d.ts.map +0 -1
- package/dist/protocol/users/user.d.ts.map +0 -1
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAKhF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,KAAK,EAAE,WAAW,CAAA;IAClB,YAAY,EAAE,kBAAkB,CAAA;IAChC,OAAO,EAAE,aAAa,CAAA;IACtB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,8BAA8B;gBACvD,OAAO,GAAE,MAA8B;IAS3C,IAAI,EAAE,eAAe,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AASD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC9B,IAAI,GAAE,sBAA2B,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAMjC"}
|
package/dist/init.js
CHANGED
|
@@ -104,7 +104,7 @@ async function awaitHostInitWithTimeout(timeoutMs) {
|
|
|
104
104
|
if (isTimeoutError(error)) {
|
|
105
105
|
throw new CustomBlockInitializationError({
|
|
106
106
|
code: "init_timeout",
|
|
107
|
-
message: "Host did not respond to
|
|
107
|
+
message: "Host did not respond to the `connect` message before the timeout.",
|
|
108
108
|
isRetryable: true,
|
|
109
109
|
});
|
|
110
110
|
}
|
|
@@ -2,4 +2,3 @@ import * as v from "valibot";
|
|
|
2
2
|
export declare const notionContrastModeSchema: v.PicklistSchema<["standard", "high"], undefined>;
|
|
3
3
|
export type NotionContrastMode = v.InferOutput<typeof notionContrastModeSchema>;
|
|
4
4
|
export declare const DEFAULT_CONTRAST_MODE: NotionContrastMode;
|
|
5
|
-
//# sourceMappingURL=contrast.d.ts.map
|
|
@@ -729,4 +729,3 @@ export declare const notionDataSourceBindingsSchema: v.RecordSchema<v.StringSche
|
|
|
729
729
|
}, undefined>, undefined>;
|
|
730
730
|
export type NotionDataSourceBindings = v.InferOutput<typeof notionDataSourceBindingsSchema>;
|
|
731
731
|
export {};
|
|
732
|
-
//# sourceMappingURL=dataSource.d.ts.map
|
|
@@ -70,4 +70,3 @@ export declare const notionDataSourcePageBridgeSchema: v.ObjectSchema<{
|
|
|
70
70
|
}, undefined>;
|
|
71
71
|
/** Internal SDK type for a parsed bridge page. */
|
|
72
72
|
export type NotionDataSourcePageBridge = v.InferOutput<typeof notionDataSourcePageBridgeSchema>;
|
|
73
|
-
//# sourceMappingURL=dataSourcePage.d.ts.map
|
|
@@ -64,4 +64,3 @@ export declare const notionDataSourceValueSchema: v.UnionSchema<[v.StringSchema<
|
|
|
64
64
|
readonly table: v.StringSchema<undefined>;
|
|
65
65
|
}, undefined>, undefined>], undefined>;
|
|
66
66
|
export type NotionDataSourceValue = v.InferOutput<typeof notionDataSourceValueSchema>;
|
|
67
|
-
//# sourceMappingURL=dataSourceValue.d.ts.map
|
|
@@ -155,4 +155,3 @@ export declare const notionDateValueSchema: v.VariantSchema<"type", [v.ObjectSch
|
|
|
155
155
|
}, undefined>], undefined>, undefined>;
|
|
156
156
|
}, undefined>], undefined>;
|
|
157
157
|
export type NotionDateValue = Readonly<v.InferOutput<typeof notionDateValueSchema>>;
|
|
158
|
-
//# sourceMappingURL=dateValue.d.ts.map
|
|
@@ -6,4 +6,3 @@ export type CustomBlockDataSourceResolutionErrorInfo = CustomBlockErrorInfo<Cust
|
|
|
6
6
|
export declare const customBlockPropertyErrorCodeSchema: v.StringSchema<undefined>;
|
|
7
7
|
export type CustomBlockPropertyErrorCode = "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value" | (string & {});
|
|
8
8
|
export type CustomBlockPropertyErrorInfo = CustomBlockErrorInfo<CustomBlockPropertyErrorCode>;
|
|
9
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -43,6 +43,13 @@ export declare const notionPropertyTypeSchema: v.PicklistSchema<readonly ["title
|
|
|
43
43
|
* payload shapes.
|
|
44
44
|
*/
|
|
45
45
|
export type NotionPropertyType = v.InferOutput<typeof notionPropertyTypeSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* Property types currently supported by the custom-block data source sort API.
|
|
48
|
+
* Keep this list narrower than {@link NOTION_PROPERTY_TYPES} when a property
|
|
49
|
+
* type is exposed but its sort value is not yet represented by every host.
|
|
50
|
+
*/
|
|
51
|
+
export declare const CUSTOM_BLOCK_DATA_SOURCE_SORTABLE_PROPERTY_TYPES: readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "date", "created_time", "last_edited_time"];
|
|
52
|
+
export type CustomBlockDataSourceSortablePropertyType = (typeof CUSTOM_BLOCK_DATA_SOURCE_SORTABLE_PROPERTY_TYPES)[number];
|
|
46
53
|
/**
|
|
47
54
|
* Per-property schema as exposed by the host over the custom-block bridge.
|
|
48
55
|
* The `type` discriminator must be one of {@link NOTION_PROPERTY_TYPES}.
|
|
@@ -188,4 +195,3 @@ export type NotionPropertySchema = v.InferOutput<typeof notionPropertySchemaSche
|
|
|
188
195
|
*/
|
|
189
196
|
export declare const NOTION_BUILTIN_PROPERTY_IDS: readonly ["created_time", "last_edited_time", "created_by", "last_edited_by"];
|
|
190
197
|
export type NotionBuiltinPropertyId = (typeof NOTION_BUILTIN_PROPERTY_IDS)[number];
|
|
191
|
-
//# sourceMappingURL=propertySchema.d.ts.map
|
|
@@ -84,6 +84,23 @@ export const NOTION_PROPERTY_TYPES = [
|
|
|
84
84
|
"last_edited_by",
|
|
85
85
|
];
|
|
86
86
|
export const notionPropertyTypeSchema = v.picklist(NOTION_PROPERTY_TYPES);
|
|
87
|
+
/**
|
|
88
|
+
* Property types currently supported by the custom-block data source sort API.
|
|
89
|
+
* Keep this list narrower than {@link NOTION_PROPERTY_TYPES} when a property
|
|
90
|
+
* type is exposed but its sort value is not yet represented by every host.
|
|
91
|
+
*/
|
|
92
|
+
export const CUSTOM_BLOCK_DATA_SOURCE_SORTABLE_PROPERTY_TYPES = [
|
|
93
|
+
"title",
|
|
94
|
+
"rich_text",
|
|
95
|
+
"number",
|
|
96
|
+
"checkbox",
|
|
97
|
+
"url",
|
|
98
|
+
"email",
|
|
99
|
+
"phone_number",
|
|
100
|
+
"date",
|
|
101
|
+
"created_time",
|
|
102
|
+
"last_edited_time",
|
|
103
|
+
];
|
|
87
104
|
/**
|
|
88
105
|
* Per-property schema as exposed by the host over the custom-block bridge.
|
|
89
106
|
* The `type` discriminator must be one of {@link NOTION_PROPERTY_TYPES}.
|
package/dist/protocol/ids.d.ts
CHANGED
|
@@ -29,4 +29,3 @@ export type NotionAgentId = v.InferOutput<typeof notionAgentIdSchema>;
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const notionSpaceIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>;
|
|
31
31
|
export type NotionSpaceId = v.InferOutput<typeof notionSpaceIdSchema>;
|
|
32
|
-
//# sourceMappingURL=ids.d.ts.map
|
package/dist/protocol/index.d.ts
CHANGED
|
@@ -17,4 +17,3 @@ export type BridgeMessagePayload<T extends {
|
|
|
17
17
|
type: string;
|
|
18
18
|
}, TErrorInfo extends CustomBlockErrorInfo | undefined = undefined> = T extends unknown ? WithTypedErrorInfo<Omit<T, "type" | "requestId" | "subscriptionId">, TErrorInfo> : never;
|
|
19
19
|
export {};
|
|
20
|
-
//# sourceMappingURL=messagePayload.d.ts.map
|
|
@@ -5,4 +5,3 @@ export declare const contrastModeChangedMessageSchema: v.ObjectSchema<{
|
|
|
5
5
|
readonly contrastMode: v.PicklistSchema<["standard", "high"], undefined>;
|
|
6
6
|
}, undefined>;
|
|
7
7
|
export type ContrastModeChangedMessage = v.InferOutput<typeof contrastModeChangedMessageSchema>;
|
|
8
|
-
//# sourceMappingURL=contrastModeChanged.d.ts.map
|
|
@@ -47,6 +47,5 @@ export const createPageMessageSchema = v.object({
|
|
|
47
47
|
* those keys before it sends this message.
|
|
48
48
|
*/
|
|
49
49
|
properties: notionPagePropertyWriteMapSchema,
|
|
50
|
-
// TODO(custom-blocks): Add icon and cover once the Notion host supports them for page creation.
|
|
51
50
|
position: v.optional(notionCreatePagePositionSchema),
|
|
52
51
|
});
|
|
@@ -211,4 +211,3 @@ export declare const createPageResultMessageSchema: v.VariantSchema<"status", [v
|
|
|
211
211
|
}, undefined>;
|
|
212
212
|
}, undefined>], undefined>;
|
|
213
213
|
export type CreatePageResultMessage = v.InferOutput<typeof createPageResultMessageSchema>;
|
|
214
|
-
//# sourceMappingURL=createPageResult.d.ts.map
|
|
@@ -1162,4 +1162,6 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
1162
1162
|
readonly reason: v.StringSchema<undefined>;
|
|
1163
1163
|
}, undefined>], undefined>;
|
|
1164
1164
|
export type HostToSandboxMessage = v.InferOutput<typeof hostToSandboxMessageSchema>;
|
|
1165
|
-
|
|
1165
|
+
export type PrimeableHostToSandboxMessage = Extract<HostToSandboxMessage, {
|
|
1166
|
+
type: "getPageResult" | "createPageResult" | "updatePageResult" | "getUserResult" | "listUsersResult" | "queryDataSourceResult";
|
|
1167
|
+
}>;
|
|
@@ -12,4 +12,3 @@ export declare const invalidSandboxMessageSchema: v.ObjectSchema<{
|
|
|
12
12
|
readonly reason: v.StringSchema<undefined>;
|
|
13
13
|
}, undefined>;
|
|
14
14
|
export type InvalidSandboxMessage = v.InferOutput<typeof invalidSandboxMessageSchema>;
|
|
15
|
-
//# sourceMappingURL=invalidSandboxMessage.d.ts.map
|
|
@@ -604,6 +604,16 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
|
|
|
604
604
|
}, undefined>], undefined>, undefined>;
|
|
605
605
|
}, undefined>], undefined>;
|
|
606
606
|
export type ResolvedCustomBlockDataSourceFilter = v.InferOutput<typeof resolvedCustomBlockDataSourceFilterSchema>;
|
|
607
|
+
/** Maximum number of sort properties accepted in one data source query. */
|
|
608
|
+
export declare const CUSTOM_BLOCK_DATA_SOURCE_QUERY_MAX_SORTS = 10;
|
|
609
|
+
export declare const resolvedCustomBlockDataSourceSortSchema: v.ObjectSchema<{
|
|
610
|
+
readonly propertyId: v.StringSchema<undefined>;
|
|
611
|
+
readonly direction: v.PicklistSchema<["ascending", "descending"], undefined>;
|
|
612
|
+
}, undefined>;
|
|
613
|
+
/**
|
|
614
|
+
* A sort after the SDK resolves a semantic property key to a raw property ID.
|
|
615
|
+
*/
|
|
616
|
+
export type ResolvedCustomBlockDataSourceSort = v.InferOutput<typeof resolvedCustomBlockDataSourceSortSchema>;
|
|
607
617
|
/**
|
|
608
618
|
* Message sent by the sandbox to ask the host for the current rows in a resolved
|
|
609
619
|
* Notion data source.
|
|
@@ -966,6 +976,10 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
|
|
|
966
976
|
}, undefined>], undefined>], undefined>;
|
|
967
977
|
}, undefined>], undefined>, undefined>;
|
|
968
978
|
}, undefined>], undefined>, undefined>;
|
|
979
|
+
/** Sandbox-resolved property sorts, in priority order. */
|
|
980
|
+
readonly sorts: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
981
|
+
readonly propertyId: v.StringSchema<undefined>;
|
|
982
|
+
readonly direction: v.PicklistSchema<["ascending", "descending"], undefined>;
|
|
983
|
+
}, undefined>, undefined>, undefined>;
|
|
969
984
|
}, undefined>;
|
|
970
985
|
export type QueryDataSourceMessage = v.InferOutput<typeof queryDataSourceMessageSchema>;
|
|
971
|
-
//# sourceMappingURL=queryDataSource.d.ts.map
|
|
@@ -98,6 +98,12 @@ export const resolvedCustomBlockDataSourceFilterSchema = v.union([
|
|
|
98
98
|
and: v.array(resolvedCustomBlockDataSourcePropertyFilterSchema),
|
|
99
99
|
}),
|
|
100
100
|
]);
|
|
101
|
+
/** Maximum number of sort properties accepted in one data source query. */
|
|
102
|
+
export const CUSTOM_BLOCK_DATA_SOURCE_QUERY_MAX_SORTS = 10;
|
|
103
|
+
export const resolvedCustomBlockDataSourceSortSchema = v.object({
|
|
104
|
+
propertyId: v.string(),
|
|
105
|
+
direction: v.picklist(["ascending", "descending"]),
|
|
106
|
+
});
|
|
101
107
|
/**
|
|
102
108
|
* Message sent by the sandbox to ask the host for the current rows in a resolved
|
|
103
109
|
* Notion data source.
|
|
@@ -112,4 +118,6 @@ export const queryDataSourceMessageSchema = v.object({
|
|
|
112
118
|
limit: v.number(),
|
|
113
119
|
/** A sandbox-resolved property filter. */
|
|
114
120
|
filter: v.optional(resolvedCustomBlockDataSourceFilterSchema),
|
|
121
|
+
/** Sandbox-resolved property sorts, in priority order. */
|
|
122
|
+
sorts: v.optional(v.array(resolvedCustomBlockDataSourceSortSchema)),
|
|
115
123
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import type { CustomBlockErrorCode, CustomBlockErrorInfo } from "../errors.js";
|
|
3
3
|
export declare const customBlockQueryDataSourceErrorCodeSchema: v.StringSchema<undefined>;
|
|
4
|
-
export type CustomBlockQueryDataSourceErrorCode = CustomBlockErrorCode<"query_data_source_failed" | "invalid_data_source_query" | "invalid_data_source_query_filter" | "unknown_data_source_key" | "unmapped_data_source">;
|
|
4
|
+
export type CustomBlockQueryDataSourceErrorCode = CustomBlockErrorCode<"query_data_source_failed" | "invalid_data_source_query" | "invalid_data_source_query_filter" | "invalid_data_source_query_sort" | "unknown_data_source_key" | "unmapped_data_source">;
|
|
5
5
|
export type CustomBlockQueryDataSourceErrorInfo = CustomBlockErrorInfo<CustomBlockQueryDataSourceErrorCode>;
|
|
6
6
|
export declare const customBlockQueryDataSourceErrorInfoSchema: v.ObjectSchema<{
|
|
7
7
|
readonly code: v.StringSchema<undefined>;
|
|
@@ -91,4 +91,3 @@ export declare const queryDataSourceResultMessageSchema: v.VariantSchema<"status
|
|
|
91
91
|
}, undefined>;
|
|
92
92
|
}, undefined>], undefined>;
|
|
93
93
|
export type QueryDataSourceResultMessage = v.InferOutput<typeof queryDataSourceResultMessageSchema>;
|
|
94
|
-
//# sourceMappingURL=queryDataSourceResult.d.ts.map
|
|
@@ -9,4 +9,3 @@ export declare const resizeMessageSchema: v.ObjectSchema<{
|
|
|
9
9
|
readonly height: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
10
10
|
}, undefined>;
|
|
11
11
|
export type ResizeMessage = v.InferOutput<typeof resizeMessageSchema>;
|
|
12
|
-
//# sourceMappingURL=resize.d.ts.map
|
|
@@ -407,6 +407,10 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
407
407
|
}, undefined>], undefined>], undefined>;
|
|
408
408
|
}, undefined>], undefined>, undefined>;
|
|
409
409
|
}, undefined>], undefined>, undefined>;
|
|
410
|
+
readonly sorts: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
411
|
+
readonly propertyId: v.StringSchema<undefined>;
|
|
412
|
+
readonly direction: v.PicklistSchema<["ascending", "descending"], undefined>;
|
|
413
|
+
}, undefined>, undefined>, undefined>;
|
|
410
414
|
}, undefined>, v.ObjectSchema<{
|
|
411
415
|
readonly type: v.LiteralSchema<"createPage", undefined>;
|
|
412
416
|
readonly requestId: v.StringSchema<undefined>;
|
|
@@ -738,4 +742,3 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
738
742
|
readonly reason: v.StringSchema<undefined>;
|
|
739
743
|
}, undefined>], undefined>;
|
|
740
744
|
export type SandboxToHostMessage = v.InferOutput<typeof sandboxToHostMessageSchema>;
|
|
741
|
-
//# sourceMappingURL=sandboxToHost.d.ts.map
|
|
@@ -8,4 +8,3 @@ export declare const themeChangedMessageSchema: v.ObjectSchema<{
|
|
|
8
8
|
readonly theme: v.PicklistSchema<["light", "dark"], undefined>;
|
|
9
9
|
}, undefined>;
|
|
10
10
|
export type ThemeChangedMessage = v.InferOutput<typeof themeChangedMessageSchema>;
|
|
11
|
-
//# sourceMappingURL=themeChanged.d.ts.map
|
|
@@ -210,4 +210,3 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
|
|
|
210
210
|
}, undefined>;
|
|
211
211
|
}, undefined>], undefined>;
|
|
212
212
|
export type UpdatePageResultMessage = v.InferOutput<typeof updatePageResultMessageSchema>;
|
|
213
|
-
//# sourceMappingURL=updatePageResult.d.ts.map
|
|
@@ -42,7 +42,6 @@ export const notionHostedFileSchema = v.object({
|
|
|
42
42
|
expiry_time: v.optional(v.string()),
|
|
43
43
|
}),
|
|
44
44
|
});
|
|
45
|
-
// TODO(custom-blocks): Add file upload support.
|
|
46
45
|
export const notionPageIconSchema = v.variant("type", [
|
|
47
46
|
notionEmojiIconSchema,
|
|
48
47
|
notionCustomEmojiIconSchema,
|
|
@@ -26,4 +26,3 @@ export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema
|
|
|
26
26
|
* - `agent_id` — owned by an agent, such as an agent instruction page or its blocks.
|
|
27
27
|
*/
|
|
28
28
|
export type NotionParent = v.InferOutput<typeof notionParentSchema>;
|
|
29
|
-
//# sourceMappingURL=parent.d.ts.map
|
package/dist/protocol/theme.d.ts
CHANGED
|
@@ -30,4 +30,3 @@ export declare const notionUserListSchema: v.ObjectSchema<{
|
|
|
30
30
|
readonly user: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
|
|
31
31
|
}, undefined>;
|
|
32
32
|
export type NotionUserList = v.InferOutput<typeof notionUserListSchema>;
|
|
33
|
-
//# sourceMappingURL=user.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugMessageLog.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"DebugMessageLog.d.ts","sourceRoot":"","sources":["../../src/react/DebugMessageLog.tsx"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,4CAa9B"}
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
--custom-blocks-init-error-border: #e5e5e1;
|
|
19
19
|
--custom-blocks-init-error-text: #1f1f1d;
|
|
20
20
|
--custom-blocks-init-error-muted-text: #5f5e5b;
|
|
21
|
-
--custom-blocks-init-error-eyebrow-text: #787774;
|
|
22
21
|
--custom-blocks-init-error-pre-background: #f1f1ef;
|
|
23
22
|
--custom-blocks-init-error-pre-text: #37352f;
|
|
24
23
|
--custom-blocks-init-error-shadow: rgba(0, 0, 0, 0.08);
|
|
@@ -46,15 +45,6 @@
|
|
|
46
45
|
box-shadow: 0 8px 24px var(--custom-blocks-init-error-shadow);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
.custom-blocks-default-init-error__eyebrow {
|
|
50
|
-
margin-bottom: 8px;
|
|
51
|
-
font-size: 11px;
|
|
52
|
-
font-weight: 600;
|
|
53
|
-
letter-spacing: 0.08em;
|
|
54
|
-
text-transform: uppercase;
|
|
55
|
-
color: var(--custom-blocks-init-error-eyebrow-text);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
48
|
.custom-blocks-default-init-error__title {
|
|
59
49
|
margin: 0;
|
|
60
50
|
font-size: 18px;
|
|
@@ -100,7 +90,6 @@
|
|
|
100
90
|
--custom-blocks-init-error-border: #373633;
|
|
101
91
|
--custom-blocks-init-error-text: #f1f1ef;
|
|
102
92
|
--custom-blocks-init-error-muted-text: #b9b8b3;
|
|
103
|
-
--custom-blocks-init-error-eyebrow-text: #9b9a97;
|
|
104
93
|
--custom-blocks-init-error-pre-background: #2a2a28;
|
|
105
94
|
--custom-blocks-init-error-pre-text: #e8e8e4;
|
|
106
95
|
--custom-blocks-init-error-shadow: rgba(0, 0, 0, 0.35);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotionCustomBlock.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"NotionCustomBlock.d.ts","sourceRoot":"","sources":["../../src/react/NotionCustomBlock.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAwC,MAAM,OAAO,CAAA;AAE5E,OAAO,EAAE,KAAK,sBAAsB,EAAoB,MAAM,YAAY,CAAA;AAM1E,OAAO,yBAAyB,CAAA;AAEhC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,sBAAsB,GAAG;IAC7D,QAAQ,EAAE,SAAS,CAAA;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAA;IACzD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,QAAe,EACf,aAAa,EACb,UAAiB,GACjB,EAAE,sBAAsB,2CAsExB"}
|
|
@@ -82,10 +82,21 @@ export function NotionCustomBlock({ children, timeoutMs, fallback = null, errorF
|
|
|
82
82
|
}
|
|
83
83
|
return _jsx(_Fragment, { children: children });
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Host-agnostic fallback for custom block initialization errors.
|
|
87
|
+
*
|
|
88
|
+
* The production Notion host and the dev shell both cover the iframe and render their own error
|
|
89
|
+
* surfaces. But a generic host may not, so we show this component inside the iframe to provide a
|
|
90
|
+
* decent fallback experience.
|
|
91
|
+
*/
|
|
92
|
+
function DefaultInitErrorFallback({ error, }) {
|
|
87
93
|
useEffect(() => {
|
|
88
94
|
console.warn(`[custom-blocks-sdk] Custom block init failed: ${error.message}`);
|
|
89
95
|
}, [error]);
|
|
90
|
-
|
|
96
|
+
const errorDetails = JSON.stringify({
|
|
97
|
+
code: error.code,
|
|
98
|
+
message: error.message,
|
|
99
|
+
isRetryable: error.isRetryable,
|
|
100
|
+
}, null, 2);
|
|
101
|
+
return (_jsx("div", { role: "alert", className: "custom-blocks-default-init-error", children: _jsxs("div", { className: "custom-blocks-default-init-error__card", children: [_jsx("h2", { className: "custom-blocks-default-init-error__title", children: "Custom block failed to initialize" }), _jsx("p", { className: "custom-blocks-default-init-error__body", children: "The custom block loaded, but its setup handshake did not finish. Try again. If this keeps happening, check the browser console for more details." }), _jsxs("details", { className: "custom-blocks-default-init-error__details", children: [_jsx("summary", { children: "Developer details" }), _jsx("pre", { className: "custom-blocks-default-init-error__pre", children: errorDetails })] })] }) }));
|
|
91
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotionTokenScope.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"NotionTokenScope.d.ts","sourceRoot":"","sources":["../../src/react/NotionTokenScope.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,qBAAqB,GAAG;IACnC,QAAQ,EAAE,SAAS,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAanE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,iBAAiB,EACjB,KAAK,sBAAsB,GAC3B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACN,gBAAgB,EAChB,KAAK,qBAAqB,GAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EACN,KAAK,wBAAwB,EAC7B,kBAAkB,GAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EACN,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,GACR,MAAM,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalonePreview.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"standalonePreview.d.ts","sourceRoot":"","sources":["../../src/react/standalonePreview.ts"],"names":[],"mappings":"AAaA,wBAAgB,0BAA0B,SAuBzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomBlockAutoResize.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useCustomBlockAutoResize.d.ts","sourceRoot":"","sources":["../../src/react/useCustomBlockAutoResize.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACvC,IAAI,GAAE;IACL;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CACZ,GACJ,IAAI,CAYN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomBlockInit.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useCustomBlockInit.d.ts","sourceRoot":"","sources":["../../src/react/useCustomBlockInit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAA;AAEvG,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAE3B,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;GASG;AACH,MAAM,MAAM,wBAAwB,GACjC;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACrC;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,8BAA8B,CAAA;CAAE,GAC1D;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAExE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,CAAC,EAAE,sBAAsB,GAC3B,wBAAwB,CA2B1B"}
|
|
@@ -4,7 +4,7 @@ import type { UseDataSourceOptions, UseDataSourceResult } from "../types.js";
|
|
|
4
4
|
*
|
|
5
5
|
* @param key - The semantic data source key the block is wired to (e.g. `"people"`).
|
|
6
6
|
* @param options - Optional live snapshot options. `limit` defaults to 20 and
|
|
7
|
-
* is capped at 999.
|
|
7
|
+
* is capped at 999. `sorts` are applied in array order.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* const { items, isLoading, hasMore, error } = useDataSource("default", { limit: 25 })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataSource.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useDataSource.d.ts","sourceRoot":"","sources":["../../src/react/useDataSource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAG5E;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC5B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,oBAAoB,GAC5B,mBAAmB,CAuCrB"}
|
|
@@ -7,7 +7,7 @@ import { useCustomBlockHost } from "./useHostState.js";
|
|
|
7
7
|
*
|
|
8
8
|
* @param key - The semantic data source key the block is wired to (e.g. `"people"`).
|
|
9
9
|
* @param options - Optional live snapshot options. `limit` defaults to 20 and
|
|
10
|
-
* is capped at 999.
|
|
10
|
+
* is capped at 999. `sorts` are applied in array order.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* const { items, isLoading, hasMore, error } = useDataSource("default", { limit: 25 })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHostState.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useHostState.d.ts","sourceRoot":"","sources":["../../src/react/useHostState.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,0DAKjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRuntimeState.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useRuntimeState.d.ts","sourceRoot":"","sources":["../../src/react/useRuntimeState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAIhF;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,aAAa,CAE1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAExC;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,IAAI,eAAe,CAEzC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,IAAI,WAAW,CAEtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,kBAAkB,CAKpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAE3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,IAAI,mBAAmB,CAEjD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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" | "queryDataSourceResult" | "updatePageResult", BridgeMessagePayload<PrimeableHostToSandboxMessage>>;
|
|
8
|
+
/**
|
|
9
|
+
* Injects a one-use response for SDK tests and verification fixtures. The next
|
|
10
|
+
* matching request receives it locally without reaching the host; later requests
|
|
11
|
+
* use the host normally unless another response is primed.
|
|
12
|
+
*/
|
|
13
|
+
export declare function primeNextResponse<T extends PrimeableHostToSandboxMessage>({ expectedType, response, }: {
|
|
14
|
+
expectedType: T["type"];
|
|
15
|
+
response: BridgeMessagePayload<T>;
|
|
16
|
+
}): void;
|
|
17
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AAE/G;;;GAGG;AACH,eAAO,MAAM,0BAA0B,qLAGpC,CAAA;AAEH;;;;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
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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();
|
|
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({ expectedType, response, }) {
|
|
12
|
+
globalPrimedResponsesCache.set(expectedType, response);
|
|
13
|
+
}
|