* Update CI action to node 18.x
Signed-off-by: Jordan Moore <1930631+OneCricketeer@users.noreply.github.com>
* doc: update README
Signed-off-by: Jordan Moore <1930631+OneCricketeer@users.noreply.github.com>
---------
Signed-off-by: Jordan Moore <1930631+OneCricketeer@users.noreply.github.com>
* 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>
* fix: allow `Uint16|8Array` for binary data
Previously we only considered `Uint32Array` binary data. This was an
oversight. This fixes that issue.
Fixes: https://github.com/cloudevents/sdk-javascript/issues/491
Signed-off-by: Lance Ball <lball@redhat.com>
* fix: HTTP headers for extensions with false values
CloudEvent objects may include extensions that have a defined key and a
`false` value. This change ensures that HTTP messages for CloudEvents
containing these extension values include the appropriate headers.
Signed-off-by: Lance Ball <lball@redhat.com>
* chore: bump ajv and remove old dep dependency
This should allow the existing, meaningful PRs to pass CI validation if they get a rebase.
Signed-off-by: Lance Ball <lball@redhat.com>
* feat: add builtin HTTP emitter
Adds a builtin HTTP event emitter that can be used with `emitterFor()`
to send events over HTTP without pulling in any additional dependencies.
In the past we chose to keep this in our code base by considering axios a
peer dependency - users were required to include it in their projects
explicitly. In working on the HTTP emitter, it became more and more
apparent that the axios emitter was probably no longer needed, and in fact
I doubt it was really used at all. To use it, users would have been required
to do this, since it isn't exported at the top level.
const { axiosEmitter } = require("cloudevents/transport/http");
Based on this, I think the usage in the wild is probably very minimal,
and I like the idea of eliminating this dependency.
Signed-off-by: Lance Ball <lball@redhat.com>
Adds a convenience npm script that allows you to run only a single test
file at a time. Example usage:
```
sdk-javascript on lance/update-deps-package-json [!?] is 📦 v5.3.2 via v16.14.0
❯ npm run test:one
> cloudevents@5.3.2 test:one
> mocha --require ts-node/register
Error: No test files found
sdk-javascript on lance/update-deps-package-json [!?] is 📦 v5.3.2 via v16.14.0
❯ npm run test:one -- ./test/integration/batch_test.ts
> cloudevents@5.3.2 test:one
> mocha --require ts-node/register "./test/integration/batch_test.ts"
A batched CloudEvent message over HTTP
✔ Can be created with a typed Message
A batched CloudEvent message over Kafka
✔ Can be created with a typed Message
2 passing (5ms)
sdk-javascript on lance/update-deps-package-json [!?] is 📦 v5.3.2 via v16.14.0
```
Signed-off-by: Lance Ball <lball@redhat.com>
* 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>
* docs: fix ts example
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
* docs: fix ts example
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
* docs: update quote mark
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
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>
This commit extends the `message` package to include Kafka transport.
Additionally, some of the type information has changed across the project
to more accurately reflect the type of `Message` (by including `T`).
Related: https://github.com/cloudevents/sdk-javascript/issues/390
Signed-off-by: Lance Ball <lball@redhat.com>