@notionhq/custom-blocks 0.4.0 → 0.5.1

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 (133) hide show
  1. package/dist/bridge/SandboxBridge.d.ts +0 -16
  2. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  3. package/dist/bridge/SandboxBridge.js +2 -41
  4. package/dist/bridge/parseHostToSandboxMessage.d.ts +3658 -0
  5. package/dist/bridge/parseHostToSandboxMessage.d.ts.map +1 -0
  6. package/dist/bridge/parseHostToSandboxMessage.js +47 -0
  7. package/dist/dataSources/bridge/resolveDataSourceQuery.js +3 -3
  8. package/dist/dataSources/bridge/resolveDataSources.js +5 -5
  9. package/dist/dataSources/filters/resolveFilter.d.ts.map +1 -1
  10. package/dist/dataSources/filters/resolveFilter.js +13 -3
  11. package/dist/dataSources/filters/types.d.ts +9 -3
  12. package/dist/dataSources/filters/types.d.ts.map +1 -1
  13. package/dist/dataSources/properties/resolvePropertyAddress.js +1 -1
  14. package/dist/dataSources/properties/resolvePropertyWriteMapForDataSource.js +1 -1
  15. package/dist/dataSources/resolvePageDataSource.js +2 -2
  16. package/dist/dataSources/subscribeToDataSource.d.ts +1 -4
  17. package/dist/dataSources/subscribeToDataSource.d.ts.map +1 -1
  18. package/dist/dataSources/subscribeToDataSource.js +2 -3
  19. package/dist/files/files.d.ts +2 -0
  20. package/dist/files/files.d.ts.map +1 -0
  21. package/dist/files/files.js +1 -0
  22. package/dist/files/icons.d.ts +2 -0
  23. package/dist/files/icons.d.ts.map +1 -0
  24. package/dist/files/icons.js +1 -0
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/initialization/getInitBindingError.js +2 -2
  28. package/dist/manifest/types.d.ts +4 -3
  29. package/dist/manifest/types.d.ts.map +1 -1
  30. package/dist/pages/bridge/getPageForDataSource.js +1 -1
  31. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts +4 -1
  32. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts.map +1 -1
  33. package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.d.ts.map +1 -1
  34. package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.js +0 -2
  35. package/dist/pages/bridge/updatePage.js +1 -1
  36. package/dist/pages/properties/getPropertyByKey.js +2 -2
  37. package/dist/pages/types.d.ts +8 -10
  38. package/dist/pages/types.d.ts.map +1 -1
  39. package/dist/protocol/compatibility/protocol3To10/dataSourceBindings.d.ts +530 -0
  40. package/dist/protocol/compatibility/protocol3To10/dataSourceBindings.js +25 -0
  41. package/dist/protocol/compatibility/protocol3To5/bridgePage.d.ts +6 -7
  42. package/dist/protocol/compatibility/protocol3To5/bridgePage.js +3 -3
  43. package/dist/protocol/context/containingPage.d.ts +3 -0
  44. package/dist/protocol/context/messages/pageChanged.d.ts +3 -0
  45. package/dist/protocol/context/messages/parentChanged.d.ts +3 -0
  46. package/dist/protocol/context/parent.d.ts +3 -0
  47. package/dist/protocol/context/parent.js +6 -1
  48. package/dist/protocol/dataSources/bridgeDataSourceBinding.d.ts +3 -7
  49. package/dist/protocol/dataSources/bridgeDataSourceBinding.js +5 -5
  50. package/dist/protocol/dataSources/bridgeDataSourceBindings.d.ts +2 -6
  51. package/dist/protocol/dataSources/{collectionPointer.d.ts → dataSourcePointer.d.ts} +2 -2
  52. package/dist/protocol/dataSources/{collectionPointer.js → dataSourcePointer.js} +1 -1
  53. package/dist/protocol/dataSources/{collectionSchema.d.ts → dataSourceSchema.d.ts} +2 -6
  54. package/dist/protocol/dataSources/{collectionSchema.js → dataSourceSchema.js} +1 -1
  55. package/dist/protocol/dataSources/filters/bridgeDataSourceFilter.d.ts +1458 -12
  56. package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.d.ts +729 -6
  57. package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.js +14 -2
  58. package/dist/protocol/dataSources/filters/peopleFilterOperator.d.ts +3 -3
  59. package/dist/protocol/dataSources/filters/peopleFilterOperator.js +1 -1
  60. package/dist/protocol/dataSources/filters/timestampFilterOperator.d.ts +354 -0
  61. package/dist/protocol/dataSources/filters/timestampFilterOperator.js +4 -0
  62. package/dist/protocol/dataSources/messages/dataSourcesChanged.d.ts +2 -6
  63. package/dist/protocol/dataSources/messages/queryDataSource.d.ts +1470 -26
  64. package/dist/protocol/dataSources/notionDataSource.d.ts +3 -11
  65. package/dist/protocol/dataSources/notionDataSource.js +5 -5
  66. package/dist/protocol/dataSources/properties/propertySchema.d.ts +4 -9
  67. package/dist/protocol/dataSources/properties/propertySchema.js +2 -4
  68. package/dist/protocol/dataSources/resolveDataSourceBinding.d.ts +4 -4
  69. package/dist/protocol/dataSources/resolveDataSourceBinding.js +2 -2
  70. package/dist/protocol/files.d.ts +32 -0
  71. package/dist/protocol/files.js +17 -0
  72. package/dist/protocol/handshake/connect.d.ts +1 -1
  73. package/dist/protocol/handshake/init.d.ts +9 -7
  74. package/dist/protocol/icons.d.ts +22 -7
  75. package/dist/protocol/icons.js +19 -7
  76. package/dist/protocol/index.d.ts +16 -14
  77. package/dist/protocol/index.js +10 -7
  78. package/dist/protocol/manifest/manifest.d.ts +9 -9
  79. package/dist/protocol/manifest/manifest.js +7 -7
  80. package/dist/protocol/messages/hostToSandbox.d.ts +100 -103
  81. package/dist/protocol/messages/sandboxToHost.d.ts +1471 -37
  82. package/dist/protocol/pages/bridgePage.d.ts +6 -7
  83. package/dist/protocol/pages/bridgePage.js +3 -3
  84. package/dist/protocol/pages/messages/createPage.d.ts +547 -40
  85. package/dist/protocol/pages/messages/createPage.js +27 -15
  86. package/dist/protocol/pages/messages/getPage.d.ts +18 -21
  87. package/dist/protocol/pages/messages/updatePage.d.ts +21 -28
  88. package/dist/protocol/pages/messages/updatePage.js +3 -3
  89. package/dist/protocol/pages/pageAppearance.d.ts +5 -59
  90. package/dist/protocol/pages/pageAppearance.js +11 -40
  91. package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +4 -12
  92. package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +2 -6
  93. package/dist/protocol/pages/properties/bridgePagePropertyValue.js +2 -7
  94. package/dist/protocol/utils/ids.d.ts +2 -0
  95. package/dist/protocol/utils/ids.js +1 -0
  96. package/dist/protocol/utils/protocolVersion.d.ts +2 -1
  97. package/dist/protocol/utils/protocolVersion.js +3 -1
  98. package/dist/react/NotionCustomBlock.d.ts.map +1 -1
  99. package/dist/react/NotionCustomBlock.js +1 -15
  100. package/dist/utils/version.js +1 -1
  101. package/docs/data-sources.md +75 -76
  102. package/docs/deployment.md +4 -5
  103. package/docs/pages.md +90 -56
  104. package/package.json +1 -1
  105. package/src/bridge/SandboxBridge.ts +3 -58
  106. package/src/bridge/parseHostToSandboxMessage.ts +54 -0
  107. package/src/dataSources/bridge/resolveDataSourceQuery.ts +3 -3
  108. package/src/dataSources/bridge/resolveDataSources.ts +6 -6
  109. package/src/dataSources/filters/resolveFilter.ts +12 -3
  110. package/src/dataSources/filters/types.ts +7 -4
  111. package/src/dataSources/properties/resolvePropertyAddress.ts +1 -1
  112. package/src/dataSources/properties/resolvePropertyWriteMapForDataSource.ts +1 -1
  113. package/src/dataSources/resolvePageDataSource.ts +2 -2
  114. package/src/dataSources/subscribeToDataSource.ts +7 -19
  115. package/src/files/files.ts +5 -0
  116. package/src/files/icons.ts +9 -0
  117. package/src/index.ts +6 -11
  118. package/src/initialization/getInitBindingError.ts +2 -2
  119. package/src/manifest/types.ts +9 -3
  120. package/src/pages/bridge/getPageForDataSource.ts +1 -1
  121. package/src/pages/bridge/toNotionPagePropertyFromBridgeProperty.ts +0 -2
  122. package/src/pages/bridge/updatePage.ts +1 -1
  123. package/src/pages/properties/getPropertyByKey.ts +2 -2
  124. package/src/pages/types.ts +9 -13
  125. package/src/react/NotionCustomBlock.tsx +1 -16
  126. package/dist/protocol/dataSources/filters/createdByFilterOperator.d.ts +0 -17
  127. package/dist/protocol/dataSources/filters/createdByFilterOperator.js +0 -11
  128. package/dist/protocol/pages/properties/fileInput.d.ts +0 -16
  129. package/dist/protocol/pages/properties/fileInput.js +0 -16
  130. package/dist/react/DebugMessageLog.d.ts +0 -2
  131. package/dist/react/DebugMessageLog.d.ts.map +0 -1
  132. package/dist/react/DebugMessageLog.js +0 -23
  133. package/src/react/DebugMessageLog.tsx +0 -34
