Skip to content

Commit f851406

Browse files
snyk-botlholmquist
andauthored
[Snyk] Security upgrade cloudevents from 3.1.0 to 4.0.0 (#377)
* fix: examples/typescript-ex/package.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-AXIOS-1038255 * chore: update example to use the 4.0 API Signed-off-by: Lucas Holmquist <[email protected]> Co-authored-by: Lucas Holmquist <[email protected]>
1 parent 2b1e1ec commit f851406

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/typescript-ex/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
"typescript": "~3.9.5"
2929
},
3030
"dependencies": {
31-
"cloudevents": "~3.1.0"
31+
"cloudevents": "~4.0.0"
3232
}
3333
}

examples/typescript-ex/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CloudEvent, CloudEventV1, Receiver } from "cloudevents";
1+
import { CloudEvent, CloudEventV1, HTTP } from "cloudevents";
22

33
export function doSomeStuff(): void {
44
const myevent: CloudEventV1 = new CloudEvent({
@@ -21,7 +21,7 @@ export function doSomeStuff(): void {
2121

2222
// Typically used with an incoming HTTP request where myevent.format() is the actual
2323
// body of the HTTP
24-
console.log("Received structured event:", Receiver.accept(headers, myevent));
24+
console.log("Received structured event:", HTTP.toEvent({headers, body: myevent}));
2525

2626
// ------ receiver binary
2727
const data = {
@@ -38,8 +38,8 @@ export function doSomeStuff(): void {
3838
"ce-extension1": "extension1",
3939
};
4040

41-
console.log("My binary event:", Receiver.accept(attributes, data));
42-
console.log("My binary event extensions:", Receiver.accept(attributes, data));
41+
console.log("My binary event:", HTTP.toEvent({headers: attributes, body: data}));
42+
console.log("My binary event extensions:", HTTP.toEvent({headers: attributes, body: data}));
4343

4444
}
4545

0 commit comments

Comments
 (0)