Filter by arbitrary attributes #40

Merged
telackey merged 3 commits from telackey/filterany into main 2023-11-28 23:22:58 +00:00
Showing only changes of commit db57b09717 - Show all commits

View File

@ -44,18 +44,9 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
let result: any[];
try {
result = await registry.queryRecords({...filters, type, name}, all as boolean);
} catch (e) {
// https://git.vdb.to/cerc-io/laconicd/issues/118
if (Array.isArray(e) && (e as []).length && e[0].message?.includes("store doesn't have key")) {
result = [];
} else {
throw e;
}
}
let result = await registry.queryRecords({...filters, type, name}, all as boolean);
// Apply ex post filters.
if (bondId) {
result = result.filter(v => v.bondId === bondId);
}