add explicit clear rejection of

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-02-20 12:14:08 +01:00
parent b8355e7208
commit 430b897840
2 changed files with 11 additions and 0 deletions
@@ -231,6 +231,12 @@ describe.each(databases.eachSupportedId())(
).resolves.toEqual(['service-a', 'website-c']);
});
it('throws on $contains operator', async () => {
await expect(
query({ 'metadata.name': { $contains: 'service' } as any }),
).rejects.toThrow(/\$contains operator is not supported/);
});
it('throws on top-level primitive', async () => {
await expect(query('bad-value' as any)).rejects.toThrow(
/top-level primitive values are not supported/,
@@ -209,6 +209,11 @@ function applyFieldCondition(options: {
.andWhereRaw('?? like ? escape ?', ['value', `${escaped}%`, '\\']);
return targetQuery.andWhere(onEntityIdField, 'in', matchQuery);
}
if ('$contains' in value) {
// TODO(freben): Implement this, AT LEAST for some special cases such as tags and relations.
throw new InputError('The $contains operator is not supported');
}
}
throw new InputError(