1 | import * as firestore from "firebase-admin/firestore";
|
2 | import { Change } from "../../common/change";
|
3 | import { ParamsOf } from "../../common/params";
|
4 | import { CloudFunction, Event, EventContext } from "../cloud-functions";
|
5 | import { DeploymentOptions } from "../function-configuration";
|
6 | export type DocumentSnapshot = firestore.DocumentSnapshot;
|
7 | export type QueryDocumentSnapshot = firestore.QueryDocumentSnapshot;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export declare function document<Path extends string>(path: Path): DocumentBuilder<Path>;
|
16 | export declare function namespace(namespace: string): NamespaceBuilder;
|
17 | export declare function database(database: string): DatabaseBuilder;
|
18 | export declare class DatabaseBuilder {
|
19 | private database;
|
20 | private options;
|
21 | constructor(database: string, options: DeploymentOptions);
|
22 | namespace(namespace: string): NamespaceBuilder;
|
23 | document<Path extends string>(path: Path): DocumentBuilder<Path>;
|
24 | }
|
25 | export declare class NamespaceBuilder {
|
26 | private database;
|
27 | private options;
|
28 | private namespace?;
|
29 | constructor(database: string, options: DeploymentOptions, namespace?: string);
|
30 | document<Path extends string>(path: Path): DocumentBuilder<Path>;
|
31 | }
|
32 | export declare function snapshotConstructor(event: Event): DocumentSnapshot;
|
33 | export declare function beforeSnapshotConstructor(event: Event): DocumentSnapshot;
|
34 | export declare class DocumentBuilder<Path extends string> {
|
35 | private triggerResource;
|
36 | private options;
|
37 | constructor(triggerResource: () => string, options: DeploymentOptions);
|
38 | /** Respond to all document writes (creates, updates, or deletes). */
|
39 | onWrite(handler: (change: Change<DocumentSnapshot>, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any): CloudFunction<Change<DocumentSnapshot>>;
|
40 | /** Respond only to document updates. */
|
41 | onUpdate(handler: (change: Change<QueryDocumentSnapshot>, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any): CloudFunction<Change<QueryDocumentSnapshot>>;
|
42 | /** Respond only to document creations. */
|
43 | onCreate(handler: (snapshot: QueryDocumentSnapshot, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any): CloudFunction<QueryDocumentSnapshot>;
|
44 | /** Respond only to document deletions. */
|
45 | onDelete(handler: (snapshot: QueryDocumentSnapshot, context: EventContext<ParamsOf<Path>>) => PromiseLike<any> | any): CloudFunction<QueryDocumentSnapshot>;
|
46 | private onOperation;
|
47 | }
|