@notionhq/custom-blocks-dev-shell 0.4.2 → 0.4.3

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/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Workers local shell</title>
7
- <script type="module" crossorigin src="/assets/index-BPt5jNdQ.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-BlifLoaB.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CohEBjwO.css">
9
9
  </head>
10
10
  <body>
@@ -310,6 +310,20 @@ function getFallback(schema, dataset, config$1) {
310
310
  return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
311
311
  }
312
312
  // @__NO_SIDE_EFFECTS__
313
+ function fallback(schema, fallback$1) {
314
+ return _standardSchema({
315
+ ...schema,
316
+ fallback: fallback$1,
317
+ "~run"(dataset, config$1) {
318
+ const outputDataset = schema["~run"](dataset, config$1);
319
+ return outputDataset.issues ? {
320
+ typed: true,
321
+ value: /* @__PURE__ */ getFallback(this, outputDataset, config$1)
322
+ } : outputDataset;
323
+ }
324
+ });
325
+ }
326
+ // @__NO_SIDE_EFFECTS__
313
327
  function getDefault(schema, dataset, config$1) {
314
328
  return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
315
329
  }
@@ -379,6 +393,23 @@ function boolean(message$1) {
379
393
  });
380
394
  }
381
395
  // @__NO_SIDE_EFFECTS__
