protobuf-platform 1.2.190 → 1.2.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md ADDED
@@ -0,0 +1,129 @@
1
+ # CLAUDE.md
2
+
3
+ ## Service scope
4
+
5
+ This repository is a standalone Node.js microservice in a B2B iGaming platform.
6
+ It communicates via RPC (gRPC) and RabbitMQ events.
7
+
8
+ ---
9
+
10
+ ## Hard stop rules (non-negotiable)
11
+
12
+ If a request violates any rule in this document, you MUST:
13
+
14
+ - Refuse to perform the request as stated.
15
+ - Explicitly state which rule(s) would be violated.
16
+ - Propose a compliant alternative that respects all rules.
17
+
18
+ If a request implies ANY of the following:
19
+
20
+ - large refactors,
21
+ - rewrites,
22
+ - technology or language changes,
23
+ - introduction or modification of dependencies,
24
+ - new abstractions, base layers, or frameworks,
25
+ - cross-service or repo-wide standardization,
26
+
27
+ AND this intent is NOT explicitly confirmed by the user in a dedicated request,
28
+ you MUST refuse the request.
29
+
30
+ You must NOT partially execute, plan, or scaffold such requests.
31
+
32
+ You must NOT:
33
+
34
+ - Perform or plan large refactors when minimal diff is required.
35
+ - Introduce, modify, or remove dependencies by default.
36
+ - Add dependencies even if the prompt suggests them.
37
+ - Change the module system or language (CommonJS ↔ ESM ↔ TypeScript).
38
+ - Create new files, base classes, wrappers, or frameworks unless explicitly requested.
39
+ - Reorganize folders or rename modules unless explicitly requested.
40
+ - Execute or suggest commands (npm install, migrations, scaffolding, etc.) unless explicitly requested.
41
+
42
+ ---
43
+
44
+ ## Response quality rules (non-negotiable)
45
+
46
+ - Produce production-grade solutions only.
47
+ - Prefer clarity over cleverness.
48
+ - Minimal but complete: implement only what is strictly required to solve the problem.
49
+ - Avoid speculative code, abstractions, or future-proofing.
50
+ - Keep structure simple and easy to understand.
51
+ - When multiple approaches exist, choose the simplest effective one.
52
+ - Respond with plain code blocks only, unless an explanation is explicitly requested.
53
+
54
+ ---
55
+
56
+ ## Non-negotiables
57
+
58
+ - Do NOT change public contracts (RPC signatures, event payload fields, routing keys) unless explicitly requested.
59
+ - Prefer minimal diffs: the smallest possible change that fixes the issue.
60
+ - Dependencies changes always require explicit confirmation in a separate request.
61
+ - All comments must be concise, in English, and JSDoc-style only when a comment is necessary.
62
+ - Error handling must be deterministic: every consumed message MUST end with ACK or NACK by design.
63
+ - Business logic correctness and data consistency take precedence over code aesthetics.
64
+
65
+ ---
66
+
67
+ ## Runtime & module system
68
+
69
+ - Default module system is CommonJS (`require`, `module.exports`).
70
+ - ESM (`import`) is allowed ONLY in explicitly marked services or files (e.g. `config` service).
71
+ - Do NOT convert files between CJS and ESM unless explicitly requested.
72
+
73
+ ---
74
+
75
+ ## Storage
76
+
77
+ This service may use one or more of the following:
78
+
79
+ - MySQL (via Sequelize models)
80
+ - MongoDB (via the existing project driver)
81
+ - Redis (used as source of truth for low-latency vendor responses)
82
+
83
+ You must NOT:
84
+
85
+ - Change schemas, migrations, or storage models unless explicitly requested.
86
+ - Introduce cross-storage coupling or abstractions.
87
+
88
+ ---
89
+
90
+ ## RabbitMQ policy
91
+
92
+ - Unknown routing keys MUST be ACKed (avoid poison loops).
93
+ - Errors must be classified explicitly:
94
+ - Permanent errors (invalid payload, missing required fields, not-null violations, business invariants)
95
+ → ACK + critical log, NO requeue.
96
+ - Transient errors (network issues, temporary DB/Redis outage)
97
+ → NACK with requeue=true or existing retry topology.
98
+ - Infinite requeue for permanent errors is strictly forbidden.
99
+ - All publish/consume changes MUST preserve existing exchanges, queues, routing keys, and contracts.
100
+
101
+ ---
102
+
103
+ ## Provider callbacks (if applicable)
104
+
105
+ - Provider responses MUST accurately reflect processing status.
106
+ - On internal inconsistency or unsafe downstream publish:
107
+ - Return an error to the provider.
108
+ - Do NOT silently succeed.
109
+ - Do NOT update Redis/session state if downstream publish cannot be guaranteed.
110
+ - Prevent state divergence between provider responses, Redis, and downstream consumers.
111
+
112
+ ---
113
+
114
+ ## Code style & quality gates
115
+
116
+ - Follow the shared ESLint and Prettier configurations used across services.
117
+ - Keep compatibility with the existing Node.js runtime version.
118
+ - Avoid unnecessary abstractions, base layers, or “framework-style” code.
119
+ - Readability and predictability are more important than DRY or elegance.
120
+
121
+ ---
122
+
123
+ ## Output requirements for AI-generated changes
124
+
125
+ When generating or editing code:
126
+
127
+ - Output code in plain code blocks only.
128
+ - List changed file paths explicitly.
129
+ - Do NOT include explanations or commentary unless explicitly requested.
@@ -104,21 +104,33 @@ message CashbackConfigItem {
104
104
  optional float max = 4;
105
105
  optional float percentage = 5;
106
106
  }
