UNPKG

diffusion

Version:

Diffusion JavaScript client

72 lines (71 loc) 3.2 kB
"use strict"; /** * @module Services.SessionFetchQuery */ 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.SessionFetchQueryResultSerialiser = exports.SessionFetchQueryResultSerialiserClass = void 0; var Codec = require("./../../io/codec"); var serialiser_1 = require("./../../serialisers/serialiser"); var error_report_list_serialiser_1 = require("./../../services/error-report-list-serialiser"); var session_fetch_query_result_1 = require("./../../services/session-fetch-query/session-fetch-query-result"); /** * Read a session property map from the stream * * @param bis the input stream * @return the property map that was read */ function readSession(bis) { var startTime = Codec.readOptional(bis, Codec.readInt64); var properties = Codec.readDictionary(bis, Codec.readString); if (startTime) { properties.$StartTime = startTime.toString(); } return properties; } /** * Serialiser for {@link SessionFetchQueryResult} */ var SessionFetchQueryResultSerialiserClass = /** @class */ (function (_super) { __extends(SessionFetchQueryResultSerialiserClass, _super); function SessionFetchQueryResultSerialiserClass() { return _super !== null && _super.apply(this, arguments) || this; } /** * Read a {@link SessionFetchQueryResult} from the stream * * @param bis the input stream * @return the {@link SessionFetchQueryResult} that was read */ SessionFetchQueryResultSerialiserClass.prototype.read = function (bis) { if (Codec.readByte(bis) === 0) { var sessions = Codec.readCollection(bis, readSession); var totalSelected = Codec.readInt32(bis); return new session_fetch_query_result_1.SessionFetchQueryResult(sessions, totalSelected); } else { var errors = error_report_list_serialiser_1.ErrorReportListSerialiser.read(bis); return new session_fetch_query_result_1.SessionFetchQueryResult(undefined, undefined, errors); } }; return SessionFetchQueryResultSerialiserClass; }(serialiser_1.AbstractSerialiser)); exports.SessionFetchQueryResultSerialiserClass = SessionFetchQueryResultSerialiserClass; /** * The {@link SessionFetchQueryResultSerialiser} singleton */ // eslint-disable-next-line @typescript-eslint/naming-convention exports.SessionFetchQueryResultSerialiser = new SessionFetchQueryResultSerialiserClass();