@notionhq/custom-blocks-host 0.1.17 → 0.1.18

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.
@@ -1,4 +1,25 @@
1
1
  import * as v from "valibot";
2
+ declare const customBlockPersonFilterValueSchema: v.ObjectSchema<{
3
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
4
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
5
+ }, undefined>;
6
+ export type CustomBlockPersonFilterValue = v.InferOutput<typeof customBlockPersonFilterValueSchema>;
7
+ export declare const customBlockPeopleFilterOperatorSchema: v.UnionSchema<[v.ObjectSchema<{
8
+ readonly contains: v.ObjectSchema<{
9
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
10
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
11
+ }, undefined>;
12
+ }, undefined>, v.ObjectSchema<{
13
+ readonly does_not_contain: v.ObjectSchema<{
14
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
15
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
16
+ }, undefined>;
17
+ }, undefined>, v.UnionSchema<[v.ObjectSchema<{
18
+ readonly is_empty: v.LiteralSchema<true, undefined>;
19
+ }, undefined>, v.ObjectSchema<{
20
+ readonly is_not_empty: v.LiteralSchema<true, undefined>;
21
+ }, undefined>], undefined>], undefined>;
22
+ export type CustomBlockPeopleFilterOperator = v.InferOutput<typeof customBlockPeopleFilterOperatorSchema>;
2
23
  export declare const customBlockTextFilterOperatorSchema: v.UnionSchema<[v.ObjectSchema<{
3
24
  readonly equals: v.StringSchema<undefined>;
4
25
  }, undefined>, v.ObjectSchema<{
@@ -252,6 +273,23 @@ export declare const resolvedCustomBlockDataSourcePropertyFilterSchema: v.UnionS
252
273
  }, undefined>, v.ObjectSchema<{
253
274
  readonly is_not_empty: v.LiteralSchema<true, undefined>;
254
275
  }, undefined>], undefined>], undefined>;
276
+ }, undefined>, v.ObjectSchema<{
277
+ readonly propertyId: v.StringSchema<undefined>;
278
+ readonly people: v.UnionSchema<[v.ObjectSchema<{
279
+ readonly contains: v.ObjectSchema<{
280
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
281
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
282
+ }, undefined>;
283
+ }, undefined>, v.ObjectSchema<{
284
+ readonly does_not_contain: v.ObjectSchema<{
285
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
286
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
287
+ }, undefined>;
288
+ }, undefined>, v.UnionSchema<[v.ObjectSchema<{
289
+ readonly is_empty: v.LiteralSchema<true, undefined>;
290
+ }, undefined>, v.ObjectSchema<{
291
+ readonly is_not_empty: v.LiteralSchema<true, undefined>;
292
+ }, undefined>], undefined>], undefined>;
255
293
  }, undefined>], undefined>;
256
294
  export type ResolvedCustomBlockDataSourcePropertyFilter = v.InferOutput<typeof resolvedCustomBlockDataSourcePropertyFilterSchema>;
257
295
  export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v.UnionSchema<[v.ObjectSchema<{
@@ -427,6 +465,23 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
427
465
  }, undefined>, v.ObjectSchema<{
428
466
  readonly is_not_empty: v.LiteralSchema<true, undefined>;
429
467
  }, undefined>], undefined>], undefined>;
468
+ }, undefined>, v.ObjectSchema<{
469
+ readonly propertyId: v.StringSchema<undefined>;
470
+ readonly people: v.UnionSchema<[v.ObjectSchema<{
471
+ readonly contains: v.ObjectSchema<{
472
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
473
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
474
+ }, undefined>;
475
+ }, undefined>, v.ObjectSchema<{
476
+ readonly does_not_contain: v.ObjectSchema<{
477
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
478
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
479
+ }, undefined>;
480
+ }, undefined>, v.UnionSchema<[v.ObjectSchema<{
481
+ readonly is_empty: v.LiteralSchema<true, undefined>;
482
+ }, undefined>, v.ObjectSchema<{
483
+ readonly is_not_empty: v.LiteralSchema<true, undefined>;
484
+ }, undefined>], undefined>], undefined>;
430
485
  }, undefined>], undefined>, v.ObjectSchema<{
431
486
  readonly and: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
432
487
  readonly propertyId: v.StringSchema<undefined>;
@@ -601,6 +656,23 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
601
656
  }, undefined>, v.ObjectSchema<{
602
657
  readonly is_not_empty: v.LiteralSchema<true, undefined>;
603
658
  }, undefined>], undefined>], undefined>;
