@notionhq/custom-blocks 0.0.73 → 0.0.75

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/HOST.md CHANGED
@@ -119,6 +119,8 @@ Types:
119
119
  - `NotionDataSourceBindings` — keyed-by-semantic-key map of bindings, the shape carried in `init.dataSources` and `dataSourcesChanged`.
120
120
  - `NotionDataSourcePageBridge` — wire shape for a single page (raw property IDs in `propertiesById`). The SDK derives the consumer-facing `NotionDataSourcePage` from it.
121
121
 
122
+ The host is authoritative for property bindings. The SDK validates each supplied property ID against the manifest and collection schema, but leaves omitted mappings unbound rather than inferring them from property IDs or names.
123
+
122
124
  Schemas:
123
125
 
124
126
  - `notionBlockIdSchema`
@@ -138,7 +140,7 @@ Messages sent from the sandbox to the host. Parse `window` `message` events with
138
140
  | -------------------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
139
141
  | `ready` | `ReadyMessage` / `readyMessageSchema` | One-shot handshake; carries `bridgeProtocolVersion`, `sdkVersion`, and the manifest. |
140
142
  | `queryDataSource` | `QueryDataSourceMessage` / `queryDataSourceMessageSchema` | `requestId`-keyed request for the current rows in a raw `dataSourceId`. `snapshotId` names the SDK result slot to update, so later refreshes for the same `useDataSource` call replace the same snapshot instead of creating a new one. |
141
- | `createPage` | `CreatePageMessage` / `createPageMessageSchema` | `requestId`-keyed page creation; parent is `page_id` or `data_source_id`. |
143
+ | `createPage` | `CreatePageMessage` / `createPageMessageSchema` | `requestId`-keyed page creation with properties and optional position; parent is `page_id` or `data_source_id`. Create-time icon and cover are not supported. |
142
144
  | `getPage` | `GetPageMessage` / `getPageMessageSchema` | `requestId`-keyed page fetch by page id. |
143
145
  | `updatePage` | `UpdatePageMessage` / `updatePageMessageSchema` | `requestId`-keyed patch (properties, icon, cover, or `archived`). |
144
146
  | `getUser` | `GetUserMessage` / `getUserMessageSchema` | `requestId`-keyed user fetch by user id. |
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/SandboxBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EACX,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAQxD,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAW3E;;;;GAIG;AAEH,eAAO,MAAM,oCAAoC,IAAI,CAAA;AAErD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,UAAU,CAAA;IAC9B,IAAI,EAAE,OAAO,CAAA;CACb,CAAA;AAED,qBAAa,aAAa;IACzB,OAAO,CAAC,SAAS,CAGhB;IACD,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,mBAAmB,CAAwB;IACnD,OAAO,CAAC,aAAa,CAAI;IACzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAEjC;IACD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE9B;IACD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE9B;IACD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CA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,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2C7D;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,gBAAgB,CAAA;QAC5B,MAAM,EAAE,YAAY,CAAA;QACpB,KAAK,EAAE,+BAA+B,CAAA;KACtC,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAuB7C;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAkE/B"}
1
+ {"version":3,"file":"SandboxBridge.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/SandboxBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EACX,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAQxD,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAW3E;;;;GAIG;AAEH,eAAO,MAAM,oCAAoC,IAAI,CAAA;AAErD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,UAAU,CAAA;IAC9B,IAAI,EAAE,OAAO,CAAA;CACb,CAAA;AAED,qBAAa,aAAa;IACzB,OAAO,CAAC,SAAS,CAGhB;IACD,OAAO,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AAM;IAazB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8B7D,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAYrD,SAAS,CAAC,KAAK,GAAE,cAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAa/D,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2C7D;;;;OAIG;IACH,oBAAoB,CAAC,IAAI,EAAE;QAC1B,UAAU,EAAE,gBAAgB,CAAA;QAC5B,MAAM,EAAE,YAAY,CAAA;QACpB,KAAK,EAAE,+BAA+B,CAAA;KACtC,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAuB7C;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CAkE/B"}
@@ -506,12 +506,6 @@ export class SandboxBridge {
506
506
  parent: resolvedParent.parent,
507
507
  properties: resolvedProperties.properties,
508
508
  };
