@notionhq/custom-blocks-dev-shell 0.1.113 → 0.1.115

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.
Files changed (131) hide show
  1. package/README.md +27 -14
  2. package/bin/cli.js +3 -1
  3. package/dist/assets/index-DXzPwq_J.js +11 -0
  4. package/dist/index.html +1 -1
  5. package/dist-cli/cli/binding-cli-flags.js +33 -0
  6. package/dist-cli/cli/binding-errors.js +15 -0
  7. package/dist-cli/{build-block-registry.js → cli/build-block-registry.js} +2 -0
  8. package/dist-cli/{convert-values.js → cli/convert-values.js} +5 -5
  9. package/dist-cli/{convert.js → cli/convert.js} +3 -3
  10. package/dist-cli/cli/data-source-files.js +6 -0
  11. package/dist-cli/{data-sources.js → cli/data-sources.js} +12 -65
  12. package/dist-cli/{dev-shell-launcher.js → cli/dev-shell-launcher.js} +23 -10
  13. package/dist-cli/{errors.js → cli/errors.js} +5 -1
  14. package/dist-cli/cli/launcher-bindings.js +144 -0
  15. package/dist-cli/{published-cli.js → cli/published-cli.js} +2 -2
  16. package/dist-cli/{worker-manifest.js → cli/worker-manifest.js} +18 -1
  17. package/dist-cli/protocol/contrast.d.ts +4 -0
  18. package/dist-cli/protocol/contrast.js +3 -0
  19. package/dist-cli/protocol/dataSources/dataSource.d.ts +786 -0
  20. package/dist-cli/protocol/dataSources/dataSource.js +66 -0
  21. package/dist-cli/protocol/dataSources/dataSourcePage.d.ts +74 -0
  22. package/dist-cli/protocol/dataSources/dataSourcePage.js +15 -0
  23. package/dist-cli/protocol/dataSources/dataSourceValue.d.ts +66 -0
  24. package/dist-cli/protocol/dataSources/dataSourceValue.js +14 -0
  25. package/dist-cli/protocol/dataSources/dateValue.d.ts +157 -0
  26. package/dist-cli/protocol/dataSources/dateValue.js +61 -0
  27. package/dist-cli/protocol/dataSources/errors.d.ts +8 -0
  28. package/dist-cli/protocol/dataSources/errors.js +7 -0
  29. package/dist-cli/protocol/dataSources/propertySchema.d.ts +200 -0
  30. package/dist-cli/protocol/dataSources/propertySchema.js +174 -0
  31. package/dist-cli/protocol/dataSources/recordPointer.d.ts +9 -0
  32. package/dist-cli/protocol/dataSources/recordPointer.js +8 -0
  33. package/dist-cli/protocol/dataSources/sortDirection.d.ts +3 -0
  34. package/dist-cli/protocol/dataSources/sortDirection.js +2 -0
  35. package/dist-cli/protocol/errors.d.ts +12 -0
  36. package/dist-cli/protocol/errors.js +6 -0
  37. package/dist-cli/protocol/ids.d.ts +31 -0
  38. package/dist-cli/protocol/ids.js +26 -0
  39. package/dist-cli/protocol/index.d.ts +53 -0
  40. package/dist-cli/protocol/index.js +53 -0
  41. package/dist-cli/protocol/manifest.d.ts +67 -0
  42. package/dist-cli/protocol/manifest.js +36 -0
  43. package/dist-cli/protocol/messages/connect.d.ts +54 -0
  44. package/dist-cli/protocol/messages/connect.js +39 -0
  45. package/dist-cli/protocol/messages/contrastModeChanged.d.ts +7 -0
  46. package/dist-cli/protocol/messages/contrastModeChanged.js +7 -0
  47. package/dist-cli/protocol/messages/createPage.d.ts +290 -0
  48. package/dist-cli/protocol/messages/createPage.js +51 -0
  49. package/dist-cli/protocol/messages/createPageResult.d.ts +897 -0
  50. package/dist-cli/protocol/messages/createPageResult.js +43 -0
  51. package/dist-cli/protocol/messages/currentUserChanged.d.ts +18 -0
  52. package/dist-cli/protocol/messages/currentUserChanged.js +9 -0
  53. package/dist-cli/protocol/messages/dataSourcesChanged.d.ts +157 -0
  54. package/dist-cli/protocol/messages/dataSourcesChanged.js +13 -0
  55. package/dist-cli/protocol/messages/getPage.d.ts +902 -0
  56. package/dist-cli/protocol/messages/getPage.js +48 -0
  57. package/dist-cli/protocol/messages/getUser.d.ts +44 -0
  58. package/dist-cli/protocol/messages/getUser.js +32 -0
  59. package/dist-cli/protocol/messages/hostToSandbox.d.ts +4385 -0
  60. package/dist-cli/protocol/messages/hostToSandbox.js +48 -0
  61. package/dist-cli/protocol/messages/incomingType.d.ts +9 -0
  62. package/dist-cli/protocol/messages/incomingType.js +17 -0
  63. package/dist-cli/protocol/messages/init.d.ts +273 -0
  64. package/dist-cli/protocol/messages/init.js +57 -0
  65. package/dist-cli/protocol/messages/initResult.d.ts +37 -0
  66. package/dist-cli/protocol/messages/initResult.js +29 -0
  67. package/dist-cli/protocol/messages/invalidHostMessage.d.ts +14 -0
  68. package/dist-cli/protocol/messages/invalidHostMessage.js +13 -0
  69. package/dist-cli/protocol/messages/invalidSandboxMessage.d.ts +14 -0
  70. package/dist-cli/protocol/messages/invalidSandboxMessage.js +13 -0
  71. package/dist-cli/protocol/messages/isInitHandshakeMessage.d.ts +4 -0
  72. package/dist-cli/protocol/messages/isInitHandshakeMessage.js +11 -0
  73. package/dist-cli/protocol/messages/listUsers.d.ts +52 -0
  74. package/dist-cli/protocol/messages/listUsers.js +33 -0
  75. package/dist-cli/protocol/messages/messagePayload.d.ts +19 -0
  76. package/dist-cli/protocol/messages/messagePayload.js +1 -0
  77. package/dist-cli/protocol/messages/openExternalUrl.d.ts +32 -0
  78. package/dist-cli/protocol/messages/openExternalUrl.js +26 -0
  79. package/dist-cli/protocol/messages/openPage.d.ts +38 -0
  80. package/dist-cli/protocol/messages/openPage.js +34 -0
  81. package/dist-cli/protocol/messages/pageChanged.d.ts +32 -0
  82. package/dist-cli/protocol/messages/pageChanged.js +9 -0
  83. package/dist-cli/protocol/messages/parentChanged.d.ts +26 -0
  84. package/dist-cli/protocol/messages/parentChanged.js +9 -0
  85. package/dist-cli/protocol/messages/queryDataSource.d.ts +1446 -0
  86. package/dist-cli/protocol/messages/queryDataSource.js +252 -0
  87. package/dist-cli/protocol/messages/queryDataSourceResult.d.ts +686 -0
  88. package/dist-cli/protocol/messages/queryDataSourceResult.js +44 -0
  89. package/dist-cli/protocol/messages/resize.d.ts +11 -0
  90. package/dist-cli/protocol/messages/resize.js +10 -0
  91. package/dist-cli/protocol/messages/sandboxToHost.d.ts +1091 -0
  92. package/dist-cli/protocol/messages/sandboxToHost.js +33 -0
  93. package/dist-cli/protocol/messages/themeChanged.d.ts +10 -0
  94. package/dist-cli/protocol/messages/themeChanged.js +10 -0
  95. package/dist-cli/protocol/messages/unsubscribeDataSourceQuery.d.ts +10 -0
  96. package/dist-cli/protocol/messages/unsubscribeDataSourceQuery.js +9 -0
  97. package/dist-cli/protocol/messages/updatePage.d.ts +271 -0
  98. package/dist-cli/protocol/messages/updatePage.js +23 -0
  99. package/dist-cli/protocol/messages/updatePageResult.d.ts +895 -0
  100. package/dist-cli/protocol/messages/updatePageResult.js +41 -0
  101. package/dist-cli/protocol/pages/page.d.ts +1422 -0
  102. package/dist-cli/protocol/pages/page.js +318 -0
  103. package/dist-cli/protocol/parent.d.ts +32 -0
  104. package/dist-cli/protocol/parent.js +13 -0
  105. package/dist-cli/protocol/protocolVersion.d.ts +8 -0
  106. package/dist-cli/protocol/protocolVersion.js +11 -0
  107. package/dist-cli/protocol/theme.d.ts +3 -0
  108. package/dist-cli/protocol/theme.js +2 -0
  109. package/dist-cli/protocol/users/user.d.ts +32 -0
  110. package/dist-cli/protocol/users/user.js +20 -0
  111. package/dist-cli/shared/block-registry.js +28 -0
  112. package/dist-cli/shared/data-source.js +22 -0
  113. package/dist-cli/shared/runtime-config.js +10 -0
  114. package/dist-cli/shared/sample-data-source.js +12 -0
  115. package/docs/bindings.md +79 -27
  116. package/package.json +5 -26
  117. package/dist/assets/index-DgQZ0zg6.js +0 -11
  118. package/dist-cli/date-value.js +0 -46
  119. package/dist-cli/resolve-bindings.js +0 -39
  120. package/dist-cli/source-bindings.js +0 -17
  121. /package/dist-cli/{block-csp.js → cli/block-csp.js} +0 -0
  122. /package/dist-cli/{dev-shell-run.js → cli/dev-shell-run.js} +0 -0
  123. /package/dist-cli/{materialize.js → cli/materialize.js} +0 -0
  124. /package/dist-cli/{ports.js → cli/ports.js} +0 -0
  125. /package/dist-cli/{prebuilt.js → cli/prebuilt.js} +0 -0
  126. /package/dist-cli/{runtime-error-client.js → cli/runtime-error-client.js} +0 -0
  127. /package/dist-cli/{serve-ui.js → cli/serve-ui.js} +0 -0
  128. /package/dist-cli/{shared-server.js → cli/shared-server.js} +0 -0
  129. /package/dist-cli/{utils.js → cli/utils.js} +0 -0
  130. /package/dist-cli/{vite-block-server.js → cli/vite-block-server.js} +0 -0
  131. /package/dist-cli/{vite-middleware.js → cli/vite-middleware.js} +0 -0
