@@ -140,139 +140,3 @@ export interface CloudEventV1OptionalAttributes {
140140 */
141141 [ key : string ] : unknown ;
142142}
143-
144- /**
145- * The object interface for CloudEvents 0.3.
146- * @see https://github.com/cloudevents/spec/blob/v0.3/spec.md
147- */
148-
149- export interface CloudEventV03 extends CloudEventV03Attributes {
150- // REQUIRED Attributes
151- /**
152- * [REQUIRED] Identifies the event. Producers MUST ensure that `source` + `id`
153- * is unique for each distinct event. If a duplicate event is re-sent (e.g. due
154- * to a network error) it MAY have the same `id`. Consumers MAY assume that
155- * Events with identical `source` and `id` are duplicates.
156- * @required Non-empty string. Unique within producer.
157- * @example An event counter maintained by the producer
158- * @example A UUID
159- */
160- id : string ;
161- /**
162- * [REQUIRED] The version of the CloudEvents specification which the event
163- * uses. This enables the interpretation of the context. Compliant event
164- * producers MUST use a value of `1.0` when referring to this version of the
165- * specification.
166- * @required MUST be a non-empty string.
167- */
168- specversion : string ;
169- }
170-
171- export interface CloudEventV03Attributes extends CloudEventV03OptionalAttributes {
172- /**
173- * [REQUIRED] Identifies the context in which an event happened. Often this
174- * will include information such as the type of the event source, the
175- * organization publishing the event or the process that produced the event. The
176- * exact syntax and semantics behind the data encoded in the URI is defined by
177- * the event producer.
178- * Producers MUST ensure that `source` + `id` is unique for each distinct event.
179- * An application MAY assign a unique `source` to each distinct producer, which
180- * makes it easy to produce unique IDs since no other producer will have the same
181- * source. The application MAY use UUIDs, URNs, DNS authorities or an
182- * application-specific scheme to create unique `source` identifiers.
183- * A source MAY include more than one producer. In that case the producers MUST
184- * collaborate to ensure that `source` + `id` is unique for each distinct event.
185- * @required Non-empty URI-reference
186- */
187- source : string ;
188- /**
189- * [REQUIRED] This attribute contains a value describing the type of event
190- * related to the originating occurrence. Often this attribute is used for
191- * routing, observability, policy enforcement, etc. The format of this is
192- * producer defined and might include information such as the version of the
193- * `type` - see
194- * [Versioning of Attributes in the Primer](primer.md#versioning-of-attributes)
195- * for more information.
196- * @required MUST be a non-empty string
197- * @should SHOULD be prefixed with a reverse-DNS name. The prefixed domain dictates the
198- * organization which defines the semantics of this event type.
199- * @example com.github.pull.create
200- * @example com.example.object.delete.v2
201- */
202- type : string ;
203- }
204-
205- export interface CloudEventV03OptionalAttributes {
206- /**
207- * The following fields are optional.
208- */
209-
210- /**
211- * [OPTIONAL] Describes the content encoding for the data attribute for when the
212- * data field MUST be encoded as a string, like with structured transport binding
213- * modes using the JSON event format, but the datacontenttype indicates a non-string
214- * media type. When the data field's effective data type is not String, this attribute
215- * MUST NOT be set and MUST be ignored when set.
216- */
217- datacontentencoding ?: string ;
218-
219- /**
220- * [OPTIONAL] Content type of `data` value. This attribute enables `data` to
221- * carry any type of content, whereby format and encoding might differ from that
222- * of the chosen event format. For example, an event rendered using the
223- * [JSON envelope](./json-format.md#3-envelope) format might carry an XML payload
224- * in `data`, and the consumer is informed by this attribute being set to
225- * "application/xml". The rules for how `data` content is rendered for different
226- * `datacontenttype` values are defined in the event format specifications; for
227- * example, the JSON event format defines the relationship in
228- * [section 3.1](./json-format.md#31-handling-of-data).
229- */
230- datacontenttype ?: string ;
231- /**
232- * [OPTIONAL] A link to the schema that the data attribute adheres to.
233- * Incompatible changes to the schema SHOULD be reflected by a different URL.
234- * If present, MUST be a non-empty URI.
235- */
236- schemaurl ?: string ;
237- /**
238- * [OPTIONAL] This describes the subject of the event in the context of the
239- * event producer (identified by `source`). In publish-subscribe scenarios, a
240- * subscriber will typically subscribe to events emitted by a `source`, but the
241- * `source` identifier alone might not be sufficient as a qualifier for any
242- * specific event if the `source` context has internal sub-structure.
243- *
244- * Identifying the subject of the event in context metadata (opposed to only in
245- * the `data` payload) is particularly helpful in generic subscription filtering
246- * scenarios where middleware is unable to interpret the `data` content. In the
247- * above example, the subscriber might only be interested in blobs with names
248- * ending with '.jpg' or '.jpeg' and the `subject` attribute allows for
249- * constructing a simple and efficient string-suffix filter for that subset of
250- * events.
251- *
252- * If present, MUST be a non-empty string.
253- * @example "https://example.com/storage/tenant/container"
254- * @example "mynewfile.jpg"
255- */
256- subject ?: string ;
257- /**
258- * [OPTIONAL] Timestamp of when the occurrence happened. If the time of the
259- * occurrence cannot be determined then this attribute MAY be set to some other
260- * time (such as the current time) by the CloudEvents producer, however all
261- * producers for the same `source` MUST be consistent in this respect. In other
262- * words, either they all use the actual time of the occurrence or they all use
263- * the same algorithm to determine the value used.
264- * @example "2020-08-08T14:48:09.769Z"
265- */
266- time ?: string ;
267- /**
268- * [OPTIONAL] The event payload. This specification does not place any restriction
269- * on the type of this information. It is encoded into a media format which is
270- * specified by the datacontenttype attribute (e.g. application/json), and adheres
271- * to the dataschema format when those respective attributes are present.
272- */
273- data ?: Record < string , unknown | string | number | boolean > | string | number | boolean | null | unknown ;
274- /**
275- * [OPTIONAL] CloudEvents extension attributes.
276- */
277- [ key : string ] : unknown ;
278- }
0 commit comments