@notionhq/custom-blocks-host 0.3.6 → 0.3.7

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.
@@ -113,11 +113,49 @@ declare const notionSelectOptionInputSchema: v.UnionSchema<[v.ObjectSchema<{
113
113
  readonly description: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
114
114
  }, undefined>], undefined>;
115
115
  export type NotionSelectOptionInput = v.InferOutput<typeof notionSelectOptionInputSchema>;
116
- declare const notionDateInputSchema: v.ObjectSchema<{
116
+ declare const notionDateInputSchema: v.UnionSchema<[v.ObjectSchema<{
117
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
118
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
119
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
120
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
121
+ readonly value: v.NumberSchema<undefined>;
122
+ readonly time: v.StringSchema<undefined>;
123
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
124
+ }, undefined>, v.ObjectSchema<{
125
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
126
+ readonly value: v.NumberSchema<undefined>;
127
+ }, undefined>], undefined>, v.ObjectSchema<{
128
+ readonly unit: v.LiteralSchema<"none", undefined>;
129
+ }, undefined>], undefined>, undefined>;
130
+ readonly start: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "T", undefined>]>;
131
+ }, undefined>, v.ObjectSchema<{
132
+ readonly start: v.StringSchema<undefined>;
133
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
134
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
135
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
136
+ readonly value: v.NumberSchema<undefined>;
137
+ readonly time: v.StringSchema<undefined>;
138
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
139
+ }, undefined>, v.ObjectSchema<{
140
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
141
+ readonly value: v.NumberSchema<undefined>;
142
+ }, undefined>], undefined>, v.ObjectSchema<{
143
+ readonly unit: v.LiteralSchema<"none", undefined>;
144
+ }, undefined>], undefined>, undefined>;
145
+ readonly time_zone: v.StringSchema<undefined>;
146
+ }, undefined>, v.ObjectSchema<{
117
147
  readonly start: v.StringSchema<undefined>;
118
148
  readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
119
149
  readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
120
- }, undefined>;
150
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
151
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
152
+ readonly value: v.NumberSchema<undefined>;
153
+ readonly time: v.StringSchema<undefined>;
154
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
155
+ }, undefined>, v.ObjectSchema<{
156
+ readonly unit: v.LiteralSchema<"none", undefined>;
157
+ }, undefined>], undefined>, undefined>;
158
+ }, undefined>], undefined>;
121
159
  export type NotionDateInput = v.InferOutput<typeof notionDateInputSchema>;