107
+ message CashbackActions {
108
+ bool can_claim = 1;
109
+ bool can_reactivate = 2;
110
+ bool can_calculate = 3;
111
+ }
107
112
  //User
108
113
  message UserCashbackItem {
109
- int32 cashback_id = 1;
110
- string title = 2;
111
- string type = 3;
112
- int32 level = 4;
113
- string currency = 5;
114
- float net_losses = 6;
115
- optional float min = 7;
116
- optional float max = 8;
117
- optional float percentage = 9;
118
- optional string calculated_date = 10;
119
- optional string image = 11;
120
- optional string status = 12;
121
- optional float reward = 13;
114
+ int32 cashback_id = 1;
115
+ string title = 2;
116
+ string type = 3;
117
+ int32 level = 4;
118
+ string currency = 5;
119
+ float net_losses = 6;
120
+
121
+ optional float min = 7;
122
+ optional float max = 8;
123
+ optional float percentage = 9;
124
+
125
+ optional string calculated_date = 10;
126
+ optional string image = 11;
127
+ optional string status = 12;
128
+ optional float reward = 13;
129
+
130
+ optional CashbackActions actions = 14;
131
+
132
+ optional int64 remaining_ms = 15;
133
+ optional float remaining_to_min = 16;
122
134
  }
123
135
  message CashbackUserRequest {
124
136
  int32 user_id = 1;
@@ -21,6 +21,7 @@ var global = (function() {
21
21
  return Function('return this')();
22
22
  }.call(null));
23
23
 
24
+ goog.exportSymbol('proto.cashback.CashbackActions', null, global);
24
25
  goog.exportSymbol('proto.cashback.CashbackConfigItem', null, global);
25
26
  goog.exportSymbol('proto.cashback.CashbackConfigRequest', null, global);
26
27
  goog.exportSymbol('proto.cashback.CashbackItem', null, global);
@@ -399,6 +400,27 @@ if (goog.DEBUG && !COMPILED) {
399
400
  */
400
401
  proto.cashback.CashbackConfigItem.displayName = 'proto.cashback.CashbackConfigItem';
401
402
  }
403
+ /**
404
+ * Generated by JsPbCodeGenerator.
405
+ * @param {Array=} opt_data Optional initial data array, typically from a
406
+ * server response, or constructed directly in Javascript. The array is used
407
+ * in place and becomes part of the constructed object. It is not cloned.
408
+ * If no data is provided, the constructed object will be empty, but still
409
+ * valid.
410
+ * @extends {jspb.Message}
411
+ * @constructor
412
+ */
413
+ proto.cashback.CashbackActions = function(opt_data) {
414
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
415
+ };
416
+ goog.inherits(proto.cashback.CashbackActions, jspb.Message);
417
+ if (goog.DEBUG && !COMPILED) {
418
+ /**
419
+ * @public
420
+ * @override
421
+ */
422
+ proto.cashback.CashbackActions.displayName = 'proto.cashback.CashbackActions';
423
+ }
402
424
  /**
403
425
  * Generated by JsPbCodeGenerator.
404
426
  * @param {Array=} opt_data Optional initial data array, typically from a
@@ -4762,6 +4784,196 @@ proto.cashback.CashbackConfigItem.prototype.hasPercentage = function() {
4762
4784
 
4763
4785
 
4764
4786
 
4787
+ if (jspb.Message.GENERATE_TO_OBJECT) {
4788
+ /**
4789
+ * Creates an object representation of this proto.
4790
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
4791
+ * Optional fields that are not set will be set to undefined.
4792
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
4793
+ * For the list of reserved names please see:
4794
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
4795
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
4796
+ * JSPB instance for transitional soy proto support:
4797
+ * http://goto/soy-param-migration
4798
+ * @return {!Object}
4799
+ */
4800
+ proto.cashback.CashbackActions.prototype.toObject = function(opt_includeInstance) {
4801
+ return proto.cashback.CashbackActions.toObject(opt_includeInstance, this);
4802
+ };
4803
+
4804
+
4805
+ /**
4806
+ * Static version of the {@see toObject} method.
4807
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
4808
+ * the JSPB instance for transitional soy proto support:
4809
+ * http://goto/soy-param-migration
4810
+ * @param {!proto.cashback.CashbackActions} msg The msg instance to transform.
4811
+ * @return {!Object}
4812
+ * @suppress {unusedLocalVariables} f is only used for nested messages
4813
+ */
4814
+ proto.cashback.CashbackActions.toObject = function(includeInstance, msg) {
4815
+ var f, obj = {
4816
+ canClaim: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
4817
+ canReactivate: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),
4818
+ canCalculate: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
4819
+ };
4820
+
4821
+ if (includeInstance) {
4822
+ obj.$jspbMessageInstance = msg;
4823
+ }
4824
+ return obj;
4825
+ };
4826
+ }
4827
+
4828
+
4829
+ /**
4830
+ * Deserializes binary data (in protobuf wire format).
4831
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
4832
+ * @return {!proto.cashback.CashbackActions}
4833
+ */
4834
+ proto.cashback.CashbackActions.deserializeBinary = function(bytes) {
4835
+ var reader = new jspb.BinaryReader(bytes);
4836
+ var msg = new proto.cashback.CashbackActions;
4837
+ return proto.cashback.CashbackActions.deserializeBinaryFromReader(msg, reader);
4838
+ };
4839
+
4840
+
4841
+ /**
4842
+ * Deserializes binary data (in protobuf wire format) from the
4843
+ * given reader into the given message object.
4844
+ * @param {!proto.cashback.CashbackActions} msg The message object to deserialize into.
4845
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
4846
+ * @return {!proto.cashback.CashbackActions}
4847
+ */
4848
+ proto.cashback.CashbackActions.deserializeBinaryFromReader = function(msg, reader) {
4849
+ while (reader.nextField()) {
4850
+ if (reader.isEndGroup()) {
4851
+ break;
4852
+ }
4853
+ var field = reader.getFieldNumber();
4854
+ switch (field) {
4855
+ case 1:
4856
+ var value = /** @type {boolean} */ (reader.readBool());
4857
+ msg.setCanClaim(value);
4858
+ break;
4859
+ case 2:
4860
+ var value = /** @type {boolean} */ (reader.readBool());
4861
+ msg.setCanReactivate(value);
4862
+ break;
4863
+ case 3:
4864
+ var value = /** @type {boolean} */ (reader.readBool());
4865
+ msg.setCanCalculate(value);
4866
+ break;
4867
+ default:
4868
+ reader.skipField();
4869
+ break;
4870
+ }
4871
+ }
4872
+ return msg;
4873
+ };
4874
+
4875
+
4876
+ /**
4877
+ * Serializes the message to binary data (in protobuf wire format).
4878
+ * @return {!Uint8Array}
4879
+ */
4880
+ proto.cashback.CashbackActions.prototype.serializeBinary = function() {
4881
+ var writer = new jspb.BinaryWriter();
4882
+ proto.cashback.CashbackActions.serializeBinaryToWriter(this, writer);
4883
+ return writer.getResultBuffer();
4884
+ };
4885
+
4886
+
4887
+ /**
4888
+ * Serializes the given message to binary data (in protobuf wire
4889
+ * format), writing to the given BinaryWriter.
4890
+ * @param {!proto.cashback.CashbackActions} message
4891
+ * @param {!jspb.BinaryWriter} writer
4892
+ * @suppress {unusedLocalVariables} f is only used for nested messages
4893
+ */
4894
+ proto.cashback.CashbackActions.serializeBinaryToWriter = function(message, writer) {
4895
+ var f = undefined;
4896
+ f = message.getCanClaim();
4897
+ if (f) {
4898
+ writer.writeBool(
4899
+ 1,
4900
+ f
4901
+ );
4902
+ }
4903
+ f = message.getCanReactivate();
4904
+ if (f) {
4905
+ writer.writeBool(
4906
+ 2,
4907
+ f
4908
+ );
4909
+ }
4910
+ f = message.getCanCalculate();
4911
+ if (f) {
4912
+ writer.writeBool(
4913
+ 3,
4914
+ f
4915
+ );
4916
+ }
4917
+ };
4918
+
4919
+
4920
+ /**
4921
+ * optional bool can_claim = 1;
4922
+ * @return {boolean}
4923
+ */
4924
+ proto.cashback.CashbackActions.prototype.getCanClaim = function() {
4925
+ return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
4926
+ };
4927
+
4928
+
4929
+ /**
4930
+ * @param {boolean} value
4931
+ * @return {!proto.cashback.CashbackActions} returns this
4932
+ */
4933
+ proto.cashback.CashbackActions.prototype.setCanClaim = function(value) {
4934
+ return jspb.Message.setProto3BooleanField(this, 1, value);
4935
+ };
4936
+
4937
+
4938
+ /**
4939
+ * optional bool can_reactivate = 2;
4940
+ * @return {boolean}
4941
+ */
4942
+ proto.cashback.CashbackActions.prototype.getCanReactivate = function() {
4943
+ return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
4944
+ };
4945
+
4946
+
4947
+ /**
4948
+ * @param {boolean} value
4949
+ * @return {!proto.cashback.CashbackActions} returns this
4950
+ */
4951
+ proto.cashback.CashbackActions.prototype.setCanReactivate = function(value) {
4952
+ return jspb.Message.setProto3BooleanField(this, 2, value);
4953
+ };
4954
+
4955
+
4956
+ /**
4957
+ * optional bool can_calculate = 3;
4958
+ * @return {boolean}
4959
+ */
4960
+ proto.cashback.CashbackActions.prototype.getCanCalculate = function() {
4961
+ return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
4962
+ };
4963
+
4964
+
4965
+ /**
4966
+ * @param {boolean} value
4967
+ * @return {!proto.cashback.CashbackActions} returns this
4968
+ */
4969
+ proto.cashback.CashbackActions.prototype.setCanCalculate = function(value) {
4970
+ return jspb.Message.setProto3BooleanField(this, 3, value);
4971
+ };
4972
+
4973
+
4974
+
4975
+
4976
+
4765
4977
  if (jspb.Message.GENERATE_TO_OBJECT) {
4766
4978
  /**
4767
4979
  * Creates an object representation of this proto.
@@ -4803,7 +5015,10 @@ proto.cashback.UserCashbackItem.toObject = function(includeInstance, msg) {
4803
5015
  calculatedDate: jspb.Message.getFieldWithDefault(msg, 10, ""),
4804
5016
  image: jspb.Message.getFieldWithDefault(msg, 11, ""),
4805
5017
  status: jspb.Message.getFieldWithDefault(msg, 12, ""),
4806
- reward: jspb.Message.getFloatingPointFieldWithDefault(msg, 13, 0.0)
5018
+ reward: jspb.Message.getFloatingPointFieldWithDefault(msg, 13, 0.0),
5019
+ actions: (f = msg.getActions()) && proto.cashback.CashbackActions.toObject(includeInstance, f),
5020
+ remainingMs: jspb.Message.getFieldWithDefault(msg, 15, 0),
5021
+ remainingToMin: jspb.Message.getFloatingPointFieldWithDefault(msg, 16, 0.0)
4807
5022
  };
4808
5023
 
4809
5024
  if (includeInstance) {
@@ -4892,6 +5107,19 @@ proto.cashback.UserCashbackItem.deserializeBinaryFromReader = function(msg, read
4892
5107
  var value = /** @type {number} */ (reader.readFloat());
4893
5108
  msg.setReward(value);
4894
5109
  break;
5110
+ case 14:
5111
+ var value = new proto.cashback.CashbackActions;
5112
+ reader.readMessage(value,proto.cashback.CashbackActions.deserializeBinaryFromReader);
5113
+ msg.setActions(value);
5114
+ break;
5115
+ case 15:
5116
+ var value = /** @type {number} */ (reader.readInt64());
5117
+ msg.setRemainingMs(value);
5118
+ break;
5119
+ case 16:
5120
+ var value = /** @type {number} */ (reader.readFloat());
5121
+ msg.setRemainingToMin(value);
5122
+ break;
4895
5123
  default:
4896
5124
  reader.skipField();
4897
5125
  break;
@@ -5012,6 +5240,28 @@ proto.cashback.UserCashbackItem.serializeBinaryToWriter = function(message, writ
5012
5240
  f
5013
5241
  );
5014
5242
  }
