firebase-functions 7.2.2 → 7.2.4

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 (44) hide show
  1. package/lib/common/providers/tasks.js +1 -0
  2. package/lib/common/utilities/path-pattern.js +12 -3
  3. package/lib/esm/common/providers/tasks.mjs +1 -0
  4. package/lib/esm/common/utilities/path-pattern.mjs +11 -3
  5. package/lib/esm/v2/compat.mjs +19 -59
  6. package/lib/esm/v2/index.doc.mjs +1 -1
  7. package/lib/esm/v2/index.mjs +2 -2
  8. package/lib/esm/v2/providers/ai/index.mjs +187 -0
  9. package/lib/esm/v2/providers/ai/types/gemini/v1beta/index.mjs +6 -0
  10. package/lib/esm/v2/providers/ai/types/vertex/v1beta1/index.mjs +6 -0
  11. package/lib/esm/v2/providers/database.mjs +35 -2
  12. package/lib/esm/v2/providers/firestore.mjs +38 -6
  13. package/lib/esm/v2/providers/https.mjs +10 -2
  14. package/lib/esm/v2/providers/pubsub.mjs +42 -2
  15. package/lib/esm/v2/providers/remoteConfig.mjs +18 -1
  16. package/lib/esm/v2/providers/scheduler.mjs +12 -0
  17. package/lib/esm/v2/providers/storage.mjs +24 -1
  18. package/lib/v2/compat.d.ts +14 -12
  19. package/lib/v2/compat.js +19 -58
  20. package/lib/v2/index.d.ts +0 -1
  21. package/lib/v2/index.doc.js +1 -1
  22. package/lib/v2/index.js +2 -2
  23. package/lib/v2/providers/ai/index.d.ts +53 -0
  24. package/lib/v2/providers/ai/index.js +198 -0
  25. package/lib/v2/providers/ai/types/gemini/v1beta/index.d.ts +817 -0
  26. package/lib/v2/providers/ai/types/gemini/v1beta/index.js +8 -0
  27. package/lib/v2/providers/ai/types/vertex/v1beta1/index.d.ts +850 -0
  28. package/lib/v2/providers/ai/types/vertex/v1beta1/index.js +8 -0
  29. package/lib/v2/providers/database.d.ts +61 -4
  30. package/lib/v2/providers/database.js +35 -2
  31. package/lib/v2/providers/firestore.d.ts +127 -0
  32. package/lib/v2/providers/firestore.js +38 -5
  33. package/lib/v2/providers/https.d.ts +2 -2
  34. package/lib/v2/providers/https.js +10 -2
  35. package/lib/v2/providers/pubsub.d.ts +18 -4
  36. package/lib/v2/providers/pubsub.js +42 -2
  37. package/lib/v2/providers/remoteConfig.d.ts +16 -0
  38. package/lib/v2/providers/remoteConfig.js +18 -1
  39. package/lib/v2/providers/scheduler.d.ts +21 -0
  40. package/lib/v2/providers/scheduler.js +12 -0
  41. package/lib/v2/providers/storage.d.ts +127 -0
  42. package/lib/v2/providers/storage.js +24 -1
  43. package/lib/v2/providers/tasks.d.ts +20 -1
  44. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+
2
+ //#region src/v2/providers/ai/types/vertex/v1beta1/index.ts
3
+ const requestTypeName = "type.googleapis.com/google.cloud.aiplatform.v1beta1.GenerateContentRequest";
4
+ const responseTypeName = "type.googleapis.com/google.cloud.aiplatform.v1beta1.GenerateContentResponse";
5
+
6
+ //#endregion
7
+ exports.requestTypeName = requestTypeName;
8
+ exports.responseTypeName = responseTypeName;
@@ -6,6 +6,7 @@ import { CloudEvent, CloudFunction } from "../core";
6
6
  import { Expression } from "../../params";
7
7
  import * as options from "../options";
8
8
  import { SupportedSecretParam } from "../../params/types";
9
+ import { V1Compat } from "../compat";
9
10
  export { DataSnapshot };
10
11
  /** @hidden */