122
160
  declare const notionUserInputSchema: v.UnionSchema<[v.ObjectSchema<{
123
161
  readonly object: v.OptionalSchema<v.LiteralSchema<"user", undefined>, undefined>;
@@ -232,11 +270,49 @@ export declare const notionPagePropertyValueSchema: v.VariantSchema<"type", [v.O
232
270
  }, undefined>, v.ObjectSchema<{
233
271
  readonly id: v.StringSchema<undefined>;
234
272
  readonly type: v.LiteralSchema<"date", undefined>;
235
- readonly date: v.NullableSchema<v.ObjectSchema<{
273
+ readonly date: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
274
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
275
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
276
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
277
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
278
+ readonly value: v.NumberSchema<undefined>;
279
+ readonly time: v.StringSchema<undefined>;
280
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
281
+ }, undefined>, v.ObjectSchema<{
282
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
283
+ readonly value: v.NumberSchema<undefined>;
284
+ }, undefined>], undefined>, v.ObjectSchema<{
285
+ readonly unit: v.LiteralSchema<"none", undefined>;
286
+ }, undefined>], undefined>, undefined>;
287
+ readonly start: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "T", undefined>]>;
288
+ }, undefined>, v.ObjectSchema<{
289
+ readonly start: v.StringSchema<undefined>;
290
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
291
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
292
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
293
+ readonly value: v.NumberSchema<undefined>;
294
+ readonly time: v.StringSchema<undefined>;
295
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
296
+ }, undefined>, v.ObjectSchema<{
297
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
298
+ readonly value: v.NumberSchema<undefined>;
299
+ }, undefined>], undefined>, v.ObjectSchema<{
300
+ readonly unit: v.LiteralSchema<"none", undefined>;
301
+ }, undefined>], undefined>, undefined>;
302
+ readonly time_zone: v.StringSchema<undefined>;
303
+ }, undefined>, v.ObjectSchema<{
236
304
  readonly start: v.StringSchema<undefined>;
237
305
  readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
238
306
  readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
239
- }, undefined>, undefined>;
307
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
308
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
309
+ readonly value: v.NumberSchema<undefined>;
310
+ readonly time: v.StringSchema<undefined>;
311
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
312
+ }, undefined>, v.ObjectSchema<{
313
+ readonly unit: v.LiteralSchema<"none", undefined>;
314
+ }, undefined>], undefined>, undefined>;
315
+ }, undefined>], undefined>, undefined>;
240
316
  }, undefined>, v.ObjectSchema<{
241
317
  readonly id: v.StringSchema<undefined>;
242
318
  readonly type: v.LiteralSchema<"people", undefined>;
@@ -386,11 +462,49 @@ export declare const notionPagePropertyWriteMapSchema: v.RecordSchema<v.StringSc
386
462
  }, undefined>, v.ObjectSchema<{
387
463
  readonly id: v.StringSchema<undefined>;
388
464
  readonly type: v.LiteralSchema<"date", undefined>;
389
- readonly date: v.NullableSchema<v.ObjectSchema<{
465
+ readonly date: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
466
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
467
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
468
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
469
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
470
+ readonly value: v.NumberSchema<undefined>;
471
+ readonly time: v.StringSchema<undefined>;
472
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
473
+ }, undefined>, v.ObjectSchema<{
474
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
475
+ readonly value: v.NumberSchema<undefined>;
476
+ }, undefined>], undefined>, v.ObjectSchema<{
477
+ readonly unit: v.LiteralSchema<"none", undefined>;
478
+ }, undefined>], undefined>, undefined>;
479
+ readonly start: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "T", undefined>]>;
480
+ }, undefined>, v.ObjectSchema<{
481
+ readonly start: v.StringSchema<undefined>;
482
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
483
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
484
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
485
+ readonly value: v.NumberSchema<undefined>;
486
+ readonly time: v.StringSchema<undefined>;
487
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
488
+ }, undefined>, v.ObjectSchema<{
489
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
490
+ readonly value: v.NumberSchema<undefined>;
491
+ }, undefined>], undefined>, v.ObjectSchema<{
492
+ readonly unit: v.LiteralSchema<"none", undefined>;
493
+ }, undefined>], undefined>, undefined>;
494
+ readonly time_zone: v.StringSchema<undefined>;
495
+ }, undefined>, v.ObjectSchema<{
390
496
  readonly start: v.StringSchema<undefined>;
391
497
  readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
392
498
  readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
393
- }, undefined>, undefined>;
499
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
500
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
501
+ readonly value: v.NumberSchema<undefined>;
502
+ readonly time: v.StringSchema<undefined>;
503
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
504
+ }, undefined>, v.ObjectSchema<{
505
+ readonly unit: v.LiteralSchema<"none", undefined>;
506
+ }, undefined>], undefined>, undefined>;
507
+ }, undefined>], undefined>, undefined>;
394
508
  }, undefined>, v.ObjectSchema<{
395
509
  readonly id: v.StringSchema<undefined>;
396
510
  readonly type: v.LiteralSchema<"people", undefined>;
@@ -539,11 +653,49 @@ export declare const notionPagePropertyReadMapSchema: v.RecordSchema<v.StringSch
539
653
  }, undefined>, v.ObjectSchema<{
540
654
  readonly id: v.StringSchema<undefined>;
541
655
  readonly type: v.LiteralSchema<"date", undefined>;
542
- readonly date: v.NullableSchema<v.ObjectSchema<{
656
+ readonly date: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
657
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
658
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
659
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
660
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
661
+ readonly value: v.NumberSchema<undefined>;
662
+ readonly time: v.StringSchema<undefined>;
663
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
664
+ }, undefined>, v.ObjectSchema<{
665
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
666
+ readonly value: v.NumberSchema<undefined>;
667
+ }, undefined>], undefined>, v.ObjectSchema<{
668
+ readonly unit: v.LiteralSchema<"none", undefined>;
669
+ }, undefined>], undefined>, undefined>;
670
+ readonly start: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "T", undefined>]>;
671
+ }, undefined>, v.ObjectSchema<{
672
+ readonly start: v.StringSchema<undefined>;
673
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
674
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
675
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
676
+ readonly value: v.NumberSchema<undefined>;
677
+ readonly time: v.StringSchema<undefined>;
678
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
679
+ }, undefined>, v.ObjectSchema<{
680
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
681
+ readonly value: v.NumberSchema<undefined>;
682
+ }, undefined>], undefined>, v.ObjectSchema<{
683
+ readonly unit: v.LiteralSchema<"none", undefined>;
684
+ }, undefined>], undefined>, undefined>;
685
+ readonly time_zone: v.StringSchema<undefined>;
686
+ }, undefined>, v.ObjectSchema<{
543
687
  readonly start: v.StringSchema<undefined>;
544
688
  readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
545
689
  readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
546
- }, undefined>, undefined>;
690
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
691
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
692
+ readonly value: v.NumberSchema<undefined>;
693
+ readonly time: v.StringSchema<undefined>;
694
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
695
+ }, undefined>, v.ObjectSchema<{
696
+ readonly unit: v.LiteralSchema<"none", undefined>;
697
+ }, undefined>], undefined>, undefined>;
698
+ }, undefined>], undefined>, undefined>;
547
699
  }, undefined>, v.ObjectSchema<{
548
700
  readonly id: v.StringSchema<undefined>;
549
701
  readonly type: v.LiteralSchema<"people", undefined>;
@@ -718,11 +870,49 @@ export declare const notionPageDataSchema: v.ObjectSchema<{
718
870
  }, undefined>, v.ObjectSchema<{
719
871
  readonly id: v.StringSchema<undefined>;
720
872
  readonly type: v.LiteralSchema<"date", undefined>;
721
- readonly date: v.NullableSchema<v.ObjectSchema<{
873
+ readonly date: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
874
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
875
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
876
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
877
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
878
+ readonly value: v.NumberSchema<undefined>;
879
+ readonly time: v.StringSchema<undefined>;
880
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
881
+ }, undefined>, v.ObjectSchema<{
882
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
883
+ readonly value: v.NumberSchema<undefined>;
884
+ }, undefined>], undefined>, v.ObjectSchema<{
885
+ readonly unit: v.LiteralSchema<"none", undefined>;
886
+ }, undefined>], undefined>, undefined>;
887
+ readonly start: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "T", undefined>]>;
888
+ }, undefined>, v.ObjectSchema<{
889
+ readonly start: v.StringSchema<undefined>;
890
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
891
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
892
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
893
+ readonly value: v.NumberSchema<undefined>;
894
+ readonly time: v.StringSchema<undefined>;
895
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
896
+ }, undefined>, v.ObjectSchema<{
897
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
898
+ readonly value: v.NumberSchema<undefined>;
899
+ }, undefined>], undefined>, v.ObjectSchema<{
900
+ readonly unit: v.LiteralSchema<"none", undefined>;
901
+ }, undefined>], undefined>, undefined>;
902
+ readonly time_zone: v.StringSchema<undefined>;
903
+ }, undefined>, v.ObjectSchema<{
722
904
  readonly start: v.StringSchema<undefined>;
723
905
  readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
724
906
  readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
725
- }, undefined>, undefined>;
907
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
908
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
909
+ readonly value: v.NumberSchema<undefined>;
910
+ readonly time: v.StringSchema<undefined>;
911
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
912
+ }, undefined>, v.ObjectSchema<{
913
+ readonly unit: v.LiteralSchema<"none", undefined>;
914
+ }, undefined>], undefined>, undefined>;
915
+ }, undefined>], undefined>, undefined>;
726
916
  }, undefined>, v.ObjectSchema<{
727
917
  readonly id: v.StringSchema<undefined>;
728
918
  readonly type: v.LiteralSchema<"people", undefined>;
@@ -947,11 +1137,49 @@ export declare const legacyNotionPageSchema: v.ObjectSchema<{
947
1137
  }, undefined>, v.ObjectSchema<{
948
1138
  readonly id: v.StringSchema<undefined>;
949
1139
  readonly type: v.LiteralSchema<"date", undefined>;
950
- readonly date: v.NullableSchema<v.ObjectSchema<{
1140
+ readonly date: v.NullableSchema<v.UnionSchema<[v.ObjectSchema<{
1141
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1142
+ readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1143
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
1144
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
1145
+ readonly value: v.NumberSchema<undefined>;
1146
+ readonly time: v.StringSchema<undefined>;
1147
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1148
+ }, undefined>, v.ObjectSchema<{
1149
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
1150
+ readonly value: v.NumberSchema<undefined>;
1151
+ }, undefined>], undefined>, v.ObjectSchema<{
1152
+ readonly unit: v.LiteralSchema<"none", undefined>;
1153
+ }, undefined>], undefined>, undefined>;
1154
+ readonly start: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "T", undefined>]>;
1155
+ }, undefined>, v.ObjectSchema<{
1156
+ readonly start: v.StringSchema<undefined>;
1157
+ readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1158
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
1159
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
1160
+ readonly value: v.NumberSchema<undefined>;
1161
+ readonly time: v.StringSchema<undefined>;
1162
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1163
+ }, undefined>, v.ObjectSchema<{
1164
+ readonly unit: v.PicklistSchema<["hour", "minute"], undefined>;
1165
+ readonly value: v.NumberSchema<undefined>;
1166
+ }, undefined>], undefined>, v.ObjectSchema<{
1167
+ readonly unit: v.LiteralSchema<"none", undefined>;
1168
+ }, undefined>], undefined>, undefined>;
1169
+ readonly time_zone: v.StringSchema<undefined>;
1170
+ }, undefined>, v.ObjectSchema<{
951
1171
  readonly start: v.StringSchema<undefined>;
952
1172
  readonly end: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
953
1173
  readonly time_zone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
954
- }, undefined>, undefined>;
1174
+ readonly reminder: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
1175
+ readonly unit: v.PicklistSchema<["year", "month", "week", "day"], undefined>;
1176
+ readonly value: v.NumberSchema<undefined>;
1177
+ readonly time: v.StringSchema<undefined>;
1178
+ readonly defaultTimeZone: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1179
+ }, undefined>, v.ObjectSchema<{
1180
+ readonly unit: v.LiteralSchema<"none", undefined>;
1181
+ }, undefined>], undefined>, undefined>;
1182
+ }, undefined>], undefined>, undefined>;
955
1183
  }, undefined>, v.ObjectSchema<{
956
1184
  readonly id: v.StringSchema<undefined>;
957
1185
  readonly type: v.LiteralSchema<"people", undefined>;
@@ -5,6 +5,7 @@
5
5
  * shape the host delivers for messages like `createPageResult`.
6
6
  */
7
7
  import * as v from "valibot";
8
+ import { notionDateReminderSchema, notionDateTimeReminderSchema, notionDisabledReminderSchema, } from "../dataSources/dateValue.js";
8
9
  import { notionRecordPointerSchema } from "../dataSources/recordPointer.js";
9
10
  import { notionPageIdSchema } from "../ids.js";
10
11
  import { notionParentSchema } from "../parent.js";
@@ -75,11 +76,26 @@ const notionSelectOptionInputSchema = v.union([
75
76
  description: v.optional(nullableStringSchema),
76
77
  }),
77
78
  ]);
