diffusion
Version:
Diffusion JavaScript client
60 lines (59 loc) • 2.9 kB
JavaScript
;
/**
* @module Services.RemoteServers
*/
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.CreateRemoteServerResultSerialiser = exports.CreateRemoteServerResultSerialiserClass = 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 read_remote_server_1 = require("./../../services/remote-servers/read-remote-server");
var create_remote_server_result_1 = require("./create-remote-server-result");
/**
* Serialiser for {@link CreateRemoteServerResult}
*/
var CreateRemoteServerResultSerialiserClass = /** @class */ (function (_super) {
__extends(CreateRemoteServerResultSerialiserClass, _super);
function CreateRemoteServerResultSerialiserClass() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Read a {@link CreateRemoteServerResultSerialiserClass} from the stream
*
* @param bis the input stream
* @return the {@link CreateRemoteServerResultSerialiserClass} that was read
*/
CreateRemoteServerResultSerialiserClass.prototype.read = function (bis) {
if (bis.peek() === 0) {
// consume the zero from the input stream
Codec.readByte(bis);
var server = read_remote_server_1.readRemoteServer(bis);
return new create_remote_server_result_1.CreateRemoteServerResult(server);
}
else {
var errors = error_report_list_serialiser_1.ErrorReportListSerialiser.read(bis);
return new create_remote_server_result_1.CreateRemoteServerResult(undefined, errors);
}
};
return CreateRemoteServerResultSerialiserClass;
}(serialiser_1.AbstractSerialiser));
exports.CreateRemoteServerResultSerialiserClass = CreateRemoteServerResultSerialiserClass;
/**
* The {@link CreateRemoteServerResultSerialiser} singleton
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
exports.CreateRemoteServerResultSerialiser = new CreateRemoteServerResultSerialiserClass();