How to use the @webiny/commodo.Collection function in @webiny/commodo

To help you get started, we’ve selected a few @webiny/commodo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / packages / api-page-builder / src / plugins / graphql / pageResolvers / listPublishedPages.js View on Github external
export const listPublishedPages = async ({ args, context }: Object) => {
    const plugin = context.plugins.byName("pb-resolver-list-published-pages");

    if (!plugin) {
        throw Error(`Resolver plugin "pb-resolver-list-published-pages" is not configured!`);
    }

    const { pages, totalCount } = await plugin.resolve({ args, context });
    const meta = createPaginationMeta({
        totalCount,
        page: args.page,
        perPage: args.perPage
    });

    return new Collection(pages).setMeta(meta);
};