396
+ function custom(check$1, message$1) {
397
+ return _standardSchema({
398
+ kind: "schema",
399
+ type: "custom",
400
+ reference: custom,
401
+ expects: "unknown",
402
+ async: false,
403
+ check: check$1,
404
+ message: message$1,
405
+ "~run"(dataset, config$1) {
406
+ if (this.check(dataset.value)) dataset.typed = true;
407
+ else _addIssue(this, "type", dataset, config$1);
408
+ return dataset;
409
+ }
410
+ });
411
+ }
412
+ // @__NO_SIDE_EFFECTS__
382
413
  function literal(literal_, message$1) {
383
414
  return _standardSchema({
384
415
  kind: "schema",
@@ -1233,6 +1264,15 @@ var customBlockErrorInfoSchema = object({
1233
1264
  message: string(),
1234
1265
  isRetryable: boolean()
1235
1266
  });
1267
+ var customBlockErrorDetailsSchema = custom(
1268
+ (value) => {
1269
+ if (value === null || typeof value !== "object") {
1270
+ return false;
1271
+ }
1272
+ const prototype = Object.getPrototypeOf(value);
1273
+ return prototype === Object.prototype || prototype === null;
1274
+ }
1275
+ );
1236
1276
 
1237
1277
  // ../protocol/src/compatibility/protocol3To11/connect.ts
1238
1278
  var connectMessageCommonEntries = {
@@ -1571,6 +1611,14 @@ var bridgeFilePropertyItemSchema = union([
1571
1611
  object({ ...bridgeExternalFileSchema.entries, name: string() }),
1572
1612
  object({ ...bridgeNotionHostedFileSchema.entries, name: string() })
1573
1613
  ]);
1614
+ var bridgeUnavailableFilePropertyItemSchema = object({
1615
+ type: literal("unavailable"),
1616
+ name: optional(string())
1617
+ });
1618
+ var bridgeFilePropertyReadItemSchema = union([
1619
+ ...bridgeFilePropertyItemSchema.options,
1620
+ bridgeUnavailableFilePropertyItemSchema
1621
+ ]);
1574
1622
 
1575
1623
  // ../protocol/src/icons.ts
1576
1624
  var bridgeIconNameSchema = string();
@@ -1771,7 +1819,7 @@ var notionUserInputSchema = union([
1771
1819
 
1772
1820
  // ../protocol/src/pages/properties/bridgePagePropertyValue.ts
1773
1821
  var pagePropertyBaseSchema = { id: string() };
1774
- var bridgePagePropertyValueSchema = variant("type", [
1822
+ var basePropertySchemas = [
1775
1823
  object({
1776
1824
  ...pagePropertyBaseSchema,
1777
1825
  type: literal("title"),
@@ -1838,11 +1886,6 @@ var bridgePagePropertyValueSchema = variant("type", [
1838
1886
  has_more: optional(boolean()),
1839
1887
  relation: array(notionRelationInputSchema)
1840
1888
  }),
1841
- object({
1842
- ...pagePropertyBaseSchema,
1843
- type: literal("files"),
1844
- files: array(bridgeFilePropertyItemSchema)
1845
- }),
1846
1889
  object({
1847
1890
  ...pagePropertyBaseSchema,
1848
1891
  type: literal("place"),
@@ -1893,16 +1936,32 @@ var bridgePagePropertyValueSchema = variant("type", [
1893
1936
  type: literal("verification"),
1894
1937
  verification: string()
1895
1938
  })
1939
+ ];
1940
+ var bridgePagePropertyWriteValueSchema = variant("type", [
1941
+ ...basePropertySchemas,
1942
+ object({
1943
+ ...pagePropertyBaseSchema,
1944
+ type: literal("files"),
1945
+ files: array(bridgeFilePropertyItemSchema)
1946
+ })
1947
+ ]);
1948
+ var bridgePagePropertyReadValueSchema = variant("type", [
1949
+ ...basePropertySchemas,
1950
+ object({
1951
+ ...pagePropertyBaseSchema,
1952
+ type: literal("files"),
1953
+ files: array(bridgeFilePropertyReadItemSchema)
1954
+ })
1896
1955
  ]);
1897
1956
 
1898
1957
  // ../protocol/src/pages/properties/bridgePagePropertyMaps.ts
1899
1958
  var bridgePagePropertyWriteMapSchema = record(
1900
1959
  string(),
1901
- bridgePagePropertyValueSchema
1960
+ bridgePagePropertyWriteValueSchema
1902
1961
  );
1903
1962
  var bridgePagePropertyReadMapSchema = record(
1904
1963
  string(),
1905
- nullable(bridgePagePropertyValueSchema)
1964
+ nullable(bridgePagePropertyReadValueSchema)
1906
1965
  );
1907
1966
 
1908
1967
  // ../protocol/src/pages/bridgePage.ts
@@ -2252,7 +2311,8 @@ var customBlockQueryDataSourceErrorCodeSchema = string();
2252
2311
  var customBlockQueryDataSourceErrorInfoSchema = object({
2253
2312
  code: customBlockQueryDataSourceErrorCodeSchema,
2254
2313
  message: string(),
2255
- isRetryable: boolean()
2314
+ isRetryable: boolean(),
2315
+ details: fallback(optional(customBlockErrorDetailsSchema), void 0)
2256
2316
  });
2257
2317
  var queryDataSourceResultMessageSchema = variant("status", [
2258
2318
  object({
@@ -2392,7 +2452,8 @@ var customBlockGetPageErrorCodeSchema = string();
2392
2452
  var customBlockGetPageErrorInfoSchema = object({
2393
2453
  code: customBlockGetPageErrorCodeSchema,
2394
2454
  message: string(),
2395
- isRetryable: boolean()
2455
+ isRetryable: boolean(),
2456
+ details: fallback(optional(customBlockErrorDetailsSchema), void 0)
2396
2457
  });
2397
2458
  var getPageMessageSchema = object({
2398
2459
  type: literal("getPage"),
@@ -2624,7 +2685,7 @@ var invalidSandboxMessageSchema = object({
2624
2685
  });
2625
2686
 
2626
2687
  // ../protocol/src/messages/hostToSandbox.ts
2627
- var hostToSandboxMessageSchema = variant("type", [
2688
+ var commonHostToSandboxSchemas = [
2628
2689
  connectResultMessageSchema,
2629
2690
  setupInitMessageSchema,
2630
2691
  getDataSourceResultMessageSchema,
@@ -2641,13 +2702,25 @@ var hostToSandboxMessageSchema = variant("type", [
2641
2702
  listUsersResultMessageSchema,
2642
2703
  openPageResultMessageSchema,
2643
2704
  openExternalUrlResultMessageSchema,
2644
- invalidSandboxMessageSchema,
2705
+ invalidSandboxMessageSchema
2706
+ ];
2707
+ var hostToSandboxMessageSchema = variant("type", [
2708
+ ...commonHostToSandboxSchemas,
2645
2709
  queryDataSourceResultMessageSchema,
2646
2710
  getPageResultMessageSchema,
2647
2711
  createPageResultMessageSchema,
2648
2712
  updatePageResultMessageSchema
2649
2713
  ]);
2650
2714
 
2715
+ // ../protocol/src/compatibility/protocol12/page.ts
2716
+ var bridgePageForProtocol12Schema = object({
2717
+ ...bridgePageSchema.entries,
2718
+ properties: record(
2719
+ string(),
2720
+ nullable(bridgePagePropertyWriteValueSchema)
2721
+ )
2722
+ });
2723
+
2651
2724
  // ../protocol/src/compatibility/protocol3To5/bridgePage.ts
2652
2725
  var bridgePageForProtocol3To5Schema = object({
2653
2726
  object: literal("page"),
@@ -2693,7 +2766,10 @@ var createPageResultMessageWithProtocol3To5CompatibilitySchema = variant("status
2693
2766
  requestId: string(),
2694
2767
  status: literal("success"),
2695
2768
  /** The newly created page. */
2696
- page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
2769
+ page: union([
2770
+ bridgePageForProtocol12Schema,
2771
+ bridgePageForProtocol3To5Schema
2772
+ ])
2697
2773
  }),
2698
2774
  object({
2699
2775
  type: literal("createPageResult"),
@@ -2707,7 +2783,10 @@ var getPageResultMessageWithProtocol3To5CompatibilitySchema = variant("status",
2707
2783
  type: literal("getPageResult"),
2708
2784
  requestId: string(),
2709
2785
  status: literal("success"),
2710
- page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
2786
+ page: union([
2787
+ bridgePageForProtocol12Schema,
2788
+ bridgePageForProtocol3To5Schema
2789
+ ])
2711
2790
  }),
2712
2791
  object({
2713
2792
  type: literal("getPageResult"),
@@ -2721,7 +2800,10 @@ var updatePageResultMessageWithProtocol3To5CompatibilitySchema = variant("status
2721
2800
  type: literal("updatePageResult"),
2722
2801
  requestId: string(),
2723
2802
  status: literal("success"),
2724
- page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
2803
+ page: union([
2804
+ bridgePageForProtocol12Schema,
2805
+ bridgePageForProtocol3To5Schema
2806
+ ])
2725
2807
  }),
2726
2808
  object({
2727
2809
  type: literal("updatePageResult"),
@@ -2736,7 +2818,10 @@ var queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema = variant("s
2736
2818
  subscriptionId: string(),
2737
2819
  status: literal("success"),
2738
2820
  items: array(
2739
- union([bridgePageSchema, notionDataSourcePageForProtocol3To5Schema])
2821
+ union([
2822
+ bridgePageForProtocol12Schema,
2823
+ notionDataSourcePageForProtocol3To5Schema
2824
+ ])
2740
2825
  ),
2741
2826
  hasMore: boolean(),
2742
2827
  limitClamp: optional(bridgeDataSourceQueryLimitClampSchema)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-dev-shell",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Local development shell for Notion custom block workers.",
5
5
  "license": "MIT",
6
6
  "type": "module",