firebase-functions 3.24.1 → 4.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +7 -9
  2. package/lib/bin/firebase-functions.js +13 -15
  3. package/lib/common/app.d.ts +14 -0
  4. package/lib/common/app.js +62 -0
  5. package/lib/common/change.d.ts +0 -5
  6. package/lib/common/change.js +5 -7
  7. package/lib/common/config.d.ts +6 -0
  8. package/lib/common/config.js +49 -0
  9. package/lib/common/debug.js +2 -2
  10. package/lib/common/encoding.d.ts +0 -8
  11. package/lib/common/encoding.js +6 -29
  12. package/lib/common/options.d.ts +14 -0
  13. package/lib/common/options.js +44 -0
  14. package/lib/common/params.d.ts +32 -0
  15. package/lib/common/params.js +23 -0
  16. package/lib/common/providers/database.d.ts +17 -19
  17. package/lib/common/providers/database.js +68 -39
  18. package/lib/common/providers/https.d.ts +11 -52
  19. package/lib/common/providers/https.js +115 -110
  20. package/lib/common/providers/identity.d.ts +8 -8
  21. package/lib/common/providers/identity.js +71 -79
  22. package/lib/common/providers/tasks.d.ts +11 -10
  23. package/lib/common/providers/tasks.js +10 -9
  24. package/lib/common/timezone.js +538 -538
  25. package/lib/common/trace.d.ts +14 -0
  26. package/lib/common/trace.js +69 -0
  27. package/lib/{encoder.d.ts → common/utilities/encoder.d.ts} +0 -0
  28. package/lib/{encoder.js → common/utilities/encoder.js} +1 -1
  29. package/lib/{utilities → common/utilities}/path-pattern.d.ts +0 -0
  30. package/lib/{utilities → common/utilities}/path-pattern.js +17 -16
  31. package/lib/{utilities → common/utilities}/path.d.ts +0 -0
  32. package/lib/{utilities → common/utilities}/path.js +5 -7
  33. package/lib/{utils.d.ts → common/utilities/utils.d.ts} +1 -1
  34. package/lib/{utils.js → common/utilities/utils.js} +18 -12
  35. package/lib/logger/common.d.ts +1 -3
  36. package/lib/logger/common.js +9 -14
  37. package/lib/logger/compat.js +9 -9
  38. package/lib/logger/index.d.ts +1 -1
  39. package/lib/logger/index.js +24 -30
  40. package/lib/{v2/params → params}/index.d.ts +22 -9
  41. package/lib/{v2/params → params}/index.js +22 -14
  42. package/lib/params/types.d.ts +180 -0
  43. package/lib/params/types.js +289 -0
  44. package/lib/runtime/loader.js +12 -14
  45. package/lib/runtime/manifest.d.ts +56 -24
  46. package/lib/runtime/manifest.js +114 -4
  47. package/lib/v1/cloud-functions.d.ts +232 -0
  48. package/lib/v1/cloud-functions.js +205 -0
  49. package/lib/v1/config.d.ts +8 -0
  50. package/lib/v1/config.js +75 -0
  51. package/lib/{function-builder.d.ts → v1/function-builder.d.ts} +16 -16
  52. package/lib/{function-builder.js → v1/function-builder.js} +56 -46
  53. package/lib/v1/function-configuration.d.ts +197 -0
  54. package/lib/v1/function-configuration.js +70 -0
  55. package/lib/v1/index.d.ts +20 -0
  56. package/lib/{index.js → v1/index.js} +5 -10
  57. package/lib/{providers → v1/providers}/analytics.d.ts +5 -11
  58. package/lib/{providers → v1/providers}/analytics.js +49 -43
  59. package/lib/{providers → v1/providers}/auth.d.ts +28 -18
  60. package/lib/{providers → v1/providers}/auth.js +45 -34
  61. package/lib/{providers → v1/providers}/database.d.ts +25 -42
  62. package/lib/{providers → v1/providers}/database.js +46 -46
  63. package/lib/{providers → v1/providers}/firestore.d.ts +15 -33
  64. package/lib/{providers → v1/providers}/firestore.js +40 -44
  65. package/lib/{providers → v1/providers}/https.d.ts +3 -8
  66. package/lib/{providers → v1/providers}/https.js +14 -22
  67. package/lib/{providers → v1/providers}/pubsub.d.ts +8 -16
  68. package/lib/{providers → v1/providers}/pubsub.js +22 -26
  69. package/lib/{providers → v1/providers}/remoteConfig.d.ts +2 -11
  70. package/lib/{providers → v1/providers}/remoteConfig.js +9 -9
  71. package/lib/{providers → v1/providers}/storage.d.ts +11 -26
  72. package/lib/{providers → v1/providers}/storage.js +24 -29
  73. package/lib/{providers → v1/providers}/tasks.d.ts +6 -8
  74. package/lib/{providers → v1/providers}/tasks.js +12 -17
  75. package/lib/{providers → v1/providers}/testLab.d.ts +86 -46
  76. package/lib/{providers → v1/providers}/testLab.js +14 -14
  77. package/lib/v2/core.d.ts +4 -5
  78. package/lib/v2/index.d.ts +16 -14
  79. package/lib/v2/index.js +5 -1
  80. package/lib/v2/options.d.ts +52 -32
  81. package/lib/v2/options.js +32 -47
  82. package/lib/v2/providers/alerts/alerts.d.ts +20 -18
  83. package/lib/v2/providers/alerts/alerts.js +9 -6
  84. package/lib/v2/providers/alerts/appDistribution.d.ts +28 -26
  85. package/lib/v2/providers/alerts/appDistribution.js +8 -7
  86. package/lib/v2/providers/alerts/billing.d.ts +5 -5
  87. package/lib/v2/providers/alerts/billing.js +5 -4
  88. package/lib/v2/providers/alerts/crashlytics.d.ts +32 -30
  89. package/lib/v2/providers/alerts/crashlytics.js +10 -9
  90. package/lib/v2/providers/alerts/index.d.ts +5 -5
  91. package/lib/v2/providers/alerts/performance.d.ts +3 -3
  92. package/lib/v2/providers/alerts/performance.js +5 -7
  93. package/lib/v2/providers/database.d.ts +41 -38
  94. package/lib/v2/providers/database.js +22 -17
  95. package/lib/v2/providers/eventarc.d.ts +25 -23
  96. package/lib/v2/providers/eventarc.js +10 -7
  97. package/lib/v2/providers/https.d.ts +43 -33
  98. package/lib/v2/providers/https.js +18 -56
  99. package/lib/v2/providers/identity.d.ts +25 -23
  100. package/lib/v2/providers/identity.js +10 -7
  101. package/lib/v2/providers/pubsub.d.ts +25 -23
  102. package/lib/v2/providers/pubsub.js +11 -27
  103. package/lib/v2/providers/remoteConfig.d.ts +63 -0
  104. package/lib/v2/providers/remoteConfig.js +65 -0
  105. package/lib/v2/providers/scheduler.d.ts +14 -12
  106. package/lib/v2/providers/scheduler.js +16 -14
  107. package/lib/v2/providers/storage.d.ts +32 -30
  108. package/lib/v2/providers/storage.js +16 -32
  109. package/lib/v2/providers/tasks.d.ts +30 -26
  110. package/lib/v2/providers/tasks.js +14 -31
  111. package/lib/v2/providers/testLab.d.ts +110 -0
  112. package/lib/v2/providers/testLab.js +65 -0
  113. package/lib/v2/trace.d.ts +4 -0
  114. package/lib/v2/trace.js +21 -0
  115. package/package.json +61 -66
  116. package/lib/apps.d.ts +0 -35
  117. package/lib/apps.js +0 -112
  118. package/lib/cloud-functions.d.ts +0 -231
  119. package/lib/cloud-functions.js +0 -251
  120. package/lib/config.d.ts +0 -24
  121. package/lib/config.js +0 -117
  122. package/lib/function-configuration.d.ts +0 -108
  123. package/lib/function-configuration.js +0 -71
  124. package/lib/handler-builder.d.ts +0 -256
  125. package/lib/handler-builder.js +0 -349
  126. package/lib/index.d.ts +0 -19
  127. package/lib/setup.d.ts +0 -1
  128. package/lib/setup.js +0 -60
  129. package/lib/v2/params/types.d.ts +0 -118
  130. package/lib/v2/params/types.js +0 -196