package/src/index.ts CHANGED
@@ -11,7 +11,7 @@ export type { CustomBlockPage } from "@notionhq/custom-blocks-protocol/context/c
11
11
  export type { NotionContrastMode } from "@notionhq/custom-blocks-protocol/context/contrast.js"
12
12
  export type { NotionParent } from "@notionhq/custom-blocks-protocol/context/parent.js"
13
13
  export type { NotionTheme } from "@notionhq/custom-blocks-protocol/context/theme.js"
14
- export type { NotionCollectionSchema } from "@notionhq/custom-blocks-protocol/dataSources/collectionSchema.js"
14
+ export type { NotionDataSourceSchema } from "@notionhq/custom-blocks-protocol/dataSources/dataSourceSchema.js"
15
15
  export type {
16
16
  CustomBlockDataSourceResolutionErrorCode,
17
17
  CustomBlockDataSourceResolutionErrorInfo,
@@ -44,20 +44,11 @@ export type {
44
44
  CustomBlockInitializationErrorInfo,
45
45
  } from "@notionhq/custom-blocks-protocol/handshake/init.js"
46
46
  export { CustomBlockInitializationError } from "@notionhq/custom-blocks-protocol/handshake/init.js"
47
- export type {
48
- NotionIconColor,
49
- NotionIconName,
50
- } from "@notionhq/custom-blocks-protocol/icons.js"
51
47
  export type {
52
48
  CustomBlockGrant,
53
49
  CustomBlockGrantAction,
54
50
  CustomBlockGrantResourceName,
55
51
  } from "@notionhq/custom-blocks-protocol/manifest/grants.js"
56
- export type {
57
- ManifestDataSource,
58
- ManifestIcon,
59
- ManifestProperty,
60
- } from "@notionhq/custom-blocks-protocol/manifest/manifest.js"
61
52
  export type {
62
53
  CustomBlockOpenExternalUrlErrorCode,
63
54
  CustomBlockOpenExternalUrlErrorInfo,
@@ -101,12 +92,16 @@ export { customBlock } from "./context/index.js"
101
92
  export type * from "./dataSources/filters/types.js"
102
93
  export { dataSources } from "./dataSources/index.js"
103
94
  export type * from "./dataSources/types.js"
95
+ export type * from "./files/files.js"
96
+ export type * from "./files/icons.js"
104
97
  export { initCustomBlock } from "./initialization/initCustomBlock.js"
105
98
  export { NotInIframeError } from "./initialization/NotInIframeError.js"
106
99
  export type { CustomBlockInitPayload } from "./initialization/types.js"
107
100
  export type {
108
- CustomBlockManifest,
109
101
  NotionCustomBlockManifest,
102
+ NotionManifestDataSource,
103
+ NotionManifestIcon,
104
+ NotionManifestProperty,
110
105
  } from "./manifest/types.js"
111
106
  export { links } from "./navigation/index.js"
112
107
  export type * from "./navigation/types.js"
@@ -14,8 +14,8 @@ export function getInitBindingError(
14
14
  continue
15
15
  }
16
16
  if (
17
- dataSource?.collectionPointer === undefined ||
18
- dataSource.collectionSchema === undefined
17
+ dataSource?.dataSourcePointer === undefined ||
18
+ dataSource.dataSourceSchema === undefined
19
19
  ) {
20
20
  return {
21
21
  code: "invalid_init_bindings",
@@ -1,7 +1,13 @@
1
- import type { BridgeCustomBlockManifest } from "@notionhq/custom-blocks-protocol/manifest/manifest.js"
1
+ import type {
2
+ BridgeCustomBlockManifest,
3
+ BridgeManifestDataSource,
4
+ BridgeManifestIcon,
5
+ BridgeManifestProperty,
6
+ } from "@notionhq/custom-blocks-protocol/manifest/manifest.js"
2
7
 
3
8
  /** A block's declared metadata, data sources, and grants. */
4
9
  export type NotionCustomBlockManifest = BridgeCustomBlockManifest
5
10
 
6
- /** @deprecated Use NotionCustomBlockManifest. */
7
- export type CustomBlockManifest = NotionCustomBlockManifest
11
+ export type NotionManifestIcon = BridgeManifestIcon
12
+ export type NotionManifestProperty = BridgeManifestProperty
13
+ export type NotionManifestDataSource = BridgeManifestDataSource
@@ -13,7 +13,7 @@ export async function getPageForDataSource(
13
13
  },
14
14
  ): Promise<GetPageResult> {
15
15
  const { pageId, dataSource } = args
16
- const dataSourceId = dataSource?.collectionPointer?.id
16
+ const dataSourceId = dataSource?.dataSourcePointer?.id
17
17
  const result = await bridge.request(
18
18
  { type: "getPage", dataSourceId, pageId },
19
19
  getPageResultMessageSchema,
@@ -75,8 +75,6 @@ export function toNotionPagePropertyFromBridgeProperty(
75
75
  return { id: value.id, type: value.type, button: value.button }
76
76
  case "formula":
77
77
  return { id: value.id, type: value.type, formula: value.formula }
78
- case "location":
79
- return { id: value.id, type: value.type, location: value.location }
80
78
  case "rollup":
81
79
  return { id: value.id, type: value.type, rollup: value.rollup }
82
80
  case "verification":
@@ -45,7 +45,7 @@ export function updatePage(
45
45
  }
46
46
  }
47
47
  const { dataSource } = args
48
- const dataSourceId = dataSource?.collectionPointer?.id
48
+ const dataSourceId = dataSource?.dataSourcePointer?.id
49
49
  const resolved = resolvePropertyWriteMapForDataSource({
50
50
  dataSource,
51
51
  properties: args.properties === undefined ? {} : args.properties,
@@ -18,8 +18,8 @@ export function getPropertyByKey(
18
18
  : undefined
19
19
  // Keep the captured mapping valid only while its key remains bound to the original database.
20
20
  if (
21
- !dataSource?.collectionPointer ||
22
- currentDataSource?.collectionPointer?.id !== dataSource.collectionPointer.id
21
+ !dataSource?.dataSourcePointer ||
22
+ currentDataSource?.dataSourcePointer?.id !== dataSource.dataSourcePointer.id
23
23
  ) {
24
24
  return null
25
25
  }
@@ -14,27 +14,25 @@ import type {
14
14
  } from "@notionhq/custom-blocks-protocol/pages/messages/openPage.js"
15
15
  import type { CustomBlockUpdatePageErrorInfo } from "@notionhq/custom-blocks-protocol/pages/messages/updatePage.js"
16
16
  import type {
17
- NotionCreatePageIcon,
18
- NotionPageCover,
19
- NotionPageIcon,
17
+ BridgePageCover,
18
+ BridgePageIcon,
20
19
  } from "@notionhq/custom-blocks-protocol/pages/pageAppearance.js"
21
20
  import type { NotionDateInput } from "@notionhq/custom-blocks-protocol/pages/properties/dateInput.js"
22
- import type { NotionFileInput } from "@notionhq/custom-blocks-protocol/pages/properties/fileInput.js"
23
21
  import type { NotionPlaceInput } from "@notionhq/custom-blocks-protocol/pages/properties/placeInput.js"
24
22
  import type { NotionRelationInput } from "@notionhq/custom-blocks-protocol/pages/properties/relationInput.js"
25
23
  import type { NotionRichTextItem } from "@notionhq/custom-blocks-protocol/pages/properties/richText.js"
26
24
  import type { NotionSelectOptionInput } from "@notionhq/custom-blocks-protocol/pages/properties/selectOption.js"
27
25
  import type { NotionUserInput } from "@notionhq/custom-blocks-protocol/pages/properties/userInput.js"
28
26
  import type { NotionPageId } from "@notionhq/custom-blocks-protocol/utils/ids.js"
27
+ import type { NotionFilePropertyItem } from "../files/files.js"
29
28
  import type { KeyedDataSourceParent } from "./parent.js"
30
29
 
31
- export type {
32
- NotionPageCover,
33
- NotionPageIcon,
34
- } from "@notionhq/custom-blocks-protocol/pages/pageAppearance.js"
35
30
  // These leaf values intentionally share their SDK and protocol representation.
36
31
  export type { NotionDateInput } from "@notionhq/custom-blocks-protocol/pages/properties/dateInput.js"
37
32
 
33
+ export type NotionPageIcon = BridgePageIcon
34
+ export type NotionPageCover = BridgePageCover
35
+
38
36
  export type NotionPagePropertyValue = { id: string } & (
39
37
  | { type: "title"; title: NotionRichTextItem[] }
40
38
  | { type: "rich_text"; rich_text: NotionRichTextItem[] }
@@ -49,7 +47,7 @@ export type NotionPagePropertyValue = { id: string } & (
49
47
  | { type: "date"; date: NotionDateInput | null }
50
48
  | { type: "people"; people: NotionUserInput[] }
51
49
  | { type: "relation"; relation: NotionRelationInput[]; has_more?: boolean }
52
- | { type: "files"; files: NotionFileInput[] }
50
+ | { type: "files"; files: NotionFilePropertyItem[] }
53
51
  | { type: "place"; place: NotionPlaceInput | null }
54
52
  | { type: "created_time"; created_time: string | null }
55
53
  | { type: "last_edited_time"; last_edited_time: string | null }
@@ -58,7 +56,6 @@ export type NotionPagePropertyValue = { id: string } & (
58
56
  | { type: "unique_id"; unique_id: string }
59
57
  | { type: "button"; button: string }
60
58
  | { type: "formula"; formula: string }
61
- | { type: "location"; location: string }
62
59
  | { type: "rollup"; rollup: string }
63
60
  | { type: "verification"; verification: string }
64
61
  )
@@ -86,7 +83,6 @@ export type NotionPagePropertyInputValue =
86
83
  | "unique_id"
87
84
  | "button"
88
85
  | "formula"
89
- | "location"
90
86
  | "rollup"
91
87
  | "verification"
92
88
  }
@@ -145,7 +141,7 @@ export type CreatePageResult =
145
141
  *
146
142
  * - `page_id`: Create a child page under the given Notion page.
147
143
  * - `data_source_id`: Create a row inside the given Notion data source. The public API's
148
- * `data_source_id` is the same UUID as the `collectionPointer.id` exposed in `dataSources`,
144
+ * `data_source_id` is the same UUID as the `dataSourcePointer.id` exposed in `dataSources`,
149
145
  * so either value works here.
150
146
  * - `data_source_key`: Create a row inside the data source that the custom block was configured with
151
147
  * under this semantic key. The SDK resolves the key to a `data_source_id` locally before
@@ -158,7 +154,7 @@ export type { CreatePageParent } from "./parent.js"
158
154
  */
159
155
  export type CreatePageArgs = {
160
156
  properties: NotionPagePropertyInputMap
161
- icon?: NotionCreatePageIcon
157
+ icon?: NotionPageIcon
162
158
  cover?: NotionPageCover
163
159
  } & (
164
160
  | {
@@ -1,10 +1,9 @@
1
1
  import type { CustomBlockInitializationError } from "@notionhq/custom-blocks-protocol/handshake/init.js"
2
2
  import type { ReactNode } from "react"
3
- import { useEffect, useLayoutEffect, useState } from "react"
3
+ import { useEffect, useLayoutEffect } from "react"
4
4
  import { getBridge } from "../bridge/getBridge.js"
5
5
  import { useCustomBlockInit } from "../initialization/react/useCustomBlockInit.js"
6
6
  import { autoResize } from "../layout/autoResize.js"
7
- import { DebugMessageLog } from "./DebugMessageLog.js"
8
7
  import { InitializationErrorDetails } from "./InitializationErrorDetails.js"
9
8
  import { MissingHostScreen } from "./MissingHostScreen.js"
10
9
  import "./InitializationErrorScreen.css"
@@ -51,7 +50,6 @@ export function NotionCustomBlock({
51
50
  errorFallback,
52
51
  }: NotionCustomBlockProps) {
53
52
  const init = useCustomBlockInit()
54
- const [debugOpen, setDebugOpen] = useState(false)
55
53
 
56
54
  // Keep the host iframe height in sync with the block's content after initialization.
57
55
  useEffect(() => {
@@ -61,16 +59,6 @@ export function NotionCustomBlock({
61
59
  return autoResize({ target: document.getElementById("root") })
62
60
  }, [init.isLoaded])
63
61
 
64
- useEffect(() => {
65
- const onKeyDown = (e: KeyboardEvent) => {
66
- if (e.key === "\\") {
67
- setDebugOpen(prev => !prev)
68
- }
69
- }
70
- window.addEventListener("keydown", onKeyDown)
71
- return () => window.removeEventListener("keydown", onKeyDown)
72
- }, [])
73
-
74
62
  useLayoutEffect(() => {
75
63
  if (!init.isLoaded) {
76
64
  return
@@ -80,9 +68,6 @@ export function NotionCustomBlock({
80
68
  getBridge().completeInitialization()
81
69
  }, [init.isLoaded])
82
70
 
83
- if (debugOpen) {
84
- return <DebugMessageLog />
85
- }
86
71
  if (init.error) {
87
72
  if (errorFallback === undefined) {
88
73
  return <DefaultInitErrorFallback error={init.error} />
@@ -1,17 +0,0 @@
1
- import * as v from "valibot";
2
- export declare const customBlockCreatedByFilterOperatorSchema: v.UnionSchema<[v.StrictObjectSchema<{
3
- readonly contains: v.StrictObjectSchema<{
4
- readonly object: v.LiteralSchema<"user", undefined>;
5
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
6
- }, undefined>;
7
- }, undefined>, v.StrictObjectSchema<{
8
- readonly does_not_contain: v.StrictObjectSchema<{
9
- readonly object: v.LiteralSchema<"user", undefined>;
10
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
11
- }, undefined>;
12
- }, undefined>, v.StrictObjectSchema<{
13
- readonly is_empty: v.LiteralSchema<true, undefined>;
14
- }, undefined>, v.StrictObjectSchema<{
15
- readonly is_not_empty: v.LiteralSchema<true, undefined>;
16
- }, undefined>], undefined>;
17
- export type CustomBlockCreatedByFilterOperator = v.InferOutput<typeof customBlockCreatedByFilterOperatorSchema>;
@@ -1,11 +0,0 @@
1
- import * as v from "valibot";
2
- const customBlockCreatorFilterValueSchema = v.strictObject({
3
- object: v.literal("user"),
4
- id: v.pipe(v.string(), v.minLength(1), v.maxLength(2_000)),
5
- });
6
- export const customBlockCreatedByFilterOperatorSchema = v.union([
7
- v.strictObject({ contains: customBlockCreatorFilterValueSchema }),
8
- v.strictObject({ does_not_contain: customBlockCreatorFilterValueSchema }),
9
- v.strictObject({ is_empty: v.literal(true) }),
10
- v.strictObject({ is_not_empty: v.literal(true) }),
11
- ]);
@@ -1,16 +0,0 @@
1
- import * as v from "valibot";
2
- export declare const notionFileInputSchema: v.UnionSchema<[v.ObjectSchema<{
3
- readonly type: v.LiteralSchema<"external", undefined>;
4
- readonly name: v.StringSchema<undefined>;
5
- readonly external: v.ObjectSchema<{
6
- readonly url: v.StringSchema<undefined>;
7
- }, undefined>;
8
- }, undefined>, v.ObjectSchema<{
9
- readonly type: v.LiteralSchema<"file", undefined>;
10
- readonly name: v.StringSchema<undefined>;
11
- readonly file: v.ObjectSchema<{
12
- readonly url: v.StringSchema<undefined>;
13
- readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
14
- }, undefined>;
15
- }, undefined>], undefined>;
16
- export type NotionFileInput = v.InferOutput<typeof notionFileInputSchema>;
@@ -1,16 +0,0 @@
1
- import * as v from "valibot";
2
- export const notionFileInputSchema = v.union([
3
- v.object({
4
- type: v.literal("external"),
5
- name: v.string(),
6
- external: v.object({ url: v.string() }),
7
- }),
8
- v.object({
9
- type: v.literal("file"),
10
- name: v.string(),
11
- file: v.object({
12
- url: v.string(),
13
- expiry_time: v.optional(v.string()),
14
- }),
15
- }),
16
- ]);
@@ -1,2 +0,0 @@
1
- export declare function DebugMessageLog(): import("react").JSX.Element;
2
- //# sourceMappingURL=DebugMessageLog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DebugMessageLog.d.ts","sourceRoot":"","sources":["../../src/react/DebugMessageLog.tsx"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,gCAiB9B"}
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useSyncExternalStore } from "react";
3
- import { getBridge } from "../bridge/getBridge.js";
4
- export function DebugMessageLog() {
5
- const bridge = getBridge();
6
- const log = useSyncExternalStore(bridge.subscribeToMessageLog, bridge.getMessageLog);
7
- const text = log
8
- .map(entry => `[${entry.timestamp}] ${entry.direction}: ${JSON.stringify(entry.data)}`)
9
- .join("\n");
10
- return (_jsx("pre", { "data-testid": "debug-message-log", style: DEBUG_PRE_STYLE, children: text || "(no messages yet)" }));
11
- }
12
- const DEBUG_PRE_STYLE = {
13
- margin: 0,
14
- padding: "8px 12px",
15
- fontSize: 12,
16
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
17
- lineHeight: 1.5,
18
- whiteSpace: "pre-wrap",
19
- wordBreak: "break-all",
20
- userSelect: "text",
21
- background: "#1e1e1e",
22
- color: "#d4d4d4",
23
- };
@@ -1,34 +0,0 @@
1
- import { useSyncExternalStore } from "react"
2
- import { getBridge } from "../bridge/getBridge.js"
3
-
4
- export function DebugMessageLog() {
5
- const bridge = getBridge()
6
- const log = useSyncExternalStore(
7
- bridge.subscribeToMessageLog,
8
- bridge.getMessageLog,
9
- )
10
- const text = log
11
- .map(
12
- entry =>
13
- `[${entry.timestamp}] ${entry.direction}: ${JSON.stringify(entry.data)}`,
14
- )
15
- .join("\n")
16
- return (
17
- <pre data-testid="debug-message-log" style={DEBUG_PRE_STYLE}>
18
- {text || "(no messages yet)"}
19
- </pre>
20
- )
21
- }
22
-
23
- const DEBUG_PRE_STYLE = {
24
- margin: 0,
25
- padding: "8px 12px",
26
- fontSize: 12,
27
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
28
- lineHeight: 1.5,
29
- whiteSpace: "pre-wrap" as const,
30
- wordBreak: "break-all" as const,
31
- userSelect: "text" as const,
32
- background: "#1e1e1e",
33
- color: "#d4d4d4",
34
- }