Skip to content

Commit e172f7a

Browse files
chore: udpate ts-doc annotations (#603)
1 parent 7a538e0 commit e172f7a

15 files changed

+85
-85
lines changed

docs/generated/api.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
{
176176
"kind": "Function",
177177
"canonicalReference": "@google-cloud/functions-framework!cloudEvent:function(1)",
178-
"docComment": "/**\n * Register a function that handles CloudEvents.\n *\n * @param functionName - the name of the function\n *\n * @param handler - the function to trigger when handling CloudEvents\n *\n * @public\n */\n",
178+
"docComment": "/**\n * Register a function that handles CloudEvents.\n *\n * @param functionName - The name of the function\n *\n * @param handler - The function to trigger when handling CloudEvents\n *\n * @public\n */\n",
179179
"excerptTokens": [
180180
{
181181
"kind": "Content",
@@ -949,7 +949,7 @@
949949
{
950950
"kind": "Function",
951951
"canonicalReference": "@google-cloud/functions-framework!http:function(1)",
952-
"docComment": "/**\n * Register a function that responds to HTTP requests.\n *\n * @param functionName - the name of the function\n *\n * @param handler - the function to invoke when handling HTTP requests\n *\n * @public\n */\n",
952+
"docComment": "/**\n * Register a function that responds to HTTP requests.\n *\n * @param functionName - The name of the function\n *\n * @param handler - The function to invoke when handling HTTP requests\n *\n * @public\n */\n",
953953
"excerptTokens": [
954954
{
955955
"kind": "Content",
@@ -1125,7 +1125,7 @@
11251125
{
11261126
"kind": "MethodSignature",
11271127
"canonicalReference": "@google-cloud/functions-framework!InvocationFormat#deserializeRequest:member(1)",
1128-
"docComment": "/**\n * Creates an instance of the request type from an invocation request.\n *\n * @param request - the request body as raw bytes\n */\n",
1128+
"docComment": "/**\n * Creates an instance of the request type from an invocation request.\n *\n * @param request - The request body as raw bytes\n */\n",
11291129
"excerptTokens": [
11301130
{
11311131
"kind": "Content",
@@ -1180,7 +1180,7 @@
11801180
{
11811181
"kind": "MethodSignature",
11821182
"canonicalReference": "@google-cloud/functions-framework!InvocationFormat#serializeResponse:member(1)",
1183-
"docComment": "/**\n * Writes the response type to the invocation result.\n *\n * @param responseWriter - interface for writing to the invocation result\n *\n * @param response - the response object\n */\n",
1183+
"docComment": "/**\n * Writes the response type to the invocation result.\n *\n * @param responseWriter - Interface for writing to the invocation result\n *\n * @param response - The response object\n */\n",
11841184
"excerptTokens": [
11851185
{
11861186
"kind": "Content",

src/cloud_events.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const CE_SERVICE = {
3636
*
3737
* {@link https://github.com/cloudevents/spec/blob/main/http-protocol-binding.md#3-http-message-mapping}
3838
*
39-
* @param req - Express request object.
39+
* @param req - Express request object
4040
* @return True if the request is a CloudEvents event in binary content mode,
4141
* false otherwise.
4242
*/
@@ -53,8 +53,8 @@ export function isBinaryCloudEvent(req: express.Request): boolean {
5353
* Returns a CloudEvents context from the given CloudEvents request. Context
5454
* attributes are retrieved from request headers.
5555
*
56-
* @param req Express request object.
57-
* @return CloudEvents context.
56+
* @param req - Express request object
57+
* @return CloudEvents context
5858
*/
5959
export function getBinaryCloudEventContext(
6060
req: express.Request

src/function_registry.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const register = <T = unknown, U = unknown>(
5656
* - must be <= 63 characters
5757
* - must start with a letter
5858
* - must end with a letter or number
59-
* @param functionName the function name
59+
* @param functionName - The function name
6060
* @returns true if the function name is valid
6161
*/
6262
export const isValidFunctionName = (functionName: string): boolean => {
@@ -67,9 +67,9 @@ export const isValidFunctionName = (functionName: string): boolean => {
6767

6868
/**
6969
* Get a declaratively registered function
70-
* @param functionName the name with which the function was registered
71-
* @returns the registered function and signature type or undefined no function matching
72-
* the provided name has been registered.
70+
* @param functionName - The name with which the function was registered
71+
* @returns The registered function and signature type or undefined no function matching
72+
* the provided name has been registered
7373
*/
7474
export const getRegisteredFunction = (
7575
functionName: string
@@ -80,8 +80,8 @@ export const getRegisteredFunction = (
8080

8181
/**
8282
* Register a function that responds to HTTP requests.
83-
* @param functionName - the name of the function
84-
* @param handler - the function to invoke when handling HTTP requests
83+
* @param functionName - The name of the function
84+
* @param handler - The function to invoke when handling HTTP requests
8585
* @public
8686
*/
8787
export const http = (functionName: string, handler: HttpFunction): void => {
@@ -90,8 +90,8 @@ export const http = (functionName: string, handler: HttpFunction): void => {
9090

9191
/**
9292
* Register a function that handles CloudEvents.
93-
* @param functionName - the name of the function
94-
* @param handler - the function to trigger when handling CloudEvents
93+
* @param functionName - The name of the function
94+
* @param handler - The function to trigger when handling CloudEvents
9595
* @public
9696
*/
9797
export const cloudEvent = <T = unknown>(
@@ -103,8 +103,8 @@ export const cloudEvent = <T = unknown>(
103103

104104
/**
105105
* Register a function that handles strongly typed invocations.
106-
* @param functionName - the name of the function
107-
* @param handler - the function to trigger
106+
* @param functionName - The name of the function
107+
* @param handler - The function to trigger
108108
* @internal
109109
*/
110110
export const typed = <T, U>(

src/function_wrappers.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ type OnDoneCallback = (err: Error | null, result: any) => void;
4141

4242
/**
4343
* Get a completion handler that can be used to signal completion of an event function.
44-
* @param res the response object of the request the completion handler is for.
45-
* @returns an OnDoneCallback for the provided request.
44+
* @param res - The response object of the request the completion handler is for
45+
* @returns An OnDoneCallback for the provided request.
4646
*/
4747
const getOnDoneCallback = (res: Response): OnDoneCallback => {
4848
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -58,8 +58,8 @@ const getOnDoneCallback = (res: Response): OnDoneCallback => {
5858

5959
/**
6060
* Helper function to parse a CloudEvent object from an HTTP request.
61-
* @param req an Express HTTP request
62-
* @returns a CloudEvent parsed from the request
61+
* @param req - An Express HTTP request
62+
* @returns A CloudEvent parsed from the request
6363
*/
6464
const parseCloudEventRequest = (req: Request): CloudEvent<unknown> => {
6565
let cloudEvent = req.body;
@@ -77,8 +77,8 @@ const parseCloudEventRequest = (req: Request): CloudEvent<unknown> => {
7777
/**
7878
* Helper function to background event context and data payload object from an HTTP
7979
* request.
80-
* @param req an Express HTTP request
81-
* @returns the data playload and event context parsed from the request
80+
* @param req - An Express HTTP request
81+
* @returns The data playload and event context parsed from the request
8282
*/
8383
const parseBackgroundEvent = (req: Request): {data: {}; context: Context} => {
8484
const event = req.body;
@@ -100,8 +100,8 @@ const parseBackgroundEvent = (req: Request): {data: {}; context: Context} => {
100100
/**
101101
* Wraps the provided function into an Express handler function with additional
102102
* instrumentation logic.
103-
* @param execute Runs user's function.
104-
* @return An Express handler function.
103+
* @param execute - Runs user's function
104+
* @return An Express handler function
105105
*/
106106
const wrapHttpFunction = (execute: HttpFunction): RequestHandler => {
107107
return (req: Request, res: Response) => {
@@ -132,8 +132,8 @@ const wrapHttpFunction = (execute: HttpFunction): RequestHandler => {
132132

133133
/**
134134
* Wraps an async CloudEvent function in an express RequestHandler.
135-
* @param userFunction User's function.
136-
* @return An Express hander function that invokes the user function.
135+
* @param userFunction - User's function
136+
* @return An Express hander function that invokes the user function
137137
*/
138138
const wrapCloudEventFunction = (
139139
userFunction: CloudEventFunction
@@ -153,8 +153,8 @@ const wrapCloudEventFunction = (
153153

154154
/**
155155
* Wraps callback style CloudEvent function in an express RequestHandler.
156-
* @param userFunction User's function.
157-
* @return An Express hander function that invokes the user function.
156+
* @param userFunction - User's function
157+
* @return An Express hander function that invokes the user function
158158
*/
159159
const wrapCloudEventFunctionWithCallback = (
160160
userFunction: CloudEventFunctionWithCallback
@@ -169,8 +169,8 @@ const wrapCloudEventFunctionWithCallback = (
169169

170170
/**
171171
* Wraps an async event function in an express RequestHandler.
172-
* @param userFunction User's function.
173-
* @return An Express hander function that invokes the user function.
172+
* @param userFunction - User's function
173+
* @return An Express hander function that invokes the user function
174174
*/
175175
const wrapEventFunction = (userFunction: EventFunction): RequestHandler => {
176176
const httpHandler = (req: Request, res: Response) => {
@@ -188,8 +188,8 @@ const wrapEventFunction = (userFunction: EventFunction): RequestHandler => {
188188

189189
/**
190190
* Wraps a callback style event function in an express RequestHandler.
191-
* @param userFunction User's function.
192-
* @return An Express hander function that invokes the user function.
191+
* @param userFunction - User's function
192+
* @return An Express hander function that invokes the user function
193193
*/
194194
const wrapEventFunctionWithCallback = (
195195
userFunction: EventFunctionWithCallback
@@ -204,7 +204,7 @@ const wrapEventFunctionWithCallback = (
204204

205205
/**
206206
* Wraps a typed function in an express style RequestHandler.
207-
* @param userFunction User's function
207+
* @param userFunction - User's function
208208
* @return An Express handler function that invokes the user function
209209
*/
210210
const wrapTypedFunction = (typedFunction: TypedFunction): RequestHandler => {

src/functions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,15 @@ export interface InvocationFormat<T, U> {
198198
/**
199199
* Creates an instance of the request type from an invocation request.
200200
*
201-
* @param request - the request body as raw bytes
201+
* @param request - The request body as raw bytes
202202
*/
203203
deserializeRequest(request: InvocationRequest): T | Promise<T>;
204204

205205
/**
206206
* Writes the response type to the invocation result.
207207
*
208-
* @param responseWriter interface for writing to the invocation result
209-
* @param response the response object
208+
* @param responseWriter - Interface for writing to the invocation result
209+
* @param response - The response object
210210
*/
211211
serializeResponse(
212212
responseWriter: InvocationResponse,

src/invoker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export const setLatestRes = (res: express.Response) => {
3434

3535
/**
3636
* Sends back a response to the incoming request.
37-
* @param result Output from function execution.
38-
* @param err Error from function execution.
39-
* @param res Express response object.
37+
* @param result - Output from function execution
38+
* @param err - Error from function execution
39+
* @param res - Express response object
4040
*/
4141

4242
export function sendResponse(
@@ -79,7 +79,7 @@ const killInstance = process.exit.bind(process, 16);
7979

8080
/**
8181
* Enables registration of error handlers.
82-
* @param server HTTP server which invokes user's function.
82+
* @param server - HTTP server which invokes user's function
8383
* @constructor
8484
*/
8585
export class ErrorHandler {

src/loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export async function getUserFunction(
174174
/**
175175
* Returns resolved path to the module containing the user function.
176176
* Returns null if the module can not be identified.
177-
* @param codeLocation Directory with user's code.
177+
* @param codeLocation - Directory with user's code
178178
* @return Resolved path or null.
179179
*/
180180
function getFunctionModulePath(codeLocation: string): string | null {

src/logger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ const SEVERITY = 'severity';
2525
/**
2626
* Logs an error message and sends back an error response to the incoming
2727
* request.
28-
* @param err Error to be logged and sent.
29-
* @param res Express response object.
30-
* @param callback A function to be called synchronously.
28+
* @param err - Error to be logged and sent
29+
* @param res - Express response object
30+
* @param callback - A function to be called synchronously
3131
*/
3232
export function sendCrashResponse({
3333
err,

src/middleware/background_event_to_cloud_event.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ const CE_SERVICE_TO_RESOURCE_RE = new Map([
6262

6363
/**
6464
* Is this request a known GCF event that can be converted to a cloud event.
65-
* @param req the express request object
66-
* @returns true if this request can be converted to a CloudEvent
65+
* @param req - The express request object
66+
* @returns True if this request can be converted to a CloudEvent
6767
*/
6868
const isConvertableBackgroundEvent = (req: Request): boolean => {
6969
const {body} = req;
@@ -79,8 +79,8 @@ const isConvertableBackgroundEvent = (req: Request): boolean => {
7979

8080
/**
8181
* Convert the given HTTP request into the GCF Background Event data / context format.
82-
* @param body the express request object
83-
* @returns a marshalled background event
82+
* @param body - The express request object
83+
* @returns A marshalled background event
8484
*/
8585
const getBackgroundEvent = (request: Request): LegacyEvent => {
8686
let {context} = request.body;
@@ -104,8 +104,8 @@ interface ParsedResource {
104104

105105
/**
106106
* Splits a background event's resource into a CloudEvent service, resource, and subject.
107-
* @param context the GCF event context to parse.
108-
* @returns the CloudEvent service, resource and subject fields for the given GCF event context.
107+
* @param context - The GCF event context to parse
108+
* @returns The CloudEvent service, resource and subject fields for the given GCF event context
109109
*/
110110
export const splitResource = (
111111
context: CloudFunctionsContext
@@ -159,9 +159,9 @@ export const splitResource = (
159159
/**
160160
* Express middleware to convert background GCF requests to Cloudevents. This enables functions
161161
* using the "cloudevent" signature type to accept requests from a background event producer.
162-
* @param req express request object
163-
* @param res express response object
164-
* @param next function used to pass control to the next middleware function in the stack
162+
* @param req - Express request object
163+
* @param res - Express response object
164+
* @param next - Function used to pass control to the next middleware function in the stack
165165
*/
166166
export const backgroundEventToCloudEventMiddleware = (
167167
req: Request,

src/middleware/cloud_event_to_background_event.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ const CE_SOURCE_REGEX = /\/\/([^/]+)\/(.+)/;
6262

6363
/**
6464
* Is the given request a known CloudEvent that can be converted to a legacy event.
65-
* @param request express request object
66-
* @returns true if the request can be converted
65+
* @param request - Express request object
66+
* @returns True if the request can be converted
6767
*/
6868
const isConvertableCloudEvent = (request: Request): boolean => {
6969
if (isBinaryCloudEvent(request)) {
@@ -75,8 +75,8 @@ const isConvertableCloudEvent = (request: Request): boolean => {
7575

7676
/**
7777
* Splits a CloudEvent source string into resource and subject components.
78-
* @param source the cloud event source
79-
* @returns the parsed service and name components of the CE source string
78+
* @param source - The cloud event source
79+
* @returns The parsed service and name components of the CE source string
8080
*/
8181
export const parseSource = (
8282
source: string
@@ -95,8 +95,8 @@ export const parseSource = (
9595

9696
/**
9797
* Marshal a known GCP CloudEvent request the equivalent context/data legacy event format.
98-
* @param req express request object
99-
* @returns the request body of the equivalent legacy event request
98+
* @param req - Express request object
99+
* @returns The request body of the equivalent legacy event request
100100
*/
101101
const marshalConvertableCloudEvent = (
102102
req: Request
@@ -173,9 +173,9 @@ const marshalConvertableCloudEvent = (
173173
/**
174174
* Express middleware to convert cloud event requests to legacy GCF events. This enables
175175
* functions using the "EVENT" signature type to accept requests from a cloud event producer.
176-
* @param req express request object
177-
* @param res express response object
178-
* @param next function used to pass control to the next middle middleware function in the stack
176+
* @param req - Express request object
177+
* @param res - Express response object
178+
* @param next - Function used to pass control to the next middle middleware function in the stack
179179
*/
180180
export const cloudEventToBackgroundEventMiddleware = (
181181
req: Request,

src/options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ Documentation:
162162
/**
163163
* Parse the configurable framework options from the provided CLI arguments and
164164
* environment variables.
165-
* @param cliArgs the raw command line arguments
166-
* @param envVars the environment variables to parse options from
167-
* @returns the parsed options that should be used to configure the framework.
165+
* @param cliArgs - The raw command line arguments
166+
* @param envVars - The environment variables to parse options from
167+
* @returns The parsed options that should be used to configure the framework
168168
*/
169169
export const parseOptions = (
170170
cliArgs: string[] = process.argv,

0 commit comments

Comments
 (0)