Commit Graph

14 Commits

Author SHA1 Message Date
Lance Ball 250a0a144c
feat!: expose a version agnostic event emitter (#141)
* feat!: expose a version agnostic event emitter

This is a breaking change.

This commit exposes an HTTP based event emitter that simplifes the API.
To use it, simply import the SDK and start emitting. The default spec
version is 1.0, but you can use 0.3 by supplying that to the constructor.

By default, CloudEvents are emitted in binary mode, but this can be changed
by providing the "structured" parameter to the `send()` function.

This commit also eliminates the version specific emitters and receivers
from the `v1` and `v03` exports, and eliminates the explicit usage of
versioned emitters from `lib/bindings/http`.

Finally, the CE headers can be retrieved from the emitter for a given
event by passing the event to the `headers()` function.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/124
Fixes: https://github.com/cloudevents/sdk-javascript/issues/149

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-14 11:37:02 -04:00
Lance Ball 5110ad4c67 src,fix: drop support for v0.2 and clean up contenttype
This commit removes support for the v0.2 specification. It also removes the
`contenttype` attribute from the `CloudEvent` object. While the HTTP protocol
binding specifies that in binary mode, the `datacontenttype` attribute should
map to the HTTP Content-Type header, that doesn't mean that the `CloudEvent`
object should have a `contenttype` property.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/61
Fixes: https://github.com/cloudevents/sdk-javascript/issues/66

Signed-off-by: Lance Ball <lball@redhat.com>
2020-04-28 17:37:49 -03:00
Fabio José cf701e423c Remove HTTPUnmarshaller
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-04 10:13:04 -03:00
Fabio José 43c6bfe9dc Exporting the http unmarshaller spec 1.0
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-04 10:07:02 -03:00
Fabio José 23b0648a07 Exporting the binary receiber
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-04 09:45:25 -03:00
Fabio José dfd98197ad Comment pendeing stuff
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-02 07:06:38 -03:00
Fabio José 8487b1c76c Sdk tests for spec 1.0
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-02 07:05:20 -03:00
Fabio José d399e5abc3 Exporting the HTTPUnmarshaller
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-05 09:22:15 -03:00
Fabio José fd119040fc Exporting the receiver and emitter for binary 0.3
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-04 13:26:14 -03:00
Fabio José 084d0c1a0b Export the structured emitter for v0.3
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-02 09:57:59 -03:00
Fabio José e7b5c833c6 Exporting the v0.3 stuff
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-01 17:43:48 -03:00
Fabio José b53d660402 SDK Requirements: exports the receivers
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-29 16:38:38 -03:00
Fabio José 6b5a8d1f3e should have the minimum exports
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-29 14:46:31 -03:00
Fabio José 375f67952d Test the event() method of SDK Requirements
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-29 13:26:20 -03:00