11
12
  export interface RawRTDBCloudEventData {
@@ -156,7 +157,21 @@ export interface ReferenceOptions<Ref extends string = string> extends options.E
156
157
  * @param reference - The database reference path to trigger on.
157
158
  * @param handler - Event handler which is run every time a Realtime Database create, update, or delete occurs.
158
159
  */
159
- export declare function onValueWritten<Ref extends string>(ref: Ref, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;
160
+ export declare function onValueWritten<Ref extends string>(reference: Ref, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>> & V1Compat<"change", Change<DataSnapshot>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;
161
+ /**
162
+ * Event handler which triggers when data is created, updated, or deleted in Realtime Database.
163
+ *
164
+ * @param reference - The database reference path to trigger on.
165
+ * @param handler - Event handler which is run every time a Realtime Database create, update, or delete occurs.
166
+ */
167
+ export declare function onValueWritten<Ref extends string>(reference: Ref, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;
168
+ /**
169
+ * Event handler which triggers when data is created, updated, or deleted in Realtime Database.
170
+ *
171
+ * @param opts - Options that can be set on an individual event-handling function.
172
+ * @param handler - Event handler which is run every time a Realtime Database create, update, or delete occurs.
173
+ */
174
+ export declare function onValueWritten<Ref extends string>(opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>> & V1Compat<"change", Change<DataSnapshot>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;
160
175
  /**
161
176
  * Event handler which triggers when data is created, updated, or deleted in Realtime Database.
162
177
  *
@@ -170,7 +185,21 @@ export declare function onValueWritten<Ref extends string>(opts: ReferenceOption
170
185
  * @param reference - The database reference path to trigger on.
171
186
  * @param handler - Event handler which is run every time a Realtime Database create occurs.
172
187
  */
173
- export declare function onValueCreated<Ref extends string>(ref: Ref, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;
188
+ export declare function onValueCreated<Ref extends string>(reference: Ref, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>> & V1Compat<"snapshot", DataSnapshot>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;
189
+ /**
190
+ * Event handler which triggers when data is created in Realtime Database.
191
+ *
192
+ * @param reference - The database reference path to trigger on.
193
+ * @param handler - Event handler which is run every time a Realtime Database create occurs.
194
+ */
195
+ export declare function onValueCreated<Ref extends string>(reference: Ref, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;
196
+ /**
197
+ * Event handler which triggers when data is created in Realtime Database.
198
+ *
199
+ * @param opts - Options that can be set on an individual event-handling function.
200
+ * @param handler - Event handler which is run every time a Realtime Database create occurs.
201
+ */
202
+ export declare function onValueCreated<Ref extends string>(opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>> & V1Compat<"snapshot", DataSnapshot>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;
174
203
  /**
175
204
  * Event handler which triggers when data is created in Realtime Database.
176
205
  *
@@ -184,7 +213,21 @@ export declare function onValueCreated<Ref extends string>(opts: ReferenceOption
184
213
  * @param reference - The database reference path to trigger on.
185
214
  * @param handler - Event handler which is run every time a Realtime Database update occurs.
186
215
  */
187
- export declare function onValueUpdated<Ref extends string>(ref: Ref, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;
216
+ export declare function onValueUpdated<Ref extends string>(reference: Ref, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>> & V1Compat<"change", Change<DataSnapshot>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;
217
+ /**
218
+ * Event handler which triggers when data is updated in Realtime Database.
219
+ *
220
+ * @param reference - The database reference path to trigger on.
221
+ * @param handler - Event handler which is run every time a Realtime Database update occurs.
222
+ */
223
+ export declare function onValueUpdated<Ref extends string>(reference: Ref, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;
224
+ /**
225
+ * Event handler which triggers when data is updated in Realtime Database.
226
+ *
227
+ * @param opts - Options that can be set on an individual event-handling function.
228
+ * @param handler - Event handler which is run every time a Realtime Database update occurs.
229
+ */
230
+ export declare function onValueUpdated<Ref extends string>(opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>> & V1Compat<"change", Change<DataSnapshot>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;
188
231
  /**
189
232
  * Event handler which triggers when data is updated in Realtime Database.
190
233
  *
@@ -198,7 +241,21 @@ export declare function onValueUpdated<Ref extends string>(opts: ReferenceOption
198
241
  * @param reference - The database reference path to trigger on.
199
242
  * @param handler - Event handler which is run every time a Realtime Database deletion occurs.
200
243
  */
201
- export declare function onValueDeleted<Ref extends string>(ref: Ref, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;
244
+ export declare function onValueDeleted<Ref extends string>(reference: Ref, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>> & V1Compat<"snapshot", DataSnapshot>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;
245
+ /**
246
+ * Event handler which triggers when data is deleted in Realtime Database.
247
+ *
248
+ * @param reference - The database reference path to trigger on.
249
+ * @param handler - Event handler which is run every time a Realtime Database deletion occurs.
250
+ */
251
+ export declare function onValueDeleted<Ref extends string>(reference: Ref, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;
252
+ /**
253
+ * Event handler which triggers when data is deleted in Realtime Database.
254
+ *
255
+ * @param opts - Options that can be set on an individual event-handling function.
256
+ * @param handler - Event handler which is run every time a Realtime Database deletion occurs.
257
+ */
258
+ export declare function onValueDeleted<Ref extends string>(opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>> & V1Compat<"snapshot", DataSnapshot>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;
202
259
  /**
203
260
  * Event handler which triggers when data is deleted in Realtime Database.
204
261
  *
@@ -6,6 +6,7 @@ const require_common_utilities_path = require('../../common/utilities/path.js');
6
6
  const require_common_providers_database = require('../../common/providers/database.js');
7
7
  const require_common_utilities_utils = require('../../common/utilities/utils.js');
8
8
  const require_v2_trace = require('../trace.js');
9
+ const require_v2_compat = require('../compat.js');
9
10
  const require_v2_options = require('../options.js');
10
11
  const require_common_utilities_path_pattern = require('../../common/utilities/path-pattern.js');
11
12
 
@@ -135,6 +136,30 @@ function makeChangedDatabaseEvent(event, instance, params) {
135
136
  delete databaseEvent.authid;
136
137
  return databaseEvent;
137
138
  }
139
+ function makeV1Context(eventType, databaseEvent) {
140
+ return {
141
+ eventId: databaseEvent.id,
142
+ timestamp: databaseEvent.time,
143
+ eventType: {
144
+ [writtenEventType]: "providers/google.firebase.database/eventTypes/ref.write",
145
+ [createdEventType]: "providers/google.firebase.database/eventTypes/ref.create",
146
+ [updatedEventType]: "providers/google.firebase.database/eventTypes/ref.update",
147
+ [deletedEventType]: "providers/google.firebase.database/eventTypes/ref.delete"
148
+ }[eventType] || eventType,
149
+ resource: {
150
+ service: "firebaseio.com",
151
+ name: `projects/_/instances/${databaseEvent.instance}/refs/${databaseEvent.ref}`
152
+ },
153
+ params: databaseEvent.params,
154
+ ...databaseEvent.authType === "admin" ? { authType: "ADMIN" } : databaseEvent.authType === "unauthenticated" ? { authType: "UNAUTHENTICATED" } : databaseEvent.authType === "app_user" ? {
155
+ authType: "USER",
156
+ auth: {
157
+ uid: databaseEvent.authId || "",
158
+ token: {}
159
+ }
160
+ } : {}
161
+ };
162
+ }
138
163
  /** @internal */
139
164
  function makeEndpoint(eventType, opts, path, instance) {
140
165
  const baseOpts = require_v2_options.optionsToEndpoint(require_v2_options.getGlobalOptions());
@@ -173,7 +198,11 @@ function onChangedOperation(eventType, referenceOrOpts, handler) {
173
198
  const instanceUrl = getInstance(event);
174
199
  const params = makeParams(event, pathPattern, instancePattern);
175
200
  const databaseEvent = makeChangedDatabaseEvent(event, instanceUrl, params);
176
- return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(databaseEvent);
201
+ const compatEvent = require_v2_compat.addV1Compat(databaseEvent, {
202
+ context: () => makeV1Context(eventType, databaseEvent),
203
+ change: () => databaseEvent.data
204
+ });
205
+ return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(compatEvent);
177
206
  };
178
207
  func.run = handler;
179
208
  func.__endpoint = makeEndpoint(eventType, opts, pathPattern, instancePattern);
@@ -190,7 +219,11 @@ function onOperation(eventType, referenceOrOpts, handler) {
190
219
  const params = makeParams(event, pathPattern, instancePattern);
191
220
  const data = eventType === deletedEventType ? event.data.data : event.data.delta;
192
221
  const databaseEvent = makeDatabaseEvent(event, data, instanceUrl, params);
193
- return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(databaseEvent);
222
+ const compatEvent = require_v2_compat.addV1Compat(databaseEvent, {
223
+ context: () => makeV1Context(eventType, databaseEvent),
224
+ snapshot: () => databaseEvent.data
225
+ });
226
+ return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(compatEvent);
194
227
  };
195
228
  func.run = handler;
196
229
  func.__endpoint = makeEndpoint(eventType, opts, pathPattern, instancePattern);
@@ -2,6 +2,7 @@ import * as firestore from "firebase-admin/firestore";
2
2
  import { ParamsOf } from "../../common/params";
3
3
  import { Change, CloudEvent, CloudFunction } from "../core";
4
4
  import { EventHandlerOptions } from "../options";
5
+ import { V1Compat } from "../compat";
5
6
  import { Expression } from "../../params";
6
7
  export { Change };
7
8
  /** A Firestore DocumentSnapshot */
@@ -50,6 +51,13 @@ export interface DocumentOptions<Document extends string = string> extends Event
50
51
  /** The Firestore namespace */
51
52
  namespace?: string | Expression<string>;
52
53
  }
54
+ /**
55
+ * Event handler that triggers when a document is created, updated, or deleted in Firestore.
56
+ *
57
+ * @param document - The Firestore document path to trigger on.
58
+ * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
59
+ */
60
+ export declare function onDocumentWritten<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<DocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
53
61
  /**
54
62
  * Event handler that triggers when a document is created, updated, or deleted in Firestore.
55
63
  *
@@ -57,6 +65,13 @@ export interface DocumentOptions<Document extends string = string> extends Event
57
65
  * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
58
66
  */
59
67
  export declare function onDocumentWritten<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
68
+ /**
69
+ * Event handler that triggers when a document is created, updated, or deleted in Firestore.
70
+ *
71
+ * @param opts - Options that can be set on an individual event-handling function.
72
+ * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
73
+ */
74
+ export declare function onDocumentWritten<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<DocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
60
75
  /**
61
76
  * Event handler that triggers when a document is created, updated, or deleted in Firestore.
62
77
  *
@@ -64,6 +79,14 @@ export declare function onDocumentWritten<Document extends string>(document: Doc
64
79
  * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
65
80
  */
66
81
  export declare function onDocumentWritten<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
82
+ /**
83
+ * Event handler that triggers when a document is created, updated, or deleted in Firestore.
84
+ * This trigger also provides the authentication context of the principal who triggered the event.
85
+ *
86
+ * @param document - The Firestore document path to trigger on.
87
+ * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
88
+ */
89
+ export declare function onDocumentWrittenWithAuthContext<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<DocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
67
90
  /**
68
91
  * Event handler that triggers when a document is created, updated, or deleted in Firestore.
69
92
  * This trigger also provides the authentication context of the principal who triggered the event.
@@ -72,6 +95,14 @@ export declare function onDocumentWritten<Document extends string>(opts: Documen
72
95
  * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
73
96
  */
74
97
  export declare function onDocumentWrittenWithAuthContext<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
98
+ /**
99
+ * Event handler that triggers when a document is created, updated, or deleted in Firestore.
100
+ * This trigger also provides the authentication context of the principal who triggered the event.
101
+ *
102
+ * @param opts - Options that can be set on an individual event-handling function.
103
+ * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
104
+ */
105
+ export declare function onDocumentWrittenWithAuthContext<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<DocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
75
106
  /**
76
107
  * Event handler that triggers when a document is created, updated, or deleted in Firestore.
77
108
  * This trigger also provides the authentication context of the principal who triggered the event.
@@ -80,6 +111,13 @@ export declare function onDocumentWrittenWithAuthContext<Document extends string
80
111
  * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
81
112
  */
82
113
  export declare function onDocumentWrittenWithAuthContext<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
114
+ /**
115
+ * Event handler that triggers when a document is created in Firestore.
116
+ *
117
+ * @param document - The Firestore document path to trigger on.
118
+ * @param handler - Event handler which is run every time a Firestore create occurs.
119
+ */
120
+ export declare function onDocumentCreated<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
83
121
  /**
84
122
  * Event handler that triggers when a document is created in Firestore.
85
123
  *
@@ -87,6 +125,13 @@ export declare function onDocumentWrittenWithAuthContext<Document extends string
87
125
  * @param handler - Event handler which is run every time a Firestore create occurs.
88
126
  */
89
127
  export declare function onDocumentCreated<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
128
+ /**
129
+ * Event handler that triggers when a document is created in Firestore.
130
+ *
131
+ * @param opts - Options that can be set on an individual event-handling function.
132
+ * @param handler - Event handler which is run every time a Firestore create occurs.
133
+ */
134
+ export declare function onDocumentCreated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
90
135
  /**
91
136
  * Event handler that triggers when a document is created in Firestore.
92
137
  *
@@ -94,6 +139,14 @@ export declare function onDocumentCreated<Document extends string>(document: Doc
94
139
  * @param handler - Event handler which is run every time a Firestore create occurs.
95
140
  */
96
141
  export declare function onDocumentCreated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
142
+ /**
143
+ * Event handler that triggers when a document is created in Firestore.
144
+ * This trigger also provides the authentication context of the principal who triggered the event.
145
+ *
146
+ * @param document - The Firestore document path to trigger on.
147
+ * @param handler - Event handler which is run every time a Firestore create occurs.
148
+ */
149
+ export declare function onDocumentCreatedWithAuthContext<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
97
150
  /**
98
151
  * Event handler that triggers when a document is created in Firestore.
99
152
  * This trigger also provides the authentication context of the principal who triggered the event.
@@ -102,6 +155,14 @@ export declare function onDocumentCreated<Document extends string>(opts: Documen
102
155
  * @param handler - Event handler which is run every time a Firestore create occurs.
103
156
  */
104
157
  export declare function onDocumentCreatedWithAuthContext<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
158
+ /**
159
+ * Event handler that triggers when a document is created in Firestore.
160
+ * This trigger also provides the authentication context of the principal who triggered the event.
161
+ *
162
+ * @param opts - Options that can be set on an individual event-handling function.
163
+ * @param handler - Event handler which is run every time a Firestore create occurs.
164
+ */
165
+ export declare function onDocumentCreatedWithAuthContext<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
105
166
  /**
106
167
  * Event handler that triggers when a document is created in Firestore.
107
168
  * This trigger also provides the authentication context of the principal who triggered the event.
@@ -110,6 +171,13 @@ export declare function onDocumentCreatedWithAuthContext<Document extends string
110
171
  * @param handler - Event handler which is run every time a Firestore create occurs.
111
172
  */
112
173
  export declare function onDocumentCreatedWithAuthContext<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
174
+ /**
175
+ * Event handler that triggers when a document is updated in Firestore.
176
+ *
177
+ * @param document - The Firestore document path to trigger on.
178
+ * @param handler - Event handler which is run every time a Firestore update occurs.
179
+ */
180
+ export declare function onDocumentUpdated<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<QueryDocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
113
181
  /**
114
182
  * Event handler that triggers when a document is updated in Firestore.
115
183
  *
@@ -117,6 +185,13 @@ export declare function onDocumentCreatedWithAuthContext<Document extends string
117
185
  * @param handler - Event handler which is run every time a Firestore update occurs.
118
186
  */
119
187
  export declare function onDocumentUpdated<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
188
+ /**
189
+ * Event handler that triggers when a document is updated in Firestore.
190
+ *
191
+ * @param opts - Options that can be set on an individual event-handling function.
192
+ * @param handler - Event handler which is run every time a Firestore update occurs.
193
+ */
194
+ export declare function onDocumentUpdated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<QueryDocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
120
195
  /**
121
196
  * Event handler that triggers when a document is updated in Firestore.
122
197
  *
@@ -124,6 +199,14 @@ export declare function onDocumentUpdated<Document extends string>(document: Doc
124
199
  * @param handler - Event handler which is run every time a Firestore update occurs.
125
200
  */
126
201
  export declare function onDocumentUpdated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
202
+ /**
203
+ * Event handler that triggers when a document is updated in Firestore.
204
+ * This trigger also provides the authentication context of the principal who triggered the event.
205
+ *
206
+ * @param document - The Firestore document path to trigger on.
207
+ * @param handler - Event handler which is run every time a Firestore update occurs.
208
+ */
209
+ export declare function onDocumentUpdatedWithAuthContext<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<QueryDocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
127
210
  /**
128
211
  * Event handler that triggers when a document is updated in Firestore.
129
212
  * This trigger also provides the authentication context of the principal who triggered the event.
@@ -132,6 +215,14 @@ export declare function onDocumentUpdated<Document extends string>(opts: Documen
132
215
  * @param handler - Event handler which is run every time a Firestore update occurs.
133
216
  */
134
217
  export declare function onDocumentUpdatedWithAuthContext<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
218
+ /**
219
+ * Event handler that triggers when a document is updated in Firestore.
220
+ * This trigger also provides the authentication context of the principal who triggered the event.
221
+ *
222
+ * @param opts - Options that can be set on an individual event-handling function.
223
+ * @param handler - Event handler which is run every time a Firestore update occurs.
224
+ */
225
+ export declare function onDocumentUpdatedWithAuthContext<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<QueryDocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
135
226
  /**
136
227
  * Event handler that triggers when a document is updated in Firestore.
137
228
  * This trigger also provides the authentication context of the principal who triggered the event.
@@ -140,6 +231,13 @@ export declare function onDocumentUpdatedWithAuthContext<Document extends string
140
231
  * @param handler - Event handler which is run every time a Firestore update occurs.
141
232
  */
142
233
  export declare function onDocumentUpdatedWithAuthContext<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
234
+ /**
235
+ * Event handler that triggers when a document is deleted in Firestore.
236
+ *
237
+ * @param document - The Firestore document path to trigger on.
238
+ * @param handler - Event handler which is run every time a Firestore delete occurs.
239
+ */
240
+ export declare function onDocumentDeleted<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
143
241
  /**
144
242
  * Event handler that triggers when a document is deleted in Firestore.
145
243
  *
@@ -147,6 +245,13 @@ export declare function onDocumentUpdatedWithAuthContext<Document extends string
147
245
  * @param handler - Event handler which is run every time a Firestore delete occurs.
148
246
  */
149
247
  export declare function onDocumentDeleted<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
248
+ /**
249
+ * Event handler that triggers when a document is deleted in Firestore.
250
+ *
251
+ * @param opts - Options that can be set on an individual event-handling function.
252
+ * @param handler - Event handler which is run every time a Firestore delete occurs.
253
+ */
254
+ export declare function onDocumentDeleted<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
150
255
  /**
151
256
  * Event handler that triggers when a document is deleted in Firestore.
152
257
  *
@@ -154,6 +259,14 @@ export declare function onDocumentDeleted<Document extends string>(document: Doc
154
259
  * @param handler - Event handler which is run every time a Firestore delete occurs.
155
260
  */
156
261
  export declare function onDocumentDeleted<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
262
+ /**
263
+ * Event handler that triggers when a document is deleted in Firestore.
264
+ * This trigger also provides the authentication context of the principal who triggered the event.
265
+ *
266
+ * @param document - The Firestore document path to trigger on.
267
+ * @param handler - Event handler which is run every time a Firestore delete occurs.
268
+ */
269
+ export declare function onDocumentDeletedWithAuthContext<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
157
270
  /**
158
271
  * Event handler that triggers when a document is deleted in Firestore.
159
272
  * This trigger also provides the authentication context of the principal who triggered the event.
@@ -162,6 +275,14 @@ export declare function onDocumentDeleted<Document extends string>(opts: Documen
162
275
  * @param handler - Event handler which is run every time a Firestore delete occurs.
163
276
  */
164
277
  export declare function onDocumentDeletedWithAuthContext<Document extends string>(document: Document, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
278
+ /**
279
+ * Event handler that triggers when a document is deleted in Firestore.
280
+ * This trigger also provides the authentication context of the principal who triggered the event.
281
+ *
282
+ * @param opts - Options that can be set on an individual event-handling function.
283
+ * @param handler - Event handler which is run every time a Firestore delete occurs.
284
+ */
285
+ export declare function onDocumentDeletedWithAuthContext<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
165
286
  /**
166
287
  * Event handler that triggers when a document is deleted in Firestore.
167
288
  * This trigger also provides the authentication context of the principal who triggered the event.
@@ -170,3 +291,9 @@ export declare function onDocumentDeletedWithAuthContext<Document extends string
170
291
  * @param handler - Event handler which is run every time a Firestore delete occurs.
171
292
  */
172
293
  export declare function onDocumentDeletedWithAuthContext<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
294
+ export declare function onOperation<Document extends string>(eventType: string, documentOrOpts: Document | DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
295
+ export declare function onOperation<Document extends string>(eventType: string, documentOrOpts: Document | DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>> & V1Compat<"snapshot", QueryDocumentSnapshot>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
296
+ export declare function onOperation<Document extends string>(eventType: string, documentOrOpts: Document | DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
297
+ export declare function onChangedOperation<Document extends string>(eventType: string, documentOrOpts: Document | DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
298
+ export declare function onChangedOperation<Document extends string>(eventType: string, documentOrOpts: Document | DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>> & V1Compat<"change", Change<QueryDocumentSnapshot>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
299
+ export declare function onChangedOperation<Document extends string>(eventType: string, documentOrOpts: Document | DocumentOptions<Document>, handler: (event: FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreAuthEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
@@ -6,8 +6,9 @@ const require_common_onInit = require('../../common/onInit.js');
6
6
  const require_common_utilities_path = require('../../common/utilities/path.js');
7
7
  const require_common_providers_firestore = require('../../common/providers/firestore.js');
8
8
  const require_v2_trace = require('../trace.js');
9
- const require_v2_options = require('../options.js');
9
+ const require_v2_compat = require('../compat.js');
10
10
  require('../core.js');
11
+ const require_v2_options = require('../options.js');
11
12
  const require_common_utilities_path_pattern = require('../../common/utilities/path-pattern.js');
12
13
 
13
14
  //#region src/v2/providers/firestore.ts
@@ -20,6 +21,7 @@ var firestore_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
20
21
  deletedEventType: () => deletedEventType,
21
22
  deletedEventWithAuthContextType: () => deletedEventWithAuthContextType,
22
23
  getOpts: () => getOpts,
24
+ getV1Context: () => getV1Context,
23
25
  makeChangedFirestoreEvent: () => makeChangedFirestoreEvent,
24
26
  makeEndpoint: () => makeEndpoint,
25
27
  makeFirestoreEvent: () => makeFirestoreEvent,
@@ -68,7 +70,7 @@ function onDocumentWritten(documentOrOpts, handler) {
68
70
  * Event handler that triggers when a document is created, updated, or deleted in Firestore.
69
71
  * This trigger also provides the authentication context of the principal who triggered the event.
70
72
  *
71
- * @param opts - Options or a string document path.
73
+ * @param documentOrOpts - Options or a string document path.
72
74
  * @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.
73
75
  */
74
76
  function onDocumentWrittenWithAuthContext(documentOrOpts, handler) {
@@ -262,6 +264,29 @@ function makeEndpoint(eventType, opts, document, database, namespace) {
262
264
  };
263
265
  }
264
266
  /** @internal */
267
+ function getV1Context(event) {
268
+ return {
269
+ eventId: event.id,
270
+ timestamp: event.time,
271
+ eventType: {
272
+ "google.cloud.firestore.document.v1.written": "providers/cloud.firestore/eventTypes/document.write",
273
+ "google.cloud.firestore.document.v1.created": "providers/cloud.firestore/eventTypes/document.create",
274
+ "google.cloud.firestore.document.v1.updated": "providers/cloud.firestore/eventTypes/document.update",
275
+ "google.cloud.firestore.document.v1.deleted": "providers/cloud.firestore/eventTypes/document.delete",
276
+ "google.cloud.firestore.document.v1.written.withAuthContext": "providers/cloud.firestore/eventTypes/document.write",
277
+ "google.cloud.firestore.document.v1.created.withAuthContext": "providers/cloud.firestore/eventTypes/document.create",
278
+ "google.cloud.firestore.document.v1.updated.withAuthContext": "providers/cloud.firestore/eventTypes/document.update",
279
+ "google.cloud.firestore.document.v1.deleted.withAuthContext": "providers/cloud.firestore/eventTypes/document.delete"
280
+ }[event.type] || event.type,
281
+ resource: {
282
+ service: "firestore.googleapis.com",
283
+ name: `projects/${event.project}/databases/${event.database}/documents/${event.document}`
284
+ },
285
+ params: event.params,
286
+ authType: event.authType,
287
+ authId: event.authId
288
+ };
289
+ }
265
290
  function onOperation(eventType, documentOrOpts, handler) {
266
291
  const { document, database, namespace, opts } = getOpts(documentOrOpts);
267
292
  const func = (raw) => {
@@ -269,13 +294,16 @@ function onOperation(eventType, documentOrOpts, handler) {
269
294
  const documentPattern = new require_common_utilities_path_pattern.PathPattern(typeof document === "string" ? document : document.value());
270
295
  const params = makeParams(event.document, documentPattern);
271
296
  const firestoreEvent = makeFirestoreEvent(eventType, event, params);
272
- return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(firestoreEvent);
297
+ const patchedEvent = require_v2_compat.addV1Compat(firestoreEvent, {
298
+ context: () => getV1Context(firestoreEvent),
299
+ snapshot: () => firestoreEvent.data
300
+ });
301
+ return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(patchedEvent);
273
302
  };
274
303
  func.run = handler;
275
304
  func.__endpoint = makeEndpoint(eventType, opts, document, database, namespace);
276
305
  return func;
277
306
  }
278
- /** @internal */
279
307
  function onChangedOperation(eventType, documentOrOpts, handler) {
280
308
  const { document, database, namespace, opts } = getOpts(documentOrOpts);
281
309
  const func = (raw) => {
@@ -283,7 +311,11 @@ function onChangedOperation(eventType, documentOrOpts, handler) {
283
311
  const documentPattern = new require_common_utilities_path_pattern.PathPattern(typeof document === "string" ? document : document.value());
284
312
  const params = makeParams(event.document, documentPattern);
285
313
  const firestoreEvent = makeChangedFirestoreEvent(event, params);
286
- return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(firestoreEvent);
314
+ const patchedEvent = require_v2_compat.addV1Compat(firestoreEvent, {
315
+ context: () => getV1Context(firestoreEvent),
316
+ change: () => firestoreEvent.data
317
+ });
318
+ return require_v2_trace.wrapTraceContext(require_common_onInit.withInit(handler))(patchedEvent);
287
319
  };
288
320
  func.run = handler;
289
321
  func.__endpoint = makeEndpoint(eventType, opts, document, database, namespace);
@@ -305,6 +337,7 @@ Object.defineProperty(exports, 'firestore_exports', {
305
337
  }
306
338
  });
307
339
  exports.getOpts = getOpts;
340
+ exports.getV1Context = getV1Context;
308
341
  exports.makeChangedFirestoreEvent = makeChangedFirestoreEvent;
309
342
  exports.makeEndpoint = makeEndpoint;
310
343
  exports.makeFirestoreEvent = makeFirestoreEvent;
@@ -109,7 +109,7 @@ export interface CallableOptions<T = any> extends HttpsOptions {
109
109
  * (Unauthorized) error.
110
110
  * When false, requests with invalid tokens set event.app to undefiend.
111
111
  */
112
- enforceAppCheck?: boolean;
112
+ enforceAppCheck?: boolean | Expression<boolean>;
113
113
  /**
114
114
  * Determines whether Firebase App Check token is consumed on request. Defaults to false.
115
115
  *
@@ -132,7 +132,7 @@ export interface CallableOptions<T = any> extends HttpsOptions {
132
132
  * the request.app.alreadyConsumed property will be set to true and pass the execution to the handler code for making
133
133
  * further decisions, such as requiring additional security checks or rejecting the request.
134
134
  */
135
- consumeAppCheckToken?: boolean;
135
+ consumeAppCheckToken?: boolean | Expression<boolean>;
136
136
  /**
137
137
  * Time in seconds between sending heartbeat messages to keep the connection
138
138
  * alive. Set to `null` to disable heartbeats.
@@ -129,13 +129,21 @@ function onCall(optsOrHandler, handler) {
129
129
  origin = origin[0];
130
130
  }
131
131
  const fixedLen = (req, resp) => handler(req, resp);
132
+ let enforceAppCheck = opts.enforceAppCheck ?? require_v2_options.getGlobalOptions().enforceAppCheck;
133
+ if (enforceAppCheck instanceof require_params_types.Expression) {
134
+ enforceAppCheck = enforceAppCheck.value();
135
+ }
136
+ let consumeAppCheckToken = opts.consumeAppCheckToken;
137
+ if (consumeAppCheckToken instanceof require_params_types.Expression) {
138
+ consumeAppCheckToken = consumeAppCheckToken.value();
139
+ }
132
140
  let func = require_common_providers_https.onCallHandler({
133
141
  cors: {
134
142
  origin,
135
143
  methods: "POST"
136
144
  },
137
- enforceAppCheck: opts.enforceAppCheck ?? require_v2_options.getGlobalOptions().enforceAppCheck,
138
- consumeAppCheckToken: opts.consumeAppCheckToken,
145
+ enforceAppCheck,
146
+ consumeAppCheckToken,
139
147
  heartbeatSeconds: opts.heartbeatSeconds,
140
148
  authPolicy: opts.authPolicy
141
149
  }, fixedLen, "gcfv2");
@@ -1,9 +1,9 @@
1
1
  import { ResetValue } from "../../common/options";
2
- import { CloudFunction } from "../core";
2
+ import { CloudEvent, CloudFunction } from "../core";
3
3
  import { Expression } from "../../params";
4
4
  import * as options from "../options";
5
5
  import { SupportedSecretParam } from "../../params/types";
6
- import { PubSubCloudEvent } from "../compat";
6
+ import { V1Compat } from "../compat";
7
7
  /**
8
8
  * Google Cloud Pub/Sub is a globally distributed message bus that automatically scales as you need it.
9
9
  * You can create a function ({@link onMessagePublished}) that handles pub/sub events by using functions.pubsub.
@@ -182,11 +182,25 @@ export interface PubSubOptions extends options.EventHandlerOptions {
182
182
  * @param handler - runs every time a Cloud Pub/Sub message is published
183
183
  * @typeParam T - Type representing `Message.data`'s JSON format
184
184
  */
185
- export declare function onMessagePublished<T = any>(topic: string, handler: (event: PubSubCloudEvent<T>) => any | Promise<any>): CloudFunction<PubSubCloudEvent<T>>;
185
+ export declare function onMessagePublished<T = any>(topic: string, handler: (event: CloudEvent<MessagePublishedData<T>> & V1Compat<"message", V1PubSubMessage<T>>) => any | Promise<any>): CloudFunction<CloudEvent<MessagePublishedData<T>>>;
186
+ /**
187
+ * Handle a message being published to a Pub/Sub topic.
188
+ * @param topic - The Pub/Sub topic to watch for message events.
189
+ * @param handler - runs every time a Cloud Pub/Sub message is published
190
+ * @typeParam T - Type representing `Message.data`'s JSON format
191
+ */
192
+ export declare function onMessagePublished<T = any>(topic: string, handler: (event: CloudEvent<MessagePublishedData<T>>) => any | Promise<any>): CloudFunction<CloudEvent<MessagePublishedData<T>>>;
193
+ /**
194
+ * Handle a message being published to a Pub/Sub topic.
195
+ * @param options - Option containing information (topic) for event
196
+ * @param handler - runs every time a Cloud Pub/Sub message is published
197
+ * @typeParam T - Type representing `Message.data`'s JSON format
198
+ */
199
+ export declare function onMessagePublished<T = any>(options: PubSubOptions, handler: (event: CloudEvent<MessagePublishedData<T>> & V1Compat<"message", V1PubSubMessage<T>>) => any | Promise<any>): CloudFunction<CloudEvent<MessagePublishedData<T>>>;
186
200
  /**
187
201
  * Handle a message being published to a Pub/Sub topic.
188
202
  * @param options - Option containing information (topic) for event
189
203
  * @param handler - runs every time a Cloud Pub/Sub message is published
190
204
  * @typeParam T - Type representing `Message.data`'s JSON format
191
205
  */
192
- export declare function onMessagePublished<T = any>(options: PubSubOptions, handler: (event: PubSubCloudEvent<T>) => any | Promise<any>): CloudFunction<PubSubCloudEvent<T>>;
206
+ export declare function onMessagePublished<T = any>(options: PubSubOptions, handler: (event: CloudEvent<MessagePublishedData<T>>) => any | Promise<any>): CloudFunction<CloudEvent<MessagePublishedData<T>>>;