@notionhq/custom-blocks 0.4.0 → 0.5.0

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 (129) 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 +0 -38
  4. package/dist/dataSources/bridge/resolveDataSourceQuery.js +3 -3
  5. package/dist/dataSources/bridge/resolveDataSources.js +4 -4
  6. package/dist/dataSources/filters/resolveFilter.d.ts.map +1 -1
  7. package/dist/dataSources/filters/resolveFilter.js +13 -3
  8. package/dist/dataSources/filters/types.d.ts +9 -3
  9. package/dist/dataSources/filters/types.d.ts.map +1 -1
  10. package/dist/dataSources/properties/resolvePropertyAddress.js +1 -1
  11. package/dist/dataSources/properties/resolvePropertyWriteMapForDataSource.js +1 -1
  12. package/dist/dataSources/resolvePageDataSource.js +2 -2
  13. package/dist/dataSources/subscribeToDataSource.d.ts +1 -4
  14. package/dist/dataSources/subscribeToDataSource.d.ts.map +1 -1
  15. package/dist/dataSources/subscribeToDataSource.js +2 -3
  16. package/dist/files/files.d.ts +2 -0
  17. package/dist/files/files.d.ts.map +1 -0
  18. package/dist/files/files.js +1 -0
  19. package/dist/files/icons.d.ts +2 -0
  20. package/dist/files/icons.d.ts.map +1 -0
  21. package/dist/files/icons.js +1 -0
  22. package/dist/index.d.ts +4 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/initialization/getInitBindingError.js +2 -2
  25. package/dist/manifest/types.d.ts +4 -3
  26. package/dist/manifest/types.d.ts.map +1 -1
  27. package/dist/pages/bridge/getPageForDataSource.js +1 -1
  28. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts +4 -1
  29. package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts.map +1 -1
  30. package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.d.ts.map +1 -1
  31. package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.js +0 -2
  32. package/dist/pages/bridge/updatePage.js +1 -1
  33. package/dist/pages/properties/getPropertyByKey.js +2 -2
  34. package/dist/pages/types.d.ts +8 -10
  35. package/dist/pages/types.d.ts.map +1 -1
  36. package/dist/protocol/compatibility/protocol3To10/dataSourceBindings.d.ts +530 -0
  37. package/dist/protocol/compatibility/protocol3To10/dataSourceBindings.js +25 -0
  38. package/dist/protocol/compatibility/protocol3To5/bridgePage.d.ts +6 -7
  39. package/dist/protocol/compatibility/protocol3To5/bridgePage.js +3 -3
  40. package/dist/protocol/context/containingPage.d.ts +3 -0
  41. package/dist/protocol/context/messages/pageChanged.d.ts +3 -0
  42. package/dist/protocol/context/messages/parentChanged.d.ts +3 -0
  43. package/dist/protocol/context/parent.d.ts +3 -0
  44. package/dist/protocol/context/parent.js +6 -1
  45. package/dist/protocol/dataSources/bridgeDataSourceBinding.d.ts +3 -7
  46. package/dist/protocol/dataSources/bridgeDataSourceBinding.js +5 -5
  47. package/dist/protocol/dataSources/bridgeDataSourceBindings.d.ts +2 -6
  48. package/dist/protocol/dataSources/{collectionPointer.d.ts → dataSourcePointer.d.ts} +2 -2
  49. package/dist/protocol/dataSources/{collectionPointer.js → dataSourcePointer.js} +1 -1
  50. package/dist/protocol/dataSources/{collectionSchema.d.ts → dataSourceSchema.d.ts} +2 -6
  51. package/dist/protocol/dataSources/{collectionSchema.js → dataSourceSchema.js} +1 -1
  52. package/dist/protocol/dataSources/filters/bridgeDataSourceFilter.d.ts +1458 -12
  53. package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.d.ts +729 -6
  54. package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.js +14 -2
  55. package/dist/protocol/dataSources/filters/peopleFilterOperator.d.ts +3 -3
  56. package/dist/protocol/dataSources/filters/peopleFilterOperator.js +1 -1
  57. package/dist/protocol/dataSources/filters/timestampFilterOperator.d.ts +354 -0
  58. package/dist/protocol/dataSources/filters/timestampFilterOperator.js +4 -0
  59. package/dist/protocol/dataSources/messages/dataSourcesChanged.d.ts +2 -6
  60. package/dist/protocol/dataSources/messages/queryDataSource.d.ts +1470 -26
  61. package/dist/protocol/dataSources/notionDataSource.d.ts +3 -11
  62. package/dist/protocol/dataSources/notionDataSource.js +5 -5
  63. package/dist/protocol/dataSources/properties/propertySchema.d.ts +4 -9
  64. package/dist/protocol/dataSources/properties/propertySchema.js +2 -4
  65. package/dist/protocol/dataSources/resolveDataSourceBinding.d.ts +4 -4
  66. package/dist/protocol/dataSources/resolveDataSourceBinding.js +2 -2
  67. package/dist/protocol/files.d.ts +32 -0
  68. package/dist/protocol/files.js +17 -0
  69. package/dist/protocol/handshake/connect.d.ts +1 -1
  70. package/dist/protocol/handshake/init.d.ts +9 -7
  71. package/dist/protocol/icons.d.ts +22 -7
  72. package/dist/protocol/icons.js +19 -7
  73. package/dist/protocol/index.d.ts +16 -14
  74. package/dist/protocol/index.js +10 -7
  75. package/dist/protocol/manifest/manifest.d.ts +9 -9
  76. package/dist/protocol/manifest/manifest.js +7 -7
  77. package/dist/protocol/messages/hostToSandbox.d.ts +100 -103
  78. package/dist/protocol/messages/sandboxToHost.d.ts +1471 -37
  79. package/dist/protocol/pages/bridgePage.d.ts +6 -7
  80. package/dist/protocol/pages/bridgePage.js +3 -3
  81. package/dist/protocol/pages/messages/createPage.d.ts +547 -40
  82. package/dist/protocol/pages/messages/createPage.js +27 -15
  83. package/dist/protocol/pages/messages/getPage.d.ts +18 -21
  84. package/dist/protocol/pages/messages/updatePage.d.ts +21 -28
  85. package/dist/protocol/pages/messages/updatePage.js +3 -3
  86. package/dist/protocol/pages/pageAppearance.d.ts +5 -59
  87. package/dist/protocol/pages/pageAppearance.js +11 -40
  88. package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +4 -12
  89. package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +2 -6
  90. package/dist/protocol/pages/properties/bridgePagePropertyValue.js +2 -7
  91. package/dist/protocol/utils/ids.d.ts +2 -0
  92. package/dist/protocol/utils/ids.js +1 -0
  93. package/dist/protocol/utils/protocolVersion.d.ts +2 -1
  94. package/dist/protocol/utils/protocolVersion.js +3 -1
  95. package/dist/react/NotionCustomBlock.d.ts.map +1 -1
  96. package/dist/react/NotionCustomBlock.js +1 -15
  97. package/dist/utils/version.js +1 -1
  98. package/docs/data-sources.md +74 -76
  99. package/docs/deployment.md +4 -5
  100. package/docs/pages.md +91 -55
  101. package/package.json +1 -1
  102. package/src/bridge/SandboxBridge.ts +0 -55
  103. package/src/dataSources/bridge/resolveDataSourceQuery.ts +3 -3
  104. package/src/dataSources/bridge/resolveDataSources.ts +4 -4
  105. package/src/dataSources/filters/resolveFilter.ts +12 -3
  106. package/src/dataSources/filters/types.ts +7 -4
  107. package/src/dataSources/properties/resolvePropertyAddress.ts +1 -1
  108. package/src/dataSources/properties/resolvePropertyWriteMapForDataSource.ts +1 -1
  109. package/src/dataSources/resolvePageDataSource.ts +2 -2
  110. package/src/dataSources/subscribeToDataSource.ts +7 -19
  111. package/src/files/files.ts +5 -0
  112. package/src/files/icons.ts +9 -0
  113. package/src/index.ts +6 -11
  114. package/src/initialization/getInitBindingError.ts +2 -2
  115. package/src/manifest/types.ts +9 -3
  116. package/src/pages/bridge/getPageForDataSource.ts +1 -1
  117. package/src/pages/bridge/toNotionPagePropertyFromBridgeProperty.ts +0 -2
  118. package/src/pages/bridge/updatePage.ts +1 -1
  119. package/src/pages/properties/getPropertyByKey.ts +2 -2
  120. package/src/pages/types.ts +9 -13
  121. package/src/react/NotionCustomBlock.tsx +1 -16
  122. package/dist/protocol/dataSources/filters/createdByFilterOperator.d.ts +0 -17
  123. package/dist/protocol/dataSources/filters/createdByFilterOperator.js +0 -11
  124. package/dist/protocol/pages/properties/fileInput.d.ts +0 -16
  125. package/dist/protocol/pages/properties/fileInput.js +0 -16
  126. package/dist/react/DebugMessageLog.d.ts +0 -2
  127. package/dist/react/DebugMessageLog.d.ts.map +0 -1
  128. package/dist/react/DebugMessageLog.js +0 -23
  129. package/src/react/DebugMessageLog.tsx +0 -34
