Commit Graph

3 Commits

Author SHA1 Message Date
Lucas Holmquist 763838c89c
chore: Update examples to use latest sdk changes (#282)
* This updates all the examples to use the latest module version(3.0.0)


Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-07-30 09:24:02 -04:00
Lance Ball 276b810dd8
BREAKING CHANGE(lib): rewrite in TypeScript (#226)
This is a major rewrite of the entire codebase into TypeScript. Nearly
all tests have been retained except where behavior is significantly
different. Some highlights of these changes:

* lowercase all CloudEvent properties and fix base64 encoded data

Previously there was a format() function that would convert a CloudEvent
object into JSON with all of the properties lowercased. With this rewrite
a CloudEvent object can be converted to JSON simply with JSON.stringify().

However, in order to be compliant with the JSON representation outlined in
the spec here https://github.com/cloudevents/spec/blob/v1.0/json-format.md
all of the event properties must be all lowercase.

* lib(transport): make transport mode an Enum
* src: allow custom headers (#1)
* lib(exports): export explicitly versioned names where appropriate
* lib(cloudevent): modify ctor to accept extensions inline
* lib(cloudevent): make extensions a part of the event object
* test: convert all tests to typescript
* examples: update all examples with latest API changes
* docs: update README with latest API changes
* src: add prettier for code style and fix a lot of linting errors
* lib: move data decoding to occur within the CloudEvent object

Signed-off-by: Lance Ball <lball@redhat.com>
2020-06-29 14:46:20 -04:00
Lance Ball 99bb88be00
examples: add a WebSocket example (#218)
There is nothing really to do in order to support events over websockets.
Since a `CloudEvent` can easily be represented in full with JSON, it can
be sent over a websocket as `event.toString()`. This example illustrates
sending a `CloudEvent` over websocket from a browser or CLI.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/156
Signed-off-by: Lance Ball <lball@redhat.com>
2020-06-10 17:50:35 -04:00