Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docgen/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import { writeFileSync } from 'fs';
import { resolve } from 'path';

import yargs from 'yargs';
import * as yaml from 'js-yaml';
import { FileSystem } from '@rushstack/node-core-library';
import * as yaml from 'js-yaml';
import yargs from 'yargs';

export interface TocGenerationOptions {
inputFolder: string;
Expand Down
104 changes: 60 additions & 44 deletions src/cloud-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,45 +257,33 @@ export interface Resource {
}

/**
* @hidden
* TriggerAnnotated is used internally by the firebase CLI to understand what
* TriggerAnnotion is used internally by the firebase CLI to understand what
* type of Cloud Function to deploy.
*/
export interface TriggerAnnotated {
__trigger: {
availableMemoryMb?: number;
blockingTrigger?: {
eventType: string;
options?: Record<string, unknown>;
};
eventTrigger?: {
eventType: string;
resource: string;
service: string;
};
failurePolicy?: FailurePolicy;
httpsTrigger?: {
invoker?: string[];
};
labels?: { [key: string]: string };
regions?: string[];
schedule?: Schedule;
timeout?: Duration;
vpcConnector?: string;
vpcConnectorEgressSettings?: string;
serviceAccountEmail?: string;
ingressSettings?: string;
secrets?: string[];
interface TriggerAnnotation {
availableMemoryMb?: number;
blockingTrigger?: {
eventType: string;
options?: Record<string, unknown>;
};
}

/**
* @hidden
* EndpointAnnotated is used to generate the manifest that conforms to the container contract.
*/
export interface EndpointAnnotated {
__endpoint: ManifestEndpoint;
__requiredAPIs?: ManifestRequiredAPI[];
eventTrigger?: {
eventType: string;
resource: string;
service: string;
};
failurePolicy?: FailurePolicy;
httpsTrigger?: {
invoker?: string[];
};
labels?: { [key: string]: string };
regions?: string[];
schedule?: Schedule;
timeout?: Duration;
vpcConnector?: string;
vpcConnectorEgressSettings?: string;
serviceAccountEmail?: string;
ingressSettings?: string;
secrets?: string[];
}

/**
Expand All @@ -315,14 +303,34 @@ export interface Runnable<T> {
* [`Response`](https://expressjs.com/en/api.html#res) objects as its only
* arguments.
*/
export type HttpsFunction = TriggerAnnotated &
EndpointAnnotated &
((req: Request, resp: Response) => void | Promise<void>);
export interface HttpsFunction {
(req: Request, resp: Response): void | Promise<void>;

/** @alpha */
__trigger: TriggerAnnotation;

/** @alpha */
__endpoint: ManifestEndpoint;

/** @alpha */
__requiredAPIs?: ManifestRequiredAPI[];
}

/**
* The Cloud Function type for Blocking triggers.
*/
export type BlockingFunction = HttpsFunction;
export interface BlockingFunction {
(req: Request, resp: Response): void | Promise<void>;

/** @alpha */
__trigger: TriggerAnnotation;

/** @alpha */
__endpoint: ManifestEndpoint;

/** @alpha */
__requiredAPIs?: ManifestRequiredAPI[];
}

/**
* The Cloud Function type for all non-HTTPS triggers. This should be exported
Expand All @@ -331,10 +339,18 @@ export type BlockingFunction = HttpsFunction;
* This type is a special JavaScript function which takes a templated
* `Event` object as its only argument.
*/
export type CloudFunction<T> = Runnable<T> &
TriggerAnnotated &
EndpointAnnotated &
((input: any, context?: any) => PromiseLike<any> | any);
export interface CloudFunction<T> extends Runnable<T> {
(input: any, context?: any): PromiseLike<any> | any;

/** @alpha */
__trigger: TriggerAnnotation;

/** @alpha */
__endpoint: ManifestEndpoint;

/** @alpha */
__requiredAPIs?: ManifestRequiredAPI[];
}

/** @hidden */
export interface MakeCloudFunctionArgs<EventData> {
Expand Down
5 changes: 4 additions & 1 deletion src/common/providers/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ const DISALLOWED_CUSTOM_CLAIMS = [

const CLAIMS_MAX_PAYLOAD_SIZE = 1000;

/** Shorthand auth blocking events from GCIP. */
/**
* Shorthand auth blocking events from GCIP.
* @internal
*/
export type AuthBlockingEventType = 'beforeCreate' | 'beforeSignIn';

const EVENT_MAPPING: Record<string, string> = {
Expand Down