Skip to content

Commit 6f0b5ea

Browse files
authored
lib!: refactor HTTP bindings and specifications (#165)
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>
1 parent b99e6ea commit 6f0b5ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4593
-900
lines changed

Diff for: docs/BinaryHTTPEmitter.html

+535
Large diffs are not rendered by default.

Diff for: docs/BinaryHTTPReceiver.html

+715
Large diffs are not rendered by default.

Diff for: docs/CloudEvent.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ <h3>
7373

7474

7575

76-
<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>
76+
<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>
7777
</nav>
7878

7979
<div id="main">
@@ -119,7 +119,7 @@ <h2>Constructor</h2>
119119
</svg>
120120
</a>
121121
<h4 class="name" id="CloudEvent">
122-
<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>
122+
<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>
123123
</h4>
124124
</span>
125125

@@ -163,7 +163,7 @@ <h5>Parameters:</h5>
163163

164164
<tr>
165165

166-
<td class="name"><code>UserSpec</code></td>
166+
<td class="name"><code>userSpec</code></td>
167167

168168

169169
<td class="type">
@@ -202,7 +202,7 @@ <h5>Parameters:</h5>
202202

203203
<tr>
204204

205-
<td class="name"><code>UserFormatter</code></td>
205+
<td class="name"><code>userFormatter</code></td>
206206

207207

208208
<td class="type">
@@ -397,7 +397,7 @@ <h5>Parameters:</h5>
397397

398398

399399
<td class="description last">
400-
<p>the name of the exteneion attribute</p>
400+
<p>the name of the extension attribute</p>
401401

402402
</td>
403403
</tr>
@@ -843,7 +843,7 @@ <h4 class="name" id="format">
843843

844844

845845
<div class="description">
846-
<p>Format the CloudEvent as JSON. Validates the event according
846+
<p>Formats the CloudEvent as JSON. Validates the event according
847847
to the CloudEvent specification and throws an exception if
848848
it's invalid.</p>
849849
</div>

0 commit comments

Comments
 (0)