Skip to content

Commit 92aa571

Browse files
authored
Move some types to interfaces; inline interfaces to make fields private (#1113)
* Move some types to interfaces; inline interfaces to make fields private * Run formatter
1 parent 6709467 commit 92aa571

File tree

3 files changed

+66
-47
lines changed

3 files changed

+66
-47
lines changed

docgen/toc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
import { writeFileSync } from 'fs';
2222
import { resolve } from 'path';
2323

24-
import yargs from 'yargs';
25-
import * as yaml from 'js-yaml';
2624
import { FileSystem } from '@rushstack/node-core-library';
25+
import * as yaml from 'js-yaml';
26+
import yargs from 'yargs';
2727

2828
export interface TocGenerationOptions {
2929
inputFolder: string;

src/cloud-functions.ts

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -257,45 +257,33 @@ export interface Resource {
257257
}
258258

259259
/**
260-
* @hidden
261-
* TriggerAnnotated is used internally by the firebase CLI to understand what
260+
* TriggerAnnotion is used internally by the firebase CLI to understand what
262261
* type of Cloud Function to deploy.
263262
*/
264-
export interface TriggerAnnotated {
265-
__trigger: {
266-
availableMemoryMb?: number;
267-
blockingTrigger?: {
268-
eventType: string;
269-
options?: Record<string, unknown>;
270-
};
271-
eventTrigger?: {
272-
eventType: string;
273-
resource: string;
274-
service: string;
275-
};
276-
failurePolicy?: FailurePolicy;
277-
httpsTrigger?: {
278-
invoker?: string[];
279-
};
280-
labels?: { [key: string]: string };
281-
regions?: string[];
282-
schedule?: Schedule;
283-
timeout?: Duration;
284-
vpcConnector?: string;
285-
vpcConnectorEgressSettings?: string;
286-
serviceAccountEmail?: string;
287-
ingressSettings?: string;
288-
secrets?: string[];
263+
interface TriggerAnnotation {
264+
availableMemoryMb?: number;
265+
blockingTrigger?: {
266+
eventType: string;
267+
options?: Record<string, unknown>;
289268
};
290-
}
291-
292-
/**
293-
* @hidden
294-
* EndpointAnnotated is used to generate the manifest that conforms to the container contract.
295-
*/
296-
export interface EndpointAnnotated {
297-
__endpoint: ManifestEndpoint;
298-
__requiredAPIs?: ManifestRequiredAPI[];
269+
eventTrigger?: {
270+
eventType: string;
271+
resource: string;
272+
service: string;
273+
};
274+
failurePolicy?: FailurePolicy;
275+
httpsTrigger?: {
276+
invoker?: string[];
277+
};
278+
labels?: { [key: string]: string };
279+
regions?: string[];
280+
schedule?: Schedule;
281+
timeout?: Duration;
282+
vpcConnector?: string;
283+
vpcConnectorEgressSettings?: string;
284+
serviceAccountEmail?: string;
285+
ingressSettings?: string;
286+
secrets?: string[];
299287
}
300288

301289
/**
@@ -315,14 +303,34 @@ export interface Runnable<T> {
315303
* [`Response`](https://expressjs.com/en/api.html#res) objects as its only
316304
* arguments.
317305
*/
318-
export type HttpsFunction = TriggerAnnotated &
319-
EndpointAnnotated &
320-
((req: Request, resp: Response) => void | Promise<void>);
306+
export interface HttpsFunction {
307+
(req: Request, resp: Response): void | Promise<void>;
308+
309+
/** @alpha */
310+
__trigger: TriggerAnnotation;
311+
312+
/** @alpha */
313+
__endpoint: ManifestEndpoint;
314+
315+
/** @alpha */
316+
__requiredAPIs?: ManifestRequiredAPI[];
317+
}
321318

322319
/**
323320
* The Cloud Function type for Blocking triggers.
324321
*/
325-
export type BlockingFunction = HttpsFunction;
322+
export interface BlockingFunction {
323+
(req: Request, resp: Response): void | Promise<void>;
324+
325+
/** @alpha */
326+
__trigger: TriggerAnnotation;
327+
328+
/** @alpha */
329+
__endpoint: ManifestEndpoint;
330+
331+
/** @alpha */
332+
__requiredAPIs?: ManifestRequiredAPI[];
333+
}
326334

327335
/**
328336
* The Cloud Function type for all non-HTTPS triggers. This should be exported
@@ -331,10 +339,18 @@ export type BlockingFunction = HttpsFunction;
331339
* This type is a special JavaScript function which takes a templated
332340
* `Event` object as its only argument.
333341
*/
334-
export type CloudFunction<T> = Runnable<T> &
335-
TriggerAnnotated &
336-
EndpointAnnotated &
337-
((input: any, context?: any) => PromiseLike<any> | any);
342+
export interface CloudFunction<T> extends Runnable<T> {
343+
(input: any, context?: any): PromiseLike<any> | any;
344+
345+
/** @alpha */
346+
__trigger: TriggerAnnotation;
347+
348+
/** @alpha */
349+
__endpoint: ManifestEndpoint;
350+
351+
/** @alpha */
352+
__requiredAPIs?: ManifestRequiredAPI[];
353+
}
338354

339355
/** @hidden */
340356
export interface MakeCloudFunctionArgs<EventData> {

src/common/providers/identity.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ const DISALLOWED_CUSTOM_CLAIMS = [
5050

5151
const CLAIMS_MAX_PAYLOAD_SIZE = 1000;
5252

53-
/** Shorthand auth blocking events from GCIP. */
53+
/**
54+
* Shorthand auth blocking events from GCIP.
55+
* @internal
56+
*/
5457
export type AuthBlockingEventType = 'beforeCreate' | 'beforeSignIn';
5558

5659
const EVENT_MAPPING: Record<string, string> = {

0 commit comments

Comments
 (0)