Skip to content

Commit ba368e8

Browse files
authored
Adding some format and style edits for common or top-level reference pages. (#1438)
1 parent aa55ea6 commit ba368e8

File tree

4 files changed

+42
-38
lines changed

4 files changed

+42
-38
lines changed

src/common/change.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// SOFTWARE.
2222

2323
/**
24-
* `ChangeJson` is the JSON format used to construct a Change object.
24+
* `ChangeJson` is the JSON format used to construct a `Change` object.
2525
*/
2626
export interface ChangeJson {
2727
/**
@@ -64,24 +64,24 @@ export function applyFieldMask(sparseBefore: any, after: any, fieldMask: string)
6464
}
6565

6666
/**
67-
* The Functions interface for events that change state, such as
68-
* Realtime Database or Cloud Firestore `onWrite` and `onUpdate`.
67+
* The Cloud Functions interface for events that change state, such as
68+
* Realtime Database or Cloud Firestore `onWrite` and `onUpdate` events.
6969
*
7070
* For more information about the format used to construct `Change` objects, see
7171
* {@link ChangeJson} below.
7272
*
7373
*/
7474
export class Change<T> {
7575
/**
76-
* Factory method for creating a Change from a `before` object and an `after`
76+
* Factory method for creating a `Change` from a `before` object and an `after`
7777
* object.
7878
*/
7979
static fromObjects<T>(before: T, after: T) {
8080
return new Change(before, after);
8181
}
8282

8383
/**
84-
* Factory method for creating a Change from a JSON and an optional customizer
84+
* Factory method for creating a `Change` from JSON and an optional customizer
8585
* function to be applied to both the `before` and the `after` fields.
8686
*/
8787
static fromJSON<T>(json: ChangeJson, customizer: (x: any) => T = (x) => x as T): Change<T> {

src/v2/core.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// SOFTWARE.
2222

2323
/**
24-
* Core functionality of the Firebase Functions v2 SDK.
24+
* Core functionality of the Cloud Functions for Firebase 2nd gen SDK.
2525
* @packageDocumentation
2626
*/
2727

@@ -64,8 +64,8 @@ export interface TriggerAnnotation {
6464
}
6565

6666
/**
67-
* A CloudEventBase is the base of a cross-platform format for encoding a serverless event.
68-
* More information can be found in https://github.com/cloudevents/spec
67+
* A `CloudEventBase` is the base of a cross-platform format for encoding a serverless event.
68+
* For more information, see https://github.com/cloudevents/spec.
6969
* @typeParam T - The type of the event data.
7070
* @beta
7171
*/
@@ -76,10 +76,10 @@ export interface CloudEvent<T> {
7676
/** A globally unique ID for this event. */
7777
id: string;
7878

79-
/** The resource which published this event. */
79+
/** The resource that published this event. */
8080
source: string;
8181

82-
/** The resource, provided by source, that this event relates to */
82+
/** The resource, provided by source, that this event relates to. */
8383
subject?: string;
8484

8585
/** The type of event that this represents. */
@@ -107,10 +107,10 @@ export interface CloudFunction<EventType extends CloudEvent<unknown>> {
107107
__endpoint: ManifestEndpoint;
108108

109109
/**
110-
* The callback passed to the CloudFunction constructor.
111-
* Use run to test a CloudFunction
110+
* The callback passed to the `CloudFunction` constructor.
111+
* Use `run` to test a function.
112112
* @param event - The parsed event to handle.
113-
* @returns Any return value. Google Cloud Functions awaits any promise
113+
* @returns Any return value. Cloud Functions awaits any promise
114114
* before shutting down your function. Resolved return values
115115
* are only used for unit testing purposes.
116116
* @beta

src/v2/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
// SOFTWARE.
2222

2323
/**
24-
* The V2 API for Cloud Functions for Firebase.
25-
* This SDK also supports deep imports. For example, the namespace
26-
* 'pubsub' is available at 'firebase-functions/v2' or is directly importable
27-
* from 'firebase-functions/v2/pubsub'.
24+
* The 2nd gen API for Cloud Functions for Firebase.
25+
* This SDK supports deep imports. For example, the namespace
26+
* `pubsub` is available at `firebase-functions/v2` or is directly importable
27+
* from `firebase-functions/v2/pubsub`.
2828
* @packageDocumentation
2929
*/
3030

src/v2/options.ts

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import * as logger from "../logger";
4242
export { RESET_VALUE } from "../common/options";
4343

4444
/**
45-
* List of all regions supported by Cloud Functions v2
45+
* List of all regions supported by Cloud Functions (2nd gen).
4646
*/
4747
export type SupportedRegion =
4848
| "asia-east1"
@@ -98,18 +98,18 @@ const MemoryOptionToMB: Record<MemoryOption, number> = {
9898
};
9999

100100
/**
101-
* List of available options for VpcConnectorEgressSettings.
101+
* List of available options for `VpcConnectorEgressSettings`.
102102
*/
103103
export type VpcEgressSetting = "PRIVATE_RANGES_ONLY" | "ALL_TRAFFIC";
104104

105105
/**
106-
* List of available options for IngressSettings.
106+
* List of available options for `IngressSettings`.
107107
*/
108108
export type IngressSetting = "ALLOW_ALL" | "ALLOW_INTERNAL_ONLY" | "ALLOW_INTERNAL_AND_GCLB";
109109

110110
/**
111-
* GlobalOptions are options that can be set across an entire project.
112-
* These options are common to HTTPS and Event handling functions.
111+
* `GlobalOptions` are options that can be set across an entire project.
112+
* These options are common to HTTPS and event handling functions.
113113
*/
114114
export interface GlobalOptions {
115115
/**
@@ -132,33 +132,33 @@ export interface GlobalOptions {
132132
* HTTPS functions can specify a higher timeout.
133133
*
134134
* @remarks
135-
* The minimum timeout for a gen 2 function is 1s. The maximum timeout for a
135+
* The minimum timeout for a 2nd gen function is 1s. The maximum timeout for a
136136
* function depends on the type of function: Event handling functions have a
137137
* maximum timeout of 540s (9 minutes). HTTPS and callable functions have a
138138
* maximum timeout of 36,00s (1 hour). Task queue functions have a maximum
139-
* timeout of 1,800s (30 minutes)
139+
* timeout of 1,800s (30 minutes).
140140
*/
141141
timeoutSeconds?: number | Expression<number> | ResetValue;
142142

143143
/**
144-
* Min number of actual instances to be running at a given time.
144+
* Minimum number of actual instances to be running at a given time.
145145
*
146146
* @remarks
147-
* Instances will be billed for memory allocation and 10% of CPU allocation
147+
* Instances are billed for memory allocation and 10% of CPU allocation
148148
* while idle.
149149
*/
150150
minInstances?: number | Expression<number> | ResetValue;
151151

152152
/**
153-
* Max number of instances to be running in parallel.
153+
* Max number of instances that can be running in parallel.
154154
*/
155155
maxInstances?: number | Expression<number> | ResetValue;
156156

157157
/**
158158
* Number of requests a function can serve at once.
159159
*
160160
* @remarks
161-
* Can only be applied to functions running on Cloud Functions v2.
161+
* Can be applied only to functions running on Cloud Functions (2nd gen)).
162162
* A value of null restores the default concurrency (80 when CPU >= 1, 1 otherwise).
163163
* Concurrency cannot be set to any value other than 1 if `cpu` is less than 1.
164164
* The maximum value for concurrency is 1,000.
@@ -171,14 +171,14 @@ export interface GlobalOptions {
171171
* @remarks
172172
* Defaults to 1 for functions with <= 2GB RAM and increases for larger memory sizes.
173173
* This is different from the defaults when using the gcloud utility and is different from
174-
* the fixed amount assigned in Google Cloud Functions generation 1.
175-
* To revert to the CPU amounts used in gcloud or in Cloud Functions generation 1, set this
174+
* the fixed amount assigned in Cloud Functions (1st gen).
175+
* To revert to the CPU amounts used in gcloud or in Cloud Functions (1st gen), set this
176176
* to the value "gcf_gen1"
177177
*/
178178
cpu?: number | "gcf_gen1";
179179

180180
/**
181-
* Connect cloud function to specified VPC connector.
181+
* Connect a function to a specified VPC connector.
182182
*/
183183
vpcConnector?: string | Expression<string> | ResetValue;
184184

@@ -198,7 +198,7 @@ export interface GlobalOptions {
198198
ingressSettings?: IngressSetting | ResetValue;
199199

200200
/**
201-
* Invoker to set access control on https functions.
201+
* Invoker to set access control on HTTPS functions.
202202
*/
203203
invoker?: "public" | "private" | string | string[];
204204

@@ -213,21 +213,21 @@ export interface GlobalOptions {
213213
secrets?: (string | SecretParam)[];
214214

215215
/**
216-
* Determines whether Firebase AppCheck is enforced. Defaults to false.
216+
* Determines whether Firebase App Check is enforced. Defaults to false.
217217
*
218218
* @remarks
219219
* When true, requests with invalid tokens autorespond with a 401
220220
* (Unauthorized) error.
221-
* When false, requests with invalid tokens set event.app to undefined.
221+
* When false, requests with invalid tokens set `event.app` to `undefined`.
222222
*/
223223
enforceAppCheck?: boolean;
224224

225225
/**
226226
* Controls whether function configuration modified outside of function source is preserved. Defaults to false.
227227
*
228228
* @remarks
229-
* When setting configuration available in the underlying platform that is not yet available in the Firebase Functions
230-
* SDK, we highly recommend setting `preserveExternalChanges` to `true`. Otherwise, when the Firebase Functions SDK releases
229+
* When setting configuration available in an underlying platform that is not yet available in the Firebase SDK
230+
* for Cloud Functions, we recommend setting `preserveExternalChanges` to `true`. Otherwise, when Google releases
231231
* a new version of the SDK with support for the missing configuration, your function's manually configured setting
232232
* may inadvertently be wiped out.
233233
*/
@@ -237,7 +237,7 @@ export interface GlobalOptions {
237237
let globalOptions: GlobalOptions | undefined;
238238

239239
/**
240-
* Sets default options for all functions written using the v2 SDK.
240+
* Sets default options for all functions written using the 2nd gen SDK.
241241
* @param options Options to set as default
242242
*/
243243
export function setGlobalOptions(options: GlobalOptions) {
@@ -257,12 +257,16 @@ export function getGlobalOptions(): GlobalOptions {
257257
}
258258

259259
/**
260-
* Additional fields that can be set on any event-handling Cloud Function.
260+
* Additional fields that can be set on any event-handling function.
261261
*/
262262
export interface EventHandlerOptions extends Omit<GlobalOptions, "enforceAppCheck"> {
263+
/** Type of the event. Valid values are TODO */
263264
eventType?: string;
264265

266+
/** TODO */
265267
eventFilters?: Record<string, string | Expression<string>>;
268+
269+
/** TODO */
266270
eventFilterPathPatterns?: Record<string, string | Expression<string>>;
267271

268272
/** Whether failed executions should be delivered again. */

0 commit comments

Comments
 (0)