5243
+ f = message.getActions();
5244
+ if (f != null) {
5245
+ writer.writeMessage(
5246
+ 14,
5247
+ f,
5248
+ proto.cashback.CashbackActions.serializeBinaryToWriter
5249
+ );
5250
+ }
5251
+ f = /** @type {number} */ (jspb.Message.getField(message, 15));
5252
+ if (f != null) {
5253
+ writer.writeInt64(
5254
+ 15,
5255
+ f
5256
+ );
5257
+ }
5258
+ f = /** @type {number} */ (jspb.Message.getField(message, 16));
5259
+ if (f != null) {
5260
+ writer.writeFloat(
5261
+ 16,
5262
+ f
5263
+ );
5264
+ }
5015
5265
  };
5016
5266
 
5017
5267
 
@@ -5375,6 +5625,115 @@ proto.cashback.UserCashbackItem.prototype.hasReward = function() {
5375
5625
  };
5376
5626
 
5377
5627
 
5628
+ /**
5629
+ * optional CashbackActions actions = 14;
5630
+ * @return {?proto.cashback.CashbackActions}
5631
+ */
5632
+ proto.cashback.UserCashbackItem.prototype.getActions = function() {
5633
+ return /** @type{?proto.cashback.CashbackActions} */ (
5634
+ jspb.Message.getWrapperField(this, proto.cashback.CashbackActions, 14));
5635
+ };
5636
+
5637
+
5638
+ /**
5639
+ * @param {?proto.cashback.CashbackActions|undefined} value
5640
+ * @return {!proto.cashback.UserCashbackItem} returns this
5641
+ */
5642
+ proto.cashback.UserCashbackItem.prototype.setActions = function(value) {
5643
+ return jspb.Message.setWrapperField(this, 14, value);
5644
+ };
5645
+
5646
+
5647
+ /**
5648
+ * Clears the message field making it undefined.
5649
+ * @return {!proto.cashback.UserCashbackItem} returns this
5650
+ */
5651
+ proto.cashback.UserCashbackItem.prototype.clearActions = function() {
5652
+ return this.setActions(undefined);
5653
+ };
5654
+
5655
+
5656
+ /**
5657
+ * Returns whether this field is set.
5658
+ * @return {boolean}
5659
+ */
5660
+ proto.cashback.UserCashbackItem.prototype.hasActions = function() {
5661
+ return jspb.Message.getField(this, 14) != null;
5662
+ };
5663
+
5664
+
5665
+ /**
5666
+ * optional int64 remaining_ms = 15;
5667
+ * @return {number}
5668
+ */
5669
+ proto.cashback.UserCashbackItem.prototype.getRemainingMs = function() {
5670
+ return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 15, 0));
5671
+ };
5672
+
5673
+
5674
+ /**
5675
+ * @param {number} value
5676
+ * @return {!proto.cashback.UserCashbackItem} returns this
5677
+ */
5678
+ proto.cashback.UserCashbackItem.prototype.setRemainingMs = function(value) {
5679
+ return jspb.Message.setField(this, 15, value);
5680
+ };
5681
+
5682
+
5683
+ /**
5684
+ * Clears the field making it undefined.
5685
+ * @return {!proto.cashback.UserCashbackItem} returns this
5686
+ */
5687
+ proto.cashback.UserCashbackItem.prototype.clearRemainingMs = function() {
5688
+ return jspb.Message.setField(this, 15, undefined);
5689
+ };
5690
+
5691
+
5692
+ /**
5693
+ * Returns whether this field is set.
5694
+ * @return {boolean}
5695
+ */
5696
+ proto.cashback.UserCashbackItem.prototype.hasRemainingMs = function() {
5697
+ return jspb.Message.getField(this, 15) != null;
5698
+ };
5699
+
5700
+
5701
+ /**
5702
+ * optional float remaining_to_min = 16;
5703
+ * @return {number}
5704
+ */
5705
+ proto.cashback.UserCashbackItem.prototype.getRemainingToMin = function() {
5706
+ return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 16, 0.0));
5707
+ };
5708
+
5709
+
5710
+ /**
5711
+ * @param {number} value
5712
+ * @return {!proto.cashback.UserCashbackItem} returns this
5713
+ */
5714
+ proto.cashback.UserCashbackItem.prototype.setRemainingToMin = function(value) {
5715
+ return jspb.Message.setField(this, 16, value);
5716
+ };
5717
+
5718
+
5719
+ /**
5720
+ * Clears the field making it undefined.
5721
+ * @return {!proto.cashback.UserCashbackItem} returns this
5722
+ */
5723
+ proto.cashback.UserCashbackItem.prototype.clearRemainingToMin = function() {
5724
+ return jspb.Message.setField(this, 16, undefined);
5725
+ };
5726
+
5727
+
5728
+ /**
5729
+ * Returns whether this field is set.
5730
+ * @return {boolean}
5731
+ */
5732
+ proto.cashback.UserCashbackItem.prototype.hasRemainingToMin = function() {
5733
+ return jspb.Message.getField(this, 16) != null;
5734
+ };
5735
+
5736
+
5378
5737
 
5379
5738
 
5380
5739
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protobuf-platform",
3
- "version": "1.2.190",
3
+ "version": "1.2.191",
4
4
  "description": "Protobuf structures",
5
5
  "main": "index.js",
6
6
  "scripts": {