@notionhq/custom-blocks-dev-shell 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/dist/assets/{index-B4LAgGzW.css → index-CohEBjwO.css} +1 -1
- package/dist/assets/index-G-f2Po2-.js +12 -0
- package/dist/index.html +2 -2
- package/dist-cli/cli/published-cli.js +408 -360
- package/docs/bindings.md +8 -7
- package/docs/bridge/changelog.md +18 -10
- package/docs/bridge/protocol.md +26 -6
- package/docs/host/README.md +10 -12
- package/docs/host/docs/compatibility.md +13 -1
- package/docs/host/docs/handlers.md +9 -0
- package/docs/host/docs/host-contract.md +20 -13
- package/docs/host/docs/lifecycle.md +14 -2
- package/package.json +1 -1
- package/dist/assets/index-CjUu48lJ.js +0 -12
|
@@ -968,7 +968,7 @@ function safeParse(schema, input, config$1) {
|
|
|
968
968
|
}
|
|
969
969
|
|
|
970
970
|
// ../protocol/src/dataSources/properties/propertySchema.ts
|
|
971
|
-
var
|
|
971
|
+
var knownNotionPropertyColorSchema = picklist([
|
|
972
972
|
"default",
|
|
973
973
|
"gray",
|
|
974
974
|
"brown",
|
|
@@ -990,6 +990,7 @@ var notionPropertyColorSchema = picklist([
|
|
|
990
990
|
"red_background",
|
|
991
991
|
"default_background"
|
|
992
992
|
]);
|
|
993
|
+
var notionPropertyColorSchema = union([knownNotionPropertyColorSchema, string()]);
|
|
993
994
|
var notionPropertyOptionSchema = object({
|
|
994
995
|
id: string(),
|
|
995
996
|
name: string(),
|
|
@@ -1436,6 +1437,7 @@ var protocol3To11InitMessageSchema = variant("status", [
|
|
|
1436
1437
|
]);
|
|
1437
1438
|
|
|
1438
1439
|
// ../protocol/src/compatibility/protocol3To11/initResult.ts
|
|
1440
|
+
var protocol3To11InitResultErrorCodeSchema = string();
|
|
1439
1441
|
var protocol3To11InitResultMessageSchema = variant("status", [
|
|
1440
1442
|
object({
|
|
1441
1443
|
type: literal("initResult"),
|
|
@@ -1448,7 +1450,10 @@ var protocol3To11InitResultMessageSchema = variant("status", [
|
|
|
1448
1450
|
type: literal("initResult"),
|
|
1449
1451
|
initializationId: string(),
|
|
1450
1452
|
status: literal("error"),
|
|
1451
|
-
error:
|
|
1453
|
+
error: object({
|
|
1454
|
+
...customBlockErrorInfoSchema.entries,
|
|
1455
|
+
code: protocol3To11InitResultErrorCodeSchema
|
|
1456
|
+
})
|
|
1452
1457
|
})
|
|
1453
1458
|
]);
|
|
1454
1459
|
|
|
@@ -1524,14 +1529,6 @@ var themeChangedMessageSchema = object({
|
|
|
1524
1529
|
theme: notionThemeSchema
|
|
1525
1530
|
});
|
|
1526
1531
|
|
|
1527
|
-
// ../protocol/src/dataSources/messages/dataSourcesChanged.ts
|
|
1528
|
-
var dataSourcesChangedMessageSchema = object({
|
|
1529
|
-
type: literal("dataSourcesChanged"),
|
|
1530
|
-
dataSources: object({
|
|
1531
|
-
bindings: bridgeDataSourceBindingsSchema
|
|
1532
|
-
})
|
|
1533
|
-
});
|
|
1534
|
-
|
|
1535
1532
|
// ../protocol/src/dataSources/messages/getDataSource.ts
|
|
1536
1533
|
var getDataSourceMessageSchema = object({
|
|
1537
1534
|
type: literal("getDataSource"),
|
|
@@ -1558,90 +1555,6 @@ var dataSourcesInvalidatedMessageSchema = object({
|
|
|
1558
1555
|
type: literal("dataSourcesInvalidated")
|
|
1559
1556
|
});
|
|
1560
1557
|
|
|
1561
|
-
// ../protocol/src/dataSources/properties/dateValue.ts
|
|
1562
|
-
var notionDateReminderSchema = object({
|
|
1563
|
-
unit: picklist(["year", "month", "week", "day"]),
|
|
1564
|
-
value: number(),
|
|
1565
|
-
time: string(),
|
|
1566
|
-
defaultTimeZone: optional(string())
|
|
1567
|
-
});
|
|
1568
|
-
var notionTimeReminderSchema = object({
|
|
1569
|
-
unit: picklist(["hour", "minute"]),
|
|
1570
|
-
value: number()
|
|
1571
|
-
});
|
|
1572
|
-
var notionDisabledReminderSchema = object({
|
|
1573
|
-
unit: literal("none")
|
|
1574
|
-
});
|
|
1575
|
-
var notionDateTimeReminderSchema = union([
|
|
1576
|
-
notionDateReminderSchema,
|
|
1577
|
-
notionTimeReminderSchema
|
|
1578
|
-
]);
|
|
1579
|
-
var dateOrDisabledReminder = optional(
|
|
1580
|
-
union([notionDateReminderSchema, notionDisabledReminderSchema])
|
|
1581
|
-
);
|
|
1582
|
-
var dateTimeOrDisabledReminder = optional(
|
|
1583
|
-
union([notionDateTimeReminderSchema, notionDisabledReminderSchema])
|
|
1584
|
-
);
|
|
1585
|
-
var notionDateSchema = object({
|
|
1586
|
-
type: literal("date"),
|
|
1587
|
-
start_date: string(),
|
|
1588
|
-
reminder: dateOrDisabledReminder
|
|
1589
|
-
});
|
|
1590
|
-
var notionDateRangeSchema = object({
|
|
1591
|
-
type: literal("daterange"),
|
|
1592
|
-
start_date: string(),
|
|
1593
|
-
end_date: string(),
|
|
1594
|
-
reminder: dateOrDisabledReminder
|
|
1595
|
-
});
|
|
1596
|
-
var notionDateTimeSchema = object({
|
|
1597
|
-
type: literal("datetime"),
|
|
1598
|
-
start_date: string(),
|
|
1599
|
-
start_time: string(),
|
|
1600
|
-
time_zone: optional(string()),
|
|
1601
|
-
reminder: dateTimeOrDisabledReminder
|
|
1602
|
-
});
|
|
1603
|
-
var notionDateTimeRangeSchema = object({
|
|
1604
|
-
type: literal("datetimerange"),
|
|
1605
|
-
start_date: string(),
|
|
1606
|
-
start_time: string(),
|
|
1607
|
-
end_date: string(),
|
|
1608
|
-
end_time: string(),
|
|
1609
|
-
time_zone: optional(string()),
|
|
1610
|
-
reminder: dateTimeOrDisabledReminder
|
|
1611
|
-
});
|
|
1612
|
-
var notionDateValueSchema = variant("type", [
|
|
1613
|
-
notionDateSchema,
|
|
1614
|
-
notionDateRangeSchema,
|
|
1615
|
-
notionDateTimeSchema,
|
|
1616
|
-
notionDateTimeRangeSchema
|
|
1617
|
-
]);
|
|
1618
|
-
|
|
1619
|
-
// ../protocol/src/utils/recordPointer.ts
|
|
1620
|
-
var notionRecordPointerSchema = object({
|
|
1621
|
-
id: string(),
|
|
1622
|
-
table: string()
|
|
1623
|
-
});
|
|
1624
|
-
|
|
1625
|
-
// ../protocol/src/compatibility/protocol3To5/dataSourceValue.ts
|
|
1626
|
-
var notionDataSourceValueSchema = union([
|
|
1627
|
-
string(),
|
|
1628
|
-
number(),
|
|
1629
|
-
boolean(),
|
|
1630
|
-
notionDateValueSchema,
|
|
1631
|
-
array(string()),
|
|
1632
|
-
array(notionRecordPointerSchema)
|
|
1633
|
-
]);
|
|
1634
|
-
|
|
1635
|
-
// ../protocol/src/compatibility/protocol3To5/dataSourcePage.ts
|
|
1636
|
-
var notionDataSourcePageForProtocol3To5Schema = object({
|
|
1637
|
-
id: notionPageIdSchema,
|
|
1638
|
-
/** Whether the page or an ancestor is archived. */
|
|
1639
|
-
is_archived: boolean(),
|
|
1640
|
-
/** Whether the page or an ancestor is in Trash. */
|
|
1641
|
-
in_trash: boolean(),
|
|
1642
|
-
propertiesById: record(string(), optional(notionDataSourceValueSchema))
|
|
1643
|
-
});
|
|
1644
|
-
|
|
1645
1558
|
// ../protocol/src/files.ts
|
|
1646
1559
|
var bridgeExternalFileSchema = object({
|
|
1647
1560
|
type: literal("external"),
|
|
@@ -1713,6 +1626,64 @@ var bridgePageCoverSchema = variant("type", [
|
|
|
1713
1626
|
// ../protocol/src/utils/nullableStringSchema.ts
|
|
1714
1627
|
var nullableStringSchema = nullable(string());
|
|
1715
1628
|
|
|
1629
|
+
// ../protocol/src/dataSources/properties/dateValue.ts
|
|
1630
|
+
var notionDateReminderSchema = object({
|
|
1631
|
+
unit: picklist(["year", "month", "week", "day"]),
|
|
1632
|
+
value: number(),
|
|
1633
|
+
time: string(),
|
|
1634
|
+
defaultTimeZone: optional(string())
|
|
1635
|
+
});
|
|
1636
|
+
var notionTimeReminderSchema = object({
|
|
1637
|
+
unit: picklist(["hour", "minute"]),
|
|
1638
|
+
value: number()
|
|
1639
|
+
});
|
|
1640
|
+
var notionDisabledReminderSchema = object({
|
|
1641
|
+
unit: literal("none")
|
|
1642
|
+
});
|
|
1643
|
+
var notionDateTimeReminderSchema = union([
|
|
1644
|
+
notionDateReminderSchema,
|
|
1645
|
+
notionTimeReminderSchema
|
|
1646
|
+
]);
|
|
1647
|
+
var dateOrDisabledReminder = optional(
|
|
1648
|
+
union([notionDateReminderSchema, notionDisabledReminderSchema])
|
|
1649
|
+
);
|
|
1650
|
+
var dateTimeOrDisabledReminder = optional(
|
|
1651
|
+
union([notionDateTimeReminderSchema, notionDisabledReminderSchema])
|
|
1652
|
+
);
|
|
1653
|
+
var notionDateSchema = object({
|
|
1654
|
+
type: literal("date"),
|
|
1655
|
+
start_date: string(),
|
|
1656
|
+
reminder: dateOrDisabledReminder
|
|
1657
|
+
});
|
|
1658
|
+
var notionDateRangeSchema = object({
|
|
1659
|
+
type: literal("daterange"),
|
|
1660
|
+
start_date: string(),
|
|
1661
|
+
end_date: string(),
|
|
1662
|
+
reminder: dateOrDisabledReminder
|
|
1663
|
+
});
|
|
1664
|
+
var notionDateTimeSchema = object({
|
|
1665
|
+
type: literal("datetime"),
|
|
1666
|
+
start_date: string(),
|
|
1667
|
+
start_time: string(),
|
|
1668
|
+
time_zone: optional(string()),
|
|
1669
|
+
reminder: dateTimeOrDisabledReminder
|
|
1670
|
+
});
|
|
1671
|
+
var notionDateTimeRangeSchema = object({
|
|
1672
|
+
type: literal("datetimerange"),
|
|
1673
|
+
start_date: string(),
|
|
1674
|
+
start_time: string(),
|
|
1675
|
+
end_date: string(),
|
|
1676
|
+
end_time: string(),
|
|
1677
|
+
time_zone: optional(string()),
|
|
1678
|
+
reminder: dateTimeOrDisabledReminder
|
|
1679
|
+
});
|
|
1680
|
+
var notionDateValueSchema = variant("type", [
|
|
1681
|
+
notionDateSchema,
|
|
1682
|
+
notionDateRangeSchema,
|
|
1683
|
+
notionDateTimeSchema,
|
|
1684
|
+
notionDateTimeRangeSchema
|
|
1685
|
+
]);
|
|
1686
|
+
|
|
1716
1687
|
// ../protocol/src/pages/properties/dateInput.ts
|
|
1717
1688
|
var dateInputEntries = {
|
|
1718
1689
|
start: string(),
|
|
@@ -1739,11 +1710,16 @@ var notionDateInputSchema = union([
|
|
|
1739
1710
|
})
|
|
1740
1711
|
]);
|
|
1741
1712
|
|
|
1713
|
+
// ../protocol/src/utils/recordPointer.ts
|
|
1714
|
+
var notionRecordPointerSchema = object({
|
|
1715
|
+
id: string(),
|
|
1716
|
+
table: string()
|
|
1717
|
+
});
|
|
1718
|
+
|
|
1742
1719
|
// ../protocol/src/pages/properties/metadataActor.ts
|
|
1743
1720
|
var metadataActorSchema = nullable(
|
|
1744
1721
|
object({
|
|
1745
1722
|
...notionRecordPointerSchema.entries,
|
|
1746
|
-
table: picklist(["notion_user", "bot", "organization_bot"]),
|
|
1747
1723
|
spaceId: optional(string())
|
|
1748
1724
|
})
|
|
1749
1725
|
);
|
|
@@ -1930,6 +1906,18 @@ var bridgePagePropertyReadMapSchema = record(
|
|
|
1930
1906
|
);
|
|
1931
1907
|
|
|
1932
1908
|
// ../protocol/src/pages/bridgePage.ts
|
|
1909
|
+
var pageIconReadSchema = union([
|
|
1910
|
+
bridgePageIconSchema,
|
|
1911
|
+
pipe(
|
|
1912
|
+
object({ type: string() }),
|
|
1913
|
+
check(
|
|
1914
|
+
(icon) => !bridgePageIconSchema.options.some(
|
|
1915
|
+
(option) => option.entries.type.literal === icon.type
|
|
1916
|
+
)
|
|
1917
|
+
),
|
|
1918
|
+
transform(() => null)
|
|
1919
|
+
)
|
|
1920
|
+
]);
|
|
1933
1921
|
var bridgePageSchema = object({
|
|
1934
1922
|
object: literal("page"),
|
|
1935
1923
|
id: notionPageIdSchema,
|
|
@@ -1939,7 +1927,7 @@ var bridgePageSchema = object({
|
|
|
1939
1927
|
last_edited_by: optional(metadataActorSchema, null),
|
|
1940
1928
|
created_time: optional(nullable(string()), null),
|
|
1941
1929
|
last_edited_time: optional(nullable(string()), null),
|
|
1942
|
-
icon: optional(nullable(
|
|
1930
|
+
icon: optional(nullable(pageIconReadSchema), null),
|
|
1943
1931
|
cover: optional(nullable(bridgePageCoverSchema), null),
|
|
1944
1932
|
url: optional(nullable(string()), null),
|
|
1945
1933
|
public_url: optional(nullable(string()), null),
|
|
@@ -2282,24 +2270,6 @@ var queryDataSourceResultMessageSchema = variant("status", [
|
|
|
2282
2270
|
error: customBlockQueryDataSourceErrorInfoSchema
|
|
2283
2271
|
})
|
|
2284
2272
|
]);
|
|
2285
|
-
var queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema = variant("status", [
|
|
2286
|
-
object({
|
|
2287
|
-
type: literal("queryDataSourceResult"),
|
|
2288
|
-
subscriptionId: string(),
|
|
2289
|
-
status: literal("success"),
|
|
2290
|
-
items: array(
|
|
2291
|
-
union([bridgePageSchema, notionDataSourcePageForProtocol3To5Schema])
|
|
2292
|
-
),
|
|
2293
|
-
hasMore: boolean(),
|
|
2294
|
-
limitClamp: optional(bridgeDataSourceQueryLimitClampSchema)
|
|
2295
|
-
}),
|
|
2296
|
-
object({
|
|
2297
|
-
type: literal("queryDataSourceResult"),
|
|
2298
|
-
subscriptionId: string(),
|
|
2299
|
-
status: literal("error"),
|
|
2300
|
-
error: customBlockQueryDataSourceErrorInfoSchema
|
|
2301
|
-
})
|
|
2302
|
-
]);
|
|
2303
2273
|
|
|
2304
2274
|
// ../protocol/src/handshake/connectResult.ts
|
|
2305
2275
|
var connectResultMessageSchema = variant("status", [
|
|
@@ -2344,24 +2314,6 @@ var openExternalUrlResultMessageSchema = variant("status", [
|
|
|
2344
2314
|
})
|
|
2345
2315
|
]);
|
|
2346
2316
|
|
|
2347
|
-
// ../protocol/src/compatibility/protocol3To5/bridgePage.ts
|
|
2348
|
-
var bridgePageForProtocol3To5Schema = object({
|
|
2349
|
-
object: literal("page"),
|
|
2350
|
-
id: notionPageIdSchema,
|
|
2351
|
-
parent: notionParentSchema,
|
|
2352
|
-
properties: bridgePagePropertyWriteMapSchema,
|
|
2353
|
-
created_time: optional(string()),
|
|
2354
|
-
last_edited_time: optional(string()),
|
|
2355
|
-
icon: optional(bridgePageIconSchema),
|
|
2356
|
-
cover: optional(bridgePageCoverSchema),
|
|
2357
|
-
url: optional(string()),
|
|
2358
|
-
public_url: optional(string()),
|
|
2359
|
-
/** Whether the page or an ancestor is archived. */
|
|
2360
|
-
is_archived: boolean(),
|
|
2361
|
-
/** Whether the page or an ancestor is in Trash. */
|
|
2362
|
-
in_trash: boolean()
|
|
2363
|
-
});
|
|
2364
|
-
|
|
2365
2317
|
// ../protocol/src/pages/messages/createPage.ts
|
|
2366
2318
|
var customBlockCreatePageErrorCodeSchema = string();
|
|
2367
2319
|
var customBlockCreatePageErrorInfoSchema = object({
|
|
@@ -2384,21 +2336,6 @@ var createPageResultMessageSchema = variant("status", [
|
|
|
2384
2336
|
error: customBlockCreatePageErrorInfoSchema
|
|
2385
2337
|
})
|
|
2386
2338
|
]);
|
|
2387
|
-
var createPageResultMessageWithProtocol3To5CompatibilitySchema = variant("status", [
|
|
2388
|
-
object({
|
|
2389
|
-
type: literal("createPageResult"),
|
|
2390
|
-
requestId: string(),
|
|
2391
|
-
status: literal("success"),
|
|
2392
|
-
/** The newly created page. */
|
|
2393
|
-
page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
|
|
2394
|
-
}),
|
|
2395
|
-
object({
|
|
2396
|
-
type: literal("createPageResult"),
|
|
2397
|
-
requestId: string(),
|
|
2398
|
-
status: literal("error"),
|
|
2399
|
-
error: customBlockCreatePageErrorInfoSchema
|
|
2400
|
-
})
|
|
2401
|
-
]);
|
|
2402
2339
|
var notionCreatePagePositionSchema = variant("type", [
|
|
2403
2340
|
object({ type: literal("start") }),
|
|
2404
2341
|
object({ type: literal("end") }),
|
|
@@ -2477,20 +2414,6 @@ var getPageResultMessageSchema = variant("status", [
|
|
|
2477
2414
|
error: customBlockGetPageErrorInfoSchema
|
|
2478
2415
|
})
|
|
2479
2416
|
]);
|
|
2480
|
-
var getPageResultMessageWithProtocol3To5CompatibilitySchema = variant("status", [
|
|
2481
|
-
object({
|
|
2482
|
-
type: literal("getPageResult"),
|
|
2483
|
-
requestId: string(),
|
|
2484
|
-
status: literal("success"),
|
|
2485
|
-
page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
|
|
2486
|
-
}),
|
|
2487
|
-
object({
|
|
2488
|
-
type: literal("getPageResult"),
|
|
2489
|
-
requestId: string(),
|
|
2490
|
-
status: literal("error"),
|
|
2491
|
-
error: customBlockGetPageErrorInfoSchema
|
|
2492
|
-
})
|
|
2493
|
-
]);
|
|
2494
2417
|
|
|
2495
2418
|
// ../protocol/src/pages/messages/openPage.ts
|
|
2496
2419
|
var openPageModeSchema = picklist(["side_peek", "center_peek"]);
|
|
@@ -2542,20 +2465,6 @@ var updatePageResultMessageSchema = variant("status", [
|
|
|
2542
2465
|
error: customBlockUpdatePageErrorInfoSchema
|
|
2543
2466
|
})
|
|
2544
2467
|
]);
|
|
2545
|
-
var updatePageResultMessageWithProtocol3To5CompatibilitySchema = variant("status", [
|
|
2546
|
-
object({
|
|
2547
|
-
type: literal("updatePageResult"),
|
|
2548
|
-
requestId: string(),
|
|
2549
|
-
status: literal("success"),
|
|
2550
|
-
page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
|
|
2551
|
-
}),
|
|
2552
|
-
object({
|
|
2553
|
-
type: literal("updatePageResult"),
|
|
2554
|
-
requestId: string(),
|
|
2555
|
-
status: literal("error"),
|
|
2556
|
-
error: customBlockUpdatePageErrorInfoSchema
|
|
2557
|
-
})
|
|
2558
|
-
]);
|
|
2559
2468
|
var updatePageMessageSchema = object({
|
|
2560
2469
|
type: literal("updatePage"),
|
|
2561
2470
|
requestId: string(),
|
|
@@ -2587,12 +2496,6 @@ var bridgeUserSchema = object({
|
|
|
2587
2496
|
})
|
|
2588
2497
|
});
|
|
2589
2498
|
|
|
2590
|
-
// ../protocol/src/users/messages/currentUserChanged.ts
|
|
2591
|
-
var currentUserChangedMessageSchema = object({
|
|
2592
|
-
type: literal("currentUserChanged"),
|
|
2593
|
-
currentUser: bridgeUserSchema
|
|
2594
|
-
});
|
|
2595
|
-
|
|
2596
2499
|
// ../protocol/src/users/messages/getCurrentUser.ts
|
|
2597
2500
|
var getCurrentUserMessageSchema = object({
|
|
2598
2501
|
type: literal("getCurrentUser"),
|
|
@@ -2640,6 +2543,35 @@ var getUserResultMessageSchema = variant("status", [
|
|
|
2640
2543
|
})
|
|
2641
2544
|
]);
|
|
2642
2545
|
|
|
2546
|
+
// ../protocol/src/users/viewer.ts
|
|
2547
|
+
var bridgeViewerSchema = variant("type", [
|
|
2548
|
+
object({
|
|
2549
|
+
type: literal("user"),
|
|
2550
|
+
userId: pipe(notionUserIdSchema, nonEmpty())
|
|
2551
|
+
}),
|
|
2552
|
+
object({ type: literal("anonymous") })
|
|
2553
|
+
]);
|
|
2554
|
+
|
|
2555
|
+
// ../protocol/src/users/messages/getViewer.ts
|
|
2556
|
+
var getViewerMessageSchema = object({
|
|
2557
|
+
type: literal("getViewer"),
|
|
2558
|
+
requestId: string()
|
|
2559
|
+
});
|
|
2560
|
+
var getViewerResultMessageSchema = variant("status", [
|
|
2561
|
+
object({
|
|
2562
|
+
type: literal("getViewerResult"),
|
|
2563
|
+
requestId: string(),
|
|
2564
|
+
status: literal("success"),
|
|
2565
|
+
viewer: bridgeViewerSchema
|
|
2566
|
+
}),
|
|
2567
|
+
object({
|
|
2568
|
+
type: literal("getViewerResult"),
|
|
2569
|
+
requestId: string(),
|
|
2570
|
+
status: literal("error"),
|
|
2571
|
+
error: customBlockErrorInfoSchema
|
|
2572
|
+
})
|
|
2573
|
+
]);
|
|
2574
|
+
|
|
2643
2575
|
// ../protocol/src/users/bridgeUserList.ts
|
|
2644
2576
|
var bridgeUserListSchema = object({
|
|
2645
2577
|
object: literal("list"),
|
|
@@ -2665,56 +2597,166 @@ var listUsersMessageSchema = object({
|
|
|
2665
2597
|
});
|
|
2666
2598
|
var listUsersResultMessageSchema = variant("status", [
|
|
2667
2599
|
object({
|
|
2668
|
-
type: literal("listUsersResult"),
|
|
2669
|
-
requestId: string(),
|
|
2600
|
+
type: literal("listUsersResult"),
|
|
2601
|
+
requestId: string(),
|
|
2602
|
+
status: literal("success"),
|
|
2603
|
+
list: bridgeUserListSchema
|
|
2604
|
+
}),
|
|
2605
|
+
object({
|
|
2606
|
+
type: literal("listUsersResult"),
|
|
2607
|
+
requestId: string(),
|
|
2608
|
+
status: literal("error"),
|
|
2609
|
+
error: customBlockListUsersErrorInfoSchema
|
|
2610
|
+
})
|
|
2611
|
+
]);
|
|
2612
|
+
|
|
2613
|
+
// ../protocol/src/messages/invalidSandboxMessage.ts
|
|
2614
|
+
var invalidSandboxMessageSchema = object({
|
|
2615
|
+
type: literal("invalidSandboxMessage"),
|
|
2616
|
+
/** Identifies the rejected request or response, when readable. */
|
|
2617
|
+
requestId: optional(string()),
|
|
2618
|
+
/** Identifies the affected query subscription, when readable. */
|
|
2619
|
+
subscriptionId: optional(string()),
|
|
2620
|
+
/**
|
|
2621
|
+
* A human-readable string intended for sandbox-side logging. It has no structured contract.
|
|
2622
|
+
*/
|
|
2623
|
+
reason: string()
|
|
2624
|
+
});
|
|
2625
|
+
|
|
2626
|
+
// ../protocol/src/messages/hostToSandbox.ts
|
|
2627
|
+
var hostToSandboxMessageSchema = variant("type", [
|
|
2628
|
+
connectResultMessageSchema,
|
|
2629
|
+
setupInitMessageSchema,
|
|
2630
|
+
getDataSourceResultMessageSchema,
|
|
2631
|
+
getCurrentUserResultMessageSchema,
|
|
2632
|
+
getViewerResultMessageSchema,
|
|
2633
|
+
dataSourcesInvalidatedMessageSchema,
|
|
2634
|
+
themeChangedMessageSchema,
|
|
2635
|
+
contrastModeChangedMessageSchema,
|
|
2636
|
+
parentChangedMessageSchema,
|
|
2637
|
+
pageChangedMessageSchema,
|
|
2638
|
+
pageErrorMessageSchema,
|
|
2639
|
+
parentErrorMessageSchema,
|
|
2640
|
+
getUserResultMessageSchema,
|
|
2641
|
+
listUsersResultMessageSchema,
|
|
2642
|
+
openPageResultMessageSchema,
|
|
2643
|
+
openExternalUrlResultMessageSchema,
|
|
2644
|
+
invalidSandboxMessageSchema,
|
|
2645
|
+
queryDataSourceResultMessageSchema,
|
|
2646
|
+
getPageResultMessageSchema,
|
|
2647
|
+
createPageResultMessageSchema,
|
|
2648
|
+
updatePageResultMessageSchema
|
|
2649
|
+
]);
|
|
2650
|
+
|
|
2651
|
+
// ../protocol/src/compatibility/protocol3To5/bridgePage.ts
|
|
2652
|
+
var bridgePageForProtocol3To5Schema = object({
|
|
2653
|
+
object: literal("page"),
|
|
2654
|
+
id: notionPageIdSchema,
|
|
2655
|
+
parent: notionParentSchema,
|
|
2656
|
+
properties: bridgePagePropertyWriteMapSchema,
|
|
2657
|
+
created_time: optional(string()),
|
|
2658
|
+
last_edited_time: optional(string()),
|
|
2659
|
+
icon: optional(bridgePageIconSchema),
|
|
2660
|
+
cover: optional(bridgePageCoverSchema),
|
|
2661
|
+
url: optional(string()),
|
|
2662
|
+
public_url: optional(string()),
|
|
2663
|
+
/** Whether the page or an ancestor is archived. */
|
|
2664
|
+
is_archived: boolean(),
|
|
2665
|
+
/** Whether the page or an ancestor is in Trash. */
|
|
2666
|
+
in_trash: boolean()
|
|
2667
|
+
});
|
|
2668
|
+
|
|
2669
|
+
// ../protocol/src/compatibility/protocol3To5/dataSourceValue.ts
|
|
2670
|
+
var notionDataSourceValueSchema = union([
|
|
2671
|
+
string(),
|
|
2672
|
+
number(),
|
|
2673
|
+
boolean(),
|
|
2674
|
+
notionDateValueSchema,
|
|
2675
|
+
array(string()),
|
|
2676
|
+
array(notionRecordPointerSchema)
|
|
2677
|
+
]);
|
|
2678
|
+
|
|
2679
|
+
// ../protocol/src/compatibility/protocol3To5/dataSourcePage.ts
|
|
2680
|
+
var notionDataSourcePageForProtocol3To5Schema = object({
|
|
2681
|
+
id: notionPageIdSchema,
|
|
2682
|
+
/** Whether the page or an ancestor is archived. */
|
|
2683
|
+
is_archived: boolean(),
|
|
2684
|
+
/** Whether the page or an ancestor is in Trash. */
|
|
2685
|
+
in_trash: boolean(),
|
|
2686
|
+
propertiesById: record(string(), optional(notionDataSourceValueSchema))
|
|
2687
|
+
});
|
|
2688
|
+
|
|
2689
|
+
// ../protocol/src/compatibility/protocol3To5/pageResults.ts
|
|
2690
|
+
var createPageResultMessageWithProtocol3To5CompatibilitySchema = variant("status", [
|
|
2691
|
+
object({
|
|
2692
|
+
type: literal("createPageResult"),
|
|
2693
|
+
requestId: string(),
|
|
2694
|
+
status: literal("success"),
|
|
2695
|
+
/** The newly created page. */
|
|
2696
|
+
page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
|
|
2697
|
+
}),
|
|
2698
|
+
object({
|
|
2699
|
+
type: literal("createPageResult"),
|
|
2700
|
+
requestId: string(),
|
|
2701
|
+
status: literal("error"),
|
|
2702
|
+
error: customBlockCreatePageErrorInfoSchema
|
|
2703
|
+
})
|
|
2704
|
+
]);
|
|
2705
|
+
var getPageResultMessageWithProtocol3To5CompatibilitySchema = variant("status", [
|
|
2706
|
+
object({
|
|
2707
|
+
type: literal("getPageResult"),
|
|
2708
|
+
requestId: string(),
|
|
2709
|
+
status: literal("success"),
|
|
2710
|
+
page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
|
|
2711
|
+
}),
|
|
2712
|
+
object({
|
|
2713
|
+
type: literal("getPageResult"),
|
|
2714
|
+
requestId: string(),
|
|
2715
|
+
status: literal("error"),
|
|
2716
|
+
error: customBlockGetPageErrorInfoSchema
|
|
2717
|
+
})
|
|
2718
|
+
]);
|
|
2719
|
+
var updatePageResultMessageWithProtocol3To5CompatibilitySchema = variant("status", [
|
|
2720
|
+
object({
|
|
2721
|
+
type: literal("updatePageResult"),
|
|
2722
|
+
requestId: string(),
|
|
2723
|
+
status: literal("success"),
|
|
2724
|
+
page: union([bridgePageSchema, bridgePageForProtocol3To5Schema])
|
|
2725
|
+
}),
|
|
2726
|
+
object({
|
|
2727
|
+
type: literal("updatePageResult"),
|
|
2728
|
+
requestId: string(),
|
|
2729
|
+
status: literal("error"),
|
|
2730
|
+
error: customBlockUpdatePageErrorInfoSchema
|
|
2731
|
+
})
|
|
2732
|
+
]);
|
|
2733
|
+
var queryDataSourceResultMessageWithProtocol3To5CompatibilitySchema = variant("status", [
|
|
2734
|
+
object({
|
|
2735
|
+
type: literal("queryDataSourceResult"),
|
|
2736
|
+
subscriptionId: string(),
|
|
2670
2737
|
status: literal("success"),
|
|
2671
|
-
|
|
2738
|
+
items: array(
|
|
2739
|
+
union([bridgePageSchema, notionDataSourcePageForProtocol3To5Schema])
|
|
2740
|
+
),
|
|
2741
|
+
hasMore: boolean(),
|
|
2742
|
+
limitClamp: optional(bridgeDataSourceQueryLimitClampSchema)
|
|
2672
2743
|
}),
|
|
2673
2744
|
object({
|
|
2674
|
-
type: literal("
|
|
2675
|
-
|
|
2745
|
+
type: literal("queryDataSourceResult"),
|
|
2746
|
+
subscriptionId: string(),
|
|
2676
2747
|
status: literal("error"),
|
|
2677
|
-
error:
|
|
2748
|
+
error: customBlockQueryDataSourceErrorInfoSchema
|
|
2678
2749
|
})
|
|
2679
2750
|
]);
|
|
2680
2751
|
|
|
2681
|
-
// ../protocol/src/
|
|
2682
|
-
var
|
|
2683
|
-
type: literal("
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
* A human-readable string intended for sandbox-side logging. It has no structured contract.
|
|
2688
|
-
*/
|
|
2689
|
-
reason: string()
|
|
2752
|
+
// ../protocol/src/compatibility/protocol11/dataSourcesChanged.ts
|
|
2753
|
+
var dataSourcesChangedMessageSchema = object({
|
|
2754
|
+
type: literal("dataSourcesChanged"),
|
|
2755
|
+
dataSources: object({
|
|
2756
|
+
bindings: bridgeDataSourceBindingsSchema
|
|
2757
|
+
})
|
|
2690
2758
|
});
|
|
2691
2759
|
|
|
2692
|
-
// ../protocol/src/messages/hostToSandbox.ts
|
|
2693
|
-
var hostToSandboxMessageSchema = variant("type", [
|
|
2694
|
-
connectResultMessageSchema,
|
|
2695
|
-
setupInitMessageSchema,
|
|
2696
|
-
getDataSourceResultMessageSchema,
|
|
2697
|
-
getCurrentUserResultMessageSchema,
|
|
2698
|
-
dataSourcesInvalidatedMessageSchema,
|
|
2699
|
-
themeChangedMessageSchema,
|
|
2700
|
-
contrastModeChangedMessageSchema,
|
|
2701
|
-
parentChangedMessageSchema,
|
|
2702
|
-
pageChangedMessageSchema,
|
|
2703
|
-
pageErrorMessageSchema,
|
|
2704
|
-
parentErrorMessageSchema,
|
|
2705
|
-
currentUserChangedMessageSchema,
|
|
2706
|
-
dataSourcesChangedMessageSchema,
|
|
2707
|
-
getUserResultMessageSchema,
|
|
2708
|
-
listUsersResultMessageSchema,
|
|
2709
|
-
openPageResultMessageSchema,
|
|
2710
|
-
openExternalUrlResultMessageSchema,
|
|
2711
|
-
invalidSandboxMessageSchema,
|
|
2712
|
-
queryDataSourceResultMessageSchema,
|
|
2713
|
-
getPageResultMessageSchema,
|
|
2714
|
-
createPageResultMessageSchema,
|
|
2715
|
-
updatePageResultMessageSchema
|
|
2716
|
-
]);
|
|
2717
|
-
|
|
2718
2760
|
// ../protocol/src/compatibility/protocol3To11/hostToSandbox.ts
|
|
2719
2761
|
var protocol3To11HostToSandboxMessageSchema = variant("type", [
|
|
2720
2762
|
protocol3To11InitMessageSchema,
|
|
@@ -2787,6 +2829,8 @@ var invalidHostMessageSchema = object({
|
|
|
2787
2829
|
type: literal("invalidHostMessage"),
|
|
2788
2830
|
/** Identifies the rejected request or response, when readable. */
|
|
2789
2831
|
requestId: optional(string()),
|
|
2832
|
+
/** Identifies the affected query subscription, when readable. */
|
|
2833
|
+
subscriptionId: optional(string()),
|
|
2790
2834
|
/**
|
|
2791
2835
|
* A human-readable string intended for sandbox-side logging. It has no structured contract.
|
|
2792
2836
|
*/
|
|
@@ -2842,6 +2886,7 @@ var sandboxToHostMessageSchema = variant("type", [
|
|
|
2842
2886
|
connectRequestMessageSchema,
|
|
2843
2887
|
getDataSourceMessageSchema,
|
|
2844
2888
|
getCurrentUserMessageSchema,
|
|
2889
|
+
getViewerMessageSchema,
|
|
2845
2890
|
initResultRequestMessageSchema,
|
|
2846
2891
|
readyMessageSchema,
|
|
2847
2892
|
queryDataSourceMessageSchema,
|
|
@@ -2906,6 +2951,56 @@ var notionDataSourceSchema = object({
|
|
|
2906
2951
|
// ../protocol/src/utils/readRequestId.ts
|
|
2907
2952
|
var requestIdentitySchema = object({ requestId: string() });
|
|
2908
2953
|
|
|
2954
|
+
// shared/dataSources/localPropertyValues.ts
|
|
2955
|
+
var stringValue = string();
|
|
2956
|
+
var numberValue = pipe(number(), finite());
|
|
2957
|
+
var booleanValue = boolean();
|
|
2958
|
+
var stringArrayValue = array(string());
|
|
2959
|
+
var pointerArrayValue = array(notionRecordPointerSchema);
|
|
2960
|
+
var anyLocalValue = union([
|
|
2961
|
+
stringValue,
|
|
2962
|
+
numberValue,
|
|
2963
|
+
booleanValue,
|
|
2964
|
+
notionDateValueSchema,
|
|
2965
|
+
stringArrayValue,
|
|
2966
|
+
pointerArrayValue
|
|
2967
|
+
]);
|
|
2968
|
+
var bindingValueSchemas = {
|
|
2969
|
+
title: stringValue,
|
|
2970
|
+
rich_text: stringValue,
|
|
2971
|
+
url: stringValue,
|
|
2972
|
+
email: stringValue,
|
|
2973
|
+
phone_number: stringValue,
|
|
2974
|
+
select: stringValue,
|
|
2975
|
+
status: stringValue,
|
|
2976
|
+
number: numberValue,
|
|
2977
|
+
checkbox: booleanValue,
|
|
2978
|
+
multi_select: stringArrayValue,
|
|
2979
|
+
date: notionDateValueSchema,
|
|
2980
|
+
created_time: notionDateValueSchema,
|
|
2981
|
+
last_edited_time: notionDateValueSchema,
|
|
2982
|
+
people: pointerArrayValue,
|
|
2983
|
+
relation: pointerArrayValue,
|
|
2984
|
+
files: stringValue
|
|
2985
|
+
};
|
|
2986
|
+
var convertedValueSchemas = {
|
|
2987
|
+
...bindingValueSchemas,
|
|
2988
|
+
created_by: pointerArrayValue,
|
|
2989
|
+
last_edited_by: pointerArrayValue,
|
|
2990
|
+
unique_id: stringValue,
|
|
2991
|
+
formula: stringValue,
|
|
2992
|
+
rollup: stringValue,
|
|
2993
|
+
verification: stringValue,
|
|
2994
|
+
place: stringValue
|
|
2995
|
+
};
|
|
2996
|
+
function matchesConvertedPropertyType(value, type) {
|
|
2997
|
+
const schema = is(notionPropertyTypeSchema, type) ? convertedValueSchemas[type] : void 0;
|
|
2998
|
+
return is(schema ?? anyLocalValue, value);
|
|
2999
|
+
}
|
|
3000
|
+
function isConvertedDataSourceValue(value) {
|
|
3001
|
+
return is(anyLocalValue, value);
|
|
3002
|
+
}
|
|
3003
|
+
|
|
2909
3004
|
// cli/diagnostics/formatUnknownError.ts
|
|
2910
3005
|
function formatUnknownError(error) {
|
|
2911
3006
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -2969,50 +3064,6 @@ function slugify(name) {
|
|
|
2969
3064
|
import { readFileSync } from "node:fs";
|
|
2970
3065
|
import { basename, resolve } from "node:path";
|
|
2971
3066
|
|
|
2972
|
-
// shared/dataSources/sampleDataSource.ts
|
|
2973
|
-
var sampleDataSourceTypeSchema = picklist([
|
|
2974
|
-
"built-in",
|
|
2975
|
-
"worker",
|
|
2976
|
-
"manual",
|
|
2977
|
-
"syncedFromProd"
|
|
2978
|
-
]);
|
|
2979
|
-
var sampleDataSourceRowSchema = looseObject({ id: string() });
|
|
2980
|
-
var sampleDataSourcePropertiesSchema = record(
|
|
2981
|
-
string(),
|
|
2982
|
-
notionPropertySchemaSchema
|
|
2983
|
-
);
|
|
2984
|
-
var loadedSampleDataSourceSchema = object({
|
|
2985
|
-
status: literal("loaded"),
|
|
2986
|
-
/** Filename without .json. This is the sample data source's identity. */
|
|
2987
|
-
filename: string(),
|
|
2988
|
-
type: sampleDataSourceTypeSchema,
|
|
2989
|
-
name: string(),
|
|
2990
|
-
icon: optional(string()),
|
|
2991
|
-
schema: sampleDataSourcePropertiesSchema,
|
|
2992
|
-
rows: array(sampleDataSourceRowSchema)
|
|
2993
|
-
});
|
|
2994
|
-
var sampleDataSourceLoadErrorSchema = object({
|
|
2995
|
-
status: literal("failed"),
|
|
2996
|
-
filename: string(),
|
|
2997
|
-
message: string()
|
|
2998
|
-
});
|
|
2999
|
-
var sampleDataSourceSchema = variant("status", [
|
|
3000
|
-
loadedSampleDataSourceSchema,
|
|
3001
|
-
sampleDataSourceLoadErrorSchema
|
|
3002
|
-
]);
|
|
3003
|
-
function selectSampleDataSource({
|
|
3004
|
-
slotKey,
|
|
3005
|
-
sources,
|
|
3006
|
-
explicitFilename
|
|
3007
|
-
}) {
|
|
3008
|
-
if (explicitFilename !== void 0) {
|
|
3009
|
-
return sources.find(
|
|
3010
|
-
(source) => `${source.filename}.json` === explicitFilename
|
|
3011
|
-
);
|
|
3012
|
-
}
|
|
3013
|
-
return sources.find((source) => source.filename === `worker_${slotKey}`) ?? sources.find((source) => source.filename === slotKey);
|
|
3014
|
-
}
|
|
3015
|
-
|
|
3016
3067
|
// ../node_modules/.pnpm/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/root.js
|
|
3017
3068
|
var NativeTemporal = globalThis.Temporal;
|
|
3018
3069
|
|
|
@@ -6750,65 +6801,56 @@ var Temporal = /* @__PURE__ */ Object.defineProperties({}, {
|
|
|
6750
6801
|
var Temporal2 = NativeTemporal || Temporal;
|
|
6751
6802
|
var toTemporalInstant2 = NativeTemporal ? Date.prototype.toTemporalInstant : toTemporalInstant;
|
|
6752
6803
|
|
|
6753
|
-
// shared/
|
|
6754
|
-
function unreachable(value) {
|
|
6755
|
-
throw new Error(
|
|
6756
|
-
`[custom-blocks-dev-shell] Unexpected value encountered: ${JSON.stringify(value)}`
|
|
6757
|
-
);
|
|
6758
|
-
}
|
|
6759
|
-
|
|
6760
|
-
// shared/dataSources/toNotionDateInput.ts
|
|
6804
|
+
// shared/dataSources/notionDate.ts
|
|
6761
6805
|
function toNotionDateInput(value) {
|
|
6762
6806
|
if ("time_zone" in value && value.time_zone !== void 0) {
|
|
6763
6807
|
validateTimeZone(value.time_zone);
|
|
6764
6808
|
}
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
return {
|
|
6773
|
-
start: normalizeDateBoundary({ value: value.start_date }),
|
|
6774
|
-
end: normalizeDateBoundary({ value: value.end_date }),
|
|
6775
|
-
reminder: value.reminder
|
|
6776
|
-
};
|
|
6777
|
-
case "datetime":
|
|
6778
|
-
return {
|
|
6779
|
-
start: normalizeDateBoundary({
|
|
6780
|
-
value: `${value.start_date}T${value.start_time}`,
|
|
6781
|
-
timeZone: value.time_zone
|
|
6782
|
-
}),
|
|
6783
|
-
reminder: value.reminder
|
|
6784
|
-
};
|
|
6785
|
-
case "datetimerange":
|
|
6786
|
-
return {
|
|
6787
|
-
start: normalizeDateBoundary({
|
|
6788
|
-
value: `${value.start_date}T${value.start_time}`,
|
|
6789
|
-
timeZone: value.time_zone
|
|
6790
|
-
}),
|
|
6791
|
-
end: normalizeDateBoundary({
|
|
6792
|
-
value: `${value.end_date}T${value.end_time}`,
|
|
6793
|
-
timeZone: value.time_zone
|
|
6794
|
-
}),
|
|
6795
|
-
reminder: value.reminder
|
|
6796
|
-
};
|
|
6797
|
-
default:
|
|
6798
|
-
return unreachable(value);
|
|
6809
|
+
const start = parseDatePropertyEndpoint(value, "start").toString();
|
|
6810
|
+
if (value.type === "daterange" || value.type === "datetimerange") {
|
|
6811
|
+
return {
|
|
6812
|
+
start,
|
|
6813
|
+
end: parseDatePropertyEndpoint(value, "end").toString(),
|
|
6814
|
+
reminder: value.reminder
|
|
6815
|
+
};
|
|
6799
6816
|
}
|
|
6817
|
+
return { start, reminder: value.reminder };
|
|
6800
6818
|
}
|
|
6801
|
-
function
|
|
6819
|
+
function parseDatePropertyEndpoint(value, endpoint) {
|
|
6820
|
+
const useEnd = endpoint === "end" && (value.type === "daterange" || value.type === "datetimerange");
|
|
6821
|
+
const date = useEnd ? value.end_date : value.start_date;
|
|
6822
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
6823
|
+
const field = useEnd ? "end_date" : "start_date";
|
|
6824
|
+
throw new RangeError(`${field} must use YYYY-MM-DD.`);
|
|
6825
|
+
}
|
|
6826
|
+
if (value.type === "datetime" || value.type === "datetimerange") {
|
|
6827
|
+
const time = useEnd && value.type === "datetimerange" ? value.end_time : value.start_time;
|
|
6828
|
+
return parseDateBoundary({
|
|
6829
|
+
value: `${date}T${time}`,
|
|
6830
|
+
timeZone: value.time_zone
|
|
6831
|
+
});
|
|
6832
|
+
}
|
|
6833
|
+
return Temporal2.PlainDate.from(date);
|
|
6834
|
+
}
|
|
6835
|
+
function parseDateBoundary({
|
|
6802
6836
|
value,
|
|
6803
6837
|
timeZone
|
|
6804
6838
|
}) {
|
|
6805
6839
|
if (!value.includes("T")) {
|
|
6806
|
-
return Temporal2.PlainDate.from(value)
|
|
6840
|
+
return Temporal2.PlainDate.from(value);
|
|
6807
6841
|
}
|
|
6808
6842
|
if (/(?:Z|[+-]\d{2}:?\d{2})$/i.test(value)) {
|
|
6809
|
-
return Temporal2.Instant.from(value)
|
|
6843
|
+
return Temporal2.Instant.from(value);
|
|
6810
6844
|
}
|
|
6811
|
-
|
|
6845
|
+
const localTime = Temporal2.PlainDateTime.from(value);
|
|
6846
|
+
const zone = timeZone ?? "UTC";
|
|
6847
|
+
const zonedTime = localTime.toZonedDateTime(zone, {
|
|
6848
|
+
disambiguation: "earlier"
|
|
6849
|
+
});
|
|
6850
|
+
if (!zonedTime.toPlainDateTime().equals(localTime)) {
|
|
6851
|
+
throw new RangeError(`Local time "${value}" does not exist in "${zone}".`);
|
|
6852
|
+
}
|
|
6853
|
+
return zonedTime.toInstant();
|
|
6812
6854
|
}
|
|
6813
6855
|
function validateTimeZone(timeZone) {
|
|
6814
6856
|
try {
|
|
@@ -6821,6 +6863,50 @@ function validateTimeZone(timeZone) {
|
|
|
6821
6863
|
}
|
|
6822
6864
|
}
|
|
6823
6865
|
|
|
6866
|
+
// shared/dataSources/sampleDataSource.ts
|
|
6867
|
+
var sampleDataSourceTypeSchema = picklist([
|
|
6868
|
+
"built-in",
|
|
6869
|
+
"worker",
|
|
6870
|
+
"manual",
|
|
6871
|
+
"syncedFromProd"
|
|
6872
|
+
]);
|
|
6873
|
+
var sampleDataSourceRowSchema = looseObject({ id: string() });
|
|
6874
|
+
var sampleDataSourcePropertiesSchema = record(
|
|
6875
|
+
string(),
|
|
6876
|
+
notionPropertySchemaSchema
|
|
6877
|
+
);
|
|
6878
|
+
var loadedSampleDataSourceSchema = object({
|
|
6879
|
+
status: literal("loaded"),
|
|
6880
|
+
/** Filename without .json. This is the sample data source's identity. */
|
|
6881
|
+
filename: string(),
|
|
6882
|
+
type: sampleDataSourceTypeSchema,
|
|
6883
|
+
name: string(),
|
|
6884
|
+
icon: optional(string()),
|
|
6885
|
+
schema: sampleDataSourcePropertiesSchema,
|
|
6886
|
+
rows: array(sampleDataSourceRowSchema)
|
|
6887
|
+
});
|
|
6888
|
+
var sampleDataSourceLoadErrorSchema = object({
|
|
6889
|
+
status: literal("failed"),
|
|
6890
|
+
filename: string(),
|
|
6891
|
+
message: string()
|
|
6892
|
+
});
|
|
6893
|
+
var sampleDataSourceSchema = variant("status", [
|
|
6894
|
+
loadedSampleDataSourceSchema,
|
|
6895
|
+
sampleDataSourceLoadErrorSchema
|
|
6896
|
+
]);
|
|
6897
|
+
function selectSampleDataSource({
|
|
6898
|
+
slotKey,
|
|
6899
|
+
sources,
|
|
6900
|
+
explicitFilename
|
|
6901
|
+
}) {
|
|
6902
|
+
if (explicitFilename !== void 0) {
|
|
6903
|
+
return sources.find(
|
|
6904
|
+
(source) => `${source.filename}.json` === explicitFilename
|
|
6905
|
+
);
|
|
6906
|
+
}
|
|
6907
|
+
return sources.find((source) => source.filename === `worker_${slotKey}`) ?? sources.find((source) => source.filename === slotKey);
|
|
6908
|
+
}
|
|
6909
|
+
|
|
6824
6910
|
// shared/dataSources/toDataSourceDateValue.ts
|
|
6825
6911
|
function toDataSourceDateValue(value) {
|
|
6826
6912
|
if (is(notionDateValueSchema, value)) {
|
|
@@ -7040,6 +7126,13 @@ function toNotionPropertySchema(propertyKey, property) {
|
|
|
7040
7126
|
});
|
|
7041
7127
|
}
|
|
7042
7128
|
|
|
7129
|
+
// shared/utils/unreachable.ts
|
|
7130
|
+
function unreachable(value) {
|
|
7131
|
+
throw new Error(
|
|
7132
|
+
`[custom-blocks-dev-shell] Unexpected value encountered: ${JSON.stringify(value)}`
|
|
7133
|
+
);
|
|
7134
|
+
}
|
|
7135
|
+
|
|
7043
7136
|
// cli/dataSources/conversion/convertPublicApiPropertyValue.ts
|
|
7044
7137
|
function convertPublicApiPropertyValue(publicType, value) {
|
|
7045
7138
|
if (typeof value !== "object" || value === null) {
|
|
@@ -7172,52 +7265,6 @@ function timestampToLocal(timestamp) {
|
|
|
7172
7265
|
start_time: timestamp.slice(11, 16)
|
|
7173
7266
|
} : { type: "date", start_date: timestamp.slice(0, 10) };
|
|
7174
7267
|
}
|
|
7175
|
-
var stringValue = string();
|
|
7176
|
-
var numberValue = pipe(number(), finite());
|
|
7177
|
-
var booleanValue = boolean();
|
|
7178
|
-
var stringArrayValue = array(string());
|
|
7179
|
-
var pointerArrayValue = array(
|
|
7180
|
-
object({ id: string(), table: string() })
|
|
7181
|
-
);
|
|
7182
|
-
var anyLocalValue = union([
|
|
7183
|
-
stringValue,
|
|
7184
|
-
numberValue,
|
|
7185
|
-
booleanValue,
|
|
7186
|
-
notionDateValueSchema,
|
|
7187
|
-
stringArrayValue,
|
|
7188
|
-
pointerArrayValue
|
|
7189
|
-
]);
|
|
7190
|
-
var VALUE_SCHEMAS = {
|
|
7191
|
-
title: stringValue,
|
|
7192
|
-
rich_text: stringValue,
|
|
7193
|
-
url: stringValue,
|
|
7194
|
-
email: stringValue,
|
|
7195
|
-
phone_number: stringValue,
|
|
7196
|
-
select: stringValue,
|
|
7197
|
-
status: stringValue,
|
|
7198
|
-
number: numberValue,
|
|
7199
|
-
checkbox: booleanValue,
|
|
7200
|
-
multi_select: stringArrayValue,
|
|
7201
|
-
date: notionDateValueSchema,
|
|
7202
|
-
created_time: notionDateValueSchema,
|
|
7203
|
-
last_edited_time: notionDateValueSchema,
|
|
7204
|
-
people: pointerArrayValue,
|
|
7205
|
-
relation: pointerArrayValue,
|
|
7206
|
-
created_by: pointerArrayValue,
|
|
7207
|
-
last_edited_by: pointerArrayValue,
|
|
7208
|
-
unique_id: stringValue,
|
|
7209
|
-
files: stringValue,
|
|
7210
|
-
formula: stringValue,
|
|
7211
|
-
rollup: stringValue,
|
|
7212
|
-
verification: stringValue,
|
|
7213
|
-
place: stringValue
|
|
7214
|
-
};
|
|
7215
|
-
function matchesPropertyType(value, type) {
|
|
7216
|
-
return is(VALUE_SCHEMAS[type] ?? anyLocalValue, value);
|
|
7217
|
-
}
|
|
7218
|
-
function isDataSourceValue(value) {
|
|
7219
|
-
return is(anyLocalValue, value);
|
|
7220
|
-
}
|
|
7221
7268
|
|
|
7222
7269
|
// cli/dataSources/conversion/runConvert.ts
|
|
7223
7270
|
var SUPPORTED_TYPES = new Set(NOTION_PROPERTY_TYPES);
|
|
@@ -7377,7 +7424,7 @@ function validateSource(source) {
|
|
|
7377
7424
|
);
|
|
7378
7425
|
continue;
|
|
7379
7426
|
}
|
|
7380
|
-
const matches = declared ?
|
|
7427
|
+
const matches = declared ? matchesConvertedPropertyType(value, declared.type) : isConvertedDataSourceValue(value);
|
|
7381
7428
|
if (!matches) {
|
|
7382
7429
|
issues.push(
|
|
7383
7430
|
`row ${JSON.stringify(row.id)}: ${JSON.stringify(key)} does not match ${declared ? `type ${JSON.stringify(declared.type)}` : "any supported value shape"}`
|
|
@@ -8218,7 +8265,8 @@ function buildCustomBlockDevShellCsp(args) {
|
|
|
8218
8265
|
"form-action 'none'",
|
|
8219
8266
|
// Local hosts replace Notion's production app, relay, and mobile-shell ancestors.
|
|
8220
8267
|
`frame-ancestors 'self' ${shellOrigin} ${allowedFrameAncestors.join(" ")}`,
|
|
8221
|
-
|
|
8268
|
+
// Allow WebAssembly compilation without enabling JavaScript string evaluation.
|
|
8269
|
+
"script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'",
|
|
8222
8270
|
`style-src 'self' 'unsafe-inline' https://fonts.googleapis.com ${approved}`
|
|
8223
8271
|
].map((directive) => directive.trim()).join("; ");
|
|
8224
8272
|
}
|