UNPKG

diffusion

Version:

Diffusion JavaScript client

60 lines (59 loc) 2.59 kB
"use strict"; /** * @module Services.ControlClient */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.GetSelectorsResultSerialiser = exports.GetSelectorsResultSerialiserClass = void 0; var topic_selection_1 = require("./../../../topics/topic-selection"); var Codec = require("./../../io/codec"); var BEES = require("./../../serialisers/byte-encoded-enum-serialiser"); var serialiser_1 = require("./../../serialisers/serialiser"); function readStringTopicSelection(bis) { var selectorExpression = Codec.readString(bis); var selectorType = BEES.read(bis, topic_selection_1.TopicSelectionType); return { selectorExpression: selectorExpression, selectionType: selectorType }; } /** * Serialiser for {@link GetSelectorsResult} */ var GetSelectorsResultSerialiserClass = /** @class */ (function (_super) { __extends(GetSelectorsResultSerialiserClass, _super); function GetSelectorsResultSerialiserClass() { return _super !== null && _super.apply(this, arguments) || this; } /** * Read a {@link GetSelectorsResult} from the stream * * @param bis the input stream * @return the {@link GetSelectorsResult} that was read */ GetSelectorsResultSerialiserClass.prototype.read = function (bis) { return { scopeMap: Codec.readDictionary(bis, function (bis) { return Codec.readCollection(bis, readStringTopicSelection); }) }; }; return GetSelectorsResultSerialiserClass; }(serialiser_1.AbstractSerialiser)); exports.GetSelectorsResultSerialiserClass = GetSelectorsResultSerialiserClass; /** * The {@link GetSelectorsResultSerialiser} singleton */ // eslint-disable-next-line @typescript-eslint/naming-convention exports.GetSelectorsResultSerialiser = new GetSelectorsResultSerialiserClass();