Commit Graph

709 Commits

Author SHA1 Message Date
Lance Ball 2bd9a5a1e4
src!: remove support for 0.3 events (#425)
It has been nearly two years since 1.0 became final. This change removes
support for 0.3 events in the interest of simplifying the project a little.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-08-27 10:34:32 -04:00
dependabot[bot] 36f5e2b5f8
build(deps): bump path-parse from 1.0.6 to 1.0.7 (#428)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-26 07:54:43 -04:00
Lance Ball 2118488a14
chore: use git submodules for conformance tests (#427)
I don't think downloading to `/tmp` for each `npm test` is such a great
idea. This does mean that contributors to this repo will need to run the
following command once on their clone after this commit lands.

```
git submodule init
git submodule update
```

Signed-off-by: Lance Ball <lball@redhat.com>
2021-08-05 09:47:43 -04:00
Lance Ball 061c122b86
chore: update eslint and prettier dependencies (#424)
There were some minor changes that resulted in a few code style changes, but not much.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-08-04 15:51:37 -04:00
github-actions[bot] b5100566c6
chore: release 4.0.3 (#412)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-07-06 14:34:19 -04:00
dependabot[bot] 5cbe1783fe
build(deps): bump set-getter from 0.1.0 to 0.1.1 (#422)
Bumps [set-getter](https://github.com/doowb/set-getter) from 0.1.0 to 0.1.1.
- [Release notes](https://github.com/doowb/set-getter/releases)
- [Commits](https://github.com/doowb/set-getter/commits/0.1.1)

---
updated-dependencies:
- dependency-name: set-getter
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-06 11:10:10 -04:00
dependabot[bot] b3d9cd4585
build(deps): bump browserslist from 4.14.7 to 4.16.6 (#421)
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.14.7 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.14.7...4.16.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-06 11:09:55 -04:00
Lance Ball 22e42ddb80
fix: do not modify incoming event's specversion (#419)
Even if the specversion is totally invalid, we should not change the value
received in an incoming `Message`. Previously we defaulted to 1.0 if we did
not recognize the version number. This commit changes that, leaving the value
unmodified. We default to parsing this mystery event with the 1.0 spec. When
the event is validated with `event.validate()` we return `false`.

One additional small change to eliminate a prettier warning about `parer`
being previously declared.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-25 11:10:46 -04:00
Lance Ball 7c05adee7b
fix: do not modify incoming event's specversion (#419)
Even if the specversion is totally invalid, we should not change the value
received in an incoming `Message`. Previously we defaulted to 1.0 if we did
not recognize the version number. This commit changes that, leaving the value
unmodified. We default to parsing this mystery event with the 1.0 spec. When
the event is validated with `event.validate()` we return `false`.

One additional small change to eliminate a prettier warning about `parer`
being previously declared.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-25 11:10:20 -04:00
Lance Ball 7f6b658858
fix: throw on validation if extensions are improperly named (#420)
Also fixes the case where UPPERCASED extension names were silently changed
to lowercase and then set as undefined. Even though uppercased extension
names are invalid, we should still accept them in incoming messsages and
only throw when validating the event.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-24 14:53:07 -04: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
Lance Ball db4be6b1da
src: be more forgiving parsing JSON as a string (#417)
* src: be more forgiving parsing JSON as a string

A simple string is considered valid JSON. However, our parsers do
not accept that unless the string has quotation marks. This commit
modifies the parser to look for strings declared as application/json
which do not begin with '[' '{' or '"' and surrounds them with
quotes.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-13 12:46:36 -04:00
dependabot[bot] e06147b9de
build(deps): bump handlebars from 4.7.6 to 4.7.7 (#414)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.7.6 to 4.7.7.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 10:08:31 -04:00
dependabot[bot] 6d7fb24636
build(deps): bump underscore from 1.11.0 to 1.13.1 (#413)
Bumps [underscore](https://github.com/jashkenas/underscore) from 1.11.0 to 1.13.1.
- [Release notes](https://github.com/jashkenas/underscore/releases)
- [Commits](https://github.com/jashkenas/underscore/compare/1.11.0...1.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 10:08:13 -04:00
dependabot[bot] d0ff345ef1
build(deps): bump lodash from 4.17.20 to 4.17.21 (#415)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 10:07:53 -04:00
dependabot[bot] 2c8cc45f64
build(deps): bump hosted-git-info from 2.8.8 to 2.8.9 (#416)
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 10:07:24 -04:00
Lance Ball 0c17ff3af4
doc: improve generated documentation (#410)
Adds some additional JSDoc properties so the docs are clearer.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-27 12:31:45 -04:00
Lance Ball d68b85a227
chore: add Lance Ball to maintainers in package.json (#411)
Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-27 12:12:07 -04:00
github-actions[bot] 1fe4f5b62a
chore: release 4.0.2 (#396)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-23 12:21:46 -04:00
Lance Ball 66f0b42f0d
chore: update codacy badges (#409)
Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-21 17:13:05 -04:00
Lance Ball a0009f6189
chore: remove @types/axios and add axios in dev (#408)
This commit removes @types/axios from the devDependencies and replaces
it with straight up axios. The @types package is deprecated and has not
been updated in four years. Plus it was raising a security alert. Plus
axios publishes their own types now.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-21 10:13:10 -04:00
Lance Ball 26ceb908db
chore: tweak PR template (#407)
Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-21 10:12:44 -04:00
Lance Ball 192c6a3a5c
chore: externalize remark-lint config (#406)
This way Codacy will use our configuration instead of its own.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-21 10:12:31 -04:00
Lance Ball fea5ac2d05
chore: add markdown linter (#403)
Also fixes a few minor linting issues from CHANGELOG.md.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-20 11:53:23 -04:00
Lance Ball cc43f3bd10
chore: update CI workflow to include Node.js 14.x (#404)
Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-20 11:46:38 -04:00
Lance Ball edd3c7fbac
chore: remove standard-version (#402)
Now that we are using release-please, this is not necessary.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-16 15:08:14 -04:00
Lance Ball d10fee05ba
doc: fix README.md coverage/quality badge links (#401)
For some reason they had never been changed from @fabiojose

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

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-15 18:49:10 -04:00
Snyk bot d3593556f1
fix: examples/typescript-ex/package.json to reduce vulnerabilities (#395)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-HOSTEDGITINFO-1088355

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-06 10:58:06 -04:00
dependabot[bot] 643c914da8
build(deps): bump y18n from 4.0.0 to 4.0.1 (#397)
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-06 09:48:02 -04:00
Lance Ball 0f11b02a01
fix: defaults properly handled for emitterFor() (#399)
* fix: defaults properly handled for emitterFor()

Fixes: https://github.com/cloudevents/sdk-javascript/issues/391
2021-04-05 13:14:04 -04:00
Lance Ball 447252e0c7
docs: fix 'npm run generate-docs' (#398)
Fixes: https://github.com/cloudevents/sdk-javascript/issues/392

This commit also removes the external doc theme, since the new version
generates decent looking docs.

After this lands, docs should be published.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-05 10:18:59 -04:00
Lance Ball efe466ac7d
fix: ensure loose validation for isEvent and toEvent (#394)
The `HTTP.isEvent()` and `HTTP.toEvent()` functions both had some validation
code that violated the principle of loose validation when receiving an
event over HTTP. As discussed, the validation should be managed by the
receiver in this case with `event.validate()`

Signed-off-by: Lance Ball <lball@redhat.com>
2021-03-25 12:37:05 -04:00
github-actions[bot] 93f02130f6
chore: release 4.0.1 (#378)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-03-23 11:55:26 -04:00
Lance Ball 39812f77d0
fix: package.json & package-lock.json to reduce vulnerabilities (#384)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-MARKED-1070800

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2021-03-08 18:32:41 -05:00
Lance Ball e7d99eb882
test: add a test for extension names with all caps. (#389)
See: https://github.com/cloudevents/sdk-javascript/issues/380

Signed-off-by: Lance Ball <lball@redhat.com>
2021-03-08 16:07:24 -05:00
Lance Ball b006b90122 fixup: incorporate review comments
Signed-off-by: Lance Ball <lball@redhat.com>
2021-02-27 19:27:20 -05:00
Lance Ball 1af3d43341 fix: Emitter should not extend EventEmitter
This change modifies Emitter so that it does not directly extend the Node.js
EventEmitter class. Instead, it holds a singleton instance of an EventEmitter
but is not an instance of EventEmitter itself.

This commit also updates the typescript example to use a modern version of
@types/node and typescript.

Finally there are a few minor formatting changes picked up by eslint.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2021-02-27 19:27:20 -05:00
Snyk bot 6be3b27514
fix: cloudevents from 3.2.0 to 4.0.0 (#376)
* fix: examples/express-ex/package.json to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AXIOS-1038255

* fix(examples): remove the body-parser module.

* When a structured formatted CloudEvent comes in, the body parser module does know how to parse it since the content type is not application/json, which resulted in an empty request body

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>

Co-authored-by: Lucas Holmquist <lholmqui@redhat.com>
2021-01-06 13:46:21 -05:00
Snyk bot f8514062d4
[Snyk] Security upgrade cloudevents from 3.1.0 to 4.0.0 (#377)
* fix: examples/typescript-ex/package.json to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AXIOS-1038255

* chore: update example to use the 4.0 API

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>

Co-authored-by: Lucas Holmquist <lholmqui@redhat.com>
2021-01-06 09:55:37 -05:00
Snyk bot 2b1e1ec5a2
fix: examples/websocket/package.json to reduce vulnerabilities (#375)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AXIOS-1038255

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2021-01-06 09:44:31 -05:00
dependabot[bot] 8243fa10f1
build(deps): bump ini from 1.3.5 to 1.3.7 (#373)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-04 11:03:27 -05:00
Ali Ok ed8148326b
chore(docs): Fix minor import problems in README (#374)
Signed-off-by: Ali Ok <aliok@redhat.com>
2021-01-04 11:02:53 -05:00
github-actions[bot] 97cf2f7785
chore: release 4.0.0 (#368)
* chore: release 4.0.0

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Lucas Holmquist <lholmqui@redhat.com>
2020-12-11 14:28:02 -05:00
dependabot[bot] d656362cd9
build(deps): bump highlight.js from 10.3.2 to 10.4.1 (#372)
Bumps [highlight.js](https://github.com/highlightjs/highlight.js) from 10.3.2 to 10.4.1.
- [Release notes](https://github.com/highlightjs/highlight.js/releases)
- [Changelog](https://github.com/highlightjs/highlight.js/blob/master/CHANGES.md)
- [Commits](https://github.com/highlightjs/highlight.js/compare/10.3.2...10.4.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-07 11:22:38 -05:00
Lucas Holmquist 79296a8e63
chore: add a transition guide. fixes #360 (#363)
Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-12-07 11:21:30 -05:00
Lance Ball 9f86cfdf0e fix: improve error messages when validating extensions
This commit changes the messages produced when validating extension names and
values, including the offending name or value in the message, and including
text from the CloudEvent specification, or a link to the type system.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2020-11-30 17:38:49 -05:00
snyk-bot 132f052f1f fix: package.json & package-lock.json to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-Y18N-1021887

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-11-25 11:31:12 -05:00
Remi Cattiau 6adb578402 ci: disable @typescript-eslint/no-explicit-any linter rule
Signed-off-by: Remi Cattiau <remi@cattiau.com>
2020-11-17 08:41:16 -05:00
Remi Cattiau 43d9e01972 feat: allow ensureDelivery to be able to ensure delivery on emit
Signed-off-by: Remi Cattiau <remi@cattiau.com>
2020-11-17 08:41:16 -05:00
Remi Cattiau d418a50c56 ci: add unit test for emitter
Signed-off-by: Remi Cattiau <remi@cattiau.com>
2020-11-17 08:41:16 -05:00