Skip to content

Commit

Permalink
lib!: refactor HTTP bindings and specifications (#165)
Browse files Browse the repository at this point in the history
This is a breaking change.

This commit makes a number of changes to the HTTP bindings code in an attempt
to simplify its usage and implementation. From a very high level, this inverts
the existing dependencies.

As an example, consider `lib/bindings/http/receiver_structured_1.js`.
https://github.com/cloudevents/sdk-javascript/blob/v1.0.0/lib/bindings/http/receiver_structured_0_3.js

This class instantiates `lib/bindings/http/receiver_structured.js` and delegates
its function invokations to it. This had the effect of requiring a user to know what
event versions they would be receiving. And for me personally was a little confusing
as a maintainer.

The change introduced here reverses that logic, so that the version agnostic receiver
is what the user instantiates. It instantiates the approrpiate version of a specific
receiever and delegates to it - reversing the dependencies.

I've also moved all of the top level directories related to HTTP versions into
`lib/bindings/http/v1` and `lib/bindings/http/v03` and generally done some rearranging
to make the repository structure cleaner and more organized.

Signed-off-by: Lance Ball <lball@redhat.com>
  • Loading branch information
lance authored May 18, 2020
1 parent b99e6ea commit 6f0b5ea
Show file tree
Hide file tree
Showing 59 changed files with 4,593 additions and 900 deletions.
535 changes: 535 additions & 0 deletions docs/BinaryHTTPEmitter.html

Large diffs are not rendered by default.

715 changes: 715 additions & 0 deletions docs/BinaryHTTPReceiver.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/CloudEvent.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h3>



<h3>Classes</h3><ul><li id="CloudEvent-nav"><a href="CloudEvent.html">CloudEvent</a><ul class='methods'><li data-type="method" id="CloudEvent-addExtension-nav"><a href="CloudEvent.html#addExtension">addExtension</a></li><li data-type="method" id="CloudEvent-data-nav"><a href="CloudEvent.html#data">data</a></li><li data-type="method" id="CloudEvent-dataContenttype-nav"><a href="CloudEvent.html#dataContenttype">dataContenttype</a></li><li data-type="method" id="CloudEvent-format-nav"><a href="CloudEvent.html#format">format</a></li><li data-type="method" id="CloudEvent-getData-nav"><a href="CloudEvent.html#getData">getData</a></li><li data-type="method" id="CloudEvent-getDataContenttype-nav"><a href="CloudEvent.html#getDataContenttype">getDataContenttype</a></li><li data-type="method" id="CloudEvent-getExtensions-nav"><a href="CloudEvent.html#getExtensions">getExtensions</a></li><li data-type="method" id="CloudEvent-getFormats-nav"><a href="CloudEvent.html#getFormats">getFormats</a></li><li data-type="method" id="CloudEvent-getId-nav"><a href="CloudEvent.html#getId">getId</a></li><li data-type="method" id="CloudEvent-getSource-nav"><a href="CloudEvent.html#getSource">getSource</a></li><li data-type="method" id="CloudEvent-getSpecversion-nav"><a href="CloudEvent.html#getSpecversion">getSpecversion</a></li><li data-type="method" id="CloudEvent-getTime-nav"><a href="CloudEvent.html#getTime">getTime</a></li><li data-type="method" id="CloudEvent-getType-nav"><a href="CloudEvent.html#getType">getType</a></li><li data-type="method" id="CloudEvent-id-nav"><a href="CloudEvent.html#id">id</a></li><li data-type="method" id="CloudEvent-source-nav"><a href="CloudEvent.html#source">source</a></li><li data-type="method" id="CloudEvent-time-nav"><a href="CloudEvent.html#time">time</a></li><li data-type="method" id="CloudEvent-toString-nav"><a href="CloudEvent.html#toString">toString</a></li><li data-type="method" id="CloudEvent-type-nav"><a href="CloudEvent.html#type">type</a></li></ul></li><li id="HTTPReceiver-nav"><a href="HTTPReceiver.html">HTTPReceiver</a><ul class='methods'><li data-type="method" id="HTTPReceiver-accept-nav"><a href="HTTPReceiver.html#accept">accept</a></li></ul></li></ul>
<h3>Classes</h3><ul><li id="BinaryHTTPEmitter-nav"><a href="BinaryHTTPEmitter.html">BinaryHTTPEmitter</a><ul class='methods'><li data-type="method" id="BinaryHTTPEmitter-emit-nav"><a href="BinaryHTTPEmitter.html#emit">emit</a></li></ul></li><li id="BinaryHTTPReceiver-nav"><a href="BinaryHTTPReceiver.html">BinaryHTTPReceiver</a><ul class='methods'><li data-type="method" id="BinaryHTTPReceiver-check-nav"><a href="BinaryHTTPReceiver.html#check">check</a></li><li data-type="method" id="BinaryHTTPReceiver-parse-nav"><a href="BinaryHTTPReceiver.html#parse">parse</a></li></ul></li><li id="CloudEvent-nav"><a href="CloudEvent.html">CloudEvent</a><ul class='methods'><li data-type="method" id="CloudEvent-addExtension-nav"><a href="CloudEvent.html#addExtension">addExtension</a></li><li data-type="method" id="CloudEvent-data-nav"><a href="CloudEvent.html#data">data</a></li><li data-type="method" id="CloudEvent-dataContenttype-nav"><a href="CloudEvent.html#dataContenttype">dataContenttype</a></li><li data-type="method" id="CloudEvent-format-nav"><a href="CloudEvent.html#format">format</a></li><li data-type="method" id="CloudEvent-getData-nav"><a href="CloudEvent.html#getData">getData</a></li><li data-type="method" id="CloudEvent-getDataContenttype-nav"><a href="CloudEvent.html#getDataContenttype">getDataContenttype</a></li><li data-type="method" id="CloudEvent-getExtensions-nav"><a href="CloudEvent.html#getExtensions">getExtensions</a></li><li data-type="method" id="CloudEvent-getFormats-nav"><a href="CloudEvent.html#getFormats">getFormats</a></li><li data-type="method" id="CloudEvent-getId-nav"><a href="CloudEvent.html#getId">getId</a></li><li data-type="method" id="CloudEvent-getSource-nav"><a href="CloudEvent.html#getSource">getSource</a></li><li data-type="method" id="CloudEvent-getSpecversion-nav"><a href="CloudEvent.html#getSpecversion">getSpecversion</a></li><li data-type="method" id="CloudEvent-getTime-nav"><a href="CloudEvent.html#getTime">getTime</a></li><li data-type="method" id="CloudEvent-getType-nav"><a href="CloudEvent.html#getType">getType</a></li><li data-type="method" id="CloudEvent-id-nav"><a href="CloudEvent.html#id">id</a></li><li data-type="method" id="CloudEvent-source-nav"><a href="CloudEvent.html#source">source</a></li><li data-type="method" id="CloudEvent-time-nav"><a href="CloudEvent.html#time">time</a></li><li data-type="method" id="CloudEvent-toString-nav"><a href="CloudEvent.html#toString">toString</a></li><li data-type="method" id="CloudEvent-type-nav"><a href="CloudEvent.html#type">type</a></li></ul></li><li id="HTTPEmitter-nav"><a href="HTTPEmitter.html">HTTPEmitter</a><ul class='methods'><li data-type="method" id="HTTPEmitter-headers-nav"><a href="HTTPEmitter.html#headers">headers</a></li><li data-type="method" id="HTTPEmitter-send-nav"><a href="HTTPEmitter.html#send">send</a></li></ul></li><li id="HTTPReceiver-nav"><a href="HTTPReceiver.html">HTTPReceiver</a><ul class='methods'><li data-type="method" id="HTTPReceiver-accept-nav"><a href="HTTPReceiver.html#accept">accept</a></li></ul></li><li id="StructuredHTTPEmitter-nav"><a href="StructuredHTTPEmitter.html">StructuredHTTPEmitter</a><ul class='methods'><li data-type="method" id="StructuredHTTPEmitter-emit-nav"><a href="StructuredHTTPEmitter.html#emit">emit</a></li></ul></li><li id="ValidationError-nav"><a href="ValidationError.html">ValidationError</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -119,7 +119,7 @@ <h2>Constructor</h2>
</svg>
</a>
<h4 class="name" id="CloudEvent">
<span class="type-signature"></span>new CloudEvent<span class="signature">(UserSpec<span class="signature-attributes">opt</span>, UserFormatter<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span>
<span class="type-signature"></span>new CloudEvent<span class="signature">(userSpec<span class="signature-attributes">opt</span>, userFormatter<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span>
</h4>
</span>

Expand Down Expand Up @@ -163,7 +163,7 @@ <h5>Parameters:</h5>

<tr>

<td class="name"><code>UserSpec</code></td>
<td class="name"><code>userSpec</code></td>


<td class="type">
Expand Down Expand Up @@ -202,7 +202,7 @@ <h5>Parameters:</h5>

<tr>

<td class="name"><code>UserFormatter</code></td>
<td class="name"><code>userFormatter</code></td>


<td class="type">
Expand Down Expand Up @@ -397,7 +397,7 @@ <h5>Parameters:</h5>


<td class="description last">
<p>the name of the exteneion attribute</p>
<p>the name of the extension attribute</p>

</td>
</tr>
Expand Down Expand Up @@ -843,7 +843,7 @@ <h4 class="name" id="format">


<div class="description">
<p>Format the CloudEvent as JSON. Validates the event according
<p>Formats the CloudEvent as JSON. Validates the event according
to the CloudEvent specification and throws an exception if
it's invalid.</p>
</div>
Expand Down
Loading

0 comments on commit 6f0b5ea

Please sign in to comment.