@notionhq/custom-blocks-host 0.2.2 → 0.2.4
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 +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/protocol/messages/hostToSandbox.d.ts +0 -3
- package/dist/protocol/messages/queryDataSource.d.ts +47 -5
- package/dist/protocol/messages/queryDataSource.js +22 -1
- package/dist/protocol/messages/sandboxToHost.d.ts +10 -2
- package/dist/queries/validateQueryDataSourceFilter.js +21 -1
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/queries/validateQueryDataSourceFilter.ts +25 -1
package/README.md
CHANGED
|
@@ -179,9 +179,9 @@ For SDKs using protocol 3 or 4, the runtime adds synthetic metadata schemas to o
|
|
|
179
179
|
the actual database schema supplied by the host. Protocol 5 SDKs receive that schema directly and
|
|
180
180
|
add the metadata read schemas themselves.
|
|
181
181
|
|
|
182
|
-
The runtime validates option names, supported sort types, and
|
|
183
|
-
properties before it invokes the handler.
|
|
184
|
-
filter types fail protocol validation.
|
|
182
|
+
The runtime validates option names, Status group names, supported sort types, and ten unique sort
|
|
183
|
+
properties before it invokes the handler. It checks group names against the current bound schema.
|
|
184
|
+
Sorts retain their array order. Extra fields and mixed filter types fail protocol validation.
|
|
185
185
|
|
|
186
186
|
Derive bindings from the successful `connect` message inside `getInitialState` and return them in
|
|
187
187
|
`initialState.dataSources`.
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { GetPageMessage } from "./protocol/messages/getPage.js";
|
|
|
4
4
|
export type { GetUserMessage } from "./protocol/messages/getUser.js";
|
|
5
5
|
export type { ListUsersMessage } from "./protocol/messages/listUsers.js";
|
|
6
6
|
export type { OpenPageMessage } from "./protocol/messages/openPage.js";
|
|
7
|
-
export type { CustomBlockCheckboxFilterOperator, CustomBlockContainsFilterOperator, CustomBlockCreatedByFilterOperator, CustomBlockDateFilterOperator, CustomBlockNumberFilterOperator, CustomBlockOptionFilterOperator, CustomBlockPeopleFilterOperator, CustomBlockPersonFilterValue, CustomBlockTextFilterOperator, QueryDataSourceMessage, ResolvedCustomBlockDataSourceFilter, ResolvedCustomBlockDataSourcePropertyFilter, ResolvedCustomBlockDataSourceSort, } from "./protocol/messages/queryDataSource.js";
|
|
7
|
+
export type { CustomBlockCheckboxFilterOperator, CustomBlockContainsFilterOperator, CustomBlockCreatedByFilterOperator, CustomBlockDateFilterOperator, CustomBlockNumberFilterOperator, CustomBlockOptionFilterOperator, CustomBlockPeopleFilterOperator, CustomBlockPersonFilterValue, CustomBlockStatusFilterOperator, CustomBlockStatusGroupFilterOperator, CustomBlockStatusGroupName, CustomBlockTextFilterOperator, QueryDataSourceMessage, ResolvedCustomBlockDataSourceFilter, ResolvedCustomBlockDataSourcePropertyFilter, ResolvedCustomBlockDataSourceSort, } from "./protocol/messages/queryDataSource.js";
|
|
8
8
|
export type { ResizeMessage } from "./protocol/messages/resize.js";
|
|
9
9
|
export type { UpdatePageMessage } from "./protocol/messages/updatePage.js";
|
|
10
10
|
export type { NotionDateInput, NotionFileInput, NotionPageCover, NotionPageIcon, NotionPagePropertyValue, NotionPagePropertyWriteMap, NotionRichTextItem, NotionSelectOptionInput, } from "./protocol/pages/page.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACtF,YAAY,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAChG,YAAY,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,YAAY,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,YAAY,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAA;AAC9F,YAAY,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AA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B,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,oCAAoC,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -1201,6 +1201,3 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
1201
1201
|
readonly reason: v.StringSchema<undefined>;
|
|
1202
1202
|
}, undefined>], undefined>;
|
|
1203
1203
|
export type HostToSandboxMessage = v.InferOutput<typeof hostToSandboxMessageSchema>;
|
|
1204
|
-
export type PrimeableHostToSandboxMessage = Extract<HostToSandboxMessage, {
|
|
1205
|
-
type: "getPageResult" | "openPageResult" | "createPageResult" | "updatePageResult" | "getUserResult" | "listUsersResult" | "queryDataSourceResult";
|
|
1206
|
-
}>;
|
|
@@ -88,6 +88,28 @@ export declare const customBlockOptionFilterOperatorSchema: v.UnionSchema<[v.Str
|
|
|
88
88
|
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
89
89
|
}, undefined>], undefined>], undefined>;
|
|
90
90
|
export type CustomBlockOptionFilterOperator = v.InferOutput<typeof customBlockOptionFilterOperatorSchema>;
|
|
91
|
+
export declare const customBlockStatusGroupNameSchema: v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>;
|
|
92
|
+
export type CustomBlockStatusGroupName = v.InferOutput<typeof customBlockStatusGroupNameSchema>;
|
|
93
|
+
export declare const customBlockStatusGroupFilterOperatorSchema: v.UnionSchema<[v.StrictObjectSchema<{
|
|
94
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
95
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
96
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
97
|
+
}, undefined>], undefined>;
|
|
98
|
+
export type CustomBlockStatusGroupFilterOperator = v.InferOutput<typeof customBlockStatusGroupFilterOperatorSchema>;
|
|
99
|
+
export declare const customBlockStatusFilterOperatorSchema: v.UnionSchema<[v.UnionSchema<[v.StrictObjectSchema<{
|
|
100
|
+
readonly equals: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
101
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
102
|
+
readonly does_not_equal: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
103
|
+
}, undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
104
|
+
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
105
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
106
|
+
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
107
|
+
}, undefined>], undefined>], undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
108
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
109
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
110
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
111
|
+
}, undefined>], undefined>], undefined>;
|
|
112
|
+
export type CustomBlockStatusFilterOperator = v.InferOutput<typeof customBlockStatusFilterOperatorSchema>;
|
|
91
113
|
export declare const customBlockContainsFilterOperatorSchema: v.UnionSchema<[v.StrictObjectSchema<{
|
|
92
114
|
readonly contains: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
93
115
|
}, undefined>, v.StrictObjectSchema<{
|
|
@@ -280,7 +302,7 @@ export declare const resolvedCustomBlockDataSourcePropertyFilterSchema: v.UnionS
|
|
|
280
302
|
}, undefined>], undefined>], undefined>;
|
|
281
303
|
}, undefined>, v.StrictObjectSchema<{
|
|
282
304
|
readonly propertyId: v.StringSchema<undefined>;
|
|
283
|
-
readonly status: v.UnionSchema<[v.StrictObjectSchema<{
|
|
305
|
+
readonly status: v.UnionSchema<[v.UnionSchema<[v.StrictObjectSchema<{
|
|
284
306
|
readonly equals: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
285
307
|
}, undefined>, v.StrictObjectSchema<{
|
|
286
308
|
readonly does_not_equal: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
@@ -288,6 +310,10 @@ export declare const resolvedCustomBlockDataSourcePropertyFilterSchema: v.UnionS
|
|
|
288
310
|
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
289
311
|
}, undefined>, v.StrictObjectSchema<{
|
|
290
312
|
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
313
|
+
}, undefined>], undefined>], undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
314
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
315
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
316
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
291
317
|
}, undefined>], undefined>], undefined>;
|
|
292
318
|
}, undefined>, v.StrictObjectSchema<{
|
|
293
319
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -489,7 +515,7 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
|
|
|
489
515
|
}, undefined>], undefined>], undefined>;
|
|
490
516
|
}, undefined>, v.StrictObjectSchema<{
|
|
491
517
|
readonly propertyId: v.StringSchema<undefined>;
|
|
492
|
-
readonly status: v.UnionSchema<[v.StrictObjectSchema<{
|
|
518
|
+
readonly status: v.UnionSchema<[v.UnionSchema<[v.StrictObjectSchema<{
|
|
493
519
|
readonly equals: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
494
520
|
}, undefined>, v.StrictObjectSchema<{
|
|
495
521
|
readonly does_not_equal: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
@@ -497,6 +523,10 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
|
|
|
497
523
|
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
498
524
|
}, undefined>, v.StrictObjectSchema<{
|
|
499
525
|
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
526
|
+
}, undefined>], undefined>], undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
527
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
528
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
529
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
500
530
|
}, undefined>], undefined>], undefined>;
|
|
501
531
|
}, undefined>, v.StrictObjectSchema<{
|
|
502
532
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -697,7 +727,7 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
|
|
|
697
727
|
}, undefined>], undefined>], undefined>;
|
|
698
728
|
}, undefined>, v.StrictObjectSchema<{
|
|
699
729
|
readonly propertyId: v.StringSchema<undefined>;
|
|
700
|
-
readonly status: v.UnionSchema<[v.StrictObjectSchema<{
|
|
730
|
+
readonly status: v.UnionSchema<[v.UnionSchema<[v.StrictObjectSchema<{
|
|
701
731
|
readonly equals: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
702
732
|
}, undefined>, v.StrictObjectSchema<{
|
|
703
733
|
readonly does_not_equal: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
@@ -705,6 +735,10 @@ export declare const resolvedCustomBlockDataSourceFilterSchema: v.UnionSchema<[v
|
|
|
705
735
|
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
706
736
|
}, undefined>, v.StrictObjectSchema<{
|
|
707
737
|
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
738
|
+
}, undefined>], undefined>], undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
739
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
740
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
741
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
708
742
|
}, undefined>], undefined>], undefined>;
|
|
709
743
|
}, undefined>, v.StrictObjectSchema<{
|
|
710
744
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -930,7 +964,7 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
|
|
|
930
964
|
}, undefined>], undefined>], undefined>;
|
|
931
965
|
}, undefined>, v.StrictObjectSchema<{
|
|
932
966
|
readonly propertyId: v.StringSchema<undefined>;
|
|
933
|
-
readonly status: v.UnionSchema<[v.StrictObjectSchema<{
|
|
967
|
+
readonly status: v.UnionSchema<[v.UnionSchema<[v.StrictObjectSchema<{
|
|
934
968
|
readonly equals: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
935
969
|
}, undefined>, v.StrictObjectSchema<{
|
|
936
970
|
readonly does_not_equal: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
@@ -938,6 +972,10 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
|
|
|
938
972
|
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
939
973
|
}, undefined>, v.StrictObjectSchema<{
|
|
940
974
|
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
975
|
+
}, undefined>], undefined>], undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
976
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
977
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
978
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
941
979
|
}, undefined>], undefined>], undefined>;
|
|
942
980
|
}, undefined>, v.StrictObjectSchema<{
|
|
943
981
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -1138,7 +1176,7 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
|
|
|
1138
1176
|
}, undefined>], undefined>], undefined>;
|
|
1139
1177
|
}, undefined>, v.StrictObjectSchema<{
|
|
1140
1178
|
readonly propertyId: v.StringSchema<undefined>;
|
|
1141
|
-
readonly status: v.UnionSchema<[v.StrictObjectSchema<{
|
|
1179
|
+
readonly status: v.UnionSchema<[v.UnionSchema<[v.StrictObjectSchema<{
|
|
1142
1180
|
readonly equals: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
1143
1181
|
}, undefined>, v.StrictObjectSchema<{
|
|
1144
1182
|
readonly does_not_equal: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
@@ -1146,6 +1184,10 @@ export declare const queryDataSourceMessageSchema: v.ObjectSchema<{
|
|
|
1146
1184
|
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
1147
1185
|
}, undefined>, v.StrictObjectSchema<{
|
|
1148
1186
|
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
1187
|
+
}, undefined>], undefined>], undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
1188
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
1189
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
1190
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
1149
1191
|
}, undefined>], undefined>], undefined>;
|
|
1150
1192
|
}, undefined>, v.StrictObjectSchema<{
|
|
1151
1193
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -55,6 +55,27 @@ export const customBlockOptionFilterOperatorSchema = v.union([
|
|
|
55
55
|
v.strictObject({ does_not_equal: stringOrStringArraySchema }),
|
|
56
56
|
emptyOperatorSchema,
|
|
57
57
|
]);
|
|
58
|
+
export const customBlockStatusGroupNameSchema = v.picklist([
|
|
59
|
+
"To-do",
|
|
60
|
+
"In progress",
|
|
61
|
+
"Complete",
|
|
62
|
+
"Current",
|
|
63
|
+
"Future",
|
|
64
|
+
]);
|
|
65
|
+
const customBlockStatusGroupFilterValueSchema = v.union([
|
|
66
|
+
customBlockStatusGroupNameSchema,
|
|
67
|
+
v.pipe(v.array(customBlockStatusGroupNameSchema), v.minLength(1), v.maxLength(5)),
|
|
68
|
+
]);
|
|
69
|
+
export const customBlockStatusGroupFilterOperatorSchema = v.union([
|
|
70
|
+
v.strictObject({ group_equals: customBlockStatusGroupFilterValueSchema }),
|
|
71
|
+
v.strictObject({
|
|
72
|
+
group_does_not_equal: customBlockStatusGroupFilterValueSchema,
|
|
73
|
+
}),
|
|
74
|
+
]);
|
|
75
|
+
export const customBlockStatusFilterOperatorSchema = v.union([
|
|
76
|
+
customBlockOptionFilterOperatorSchema,
|
|
77
|
+
customBlockStatusGroupFilterOperatorSchema,
|
|
78
|
+
]);
|
|
58
79
|
export const customBlockContainsFilterOperatorSchema = v.union([
|
|
59
80
|
v.strictObject({ contains: stringOrStringArraySchema }),
|
|
60
81
|
v.strictObject({ contains_all: stringOrStringArraySchema }),
|
|
@@ -112,7 +133,7 @@ export const resolvedCustomBlockDataSourcePropertyFilterSchema = v.union([
|
|
|
112
133
|
}),
|
|
113
134
|
v.strictObject({
|
|
114
135
|
propertyId: v.string(),
|
|
115
|
-
status:
|
|
136
|
+
status: customBlockStatusFilterOperatorSchema,
|
|
116
137
|
}),
|
|
117
138
|
v.strictObject({
|
|
118
139
|
propertyId: v.string(),
|
|
@@ -222,7 +222,7 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
222
222
|
}, undefined>], undefined>], undefined>;
|
|
223
223
|
}, undefined>, v.StrictObjectSchema<{
|
|
224
224
|
readonly propertyId: v.StringSchema<undefined>;
|
|
225
|
-
readonly status: v.UnionSchema<[v.StrictObjectSchema<{
|
|
225
|
+
readonly status: v.UnionSchema<[v.UnionSchema<[v.StrictObjectSchema<{
|
|
226
226
|
readonly equals: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
227
227
|
}, undefined>, v.StrictObjectSchema<{
|
|
228
228
|
readonly does_not_equal: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
@@ -230,6 +230,10 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
230
230
|
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
231
231
|
}, undefined>, v.StrictObjectSchema<{
|
|
232
232
|
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
233
|
+
}, undefined>], undefined>], undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
234
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
235
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
236
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
233
237
|
}, undefined>], undefined>], undefined>;
|
|
234
238
|
}, undefined>, v.StrictObjectSchema<{
|
|
235
239
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -430,7 +434,7 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
430
434
|
}, undefined>], undefined>], undefined>;
|
|
431
435
|
}, undefined>, v.StrictObjectSchema<{
|
|
432
436
|
readonly propertyId: v.StringSchema<undefined>;
|
|
433
|
-
readonly status: v.UnionSchema<[v.StrictObjectSchema<{
|
|
437
|
+
readonly status: v.UnionSchema<[v.UnionSchema<[v.StrictObjectSchema<{
|
|
434
438
|
readonly equals: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
435
439
|
}, undefined>, v.StrictObjectSchema<{
|
|
436
440
|
readonly does_not_equal: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
@@ -438,6 +442,10 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
|
|
|
438
442
|
readonly is_empty: v.LiteralSchema<true, undefined>;
|
|
439
443
|
}, undefined>, v.StrictObjectSchema<{
|
|
440
444
|
readonly is_not_empty: v.LiteralSchema<true, undefined>;
|
|
445
|
+
}, undefined>], undefined>], undefined>, v.UnionSchema<[v.StrictObjectSchema<{
|
|
446
|
+
readonly group_equals: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
447
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
448
|
+
readonly group_does_not_equal: v.UnionSchema<[v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["To-do", "In progress", "Complete", "Current", "Future"], undefined>, undefined>, v.MinLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 1, undefined>, v.MaxLengthAction<("Complete" | "Current" | "Future" | "In progress" | "To-do")[], 5, undefined>]>], undefined>;
|
|
441
449
|
}, undefined>], undefined>], undefined>;
|
|
442
450
|
}, undefined>, v.StrictObjectSchema<{
|
|
443
451
|
readonly propertyId: v.StringSchema<undefined>;
|
|
@@ -29,6 +29,23 @@ function validatePropertyFilter(filter, collectionSchema) {
|
|
|
29
29
|
isRetryable: false,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
+
if ("status" in filter && propertySchema.type === "status") {
|
|
33
|
+
const operator = filter.status;
|
|
34
|
+
if ("group_equals" in operator || "group_does_not_equal" in operator) {
|
|
35
|
+
const value = "group_equals" in operator
|
|
36
|
+
? operator.group_equals
|
|
37
|
+
: operator.group_does_not_equal;
|
|
38
|
+
const names = Array.isArray(value) ? value : [value];
|
|
39
|
+
const unknownName = names.find(name => !propertySchema.groups.some(group => group.name === name));
|
|
40
|
+
return unknownName === undefined
|
|
41
|
+
? undefined
|
|
42
|
+
: {
|
|
43
|
+
code: "invalid_data_source_query_filter",
|
|
44
|
+
message: `Unknown status group "${unknownName}".`,
|
|
45
|
+
isRetryable: false,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
32
49
|
const optionFilter = getOptionFilter(filter);
|
|
33
50
|
if (optionFilter === undefined ||
|
|
34
51
|
propertySchema.type !== optionFilter.propertyType) {
|
|
@@ -53,7 +70,10 @@ function getOptionFilter(filter) {
|
|
|
53
70
|
return { propertyType: "multi_select", operator: filter.multi_select };
|
|
54
71
|
}
|
|
55
72
|
if ("status" in filter) {
|
|
56
|
-
|
|
73
|
+
const operator = filter.status;
|
|
74
|
+
return "group_equals" in operator || "group_does_not_equal" in operator
|
|
75
|
+
? undefined
|
|
76
|
+
: { propertyType: "status", operator };
|
|
57
77
|
}
|
|
58
78
|
return undefined;
|
|
59
79
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -13,6 +13,9 @@ export type {
|
|
|
13
13
|
CustomBlockOptionFilterOperator,
|
|
14
14
|
CustomBlockPeopleFilterOperator,
|
|
15
15
|
CustomBlockPersonFilterValue,
|
|
16
|
+
CustomBlockStatusFilterOperator,
|
|
17
|
+
CustomBlockStatusGroupFilterOperator,
|
|
18
|
+
CustomBlockStatusGroupName,
|
|
16
19
|
CustomBlockTextFilterOperator,
|
|
17
20
|
QueryDataSourceMessage,
|
|
18
21
|
ResolvedCustomBlockDataSourceFilter,
|
|
@@ -52,6 +52,27 @@ function validatePropertyFilter(
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
if ("status" in filter && propertySchema.type === "status") {
|
|
56
|
+
const operator = filter.status
|
|
57
|
+
if ("group_equals" in operator || "group_does_not_equal" in operator) {
|
|
58
|
+
const value =
|
|
59
|
+
"group_equals" in operator
|
|
60
|
+
? operator.group_equals
|
|
61
|
+
: operator.group_does_not_equal
|
|
62
|
+
const names = Array.isArray(value) ? value : [value]
|
|
63
|
+
const unknownName = names.find(
|
|
64
|
+
name => !propertySchema.groups.some(group => group.name === name),
|
|
65
|
+
)
|
|
66
|
+
return unknownName === undefined
|
|
67
|
+
? undefined
|
|
68
|
+
: {
|
|
69
|
+
code: "invalid_data_source_query_filter",
|
|
70
|
+
message: `Unknown status group "${unknownName}".`,
|
|
71
|
+
isRetryable: false,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
55
76
|
const optionFilter = getOptionFilter(filter)
|
|
56
77
|
if (
|
|
57
78
|
optionFilter === undefined ||
|
|
@@ -88,7 +109,10 @@ function getOptionFilter(filter: ResolvedCustomBlockDataSourcePropertyFilter):
|
|
|
88
109
|
return { propertyType: "multi_select", operator: filter.multi_select }
|
|
89
110
|
}
|
|
90
111
|
if ("status" in filter) {
|
|
91
|
-
|
|
112
|
+
const operator = filter.status
|
|
113
|
+
return "group_equals" in operator || "group_does_not_equal" in operator
|
|
114
|
+
? undefined
|
|
115
|
+
: { propertyType: "status", operator }
|
|
92
116
|
}
|
|
93
117
|
return undefined
|
|
94
118
|
}
|