catalog-react: remove $nor predicate
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -31,9 +31,6 @@ describe('createEntityPredicateSchema', () => {
|
||||
{
|
||||
$or: [{ kind: 'component', 'spec.type': 'service' }, { kind: 'group' }],
|
||||
},
|
||||
{
|
||||
$nor: [{ kind: 'component', 'spec.type': 'service' }, { kind: 'group' }],
|
||||
},
|
||||
{
|
||||
relations: {
|
||||
$elemMatch: { type: 'ownedBy', targetRef: 'group:default/g' },
|
||||
@@ -68,7 +65,6 @@ describe('createEntityPredicateSchema', () => {
|
||||
},
|
||||
{ $and: [{ x: { $exists: true } }] },
|
||||
{ $or: [{ x: { $exists: true } }] },
|
||||
{ $nor: [{ x: { $exists: true } }] },
|
||||
{ $not: { x: { $exists: true } } },
|
||||
{ $not: { $and: [{ x: { $exists: true } }] } },
|
||||
])('should accept valid predicate %j', predicate => {
|
||||
@@ -89,7 +85,6 @@ describe('createEntityPredicateSchema', () => {
|
||||
1,
|
||||
{ $and: [{ x: { $unknown: true } }] },
|
||||
{ $or: [{ x: { $unknown: true } }] },
|
||||
{ $nor: [{ x: { $unknown: true } }] },
|
||||
{ $not: { x: { $unknown: true } } },
|
||||
{ $not: { $and: [{ x: { $unknown: true } }] } },
|
||||
{ $unknown: 'foo' },
|
||||
|
||||
@@ -37,7 +37,6 @@ export function createEntityPredicateSchema(z: typeof zImpl) {
|
||||
z.union([
|
||||
z.object({ $and: z.array(filterSchema) }),
|
||||
z.object({ $or: z.array(filterSchema) }),
|
||||
z.object({ $nor: z.array(filterSchema) }),
|
||||
z.object({ $not: filterSchema }),
|
||||
z.record(z.string().regex(/^(?!\$).*$/), filterValueSchema),
|
||||
]),
|
||||
|
||||
@@ -148,10 +148,12 @@ describe('evaluateEntityPredicate', () => {
|
||||
[
|
||||
'w,a',
|
||||
{
|
||||
$nor: [
|
||||
{ kind: 'component', 'spec.type': 'service' },
|
||||
{ kind: 'group' },
|
||||
],
|
||||
$not: {
|
||||
$or: [
|
||||
{ kind: 'component', 'spec.type': 'service' },
|
||||
{ kind: 'group' },
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
|
||||
@@ -46,9 +46,6 @@ export function evaluateEntityPredicate(
|
||||
if ('$or' in filter) {
|
||||
return filter.$or.some(f => evaluateEntityPredicate(f, value));
|
||||
}
|
||||
if ('$nor' in filter) {
|
||||
return !filter.$nor.some(f => evaluateEntityPredicate(f, value));
|
||||
}
|
||||
if ('$not' in filter) {
|
||||
return !evaluateEntityPredicate(filter.$not, value);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ export type EntityPredicate =
|
||||
| EntityPredicateExpression
|
||||
| { $and: EntityPredicate[] }
|
||||
| { $or: EntityPredicate[] }
|
||||
| { $nor: EntityPredicate[] }
|
||||
| { $not: EntityPredicate };
|
||||
|
||||
/** @alpha */
|
||||
|
||||
Reference in New Issue
Block a user