@notionhq/custom-blocks-host 0.1.4 → 0.1.5

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.
@@ -1,7 +1,7 @@
1
1
  import { initErrorForFailureReason } from "./initErrors.js";
2
2
  import { isValidBridgeProtocolVersion } from "./protocolVersion.js";
3
- const DEFAULT_NO_CONNECT_TIMEOUT_MS = 5000;
4
- const DEFAULT_NO_INIT_RESULT_TIMEOUT_MS = 5000;
3
+ const DEFAULT_NO_CONNECT_TIMEOUT_MS = 5_000;
4
+ const DEFAULT_NO_INIT_RESULT_TIMEOUT_MS = 5_000;
5
5
  export function createInitializationController(options) {
6
6
  const { blockId, getState, prepareInit, post, warn, flushPendingHostStateChanges, minBridgeProtocolVersion, noConnectTimeoutMs = DEFAULT_NO_CONNECT_TIMEOUT_MS, noInitResultTimeoutMs = DEFAULT_NO_INIT_RESULT_TIMEOUT_MS, onConnect, onInitResult, onIgnoredConnect, onInitializationFailure, } = options;
7
7
  let initStatus = "waitingForConnect";
@@ -22,6 +22,8 @@ export class CustomBlockInitializationError extends Error {
22
22
  this.code = error.code;
23
23
  this.isRetryable = error.isRetryable;
24
24
  }
25
+ code;
26
+ isRetryable;
25
27
  }
26
28
  /**
27
29
  * Initialization message sent by the host to the sandbox exactly once, in response to the
@@ -1,7 +1,5 @@
1
1
  export class QuerySubscriptions {
2
- constructor() {
3
- this.bySubscriptionId = new Map();
4
- }
2
+ bySubscriptionId = new Map();
5
3
  track(message) {
6
4
  const token = {
7
5
  _tag: "QuerySubscriptionToken",
@@ -1 +1 @@
1
- {"version":3,"file":"validateQueryDataSourceSorts.d.ts","sourceRoot":"","sources":["../../src/queries/validateQueryDataSourceSorts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4DAA4D,CAAA;AAExG,OAAO,EAEN,KAAK,iCAAiC,EACtC,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oEAAoE,CAAA;AAM7H;;GAEG;AACH,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,iCAAiC,EAAE,GAAG,SAAS,EACtD,gBAAgB,EAAE,sBAAsB,GAAG,SAAS,GAClD,mCAAmC,GAAG,SAAS,CAkDjD"}
1
+ {"version":3,"file":"validateQueryDataSourceSorts.d.ts","sourceRoot":"","sources":["../../src/queries/validateQueryDataSourceSorts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4DAA4D,CAAA;AAExG,OAAO,EAEN,KAAK,iCAAiC,EACtC,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oEAAoE,CAAA;AAM7H;;GAEG;AACH,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,iCAAiC,EAAE,GAAG,SAAS,EACtD,gBAAgB,EAAE,sBAAsB,GAAG,SAAS,GAClD,mCAAmC,GAAG,SAAS,CA+CjD"}
@@ -26,7 +26,7 @@ export function validateQueryDataSourceSorts(sorts, collectionSchema) {
26
26
  }
27
27
  seenPropertyIds.add(sort.propertyId);
28
28
  if (collectionSchema !== undefined &&
29
- !Object.prototype.hasOwnProperty.call(collectionSchema.propertiesById, sort.propertyId)) {
29
+ !Object.hasOwn(collectionSchema.propertiesById, sort.propertyId)) {
30
30
  return {
31
31
  code: "invalid_data_source_query_sort",
32
32
  message: `Data source query sort property ID "${sort.propertyId}" is not defined in the bound data source schema.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-host",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Reusable host runtime for Notion custom blocks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,10 +41,7 @@ export function validateQueryDataSourceSorts(
41
41
 
42
42
  if (
43
43
  collectionSchema !== undefined &&
44
- !Object.prototype.hasOwnProperty.call(
45
- collectionSchema.propertiesById,
46
- sort.propertyId,
47
- )
44
+ !Object.hasOwn(collectionSchema.propertiesById, sort.propertyId)
48
45
  ) {
49
46
  return {
50
47
  code: "invalid_data_source_query_sort",