// ----------------------------------------------------------------------------- // Enum Typedefs // ----------------------------------------------------------------------------- /** * A type for a topic's schema field. * @typedef {"boolean" | "date-iso8601" | "date-time-iso8601" | "decimal" | "double" | "integer" | "long" | "string" | "uuid" | "object"} ScalarType */ // ----------------------------------------------------------------------------- // Model Typedefs // ----------------------------------------------------------------------------- /** * Deletes a reporting entity defined by its `tracking_id`. * @typedef {Object} DeleteEvent * @property {string} tracking_id A unique id, which identifies the association of multiple events. This can i.e. be a user guid, for events related to a user. It is important, that this id is unique and immutable. * @property {Audit} audit Audit information about this event. */ /** * Single field of a topic schema. A field can be used for projecting, filtering and sorting in reports. * @typedef {Object} Field * @property {ScalarType} type The (scalar) type of the field. Fields can only be primitive types. * @property {boolean} is_array Setting this to `true` means the field is an array of given type. * @property {Object.} [fields] Nested fields for type `object`. When defining fields but not having set the type to `object`, the fields will be ignored. When setting the type to `object`, the fields need to be defined. * @property {string} [label] A human-readable label for the field. * @property {string} [description] A human-readable description of the field. */ /** * Defines a condition for values. * @typedef {Object} Filter * @property {string} [expression] An SQL-like expression. * @property {Object.} [variables] A map of values, which can be used in the expression. Variables can be access by prepending them with `$`. */ /** * A single field of a projection schema. * @typedef {Object} ProjectionField * @property {string} [label] A human-readable label for the field. * @property {string} [description] A human-readable description for the field. * @property {ProjectionFieldSource} [source] The source of the field. Either `source` or `fields` must be set. * @property {Object.} [fields] Defines nested fields for this projection. Either `source` or `fields` must be set. */ /** * Represents the source for a single projection field from a topic's schema. * @typedef {Object} ProjectionFieldSource * @property {string} topic Name of the originating topic. * @property {string} path A slimmed down variant of [JSON Path](https://gregsdennis.github.io/Manatee.Json/usage/path.html) to point to a specific field in a topic's schema. * @property {string} filter A conditional filter expression. The expression can contain variables, which will be passed in when evaluating the projection. */ /** * Form for querying and projecting data. * @typedef {Object} QueryForm * @property {string} [view] The name of a defined `view` used for projecting. If the view defines variables, they must be provided as well. Either `view` or `projection` must be set. * @property {Object.} [projection] Projected fields to return. Either `view` or `projection` must be set. * @property {Object.} variables Variables to pass to the projection or the view. * @property {Sort[]} [sort] The defined properties refer to the fields of the projection. */ /** * The result of a query, returning data in a projected form. * @typedef {Object} QueryResponse * @property {PageResponse} page * @property {Object} data The returned data in the projected form. */ /** * Represents a single topic, which will be consumed by the reporting service. * @typedef {Object} Topic * @property {string} name * @property {ServiceInfo} service Info about the producing service. * @property {Object.} schema The schema of the topics' provided data. */ /** * @typedef {Object} TopicResponse * @property {PageResponse} page * @property {Topic[]} data */ /** * Updates one or more data fields. * @typedef {Object} UpdateEvent * @property {string} tracking_id A unique id, which identifies the association of multiple events. This can i.e. be a user guid, for events related to a user. It is important, that this id is unique and immutable. * @property {Object} payload One or more fields defined in the reporting schema, which will be updated. * @property {Audit} audit Audit information about this event. */ /** * A stored view containing data from one or more topics. * @typedef {Object} View * @property {string} guid Globally unique identifier of the projection. * @property {string} name Name of this projection used to reference it in a human-friendly way. The name must be unique. * @property {Object.} projection Projected fields of this view. * @property {Object.} variables Definition of variables which can be passed to the view. All `scalar_type`s are allowed, except `object`. */ /** * Form for creating a new `view`. * @typedef {Object} ViewForm * @property {string} name Name of the view. * @property {Object.} projection Projected fields of this view. * @property {Object.} variables Definition of variables which can be passed to the view. All `scalar_type`s are allowed, except `object`. */ /** * @typedef {Object} ViewResponse * @property {PageResponse} page * @property {View[]} data */ // ----------------------------------------------------------------------------- // Union Typedefs // ----------------------------------------------------------------------------- /** * @typedef {(UpdateEvent & { type: "update_event" } | DeleteEvent & { type: "delete_event" })} ReportingEvent */