How to use increaseValue method in ng-mocks

Best JavaScript code snippet using ng-mocks

proto.js

Source:proto.js Github

copy

Full Screen

1// Common aliases2var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;3// Exported root namespace4var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});5$root.com = (function() {6 /**7 * Namespace com.8 * @exports com9 * @namespace10 */11 var com = {};12 com.example = (function() {13 /**14 * Namespace example.15 * @memberof com16 * @namespace17 */18 var example = {};19 example.IncreaseValue = (function() {20 /**21 * Properties of an IncreaseValue.22 * @memberof com.example23 * @interface IIncreaseValue24 * @property {string|null} [counterId] IncreaseValue counterId25 * @property {number|null} [value] IncreaseValue value26 */27 /**28 * Constructs a new IncreaseValue.29 * @memberof com.example30 * @classdesc Represents an IncreaseValue.31 * @implements IIncreaseValue32 * @constructor33 * @param {com.example.IIncreaseValue=} [properties] Properties to set34 */35 function IncreaseValue(properties) {36 if (properties)37 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)38 if (properties[keys[i]] != null)39 this[keys[i]] = properties[keys[i]];40 }41 /**42 * IncreaseValue counterId.43 * @member {string} counterId44 * @memberof com.example.IncreaseValue45 * @instance46 */47 IncreaseValue.prototype.counterId = "";48 /**49 * IncreaseValue value.50 * @member {number} value51 * @memberof com.example.IncreaseValue52 * @instance53 */54 IncreaseValue.prototype.value = 0;55 /**56 * Creates a new IncreaseValue instance using the specified properties.57 * @function create58 * @memberof com.example.IncreaseValue59 * @static60 * @param {com.example.IIncreaseValue=} [properties] Properties to set61 * @returns {com.example.IncreaseValue} IncreaseValue instance62 */63 IncreaseValue.create = function create(properties) {64 return new IncreaseValue(properties);65 };66 /**67 * Encodes the specified IncreaseValue message. Does not implicitly {@link com.example.IncreaseValue.verify|verify} messages.68 * @function encode69 * @memberof com.example.IncreaseValue70 * @static71 * @param {com.example.IIncreaseValue} message IncreaseValue message or plain object to encode72 * @param {$protobuf.Writer} [writer] Writer to encode to73 * @returns {$protobuf.Writer} Writer74 */75 IncreaseValue.encode = function encode(message, writer) {76 if (!writer)77 writer = $Writer.create();78 if (message.counterId != null && Object.hasOwnProperty.call(message, "counterId"))79 writer.uint32(/* id 1, wireType 2 =*/10).string(message.counterId);80 if (message.value != null && Object.hasOwnProperty.call(message, "value"))81 writer.uint32(/* id 2, wireType 0 =*/16).int32(message.value);82 return writer;83 };84 /**85 * Encodes the specified IncreaseValue message, length delimited. Does not implicitly {@link com.example.IncreaseValue.verify|verify} messages.86 * @function encodeDelimited87 * @memberof com.example.IncreaseValue88 * @static89 * @param {com.example.IIncreaseValue} message IncreaseValue message or plain object to encode90 * @param {$protobuf.Writer} [writer] Writer to encode to91 * @returns {$protobuf.Writer} Writer92 */93 IncreaseValue.encodeDelimited = function encodeDelimited(message, writer) {94 return this.encode(message, writer).ldelim();95 };96 /**97 * Decodes an IncreaseValue message from the specified reader or buffer.98 * @function decode99 * @memberof com.example.IncreaseValue100 * @static101 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from102 * @param {number} [length] Message length if known beforehand103 * @returns {com.example.IncreaseValue} IncreaseValue104 * @throws {Error} If the payload is not a reader or valid buffer105 * @throws {$protobuf.util.ProtocolError} If required fields are missing106 */107 IncreaseValue.decode = function decode(reader, length) {108 if (!(reader instanceof $Reader))109 reader = $Reader.create(reader);110 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.com.example.IncreaseValue();111 while (reader.pos < end) {112 var tag = reader.uint32();113 switch (tag >>> 3) {114 case 1:115 message.counterId = reader.string();116 break;117 case 2:118 message.value = reader.int32();119 break;120 default:121 reader.skipType(tag & 7);122 break;123 }124 }125 return message;126 };127 /**128 * Decodes an IncreaseValue message from the specified reader or buffer, length delimited.129 * @function decodeDelimited130 * @memberof com.example.IncreaseValue131 * @static132 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from133 * @returns {com.example.IncreaseValue} IncreaseValue134 * @throws {Error} If the payload is not a reader or valid buffer135 * @throws {$protobuf.util.ProtocolError} If required fields are missing136 */137 IncreaseValue.decodeDelimited = function decodeDelimited(reader) {138 if (!(reader instanceof $Reader))139 reader = new $Reader(reader);140 return this.decode(reader, reader.uint32());141 };142 /**143 * Verifies an IncreaseValue message.144 * @function verify145 * @memberof com.example.IncreaseValue146 * @static147 * @param {Object.<string,*>} message Plain object to verify148 * @returns {string|null} `null` if valid, otherwise the reason why it is not149 */150 IncreaseValue.verify = function verify(message) {151 if (typeof message !== "object" || message === null)152 return "object expected";153 if (message.counterId != null && message.hasOwnProperty("counterId"))154 if (!$util.isString(message.counterId))155 return "counterId: string expected";156 if (message.value != null && message.hasOwnProperty("value"))157 if (!$util.isInteger(message.value))158 return "value: integer expected";159 return null;160 };161 /**162 * Creates an IncreaseValue message from a plain object. Also converts values to their respective internal types.163 * @function fromObject164 * @memberof com.example.IncreaseValue165 * @static166 * @param {Object.<string,*>} object Plain object167 * @returns {com.example.IncreaseValue} IncreaseValue168 */169 IncreaseValue.fromObject = function fromObject(object) {170 if (object instanceof $root.com.example.IncreaseValue)171 return object;172 var message = new $root.com.example.IncreaseValue();173 if (object.counterId != null)174 message.counterId = String(object.counterId);175 if (object.value != null)176 message.value = object.value | 0;177 return message;178 };179 /**180 * Creates a plain object from an IncreaseValue message. Also converts values to other types if specified.181 * @function toObject182 * @memberof com.example.IncreaseValue183 * @static184 * @param {com.example.IncreaseValue} message IncreaseValue185 * @param {$protobuf.IConversionOptions} [options] Conversion options186 * @returns {Object.<string,*>} Plain object187 */188 IncreaseValue.toObject = function toObject(message, options) {189 if (!options)190 options = {};191 var object = {};192 if (options.defaults) {193 object.counterId = "";194 object.value = 0;195 }196 if (message.counterId != null && message.hasOwnProperty("counterId"))197 object.counterId = message.counterId;198 if (message.value != null && message.hasOwnProperty("value"))199 object.value = message.value;200 return object;201 };202 /**203 * Converts this IncreaseValue to JSON.204 * @function toJSON205 * @memberof com.example.IncreaseValue206 * @instance207 * @returns {Object.<string,*>} JSON object208 */209 IncreaseValue.prototype.toJSON = function toJSON() {210 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);211 };212 return IncreaseValue;213 })();214 example.DecreaseValue = (function() {215 /**216 * Properties of a DecreaseValue.217 * @memberof com.example218 * @interface IDecreaseValue219 * @property {string|null} [counterId] DecreaseValue counterId220 * @property {number|null} [value] DecreaseValue value221 */222 /**223 * Constructs a new DecreaseValue.224 * @memberof com.example225 * @classdesc Represents a DecreaseValue.226 * @implements IDecreaseValue227 * @constructor228 * @param {com.example.IDecreaseValue=} [properties] Properties to set229 */230 function DecreaseValue(properties) {231 if (properties)232 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)233 if (properties[keys[i]] != null)234 this[keys[i]] = properties[keys[i]];235 }236 /**237 * DecreaseValue counterId.238 * @member {string} counterId239 * @memberof com.example.DecreaseValue240 * @instance241 */242 DecreaseValue.prototype.counterId = "";243 /**244 * DecreaseValue value.245 * @member {number} value246 * @memberof com.example.DecreaseValue247 * @instance248 */249 DecreaseValue.prototype.value = 0;250 /**251 * Creates a new DecreaseValue instance using the specified properties.252 * @function create253 * @memberof com.example.DecreaseValue254 * @static255 * @param {com.example.IDecreaseValue=} [properties] Properties to set256 * @returns {com.example.DecreaseValue} DecreaseValue instance257 */258 DecreaseValue.create = function create(properties) {259 return new DecreaseValue(properties);260 };261 /**262 * Encodes the specified DecreaseValue message. Does not implicitly {@link com.example.DecreaseValue.verify|verify} messages.263 * @function encode264 * @memberof com.example.DecreaseValue265 * @static266 * @param {com.example.IDecreaseValue} message DecreaseValue message or plain object to encode267 * @param {$protobuf.Writer} [writer] Writer to encode to268 * @returns {$protobuf.Writer} Writer269 */270 DecreaseValue.encode = function encode(message, writer) {271 if (!writer)272 writer = $Writer.create();273 if (message.counterId != null && Object.hasOwnProperty.call(message, "counterId"))274 writer.uint32(/* id 1, wireType 2 =*/10).string(message.counterId);275 if (message.value != null && Object.hasOwnProperty.call(message, "value"))276 writer.uint32(/* id 2, wireType 0 =*/16).int32(message.value);277 return writer;278 };279 /**280 * Encodes the specified DecreaseValue message, length delimited. Does not implicitly {@link com.example.DecreaseValue.verify|verify} messages.281 * @function encodeDelimited282 * @memberof com.example.DecreaseValue283 * @static284 * @param {com.example.IDecreaseValue} message DecreaseValue message or plain object to encode285 * @param {$protobuf.Writer} [writer] Writer to encode to286 * @returns {$protobuf.Writer} Writer287 */288 DecreaseValue.encodeDelimited = function encodeDelimited(message, writer) {289 return this.encode(message, writer).ldelim();290 };291 /**292 * Decodes a DecreaseValue message from the specified reader or buffer.293 * @function decode294 * @memberof com.example.DecreaseValue295 * @static296 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from297 * @param {number} [length] Message length if known beforehand298 * @returns {com.example.DecreaseValue} DecreaseValue299 * @throws {Error} If the payload is not a reader or valid buffer300 * @throws {$protobuf.util.ProtocolError} If required fields are missing301 */302 DecreaseValue.decode = function decode(reader, length) {303 if (!(reader instanceof $Reader))304 reader = $Reader.create(reader);305 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.com.example.DecreaseValue();306 while (reader.pos < end) {307 var tag = reader.uint32();308 switch (tag >>> 3) {309 case 1:310 message.counterId = reader.string();311 break;312 case 2:313 message.value = reader.int32();314 break;315 default:316 reader.skipType(tag & 7);317 break;318 }319 }320 return message;321 };322 /**323 * Decodes a DecreaseValue message from the specified reader or buffer, length delimited.324 * @function decodeDelimited325 * @memberof com.example.DecreaseValue326 * @static327 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from328 * @returns {com.example.DecreaseValue} DecreaseValue329 * @throws {Error} If the payload is not a reader or valid buffer330 * @throws {$protobuf.util.ProtocolError} If required fields are missing331 */332 DecreaseValue.decodeDelimited = function decodeDelimited(reader) {333 if (!(reader instanceof $Reader))334 reader = new $Reader(reader);335 return this.decode(reader, reader.uint32());336 };337 /**338 * Verifies a DecreaseValue message.339 * @function verify340 * @memberof com.example.DecreaseValue341 * @static342 * @param {Object.<string,*>} message Plain object to verify343 * @returns {string|null} `null` if valid, otherwise the reason why it is not344 */345 DecreaseValue.verify = function verify(message) {346 if (typeof message !== "object" || message === null)347 return "object expected";348 if (message.counterId != null && message.hasOwnProperty("counterId"))349 if (!$util.isString(message.counterId))350 return "counterId: string expected";351 if (message.value != null && message.hasOwnProperty("value"))352 if (!$util.isInteger(message.value))353 return "value: integer expected";354 return null;355 };356 /**357 * Creates a DecreaseValue message from a plain object. Also converts values to their respective internal types.358 * @function fromObject359 * @memberof com.example.DecreaseValue360 * @static361 * @param {Object.<string,*>} object Plain object362 * @returns {com.example.DecreaseValue} DecreaseValue363 */364 DecreaseValue.fromObject = function fromObject(object) {365 if (object instanceof $root.com.example.DecreaseValue)366 return object;367 var message = new $root.com.example.DecreaseValue();368 if (object.counterId != null)369 message.counterId = String(object.counterId);370 if (object.value != null)371 message.value = object.value | 0;372 return message;373 };374 /**375 * Creates a plain object from a DecreaseValue message. Also converts values to other types if specified.376 * @function toObject377 * @memberof com.example.DecreaseValue378 * @static379 * @param {com.example.DecreaseValue} message DecreaseValue380 * @param {$protobuf.IConversionOptions} [options] Conversion options381 * @returns {Object.<string,*>} Plain object382 */383 DecreaseValue.toObject = function toObject(message, options) {384 if (!options)385 options = {};386 var object = {};387 if (options.defaults) {388 object.counterId = "";389 object.value = 0;390 }391 if (message.counterId != null && message.hasOwnProperty("counterId"))392 object.counterId = message.counterId;393 if (message.value != null && message.hasOwnProperty("value"))394 object.value = message.value;395 return object;396 };397 /**398 * Converts this DecreaseValue to JSON.399 * @function toJSON400 * @memberof com.example.DecreaseValue401 * @instance402 * @returns {Object.<string,*>} JSON object403 */404 DecreaseValue.prototype.toJSON = function toJSON() {405 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);406 };407 return DecreaseValue;408 })();409 example.ResetValue = (function() {410 /**411 * Properties of a ResetValue.412 * @memberof com.example413 * @interface IResetValue414 * @property {string|null} [counterId] ResetValue counterId415 */416 /**417 * Constructs a new ResetValue.418 * @memberof com.example419 * @classdesc Represents a ResetValue.420 * @implements IResetValue421 * @constructor422 * @param {com.example.IResetValue=} [properties] Properties to set423 */424 function ResetValue(properties) {425 if (properties)426 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)427 if (properties[keys[i]] != null)428 this[keys[i]] = properties[keys[i]];429 }430 /**431 * ResetValue counterId.432 * @member {string} counterId433 * @memberof com.example.ResetValue434 * @instance435 */436 ResetValue.prototype.counterId = "";437 /**438 * Creates a new ResetValue instance using the specified properties.439 * @function create440 * @memberof com.example.ResetValue441 * @static442 * @param {com.example.IResetValue=} [properties] Properties to set443 * @returns {com.example.ResetValue} ResetValue instance444 */445 ResetValue.create = function create(properties) {446 return new ResetValue(properties);447 };448 /**449 * Encodes the specified ResetValue message. Does not implicitly {@link com.example.ResetValue.verify|verify} messages.450 * @function encode451 * @memberof com.example.ResetValue452 * @static453 * @param {com.example.IResetValue} message ResetValue message or plain object to encode454 * @param {$protobuf.Writer} [writer] Writer to encode to455 * @returns {$protobuf.Writer} Writer456 */457 ResetValue.encode = function encode(message, writer) {458 if (!writer)459 writer = $Writer.create();460 if (message.counterId != null && Object.hasOwnProperty.call(message, "counterId"))461 writer.uint32(/* id 1, wireType 2 =*/10).string(message.counterId);462 return writer;463 };464 /**465 * Encodes the specified ResetValue message, length delimited. Does not implicitly {@link com.example.ResetValue.verify|verify} messages.466 * @function encodeDelimited467 * @memberof com.example.ResetValue468 * @static469 * @param {com.example.IResetValue} message ResetValue message or plain object to encode470 * @param {$protobuf.Writer} [writer] Writer to encode to471 * @returns {$protobuf.Writer} Writer472 */473 ResetValue.encodeDelimited = function encodeDelimited(message, writer) {474 return this.encode(message, writer).ldelim();475 };476 /**477 * Decodes a ResetValue message from the specified reader or buffer.478 * @function decode479 * @memberof com.example.ResetValue480 * @static481 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from482 * @param {number} [length] Message length if known beforehand483 * @returns {com.example.ResetValue} ResetValue484 * @throws {Error} If the payload is not a reader or valid buffer485 * @throws {$protobuf.util.ProtocolError} If required fields are missing486 */487 ResetValue.decode = function decode(reader, length) {488 if (!(reader instanceof $Reader))489 reader = $Reader.create(reader);490 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.com.example.ResetValue();491 while (reader.pos < end) {492 var tag = reader.uint32();493 switch (tag >>> 3) {494 case 1:495 message.counterId = reader.string();496 break;497 default:498 reader.skipType(tag & 7);499 break;500 }501 }502 return message;503 };504 /**505 * Decodes a ResetValue message from the specified reader or buffer, length delimited.506 * @function decodeDelimited507 * @memberof com.example.ResetValue508 * @static509 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from510 * @returns {com.example.ResetValue} ResetValue511 * @throws {Error} If the payload is not a reader or valid buffer512 * @throws {$protobuf.util.ProtocolError} If required fields are missing513 */514 ResetValue.decodeDelimited = function decodeDelimited(reader) {515 if (!(reader instanceof $Reader))516 reader = new $Reader(reader);517 return this.decode(reader, reader.uint32());518 };519 /**520 * Verifies a ResetValue message.521 * @function verify522 * @memberof com.example.ResetValue523 * @static524 * @param {Object.<string,*>} message Plain object to verify525 * @returns {string|null} `null` if valid, otherwise the reason why it is not526 */527 ResetValue.verify = function verify(message) {528 if (typeof message !== "object" || message === null)529 return "object expected";530 if (message.counterId != null && message.hasOwnProperty("counterId"))531 if (!$util.isString(message.counterId))532 return "counterId: string expected";533 return null;534 };535 /**536 * Creates a ResetValue message from a plain object. Also converts values to their respective internal types.537 * @function fromObject538 * @memberof com.example.ResetValue539 * @static540 * @param {Object.<string,*>} object Plain object541 * @returns {com.example.ResetValue} ResetValue542 */543 ResetValue.fromObject = function fromObject(object) {544 if (object instanceof $root.com.example.ResetValue)545 return object;546 var message = new $root.com.example.ResetValue();547 if (object.counterId != null)548 message.counterId = String(object.counterId);549 return message;550 };551 /**552 * Creates a plain object from a ResetValue message. Also converts values to other types if specified.553 * @function toObject554 * @memberof com.example.ResetValue555 * @static556 * @param {com.example.ResetValue} message ResetValue557 * @param {$protobuf.IConversionOptions} [options] Conversion options558 * @returns {Object.<string,*>} Plain object559 */560 ResetValue.toObject = function toObject(message, options) {561 if (!options)562 options = {};563 var object = {};564 if (options.defaults)565 object.counterId = "";566 if (message.counterId != null && message.hasOwnProperty("counterId"))567 object.counterId = message.counterId;568 return object;569 };570 /**571 * Converts this ResetValue to JSON.572 * @function toJSON573 * @memberof com.example.ResetValue574 * @instance575 * @returns {Object.<string,*>} JSON object576 */577 ResetValue.prototype.toJSON = function toJSON() {578 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);579 };580 return ResetValue;581 })();582 example.GetCounter = (function() {583 /**584 * Properties of a GetCounter.585 * @memberof com.example586 * @interface IGetCounter587 * @property {string|null} [counterId] GetCounter counterId588 */589 /**590 * Constructs a new GetCounter.591 * @memberof com.example592 * @classdesc Represents a GetCounter.593 * @implements IGetCounter594 * @constructor595 * @param {com.example.IGetCounter=} [properties] Properties to set596 */597 function GetCounter(properties) {598 if (properties)599 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)600 if (properties[keys[i]] != null)601 this[keys[i]] = properties[keys[i]];602 }603 /**604 * GetCounter counterId.605 * @member {string} counterId606 * @memberof com.example.GetCounter607 * @instance608 */609 GetCounter.prototype.counterId = "";610 /**611 * Creates a new GetCounter instance using the specified properties.612 * @function create613 * @memberof com.example.GetCounter614 * @static615 * @param {com.example.IGetCounter=} [properties] Properties to set616 * @returns {com.example.GetCounter} GetCounter instance617 */618 GetCounter.create = function create(properties) {619 return new GetCounter(properties);620 };621 /**622 * Encodes the specified GetCounter message. Does not implicitly {@link com.example.GetCounter.verify|verify} messages.623 * @function encode624 * @memberof com.example.GetCounter625 * @static626 * @param {com.example.IGetCounter} message GetCounter message or plain object to encode627 * @param {$protobuf.Writer} [writer] Writer to encode to628 * @returns {$protobuf.Writer} Writer629 */630 GetCounter.encode = function encode(message, writer) {631 if (!writer)632 writer = $Writer.create();633 if (message.counterId != null && Object.hasOwnProperty.call(message, "counterId"))634 writer.uint32(/* id 1, wireType 2 =*/10).string(message.counterId);635 return writer;636 };637 /**638 * Encodes the specified GetCounter message, length delimited. Does not implicitly {@link com.example.GetCounter.verify|verify} messages.639 * @function encodeDelimited640 * @memberof com.example.GetCounter641 * @static642 * @param {com.example.IGetCounter} message GetCounter message or plain object to encode643 * @param {$protobuf.Writer} [writer] Writer to encode to644 * @returns {$protobuf.Writer} Writer645 */646 GetCounter.encodeDelimited = function encodeDelimited(message, writer) {647 return this.encode(message, writer).ldelim();648 };649 /**650 * Decodes a GetCounter message from the specified reader or buffer.651 * @function decode652 * @memberof com.example.GetCounter653 * @static654 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from655 * @param {number} [length] Message length if known beforehand656 * @returns {com.example.GetCounter} GetCounter657 * @throws {Error} If the payload is not a reader or valid buffer658 * @throws {$protobuf.util.ProtocolError} If required fields are missing659 */660 GetCounter.decode = function decode(reader, length) {661 if (!(reader instanceof $Reader))662 reader = $Reader.create(reader);663 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.com.example.GetCounter();664 while (reader.pos < end) {665 var tag = reader.uint32();666 switch (tag >>> 3) {667 case 1:668 message.counterId = reader.string();669 break;670 default:671 reader.skipType(tag & 7);672 break;673 }674 }675 return message;676 };677 /**678 * Decodes a GetCounter message from the specified reader or buffer, length delimited.679 * @function decodeDelimited680 * @memberof com.example.GetCounter681 * @static682 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from683 * @returns {com.example.GetCounter} GetCounter684 * @throws {Error} If the payload is not a reader or valid buffer685 * @throws {$protobuf.util.ProtocolError} If required fields are missing686 */687 GetCounter.decodeDelimited = function decodeDelimited(reader) {688 if (!(reader instanceof $Reader))689 reader = new $Reader(reader);690 return this.decode(reader, reader.uint32());691 };692 /**693 * Verifies a GetCounter message.694 * @function verify695 * @memberof com.example.GetCounter696 * @static697 * @param {Object.<string,*>} message Plain object to verify698 * @returns {string|null} `null` if valid, otherwise the reason why it is not699 */700 GetCounter.verify = function verify(message) {701 if (typeof message !== "object" || message === null)702 return "object expected";703 if (message.counterId != null && message.hasOwnProperty("counterId"))704 if (!$util.isString(message.counterId))705 return "counterId: string expected";706 return null;707 };708 /**709 * Creates a GetCounter message from a plain object. Also converts values to their respective internal types.710 * @function fromObject711 * @memberof com.example.GetCounter712 * @static713 * @param {Object.<string,*>} object Plain object714 * @returns {com.example.GetCounter} GetCounter715 */716 GetCounter.fromObject = function fromObject(object) {717 if (object instanceof $root.com.example.GetCounter)718 return object;719 var message = new $root.com.example.GetCounter();720 if (object.counterId != null)721 message.counterId = String(object.counterId);722 return message;723 };724 /**725 * Creates a plain object from a GetCounter message. Also converts values to other types if specified.726 * @function toObject727 * @memberof com.example.GetCounter728 * @static729 * @param {com.example.GetCounter} message GetCounter730 * @param {$protobuf.IConversionOptions} [options] Conversion options731 * @returns {Object.<string,*>} Plain object732 */733 GetCounter.toObject = function toObject(message, options) {734 if (!options)735 options = {};736 var object = {};737 if (options.defaults)738 object.counterId = "";739 if (message.counterId != null && message.hasOwnProperty("counterId"))740 object.counterId = message.counterId;741 return object;742 };743 /**744 * Converts this GetCounter to JSON.745 * @function toJSON746 * @memberof com.example.GetCounter747 * @instance748 * @returns {Object.<string,*>} JSON object749 */750 GetCounter.prototype.toJSON = function toJSON() {751 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);752 };753 return GetCounter;754 })();755 example.CurrentCounter = (function() {756 /**757 * Properties of a CurrentCounter.758 * @memberof com.example759 * @interface ICurrentCounter760 * @property {number|null} [value] CurrentCounter value761 */762 /**763 * Constructs a new CurrentCounter.764 * @memberof com.example765 * @classdesc Represents a CurrentCounter.766 * @implements ICurrentCounter767 * @constructor768 * @param {com.example.ICurrentCounter=} [properties] Properties to set769 */770 function CurrentCounter(properties) {771 if (properties)772 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)773 if (properties[keys[i]] != null)774 this[keys[i]] = properties[keys[i]];775 }776 /**777 * CurrentCounter value.778 * @member {number} value779 * @memberof com.example.CurrentCounter780 * @instance781 */782 CurrentCounter.prototype.value = 0;783 /**784 * Creates a new CurrentCounter instance using the specified properties.785 * @function create786 * @memberof com.example.CurrentCounter787 * @static788 * @param {com.example.ICurrentCounter=} [properties] Properties to set789 * @returns {com.example.CurrentCounter} CurrentCounter instance790 */791 CurrentCounter.create = function create(properties) {792 return new CurrentCounter(properties);793 };794 /**795 * Encodes the specified CurrentCounter message. Does not implicitly {@link com.example.CurrentCounter.verify|verify} messages.796 * @function encode797 * @memberof com.example.CurrentCounter798 * @static799 * @param {com.example.ICurrentCounter} message CurrentCounter message or plain object to encode800 * @param {$protobuf.Writer} [writer] Writer to encode to801 * @returns {$protobuf.Writer} Writer802 */803 CurrentCounter.encode = function encode(message, writer) {804 if (!writer)805 writer = $Writer.create();806 if (message.value != null && Object.hasOwnProperty.call(message, "value"))807 writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value);808 return writer;809 };810 /**811 * Encodes the specified CurrentCounter message, length delimited. Does not implicitly {@link com.example.CurrentCounter.verify|verify} messages.812 * @function encodeDelimited813 * @memberof com.example.CurrentCounter814 * @static815 * @param {com.example.ICurrentCounter} message CurrentCounter message or plain object to encode816 * @param {$protobuf.Writer} [writer] Writer to encode to817 * @returns {$protobuf.Writer} Writer818 */819 CurrentCounter.encodeDelimited = function encodeDelimited(message, writer) {820 return this.encode(message, writer).ldelim();821 };822 /**823 * Decodes a CurrentCounter message from the specified reader or buffer.824 * @function decode825 * @memberof com.example.CurrentCounter826 * @static827 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from828 * @param {number} [length] Message length if known beforehand829 * @returns {com.example.CurrentCounter} CurrentCounter830 * @throws {Error} If the payload is not a reader or valid buffer831 * @throws {$protobuf.util.ProtocolError} If required fields are missing832 */833 CurrentCounter.decode = function decode(reader, length) {834 if (!(reader instanceof $Reader))835 reader = $Reader.create(reader);836 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.com.example.CurrentCounter();837 while (reader.pos < end) {838 var tag = reader.uint32();839 switch (tag >>> 3) {840 case 1:841 message.value = reader.int32();842 break;843 default:844 reader.skipType(tag & 7);845 break;846 }847 }848 return message;849 };850 /**851 * Decodes a CurrentCounter message from the specified reader or buffer, length delimited.852 * @function decodeDelimited853 * @memberof com.example.CurrentCounter854 * @static855 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from856 * @returns {com.example.CurrentCounter} CurrentCounter857 * @throws {Error} If the payload is not a reader or valid buffer858 * @throws {$protobuf.util.ProtocolError} If required fields are missing859 */860 CurrentCounter.decodeDelimited = function decodeDelimited(reader) {861 if (!(reader instanceof $Reader))862 reader = new $Reader(reader);863 return this.decode(reader, reader.uint32());864 };865 /**866 * Verifies a CurrentCounter message.867 * @function verify868 * @memberof com.example.CurrentCounter869 * @static870 * @param {Object.<string,*>} message Plain object to verify871 * @returns {string|null} `null` if valid, otherwise the reason why it is not872 */873 CurrentCounter.verify = function verify(message) {874 if (typeof message !== "object" || message === null)875 return "object expected";876 if (message.value != null && message.hasOwnProperty("value"))877 if (!$util.isInteger(message.value))878 return "value: integer expected";879 return null;880 };881 /**882 * Creates a CurrentCounter message from a plain object. Also converts values to their respective internal types.883 * @function fromObject884 * @memberof com.example.CurrentCounter885 * @static886 * @param {Object.<string,*>} object Plain object887 * @returns {com.example.CurrentCounter} CurrentCounter888 */889 CurrentCounter.fromObject = function fromObject(object) {890 if (object instanceof $root.com.example.CurrentCounter)891 return object;892 var message = new $root.com.example.CurrentCounter();893 if (object.value != null)894 message.value = object.value | 0;895 return message;896 };897 /**898 * Creates a plain object from a CurrentCounter message. Also converts values to other types if specified.899 * @function toObject900 * @memberof com.example.CurrentCounter901 * @static902 * @param {com.example.CurrentCounter} message CurrentCounter903 * @param {$protobuf.IConversionOptions} [options] Conversion options904 * @returns {Object.<string,*>} Plain object905 */906 CurrentCounter.toObject = function toObject(message, options) {907 if (!options)908 options = {};909 var object = {};910 if (options.defaults)911 object.value = 0;912 if (message.value != null && message.hasOwnProperty("value"))913 object.value = message.value;914 return object;915 };916 /**917 * Converts this CurrentCounter to JSON.918 * @function toJSON919 * @memberof com.example.CurrentCounter920 * @instance921 * @returns {Object.<string,*>} JSON object922 */923 CurrentCounter.prototype.toJSON = function toJSON() {924 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);925 };926 return CurrentCounter;927 })();928 example.CounterService = (function() {929 /**930 * Constructs a new CounterService service.931 * @memberof com.example932 * @classdesc Represents a CounterService933 * @extends $protobuf.rpc.Service934 * @constructor935 * @param {$protobuf.RPCImpl} rpcImpl RPC implementation936 * @param {boolean} [requestDelimited=false] Whether requests are length-delimited937 * @param {boolean} [responseDelimited=false] Whether responses are length-delimited938 */939 function CounterService(rpcImpl, requestDelimited, responseDelimited) {940 $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);941 }942 (CounterService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CounterService;943 /**944 * Creates new CounterService service using the specified rpc implementation.945 * @function create946 * @memberof com.example.CounterService947 * @static948 * @param {$protobuf.RPCImpl} rpcImpl RPC implementation949 * @param {boolean} [requestDelimited=false] Whether requests are length-delimited950 * @param {boolean} [responseDelimited=false] Whether responses are length-delimited951 * @returns {CounterService} RPC service. Useful where requests and/or responses are streamed.952 */953 CounterService.create = function create(rpcImpl, requestDelimited, responseDelimited) {954 return new this(rpcImpl, requestDelimited, responseDelimited);955 };956 /**957 * Callback as used by {@link com.example.CounterService#increase}.958 * @memberof com.example.CounterService959 * @typedef IncreaseCallback960 * @type {function}961 * @param {Error|null} error Error, if any962 * @param {google.protobuf.Empty} [response] Empty963 */964 /**965 * Calls Increase.966 * @function increase967 * @memberof com.example.CounterService968 * @instance969 * @param {com.example.IIncreaseValue} request IncreaseValue message or plain object970 * @param {com.example.CounterService.IncreaseCallback} callback Node-style callback called with the error, if any, and Empty971 * @returns {undefined}972 * @variation 1973 */974 Object.defineProperty(CounterService.prototype.increase = function increase(request, callback) {975 return this.rpcCall(increase, $root.com.example.IncreaseValue, $root.google.protobuf.Empty, request, callback);976 }, "name", { value: "Increase" });977 /**978 * Calls Increase.979 * @function increase980 * @memberof com.example.CounterService981 * @instance982 * @param {com.example.IIncreaseValue} request IncreaseValue message or plain object983 * @returns {Promise<google.protobuf.Empty>} Promise984 * @variation 2985 */986 /**987 * Callback as used by {@link com.example.CounterService#decrease}.988 * @memberof com.example.CounterService989 * @typedef DecreaseCallback990 * @type {function}991 * @param {Error|null} error Error, if any992 * @param {google.protobuf.Empty} [response] Empty993 */994 /**995 * Calls Decrease.996 * @function decrease997 * @memberof com.example.CounterService998 * @instance999 * @param {com.example.IDecreaseValue} request DecreaseValue message or plain object1000 * @param {com.example.CounterService.DecreaseCallback} callback Node-style callback called with the error, if any, and Empty1001 * @returns {undefined}1002 * @variation 11003 */1004 Object.defineProperty(CounterService.prototype.decrease = function decrease(request, callback) {1005 return this.rpcCall(decrease, $root.com.example.DecreaseValue, $root.google.protobuf.Empty, request, callback);1006 }, "name", { value: "Decrease" });1007 /**1008 * Calls Decrease.1009 * @function decrease1010 * @memberof com.example.CounterService1011 * @instance1012 * @param {com.example.IDecreaseValue} request DecreaseValue message or plain object1013 * @returns {Promise<google.protobuf.Empty>} Promise1014 * @variation 21015 */1016 /**1017 * Callback as used by {@link com.example.CounterService#reset}.1018 * @memberof com.example.CounterService1019 * @typedef ResetCallback1020 * @type {function}1021 * @param {Error|null} error Error, if any1022 * @param {google.protobuf.Empty} [response] Empty1023 */1024 /**1025 * Calls Reset.1026 * @function reset1027 * @memberof com.example.CounterService1028 * @instance1029 * @param {com.example.IResetValue} request ResetValue message or plain object1030 * @param {com.example.CounterService.ResetCallback} callback Node-style callback called with the error, if any, and Empty1031 * @returns {undefined}1032 * @variation 11033 */1034 Object.defineProperty(CounterService.prototype.reset = function reset(request, callback) {1035 return this.rpcCall(reset, $root.com.example.ResetValue, $root.google.protobuf.Empty, request, callback);1036 }, "name", { value: "Reset" });1037 /**1038 * Calls Reset.1039 * @function reset1040 * @memberof com.example.CounterService1041 * @instance1042 * @param {com.example.IResetValue} request ResetValue message or plain object1043 * @returns {Promise<google.protobuf.Empty>} Promise1044 * @variation 21045 */1046 /**1047 * Callback as used by {@link com.example.CounterService#getCurrentCounter}.1048 * @memberof com.example.CounterService1049 * @typedef GetCurrentCounterCallback1050 * @type {function}1051 * @param {Error|null} error Error, if any1052 * @param {com.example.CurrentCounter} [response] CurrentCounter1053 */1054 /**1055 * Calls GetCurrentCounter.1056 * @function getCurrentCounter1057 * @memberof com.example.CounterService1058 * @instance1059 * @param {com.example.IGetCounter} request GetCounter message or plain object1060 * @param {com.example.CounterService.GetCurrentCounterCallback} callback Node-style callback called with the error, if any, and CurrentCounter1061 * @returns {undefined}1062 * @variation 11063 */1064 Object.defineProperty(CounterService.prototype.getCurrentCounter = function getCurrentCounter(request, callback) {1065 return this.rpcCall(getCurrentCounter, $root.com.example.GetCounter, $root.com.example.CurrentCounter, request, callback);1066 }, "name", { value: "GetCurrentCounter" });1067 /**1068 * Calls GetCurrentCounter.1069 * @function getCurrentCounter1070 * @memberof com.example.CounterService1071 * @instance1072 * @param {com.example.IGetCounter} request GetCounter message or plain object1073 * @returns {Promise<com.example.CurrentCounter>} Promise1074 * @variation 21075 */1076 return CounterService;1077 })();1078 example.domain = (function() {1079 /**1080 * Namespace domain.1081 * @memberof com.example1082 * @namespace1083 */1084 var domain = {};1085 domain.CounterState = (function() {1086 /**1087 * Properties of a CounterState.1088 * @memberof com.example.domain1089 * @interface ICounterState1090 * @property {number|null} [value] CounterState value1091 */1092 /**1093 * Constructs a new CounterState.1094 * @memberof com.example.domain1095 * @classdesc Represents a CounterState.1096 * @implements ICounterState1097 * @constructor1098 * @param {com.example.domain.ICounterState=} [properties] Properties to set1099 */1100 function CounterState(properties) {1101 if (properties)1102 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)1103 if (properties[keys[i]] != null)1104 this[keys[i]] = properties[keys[i]];1105 }1106 /**1107 * CounterState value.1108 * @member {number} value1109 * @memberof com.example.domain.CounterState1110 * @instance1111 */1112 CounterState.prototype.value = 0;1113 /**1114 * Creates a new CounterState instance using the specified properties.1115 * @function create1116 * @memberof com.example.domain.CounterState1117 * @static1118 * @param {com.example.domain.ICounterState=} [properties] Properties to set1119 * @returns {com.example.domain.CounterState} CounterState instance1120 */1121 CounterState.create = function create(properties) {1122 return new CounterState(properties);1123 };1124 /**1125 * Encodes the specified CounterState message. Does not implicitly {@link com.example.domain.CounterState.verify|verify} messages.1126 * @function encode1127 * @memberof com.example.domain.CounterState1128 * @static1129 * @param {com.example.domain.ICounterState} message CounterState message or plain object to encode1130 * @param {$protobuf.Writer} [writer] Writer to encode to1131 * @returns {$protobuf.Writer} Writer1132 */1133 CounterState.encode = function encode(message, writer) {1134 if (!writer)1135 writer = $Writer.create();1136 if (message.value != null && Object.hasOwnProperty.call(message, "value"))1137 writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value);1138 return writer;1139 };1140 /**1141 * Encodes the specified CounterState message, length delimited. Does not implicitly {@link com.example.domain.CounterState.verify|verify} messages.1142 * @function encodeDelimited1143 * @memberof com.example.domain.CounterState1144 * @static1145 * @param {com.example.domain.ICounterState} message CounterState message or plain object to encode1146 * @param {$protobuf.Writer} [writer] Writer to encode to1147 * @returns {$protobuf.Writer} Writer1148 */1149 CounterState.encodeDelimited = function encodeDelimited(message, writer) {1150 return this.encode(message, writer).ldelim();1151 };1152 /**1153 * Decodes a CounterState message from the specified reader or buffer.1154 * @function decode1155 * @memberof com.example.domain.CounterState1156 * @static1157 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from1158 * @param {number} [length] Message length if known beforehand1159 * @returns {com.example.domain.CounterState} CounterState1160 * @throws {Error} If the payload is not a reader or valid buffer1161 * @throws {$protobuf.util.ProtocolError} If required fields are missing1162 */1163 CounterState.decode = function decode(reader, length) {1164 if (!(reader instanceof $Reader))1165 reader = $Reader.create(reader);1166 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.com.example.domain.CounterState();1167 while (reader.pos < end) {1168 var tag = reader.uint32();1169 switch (tag >>> 3) {1170 case 1:1171 message.value = reader.int32();1172 break;1173 default:1174 reader.skipType(tag & 7);1175 break;1176 }1177 }1178 return message;1179 };1180 /**1181 * Decodes a CounterState message from the specified reader or buffer, length delimited.1182 * @function decodeDelimited1183 * @memberof com.example.domain.CounterState1184 * @static1185 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from1186 * @returns {com.example.domain.CounterState} CounterState1187 * @throws {Error} If the payload is not a reader or valid buffer1188 * @throws {$protobuf.util.ProtocolError} If required fields are missing1189 */1190 CounterState.decodeDelimited = function decodeDelimited(reader) {1191 if (!(reader instanceof $Reader))1192 reader = new $Reader(reader);1193 return this.decode(reader, reader.uint32());1194 };1195 /**1196 * Verifies a CounterState message.1197 * @function verify1198 * @memberof com.example.domain.CounterState1199 * @static1200 * @param {Object.<string,*>} message Plain object to verify1201 * @returns {string|null} `null` if valid, otherwise the reason why it is not1202 */1203 CounterState.verify = function verify(message) {1204 if (typeof message !== "object" || message === null)1205 return "object expected";1206 if (message.value != null && message.hasOwnProperty("value"))1207 if (!$util.isInteger(message.value))1208 return "value: integer expected";1209 return null;1210 };1211 /**1212 * Creates a CounterState message from a plain object. Also converts values to their respective internal types.1213 * @function fromObject1214 * @memberof com.example.domain.CounterState1215 * @static1216 * @param {Object.<string,*>} object Plain object1217 * @returns {com.example.domain.CounterState} CounterState1218 */1219 CounterState.fromObject = function fromObject(object) {1220 if (object instanceof $root.com.example.domain.CounterState)1221 return object;1222 var message = new $root.com.example.domain.CounterState();1223 if (object.value != null)1224 message.value = object.value | 0;1225 return message;1226 };1227 /**1228 * Creates a plain object from a CounterState message. Also converts values to other types if specified.1229 * @function toObject1230 * @memberof com.example.domain.CounterState1231 * @static1232 * @param {com.example.domain.CounterState} message CounterState1233 * @param {$protobuf.IConversionOptions} [options] Conversion options1234 * @returns {Object.<string,*>} Plain object1235 */1236 CounterState.toObject = function toObject(message, options) {1237 if (!options)1238 options = {};1239 var object = {};1240 if (options.defaults)1241 object.value = 0;1242 if (message.value != null && message.hasOwnProperty("value"))1243 object.value = message.value;1244 return object;1245 };1246 /**1247 * Converts this CounterState to JSON.1248 * @function toJSON1249 * @memberof com.example.domain.CounterState1250 * @instance1251 * @returns {Object.<string,*>} JSON object1252 */1253 CounterState.prototype.toJSON = function toJSON() {1254 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);1255 };1256 return CounterState;1257 })();1258 return domain;1259 })();1260 return example;1261 })();1262 return com;1263})();1264$root.google = (function() {1265 /**1266 * Namespace google.1267 * @exports google1268 * @namespace1269 */1270 var google = {};1271 google.protobuf = (function() {1272 /**1273 * Namespace protobuf.1274 * @memberof google1275 * @namespace1276 */1277 var protobuf = {};1278 protobuf.Empty = (function() {1279 /**1280 * Properties of an Empty.1281 * @memberof google.protobuf1282 * @interface IEmpty1283 */1284 /**1285 * Constructs a new Empty.1286 * @memberof google.protobuf1287 * @classdesc Represents an Empty.1288 * @implements IEmpty1289 * @constructor1290 * @param {google.protobuf.IEmpty=} [properties] Properties to set1291 */1292 function Empty(properties) {1293 if (properties)1294 for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)1295 if (properties[keys[i]] != null)1296 this[keys[i]] = properties[keys[i]];1297 }1298 /**1299 * Creates a new Empty instance using the specified properties.1300 * @function create1301 * @memberof google.protobuf.Empty1302 * @static1303 * @param {google.protobuf.IEmpty=} [properties] Properties to set1304 * @returns {google.protobuf.Empty} Empty instance1305 */1306 Empty.create = function create(properties) {1307 return new Empty(properties);1308 };1309 /**1310 * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages.1311 * @function encode1312 * @memberof google.protobuf.Empty1313 * @static1314 * @param {google.protobuf.IEmpty} message Empty message or plain object to encode1315 * @param {$protobuf.Writer} [writer] Writer to encode to1316 * @returns {$protobuf.Writer} Writer1317 */1318 Empty.encode = function encode(message, writer) {1319 if (!writer)1320 writer = $Writer.create();1321 return writer;1322 };1323 /**1324 * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages.1325 * @function encodeDelimited1326 * @memberof google.protobuf.Empty1327 * @static1328 * @param {google.protobuf.IEmpty} message Empty message or plain object to encode1329 * @param {$protobuf.Writer} [writer] Writer to encode to1330 * @returns {$protobuf.Writer} Writer1331 */1332 Empty.encodeDelimited = function encodeDelimited(message, writer) {1333 return this.encode(message, writer).ldelim();1334 };1335 /**1336 * Decodes an Empty message from the specified reader or buffer.1337 * @function decode1338 * @memberof google.protobuf.Empty1339 * @static1340 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from1341 * @param {number} [length] Message length if known beforehand1342 * @returns {google.protobuf.Empty} Empty1343 * @throws {Error} If the payload is not a reader or valid buffer1344 * @throws {$protobuf.util.ProtocolError} If required fields are missing1345 */1346 Empty.decode = function decode(reader, length) {1347 if (!(reader instanceof $Reader))1348 reader = $Reader.create(reader);1349 var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty();1350 while (reader.pos < end) {1351 var tag = reader.uint32();1352 switch (tag >>> 3) {1353 default:1354 reader.skipType(tag & 7);1355 break;1356 }1357 }1358 return message;1359 };1360 /**1361 * Decodes an Empty message from the specified reader or buffer, length delimited.1362 * @function decodeDelimited1363 * @memberof google.protobuf.Empty1364 * @static1365 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from1366 * @returns {google.protobuf.Empty} Empty1367 * @throws {Error} If the payload is not a reader or valid buffer1368 * @throws {$protobuf.util.ProtocolError} If required fields are missing1369 */1370 Empty.decodeDelimited = function decodeDelimited(reader) {1371 if (!(reader instanceof $Reader))1372 reader = new $Reader(reader);1373 return this.decode(reader, reader.uint32());1374 };1375 /**1376 * Verifies an Empty message.1377 * @function verify1378 * @memberof google.protobuf.Empty1379 * @static1380 * @param {Object.<string,*>} message Plain object to verify1381 * @returns {string|null} `null` if valid, otherwise the reason why it is not1382 */1383 Empty.verify = function verify(message) {1384 if (typeof message !== "object" || message === null)1385 return "object expected";1386 return null;1387 };1388 /**1389 * Creates an Empty message from a plain object. Also converts values to their respective internal types.1390 * @function fromObject1391 * @memberof google.protobuf.Empty1392 * @static1393 * @param {Object.<string,*>} object Plain object1394 * @returns {google.protobuf.Empty} Empty1395 */1396 Empty.fromObject = function fromObject(object) {1397 if (object instanceof $root.google.protobuf.Empty)1398 return object;1399 return new $root.google.protobuf.Empty();1400 };1401 /**1402 * Creates a plain object from an Empty message. Also converts values to other types if specified.1403 * @function toObject1404 * @memberof google.protobuf.Empty1405 * @static1406 * @param {google.protobuf.Empty} message Empty1407 * @param {$protobuf.IConversionOptions} [options] Conversion options1408 * @returns {Object.<string,*>} Plain object1409 */1410 Empty.toObject = function toObject() {1411 return {};1412 };1413 /**1414 * Converts this Empty to JSON.1415 * @function toJSON1416 * @memberof google.protobuf.Empty1417 * @instance1418 * @returns {Object.<string,*>} JSON object1419 */1420 Empty.prototype.toJSON = function toJSON() {1421 return this.constructor.toObject(this, $protobuf.util.toJSONOptions);1422 };1423 return Empty;1424 })();1425 return protobuf;1426 })();1427 return google;...