509
- if (input.icon !== undefined) {
510
- outbound.icon = input.icon;
511
- }
512
- if (input.cover !== undefined) {
513
- outbound.cover = input.cover;
514
- }
515
509
  if (input.position !== undefined) {
516
510
  outbound.position = input.position;
517
511
  }
@@ -1,6 +1,5 @@
1
1
  import type { CustomBlockManifest } from "../manifest.js";
2
2
  import type { NotionDataSource, NotionDataSourceBindings } from "./dataSource.js";
3
- import type { NotionPropertySchema } from "./propertySchema.js";
4
3
  type ResolveDataSourcesArgs = {
5
4
  manifest: CustomBlockManifest | null;
6
5
  dataSourceBindings: NotionDataSourceBindings;
@@ -9,14 +8,10 @@ type ResolveDataSourcesArgs = {
9
8
  * Builds the public {@link NotionDataSource} list the SDK exposes to consumers.
10
9
  *
11
10
  * Combines the host-supplied bindings (collection pointers + schemas) with the
12
- * manifest's declared data-source keys. When the manifest names a property
13
- * that isn't in `propertyIdsByKey`, falls back to {@link findPropertyIdByManifestProperty}
14
- * so renames in Notion still resolve as long as the schema name matches.
11
+ * manifest's declared data-source keys. Property mappings are host-owned: the
12
+ * SDK validates the supplied property id against the manifest and live schema,
13
+ * but does not infer a missing mapping.
15
14
  */
16
15
  export declare function resolveDataSources(args: ResolveDataSourcesArgs): NotionDataSource[];
17
- export declare function findPropertyIdByManifestProperty(propertySchemasById: Record<string, NotionPropertySchema>, manifestProperty: {
18
- key: string;
19
- type: NotionPropertySchema["type"];
20
- }): string | undefined;
21
16
  export {};
22
17
  //# sourceMappingURL=resolve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/dataSources/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,KAAK,EACX,gBAAgB,EAChB,wBAAwB,EACxB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,KAAK,sBAAsB,GAAG;IAC7B,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACpC,kBAAkB,EAAE,wBAAwB,CAAA;CAC5C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,sBAAsB,GAC1B,gBAAgB,EAAE,CA+CpB;AAED,wBAAgB,gCAAgC,CAC/C,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACzD,gBAAgB,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAA;CAAE,GACnE,MAAM,GAAG,SAAS,CAoBpB"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/dataSources/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,KAAK,EACX,gBAAgB,EAChB,wBAAwB,EACxB,MAAM,iBAAiB,CAAA;AAExB,KAAK,sBAAsB,GAAG;IAC7B,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACpC,kBAAkB,EAAE,wBAAwB,CAAA;CAC5C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,sBAAsB,GAC1B,gBAAgB,EAAE,CAyCpB"}
@@ -2,9 +2,9 @@
2
2
  * Builds the public {@link NotionDataSource} list the SDK exposes to consumers.
3
3
  *
4
4
  * Combines the host-supplied bindings (collection pointers + schemas) with the
5
- * manifest's declared data-source keys. When the manifest names a property
6
- * that isn't in `propertyIdsByKey`, falls back to {@link findPropertyIdByManifestProperty}
7
- * so renames in Notion still resolve as long as the schema name matches.
5
+ * manifest's declared data-source keys. Property mappings are host-owned: the
6
+ * SDK validates the supplied property id against the manifest and live schema,
7
+ * but does not infer a missing mapping.
8
8
  */
9
9
  export function resolveDataSources(args) {
10
10
  if (args.manifest === null) {
@@ -23,12 +23,7 @@ export function resolveDataSources(args) {
23
23
  const propertyIdsByKey = {};
24
24
  const manifestProperties = Object.entries(manifestDataSource.properties ?? {});
25
25
  for (const [propertyKey, manifestProperty] of manifestProperties) {
26
- const propertyId = propertyKey in bindingPropertyIdsByKey
27
- ? bindingPropertyIdsByKey[propertyKey]
28
- : findPropertyIdByManifestProperty(propertySchemasById, {
29
- key: propertyKey,
30
- type: manifestProperty.type,
31
- });
26
+ const propertyId = bindingPropertyIdsByKey[propertyKey];
32
27
  const propertySchema = propertyId === undefined ? undefined : propertySchemasById[propertyId];
33
28
  propertyIdsByKey[propertyKey] =
34
29
  propertySchema?.type === manifestProperty.type
@@ -44,22 +39,3 @@ export function resolveDataSources(args) {
44
39
  };
45
40
  });
46
41
  }
47
- export function findPropertyIdByManifestProperty(propertySchemasById, manifestProperty) {
48
- // `ManifestProperty.name` is display copy for setup UI. Binding fallback is based
49
- // on the stable semantic key so copy changes don't affect property resolution.
50
- const propertySchemaForKey = propertySchemasById[manifestProperty.key];
51
- if (propertySchemaForKey?.type === manifestProperty.type) {
52
- return manifestProperty.key;
53
- }
54
- const normalizedKey = normalizePropertyName(manifestProperty.key);
55
- for (const [propertyId, propertySchema] of Object.entries(propertySchemasById)) {
56
- if (propertySchema.type === manifestProperty.type &&
57
- normalizePropertyName(propertySchema.name) === normalizedKey) {
58
- return propertyId;
59
- }
60
- }
61
- return undefined;
62
- }
63
- function normalizePropertyName(value) {
64
- return value.trim().toLowerCase();
65
- }
@@ -25,7 +25,8 @@ export declare function resolvePropertyWriteMapForDataSource(args: {
25
25
  operationName: string;
26
26
  }): PropertyWriteMapResolutionResult;
27
27
  /**
28
- * Treats matching data-source keys as aliases for property IDs; all other identifiers are raw IDs.
28
+ * Treats bound data-source keys as aliases for property IDs. An unbound key may still be used as
29
+ * a raw ID when it exactly matches a property in the data source schema.
29
30
  */
30
31
  export declare function resolvePropertyIdentifierForDataSource(args: {
31
32
  dataSource: NotionDataSource | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"resolveProperty.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/dataSources/resolveProperty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EACX,0BAA0B,EAC1B,0BAA0B,EAC1B,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAIvD,eAAO,MAAM,kCAAkC,2BAAa,CAAA;AAE5D,MAAM,MAAM,4BAA4B,GACrC,mBAAmB,GACnB,sBAAsB,GACtB,oBAAoB,GACpB,wBAAwB,GACxB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEhB,MAAM,MAAM,4BAA4B,GACvC,oBAAoB,CAAC,4BAA4B,CAAC,CAAA;AAEnD,MAAM,MAAM,gCAAgC,GACzC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,0BAA0B,CAAA;CAAE,GAC7D;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,CAAA;AAS3D;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,IAAI,EAAE;IAC1D,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,0BAA0B,CAAA;IACtC,aAAa,EAAE,MAAM,CAAA;CACrB,GAAG,gCAAgC,CAwDnC;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE;IAC5D,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACrB,GACE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,CAiB1D"}
1
+ {"version":3,"file":"resolveProperty.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/dataSources/resolveProperty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EACX,0BAA0B,EAC1B,0BAA0B,EAC1B,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAIvD,eAAO,MAAM,kCAAkC,2BAAa,CAAA;AAE5D,MAAM,MAAM,4BAA4B,GACrC,mBAAmB,GACnB,sBAAsB,GACtB,oBAAoB,GACpB,wBAAwB,GACxB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEhB,MAAM,MAAM,4BAA4B,GACvC,oBAAoB,CAAC,4BAA4B,CAAC,CAAA;AAEnD,MAAM,MAAM,gCAAgC,GACzC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,0BAA0B,CAAA;CAAE,GAC7D;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,CAAA;AAS3D;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,IAAI,EAAE;IAC1D,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,0BAA0B,CAAA;IACtC,aAAa,EAAE,MAAM,CAAA;CACrB,GAAG,gCAAgC,CAwDnC;AAED;;;GAGG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE;IAC5D,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACrB,GACE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,4BAA4B,CAAA;CAAE,CAsB1D"}
@@ -55,13 +55,19 @@ export function resolvePropertyWriteMapForDataSource(args) {
55
55
  return { status: "success", properties: resolvedProperties };
56
56
  }
57
57
  /**
58
- * Treats matching data-source keys as aliases for property IDs; all other identifiers are raw IDs.
58
+ * Treats bound data-source keys as aliases for property IDs. An unbound key may still be used as
59
+ * a raw ID when it exactly matches a property in the data source schema.
59
60
  */
60
61
  export function resolvePropertyIdentifierForDataSource(args) {
61
62
  const { dataSource, identifier, operationName } = args;
62
63
  if (dataSource !== undefined && identifier in dataSource.propertyIdsByKey) {
63
64
  const propertyId = dataSource.propertyIdsByKey[identifier];
64
65
  if (propertyId === undefined) {
66
+ // If the property is not bound to a key, check if it is a valid property ID. If so, we
67
+ // can use it directly.
68
+ if (identifier in dataSource.propertySchemasById) {
69
+ return { status: "success", propertyId: identifier };
70
+ }
65
71
  return {
66
72
  status: "error",
67
73
  error: makePropertyError("unmapped_property", `${operationName} cannot resolve property key "${identifier}" because it is not bound to a Notion property.`),
@@ -175,40 +175,6 @@ export declare const createPageMessageSchema: v.ObjectSchema<{
175
175
  }, undefined>, undefined>;
176
176
  readonly id: v.StringSchema<undefined>;
177
177
  }, undefined>], undefined>, undefined>;
178
- readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
179
- readonly type: v.LiteralSchema<"emoji", undefined>;
180
- readonly emoji: v.StringSchema<undefined>;
181
- }, undefined>, v.ObjectSchema<{
182
- readonly type: v.LiteralSchema<"custom_emoji", undefined>;
183
- readonly custom_emoji: v.ObjectSchema<{
184
- readonly id: v.StringSchema<undefined>;
185
- readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
186
- readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
187
- }, undefined>;
188
- }, undefined>, v.ObjectSchema<{
189
- readonly type: v.LiteralSchema<"external", undefined>;
190
- readonly external: v.ObjectSchema<{
191
- readonly url: v.StringSchema<undefined>;
192
- }, undefined>;
193
- }, undefined>, v.ObjectSchema<{
194
- readonly type: v.LiteralSchema<"file", undefined>;
195
- readonly file: v.ObjectSchema<{
196
- readonly url: v.StringSchema<undefined>;
197
- readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
198
- }, undefined>;
199
- }, undefined>], undefined>, undefined>;
200
- readonly cover: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
201
- readonly type: v.LiteralSchema<"external", undefined>;
202
- readonly external: v.ObjectSchema<{
203
- readonly url: v.StringSchema<undefined>;
204
- }, undefined>;
205
- }, undefined>, v.ObjectSchema<{
206
- readonly type: v.LiteralSchema<"file", undefined>;
207
- readonly file: v.ObjectSchema<{
208
- readonly url: v.StringSchema<undefined>;
209
- readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
210
- }, undefined>;
211
- }, undefined>], undefined>, undefined>;
212
178
  readonly position: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
213
179
  readonly type: v.LiteralSchema<"start", undefined>;
214
180
  }, undefined>, v.ObjectSchema<{
@@ -1 +1 @@
1
- {"version":3,"file":"createPage.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/createPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAY5B;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;0BAKzC,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CACnD,OAAO,8BAA8B,CACrC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;0BAMjC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,sBAAsB,CAC7B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAQlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
1
+ {"version":3,"file":"createPage.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/createPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAQ5B;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;0BAKzC,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CACnD,OAAO,8BAA8B,CACrC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;0BAMjC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,sBAAsB,CAC7B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAOlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
2
  import { notionBlockIdSchema, notionDataSourceIdSchema, notionPageIdSchema, } from "../ids.js";
3
- import { notionPageCoverSchema, notionPageIconSchema, notionPagePropertyWriteMapSchema, } from "../pages/page.js";
3
+ import { notionPagePropertyWriteMapSchema } from "../pages/page.js";
4
4
  /**
5
5
  * Describes where the newly created page should be inserted.
6
6
  * - `start` / `end` (default): prepend / append to the request's `parent`
@@ -40,7 +40,6 @@ export const createPageMessageSchema = v.object({
40
40
  requestId: v.string(),
41
41
  parent: createPageParentSchema,
42
42
  properties: notionPagePropertyWriteMapSchema,
43
- icon: v.optional(notionPageIconSchema),
44
- cover: v.optional(notionPageCoverSchema),
43
+ // TODO(custom-blocks): Add icon and cover once the Notion host supports them for page creation.
45
44
  position: v.optional(notionCreatePagePositionSchema),
46
45
  });
@@ -178,40 +178,6 @@ export declare const sandboxToHostMessageSchema: v.UnionSchema<[v.UnionSchema<[v
178
178
  }, undefined>, undefined>;
179
179
  readonly id: v.StringSchema<undefined>;
180
180
  }, undefined>], undefined>, undefined>;
181
- readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
182
- readonly type: v.LiteralSchema<"emoji", undefined>;
183
- readonly emoji: v.StringSchema<undefined>;
184
- }, undefined>, v.ObjectSchema<{
185
- readonly type: v.LiteralSchema<"custom_emoji", undefined>;
186
- readonly custom_emoji: v.ObjectSchema<{
187
- readonly id: v.StringSchema<undefined>;
188
- readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
189
- readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
190
- }, undefined>;
191
- }, undefined>, v.ObjectSchema<{
192
- readonly type: v.LiteralSchema<"external", undefined>;
193
- readonly external: v.ObjectSchema<{
194
- readonly url: v.StringSchema<undefined>;
195
- }, undefined>;
196
- }, undefined>, v.ObjectSchema<{
197
- readonly type: v.LiteralSchema<"file", undefined>;
198
- readonly file: v.ObjectSchema<{
199
- readonly url: v.StringSchema<undefined>;
200
- readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
201
- }, undefined>;
202
- }, undefined>], undefined>, undefined>;
203
- readonly cover: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
204
- readonly type: v.LiteralSchema<"external", undefined>;
205
- readonly external: v.ObjectSchema<{
206
- readonly url: v.StringSchema<undefined>;
207
- }, undefined>;
208
- }, undefined>, v.ObjectSchema<{
209
- readonly type: v.LiteralSchema<"file", undefined>;
210
- readonly file: v.ObjectSchema<{
211
- readonly url: v.StringSchema<undefined>;
212
- readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
213
- }, undefined>;
214
- }, undefined>], undefined>, undefined>;
215
181
  readonly position: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
216
182
  readonly type: v.LiteralSchema<"start", undefined>;
217
183
  }, undefined>, v.ObjectSchema<{
@@ -1 +1 @@
1
- {"version":3,"file":"sandboxToHost.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/sandboxToHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAW5B;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAUrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
1
+ {"version":3,"file":"sandboxToHost.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/bridge/messages/sandboxToHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAW5B;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAUrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
package/dist/types.d.ts CHANGED
@@ -91,8 +91,6 @@ export type CreatePageParent = {
91
91
  export type CreatePageInput = {
92
92
  parent: CreatePageParent;
93
93
  properties: NotionPagePropertyInputMap;
94
- icon?: NotionPageIcon;
95
- cover?: NotionPageCover;
96
94
  position?: NotionCreatePagePosition;
97
95
  };
98
96
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,KAAK,EACX,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAA;AAC3F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAC/E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAC/E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAA;AACnF,OAAO,KAAK,EAAE,mC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B,GACzB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACf,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,8BAA8B,CAAA;CAAE,CAAA;AAE7D,MAAM,MAAM,cAAc,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,eAAe,GACxB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,cAAc,CAAA;CACnB,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,6BAA6B,CAAA;CAAE,CAAA;AAE5D,MAAM,MAAM,aAAa,GACtB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACf,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,2BAA2B,CAAA;CAAE,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,KAAK,EACX,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAA;AAC3F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAC/E,OA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E,2BAA2B,CAAA;CAAE,CAAA;AAE1D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACzB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACf,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,8BAA8B,CAAA;CAAE,CAAA;AAE7D,MAAM,MAAM,cAAc,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,eAAe,GACxB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,cAAc,CAAA;CACnB,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,6BAA6B,CAAA;CAAE,CAAA;AAE5D,MAAM,MAAM,aAAa,GACtB;IACA,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,UAAU,CAAA;CACf,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,2BAA2B,CAAA;CAAE,CAAA"}
package/dist/version.js CHANGED
@@ -4,4 +4,4 @@
4
4
  *
5
5
  * WARNING: Generated during SDK publish. Do not edit in the published package.
6
6
  */
7
- export const CUSTOM_BLOCKS_SDK_VERSION = "0.0.73"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.0.75"
package/docs/pages.md CHANGED
@@ -10,7 +10,7 @@ Every helper follows the SDK's [error-handling contract](./errors.md). Check `re
10
10
 
11
11
  ## Creating pages
12
12
 
13
- `pages.create` mirrors Notion's [`POST /v1/pages`](https://developers.notion.com/reference/post-page). Pass a parent, a property map, and optionally an `icon` or `cover`:
13
+ `pages.create` accepts a parent, a property map, and an optional position. Setting an icon or cover at creation time is not supported yet; create the page first, then use `pages.update`.
14
14
 
15
15
  ```ts
16
16
  const result = await pages.create({
@@ -22,7 +22,6 @@ const result = await pages.create({
22
22
  },
23
23
  dueDate: { type: "date", date: { start: "2026-06-01" } },
24
24
  },
25
- icon: { type: "emoji", emoji: "📝" },
26
25
  });
27
26
 
28
27
  if (result.status === "success") {
@@ -118,7 +117,9 @@ To restore a page, call `pages.update({ pageId, archived: false })`.
118
117
 
119
118
  ## Icons, covers, and file uploads
120
119
 
121
- File-upload references aren't enabled for custom blocks yet. For icons, covers, and file properties, use one of:
120
+ `pages.update` can set icons and covers, and returned `NotionPage` objects can contain both fields. `pages.create` cannot set them yet.
121
+
122
+ File-upload references aren't enabled for custom blocks yet. When updating icons or covers, use one of:
122
123
 
123
124
  - An emoji icon — `{ type: "emoji", emoji: "🟢" }`
124
125
  - An external URL — `{ type: "external", external: { url: "https://example.com/cover.png" } }`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks",
3
- "version": "0.0.73",
3
+ "version": "0.0.75",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -660,12 +660,6 @@ export class SandboxBridge {
660
660
  parent: resolvedParent.parent,
661
661
  properties: resolvedProperties.properties,
662
662
  }
663
- if (input.icon !== undefined) {
664
- outbound.icon = input.icon
665
- }
666
- if (input.cover !== undefined) {
667
- outbound.cover = input.cover
668
- }
669
663
  if (input.position !== undefined) {
670
664
  outbound.position = input.position
671
665
  }
@@ -3,7 +3,6 @@ import type {
3
3
  NotionDataSource,
4
4
  NotionDataSourceBindings,
5
5
  } from "./dataSource.js"
6
- import type { NotionPropertySchema } from "./propertySchema.js"
7
6
 
8
7
  type ResolveDataSourcesArgs = {
9
8
  manifest: CustomBlockManifest | null
@@ -14,9 +13,9 @@ type ResolveDataSourcesArgs = {
14
13
  * Builds the public {@link NotionDataSource} list the SDK exposes to consumers.
15
14
  *
16
15
  * Combines the host-supplied bindings (collection pointers + schemas) with the
17
- * manifest's declared data-source keys. When the manifest names a property
18
- * that isn't in `propertyIdsByKey`, falls back to {@link findPropertyIdByManifestProperty}
19
- * so renames in Notion still resolve as long as the schema name matches.
16
+ * manifest's declared data-source keys. Property mappings are host-owned: the
17
+ * SDK validates the supplied property id against the manifest and live schema,
18
+ * but does not infer a missing mapping.
20
19
  */
21
20
  export function resolveDataSources(
22
21
  args: ResolveDataSourcesArgs,
@@ -43,13 +42,7 @@ export function resolveDataSources(
43
42
  manifestDataSource.properties ?? {},
44
43
  )
45
44
  for (const [propertyKey, manifestProperty] of manifestProperties) {
46
- const propertyId =
47
- propertyKey in bindingPropertyIdsByKey
48
- ? bindingPropertyIdsByKey[propertyKey]
49
- : findPropertyIdByManifestProperty(propertySchemasById, {
50
- key: propertyKey,
51
- type: manifestProperty.type,
52
- })
45
+ const propertyId = bindingPropertyIdsByKey[propertyKey]
53
46
  const propertySchema =
54
47
  propertyId === undefined ? undefined : propertySchemasById[propertyId]
55
48
  propertyIdsByKey[propertyKey] =
@@ -68,32 +61,3 @@ export function resolveDataSources(
68
61
  },
69
62
  )
70
63
  }
71
-
72
- export function findPropertyIdByManifestProperty(
73
- propertySchemasById: Record<string, NotionPropertySchema>,
74
- manifestProperty: { key: string; type: NotionPropertySchema["type"] },
75
- ): string | undefined {
76
- // `ManifestProperty.name` is display copy for setup UI. Binding fallback is based
77
- // on the stable semantic key so copy changes don't affect property resolution.
78
- const propertySchemaForKey = propertySchemasById[manifestProperty.key]
79
- if (propertySchemaForKey?.type === manifestProperty.type) {
80
- return manifestProperty.key
81
- }
82
-
83
- const normalizedKey = normalizePropertyName(manifestProperty.key)
84
- for (const [propertyId, propertySchema] of Object.entries(
85
- propertySchemasById,
86
- )) {
87
- if (
88
- propertySchema.type === manifestProperty.type &&
89
- normalizePropertyName(propertySchema.name) === normalizedKey
90
- ) {
91
- return propertyId
92
- }
93
- }
94
- return undefined
95
- }
96
-
97
- function normalizePropertyName(value: string): string {
98
- return value.trim().toLowerCase()
99
- }
@@ -102,7 +102,8 @@ export function resolvePropertyWriteMapForDataSource(args: {
102
102
  }
103
103
 
104
104
  /**
105
- * Treats matching data-source keys as aliases for property IDs; all other identifiers are raw IDs.
105
+ * Treats bound data-source keys as aliases for property IDs. An unbound key may still be used as
106
+ * a raw ID when it exactly matches a property in the data source schema.
106
107
  */
107
108
  export function resolvePropertyIdentifierForDataSource(args: {
108
109
  dataSource: NotionDataSource | undefined
@@ -115,6 +116,11 @@ export function resolvePropertyIdentifierForDataSource(args: {
115
116
  if (dataSource !== undefined && identifier in dataSource.propertyIdsByKey) {
116
117
  const propertyId = dataSource.propertyIdsByKey[identifier]
117
118
  if (propertyId === undefined) {
119
+ // If the property is not bound to a key, check if it is a valid property ID. If so, we
120
+ // can use it directly.
121
+ if (identifier in dataSource.propertySchemasById) {
122
+ return { status: "success", propertyId: identifier }
123
+ }
118
124
  return {
119
125
  status: "error",
120
126
  error: makePropertyError(
@@ -4,11 +4,7 @@ import {
4
4
  notionDataSourceIdSchema,
5
5
  notionPageIdSchema,
6
6
  } from "../ids.js"
7
- import {
8
- notionPageCoverSchema,
9
- notionPageIconSchema,
10
- notionPagePropertyWriteMapSchema,
11
- } from "../pages/page.js"
7
+ import { notionPagePropertyWriteMapSchema } from "../pages/page.js"
12
8
 
13
9
  /**
14
10
  * Describes where the newly created page should be inserted.
@@ -59,8 +55,7 @@ export const createPageMessageSchema = v.object({
59
55
  requestId: v.string(),
60
56
  parent: createPageParentSchema,
61
57
  properties: notionPagePropertyWriteMapSchema,
62
- icon: v.optional(notionPageIconSchema),
63
- cover: v.optional(notionPageCoverSchema),
58
+ // TODO(custom-blocks): Add icon and cover once the Notion host supports them for page creation.
64
59
  position: v.optional(notionCreatePagePositionSchema),
65
60
  })
66
61
 
package/src/types.ts CHANGED
@@ -109,8 +109,7 @@ export type CreatePageParent =
109
109
  export type CreatePageInput = {
110
110
  parent: CreatePageParent
111
111
  properties: NotionPagePropertyInputMap
112
- icon?: NotionPageIcon
113
- cover?: NotionPageCover
112
+ // TODO(custom-blocks): Add icon and cover once the Notion host supports them for page creation.
114
113
  position?: NotionCreatePagePosition
115
114
  }
116
115