package/lib/config.js DELETED
@@ -1,117 +0,0 @@
1
- "use strict";
2
- // The MIT License (MIT)
3
- //
4
- // Copyright (c) 2017 Firebase
5
- //
6
- // Permission is hereby granted, free of charge, to any person obtaining a copy
7
- // of this software and associated documentation files (the "Software"), to deal
8
- // in the Software without restriction, including without limitation the rights
9
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- // copies of the Software, and to permit persons to whom the Software is
11
- // furnished to do so, subject to the following conditions:
12
- //
13
- // The above copyright notice and this permission notice shall be included in all
14
- // copies or substantial portions of the Software.
15
- //
16
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- // SOFTWARE.
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.firebaseConfig = exports.firebaseConfigCache = exports.config = void 0;
25
- const fs = require("fs");
26
- const path = require("path");
27
- function config() {
28
- // K_CONFIGURATION is only set in GCFv2
29
- if (process.env.K_CONFIGURATION) {
30
- throw new Error('functions.config() is no longer available in Cloud Functions for ' +
31
- 'Firebase v2. Please see the latest documentation for information ' +
32
- 'on how to transition to using environment variables');
33
- }
34
- if (typeof config.singleton === 'undefined') {
35
- init();
36
- }
37
- return config.singleton;
38
- }
39
- exports.config = config;
40
- /**
41
- * Store and retrieve project configuration data such as third-party API
42
- * keys or other settings. You can set configuration values using the
43
- * Firebase CLI as described in
44
- * [Environment Configuration](/docs/functions/config-env).
45
- */
46
- (function (config) {
47
- })(config = exports.config || (exports.config = {}));
48
- /** @hidden */
49
- exports.firebaseConfigCache = null;
50
- /** @hidden */
51
- function firebaseConfig() {
52
- if (exports.firebaseConfigCache) {
53
- return exports.firebaseConfigCache;
54
- }
55
- let env = process.env.FIREBASE_CONFIG;
56
- if (env) {
57
- // Firebase Tools will always use a JSON blob in prod, but docs
58
- // explicitly state that the user can set the env to a file:
59
- // https://firebase.google.com/docs/admin/setup#initialize-without-parameters
60
- if (!env.startsWith('{')) {
61
- env = fs.readFileSync(path.join(process.env.PWD, env)).toString('utf8');
62
- }
63
- exports.firebaseConfigCache = JSON.parse(env);
64
- return exports.firebaseConfigCache;
65
- }
66
- // Could have Runtime Config with Firebase in it as an ENV value.
67
- try {
68
- const config = JSON.parse(process.env.CLOUD_RUNTIME_CONFIG);
69
- if (config.firebase) {
70
- exports.firebaseConfigCache = config.firebase;
71
- return exports.firebaseConfigCache;
72
- }
73
- }
74
- catch (e) {
75
- // Do nothing
76
- }
77
- // Could have Runtime Config with Firebase in it as an ENV location or default.
78
- try {
79
- const configPath = process.env.CLOUD_RUNTIME_CONFIG ||
80
- path.join(process.cwd(), '.runtimeconfig.json');
81
- const contents = fs.readFileSync(configPath);
82
- const config = JSON.parse(contents.toString('utf8'));
83
- if (config.firebase) {
84
- exports.firebaseConfigCache = config.firebase;
85
- return exports.firebaseConfigCache;
86
- }
87
- }
88
- catch (e) {
89
- // Do nothing
90
- }
91
- return null;
92
- }
93
- exports.firebaseConfig = firebaseConfig;
94
- function init() {
95
- try {
96
- const parsed = JSON.parse(process.env.CLOUD_RUNTIME_CONFIG);
97
- delete parsed.firebase;
98
- config.singleton = parsed;
99
- return;
100
- }
101
- catch (e) {
102
- // Do nothing
103
- }
104
- try {
105
- const configPath = process.env.CLOUD_RUNTIME_CONFIG ||
106
- path.join(process.cwd(), '.runtimeconfig.json');
107
- const contents = fs.readFileSync(configPath);
108
- const parsed = JSON.parse(contents.toString('utf8'));
109
- delete parsed.firebase;
110
- config.singleton = parsed;
111
- return;
112
- }
113
- catch (e) {
114
- // Do nothing
115
- }
116
- config.singleton = {};
117
- }
@@ -1,108 +0,0 @@
1
- import { Expression } from './v2/params';
2
- /**
3
- * List of all regions supported by Cloud Functions.
4
- */
5
- export declare const SUPPORTED_REGIONS: readonly ["us-central1", "us-east1", "us-east4", "us-west2", "us-west3", "us-west4", "europe-central2", "europe-west1", "europe-west2", "europe-west3", "europe-west6", "asia-east1", "asia-east2", "asia-northeast1", "asia-northeast2", "asia-northeast3", "asia-south1", "asia-southeast1", "asia-southeast2", "northamerica-northeast1", "southamerica-east1", "australia-southeast1"];
6
- /**
7
- * Cloud Functions min timeout value.
8
- */
9
- export declare const MIN_TIMEOUT_SECONDS = 0;
10
- /**
11
- * Cloud Functions max timeout value.
12
- */
13
- export declare const MAX_TIMEOUT_SECONDS = 540;
14
- /**
15
- * List of available memory options supported by Cloud Functions.
16
- */
17
- export declare const VALID_MEMORY_OPTIONS: readonly ["128MB", "256MB", "512MB", "1GB", "2GB", "4GB", "8GB"];
18
- /**
19
- * List of available options for VpcConnectorEgressSettings.
20
- */
21
- export declare const VPC_EGRESS_SETTINGS_OPTIONS: readonly ["VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED", "PRIVATE_RANGES_ONLY", "ALL_TRAFFIC"];
22
- /**
23
- * List of available options for IngressSettings.
24
- */
25
- export declare const INGRESS_SETTINGS_OPTIONS: readonly ["INGRESS_SETTINGS_UNSPECIFIED", "ALLOW_ALL", "ALLOW_INTERNAL_ONLY", "ALLOW_INTERNAL_AND_GCLB"];
26
- /**
27
- * Scheduler retry options. Applies only to scheduled functions.
28
- */
29
- export interface ScheduleRetryConfig {
30
- retryCount?: number | Expression<number> | null;
31
- maxRetryDuration?: string | Expression<string> | null;
32
- minBackoffDuration?: string | Expression<string> | null;
33
- maxBackoffDuration?: string | Expression<string> | null;
34
- maxDoublings?: number | Expression<number> | null;
35
- }
36
- /**
37
- * Configuration options for scheduled functions.
38
- */
39
- export interface Schedule {
40
- schedule: string;
41
- timeZone?: string;
42
- retryConfig?: ScheduleRetryConfig;
43
- }
44
- export interface FailurePolicy {
45
- retry: {};
46
- }
47
- export declare const DEFAULT_FAILURE_POLICY: FailurePolicy;
48
- export declare const MAX_NUMBER_USER_LABELS = 58;
49
- export interface RuntimeOptions {
50
- /**
51
- * Which platform should host the backend. Valid options are "gcfv1"
52
- * @hidden
53
- */
54
- platform?: 'gcfv1';
55
- /**
56
- * Failure policy of the function, with boolean `true` being equivalent to
57
- * providing an empty retry object.
58
- */
59
- failurePolicy?: FailurePolicy | boolean;
60
- /**
61
- * Amount of memory to allocate to the function.
62
- */
63
- memory?: typeof VALID_MEMORY_OPTIONS[number];
64
- /**
65
- * Timeout for the function in seconds, possible values are 0 to 540.
66
- */
67
- timeoutSeconds?: number;
68
- /**
69
- * Min number of actual instances to be running at a given time.
70
- * Instances will be billed for memory allocation and 10% of CPU allocation
71
- * while idle.
72
- */
73
- minInstances?: number;
74
- /**
75
- * Max number of actual instances allowed to be running in parallel.
76
- */
77
- maxInstances?: number;
78
- /**
79
- * Connect cloud function to specified VPC connector.
80
- */
81
- vpcConnector?: string;
82
- /**
83
- * Egress settings for VPC connector.
84
- */
85
- vpcConnectorEgressSettings?: typeof VPC_EGRESS_SETTINGS_OPTIONS[number];
86
- /**
87
- * Specific service account for the function to run as.
88
- */
89
- serviceAccount?: 'default' | string;
90
- /**
91
- * Ingress settings which control where this function can be called from.
92
- */
93
- ingressSettings?: typeof INGRESS_SETTINGS_OPTIONS[number];
94
- /**
95
- * User labels to set on the function.
96
- */
97
- labels?: Record<string, string>;
98
- /**
99
- * Invoker to set access control on https functions.
100
- */
101
- invoker?: 'public' | 'private' | string | string[];
102
- allowInvalidAppCheckToken?: boolean;
103
- secrets?: string[];
104
- }
105
- export interface DeploymentOptions extends RuntimeOptions {
106
- regions?: Array<typeof SUPPORTED_REGIONS[number] | string>;
107
- schedule?: Schedule;
108
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_NUMBER_USER_LABELS = exports.DEFAULT_FAILURE_POLICY = exports.INGRESS_SETTINGS_OPTIONS = exports.VPC_EGRESS_SETTINGS_OPTIONS = exports.VALID_MEMORY_OPTIONS = exports.MAX_TIMEOUT_SECONDS = exports.MIN_TIMEOUT_SECONDS = exports.SUPPORTED_REGIONS = void 0;
4
- /**
5
- * List of all regions supported by Cloud Functions.
6
- */
7
- exports.SUPPORTED_REGIONS = [
8
- 'us-central1',
9
- 'us-east1',
10
- 'us-east4',
11
- 'us-west2',
12
- 'us-west3',
13
- 'us-west4',
14
- 'europe-central2',
15
- 'europe-west1',
16
- 'europe-west2',
17
- 'europe-west3',
18
- 'europe-west6',
19
- 'asia-east1',
20
- 'asia-east2',
21
- 'asia-northeast1',
22
- 'asia-northeast2',
23
- 'asia-northeast3',
24
- 'asia-south1',
25
- 'asia-southeast1',
26
- 'asia-southeast2',
27
- 'northamerica-northeast1',
28
- 'southamerica-east1',
29
- 'australia-southeast1',
30
- ];
31
- /**
32
- * Cloud Functions min timeout value.
33
- */
34
- exports.MIN_TIMEOUT_SECONDS = 0;
35
- /**
36
- * Cloud Functions max timeout value.
37
- */
38
- exports.MAX_TIMEOUT_SECONDS = 540;
39
- /**
40
- * List of available memory options supported by Cloud Functions.
41
- */
42
- exports.VALID_MEMORY_OPTIONS = [
43
- '128MB',
44
- '256MB',
45
- '512MB',
46
- '1GB',
47
- '2GB',
48
- '4GB',
49
- '8GB',
50
- ];
51
- /**
52
- * List of available options for VpcConnectorEgressSettings.
53
- */
54
- exports.VPC_EGRESS_SETTINGS_OPTIONS = [
55
- 'VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED',
56
- 'PRIVATE_RANGES_ONLY',
57
- 'ALL_TRAFFIC',
58
- ];
59
- /**
60
- * List of available options for IngressSettings.
61
- */
62
- exports.INGRESS_SETTINGS_OPTIONS = [
63
- 'INGRESS_SETTINGS_UNSPECIFIED',
64
- 'ALLOW_ALL',
65
- 'ALLOW_INTERNAL_ONLY',
66
- 'ALLOW_INTERNAL_AND_GCLB',
67
- ];
68
- exports.DEFAULT_FAILURE_POLICY = {
69
- retry: {},
70
- };
71
- exports.MAX_NUMBER_USER_LABELS = 58;
@@ -1,256 +0,0 @@
1
- import * as express from 'express';
2
- import { CloudFunction, EventContext, HttpsFunction } from './cloud-functions';
3
- import * as analytics from './providers/analytics';
4
- import * as auth from './providers/auth';
5
- import * as database from './providers/database';
6
- import * as firestore from './providers/firestore';
7
- import * as https from './providers/https';
8
- import * as pubsub from './providers/pubsub';
9
- import * as remoteConfig from './providers/remoteConfig';
10
- import * as storage from './providers/storage';
11
- import * as tasks from './providers/tasks';
12
- import * as testLab from './providers/testLab';
13
- /**
14
- * The `HandlerBuilder` class facilitates the writing of functions by developers
15
- * building Firebase Extensions as well as developers who want to use the gcloud CLI or
16
- * Google Cloud Console to deploy their functions.
17
- *
18
- * **Do not use `HandlerBuilder` when writing normal functions for deployment via
19
- * the Firebase CLI.** For normal purposes, use
20
- * [`FunctionBuilder`](/docs/reference/functions/function_builder_.functionbuilder).
21
- */
22
- export declare class HandlerBuilder {
23
- constructor();
24
- /**
25
- * Create a handler for HTTPS events.
26
-
27
- * `onRequest` handles an HTTPS request and has the same signature as an Express app.
28
- *
29
- * @example
30
- * ```javascript
31
- * exports.myFunction = functions.handler.https.onRequest((req, res) => { ... })
32
- * ```
33
- *
34
- * `onCall` declares a callable function for clients to call using a Firebase SDK.
35
- *
36
- * @example
37
- * ```javascript
38
- * exports.myFunction = functions.handler.https.onCall((data, context) => { ... })
39
- * ```
40
- */
41
- get https(): {
42
- onRequest: (handler: (req: express.Request, resp: express.Response) => void) => HttpsFunction;
43
- onCall: (handler: (data: any, context: https.CallableContext) => any | Promise<any>) => HttpsFunction;
44
- };
45
- /**
46
- * Create a handler for tasks functions.
47
- *
48
- * @example
49
- * ```javascript
50
- * exports.myFunction = functions.handler.tasks.onDispatch((data, context) => { ... })
51
- * ```
52
- */
53
- /** @hidden */
54
- get tasks(): {
55
- readonly taskQueue: {
56
- onDispatch: (handler: (data: any, context: tasks.TaskContext) => void | Promise<void>) => HttpsFunction;
57
- };
58
- };
59
- /**
60
- * Create a handler for Firebase Realtime Database events.
61
- *
62
- * `ref.onCreate` handles the creation of new data.
63
- *
64
- * @example
65
- * ```javascript
66
- * exports.myFunction = functions.handler.database.ref.onCreate((snap, context) => { ... })
67
- * ```
68
- *
69
- * `ref.onUpdate` handles updates to existing data.
70
- *
71
- * @example
72
- * ```javascript
73
- * exports.myFunction = functions.handler.database.ref.onUpdate((change, context) => { ... })
74
- * ```
75
-
76
- * `ref.onDelete` handles the deletion of existing data.
77
- *
78
- * @example
79
- * ```javascript
80
- * exports.myFunction = functions.handler.database.ref.onDelete((snap, context) => { ... })
81
- * ```
82
-
83
- * `ref.onWrite` handles the creation, update, or deletion of data.
84
- *
85
- * @example
86
- * ```javascript
87
- * exports.myFunction = functions.handler.database.ref.onWrite((change, context) => { ... })
88
- * ```
89
- */
90
- get database(): {
91
- /** @hidden */
92
- readonly instance: {
93
- readonly ref: database.RefBuilder;
94
- };
95
- readonly ref: database.RefBuilder;
96
- };
97
- /**
98
- * Create a handler for Cloud Firestore events.
99
- *
100
- * `document.onCreate` handles the creation of new documents.
101
- *
102
- * @example
103
- * ```javascript
104
- * exports.myFunction = functions.handler.firestore.document.onCreate((snap, context) => { ... })
105
- * ```
106
-
107
- * `document.onUpdate` handles updates to existing documents.
108
- *
109
- * @example
110
- * ```javascript
111
- * exports.myFunction = functions.handler.firestore.document.onUpdate((change, context) => { ... })
112
- * ```
113
-
114
- * `document.onDelete` handles the deletion of existing documents.
115
- *
116
- * @example
117
- * ```javascript
118
- * exports.myFunction = functions.handler.firestore.document.onDelete((snap, context) =>
119
- * { ... })
120
- * ```
121
-
122
- * `document.onWrite` handles the creation, update, or deletion of documents.
123
- *
124
- * @example
125
- * ```javascript
126
- * exports.myFunction = functions.handler.firestore.document.onWrite((change, context) =>
127
- * { ... })
128
- * ```
129
- */
130
- get firestore(): {
131
- readonly document: firestore.DocumentBuilder;
132
- /** @hidden */
133
- readonly namespace: firestore.DocumentBuilder;
134
- /** @hidden */
135
- readonly database: firestore.DocumentBuilder;
136
- };
137
- /**
138
- * Create a handler for Firebase Remote Config events.
139
-
140
- * `remoteConfig.onUpdate` handles events that update a Remote Config template.
141
-
142
- * @example
143
- * ```javascript
144
- * exports.myFunction = functions.handler.remoteConfig.onUpdate() => { ... })
145
- * ```
146
- */
147
- get remoteConfig(): {
148
- onUpdate: (handler: (version: remoteConfig.TemplateVersion, context: EventContext) => PromiseLike<any> | any) => CloudFunction<remoteConfig.TemplateVersion>;
149
- };
150
- /**
151
- * Create a handler for Google Analytics events.
152
-
153
- * `event.onLog` handles the logging of Analytics conversion events.
154
-
155
- * @example
156
- * ```javascript
157
- * exports.myFunction = functions.handler.analytics.event.onLog((event) => { ... })
158
- * ```
159
- */
160
- get analytics(): {
161
- readonly event: analytics.AnalyticsEventBuilder;
162
- };
163
- /**
164
- * Create a handler for Cloud Storage for Firebase events.
165
- *
166
- * `object.onArchive` handles the archiving of Storage objects.
167
- *
168
- * @example
169
- * ```javascript
170
- * exports.myFunction = functions.handler.storage.object.onArchive((object) => { ... })
171
- * ```
172
-
173
- * `object.onDelete` handles the deletion of Storage objects.
174
- *
175
- * @example
176
- * ```javascript
177
- * exports.myFunction = functions.handler.storage.object.onDelete((object) => { ... })
178
- * ```
179
-
180
- * `object.onFinalize` handles the creation of Storage objects.
181
- *
182
- * @example
183
- * ```javascript
184
- * exports.myFunction = functions.handler.storage.object.onFinalize((object) =>
185
- * { ... })
186
- * ```
187
-
188
- * `object.onMetadataUpdate` handles changes to the metadata of existing Storage objects.
189
- *
190
- * @example
191
- * ```javascript
192
- * exports.myFunction = functions.handler.storage.object.onMetadataUpdate((object) =>
193
- * { ... })
194
- * ```
195
- */
196
- get storage(): {
197
- readonly bucket: storage.ObjectBuilder;
198
- readonly object: storage.ObjectBuilder;
199
- };
200
- /**
201
- * Create a handler for Cloud Pub/Sub events.
202
- *
203
- * `topic.onPublish` handles messages published to a Pub/Sub topic from SDKs, Cloud Console, or gcloud CLI.
204
- *
205
- * @example
206
- * ```javascript
207
- * exports.myFunction = functions.handler.pubsub.topic.onPublish((message) => { ... })
208
- * ```
209
-
210
- * `schedule.onPublish` handles messages published to a Pub/Sub topic on a schedule.
211
- *
212
- * @example
213
- * ```javascript
214
- * exports.myFunction = functions.handler.pubsub.schedule.onPublish((message) => { ... })
215
- * ```
216
- */
217
- get pubsub(): {
218
- readonly topic: pubsub.TopicBuilder;
219
- readonly schedule: pubsub.ScheduleBuilder;
220
- };
221
- /**
222
- * Create a handler for Firebase Authentication events.
223
- *
224
- * `user.onCreate` handles the creation of users.
225
- *
226
- * @example
227
- * ```javascript
228
- * exports.myFunction = functions.handler.auth.user.onCreate((user) => { ... })
229
- * ```
230
-
231
- * `user.onDelete` handles the deletion of users.
232
- *
233
- * @example
234
- * ```javascript
235
- * exports.myFunction = functions.handler.auth.user.onDelete((user => { ... })
236
- * ```
237
-
238
- */
239
- get auth(): {
240
- readonly user: auth.UserBuilder;
241
- };
242
- /**
243
- * Create a handler for Firebase Test Lab events.
244
-
245
- * `testMatrix.onComplete` handles the completion of a test matrix.
246
-
247
- * @example
248
- * ```javascript
249
- * exports.myFunction = functions.handler.testLab.testMatrix.onComplete((testMatrix) => { ... })
250
- * ```
251
- */
252
- get testLab(): {
253
- readonly testMatrix: testLab.TestMatrixBuilder;
254
- };
255
- }
256
- export declare let handler: HandlerBuilder;