From 54a397cce086aa12a14c9903b0983b2f9ffc7cec Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Tue, 7 Apr 2020 15:07:05 -0700 Subject: [PATCH 1/2] Adding comments for Crashlytics handler. --- src/handler-builder.ts | 100 +++++++++++++++++++++++++++++++++++------ 1 file changed, 86 insertions(+), 14 deletions(-) diff --git a/src/handler-builder.ts b/src/handler-builder.ts index bc3b64785..cca512e14 100644 --- a/src/handler-builder.ts +++ b/src/handler-builder.ts @@ -51,10 +51,18 @@ export class HandlerBuilder { * Create a handler for HTTPS events. * `onRequest` handles an HTTPS request and has the same signature as an Express app. - * `exports.myFunction = functions.handler.https.onRequest((req, res) => { ... })` - + * + * @example + * ```javascript + * exports.myFunction = functions.handler.https.onRequest((req, res) => { ... }) + * ``` + * * `onCall` declares a callable function for clients to call using a Firebase SDK. - * `exports.myFunction = functions.handler.https.onCall((data, context) => { ... })` + * + * @example + * ```javascript + * exports.myFunction = functions.handler.https.onCall((data, context) => { ... }) + * ``` */ get https() { return { @@ -82,16 +90,32 @@ export class HandlerBuilder { * Create a handler for Realtime Database events. * * `ref.onCreate` handles new data creation. - * `exports.myFunction = functions.handler.database.ref.onCreate((snap, context) => { ... })` - + * + * @example + * ```javascript + * exports.myFunction = functions.handler.database.ref.onCreate((snap, context) => { ... }) + * ``` + * * `ref.onUpdate` handles data updates. - * `exports.myFunction = functions.handler.database.ref.onUpdate((change, context) => { ... })` - + * + * @example + * ```javascript + * exports.myFunction = functions.handler.database.ref.onUpdate((change, context) => { ... }) + * ``` + * `ref.onDelete` handles data deletion. - * `exports.myFunction = functions.handler.database.ref.onDelete((snap, context) => { ... })` - + * + * @example + * ```javascript + * exports.myFunction = functions.handler.database.ref.onDelete((snap, context) => { ... }) + * ``` + * `ref.onWrite` handles data creation, update, or deletion. - * `exports.myFunction = functions.handler.database.ref.onWrite((change, context) => { ... })` + * + * @example + * ```javascript + * exports.myFunction = functions.handler.database.ref.onWrite((change, context) => { ... }) + * ``` */ get database() { return { @@ -113,16 +137,34 @@ export class HandlerBuilder { * Create a handler for Firestore events. * * `document.onCreate` handles document creations. - * `exports.myFunction = functions.handler.firestore.document.onCreate((snap, context) => { ... })` + * + * @example + * ```javascript + * exports.myFunction = functions.handler.firestore.document.onCreate((snap, context) => { ... }) + * ``` * `document.onUpdate` handles document updates. - * `exports.myFunction = functions.handler.firestore.document.onUpdate((change, context) => { ... })` + * + * @example + * ```javascript + * exports.myFunction = functions.handler.firestore.document.onUpdate((change, context) => { ... }) + * ``` * `document.onDelete` handles document deletes. - * `exports.myFunction = functions.handler.firestore.document.onDelete((snap, context) => { ... })` + * + * @example + * ```javascript + * exports.myFunction = functions.handler.firestore.document.onDelete((snap, context) => + * { ... }) + * ``` * `document.onWrite` handles document creates, updates, and deletes. - * `exports.myFunction = functions.handler.firestore.document.onWrite((change, context) => { ... })` + * + * @example + * ```javascript + * exports.myFunction = functions.handler.firestore.document.onWrite((change, context) => + * { ... }) + * ``` */ get firestore() { return { @@ -140,6 +182,36 @@ export class HandlerBuilder { }; } + /** + * Create a handler for Crashlytics events. + + * `issue.onNew` handles events where the app experiences an issue for the first time. + + * @example + * ```javascript + * exports.myFunction = functions.handler.crashlytics.issue().onNew(async + * (issue) => { ... }) + * ``` + + * `issue.onRegressed` handles events where an issue reoccurs after it + * is closed in Crashlytics. + * + * @example + * ```javascript + * exports.myFunction = functions.handler.crashlytics.issue().onRegressed(async + * (issue) => { ... }) + * ``` + + * `issue.onVelocityAlert` handles events where a statistically significant number + * of sessions in a given build crash. + * + * @example + * ```javascript + * exports.myFunction = functions.handler.crashlytics.issue().onVelocityAlert(async + * (issue) => { ... }) + * ``` + + */ get crashlytics() { return { get issue() { From 3c5aacfa0ffd996974ec522222a321c539e4b5ff Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Tue, 7 Apr 2020 17:25:20 -0700 Subject: [PATCH 2/2] Removing parens for parameters per feedback. --- src/handler-builder.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/handler-builder.ts b/src/handler-builder.ts index cca512e14..0c5377718 100644 --- a/src/handler-builder.ts +++ b/src/handler-builder.ts @@ -189,7 +189,7 @@ export class HandlerBuilder { * @example * ```javascript - * exports.myFunction = functions.handler.crashlytics.issue().onNew(async + * exports.myFunction = functions.handler.crashlytics.issue.onNew(async * (issue) => { ... }) * ``` @@ -198,7 +198,7 @@ export class HandlerBuilder { * * @example * ```javascript - * exports.myFunction = functions.handler.crashlytics.issue().onRegressed(async + * exports.myFunction = functions.handler.crashlytics.issue.onRegressed(async * (issue) => { ... }) * ``` @@ -207,7 +207,7 @@ export class HandlerBuilder { * * @example * ```javascript - * exports.myFunction = functions.handler.crashlytics.issue().onVelocityAlert(async + * exports.myFunction = functions.handler.crashlytics.issue.onVelocityAlert(async * (issue) => { ... }) * ```