@@ -4,20 +4,20 @@ import * as v from "valibot";
4
4
  * `emoji` / `external` icon variants the public Notion API uses, so the host
5
5
  * can render a recognizable affordance next to the slot in setup UI.
6
6
  */
7
- export declare const manifestIconSchema: v.VariantSchema<"type", [v.ObjectSchema<{
7
+ export declare const bridgeManifestIconSchema: v.VariantSchema<"type", [v.ObjectSchema<{
8
8
  readonly type: v.LiteralSchema<"emoji", undefined>;
9
9
  readonly emoji: v.StringSchema<undefined>;
10
10
  }, undefined>, v.ObjectSchema<{
11
11
  readonly type: v.LiteralSchema<"external", undefined>;
12
12
  readonly url: v.StringSchema<undefined>;
13
13
  }, undefined>], undefined>;
14
- export type ManifestIcon = v.InferOutput<typeof manifestIconSchema>;
15
- export declare const manifestPropertySchema: v.ObjectSchema<{
14
+ export type BridgeManifestIcon = v.InferOutput<typeof bridgeManifestIconSchema>;
15
+ export declare const bridgeManifestPropertySchema: v.ObjectSchema<{
16
16
  readonly name: v.StringSchema<undefined>;
17
17
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
18
- readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
18
+ readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
19
19
  }, undefined>;
20
- export type ManifestProperty = v.InferOutput<typeof manifestPropertySchema>;
20
+ export type BridgeManifestProperty = v.InferOutput<typeof bridgeManifestPropertySchema>;
21
21
  export declare const manifestPageSchema: v.ObjectSchema<{
22
22
  readonly name: v.StringSchema<undefined>;
23
23
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -30,7 +30,7 @@ export declare const manifestPageSchema: v.ObjectSchema<{
30
30
  }, undefined>], undefined>, undefined>;
31
31
  }, undefined>;
32
32
  export type ManifestPage = v.InferOutput<typeof manifestPageSchema>;
33
- export declare const manifestDataSourceSchema: v.ObjectSchema<{
33
+ export declare const bridgeManifestDataSourceSchema: v.ObjectSchema<{
34
34
  readonly name: v.StringSchema<undefined>;
35
35
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
36
36
  readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
@@ -43,10 +43,10 @@ export declare const manifestDataSourceSchema: v.ObjectSchema<{
43
43
  readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
44
44
  readonly name: v.StringSchema<undefined>;
45
45
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
46
- readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
46
+ readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
47
47
  }, undefined>, undefined>, {}>;
48
48
  }, undefined>;
49
- export type ManifestDataSource = v.InferOutput<typeof manifestDataSourceSchema>;
49
+ export type BridgeManifestDataSource = v.InferOutput<typeof bridgeManifestDataSourceSchema>;
50
50
  export declare const manifestSchema: v.ObjectSchema<{
51
51
  readonly version: v.LiteralSchema<1, undefined>;
52
52
  readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -69,7 +69,7 @@ export declare const manifestSchema: v.ObjectSchema<{
69
69
  readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
70
70
  readonly name: v.StringSchema<undefined>;
71
71
  readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
72
- readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
72
+ readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
73
73
  }, undefined>, undefined>, {}>;
74
74
  }, undefined>, undefined>, {}>;
75
75
  readonly pages: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
@@ -6,7 +6,7 @@ import { customBlockGrantSchema } from "./grants.js";
6
6
  * `emoji` / `external` icon variants the public Notion API uses, so the host
7
7
  * can render a recognizable affordance next to the slot in setup UI.
8
8
  */
9
- export const manifestIconSchema = v.variant("type", [
9
+ export const bridgeManifestIconSchema = v.variant("type", [
10
10
  v.object({
11
11
  type: v.literal("emoji"),
12
12
  emoji: v.string(),
@@ -16,7 +16,7 @@ export const manifestIconSchema = v.variant("type", [
16
16
  url: v.string(),
17
17
  }),
18
18
  ]);
19
- export const manifestPropertySchema = v.object({
19
+ export const bridgeManifestPropertySchema = v.object({
20
20
  name: v.string(),
21
21
  description: v.optional(v.string()),
22
22
  type: notionPropertyTypeSchema,
@@ -24,13 +24,13 @@ export const manifestPropertySchema = v.object({
24
24
  export const manifestPageSchema = v.object({
25
25
  name: v.string(),
26
26
  description: v.optional(v.string()),
27
- icon: v.optional(manifestIconSchema),
27
+ icon: v.optional(bridgeManifestIconSchema),
28
28
  });
29
- export const manifestDataSourceSchema = v.object({
29
+ export const bridgeManifestDataSourceSchema = v.object({
30
30
  name: v.string(),
31
31
  description: v.optional(v.string()),
32
- icon: v.optional(manifestIconSchema),
33
- properties: v.optional(v.record(v.string(), manifestPropertySchema), {}),
32
+ icon: v.optional(bridgeManifestIconSchema),
33
+ properties: v.optional(v.record(v.string(), bridgeManifestPropertySchema), {}),
34
34
  });
35
35
  export const manifestSchema = v.object({
36
36
  version: v.literal(1),
@@ -38,7 +38,7 @@ export const manifestSchema = v.object({
38
38
  description: v.optional(v.string()),
39
39
  slashCommand: v.optional(v.string()),
40
40
  icon: v.optional(v.object({ type: v.literal("emoji"), emoji: v.string() })),
41
- dataSources: v.optional(v.record(v.string(), manifestDataSourceSchema), {}),
41
+ dataSources: v.optional(v.record(v.string(), bridgeManifestDataSourceSchema), {}),
42
42
  pages: v.optional(v.record(v.string(), manifestPageSchema)),
43
43
  /**
44
44
  * Grants the block needs. Omitted means the block predates viewer