Skip to content
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
15 changes: 12 additions & 3 deletions docs/generated/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@
"text": "CloudEventFunction",
"canonicalReference": "@google-cloud/functions-framework!CloudEventFunction:interface"
},
{
"kind": "Content",
"text": "<T> | "
},
{
"kind": "Reference",
"text": "CloudEventFunctionWithCallback",
"canonicalReference": "@google-cloud/functions-framework!CloudEventFunctionWithCallback:interface"
},
{
"kind": "Content",
"text": "<T>"
Expand All @@ -217,8 +226,8 @@
],
"fileUrlPath": "src/function_registry.ts",
"returnTypeTokenRange": {
"startIndex": 8,
"endIndex": 9
"startIndex": 10,
"endIndex": 11
},
"releaseTag": "Public",
"overloadIndex": 1,
Expand All @@ -235,7 +244,7 @@
"parameterName": "handler",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 7
"endIndex": 9
},
"isOptional": false
}
Expand Down
140 changes: 140 additions & 0 deletions docs/generated/api.md.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
## API Report File for "@google-cloud/functions-framework"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

/// <reference types="node" />

import { CloudEventV1 as CloudEvent } from 'cloudevents';
import { Request as Request_3 } from 'express';
import { Response as Response_2 } from 'express';

export { CloudEvent }

// @public
export const cloudEvent: <T = unknown>(functionName: string, handler: CloudEventFunction<T> | CloudEventFunctionWithCallback<T>) => void;

// @public
export interface CloudEventFunction<T = unknown> {
// (undocumented)
(cloudEvent: CloudEvent<T>): any;
}

// @public
export interface CloudEventFunctionWithCallback<T = unknown> {
// (undocumented)
(cloudEvent: CloudEvent<T>, callback: Function): any;
}

// @public
export interface CloudFunctionsContext {
eventId?: string;
eventType?: string;
resource?: string | {
[key: string]: string;
};
timestamp?: string;
}

// @public
export type Context = CloudFunctionsContext | CloudEvent<unknown>;

// @public
export interface Data {
// (undocumented)
data: object;
}

// @public
export interface EventFunction {
// (undocumented)
(data: {}, context: Context): any;
}

// @public
export interface EventFunctionWithCallback {
// (undocumented)
(data: {}, context: Context, callback: Function): any;
}

// @public
export type HandlerFunction<T = unknown, U = unknown> = HttpFunction | EventFunction | EventFunctionWithCallback | CloudEventFunction<T> | CloudEventFunctionWithCallback<T> | TypedFunction<T, U>;

// @public
export const http: (functionName: string, handler: HttpFunction) => void;

// @public
export interface HttpFunction {
// (undocumented)
(req: Request_2, res: Response_2): any;
}

// @public
export interface InvocationFormat<T, U> {
deserializeRequest(request: InvocationRequest): T | Promise<T>;
serializeResponse(responseWriter: InvocationResponse, response: U): void | Promise<void>;
}

// @public
export interface InvocationRequest {
body(): string | Buffer;
header(header: string): string | undefined;
}

// @public
export interface InvocationResponse {
end(data: string | Buffer): void;
setHeader(key: string, value: string): void;
write(data: string | Buffer): void;
}

// @public
export class JsonInvocationFormat<T, U> implements InvocationFormat<T, U> {
// (undocumented)
deserializeRequest(request: InvocationRequest): T;
// (undocumented)
serializeResponse(responseWriter: InvocationResponse, response: U): void;
}

// @public
export type LegacyCloudFunctionsContext = CloudFunctionsContext | Data;

// @public
export interface LegacyEvent {
// (undocumented)
context: CloudFunctionsContext;
// (undocumented)
data: {
[key: string]: any;
};
}

// @public (undocumented)
interface Request_2 extends Request_3 {
abortController?: AbortController;
executionId?: string;
rawBody?: Buffer;
spanId?: string;
traceId?: string;
}
export { Request_2 as Request }

export { Response_2 as Response }

// Warning: (ae-internal-missing-underscore) The name "typed" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
export const typed: <T, U>(functionName: string, handler: TypedFunction<T, U> | ((req: T) => U | Promise<U>)) => void;

// @public
export interface TypedFunction<T = unknown, U = unknown> {
// (undocumented)
format: InvocationFormat<T, U>;
// (undocumented)
handler: (req: T) => U | Promise<U>;
}

// (No @packageDocumentation comment for this package)

```
1 change: 0 additions & 1 deletion test/integration/cloud_event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ describe('CloudEvent Function', () => {
.expect(204);
});


it('returns a 500 if the function throws an exception', async () => {
functions.cloudEvent('testTypedCloudEvent', () => {
throw 'I crashed';
Expand Down
Loading