From 838befe7387aa0f265519dca90ee08c86afcd383 Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Thu, 14 May 2020 14:32:55 -0700 Subject: [PATCH 1/6] Updating home page. --- docgen/content-sources/HOME.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docgen/content-sources/HOME.md b/docgen/content-sources/HOME.md index c89df0a57..00d2090a0 100644 --- a/docgen/content-sources/HOME.md +++ b/docgen/content-sources/HOME.md @@ -1,3 +1,8 @@ # Firebase Functions SDK Reference -Functions SDK!!! +The `firebase-functions` package provides an SDK for defining Cloud Functions for Firebase. + +To get started using Cloud Functions, see +[Get started: write, test, and deploy your first functions](/docs/functions/get-started). + +For source code, see the [Cloud Functions for Firebase GitHub repo](https://github.com/firebase/firebase-functions). From 853baa03bdc7ca61e89161cef6c713dfb9b80431 Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Thu, 14 May 2020 16:15:33 -0700 Subject: [PATCH 2/6] Attempting to hide API members for which we don't need to generate TypeDoc output. --- src/setup.ts | 1 + src/utilities/assertions.ts | 1 + src/utilities/path.ts | 1 + src/utils.ts | 1 + 4 files changed, 4 insertions(+) diff --git a/src/setup.ts b/src/setup.ts index 6a0796348..b30fa6226 100644 --- a/src/setup.ts +++ b/src/setup.ts @@ -20,6 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +/** @hidden */ import { firebaseConfig } from './config'; // Set up for config and vars diff --git a/src/utilities/assertions.ts b/src/utilities/assertions.ts index 49ff5e36d..ad487eb53 100644 --- a/src/utilities/assertions.ts +++ b/src/utilities/assertions.ts @@ -1,3 +1,4 @@ +/** @hidden */ /** * @file Provides common assertion helpers which can be used to improve * strictness of both type checking and runtime. diff --git a/src/utilities/path.ts b/src/utilities/path.ts index 40ab8f047..a45ad9416 100644 --- a/src/utilities/path.ts +++ b/src/utilities/path.ts @@ -1,3 +1,4 @@ +/** @hidden */ /** * Removes leading and trailing slashes from a path. * diff --git a/src/utils.ts b/src/utils.ts index b52c1e54f..e41b1e1fb 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,6 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +/** @hidden */ import * as _ from 'lodash'; export function applyChange(src: any, dest: any) { From 3a7773dddf6298db87ea973eb6785981b6f49c80 Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Sat, 23 May 2020 14:40:31 -0700 Subject: [PATCH 3/6] Having better success hiding internal API members now. --- src/providers/https.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/providers/https.ts b/src/providers/https.ts index 36077affd..067de39bd 100644 --- a/src/providers/https.ts +++ b/src/providers/https.ts @@ -28,6 +28,7 @@ import { apps } from '../apps'; import { HttpsFunction, optionsToTrigger, Runnable } from '../cloud-functions'; import { DeploymentOptions } from '../function-configuration'; +/** @hidden */ export interface Request extends express.Request { rawBody: Buffer; } @@ -180,6 +181,7 @@ const errorCodeMap: { [name in FunctionsErrorCode]: HttpErrorCode } = { 'data-loss': { canonicalName: 'DATA_LOSS', status: 500 }, }; +/** @hidden */ interface HttpErrorWireFormat { details?: unknown; message: string; @@ -262,6 +264,7 @@ export interface CallableContext { } // The allowed interface for an http request for a callable function. +/** @hidden*/ interface HttpRequest extends Request { body: { data: any; @@ -274,6 +277,7 @@ interface HttpResponseBody { error?: HttpsError; } +/** @hidden */ // Returns true if req is a properly formatted callable request. function isValidRequest(req: Request): req is HttpRequest { // The body must not be empty. @@ -317,7 +321,9 @@ function isValidRequest(req: Request): req is HttpRequest { return true; } +/** @hidden */ const LONG_TYPE = 'type.googleapis.com/google.protobuf.Int64Value'; +/** @hidden */ const UNSIGNED_LONG_TYPE = 'type.googleapis.com/google.protobuf.UInt64Value'; /** @@ -400,6 +406,7 @@ export function decode(data: any): any { return data; } +/** @hidden */ const corsHandler = cors({ origin: true, methods: 'POST' }); /** @hidden */ From ccb03f580ca284dd9a7ecbed6effb77286b61b9d Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Tue, 26 May 2020 12:11:04 -0700 Subject: [PATCH 4/6] Adding TOC entry for CallableContext and hiding undocumented interfaces. --- docgen/content-sources/toc.yaml | 2 ++ src/providers/https.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docgen/content-sources/toc.yaml b/docgen/content-sources/toc.yaml index 856b12640..91544d4f6 100644 --- a/docgen/content-sources/toc.yaml +++ b/docgen/content-sources/toc.yaml @@ -90,6 +90,8 @@ toc: section: - title: 'HttpsError' path: /docs/reference/functions/providers_https_.httpserror.html + - title: 'CallableContext' + path: /docs/reference/functions/providers_https_.callablecontext.html - title: 'functions.pubsub' path: /docs/reference/functions/providers_pubsub_.html diff --git a/src/providers/https.ts b/src/providers/https.ts index 067de39bd..effa8cdc2 100644 --- a/src/providers/https.ts +++ b/src/providers/https.ts @@ -147,6 +147,7 @@ export type CanonicalErrorCodeName = | 'UNAVAILABLE' | 'DATA_LOSS'; +/** @hidden */ interface HttpErrorCode { canonicalName: CanonicalErrorCodeName; status: number; @@ -271,6 +272,7 @@ interface HttpRequest extends Request { }; } +/** @hidden */ // The format for the http body response to a callable function. interface HttpResponseBody { result?: any; From 4cf2b85b9156c28759d42ba3aeeb1de58b87eb16 Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Wed, 27 May 2020 11:43:52 -0700 Subject: [PATCH 5/6] Adding fixes from review feedback. --- src/providers/https.ts | 3 ++- src/utilities/assertions.ts | 3 +-- src/utilities/path.ts | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/providers/https.ts b/src/providers/https.ts index effa8cdc2..003a03b8d 100644 --- a/src/providers/https.ts +++ b/src/providers/https.ts @@ -128,6 +128,7 @@ export type FunctionsErrorCode = | 'data-loss' | 'unauthenticated'; +/** @hidden */ export type CanonicalErrorCodeName = | 'OK' | 'CANCELLED' @@ -264,7 +265,7 @@ export interface CallableContext { rawRequest: Request; } -// The allowed interface for an http request for a callable function. +// The allowed interface for an HTTP request to a Callable function. /** @hidden*/ interface HttpRequest extends Request { body: { diff --git a/src/utilities/assertions.ts b/src/utilities/assertions.ts index ad487eb53..982ca304d 100644 --- a/src/utilities/assertions.ts +++ b/src/utilities/assertions.ts @@ -1,5 +1,4 @@ -/** @hidden */ -/** +/** @hidden * @file Provides common assertion helpers which can be used to improve * strictness of both type checking and runtime. */ diff --git a/src/utilities/path.ts b/src/utilities/path.ts index a45ad9416..33e187f9e 100644 --- a/src/utilities/path.ts +++ b/src/utilities/path.ts @@ -1,5 +1,4 @@ -/** @hidden */ -/** +/** @hidden * Removes leading and trailing slashes from a path. * * @param path A path to normalize, in POSIX format. From 1be5d56c7707cc47c24080f91a3ce3da4f70f4bd Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Wed, 27 May 2020 11:46:48 -0700 Subject: [PATCH 6/6] Missed one comment. --- src/providers/https.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/https.ts b/src/providers/https.ts index 003a03b8d..605c633f0 100644 --- a/src/providers/https.ts +++ b/src/providers/https.ts @@ -274,7 +274,7 @@ interface HttpRequest extends Request { } /** @hidden */ -// The format for the http body response to a callable function. +// The format for an HTTP body response from a Callable function. interface HttpResponseBody { result?: any; error?: HttpsError;