Skip to content

Commit 414ff0a

Browse files
authoredNov 21, 2023
Refreshing 1st gen reference and making some style and format tweaks. (#1490)
1 parent affa64d commit 414ff0a

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed
 

‎src/common/providers/identity.ts

+18-17
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,19 @@ const EVENT_MAPPING: Record<string, string> = {
6363
};
6464

6565
/**
66-
* The UserRecord passed to Cloud Functions is the same UserRecord that is returned by the Firebase Admin
67-
* SDK.
66+
* The `UserRecord` passed to Cloud Functions is the same
67+
* {@link https://firebase.google.com/docs/reference/admin/node/firebase-admin.auth.userrecord | UserRecord}
68+
* that is returned by the Firebase Admin SDK.
6869
*/
6970
export type UserRecord = auth.UserRecord;
7071

7172
/**
72-
* UserInfo that is part of the UserRecord
73+
* `UserInfo` that is part of the `UserRecord`.
7374
*/
7475
export type UserInfo = auth.UserInfo;
7576

7677
/**
77-
* Helper class to create the user metadata in a UserRecord object
78+
* Helper class to create the user metadata in a `UserRecord` object.
7879
*/
7980
export class UserRecordMetadata implements auth.UserMetadata {
8081
constructor(public creationTime: string, public lastSignInTime: string) {}
@@ -89,9 +90,9 @@ export class UserRecordMetadata implements auth.UserMetadata {
8990
}
9091

9192
/**
92-
* Helper function that creates a UserRecord Class from data sent over the wire.
93+
* Helper function that creates a `UserRecord` class from data sent over the wire.
9394
* @param wireData data sent over the wire
94-
* @returns an instance of UserRecord with correct toJSON functions
95+
* @returns an instance of `UserRecord` with correct toJSON functions
9596
*/
9697
export function userRecordConstructor(wireData: Record<string, unknown>): UserRecord {
9798
// Falsey values from the wire format proto get lost when converted to JSON, this adds them back.
@@ -157,7 +158,7 @@ export function userRecordConstructor(wireData: Record<string, unknown>): UserRe
157158
}
158159

159160
/**
160-
* User info that is part of the AuthUserRecord
161+
* User info that is part of the `AuthUserRecord`.
161162
*/
162163
export interface AuthUserInfo {
163164
/**
@@ -237,7 +238,7 @@ export interface AuthMultiFactorSettings {
237238
}
238239

239240
/**
240-
* The UserRecord passed to auth blocking Cloud Functions from the identity platform.
241+
* The `UserRecord` passed to auth blocking functions from the identity platform.
241242
*/
242243
export interface AuthUserRecord {
243244
/**
@@ -334,7 +335,7 @@ export interface AuthEventContext extends EventContext {
334335
credential?: Credential;
335336
}
336337

337-
/** Defines the auth event for v2 blocking events */
338+
/** Defines the auth event for 2nd gen blocking events */
338339
export interface AuthBlockingEvent extends AuthEventContext {
339340
data: AuthUserRecord;
340341
}
@@ -344,7 +345,7 @@ export interface AuthBlockingEvent extends AuthEventContext {
344345
*/
345346
export type RecaptchaActionOptions = "ALLOW" | "BLOCK";
346347

347-
/** The handler response type for beforeCreate blocking events */
348+
/** The handler response type for `beforeCreate` blocking events */
348349
export interface BeforeCreateResponse {
349350
displayName?: string;
350351
disabled?: boolean;
@@ -354,7 +355,7 @@ export interface BeforeCreateResponse {
354355
recaptchaActionOverride?: RecaptchaActionOptions;
355356
}
356357

357-
/** The handler response type for beforeSignIn blocking events */
358+
/** The handler response type for `beforeSignIn` blocking events */
358359
export interface BeforeSignInResponse extends BeforeCreateResponse {
359360
sessionClaims?: object;
360361
}
@@ -472,7 +473,7 @@ type HandlerV2 = (
472473
| Promise<void>;
473474

474475
/**
475-
* Checks for a valid identity platform web request, otherwise throws an HttpsError
476+
* Checks for a valid identity platform web request, otherwise throws an HttpsError.
476477
* @internal
477478
*/
478479
export function isValidRequest(req: express.Request): boolean {
@@ -508,7 +509,7 @@ function unsafeDecodeAuthBlockingToken(token: string): DecodedPayload {
508509
}
509510

510511
/**
511-
* Helper function to parse the decoded metadata object into a UserMetaData object
512+
* Helper function to parse the decoded metadata object into a `UserMetaData` object
512513
* @internal
513514
*/
514515
export function parseMetadata(metadata: DecodedPayloadUserRecordMetadata): AuthUserMetadata {
@@ -525,7 +526,7 @@ export function parseMetadata(metadata: DecodedPayloadUserRecordMetadata): AuthU
525526
}
526527

527528
/**
528-
* Helper function to parse the decoded user info array into an AuthUserInfo array
529+
* Helper function to parse the decoded user info array into an `AuthUserInfo` array.
529530
* @internal
530531
*/
531532
export function parseProviderData(
@@ -546,7 +547,7 @@ export function parseProviderData(
546547
}
547548

548549
/**
549-
* Helper function to parse the date into a UTC string
550+
* Helper function to parse the date into a UTC string.
550551
* @internal
551552
*/
552553
export function parseDate(tokensValidAfterTime?: number): string | null {
@@ -639,7 +640,7 @@ export function parseAuthUserRecord(
639640
};
640641
}
641642

642-
/** Helper to get the AdditionalUserInfo from the decoded jwt */
643+
/** Helper to get the `AdditionalUserInfo` from the decoded JWT */
643644
function parseAdditionalUserInfo(decodedJWT: DecodedPayload): AdditionalUserInfo {
644645
let profile;
645646
let username;
@@ -697,7 +698,7 @@ export function generateResponsePayload(
697698
return result;
698699
}
699700

700-
/** Helper to get the Credential from the decoded jwt */
701+
/** Helper to get the Credential from the decoded JWT */
701702
function parseAuthCredential(decodedJWT: DecodedPayload, time: number): Credential {
702703
if (
703704
!decodedJWT.sign_in_attributes &&

‎src/common/providers/tasks.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ export interface TaskContext {
9898
/**
9999
* The "short" name of the task, or, if no name was specified at creation, a unique
100100
* system-generated id.
101-
* This is the my-task-id value in the complete task name, ie, task_name =
102-
* projects/my-project-id/locations/my-location/queues/my-queue-id/tasks/my-task-id.
101+
* This is the "my-task-id" value in the complete task name, such as "task_name =
102+
* projects/my-project-id/locations/my-location/queues/my-queue-id/tasks/my-task-id."
103103
* Populated via the `X-CloudTasks-TaskName` header.
104104
*/
105105
id: string;

‎src/v1/function-configuration.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ export interface RuntimeOptions {
252252
*
253253
* @remarks
254254
* Set this to true to enable the App Check replay protection feature by consuming the App Check token on callable
255-
* request. Tokens that are found to be already consumed will have request.app.alreadyConsumed property set true.
255+
* request. Tokens that are found to be already consumed will have the `request.app.alreadyConsumed` property set
256+
* to true.
256257
*
257258
*
258259
* Tokens are only considered to be consumed if it is sent to the App Check service by setting this option to true.
@@ -263,10 +264,10 @@ export interface RuntimeOptions {
263264
* performance and can potentially deplete your attestation providers' quotas faster. Use this feature only for
264265
* protecting low volume, security critical, or expensive operations.
265266
*
266-
* This option does not affect the enforceAppCheck option. Setting the latter to true will cause the callable function
267-
* to automatically respond with a 401 Unauthorized status code when request includes an invalid App Check token.
268-
* When request includes valid but consumed App Check tokens, requests will not be automatically rejected. Instead,
269-
* the request.app.alreadyConsumed property will be set to true and pass the execution to the handler code for making
267+
* This option does not affect the `enforceAppCheck` option. Setting the latter to true will cause the callable function
268+
* to automatically respond with a 401 Unauthorized status code when the request includes an invalid App Check token.
269+
* When the request includes valid but consumed App Check tokens, requests will not be automatically rejected. Instead,
270+
* the `request.app.alreadyConsumed` property will be set to true and pass the execution to the handler code for making
270271
* further decisions, such as requiring additional security checks or rejecting the request.
271272
*/
272273
consumeAppCheckToken?: boolean;

0 commit comments

Comments
 (0)
Please sign in to comment.