Add pagination to list records CLI #82
@ -24,13 +24,23 @@ export const builder = {
|
|||||||
all: {
|
all: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
refs: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
type: 'number'
|
||||||
|
},
|
||||||
|
offset: {
|
||||||
|
type: 'number'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const handler = async (argv: Arguments) => {
|
export const handler = async (argv: Arguments) => {
|
||||||
const { services: { registry: registryConfig } } = getConfig(argv.config as string);
|
const { services: { registry: registryConfig } } = getConfig(argv.config as string);
|
||||||
const { rpcEndpoint, gqlEndpoint, chainId } = getConnectionInfo(argv, registryConfig);
|
const { rpcEndpoint, gqlEndpoint, chainId } = getConnectionInfo(argv, registryConfig);
|
||||||
const { type, name, bondId, owner, all } = argv;
|
const { type, name, bondId, owner, all, refs, limit, offset } = argv;
|
||||||
const filters: any = {};
|
const filters: any = {};
|
||||||
|
|
||||||
const filterArgs = argv._.slice(3);
|
const filterArgs = argv._.slice(3);
|
||||||
@ -44,7 +54,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
|
|
||||||
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||||
|
|
||||||
let result = await registry.queryRecords({ ...filters, type, name }, all as boolean);
|
let result = await registry.queryRecords({ ...filters, type, name }, all as boolean, refs as boolean, limit as number, offset as number);
|
||||||
|
|
||||||
// Apply ex post filters.
|
// Apply ex post filters.
|
||||||
if (bondId) {
|
if (bondId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user