Best JavaScript code snippet using mountebank
enceladus_pb.js
Source:enceladus_pb.js
1// source: enceladus.proto2/**3 * @fileoverview4 * @enhanceable5 * @suppress {messageConventions} JS Compiler reports an error if a variable or6 * field starts with 'MSG_' and isn't a translatable message.7 * @public8 */9// GENERATED CODE -- DO NOT EDIT!10var jspb = require('google-protobuf');11var goog = jspb;12var global = Function('return this')();13var common_pb = require('./common_pb.js');14goog.object.extend(proto, common_pb);15goog.exportSymbol('proto.protocols.enceladus.PostAdminRequest', null, global);16goog.exportSymbol('proto.protocols.enceladus.PostAdminResponse', null, global);17goog.exportSymbol('proto.protocols.enceladus.PostPreviewResourceRequest', null, global);18goog.exportSymbol('proto.protocols.enceladus.PostPreviewResourceResponse', null, global);19goog.exportSymbol('proto.protocols.enceladus.PostResourceResponse', null, global);20/**21 * Generated by JsPbCodeGenerator.22 * @param {Array=} opt_data Optional initial data array, typically from a23 * server response, or constructed directly in Javascript. The array is used24 * in place and becomes part of the constructed object. It is not cloned.25 * If no data is provided, the constructed object will be empty, but still26 * valid.27 * @extends {jspb.Message}28 * @constructor29 */30proto.protocols.enceladus.PostResourceResponse = function(opt_data) {31 jspb.Message.initialize(this, opt_data, 0, -1, null, null);32};33goog.inherits(proto.protocols.enceladus.PostResourceResponse, jspb.Message);34if (goog.DEBUG && !COMPILED) {35 /**36 * @public37 * @override38 */39 proto.protocols.enceladus.PostResourceResponse.displayName = 'proto.protocols.enceladus.PostResourceResponse';40}41/**42 * Generated by JsPbCodeGenerator.43 * @param {Array=} opt_data Optional initial data array, typically from a44 * server response, or constructed directly in Javascript. The array is used45 * in place and becomes part of the constructed object. It is not cloned.46 * If no data is provided, the constructed object will be empty, but still47 * valid.48 * @extends {jspb.Message}49 * @constructor50 */51proto.protocols.enceladus.PostPreviewResourceRequest = function(opt_data) {52 jspb.Message.initialize(this, opt_data, 0, -1, null, null);53};54goog.inherits(proto.protocols.enceladus.PostPreviewResourceRequest, jspb.Message);55if (goog.DEBUG && !COMPILED) {56 /**57 * @public58 * @override59 */60 proto.protocols.enceladus.PostPreviewResourceRequest.displayName = 'proto.protocols.enceladus.PostPreviewResourceRequest';61}62/**63 * Generated by JsPbCodeGenerator.64 * @param {Array=} opt_data Optional initial data array, typically from a65 * server response, or constructed directly in Javascript. The array is used66 * in place and becomes part of the constructed object. It is not cloned.67 * If no data is provided, the constructed object will be empty, but still68 * valid.69 * @extends {jspb.Message}70 * @constructor71 */72proto.protocols.enceladus.PostPreviewResourceResponse = function(opt_data) {73 jspb.Message.initialize(this, opt_data, 0, -1, null, null);74};75goog.inherits(proto.protocols.enceladus.PostPreviewResourceResponse, jspb.Message);76if (goog.DEBUG && !COMPILED) {77 /**78 * @public79 * @override80 */81 proto.protocols.enceladus.PostPreviewResourceResponse.displayName = 'proto.protocols.enceladus.PostPreviewResourceResponse';82}83/**84 * Generated by JsPbCodeGenerator.85 * @param {Array=} opt_data Optional initial data array, typically from a86 * server response, or constructed directly in Javascript. The array is used87 * in place and becomes part of the constructed object. It is not cloned.88 * If no data is provided, the constructed object will be empty, but still89 * valid.90 * @extends {jspb.Message}91 * @constructor92 */93proto.protocols.enceladus.PostAdminRequest = function(opt_data) {94 jspb.Message.initialize(this, opt_data, 0, -1, null, null);95};96goog.inherits(proto.protocols.enceladus.PostAdminRequest, jspb.Message);97if (goog.DEBUG && !COMPILED) {98 /**99 * @public100 * @override101 */102 proto.protocols.enceladus.PostAdminRequest.displayName = 'proto.protocols.enceladus.PostAdminRequest';103}104/**105 * Generated by JsPbCodeGenerator.106 * @param {Array=} opt_data Optional initial data array, typically from a107 * server response, or constructed directly in Javascript. The array is used108 * in place and becomes part of the constructed object. It is not cloned.109 * If no data is provided, the constructed object will be empty, but still110 * valid.111 * @extends {jspb.Message}112 * @constructor113 */114proto.protocols.enceladus.PostAdminResponse = function(opt_data) {115 jspb.Message.initialize(this, opt_data, 0, -1, null, null);116};117goog.inherits(proto.protocols.enceladus.PostAdminResponse, jspb.Message);118if (goog.DEBUG && !COMPILED) {119 /**120 * @public121 * @override122 */123 proto.protocols.enceladus.PostAdminResponse.displayName = 'proto.protocols.enceladus.PostAdminResponse';124}125if (jspb.Message.GENERATE_TO_OBJECT) {126/**127 * Creates an object representation of this proto.128 * Field names that are reserved in JavaScript and will be renamed to pb_name.129 * Optional fields that are not set will be set to undefined.130 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.131 * For the list of reserved names please see:132 * net/proto2/compiler/js/internal/generator.cc#kKeyword.133 * @param {boolean=} opt_includeInstance Deprecated. whether to include the134 * JSPB instance for transitional soy proto support:135 * http://goto/soy-param-migration136 * @return {!Object}137 */138proto.protocols.enceladus.PostResourceResponse.prototype.toObject = function(opt_includeInstance) {139 return proto.protocols.enceladus.PostResourceResponse.toObject(opt_includeInstance, this);140};141/**142 * Static version of the {@see toObject} method.143 * @param {boolean|undefined} includeInstance Deprecated. Whether to include144 * the JSPB instance for transitional soy proto support:145 * http://goto/soy-param-migration146 * @param {!proto.protocols.enceladus.PostResourceResponse} msg The msg instance to transform.147 * @return {!Object}148 * @suppress {unusedLocalVariables} f is only used for nested messages149 */150proto.protocols.enceladus.PostResourceResponse.toObject = function(includeInstance, msg) {151 var f, obj = {152 common: (f = msg.getCommon()) && common_pb.CommonStatus.toObject(includeInstance, f),153 resource: (f = msg.getResource()) && common_pb.Resource.toObject(includeInstance, f)154 };155 if (includeInstance) {156 obj.$jspbMessageInstance = msg;157 }158 return obj;159};160}161/**162 * Deserializes binary data (in protobuf wire format).163 * @param {jspb.ByteSource} bytes The bytes to deserialize.164 * @return {!proto.protocols.enceladus.PostResourceResponse}165 */166proto.protocols.enceladus.PostResourceResponse.deserializeBinary = function(bytes) {167 var reader = new jspb.BinaryReader(bytes);168 var msg = new proto.protocols.enceladus.PostResourceResponse;169 return proto.protocols.enceladus.PostResourceResponse.deserializeBinaryFromReader(msg, reader);170};171/**172 * Deserializes binary data (in protobuf wire format) from the173 * given reader into the given message object.174 * @param {!proto.protocols.enceladus.PostResourceResponse} msg The message object to deserialize into.175 * @param {!jspb.BinaryReader} reader The BinaryReader to use.176 * @return {!proto.protocols.enceladus.PostResourceResponse}177 */178proto.protocols.enceladus.PostResourceResponse.deserializeBinaryFromReader = function(msg, reader) {179 while (reader.nextField()) {180 if (reader.isEndGroup()) {181 break;182 }183 var field = reader.getFieldNumber();184 switch (field) {185 case 1:186 var value = new common_pb.CommonStatus;187 reader.readMessage(value,common_pb.CommonStatus.deserializeBinaryFromReader);188 msg.setCommon(value);189 break;190 case 2:191 var value = new common_pb.Resource;192 reader.readMessage(value,common_pb.Resource.deserializeBinaryFromReader);193 msg.setResource(value);194 break;195 default:196 reader.skipField();197 break;198 }199 }200 return msg;201};202/**203 * Serializes the message to binary data (in protobuf wire format).204 * @return {!Uint8Array}205 */206proto.protocols.enceladus.PostResourceResponse.prototype.serializeBinary = function() {207 var writer = new jspb.BinaryWriter();208 proto.protocols.enceladus.PostResourceResponse.serializeBinaryToWriter(this, writer);209 return writer.getResultBuffer();210};211/**212 * Serializes the given message to binary data (in protobuf wire213 * format), writing to the given BinaryWriter.214 * @param {!proto.protocols.enceladus.PostResourceResponse} message215 * @param {!jspb.BinaryWriter} writer216 * @suppress {unusedLocalVariables} f is only used for nested messages217 */218proto.protocols.enceladus.PostResourceResponse.serializeBinaryToWriter = function(message, writer) {219 var f = undefined;220 f = message.getCommon();221 if (f != null) {222 writer.writeMessage(223 1,224 f,225 common_pb.CommonStatus.serializeBinaryToWriter226 );227 }228 f = message.getResource();229 if (f != null) {230 writer.writeMessage(231 2,232 f,233 common_pb.Resource.serializeBinaryToWriter234 );235 }236};237/**238 * optional protocols.common.CommonStatus common = 1;239 * @return {?proto.protocols.common.CommonStatus}240 */241proto.protocols.enceladus.PostResourceResponse.prototype.getCommon = function() {242 return /** @type{?proto.protocols.common.CommonStatus} */ (243 jspb.Message.getWrapperField(this, common_pb.CommonStatus, 1));244};245/**246 * @param {?proto.protocols.common.CommonStatus|undefined} value247 * @return {!proto.protocols.enceladus.PostResourceResponse} returns this248*/249proto.protocols.enceladus.PostResourceResponse.prototype.setCommon = function(value) {250 return jspb.Message.setWrapperField(this, 1, value);251};252/**253 * Clears the message field making it undefined.254 * @return {!proto.protocols.enceladus.PostResourceResponse} returns this255 */256proto.protocols.enceladus.PostResourceResponse.prototype.clearCommon = function() {257 return this.setCommon(undefined);258};259/**260 * Returns whether this field is set.261 * @return {boolean}262 */263proto.protocols.enceladus.PostResourceResponse.prototype.hasCommon = function() {264 return jspb.Message.getField(this, 1) != null;265};266/**267 * optional protocols.common.Resource resource = 2;268 * @return {?proto.protocols.common.Resource}269 */270proto.protocols.enceladus.PostResourceResponse.prototype.getResource = function() {271 return /** @type{?proto.protocols.common.Resource} */ (272 jspb.Message.getWrapperField(this, common_pb.Resource, 2));273};274/**275 * @param {?proto.protocols.common.Resource|undefined} value276 * @return {!proto.protocols.enceladus.PostResourceResponse} returns this277*/278proto.protocols.enceladus.PostResourceResponse.prototype.setResource = function(value) {279 return jspb.Message.setWrapperField(this, 2, value);280};281/**282 * Clears the message field making it undefined.283 * @return {!proto.protocols.enceladus.PostResourceResponse} returns this284 */285proto.protocols.enceladus.PostResourceResponse.prototype.clearResource = function() {286 return this.setResource(undefined);287};288/**289 * Returns whether this field is set.290 * @return {boolean}291 */292proto.protocols.enceladus.PostResourceResponse.prototype.hasResource = function() {293 return jspb.Message.getField(this, 2) != null;294};295if (jspb.Message.GENERATE_TO_OBJECT) {296/**297 * Creates an object representation of this proto.298 * Field names that are reserved in JavaScript and will be renamed to pb_name.299 * Optional fields that are not set will be set to undefined.300 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.301 * For the list of reserved names please see:302 * net/proto2/compiler/js/internal/generator.cc#kKeyword.303 * @param {boolean=} opt_includeInstance Deprecated. whether to include the304 * JSPB instance for transitional soy proto support:305 * http://goto/soy-param-migration306 * @return {!Object}307 */308proto.protocols.enceladus.PostPreviewResourceRequest.prototype.toObject = function(opt_includeInstance) {309 return proto.protocols.enceladus.PostPreviewResourceRequest.toObject(opt_includeInstance, this);310};311/**312 * Static version of the {@see toObject} method.313 * @param {boolean|undefined} includeInstance Deprecated. Whether to include314 * the JSPB instance for transitional soy proto support:315 * http://goto/soy-param-migration316 * @param {!proto.protocols.enceladus.PostPreviewResourceRequest} msg The msg instance to transform.317 * @return {!Object}318 * @suppress {unusedLocalVariables} f is only used for nested messages319 */320proto.protocols.enceladus.PostPreviewResourceRequest.toObject = function(includeInstance, msg) {321 var f, obj = {322 encodedimage: jspb.Message.getFieldWithDefault(msg, 1, "")323 };324 if (includeInstance) {325 obj.$jspbMessageInstance = msg;326 }327 return obj;328};329}330/**331 * Deserializes binary data (in protobuf wire format).332 * @param {jspb.ByteSource} bytes The bytes to deserialize.333 * @return {!proto.protocols.enceladus.PostPreviewResourceRequest}334 */335proto.protocols.enceladus.PostPreviewResourceRequest.deserializeBinary = function(bytes) {336 var reader = new jspb.BinaryReader(bytes);337 var msg = new proto.protocols.enceladus.PostPreviewResourceRequest;338 return proto.protocols.enceladus.PostPreviewResourceRequest.deserializeBinaryFromReader(msg, reader);339};340/**341 * Deserializes binary data (in protobuf wire format) from the342 * given reader into the given message object.343 * @param {!proto.protocols.enceladus.PostPreviewResourceRequest} msg The message object to deserialize into.344 * @param {!jspb.BinaryReader} reader The BinaryReader to use.345 * @return {!proto.protocols.enceladus.PostPreviewResourceRequest}346 */347proto.protocols.enceladus.PostPreviewResourceRequest.deserializeBinaryFromReader = function(msg, reader) {348 while (reader.nextField()) {349 if (reader.isEndGroup()) {350 break;351 }352 var field = reader.getFieldNumber();353 switch (field) {354 case 1:355 var value = /** @type {string} */ (reader.readString());356 msg.setEncodedimage(value);357 break;358 default:359 reader.skipField();360 break;361 }362 }363 return msg;364};365/**366 * Serializes the message to binary data (in protobuf wire format).367 * @return {!Uint8Array}368 */369proto.protocols.enceladus.PostPreviewResourceRequest.prototype.serializeBinary = function() {370 var writer = new jspb.BinaryWriter();371 proto.protocols.enceladus.PostPreviewResourceRequest.serializeBinaryToWriter(this, writer);372 return writer.getResultBuffer();373};374/**375 * Serializes the given message to binary data (in protobuf wire376 * format), writing to the given BinaryWriter.377 * @param {!proto.protocols.enceladus.PostPreviewResourceRequest} message378 * @param {!jspb.BinaryWriter} writer379 * @suppress {unusedLocalVariables} f is only used for nested messages380 */381proto.protocols.enceladus.PostPreviewResourceRequest.serializeBinaryToWriter = function(message, writer) {382 var f = undefined;383 f = message.getEncodedimage();384 if (f.length > 0) {385 writer.writeString(386 1,387 f388 );389 }390};391/**392 * optional string encodedImage = 1;393 * @return {string}394 */395proto.protocols.enceladus.PostPreviewResourceRequest.prototype.getEncodedimage = function() {396 return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));397};398/**399 * @param {string} value400 * @return {!proto.protocols.enceladus.PostPreviewResourceRequest} returns this401 */402proto.protocols.enceladus.PostPreviewResourceRequest.prototype.setEncodedimage = function(value) {403 return jspb.Message.setProto3StringField(this, 1, value);404};405if (jspb.Message.GENERATE_TO_OBJECT) {406/**407 * Creates an object representation of this proto.408 * Field names that are reserved in JavaScript and will be renamed to pb_name.409 * Optional fields that are not set will be set to undefined.410 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.411 * For the list of reserved names please see:412 * net/proto2/compiler/js/internal/generator.cc#kKeyword.413 * @param {boolean=} opt_includeInstance Deprecated. whether to include the414 * JSPB instance for transitional soy proto support:415 * http://goto/soy-param-migration416 * @return {!Object}417 */418proto.protocols.enceladus.PostPreviewResourceResponse.prototype.toObject = function(opt_includeInstance) {419 return proto.protocols.enceladus.PostPreviewResourceResponse.toObject(opt_includeInstance, this);420};421/**422 * Static version of the {@see toObject} method.423 * @param {boolean|undefined} includeInstance Deprecated. Whether to include424 * the JSPB instance for transitional soy proto support:425 * http://goto/soy-param-migration426 * @param {!proto.protocols.enceladus.PostPreviewResourceResponse} msg The msg instance to transform.427 * @return {!Object}428 * @suppress {unusedLocalVariables} f is only used for nested messages429 */430proto.protocols.enceladus.PostPreviewResourceResponse.toObject = function(includeInstance, msg) {431 var f, obj = {432 common: (f = msg.getCommon()) && common_pb.CommonStatus.toObject(includeInstance, f),433 previewresource: (f = msg.getPreviewresource()) && common_pb.PreviewResource.toObject(includeInstance, f)434 };435 if (includeInstance) {436 obj.$jspbMessageInstance = msg;437 }438 return obj;439};440}441/**442 * Deserializes binary data (in protobuf wire format).443 * @param {jspb.ByteSource} bytes The bytes to deserialize.444 * @return {!proto.protocols.enceladus.PostPreviewResourceResponse}445 */446proto.protocols.enceladus.PostPreviewResourceResponse.deserializeBinary = function(bytes) {447 var reader = new jspb.BinaryReader(bytes);448 var msg = new proto.protocols.enceladus.PostPreviewResourceResponse;449 return proto.protocols.enceladus.PostPreviewResourceResponse.deserializeBinaryFromReader(msg, reader);450};451/**452 * Deserializes binary data (in protobuf wire format) from the453 * given reader into the given message object.454 * @param {!proto.protocols.enceladus.PostPreviewResourceResponse} msg The message object to deserialize into.455 * @param {!jspb.BinaryReader} reader The BinaryReader to use.456 * @return {!proto.protocols.enceladus.PostPreviewResourceResponse}457 */458proto.protocols.enceladus.PostPreviewResourceResponse.deserializeBinaryFromReader = function(msg, reader) {459 while (reader.nextField()) {460 if (reader.isEndGroup()) {461 break;462 }463 var field = reader.getFieldNumber();464 switch (field) {465 case 1:466 var value = new common_pb.CommonStatus;467 reader.readMessage(value,common_pb.CommonStatus.deserializeBinaryFromReader);468 msg.setCommon(value);469 break;470 case 2:471 var value = new common_pb.PreviewResource;472 reader.readMessage(value,common_pb.PreviewResource.deserializeBinaryFromReader);473 msg.setPreviewresource(value);474 break;475 default:476 reader.skipField();477 break;478 }479 }480 return msg;481};482/**483 * Serializes the message to binary data (in protobuf wire format).484 * @return {!Uint8Array}485 */486proto.protocols.enceladus.PostPreviewResourceResponse.prototype.serializeBinary = function() {487 var writer = new jspb.BinaryWriter();488 proto.protocols.enceladus.PostPreviewResourceResponse.serializeBinaryToWriter(this, writer);489 return writer.getResultBuffer();490};491/**492 * Serializes the given message to binary data (in protobuf wire493 * format), writing to the given BinaryWriter.494 * @param {!proto.protocols.enceladus.PostPreviewResourceResponse} message495 * @param {!jspb.BinaryWriter} writer496 * @suppress {unusedLocalVariables} f is only used for nested messages497 */498proto.protocols.enceladus.PostPreviewResourceResponse.serializeBinaryToWriter = function(message, writer) {499 var f = undefined;500 f = message.getCommon();501 if (f != null) {502 writer.writeMessage(503 1,504 f,505 common_pb.CommonStatus.serializeBinaryToWriter506 );507 }508 f = message.getPreviewresource();509 if (f != null) {510 writer.writeMessage(511 2,512 f,513 common_pb.PreviewResource.serializeBinaryToWriter514 );515 }516};517/**518 * optional protocols.common.CommonStatus common = 1;519 * @return {?proto.protocols.common.CommonStatus}520 */521proto.protocols.enceladus.PostPreviewResourceResponse.prototype.getCommon = function() {522 return /** @type{?proto.protocols.common.CommonStatus} */ (523 jspb.Message.getWrapperField(this, common_pb.CommonStatus, 1));524};525/**526 * @param {?proto.protocols.common.CommonStatus|undefined} value527 * @return {!proto.protocols.enceladus.PostPreviewResourceResponse} returns this528*/529proto.protocols.enceladus.PostPreviewResourceResponse.prototype.setCommon = function(value) {530 return jspb.Message.setWrapperField(this, 1, value);531};532/**533 * Clears the message field making it undefined.534 * @return {!proto.protocols.enceladus.PostPreviewResourceResponse} returns this535 */536proto.protocols.enceladus.PostPreviewResourceResponse.prototype.clearCommon = function() {537 return this.setCommon(undefined);538};539/**540 * Returns whether this field is set.541 * @return {boolean}542 */543proto.protocols.enceladus.PostPreviewResourceResponse.prototype.hasCommon = function() {544 return jspb.Message.getField(this, 1) != null;545};546/**547 * optional protocols.common.PreviewResource previewResource = 2;548 * @return {?proto.protocols.common.PreviewResource}549 */550proto.protocols.enceladus.PostPreviewResourceResponse.prototype.getPreviewresource = function() {551 return /** @type{?proto.protocols.common.PreviewResource} */ (552 jspb.Message.getWrapperField(this, common_pb.PreviewResource, 2));553};554/**555 * @param {?proto.protocols.common.PreviewResource|undefined} value556 * @return {!proto.protocols.enceladus.PostPreviewResourceResponse} returns this557*/558proto.protocols.enceladus.PostPreviewResourceResponse.prototype.setPreviewresource = function(value) {559 return jspb.Message.setWrapperField(this, 2, value);560};561/**562 * Clears the message field making it undefined.563 * @return {!proto.protocols.enceladus.PostPreviewResourceResponse} returns this564 */565proto.protocols.enceladus.PostPreviewResourceResponse.prototype.clearPreviewresource = function() {566 return this.setPreviewresource(undefined);567};568/**569 * Returns whether this field is set.570 * @return {boolean}571 */572proto.protocols.enceladus.PostPreviewResourceResponse.prototype.hasPreviewresource = function() {573 return jspb.Message.getField(this, 2) != null;574};575if (jspb.Message.GENERATE_TO_OBJECT) {576/**577 * Creates an object representation of this proto.578 * Field names that are reserved in JavaScript and will be renamed to pb_name.579 * Optional fields that are not set will be set to undefined.580 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.581 * For the list of reserved names please see:582 * net/proto2/compiler/js/internal/generator.cc#kKeyword.583 * @param {boolean=} opt_includeInstance Deprecated. whether to include the584 * JSPB instance for transitional soy proto support:585 * http://goto/soy-param-migration586 * @return {!Object}587 */588proto.protocols.enceladus.PostAdminRequest.prototype.toObject = function(opt_includeInstance) {589 return proto.protocols.enceladus.PostAdminRequest.toObject(opt_includeInstance, this);590};591/**592 * Static version of the {@see toObject} method.593 * @param {boolean|undefined} includeInstance Deprecated. Whether to include594 * the JSPB instance for transitional soy proto support:595 * http://goto/soy-param-migration596 * @param {!proto.protocols.enceladus.PostAdminRequest} msg The msg instance to transform.597 * @return {!Object}598 * @suppress {unusedLocalVariables} f is only used for nested messages599 */600proto.protocols.enceladus.PostAdminRequest.toObject = function(includeInstance, msg) {601 var f, obj = {602 id: jspb.Message.getFieldWithDefault(msg, 1, ""),603 password: jspb.Message.getFieldWithDefault(msg, 2, "")604 };605 if (includeInstance) {606 obj.$jspbMessageInstance = msg;607 }608 return obj;609};610}611/**612 * Deserializes binary data (in protobuf wire format).613 * @param {jspb.ByteSource} bytes The bytes to deserialize.614 * @return {!proto.protocols.enceladus.PostAdminRequest}615 */616proto.protocols.enceladus.PostAdminRequest.deserializeBinary = function(bytes) {617 var reader = new jspb.BinaryReader(bytes);618 var msg = new proto.protocols.enceladus.PostAdminRequest;619 return proto.protocols.enceladus.PostAdminRequest.deserializeBinaryFromReader(msg, reader);620};621/**622 * Deserializes binary data (in protobuf wire format) from the623 * given reader into the given message object.624 * @param {!proto.protocols.enceladus.PostAdminRequest} msg The message object to deserialize into.625 * @param {!jspb.BinaryReader} reader The BinaryReader to use.626 * @return {!proto.protocols.enceladus.PostAdminRequest}627 */628proto.protocols.enceladus.PostAdminRequest.deserializeBinaryFromReader = function(msg, reader) {629 while (reader.nextField()) {630 if (reader.isEndGroup()) {631 break;632 }633 var field = reader.getFieldNumber();634 switch (field) {635 case 1:636 var value = /** @type {string} */ (reader.readString());637 msg.setId(value);638 break;639 case 2:640 var value = /** @type {string} */ (reader.readString());641 msg.setPassword(value);642 break;643 default:644 reader.skipField();645 break;646 }647 }648 return msg;649};650/**651 * Serializes the message to binary data (in protobuf wire format).652 * @return {!Uint8Array}653 */654proto.protocols.enceladus.PostAdminRequest.prototype.serializeBinary = function() {655 var writer = new jspb.BinaryWriter();656 proto.protocols.enceladus.PostAdminRequest.serializeBinaryToWriter(this, writer);657 return writer.getResultBuffer();658};659/**660 * Serializes the given message to binary data (in protobuf wire661 * format), writing to the given BinaryWriter.662 * @param {!proto.protocols.enceladus.PostAdminRequest} message663 * @param {!jspb.BinaryWriter} writer664 * @suppress {unusedLocalVariables} f is only used for nested messages665 */666proto.protocols.enceladus.PostAdminRequest.serializeBinaryToWriter = function(message, writer) {667 var f = undefined;668 f = message.getId();669 if (f.length > 0) {670 writer.writeString(671 1,672 f673 );674 }675 f = message.getPassword();676 if (f.length > 0) {677 writer.writeString(678 2,679 f680 );681 }682};683/**684 * optional string id = 1;685 * @return {string}686 */687proto.protocols.enceladus.PostAdminRequest.prototype.getId = function() {688 return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));689};690/**691 * @param {string} value692 * @return {!proto.protocols.enceladus.PostAdminRequest} returns this693 */694proto.protocols.enceladus.PostAdminRequest.prototype.setId = function(value) {695 return jspb.Message.setProto3StringField(this, 1, value);696};697/**698 * optional string password = 2;699 * @return {string}700 */701proto.protocols.enceladus.PostAdminRequest.prototype.getPassword = function() {702 return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));703};704/**705 * @param {string} value706 * @return {!proto.protocols.enceladus.PostAdminRequest} returns this707 */708proto.protocols.enceladus.PostAdminRequest.prototype.setPassword = function(value) {709 return jspb.Message.setProto3StringField(this, 2, value);710};711if (jspb.Message.GENERATE_TO_OBJECT) {712/**713 * Creates an object representation of this proto.714 * Field names that are reserved in JavaScript and will be renamed to pb_name.715 * Optional fields that are not set will be set to undefined.716 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.717 * For the list of reserved names please see:718 * net/proto2/compiler/js/internal/generator.cc#kKeyword.719 * @param {boolean=} opt_includeInstance Deprecated. whether to include the720 * JSPB instance for transitional soy proto support:721 * http://goto/soy-param-migration722 * @return {!Object}723 */724proto.protocols.enceladus.PostAdminResponse.prototype.toObject = function(opt_includeInstance) {725 return proto.protocols.enceladus.PostAdminResponse.toObject(opt_includeInstance, this);726};727/**728 * Static version of the {@see toObject} method.729 * @param {boolean|undefined} includeInstance Deprecated. Whether to include730 * the JSPB instance for transitional soy proto support:731 * http://goto/soy-param-migration732 * @param {!proto.protocols.enceladus.PostAdminResponse} msg The msg instance to transform.733 * @return {!Object}734 * @suppress {unusedLocalVariables} f is only used for nested messages735 */736proto.protocols.enceladus.PostAdminResponse.toObject = function(includeInstance, msg) {737 var f, obj = {738 common: (f = msg.getCommon()) && common_pb.CommonStatus.toObject(includeInstance, f)739 };740 if (includeInstance) {741 obj.$jspbMessageInstance = msg;742 }743 return obj;744};745}746/**747 * Deserializes binary data (in protobuf wire format).748 * @param {jspb.ByteSource} bytes The bytes to deserialize.749 * @return {!proto.protocols.enceladus.PostAdminResponse}750 */751proto.protocols.enceladus.PostAdminResponse.deserializeBinary = function(bytes) {752 var reader = new jspb.BinaryReader(bytes);753 var msg = new proto.protocols.enceladus.PostAdminResponse;754 return proto.protocols.enceladus.PostAdminResponse.deserializeBinaryFromReader(msg, reader);755};756/**757 * Deserializes binary data (in protobuf wire format) from the758 * given reader into the given message object.759 * @param {!proto.protocols.enceladus.PostAdminResponse} msg The message object to deserialize into.760 * @param {!jspb.BinaryReader} reader The BinaryReader to use.761 * @return {!proto.protocols.enceladus.PostAdminResponse}762 */763proto.protocols.enceladus.PostAdminResponse.deserializeBinaryFromReader = function(msg, reader) {764 while (reader.nextField()) {765 if (reader.isEndGroup()) {766 break;767 }768 var field = reader.getFieldNumber();769 switch (field) {770 case 1:771 var value = new common_pb.CommonStatus;772 reader.readMessage(value,common_pb.CommonStatus.deserializeBinaryFromReader);773 msg.setCommon(value);774 break;775 default:776 reader.skipField();777 break;778 }779 }780 return msg;781};782/**783 * Serializes the message to binary data (in protobuf wire format).784 * @return {!Uint8Array}785 */786proto.protocols.enceladus.PostAdminResponse.prototype.serializeBinary = function() {787 var writer = new jspb.BinaryWriter();788 proto.protocols.enceladus.PostAdminResponse.serializeBinaryToWriter(this, writer);789 return writer.getResultBuffer();790};791/**792 * Serializes the given message to binary data (in protobuf wire793 * format), writing to the given BinaryWriter.794 * @param {!proto.protocols.enceladus.PostAdminResponse} message795 * @param {!jspb.BinaryWriter} writer796 * @suppress {unusedLocalVariables} f is only used for nested messages797 */798proto.protocols.enceladus.PostAdminResponse.serializeBinaryToWriter = function(message, writer) {799 var f = undefined;800 f = message.getCommon();801 if (f != null) {802 writer.writeMessage(803 1,804 f,805 common_pb.CommonStatus.serializeBinaryToWriter806 );807 }808};809/**810 * optional protocols.common.CommonStatus common = 1;811 * @return {?proto.protocols.common.CommonStatus}812 */813proto.protocols.enceladus.PostAdminResponse.prototype.getCommon = function() {814 return /** @type{?proto.protocols.common.CommonStatus} */ (815 jspb.Message.getWrapperField(this, common_pb.CommonStatus, 1));816};817/**818 * @param {?proto.protocols.common.CommonStatus|undefined} value819 * @return {!proto.protocols.enceladus.PostAdminResponse} returns this820*/821proto.protocols.enceladus.PostAdminResponse.prototype.setCommon = function(value) {822 return jspb.Message.setWrapperField(this, 1, value);823};824/**825 * Clears the message field making it undefined.826 * @return {!proto.protocols.enceladus.PostAdminResponse} returns this827 */828proto.protocols.enceladus.PostAdminResponse.prototype.clearCommon = function() {829 return this.setCommon(undefined);830};831/**832 * Returns whether this field is set.833 * @return {boolean}834 */835proto.protocols.enceladus.PostAdminResponse.prototype.hasCommon = function() {836 return jspb.Message.getField(this, 1) != null;837};...
protocols.js
Source:protocols.js
1// Compiled by ClojureScript 1.11.4 {:static-fns true, :optimize-constants true, :optimizations :advanced}2goog.provide('cljs.core.async.impl.protocols');3goog.require('cljs.core');4goog.require('cljs.core.constants');5cljs.core.async.impl.protocols.MAX_QUEUE_SIZE = (1024);6/**7 * @interface8 */9cljs.core.async.impl.protocols.ReadPort = function(){};10var cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_528 = (function (port,fn1_handler){11var x__4550__auto__ = (((port == null))?null:port);12var m__4551__auto__ = (cljs.core.async.impl.protocols.take_BANG_[goog.typeOf(x__4550__auto__)]);13if((!((m__4551__auto__ == null)))){14return (m__4551__auto__.cljs$core$IFn$_invoke$arity$2 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$2(port,fn1_handler) : m__4551__auto__.call(null,port,fn1_handler));15} else {16var m__4549__auto__ = (cljs.core.async.impl.protocols.take_BANG_["_"]);17if((!((m__4549__auto__ == null)))){18return (m__4549__auto__.cljs$core$IFn$_invoke$arity$2 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$2(port,fn1_handler) : m__4549__auto__.call(null,port,fn1_handler));19} else {20throw cljs.core.missing_protocol("ReadPort.take!",port);21}22}23});24/**25 * derefable val if taken, nil if take was enqueued26 */27cljs.core.async.impl.protocols.take_BANG_ = (function cljs$core$async$impl$protocols$take_BANG_(port,fn1_handler){28if((((!((port == null)))) && ((!((port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 == null)))))){29return port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(port,fn1_handler);30} else {31return cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_528(port,fn1_handler);32}33});34/**35 * @interface36 */37cljs.core.async.impl.protocols.WritePort = function(){};38var cljs$core$async$impl$protocols$WritePort$put_BANG_$dyn_529 = (function (port,val,fn1_handler){39var x__4550__auto__ = (((port == null))?null:port);40var m__4551__auto__ = (cljs.core.async.impl.protocols.put_BANG_[goog.typeOf(x__4550__auto__)]);41if((!((m__4551__auto__ == null)))){42return (m__4551__auto__.cljs$core$IFn$_invoke$arity$3 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$3(port,val,fn1_handler) : m__4551__auto__.call(null,port,val,fn1_handler));43} else {44var m__4549__auto__ = (cljs.core.async.impl.protocols.put_BANG_["_"]);45if((!((m__4549__auto__ == null)))){46return (m__4549__auto__.cljs$core$IFn$_invoke$arity$3 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$3(port,val,fn1_handler) : m__4549__auto__.call(null,port,val,fn1_handler));47} else {48throw cljs.core.missing_protocol("WritePort.put!",port);49}50}51});52/**53 * derefable boolean (false if already closed) if handled, nil if put was enqueued.54 * Must throw on nil val.55 */56cljs.core.async.impl.protocols.put_BANG_ = (function cljs$core$async$impl$protocols$put_BANG_(port,val,fn1_handler){57if((((!((port == null)))) && ((!((port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 == null)))))){58return port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(port,val,fn1_handler);59} else {60return cljs$core$async$impl$protocols$WritePort$put_BANG_$dyn_529(port,val,fn1_handler);61}62});63/**64 * @interface65 */66cljs.core.async.impl.protocols.Channel = function(){};67var cljs$core$async$impl$protocols$Channel$close_BANG_$dyn_530 = (function (chan){68var x__4550__auto__ = (((chan == null))?null:chan);69var m__4551__auto__ = (cljs.core.async.impl.protocols.close_BANG_[goog.typeOf(x__4550__auto__)]);70if((!((m__4551__auto__ == null)))){71return (m__4551__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__4551__auto__.call(null,chan));72} else {73var m__4549__auto__ = (cljs.core.async.impl.protocols.close_BANG_["_"]);74if((!((m__4549__auto__ == null)))){75return (m__4549__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__4549__auto__.call(null,chan));76} else {77throw cljs.core.missing_protocol("Channel.close!",chan);78}79}80});81cljs.core.async.impl.protocols.close_BANG_ = (function cljs$core$async$impl$protocols$close_BANG_(chan){82if((((!((chan == null)))) && ((!((chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 == null)))))){83return chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(chan);84} else {85return cljs$core$async$impl$protocols$Channel$close_BANG_$dyn_530(chan);86}87});88var cljs$core$async$impl$protocols$Channel$closed_QMARK_$dyn_531 = (function (chan){89var x__4550__auto__ = (((chan == null))?null:chan);90var m__4551__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_[goog.typeOf(x__4550__auto__)]);91if((!((m__4551__auto__ == null)))){92return (m__4551__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__4551__auto__.call(null,chan));93} else {94var m__4549__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_["_"]);95if((!((m__4549__auto__ == null)))){96return (m__4549__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__4549__auto__.call(null,chan));97} else {98throw cljs.core.missing_protocol("Channel.closed?",chan);99}100}101});102cljs.core.async.impl.protocols.closed_QMARK_ = (function cljs$core$async$impl$protocols$closed_QMARK_(chan){103if((((!((chan == null)))) && ((!((chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 == null)))))){104return chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1(chan);105} else {106return cljs$core$async$impl$protocols$Channel$closed_QMARK_$dyn_531(chan);107}108});109/**110 * @interface111 */112cljs.core.async.impl.protocols.Handler = function(){};113var cljs$core$async$impl$protocols$Handler$active_QMARK_$dyn_532 = (function (h){114var x__4550__auto__ = (((h == null))?null:h);115var m__4551__auto__ = (cljs.core.async.impl.protocols.active_QMARK_[goog.typeOf(x__4550__auto__)]);116if((!((m__4551__auto__ == null)))){117return (m__4551__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__4551__auto__.call(null,h));118} else {119var m__4549__auto__ = (cljs.core.async.impl.protocols.active_QMARK_["_"]);120if((!((m__4549__auto__ == null)))){121return (m__4549__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__4549__auto__.call(null,h));122} else {123throw cljs.core.missing_protocol("Handler.active?",h);124}125}126});127/**128 * returns true if has callback. Must work w/o lock129 */130cljs.core.async.impl.protocols.active_QMARK_ = (function cljs$core$async$impl$protocols$active_QMARK_(h){131if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 == null)))))){132return h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(h);133} else {134return cljs$core$async$impl$protocols$Handler$active_QMARK_$dyn_532(h);135}136});137var cljs$core$async$impl$protocols$Handler$blockable_QMARK_$dyn_533 = (function (h){138var x__4550__auto__ = (((h == null))?null:h);139var m__4551__auto__ = (cljs.core.async.impl.protocols.blockable_QMARK_[goog.typeOf(x__4550__auto__)]);140if((!((m__4551__auto__ == null)))){141return (m__4551__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__4551__auto__.call(null,h));142} else {143var m__4549__auto__ = (cljs.core.async.impl.protocols.blockable_QMARK_["_"]);144if((!((m__4549__auto__ == null)))){145return (m__4549__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__4549__auto__.call(null,h));146} else {147throw cljs.core.missing_protocol("Handler.blockable?",h);148}149}150});151/**152 * returns true if this handler may be blocked, otherwise it must not block153 */154cljs.core.async.impl.protocols.blockable_QMARK_ = (function cljs$core$async$impl$protocols$blockable_QMARK_(h){155if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 == null)))))){156return h.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1(h);157} else {158return cljs$core$async$impl$protocols$Handler$blockable_QMARK_$dyn_533(h);159}160});161var cljs$core$async$impl$protocols$Handler$commit$dyn_534 = (function (h){162var x__4550__auto__ = (((h == null))?null:h);163var m__4551__auto__ = (cljs.core.async.impl.protocols.commit[goog.typeOf(x__4550__auto__)]);164if((!((m__4551__auto__ == null)))){165return (m__4551__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__4551__auto__.call(null,h));166} else {167var m__4549__auto__ = (cljs.core.async.impl.protocols.commit["_"]);168if((!((m__4549__auto__ == null)))){169return (m__4549__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__4549__auto__.call(null,h));170} else {171throw cljs.core.missing_protocol("Handler.commit",h);172}173}174});175/**176 * commit to fulfilling its end of the transfer, returns cb. Must be called within lock177 */178cljs.core.async.impl.protocols.commit = (function cljs$core$async$impl$protocols$commit(h){179if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$commit$arity$1 == null)))))){180return h.cljs$core$async$impl$protocols$Handler$commit$arity$1(h);181} else {182return cljs$core$async$impl$protocols$Handler$commit$dyn_534(h);183}184});185/**186 * @interface187 */188cljs.core.async.impl.protocols.Buffer = function(){};189var cljs$core$async$impl$protocols$Buffer$full_QMARK_$dyn_535 = (function (b){190var x__4550__auto__ = (((b == null))?null:b);191var m__4551__auto__ = (cljs.core.async.impl.protocols.full_QMARK_[goog.typeOf(x__4550__auto__)]);192if((!((m__4551__auto__ == null)))){193return (m__4551__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__4551__auto__.call(null,b));194} else {195var m__4549__auto__ = (cljs.core.async.impl.protocols.full_QMARK_["_"]);196if((!((m__4549__auto__ == null)))){197return (m__4549__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__4549__auto__.call(null,b));198} else {199throw cljs.core.missing_protocol("Buffer.full?",b);200}201}202});203/**204 * returns true if buffer cannot accept put205 */206cljs.core.async.impl.protocols.full_QMARK_ = (function cljs$core$async$impl$protocols$full_QMARK_(b){207if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 == null)))))){208return b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(b);209} else {210return cljs$core$async$impl$protocols$Buffer$full_QMARK_$dyn_535(b);211}212});213var cljs$core$async$impl$protocols$Buffer$remove_BANG_$dyn_536 = (function (b){214var x__4550__auto__ = (((b == null))?null:b);215var m__4551__auto__ = (cljs.core.async.impl.protocols.remove_BANG_[goog.typeOf(x__4550__auto__)]);216if((!((m__4551__auto__ == null)))){217return (m__4551__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__4551__auto__.call(null,b));218} else {219var m__4549__auto__ = (cljs.core.async.impl.protocols.remove_BANG_["_"]);220if((!((m__4549__auto__ == null)))){221return (m__4549__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__4549__auto__.call(null,b));222} else {223throw cljs.core.missing_protocol("Buffer.remove!",b);224}225}226});227/**228 * remove and return next item from buffer, called under chan mutex229 */230cljs.core.async.impl.protocols.remove_BANG_ = (function cljs$core$async$impl$protocols$remove_BANG_(b){231if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 == null)))))){232return b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(b);233} else {234return cljs$core$async$impl$protocols$Buffer$remove_BANG_$dyn_536(b);235}236});237var cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$dyn_537 = (function (b,itm){238var x__4550__auto__ = (((b == null))?null:b);239var m__4551__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_[goog.typeOf(x__4550__auto__)]);240if((!((m__4551__auto__ == null)))){241return (m__4551__auto__.cljs$core$IFn$_invoke$arity$2 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$2(b,itm) : m__4551__auto__.call(null,b,itm));242} else {243var m__4549__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_["_"]);244if((!((m__4549__auto__ == null)))){245return (m__4549__auto__.cljs$core$IFn$_invoke$arity$2 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$2(b,itm) : m__4549__auto__.call(null,b,itm));246} else {247throw cljs.core.missing_protocol("Buffer.add!*",b);248}249}250});251/**252 * if room, add item to the buffer, returns b, called under chan mutex253 */254cljs.core.async.impl.protocols.add_BANG__STAR_ = (function cljs$core$async$impl$protocols$add_BANG__STAR_(b,itm){255if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 == null)))))){256return b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2(b,itm);257} else {258return cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$dyn_537(b,itm);259}260});261var cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$dyn_538 = (function (b){262var x__4550__auto__ = (((b == null))?null:b);263var m__4551__auto__ = (cljs.core.async.impl.protocols.close_buf_BANG_[goog.typeOf(x__4550__auto__)]);264if((!((m__4551__auto__ == null)))){265return (m__4551__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4551__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__4551__auto__.call(null,b));266} else {267var m__4549__auto__ = (cljs.core.async.impl.protocols.close_buf_BANG_["_"]);268if((!((m__4549__auto__ == null)))){269return (m__4549__auto__.cljs$core$IFn$_invoke$arity$1 ? m__4549__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__4549__auto__.call(null,b));270} else {271throw cljs.core.missing_protocol("Buffer.close-buf!",b);272}273}274});275/**276 * called on chan closed under chan mutex, return ignored277 */278cljs.core.async.impl.protocols.close_buf_BANG_ = (function cljs$core$async$impl$protocols$close_buf_BANG_(b){279if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 == null)))))){280return b.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1(b);281} else {282return cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$dyn_538(b);283}284});285cljs.core.async.impl.protocols.add_BANG_ = (function cljs$core$async$impl$protocols$add_BANG_(var_args){286var G__540 = arguments.length;287switch (G__540) {288case 1:289return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));290break;291case 2:292return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));293break;294default:295throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));296}297});298(cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (b){299return b;300}));301(cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (b,itm){302if((!((itm == null)))){303} else {304throw (new Error("Assert failed: (not (nil? itm))"));305}306return cljs.core.async.impl.protocols.add_BANG__STAR_(b,itm);307}));308(cljs.core.async.impl.protocols.add_BANG_.cljs$lang$maxFixedArity = 2);309/**310 * @interface311 */...
ProtocolStrategy.js
Source:ProtocolStrategy.js
1import log from '../../../log';2import defaultProtocol from '../defaultProtocol';3export default class ProtocolStrategy {4 constructor() {5 this.hangingProtocols = new Map();6 this.defaultsAdded = false;7 }8 /**9 * Registers a function to be called when the hangingProtocols collection is subscribed10 * The callback is called only one time when the subscription is ready11 *12 * @param callback The function to be called as a callback13 */14 onReady(callback) {15 if (!this.defaultsAdded) {16 log.info('Inserting the default hanging protocol...');17 this.addProtocol(defaultProtocol);18 this.defaultsAdded = true;19 }20 callback();21 }22 /**23 * Gets the hanging protocol by protocolId if defined, otherwise all stored hanging protocols24 *25 * @param protocolId The protocol ID used to find the hanging protocol26 * @returns {object|array} The hanging protocol by protocolId or array of the stored hanging protocols27 */28 getProtocol(protocolId) {29 // Return the hanging protocol by protocolId if defined30 if (protocolId) {31 return this.hangingProtocols.get(protocolId);32 }33 // Otherwise, return all protocols34 return Array.from(this.hangingProtocols.values());35 }36 /**37 * Stores the hanging protocol38 *39 * @param protocol The hanging protocol to be stored40 */41 addProtocol(protocol) {42 this.hangingProtocols.set(protocol.id, protocol);43 }44 /**45 * Updates the hanging protocol by protocolId46 *47 * @param protocolId The protocol ID used to find the hanging protocol to update48 * @param protocol The updated hanging protocol49 */50 updateProtocol(protocolId, protocol) {51 if (!this.hangingProtocols.has(protocolId)) {52 return;53 }54 this.hangingProtocols.set(protocolId, protocol);55 }56 /**57 * Removes the hanging protocol58 *59 * @param protocolId The protocol ID used to remove the hanging protocol60 */61 removeProtocol(protocolId) {62 if (!this.hangingProtocols.has(protocolId)) {63 return;64 }65 this.hangingProtocols.delete(protocolId);66 }...
Using AI Code Generation
1var mb = require('mountebank');2var Q = require('q');3var fs = require('fs');4var path = require('path');5var imposter = {6 stubs: [{7 responses: [{8 is: {9 }10 }]11 }]12};13mb.create(imposter).then(function (response) {14 console.log('Imposter created');15 console.log(response);16}, function (error) {17 console.log('Error creating imposter');18 console.log(error);19});20{ [Error: connect ECONNREFUSED
Using AI Code Generation
1var mb = require('mountebank');2var mbHelper = require('mountebank-helper');3var mbPort = 2525;4var mbProtocol = 'http';5var mbHost = 'localhost';6var mbUrl = mbHelper.mbUrl(mbProtocol, mbHost, mbPort);7 {8 {9 {10 is: {11 headers: {12 },13 body: JSON.stringify({14 })15 }16 }17 }18 }19];20mb.create(mbUrl, imposters, function (error, result) {21 console.log(result);22 mb.get(mbUrl, function (error, result) {23 console.log(result);24 });25});26{27 "scripts": {28 },29 "dependencies": {30 }31}32{ port: 3000, protocol: 'http', numberOfRequests: 0 }33[ { port: 3000, protocol: 'http', numberOfRequests: 0 } ]
Using AI Code Generation
1const mb = require('mountebank');2const protocols = mb.protocols;3const http = protocols.http;4const port = 2525;5 {6 {7 {8 is: {9 }10 }11 }12 }13];14http.create({ port, imposters }, () => {15 console.log('Imposter created');16});17const mb = require('mountebank');18const protocols = mb.protocols;19const http = protocols.http;20const port = 2525;21 {22 {23 {24 is: {25 }26 }27 }28 }29];30http.create({ port, imposters }, () => {31 console.log('Imposter created');32});33const mb = require('mountebank');34const protocols = mb.protocols;35const http = protocols.http;36const port = 2525;37 {38 {39 {40 is: {41 }42 }43 }44 }45];46http.create({ port, imposters }, () => {47 console.log('Imposter created');48});49const mb = require('mountebank');50const protocols = mb.protocols;51const http = protocols.http;52const port = 2525;53 {54 {55 {56 is: {57 }58 }59 }60 }61];62http.create({ port, imposters }, () => {63 console.log('Imposter created');
Using AI Code Generation
1var mb = require('mountebank');2var fs = require('fs');3var path = require('path');4var assert = require('assert');5var imposter = {6 {7 {8 equals: {9 }10 }11 {12 is: {13 headers: {14 },15 }16 }17 }18};19mb.create(imposter, function (error, imposter) {20 assert.equal(error, null, 'Error creating imposter: ' + error);21 assert.equal(imposter.port, 4545, 'Imposter port is incorrect');22 var request = {23 };24 mb.send(request, function (error, response) {25 assert.equal(error, null, 'Error sending request: ' + error);26 assert.equal(response.statusCode, 200, 'Response status code is incorrect');27 assert.equal(response.body, 'Hello World', 'Response body is incorrect');28 console.log('Success');29 mb.del(imposter.port, function (error) {30 assert.equal(error, null, 'Error deleting imposter: ' + error);31 console.log('Success');32 });33 });34});35var mb = require('mountebank');36var fs = require('fs');37var path = require('path');38var assert = require('assert');39var imposter = {40 {41 {42 equals: {43 }44 }45 {46 is: {47 headers: {48 },49 }50 }
Using AI Code Generation
1var http = require('http');2var mb = require('mountebank');3var protocol = mb.createProtocol('http', 8080);4var protocol = mb.createProtocol('https', 8081);5var protocol = mb.createProtocol('tcp', 8082);6var protocol = mb.createProtocol('smtp', 8083);7var protocol = mb.createProtocol('smtps', 8084);8var protocol = mb.createProtocol('ws', 8085);9var protocol = mb.createProtocol('wss', 8086);10var protocol = mb.createProtocol('stomp', 8087);11var protocol = mb.createProtocol('stomps', 8088);12var protocol = mb.createProtocol('udp', 8089);13var protocol = mb.createProtocol('udp4', 8090);14var protocol = mb.createProtocol('udp6', 8091);15var protocol = mb.createProtocol('dns', 8092);16var protocol = mb.createProtocol('dns4', 8093);17var protocol = mb.createProtocol('dns6', 8094);18var protocol = mb.createProtocol('tls', 8095);19var protocol = mb.createProtocol('unix', 8096);20var protocol = mb.createProtocol('pipe', 8097);21var protocol = mb.createProtocol('http2', 8098);22var protocol = mb.createProtocol('https2', 8099);23var protocol = mb.createProtocol('http3', 8100);24var protocol = mb.createProtocol('https3', 8101);25var protocol = mb.createProtocol('http4', 8102);26var protocol = mb.createProtocol('https4', 8103);27var protocol = mb.createProtocol('http5', 8104);
Using AI Code Generation
1var mb = require('mountebank');2var http = require('http');3var port = 2525;4var host = 'localhost';5var protocol = 'http';6 {7 {8 equals: {9 }10 }11 {12 is: {13 headers: {14 },15 body: {16 }17 }18 }19 }20];21mb.create(port, host, protocol, stubs, function (error, imposter) {22 if (error) {23 console.log(error);24 } else {25 console.log('imposter created');26 response.on('data', function (data) {27 console.log(data.toString());28 });29 });30 }31});
Using AI Code Generation
1var assert = require('assert');2var mb = require('mountebank');3var request = require('request');4var port = 2525;5mb.createProtocol(port, 'myProtocol', function (error, result) {6 assert.ifError(error);7 assert.deepEqual(result, { protocol: 'myProtocol' });8 console.log('Protocol created');9 mb.createStub(port, {10 {11 {12 equals: {13 }14 }15 {16 is: {17 }18 }19 }20 }, function (error, result) {21 assert.ifError(error);22 assert.deepEqual(result, { protocol: 'myProtocol' });23 console.log('Stub created');24 request({25 headers: {26 }27 }, function (error, response, body) {28 assert.ifError(error);29 assert.strictEqual(response.statusCode, 200);30 assert.strictEqual(body, 'Hello from myProtocol');31 console.log('Test passed');32 mb.reset(port, function (error, result) {33 assert.ifError(error);34 assert.deepEqual(result, { reset: true });35 console.log('Mountebank reset');36 });37 });38 });39});40mb.reset(port, function (error, result) {41 assert.ifError(error);42 assert.deepEqual(result, { reset: true });43 console.log('Mountebank reset');44});45mb.deleteProtocol(port, 'myProtocol', function (error, result) {46 assert.ifError(error);47 assert.deepEqual(result, { protocol: 'myProtocol' });48 console.log('Protocol deleted');49});50mb.reset(port, function (error, result) {51 assert.ifError(error);52 assert.deepEqual(result, { reset: true });53 console.log('Mount
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!