@types/pouchdb-live-find
TypeScript icon, indicating that this package has built-in type declarations

0.4.4 • Public • Published

Installation

npm install --save @types/pouchdb-live-find

Summary

This package contains type definitions for pouchdb-live-find (https://github.com/colinskow/pouchdb-live-find).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pouchdb-live-find.

index.d.ts

/// <reference types="pouchdb-core" />
declare namespace PouchDB {
    namespace LiveFind {
        interface RequestDef<Content extends {}>
            extends Pick<Find.FindRequest<Content>, Exclude<keyof Find.FindRequest<Content>, "use_index">>
        {
            aggregate?: boolean | undefined; // if true outputs an aggregate list on every update event
        }

        interface PaginateOptions<Content extends {}>
            extends Pick<Find.FindRequest<Content>, "sort" | "skip" | "limit">
        {}

        interface UpdateEvent {
            action: "REMOVE" | "ADD" | "UPDATE";
            id: any;
            rev: any;
            doc: any;
        }
        interface LiveFeed<Content extends {} = {}> {
            on(event: "ready" | "cancelled", listener: () => void): this;
            on(event: "error", listener: (err: any) => void): this;
            on(event: "update", listener: (event: UpdateEvent, list: any) => void): this;
        }

        interface LiveFeed<Content extends {} = {}> extends EventEmitter {
            // stops the query and removes all listeners
            cancel(): void;
            // a convenience function to sort any list in place by the sort order you provided. (This will mutate the Array.)
            sort(list: []): [];
            // updates the pagination and sorting of the aggregate list and immediately returns the updated list. Available options are sort, skip, and limit.
            paginate(options: PaginateOptions<Content>): [];
            then(callbackSuccess: () => any): void;
            catch(callbackFailure: () => any): void;
        }
    }
    interface Database<Content extends {} = {}> {
        liveFind(requestDef: LiveFind.RequestDef<Content>): LiveFind.LiveFeed<Content>;
    }
}

declare module "pouchdb-live-find" {
    const plugin: PouchDB.Plugin;
    export = plugin;
}

Additional Details

Credits

These definitions were written by assemblethis.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/pouchdb-live-find

Weekly Downloads

3

Version

0.4.4

License

MIT

Unpacked Size

6.46 kB

Total Files

5

Last publish

Collaborators

  • types