@notionhq/custom-blocks-dev-shell 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -23
- package/data/customers.json +10 -20
- package/data/meetings.json +51 -102
- package/data/projects.json +28 -42
- package/data/tasks.json +33 -66
- package/dist/assets/index-Dhs3H2Yo.js +12 -0
- package/dist/index.html +1 -1
- package/dist-cli/cli/published-cli.js +1717 -471
- package/docs/bindings.md +25 -24
- package/docs/data-sources.md +41 -19
- package/package.json +1 -1
- package/dist/assets/index-B1RObNc_.js +0 -12
|
@@ -492,6 +492,22 @@ function looseObject(entries$1, message$1) {
|
|
|
492
492
|
});
|
|
493
493
|
}
|
|
494
494
|
// @__NO_SIDE_EFFECTS__
|
|
495
|
+
function nan(message$1) {
|
|
496
|
+
return _standardSchema({
|
|
497
|
+
kind: "schema",
|
|
498
|
+
type: "nan",
|
|
499
|
+
reference: nan,
|
|
500
|
+
expects: "NaN",
|
|
501
|
+
async: false,
|
|
502
|
+
message: message$1,
|
|
503
|
+
"~run"(dataset, config$1) {
|
|
504
|
+
if (Number.isNaN(dataset.value)) dataset.typed = true;
|
|
505
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
506
|
+
return dataset;
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
// @__NO_SIDE_EFFECTS__
|
|
495
511
|
function never(message$1) {
|
|
496
512
|
return _standardSchema({
|
|
497
513
|
kind: "schema",
|
|
@@ -524,6 +540,22 @@ function nonOptional(wrapped, message$1) {
|
|
|
524
540
|
});
|
|
525
541
|
}
|
|
526
542
|
// @__NO_SIDE_EFFECTS__
|
|
543
|
+
function null_(message$1) {
|
|
544
|
+
return _standardSchema({
|
|
545
|
+
kind: "schema",
|
|
546
|
+
type: "null",
|
|
547
|
+
reference: null_,
|
|
548
|
+
expects: "null",
|
|
549
|
+
async: false,
|
|
550
|
+
message: message$1,
|
|
551
|
+
"~run"(dataset, config$1) {
|
|
552
|
+
if (dataset.value === null) dataset.typed = true;
|
|
553
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
554
|
+
return dataset;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
// @__NO_SIDE_EFFECTS__
|
|
527
559
|
function nullable(wrapped, default_) {
|
|
528
560
|
return _standardSchema({
|
|
529
561
|
kind: "schema",
|
|
@@ -960,6 +992,15 @@ function parse(schema, input, config$1) {
|
|
|
960
992
|
return dataset.value;
|
|
961
993
|
}
|
|
962
994
|
// @__NO_SIDE_EFFECTS__
|
|
995
|
+
function partial(schema, keys) {
|
|
996
|
+
const entries$1 = {};
|
|
997
|
+
for (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
|
|
998
|
+
return _standardSchema({
|
|
999
|
+
...schema,
|
|
1000
|
+
entries: entries$1
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
// @__NO_SIDE_EFFECTS__
|
|
963
1004
|
function pipe(...pipe$1) {
|
|
964
1005
|
return _standardSchema({
|
|
965
1006
|
...pipe$1[0],
|
|
@@ -998,6 +1039,17 @@ function safeParse(schema, input, config$1) {
|
|
|
998
1039
|
};
|
|
999
1040
|
}
|
|
1000
1041
|
|
|
1042
|
+
// ../protocol/src/utils/unknownPropertyTypeSchema.ts
|
|
1043
|
+
var unknownPropertyTypeSchema = pipe(
|
|
1044
|
+
string(),
|
|
1045
|
+
minLength(1),
|
|
1046
|
+
check(
|
|
1047
|
+
(type) => type !== "unknown" && // Reserved for the placeholder's `type`. `originalType` carries the source type.
|
|
1048
|
+
// These values exist in Notion but are unsupported in custom blocks.
|
|
1049
|
+
type !== "last_visited_time" && type !== "location"
|
|
1050
|
+
)
|
|
1051
|
+
);
|
|
1052
|
+
|
|
1001
1053
|
// ../protocol/src/dataSources/properties/propertySchema.ts
|
|
1002
1054
|
var knownNotionPropertyColorSchema = picklist([
|
|
1003
1055
|
"default",
|
|
@@ -1028,13 +1080,13 @@ var notionPropertyOptionSchema = object({
|
|
|
1028
1080
|
color: optional(notionPropertyColorSchema),
|
|
1029
1081
|
description: optional(string())
|
|
1030
1082
|
});
|
|
1031
|
-
var
|
|
1083
|
+
var bridgeStatusGroupSchema = object({
|
|
1032
1084
|
id: string(),
|
|
1033
1085
|
name: string(),
|
|
1034
1086
|
color: optional(notionPropertyColorSchema),
|
|
1035
1087
|
option_ids: array(string())
|
|
1036
1088
|
});
|
|
1037
|
-
var
|
|
1089
|
+
var bridgeDualPropertySchema = object({
|
|
1038
1090
|
synced_property_id: string(),
|
|
1039
1091
|
synced_property_name: string()
|
|
1040
1092
|
});
|
|
@@ -1069,7 +1121,22 @@ var NOTION_PROPERTY_TYPES = [
|
|
|
1069
1121
|
"last_edited_by"
|
|
1070
1122
|
];
|
|
1071
1123
|
var notionPropertyTypeSchema = picklist(NOTION_PROPERTY_TYPES);
|
|
1072
|
-
var
|
|
1124
|
+
var CUSTOM_BLOCK_DATA_SOURCE_SORTABLE_PROPERTY_TYPES = [
|
|
1125
|
+
"title",
|
|
1126
|
+
"rich_text",
|
|
1127
|
+
"number",
|
|
1128
|
+
"checkbox",
|
|
1129
|
+
"url",
|
|
1130
|
+
"email",
|
|
1131
|
+
"phone_number",
|
|
1132
|
+
"date",
|
|
1133
|
+
"created_time",
|
|
1134
|
+
"last_edited_time",
|
|
1135
|
+
"people",
|
|
1136
|
+
"created_by",
|
|
1137
|
+
"last_edited_by"
|
|
1138
|
+
];
|
|
1139
|
+
var knownBridgePropertySchema = variant("type", [
|
|
1073
1140
|
object({ ...baseProp.entries, type: literal("title") }),
|
|
1074
1141
|
object({ ...baseProp.entries, type: literal("rich_text") }),
|
|
1075
1142
|
object({ ...baseProp.entries, type: literal("number") }),
|
|
@@ -1091,7 +1158,7 @@ var notionPropertySchemaSchema = variant("type", [
|
|
|
1091
1158
|
...baseProp.entries,
|
|
1092
1159
|
type: literal("status"),
|
|
1093
1160
|
options: array(notionPropertyOptionSchema),
|
|
1094
|
-
groups: array(
|
|
1161
|
+
groups: array(bridgeStatusGroupSchema)
|
|
1095
1162
|
}),
|
|
1096
1163
|
object({ ...baseProp.entries, type: literal("date") }),
|
|
1097
1164
|
object({ ...baseProp.entries, type: literal("people") }),
|
|
@@ -1101,7 +1168,7 @@ var notionPropertySchemaSchema = variant("type", [
|
|
|
1101
1168
|
...baseProp.entries,
|
|
1102
1169
|
type: literal("relation"),
|
|
1103
1170
|
data_source_id: optional(string()),
|
|
1104
|
-
dual_property: optional(
|
|
1171
|
+
dual_property: optional(bridgeDualPropertySchema)
|
|
1105
1172
|
}),
|
|
1106
1173
|
object({ ...baseProp.entries, type: literal("place") }),
|
|
1107
1174
|
object({ ...baseProp.entries, type: literal("formula") }),
|
|
@@ -1115,6 +1182,28 @@ var notionPropertySchemaSchema = variant("type", [
|
|
|
1115
1182
|
object({ ...baseProp.entries, type: literal("created_by") }),
|
|
1116
1183
|
object({ ...baseProp.entries, type: literal("last_edited_by") })
|
|
1117
1184
|
]);
|
|
1185
|
+
var bridgeUnknownPropertySchema = object({
|
|
1186
|
+
...baseProp.entries,
|
|
1187
|
+
type: literal("unknown"),
|
|
1188
|
+
originalType: unknownPropertyTypeSchema
|
|
1189
|
+
});
|
|
1190
|
+
var futurePropertySchema = pipe(
|
|
1191
|
+
object({ ...baseProp.entries, type: unknownPropertyTypeSchema }),
|
|
1192
|
+
check(({ type }) => !is(notionPropertyTypeSchema, type)),
|
|
1193
|
+
transform(
|
|
1194
|
+
({ name, description, type }) => ({
|
|
1195
|
+
name,
|
|
1196
|
+
description,
|
|
1197
|
+
type: "unknown",
|
|
1198
|
+
originalType: type
|
|
1199
|
+
})
|
|
1200
|
+
)
|
|
1201
|
+
);
|
|
1202
|
+
var bridgePropertySchema = union([
|
|
1203
|
+
knownBridgePropertySchema,
|
|
1204
|
+
bridgeUnknownPropertySchema,
|
|
1205
|
+
futurePropertySchema
|
|
1206
|
+
]);
|
|
1118
1207
|
|
|
1119
1208
|
// ../protocol/src/manifest/grants.ts
|
|
1120
1209
|
var customBlockGrantSchema = object({
|
|
@@ -1305,10 +1394,24 @@ var pageParentSchema = object({
|
|
|
1305
1394
|
type: literal("page_id"),
|
|
1306
1395
|
page_id: notionPageIdSchema
|
|
1307
1396
|
});
|
|
1397
|
+
var pageKeyParentSchema = strictObject({
|
|
1398
|
+
type: literal("page_key"),
|
|
1399
|
+
pageKey: string()
|
|
1400
|
+
});
|
|
1401
|
+
var pageKindParentSchema = strictObject({
|
|
1402
|
+
type: literal("page")
|
|
1403
|
+
});
|
|
1308
1404
|
var dataSourceParentSchema = object({
|
|
1309
1405
|
type: literal("data_source_id"),
|
|
1310
1406
|
data_source_id: notionDataSourceIdSchema
|
|
1311
1407
|
});
|
|
1408
|
+
var dataSourceKeyParentSchema = strictObject({
|
|
1409
|
+
type: literal("data_source_key"),
|
|
1410
|
+
key: string()
|
|
1411
|
+
});
|
|
1412
|
+
var dataSourceKindParentSchema = strictObject({
|
|
1413
|
+
type: literal("data_source")
|
|
1414
|
+
});
|
|
1312
1415
|
var workspaceParentSchema = object({
|
|
1313
1416
|
type: literal("workspace"),
|
|
1314
1417
|
workspace: literal(true)
|
|
@@ -1326,7 +1429,7 @@ var appInstallationParentSchema = object({
|
|
|
1326
1429
|
app_installation_id: notionAppInstallationIdSchema
|
|
1327
1430
|
});
|
|
1328
1431
|
var unavailableParentSchema = object({ type: literal("unavailable") });
|
|
1329
|
-
var
|
|
1432
|
+
var parentThroughProtocol13Schema = variant("type", [
|
|
1330
1433
|
pageParentSchema,
|
|
1331
1434
|
dataSourceParentSchema,
|
|
1332
1435
|
workspaceParentSchema,
|
|
@@ -1335,6 +1438,13 @@ var notionParentSchema = variant("type", [
|
|
|
1335
1438
|
appInstallationParentSchema,
|
|
1336
1439
|
unavailableParentSchema
|
|
1337
1440
|
]);
|
|
1441
|
+
var notionParentSchema = variant("type", [
|
|
1442
|
+
...parentThroughProtocol13Schema.options,
|
|
1443
|
+
pageKeyParentSchema,
|
|
1444
|
+
pageKindParentSchema,
|
|
1445
|
+
dataSourceKindParentSchema,
|
|
1446
|
+
dataSourceKeyParentSchema
|
|
1447
|
+
]);
|
|
1338
1448
|
|
|
1339
1449
|
// ../protocol/src/dataSources/dataSourcePointer.ts
|
|
1340
1450
|
var dataSourcePointerValidator = object({
|
|
@@ -1344,15 +1454,18 @@ var dataSourcePointerValidator = object({
|
|
|
1344
1454
|
});
|
|
1345
1455
|
|
|
1346
1456
|
// ../protocol/src/dataSources/dataSourceSchema.ts
|
|
1347
|
-
var
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1457
|
+
var bridgeDataSourceSchemaValidator = makeNotionDataSourceSchemaValidator(bridgePropertySchema);
|
|
1458
|
+
function makeNotionDataSourceSchemaValidator(propertySchema) {
|
|
1459
|
+
return object({
|
|
1460
|
+
id: optional(notionDataSourceIdSchema),
|
|
1461
|
+
/**
|
|
1462
|
+
* Describes actual database properties in protocol 5. Protocol 3/4 payloads can also include
|
|
1463
|
+
* synthetic metadata for compatibility. Use this map to resolve property bindings. Use this map
|
|
1464
|
+
* to validate filter and sort references.
|
|
1465
|
+
*/
|
|
1466
|
+
propertiesById: record(string(), propertySchema)
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1356
1469
|
|
|
1357
1470
|
// ../protocol/src/dataSources/bridgeDataSourceBinding.ts
|
|
1358
1471
|
var bridgeDataSourceBindingSchema = object({
|
|
@@ -1362,7 +1475,7 @@ var bridgeDataSourceBindingSchema = object({
|
|
|
1362
1475
|
* schema to validate filter and sort references. Undefined when the host does not provide a
|
|
1363
1476
|
* database schema.
|
|
1364
1477
|
*/
|
|
1365
|
-
dataSourceSchema: optional(
|
|
1478
|
+
dataSourceSchema: optional(bridgeDataSourceSchemaValidator),
|
|
1366
1479
|
/**
|
|
1367
1480
|
* Maps user-defined property keys to database property IDs. Use this map to resolve a key
|
|
1368
1481
|
* such as `name` to its database property ID. A value of `undefined` marks a declared
|
|
@@ -1442,7 +1555,7 @@ var protocol3To11ContainingPageSchema = variant("type", [
|
|
|
1442
1555
|
object({
|
|
1443
1556
|
type: literal("page"),
|
|
1444
1557
|
id: notionPageIdSchema,
|
|
1445
|
-
parent:
|
|
1558
|
+
parent: parentThroughProtocol13Schema
|
|
1446
1559
|
})
|
|
1447
1560
|
]);
|
|
1448
1561
|
var protocol3To11PageChangedMessageSchema = object({
|
|
@@ -1458,7 +1571,7 @@ var protocol3To11InitSuccessMessageSchema = object({
|
|
|
1458
1571
|
theme: notionThemeSchema,
|
|
1459
1572
|
contrastMode: notionContrastModeSchema,
|
|
1460
1573
|
blockId: notionBlockIdSchema,
|
|
1461
|
-
parent:
|
|
1574
|
+
parent: parentThroughProtocol13Schema,
|
|
1462
1575
|
page: protocol3To11ContainingPageSchema,
|
|
1463
1576
|
manifest: manifestSchema,
|
|
1464
1577
|
dataSources: object({
|
|
@@ -1538,11 +1651,19 @@ var containingPageSchema = variant("type", [
|
|
|
1538
1651
|
)
|
|
1539
1652
|
})
|
|
1540
1653
|
]);
|
|
1654
|
+
var containingPageContextSchema = variant("type", [
|
|
1655
|
+
strictObject({ type: literal("unavailable") }),
|
|
1656
|
+
strictObject({
|
|
1657
|
+
type: literal("page"),
|
|
1658
|
+
parent: notionParentSchema,
|
|
1659
|
+
displayMode: containingPageSchema.options[1].entries.displayMode
|
|
1660
|
+
})
|
|
1661
|
+
]);
|
|
1541
1662
|
|
|
1542
1663
|
// ../protocol/src/context/messages/pageChanged.ts
|
|
1543
1664
|
var pageChangedMessageSchema = object({
|
|
1544
1665
|
type: literal("pageChanged"),
|
|
1545
|
-
page:
|
|
1666
|
+
page: containingPageContextSchema
|
|
1546
1667
|
});
|
|
1547
1668
|
|
|
1548
1669
|
// ../protocol/src/context/messages/pageError.ts
|
|
@@ -1569,32 +1690,6 @@ var themeChangedMessageSchema = object({
|
|
|
1569
1690
|
theme: notionThemeSchema
|
|
1570
1691
|
});
|
|
1571
1692
|
|
|
1572
|
-
// ../protocol/src/dataSources/messages/getDataSource.ts
|
|
1573
|
-
var getDataSourceMessageSchema = object({
|
|
1574
|
-
type: literal("getDataSource"),
|
|
1575
|
-
requestId: string(),
|
|
1576
|
-
key: string()
|
|
1577
|
-
});
|
|
1578
|
-
var getDataSourceResultMessageSchema = variant("status", [
|
|
1579
|
-
object({
|
|
1580
|
-
type: literal("getDataSourceResult"),
|
|
1581
|
-
requestId: string(),
|
|
1582
|
-
status: literal("success"),
|
|
1583
|
-
binding: required(
|
|
1584
|
-
omit(bridgeDataSourceBindingSchema, ["inaccessible"])
|
|
1585
|
-
)
|
|
1586
|
-
}),
|
|
1587
|
-
object({
|
|
1588
|
-
type: literal("getDataSourceResult"),
|
|
1589
|
-
requestId: string(),
|
|
1590
|
-
status: literal("error"),
|
|
1591
|
-
error: customBlockErrorInfoSchema
|
|
1592
|
-
})
|
|
1593
|
-
]);
|
|
1594
|
-
var dataSourcesInvalidatedMessageSchema = object({
|
|
1595
|
-
type: literal("dataSourcesInvalidated")
|
|
1596
|
-
});
|
|
1597
|
-
|
|
1598
1693
|
// ../protocol/src/files.ts
|
|
1599
1694
|
var bridgeExternalFileSchema = object({
|
|
1600
1695
|
type: literal("external"),
|
|
@@ -1671,10 +1766,86 @@ var bridgePageCoverSchema = variant("type", [
|
|
|
1671
1766
|
bridgeNotionHostedFileSchema
|
|
1672
1767
|
]);
|
|
1673
1768
|
|
|
1769
|
+
// ../protocol/src/dataSources/messages/dataSourceChanged.ts
|
|
1770
|
+
var sourcePropertySchema = pipe(
|
|
1771
|
+
bridgePropertySchema,
|
|
1772
|
+
transform((property) => {
|
|
1773
|
+
if (property.type !== "relation") {
|
|
1774
|
+
return property;
|
|
1775
|
+
}
|
|
1776
|
+
const { data_source_id: _dataSourceId2, ...definition } = property;
|
|
1777
|
+
return definition;
|
|
1778
|
+
})
|
|
1779
|
+
);
|
|
1780
|
+
var availableDataSourceSnapshotSchema = strictObject({
|
|
1781
|
+
type: literal("available"),
|
|
1782
|
+
propertiesById: record(string(), sourcePropertySchema),
|
|
1783
|
+
propertyIdsByKey: record(string(), optional(string())),
|
|
1784
|
+
title: optional(string()),
|
|
1785
|
+
description: optional(string()),
|
|
1786
|
+
icon: optional(bridgePageIconSchema)
|
|
1787
|
+
});
|
|
1788
|
+
var dataSourceSnapshotSchema = union([
|
|
1789
|
+
availableDataSourceSnapshotSchema,
|
|
1790
|
+
strictObject({ type: literal("not_bound") }),
|
|
1791
|
+
strictObject({ type: literal("unavailable") }),
|
|
1792
|
+
strictObject({
|
|
1793
|
+
type: literal("error"),
|
|
1794
|
+
error: customBlockErrorInfoSchema
|
|
1795
|
+
})
|
|
1796
|
+
]);
|
|
1797
|
+
var dataSourceChangedMessageSchema = object({
|
|
1798
|
+
type: literal("dataSourceChanged"),
|
|
1799
|
+
key: string(),
|
|
1800
|
+
snapshot: union([
|
|
1801
|
+
dataSourceSnapshotSchema,
|
|
1802
|
+
strictObject({ type: literal("loading") })
|
|
1803
|
+
])
|
|
1804
|
+
});
|
|
1805
|
+
|
|
1806
|
+
// ../protocol/src/utils/recordPointer.ts
|
|
1807
|
+
var notionRecordPointerSchema = object({
|
|
1808
|
+
id: string(),
|
|
1809
|
+
table: string()
|
|
1810
|
+
});
|
|
1811
|
+
|
|
1812
|
+
// ../protocol/src/pages/properties/actor.ts
|
|
1813
|
+
var bridgeActorSchema = object({
|
|
1814
|
+
...notionRecordPointerSchema.entries,
|
|
1815
|
+
spaceId: optional(string())
|
|
1816
|
+
});
|
|
1817
|
+
|
|
1818
|
+
// ../protocol/src/compatibility/pageTextPropertySchemas.ts
|
|
1819
|
+
var textUniqueIdPropertySchema = object({
|
|
1820
|
+
id: string(),
|
|
1821
|
+
type: literal("unique_id"),
|
|
1822
|
+
unique_id: string()
|
|
1823
|
+
});
|
|
1824
|
+
var textVerificationPropertySchema = object({
|
|
1825
|
+
id: string(),
|
|
1826
|
+
type: literal("verification"),
|
|
1827
|
+
verification: string()
|
|
1828
|
+
});
|
|
1829
|
+
|
|
1674
1830
|
// ../protocol/src/utils/nullableStringSchema.ts
|
|
1675
1831
|
var nullableStringSchema = nullable(string());
|
|
1676
1832
|
|
|
1677
|
-
// ../protocol/src/
|
|
1833
|
+
// ../protocol/src/pages/pageAddress.ts
|
|
1834
|
+
var pageReadTargetSchema = variant("type", [
|
|
1835
|
+
strictObject({ type: literal("page_key"), pageKey: string() }),
|
|
1836
|
+
strictObject({
|
|
1837
|
+
type: literal("data_source_descendant"),
|
|
1838
|
+
dataSourceKey: string(),
|
|
1839
|
+
pageId: notionPageIdSchema
|
|
1840
|
+
}),
|
|
1841
|
+
strictObject({ type: literal("containing_page") })
|
|
1842
|
+
]);
|
|
1843
|
+
var pageAddressSchema = variant("type", [
|
|
1844
|
+
...pageReadTargetSchema.options,
|
|
1845
|
+
strictObject({ type: literal("page_id"), pageId: notionPageIdSchema })
|
|
1846
|
+
]);
|
|
1847
|
+
|
|
1848
|
+
// ../protocol/src/dataSources/properties/dateReminders.ts
|
|
1678
1849
|
var notionDateReminderSchema = object({
|
|
1679
1850
|
unit: picklist(["year", "month", "week", "day"]),
|
|
1680
1851
|
value: number(),
|
|
@@ -1692,48 +1863,9 @@ var notionDateTimeReminderSchema = union([
|
|
|
1692
1863
|
notionDateReminderSchema,
|
|
1693
1864
|
notionTimeReminderSchema
|
|
1694
1865
|
]);
|
|
1695
|
-
var dateOrDisabledReminder = optional(
|
|
1696
|
-
union([notionDateReminderSchema, notionDisabledReminderSchema])
|
|
1697
|
-
);
|
|
1698
|
-
var dateTimeOrDisabledReminder = optional(
|
|
1699
|
-
union([notionDateTimeReminderSchema, notionDisabledReminderSchema])
|
|
1700
|
-
);
|
|
1701
|
-
var notionDateSchema = object({
|
|
1702
|
-
type: literal("date"),
|
|
1703
|
-
start_date: string(),
|
|
1704
|
-
reminder: dateOrDisabledReminder
|
|
1705
|
-
});
|
|
1706
|
-
var notionDateRangeSchema = object({
|
|
1707
|
-
type: literal("daterange"),
|
|
1708
|
-
start_date: string(),
|
|
1709
|
-
end_date: string(),
|
|
1710
|
-
reminder: dateOrDisabledReminder
|
|
1711
|
-
});
|
|
1712
|
-
var notionDateTimeSchema = object({
|
|
1713
|
-
type: literal("datetime"),
|
|
1714
|
-
start_date: string(),
|
|
1715
|
-
start_time: string(),
|
|
1716
|
-
time_zone: optional(string()),
|
|
1717
|
-
reminder: dateTimeOrDisabledReminder
|
|
1718
|
-
});
|
|
1719
|
-
var notionDateTimeRangeSchema = object({
|
|
1720
|
-
type: literal("datetimerange"),
|
|
1721
|
-
start_date: string(),
|
|
1722
|
-
start_time: string(),
|
|
1723
|
-
end_date: string(),
|
|
1724
|
-
end_time: string(),
|
|
1725
|
-
time_zone: optional(string()),
|
|
1726
|
-
reminder: dateTimeOrDisabledReminder
|
|
1727
|
-
});
|
|
1728
|
-
var notionDateValueSchema = variant("type", [
|
|
1729
|
-
notionDateSchema,
|
|
1730
|
-
notionDateRangeSchema,
|
|
1731
|
-
notionDateTimeSchema,
|
|
1732
|
-
notionDateTimeRangeSchema
|
|
1733
|
-
]);
|
|
1734
1866
|
|
|
1735
|
-
// ../protocol/src/pages/properties/
|
|
1736
|
-
var
|
|
1867
|
+
// ../protocol/src/pages/properties/date.ts
|
|
1868
|
+
var dateEntries = {
|
|
1737
1869
|
start: string(),
|
|
1738
1870
|
end: optional(nullableStringSchema),
|
|
1739
1871
|
time_zone: optional(nullableStringSchema),
|
|
@@ -1741,39 +1873,38 @@ var dateInputEntries = {
|
|
|
1741
1873
|
union([notionDateTimeReminderSchema, notionDisabledReminderSchema])
|
|
1742
1874
|
)
|
|
1743
1875
|
};
|
|
1744
|
-
var
|
|
1876
|
+
var bridgeDateSchema = union([
|
|
1745
1877
|
object({
|
|
1746
|
-
...
|
|
1878
|
+
...dateEntries,
|
|
1747
1879
|
start: pipe(string(), includes("T"))
|
|
1748
1880
|
}),
|
|
1749
1881
|
object({
|
|
1750
|
-
...
|
|
1882
|
+
...dateEntries,
|
|
1751
1883
|
time_zone: string()
|
|
1752
1884
|
}),
|
|
1753
1885
|
object({
|
|
1754
|
-
...
|
|
1886
|
+
...dateEntries,
|
|
1755
1887
|
reminder: optional(
|
|
1756
1888
|
union([notionDateReminderSchema, notionDisabledReminderSchema])
|
|
1757
1889
|
)
|
|
1758
1890
|
})
|
|
1759
1891
|
]);
|
|
1760
1892
|
|
|
1761
|
-
// ../protocol/src/
|
|
1762
|
-
var
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
// ../protocol/src/pages/properties/metadataActor.ts
|
|
1768
|
-
var metadataActorSchema = nullable(
|
|
1893
|
+
// ../protocol/src/pages/properties/personItem.ts
|
|
1894
|
+
var bridgePersonItemSchema = union([
|
|
1895
|
+
object({
|
|
1896
|
+
object: optional(literal("user")),
|
|
1897
|
+
id: string()
|
|
1898
|
+
}),
|
|
1769
1899
|
object({
|
|
1770
|
-
|
|
1771
|
-
|
|
1900
|
+
object: literal("group"),
|
|
1901
|
+
id: string(),
|
|
1902
|
+
name: optional(nullableStringSchema)
|
|
1772
1903
|
})
|
|
1773
|
-
);
|
|
1904
|
+
]);
|
|
1774
1905
|
|
|
1775
|
-
// ../protocol/src/pages/properties/
|
|
1776
|
-
var
|
|
1906
|
+
// ../protocol/src/pages/properties/place.ts
|
|
1907
|
+
var bridgePlaceSchema = object({
|
|
1777
1908
|
lat: number(),
|
|
1778
1909
|
lon: number(),
|
|
1779
1910
|
name: optional(nullableStringSchema),
|
|
@@ -1782,14 +1913,14 @@ var notionPlaceInputSchema = object({
|
|
|
1782
1913
|
google_place_id: optional(nullableStringSchema)
|
|
1783
1914
|
});
|
|
1784
1915
|
|
|
1785
|
-
// ../protocol/src/pages/properties/
|
|
1786
|
-
var
|
|
1916
|
+
// ../protocol/src/pages/properties/relationItem.ts
|
|
1917
|
+
var bridgeRelationItemSchema = object({ id: string() });
|
|
1787
1918
|
|
|
1788
1919
|
// ../protocol/src/pages/properties/richText.ts
|
|
1789
|
-
var
|
|
1920
|
+
var bridgeRichTextItemSchema = record(string(), unknown());
|
|
1790
1921
|
|
|
1791
1922
|
// ../protocol/src/pages/properties/selectOption.ts
|
|
1792
|
-
var
|
|
1923
|
+
var bridgeSelectOptionSchema = union([
|
|
1793
1924
|
object({
|
|
1794
1925
|
id: string(),
|
|
1795
1926
|
name: optional(string()),
|
|
@@ -1804,31 +1935,22 @@ var notionSelectOptionInputSchema = union([
|
|
|
1804
1935
|
})
|
|
1805
1936
|
]);
|
|
1806
1937
|
|
|
1807
|
-
// ../protocol/src/pages/properties/userInput.ts
|
|
1808
|
-
var notionUserInputSchema = union([
|
|
1809
|
-
object({
|
|
1810
|
-
object: optional(literal("user")),
|
|
1811
|
-
id: string()
|
|
1812
|
-
}),
|
|
1813
|
-
object({
|
|
1814
|
-
object: literal("group"),
|
|
1815
|
-
id: string(),
|
|
1816
|
-
name: optional(nullableStringSchema)
|
|
1817
|
-
})
|
|
1818
|
-
]);
|
|
1819
|
-
|
|
1820
1938
|
// ../protocol/src/pages/properties/bridgePagePropertyValue.ts
|
|
1821
|
-
var pagePropertyBaseSchema = {
|
|
1822
|
-
|
|
1939
|
+
var pagePropertyBaseSchema = {
|
|
1940
|
+
id: string(),
|
|
1941
|
+
/** Readable values omit `restricted`. Only restricted values set it, to `true`. */
|
|
1942
|
+
restricted: optional(literal(false))
|
|
1943
|
+
};
|
|
1944
|
+
var commonPagePropertySchemas = [
|
|
1823
1945
|
object({
|
|
1824
1946
|
...pagePropertyBaseSchema,
|
|
1825
1947
|
type: literal("title"),
|
|
1826
|
-
title: array(
|
|
1948
|
+
title: array(bridgeRichTextItemSchema)
|
|
1827
1949
|
}),
|
|
1828
1950
|
object({
|
|
1829
1951
|
...pagePropertyBaseSchema,
|
|
1830
1952
|
type: literal("rich_text"),
|
|
1831
|
-
rich_text: array(
|
|
1953
|
+
rich_text: array(bridgeRichTextItemSchema)
|
|
1832
1954
|
}),
|
|
1833
1955
|
object({
|
|
1834
1956
|
...pagePropertyBaseSchema,
|
|
@@ -1858,38 +1980,38 @@ var basePropertySchemas = [
|
|
|
1858
1980
|
object({
|
|
1859
1981
|
...pagePropertyBaseSchema,
|
|
1860
1982
|
type: literal("select"),
|
|
1861
|
-
select: nullable(
|
|
1983
|
+
select: nullable(bridgeSelectOptionSchema)
|
|
1862
1984
|
}),
|
|
1863
1985
|
object({
|
|
1864
1986
|
...pagePropertyBaseSchema,
|
|
1865
1987
|
type: literal("status"),
|
|
1866
|
-
status: nullable(
|
|
1988
|
+
status: nullable(bridgeSelectOptionSchema)
|
|
1867
1989
|
}),
|
|
1868
1990
|
object({
|
|
1869
1991
|
...pagePropertyBaseSchema,
|
|
1870
1992
|
type: literal("multi_select"),
|
|
1871
|
-
multi_select: array(
|
|
1993
|
+
multi_select: array(bridgeSelectOptionSchema)
|
|
1872
1994
|
}),
|
|
1873
1995
|
object({
|
|
1874
1996
|
...pagePropertyBaseSchema,
|
|
1875
1997
|
type: literal("date"),
|
|
1876
|
-
date: nullable(
|
|
1998
|
+
date: nullable(bridgeDateSchema)
|
|
1877
1999
|
}),
|
|
1878
2000
|
object({
|
|
1879
2001
|
...pagePropertyBaseSchema,
|
|
1880
2002
|
type: literal("people"),
|
|
1881
|
-
people: array(
|
|
2003
|
+
people: array(bridgePersonItemSchema)
|
|
1882
2004
|
}),
|
|
1883
2005
|
object({
|
|
1884
2006
|
...pagePropertyBaseSchema,
|
|
1885
2007
|
type: literal("relation"),
|
|
1886
2008
|
has_more: optional(boolean()),
|
|
1887
|
-
relation: array(
|
|
2009
|
+
relation: array(bridgeRelationItemSchema)
|
|
1888
2010
|
}),
|
|
1889
2011
|
object({
|
|
1890
2012
|
...pagePropertyBaseSchema,
|
|
1891
2013
|
type: literal("place"),
|
|
1892
|
-
place: nullable(
|
|
2014
|
+
place: nullable(bridgePlaceSchema)
|
|
1893
2015
|
}),
|
|
1894
2016
|
object({
|
|
1895
2017
|
...pagePropertyBaseSchema,
|
|
@@ -1904,17 +2026,12 @@ var basePropertySchemas = [
|
|
|
1904
2026
|
object({
|
|
1905
2027
|
...pagePropertyBaseSchema,
|
|
1906
2028
|
type: literal("created_by"),
|
|
1907
|
-
created_by:
|
|
2029
|
+
created_by: nullable(bridgeActorSchema)
|
|
1908
2030
|
}),
|
|
1909
2031
|
object({
|
|
1910
2032
|
...pagePropertyBaseSchema,
|
|
1911
2033
|
type: literal("last_edited_by"),
|
|
1912
|
-
last_edited_by:
|
|
1913
|
-
}),
|
|
1914
|
-
object({
|
|
1915
|
-
...pagePropertyBaseSchema,
|
|
1916
|
-
type: literal("unique_id"),
|
|
1917
|
-
unique_id: string()
|
|
2034
|
+
last_edited_by: nullable(bridgeActorSchema)
|
|
1918
2035
|
}),
|
|
1919
2036
|
object({
|
|
1920
2037
|
...pagePropertyBaseSchema,
|
|
@@ -1930,71 +2047,289 @@ var basePropertySchemas = [
|
|
|
1930
2047
|
...pagePropertyBaseSchema,
|
|
1931
2048
|
type: literal("rollup"),
|
|
1932
2049
|
rollup: string()
|
|
1933
|
-
}),
|
|
1934
|
-
object({
|
|
1935
|
-
...pagePropertyBaseSchema,
|
|
1936
|
-
type: literal("verification"),
|
|
1937
|
-
verification: string()
|
|
1938
2050
|
})
|
|
1939
2051
|
];
|
|
2052
|
+
var bridgeFilesPropertyWriteValueSchema = object({
|
|
2053
|
+
...pagePropertyBaseSchema,
|
|
2054
|
+
type: literal("files"),
|
|
2055
|
+
files: array(bridgeFilePropertyItemSchema)
|
|
2056
|
+
});
|
|
1940
2057
|
var bridgePagePropertyWriteValueSchema = variant("type", [
|
|
1941
|
-
...
|
|
2058
|
+
...commonPagePropertySchemas,
|
|
1942
2059
|
object({
|
|
1943
|
-
...
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
2060
|
+
...textUniqueIdPropertySchema.entries,
|
|
2061
|
+
restricted: optional(literal(false))
|
|
2062
|
+
}),
|
|
2063
|
+
object({
|
|
2064
|
+
...textVerificationPropertySchema.entries,
|
|
2065
|
+
restricted: optional(literal(false))
|
|
2066
|
+
}),
|
|
2067
|
+
bridgeFilesPropertyWriteValueSchema
|
|
2068
|
+
]);
|
|
2069
|
+
var addressedRelationEntries = {
|
|
2070
|
+
type: literal("relation"),
|
|
2071
|
+
has_more: optional(boolean()),
|
|
2072
|
+
relation: array(union([bridgeRelationItemSchema, pageAddressSchema]))
|
|
2073
|
+
};
|
|
2074
|
+
var bridgePageAddressedPropertyWriteValueSchema = union([
|
|
2075
|
+
bridgePagePropertyWriteValueSchema,
|
|
2076
|
+
object({ ...pagePropertyBaseSchema, ...addressedRelationEntries })
|
|
2077
|
+
]);
|
|
2078
|
+
var bridgePageKeyedPropertyWriteValueSchema = union([
|
|
2079
|
+
variant(
|
|
2080
|
+
"type",
|
|
2081
|
+
bridgePagePropertyWriteValueSchema.options.map(
|
|
2082
|
+
(schema) => object({ ...schema.entries, id: optional(string()) })
|
|
2083
|
+
)
|
|
2084
|
+
),
|
|
2085
|
+
object({ ...addressedRelationEntries, id: optional(string()) })
|
|
1947
2086
|
]);
|
|
1948
2087
|
var bridgeFilesPropertyReadValueSchema = object({
|
|
1949
2088
|
...pagePropertyBaseSchema,
|
|
1950
2089
|
type: literal("files"),
|
|
1951
2090
|
files: array(bridgeFilePropertyReadItemSchema)
|
|
1952
2091
|
});
|
|
1953
|
-
var
|
|
1954
|
-
...
|
|
2092
|
+
var knownBridgePagePropertyReadValueSchema = variant("type", [
|
|
2093
|
+
...commonPagePropertySchemas,
|
|
2094
|
+
object({
|
|
2095
|
+
...textUniqueIdPropertySchema.entries,
|
|
2096
|
+
restricted: optional(literal(false))
|
|
2097
|
+
}),
|
|
2098
|
+
object({
|
|
2099
|
+
...textVerificationPropertySchema.entries,
|
|
2100
|
+
restricted: optional(literal(false))
|
|
2101
|
+
}),
|
|
1955
2102
|
bridgeFilesPropertyReadValueSchema
|
|
1956
2103
|
]);
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
)
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
)
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
),
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
object
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2104
|
+
var bridgeRestrictedPagePropertyValueSchema = variant("type", [
|
|
2105
|
+
object({
|
|
2106
|
+
id: string(),
|
|
2107
|
+
type: literal("title"),
|
|
2108
|
+
title: null_(),
|
|
2109
|
+
restricted: literal(true)
|
|
2110
|
+
}),
|
|
2111
|
+
object({
|
|
2112
|
+
id: string(),
|
|
2113
|
+
type: literal("rich_text"),
|
|
2114
|
+
rich_text: null_(),
|
|
2115
|
+
restricted: literal(true)
|
|
2116
|
+
}),
|
|
2117
|
+
object({
|
|
2118
|
+
id: string(),
|
|
2119
|
+
type: literal("number"),
|
|
2120
|
+
number: null_(),
|
|
2121
|
+
restricted: literal(true)
|
|
2122
|
+
}),
|
|
2123
|
+
object({
|
|
2124
|
+
id: string(),
|
|
2125
|
+
type: literal("url"),
|
|
2126
|
+
url: null_(),
|
|
2127
|
+
restricted: literal(true)
|
|
2128
|
+
}),
|
|
2129
|
+
object({
|
|
2130
|
+
id: string(),
|
|
2131
|
+
type: literal("email"),
|
|
2132
|
+
email: null_(),
|
|
2133
|
+
restricted: literal(true)
|
|
2134
|
+
}),
|
|
2135
|
+
object({
|
|
2136
|
+
id: string(),
|
|
2137
|
+
type: literal("phone_number"),
|
|
2138
|
+
phone_number: null_(),
|
|
2139
|
+
restricted: literal(true)
|
|
2140
|
+
}),
|
|
2141
|
+
object({
|
|
2142
|
+
id: string(),
|
|
2143
|
+
type: literal("checkbox"),
|
|
2144
|
+
checkbox: null_(),
|
|
2145
|
+
restricted: literal(true)
|
|
2146
|
+
}),
|
|
2147
|
+
object({
|
|
2148
|
+
id: string(),
|
|
2149
|
+
type: literal("select"),
|
|
2150
|
+
select: null_(),
|
|
2151
|
+
restricted: literal(true)
|
|
2152
|
+
}),
|
|
2153
|
+
object({
|
|
2154
|
+
id: string(),
|
|
2155
|
+
type: literal("status"),
|
|
2156
|
+
status: null_(),
|
|
2157
|
+
restricted: literal(true)
|
|
2158
|
+
}),
|
|
2159
|
+
object({
|
|
2160
|
+
id: string(),
|
|
2161
|
+
type: literal("multi_select"),
|
|
2162
|
+
multi_select: null_(),
|
|
2163
|
+
restricted: literal(true)
|
|
2164
|
+
}),
|
|
2165
|
+
object({
|
|
2166
|
+
id: string(),
|
|
2167
|
+
type: literal("date"),
|
|
2168
|
+
date: null_(),
|
|
2169
|
+
restricted: literal(true)
|
|
2170
|
+
}),
|
|
2171
|
+
object({
|
|
2172
|
+
id: string(),
|
|
2173
|
+
type: literal("people"),
|
|
2174
|
+
people: null_(),
|
|
2175
|
+
restricted: literal(true)
|
|
2176
|
+
}),
|
|
2177
|
+
object({
|
|
2178
|
+
id: string(),
|
|
2179
|
+
type: literal("relation"),
|
|
2180
|
+
relation: null_(),
|
|
2181
|
+
restricted: literal(true)
|
|
2182
|
+
}),
|
|
2183
|
+
object({
|
|
2184
|
+
id: string(),
|
|
2185
|
+
type: literal("files"),
|
|
2186
|
+
files: null_(),
|
|
2187
|
+
restricted: literal(true)
|
|
2188
|
+
}),
|
|
2189
|
+
object({
|
|
2190
|
+
id: string(),
|
|
2191
|
+
type: literal("place"),
|
|
2192
|
+
place: null_(),
|
|
2193
|
+
restricted: literal(true)
|
|
2194
|
+
}),
|
|
2195
|
+
object({
|
|
2196
|
+
id: string(),
|
|
2197
|
+
type: literal("created_time"),
|
|
2198
|
+
created_time: null_(),
|
|
2199
|
+
restricted: literal(true)
|
|
2200
|
+
}),
|
|
2201
|
+
object({
|
|
2202
|
+
id: string(),
|
|
2203
|
+
type: literal("last_edited_time"),
|
|
2204
|
+
last_edited_time: null_(),
|
|
2205
|
+
restricted: literal(true)
|
|
2206
|
+
}),
|
|
2207
|
+
object({
|
|
2208
|
+
id: string(),
|
|
2209
|
+
type: literal("created_by"),
|
|
2210
|
+
created_by: null_(),
|
|
2211
|
+
restricted: literal(true)
|
|
2212
|
+
}),
|
|
2213
|
+
object({
|
|
2214
|
+
id: string(),
|
|
2215
|
+
type: literal("last_edited_by"),
|
|
2216
|
+
last_edited_by: null_(),
|
|
2217
|
+
restricted: literal(true)
|
|
2218
|
+
}),
|
|
2219
|
+
object({
|
|
2220
|
+
id: string(),
|
|
2221
|
+
type: literal("unique_id"),
|
|
2222
|
+
unique_id: null_(),
|
|
2223
|
+
restricted: literal(true)
|
|
2224
|
+
}),
|
|
2225
|
+
object({
|
|
2226
|
+
id: string(),
|
|
2227
|
+
type: literal("button"),
|
|
2228
|
+
button: null_(),
|
|
2229
|
+
restricted: literal(true)
|
|
2230
|
+
}),
|
|
2231
|
+
object({
|
|
2232
|
+
id: string(),
|
|
2233
|
+
type: literal("formula"),
|
|
2234
|
+
formula: null_(),
|
|
2235
|
+
restricted: literal(true)
|
|
2236
|
+
}),
|
|
2237
|
+
object({
|
|
2238
|
+
id: string(),
|
|
2239
|
+
type: literal("rollup"),
|
|
2240
|
+
rollup: null_(),
|
|
2241
|
+
restricted: literal(true)
|
|
2242
|
+
}),
|
|
2243
|
+
object({
|
|
2244
|
+
id: string(),
|
|
2245
|
+
type: literal("verification"),
|
|
2246
|
+
verification: null_(),
|
|
2247
|
+
restricted: literal(true)
|
|
2248
|
+
})
|
|
2249
|
+
]);
|
|
2250
|
+
var bridgeUnknownPagePropertyReadValueSchema = object({
|
|
2251
|
+
...pagePropertyBaseSchema,
|
|
2252
|
+
type: literal("unknown"),
|
|
2253
|
+
originalType: unknownPropertyTypeSchema
|
|
2254
|
+
});
|
|
2255
|
+
var futurePagePropertyReadValueSchema = pipe(
|
|
2256
|
+
object({
|
|
2257
|
+
id: string(),
|
|
2258
|
+
type: unknownPropertyTypeSchema,
|
|
2259
|
+
restricted: optional(boolean())
|
|
2260
|
+
}),
|
|
2261
|
+
check(
|
|
2262
|
+
({ type }) => !knownBridgePagePropertyReadValueSchema.options.some(
|
|
2263
|
+
(schema) => schema.entries.type.literal === type
|
|
2264
|
+
)
|
|
2265
|
+
),
|
|
2266
|
+
transform(
|
|
2267
|
+
({ id, type }) => ({
|
|
2268
|
+
id,
|
|
2269
|
+
type: "unknown",
|
|
2270
|
+
originalType: type
|
|
2271
|
+
})
|
|
2272
|
+
)
|
|
2273
|
+
);
|
|
2274
|
+
var bridgePagePropertyReadValueSchema = union([
|
|
2275
|
+
bridgeRestrictedPagePropertyValueSchema,
|
|
2276
|
+
knownBridgePagePropertyReadValueSchema,
|
|
2277
|
+
bridgeUnknownPagePropertyReadValueSchema,
|
|
2278
|
+
futurePagePropertyReadValueSchema
|
|
2279
|
+
]);
|
|
2280
|
+
|
|
2281
|
+
// ../protocol/src/pages/properties/bridgePagePropertyMaps.ts
|
|
2282
|
+
var bridgePagePropertyWriteMapSchema = record(
|
|
2283
|
+
string(),
|
|
2284
|
+
bridgePagePropertyWriteValueSchema
|
|
2285
|
+
);
|
|
2286
|
+
var bridgePageAddressedPropertyWriteMapSchema = record(
|
|
2287
|
+
string(),
|
|
2288
|
+
bridgePageAddressedPropertyWriteValueSchema
|
|
2289
|
+
);
|
|
2290
|
+
var bridgePageKeyedPropertyWriteMapSchema = record(
|
|
2291
|
+
string(),
|
|
2292
|
+
bridgePageKeyedPropertyWriteValueSchema
|
|
2293
|
+
);
|
|
2294
|
+
var bridgePropertyIdsByKeySchema = record(
|
|
2295
|
+
string(),
|
|
2296
|
+
optional(string())
|
|
2297
|
+
);
|
|
2298
|
+
var bridgePagePropertyReadMapSchema = record(
|
|
2299
|
+
string(),
|
|
2300
|
+
nullable(bridgePagePropertyReadValueSchema)
|
|
2301
|
+
);
|
|
2302
|
+
|
|
2303
|
+
// ../protocol/src/pages/bridgePage.ts
|
|
2304
|
+
var pageIconReadSchema = union([
|
|
2305
|
+
bridgePageIconSchema,
|
|
2306
|
+
pipe(
|
|
2307
|
+
object({ type: string() }),
|
|
2308
|
+
check(
|
|
2309
|
+
(icon) => !bridgePageIconSchema.options.some(
|
|
2310
|
+
(option) => option.entries.type.literal === icon.type
|
|
2311
|
+
)
|
|
2312
|
+
),
|
|
2313
|
+
transform(() => null)
|
|
2314
|
+
)
|
|
2315
|
+
]);
|
|
2316
|
+
var bridgePageSchema = object({
|
|
2317
|
+
object: literal("page"),
|
|
2318
|
+
id: notionPageIdSchema,
|
|
2319
|
+
parent: notionParentSchema,
|
|
2320
|
+
properties: bridgePagePropertyReadMapSchema,
|
|
2321
|
+
created_by: optional(nullable(bridgeActorSchema), null),
|
|
2322
|
+
last_edited_by: optional(nullable(bridgeActorSchema), null),
|
|
2323
|
+
created_time: optional(nullable(string()), null),
|
|
2324
|
+
last_edited_time: optional(nullable(string()), null),
|
|
2325
|
+
icon: optional(nullable(pageIconReadSchema), null),
|
|
2326
|
+
cover: optional(nullable(bridgePageCoverSchema), null),
|
|
2327
|
+
url: optional(nullable(string()), null),
|
|
2328
|
+
public_url: optional(nullable(string()), null),
|
|
2329
|
+
/** Whether the page or an ancestor is archived. */
|
|
2330
|
+
is_archived: boolean(),
|
|
2331
|
+
/** Whether the page or an ancestor is in Trash. */
|
|
2332
|
+
in_trash: boolean()
|
|
1998
2333
|
});
|
|
1999
2334
|
|
|
2000
2335
|
// ../protocol/src/dataSources/bridgeArchiveStatus.ts
|
|
@@ -2375,6 +2710,59 @@ var openExternalUrlResultMessageSchema = variant("status", [
|
|
|
2375
2710
|
})
|
|
2376
2711
|
]);
|
|
2377
2712
|
|
|
2713
|
+
// ../protocol/src/pages/messages/getPage.ts
|
|
2714
|
+
var customBlockGetPageErrorCodeSchema = string();
|
|
2715
|
+
var customBlockGetPageErrorInfoSchema = object({
|
|
2716
|
+
code: customBlockGetPageErrorCodeSchema,
|
|
2717
|
+
message: string(),
|
|
2718
|
+
isRetryable: boolean(),
|
|
2719
|
+
details: fallback(optional(customBlockErrorDetailsSchema), void 0)
|
|
2720
|
+
});
|
|
2721
|
+
var getPageMessageSchema = object({
|
|
2722
|
+
type: literal("getPage"),
|
|
2723
|
+
requestId: string(),
|
|
2724
|
+
pageId: notionPageIdSchema,
|
|
2725
|
+
dataSourceId: optional(notionDataSourceIdSchema)
|
|
2726
|
+
});
|
|
2727
|
+
var keyedGetPageMessageSchema = variant("type", [
|
|
2728
|
+
strictObject({
|
|
2729
|
+
type: literal("getPage"),
|
|
2730
|
+
requestId: string(),
|
|
2731
|
+
target: pageReadTargetSchema
|
|
2732
|
+
}),
|
|
2733
|
+
// The host checks bare IDs against current bindings or pages created on the connection.
|
|
2734
|
+
strictObject({
|
|
2735
|
+
type: literal("getPage"),
|
|
2736
|
+
requestId: string(),
|
|
2737
|
+
pageId: notionPageIdSchema
|
|
2738
|
+
})
|
|
2739
|
+
]);
|
|
2740
|
+
var getPageResultMessageSchema = variant("status", [
|
|
2741
|
+
object({
|
|
2742
|
+
type: literal("getPageResult"),
|
|
2743
|
+
requestId: string(),
|
|
2744
|
+
status: literal("success"),
|
|
2745
|
+
page: bridgePageSchema,
|
|
2746
|
+
propertyIdsByKey: optional(bridgePropertyIdsByKeySchema)
|
|
2747
|
+
}),
|
|
2748
|
+
object({
|
|
2749
|
+
type: literal("getPageResult"),
|
|
2750
|
+
requestId: string(),
|
|
2751
|
+
status: literal("error"),
|
|
2752
|
+
error: customBlockGetPageErrorInfoSchema
|
|
2753
|
+
})
|
|
2754
|
+
]);
|
|
2755
|
+
var addressedGetPageResultMessageSchema = variant("status", [
|
|
2756
|
+
object({
|
|
2757
|
+
...getPageResultMessageSchema.options[0].entries,
|
|
2758
|
+
page: object({
|
|
2759
|
+
...bridgePageSchema.entries,
|
|
2760
|
+
id: optional(notionPageIdSchema)
|
|
2761
|
+
})
|
|
2762
|
+
}),
|
|
2763
|
+
getPageResultMessageSchema.options[1]
|
|
2764
|
+
]);
|
|
2765
|
+
|
|
2378
2766
|
// ../protocol/src/pages/messages/createPage.ts
|
|
2379
2767
|
var customBlockCreatePageErrorCodeSchema = string();
|
|
2380
2768
|
var customBlockCreatePageErrorInfoSchema = object({
|
|
@@ -2388,7 +2776,8 @@ var createPageResultMessageSchema = variant("status", [
|
|
|
2388
2776
|
requestId: string(),
|
|
2389
2777
|
status: literal("success"),
|
|
2390
2778
|
/** The newly created page. */
|
|
2391
|
-
page: bridgePageSchema
|
|
2779
|
+
page: bridgePageSchema,
|
|
2780
|
+
propertyIdsByKey: optional(bridgePropertyIdsByKeySchema)
|
|
2392
2781
|
}),
|
|
2393
2782
|
object({
|
|
2394
2783
|
type: literal("createPageResult"),
|
|
@@ -2407,17 +2796,18 @@ var createPageParentSchema = variant("type", [
|
|
|
2407
2796
|
pageParentSchema,
|
|
2408
2797
|
dataSourceParentSchema
|
|
2409
2798
|
]);
|
|
2799
|
+
var createPageAppearanceEntries = {
|
|
2800
|
+
icon: optional(bridgePageIconSchema),
|
|
2801
|
+
cover: optional(bridgePageCoverSchema)
|
|
2802
|
+
};
|
|
2410
2803
|
var createPageBaseEntries = {
|
|
2804
|
+
...createPageAppearanceEntries,
|
|
2411
2805
|
/**
|
|
2412
2806
|
* Property values, keyed by raw property IDs from Notion.
|
|
2413
2807
|
*
|
|
2414
2808
|
* Each value must carry the same raw property ID in its `id` field.
|
|
2415
|
-
* To create a page with manifest-defined property keys, call `pages.create`. The SDK resolves
|
|
2416
|
-
* those keys before it sends this message.
|
|
2417
2809
|
*/
|
|
2418
|
-
properties: bridgePagePropertyWriteMapSchema
|
|
2419
|
-
icon: optional(bridgePageIconSchema),
|
|
2420
|
-
cover: optional(bridgePageCoverSchema)
|
|
2810
|
+
properties: bridgePagePropertyWriteMapSchema
|
|
2421
2811
|
};
|
|
2422
2812
|
var createPageUnderPageArgsSchema = object({
|
|
2423
2813
|
...createPageBaseEntries,
|
|
@@ -2447,33 +2837,19 @@ var createPageMessageSchema = variant("type", [
|
|
|
2447
2837
|
...createPageUnderDataSourceArgsSchema.entries
|
|
2448
2838
|
})
|
|
2449
2839
|
]);
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
isRetryable: boolean(),
|
|
2457
|
-
details: fallback(optional(customBlockErrorDetailsSchema), void 0)
|
|
2458
|
-
});
|
|
2459
|
-
var getPageMessageSchema = object({
|
|
2460
|
-
type: literal("getPage"),
|
|
2461
|
-
requestId: string(),
|
|
2462
|
-
pageId: notionPageIdSchema,
|
|
2463
|
-
dataSourceId: optional(notionDataSourceIdSchema)
|
|
2464
|
-
});
|
|
2465
|
-
var getPageResultMessageSchema = variant("status", [
|
|
2466
|
-
object({
|
|
2467
|
-
type: literal("getPageResult"),
|
|
2468
|
-
requestId: string(),
|
|
2469
|
-
status: literal("success"),
|
|
2470
|
-
page: bridgePageSchema
|
|
2840
|
+
var keyedCreatePageMessageSchema = variant("type", [
|
|
2841
|
+
strictObject({
|
|
2842
|
+
...createPageMessageEntries,
|
|
2843
|
+
...createPageUnderPageArgsSchema.entries,
|
|
2844
|
+
parent: pageAddressSchema,
|
|
2845
|
+
properties: bridgePageAddressedPropertyWriteMapSchema
|
|
2471
2846
|
}),
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2847
|
+
strictObject({
|
|
2848
|
+
...createPageMessageEntries,
|
|
2849
|
+
...createPageAppearanceEntries,
|
|
2850
|
+
parent: dataSourceKeyParentSchema,
|
|
2851
|
+
propertiesByKey: bridgePageKeyedPropertyWriteMapSchema,
|
|
2852
|
+
position: optional(never())
|
|
2477
2853
|
})
|
|
2478
2854
|
]);
|
|
2479
2855
|
|
|
@@ -2505,6 +2881,18 @@ var openPageResultMessageSchema = variant("status", [
|
|
|
2505
2881
|
error: customBlockOpenPageErrorInfoSchema
|
|
2506
2882
|
})
|
|
2507
2883
|
]);
|
|
2884
|
+
var addressedOpenPageMessageSchema = strictObject({
|
|
2885
|
+
type: literal("openPage"),
|
|
2886
|
+
requestId: string(),
|
|
2887
|
+
target: pageAddressSchema,
|
|
2888
|
+
mode: openPageModeSchema
|
|
2889
|
+
});
|
|
2890
|
+
var addressedOpenPageResultMessageSchema = variant("status", [
|
|
2891
|
+
strictObject(
|
|
2892
|
+
omit(openPageResultMessageSchema.options[0], ["pageId"]).entries
|
|
2893
|
+
),
|
|
2894
|
+
openPageResultMessageSchema.options[1]
|
|
2895
|
+
]);
|
|
2508
2896
|
|
|
2509
2897
|
// ../protocol/src/pages/messages/updatePage.ts
|
|
2510
2898
|
var customBlockUpdatePageErrorCodeSchema = string();
|
|
@@ -2518,7 +2906,8 @@ var updatePageResultMessageSchema = variant("status", [
|
|
|
2518
2906
|
type: literal("updatePageResult"),
|
|
2519
2907
|
requestId: string(),
|
|
2520
2908
|
status: literal("success"),
|
|
2521
|
-
page: bridgePageSchema
|
|
2909
|
+
page: bridgePageSchema,
|
|
2910
|
+
propertyIdsByKey: optional(bridgePropertyIdsByKeySchema)
|
|
2522
2911
|
}),
|
|
2523
2912
|
object({
|
|
2524
2913
|
type: literal("updatePageResult"),
|
|
@@ -2527,6 +2916,13 @@ var updatePageResultMessageSchema = variant("status", [
|
|
|
2527
2916
|
error: customBlockUpdatePageErrorInfoSchema
|
|
2528
2917
|
})
|
|
2529
2918
|
]);
|
|
2919
|
+
var addressedUpdatePageResultMessageSchema = variant("status", [
|
|
2920
|
+
object({
|
|
2921
|
+
...updatePageResultMessageSchema.options[0].entries,
|
|
2922
|
+
page: partial(bridgePageSchema, ["id"])
|
|
2923
|
+
}),
|
|
2924
|
+
updatePageResultMessageSchema.options[1]
|
|
2925
|
+
]);
|
|
2530
2926
|
var updatePageMessageSchema = object({
|
|
2531
2927
|
type: literal("updatePage"),
|
|
2532
2928
|
requestId: string(),
|
|
@@ -2536,14 +2932,33 @@ var updatePageMessageSchema = object({
|
|
|
2536
2932
|
* Property values, keyed by raw property IDs from Notion.
|
|
2537
2933
|
*
|
|
2538
2934
|
* Each value must carry the same raw property ID in its `id` field.
|
|
2539
|
-
* To update a page with manifest-defined property keys, call `row.updateByKey()` on a row returned
|
|
2540
|
-
* by `useDataSource()`. The SDK resolves those keys before it sends this message.
|
|
2541
2935
|
*/
|
|
2542
2936
|
properties: optional(bridgePagePropertyWriteMapSchema),
|
|
2543
2937
|
icon: optional(bridgePageIconSchema),
|
|
2544
2938
|
cover: optional(bridgePageCoverSchema),
|
|
2545
2939
|
archived: optional(boolean())
|
|
2546
2940
|
});
|
|
2941
|
+
var {
|
|
2942
|
+
dataSourceId: _dataSourceId,
|
|
2943
|
+
pageId: _pageId,
|
|
2944
|
+
properties: _properties,
|
|
2945
|
+
...updatePageFields
|
|
2946
|
+
} = updatePageMessageSchema.entries;
|
|
2947
|
+
var keyedUpdatePageMessageSchema = variant("type", [
|
|
2948
|
+
strictObject({
|
|
2949
|
+
...updatePageFields,
|
|
2950
|
+
target: pageAddressSchema,
|
|
2951
|
+
dataSourceKey: optional(string()),
|
|
2952
|
+
properties: optional(bridgePageAddressedPropertyWriteMapSchema)
|
|
2953
|
+
}),
|
|
2954
|
+
strictObject({
|
|
2955
|
+
...updatePageFields,
|
|
2956
|
+
target: pageAddressSchema,
|
|
2957
|
+
// Supply a mapping for targets that do not already identify a data source.
|
|
2958
|
+
dataSourceKey: optional(string()),
|
|
2959
|
+
propertiesByKey: bridgePageKeyedPropertyWriteMapSchema
|
|
2960
|
+
})
|
|
2961
|
+
]);
|
|
2547
2962
|
|
|
2548
2963
|
// ../protocol/src/users/bridgeUser.ts
|
|
2549
2964
|
var bridgeUserSchema = object({
|
|
@@ -2689,36 +3104,179 @@ var invalidSandboxMessageSchema = object({
|
|
|
2689
3104
|
var commonHostToSandboxSchemas = [
|
|
2690
3105
|
connectResultMessageSchema,
|
|
2691
3106
|
setupInitMessageSchema,
|
|
2692
|
-
getDataSourceResultMessageSchema,
|
|
2693
3107
|
getCurrentUserResultMessageSchema,
|
|
2694
3108
|
getViewerResultMessageSchema,
|
|
2695
|
-
dataSourcesInvalidatedMessageSchema,
|
|
2696
3109
|
themeChangedMessageSchema,
|
|
2697
3110
|
contrastModeChangedMessageSchema,
|
|
2698
|
-
parentChangedMessageSchema,
|
|
2699
|
-
pageChangedMessageSchema,
|
|
2700
3111
|
pageErrorMessageSchema,
|
|
2701
3112
|
parentErrorMessageSchema,
|
|
2702
3113
|
getUserResultMessageSchema,
|
|
2703
3114
|
listUsersResultMessageSchema,
|
|
2704
|
-
openPageResultMessageSchema,
|
|
2705
3115
|
openExternalUrlResultMessageSchema,
|
|
2706
3116
|
invalidSandboxMessageSchema
|
|
2707
3117
|
];
|
|
2708
3118
|
var hostToSandboxMessageSchema = variant("type", [
|
|
2709
3119
|
...commonHostToSandboxSchemas,
|
|
3120
|
+
addressedOpenPageResultMessageSchema,
|
|
3121
|
+
pageChangedMessageSchema,
|
|
3122
|
+
parentChangedMessageSchema,
|
|
3123
|
+
dataSourceChangedMessageSchema,
|
|
2710
3124
|
queryDataSourceResultMessageSchema,
|
|
2711
|
-
|
|
3125
|
+
addressedGetPageResultMessageSchema,
|
|
2712
3126
|
createPageResultMessageSchema,
|
|
2713
|
-
|
|
3127
|
+
addressedUpdatePageResultMessageSchema
|
|
2714
3128
|
]);
|
|
2715
3129
|
|
|
3130
|
+
// ../protocol/src/compatibility/contextThroughProtocol13.ts
|
|
3131
|
+
var parentChangedThroughProtocol13Schema = object({
|
|
3132
|
+
...parentChangedMessageSchema.entries,
|
|
3133
|
+
parent: parentThroughProtocol13Schema
|
|
3134
|
+
});
|
|
3135
|
+
var pageChangedThroughProtocol13Schema = object({
|
|
3136
|
+
...pageChangedMessageSchema.entries,
|
|
3137
|
+
page: variant("type", [
|
|
3138
|
+
containingPageSchema.options[0],
|
|
3139
|
+
object({
|
|
3140
|
+
...containingPageSchema.options[1].entries,
|
|
3141
|
+
parent: parentThroughProtocol13Schema
|
|
3142
|
+
})
|
|
3143
|
+
])
|
|
3144
|
+
});
|
|
3145
|
+
|
|
3146
|
+
// ../protocol/src/compatibility/protocol13/pagePropertyValues.ts
|
|
3147
|
+
var pagePropertyBaseSchema2 = { id: string() };
|
|
3148
|
+
var commonPagePropertySchemas2 = [
|
|
3149
|
+
object({
|
|
3150
|
+
...pagePropertyBaseSchema2,
|
|
3151
|
+
type: literal("title"),
|
|
3152
|
+
title: array(bridgeRichTextItemSchema)
|
|
3153
|
+
}),
|
|
3154
|
+
object({
|
|
3155
|
+
...pagePropertyBaseSchema2,
|
|
3156
|
+
type: literal("rich_text"),
|
|
3157
|
+
rich_text: array(bridgeRichTextItemSchema)
|
|
3158
|
+
}),
|
|
3159
|
+
object({
|
|
3160
|
+
...pagePropertyBaseSchema2,
|
|
3161
|
+
type: literal("number"),
|
|
3162
|
+
number: nullable(number())
|
|
3163
|
+
}),
|
|
3164
|
+
object({
|
|
3165
|
+
...pagePropertyBaseSchema2,
|
|
3166
|
+
type: literal("url"),
|
|
3167
|
+
url: nullableStringSchema
|
|
3168
|
+
}),
|
|
3169
|
+
object({
|
|
3170
|
+
...pagePropertyBaseSchema2,
|
|
3171
|
+
type: literal("email"),
|
|
3172
|
+
email: nullableStringSchema
|
|
3173
|
+
}),
|
|
3174
|
+
object({
|
|
3175
|
+
...pagePropertyBaseSchema2,
|
|
3176
|
+
type: literal("phone_number"),
|
|
3177
|
+
phone_number: nullableStringSchema
|
|
3178
|
+
}),
|
|
3179
|
+
object({
|
|
3180
|
+
...pagePropertyBaseSchema2,
|
|
3181
|
+
type: literal("checkbox"),
|
|
3182
|
+
checkbox: boolean()
|
|
3183
|
+
}),
|
|
3184
|
+
object({
|
|
3185
|
+
...pagePropertyBaseSchema2,
|
|
3186
|
+
type: literal("select"),
|
|
3187
|
+
select: nullable(bridgeSelectOptionSchema)
|
|
3188
|
+
}),
|
|
3189
|
+
object({
|
|
3190
|
+
...pagePropertyBaseSchema2,
|
|
3191
|
+
type: literal("status"),
|
|
3192
|
+
status: nullable(bridgeSelectOptionSchema)
|
|
3193
|
+
}),
|
|
3194
|
+
object({
|
|
3195
|
+
...pagePropertyBaseSchema2,
|
|
3196
|
+
type: literal("multi_select"),
|
|
3197
|
+
multi_select: array(bridgeSelectOptionSchema)
|
|
3198
|
+
}),
|
|
3199
|
+
object({
|
|
3200
|
+
...pagePropertyBaseSchema2,
|
|
3201
|
+
type: literal("date"),
|
|
3202
|
+
date: nullable(bridgeDateSchema)
|
|
3203
|
+
}),
|
|
3204
|
+
object({
|
|
3205
|
+
...pagePropertyBaseSchema2,
|
|
3206
|
+
type: literal("people"),
|
|
3207
|
+
people: array(bridgePersonItemSchema)
|
|
3208
|
+
}),
|
|
3209
|
+
object({
|
|
3210
|
+
...pagePropertyBaseSchema2,
|
|
3211
|
+
type: literal("relation"),
|
|
3212
|
+
has_more: optional(boolean()),
|
|
3213
|
+
relation: array(bridgeRelationItemSchema)
|
|
3214
|
+
}),
|
|
3215
|
+
object({
|
|
3216
|
+
...pagePropertyBaseSchema2,
|
|
3217
|
+
type: literal("place"),
|
|
3218
|
+
place: nullable(bridgePlaceSchema)
|
|
3219
|
+
}),
|
|
3220
|
+
object({
|
|
3221
|
+
...pagePropertyBaseSchema2,
|
|
3222
|
+
type: literal("created_time"),
|
|
3223
|
+
created_time: nullableStringSchema
|
|
3224
|
+
}),
|
|
3225
|
+
object({
|
|
3226
|
+
...pagePropertyBaseSchema2,
|
|
3227
|
+
type: literal("last_edited_time"),
|
|
3228
|
+
last_edited_time: nullableStringSchema
|
|
3229
|
+
}),
|
|
3230
|
+
object({
|
|
3231
|
+
...pagePropertyBaseSchema2,
|
|
3232
|
+
type: literal("created_by"),
|
|
3233
|
+
created_by: nullable(bridgeActorSchema)
|
|
3234
|
+
}),
|
|
3235
|
+
object({
|
|
3236
|
+
...pagePropertyBaseSchema2,
|
|
3237
|
+
type: literal("last_edited_by"),
|
|
3238
|
+
last_edited_by: nullable(bridgeActorSchema)
|
|
3239
|
+
}),
|
|
3240
|
+
object({
|
|
3241
|
+
...pagePropertyBaseSchema2,
|
|
3242
|
+
type: literal("button"),
|
|
3243
|
+
button: string()
|
|
3244
|
+
}),
|
|
3245
|
+
object({
|
|
3246
|
+
...pagePropertyBaseSchema2,
|
|
3247
|
+
type: literal("formula"),
|
|
3248
|
+
formula: string()
|
|
3249
|
+
}),
|
|
3250
|
+
object({
|
|
3251
|
+
...pagePropertyBaseSchema2,
|
|
3252
|
+
type: literal("rollup"),
|
|
3253
|
+
rollup: string()
|
|
3254
|
+
})
|
|
3255
|
+
];
|
|
3256
|
+
var bridgeFilesPropertyWriteValueSchema2 = object({
|
|
3257
|
+
...pagePropertyBaseSchema2,
|
|
3258
|
+
type: literal("files"),
|
|
3259
|
+
files: array(bridgeFilePropertyItemSchema)
|
|
3260
|
+
});
|
|
3261
|
+
var bridgeFilesPropertyReadValueSchema2 = object({
|
|
3262
|
+
...pagePropertyBaseSchema2,
|
|
3263
|
+
type: literal("files"),
|
|
3264
|
+
files: array(bridgeFilePropertyReadItemSchema)
|
|
3265
|
+
});
|
|
3266
|
+
|
|
2716
3267
|
// ../protocol/src/compatibility/protocol12/page.ts
|
|
3268
|
+
var bridgePagePropertyForProtocol12Schema = variant("type", [
|
|
3269
|
+
...commonPagePropertySchemas2,
|
|
3270
|
+
textUniqueIdPropertySchema,
|
|
3271
|
+
textVerificationPropertySchema,
|
|
3272
|
+
bridgeFilesPropertyWriteValueSchema2
|
|
3273
|
+
]);
|
|
2717
3274
|
var bridgePageForProtocol12Schema = object({
|
|
2718
3275
|
...bridgePageSchema.entries,
|
|
3276
|
+
parent: parentThroughProtocol13Schema,
|
|
2719
3277
|
properties: record(
|
|
2720
3278
|
string(),
|
|
2721
|
-
nullable(
|
|
3279
|
+
nullable(bridgePagePropertyForProtocol12Schema)
|
|
2722
3280
|
)
|
|
2723
3281
|
});
|
|
2724
3282
|
|
|
@@ -2726,8 +3284,8 @@ var bridgePageForProtocol12Schema = object({
|
|
|
2726
3284
|
var bridgePageForProtocol3To5Schema = object({
|
|
2727
3285
|
object: literal("page"),
|
|
2728
3286
|
id: notionPageIdSchema,
|
|
2729
|
-
parent:
|
|
2730
|
-
properties:
|
|
3287
|
+
parent: parentThroughProtocol13Schema,
|
|
3288
|
+
properties: record(string(), bridgePagePropertyForProtocol12Schema),
|
|
2731
3289
|
created_time: optional(string()),
|
|
2732
3290
|
last_edited_time: optional(string()),
|
|
2733
3291
|
icon: optional(bridgePageIconSchema),
|
|
@@ -2740,12 +3298,53 @@ var bridgePageForProtocol3To5Schema = object({
|
|
|
2740
3298
|
in_trash: boolean()
|
|
2741
3299
|
});
|
|
2742
3300
|
|
|
3301
|
+
// ../protocol/src/compatibility/protocol3To5/dateValue.ts
|
|
3302
|
+
var dateOrDisabledReminder = optional(
|
|
3303
|
+
union([notionDateReminderSchema, notionDisabledReminderSchema])
|
|
3304
|
+
);
|
|
3305
|
+
var dateTimeOrDisabledReminder = optional(
|
|
3306
|
+
union([notionDateTimeReminderSchema, notionDisabledReminderSchema])
|
|
3307
|
+
);
|
|
3308
|
+
var protocol3To5DateSchema = object({
|
|
3309
|
+
type: literal("date"),
|
|
3310
|
+
start_date: string(),
|
|
3311
|
+
reminder: dateOrDisabledReminder
|
|
3312
|
+
});
|
|
3313
|
+
var protocol3To5DateRangeSchema = object({
|
|
3314
|
+
type: literal("daterange"),
|
|
3315
|
+
start_date: string(),
|
|
3316
|
+
end_date: string(),
|
|
3317
|
+
reminder: dateOrDisabledReminder
|
|
3318
|
+
});
|
|
3319
|
+
var protocol3To5DateTimeSchema = object({
|
|
3320
|
+
type: literal("datetime"),
|
|
3321
|
+
start_date: string(),
|
|
3322
|
+
start_time: string(),
|
|
3323
|
+
time_zone: optional(string()),
|
|
3324
|
+
reminder: dateTimeOrDisabledReminder
|
|
3325
|
+
});
|
|
3326
|
+
var protocol3To5DateTimeRangeSchema = object({
|
|
3327
|
+
type: literal("datetimerange"),
|
|
3328
|
+
start_date: string(),
|
|
3329
|
+
start_time: string(),
|
|
3330
|
+
end_date: string(),
|
|
3331
|
+
end_time: string(),
|
|
3332
|
+
time_zone: optional(string()),
|
|
3333
|
+
reminder: dateTimeOrDisabledReminder
|
|
3334
|
+
});
|
|
3335
|
+
var protocol3To5DateValueSchema = variant("type", [
|
|
3336
|
+
protocol3To5DateSchema,
|
|
3337
|
+
protocol3To5DateRangeSchema,
|
|
3338
|
+
protocol3To5DateTimeSchema,
|
|
3339
|
+
protocol3To5DateTimeRangeSchema
|
|
3340
|
+
]);
|
|
3341
|
+
|
|
2743
3342
|
// ../protocol/src/compatibility/protocol3To5/dataSourceValue.ts
|
|
2744
3343
|
var notionDataSourceValueSchema = union([
|
|
2745
3344
|
string(),
|
|
2746
3345
|
number(),
|
|
2747
3346
|
boolean(),
|
|
2748
|
-
|
|
3347
|
+
protocol3To5DateValueSchema,
|
|
2749
3348
|
array(string()),
|
|
2750
3349
|
array(notionRecordPointerSchema)
|
|
2751
3350
|
]);
|
|
@@ -2848,7 +3447,7 @@ var protocol3To11HostToSandboxMessageSchema = variant("type", [
|
|
|
2848
3447
|
protocol3To11InitMessageSchema,
|
|
2849
3448
|
themeChangedMessageSchema,
|
|
2850
3449
|
contrastModeChangedMessageSchema,
|
|
2851
|
-
|
|
3450
|
+
parentChangedThroughProtocol13Schema,
|
|
2852
3451
|
protocol3To11PageChangedMessageSchema,
|
|
2853
3452
|
currentUserChangedForProtocol3To11Schema,
|
|
2854
3453
|
dataSourcesChangedMessageSchema,
|
|
@@ -2863,9 +3462,152 @@ var protocol3To11HostToSandboxMessageSchema = variant("type", [
|
|
|
2863
3462
|
updatePageResultMessageWithProtocol3To5CompatibilitySchema
|
|
2864
3463
|
]);
|
|
2865
3464
|
|
|
3465
|
+
// ../protocol/src/dataSources/messages/getDataSource.ts
|
|
3466
|
+
var getDataSourceMessageSchema = object({
|
|
3467
|
+
type: literal("getDataSource"),
|
|
3468
|
+
requestId: string(),
|
|
3469
|
+
key: string()
|
|
3470
|
+
});
|
|
3471
|
+
var getDataSourceResultMessageSchema = variant("status", [
|
|
3472
|
+
object({
|
|
3473
|
+
type: literal("getDataSourceResult"),
|
|
3474
|
+
requestId: string(),
|
|
3475
|
+
status: literal("success"),
|
|
3476
|
+
binding: required(
|
|
3477
|
+
omit(bridgeDataSourceBindingSchema, ["inaccessible"])
|
|
3478
|
+
)
|
|
3479
|
+
}),
|
|
3480
|
+
object({
|
|
3481
|
+
type: literal("getDataSourceResult"),
|
|
3482
|
+
requestId: string(),
|
|
3483
|
+
status: literal("error"),
|
|
3484
|
+
error: customBlockErrorInfoSchema
|
|
3485
|
+
})
|
|
3486
|
+
]);
|
|
3487
|
+
var dataSourcesInvalidatedMessageSchema = object({
|
|
3488
|
+
type: literal("dataSourcesInvalidated")
|
|
3489
|
+
});
|
|
3490
|
+
|
|
3491
|
+
// ../protocol/src/compatibility/protocol13/propertyTypes.ts
|
|
3492
|
+
var SUPPORTED_PROTOCOL_13_PROPERTY_TYPES = /* @__PURE__ */ new Set([
|
|
3493
|
+
"title",
|
|
3494
|
+
"rich_text",
|
|
3495
|
+
"number",
|
|
3496
|
+
"checkbox",
|
|
3497
|
+
"url",
|
|
3498
|
+
"email",
|
|
3499
|
+
"phone_number",
|
|
3500
|
+
"select",
|
|
3501
|
+
"multi_select",
|
|
3502
|
+
"status",
|
|
3503
|
+
"date",
|
|
3504
|
+
"people",
|
|
3505
|
+
"files",
|
|
3506
|
+
"unique_id",
|
|
3507
|
+
"relation",
|
|
3508
|
+
"place",
|
|
3509
|
+
"formula",
|
|
3510
|
+
"rollup",
|
|
3511
|
+
"button",
|
|
3512
|
+
"verification",
|
|
3513
|
+
"created_time",
|
|
3514
|
+
"last_edited_time",
|
|
3515
|
+
"created_by",
|
|
3516
|
+
"last_edited_by"
|
|
3517
|
+
]);
|
|
3518
|
+
function supportsPropertyTypeThroughProtocol13(type) {
|
|
3519
|
+
return SUPPORTED_PROTOCOL_13_PROPERTY_TYPES.has(type);
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
// ../protocol/src/compatibility/hostToSandboxWithPageSchema.ts
|
|
3523
|
+
var dataSourceSchemaThroughProtocol13 = makeNotionDataSourceSchemaValidator(
|
|
3524
|
+
pipe(
|
|
3525
|
+
knownBridgePropertySchema,
|
|
3526
|
+
check((property) => supportsPropertyTypeThroughProtocol13(property.type))
|
|
3527
|
+
)
|
|
3528
|
+
);
|
|
3529
|
+
var getDataSourceResultThroughProtocol13 = variant("status", [
|
|
3530
|
+
object({
|
|
3531
|
+
...getDataSourceResultMessageSchema.options[0].entries,
|
|
3532
|
+
binding: required(
|
|
3533
|
+
omit(
|
|
3534
|
+
object({
|
|
3535
|
+
...bridgeDataSourceBindingSchema.entries,
|
|
3536
|
+
dataSourceSchema: optional(dataSourceSchemaThroughProtocol13)
|
|
3537
|
+
}),
|
|
3538
|
+
["inaccessible"]
|
|
3539
|
+
),
|
|
3540
|
+
["dataSourcePointer", "dataSourceSchema", "propertyIdsByKey"]
|
|
3541
|
+
)
|
|
3542
|
+
}),
|
|
3543
|
+
getDataSourceResultMessageSchema.options[1]
|
|
3544
|
+
]);
|
|
3545
|
+
function makeHostToSandboxMessageWithPageSchema(pageSchema) {
|
|
3546
|
+
return variant("type", [
|
|
3547
|
+
...commonHostToSandboxSchemas,
|
|
3548
|
+
openPageResultMessageSchema,
|
|
3549
|
+
parentChangedThroughProtocol13Schema,
|
|
3550
|
+
pageChangedThroughProtocol13Schema,
|
|
3551
|
+
dataSourcesInvalidatedMessageSchema,
|
|
3552
|
+
getDataSourceResultThroughProtocol13,
|
|
3553
|
+
variant("status", [
|
|
3554
|
+
object({
|
|
3555
|
+
...queryDataSourceResultMessageSchema.options[0].entries,
|
|
3556
|
+
items: array(pageSchema)
|
|
3557
|
+
}),
|
|
3558
|
+
queryDataSourceResultMessageSchema.options[1]
|
|
3559
|
+
]),
|
|
3560
|
+
variant("status", [
|
|
3561
|
+
object({
|
|
3562
|
+
...getPageResultMessageSchema.options[0].entries,
|
|
3563
|
+
page: pageSchema
|
|
3564
|
+
}),
|
|
3565
|
+
getPageResultMessageSchema.options[1]
|
|
3566
|
+
]),
|
|
3567
|
+
variant("status", [
|
|
3568
|
+
object({
|
|
3569
|
+
...createPageResultMessageSchema.options[0].entries,
|
|
3570
|
+
page: pageSchema
|
|
3571
|
+
}),
|
|
3572
|
+
createPageResultMessageSchema.options[1]
|
|
3573
|
+
]),
|
|
3574
|
+
variant("status", [
|
|
3575
|
+
object({
|
|
3576
|
+
...updatePageResultMessageSchema.options[0].entries,
|
|
3577
|
+
page: pageSchema
|
|
3578
|
+
}),
|
|
3579
|
+
updatePageResultMessageSchema.options[1]
|
|
3580
|
+
])
|
|
3581
|
+
]);
|
|
3582
|
+
}
|
|
3583
|
+
|
|
3584
|
+
// ../protocol/src/compatibility/protocol12/hostToSandbox.ts
|
|
3585
|
+
var hostToSandboxMessageForProtocol12Schema = makeHostToSandboxMessageWithPageSchema(bridgePageForProtocol12Schema);
|
|
3586
|
+
|
|
3587
|
+
// ../protocol/src/compatibility/protocol13/page.ts
|
|
3588
|
+
var bridgePagePropertyForProtocol13Schema = variant("type", [
|
|
3589
|
+
...commonPagePropertySchemas2,
|
|
3590
|
+
textUniqueIdPropertySchema,
|
|
3591
|
+
textVerificationPropertySchema,
|
|
3592
|
+
bridgeFilesPropertyReadValueSchema2
|
|
3593
|
+
]);
|
|
3594
|
+
var bridgePageForProtocol13Schema = object({
|
|
3595
|
+
...bridgePageSchema.entries,
|
|
3596
|
+
parent: parentThroughProtocol13Schema,
|
|
3597
|
+
properties: record(
|
|
3598
|
+
string(),
|
|
3599
|
+
nullable(bridgePagePropertyForProtocol13Schema)
|
|
3600
|
+
)
|
|
3601
|
+
});
|
|
3602
|
+
|
|
3603
|
+
// ../protocol/src/compatibility/protocol13/hostToSandbox.ts
|
|
3604
|
+
var hostToSandboxMessageForProtocol13Schema = makeHostToSandboxMessageWithPageSchema(bridgePageForProtocol13Schema);
|
|
3605
|
+
|
|
2866
3606
|
// ../protocol/src/compatibility/hostToSandbox.ts
|
|
2867
3607
|
var hostToSandboxMessageWithCompatibilitySchema = union([
|
|
2868
3608
|
hostToSandboxMessageSchema,
|
|
3609
|
+
hostToSandboxMessageForProtocol13Schema,
|
|
3610
|
+
hostToSandboxMessageForProtocol12Schema,
|
|
2869
3611
|
protocol3To11HostToSandboxMessageSchema
|
|
2870
3612
|
]);
|
|
2871
3613
|
|
|
@@ -2874,7 +3616,7 @@ var bridgeDataSourceBindingsForProtocol3To10Schema = record(
|
|
|
2874
3616
|
string(),
|
|
2875
3617
|
object({
|
|
2876
3618
|
collectionPointer: optional(dataSourcePointerValidator),
|
|
2877
|
-
collectionSchema: optional(
|
|
3619
|
+
collectionSchema: optional(bridgeDataSourceSchemaValidator),
|
|
2878
3620
|
propertyIdsByKey: optional(record(string(), optional(string()))),
|
|
2879
3621
|
inaccessible: optional(literal(true))
|
|
2880
3622
|
})
|
|
@@ -2941,11 +3683,15 @@ var protocol3To11SandboxToHostMessageSchema = variant("type", [
|
|
|
2941
3683
|
]);
|
|
2942
3684
|
|
|
2943
3685
|
// ../protocol/src/compatibility/protocol11/hostToSandbox.ts
|
|
3686
|
+
var pageWithHistoricalParentSchema = object({
|
|
3687
|
+
...bridgePageSchema.entries,
|
|
3688
|
+
parent: parentThroughProtocol13Schema
|
|
3689
|
+
});
|
|
2944
3690
|
var protocol11HostToSandboxMessageSchema = variant("type", [
|
|
2945
3691
|
protocol3To11InitMessageSchema,
|
|
2946
3692
|
themeChangedMessageSchema,
|
|
2947
3693
|
contrastModeChangedMessageSchema,
|
|
2948
|
-
|
|
3694
|
+
parentChangedThroughProtocol13Schema,
|
|
2949
3695
|
protocol3To11PageChangedMessageSchema,
|
|
2950
3696
|
currentUserChangedForProtocol3To11Schema,
|
|
2951
3697
|
dataSourcesChangedMessageSchema,
|
|
@@ -2954,12 +3700,47 @@ var protocol11HostToSandboxMessageSchema = variant("type", [
|
|
|
2954
3700
|
openPageResultMessageSchema,
|
|
2955
3701
|
openExternalUrlResultMessageSchema,
|
|
2956
3702
|
invalidSandboxMessageSchema,
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
3703
|
+
variant("status", [
|
|
3704
|
+
object({
|
|
3705
|
+
...queryDataSourceResultMessageSchema.options[0].entries,
|
|
3706
|
+
items: array(pageWithHistoricalParentSchema)
|
|
3707
|
+
}),
|
|
3708
|
+
queryDataSourceResultMessageSchema.options[1]
|
|
3709
|
+
]),
|
|
3710
|
+
variant("status", [
|
|
3711
|
+
object({
|
|
3712
|
+
...createPageResultMessageSchema.options[0].entries,
|
|
3713
|
+
page: pageWithHistoricalParentSchema
|
|
3714
|
+
}),
|
|
3715
|
+
createPageResultMessageSchema.options[1]
|
|
3716
|
+
]),
|
|
3717
|
+
variant("status", [
|
|
3718
|
+
object({
|
|
3719
|
+
...getPageResultMessageSchema.options[0].entries,
|
|
3720
|
+
page: pageWithHistoricalParentSchema
|
|
3721
|
+
}),
|
|
3722
|
+
getPageResultMessageSchema.options[1]
|
|
3723
|
+
]),
|
|
3724
|
+
variant("status", [
|
|
3725
|
+
object({
|
|
3726
|
+
...updatePageResultMessageSchema.options[0].entries,
|
|
3727
|
+
page: pageWithHistoricalParentSchema
|
|
3728
|
+
}),
|
|
3729
|
+
updatePageResultMessageSchema.options[1]
|
|
3730
|
+
])
|
|
2961
3731
|
]);
|
|
2962
3732
|
|
|
3733
|
+
// ../protocol/src/dataSources/messages/keyedQueryDataSource.ts
|
|
3734
|
+
var keyedQueryDataSourceMessageSchema = strictObject({
|
|
3735
|
+
type: literal("queryDataSource"),
|
|
3736
|
+
key: string(),
|
|
3737
|
+
subscriptionId: string(),
|
|
3738
|
+
limit: optional(number()),
|
|
3739
|
+
filter: optional(unknown()),
|
|
3740
|
+
sorts: optional(unknown()),
|
|
3741
|
+
archiveStatus: optional(picklist(["active", "archived", "all"]))
|
|
3742
|
+
});
|
|
3743
|
+
|
|
2963
3744
|
// ../protocol/src/handshake/ready.ts
|
|
2964
3745
|
var readyMessageSchema = object({
|
|
2965
3746
|
type: literal("ready"),
|
|
@@ -2969,6 +3750,26 @@ var readyMessageSchema = object({
|
|
|
2969
3750
|
|
|
2970
3751
|
// ../protocol/src/messages/sandboxToHost.ts
|
|
2971
3752
|
var sandboxToHostMessageSchema = variant("type", [
|
|
3753
|
+
connectRequestMessageSchema,
|
|
3754
|
+
getCurrentUserMessageSchema,
|
|
3755
|
+
getViewerMessageSchema,
|
|
3756
|
+
initResultRequestMessageSchema,
|
|
3757
|
+
readyMessageSchema,
|
|
3758
|
+
keyedQueryDataSourceMessageSchema,
|
|
3759
|
+
unsubscribeDataSourceQueryMessageSchema,
|
|
3760
|
+
keyedCreatePageMessageSchema,
|
|
3761
|
+
keyedGetPageMessageSchema,
|
|
3762
|
+
getUserMessageSchema,
|
|
3763
|
+
listUsersMessageSchema,
|
|
3764
|
+
addressedOpenPageMessageSchema,
|
|
3765
|
+
openExternalUrlMessageSchema,
|
|
3766
|
+
keyedUpdatePageMessageSchema,
|
|
3767
|
+
resizeMessageSchema,
|
|
3768
|
+
invalidHostMessageSchema
|
|
3769
|
+
]);
|
|
3770
|
+
|
|
3771
|
+
// ../protocol/src/compatibility/protocol13/sandboxToHost.ts
|
|
3772
|
+
var protocol13SandboxToHostMessageSchema = variant("type", [
|
|
2972
3773
|
connectRequestMessageSchema,
|
|
2973
3774
|
getDataSourceMessageSchema,
|
|
2974
3775
|
getCurrentUserMessageSchema,
|
|
@@ -2991,6 +3792,7 @@ var sandboxToHostMessageSchema = variant("type", [
|
|
|
2991
3792
|
// ../protocol/src/compatibility/sandboxToHost.ts
|
|
2992
3793
|
var sandboxToHostMessageWithCompatibilitySchema = union([
|
|
2993
3794
|
sandboxToHostMessageSchema,
|
|
3795
|
+
protocol13SandboxToHostMessageSchema,
|
|
2994
3796
|
protocol3To11SandboxToHostMessageSchema
|
|
2995
3797
|
]);
|
|
2996
3798
|
|
|
@@ -3007,7 +3809,7 @@ var notionDataSourceSchema = object({
|
|
|
3007
3809
|
* schema to validate filter and sort references. Undefined when the host does not provide a
|
|
3008
3810
|
* database schema.
|
|
3009
3811
|
*/
|
|
3010
|
-
dataSourceSchema: optional(
|
|
3812
|
+
dataSourceSchema: optional(bridgeDataSourceSchemaValidator),
|
|
3011
3813
|
/**
|
|
3012
3814
|
* Maps user-defined property keys to database property IDs. Use this map to resolve a key
|
|
3013
3815
|
* such as `name` to its database property ID. A value of `undefined` marks a declared
|
|
@@ -3025,7 +3827,7 @@ var notionDataSourceSchema = object({
|
|
|
3025
3827
|
* Use `propertiesById` to read a value. Use this map to read the value's schema. Use
|
|
3026
3828
|
* `dataSourceSchema` to validate filter and sort references.
|
|
3027
3829
|
*/
|
|
3028
|
-
propertySchemasById: record(string(),
|
|
3830
|
+
propertySchemasById: record(string(), bridgePropertySchema),
|
|
3029
3831
|
/**
|
|
3030
3832
|
* `true` when the data source is bound but the viewer can't read it. The block still
|
|
3031
3833
|
* initializes. Queries and writes that use this data source fail with
|
|
@@ -3034,6 +3836,43 @@ var notionDataSourceSchema = object({
|
|
|
3034
3836
|
inaccessible: optional(literal(true))
|
|
3035
3837
|
});
|
|
3036
3838
|
|
|
3839
|
+
// ../protocol/src/dataSources/resolveDataSourceBinding.ts
|
|
3840
|
+
function resolveDataSourceBinding(args) {
|
|
3841
|
+
const properties = Object.entries(
|
|
3842
|
+
args.manifestDataSource.properties ?? {}
|
|
3843
|
+
).map(([propertyKey, property]) => {
|
|
3844
|
+
const propertyId = args.propertyIdsByKey !== void 0 && Object.hasOwn(args.propertyIdsByKey, propertyKey) ? args.propertyIdsByKey[propertyKey] : void 0;
|
|
3845
|
+
const propertiesById = args.dataSourceSchema?.propertiesById;
|
|
3846
|
+
const mappedSchema = propertyId === void 0 || propertiesById === void 0 || !Object.hasOwn(propertiesById, propertyId) ? void 0 : propertiesById[propertyId];
|
|
3847
|
+
return resolvePropertyBinding(
|
|
3848
|
+
propertyKey,
|
|
3849
|
+
propertyId,
|
|
3850
|
+
mappedSchema?.type,
|
|
3851
|
+
property.type
|
|
3852
|
+
);
|
|
3853
|
+
});
|
|
3854
|
+
if (args.dataSourceSchema === void 0) {
|
|
3855
|
+
return { status: "missing_schema", properties };
|
|
3856
|
+
}
|
|
3857
|
+
if (properties.every((property) => property.status === "mapped")) {
|
|
3858
|
+
return { status: "complete", properties };
|
|
3859
|
+
}
|
|
3860
|
+
return { status: "incomplete", properties };
|
|
3861
|
+
}
|
|
3862
|
+
function resolvePropertyBinding(propertyKey, propertyId, actualType, expectedType) {
|
|
3863
|
+
if (propertyId === void 0) {
|
|
3864
|
+
return { status: "missing", propertyKey, propertyId };
|
|
3865
|
+
}
|
|
3866
|
+
if (actualType === void 0) {
|
|
3867
|
+
return { status: "invalid", propertyKey, propertyId };
|
|
3868
|
+
}
|
|
3869
|
+
return {
|
|
3870
|
+
status: actualType === expectedType ? "mapped" : "incompatible",
|
|
3871
|
+
propertyKey,
|
|
3872
|
+
propertyId
|
|
3873
|
+
};
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3037
3876
|
// ../protocol/src/utils/readRequestId.ts
|
|
3038
3877
|
var requestIdentitySchema = object({ requestId: string() });
|
|
3039
3878
|
|
|
@@ -6774,42 +7613,70 @@ var Temporal = /* @__PURE__ */ Object.defineProperties({}, {
|
|
|
6774
7613
|
var Temporal2 = NativeTemporal || Temporal;
|
|
6775
7614
|
var toTemporalInstant2 = NativeTemporal ? Date.prototype.toTemporalInstant : toTemporalInstant;
|
|
6776
7615
|
|
|
6777
|
-
// shared/dataSources/
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
7616
|
+
// shared/dataSources/sampleDate.ts
|
|
7617
|
+
var sampleDateSchema = pipe(
|
|
7618
|
+
strictObject({
|
|
7619
|
+
start: string(),
|
|
7620
|
+
end: optional(nullable(string())),
|
|
7621
|
+
timeZone: optional(nullable(string())),
|
|
7622
|
+
reminder: optional(
|
|
7623
|
+
union([notionDateTimeReminderSchema, notionDisabledReminderSchema])
|
|
7624
|
+
)
|
|
7625
|
+
}),
|
|
7626
|
+
check(
|
|
7627
|
+
({ start, reminder }) => start.includes("T") || reminder?.unit !== "hour" && reminder?.unit !== "minute",
|
|
7628
|
+
"Reminders on all-day dates must include a time of day."
|
|
7629
|
+
)
|
|
7630
|
+
);
|
|
7631
|
+
function readSampleDate(value) {
|
|
7632
|
+
if (typeof value !== "string") {
|
|
7633
|
+
const result = safeParse(sampleDateSchema, value);
|
|
7634
|
+
return result.success ? result.output : void 0;
|
|
6781
7635
|
}
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
return {
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
}
|
|
7636
|
+
try {
|
|
7637
|
+
parseDateBoundary({ value, timeZone: void 0 });
|
|
7638
|
+
return { start: value };
|
|
7639
|
+
} catch (error) {
|
|
7640
|
+
if (error instanceof RangeError) {
|
|
7641
|
+
return void 0;
|
|
7642
|
+
}
|
|
7643
|
+
throw error;
|
|
6789
7644
|
}
|
|
6790
|
-
return { start, reminder: value.reminder };
|
|
6791
7645
|
}
|
|
6792
|
-
function
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
const time = useEnd && value.type === "datetimerange" ? value.end_time : value.start_time;
|
|
6801
|
-
return parseDateBoundary({
|
|
6802
|
-
value: `${date}T${time}`,
|
|
6803
|
-
timeZone: value.time_zone
|
|
6804
|
-
});
|
|
7646
|
+
function toBridgeDate({
|
|
7647
|
+
start,
|
|
7648
|
+
end,
|
|
7649
|
+
timeZone,
|
|
7650
|
+
...rest
|
|
7651
|
+
}) {
|
|
7652
|
+
if (timeZone != null) {
|
|
7653
|
+
validateTimeZone(timeZone);
|
|
6805
7654
|
}
|
|
6806
|
-
return
|
|
7655
|
+
return {
|
|
7656
|
+
...rest,
|
|
7657
|
+
start: parseDateBoundary({
|
|
7658
|
+
value: start,
|
|
7659
|
+
timeZone: timeZone ?? void 0
|
|
7660
|
+
}).toString(),
|
|
7661
|
+
...end === void 0 ? {} : {
|
|
7662
|
+
end: end === null ? null : parseDateBoundary({
|
|
7663
|
+
value: end,
|
|
7664
|
+
timeZone: timeZone ?? void 0
|
|
7665
|
+
}).toString()
|
|
7666
|
+
},
|
|
7667
|
+
...timeZone === void 0 ? {} : { time_zone: timeZone }
|
|
7668
|
+
};
|
|
6807
7669
|
}
|
|
6808
7670
|
function parseDateBoundary({
|
|
6809
7671
|
value,
|
|
6810
7672
|
timeZone
|
|
6811
7673
|
}) {
|
|
6812
7674
|
if (!value.includes("T")) {
|
|
7675
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
7676
|
+
throw new RangeError(
|
|
7677
|
+
"Date values must use YYYY-MM-DD or an ISO timestamp."
|
|
7678
|
+
);
|
|
7679
|
+
}
|
|
6813
7680
|
return Temporal2.PlainDate.from(value);
|
|
6814
7681
|
}
|
|
6815
7682
|
if (/(?:Z|[+-]\d{2}:?\d{2})$/i.test(value)) {
|
|
@@ -6836,35 +7703,6 @@ function validateTimeZone(timeZone) {
|
|
|
6836
7703
|
}
|
|
6837
7704
|
}
|
|
6838
7705
|
|
|
6839
|
-
// shared/dataSources/toDataSourceDateValue.ts
|
|
6840
|
-
function toDataSourceDateValue(value) {
|
|
6841
|
-
if (is(notionDateValueSchema, value)) {
|
|
6842
|
-
return value;
|
|
6843
|
-
}
|
|
6844
|
-
if (typeof value !== "string") {
|
|
6845
|
-
return void 0;
|
|
6846
|
-
}
|
|
6847
|
-
try {
|
|
6848
|
-
const [date, time] = value.split("T");
|
|
6849
|
-
const { start } = toNotionDateInput({
|
|
6850
|
-
type: "datetime",
|
|
6851
|
-
start_date: date,
|
|
6852
|
-
start_time: time ?? "00:00:00Z"
|
|
6853
|
-
});
|
|
6854
|
-
return {
|
|
6855
|
-
type: "datetime",
|
|
6856
|
-
start_date: start.slice(0, 10),
|
|
6857
|
-
start_time: start.slice(11),
|
|
6858
|
-
time_zone: "UTC"
|
|
6859
|
-
};
|
|
6860
|
-
} catch (error) {
|
|
6861
|
-
if (error instanceof RangeError) {
|
|
6862
|
-
return void 0;
|
|
6863
|
-
}
|
|
6864
|
-
throw error;
|
|
6865
|
-
}
|
|
6866
|
-
}
|
|
6867
|
-
|
|
6868
7706
|
// shared/dataSources/localPropertyValues.ts
|
|
6869
7707
|
var stringValue = string();
|
|
6870
7708
|
var numberValue = pipe(number(), finite());
|
|
@@ -6878,7 +7716,7 @@ var sampleDataSourceValueSchema = union([
|
|
|
6878
7716
|
stringValue,
|
|
6879
7717
|
numberValue,
|
|
6880
7718
|
booleanValue,
|
|
6881
|
-
|
|
7719
|
+
sampleDateSchema,
|
|
6882
7720
|
stringArrayValue,
|
|
6883
7721
|
pointerArrayValue,
|
|
6884
7722
|
filesValue
|
|
@@ -6894,9 +7732,9 @@ var bindingValueSchemas = {
|
|
|
6894
7732
|
number: numberValue,
|
|
6895
7733
|
checkbox: booleanValue,
|
|
6896
7734
|
multi_select: stringArrayValue,
|
|
6897
|
-
date:
|
|
6898
|
-
created_time:
|
|
6899
|
-
last_edited_time:
|
|
7735
|
+
date: sampleDateSchema,
|
|
7736
|
+
created_time: sampleDateSchema,
|
|
7737
|
+
last_edited_time: sampleDateSchema,
|
|
6900
7738
|
people: pointerArrayValue,
|
|
6901
7739
|
relation: pointerArrayValue,
|
|
6902
7740
|
files: union([stringValue, filesValue])
|
|
@@ -6911,6 +7749,15 @@ var convertedValueSchemas = {
|
|
|
6911
7749
|
verification: stringValue,
|
|
6912
7750
|
place: stringValue
|
|
6913
7751
|
};
|
|
7752
|
+
function matchesBindingPropertyType(value, type) {
|
|
7753
|
+
if (type === "date" || type === "created_time" || type === "last_edited_time") {
|
|
7754
|
+
return readSampleDate(value) !== void 0;
|
|
7755
|
+
}
|
|
7756
|
+
if (type === "created_by" || type === "last_edited_by") {
|
|
7757
|
+
return Array.isArray(value) ? value.every((item) => parseSampleMetadataActor(item) !== void 0) : typeof value === "string" || parseSampleMetadataActor(value) !== void 0;
|
|
7758
|
+
}
|
|
7759
|
+
return is(bindingValueSchemas[type] ?? sampleDataSourceValueSchema, value);
|
|
7760
|
+
}
|
|
6914
7761
|
function matchesConvertedPropertyType(value, type) {
|
|
6915
7762
|
const schema = is(notionPropertyTypeSchema, type) ? convertedValueSchemas[type] : void 0;
|
|
6916
7763
|
return is(schema ?? sampleDataSourceValueSchema, value);
|
|
@@ -6922,6 +7769,9 @@ function parseSampleFileItem(value) {
|
|
|
6922
7769
|
const parsed = safeParse(bridgeFilePropertyReadItemSchema, value);
|
|
6923
7770
|
return parsed.success && parsed.output.type !== "file" ? parsed.output : void 0;
|
|
6924
7771
|
}
|
|
7772
|
+
function parseSampleMetadataActor(value) {
|
|
7773
|
+
return is(bridgePageSchema.entries.created_by, value) && value !== void 0 && value !== null && (value.table === "notion_user" || value.table === "bot" || value.table === "organization_bot") ? value : void 0;
|
|
7774
|
+
}
|
|
6925
7775
|
|
|
6926
7776
|
// cli/diagnostics/formatUnknownError.ts
|
|
6927
7777
|
function formatUnknownError(error) {
|
|
@@ -6940,21 +7790,21 @@ function claimUniqueKey(base, used) {
|
|
|
6940
7790
|
|
|
6941
7791
|
// cli/utils/parseCliArgs.ts
|
|
6942
7792
|
function parseCliArgs({
|
|
6943
|
-
argv,
|
|
7793
|
+
argv: argv2,
|
|
6944
7794
|
handlers,
|
|
6945
7795
|
flags = {},
|
|
6946
7796
|
onUnknown,
|
|
6947
7797
|
onPositional
|
|
6948
7798
|
}) {
|
|
6949
7799
|
const takeValue = (name, index) => {
|
|
6950
|
-
const value =
|
|
7800
|
+
const value = argv2[index];
|
|
6951
7801
|
if (value === void 0 || value.startsWith("--")) {
|
|
6952
7802
|
throw new Error(`${name} requires a value.`);
|
|
6953
7803
|
}
|
|
6954
7804
|
return value;
|
|
6955
7805
|
};
|
|
6956
|
-
for (let index = 0; index <
|
|
6957
|
-
const arg =
|
|
7806
|
+
for (let index = 0; index < argv2.length; index++) {
|
|
7807
|
+
const arg = argv2[index];
|
|
6958
7808
|
const flag = flags[arg];
|
|
6959
7809
|
if (flag !== void 0) {
|
|
6960
7810
|
flag();
|
|
@@ -6996,7 +7846,7 @@ var sampleDataSourceTypeSchema = picklist([
|
|
|
6996
7846
|
var sampleDataSourceRowSchema = looseObject({ id: string() });
|
|
6997
7847
|
var sampleDataSourcePropertiesSchema = record(
|
|
6998
7848
|
string(),
|
|
6999
|
-
|
|
7849
|
+
knownBridgePropertySchema
|
|
7000
7850
|
);
|
|
7001
7851
|
var loadedSampleDataSourceSchema = object({
|
|
7002
7852
|
status: literal("loaded"),
|
|
@@ -7118,7 +7968,7 @@ var statusGroupsSchema = array(
|
|
|
7118
7968
|
option_ids: array(nonEmptyString)
|
|
7119
7969
|
})
|
|
7120
7970
|
);
|
|
7121
|
-
var
|
|
7971
|
+
var sourcePropertySchema2 = object({
|
|
7122
7972
|
name: optional(string()),
|
|
7123
7973
|
description: optional(string()),
|
|
7124
7974
|
type: notionPropertyTypeSchema,
|
|
@@ -7129,7 +7979,7 @@ var sourceFileSchema = object({
|
|
|
7129
7979
|
type: optional(sampleDataSourceTypeSchema, "worker"),
|
|
7130
7980
|
name: optional(nonEmptyString),
|
|
7131
7981
|
icon: optional(string()),
|
|
7132
|
-
schema: optional(record(string(),
|
|
7982
|
+
schema: optional(record(string(), sourcePropertySchema2), {}),
|
|
7133
7983
|
rows: optional(array(looseObject({ id: nonEmptyString })), [])
|
|
7134
7984
|
});
|
|
7135
7985
|
function readDataSource(file) {
|
|
@@ -7178,7 +8028,7 @@ function readDataSource(file) {
|
|
|
7178
8028
|
schema: Object.fromEntries(
|
|
7179
8029
|
Object.entries(schema).map(([propertyKey, property]) => [
|
|
7180
8030
|
propertyKey,
|
|
7181
|
-
|
|
8031
|
+
toBridgePropertySchema(propertyKey, property)
|
|
7182
8032
|
])
|
|
7183
8033
|
),
|
|
7184
8034
|
rows
|
|
@@ -7197,11 +8047,11 @@ function validateDateValues(file, source) {
|
|
|
7197
8047
|
continue;
|
|
7198
8048
|
}
|
|
7199
8049
|
try {
|
|
7200
|
-
const date =
|
|
8050
|
+
const date = readSampleDate(value);
|
|
7201
8051
|
if (date === void 0) {
|
|
7202
8052
|
throw new Error("Expected a date value or ISO timestamp.");
|
|
7203
8053
|
}
|
|
7204
|
-
|
|
8054
|
+
toBridgeDate(date);
|
|
7205
8055
|
} catch (cause) {
|
|
7206
8056
|
throw new Error(
|
|
7207
8057
|
`${file}: row "${row.id}", property "${propertyId}": ${formatUnknownError(cause)}`,
|
|
@@ -7211,8 +8061,8 @@ function validateDateValues(file, source) {
|
|
|
7211
8061
|
}
|
|
7212
8062
|
}
|
|
7213
8063
|
}
|
|
7214
|
-
function
|
|
7215
|
-
return parse(
|
|
8064
|
+
function toBridgePropertySchema(propertyKey, property) {
|
|
8065
|
+
return parse(knownBridgePropertySchema, {
|
|
7216
8066
|
...property,
|
|
7217
8067
|
name: property.name ?? propertyKey,
|
|
7218
8068
|
options: property.options ?? [],
|
|
@@ -7278,7 +8128,7 @@ function convertPublicApiPropertyValue(publicType, value) {
|
|
|
7278
8128
|
return rollupToText(payload);
|
|
7279
8129
|
case "created_time":
|
|
7280
8130
|
case "last_edited_time":
|
|
7281
|
-
return
|
|
8131
|
+
return { start: payload };
|
|
7282
8132
|
case "created_by":
|
|
7283
8133
|
case "last_edited_by":
|
|
7284
8134
|
return [{ id: payload.id, table: "notion_user" }];
|
|
@@ -7336,46 +8186,18 @@ function rollupToText(rollup) {
|
|
|
7336
8186
|
function dateToText(date) {
|
|
7337
8187
|
return date.end ? `${date.start} \u2192 ${date.end}` : date.start;
|
|
7338
8188
|
}
|
|
7339
|
-
function publicDateToLocal(
|
|
7340
|
-
const start = date.start;
|
|
7341
|
-
const end = date.end ?? void 0;
|
|
7342
|
-
const timeZone = date.time_zone ?? void 0;
|
|
7343
|
-
if (!start.includes("T")) {
|
|
7344
|
-
return end === void 0 ? { type: "date", start_date: start.slice(0, 10) } : {
|
|
7345
|
-
type: "daterange",
|
|
7346
|
-
start_date: start.slice(0, 10),
|
|
7347
|
-
end_date: end.slice(0, 10)
|
|
7348
|
-
};
|
|
7349
|
-
}
|
|
7350
|
-
if (end === void 0) {
|
|
7351
|
-
return {
|
|
7352
|
-
type: "datetime",
|
|
7353
|
-
start_date: start.slice(0, 10),
|
|
7354
|
-
start_time: start.slice(11, 16),
|
|
7355
|
-
...timeZone !== void 0 ? { time_zone: timeZone } : {}
|
|
7356
|
-
};
|
|
7357
|
-
}
|
|
8189
|
+
function publicDateToLocal({ start, end, time_zone }) {
|
|
7358
8190
|
return {
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
end_date: end.slice(0, 10),
|
|
7363
|
-
end_time: end.slice(11, 16),
|
|
7364
|
-
...timeZone !== void 0 ? { time_zone: timeZone } : {}
|
|
8191
|
+
start,
|
|
8192
|
+
...end == null ? {} : { end },
|
|
8193
|
+
...time_zone == null ? {} : { timeZone: time_zone }
|
|
7365
8194
|
};
|
|
7366
8195
|
}
|
|
7367
|
-
function timestampToLocal(timestamp) {
|
|
7368
|
-
return timestamp.includes("T") ? {
|
|
7369
|
-
type: "datetime",
|
|
7370
|
-
start_date: timestamp.slice(0, 10),
|
|
7371
|
-
start_time: timestamp.slice(11, 16)
|
|
7372
|
-
} : { type: "date", start_date: timestamp.slice(0, 10) };
|
|
7373
|
-
}
|
|
7374
8196
|
|
|
7375
8197
|
// cli/dataSources/conversion/runConvert.ts
|
|
7376
8198
|
var SUPPORTED_TYPES = new Set(NOTION_PROPERTY_TYPES);
|
|
7377
8199
|
var UNSUPPORTED_TYPE_FALLBACK = "rich_text";
|
|
7378
|
-
function parseConvertArgs(
|
|
8200
|
+
function parseConvertArgs(argv2) {
|
|
7379
8201
|
const args = {
|
|
7380
8202
|
input: void 0,
|
|
7381
8203
|
name: void 0
|
|
@@ -7386,7 +8208,7 @@ function parseConvertArgs(argv) {
|
|
|
7386
8208
|
);
|
|
7387
8209
|
};
|
|
7388
8210
|
parseCliArgs({
|
|
7389
|
-
argv,
|
|
8211
|
+
argv: argv2,
|
|
7390
8212
|
handlers: {
|
|
7391
8213
|
"--in": (value) => {
|
|
7392
8214
|
args.input = value;
|
|
@@ -7542,8 +8364,8 @@ function validateSource(source) {
|
|
|
7542
8364
|
throw new Error(`Converted rows are invalid: ${issues.join("; ")}`);
|
|
7543
8365
|
}
|
|
7544
8366
|
}
|
|
7545
|
-
async function runConvert(
|
|
7546
|
-
const args = parseConvertArgs(
|
|
8367
|
+
async function runConvert(argv2) {
|
|
8368
|
+
const args = parseConvertArgs(argv2);
|
|
7547
8369
|
let raw;
|
|
7548
8370
|
if (args.input !== void 0) {
|
|
7549
8371
|
try {
|
|
@@ -7580,8 +8402,9 @@ async function runConvert(argv) {
|
|
|
7580
8402
|
// cli/bindings/errors.ts
|
|
7581
8403
|
var DevShellLauncherBindingError = class extends Error {
|
|
7582
8404
|
code;
|
|
7583
|
-
constructor(
|
|
7584
|
-
|
|
8405
|
+
constructor(args) {
|
|
8406
|
+
const { code, message } = args;
|
|
8407
|
+
super(message);
|
|
7585
8408
|
this.name = "DevShellLauncherBindingError";
|
|
7586
8409
|
this.code = code;
|
|
7587
8410
|
}
|
|
@@ -7589,14 +8412,14 @@ var DevShellLauncherBindingError = class extends Error {
|
|
|
7589
8412
|
function bindingFailure(code, message) {
|
|
7590
8413
|
return {
|
|
7591
8414
|
status: "error",
|
|
7592
|
-
error: new DevShellLauncherBindingError(code, message)
|
|
8415
|
+
error: new DevShellLauncherBindingError({ code, message })
|
|
7593
8416
|
};
|
|
7594
8417
|
}
|
|
7595
8418
|
|
|
7596
8419
|
// cli/diagnostics/formatUnknownErrorWithStack.ts
|
|
7597
8420
|
function formatUnknownErrorWithStack(error) {
|
|
7598
8421
|
if (error instanceof DevShellLauncherBindingError) {
|
|
7599
|
-
return error.message
|
|
8422
|
+
return `${error.message} (error code: ${error.code})`;
|
|
7600
8423
|
}
|
|
7601
8424
|
return error instanceof Error ? error.stack ?? error.message : String(error);
|
|
7602
8425
|
}
|
|
@@ -7606,23 +8429,63 @@ import { spawn } from "node:child_process";
|
|
|
7606
8429
|
import { readFileSync as readFileSync3, writeSync } from "node:fs";
|
|
7607
8430
|
import { join } from "node:path";
|
|
7608
8431
|
import { Readable } from "node:stream";
|
|
8432
|
+
|
|
8433
|
+
// cli/diagnostics/DevShellStartupError.ts
|
|
8434
|
+
var DevShellStartupError = class extends Error {
|
|
8435
|
+
code;
|
|
8436
|
+
constructor(args) {
|
|
8437
|
+
const { code, message, options } = args;
|
|
8438
|
+
super(message, options);
|
|
8439
|
+
this.name = "DevShellStartupError";
|
|
8440
|
+
this.code = code;
|
|
8441
|
+
}
|
|
8442
|
+
};
|
|
8443
|
+
|
|
8444
|
+
// cli/diagnostics/startupOutput.ts
|
|
7609
8445
|
var STARTUP_PIPE_ENV = "DEV_SHELL_STARTUP_PIPE";
|
|
7610
|
-
|
|
7611
|
-
|
|
8446
|
+
async function runWithStartupOutput(args) {
|
|
8447
|
+
const { main: main2 } = args;
|
|
7612
8448
|
if (process.env[STARTUP_PIPE_ENV] === "3") {
|
|
7613
8449
|
delete process.env[STARTUP_PIPE_ENV];
|
|
7614
|
-
|
|
7615
|
-
|
|
8450
|
+
const writeStartupEvent = createStartupWriter({ outputFd: 3 });
|
|
8451
|
+
try {
|
|
8452
|
+
await main2({ writeStartupEvent });
|
|
8453
|
+
} catch (error) {
|
|
8454
|
+
writeStartupFailure({ writeStartupEvent, error });
|
|
8455
|
+
throw error;
|
|
8456
|
+
}
|
|
7616
8457
|
return;
|
|
7617
8458
|
}
|
|
7618
|
-
const
|
|
7619
|
-
if (!
|
|
7620
|
-
await main2();
|
|
8459
|
+
const argv2 = process.argv.slice(2);
|
|
8460
|
+
if (!argv2.includes("--json")) {
|
|
8461
|
+
await main2({});
|
|
7621
8462
|
return;
|
|
7622
8463
|
}
|
|
8464
|
+
await relayStartupOutput({ argv: argv2 });
|
|
8465
|
+
}
|
|
8466
|
+
function writeStartupFailure(args) {
|
|
8467
|
+
const { writeStartupEvent, error } = args;
|
|
8468
|
+
writeStartupEvent?.({
|
|
8469
|
+
event: "startup_failed",
|
|
8470
|
+
version: 1,
|
|
8471
|
+
error: {
|
|
8472
|
+
code: error instanceof DevShellLauncherBindingError || error instanceof DevShellStartupError ? error.code : "startup_error",
|
|
8473
|
+
message: formatUnknownError(error)
|
|
8474
|
+
}
|
|
8475
|
+
});
|
|
8476
|
+
}
|
|
8477
|
+
function readDevShellVersion(args) {
|
|
8478
|
+
const { packageDir } = args;
|
|
8479
|
+
const metadata = JSON.parse(
|
|
8480
|
+
readFileSync3(join(packageDir, "package.json"), "utf8")
|
|
8481
|
+
);
|
|
8482
|
+
return parse(object({ version: string() }), metadata).version;
|
|
8483
|
+
}
|
|
8484
|
+
async function relayStartupOutput(args) {
|
|
8485
|
+
const { argv: argv2 } = args;
|
|
7623
8486
|
const child = spawn(
|
|
7624
8487
|
process.execPath,
|
|
7625
|
-
[...process.execArgv, process.argv[1], ...
|
|
8488
|
+
[...process.execArgv, process.argv[1], ...argv2],
|
|
7626
8489
|
{
|
|
7627
8490
|
env: { ...process.env, [STARTUP_PIPE_ENV]: "3" },
|
|
7628
8491
|
stdio: ["inherit", 2, 2, "pipe"]
|
|
@@ -7673,28 +8536,23 @@ async function runWithStartupOutput(main2) {
|
|
|
7673
8536
|
}
|
|
7674
8537
|
}
|
|
7675
8538
|
}
|
|
7676
|
-
function
|
|
7677
|
-
|
|
7678
|
-
return void 0;
|
|
7679
|
-
}
|
|
7680
|
-
const outputFd = startupPipe;
|
|
7681
|
-
const writeStdout = outputFd === void 0 ? process.stdout.write.bind(process.stdout) : (text) => writeSync(outputFd, text);
|
|
8539
|
+
function createStartupWriter(args) {
|
|
8540
|
+
const { outputFd } = args;
|
|
7682
8541
|
process.stdout.write = process.stderr.write.bind(process.stderr);
|
|
8542
|
+
let written = false;
|
|
7683
8543
|
return (event) => {
|
|
7684
|
-
|
|
8544
|
+
if (written) {
|
|
8545
|
+
return;
|
|
8546
|
+
}
|
|
8547
|
+
written = true;
|
|
8548
|
+
writeSync(outputFd, `${JSON.stringify(event)}
|
|
7685
8549
|
`);
|
|
7686
8550
|
};
|
|
7687
8551
|
}
|
|
7688
|
-
function readDevShellVersion(packageDir) {
|
|
7689
|
-
const metadata = JSON.parse(
|
|
7690
|
-
readFileSync3(join(packageDir, "package.json"), "utf8")
|
|
7691
|
-
);
|
|
7692
|
-
return parse(object({ version: string() }), metadata).version;
|
|
7693
|
-
}
|
|
7694
8552
|
|
|
7695
8553
|
// cli/launchDevShell.ts
|
|
7696
8554
|
import { existsSync as existsSync8, mkdirSync as mkdirSync6, mkdtempSync, rmSync } from "node:fs";
|
|
7697
|
-
import { basename as basename3, join as join3, resolve as resolve7 } from "node:path";
|
|
8555
|
+
import { basename as basename3, join as join3, relative as relative2, resolve as resolve7, sep } from "node:path";
|
|
7698
8556
|
|
|
7699
8557
|
// shared/dataSources/sampleDataSourceUpdates.ts
|
|
7700
8558
|
var sampleDataSourcesSnapshotSchema = object({
|
|
@@ -7705,6 +8563,349 @@ function getLoadedDataSources(snapshot) {
|
|
|
7705
8563
|
return snapshot.dataSources.filter((source) => source.status === "loaded").sort((a, b) => a.name.localeCompare(b.name));
|
|
7706
8564
|
}
|
|
7707
8565
|
|
|
8566
|
+
// shared/dataSources/getSampleDataRowIssues.ts
|
|
8567
|
+
function getSampleDataRowIssues(args) {
|
|
8568
|
+
const { source, mappings } = args;
|
|
8569
|
+
const issues = [];
|
|
8570
|
+
const typeCheckedIds = /* @__PURE__ */ new Set();
|
|
8571
|
+
const checkedPairs = /* @__PURE__ */ new Set();
|
|
8572
|
+
for (const { propertyId, expectedType } of mappings) {
|
|
8573
|
+
typeCheckedIds.add(propertyId);
|
|
8574
|
+
const pair = `${propertyId}\0${expectedType}`;
|
|
8575
|
+
if (checkedPairs.has(pair)) {
|
|
8576
|
+
continue;
|
|
8577
|
+
}
|
|
8578
|
+
checkedPairs.add(pair);
|
|
8579
|
+
const rowIds = source.rows.filter((row) => Object.hasOwn(row, propertyId)).filter((row) => !matchesBindingPropertyType(row[propertyId], expectedType)).map((row) => row.id);
|
|
8580
|
+
if (rowIds.length > 0) {
|
|
8581
|
+
issues.push({
|
|
8582
|
+
type: "invalid_property_value",
|
|
8583
|
+
propertyId,
|
|
8584
|
+
expectedType,
|
|
8585
|
+
rowIds
|
|
8586
|
+
});
|
|
8587
|
+
}
|
|
8588
|
+
}
|
|
8589
|
+
return issues.concat(getUnmappedRowIssues({ source, typeCheckedIds }));
|
|
8590
|
+
}
|
|
8591
|
+
function getUnmappedRowIssues(args) {
|
|
8592
|
+
const { source, typeCheckedIds } = args;
|
|
8593
|
+
const issues = [];
|
|
8594
|
+
for (const row of source.rows) {
|
|
8595
|
+
for (const [propertyId, value] of Object.entries(row)) {
|
|
8596
|
+
if (propertyId === "id" || typeCheckedIds.has(propertyId)) {
|
|
8597
|
+
continue;
|
|
8598
|
+
}
|
|
8599
|
+
const type = source.schema[propertyId]?.type;
|
|
8600
|
+
const isSupported = type === "files" || type === "created_by" || type === "last_edited_by" ? matchesBindingPropertyType(value, type) : isSampleDataSourceValue(value);
|
|
8601
|
+
if (!isSupported) {
|
|
8602
|
+
issues.push({
|
|
8603
|
+
type: "unsupported_property_value",
|
|
8604
|
+
propertyId,
|
|
8605
|
+
rowIds: [row.id]
|
|
8606
|
+
});
|
|
8607
|
+
}
|
|
8608
|
+
}
|
|
8609
|
+
}
|
|
8610
|
+
return issues;
|
|
8611
|
+
}
|
|
8612
|
+
|
|
8613
|
+
// ../host/src/bindings.ts
|
|
8614
|
+
var customBlockHostBindingsSchema = object({
|
|
8615
|
+
pages: record(string(), object({ pageId: notionPageIdSchema })),
|
|
8616
|
+
dataSources: record(
|
|
8617
|
+
string(),
|
|
8618
|
+
object({
|
|
8619
|
+
dataSourceId: notionDataSourceIdSchema,
|
|
8620
|
+
propertyIdsByKey: record(string(), optional(string()))
|
|
8621
|
+
})
|
|
8622
|
+
)
|
|
8623
|
+
});
|
|
8624
|
+
var hostDataSourceSchemaValidator = makeNotionDataSourceSchemaValidator(
|
|
8625
|
+
union([knownBridgePropertySchema, bridgeUnknownPropertySchema])
|
|
8626
|
+
);
|
|
8627
|
+
var customBlockHostDataSourceStateSchema = variant("status", [
|
|
8628
|
+
object({ status: literal("unavailable") }),
|
|
8629
|
+
object({
|
|
8630
|
+
status: literal("available"),
|
|
8631
|
+
dataSource: object({
|
|
8632
|
+
dataSourceSchema: hostDataSourceSchemaValidator,
|
|
8633
|
+
title: fallback(optional(string()), void 0),
|
|
8634
|
+
description: fallback(optional(string()), void 0),
|
|
8635
|
+
icon: fallback(optional(bridgePageIconSchema), void 0),
|
|
8636
|
+
capabilities: object({
|
|
8637
|
+
read: boolean(),
|
|
8638
|
+
create: boolean(),
|
|
8639
|
+
update: boolean(),
|
|
8640
|
+
archive: boolean()
|
|
8641
|
+
})
|
|
8642
|
+
})
|
|
8643
|
+
})
|
|
8644
|
+
]);
|
|
8645
|
+
|
|
8646
|
+
// ../host/src/compatibility/protocol3To11/handleInvalidProtocol3To11Handshake.ts
|
|
8647
|
+
var initializationIdentitySchema = object({ initializationId: string() });
|
|
8648
|
+
var protocolVersionSchema = object({
|
|
8649
|
+
// Preserve `NaN` so protocols 3–11 admission reports `invalid_protocol_version`.
|
|
8650
|
+
bridgeProtocolVersion: union([number(), nan()])
|
|
8651
|
+
});
|
|
8652
|
+
|
|
8653
|
+
// ../protocol/src/utils/readSubscriptionId.ts
|
|
8654
|
+
var subscriptionIdentitySchema = object({ subscriptionId: string() });
|
|
8655
|
+
|
|
8656
|
+
// ../protocol/src/dataSources/filters/filterFields.ts
|
|
8657
|
+
var BRIDGE_TO_SDK_FILTER_KEYS = {
|
|
8658
|
+
rich_text: "richText",
|
|
8659
|
+
phone_number: "phoneNumber",
|
|
8660
|
+
multi_select: "multiSelect",
|
|
8661
|
+
created_time: "createdTime",
|
|
8662
|
+
last_edited_time: "lastEditedTime",
|
|
8663
|
+
created_by: "createdBy",
|
|
8664
|
+
last_edited_by: "lastEditedBy",
|
|
8665
|
+
does_not_equal: "doesNotEqual",
|
|
8666
|
+
does_not_contain: "doesNotContain",
|
|
8667
|
+
contains_all: "containsAll",
|
|
8668
|
+
starts_with: "startsWith",
|
|
8669
|
+
ends_with: "endsWith",
|
|
8670
|
+
greater_than: "greaterThan",
|
|
8671
|
+
less_than: "lessThan",
|
|
8672
|
+
greater_than_or_equal_to: "greaterThanOrEqualTo",
|
|
8673
|
+
less_than_or_equal_to: "lessThanOrEqualTo",
|
|
8674
|
+
is_empty: "isEmpty",
|
|
8675
|
+
is_not_empty: "isNotEmpty",
|
|
8676
|
+
group_equals: "groupEquals",
|
|
8677
|
+
group_does_not_equal: "groupDoesNotEqual",
|
|
8678
|
+
on_or_before: "onOrBefore",
|
|
8679
|
+
on_or_after: "onOrAfter",
|
|
8680
|
+
this_week: "thisWeek",
|
|
8681
|
+
past_week: "pastWeek",
|
|
8682
|
+
past_month: "pastMonth",
|
|
8683
|
+
past_year: "pastYear",
|
|
8684
|
+
next_week: "nextWeek",
|
|
8685
|
+
next_month: "nextMonth",
|
|
8686
|
+
next_year: "nextYear"
|
|
8687
|
+
};
|
|
8688
|
+
var BRIDGE_TO_SDK_FILTER_KEY_MAP = new Map(
|
|
8689
|
+
Object.entries(BRIDGE_TO_SDK_FILTER_KEYS)
|
|
8690
|
+
);
|
|
8691
|
+
var SDK_TO_BRIDGE_FILTER_KEY_MAP = new Map(
|
|
8692
|
+
Object.entries(BRIDGE_TO_SDK_FILTER_KEYS).map(([bridgeKey, sdkKey]) => [
|
|
8693
|
+
sdkKey,
|
|
8694
|
+
bridgeKey
|
|
8695
|
+
])
|
|
8696
|
+
);
|
|
8697
|
+
|
|
8698
|
+
// ../protocol/src/dataSources/queries/resolveSorts.ts
|
|
8699
|
+
var supportedDataSourceSortPropertyTypes = new Set(
|
|
8700
|
+
CUSTOM_BLOCK_DATA_SOURCE_SORTABLE_PROPERTY_TYPES
|
|
8701
|
+
);
|
|
8702
|
+
|
|
8703
|
+
// ../host/src/dataSources/validation/validateQueryDataSourceSorts.ts
|
|
8704
|
+
var supportedDataSourceSortPropertyTypes2 = new Set(
|
|
8705
|
+
CUSTOM_BLOCK_DATA_SOURCE_SORTABLE_PROPERTY_TYPES
|
|
8706
|
+
);
|
|
8707
|
+
|
|
8708
|
+
// ../host/src/manifest/types.ts
|
|
8709
|
+
var customBlockHostManifestResultSchema = variant("status", [
|
|
8710
|
+
object({ status: literal("success"), manifest: manifestSchema }),
|
|
8711
|
+
object({
|
|
8712
|
+
status: literal("error"),
|
|
8713
|
+
error: customBlockInitErrorInfoSchema
|
|
8714
|
+
})
|
|
8715
|
+
]);
|
|
8716
|
+
|
|
8717
|
+
// ../host/src/messages/invalidNativeIconColor.ts
|
|
8718
|
+
var nativeIconMutationSchema = object({
|
|
8719
|
+
type: picklist(["updatePage", "createPage"]),
|
|
8720
|
+
requestId: string(),
|
|
8721
|
+
icon: object({
|
|
8722
|
+
type: literal("icon"),
|
|
8723
|
+
icon: object({ color: unknown() })
|
|
8724
|
+
})
|
|
8725
|
+
});
|
|
8726
|
+
|
|
8727
|
+
// ../host/src/createCustomBlockHost.ts
|
|
8728
|
+
var initializedHostMessageSchema = union([
|
|
8729
|
+
openPageResultMessageSchema,
|
|
8730
|
+
pageChangedThroughProtocol13Schema,
|
|
8731
|
+
hostToSandboxMessageSchema,
|
|
8732
|
+
dataSourcesInvalidatedMessageSchema,
|
|
8733
|
+
getDataSourceResultMessageSchema
|
|
8734
|
+
]);
|
|
8735
|
+
|
|
8736
|
+
// ../host/src/dataSources/bindings/resolveAutoPropertyBinding.ts
|
|
8737
|
+
function resolveAutoPropertyBinding(args) {
|
|
8738
|
+
const { propertyKey, manifestProperty, propertySchemasById } = args;
|
|
8739
|
+
const normalizedManifestName = normalizePropertyDisplayName(
|
|
8740
|
+
manifestProperty.name
|
|
8741
|
+
);
|
|
8742
|
+
const compatibleIds = [];
|
|
8743
|
+
const incompatible = [];
|
|
8744
|
+
for (const [propertyId, schema] of Object.entries(propertySchemasById)) {
|
|
8745
|
+
if (propertyId !== propertyKey && normalizePropertyDisplayName(schema.name) !== normalizedManifestName) {
|
|
8746
|
+
continue;
|
|
8747
|
+
}
|
|
8748
|
+
if (schema.type === manifestProperty.type) {
|
|
8749
|
+
compatibleIds.push(propertyId);
|
|
8750
|
+
} else {
|
|
8751
|
+
incompatible.push({ propertyId, actualType: schema.type });
|
|
8752
|
+
}
|
|
8753
|
+
}
|
|
8754
|
+
if (compatibleIds.length === 1) {
|
|
8755
|
+
return { status: "matched", propertyId: compatibleIds[0] };
|
|
8756
|
+
}
|
|
8757
|
+
if (compatibleIds.length > 1) {
|
|
8758
|
+
return { status: "ambiguous_match", candidatePropertyIds: compatibleIds };
|
|
8759
|
+
}
|
|
8760
|
+
return incompatible.length > 0 ? { status: "type_mismatch", candidates: incompatible } : { status: "no_match" };
|
|
8761
|
+
}
|
|
8762
|
+
function normalizePropertyDisplayName(value) {
|
|
8763
|
+
return value.trim().toLowerCase();
|
|
8764
|
+
}
|
|
8765
|
+
|
|
8766
|
+
// shared/dataSources/resolveInitialDataSourceBinding.ts
|
|
8767
|
+
function resolveInitialDataSourceBinding(args) {
|
|
8768
|
+
const { slotKey, slot, sources, sampleFiles, propertyOverrides } = args;
|
|
8769
|
+
const explicitFilename = Object.hasOwn(sampleFiles, slotKey) ? sampleFiles[slotKey] : void 0;
|
|
8770
|
+
const source = selectSampleDataSource({ slotKey, sources, explicitFilename });
|
|
8771
|
+
if (source?.status !== "loaded") {
|
|
8772
|
+
return { source, explicitFilename, properties: [] };
|
|
8773
|
+
}
|
|
8774
|
+
const overrides = Object.hasOwn(propertyOverrides, slotKey) ? propertyOverrides[slotKey] : void 0;
|
|
8775
|
+
const { properties } = resolveDataSourceBinding({
|
|
8776
|
+
manifestDataSource: slot,
|
|
8777
|
+
dataSourceSchema: { propertiesById: source.schema },
|
|
8778
|
+
propertyIdsByKey: overrides
|
|
8779
|
+
});
|
|
8780
|
+
return {
|
|
8781
|
+
source,
|
|
8782
|
+
explicitFilename,
|
|
8783
|
+
properties: properties.map(({ propertyKey, propertyId, status }) => {
|
|
8784
|
+
const manifestProperty = slot.properties[propertyKey];
|
|
8785
|
+
const property = { propertyKey, expectedType: manifestProperty.type };
|
|
8786
|
+
if (overrides === void 0 || !Object.hasOwn(overrides, propertyKey)) {
|
|
8787
|
+
return resolveAutomaticProperty(
|
|
8788
|
+
property,
|
|
8789
|
+
manifestProperty,
|
|
8790
|
+
source.schema
|
|
8791
|
+
);
|
|
8792
|
+
}
|
|
8793
|
+
switch (status) {
|
|
8794
|
+
case "mapped":
|
|
8795
|
+
return { ...property, type: "mapped", propertyId };
|
|
8796
|
+
case "invalid":
|
|
8797
|
+
return {
|
|
8798
|
+
...property,
|
|
8799
|
+
type: "sample_key_not_found",
|
|
8800
|
+
sampleKey: propertyId
|
|
8801
|
+
};
|
|
8802
|
+
case "incompatible":
|
|
8803
|
+
return {
|
|
8804
|
+
...property,
|
|
8805
|
+
type: "property_type_mismatch",
|
|
8806
|
+
bindingMode: "explicit",
|
|
8807
|
+
sampleProperties: [
|
|
8808
|
+
{
|
|
8809
|
+
sampleKey: propertyId,
|
|
8810
|
+
actualType: source.schema[propertyId].type
|
|
8811
|
+
}
|
|
8812
|
+
]
|
|
8813
|
+
};
|
|
8814
|
+
case "missing":
|
|
8815
|
+
return { ...property, type: "property_binding_missing" };
|
|
8816
|
+
default:
|
|
8817
|
+
return unreachable(status);
|
|
8818
|
+
}
|
|
8819
|
+
})
|
|
8820
|
+
};
|
|
8821
|
+
}
|
|
8822
|
+
function resolveAutomaticProperty(property, manifestProperty, schema) {
|
|
8823
|
+
const result = resolveAutoPropertyBinding({
|
|
8824
|
+
propertyKey: property.propertyKey,
|
|
8825
|
+
manifestProperty,
|
|
8826
|
+
propertySchemasById: schema
|
|
8827
|
+
});
|
|
8828
|
+
switch (result.status) {
|
|
8829
|
+
case "matched":
|
|
8830
|
+
return { ...property, type: "mapped", propertyId: result.propertyId };
|
|
8831
|
+
case "no_match":
|
|
8832
|
+
return { ...property, type: "property_binding_missing" };
|
|
8833
|
+
case "ambiguous_match":
|
|
8834
|
+
return {
|
|
8835
|
+
...property,
|
|
8836
|
+
type: "ambiguous_property_binding",
|
|
8837
|
+
candidateSampleKeys: result.candidatePropertyIds
|
|
8838
|
+
};
|
|
8839
|
+
case "type_mismatch":
|
|
8840
|
+
return {
|
|
8841
|
+
...property,
|
|
8842
|
+
type: "property_type_mismatch",
|
|
8843
|
+
bindingMode: "automatic",
|
|
8844
|
+
sampleProperties: result.candidates.map(
|
|
8845
|
+
({ propertyId, actualType }) => ({
|
|
8846
|
+
sampleKey: propertyId,
|
|
8847
|
+
actualType
|
|
8848
|
+
})
|
|
8849
|
+
)
|
|
8850
|
+
};
|
|
8851
|
+
default:
|
|
8852
|
+
return unreachable(result);
|
|
8853
|
+
}
|
|
8854
|
+
}
|
|
8855
|
+
|
|
8856
|
+
// cli/bindings/describeStartupDataSourceBindings.ts
|
|
8857
|
+
function describeStartupDataSourceBindings(block, sources) {
|
|
8858
|
+
return Object.fromEntries(
|
|
8859
|
+
Object.entries(block.manifest.dataSources).map(([slotKey, slot]) => [
|
|
8860
|
+
slotKey,
|
|
8861
|
+
describeBinding(
|
|
8862
|
+
resolveInitialDataSourceBinding({
|
|
8863
|
+
slotKey,
|
|
8864
|
+
slot,
|
|
8865
|
+
sources,
|
|
8866
|
+
sampleFiles: block.sampleFilesByDataSource,
|
|
8867
|
+
propertyOverrides: block.propertyIdsByDataSource
|
|
8868
|
+
})
|
|
8869
|
+
)
|
|
8870
|
+
])
|
|
8871
|
+
);
|
|
8872
|
+
}
|
|
8873
|
+
function describeBinding(binding) {
|
|
8874
|
+
const { source, explicitFilename, properties } = binding;
|
|
8875
|
+
if (source === void 0) {
|
|
8876
|
+
return explicitFilename === void 0 ? { status: "data_source_binding_missing" } : {
|
|
8877
|
+
status: "data_source_load_failed",
|
|
8878
|
+
sampleFile: `data/${explicitFilename}`,
|
|
8879
|
+
message: "The selected sample file disappeared during startup."
|
|
8880
|
+
};
|
|
8881
|
+
}
|
|
8882
|
+
const sampleFile = `data/${source.filename}.json`;
|
|
8883
|
+
if (source.status === "failed") {
|
|
8884
|
+
return {
|
|
8885
|
+
status: "data_source_load_failed",
|
|
8886
|
+
sampleFile,
|
|
8887
|
+
message: source.message
|
|
8888
|
+
};
|
|
8889
|
+
}
|
|
8890
|
+
const mapped = properties.filter((property) => property.type === "mapped");
|
|
8891
|
+
const errors = getSampleDataRowIssues({ source, mappings: mapped });
|
|
8892
|
+
const report = {
|
|
8893
|
+
sampleFile,
|
|
8894
|
+
propertyIdsByKey: Object.fromEntries(
|
|
8895
|
+
mapped.map(({ propertyKey, propertyId }) => [propertyKey, propertyId])
|
|
8896
|
+
),
|
|
8897
|
+
...errors.length > 0 ? { errors } : {}
|
|
8898
|
+
};
|
|
8899
|
+
const [first, ...remaining] = properties.filter(
|
|
8900
|
+
(property) => property.type !== "mapped"
|
|
8901
|
+
);
|
|
8902
|
+
return first === void 0 ? { status: "complete", ...report } : {
|
|
8903
|
+
status: "incomplete_property_bindings",
|
|
8904
|
+
...report,
|
|
8905
|
+
propertyIssues: [first, ...remaining]
|
|
8906
|
+
};
|
|
8907
|
+
}
|
|
8908
|
+
|
|
7708
8909
|
// cli/bindings/parseDataSourceBindingOverride.ts
|
|
7709
8910
|
function parseDataSourceBindingOverride({
|
|
7710
8911
|
value
|
|
@@ -7714,10 +8915,10 @@ function parseDataSourceBindingOverride({
|
|
|
7714
8915
|
const filename = value.slice(separator + 1);
|
|
7715
8916
|
const dot = target.indexOf(".");
|
|
7716
8917
|
if (separator < 0 || dot <= 0 || dot === target.length - 1 || target !== target.trim() || filename !== filename.trim() || !filename.endsWith(".json") || filename === ".json" || /[\\/\0]/.test(filename)) {
|
|
7717
|
-
throw new DevShellLauncherBindingError(
|
|
7718
|
-
"
|
|
7719
|
-
"--bind requires <capabilityKey>.<dataSourceKey>=<sampleDataFileName.json>. Use a filename in data/."
|
|
7720
|
-
);
|
|
8918
|
+
throw new DevShellLauncherBindingError({
|
|
8919
|
+
code: "invalid_data_source_binding_syntax",
|
|
8920
|
+
message: "--bind-data-source requires <capabilityKey>.<dataSourceKey>=<sampleDataFileName.json>. Use a filename in data/."
|
|
8921
|
+
});
|
|
7721
8922
|
}
|
|
7722
8923
|
return { target, filename };
|
|
7723
8924
|
}
|
|
@@ -7731,10 +8932,10 @@ function parsePropertyBindingOverride({
|
|
|
7731
8932
|
const sourcePropertyKey = value.slice(separator + 1);
|
|
7732
8933
|
const parts = target.split(".");
|
|
7733
8934
|
if (separator < 0 || parts.length < 3 || parts.some((part) => part.length === 0) || target !== target.trim() || sourcePropertyKey.length === 0 || sourcePropertyKey !== sourcePropertyKey.trim()) {
|
|
7734
|
-
throw new DevShellLauncherBindingError(
|
|
7735
|
-
"invalid_property_binding_syntax",
|
|
7736
|
-
"--bind-property requires <capabilityKey>.<dataSourceKey>.<propertyKey>=<sourcePropertyKey>."
|
|
7737
|
-
);
|
|
8935
|
+
throw new DevShellLauncherBindingError({
|
|
8936
|
+
code: "invalid_property_binding_syntax",
|
|
8937
|
+
message: "--bind-property requires <capabilityKey>.<dataSourceKey>.<propertyKey>=<sourcePropertyKey>."
|
|
8938
|
+
});
|
|
7738
8939
|
}
|
|
7739
8940
|
return { target, sourcePropertyKey };
|
|
7740
8941
|
}
|
|
@@ -7816,14 +9017,14 @@ function resolveDataSourceBindingSlot({
|
|
|
7816
9017
|
const matches = dataSourceSlots.filter((slot2) => slot2.target === target);
|
|
7817
9018
|
if (matches.length !== 1) {
|
|
7818
9019
|
return bindingFailure(
|
|
7819
|
-
matches.length === 0 ? "
|
|
9020
|
+
matches.length === 0 ? "unknown_data_source_binding_target" : "ambiguous_data_source_binding_target",
|
|
7820
9021
|
`${matches.length === 0 ? "Unknown" : "Ambiguous"} binding target "${target}". Available targets: ${dataSourceSlots.map((slot2) => slot2.target).join(", ") || "(none)"}.`
|
|
7821
9022
|
);
|
|
7822
9023
|
}
|
|
7823
9024
|
if (explicitSlots.has(target)) {
|
|
7824
9025
|
return bindingFailure(
|
|
7825
|
-
"
|
|
7826
|
-
`Duplicate --bind target "${target}". Specify each target once.`
|
|
9026
|
+
"duplicate_data_source_binding_target",
|
|
9027
|
+
`Duplicate --bind-data-source target "${target}". Specify each target once.`
|
|
7827
9028
|
);
|
|
7828
9029
|
}
|
|
7829
9030
|
const slot = matches[0];
|
|
@@ -7866,8 +9067,8 @@ function resolvePropertyBindingSlot({
|
|
|
7866
9067
|
const { dataSourceResult } = slot;
|
|
7867
9068
|
if (dataSourceResult === void 0) {
|
|
7868
9069
|
return bindingFailure(
|
|
7869
|
-
"
|
|
7870
|
-
`Cannot bind ${target}: no sample data source selected. Use --bind ${slot.target}=<sampleDataFileName.json>.`
|
|
9070
|
+
"property_binding_source_missing",
|
|
9071
|
+
`Cannot bind ${target}: no sample data source selected. Use --bind-data-source ${slot.target}=<sampleDataFileName.json>.`
|
|
7871
9072
|
);
|
|
7872
9073
|
}
|
|
7873
9074
|
if (dataSourceResult.status === "failed") {
|
|
@@ -8117,6 +9318,10 @@ function createDevShellDataService(options) {
|
|
|
8117
9318
|
handleUpdatesRequest,
|
|
8118
9319
|
handleAddPrebuiltRequest,
|
|
8119
9320
|
getSnapshot: () => snapshot,
|
|
9321
|
+
refreshSnapshot() {
|
|
9322
|
+
scan();
|
|
9323
|
+
return snapshot;
|
|
9324
|
+
},
|
|
8120
9325
|
close() {
|
|
8121
9326
|
clearImmediate(initialScan);
|
|
8122
9327
|
clearTimeout(timer);
|
|
@@ -8306,15 +9511,15 @@ async function closeResource(resource) {
|
|
|
8306
9511
|
}
|
|
8307
9512
|
|
|
8308
9513
|
// cli/lifecycle/installProcessSignalHandlers.ts
|
|
8309
|
-
function installProcessSignalHandlers(
|
|
9514
|
+
function installProcessSignalHandlers(run2) {
|
|
8310
9515
|
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
8311
|
-
process.on(signal, () =>
|
|
9516
|
+
process.on(signal, () => run2.shutdown(signal));
|
|
8312
9517
|
}
|
|
8313
|
-
process.on("exit", () =>
|
|
9518
|
+
process.on("exit", () => run2.shutdown("exit"));
|
|
8314
9519
|
process.on("uncaughtException", (error) => {
|
|
8315
9520
|
console.error(error);
|
|
8316
9521
|
process.exitCode = 1;
|
|
8317
|
-
|
|
9522
|
+
run2.shutdown("SIGTERM");
|
|
8318
9523
|
});
|
|
8319
9524
|
}
|
|
8320
9525
|
|
|
@@ -8372,7 +9577,7 @@ function buildCustomBlockDevShellCsp(args) {
|
|
|
8372
9577
|
// Local hosts replace Notion's production app, relay, and mobile-shell ancestors.
|
|
8373
9578
|
`frame-ancestors 'self' ${shellOrigin} ${allowedFrameAncestors.join(" ")}`,
|
|
8374
9579
|
// Allow WebAssembly compilation without enabling JavaScript string evaluation.
|
|
8375
|
-
"script-src 'self' '
|
|
9580
|
+
"script-src 'self' 'wasm-unsafe-eval'",
|
|
8376
9581
|
`style-src 'self' 'unsafe-inline' https://fonts.googleapis.com ${approved}`
|
|
8377
9582
|
].map((directive) => directive.trim()).join("; ");
|
|
8378
9583
|
}
|
|
@@ -8576,7 +9781,8 @@ var SharedServer = class {
|
|
|
8576
9781
|
// cli/server/waitForPreviewUrls.ts
|
|
8577
9782
|
import { request } from "node:http";
|
|
8578
9783
|
import { setTimeout as delay } from "node:timers/promises";
|
|
8579
|
-
async function waitForPreviewUrls(
|
|
9784
|
+
async function waitForPreviewUrls(args) {
|
|
9785
|
+
const { urls, signal, timeoutMs = 1e4 } = args;
|
|
8580
9786
|
const deadline = new AbortController();
|
|
8581
9787
|
const timer = setTimeout(() => deadline.abort(), timeoutMs);
|
|
8582
9788
|
const bounded = AbortSignal.any([signal, deadline.signal]);
|
|
@@ -8598,9 +9804,10 @@ async function waitForPreviewUrls(urls, signal, timeoutMs = 1e4) {
|
|
|
8598
9804
|
bounded.throwIfAborted();
|
|
8599
9805
|
} catch (error) {
|
|
8600
9806
|
if (deadline.signal.aborted && !signal.aborted) {
|
|
8601
|
-
throw new
|
|
8602
|
-
|
|
8603
|
-
|
|
9807
|
+
throw new DevShellStartupError({
|
|
9808
|
+
code: "preview_readiness_timeout",
|
|
9809
|
+
message: `Preview readiness timed out after ${timeoutMs}ms. No successful HTTP response from: ${[...pending].join(", ")}.`
|
|
9810
|
+
});
|
|
8604
9811
|
}
|
|
8605
9812
|
throw error;
|
|
8606
9813
|
} finally {
|
|
@@ -8712,6 +9919,17 @@ const resolved =
|
|
|
8712
9919
|
|
|
8713
9920
|
const injectBlockBootstrap = {
|
|
8714
9921
|
name: "dev-shell:block-bootstrap",
|
|
9922
|
+
configResolved(config) {
|
|
9923
|
+
// Run React's Fast Refresh preamble before Vite transforms the HTML, so
|
|
9924
|
+
// Vite serves it as a same-origin module that the block CSP allows.
|
|
9925
|
+
const refresh = config.plugins.find(plugin => plugin.name === "vite:react-refresh")
|
|
9926
|
+
if (typeof refresh?.transformIndexHtml === "function") {
|
|
9927
|
+
refresh.transformIndexHtml = {
|
|
9928
|
+
order: "pre",
|
|
9929
|
+
handler: refresh.transformIndexHtml,
|
|
9930
|
+
}
|
|
9931
|
+
}
|
|
9932
|
+
},
|
|
8715
9933
|
transformIndexHtml: {
|
|
8716
9934
|
order: "pre",
|
|
8717
9935
|
handler() {
|
|
@@ -18932,7 +20150,7 @@ import { promisify } from "node:util";
|
|
|
18932
20150
|
var WORKER_MANIFEST_FILENAME = "worker_manifest.json";
|
|
18933
20151
|
async function generateWorkerManifest(workerDir, options = {}) {
|
|
18934
20152
|
const manifest = await extractWorkerManifest(workerDir, options);
|
|
18935
|
-
const dir = resolve6(workerDir, ".dev-shell");
|
|
20153
|
+
const dir = options.outputDir ?? resolve6(workerDir, ".dev-shell");
|
|
18936
20154
|
mkdirSync5(dir, { recursive: true });
|
|
18937
20155
|
const manifestPath = resolve6(dir, WORKER_MANIFEST_FILENAME);
|
|
18938
20156
|
writeFileSync3(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
@@ -18990,7 +20208,7 @@ async function extractWorkerManifest(workerDir, options = {}) {
|
|
|
18990
20208
|
`Built worker at ${entry} exposed no usable manifest (expected .manifest or .capabilities).`
|
|
18991
20209
|
);
|
|
18992
20210
|
}
|
|
18993
|
-
async function buildWorker(workerDir,
|
|
20211
|
+
async function buildWorker(workerDir, run2) {
|
|
18994
20212
|
const child = spawn2("npm run build", {
|
|
18995
20213
|
cwd: workerDir,
|
|
18996
20214
|
shell: true,
|
|
@@ -19002,7 +20220,7 @@ async function buildWorker(workerDir, run) {
|
|
|
19002
20220
|
child.once("error", reject);
|
|
19003
20221
|
child.once("close", (code2) => resolve10(code2));
|
|
19004
20222
|
});
|
|
19005
|
-
|
|
20223
|
+
run2?.addResource(async () => {
|
|
19006
20224
|
const pid = child.pid;
|
|
19007
20225
|
if (pid === void 0 || child.exitCode !== null || child.signalCode !== null) {
|
|
19008
20226
|
return;
|
|
@@ -19017,7 +20235,7 @@ async function buildWorker(workerDir, run) {
|
|
|
19017
20235
|
await finished;
|
|
19018
20236
|
});
|
|
19019
20237
|
const code = await finished;
|
|
19020
|
-
if (
|
|
20238
|
+
if (run2?.closing) {
|
|
19021
20239
|
throw new Error("Worker build cancelled");
|
|
19022
20240
|
}
|
|
19023
20241
|
if (code !== 0) {
|
|
@@ -19049,6 +20267,7 @@ async function prepareWorkerLaunchPlan(workerDir, options = {}) {
|
|
|
19049
20267
|
}
|
|
19050
20268
|
const { manifest, manifestPath } = await generateWorkerManifest(root, {
|
|
19051
20269
|
build: options.build,
|
|
20270
|
+
outputDir: options.configDir,
|
|
19052
20271
|
run: options.run
|
|
19053
20272
|
});
|
|
19054
20273
|
const capabilities = blockCapabilities(manifest);
|
|
@@ -19085,7 +20304,29 @@ async function prepareWorkerLaunchPlan(workerDir, options = {}) {
|
|
|
19085
20304
|
registry
|
|
19086
20305
|
};
|
|
19087
20306
|
}
|
|
19088
|
-
function
|
|
20307
|
+
function warnAboutDeprecatedBind({
|
|
20308
|
+
argv: argv2
|
|
20309
|
+
}) {
|
|
20310
|
+
if (argv2.some((arg) => arg === "--bind" || arg.startsWith("--bind="))) {
|
|
20311
|
+
console.error("--bind is deprecated. Use --bind-data-source instead.");
|
|
20312
|
+
}
|
|
20313
|
+
}
|
|
20314
|
+
function parseWorkerLaunchArgs(args) {
|
|
20315
|
+
try {
|
|
20316
|
+
return parseWorkerLaunchOptions(args);
|
|
20317
|
+
} catch (error) {
|
|
20318
|
+
if (error instanceof DevShellLauncherBindingError) {
|
|
20319
|
+
throw error;
|
|
20320
|
+
}
|
|
20321
|
+
throw new DevShellStartupError({
|
|
20322
|
+
code: "invalid_arguments",
|
|
20323
|
+
message: formatUnknownError(error),
|
|
20324
|
+
options: { cause: error }
|
|
20325
|
+
});
|
|
20326
|
+
}
|
|
20327
|
+
}
|
|
20328
|
+
function parseWorkerLaunchOptions(options) {
|
|
20329
|
+
const { argv: argv2 } = options;
|
|
19089
20330
|
const args = {
|
|
19090
20331
|
worker: void 0,
|
|
19091
20332
|
shellPort: DEFAULT_DEV_SHELL_PORT,
|
|
@@ -19095,17 +20336,20 @@ function parseWorkerLaunchArgs(argv) {
|
|
|
19095
20336
|
propertyBindings: []
|
|
19096
20337
|
};
|
|
19097
20338
|
let hasPositionalWorker = false;
|
|
20339
|
+
const bindDataSource = (value) => {
|
|
20340
|
+
args.bindings.push(parseDataSourceBindingOverride({ value }));
|
|
20341
|
+
};
|
|
19098
20342
|
parseCliArgs({
|
|
19099
|
-
argv,
|
|
20343
|
+
argv: argv2,
|
|
19100
20344
|
flags: {
|
|
19101
20345
|
"--json": () => {
|
|
19102
20346
|
args.json = true;
|
|
19103
20347
|
}
|
|
19104
20348
|
},
|
|
19105
20349
|
handlers: {
|
|
19106
|
-
"--bind":
|
|
19107
|
-
|
|
19108
|
-
|
|
20350
|
+
"--bind-data-source": bindDataSource,
|
|
20351
|
+
/** @deprecated Use `--bind-data-source` instead. */
|
|
20352
|
+
"--bind": bindDataSource,
|
|
19109
20353
|
"--bind-property": (value) => {
|
|
19110
20354
|
args.propertyBindings.push(parsePropertyBindingOverride({ value }));
|
|
19111
20355
|
},
|
|
@@ -19127,7 +20371,7 @@ function parseWorkerLaunchArgs(argv) {
|
|
|
19127
20371
|
},
|
|
19128
20372
|
onUnknown: (arg) => {
|
|
19129
20373
|
throw new Error(
|
|
19130
|
-
`Unknown dev shell option "${arg}". Supported: --worker <dir>, --port <port>, --json, --bind <capabilityKey>.<dataSourceKey>=<sampleDataFileName>, --bind-property <capabilityKey>.<dataSourceKey>.<propertyKey>=<sourcePropertyKey
|
|
20374
|
+
`Unknown dev shell option "${arg}". Supported: --worker <dir>, --port <port>, --json, --bind-data-source <capabilityKey>.<dataSourceKey>=<sampleDataFileName>, --bind-property <capabilityKey>.<dataSourceKey>.<propertyKey>=<sourcePropertyKey>. --bind is a deprecated alias for --bind-data-source.`
|
|
19131
20375
|
);
|
|
19132
20376
|
},
|
|
19133
20377
|
onPositional: (arg) => {
|
|
@@ -19205,34 +20449,33 @@ function applyBindingsAndLog(args, plan, workerDir, snapshot) {
|
|
|
19205
20449
|
logWorkerPlan(basename3(workerDir), plan, snapshot);
|
|
19206
20450
|
}
|
|
19207
20451
|
async function launchDevShell(options) {
|
|
19208
|
-
const { installSignalHandlers = true } = options;
|
|
20452
|
+
const { installSignalHandlers = true, writeStartupEvent } = options;
|
|
19209
20453
|
const shared = new SharedServer();
|
|
19210
20454
|
const beforeCleanup = () => shared.close();
|
|
19211
|
-
const
|
|
20455
|
+
const run2 = options.createRun?.(beforeCleanup) ?? new DevShellRun(beforeCleanup);
|
|
19212
20456
|
if (installSignalHandlers) {
|
|
19213
|
-
installProcessSignalHandlers(
|
|
20457
|
+
installProcessSignalHandlers(run2);
|
|
19214
20458
|
}
|
|
19215
20459
|
const readiness = new AbortController();
|
|
19216
|
-
|
|
20460
|
+
run2.addResource(() => readiness.abort());
|
|
19217
20461
|
try {
|
|
19218
|
-
const
|
|
19219
|
-
const args = parseWorkerLaunchArgs(options.argv);
|
|
20462
|
+
const args = parseWorkerLaunchArgs({ argv: options.argv });
|
|
19220
20463
|
const { workerDir } = resolveWorkerLaunch({ ...options, args });
|
|
19221
20464
|
const originalCwd = process.cwd();
|
|
19222
20465
|
process.chdir(workerDir);
|
|
19223
|
-
|
|
20466
|
+
run2.addResource(() => process.chdir(originalCwd));
|
|
19224
20467
|
args.shellPort = await shared.listen(args.shellPort, args.strictPort);
|
|
19225
20468
|
const tempRoot = join3(workerDir, ".dev-shell");
|
|
19226
20469
|
mkdirSync6(tempRoot, { recursive: true });
|
|
19227
20470
|
const configDir = mkdtempSync(join3(tempRoot, "run-"));
|
|
19228
|
-
|
|
20471
|
+
run2.addResource(() => rmSync(configDir, { recursive: true, force: true }));
|
|
19229
20472
|
logNamed(basename3(workerDir), "Extracting worker manifest...");
|
|
19230
20473
|
const plan = await prepareWorkerLaunchPlan(workerDir, {
|
|
19231
20474
|
shellPort: args.shellPort,
|
|
19232
20475
|
configDir,
|
|
19233
|
-
run
|
|
20476
|
+
run: run2
|
|
19234
20477
|
});
|
|
19235
|
-
if (
|
|
20478
|
+
if (run2.closing) {
|
|
19236
20479
|
return;
|
|
19237
20480
|
}
|
|
19238
20481
|
const dataService = createDevShellDataService({
|
|
@@ -19241,7 +20484,7 @@ async function launchDevShell(options) {
|
|
|
19241
20484
|
blocks: plan.registry,
|
|
19242
20485
|
log: (message) => logNamed(basename3(workerDir), message)
|
|
19243
20486
|
});
|
|
19244
|
-
|
|
20487
|
+
run2.addResource(() => dataService.close());
|
|
19245
20488
|
applyBindingsAndLog(args, plan, workerDir, dataService.getSnapshot());
|
|
19246
20489
|
shared.shellApiRoutes.set(
|
|
19247
20490
|
"/api/dev-shell",
|
|
@@ -19257,10 +20500,10 @@ async function launchDevShell(options) {
|
|
|
19257
20500
|
log: logNamed
|
|
19258
20501
|
});
|
|
19259
20502
|
if (closeShell) {
|
|
19260
|
-
|
|
20503
|
+
run2.addResource(closeShell);
|
|
19261
20504
|
}
|
|
19262
20505
|
for (const block of plan.blocks) {
|
|
19263
|
-
if (
|
|
20506
|
+
if (run2.closing) {
|
|
19264
20507
|
return;
|
|
19265
20508
|
}
|
|
19266
20509
|
const close = await mountVite({
|
|
@@ -19273,36 +20516,51 @@ async function launchDevShell(options) {
|
|
|
19273
20516
|
shared,
|
|
19274
20517
|
config: { configFile: block.configFile, root: block.blockDir }
|
|
19275
20518
|
});
|
|
19276
|
-
|
|
20519
|
+
run2.addResource(close);
|
|
19277
20520
|
}
|
|
19278
|
-
if (
|
|
20521
|
+
if (run2.closing) {
|
|
19279
20522
|
return;
|
|
19280
20523
|
}
|
|
19281
|
-
if (
|
|
19282
|
-
await waitForPreviewUrls(
|
|
19283
|
-
[
|
|
20524
|
+
if (writeStartupEvent) {
|
|
20525
|
+
await waitForPreviewUrls({
|
|
20526
|
+
urls: [
|
|
19284
20527
|
`http://localhost:${args.shellPort}`,
|
|
19285
20528
|
...plan.registry.map((block) => block.url)
|
|
19286
20529
|
],
|
|
19287
|
-
readiness.signal
|
|
19288
|
-
);
|
|
19289
|
-
if (
|
|
20530
|
+
signal: readiness.signal
|
|
20531
|
+
});
|
|
20532
|
+
if (run2.closing) {
|
|
19290
20533
|
return;
|
|
19291
20534
|
}
|
|
19292
|
-
|
|
20535
|
+
const { dataSources } = dataService.refreshSnapshot();
|
|
20536
|
+
writeStartupEvent({
|
|
19293
20537
|
event: "ready",
|
|
20538
|
+
version: 1,
|
|
19294
20539
|
shellUrl: `http://localhost:${args.shellPort}`,
|
|
19295
20540
|
workerDir,
|
|
19296
20541
|
devShellVersion: options.devShellVersion,
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
20542
|
+
workerManifestPath: relative2(workerDir, plan.manifestPath).split(sep).join("/"),
|
|
20543
|
+
customBlocks: plan.registry.map((block) => {
|
|
20544
|
+
const pageKeys = Object.keys(block.manifest.pages ?? {});
|
|
20545
|
+
return {
|
|
20546
|
+
key: block.key,
|
|
20547
|
+
url: block.url,
|
|
20548
|
+
bindings: {
|
|
20549
|
+
dataSources: describeStartupDataSourceBindings(
|
|
20550
|
+
block,
|
|
20551
|
+
dataSources
|
|
20552
|
+
),
|
|
20553
|
+
pages: pageKeys.length === 0 ? void 0 : Object.fromEntries(
|
|
20554
|
+
pageKeys.map((key) => [key, { status: "unsupported" }])
|
|
20555
|
+
)
|
|
20556
|
+
}
|
|
20557
|
+
};
|
|
20558
|
+
})
|
|
19301
20559
|
});
|
|
19302
20560
|
}
|
|
19303
20561
|
printSummary(args, plan.registry);
|
|
19304
20562
|
} catch (error) {
|
|
19305
|
-
if (
|
|
20563
|
+
if (run2.closing) {
|
|
19306
20564
|
return;
|
|
19307
20565
|
}
|
|
19308
20566
|
console.error(
|
|
@@ -19310,31 +20568,17 @@ async function launchDevShell(options) {
|
|
|
19310
20568
|
${formatUnknownErrorWithStack(error)}`
|
|
19311
20569
|
);
|
|
19312
20570
|
process.exitCode = 1;
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
}
|
|
19316
|
-
|
|
19317
|
-
return plan.blocks.map(({ capability }, index) => {
|
|
19318
|
-
const block = plan.registry[index];
|
|
19319
|
-
const manifest = capability.config.manifest;
|
|
19320
|
-
const sampleFilesByDataSource = {};
|
|
19321
|
-
for (const slotKey of Object.keys(manifest.dataSources)) {
|
|
19322
|
-
const source = selectSampleDataSource({
|
|
19323
|
-
slotKey,
|
|
19324
|
-
sources,
|
|
19325
|
-
explicitFilename: block.sampleFilesByDataSource[slotKey]
|
|
19326
|
-
});
|
|
19327
|
-
if (source?.filename !== void 0) {
|
|
19328
|
-
sampleFilesByDataSource[slotKey] = `data/${source.filename}.json`;
|
|
19329
|
-
}
|
|
20571
|
+
try {
|
|
20572
|
+
writeStartupFailure({ writeStartupEvent, error });
|
|
20573
|
+
} finally {
|
|
20574
|
+
run2.shutdown("SIGTERM");
|
|
19330
20575
|
}
|
|
19331
|
-
|
|
19332
|
-
});
|
|
20576
|
+
}
|
|
19333
20577
|
}
|
|
19334
20578
|
|
|
19335
20579
|
// cli/server/createUiHandler.ts
|
|
19336
20580
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
19337
|
-
import { extname, join as join4, normalize, resolve as resolve8, sep } from "node:path";
|
|
20581
|
+
import { extname, join as join4, normalize, resolve as resolve8, sep as sep2 } from "node:path";
|
|
19338
20582
|
var CONTENT_TYPES = {
|
|
19339
20583
|
".html": "text/html; charset=utf-8",
|
|
19340
20584
|
".js": "text/javascript; charset=utf-8",
|
|
@@ -19361,12 +20605,12 @@ function createUiHandler(distDir) {
|
|
|
19361
20605
|
}
|
|
19362
20606
|
const path = normalize(urlPath);
|
|
19363
20607
|
const filePath = join4(dist, path);
|
|
19364
|
-
if (!filePath.startsWith(dist +
|
|
20608
|
+
if (!filePath.startsWith(dist + sep2) && filePath !== dist) {
|
|
19365
20609
|
res.writeHead(403).end();
|
|
19366
20610
|
return;
|
|
19367
20611
|
}
|
|
19368
20612
|
const ext = extname(filePath);
|
|
19369
|
-
if (path === "/" || path === `${
|
|
20613
|
+
if (path === "/" || path === `${sep2}index.html` || ext === "") {
|
|
19370
20614
|
res.writeHead(200, { "Content-Type": CONTENT_TYPES[".html"] }).end(indexHtml);
|
|
19371
20615
|
return;
|
|
19372
20616
|
}
|
|
@@ -19394,22 +20638,24 @@ var createShellLaunch = async ({ shared }) => {
|
|
|
19394
20638
|
handle: createUiHandler(distDir)
|
|
19395
20639
|
});
|
|
19396
20640
|
};
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
return;
|
|
19402
|
-
}
|
|
20641
|
+
var argv = process.argv.slice(2);
|
|
20642
|
+
async function main(args) {
|
|
20643
|
+
const { writeStartupEvent } = args;
|
|
20644
|
+
warnAboutDeprecatedBind({ argv });
|
|
19403
20645
|
await launchDevShell({
|
|
19404
|
-
devShellVersion: readDevShellVersion(
|
|
20646
|
+
devShellVersion: readDevShellVersion({
|
|
20647
|
+
packageDir: resolve9(__dirname, "../..")
|
|
20648
|
+
}),
|
|
19405
20649
|
argv,
|
|
19406
20650
|
workerBaseDir: process.cwd(),
|
|
19407
20651
|
detectFromDir: process.cwd(),
|
|
19408
20652
|
createShellLaunch,
|
|
19409
|
-
prebuiltDir: resolve9(__dirname, "../..", "data")
|
|
20653
|
+
prebuiltDir: resolve9(__dirname, "../..", "data"),
|
|
20654
|
+
writeStartupEvent
|
|
19410
20655
|
});
|
|
19411
20656
|
}
|
|
19412
|
-
|
|
20657
|
+
var run = argv[0] === "convert" ? runConvert(argv.slice(1)) : runWithStartupOutput({ main });
|
|
20658
|
+
run.catch((error) => {
|
|
19413
20659
|
console.error(formatUnknownErrorWithStack(error));
|
|
19414
20660
|
process.exitCode = 1;
|
|
19415
20661
|
});
|