Skip to content

Commit 1618688

Browse files
committed
Update documentation and replace TODOs.
1 parent cce55b5 commit 1618688

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

src/v2/options.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,22 @@ export interface EventHandlerOptions extends Omit<GlobalOptions, "enforceAppChec
263263
/** Type of the event. Valid values are TODO */
264264
eventType?: string;
265265

266-
/** TODO */
266+
/**
267+
* Filters events based on exact matches on the CloudEvents attributes.
268+
*
269+
* Each key-value pair represents an attribute name and its required value for exact matching.
270+
* Events must match all specified filters to trigger the function.
271+
*/
267272
eventFilters?: Record<string, string | Expression<string>>;
268273

269-
/** TODO */
274+
/**
275+
* Filters events based on path pattern matching on the CloudEvents attributes.
276+
*
277+
* Similar to eventFilters, but supports wildcard patterns for flexible matching:
278+
* - `*` matches any single path segment
279+
* - `**` matches zero or more path segments
280+
* - `{param}` captures a path segment as a parameter
281+
*/
270282
eventFilterPathPatterns?: Record<string, string | Expression<string>>;
271283

272284
/** Whether failed executions should be delivered again. */
@@ -288,7 +300,7 @@ export interface EventHandlerOptions extends Omit<GlobalOptions, "enforceAppChec
288300
* @internal
289301
*/
290302
export function optionsToTriggerAnnotations(
291-
opts: GlobalOptions | EventHandlerOptions | HttpsOptions
303+
opts: GlobalOptions | EventHandlerOptions | HttpsOptions,
292304
): TriggerAnnotation {
293305
const annotation: TriggerAnnotation = {};
294306
copyIfPresent(
@@ -301,7 +313,7 @@ export function optionsToTriggerAnnotations(
301313
"labels",
302314
"vpcConnector",
303315
"vpcConnectorEgressSettings",
304-
"secrets"
316+
"secrets",
305317
);
306318
convertIfPresent(annotation, opts, "availableMemoryMb", "memory", (mem: MemoryOption) => {
307319
return MemoryOptionToMB[mem];
@@ -317,7 +329,7 @@ export function optionsToTriggerAnnotations(
317329
opts,
318330
"serviceAccountEmail",
319331
"serviceAccount",
320-
serviceAccountFromShorthand
332+
serviceAccountFromShorthand,
321333
);
322334
convertIfPresent(annotation, opts, "timeout", "timeoutSeconds", durationFromSeconds);
323335
convertIfPresent(
@@ -327,7 +339,7 @@ export function optionsToTriggerAnnotations(
327339
"retry",
328340
(retry: boolean) => {
329341
return retry ? { retry: true } : null;
330-
}
342+
},
331343
);
332344

333345
return annotation;
@@ -338,7 +350,7 @@ export function optionsToTriggerAnnotations(
338350
* @internal
339351
*/
340352
export function optionsToEndpoint(
341-
opts: GlobalOptions | EventHandlerOptions | HttpsOptions
353+
opts: GlobalOptions | EventHandlerOptions | HttpsOptions,
342354
): ManifestEndpoint {
343355
const endpoint: ManifestEndpoint = {};
344356
copyIfPresent(
@@ -351,7 +363,7 @@ export function optionsToEndpoint(
351363
"ingressSettings",
352364
"labels",
353365
"timeoutSeconds",
354-
"cpu"
366+
"cpu",
355367
);
356368
convertIfPresent(endpoint, opts, "serviceAccountEmail", "serviceAccount");
357369
if (opts.vpcConnector !== undefined) {
@@ -369,10 +381,10 @@ export function optionsToEndpoint(
369381
"availableMemoryMb",
370382
"memory",
371383
(
372-
mem: MemoryOption | Expression<number> | ResetValue | null
384+
mem: MemoryOption | Expression<number> | ResetValue | null,
373385
): number | Expression<number> | null | ResetValue => {
374386
return typeof mem === "object" ? mem : MemoryOptionToMB[mem];
375-
}
387+
},
376388
);
377389
convertIfPresent(endpoint, opts, "region", "region", (region) => {
378390
if (typeof region === "string") {
@@ -386,7 +398,7 @@ export function optionsToEndpoint(
386398
"secretEnvironmentVariables",
387399
"secrets",
388400
(secrets: (string | SecretParam)[]) =>
389-
secrets.map((secret) => ({ key: secret instanceof SecretParam ? secret.name : secret }))
401+
secrets.map((secret) => ({ key: secret instanceof SecretParam ? secret.name : secret })),
390402
);
391403

392404
return endpoint;

0 commit comments

Comments
 (0)