Skip to content

Commit f9c6a42

Browse files
chore: fix lint (#662)
1 parent 47cd4c6 commit f9c6a42

File tree

3 files changed

+152
-4
lines changed

3 files changed

+152
-4
lines changed

docs/generated/api.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,15 @@
202202
"text": "CloudEventFunction",
203203
"canonicalReference": "@google-cloud/functions-framework!CloudEventFunction:interface"
204204
},
205+
{
206+
"kind": "Content",
207+
"text": "<T> | "
208+
},
209+
{
210+
"kind": "Reference",
211+
"text": "CloudEventFunctionWithCallback",
212+
"canonicalReference": "@google-cloud/functions-framework!CloudEventFunctionWithCallback:interface"
213+
},
205214
{
206215
"kind": "Content",
207216
"text": "<T>"
@@ -217,8 +226,8 @@
217226
],
218227
"fileUrlPath": "src/function_registry.ts",
219228
"returnTypeTokenRange": {
220-
"startIndex": 8,
221-
"endIndex": 9
229+
"startIndex": 10,
230+
"endIndex": 11
222231
},
223232
"releaseTag": "Public",
224233
"overloadIndex": 1,
@@ -235,7 +244,7 @@
235244
"parameterName": "handler",
236245
"parameterTypeTokenRange": {
237246
"startIndex": 5,
238-
"endIndex": 7
247+
"endIndex": 9
239248
},
240249
"isOptional": false
241250
}

docs/generated/api.md.api.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
## API Report File for "@google-cloud/functions-framework"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
/// <reference types="node" />
8+
9+
import { CloudEventV1 as CloudEvent } from 'cloudevents';
10+
import { Request as Request_3 } from 'express';
11+
import { Response as Response_2 } from 'express';
12+
13+
export { CloudEvent }
14+
15+
// @public
16+
export const cloudEvent: <T = unknown>(functionName: string, handler: CloudEventFunction<T> | CloudEventFunctionWithCallback<T>) => void;
17+
18+
// @public
19+
export interface CloudEventFunction<T = unknown> {
20+
// (undocumented)
21+
(cloudEvent: CloudEvent<T>): any;
22+
}
23+
24+
// @public
25+
export interface CloudEventFunctionWithCallback<T = unknown> {
26+
// (undocumented)
27+
(cloudEvent: CloudEvent<T>, callback: Function): any;
28+
}
29+
30+
// @public
31+
export interface CloudFunctionsContext {
32+
eventId?: string;
33+
eventType?: string;
34+
resource?: string | {
35+
[key: string]: string;
36+
};
37+
timestamp?: string;
38+
}
39+
40+
// @public
41+
export type Context = CloudFunctionsContext | CloudEvent<unknown>;
42+
43+
// @public
44+
export interface Data {
45+
// (undocumented)
46+
data: object;
47+
}
48+
49+
// @public
50+
export interface EventFunction {
51+
// (undocumented)
52+
(data: {}, context: Context): any;
53+
}
54+
55+
// @public
56+
export interface EventFunctionWithCallback {
57+
// (undocumented)
58+
(data: {}, context: Context, callback: Function): any;
59+
}
60+
61+
// @public
62+
export type HandlerFunction<T = unknown, U = unknown> = HttpFunction | EventFunction | EventFunctionWithCallback | CloudEventFunction<T> | CloudEventFunctionWithCallback<T> | TypedFunction<T, U>;
63+
64+
// @public
65+
export const http: (functionName: string, handler: HttpFunction) => void;
66+
67+
// @public
68+
export interface HttpFunction {
69+
// (undocumented)
70+
(req: Request_2, res: Response_2): any;
71+
}
72+
73+
// @public
74+
export interface InvocationFormat<T, U> {
75+
deserializeRequest(request: InvocationRequest): T | Promise<T>;
76+
serializeResponse(responseWriter: InvocationResponse, response: U): void | Promise<void>;
77+
}
78+
79+
// @public
80+
export interface InvocationRequest {
81+
body(): string | Buffer;
82+
header(header: string): string | undefined;
83+
}
84+
85+
// @public
86+
export interface InvocationResponse {
87+
end(data: string | Buffer): void;
88+
setHeader(key: string, value: string): void;
89+
write(data: string | Buffer): void;
90+
}
91+
92+
// @public
93+
export class JsonInvocationFormat<T, U> implements InvocationFormat<T, U> {
94+
// (undocumented)
95+
deserializeRequest(request: InvocationRequest): T;
96+
// (undocumented)
97+
serializeResponse(responseWriter: InvocationResponse, response: U): void;
98+
}
99+
100+
// @public
101+
export type LegacyCloudFunctionsContext = CloudFunctionsContext | Data;
102+
103+
// @public
104+
export interface LegacyEvent {
105+
// (undocumented)
106+
context: CloudFunctionsContext;
107+
// (undocumented)
108+
data: {
109+
[key: string]: any;
110+
};
111+
}
112+
113+
// @public (undocumented)
114+
interface Request_2 extends Request_3 {
115+
abortController?: AbortController;
116+
executionId?: string;
117+
rawBody?: Buffer;
118+
spanId?: string;
119+
traceId?: string;
120+
}
121+
export { Request_2 as Request }
122+
123+
export { Response_2 as Response }
124+
125+
// Warning: (ae-internal-missing-underscore) The name "typed" should be prefixed with an underscore because the declaration is marked as @internal
126+
//
127+
// @internal
128+
export const typed: <T, U>(functionName: string, handler: TypedFunction<T, U> | ((req: T) => U | Promise<U>)) => void;
129+
130+
// @public
131+
export interface TypedFunction<T = unknown, U = unknown> {
132+
// (undocumented)
133+
format: InvocationFormat<T, U>;
134+
// (undocumented)
135+
handler: (req: T) => U | Promise<U>;
136+
}
137+
138+
// (No @packageDocumentation comment for this package)
139+
140+
```

test/integration/cloud_event.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ describe('CloudEvent Function', () => {
336336
.expect(204);
337337
});
338338

339-
340339
it('returns a 500 if the function throws an exception', async () => {
341340
functions.cloudEvent('testTypedCloudEvent', () => {
342341
throw 'I crashed';

0 commit comments

Comments
 (0)