UNPKG

3.02 kBTypeScriptView Raw
1import { CloudEvent, CloudFunction } from "../core";
2import { EventHandlerOptions } from "../options";
3/** All the fields associated with the person/service account that wrote a Remote Config template. */
4export interface ConfigUser {
5 /** Display name. */
6 name: string;
7 /** Email address. */
8 email: string;
9 /** Image URL. */
10 imageUrl: string;
11}
12/** What type of update was associated with the Remote Config template version. */
13export type ConfigUpdateOrigin =
14/** Catch-all for unrecognized values. */
15"REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED"
16/** The update came from the Firebase UI. */
17 | "CONSOLE"
18/** The update came from the Remote Config REST API. */
19 | "REST_API"
20/** The update came from the Firebase Admin Node SDK. */
21 | "ADMIN_SDK_NODE";
22/** Where the Remote Config update action originated. */
23export type ConfigUpdateType =
24/** Catch-all for unrecognized enum values */
25"REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED"
26/** A regular incremental update */
27 | "INCREMENTAL_UPDATE"
28/** A forced update. The ETag was specified as "*" in an UpdateRemoteConfigRequest request or the "Force Update" button was pressed on the console */
29 | "FORCED_UPDATE"
30/** A rollback to a previous Remote Config template */
31 | "ROLLBACK";
32/** The data within Firebase Remote Config update events. */
33export interface ConfigUpdateData {
34 /** The version number of the version's corresponding Remote Config template. */
35 versionNumber: number;
36 /** When the Remote Config template was written to the Remote Config server. */
37 updateTime: string;
38 /** Aggregation of all metadata fields about the account that performed the update. */
39 updateUser: ConfigUser;
40 /** The user-provided description of the corresponding Remote Config template. */
41 description: string;
42 /** Where the update action originated. */
43 updateOrigin: ConfigUpdateOrigin;
44 /** What type of update was made. */
45 updateType: ConfigUpdateType;
46 /** Only present if this version is the result of a rollback, and will be the version number of the Remote Config template that was rolled-back to. */
47 rollbackSource: number;
48}
49/**
50 * Event handler which triggers when data is updated in a Remote Config.
51 *
52 * @param handler - Event handler which is run every time a Remote Config update occurs.
53 * @returns A function that you can export and deploy.
54 */
55export declare function onConfigUpdated(handler: (event: CloudEvent<ConfigUpdateData>) => any | Promise<any>): CloudFunction<CloudEvent<ConfigUpdateData>>;
56/**
57 * Event handler which triggers when data is updated in a Remote Config.
58 *
59 * @param opts - Options that can be set on an individual event-handling function.
60 * @param handler - Event handler which is run every time a Remote Config update occurs.
61 * @returns A function that you can export and deploy.
62 */
63export declare function onConfigUpdated(opts: EventHandlerOptions, handler: (event: CloudEvent<ConfigUpdateData>) => any | Promise<any>): CloudFunction<CloudEvent<ConfigUpdateData>>;