|
| 1 | +// Copyright 2021 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +/** |
| 16 | + * The CloudEvents v1.0 context attributes. |
| 17 | + * {@link https://github.com/cloudevents/spec/blob/v1.0.1/spec.md#context-attributes} |
| 18 | + * @public |
| 19 | + */ |
| 20 | +export interface CloudEventsContext { |
| 21 | + /** |
| 22 | + * ID of the event. |
| 23 | + */ |
| 24 | + id: string; |
| 25 | + /** |
| 26 | + * The event producer. |
| 27 | + */ |
| 28 | + source: string; |
| 29 | + /** |
| 30 | + * The version of the CloudEvents specification which the event uses. |
| 31 | + */ |
| 32 | + specversion: string; |
| 33 | + /** |
| 34 | + * Type of occurrence which has happened. |
| 35 | + */ |
| 36 | + type: string; |
| 37 | + /** |
| 38 | + * Timestamp of when the event happened. |
| 39 | + */ |
| 40 | + time?: string; |
| 41 | + /** |
| 42 | + * Describes the subject of the event in the context of the event producer. |
| 43 | + */ |
| 44 | + subject?: string; |
| 45 | + /** |
| 46 | + * A link to the schema that the event data adheres to. |
| 47 | + */ |
| 48 | + dataschema?: string; |
| 49 | + /** |
| 50 | + * Content type of the event data. |
| 51 | + */ |
| 52 | + datacontenttype?: string; |
| 53 | + /** |
| 54 | + * The traceparent string, containing a trace version, trace ID, span ID, and trace options. |
| 55 | + * @see https://github.com/cloudevents/spec/blob/master/extensions/distributed-tracing.md |
| 56 | + */ |
| 57 | + traceparent?: string; |
| 58 | + /** |
| 59 | + * The event payload. |
| 60 | + */ |
| 61 | + // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 62 | + data?: any; |
| 63 | +} |
0 commit comments