659
+ }, undefined>, v.ObjectSchema<{
660
+ readonly propertyId: v.StringSchema<undefined>;
661
+ readonly people: v.UnionSchema<[v.ObjectSchema<{
662
+ readonly contains: v.ObjectSchema<{
663
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
664
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
665
+ }, undefined>;
666
+ }, undefined>, v.ObjectSchema<{
667
+ readonly does_not_contain: v.ObjectSchema<{
668
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
669
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
670
+ }, undefined>;
671
+ }, undefined>, v.UnionSchema<[v.ObjectSchema<{
672
+ readonly is_empty: v.LiteralSchema<true, undefined>;
673
+ }, undefined>, v.ObjectSchema<{
674
+ readonly is_not_empty: v.LiteralSchema<true, undefined>;
675
+ }, undefined>], undefined>], undefined>;
604
676
  }, undefined>], undefined>, undefined>;
605
677
  }, undefined>], undefined>;
606
678
  export type ResolvedCustomBlockDataSourceFilter = v.InferOutput<typeof resolvedCustomBlockDataSourceFilterSchema>;
@@ -800,6 +872,23 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
800
872
  }, undefined>, v.ObjectSchema<{
801
873
  readonly is_not_empty: v.LiteralSchema<true, undefined>;
802
874
  }, undefined>], undefined>], undefined>;
875
+ }, undefined>, v.ObjectSchema<{
876
+ readonly propertyId: v.StringSchema<undefined>;
877
+ readonly people: v.UnionSchema<[v.ObjectSchema<{
878
+ readonly contains: v.ObjectSchema<{
879
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
880
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
881
+ }, undefined>;
882
+ }, undefined>, v.ObjectSchema<{
883
+ readonly does_not_contain: v.ObjectSchema<{
884
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
885
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
886
+ }, undefined>;
887
+ }, undefined>, v.UnionSchema<[v.ObjectSchema<{
888
+ readonly is_empty: v.LiteralSchema<true, undefined>;
889
+ }, undefined>, v.ObjectSchema<{
890
+ readonly is_not_empty: v.LiteralSchema<true, undefined>;
891
+ }, undefined>], undefined>], undefined>;
803
892
  }, undefined>], undefined>, v.ObjectSchema<{
804
893
  readonly and: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
805
894
  readonly propertyId: v.StringSchema<undefined>;
@@ -974,6 +1063,23 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
974
1063
  }, undefined>, v.ObjectSchema<{
975
1064
  readonly is_not_empty: v.LiteralSchema<true, undefined>;
976
1065
  }, undefined>], undefined>], undefined>;
1066
+ }, undefined>, v.ObjectSchema<{
1067
+ readonly propertyId: v.StringSchema<undefined>;
1068
+ readonly people: v.UnionSchema<[v.ObjectSchema<{
1069
+ readonly contains: v.ObjectSchema<{
1070
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
1071
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1072
+ }, undefined>;
1073
+ }, undefined>, v.ObjectSchema<{
1074
+ readonly does_not_contain: v.ObjectSchema<{
1075
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
1076
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1077
+ }, undefined>;
1078
+ }, undefined>, v.UnionSchema<[v.ObjectSchema<{
1079
+ readonly is_empty: v.LiteralSchema<true, undefined>;
1080
+ }, undefined>, v.ObjectSchema<{
1081
+ readonly is_not_empty: v.LiteralSchema<true, undefined>;
1082
+ }, undefined>], undefined>], undefined>;
977
1083
  }, undefined>], undefined>, undefined>;
978
1084
  }, undefined>], undefined>, undefined>;
979
1085
  /** Sandbox-resolved property sorts, in priority order. */
@@ -983,3 +1089,4 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
983
1089
  }, undefined>, undefined>, undefined>;
984
1090
  }, undefined>;
985
1091
  export type QueryDataSourceMessage = v.InferOutput<typeof queryDataSourceMessageSchema>;
1092
+ export {};
@@ -5,6 +5,15 @@ const emptyOperatorSchema = v.union([
5
5
  v.object({ is_not_empty: v.literal(true) }),
6
6
  ]);
7
7
  const stringOrStringArraySchema = v.union([v.string(), v.array(v.string())]);