@@ -0,0 +1,66 @@
1
+ import * as v from "valibot";
2
+ import { notionDataSourceIdSchema, notionSpaceIdSchema } from "../ids.js";
3
+ import { notionPropertySchemaSchema } from "./propertySchema.js";
4
+ const collectionPointerValidator = v.object({
5
+ id: notionDataSourceIdSchema,
6
+ table: v.string(),
7
+ spaceId: v.optional(notionSpaceIdSchema),
8
+ });
9
+ export const notionCollectionSchemaValidator = v.object({
10
+ id: v.optional(notionDataSourceIdSchema),
11
+ /**
12
+ * Describes actual database properties in protocol 5. Protocol 3/4 payloads can also include
13
+ * synthetic metadata for compatibility. Use this map to resolve property bindings. Use this map
14
+ * to validate filter and sort references.
15
+ */
16
+ propertiesById: v.record(v.string(), notionPropertySchemaSchema),
17
+ });
18
+ /**
19
+ * Describes a data source, its optional database binding, and its property schemas. The
20
+ * database schema validates query references. The read schemas describe snapshot values.
21
+ */
22
+ export const notionDataSourceSchema = v.object({
23
+ key: v.string(),
24
+ collectionPointer: v.optional(collectionPointerValidator),
25
+ /**
26
+ * Describes database properties. Use this schema to resolve property bindings. Use this
27
+ * schema to validate filter and sort references. Undefined when the host does not provide a
28
+ * database schema.
29
+ */
30
+ collectionSchema: v.optional(notionCollectionSchemaValidator),
31
+ /**
32
+ * Maps user-defined property keys to database property IDs. Use this map to resolve a key
33
+ * such as `name` to its database property ID. A value of `undefined` marks a declared
34
+ * property without a valid binding. Synthetic metadata does not add entries to this map.
35
+ */
36
+ propertyIdsByKey: v.record(v.string(), v.optional(v.string())),
37
+ /**
38
+ * Describes property values in query snapshots. Keys use the same property IDs as a snapshot's
39
+ * `propertiesById` map.
40
+ *
41
+ * Includes four synthetic metadata fields, even when the database schema is unavailable:
42
+ * `created_time`, `last_edited_time`, `created_by`, and `last_edited_by`. Also includes
43
+ * database properties when the host provides their schema.
44
+ *
45
+ * Use `propertiesById` to read a value. Use this map to read the value's schema. Use
46
+ * `collectionSchema` to validate filter and sort references.
47
+ */
48
+ propertySchemasById: v.record(v.string(), notionPropertySchemaSchema),
49
+ });
50
+ export const notionDataSourceBindingSchema = v.object({
51
+ collectionPointer: v.optional(collectionPointerValidator),
52
+ /**
53
+ * Describes database properties. Use this schema to resolve property bindings. Use this
54
+ * schema to validate filter and sort references. Undefined when the host does not provide a
55
+ * database schema.
56
+ */
57
+ collectionSchema: v.optional(notionCollectionSchemaValidator),
58
+ /**
59
+ * Maps user-defined property keys to database property IDs. Use this map to resolve a key
60
+ * such as `name` to its database property ID. A value of `undefined` marks a declared
61
+ * property without a binding. Omitted when the host does not provide property mappings.
62
+ * Synthetic metadata does not add entries to this map.
63
+ */
64
+ propertyIdsByKey: v.optional(v.record(v.string(), v.optional(v.string()))),
65
+ });
66
+ export const notionDataSourceBindingsSchema = v.record(v.string(), notionDataSourceBindingSchema);
@@ -0,0 +1,74 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Bridge shape for a data source page, as parsed from inbound host messages. The host keys
4
+ * properties by raw property ID. Only actual schema properties are included.
5
+ */
6
+ export declare const legacyNotionDataSourcePageBridgeSchema: v.ObjectSchema<{
7
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
8
+ /** Whether the page or an ancestor is archived. */
9
+ readonly is_archived: v.BooleanSchema<undefined>;
10
+ /** Whether the page or an ancestor is in Trash. */
11
+ readonly in_trash: v.BooleanSchema<undefined>;
12
+ readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
13
+ readonly type: v.LiteralSchema<"date", undefined>;
14
+ readonly start_date: v.StringSchema<undefined>;
15
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
16
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
17
+ readonly value: v.NumberSchema<undefined>;
18
+ readonly time: v.StringSchema<undefined>;
19
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
20
+ }, undefined>, v.ObjectSchema<{
21
+ readonly unit: v.LiteralSchema<"none", undefined>;
22
+ }, undefined>], undefined>, undefined>;
23
+ }, undefined>, v.ObjectSchema<{
24
+ readonly type: v.LiteralSchema<"daterange", undefined>;
25
+ readonly start_date: v.StringSchema<undefined>;
26
+ readonly end_date: v.StringSchema<undefined>;
27
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
28
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
29
+ readonly value: v.NumberSchema<undefined>;
30
+ readonly time: v.StringSchema<undefined>;
31
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
32
+ }, undefined>, v.ObjectSchema<{
33
+ readonly unit: v.LiteralSchema<"none", undefined>;
34
+ }, undefined>], undefined>, undefined>;
35
+ }, undefined>, v.ObjectSchema<{
36
+ readonly type: v.LiteralSchema<"datetime", undefined>;
37
+ readonly start_date: v.StringSchema<undefined>;
38
+ readonly start_time: v.StringSchema<undefined>;
39
+ readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
40
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
41
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
42
+ readonly value: v.NumberSchema<undefined>;
43
+ readonly time: v.StringSchema<undefined>;
44
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
45
+ }, undefined>, v.ObjectSchema<{
46
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
47
+ readonly value: v.NumberSchema<undefined>;
48
+ }, undefined>], undefined>, v.ObjectSchema<{
49
+ readonly unit: v.LiteralSchema<"none", undefined>;
50
+ }, undefined>], undefined>, undefined>;
51
+ }, undefined>, v.ObjectSchema<{
52
+ readonly type: v.LiteralSchema<"datetimerange", undefined>;
53
+ readonly start_date: v.StringSchema<undefined>;
54
+ readonly start_time: v.StringSchema<undefined>;
55
+ readonly end_date: v.StringSchema<undefined>;
56
+ readonly end_time: v.StringSchema<undefined>;
57
+ readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
58
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
59
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
60
+ readonly value: v.NumberSchema<undefined>;
61
+ readonly time: v.StringSchema<undefined>;
62
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
63
+ }, undefined>, v.ObjectSchema<{
64
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
65
+ readonly value: v.NumberSchema<undefined>;
66
+ }, undefined>], undefined>, v.ObjectSchema<{
67
+ readonly unit: v.LiteralSchema<"none", undefined>;
68
+ }, undefined>], undefined>, undefined>;
69
+ }, undefined>], undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ArraySchema<v.ObjectSchema<{
70
+ readonly id: v.StringSchema<undefined>;
71
+ readonly table: v.StringSchema<undefined>;
72
+ }, undefined>, undefined>], undefined>, undefined>, undefined>;
73
+ }, undefined>;
74
+ export type LegacyNotionDataSourcePageBridge = v.InferOutput<typeof legacyNotionDataSourcePageBridgeSchema>;
@@ -0,0 +1,15 @@
1
+ import * as v from "valibot";
2
+ import { notionPageIdSchema } from "../ids.js";
3
+ import { notionDataSourceValueSchema } from "./dataSourceValue.js";
4
+ /**
5
+ * Bridge shape for a data source page, as parsed from inbound host messages. The host keys
6
+ * properties by raw property ID. Only actual schema properties are included.
7
+ */
8
+ export const legacyNotionDataSourcePageBridgeSchema = v.object({
9
+ id: notionPageIdSchema,
10
+ /** Whether the page or an ancestor is archived. */
11
+ is_archived: v.boolean(),
12
+ /** Whether the page or an ancestor is in Trash. */
13
+ in_trash: v.boolean(),
14
+ propertiesById: v.record(v.string(), v.optional(notionDataSourceValueSchema)),
15
+ });
@@ -0,0 +1,66 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Possible types for a data source value.
4
+ */
5
+ export declare const notionDataSourceValueSchema: v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
6
+ readonly type: v.LiteralSchema<"date", undefined>;
7
+ readonly start_date: v.StringSchema<undefined>;
8
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
9
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
10
+ readonly value: v.NumberSchema<undefined>;
11
+ readonly time: v.StringSchema<undefined>;
12
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
13
+ }, undefined>, v.ObjectSchema<{
14
+ readonly unit: v.LiteralSchema<"none", undefined>;
15
+ }, undefined>], undefined>, undefined>;
16
+ }, undefined>, v.ObjectSchema<{
17
+ readonly type: v.LiteralSchema<"daterange", undefined>;
18
+ readonly start_date: v.StringSchema<undefined>;
19
+ readonly end_date: v.StringSchema<undefined>;
20
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
21
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
22
+ readonly value: v.NumberSchema<undefined>;
23
+ readonly time: v.StringSchema<undefined>;
24
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
25
+ }, undefined>, v.ObjectSchema<{
26
+ readonly unit: v.LiteralSchema<"none", undefined>;
27
+ }, undefined>], undefined>, undefined>;
28
+ }, undefined>, v.ObjectSchema<{
29
+ readonly type: v.LiteralSchema<"datetime", undefined>;
30
+ readonly start_date: v.StringSchema<undefined>;
31
+ readonly start_time: v.StringSchema<undefined>;
32
+ readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
33
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
34
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
35
+ readonly value: v.NumberSchema<undefined>;
36
+ readonly time: v.StringSchema<undefined>;
37
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
38
+ }, undefined>, v.ObjectSchema<{
39
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
40
+ readonly value: v.NumberSchema<undefined>;
41
+ }, undefined>], undefined>, v.ObjectSchema<{
42
+ readonly unit: v.LiteralSchema<"none", undefined>;
43
+ }, undefined>], undefined>, undefined>;
44
+ }, undefined>, v.ObjectSchema<{
45
+ readonly type: v.LiteralSchema<"datetimerange", undefined>;
46
+ readonly start_date: v.StringSchema<undefined>;
47
+ readonly start_time: v.StringSchema<undefined>;
48
+ readonly end_date: v.StringSchema<undefined>;
49
+ readonly end_time: v.StringSchema<undefined>;
50
+ readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
51
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
52
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
53
+ readonly value: v.NumberSchema<undefined>;
54
+ readonly time: v.StringSchema<undefined>;
55
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
56
+ }, undefined>, v.ObjectSchema<{
57
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
58
+ readonly value: v.NumberSchema<undefined>;
59
+ }, undefined>], undefined>, v.ObjectSchema<{
60
+ readonly unit: v.LiteralSchema<"none", undefined>;
61
+ }, undefined>], undefined>, undefined>;
62
+ }, undefined>], undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ArraySchema<v.ObjectSchema<{
63
+ readonly id: v.StringSchema<undefined>;
64
+ readonly table: v.StringSchema<undefined>;
65
+ }, undefined>, undefined>], undefined>;
66
+ export type NotionDataSourceValue = v.InferOutput<typeof notionDataSourceValueSchema>;
@@ -0,0 +1,14 @@
1
+ import * as v from "valibot";
2
+ import { notionDateValueSchema } from "./dateValue.js";
3
+ import { notionRecordPointerSchema } from "./recordPointer.js";
4
+ /**
5
+ * Possible types for a data source value.
6
+ */
7
+ export const notionDataSourceValueSchema = v.union([
8
+ v.string(),
9
+ v.number(),
10
+ v.boolean(),
11
+ notionDateValueSchema,
12
+ v.array(v.string()),
13
+ v.array(notionRecordPointerSchema),
14
+ ]);
@@ -0,0 +1,157 @@
1
+ import * as v from "valibot";
2
+ export declare const notionDateReminderSchema: v.ObjectSchema<{
3
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
4
+ readonly value: v.NumberSchema<undefined>;
5
+ readonly time: v.StringSchema<undefined>;
6
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
7
+ }, undefined>;
8
+ export type NotionDateReminder = v.InferOutput<typeof notionDateReminderSchema>;
9
+ export declare const notionTimeReminderSchema: v.ObjectSchema<{
10
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
11
+ readonly value: v.NumberSchema<undefined>;
12
+ }, undefined>;
13
+ export type NotionTimeReminder = v.InferOutput<typeof notionTimeReminderSchema>;
14
+ export declare const notionDisabledReminderSchema: v.ObjectSchema<{
15
+ readonly unit: v.LiteralSchema<"none", undefined>;
16
+ }, undefined>;
17
+ export type NotionDisabledReminder = v.InferOutput<typeof notionDisabledReminderSchema>;
18
+ /**
19
+ * Possible types for a Notion `datetime` reminder.
20
+ */
21
+ export declare const notionDateTimeReminderSchema: v.UnionSchema<[v.ObjectSchema<{
22
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
23
+ readonly value: v.NumberSchema<undefined>;
24
+ readonly time: v.StringSchema<undefined>;
25
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
26
+ }, undefined>, v.ObjectSchema<{
27
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
28
+ readonly value: v.NumberSchema<undefined>;
29
+ }, undefined>], undefined>;
30
+ export type NotionDateTimeReminder = v.InferOutput<typeof notionDateTimeReminderSchema>;
31
+ export declare const notionDateSchema: v.ObjectSchema<{
32
+ readonly type: v.LiteralSchema<"date", undefined>;
33
+ readonly start_date: v.StringSchema<undefined>;
34
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
35
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
36
+ readonly value: v.NumberSchema<undefined>;
37
+ readonly time: v.StringSchema<undefined>;
38
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
39
+ }, undefined>, v.ObjectSchema<{
40
+ readonly unit: v.LiteralSchema<"none", undefined>;
41
+ }, undefined>], undefined>, undefined>;
42
+ }, undefined>;
43
+ export type NotionDate = v.InferOutput<typeof notionDateSchema>;
44
+ export declare const notionDateRangeSchema: v.ObjectSchema<{
45
+ readonly type: v.LiteralSchema<"daterange", undefined>;
46
+ readonly start_date: v.StringSchema<undefined>;
47
+ readonly end_date: v.StringSchema<undefined>;
48
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
49
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
50
+ readonly value: v.NumberSchema<undefined>;
51
+ readonly time: v.StringSchema<undefined>;
52
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
53
+ }, undefined>, v.ObjectSchema<{
54
+ readonly unit: v.LiteralSchema<"none", undefined>;
55
+ }, undefined>], undefined>, undefined>;
56
+ }, undefined>;
57
+ export type NotionDateRange = v.InferOutput<typeof notionDateRangeSchema>;
58
+ export declare const notionDateTimeSchema: v.ObjectSchema<{
59
+ readonly type: v.LiteralSchema<"datetime", undefined>;
60
+ readonly start_date: v.StringSchema<undefined>;
61
+ readonly start_time: v.StringSchema<undefined>;
62
+ readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
63
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
64
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
65
+ readonly value: v.NumberSchema<undefined>;
66
+ readonly time: v.StringSchema<undefined>;
67
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
68
+ }, undefined>, v.ObjectSchema<{
69
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
70
+ readonly value: v.NumberSchema<undefined>;
71
+ }, undefined>], undefined>, v.ObjectSchema<{
72
+ readonly unit: v.LiteralSchema<"none", undefined>;
73
+ }, undefined>], undefined>, undefined>;
74
+ }, undefined>;
75
+ export type NotionDateTime = v.InferOutput<typeof notionDateTimeSchema>;
76
+ export declare const notionDateTimeRangeSchema: v.ObjectSchema<{
77
+ readonly type: v.LiteralSchema<"datetimerange", undefined>;
78
+ readonly start_date: v.StringSchema<undefined>;
79
+ readonly start_time: v.StringSchema<undefined>;
80
+ readonly end_date: v.StringSchema<undefined>;
81
+ readonly end_time: v.StringSchema<undefined>;
82
+ readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
83
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
84
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
85
+ readonly value: v.NumberSchema<undefined>;
86
+ readonly time: v.StringSchema<undefined>;
87
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
88
+ }, undefined>, v.ObjectSchema<{
89
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
90
+ readonly value: v.NumberSchema<undefined>;
91
+ }, undefined>], undefined>, v.ObjectSchema<{
92
+ readonly unit: v.LiteralSchema<"none", undefined>;
93
+ }, undefined>], undefined>, undefined>;
94
+ }, undefined>;
95
+ export type NotionDateTimeRange = v.InferOutput<typeof notionDateTimeRangeSchema>;
96
+ /**
97
+ * Possible types for a Notion `date` value.
98
+ */
99
+ export declare const notionDateValueSchema: v.VariantSchema<"type", [v.ObjectSchema<{
100
+ readonly type: v.LiteralSchema<"date", undefined>;
101
+ readonly start_date: v.StringSchema<undefined>;
102
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
103
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
104
+ readonly value: v.NumberSchema<undefined>;
105
+ readonly time: v.StringSchema<undefined>;
106
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
107
+ }, undefined>, v.ObjectSchema<{
108
+ readonly unit: v.LiteralSchema<"none", undefined>;
109
+ }, undefined>], undefined>, undefined>;
110
+ }, undefined>, v.ObjectSchema<{
111
+ readonly type: v.LiteralSchema<"daterange", undefined>;
112
+ readonly start_date: v.StringSchema<undefined>;
113
+ readonly end_date: v.StringSchema<undefined>;
114
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
115
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
116
+ readonly value: v.NumberSchema<undefined>;
117
+ readonly time: v.StringSchema<undefined>;
118
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
119
+ }, undefined>, v.ObjectSchema<{
120
+ readonly unit: v.LiteralSchema<"none", undefined>;
121
+ }, undefined>], undefined>, undefined>;
122
+ }, undefined>, v.ObjectSchema<{
123
+ readonly type: v.LiteralSchema<"datetime", undefined>;
124
+ readonly start_date: v.StringSchema<undefined>;
125
+ readonly start_time: v.StringSchema<undefined>;
126
+ readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
127
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
128
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
129
+ readonly value: v.NumberSchema<undefined>;
130
+ readonly time: v.StringSchema<undefined>;
131
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
132
+ }, undefined>, v.ObjectSchema<{
133
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
134
+ readonly value: v.NumberSchema<undefined>;
135
+ }, undefined>], undefined>, v.ObjectSchema<{
136
+ readonly unit: v.LiteralSchema<"none", undefined>;
137
+ }, undefined>], undefined>, undefined>;
138
+ }, undefined>, v.ObjectSchema<{
139
+ readonly type: v.LiteralSchema<"datetimerange", undefined>;
140
+ readonly start_date: v.StringSchema<undefined>;
141
+ readonly start_time: v.StringSchema<undefined>;
142
+ readonly end_date: v.StringSchema<undefined>;
143
+ readonly end_time: v.StringSchema<undefined>;
144
+ readonly time_zone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
145
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
146
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
147
+ readonly value: v.NumberSchema<undefined>;
148
+ readonly time: v.StringSchema<undefined>;
149
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
150
+ }, undefined>, v.ObjectSchema<{
151
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
152
+ readonly value: v.NumberSchema<undefined>;
153
+ }, undefined>], undefined>, v.ObjectSchema<{
154
+ readonly unit: v.LiteralSchema<"none", undefined>;
155
+ }, undefined>], undefined>, undefined>;
156
+ }, undefined>], undefined>;
157
+ export type NotionDateValue = Readonly<v.InferOutput<typeof notionDateValueSchema>>;
@@ -0,0 +1,61 @@
1
+ import * as v from "valibot";
2
+ export const notionDateReminderSchema = v.object({
3
+ unit: v.picklist(["year", "month", "week", "day"]),
4
+ value: v.number(),
5
+ time: v.string(),
6
+ defaultTimeZone: v.optional(v.string()),
7
+ });
8
+ export const notionTimeReminderSchema = v.object({
9
+ unit: v.picklist(["hour", "minute"]),
10
+ value: v.number(),
11
+ });
12
+ // An omitted reminder can inherit the date property's default reminder.
13
+ // "none" explicitly disables reminders instead.
14
+ export const notionDisabledReminderSchema = v.object({
15
+ unit: v.literal("none"),
16
+ });
17
+ /**
18
+ * Possible types for a Notion `datetime` reminder.
19
+ */
20
+ export const notionDateTimeReminderSchema = v.union([
21
+ notionDateReminderSchema,
22
+ notionTimeReminderSchema,
23
+ ]);
24
+ const dateOrDisabledReminder = v.optional(v.union([notionDateReminderSchema, notionDisabledReminderSchema]));
25
+ const dateTimeOrDisabledReminder = v.optional(v.union([notionDateTimeReminderSchema, notionDisabledReminderSchema]));
26
+ export const notionDateSchema = v.object({
27
+ type: v.literal("date"),
28
+ start_date: v.string(),
29
+ reminder: dateOrDisabledReminder,
30
+ });
31
+ export const notionDateRangeSchema = v.object({
32
+ type: v.literal("daterange"),
33
+ start_date: v.string(),
34
+ end_date: v.string(),
35
+ reminder: dateOrDisabledReminder,
36
+ });
37
+ export const notionDateTimeSchema = v.object({
38
+ type: v.literal("datetime"),
39
+ start_date: v.string(),
40
+ start_time: v.string(),
41
+ time_zone: v.optional(v.string()),
42
+ reminder: dateTimeOrDisabledReminder,
43
+ });
44
+ export const notionDateTimeRangeSchema = v.object({
45
+ type: v.literal("datetimerange"),
46
+ start_date: v.string(),
47
+ start_time: v.string(),
48
+ end_date: v.string(),
49
+ end_time: v.string(),
50
+ time_zone: v.optional(v.string()),
51
+ reminder: dateTimeOrDisabledReminder,
52
+ });
53
+ /**
54
+ * Possible types for a Notion `date` value.
55
+ */
56
+ export const notionDateValueSchema = v.variant("type", [
57
+ notionDateSchema,
58
+ notionDateRangeSchema,
59
+ notionDateTimeSchema,
60
+ notionDateTimeRangeSchema,
61
+ ]);
@@ -0,0 +1,8 @@
1
+ import * as v from "valibot";
2
+ import type { CustomBlockErrorInfo } from "../errors.js";
3
+ export declare const customBlockDataSourceResolutionErrorCodeSchema: v.StringSchema<undefined>;
4
+ export type CustomBlockDataSourceResolutionErrorCode = "unknown_data_source_key" | "unmapped_data_source" | (string & {});
5
+ export type CustomBlockDataSourceResolutionErrorInfo = CustomBlockErrorInfo<CustomBlockDataSourceResolutionErrorCode>;
6
+ export declare const customBlockPropertyErrorCodeSchema: v.StringSchema<undefined>;
7
+ export type CustomBlockPropertyErrorCode = "unmapped_property" | "property_id_mismatch" | "duplicate_property" | "invalid_property_value" | (string & {});
8
+ export type CustomBlockPropertyErrorInfo = CustomBlockErrorInfo<CustomBlockPropertyErrorCode>;
@@ -0,0 +1,7 @@
1
+ import * as v from "valibot";
2
+ // The schema accepts any string code. The type lists known codes for
3
+ // autocomplete, with an open string fallback for newer senders.
4
+ export const customBlockDataSourceResolutionErrorCodeSchema = v.string();
5
+ // The schema accepts any string code. The type lists known codes for
6
+ // autocomplete, with an open string fallback for newer senders.
7
+ export const customBlockPropertyErrorCodeSchema = v.string();