Commit Graph

115 Commits

Author SHA1 Message Date
Lucas Holmquist 73f0becc2b
chore: Update README with correct links for the support specification versions (#321)
* chore(readme): Remove reference of HTTPReceiver

* chore(readme): fix support specification links.

* This adds the real links to the v0.3 and v1.0 specification.

fixes #320

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-08-19 15:39:37 -04:00
Lucas Holmquist 4bf2eb838a
chore: Update references of master to main (#316)
Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-08-12 19:00:02 -04:00
Doug Davis 81623ac443
chore: typo (#313)
Signed-off-by: Doug Davis <dug@us.ibm.com>
2020-08-11 11:01:40 -04:00
Doug Davis b3624c2b1a
docs: add ref to CoC and other things (#244)
* add ref to CoC and other things

Signed-off-by: Doug Davis <dug@us.ibm.com>
2020-08-11 10:18:47 -04:00
Grant Timmerman d590e3a007
docs: improve readme receiver example (#309)
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-08-11 09:31:05 -04:00
Grant Timmerman 3fab5f2c92
docs: update badge name (#289)
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-07-30 08:43:51 -04:00
Lucas Holmquist e219a30708
chore: Update readme with correct Receiver usage (#287)
Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-07-29 18:48:14 -04:00
Grant Timmerman 565f867424
feat: use npm name cloudevents (#260)
BREAKING CHANGE:  This changes the modules name from cloudevents-sdk to cloudevents

* feat: use npm name cloudevents
fixes #215

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-07-24 10:04:25 -04:00
Lance Ball c49693189d
docs: clean up spec compliance table on README.md (#252)
This commit separates the spec compliance table in the README.md file
into three: the core spec, event formats, and transport protocols.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/166
Signed-off-by: Lance Ball <lball@redhat.com>
2020-07-16 17:45:03 -04:00
Lucas Holmquist de6f0a2945
docs(README): Update readme to mention that CloudEvents are read-only now (#248)
* also update readme with a mention about the cloneWith method

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-07-15 09:50:46 -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
Lucas Holmquist 850e893ca7
docs(README): fix wrong order of arguments in the accept example (#224)
fixes #222

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-06-18 17:11:46 -04:00
Lucas Holmquist ed1d3286fa
docs: Update references of specific versions to use Latest Supported. (#211)
* docs: Update references of specific versions to use Latest Supported.

fixes #160

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-06-08 15:47:30 -04:00
Lucas Holmquist 9857eda5ef
docs(README): fix example typo (#208)
fixes #173

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
2020-06-04 18:04:03 -04:00
Grant Timmerman 1b9b3af176
Update README.md (#205)
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-06-04 11:29:53 -07:00
Lance Ball 0fe57d123a
chore: add GitHub action for CI on master and prs (#181)
* chore: replace travis-ci badge with github action
* chore: remove .travis.yaml

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-26 17:09:55 -04:00
Lance Ball abc114b24e
lib!: change CloudEvent to use direct object notation and get/set properties (#172)
This commit makes a substantial change to the API, changing the CloudEvent class
to accept properties as an object in the constructor. For example:

```js
const CloudEvent = require('cloudevents-sdk');

// all event properties except extensions may be set in the constructor
const event = new CloudEvent({
  source: 'http://my.event.source',
  type: 'test-event-type'
});

// get and set all properties standard property notation
console.log(event.time); // the event timestamp
event.subject = 'my event subject';
```

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-22 13:03:36 -04:00
Lance Ball 250a0a144c
feat!: expose a version agnostic event emitter (#141)
* feat!: expose a version agnostic event emitter

This is a breaking change.

This commit exposes an HTTP based event emitter that simplifes the API.
To use it, simply import the SDK and start emitting. The default spec
version is 1.0, but you can use 0.3 by supplying that to the constructor.

By default, CloudEvents are emitted in binary mode, but this can be changed
by providing the "structured" parameter to the `send()` function.

This commit also eliminates the version specific emitters and receivers
from the `v1` and `v03` exports, and eliminates the explicit usage of
versioned emitters from `lib/bindings/http`.

Finally, the CE headers can be retrieved from the emitter for a given
event by passing the event to the `headers()` function.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-14 11:37:02 -04:00
Lance Ball b866edddd9
docs: update README and examples with new API (#138)
This commit modifies the README to show new API usage for the
`HTTPReceiver` and `CloudEvent` classes, and updates the examples
to use this as well.

Overall structure and content has been modified to look more like
the sdk-go README.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2020-05-11 09:41:05 -04:00
Grant Timmerman 07323e078f
docs: organize README badges and remove TS example (#112)
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-05-04 10:33:40 -07:00
Grant Timmerman 223a7c6f03
docs: remove repo structure docs (#111)
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-05-04 10:25:48 -07:00
Helio Frota 53524acb0e
fix: misspelled word (#115)
Signed-off-by: Helio Frota <00hf11@gmail.com>
2020-05-02 08:30:01 -07:00
Grant Timmerman f30c814a09
chore: remove note with bad link and non SDK docs (#109)
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-05-01 10:59:21 -07:00
Grant Timmerman 05ecbdea4f
feat: use CloudEvents not cloudevents everywhere (#101)
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-04-30 16:14:13 -07:00
Grant Timmerman 56036b09dd docs: remove 0.1, 0.2 spec support from README
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
2020-04-30 12:31:08 -03:00
Lance Ball 5110ad4c67 src,fix: drop support for v0.2 and clean up contenttype
This commit removes support for the v0.2 specification. It also removes the
`contenttype` attribute from the `CloudEvent` object. While the HTTP protocol
binding specifies that in binary mode, the `datacontenttype` attribute should
map to the HTTP Content-Type header, that doesn't mean that the `CloudEvent`
object should have a `contenttype` property.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2020-04-28 17:37:49 -03:00
Doug Davis b48b720974 add link to email
Signed-off-by: Doug Davis <dug@us.ibm.com>
2020-03-20 14:48:19 +00:00
Doug Davis 716854d39b add helpful text to README
Signed-off-by: Doug Davis <dug@us.ibm.com>
2020-01-28 18:53:23 +00:00
Daniel Bevenius 041aed4bad Remove non-existing fromString from README API doc
This commit removes the API documentation for the fromString Cloudevent
function as it does not seem to exist.

Signed-off-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-11-18 08:32:34 +01:00
Daniel Bevenius 2c7d2a5b41 Fix typo in "What we can do" table
Signed-off-by: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-11-11 14:26:54 +01:00
Fabio José 9dbb382d85 Remove old docs
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-06 11:33:31 -03:00
Fabio José ba221ea369 End of line char
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-06 11:01:23 -03:00
Fabio José f0ffa05297 Fix receiver example
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-06 10:58:34 -03:00
Fabio José a81cbf6493 Fix typescript example anchor
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-06 10:53:00 -03:00
Fabio José c7cfa46e9d Update the examples to v1
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-11-06 10:49:51 -03:00
Fabio José c9eed102c3 Update the versioning section
Breaking changes using the minor version

Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-09-01 10:44:48 -03:00
Fabio José 7dce05e61b Note about breaking things
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-09-01 10:42:20 -03:00
Fabio José f072fd2eef Fix changelog anchor
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-22 09:15:46 -03:00
Fabio José 958f3ae40a Link to changelof
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-22 09:14:30 -03:00
Fabio José 8c25af4318 Update the example for receiving events
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-06 12:04:56 -03:00
Fabio José bc27bb1d16 Update what we can do
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-06 11:26:14 -03:00
Fabio José 9ff4b01ac5 Fix the doc for Parser for reflect the right signature
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-06 11:13:29 -03:00
Fabio José ca6c7942c0 Document the HTTPUnmarshaller
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-05 09:21:46 -03:00
Fabio José 2044d0da84 Document the unmarshaller export
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-08-04 13:57:13 -03:00
Fabio José d42efce9fc Fix type
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-29 14:18:21 -03:00
Fabio José 2e5dddf82c Docs for news
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-29 13:24:13 -03:00
Fabio José cf8f570730 Test the SDK requirements spec
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-29 11:11:04 -03:00
Fabio José 7415e6e9cc Licence badge
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-26 16:06:20 -03:00
Fabio José f43c16e3f8 Fix deps badge link
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-24 08:52:56 -03:00
Fabio José 1c8401d1dd New badges
Signed-off-by: Fabio José <fabiojose@gmail.com>
2019-07-23 15:01:28 -03:00