8
+ const customBlockPersonFilterValueSchema = v.object({
9
+ object: v.picklist(["user", "group"]),
10
+ id: v.pipe(v.string(), v.minLength(1)),
11
+ });
12
+ export const customBlockPeopleFilterOperatorSchema = v.union([
13
+ v.object({ contains: customBlockPersonFilterValueSchema }),
14
+ v.object({ does_not_contain: customBlockPersonFilterValueSchema }),
15
+ emptyOperatorSchema,
16
+ ]);
8
17
  export const customBlockTextFilterOperatorSchema = v.union([
9
18
  v.object({ equals: v.string() }),
10
19
  v.object({ does_not_equal: v.string() }),
@@ -91,6 +100,10 @@ export const resolvedCustomBlockDataSourcePropertyFilterSchema = v.union([
91
100
  propertyId: v.string(),
92
101
  date: customBlockDateFilterOperatorSchema,
93
102
  }),
103
+ v.object({
104
+ propertyId: v.string(),
105
+ people: customBlockPeopleFilterOperatorSchema,
106
+ }),
94
107
  ]);
95
108
  export const resolvedCustomBlockDataSourceFilterSchema = v.union([
96
109
  resolvedCustomBlockDataSourcePropertyFilterSchema,
@@ -231,6 +231,23 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
231
231
  }, undefined>, v.ObjectSchema<{
232
232
  readonly is_not_empty: v.LiteralSchema<true, undefined>;
233
233
  }, undefined>], undefined>], undefined>;
234
+ }, undefined>, v.ObjectSchema<{
235
+ readonly propertyId: v.StringSchema<undefined>;
236
+ readonly people: v.UnionSchema<[v.ObjectSchema<{
237
+ readonly contains: v.ObjectSchema<{
238
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
239
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
240
+ }, undefined>;
241
+ }, undefined>, v.ObjectSchema<{
242
+ readonly does_not_contain: v.ObjectSchema<{
243
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
244
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
245
+ }, undefined>;
246
+ }, undefined>, v.UnionSchema<[v.ObjectSchema<{
247
+ readonly is_empty: v.LiteralSchema<true, undefined>;
248
+ }, undefined>, v.ObjectSchema<{
249
+ readonly is_not_empty: v.LiteralSchema<true, undefined>;
250
+ }, undefined>], undefined>], undefined>;
234
251
  }, undefined>], undefined>, v.ObjectSchema<{
235
252
  readonly and: v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
236
253
  readonly propertyId: v.StringSchema<undefined>;
@@ -405,6 +422,23 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
405
422
  }, undefined>, v.ObjectSchema<{
406
423
  readonly is_not_empty: v.LiteralSchema<true, undefined>;
407
424
  }, undefined>], undefined>], undefined>;
425
+ }, undefined>, v.ObjectSchema<{
426
+ readonly propertyId: v.StringSchema<undefined>;
427
+ readonly people: v.UnionSchema<[v.ObjectSchema<{
428
+ readonly contains: v.ObjectSchema<{
429
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
430
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
431
+ }, undefined>;
432
+ }, undefined>, v.ObjectSchema<{
433
+ readonly does_not_contain: v.ObjectSchema<{
434
+ readonly object: v.PicklistSchema<["user", "group"], undefined>;
435
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
436
+ }, undefined>;
437
+ }, undefined>, v.UnionSchema<[v.ObjectSchema<{
438
+ readonly is_empty: v.LiteralSchema<true, undefined>;
439
+ }, undefined>, v.ObjectSchema<{
440
+ readonly is_not_empty: v.LiteralSchema<true, undefined>;
441
+ }, undefined>], undefined>], undefined>;
408
442
  }, undefined>], undefined>, undefined>;
409
443
  }, undefined>], undefined>, undefined>;
410
444
  readonly sorts: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
@@ -17,6 +17,13 @@ function validatePropertyFilter(filter, collectionSchema) {
17
17
  if (propertySchema === undefined) {
18
18
  return undefined;
19
19
  }
20
+ if ("people" in filter && propertySchema.type !== "people") {
21
+ return {
22
+ code: "invalid_data_source_query_filter",
23
+ message: `Data source query filter branch "people" does not match property type "${propertySchema.type}".`,
24
+ isRetryable: false,
25
+ };
26
+ }
20
27
  const optionFilter = getOptionFilter(filter);
21
28
  if (optionFilter === undefined ||
22
29
  propertySchema.type !== optionFilter.propertyType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-host",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Reusable host runtime for Notion custom blocks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,6 +39,14 @@ function validatePropertyFilter(
39
39
  return undefined
40
40
  }
41
41
 
42
+ if ("people" in filter && propertySchema.type !== "people") {
43
+ return {
44
+ code: "invalid_data_source_query_filter",
45
+ message: `Data source query filter branch "people" does not match property type "${propertySchema.type}".`,
46
+ isRetryable: false,
47
+ }
48
+ }
49
+
42
50
  const optionFilter = getOptionFilter(filter)
43
51
  if (
44
52
  optionFilter === undefined ||