129 lines
49 KiB
HTML
129 lines
49 KiB
HTML
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>CloudEvent | cloudevents</title><meta name="description" content="Documentation for cloudevents"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">cloudevents</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">cloudevents</a></li><li><a href="CloudEvent.html">CloudEvent</a></li></ul><h1>Class CloudEvent<T> </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>A CloudEvent describes event data in common formats to provide
|
||
interoperability across services, platforms and systems.</p>
|
||
</div><dl class="tsd-comment-tags"><dt>see</dt><dd><p><a href="https://github.com/cloudevents/spec/blob/v1.0/spec.md">https://github.com/cloudevents/spec/blob/v1.0/spec.md</a></p>
|
||
</dd></dl></div></section><section class="tsd-panel tsd-type-parameters"><h3>Type Parameters</h3><ul class="tsd-type-parameters"><li><h4>T = <span class="tsd-signature-type">undefined</span></h4></li></ul></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">CloudEvent</span></li></ul></section><section class="tsd-panel"><h3>Implements</h3><ul class="tsd-hierarchy"><li><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span></li></ul></section><section class="tsd-panel tsd-kind-class tsd-has-type-parameter"><h3 class="tsd-before-signature">Indexable</h3><div class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">unknown</span></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter"><a href="CloudEvent.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#data" class="tsd-kind-icon">data</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#data_base64" class="tsd-kind-icon">data_<wbr/>base64</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#datacontenttype" class="tsd-kind-icon">datacontenttype</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#dataschema" class="tsd-kind-icon">dataschema</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#id" class="tsd-kind-icon">id</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#source" class="tsd-kind-icon">source</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#specversion" class="tsd-kind-icon">specversion</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#subject" class="tsd-kind-icon">subject</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#time" class="tsd-kind-icon">time</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#type" class="tsd-kind-icon">type</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a href="CloudEvent.html#cloneWith" class="tsd-kind-icon">clone<wbr/>With</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CloudEvent.html#emit" class="tsd-kind-icon">emit</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CloudEvent.html#toJSON" class="tsd-kind-icon">toJSON</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CloudEvent.html#toString" class="tsd-kind-icon">to<wbr/>String</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CloudEvent.html#validate" class="tsd-kind-icon">validate</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="CloudEvent.html#cloneWith-1" class="tsd-kind-icon">clone<wbr/>With</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link">constructor<a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter"><li class="tsd-signature tsd-kind-icon">new <wbr/>Cloud<wbr/>Event<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span>, strict<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L53">src/event/cloudevent.ts:53</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>Creates a new CloudEvent object with the provided properties. If there is a chance that the event
|
||
properties will not conform to the CloudEvent specification, you may pass a boolean <code>false</code> as a
|
||
second parameter to bypass event validation.</p>
|
||
</div></div><h4 class="tsd-type-parameters-title">Type Parameters</h4><ul class="tsd-type-parameters"><li><h4>T = <span class="tsd-signature-type">undefined</span></h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>event: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>the event properties</p>
|
||
</div></div></li><li><h5>strict: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>whether to perform event validation when creating the object - default: true</p>
|
||
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="data" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> data<a href="#data" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">data<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#data">data</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L34">src/event/cloudevent.ts:34</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[OPTIONAL] The event payload. This specification does not place any restriction
|
||
on the type of this information. It is encoded into a media format which is
|
||
specified by the datacontenttype attribute (e.g. application/json), and adheres
|
||
to the dataschema format when those respective attributes are present.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="data_base64" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> data_<wbr/>base64<a href="#data_base64" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">data_<wbr/>base64<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#data_base64">data_base64</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L35">src/event/cloudevent.ts:35</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[OPTIONAL] The event payload encoded as base64 data. This is used when the
|
||
data is in binary form.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="datacontenttype" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> datacontenttype<a href="#datacontenttype" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">datacontenttype<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#datacontenttype">datacontenttype</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L30">src/event/cloudevent.ts:30</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[OPTIONAL] Content type of <code>data</code> value. This attribute enables <code>data</code> to
|
||
carry any type of content, whereby format and encoding might differ from that
|
||
of the chosen event format. For example, an event rendered using the
|
||
<a href="./json-format.md#3-envelope">JSON envelope</a> format might carry an XML payload
|
||
in <code>data</code>, and the consumer is informed by this attribute being set to
|
||
"application/xml". The rules for how <code>data</code> content is rendered for different
|
||
<code>datacontenttype</code> values are defined in the event format specifications; for
|
||
example, the JSON event format defines the relationship in
|
||
<a href="./json-format.md#31-handling-of-data">section 3.1</a>.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="dataschema" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> dataschema<a href="#dataschema" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">dataschema<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#dataschema">dataschema</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L31">src/event/cloudevent.ts:31</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[OPTIONAL] Identifies the schema that <code>data</code> adheres to. Incompatible
|
||
changes to the schema SHOULD be reflected by a different URI. See
|
||
<a href="primer.md#versioning-of-attributes">Versioning of Attributes in the Primer</a>
|
||
for more information.
|
||
If present, MUST be a non-empty URI.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="id" class="tsd-anchor"></a><h3 class="tsd-anchor-link">id<a href="#id" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#id">id</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L26">src/event/cloudevent.ts:26</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[REQUIRED] Identifies the event. Producers MUST ensure that <code>source</code> + <code>id</code>
|
||
is unique for each distinct event. If a duplicate event is re-sent (e.g. due
|
||
to a network error) it MAY have the same <code>id</code>. Consumers MAY assume that
|
||
Events with identical <code>source</code> and <code>id</code> are duplicates.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="source" class="tsd-anchor"></a><h3 class="tsd-anchor-link">source<a href="#source" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">source<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#source">source</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L28">src/event/cloudevent.ts:28</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[REQUIRED] Identifies the context in which an event happened. Often this
|
||
will include information such as the type of the event source, the
|
||
organization publishing the event or the process that produced the event. The
|
||
exact syntax and semantics behind the data encoded in the URI is defined by
|
||
the event producer.
|
||
Producers MUST ensure that <code>source</code> + <code>id</code> is unique for each distinct event.
|
||
An application MAY assign a unique <code>source</code> to each distinct producer, which
|
||
makes it easy to produce unique IDs since no other producer will have the same
|
||
source. The application MAY use UUIDs, URNs, DNS authorities or an
|
||
application-specific scheme to create unique <code>source</code> identifiers.
|
||
A source MAY include more than one producer. In that case the producers MUST
|
||
collaborate to ensure that <code>source</code> + <code>id</code> is unique for each distinct event.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="specversion" class="tsd-anchor"></a><h3 class="tsd-anchor-link">specversion<a href="#specversion" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">specversion<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#specversion">specversion</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L29">src/event/cloudevent.ts:29</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[REQUIRED] The version of the CloudEvents specification which the event
|
||
uses. This enables the interpretation of the context. Compliant event
|
||
producers MUST use a value of <code>1.0</code> when referring to this version of the
|
||
specification.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="subject" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> subject<a href="#subject" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">subject<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#subject">subject</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L32">src/event/cloudevent.ts:32</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[OPTIONAL] This describes the subject of the event in the context of the
|
||
event producer (identified by <code>source</code>). In publish-subscribe scenarios, a
|
||
subscriber will typically subscribe to events emitted by a <code>source</code>, but the
|
||
<code>source</code> identifier alone might not be sufficient as a qualifier for any
|
||
specific event if the <code>source</code> context has internal sub-structure.</p>
|
||
</div><div><p>Identifying the subject of the event in context metadata (opposed to only in
|
||
the <code>data</code> payload) is particularly helpful in generic subscription filtering
|
||
scenarios where middleware is unable to interpret the <code>data</code> content. In the
|
||
above example, the subscriber might only be interested in blobs with names
|
||
ending with '.jpg' or '.jpeg' and the <code>subject</code> attribute allows for
|
||
constructing a simple and efficient string-suffix filter for that subset of
|
||
events.</p>
|
||
<p>If present, MUST be a non-empty string.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="time" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagOptional">Optional</span> time<a href="#time" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">time<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#time">time</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L33">src/event/cloudevent.ts:33</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[OPTIONAL] Timestamp of when the occurrence happened. If the time of the
|
||
occurrence cannot be determined then this attribute MAY be set to some other
|
||
time (such as the current time) by the CloudEvents producer, however all
|
||
producers for the same <code>source</code> MUST be consistent in this respect. In other
|
||
words, either they all use the actual time of the occurrence or they all use
|
||
the same algorithm to determine the value used.</p>
|
||
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="type" class="tsd-anchor"></a><h3 class="tsd-anchor-link">type<a href="#type" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/CloudEventV1.html">CloudEventV1</a>.<a href="../interfaces/CloudEventV1.html#type">type</a></p><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L27">src/event/cloudevent.ts:27</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>[REQUIRED] This attribute contains a value describing the type of event
|
||
related to the originating occurrence. Often this attribute is used for
|
||
routing, observability, policy enforcement, etc. The format of this is
|
||
producer defined and might include information such as the version of the
|
||
<code>type</code> - see
|
||
<a href="primer.md#versioning-of-attributes">Versioning of Attributes in the Primer</a>
|
||
for more information.</p>
|
||
</div></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a id="cloneWith" class="tsd-anchor"></a><h3 class="tsd-anchor-link">clone<wbr/>With<a href="#cloneWith" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><li class="tsd-signature tsd-kind-icon">clone<wbr/>With<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">never</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span>, strict<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span></li><li class="tsd-signature tsd-kind-icon">clone<wbr/>With<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">D</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">D</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span>, strict<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">D</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L193">src/event/cloudevent.ts:193</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>Clone a CloudEvent with new/updated attributes</p>
|
||
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>if the CloudEvent does not conform to the schema</p>
|
||
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">never</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>attributes to augment the CloudEvent without a <code>data</code> property</p>
|
||
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> strict: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>whether or not to use strict validation when cloning (default: true)</p>
|
||
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span></h4><div><p>returns a new CloudEvent<T></p>
|
||
</div></li><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L201">src/event/cloudevent.ts:201</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>Clone a CloudEvent with new/updated attributes and new data</p>
|
||
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>if the CloudEvent does not conform to the schema</p>
|
||
</dd></dl></div><h4 class="tsd-type-parameters-title">Type Parameters</h4><ul class="tsd-type-parameters"><li><h4>D</h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">D</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>attributes to augment the CloudEvent with a <code>data</code> property and type</p>
|
||
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> strict: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>whether or not to use strict validation when cloning (default: true)</p>
|
||
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">D</span><span class="tsd-signature-symbol">></span></h4><div><p>returns a new CloudEvent<D></p>
|
||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="emit" class="tsd-anchor"></a><h3 class="tsd-anchor-link">emit<a href="#emit" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">emit<span class="tsd-signature-symbol">(</span>ensureDelivery<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L181">src/event/cloudevent.ts:181</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>Emit this CloudEvent through the application</p>
|
||
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>ensureDelivery: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>fail the promise if one listener fail</p>
|
||
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div><p>this</p>
|
||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="toJSON" class="tsd-anchor"></a><h3 class="tsd-anchor-link">toJSON<a href="#toJSON" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">toJSON<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L143">src/event/cloudevent.ts:143</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>Used by JSON.stringify(). The name is confusing, but this method is called by
|
||
JSON.stringify() when converting this object to JSON.</p>
|
||
</div><dl class="tsd-comment-tags"><dt>see</dt><dd><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify</a></p>
|
||
</dd></dl></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h4><div><p>this event as a plain object</p>
|
||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="toString" class="tsd-anchor"></a><h3 class="tsd-anchor-link">to<wbr/>String<a href="#toString" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">to<wbr/>String<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L154">src/event/cloudevent.ts:154</a></li></ul></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="validate" class="tsd-anchor"></a><h3 class="tsd-anchor-link">validate<a href="#validate" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">validate<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L163">src/event/cloudevent.ts:163</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>Validates this CloudEvent against the schema</p>
|
||
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>if the CloudEvent does not conform to the schema</p>
|
||
</dd></dl></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div><p>true if this event is valid</p>
|
||
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="cloneWith-1" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagStatic">Static</span> clone<wbr/>With<a href="#cloneWith-1" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">clone<wbr/>With<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span>, options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span>, strict<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cloudevents/sdk-javascript/blob/fc76097/src/event/cloudevent.ts#L229">src/event/cloudevent.ts:229</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>Clone a CloudEvent with new or updated attributes.</p>
|
||
</div><dl class="tsd-comment-tags"><dt>throws</dt><dd><p>{ValidationError} if <code>strict</code> is <code>true</code> and the resulting event is invalid</p>
|
||
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>event: <a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>an object that implements the <a href="../interfaces/CloudEventV1.html"><code>CloudEventV1</code></a> interface</p>
|
||
</div></div></li><li><h5>options: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/CloudEventV1.html" class="tsd-signature-type" data-tsd-kind="Interface">CloudEventV1</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p>an object with new or updated attributes</p>
|
||
</div></div></li><li><h5>strict: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
||
<p><code>true</code> if the resulting event should be valid per the CloudEvent specification</p>
|
||
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="CloudEvent.html" class="tsd-signature-type" data-tsd-kind="Class">CloudEvent</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><div><p>a CloudEvent cloned from <code>event</code> with <code>options</code> applied.</p>
|
||
</div></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class tsd-has-type-parameter"><a href="CloudEvent.html" class="tsd-kind-icon">Cloud<wbr/>Event</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter"><a href="CloudEvent.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#data" class="tsd-kind-icon">data</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#data_base64" class="tsd-kind-icon">data_<wbr/>base64</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#datacontenttype" class="tsd-kind-icon">datacontenttype</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#dataschema" class="tsd-kind-icon">dataschema</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#id" class="tsd-kind-icon">id</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#source" class="tsd-kind-icon">source</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#specversion" class="tsd-kind-icon">specversion</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#subject" class="tsd-kind-icon">subject</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#time" class="tsd-kind-icon">time</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="CloudEvent.html#type" class="tsd-kind-icon">type</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter"><a href="CloudEvent.html#cloneWith" class="tsd-kind-icon">clone<wbr/>With</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CloudEvent.html#emit" class="tsd-kind-icon">emit</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CloudEvent.html#toJSON" class="tsd-kind-icon">toJSON</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CloudEvent.html#toString" class="tsd-kind-icon">to<wbr/>String</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="CloudEvent.html#validate" class="tsd-kind-icon">validate</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="CloudEvent.html#cloneWith-1" class="tsd-kind-icon">clone<wbr/>With</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html> |