@notionhq/custom-blocks-dev-shell 0.2.0 → 0.3.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.
- package/dist/assets/index-CWJ-vFk0.js +12 -0
- package/dist/index.html +1 -1
- package/dist-cli/cli/published-cli.js +158 -103
- package/docs/bridge/protocol.md +18 -17
- package/docs/data-sources.md +6 -4
- package/docs/host/README.md +54 -42
- package/docs/host/docs/handlers.md +36 -143
- package/docs/host/docs/host-contract.md +196 -0
- package/docs/host/docs/lifecycle.md +28 -37
- package/package.json +1 -1
- package/dist/assets/index-n0_PUieY.js +0 -11
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-CWJ-vFk0.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-Do-x8yIt.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -865,6 +865,15 @@ function variant(key, options, message$1) {
|
|
|
865
865
|
}
|
|
866
866
|
});
|
|
867
867
|
}
|
|
868
|
+
// @__NO_SIDE_EFFECTS__
|
|
869
|
+
function omit(schema, keys) {
|
|
870
|
+
const entries$1 = { ...schema.entries };
|
|
871
|
+
for (const key of keys) delete entries$1[key];
|
|
872
|
+
return _standardSchema({
|
|
873
|
+
...schema,
|
|
874
|
+
entries: entries$1
|
|
875
|
+
});
|
|
876
|
+
}
|
|
868
877
|
function parse(schema, input, config$1) {
|
|
869
878
|
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
870
879
|
if (dataset.issues) throw new ValiError(dataset.issues);
|
|
@@ -907,6 +916,10 @@ var notionDataSourceIdSchema = pipe(
|
|
|
907
916
|
var notionPageIdSchema = pipe(string(), brand("NotionPageId"));
|
|
908
917
|
var notionAgentIdSchema = pipe(string(), brand("NotionAgentId"));
|
|
909
918
|
var notionSpaceIdSchema = pipe(string(), brand("NotionSpaceId"));
|
|
919
|
+
var notionAppInstallationIdSchema = pipe(
|
|
920
|
+
string(),
|
|
921
|
+
brand("NotionAppInstallationId")
|
|
922
|
+
);
|
|
910
923
|
|
|
911
924
|
// ../protocol/src/context/parent.ts
|
|
912
925
|
var pageParentSchema = object({
|
|
@@ -929,6 +942,10 @@ var agentParentSchema = object({
|
|
|
929
942
|
type: literal("agent_id"),
|
|
930
943
|
agent_id: notionAgentIdSchema
|
|
931
944
|
});
|
|
945
|
+
var appInstallationParentSchema = object({
|
|
946
|
+
type: literal("app_installation_id"),
|
|
947
|
+
app_installation_id: notionAppInstallationIdSchema
|
|
948
|
+
});
|
|
932
949
|
var unavailableParentSchema = object({ type: literal("unavailable") });
|
|
933
950
|
var notionParentSchema = variant("type", [
|
|
934
951
|
pageParentSchema,
|
|
@@ -936,12 +953,30 @@ var notionParentSchema = variant("type", [
|
|
|
936
953
|
workspaceParentSchema,
|
|
937
954
|
blockParentSchema,
|
|
938
955
|
agentParentSchema,
|
|
956
|
+
appInstallationParentSchema,
|
|
939
957
|
unavailableParentSchema
|
|
940
958
|
]);
|
|
941
959
|
|
|
960
|
+
// ../protocol/src/files.ts
|
|
961
|
+
var bridgeExternalFileSchema = object({
|
|
962
|
+
type: literal("external"),
|
|
963
|
+
external: object({ url: string() })
|
|
964
|
+
});
|
|
965
|
+
var bridgeNotionHostedFileSchema = object({
|
|
966
|
+
type: literal("file"),
|
|
967
|
+
file: object({
|
|
968
|
+
url: string(),
|
|
969
|
+
expiry_time: optional(string())
|
|
970
|
+
})
|
|
971
|
+
});
|
|
972
|
+
var bridgeFilePropertyItemSchema = union([
|
|
973
|
+
object({ ...bridgeExternalFileSchema.entries, name: string() }),
|
|
974
|
+
object({ ...bridgeNotionHostedFileSchema.entries, name: string() })
|
|
975
|
+
]);
|
|
976
|
+
|
|
942
977
|
// ../protocol/src/icons.ts
|
|
943
|
-
var
|
|
944
|
-
var
|
|
978
|
+
var bridgeIconNameSchema = string();
|
|
979
|
+
var knownBridgeIconColorSchema = picklist([
|
|
945
980
|
"gray",
|
|
946
981
|
"lightgray",
|
|
947
982
|
"brown",
|
|
@@ -953,24 +988,22 @@ var knownNotionIconColorSchema = picklist([
|
|
|
953
988
|
"pink",
|
|
954
989
|
"red"
|
|
955
990
|
]);
|
|
956
|
-
var
|
|
957
|
-
|
|
991
|
+
var bridgeIconColorSchema = union([
|
|
992
|
+
knownBridgeIconColorSchema,
|
|
958
993
|
string()
|
|
959
994
|
]);
|
|
960
|
-
var
|
|
995
|
+
var bridgeIconSchema = looseObject({
|
|
961
996
|
type: literal("icon"),
|
|
962
997
|
icon: looseObject({
|
|
963
|
-
name:
|
|
964
|
-
color: optional(
|
|
998
|
+
name: bridgeIconNameSchema,
|
|
999
|
+
color: optional(bridgeIconColorSchema)
|
|
965
1000
|
})
|
|
966
1001
|
});
|
|
967
|
-
|
|
968
|
-
// ../protocol/src/pages/pageAppearance.ts
|
|
969
|
-
var notionEmojiIconSchema = object({
|
|
1002
|
+
var bridgeEmojiSchema = object({
|
|
970
1003
|
type: literal("emoji"),
|
|
971
1004
|
emoji: string()
|
|
972
1005
|
});
|
|
973
|
-
var
|
|
1006
|
+
var bridgeCustomEmojiSchema = object({
|
|
974
1007
|
type: literal("custom_emoji"),
|
|
975
1008
|
custom_emoji: object({
|
|
976
1009
|
id: string(),
|
|
@@ -978,34 +1011,18 @@ var notionCustomEmojiIconSchema = object({
|
|
|
978
1011
|
url: optional(string())
|
|
979
1012
|
})
|
|
980
1013
|
});
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
expiry_time: optional(string())
|
|
990
|
-
})
|
|
991
|
-
});
|
|
992
|
-
var notionPageIconSchema = variant("type", [
|
|
993
|
-
notionNativeIconSchema,
|
|
994
|
-
notionEmojiIconSchema,
|
|
995
|
-
notionCustomEmojiIconSchema,
|
|
996
|
-
notionExternalFileSchema,
|
|
997
|
-
notionHostedFileSchema
|
|
998
|
-
]);
|
|
999
|
-
var notionPageCoverSchema = variant("type", [
|
|
1000
|
-
notionExternalFileSchema,
|
|
1001
|
-
notionHostedFileSchema
|
|
1014
|
+
|
|
1015
|
+
// ../protocol/src/pages/pageAppearance.ts
|
|
1016
|
+
var bridgePageIconSchema = variant("type", [
|
|
1017
|
+
bridgeIconSchema,
|
|
1018
|
+
bridgeEmojiSchema,
|
|
1019
|
+
bridgeCustomEmojiSchema,
|
|
1020
|
+
bridgeExternalFileSchema,
|
|
1021
|
+
bridgeNotionHostedFileSchema
|
|
1002
1022
|
]);
|
|
1003
|
-
var
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
notionCustomEmojiIconSchema,
|
|
1007
|
-
notionExternalFileSchema,
|
|
1008
|
-
notionHostedFileSchema
|
|
1023
|
+
var bridgePageCoverSchema = variant("type", [
|
|
1024
|
+
bridgeExternalFileSchema,
|
|
1025
|
+
bridgeNotionHostedFileSchema
|
|
1009
1026
|
]);
|
|
1010
1027
|
|
|
1011
1028
|
// ../protocol/src/utils/nullableStringSchema.ts
|
|
@@ -1095,23 +1112,6 @@ var notionDateInputSchema = union([
|
|
|
1095
1112
|
})
|
|
1096
1113
|
]);
|
|
1097
1114
|
|
|
1098
|
-
// ../protocol/src/pages/properties/fileInput.ts
|
|
1099
|
-
var notionFileInputSchema = union([
|
|
1100
|
-
object({
|
|
1101
|
-
type: literal("external"),
|
|
1102
|
-
name: string(),
|
|
1103
|
-
external: object({ url: string() })
|
|
1104
|
-
}),
|
|
1105
|
-
object({
|
|
1106
|
-
type: literal("file"),
|
|
1107
|
-
name: string(),
|
|
1108
|
-
file: object({
|
|
1109
|
-
url: string(),
|
|
1110
|
-
expiry_time: optional(string())
|
|
1111
|
-
})
|
|
1112
|
-
})
|
|
1113
|
-
]);
|
|
1114
|
-
|
|
1115
1115
|
// ../protocol/src/utils/recordPointer.ts
|
|
1116
1116
|
var notionRecordPointerSchema = object({
|
|
1117
1117
|
id: string(),
|
|
@@ -1244,7 +1244,7 @@ var bridgePagePropertyValueSchema = variant("type", [
|
|
|
1244
1244
|
object({
|
|
1245
1245
|
...pagePropertyBaseSchema,
|
|
1246
1246
|
type: literal("files"),
|
|
1247
|
-
files: array(
|
|
1247
|
+
files: array(bridgeFilePropertyItemSchema)
|
|
1248
1248
|
}),
|
|
1249
1249
|
object({
|
|
1250
1250
|
...pagePropertyBaseSchema,
|
|
@@ -1321,8 +1321,8 @@ var bridgePageForProtocol3To5Schema = object({
|
|
|
1321
1321
|
properties: bridgePagePropertyWriteMapSchema,
|
|
1322
1322
|
created_time: optional(string()),
|
|
1323
1323
|
last_edited_time: optional(string()),
|
|
1324
|
-
icon: optional(
|
|
1325
|
-
cover: optional(
|
|
1324
|
+
icon: optional(bridgePageIconSchema),
|
|
1325
|
+
cover: optional(bridgePageCoverSchema),
|
|
1326
1326
|
url: optional(string()),
|
|
1327
1327
|
public_url: optional(string()),
|
|
1328
1328
|
/** Whether the page or an ancestor is archived. */
|
|
@@ -1404,6 +1404,13 @@ var themeChangedMessageSchema = object({
|
|
|
1404
1404
|
theme: notionThemeSchema
|
|
1405
1405
|
});
|
|
1406
1406
|
|
|
1407
|
+
// ../protocol/src/dataSources/bridgeArchiveStatus.ts
|
|
1408
|
+
var bridgeArchiveStatusSchema = picklist([
|
|
1409
|
+
"active",
|
|
1410
|
+
"archived",
|
|
1411
|
+
"all"
|
|
1412
|
+
]);
|
|
1413
|
+
|
|
1407
1414
|
// ../protocol/src/dataSources/collectionPointer.ts
|
|
1408
1415
|
var collectionPointerValidator = object({
|
|
1409
1416
|
id: notionDataSourceIdSchema,
|
|
@@ -1601,18 +1608,6 @@ var customBlockContainsFilterOperatorSchema = union([
|
|
|
1601
1608
|
emptyOperatorSchema
|
|
1602
1609
|
]);
|
|
1603
1610
|
|
|
1604
|
-
// ../protocol/src/dataSources/filters/createdByFilterOperator.ts
|
|
1605
|
-
var customBlockCreatorFilterValueSchema = strictObject({
|
|
1606
|
-
object: literal("user"),
|
|
1607
|
-
id: pipe(string(), minLength(1), maxLength(2e3))
|
|
1608
|
-
});
|
|
1609
|
-
var customBlockCreatedByFilterOperatorSchema = union([
|
|
1610
|
-
strictObject({ contains: customBlockCreatorFilterValueSchema }),
|
|
1611
|
-
strictObject({ does_not_contain: customBlockCreatorFilterValueSchema }),
|
|
1612
|
-
strictObject({ is_empty: literal(true) }),
|
|
1613
|
-
strictObject({ is_not_empty: literal(true) })
|
|
1614
|
-
]);
|
|
1615
|
-
|
|
1616
1611
|
// ../protocol/src/dataSources/filters/dateFilterOperator.ts
|
|
1617
1612
|
var dateTargetSchema = picklist(["start_date", "end_date"]);
|
|
1618
1613
|
var customBlockRelativeDateValueSchema = picklist([
|
|
@@ -1708,7 +1703,7 @@ var customBlockOptionFilterOperatorSchema = union([
|
|
|
1708
1703
|
// ../protocol/src/dataSources/filters/peopleFilterOperator.ts
|
|
1709
1704
|
var customBlockPersonFilterValueSchema = strictObject({
|
|
1710
1705
|
object: picklist(["user", "group"]),
|
|
1711
|
-
id: pipe(string(), minLength(1))
|
|
1706
|
+
id: pipe(string(), minLength(1), maxLength(2e3))
|
|
1712
1707
|
});
|
|
1713
1708
|
var customBlockPeopleFilterOperatorSchema = union([
|
|
1714
1709
|
strictObject({ contains: customBlockPersonFilterValueSchema }),
|
|
@@ -1771,15 +1766,34 @@ var customBlockTextFilterOperatorSchema = union([
|
|
|
1771
1766
|
emptyOperatorSchema
|
|
1772
1767
|
]);
|
|
1773
1768
|
|
|
1769
|
+
// ../protocol/src/dataSources/filters/timestampFilterOperator.ts
|
|
1770
|
+
var customBlockTimestampFilterOperatorSchema = union(
|
|
1771
|
+
customBlockDateFilterOperatorSchema.options.map(
|
|
1772
|
+
(option) => omit(option, ["target"])
|
|
1773
|
+
)
|
|
1774
|
+
);
|
|
1775
|
+
|
|
1774
1776
|
// ../protocol/src/dataSources/filters/bridgeDataSourceFilterCondition.ts
|
|
1775
1777
|
var bridgeDataSourceFilterConditionSchema = union([
|
|
1778
|
+
strictObject({
|
|
1779
|
+
propertyId: string(),
|
|
1780
|
+
last_edited_by: customBlockPeopleFilterOperatorSchema
|
|
1781
|
+
}),
|
|
1782
|
+
strictObject({
|
|
1783
|
+
propertyId: string(),
|
|
1784
|
+
created_time: customBlockTimestampFilterOperatorSchema
|
|
1785
|
+
}),
|
|
1786
|
+
strictObject({
|
|
1787
|
+
propertyId: string(),
|
|
1788
|
+
last_edited_time: customBlockTimestampFilterOperatorSchema
|
|
1789
|
+
}),
|
|
1776
1790
|
strictObject({
|
|
1777
1791
|
propertyId: string(),
|
|
1778
1792
|
relation: customBlockRelationFilterOperatorSchema
|
|
1779
1793
|
}),
|
|
1780
1794
|
strictObject({
|
|
1781
1795
|
propertyId: string(),
|
|
1782
|
-
created_by:
|
|
1796
|
+
created_by: customBlockPeopleFilterOperatorSchema
|
|
1783
1797
|
}),
|
|
1784
1798
|
strictObject({
|
|
1785
1799
|
propertyId: string(),
|
|
@@ -1866,8 +1880,8 @@ var bridgePageSchema = object({
|
|
|
1866
1880
|
last_edited_by: optional(metadataActorSchema, null),
|
|
1867
1881
|
created_time: optional(nullable(string()), null),
|
|
1868
1882
|
last_edited_time: optional(nullable(string()), null),
|
|
1869
|
-
icon: optional(nullable(
|
|
1870
|
-
cover: optional(nullable(
|
|
1883
|
+
icon: optional(nullable(bridgePageIconSchema), null),
|
|
1884
|
+
cover: optional(nullable(bridgePageCoverSchema), null),
|
|
1871
1885
|
url: optional(nullable(string()), null),
|
|
1872
1886
|
public_url: optional(nullable(string()), null),
|
|
1873
1887
|
/** Whether the page or an ancestor is archived. */
|
|
@@ -1888,7 +1902,8 @@ var queryDataSourceMessageSchema = object({
|
|
|
1888
1902
|
/** A sandbox-resolved property filter. */
|
|
1889
1903
|
filter: optional(bridgeDataSourceFilterSchema),
|
|
1890
1904
|
/** Sandbox-resolved property sorts, in priority order. */
|
|
1891
|
-
sorts: optional(array(bridgeDataSourceSortSchema))
|
|
1905
|
+
sorts: optional(array(bridgeDataSourceSortSchema)),
|
|
1906
|
+
archive_status: optional(bridgeArchiveStatusSchema)
|
|
1892
1907
|
});
|
|
1893
1908
|
var customBlockQueryDataSourceErrorCodeSchema = string();
|
|
1894
1909
|
var customBlockQueryDataSourceErrorInfoSchema = object({
|
|
@@ -1972,14 +1987,14 @@ var notionDataSourceSchema = object({
|
|
|
1972
1987
|
inaccessible: optional(literal(true))
|
|
1973
1988
|
});
|
|
1974
1989
|
|
|
1975
|
-
// ../protocol/src/manifest/
|
|
1976
|
-
var
|
|
1977
|
-
|
|
1990
|
+
// ../protocol/src/manifest/grants.ts
|
|
1991
|
+
var customBlockGrantSchema = object({
|
|
1992
|
+
action: string(),
|
|
1978
1993
|
resource: union([string(), pipe(array(string()), minLength(1))])
|
|
1979
1994
|
});
|
|
1980
1995
|
|
|
1981
1996
|
// ../protocol/src/manifest/manifest.ts
|
|
1982
|
-
var
|
|
1997
|
+
var bridgeManifestIconSchema = variant("type", [
|
|
1983
1998
|
object({
|
|
1984
1999
|
type: literal("emoji"),
|
|
1985
2000
|
emoji: string()
|
|
@@ -1989,7 +2004,7 @@ var manifestIconSchema = variant("type", [
|
|
|
1989
2004
|
url: string()
|
|
1990
2005
|
})
|
|
1991
2006
|
]);
|
|
1992
|
-
var
|
|
2007
|
+
var bridgeManifestPropertySchema = object({
|
|
1993
2008
|
name: string(),
|
|
1994
2009
|
description: optional(string()),
|
|
1995
2010
|
type: notionPropertyTypeSchema
|
|
@@ -1997,13 +2012,16 @@ var manifestPropertySchema = object({
|
|
|
1997
2012
|
var manifestPageSchema = object({
|
|
1998
2013
|
name: string(),
|
|
1999
2014
|
description: optional(string()),
|
|
2000
|
-
icon: optional(
|
|
2015
|
+
icon: optional(bridgeManifestIconSchema)
|
|
2001
2016
|
});
|
|
2002
|
-
var
|
|
2017
|
+
var bridgeManifestDataSourceSchema = object({
|
|
2003
2018
|
name: string(),
|
|
2004
2019
|
description: optional(string()),
|
|
2005
|
-
icon: optional(
|
|
2006
|
-
properties: optional(
|
|
2020
|
+
icon: optional(bridgeManifestIconSchema),
|
|
2021
|
+
properties: optional(
|
|
2022
|
+
record(string(), bridgeManifestPropertySchema),
|
|
2023
|
+
{}
|
|
2024
|
+
)
|
|
2007
2025
|
});
|
|
2008
2026
|
var manifestSchema = object({
|
|
2009
2027
|
version: literal(1),
|
|
@@ -2011,14 +2029,17 @@ var manifestSchema = object({
|
|
|
2011
2029
|
description: optional(string()),
|
|
2012
2030
|
slashCommand: optional(string()),
|
|
2013
2031
|
icon: optional(object({ type: literal("emoji"), emoji: string() })),
|
|
2014
|
-
dataSources: optional(
|
|
2032
|
+
dataSources: optional(
|
|
2033
|
+
record(string(), bridgeManifestDataSourceSchema),
|
|
2034
|
+
{}
|
|
2035
|
+
),
|
|
2015
2036
|
pages: optional(record(string(), manifestPageSchema)),
|
|
2016
2037
|
/**
|
|
2017
|
-
*
|
|
2018
|
-
* approval, so hosts do not ask the viewer. An empty array declares
|
|
2019
|
-
*
|
|
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.
|
|
2020
2041
|
*/
|
|
2021
|
-
|
|
2042
|
+
grants: optional(array(customBlockGrantSchema))
|
|
2022
2043
|
});
|
|
2023
2044
|
|
|
2024
2045
|
// ../protocol/src/utils/errors.ts
|
|
@@ -2206,9 +2227,7 @@ var createPageParentSchema = variant("type", [
|
|
|
2206
2227
|
pageParentSchema,
|
|
2207
2228
|
dataSourceParentSchema
|
|
2208
2229
|
]);
|
|
2209
|
-
var
|
|
2210
|
-
type: literal("createPage"),
|
|
2211
|
-
requestId: string(),
|
|
2230
|
+
var createPageBaseEntries = {
|
|
2212
2231
|
/**
|
|
2213
2232
|
* Property values, keyed by raw property IDs from Notion.
|
|
2214
2233
|
*
|
|
@@ -2217,19 +2236,35 @@ var createPageMessageBaseSchema = {
|
|
|
2217
2236
|
* those keys before it sends this message.
|
|
2218
2237
|
*/
|
|
2219
2238
|
properties: bridgePagePropertyWriteMapSchema,
|
|
2220
|
-
icon: optional(
|
|
2221
|
-
cover: optional(
|
|
2239
|
+
icon: optional(bridgePageIconSchema),
|
|
2240
|
+
cover: optional(bridgePageCoverSchema)
|
|
2241
|
+
};
|
|
2242
|
+
var createPageUnderPageArgsSchema = object({
|
|
2243
|
+
...createPageBaseEntries,
|
|
2244
|
+
parent: pageParentSchema,
|
|
2245
|
+
position: optional(notionCreatePagePositionSchema)
|
|
2246
|
+
});
|
|
2247
|
+
var createPageUnderDataSourceArgsSchema = object({
|
|
2248
|
+
...createPageBaseEntries,
|
|
2249
|
+
parent: dataSourceParentSchema,
|
|
2250
|
+
position: optional(never())
|
|
2251
|
+
});
|
|
2252
|
+
var createPageArgsSchema = union([
|
|
2253
|
+
createPageUnderPageArgsSchema,
|
|
2254
|
+
createPageUnderDataSourceArgsSchema
|
|
2255
|
+
]);
|
|
2256
|
+
var createPageMessageEntries = {
|
|
2257
|
+
type: literal("createPage"),
|
|
2258
|
+
requestId: string()
|
|
2222
2259
|
};
|
|
2223
2260
|
var createPageMessageSchema = variant("type", [
|
|
2224
2261
|
object({
|
|
2225
|
-
...
|
|
2226
|
-
|
|
2227
|
-
position: optional(notionCreatePagePositionSchema)
|
|
2262
|
+
...createPageMessageEntries,
|
|
2263
|
+
...createPageUnderPageArgsSchema.entries
|
|
2228
2264
|
}),
|
|
2229
2265
|
object({
|
|
2230
|
-
...
|
|
2231
|
-
|
|
2232
|
-
position: optional(never())
|
|
2266
|
+
...createPageMessageEntries,
|
|
2267
|
+
...createPageUnderDataSourceArgsSchema.entries
|
|
2233
2268
|
})
|
|
2234
2269
|
]);
|
|
2235
2270
|
|
|
@@ -2352,8 +2387,8 @@ var updatePageMessageSchema = object({
|
|
|
2352
2387
|
* by `useDataSource()`. The SDK resolves those keys before it sends this message.
|
|
2353
2388
|
*/
|
|
2354
2389
|
properties: optional(bridgePagePropertyWriteMapSchema),
|
|
2355
|
-
icon: optional(
|
|
2356
|
-
cover: optional(
|
|
2390
|
+
icon: optional(bridgePageIconSchema),
|
|
2391
|
+
cover: optional(bridgePageCoverSchema),
|
|
2357
2392
|
archived: optional(boolean())
|
|
2358
2393
|
});
|
|
2359
2394
|
|
|
@@ -7421,6 +7456,16 @@ function createDevShellDataService(options) {
|
|
|
7421
7456
|
import { existsSync as existsSync4, mkdirSync as mkdirSync3, writeFileSync } from "node:fs";
|
|
7422
7457
|
import { resolve as resolve3 } from "node:path";
|
|
7423
7458
|
|
|
7459
|
+
// shared/blocks/formatBlockValidationIssues.ts
|
|
7460
|
+
function formatBlockValidationIssues(blockKey, issues, pathPrefix) {
|
|
7461
|
+
const details = issues.map((issue) => {
|
|
7462
|
+
const path = [pathPrefix, getDotPath(issue)].filter(Boolean).join(".");
|
|
7463
|
+
return `${path}: ${issue.message}`;
|
|
7464
|
+
});
|
|
7465
|
+
return `Block "${blockKey}" has an invalid declaration:
|
|
7466
|
+
${details.join("\n")}`;
|
|
7467
|
+
}
|
|
7468
|
+
|
|
7424
7469
|
// cli/workers/blockCapabilities.ts
|
|
7425
7470
|
var workerBlockCapabilitySchema = object({
|
|
7426
7471
|
_tag: literal("custom_block"),
|
|
@@ -7436,7 +7481,16 @@ var workerBlockCapabilitySchema = object({
|
|
|
7436
7481
|
})
|
|
7437
7482
|
});
|
|
7438
7483
|
function blockCapabilities(manifest) {
|
|
7439
|
-
return manifest.capabilities.filter((capability) => capability._tag === "custom_block").map((capability) =>
|
|
7484
|
+
return manifest.capabilities.filter((capability) => capability._tag === "custom_block").map((capability) => {
|
|
7485
|
+
const parsed = safeParse(workerBlockCapabilitySchema, capability);
|
|
7486
|
+
if (!parsed.success) {
|
|
7487
|
+
const error = new ValiError(parsed.issues);
|
|
7488
|
+
error.message = `${formatBlockValidationIssues(capability.key, parsed.issues, "")}
|
|
7489
|
+
Fix the custom block declaration, then restart the dev shell to rebuild the manifest.`;
|
|
7490
|
+
throw error;
|
|
7491
|
+
}
|
|
7492
|
+
return parsed.output;
|
|
7493
|
+
});
|
|
7440
7494
|
}
|
|
7441
7495
|
|
|
7442
7496
|
// cli/dataSources/materializeWorkerSchemaDataSources.ts
|
|
@@ -8043,6 +8097,7 @@ function buildBlockRegistry(blocks, port = DEFAULT_DEV_SHELL_PORT) {
|
|
|
8043
8097
|
}
|
|
8044
8098
|
used.add(hostname);
|
|
8045
8099
|
return {
|
|
8100
|
+
status: "ready",
|
|
8046
8101
|
key: capability.key,
|
|
8047
8102
|
manifest: capability.config.manifest,
|
|
8048
8103
|
name: capability.key,
|
package/docs/bridge/protocol.md
CHANGED
|
@@ -139,6 +139,8 @@ without sending a message.
|
|
|
139
139
|
|
|
140
140
|
### Query requests
|
|
141
141
|
|
|
142
|
+
`queryDataSource.archive_status` accepts `active`, `archived`, or `all`. It defaults to `active`.
|
|
143
|
+
|
|
142
144
|
`queryDataSource` may include a resolved `filter` and an ordered `sorts` list. Each sort contains a
|
|
143
145
|
raw `propertyId` and an `ascending` or `descending` direction. Hosts apply sorts in array order. The
|
|
144
146
|
SDK and host validate that the list contains at most ten unique properties. The host rejects
|
|
@@ -148,14 +150,11 @@ Every filter and sort property ID must exist in `collectionSchema.propertiesById
|
|
|
148
150
|
filters or sorts return `data_source_schema_unavailable` when the schema is unavailable. Filter
|
|
149
151
|
branches, operators, person references, and sort objects reject extra fields.
|
|
150
152
|
|
|
151
|
-
#### Creator and status filters
|
|
152
|
-
|
|
153
|
-
Creator filters require `propertyId` to identify an actual database property of type `created_by`.
|
|
154
|
-
The `created_by` filter branch selects the property type, while `propertyId` addresses the column.
|
|
153
|
+
#### Creator, editor, and status filters
|
|
155
154
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
`created_by` and `last_edited_by` use People operators. Group operands match exact identities, not
|
|
156
|
+
members of the group. Bot actors count as present for empty checks. Older hosts reject
|
|
157
|
+
`last_edited_by` and group operands in `created_by` filters.
|
|
159
158
|
|
|
160
159
|
Status filters support option operators and stored group names. Group operators accept one name or
|
|
161
160
|
an array of 1–5 names. Hosts must validate each name against the bound Status property.
|
|
@@ -183,21 +182,23 @@ filter: {
|
|
|
183
182
|
}
|
|
184
183
|
```
|
|
185
184
|
|
|
186
|
-
|
|
185
|
+
`created_time` and `last_edited_time` use Date operators without `target`: timestamps have no end
|
|
186
|
+
date.
|
|
187
|
+
|
|
188
|
+
## Grants
|
|
187
189
|
|
|
188
|
-
`manifest.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
predates approval.
|
|
190
|
+
`manifest.grants` lists `{ action, resource }` declarations. `action` is an open string and
|
|
191
|
+
`resource` is an open string or a non-empty array of them, so a newer vocabulary never makes an
|
|
192
|
+
older receiver reject a manifest. An array applies the action to each element. Receivers never split
|
|
193
|
+
a resource string on commas. An omitted `grants` marks a block that predates approval.
|
|
193
194
|
|
|
194
|
-
|
|
195
|
+
Resources for page actions can name one manifest data source as `data_source:<key>`. The key is the
|
|
195
196
|
semantic key from `manifest.dataSources`; hosts resolve it to the bound data source when they record
|
|
196
197
|
and check grants. Bare `data_source` covers every declared key.
|
|
197
198
|
|
|
198
|
-
The `
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
The `not_granted` error code is reserved for a request that the viewer's grants do not cover, with
|
|
200
|
+
`isRetryable: false`. No adapter sends it yet, and no receiver restricts requests by grant. The
|
|
201
|
+
SDK's grants guide documents the vocabulary.
|
|
201
202
|
|
|
202
203
|
## Page context
|
|
203
204
|
|
package/docs/data-sources.md
CHANGED
|
@@ -77,10 +77,12 @@ property keys to property IDs before it sends the query. Empty values stay last
|
|
|
77
77
|
Date-only and zone-less datetime values sort using UTC. Datetime values with a `time_zone` use that
|
|
78
78
|
named zone, and an explicit offset in `start_time` wins.
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
Created time and Last edited time values accept ISO timestamp strings or the sample `date` shapes
|
|
81
|
+
above.
|
|
82
|
+
|
|
83
|
+
People, Created by, and Last edited by sorts use record IDs as mock display names. People sorts
|
|
84
|
+
preserve pointer order and remove duplicates. Groups use their composite group and workspace IDs.
|
|
85
|
+
The dev shell uses `en-US` collation. Notion uses resolved display names and the user’s locale.
|
|
84
86
|
|
|
85
87
|
Status group filters use each Status property's `options` and `groups`. Group `option_ids` must
|
|
86
88
|
reference option IDs from the same property.
|