Schema.Struct({
view: Schema.Literal("grid", "list", "compact").pipe(
Schema.optionalWith({ default: Function.constant("grid" as const) }),
),
q: Schema.String.pipe(
Schema.optionalWith({ default: Function.constant("") }),
),
filter: Schema.Struct({
status: UniqueArray(Schema.encodedSchema(ProjectSpace.Status.Status)).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
usage: UniqueArray(Schema.Literal("high", "medium", "low")).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
alerts: UniqueArray(Schema.Literal("critical", "warning", "none")).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
location: UniqueArray(Schema.NonEmptyTrimmedString).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
tags: UniqueArray(Schema.NonEmptyTrimmedString).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
memberCount: Schema.Struct({
min: Schema.String.pipe(
Schema.filter((value) => Number.parseInt(value, 10) >= 0),
Schema.optional,
),
max: Schema.String.pipe(
Schema.filter((value) => Number.parseInt(value, 10) >= 0),
Schema.optional,
),
}).pipe(
Schema.optionalWith({
default: () => ({ min: undefined, max: undefined }),
}),
),
}).pipe(
Schema.optionalWith({
default: () => ({
status: [],
usage: [],
alerts: [],
location: [],
tags: [],
memberCount: { min: undefined, max: undefined },
}),
}),
),
});
Schema.Struct({
view: Schema.Literal("grid", "list", "compact").pipe(
Schema.optionalWith({ default: Function.constant("grid" as const) }),
),
q: Schema.String.pipe(
Schema.optionalWith({ default: Function.constant("") }),
),
filter: Schema.Struct({
status: UniqueArray(Schema.encodedSchema(ProjectSpace.Status.Status)).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
usage: UniqueArray(Schema.Literal("high", "medium", "low")).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
alerts: UniqueArray(Schema.Literal("critical", "warning", "none")).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
location: UniqueArray(Schema.NonEmptyTrimmedString).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
tags: UniqueArray(Schema.NonEmptyTrimmedString).pipe(
Schema.optionalWith({ default: Function.constant([]) }),
),
memberCount: Schema.Struct({
min: Schema.String.pipe(
Schema.filter((value) => Number.parseInt(value, 10) >= 0),
Schema.optional,
),
max: Schema.String.pipe(
Schema.filter((value) => Number.parseInt(value, 10) >= 0),
Schema.optional,
),
}).pipe(
Schema.optionalWith({
default: () => ({ min: undefined, max: undefined }),
}),
),
}).pipe(
Schema.optionalWith({
default: () => ({
status: [],
usage: [],
alerts: [],
location: [],
tags: [],
memberCount: { min: undefined, max: undefined },
}),
}),
),
});