Commit Graph

12 Commits

Author SHA1 Message Date
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 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 17d4bc85df
chore: add cucumber.js to list of files to lint and /docs to .gitignore (#327)
Signed-off-by: Lance Ball <lball@redhat.com>
2020-08-25 16:38:17 -04:00
Lance Ball 276b810dd8
BREAKING CHANGE(lib): rewrite in TypeScript (#226)
This is a major rewrite of the entire codebase into TypeScript. Nearly
all tests have been retained except where behavior is significantly
different. Some highlights of these changes:

* lowercase all CloudEvent properties and fix base64 encoded data

Previously there was a format() function that would convert a CloudEvent
object into JSON with all of the properties lowercased. With this rewrite
a CloudEvent object can be converted to JSON simply with JSON.stringify().

However, in order to be compliant with the JSON representation outlined in
the spec here https://github.com/cloudevents/spec/blob/v1.0/json-format.md
all of the event properties must be all lowercase.

* lib(transport): make transport mode an Enum
* src: allow custom headers (#1)
* lib(exports): export explicitly versioned names where appropriate
* lib(cloudevent): modify ctor to accept extensions inline
* lib(cloudevent): make extensions a part of the event object
* test: convert all tests to typescript
* examples: update all examples with latest API changes
* docs: update README with latest API changes
* src: add prettier for code style and fix a lot of linting errors
* lib: move data decoding to occur within the CloudEvent object

Signed-off-by: Lance Ball <lball@redhat.com>
2020-06-29 14:46:20 -04:00
Lance Ball 8b2725b10a
feat: introduce browser support (#201)
This commit introduces a second `tsc` execution which generates JS in ES5 form.
Then, webpack is used to generate a browser bundle.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2020-06-10 17:49:01 -04:00
Lance Ball c757a2bce1
fix: fix references to constants - remove .js extension (#200)
Signed-off-by: Lance Ball <lball@redhat.com>
2020-06-01 17:55:54 -04:00
Lance Ball a5befbe0cf
fix: introduce CloudEventV1 and CloudEventV03 interfaces (#194)
This extracts all of the attributes from a `CloudEventVX` that
are not generated by the constructor (id and specversion) into their
own `CloudEventVXAttributes` interface which the `CloudEventVX`
interface extends. This allows TS devs to optionally provide `id`
and `specversion` with proper autocompletion.

Additionally, I have added a union type, `CE` in `cloudevent.ts` which
represents any of `CloudEventV1`, `CloudEventv03`, `CloudEventV1Attributes`
and `CloudEventV03Attributes` interfaces.

Finally, this commit changes all of the user facing API to be `.ts` instead
of `.js` files.

The existing documentation in `./docs` was removed. It should be replaced with generated
HTML from tsdocs, pending some other method of publishing API documentation. That will
come as a separate, docs-only PR.

Fixes: https://github.com/cloudevents/skd-javascript/issues/188

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-29 17:49:02 -04:00
Lance Ball 2c469efaf5
build: add tsc type checks and emit declarations in the ci/test pipeline (#155)
This commit introduces TypeScript checks and generates type declarations
for the existing JavaScript codebase using `tsc` prior to running the linter task.

Ref: https://github.com/cloudevents/sdk-javascript/issues/9

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-18 14:56:01 -04:00
Fabio José a1955b793d Ignore package-lock
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 20:49:43 -03:00
Fabio José df736d53ec ignore build/ directory
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-10-29 14:03:27 -03:00
Fabio José 6f066de091 Ignore .swp vim files
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-01-19 23:45:27 -02:00
Fabio José 268233fce7 Project start
Signed-off-by: Fabio José <fabiojose@gmail.com>
2018-11-09 16:20:29 -02:00