Full Screen

Full Screen

unitInstinct.js

Source:unitInstinct.js Github

copy

Full Screen

1export { applyInstinct };2function applyInstinct(level, unitData, settingUnitData) {3 for(let i = 0; i < level.length; i++) {4 if(unitData.value.instinct.instinct.img[i] === 'attack_power_increase') attackPowerIncrease(i, unitData, settingUnitData);5 if(unitData.value.instinct.instinct.img[i] === 'hp_increase') hpIncrease(i, settingUnitData);6 if(unitData.value.instinct.instinct.img[i] === 'cost_decrease') costDecrease(i, unitData, settingUnitData);7 if(unitData.value.instinct.instinct.img[i] === 'attack_power_up') attackPowerUp(i, unitData, settingUnitData);8 if(unitData.value.instinct.instinct.img[i] === 'move_speed_increase') moveSpeedIncrease(i, unitData, settingUnitData);9 if(unitData.value.instinct.instinct.img[i] === 'produce_speed_increase') produceSpeedIncrease(i, unitData, settingUnitData);10 if(unitData.value.instinct.instinct.img[i] === 'strength') strength(level, i, unitData, settingUnitData);11 if(unitData.value.instinct.instinct.img[i] === 'super_damage') superDamage(level, i, unitData, settingUnitData);12 if(unitData.value.instinct.instinct.img[i] === 'ultra_damage') ultraDamage(level, i, unitData, settingUnitData);13 if(unitData.value.instinct.instinct.img[i] === 'hard') hard(level, i, settingUnitData);14 if(unitData.value.instinct.instinct.img[i] === 'ultra_hard') ultraHard(level, i, settingUnitData);15 if(unitData.value.instinct.instinct.img[i] === 'critical') critical(level, i, unitData, settingUnitData);16 if(unitData.value.instinct.instinct.img[i] === 'soul_attack') soulAttack(level, i, unitData, settingUnitData);17 }18}19//기본 공격 업20function attackPowerIncrease(idx, unitData, settingUnitData) {21 let increaseValue = settingUnitData.value.instinct.instinct.increase[idx];22 if(settingUnitData.value.attackPower[2].length > 1) {23 let attackPowerArr = settingUnitData.value.attackPower[2];24 if(increaseValue !== 0) for(let i = 0; i < attackPowerArr.length; i++) attackPowerArr[i] += Math.round(attackPowerArr[i] * (increaseValue / 100));25 settingUnitData.value.attackPower[2] = attackPowerArr;26 }27 if(increaseValue !== 0) unitData.value.combineAttackPower[2] += Math.round(unitData.value.combineAttackPower[2] * (increaseValue / 100));28}29//기본 체력 업30function hpIncrease(idx, settingUnitData) {31 let increaseValue = settingUnitData.value.instinct.instinct.increase[idx];32 if(increaseValue !== 0) settingUnitData.value.hp[2] += Math.round(settingUnitData.value.hp[2] * (increaseValue / 100));33}34//생산 비용 할인35function costDecrease(idx, unitData, settingUnitData) {36 let decreaseValue = settingUnitData.value.instinct.instinct.increase[idx];37 let cost = unitData.value.cost[2];38 if(decreaseValue !== 0) cost -= decreaseValue;39 settingUnitData.value.cost = cost;40}41//공격력 업42function attackPowerUp(idx, unitData, settingUnitData) {43 const instinct = settingUnitData.value.instinct.instinct;44 let increaseValue = Number(instinct.increase[idx]);45 let init = 0;46 if(instinct.init[idx] !== undefined) init = Number(instinct.init[idx]);47 if(increaseValue > 0) increaseValue += init;48 49 if(settingUnitData.value.attackPower[2].length > 1) {50 let attackPowerArr = settingUnitData.value.attackPower[2];51 if(increaseValue !== 0) for(let i = 0; i < attackPowerArr.length; i++) attackPowerArr[i] += Math.round(attackPowerArr[i] * (increaseValue / 100));52 settingUnitData.value.attackPower[2] = attackPowerArr;53 }54 if(increaseValue !== 0) unitData.value.combineAttackPower[2] += Math.round(unitData.value.combineAttackPower[2] * (increaseValue / 100));55}56//이동 속도 증가57function moveSpeedIncrease(idx, unitData, settingUnitData) {58 let increaseValue = settingUnitData.value.instinct.instinct.increase[idx];59 let moveSpeed = unitData.value.moveSpeed[2];60 if(increaseValue != 0) moveSpeed += increaseValue;61 settingUnitData.value.moveSpeed = moveSpeed;62}63//생산 속도 증가64function produceSpeedIncrease(idx, unitData, settingUnitData) {65 let decreaseValue = settingUnitData.value.instinct.instinct.increase[idx];66 let decreaseInit = settingUnitData.value.instinct.instinct.init[idx];67 let produceSpeed = unitData.value.produceSpeed[2];68 if(decreaseValue != 0) produceSpeed -= decreaseValue;69 if(decreaseInit != 0 && unitData.value.instinctLevel[idx] > 0) produceSpeed -= decreaseInit;70 settingUnitData.value.produceSpeed = produceSpeed;71}72//엄청 강하다73function strength(level, idx, unitData, settingUnitData) {74 if(level[idx] > 0) {75 settingUnitData.value.hp[2] = Math.round(settingUnitData.value.hp[2] * 2.5);76 if(settingUnitData.value.attackPower[2].length > 1) {77 let attackPowerArr = settingUnitData.value.attackPower[2];78 for(let i = 0; i < attackPowerArr.length; i++) attackPowerArr[i] += Math.round(attackPowerArr[i] * 1.8);79 settingUnitData.value.attackPower[2] = attackPowerArr;80 }81 unitData.value.combineAttackPower[2] = Math.round(unitData.value.combineAttackPower[2] * 1.8);82 }83}84//초 데미지85function superDamage(level, idx, unitData, settingUnitData) {86 if(level[idx] > 0) {87 if(settingUnitData.value.attackPower[2].length > 1) {88 let attackPowerArr = settingUnitData.value.attackPower[2];89 90 for(let i = 0; i < attackPowerArr.length; i++) attackPowerArr[i] *= 4;91 92 settingUnitData.value.attackPower[2] = attackPowerArr;93 }94 95 unitData.value.combineAttackPower[2] = Math.round(unitData.value.combineAttackPower[2] * 4);96 }97}98//극 데미지99function ultraDamage(level, idx, unitData, settingUnitData) {100 if(level[idx] > 0) {101 if(settingUnitData.value.attackPower[2].length > 1) {102 let attackPowerArr = settingUnitData.value.attackPower[2];103 104 for(let i = 0; i < attackPowerArr.length; i++) attackPowerArr[i] *= 6;105 settingUnitData.value.attackPower[2] = attackPowerArr;106 }107 108 unitData.value.combineAttackPower[2] = Math.round(unitData.value.combineAttackPower[2] * 6);109 }110}111//맷집이 좋다112function hard(level, idx, settingUnitData) {113 if(level[idx] > 0) settingUnitData.value.hp[2] = Math.round(settingUnitData.value.hp[2] * 5);114}115//초 맷집이 좋다116function ultraHard(level, idx, settingUnitData) {117 if(level[idx] > 0) settingUnitData.value.hp[2] = Math.round(settingUnitData.value.hp[2] * 7);118}119//크리티컬120function critical(level, idx, unitData, settingUnitData) {121 if(level[idx] > 0) {122 if(settingUnitData.value.attackPower[2].length > 1) {123 let attackPowerArr = settingUnitData.value.attackPower[2];124 125 for(let i = 0; i < attackPowerArr.length; i++) attackPowerArr[i] *= 2;126 settingUnitData.value.attackPower[2] = attackPowerArr;127 }128 129 unitData.value.combineAttackPower[2] = Math.round(unitData.value.combineAttackPower[2] * 2);130 }131}132//혼신의 일격133function soulAttack(level, idx, unitData, settingUnitData) {134 if(level[idx] > 0) {135 if(settingUnitData.value.attackPower[2].length > 1) {136 let attackPowerArr = settingUnitData.value.attackPower[2];137 138 for(let i = 0; i < attackPowerArr.length; i++) attackPowerArr[i] *= 3;139 settingUnitData.value.attackPower[2] = attackPowerArr;140 }141 142 unitData.value.combineAttackPower[2] = Math.round(unitData.value.combineAttackPower[2] * 3);143 }...

