Skip to content

Commit

Permalink
feat: update to latest version of clouevents sdk
Browse files Browse the repository at this point in the history
This commit updates to the latest CESDK which provides a generic interface for
CloudEvents. This is an additive, non-breaking change to our registration API
  • Loading branch information
matthewrobertson committed Dec 3, 2021
1 parent 2073558 commit c7aa8f9
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 70 deletions.
137 changes: 108 additions & 29 deletions docs/generated/api.json
Expand Up @@ -180,7 +180,7 @@
},
{
"kind": "Content",
"text": "(functionName: string, handler: "
"text": "<T = unknown>(functionName: string, handler: "
},
{
"kind": "Reference",
Expand All @@ -189,7 +189,7 @@
},
{
"kind": "Content",
"text": ") => void"
"text": "<T>) => void"
}
],
"releaseTag": "Public",
Expand All @@ -206,10 +206,31 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare interface CloudEventFunction "
"text": "export interface CloudEventFunction<T = "
},
{
"kind": "Content",
"text": "unknown"
},
{
"kind": "Content",
"text": "> "
}
],
"releaseTag": "Public",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
}
],
"name": "CloudEventFunction",
"members": [
{
Expand All @@ -226,6 +247,10 @@
"text": "CloudEvent",
"canonicalReference": "cloudevents!CloudEventV1:interface"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": "): "
Expand All @@ -240,8 +265,8 @@
}
],
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
"startIndex": 4,
"endIndex": 5
},
"releaseTag": "Public",
"overloadIndex": 1,
Expand All @@ -250,7 +275,7 @@
"parameterName": "cloudEvent",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
"endIndex": 3
}
}
]
Expand All @@ -265,10 +290,31 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare interface CloudEventFunctionWithCallback "
"text": "export interface CloudEventFunctionWithCallback<T = "
},
{
"kind": "Content",
"text": "unknown"
},
{
"kind": "Content",
"text": "> "
}
],
"releaseTag": "Public",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
}
],
"name": "CloudEventFunctionWithCallback",
"members": [
{
Expand All @@ -285,6 +331,10 @@
"text": "CloudEvent",
"canonicalReference": "cloudevents!CloudEventV1:interface"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": ", callback: "
Expand All @@ -308,8 +358,8 @@
}
],
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
"startIndex": 6,
"endIndex": 7
},
"releaseTag": "Public",
"overloadIndex": 1,
Expand All @@ -318,14 +368,14 @@
"parameterName": "cloudEvent",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
"endIndex": 3
}
},
{
"parameterName": "callback",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
"startIndex": 4,
"endIndex": 5
}
}
]
Expand All @@ -340,7 +390,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare interface CloudFunctionsContext "
"text": "export interface CloudFunctionsContext "
}
],
"releaseTag": "Public",
Expand Down Expand Up @@ -476,6 +526,10 @@
"text": "CloudEvent",
"canonicalReference": "cloudevents!CloudEventV1:interface"
},
{
"kind": "Content",
"text": "<unknown>"
},
{
"kind": "Content",
"text": ";"
Expand All @@ -485,7 +539,7 @@
"name": "Context",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 4
"endIndex": 5
}
},
{
Expand All @@ -495,7 +549,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare interface Data "
"text": "export interface Data "
}
],
"releaseTag": "Public",
Expand Down Expand Up @@ -537,7 +591,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare interface EventFunction "
"text": "export interface EventFunction "
}
],
"releaseTag": "Public",
Expand Down Expand Up @@ -611,7 +665,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare interface EventFunctionWithCallback "
"text": "export interface EventFunctionWithCallback "
}
],
"releaseTag": "Public",
Expand Down Expand Up @@ -701,7 +755,15 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare type HandlerFunction = "
"text": "export declare type HandlerFunction<T = "
},
{
"kind": "Content",
"text": "unknown"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Reference",
Expand Down Expand Up @@ -737,23 +799,40 @@
},
{
"kind": "Content",
"text": " | "
"text": "<T> | "
},
{
"kind": "Reference",
"text": "CloudEventFunctionWithCallback",
"canonicalReference": "@google-cloud/functions-framework!CloudEventFunctionWithCallback:interface"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": ";"
}
],
"releaseTag": "Public",
"name": "HandlerFunction",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 10
"startIndex": 3,
"endIndex": 13
}
},
{
Expand Down Expand Up @@ -793,7 +872,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare interface HttpFunction "
"text": "export interface HttpFunction "
}
],
"releaseTag": "Public",
Expand All @@ -810,17 +889,17 @@
},
{
"kind": "Reference",
"text": "Request_2",
"canonicalReference": "@google-cloud/functions-framework!~Request_2:interface"
"text": "Request",
"canonicalReference": "@google-cloud/functions-framework!Request:interface"
},
{
"kind": "Content",
"text": ", res: "
},
{
"kind": "Reference",
"text": "Response_2",
"canonicalReference": "@google-cloud/functions-framework!~Response_2:type"
"text": "Response",
"canonicalReference": "@google-cloud/functions-framework!Response:type"
},
{
"kind": "Content",
Expand Down Expand Up @@ -903,7 +982,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "export declare interface LegacyEvent "
"text": "export interface LegacyEvent "
}
],
"releaseTag": "Public",
Expand Down Expand Up @@ -972,7 +1051,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "declare interface Request_2 extends "
"text": "export interface Request extends "
},
{
"kind": "Reference",
Expand Down Expand Up @@ -1029,7 +1108,7 @@
"excerptTokens": [
{
"kind": "Content",
"text": "declare type Response_2 = "
"text": "export declare type Response = "
},
{
"kind": "Reference",
Expand Down
14 changes: 7 additions & 7 deletions docs/generated/api.md
Expand Up @@ -12,18 +12,18 @@ import * as express from 'express';
export { CloudEvent }

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

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

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

// @public
Expand All @@ -37,7 +37,7 @@ export interface CloudFunctionsContext {
}

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

// @public
export interface Data {
Expand All @@ -58,7 +58,7 @@ export interface EventFunctionWithCallback {
}

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

// @public
export const http: (functionName: string, handler: HttpFunction) => void;
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"body-parser": "^1.18.3",
"cloudevents": "^5.0.0",
"cloudevents": "^5.1.0",
"express": "^4.16.4",
"minimist": "^1.2.5",
"on-finished": "^2.3.0",
Expand Down

0 comments on commit c7aa8f9

Please sign in to comment.