@notionhq/custom-blocks-dev-shell 0.3.0 → 0.3.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.
- package/dist/assets/index-Jy9OWV_k.js +12 -0
- package/dist/index.html +1 -1
- package/dist-cli/cli/published-cli.js +200 -181
- package/docs/bridge/changelog.md +43 -19
- package/docs/bridge/protocol.md +7 -7
- package/docs/host/docs/compatibility.md +11 -1
- package/docs/host/docs/host-contract.md +2 -2
- package/package.json +1 -1
- package/dist/assets/index-CWJ-vFk0.js +0 -12
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-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-Jy9OWV_k.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-Do-x8yIt.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -1286,11 +1286,6 @@ var bridgePagePropertyValueSchema = variant("type", [
|
|
|
1286
1286
|
type: literal("formula"),
|
|
1287
1287
|
formula: string()
|
|
1288
1288
|
}),
|
|
1289
|
-
object({
|
|
1290
|
-
...pagePropertyBaseSchema,
|
|
1291
|
-
type: literal("location"),
|
|
1292
|
-
location: string()
|
|
1293
|
-
}),
|
|
1294
1289
|
object({
|
|
1295
1290
|
...pagePropertyBaseSchema,
|
|
1296
1291
|
type: literal("rollup"),
|
|
@@ -1351,68 +1346,8 @@ var notionDataSourcePageForProtocol3To5Schema = object({
|
|
|
1351
1346
|
propertiesById: record(string(), optional(notionDataSourceValueSchema))
|
|
1352
1347
|
});
|
|
1353
1348
|
|
|
1354
|
-
// ../protocol/src/
|
|
1355
|
-
var
|
|
1356
|
-
/** The viewer cannot access the containing page; its ID and parent are not exposed. */
|
|
1357
|
-
object({ type: literal("unavailable") }),
|
|
1358
|
-
/** The viewer can access the containing page; includes its ID and parent location. */
|
|
1359
|
-
object({
|
|
1360
|
-
type: literal("page"),
|
|
1361
|
-
id: notionPageIdSchema,
|
|
1362
|
-
/**
|
|
1363
|
-
* The containing page's own parent. It lets a block distinguish a freestanding page from a
|
|
1364
|
-
* database row without a round trip. Not to be confused with the top-level `parent` runtime
|
|
1365
|
-
* value, which is the custom block's own parent.
|
|
1366
|
-
*/
|
|
1367
|
-
parent: notionParentSchema
|
|
1368
|
-
})
|
|
1369
|
-
]);
|
|
1370
|
-
|
|
1371
|
-
// ../protocol/src/context/contrast.ts
|
|
1372
|
-
var notionContrastModeSchema = picklist(["standard", "high"]);
|
|
1373
|
-
|
|
1374
|
-
// ../protocol/src/context/messages/contrastModeChanged.ts
|
|
1375
|
-
var contrastModeChangedMessageSchema = object({
|
|
1376
|
-
type: literal("contrastModeChanged"),
|
|
1377
|
-
contrastMode: notionContrastModeSchema
|
|
1378
|
-
});
|
|
1379
|
-
|
|
1380
|
-
// ../protocol/src/context/messages/pageChanged.ts
|
|
1381
|
-
var pageChangedMessageSchema = object({
|
|
1382
|
-
type: literal("pageChanged"),
|
|
1383
|
-
page: customBlockPageSchema
|
|
1384
|
-
});
|
|
1385
|
-
|
|
1386
|
-
// ../protocol/src/context/messages/parentChanged.ts
|
|
1387
|
-
var parentChangedMessageSchema = object({
|
|
1388
|
-
type: literal("parentChanged"),
|
|
1389
|
-
parent: notionParentSchema
|
|
1390
|
-
});
|
|
1391
|
-
|
|
1392
|
-
// ../protocol/src/context/messages/resize.ts
|
|
1393
|
-
var resizeMessageSchema = object({
|
|
1394
|
-
type: literal("resize"),
|
|
1395
|
-
height: pipe(number(), finite(), minValue(0))
|
|
1396
|
-
});
|
|
1397
|
-
|
|
1398
|
-
// ../protocol/src/context/theme.ts
|
|
1399
|
-
var notionThemeSchema = picklist(["light", "dark"]);
|
|
1400
|
-
|
|
1401
|
-
// ../protocol/src/context/messages/themeChanged.ts
|
|
1402
|
-
var themeChangedMessageSchema = object({
|
|
1403
|
-
type: literal("themeChanged"),
|
|
1404
|
-
theme: notionThemeSchema
|
|
1405
|
-
});
|
|
1406
|
-
|
|
1407
|
-
// ../protocol/src/dataSources/bridgeArchiveStatus.ts
|
|
1408
|
-
var bridgeArchiveStatusSchema = picklist([
|
|
1409
|
-
"active",
|
|
1410
|
-
"archived",
|
|
1411
|
-
"all"
|
|
1412
|
-
]);
|
|
1413
|
-
|
|
1414
|
-
// ../protocol/src/dataSources/collectionPointer.ts
|
|
1415
|
-
var collectionPointerValidator = object({
|
|
1349
|
+
// ../protocol/src/dataSources/dataSourcePointer.ts
|
|
1350
|
+
var dataSourcePointerValidator = object({
|
|
1416
1351
|
id: notionDataSourceIdSchema,
|
|
1417
1352
|
table: string(),
|
|
1418
1353
|
spaceId: optional(notionSpaceIdSchema)
|
|
@@ -1482,7 +1417,6 @@ var NOTION_PROPERTY_TYPES = [
|
|
|
1482
1417
|
"rollup",
|
|
1483
1418
|
"button",
|
|
1484
1419
|
"verification",
|
|
1485
|
-
"location",
|
|
1486
1420
|
"created_time",
|
|
1487
1421
|
"last_edited_time",
|
|
1488
1422
|
"created_by",
|
|
@@ -1529,7 +1463,6 @@ var notionPropertySchemaSchema = variant("type", [
|
|
|
1529
1463
|
// Internal-only types passed through under their bridge-native names.
|
|
1530
1464
|
object({ ...baseProp.entries, type: literal("button") }),
|
|
1531
1465
|
object({ ...baseProp.entries, type: literal("verification") }),
|
|
1532
|
-
object({ ...baseProp.entries, type: literal("location") }),
|
|
1533
1466
|
// Synthetic built-ins. The host always emits one of each per data source.
|
|
1534
1467
|
object({ ...baseProp.entries, type: literal("created_time") }),
|
|
1535
1468
|
object({ ...baseProp.entries, type: literal("last_edited_time") }),
|
|
@@ -1537,8 +1470,8 @@ var notionPropertySchemaSchema = variant("type", [
|
|
|
1537
1470
|
object({ ...baseProp.entries, type: literal("last_edited_by") })
|
|
1538
1471
|
]);
|
|
1539
1472
|
|
|
1540
|
-
// ../protocol/src/dataSources/
|
|
1541
|
-
var
|
|
1473
|
+
// ../protocol/src/dataSources/dataSourceSchema.ts
|
|
1474
|
+
var notionDataSourceSchemaValidator = object({
|
|
1542
1475
|
id: optional(notionDataSourceIdSchema),
|
|
1543
1476
|
/**
|
|
1544
1477
|
* Describes actual database properties in protocol 5. Protocol 3/4 payloads can also include
|
|
@@ -1548,15 +1481,38 @@ var notionCollectionSchemaValidator = object({
|
|
|
1548
1481
|
propertiesById: record(string(), notionPropertySchemaSchema)
|
|
1549
1482
|
});
|
|
1550
1483
|
|
|
1484
|
+
// ../protocol/src/context/containingPage.ts
|
|
1485
|
+
var customBlockPageSchema = variant("type", [
|
|
1486
|
+
/** The viewer cannot access the containing page; its ID and parent are not exposed. */
|
|
1487
|
+
object({ type: literal("unavailable") }),
|
|
1488
|
+
/** The viewer can access the containing page; includes its ID and parent location. */
|
|
1489
|
+
object({
|
|
1490
|
+
type: literal("page"),
|
|
1491
|
+
id: notionPageIdSchema,
|
|
1492
|
+
/**
|
|
1493
|
+
* The containing page's own parent. It lets a block distinguish a freestanding page from a
|
|
1494
|
+
* database row without a round trip. Not to be confused with the top-level `parent` runtime
|
|
1495
|
+
* value, which is the custom block's own parent.
|
|
1496
|
+
*/
|
|
1497
|
+
parent: notionParentSchema
|
|
1498
|
+
})
|
|
1499
|
+
]);
|
|
1500
|
+
|
|
1501
|
+
// ../protocol/src/context/contrast.ts
|
|
1502
|
+
var notionContrastModeSchema = picklist(["standard", "high"]);
|
|
1503
|
+
|
|
1504
|
+
// ../protocol/src/context/theme.ts
|
|
1505
|
+
var notionThemeSchema = picklist(["light", "dark"]);
|
|
1506
|
+
|
|
1551
1507
|
// ../protocol/src/dataSources/bridgeDataSourceBinding.ts
|
|
1552
1508
|
var bridgeDataSourceBindingSchema = object({
|
|
1553
|
-
|
|
1509
|
+
dataSourcePointer: optional(dataSourcePointerValidator),
|
|
1554
1510
|
/**
|
|
1555
1511
|
* Describes database properties. Use this schema to resolve property bindings. Use this
|
|
1556
1512
|
* schema to validate filter and sort references. Undefined when the host does not provide a
|
|
1557
1513
|
* database schema.
|
|
1558
1514
|
*/
|
|
1559
|
-
|
|
1515
|
+
dataSourceSchema: optional(notionDataSourceSchemaValidator),
|
|
1560
1516
|
/**
|
|
1561
1517
|
* Maps user-defined property keys to database property IDs. Use this map to resolve a key
|
|
1562
1518
|
* such as `name` to its database property ID. A value of `undefined` marks a declared
|
|
@@ -1566,7 +1522,7 @@ var bridgeDataSourceBindingSchema = object({
|
|
|
1566
1522
|
propertyIdsByKey: optional(record(string(), optional(string()))),
|
|
1567
1523
|
/**
|
|
1568
1524
|
* `true` when the data source is bound but the viewer can't read it. The host omits
|
|
1569
|
-
* `
|
|
1525
|
+
* `dataSourcePointer`, `dataSourceSchema`, and `propertyIdsByKey`, so the binding reveals
|
|
1570
1526
|
* nothing about the data source. The block still initializes.
|
|
1571
1527
|
*/
|
|
1572
1528
|
inaccessible: optional(literal(true))
|
|
@@ -1578,6 +1534,172 @@ var bridgeDataSourceBindingsSchema = record(
|
|
|
1578
1534
|
bridgeDataSourceBindingSchema
|
|
1579
1535
|
);
|
|
1580
1536
|
|
|
1537
|
+
// ../protocol/src/manifest/grants.ts
|
|
1538
|
+
var customBlockGrantSchema = object({
|
|
1539
|
+
action: string(),
|
|
1540
|
+
resource: union([string(), pipe(array(string()), minLength(1))])
|
|
1541
|
+
});
|
|
1542
|
+
|
|
1543
|
+
// ../protocol/src/manifest/manifest.ts
|
|
1544
|
+
var bridgeManifestIconSchema = variant("type", [
|
|
1545
|
+
object({
|
|
1546
|
+
type: literal("emoji"),
|
|
1547
|
+
emoji: string()
|
|
1548
|
+
}),
|
|
1549
|
+
object({
|
|
1550
|
+
type: literal("external"),
|
|
1551
|
+
url: string()
|
|
1552
|
+
})
|
|
1553
|
+
]);
|
|
1554
|
+
var bridgeManifestPropertySchema = object({
|
|
1555
|
+
name: string(),
|
|
1556
|
+
description: optional(string()),
|
|
1557
|
+
type: notionPropertyTypeSchema
|
|
1558
|
+
});
|
|
1559
|
+
var manifestPageSchema = object({
|
|
1560
|
+
name: string(),
|
|
1561
|
+
description: optional(string()),
|
|
1562
|
+
icon: optional(bridgeManifestIconSchema)
|
|
1563
|
+
});
|
|
1564
|
+
var bridgeManifestDataSourceSchema = object({
|
|
1565
|
+
name: string(),
|
|
1566
|
+
description: optional(string()),
|
|
1567
|
+
icon: optional(bridgeManifestIconSchema),
|
|
1568
|
+
properties: optional(
|
|
1569
|
+
record(string(), bridgeManifestPropertySchema),
|
|
1570
|
+
{}
|
|
1571
|
+
)
|
|
1572
|
+
});
|
|
1573
|
+
var manifestSchema = object({
|
|
1574
|
+
version: literal(1),
|
|
1575
|
+
name: optional(string()),
|
|
1576
|
+
description: optional(string()),
|
|
1577
|
+
slashCommand: optional(string()),
|
|
1578
|
+
icon: optional(object({ type: literal("emoji"), emoji: string() })),
|
|
1579
|
+
dataSources: optional(
|
|
1580
|
+
record(string(), bridgeManifestDataSourceSchema),
|
|
1581
|
+
{}
|
|
1582
|
+
),
|
|
1583
|
+
pages: optional(record(string(), manifestPageSchema)),
|
|
1584
|
+
/**
|
|
1585
|
+
* Grants the block needs. Omitted means the block predates viewer
|
|
1586
|
+
* approval, so hosts do not ask the viewer. An empty array declares
|
|
1587
|
+
* nothing.
|
|
1588
|
+
*/
|
|
1589
|
+
grants: optional(array(customBlockGrantSchema))
|
|
1590
|
+
});
|
|
1591
|
+
|
|
1592
|
+
// ../protocol/src/users/userId.ts
|
|
1593
|
+
var notionUserIdSchema = pipe(string(), brand("NotionUserId"));
|
|
1594
|
+
|
|
1595
|
+
// ../protocol/src/users/bridgeUser.ts
|
|
1596
|
+
var bridgeUserSchema = object({
|
|
1597
|
+
object: literal("user"),
|
|
1598
|
+
id: notionUserIdSchema,
|
|
1599
|
+
name: optional(string()),
|
|
1600
|
+
avatar_url: nullable(string()),
|
|
1601
|
+
type: literal("person"),
|
|
1602
|
+
person: object({
|
|
1603
|
+
email: string()
|
|
1604
|
+
})
|
|
1605
|
+
});
|
|
1606
|
+
|
|
1607
|
+
// ../protocol/src/handshake/init.ts
|
|
1608
|
+
var customBlockInitErrorCodeSchema = string();
|
|
1609
|
+
var customBlockInitErrorInfoSchema = object({
|
|
1610
|
+
code: customBlockInitErrorCodeSchema,
|
|
1611
|
+
message: string(),
|
|
1612
|
+
isRetryable: boolean()
|
|
1613
|
+
});
|
|
1614
|
+
var initMessageSchema = variant("status", [
|
|
1615
|
+
object({
|
|
1616
|
+
type: literal("init"),
|
|
1617
|
+
initializationId: string(),
|
|
1618
|
+
status: literal("success"),
|
|
1619
|
+
theme: notionThemeSchema,
|
|
1620
|
+
contrastMode: notionContrastModeSchema,
|
|
1621
|
+
blockId: notionBlockIdSchema,
|
|
1622
|
+
parent: notionParentSchema,
|
|
1623
|
+
page: customBlockPageSchema,
|
|
1624
|
+
manifest: manifestSchema,
|
|
1625
|
+
dataSources: object({
|
|
1626
|
+
bindings: bridgeDataSourceBindingsSchema
|
|
1627
|
+
}),
|
|
1628
|
+
currentUser: bridgeUserSchema
|
|
1629
|
+
}),
|
|
1630
|
+
object({
|
|
1631
|
+
type: literal("init"),
|
|
1632
|
+
initializationId: string(),
|
|
1633
|
+
status: literal("error"),
|
|
1634
|
+
error: customBlockInitErrorInfoSchema
|
|
1635
|
+
})
|
|
1636
|
+
]);
|
|
1637
|
+
|
|
1638
|
+
// ../protocol/src/compatibility/protocol3To10/dataSourceBindings.ts
|
|
1639
|
+
var bridgeDataSourceBindingsForProtocol3To10Schema = record(
|
|
1640
|
+
string(),
|
|
1641
|
+
object({
|
|
1642
|
+
collectionPointer: optional(dataSourcePointerValidator),
|
|
1643
|
+
collectionSchema: optional(notionDataSourceSchemaValidator),
|
|
1644
|
+
propertyIdsByKey: optional(record(string(), optional(string()))),
|
|
1645
|
+
inaccessible: optional(literal(true))
|
|
1646
|
+
})
|
|
1647
|
+
);
|
|
1648
|
+
var dataSourceBindingsMessageForProtocol3To10Schema = variant(
|
|
1649
|
+
"type",
|
|
1650
|
+
[
|
|
1651
|
+
object({
|
|
1652
|
+
...initMessageSchema.options[0].entries,
|
|
1653
|
+
dataSources: object({
|
|
1654
|
+
bindings: bridgeDataSourceBindingsForProtocol3To10Schema
|
|
1655
|
+
})
|
|
1656
|
+
}),
|
|
1657
|
+
object({
|
|
1658
|
+
type: literal("dataSourcesChanged"),
|
|
1659
|
+
dataSources: object({
|
|
1660
|
+
bindings: bridgeDataSourceBindingsForProtocol3To10Schema
|
|
1661
|
+
})
|
|
1662
|
+
})
|
|
1663
|
+
]
|
|
1664
|
+
);
|
|
1665
|
+
|
|
1666
|
+
// ../protocol/src/context/messages/contrastModeChanged.ts
|
|
1667
|
+
var contrastModeChangedMessageSchema = object({
|
|
1668
|
+
type: literal("contrastModeChanged"),
|
|
1669
|
+
contrastMode: notionContrastModeSchema
|
|
1670
|
+
});
|
|
1671
|
+
|
|
1672
|
+
// ../protocol/src/context/messages/pageChanged.ts
|
|
1673
|
+
var pageChangedMessageSchema = object({
|
|
1674
|
+
type: literal("pageChanged"),
|
|
1675
|
+
page: customBlockPageSchema
|
|
1676
|
+
});
|
|
1677
|
+
|
|
1678
|
+
// ../protocol/src/context/messages/parentChanged.ts
|
|
1679
|
+
var parentChangedMessageSchema = object({
|
|
1680
|
+
type: literal("parentChanged"),
|
|
1681
|
+
parent: notionParentSchema
|
|
1682
|
+
});
|
|
1683
|
+
|
|
1684
|
+
// ../protocol/src/context/messages/resize.ts
|
|
1685
|
+
var resizeMessageSchema = object({
|
|
1686
|
+
type: literal("resize"),
|
|
1687
|
+
height: pipe(number(), finite(), minValue(0))
|
|
1688
|
+
});
|
|
1689
|
+
|
|
1690
|
+
// ../protocol/src/context/messages/themeChanged.ts
|
|
1691
|
+
var themeChangedMessageSchema = object({
|
|
1692
|
+
type: literal("themeChanged"),
|
|
1693
|
+
theme: notionThemeSchema
|
|
1694
|
+
});
|
|
1695
|
+
|
|
1696
|
+
// ../protocol/src/dataSources/bridgeArchiveStatus.ts
|
|
1697
|
+
var bridgeArchiveStatusSchema = picklist([
|
|
1698
|
+
"active",
|
|
1699
|
+
"archived",
|
|
1700
|
+
"all"
|
|
1701
|
+
]);
|
|
1702
|
+
|
|
1581
1703
|
// ../protocol/src/dataSources/errors.ts
|
|
1582
1704
|
var customBlockDataSourceResolutionErrorCodeSchema = string();
|
|
1583
1705
|
var customBlockPropertyErrorCodeSchema = string();
|
|
@@ -1954,13 +2076,13 @@ var unsubscribeDataSourceQueryMessageSchema = object({
|
|
|
1954
2076
|
// ../protocol/src/dataSources/notionDataSource.ts
|
|
1955
2077
|
var notionDataSourceSchema = object({
|
|
1956
2078
|
key: string(),
|
|
1957
|
-
|
|
2079
|
+
dataSourcePointer: optional(dataSourcePointerValidator),
|
|
1958
2080
|
/**
|
|
1959
2081
|
* Describes database properties. Use this schema to resolve property bindings. Use this
|
|
1960
2082
|
* schema to validate filter and sort references. Undefined when the host does not provide a
|
|
1961
2083
|
* database schema.
|
|
1962
2084
|
*/
|
|
1963
|
-
|
|
2085
|
+
dataSourceSchema: optional(notionDataSourceSchemaValidator),
|
|
1964
2086
|
/**
|
|
1965
2087
|
* Maps user-defined property keys to database property IDs. Use this map to resolve a key
|
|
1966
2088
|
* such as `name` to its database property ID. A value of `undefined` marks a declared
|
|
@@ -1976,7 +2098,7 @@ var notionDataSourceSchema = object({
|
|
|
1976
2098
|
* database properties when the host provides their schema.
|
|
1977
2099
|
*
|
|
1978
2100
|
* Use `propertiesById` to read a value. Use this map to read the value's schema. Use
|
|
1979
|
-
* `
|
|
2101
|
+
* `dataSourceSchema` to validate filter and sort references.
|
|
1980
2102
|
*/
|
|
1981
2103
|
propertySchemasById: record(string(), notionPropertySchemaSchema),
|
|
1982
2104
|
/**
|
|
@@ -1987,61 +2109,6 @@ var notionDataSourceSchema = object({
|
|
|
1987
2109
|
inaccessible: optional(literal(true))
|
|
1988
2110
|
});
|
|
1989
2111
|
|
|
1990
|
-
// ../protocol/src/manifest/grants.ts
|
|
1991
|
-
var customBlockGrantSchema = object({
|
|
1992
|
-
action: string(),
|
|
1993
|
-
resource: union([string(), pipe(array(string()), minLength(1))])
|
|
1994
|
-
});
|
|
1995
|
-
|
|
1996
|
-
// ../protocol/src/manifest/manifest.ts
|
|
1997
|
-
var bridgeManifestIconSchema = variant("type", [
|
|
1998
|
-
object({
|
|
1999
|
-
type: literal("emoji"),
|
|
2000
|
-
emoji: string()
|
|
2001
|
-
}),
|
|
2002
|
-
object({
|
|
2003
|
-
type: literal("external"),
|
|
2004
|
-
url: string()
|
|
2005
|
-
})
|
|
2006
|
-
]);
|
|
2007
|
-
var bridgeManifestPropertySchema = object({
|
|
2008
|
-
name: string(),
|
|
2009
|
-
description: optional(string()),
|
|
2010
|
-
type: notionPropertyTypeSchema
|
|
2011
|
-
});
|
|
2012
|
-
var manifestPageSchema = object({
|
|
2013
|
-
name: string(),
|
|
2014
|
-
description: optional(string()),
|
|
2015
|
-
icon: optional(bridgeManifestIconSchema)
|
|
2016
|
-
});
|
|
2017
|
-
var bridgeManifestDataSourceSchema = object({
|
|
2018
|
-
name: string(),
|
|
2019
|
-
description: optional(string()),
|
|
2020
|
-
icon: optional(bridgeManifestIconSchema),
|
|
2021
|
-
properties: optional(
|
|
2022
|
-
record(string(), bridgeManifestPropertySchema),
|
|
2023
|
-
{}
|
|
2024
|
-
)
|
|
2025
|
-
});
|
|
2026
|
-
var manifestSchema = object({
|
|
2027
|
-
version: literal(1),
|
|
2028
|
-
name: optional(string()),
|
|
2029
|
-
description: optional(string()),
|
|
2030
|
-
slashCommand: optional(string()),
|
|
2031
|
-
icon: optional(object({ type: literal("emoji"), emoji: string() })),
|
|
2032
|
-
dataSources: optional(
|
|
2033
|
-
record(string(), bridgeManifestDataSourceSchema),
|
|
2034
|
-
{}
|
|
2035
|
-
),
|
|
2036
|
-
pages: optional(record(string(), manifestPageSchema)),
|
|
2037
|
-
/**
|
|
2038
|
-
* Grants the block needs. Omitted means the block predates viewer
|
|
2039
|
-
* approval, so hosts do not ask the viewer. An empty array declares
|
|
2040
|
-
* nothing.
|
|
2041
|
-
*/
|
|
2042
|
-
grants: optional(array(customBlockGrantSchema))
|
|
2043
|
-
});
|
|
2044
|
-
|
|
2045
2112
|
// ../protocol/src/utils/errors.ts
|
|
2046
2113
|
var customBlockErrorInfoSchema = object({
|
|
2047
2114
|
code: string(),
|
|
@@ -2083,52 +2150,6 @@ var connectMessageSchema = variant("status", [
|
|
|
2083
2150
|
})
|
|
2084
2151
|
]);
|
|
2085
2152
|
|
|
2086
|
-
// ../protocol/src/users/userId.ts
|
|
2087
|
-
var notionUserIdSchema = pipe(string(), brand("NotionUserId"));
|
|
2088
|
-
|
|
2089
|
-
// ../protocol/src/users/bridgeUser.ts
|
|
2090
|
-
var bridgeUserSchema = object({
|
|
2091
|
-
object: literal("user"),
|
|
2092
|
-
id: notionUserIdSchema,
|
|
2093
|
-
name: optional(string()),
|
|
2094
|
-
avatar_url: nullable(string()),
|
|
2095
|
-
type: literal("person"),
|
|
2096
|
-
person: object({
|
|
2097
|
-
email: string()
|
|
2098
|
-
})
|
|
2099
|
-
});
|
|
2100
|
-
|
|
2101
|
-
// ../protocol/src/handshake/init.ts
|
|
2102
|
-
var customBlockInitErrorCodeSchema = string();
|
|
2103
|
-
var customBlockInitErrorInfoSchema = object({
|
|
2104
|
-
code: customBlockInitErrorCodeSchema,
|
|
2105
|
-
message: string(),
|
|
2106
|
-
isRetryable: boolean()
|
|
2107
|
-
});
|
|
2108
|
-
var initMessageSchema = variant("status", [
|
|
2109
|
-
object({
|
|
2110
|
-
type: literal("init"),
|
|
2111
|
-
initializationId: string(),
|
|
2112
|
-
status: literal("success"),
|
|
2113
|
-
theme: notionThemeSchema,
|
|
2114
|
-
contrastMode: notionContrastModeSchema,
|
|
2115
|
-
blockId: notionBlockIdSchema,
|
|
2116
|
-
parent: notionParentSchema,
|
|
2117
|
-
page: customBlockPageSchema,
|
|
2118
|
-
manifest: manifestSchema,
|
|
2119
|
-
dataSources: object({
|
|
2120
|
-
bindings: bridgeDataSourceBindingsSchema
|
|
2121
|
-
}),
|
|
2122
|
-
currentUser: bridgeUserSchema
|
|
2123
|
-
}),
|
|
2124
|
-
object({
|
|
2125
|
-
type: literal("init"),
|
|
2126
|
-
initializationId: string(),
|
|
2127
|
-
status: literal("error"),
|
|
2128
|
-
error: customBlockInitErrorInfoSchema
|
|
2129
|
-
})
|
|
2130
|
-
]);
|
|
2131
|
-
|
|
2132
2153
|
// ../protocol/src/handshake/initResult.ts
|
|
2133
2154
|
var customBlockInitResultErrorCodeSchema = string();
|
|
2134
2155
|
var customBlockInitResultErrorInfoSchema = object({
|
|
@@ -6596,7 +6617,6 @@ function convertPublicApiPropertyValue(publicType, value) {
|
|
|
6596
6617
|
case "button":
|
|
6597
6618
|
return void 0;
|
|
6598
6619
|
case "place":
|
|
6599
|
-
case "location":
|
|
6600
6620
|
return JSON.stringify(payload);
|
|
6601
6621
|
default:
|
|
6602
6622
|
return unreachable(publicType);
|
|
@@ -6707,8 +6727,7 @@ var VALUE_SCHEMAS = {
|
|
|
6707
6727
|
formula: stringValue,
|
|
6708
6728
|
rollup: stringValue,
|
|
6709
6729
|
verification: stringValue,
|
|
6710
|
-
place: stringValue
|
|
6711
|
-
location: stringValue
|
|
6730
|
+
place: stringValue
|
|
6712
6731
|
};
|
|
6713
6732
|
function matchesPropertyType(value, type) {
|
|
6714
6733
|
return is(VALUE_SCHEMAS[type] ?? anyLocalValue, value);
|
package/docs/bridge/changelog.md
CHANGED
|
@@ -7,24 +7,48 @@ Protocol version rules are in [Bridge protocol versioning](versioning.md). The h
|
|
|
7
7
|
[compatibility reference](../host/docs/compatibility.md) describes current support and response
|
|
8
8
|
conversions.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
versions refer to
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
Dates refer to npm releases in Pacific time, not deployment in Notion. Planned entries show the
|
|
11
|
+
expected package version and release date. Unqualified SDK versions refer to
|
|
12
|
+
`@notionhq/custom-blocks`.
|
|
13
|
+
|
|
14
|
+
| Protocol | First SDK release | First standalone host release | First dev shell release | Breaking contract changes |
|
|
15
|
+
| ------------------------------------------------------ | ----------------------------- | ----------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| 1 | `ncblock@0.0.1` · 2026-05-11 | — | — | Initial `ready` / `init` handshake and block APIs |
|
|
17
|
+
| 2 | `ncblock@0.0.36` · 2026-06-18 | — | `0.0.1` · 2026-07-21 | Structured errors, handshake changes, and raw data-source IDs instead of manifest keys |
|
|
18
|
+
| 3 | `0.0.79` · 2026-07-22 | `0.0.1` · 2026-09-09 | `0.0.8` · 2026-07-22 | Accumulated contract changes include `connect → init → initResult`, initialization identity, subscription identity, and required structured connect errors |
|
|
19
|
+
| 4 | `0.2.0` · 2026-09-17 | `0.1.14` · 2026-09-17 | `0.1.63` · 2026-09-17 | Required `init.contrastMode` and page/query `is_archived` and `in_trash` fields |
|
|
20
|
+
| 5 [†](#protocol-5-unavailable-containing-page-context) | `0.2.16` · 2026-09-30 | `0.1.25` · 2026-10-02 | `0.1.79` · 2026-09-30 | Query filters and sorts must address actual database properties. Filter and sort payloads reject extra fields |
|
|
21
|
+
| 6 [‡](#protocol-6-richer-fallback-properties) | `0.3.0` · 2026-10-26 | `0.2.21` · 2026-10-22 | `0.1.105` · 2026-10-22 | Typed, display-name-keyed query properties and unified page responses replace the older query representation |
|
|
22
|
+
| 7 | `0.3.3` · 2026-10-30 | `0.3.11` · 2026-10-30 | `0.1.115` · 2026-10-30 | Typed text fallback properties for unique ID, button, formula, location, rollup, and verification |
|
|
23
|
+
| 8 | `0.3.4` · 2026-11-03 | `0.4.0` · 2026-11-02 | `0.1.116` · 2026-11-05 | Local manifests move from `/manifest` to HTML metadata sent in `connect`; `manifestSource` selects the initialization manifest |
|
|
24
|
+
| 9 | — | `0.6.0` · 2026-11-05 | — | Native page icons; older protocols receive external SVG URLs |
|
|
25
|
+
| 10 | `0.4.0` · 2026-11-11 | `0.7.0` · 2026-11-10 | `0.2.0` · 2026-11-10 | Removes `last_visited_time` from property schemas, page properties, and page metadata |
|
|
26
|
+
| 11 | `0.5.0` · 2026-11-13 | `0.10.0` · 2026-11-13 | `0.3.1` · 2026-11-13 | Removes `location` from manifests, binding schemas, and page properties; renames data source binding fields |
|
|
27
|
+
|
|
28
|
+
`—` means no release in that package line carried that specific protocol version.
|
|
29
|
+
|
|
30
|
+
Host compatibility depends on `connect.bridgeProtocolVersion`, not the SDK package version.
|
|
31
|
+
|
|
32
|
+
Native host package pins and protocol mappings are tracked separately in
|
|
33
|
+
[Notion's native host configuration](https://github.com/makenotion/notion-next/blob/main/src/cli/mobile/codegen/customBlockHost/config.ts)
|
|
34
|
+
and
|
|
35
|
+
[mobile shell registry](https://github.com/makenotion/notion-next/blob/main/src/cloudflare-customBlockWorker/lib/mobileShellRegistry.ts).
|
|
36
|
+
|
|
37
|
+
## Protocol 11: location removal and data source binding names
|
|
38
|
+
|
|
39
|
+
Current bindings use `dataSourceSchema` and `dataSourcePointer` in `init` and `dataSourcesChanged`.
|
|
40
|
+
Current SDK types and host APIs use the same names. The host encodes `collectionSchema` and
|
|
41
|
+
`collectionPointer` for supported protocols 3–10 only at its outgoing boundary. Protocols 3–4 still
|
|
42
|
+
receive synthetic metadata schemas there.
|
|
43
|
+
|
|
44
|
+
Publish and deploy the updated host before adopting the new SDK. Native host generation and mobile
|
|
45
|
+
shell registration must use the published release; the planned releases are SDK 0.5.0, host 0.10.0,
|
|
46
|
+
and dev shell 0.3.1.
|
|
47
|
+
|
|
48
|
+
`location` represents the source of an item in Notion's aggregated views. Protocol 11 removes it
|
|
49
|
+
from manifests, binding schemas, and page property values. Updated hosts omit it for every supported
|
|
50
|
+
protocol version. Existing blocks that declare it in a manifest must remove that declaration and
|
|
51
|
+
rebuild. Older SDKs can still connect with manifests that use supported property types.
|
|
28
52
|
|
|
29
53
|
## Protocol 10: remove last visited time
|
|
30
54
|
|
|
@@ -79,7 +103,7 @@ describes current compatibility behavior.
|
|
|
79
103
|
### Protocol 6: richer fallback properties
|
|
80
104
|
|
|
81
105
|
The protocol version changed in code on October 22, 2026. On October 26, the `pages` and
|
|
82
|
-
`dataSources` APIs adopted a shared page representation: data
|
|
106
|
+
`dataSources` APIs adopted a shared page representation: data source query rows and page operation
|
|
83
107
|
results use the same page shape, with typed properties keyed by display name.
|
|
84
108
|
|
|
85
109
|
Some SDKs added text fallback property objects for unique ID, button, formula, location, rollup, and
|
package/docs/bridge/protocol.md
CHANGED
|
@@ -34,7 +34,7 @@ sends `connect.error` with `manifest_invalid`.
|
|
|
34
34
|
The embedding application selects the manifest source. In host mode, the host uses its persisted
|
|
35
35
|
manifest and ignores the sandbox declaration. In sandbox mode, the host uses `connect.manifest` from
|
|
36
36
|
a permitted local sandbox; a missing declaration produces `manifest_unavailable`. The selected
|
|
37
|
-
manifest is authoritative and is returned in `init` with context and data
|
|
37
|
+
manifest is authoritative and is returned in `init` with context and data source bindings. Errors
|
|
38
38
|
from the selected manifest source pass through unchanged. Host mode can initialize after a sandbox
|
|
39
39
|
`manifest_invalid` error using its own manifest; other connect errors remain fatal. The connect
|
|
40
40
|
parser discards unknown properties.
|
|
@@ -126,9 +126,9 @@ for `code`, including unknown codes. TypeScript aliases list known codes for aut
|
|
|
126
126
|
### Bindings and IDs
|
|
127
127
|
|
|
128
128
|
Hosts send `BridgeDataSourceBindings` as `dataSources: { bindings }`, keyed by the semantic data
|
|
129
|
-
source key declared in the manifest. `
|
|
129
|
+
source key declared in the manifest. `dataSourceSchema` contains only actual database properties.
|
|
130
130
|
|
|
131
|
-
Sandbox-to-host object references are raw IDs. The SDK resolves semantic data
|
|
131
|
+
Sandbox-to-host object references are raw IDs. The SDK resolves semantic data source and property
|
|
132
132
|
keys before sending query or page-operation requests. Get and update requests can carry an optional
|
|
133
133
|
resolved `dataSourceId`.
|
|
134
134
|
|
|
@@ -146,7 +146,7 @@ raw `propertyId` and an `ascending` or `descending` direction. Hosts apply sorts
|
|
|
146
146
|
SDK and host validate that the list contains at most ten unique properties. The host rejects
|
|
147
147
|
property types without a supported sort value.
|
|
148
148
|
|
|
149
|
-
Every filter and sort property ID must exist in `
|
|
149
|
+
Every filter and sort property ID must exist in `dataSourceSchema.propertiesById`. Queries with
|
|
150
150
|
filters or sorts return `data_source_schema_unavailable` when the schema is unavailable. Filter
|
|
151
151
|
branches, operators, person references, and sort objects reject extra fields.
|
|
152
152
|
|
|
@@ -220,9 +220,9 @@ names as keys and typed values that include their raw property IDs. Only actual
|
|
|
220
220
|
are returned. Query results contain `items` and `hasMore`. `bridgePageSchema` defines the page
|
|
221
221
|
fields, including archive state and creation, edit, and visit metadata.
|
|
222
222
|
|
|
223
|
-
Page reads return string values for `unique_id`, `formula`, `rollup`, `button`, `verification`,
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
Page reads return string values for `unique_id`, `formula`, `rollup`, `button`, and `verification`,
|
|
224
|
+
preserving each property's type. These properties are read-only. Values use stored text, or `""`
|
|
225
|
+
when absent. Hosts do not evaluate formulas or rollups.
|
|
226
226
|
|
|
227
227
|
The host converts responses to the sandbox's declared protocol. See
|
|
228
228
|
[versioning and compatibility](versioning.md) for protocol version rules. The host's
|
|
@@ -16,7 +16,7 @@ does not guarantee that future features work.
|
|
|
16
16
|
|
|
17
17
|
`sdkVersion` is analytics metadata. Compatibility behavior depends on the protocol version.
|
|
18
18
|
|
|
19
|
-
The current SDK declares protocol
|
|
19
|
+
The current SDK declares protocol 11. The shared runtime minimum is 3. The dev shell uses the Worker
|
|
20
20
|
manifest in host mode and accepts the shared runtime's supported protocol versions. Protocols 7 and
|
|
21
21
|
8 use the same page and query response formats. Protocol 8's local manifest declaration is selected
|
|
22
22
|
only in sandbox mode; host mode uses the persisted manifest. See the
|
|
@@ -74,3 +74,13 @@ objects carry these fields at the top level. Protocol 3–5 query adapters copy
|
|
|
74
74
|
|
|
75
75
|
Filters and sorts require actual database properties in the bound schema. The host does not support
|
|
76
76
|
queries against synthetic metadata IDs without corresponding database properties.
|
|
77
|
+
|
|
78
|
+
## Data source binding names
|
|
79
|
+
|
|
80
|
+
Protocol 11 uses `dataSourceSchema` and `dataSourcePointer`. Host adapters supply only these current
|
|
81
|
+
names. The outgoing boundary restores `collectionSchema` and `collectionPointer` for protocols 3–10,
|
|
82
|
+
including initialization and live binding updates. The host runtime minimum is unchanged.
|
|
83
|
+
|
|
84
|
+
The renamed `CustomBlockHostDataSourceState.dataSource.dataSourceSchema` is a host API field, not a
|
|
85
|
+
sandbox message. Update its producers when adopting the host package. Publish the host and deploy
|
|
86
|
+
each embedding application's adoption before releasing an SDK that requires protocol 11.
|
|
@@ -76,7 +76,7 @@ sandbox message types and correlation IDs. Named domain arguments such as
|
|
|
76
76
|
contain only operation data. Handlers receive those arguments combined with
|
|
77
77
|
`CustomBlockHostRequestContext`; the runtime supplies `signal`. Page operations retain their
|
|
78
78
|
existing domain payloads, including parent-dependent insertion rules, properties, and appearance.
|
|
79
|
-
Source and page operations use raw IDs. The SDK resolves data
|
|
79
|
+
Source and page operations use raw IDs. The SDK resolves data source keys before sending requests.
|
|
80
80
|
|
|
81
81
|
| Handler | Additional input | Success payload |
|
|
82
82
|
| ----------------- | ---------------------------------- | --------------------------------------- |
|
|
@@ -141,7 +141,7 @@ schema. Initialization and each configuration refresh read metadata independentl
|
|
|
141
141
|
reuse metadata promises across reads.
|
|
142
142
|
|
|
143
143
|
`CustomBlockHostDataSourceState` is `{ status: "unavailable" }` or
|
|
144
|
-
`{ status: "available", dataSource: {
|
|
144
|
+
`{ status: "available", dataSource: { dataSourceSchema, capabilities } }`. Capabilities contain
|
|
145
145
|
`read`, `create`, `update`, and `archive`. These flags describe platform access. The runtime
|
|
146
146
|
validates the flags but does not use them to authorize requests or send them to the sandbox.
|
|
147
147
|
Handlers enforce viewer permissions on each operation.
|