Commit Graph

6 Commits

Author SHA1 Message Date
Lance Ball b13bde9b49
feat: precompile cloudevent schema (#471)
* feat: precompile cloudevent schema

This commit modifies the build pipleline so that the cloudevent schema is
precompiled for runtime validation. This eliminates the need to compile the
schema at runtime, improving both performance and security.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2022-02-15 14:06:42 -05:00
Lance Ball 2ac731eb88
chore(refactor): prefer interfaces over concrete classes (#457)
* chore(refactor): protocol bindings use interfaces

This change modifies the protocol binding interfaces such as `Binding`,
`Serializer` and the like to use the `CloudEventV1` interface instead of the
implementation class `CloudEvent`. This should make extending the interfaces
simpler as this work has grown out of efforts around the implementation of
a second transport interface, Kafka.

See: https://github.com/cloudevents/sdk-javascript/pull/455/

This commit also includes the addition of a generic type to the `Message`
interface, defaulting to `string`.

There is also some minor clean up involving what is exported from the
`message/http` modules. Now, instead of exporting the entire implementation,
only the `HTTP` binding implementation is exported, and it is then reexported
by `message`.

Also, a static `CloudEvent.cloneWith()` method has been added which the
instance methods now use.

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: make the `cloneWith()` method is dependent on interfaces

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: remove unnecessary cast

Signed-off-by: Lance Ball <lball@redhat.com>
2022-01-07 14:24:56 -05:00
Remi Cattiau 80d987c1f6
chore: add copyrights header and lint rules (#418)
Signed-off-by: Remi Cattiau <remi@cattiau.com>
2021-05-14 09:28:49 -04:00
Lucas Holmquist 875f70017a
feat!: Remove All API's that are labeled "Remove in 4.0" (#362)
* feat!: remove all 4.0 deprecation.

* This removes all the APIs that were deprecated in the 3.x releases and marked as "remove in 4.0".

* Also removes any tests associated with those API's

* squash: remove axios as a dependecy


Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-11-13 14:12:26 -05:00
Lance Ball f3953a9a5a
feat: introduce Message, Serializer, Deserializer and Binding interfaces (#324)
* lib(messages): Implement a 4.0 Messages and other supporting interfaces

This commit introduces the Message, Serializer and Deserializer, and Binding
interfaces used to convert a CloudEvent into a Message that can be sent across
a transport protocol. The first protocol implemented for this is HTTP, and some
of the functionality formerly in src/transport/http has been simplified,
reduced and/or moved to /src/messages/http.

Test for V1 and V3 events are in place. Conformance tests have been modified to use
these new interfaces vs. the HTTP Receiver class.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-08-26 18:26:50 -04:00
Lance Ball dca2811627
test: inplement the cucumber conformance tests from cloudevents/spec (#238)
This commit adds cucumber-js conformance steps and includes the cucumber
tests in 'npm test'.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-07-13 09:47:02 -04:00