From f8514062d409de00f2cea99d279fe607f3790447 Mon Sep 17 00:00:00 2001 From: Snyk bot Date: Wed, 6 Jan 2021 16:55:37 +0200 Subject: [PATCH] [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 Co-authored-by: Lucas Holmquist --- examples/typescript-ex/package.json | 2 +- examples/typescript-ex/src/index.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/typescript-ex/package.json b/examples/typescript-ex/package.json index 7a2c9c4..d9d1912 100644 --- a/examples/typescript-ex/package.json +++ b/examples/typescript-ex/package.json @@ -28,6 +28,6 @@ "typescript": "~3.9.5" }, "dependencies": { - "cloudevents": "~3.1.0" + "cloudevents": "~4.0.0" } } diff --git a/examples/typescript-ex/src/index.ts b/examples/typescript-ex/src/index.ts index af084a6..228b504 100644 --- a/examples/typescript-ex/src/index.ts +++ b/examples/typescript-ex/src/index.ts @@ -1,4 +1,4 @@ -import { CloudEvent, CloudEventV1, Receiver } from "cloudevents"; +import { CloudEvent, CloudEventV1, HTTP } from "cloudevents"; export function doSomeStuff(): void { const myevent: CloudEventV1 = new CloudEvent({ @@ -21,7 +21,7 @@ export function doSomeStuff(): void { // Typically used with an incoming HTTP request where myevent.format() is the actual // body of the HTTP - console.log("Received structured event:", Receiver.accept(headers, myevent)); + console.log("Received structured event:", HTTP.toEvent({headers, body: myevent})); // ------ receiver binary const data = { @@ -38,8 +38,8 @@ export function doSomeStuff(): void { "ce-extension1": "extension1", }; - console.log("My binary event:", Receiver.accept(attributes, data)); - console.log("My binary event extensions:", Receiver.accept(attributes, data)); + console.log("My binary event:", HTTP.toEvent({headers: attributes, body: data})); + console.log("My binary event extensions:", HTTP.toEvent({headers: attributes, body: data})); }