[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 <lholmqui@redhat.com> Co-authored-by: Lucas Holmquist <lholmqui@redhat.com>
This commit is contained in:
parent
2b1e1ec5a2
commit
f8514062d4
|
@ -28,6 +28,6 @@
|
|||
"typescript": "~3.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"cloudevents": "~3.1.0"
|
||||
"cloudevents": "~4.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue