Commit Graph

4 Commits

Author SHA1 Message Date
Lance Ball 15f6505a58
BREAKING CHANGE: use string instead of enum for `Version` (#561)
TypeScript does not consider enum values equivalent, even if the string
representation is the same. So, when a module imports `cloudevents` and
also has a dependency on `cloudevents` this can cause conflicts where
the `CloudEvent.version` attribute is not considered equal when, in
fact, it is.

Changing the `enum` to a string is pretty straightforward, but should be
considered a breaking change since TypeScript dependents will
potentially fail the build with a change like this.

Signed-off-by: Lance Ball <lball@redhat.com>
2023-07-19 10:53:03 -04:00
Philip Sanetra 2d5fab1b71
fix: Make CloudEvent data field immutable and enumerable using Object.keys() (#515) (#516)
Signed-off-by: Philip Sanetra <code@psanetra.de>
2022-11-01 12:46:26 -04:00
Lance Ball ea94a4d779
fix: improve validation on extension attribute (#502)
* fix: improve validation on extension attribute

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

Adds a regular expression check to the attribute name validation code to
ensure that attribute names only use a-z0-9 (except for `data_base64`,
which apparently is an exception to the rule.

Signed-off-by: Lance Ball <lball@redhat.com>
2022-06-22 15:27:41 -04:00
Lance Ball 591d133f31
feat: add MQTT transport messaging (#459)
Add MQTT as a `Message` format.

This commit adds `MQTT` to the supported transport protocols by adding a `Binding` and the `MQTTMessage<T>` type, extending the base `Message` type, adding the MQTT fields for `payload`, `PUBLISH` and `User Properties`. The `payload` field directly maps to `Message#body`, while `User Properties` roughly maps to `Message#headers`, even though the properties here are not formatted with a `ce-` prefix like other transport protocols. This is per the spec. See: https://github.com/cloudevents/spec/blob/v1.0.1/mqtt-protocol-binding.md. 

Signed-off-by: Lance Ball <lball@redhat.com>
2022-01-14 11:41:15 -05:00