Skip to content

Fix namespace v1 docs #1204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/common/providers/https.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { TaskContext } from "./tasks";

const JWT_REGEX = /^[a-zA-Z0-9\-_=]+?\.[a-zA-Z0-9\-_=]+?\.([a-zA-Z0-9\-_=]+)?$/;

/** @hidden */
/** An express request with the wire format representation of the request body. */
export interface Request extends express.Request {
/** The wire format representation of the request body. */
rawBody: Buffer;
Expand Down Expand Up @@ -121,9 +121,9 @@ export interface CallableRequest<T = any> {

/**
* The set of Firebase Functions status codes. The codes are the same at the
* ones exposed by gRPC here:
* https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
* ones exposed by {@link https://github.com/grpc/grpc/blob/master/doc/statuscodes.md | gRPC}.
*
* @remarks
* Possible values:
*
* - `cancelled`: The operation was cancelled (typically by the caller).
Expand Down Expand Up @@ -527,7 +527,7 @@ export function unsafeDecodeAppCheckToken(token: string): DecodedAppCheckToken {
*
* @param {Request} req - Request sent to the Callable function.
* @param {CallableContext} ctx - Context to be sent to callable function handler.
* @return {CallableTokenStatus} Status of the token verifications.
* @returns {CallableTokenStatus} Status of the token verifications.
*/
/** @internal */
async function checkTokens(req: Request, ctx: CallableContext): Promise<CallableTokenStatus> {
Expand Down
1 change: 1 addition & 0 deletions src/v1/cloud-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export interface Resource {
* function - useful for unit testing.
*/
export interface Runnable<T> {
/** Directly invoke the user defined function. */
run: (data: T, context: any) => PromiseLike<any> | any;
}

Expand Down
5 changes: 1 addition & 4 deletions src/v1/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ export { firebaseConfig } from "../common/config";

let singleton: Record<string, any>;

/**
* @hidden
* @internal
*/
/** @internal */
export function resetCache(): void {
singleton = undefined;
}
Expand Down
12 changes: 6 additions & 6 deletions src/v1/providers/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import { CloudFunction, Event, EventContext, makeCloudFunction } from "../cloud-functions";
import { DeploymentOptions } from "../function-configuration";

/** @hidden */
/** @internal */
export const provider = "google.analytics";
/** @hidden */
/** @internal */
export const service = "app-measurement.com";

/**
Expand All @@ -34,13 +34,13 @@ export const service = "app-measurement.com";
* @param analyticsEventType Name of the analytics event type to which
* this Cloud Function is scoped.
*
* @return Analytics event builder interface.
* @returns Analytics event builder interface.
*/
export function event(analyticsEventType: string) {
return _eventWithOptions(analyticsEventType, {});
}

/** @hidden */
/** @internal */
export function _eventWithOptions(analyticsEventType: string, options: DeploymentOptions) {
return new AnalyticsEventBuilder(() => {
if (!process.env.GCLOUD_PROJECT) {
Expand All @@ -53,7 +53,7 @@ export function _eventWithOptions(analyticsEventType: string, options: Deploymen
/**
* The Firebase Analytics event builder interface.
*
* Access via [`functions.analytics.event()`](functions.analytics#.event).
* Access via `functions.analytics.event()`.
*/
export class AnalyticsEventBuilder {
/** @hidden */
Expand All @@ -65,7 +65,7 @@ export class AnalyticsEventBuilder {
* @param handler Event handler that fires every time a Firebase Analytics event
* occurs.
*
* @return A function that you can export and deploy.
* @returns A function that you can export and deploy.
*/
onLog(
handler: (event: AnalyticsEvent, context: EventContext) => PromiseLike<any> | any
Expand Down
4 changes: 2 additions & 2 deletions src/v1/providers/https.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function onCall(
return _onCallWithOptions(handler, {});
}

/** @hidden */
/** @internal */
export function _onRequestWithOptions(
handler: (req: Request, resp: express.Response) => void | Promise<void>,
options: DeploymentOptions
Expand All @@ -82,7 +82,7 @@ export function _onRequestWithOptions(
return cloudFunction;
}

/** @hidden */
/** @internal */
export function _onCallWithOptions(
handler: (data: any, context: CallableContext) => any | Promise<any>,
options: DeploymentOptions
Expand Down
20 changes: 10 additions & 10 deletions src/v1/providers/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import { CloudFunction, EventContext, makeCloudFunction } from "../cloud-functions";
import { DeploymentOptions, ScheduleRetryConfig } from "../function-configuration";

/** @hidden */
/** @internal */
export const provider = "google.pubsub";
/** @hidden */
/** @internal */
export const service = "pubsub.googleapis.com";

/**
Expand All @@ -39,7 +39,7 @@ export function topic(topic: string) {
return _topicWithOptions(topic, {});
}

/** @hidden */
/** @internal */
export function _topicWithOptions(topic: string, options: DeploymentOptions): TopicBuilder {
if (topic.indexOf("/") !== -1) {
throw new Error("Topic name may not have a /");
Expand All @@ -56,7 +56,7 @@ export function _topicWithOptions(topic: string, options: DeploymentOptions): To
/**
* The Google Cloud Pub/Sub topic builder.
*
* Access via [`functions.pubsub.topic()`](providers_pubsub_.html#topic).
* Access via `functions.pubsub.topic()`.
*/
export class TopicBuilder {
/** @hidden */
Expand All @@ -68,7 +68,7 @@ export class TopicBuilder {
*
* @param handler - Event handler that runs every time a Cloud Pub/Sub message
* is published.
* @return A Cloud Function that you can export and deploy.
* @returns A Cloud Function that you can export and deploy.
*/
onPublish(
handler: (message: Message, context: EventContext) => PromiseLike<any> | any
Expand All @@ -89,13 +89,13 @@ export class TopicBuilder {
* Registers a Cloud Function to run at specified times.
*
* @param schedule - The schedule, in Unix Crontab or AppEngine syntax.
* @return ScheduleBuilder interface.
* @returns ScheduleBuilder interface.
*/
export function schedule(schedule: string): ScheduleBuilder {
return _scheduleWithOptions(schedule, {});
}

/** @hidden */
/** @internal */
export function _scheduleWithOptions(
schedule: string,
options: DeploymentOptions
Expand All @@ -120,7 +120,7 @@ export function _scheduleWithOptions(
* frequency. For more information, see
* [Schedule functions](/docs/functions/schedule-functions).
*
* Access via [`functions.pubsub.schedule()`](providers_pubsub_.html#schedule).
* Access via `functions.pubsub.schedule()`.
*/
export class ScheduleBuilder {
/** @hidden */
Expand All @@ -142,7 +142,7 @@ export class ScheduleBuilder {
*
* @param handler - Handler that fires whenever the associated
* scheduler job sends a Pub/Sub message.
* @return A Cloud Function that you can export and deploy.
* @returns A Cloud Function that you can export and deploy.
*/
onRun(handler: (context: EventContext) => PromiseLike<any> | any) {
const cloudFunction = makeCloudFunction({
Expand Down Expand Up @@ -195,7 +195,7 @@ export class Message {
/**
* Returns a JSON-serializable representation of this object.
*
* @return A JSON-serializable representation of this object.
* @returns A JSON-serializable representation of this object.
*/
toJSON(): any {
return {
Expand Down
32 changes: 16 additions & 16 deletions src/v1/providers/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import { firebaseConfig } from "../../common/config";
import { CloudFunction, EventContext, makeCloudFunction } from "../cloud-functions";
import { DeploymentOptions } from "../function-configuration";

/** @hidden */
/** @internal */
export const provider = "google.storage";
/** @hidden */
/** @internal */
export const service = "storage.googleapis.com";

/**
Expand All @@ -35,7 +35,7 @@ export const service = "storage.googleapis.com";
* @param bucket Name of the bucket to which this Cloud Function is
* scoped.
*
* @return Storage bucket builder interface.
* @returns Storage bucket builder interface.
*/
export function bucket(bucket?: string) {
return _bucketWithOptions({}, bucket);
Expand All @@ -45,13 +45,13 @@ export function bucket(bucket?: string) {
* Registers a Cloud Function scoped to the default storage bucket for the
* project.
*
* @return Storage object builder interface.
* @returns Storage object builder interface.
*/
export function object() {
return _objectWithOptions({});
}

/** @hidden */
/** @internal */
export function _bucketWithOptions(options: DeploymentOptions, bucket?: string): BucketBuilder {
const resourceGetter = () => {
bucket = bucket || firebaseConfig().storageBucket;
Expand All @@ -69,24 +69,24 @@ export function _bucketWithOptions(options: DeploymentOptions, bucket?: string):
return new BucketBuilder(resourceGetter, options);
}

/** @hidden */
/** @internal */
export function _objectWithOptions(options: DeploymentOptions): ObjectBuilder {
return _bucketWithOptions(options).object();
}

/**
* The Google Cloud Storage bucket builder interface.
*
* Access via [`functions.storage.bucket()`](providers_storage_.html#bucket).
* Access via `functions.storage.bucket()`.
*/
export class BucketBuilder {
/** @hidden */
/** @internal */
constructor(private triggerResource: () => string, private options: DeploymentOptions) {}

/**
* Event handler which fires every time a Google Cloud Storage change occurs.
*
* @return Storage object builder interface scoped to the specified storage
* @returns Storage object builder interface scoped to the specified storage
* bucket.
*/
object() {
Expand All @@ -97,13 +97,13 @@ export class BucketBuilder {
/**
* The Google Cloud Storage object builder interface.
*
* Access via [`functions.storage.object()`](providers_storage_.html#object).
* Access via `functions.storage.object()`.
*/
export class ObjectBuilder {
/** @hidden */
/** @internal */
constructor(private triggerResource: () => string, private options: DeploymentOptions) {}

/** @hidden */
/** @internal */
onChange(): Error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this in launch.next?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 #1220

throw new Error(
'"onChange" is now deprecated, please use "onArchive", "onDelete", ' +
Expand All @@ -120,7 +120,7 @@ export class ObjectBuilder {
* @param handler Event handler which is run every time a Google Cloud Storage
* archival occurs.
*
* @return A Cloud Function which you can export and deploy.
* @returns A Cloud Function which you can export and deploy.
*/
onArchive(
handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any
Expand All @@ -140,7 +140,7 @@ export class ObjectBuilder {
* @param handler Event handler which is run every time a Google Cloud Storage
* deletion occurs.
*
* @return A Cloud Function which you can export and deploy.
* @returns A Cloud Function which you can export and deploy.
*/
onDelete(
handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any
Expand All @@ -159,7 +159,7 @@ export class ObjectBuilder {
* @param handler Event handler which is run every time a Google Cloud Storage
* object creation occurs.
*
* @return A Cloud Function which you can export and deploy.
* @returns A Cloud Function which you can export and deploy.
*/
onFinalize(
handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any
Expand All @@ -174,7 +174,7 @@ export class ObjectBuilder {
* @param handler Event handler which is run every time a Google Cloud Storage
* metadata update occurs.
*
* @return A Cloud Function which you can export and deploy.
* @returns A Cloud Function which you can export and deploy.
*/
onMetadataUpdate(
handler: (object: ObjectMetadata, context: EventContext) => PromiseLike<any> | any
Expand Down