78
- const notionDateInputSchema = v.object({
79
+ const dateInputEntries = {
79
80
  start: v.string(),
80
81
  end: v.optional(nullableStringSchema),
81
82
  time_zone: v.optional(nullableStringSchema),
82
- });
83
+ reminder: v.optional(v.union([notionDateTimeReminderSchema, notionDisabledReminderSchema])),
84
+ };
85
+ const notionDateInputSchema = v.union([
86
+ v.object({
87
+ ...dateInputEntries,
88
+ start: v.pipe(v.string(), v.includes("T")),
89
+ }),
90
+ v.object({
91
+ ...dateInputEntries,
92
+ time_zone: v.string(),
93
+ }),
94
+ v.object({
95
+ ...dateInputEntries,
96
+ reminder: v.optional(v.union([notionDateReminderSchema, notionDisabledReminderSchema])),
97
+ }),
98
+ ]);
83
99
  const notionUserInputSchema = v.union([
84
100
  v.object({
85
101
  object: v.optional(v.literal("user")),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-host",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Reusable host runtime for Notion custom blocks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,120 @@
1
+ import type {
2
+ NotionDate,
3
+ NotionDateRange,
4
+ NotionDateTime,
5
+ NotionDateTimeRange,
6
+ } from "@notionhq/custom-blocks-protocol/dataSources/dateValue.js"
7
+ import type { NotionDateInput } from "@notionhq/custom-blocks-protocol/pages/page.js"
8
+
9
+ export type CustomBlockDateValue =
10
+ | NotionDate
11
+ | NotionDateRange
12
+ | (NotionDateTime & { time_zone: string })
13
+ | (NotionDateTimeRange & { time_zone: string })
14
+
15
+ export class InvalidNotionDateError extends Error {}
16
+
17
+ export function toNotionDateValue(
18
+ value: NotionDateInput,
19
+ ): CustomBlockDateValue {
20
+ try {
21
+ return convertDateValue(value)
22
+ } catch (error) {
23
+ if (error instanceof RangeError) {
24
+ throw new InvalidNotionDateError(error.message)
25
+ }
26
+ throw error
27
+ }
28
+ }
29
+
30
+ function convertDateValue(value: NotionDateInput): CustomBlockDateValue {
31
+ const { start, end, time_zone, reminder } = value
32
+ if (!start.split("T")[0]) {
33
+ throw new InvalidNotionDateError("Date values must include a date.")
34
+ }
35
+ const timed = start.includes("T") || time_zone != null
36
+ const offset = start.match(/([+-])(\d{2}):(\d{2})$/)
37
+ const offsetMinutes = offset
38
+ ? (Number(offset[2]) * 60 + Number(offset[3])) *
39
+ (offset[1] === "-" ? -1 : 1)
40
+ : 0
41
+ const fixedZone = time_zone?.match(/^UTC(?:([+-])(\d{1,2})(?::(\d{2}))?)?$/)
42
+ const targetOffsetMinutes = fixedZone
43
+ ? (Number(fixedZone[2] ?? 0) * 60 + Number(fixedZone[3] ?? 0)) *
44
+ (fixedZone[1] === "-" ? -1 : 1)
45
+ : offsetMinutes
46
+ const parts = (input: string) => {
47
+ if (!input.split("T")[0]) {
48
+ throw new InvalidNotionDateError("Date values must include a date.")
49
+ }
50
+ if (!input.includes("T")) {
51
+ return { date: input, time: "00:00" }
52
+ }
53
+ const wallClock = input.match(
54
+ /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})(?::\d{2}(?:\.\d+)?)?$/,
55
+ )
56
+ if (wallClock) {
57
+ return { date: wallClock[1], time: wallClock[2] }
58
+ }
59
+ if (!time_zone || fixedZone) {
60
+ const local = new Date(
61
+ new Date(input).getTime() + targetOffsetMinutes * 60_000,
62
+ ).toISOString()
63
+ return { date: local.slice(0, 10), time: local.slice(11, 16) }
64
+ }
65
+ const entries = new Intl.DateTimeFormat("en-CA", {
66
+ timeZone: time_zone,
67
+ year: "numeric",
68
+ month: "2-digit",
69
+ day: "2-digit",
70
+ hour: "2-digit",
71
+ minute: "2-digit",
72
+ hourCycle: "h23",
73
+ }).formatToParts(new Date(input))
74
+ const get = (type: string) =>
75
+ entries.find(part => part.type === type)?.value
76
+ return {
77
+ date: `${get("year")}-${get("month")}-${get("day")}`,
78
+ time: `${get("hour")}:${get("minute")}`,
79
+ }
80
+ }
81
+ const startParts = parts(start)
82
+ const endParts = end ? parts(end) : undefined
83
+ if (!timed) {
84
+ if (reminder && !("time" in reminder) && reminder.unit !== "none") {
85
+ throw new InvalidNotionDateError(
86
+ "Hour and minute reminders require a date with a time.",
87
+ )
88
+ }
89
+ return endParts
90
+ ? {
91
+ type: "daterange",
92
+ start_date: startParts.date,
93
+ end_date: endParts.date,
94
+ reminder,
95
+ }
96
+ : { type: "date", start_date: startParts.date, reminder }
97
+ }
98
+ const zone =
99
+ time_zone ??
100
+ (offsetMinutes === 0
101
+ ? "UTC"
102
+ : `UTC${offsetMinutes < 0 ? "-" : "+"}${Math.floor(Math.abs(offsetMinutes) / 60)}${Math.abs(offsetMinutes) % 60 === 0 ? "" : `:${String(Math.abs(offsetMinutes) % 60).padStart(2, "0")}`}`)
103
+ return endParts
104
+ ? {
105
+ type: "datetimerange",
106
+ start_date: startParts.date,
107
+ start_time: startParts.time,
108
+ end_date: endParts.date,
109
+ end_time: endParts.time,
110
+ time_zone: zone,
111
+ reminder,
112
+ }
113
+ : {
114
+ type: "datetime",
115
+ start_date: startParts.date,
116
+ start_time: startParts.time,
117
+ time_zone: zone,
118
+ reminder,
119
+ }
120
+ }
package/src/index.ts CHANGED
@@ -55,6 +55,11 @@ export {
55
55
  type CustomBlockHostOptions,
56
56
  createCustomBlockHost,
57
57
  } from "./createCustomBlockHost.js"
58
+ export {
59
+ type CustomBlockDateValue,
60
+ InvalidNotionDateError,
61
+ toNotionDateValue,
62
+ } from "./dateValue.js"
58
63
  export { toNotionPageId } from "./ids.js"
59
64
  export type { CustomBlockHostManifestOptions } from "./lifecycle/manifestOptions.js"
60
65
  export type {
@@ -5,6 +5,7 @@ import type {
5
5
  notionPageDataSchema,
6
6
  } from "@notionhq/custom-blocks-protocol/pages/page.js"
7
7
  import type { InferOutput } from "valibot"
8
+ import { toNotionDateValue } from "../dateValue.js"
8
9
  import { unreachable } from "../utils.js"
9
10
 
10
11
  export function toLegacyPage(
@@ -78,78 +79,6 @@ function timestamp(
78
79
  }
79
80
  }
80
81
 
81
- function legacyDate(value: {
82
- start: string
83
- end?: string | null
84
- time_zone?: string | null
85
- }): NotionDataSourceValue {
86
- const timed = value.start.includes("T") || value.time_zone != null
87
- const offset = value.start.match(/([+-])(\d{2}):(\d{2})$/)
88
- const offsetMinutes = offset
89
- ? (Number(offset[2]) * 60 + Number(offset[3])) *
90
- (offset[1] === "-" ? -1 : 1)
91
- : 0
92
- const parts = (input: string) => {
93
- if (!input.includes("T")) {
94
- return { date: input, time: "00:00" }
95
- }
96
- const wallClock = input.match(
97
- /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})(?::\d{2}(?:\.\d+)?)?$/,
98
- )
99
- if (wallClock) {
100
- return { date: wallClock[1], time: wallClock[2] }
101
- }
102
- if (!value.time_zone) {
103
- const local = new Date(
104
- new Date(input).getTime() + offsetMinutes * 60_000,
105
- ).toISOString()
106
- return { date: local.slice(0, 10), time: local.slice(11, 16) }
107
- }
108
- const entries = new Intl.DateTimeFormat("en-CA", {
109
- timeZone: value.time_zone,
110
- year: "numeric",
111
- month: "2-digit",
112
- day: "2-digit",
113
- hour: "2-digit",
114
- minute: "2-digit",
115
- hourCycle: "h23",
116
- }).formatToParts(new Date(input))
117
- const get = (type: string) =>
118
- entries.find(part => part.type === type)?.value
119
- return {
120
- date: `${get("year")}-${get("month")}-${get("day")}`,
121
- time: `${get("hour")}:${get("minute")}`,
122
- }
123
- }
124
- const start = parts(value.start)
125
- const end = value.end ? parts(value.end) : undefined
126
- if (!timed) {
127
- return end
128
- ? { type: "daterange", start_date: start.date, end_date: end.date }
129
- : { type: "date", start_date: start.date }
130
- }
131
- const zone =
132
- value.time_zone ??
133
- (offsetMinutes === 0
134
- ? "UTC"
135
- : `UTC${offsetMinutes < 0 ? "-" : "+"}${Math.floor(Math.abs(offsetMinutes) / 60)}${Math.abs(offsetMinutes) % 60 === 0 ? "" : `:${String(Math.abs(offsetMinutes) % 60).padStart(2, "0")}`}`)
136
- return end
137
- ? {
138
- type: "datetimerange",
139
- start_date: start.date,
140
- start_time: start.time,
141
- end_date: end.date,
142
- end_time: end.time,
143
- time_zone: zone,
144
- }
145
- : {
146
- type: "datetime",
147
- start_date: start.date,
148
- start_time: start.time,
149
- time_zone: zone,
150
- }
151
- }
152
-
153
82
  function toLegacyProperty(
154
83
  property: NotionPagePropertyValue,
155
84
  ): NotionDataSourceValue | undefined {
@@ -175,7 +104,7 @@ function toLegacyProperty(
175
104
  case "multi_select":
176
105
  return property.multi_select.flatMap(option => option.name ?? [])
177
106
  case "date":
178
- return property.date ? legacyDate(property.date) : undefined
107
+ return property.date ? toNotionDateValue(property.date) : undefined
179
108
  case "people":
180
109
  return property.people.map(person =>
181
110
  person.object === "group"