Commit Graph

19 Commits

Author SHA1 Message Date
Lance Ball 09b0c76826
feat: add ValidationError type extending TypeError (#151)
This change adds a `ValidationError` type that extends `TypeError`. Any time a `CloudEvent` cannot be received and created with the given input, this error will be thrown. Tests have all
been updated to check for the error type.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-13 13:27:18 -04:00
Grant Timmerman 106b943ee2
Inline Spec File (#129)
* fix: make application/json the default content type in binary mode (#118)

The Knative Kafka event source does not include a `Content-Type` header when
sending binary events. The CE HTTP binding specification doesn't address how
a receiver should handle this situation.

This commit makes `application/json` the default.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/117
Ref: https://github.com/cloudevents/spec/issues/614

Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

* refactor: remove ext folder

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

* Revert "fix: make application/json the default content type in binary mode (#118)"

This reverts commit 9ccfaf25ba.

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

Co-authored-by: Lance Ball <lball@redhat.com>
2020-05-06 12:12:26 -07:00
Daniel Bevenius e329d9ac00
lib: use specversion from schema (#116)
This commit updates the 0.1 and 0.3 sources to use the specversion
available in schema definitions.

Signed-off-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2020-05-04 17:44:16 -07:00
Lance Ball e83db297ae chore: update eslint rules to disallow var usage
Enforce the use of `let` and `const` by using elsint rules.
When creating the eslint configuration, I had assumed that
`extends: eslint:recommended` would have covered this, but
apparently not!

Existing usage of `var` fixed with `npm run lint -- --fix`.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2020-04-30 12:36:04 -03:00
Helio Frota 42246ce36b chore: Update uuid dependency
Signed-off-by: Helio Frota <00hf11@gmail.com>
2020-04-30 12:34:30 -03:00
Lance Ball 3f238a0124
src: add eslint configuration and npm script
Automatically fixed > 2000 issues. The remaining 200+ issues need
to be fixed by hand. Additionally, all strings are double quotes
which is not typically standard and I wonder about fixing that too.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-04-22 10:15:05 -04:00
Lance Ball aa2cef6e3c
deps: update old and remove unused dependencies
This commit updates all of the dependencies in package.json to
their most recent versions. It also removes dependencies that were
specified in package.json but not used - or only used in a
`require()` statement.

These changes have some ripple effects. Istanbul has not been
supported for some time, so it has been replaced with nyc.
The code coverage reporting tool from codacy has been updated
as well. This could not be tested without having the API token.

Finally, the CI job has been modified to run tests on Node.js
versions 10x and 12x. All older versions of Node.js are no longer
maintained.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-04-20 14:53:53 -04:00
Daniel Bevenius df85189a64 Use const instead of var where applicable
Signed-off-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2020-04-20 09:54:25 +02:00
Fabio José 68ca47cc13 Missing semicolon
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-08 10:27:36 -03:00
Fabio José 99c595036a Missing semicolon
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-08 10:17:21 -03:00
Fabio José 1f8940c8a7 Support for data_base64 when event data is Binary
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-04 13:41:13 -03:00
Fabio José 1905266d1f Validating extension types
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-31 17:50:54 -03:00
Fabio José 0d34de5315 Remaining attributes tests
Extensions

Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 16:19:19 -03:00
Fabio José 07f27426f3 Method to check against the json schema
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 14:03:09 -03:00
Fabio José acd29e142d Spec v1.0 required and optional attributes
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 10:58:16 -03:00
Fabio José 136045ae62 Fixing the lambda
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 10:38:38 -03:00
Fabio José 185f2da789 Fix method signature
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 10:37:10 -03:00
Fabio José 9996f5a84c Method to get id
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 10:34:58 -03:00
Fabio José 75aa7450c5 Spec v1.0 definitions
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 08:56:08 -03:00