Full Screen

Full Screen

post.js

Source:post.js Github

copy

Full Screen

1const format = require('./format');2const MailProvider = require('./mailProvider');3const LinkedinApi = require('./linkedinApi');4const { admin } = require('../provider/firebase');5const db = admin.firestore();6const bucket = admin.storage().bucket();7const trackData = async (userUid,data) => {8 const {author, shareMediaCategory } = data;9 const increaseValue = admin.firestore.FieldValue.increment(1);10 const increaseObject = { };11 if(author.split(':')[2] === "person") increaseObject['numPersonalPost'] = increaseValue;12 else if(author.split(':')[2] === "organization") increaseObject['numCompanyPost'] = increaseValue;13 else increaseObject['numOhterAuthorPost'] = increaseValue;14 if(shareMediaCategory === "ARTICLE") increaseObject['numArticlePost'] = increaseValue;15 else if(shareMediaCategory === "IMAGE") increaseObject['numImagePost'] = increaseValue;16 else increaseObject['numOhterMediaPost'] = increaseValue;17 increaseObject['numTotalPost'] = increaseValue;18 const userRef = db.collection('user').doc(userUid);19 const docSnapshot = await userRef.get();20 if (docSnapshot.exists) userRef.update(increaseObject);21 else userRef.set(increaseObject);22}23const postOnLinkedin = (newPost) => new Promise(async(resolve,reject) => {24 const userUid = newPost.data().userUID;25 const body = await format.postBody(userUid,newPost.data());26 if(body === null) return reject(new Error('Cannot build body'));27 if(userUid === "linkedin:3A8ySOLYhe" || process.env.GCLOUD_PROJECT === "feedmyflow"){28 const linkedinApi = new LinkedinApi();29 await linkedinApi.retrieveAccessToken(userUid);30 const res = await linkedinApi.request("LINKEDIN_API_ROLE_UGC_POST",{body}).catch((err)=> reject(err));31 if(process.env.GCLOUD_PROJECT === "feedmyflow") {32 if(res !== undefined && res.id){33 trackData(userUid, newPost.data())34 db.collection('user').doc(userUid).collection('posted').doc(newPost.id).set({...newPost.data(),...{urnPostId:res.id}});35 db.collection('user').doc(userUid).collection('post').doc(newPost.id).delete();36 const { media } = newPost.data();37 if(media && media.fileInfo && media.fileInfo.filePath) bucket.file(media.fileInfo.filePath).delete();38 39 const mailProvider = new MailProvider()40 await mailProvider.sendPostConfirmation(newPost.data())41 .then(()=> resolve('Sended'))42 .catch((error)=> reject(error));43 }44 }45 }46 return reject(new Error(`Can't post the data for this user: ${userUid}`));47});...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { increaseValue } from 'ng-mocks';2import { AppComponent } from './app.component';3import { TestBed } from '@angular/core/testing';4describe('AppComponent', () => {5 beforeEach(() => {6 TestBed.configureTestingModule({7 });8 });9 it('should increase value', () => {10 const fixture = TestBed.createComponent(AppComponent);11 const component = fixture.componentInstance;12 fixture.detectChanges();13 component.value = 1;14 increaseValue(fixture, 'value');15 expect(component.value).toBe(2);16 });17});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { increaseValue } from 'ng-mocks';2import { createComponent } from 'ng-mocks';3describe('AppComponent', () => {4 beforeEach(async(() => {5 TestBed.configureTestingModule({6 }).compileComponents();7 }));8 it('should create the app', () => {9 const fixture = TestBed.createComponent(AppComponent);10 const app = fixture.debugElement.componentInstance;11 expect(app).toBeTruthy();12 });13 it(`should have as title 'app'`, () => {14 const fixture = TestBed.createComponent(AppComponent);15 const app = fixture.debugElement.componentInstance;16 expect(app.title).toEqual('app');17 });18 it('should render title in a h1 tag', () => {19 const fixture = TestBed.createComponent(AppComponent);20 fixture.detectChanges();21 const compiled = fixture.debugElement.nativeElement;22 expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');23 });24 it('should render title in a h2 tag', () => {25 const fixture = TestBed.createComponent(AppComponent);26 fixture.detectChanges();27 const compiled = fixture.debugElement.nativeElement;28 expect(compiled.querySelector('h2').textContent).toContain('Welcome to app!');29 });30 it('should render title in a h3 tag', () => {31 const fixture = TestBed.createComponent(AppComponent);32 fixture.detectChanges();33 const compiled = fixture.debugElement.nativeElement;34 expect(compiled.querySelector('h3').textContent).toContain('Welcome to app!');35 });36 it('should render title in a h4 tag', () => {37 const fixture = TestBed.createComponent(AppComponent);38 fixture.detectChanges();39 const compiled = fixture.debugElement.nativeElement;40 expect(compiled.querySelector('h4').textContent).toContain('Welcome to app!');41 });42 it('should render title in a h5 tag', () => {43 const fixture = TestBed.createComponent(AppComponent);44 fixture.detectChanges();45 const compiled = fixture.debugElement.nativeElement;46 expect(compiled.querySelector('h5').textContent).toContain('Welcome to app!');47 });48 it('should render title in a h6 tag', () => {49 const fixture = TestBed.createComponent(AppComponent);50 fixture.detectChanges();51 const compiled = fixture.debugElement.nativeElement;52 expect(compiled.querySelector('h6').textContent).toContain('Welcome to app!');53 });54 it('should render title in a p tag', () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { increaseValue } from 'ng-mocks';2increaseValue(component, 'value');3import { decreaseValue } from 'ng-mocks';4decreaseValue(component, 'value');5import { mockValue } from 'ng-mocks';6mockValue(component, 'value', 1);7import { resetValue } from 'ng-mocks';8resetValue(component, 'value');9import { increaseValue } from 'ng-mocks';10increaseValue(component, 'value');11import { decreaseValue } from 'ng-mocks';12decreaseValue(component, 'value');13import { mockValue } from 'ng-mocks';14mockValue(component, 'value', 1);15import { resetValue } from 'ng-mocks';16resetValue(component, 'value');17import { increaseValue } from 'ng-mocks';18increaseValue(component, 'value');19import { decreaseValue } from 'ng-mocks';20decreaseValue(component, 'value');21import { mockValue } from 'ng-mocks';22mockValue(component, 'value', 1);23import { resetValue } from 'ng-mocks';24resetValue(component, 'value');25import { increaseValue } from 'ng-mocks';26increaseValue(component, 'value');27import { decreaseValue } from 'ng-mocks';28decreaseValue(component, 'value');29import { mockValue } from 'ng-mocks';30mockValue(component, 'value', 1);31import { resetValue } from 'ng-mocks';32resetValue(component,

Full Screen

Using AI Code Generation

copy

Full Screen

1import { increaseValue } from 'ng-mocks';2increaseValue(componentInstance, 'value', 1);3import { increaseValue } from 'ng-mocks';4increaseValue(componentInstance, 'value', 1);5import { increaseValue } from 'ng-mocks';6increaseValue(componentInstance, 'value', 1);7import { increaseValue } from 'ng-mocks';8increaseValue(componentInstance, 'value', 1);9import { increaseValue } from 'ng-mocks';10increaseValue(componentInstance, 'value', 1);11import { increaseValue } from 'ng-mocks';12increaseValue(componentInstance, 'value', 1);13import { increaseValue } from 'ng-mocks';14increaseValue(componentInstance, 'value', 1);15import { increaseValue } from 'ng-mocks';16increaseValue(componentInstance, 'value', 1);17import { increaseValue } from 'ng-mocks';18increaseValue(componentInstance, 'value', 1);19import { increaseValue } from 'ng-mocks';20increaseValue(componentInstance, 'value', 1);21import { increaseValue } from 'ng-mocks';22increaseValue(componentInstance, 'value', 1);23import { increaseValue } from 'ng-mocks';24increaseValue(componentInstance, 'value', 1);25import { increaseValue } from 'ng-mocks';26increaseValue(componentInstance, 'value', 1);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { increaseValue } from 'ng-mocks';2import { increaseValue } from 'ng-mocks';3describe('increaseValue', () => {4 it('should increase value', () => {5 expect(increaseValue(1, 2)).toBe(3);6 });7});8import { increaseValue } from 'ng-mocks';9describe('increaseValue', () => {10 it('should increase value', () => {11 expect(increaseValue(1, 2)).toBe(3);12 });13});14import { increaseValue } from 'ng-mocks';15import { increaseValue } from 'ng-mocks';16describe('increaseValue', () => {17 it('should increase value', () => {18 expect(increaseValue(1, 2)).toBe(3);19 });20});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { increaseValue } from 'ng-mocks';2import { ngMocks } from 'ng-mocks';3import { ngMocks } from 'ng-mocks';4import { ngMocks } from 'ngMocks';5import { ngMocks } from 'ngMocks';6import { ngMocks } from 'ngMocks';7import { ngMocks } from 'ngMocks';8import { ngMocks } from 'ngMocks';9import { ngM

Full Screen

Using AI Code Generation

copy

Full Screen

1import { increaseValue } from 'ng-mocks';2increaseValue('myButton', 5);3import { increaseValue } from 'ng-mocks';4increaseValue('myButton', 5);5import { increaseValue } from 'ng-mocks';6increaseValue('myButton', 5);7import { increaseValue } from 'ng-mocks';8increaseValue('myButton', 5);9import { increaseValue } from 'ng-mocks';10increaseValue('myButton', 5);11import { increaseValue } from 'ng-mocks';12increaseValue('myButton', 5);13import { increaseValue } from 'ng-mocks';14increaseValue('myButton', 5);15import { increaseValue } from 'ng-mocks';16increaseValue('myButton', 5);17import { increaseValue } from 'ng-mocks';18increaseValue('myButton', 5);19import { increaseValue } from 'ng-mocks';20increaseValue('myButton', 5);21import { increaseValue } from 'ng-mocks';22increaseValue('myButton', 5);23import { increaseValue } from 'ng-mocks';24increaseValue('myButton', 5);25import { increaseValue } from 'ng-mocks';26increaseValue('myButton', 5);27import { increaseValue }

Full Screen

Using AI Code Generation

copy

Full Screen

1import { increaseValue } from 'ng-mocks';2increaseValue('input', 'value', 1);3import { increaseValue } from 'ng-mocks';4increaseValue('input', 'value', 1);5import { increaseValue } from 'ng-mocks';6increaseValue('input', 'value', 1);7import { increaseValue } from 'ng-mocks';8increaseValue('input', 'value', 1);9import { increaseValue } from 'ng-mocks';10increaseValue('input', 'value', 1);11import { increaseValue } from 'ng-mocks';12increaseValue('input', 'value', 1);13import { increaseValue } from 'ng-mocks';14increaseValue('input', 'value', 1);15import { increaseValue } from 'ng-mocks';16increaseValue('input', 'value', 1);17import { increaseValue } from 'ng-mocks';18increaseValue('input', 'value', 1);19import { increaseValue } from 'ng-mocks';20increaseValue('input', 'value', 1);21import { increaseValue } from 'ng-mocks';22increaseValue('input', 'value', 1);23import { increaseValue } from 'ng-mocks';24increaseValue('input', 'value', 1);25import { increaseValue } from 'ng-mocks';26increaseValue('input

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ng-mocks automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful