diff --git a/src/main.ts b/src/main.ts index 1dbeedf..34100e4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -42,6 +42,18 @@ export type EventContextOptions = { * Default is 'UNAUTHENTICATED'. */ authType?: 'ADMIN' | 'USER' | 'UNAUTHENTICATED'; + + /** Resource is a standard format for defining a resource (google.rpc.context.AttributeContext.Resource). + * In Cloud Functions, it is the resource that triggered the function - such as a storage bucket. + */ + resource?: { + service: string; + name: string; + type?: string; + labels?: { + [tag: string]: string; + }; + }; }; /** Fields of the callable context that can be overridden/customized. */ @@ -138,7 +150,7 @@ export function wrap( }; } else { _checkOptionValidity( - ['eventId', 'timestamp', 'params', 'auth', 'authType'], + ['eventId', 'timestamp', 'params', 'auth', 'authType', 'resource'], options ); const defaultContext = _makeDefaultContext(cloudFunction, options);