UNPKG

diffusion

Version:

Diffusion JavaScript client

158 lines (157 loc) 5.79 kB
"use strict"; /** * @module diffusion.topics */ Object.defineProperty(exports, "__esModule", { value: true }); exports.TopicTypeEnum = exports.TopicType = void 0; var enumerize_1 = require("./../internal/util/enumerize"); /** * A topic type * * Documentation of the TopicType values can be found under {@link TopicTypeEnum}. */ var TopicType = /** @class */ (function () { /** * Create a new TopicType instance * * @deprecated since 6.5 * <p> * In the future, TopicType objects will be replaced by a string * constants. * * @param id the topic type ID * @param stateful a flag indicating whether the topic type is stateful * @param functional a flag indicating whether the topic type is functional */ function TopicType(id, stateful, functional) { // eslint-disable-next-line deprecation/deprecation this.id = id; // eslint-disable-next-line deprecation/deprecation this.stateful = stateful; // eslint-disable-next-line deprecation/deprecation this.functional = functional; } return TopicType; }()); exports.TopicType = TopicType; /** * Enum containing possible Topic Types. * * **Example:** * ``` * // Get a topic type for adding topics * var topicType = diffusion.topics.TopicType.JSON; * * session.topics.add("foo", topicType); * ``` */ // eslint-disable-next-line @typescript-eslint/naming-convention exports.TopicTypeEnum = { /** * Binary Topic. * * This is a stateful topic that handles data in Binary format. * @since 5.7 */ // eslint-disable-next-line deprecation/deprecation BINARY: new TopicType(14, true, false), /** * JSON (JavaScript Object Notation) Topic. * * This is a stateful topic that handles data in JSON representation. * @since 5.7 */ // eslint-disable-next-line deprecation/deprecation JSON: new TopicType(15, true, false), /** * Topic that stores and publishes String values. Based on the {@link string string data type}. * * Supports null String values. * * Supports delta-streams. * * @since 6.0 */ // eslint-disable-next-line deprecation/deprecation STRING: new TopicType(17, true, false), /** * Topic that stores and publishes 64-bit integer values. Based on the * {@link int64 int64 data type}. Values are of the type * {@link Int64}. * * Supports null int64 values. * * Does not support delta-streams - only complete values are transmitted. * * @since 6.0 */ // eslint-disable-next-line deprecation/deprecation INT64: new TopicType(18, true, false), /** * Topic that stores and publishes IEEE 754 double-precision floating point * numbers (i.e native JavaScript Numbers). Based on the {@link double double data type}. * * Supports null Double values. * * The topic does not support delta-streams - only complete values are transmitted. * * @since 6.0 */ // eslint-disable-next-line deprecation/deprecation DOUBLE: new TopicType(19, true, false), /** * Time Series Topic. * * A <em>time series</em> is a sequence of events. Each event contains a * value and has server-assigned metadata comprised of a sequence number, * timestamp, and author. * * A time series topic allows sessions to access a time series that is * maintained by the server. A time series topic has an associated * {@link DataType event data type}, such as `Binary`, `String`, * or `JSON`, that determines the type of value associated with each * event. * * <h4>Retained range</h4> * * The {@link TopicSpecification.TIME_SERIES_SUBSCRIPTION_RANGE * TIME_SERIES_SUBSCRIPTION_RANGE} property configures the range of historic * events retained by a time series topic. If the property is not specified, * a time series topic will retain the ten most recent events. * * <h4>Subscription range</h4> * * The {@link TopicSpecification.TIME_SERIES_SUBSCRIPTION_RANGE * TIME_SERIES_SUBSCRIPTION_RANGE} property configures a time series topic * to send a range of historic events from the end of the time series to new * subscribers. This is a convenient way to synchronize new subscribers * without requiring the use of a {@link TimeSeries.rangeQuery range query}. * * By default, new subscribers will be sent the latest event if delta * streams are enabled and no events if delta streams are disabled. See the * description of <em>Subscription range</em> in the {@link * Session.timeseries} time series feature} documentation. * * * <h4>Mandatory properties</h4> * * The {@link TopicSpecification.TIME_SERIES_EVENT_VALUE_TYPE * TIME_SERIES_EVENT_VALUE_TYPE} property must be provided when creating a * time series topic. * * * @since 6.0 * @see diffusion.datatypes.TimeSeriesDataType */ // eslint-disable-next-line deprecation/deprecation TIME_SERIES: new TopicType(16, true, false), /** * Topic that stores and publishes data in the form of records and fields. * Based on the {@link RecordV2DataType RecordV2 data type}. * * Supports delta-streams. * * @since 6.0 */ // eslint-disable-next-line deprecation/deprecation RECORD_V2: new TopicType(20, true, false), /** * A topic type that is unsupported by the session. * * @since 6.3 */ // eslint-disable-next-line deprecation/deprecation UNKNOWN_TOPIC_TYPE: new TopicType(21, false, false) }; enumerize_1.enumerize(exports.TopicTypeEnum);