protobuf-platform 1.2.692 → 1.2.694

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protobuf-platform",
3
- "version": "1.2.692",
3
+ "version": "1.2.694",
4
4
  "description": "Protobuf structures",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ const assert = require('node:assert/strict');
4
+ const vm = require('node:vm');
5
+ const { execFileSync } = require('node:child_process');
6
+ const { createRequire } = require('node:module');
7
+ const path = require('node:path');
8
+ const current = require('../user/user_pb');
9
+ const filename = path.resolve(__dirname, '../user/user_pb.js');
10
+ const baseline = execFileSync('git', ['show', 'ca23b58:user/user_pb.js'], {
11
+ cwd: path.resolve(__dirname, '..'), encoding: 'utf8', maxBuffer: 16 * 1024 * 1024,
12
+ });
13
+ const before = { exports: {} };
14
+ vm.runInNewContext(baseline, {
15
+ module: before, exports: before.exports, require: createRequire(filename),
16
+ }, { filename: 'baseline-user_pb.js' });
17
+ const previous = before.exports;
18
+ const legacy = (bindings) => {
19
+ const value = new bindings.PrecisionRgBinding();
20
+ const fields = { UserId: '7001', CommandKey: 'fixture-command', RequestFingerprint: 'a'.repeat(64),
21
+ PrecisionSessionId: '9007199254740993', PreparationGeneration: '1',
22
+ PreparationFingerprint: 'b'.repeat(64), AccountingCurrency: 'EUR', AccountingScale: 2,
23
+ RequestedDebitMinor: '123', GameSessionId: 'fixture-session',
24
+ ProviderTransactionId: 'fixture-provider-transaction', RoundId: 'fixture-round' };
25
+ for (const [field, item] of Object.entries(fields)) value[`set${field}`](item);
26
+ return value;
27
+ };
28
+ const oldBinding = legacy(previous);
29
+ const binding = legacy(current);
30
+ assert.deepEqual(Buffer.from(binding.serializeBinary()), Buffer.from(oldBinding.serializeBinary()));
31
+ const tuple = ['FinancialAdmissionProtocolVersion', 'WalletReference', 'OwnershipEpoch', 'AdmissionVersion'];
32
+ for (const field of tuple) assert.equal(binding[`has${field}`](), false);
33
+ const readLegacy = current.PrecisionRgBinding.deserializeBinary(oldBinding.serializeBinary());
34
+ for (const field of tuple) assert.equal(readLegacy[`has${field}`](), false);
35
+ binding.setFinancialAdmissionProtocolVersion(1);
36
+ binding.setWalletReference('fixture-payment-wallet');
37
+ binding.setOwnershipEpoch('fixture-payment-epoch');
38
+ binding.setAdmissionVersion('18446744073709551615');
39
+ const decoded = current.PrecisionRgBinding.deserializeBinary(binding.serializeBinary());
40
+ assert.equal(decoded.getFinancialAdmissionProtocolVersion(), 1);
41
+ assert.equal(decoded.getWalletReference(), 'fixture-payment-wallet');
42
+ assert.equal(decoded.getOwnershipEpoch(), 'fixture-payment-epoch');
43
+ assert.equal(decoded.getAdmissionVersion(), '18446744073709551615');
44
+ const oldReader = previous.PrecisionRgBinding.deserializeBinary(binding.serializeBinary());
45
+ assert.deepEqual(Buffer.from(oldReader.serializeBinary()), Buffer.from(oldBinding.serializeBinary()));
46
+ const request = new current.PrecisionRgAdmissionRequest();
47
+ request.setBinding(binding);
48
+ request.setAction(current.PrecisionRgAction.PRECISION_RG_RESERVE);
49
+ const oldRequest = previous.PrecisionRgAdmissionRequest.deserializeBinary(request.serializeBinary());
50
+ assert.equal(oldRequest.getBinding().getPreparationFingerprint(), 'b'.repeat(64));
51
+ const response = new current.PrecisionRgAdmissionResponse();
52
+ response.setBinding(binding);
53
+ assert.equal(current.PrecisionRgAdmissionResponse.deserializeBinary(response.serializeBinary())
54
+ .getBinding().getAdmissionVersion(), '18446744073709551615');
55
+ for (const field of tuple) binding[`clear${field}`]();
56
+ assert.deepEqual(Buffer.from(binding.serializeBinary()), Buffer.from(oldBinding.serializeBinary()));
57
+ console.log('PASS additive delegated RG contract: fields 1-12 byte-compatible, old/new readers, optional presence/clear, nested roundtrip and exact sequence above MAX_SAFE_INTEGER; old readers cannot authorize enrollment');
package/user/user.proto CHANGED
@@ -2659,6 +2659,11 @@ message PrecisionRgBinding {
2659
2659
  string game_session_id = 10;
2660
2660
  string provider_transaction_id = 11;
2661
2661
  string round_id = 12;
2662
+ // Opt-in delegated admission. All four fields are required together in mode 1.
2663
+ optional uint32 financial_admission_protocol_version = 13;
2664
+ optional string wallet_reference = 14;
2665
+ optional string ownership_epoch = 15;
2666
+ optional string admission_version = 16;
2662
2667
  }
2663
2668
  message PrecisionRgAdmissionRequest {
2664
2669
  PrecisionRgAction action = 1;
package/user/user_pb.js CHANGED
@@ -106378,7 +106378,11 @@ proto.user.PrecisionRgBinding.toObject = function(includeInstance, msg) {
106378
106378
  requestedDebitMinor: jspb.Message.getFieldWithDefault(msg, 9, ""),
106379
106379
  gameSessionId: jspb.Message.getFieldWithDefault(msg, 10, ""),
106380
106380
  providerTransactionId: jspb.Message.getFieldWithDefault(msg, 11, ""),
106381
- roundId: jspb.Message.getFieldWithDefault(msg, 12, "")
106381
+ roundId: jspb.Message.getFieldWithDefault(msg, 12, ""),
106382
+ financialAdmissionProtocolVersion: jspb.Message.getFieldWithDefault(msg, 13, 0),
106383
+ walletReference: jspb.Message.getFieldWithDefault(msg, 14, ""),
106384
+ ownershipEpoch: jspb.Message.getFieldWithDefault(msg, 15, ""),
106385
+ admissionVersion: jspb.Message.getFieldWithDefault(msg, 16, "")
106382
106386
  };
106383
106387
 
106384
106388
  if (includeInstance) {
@@ -106463,6 +106467,22 @@ proto.user.PrecisionRgBinding.deserializeBinaryFromReader = function(msg, reader
106463
106467
  var value = /** @type {string} */ (reader.readString());
106464
106468
  msg.setRoundId(value);
106465
106469
  break;
106470
+ case 13:
106471
+ var value = /** @type {number} */ (reader.readUint32());
106472
+ msg.setFinancialAdmissionProtocolVersion(value);
106473
+ break;
106474
+ case 14:
106475
+ var value = /** @type {string} */ (reader.readString());
106476
+ msg.setWalletReference(value);
106477
+ break;
106478
+ case 15:
106479
+ var value = /** @type {string} */ (reader.readString());
106480
+ msg.setOwnershipEpoch(value);
106481
+ break;
106482
+ case 16:
106483
+ var value = /** @type {string} */ (reader.readString());
106484
+ msg.setAdmissionVersion(value);
106485
+ break;
106466
106486
  default:
106467
106487
  reader.skipField();
106468
106488
  break;
@@ -106576,6 +106596,34 @@ proto.user.PrecisionRgBinding.serializeBinaryToWriter = function(message, writer
106576
106596
  f
106577
106597
  );
106578
106598
  }
106599
+ f = /** @type {number} */ (jspb.Message.getField(message, 13));
106600
+ if (f != null) {
106601
+ writer.writeUint32(
106602
+ 13,
106603
+ f
106604
+ );
106605
+ }
106606
+ f = /** @type {string} */ (jspb.Message.getField(message, 14));
106607
+ if (f != null) {
106608
+ writer.writeString(
106609
+ 14,
106610
+ f
106611
+ );
106612
+ }
106613
+ f = /** @type {string} */ (jspb.Message.getField(message, 15));
106614
+ if (f != null) {
106615
+ writer.writeString(
106616
+ 15,
106617
+ f
106618
+ );
106619
+ }
106620
+ f = /** @type {string} */ (jspb.Message.getField(message, 16));
106621
+ if (f != null) {
106622
+ writer.writeString(
106623
+ 16,
106624
+ f
106625
+ );
106626
+ }
106579
106627
  };
106580
106628
 
106581
106629
 
@@ -106795,6 +106843,150 @@ proto.user.PrecisionRgBinding.prototype.setRoundId = function(value) {
106795
106843
  };
106796
106844
 
106797
106845
 
106846
+ /**
106847
+ * optional uint32 financial_admission_protocol_version = 13;
106848
+ * @return {number}
106849
+ */
106850
+ proto.user.PrecisionRgBinding.prototype.getFinancialAdmissionProtocolVersion = function() {
106851
+ return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0));
106852
+ };
106853
+
106854
+
106855
+ /**
106856
+ * @param {number} value
106857
+ * @return {!proto.user.PrecisionRgBinding} returns this
106858
+ */
106859
+ proto.user.PrecisionRgBinding.prototype.setFinancialAdmissionProtocolVersion = function(value) {
106860
+ return jspb.Message.setField(this, 13, value);
106861
+ };
106862
+
106863
+
106864
+ /**
106865
+ * Clears the field making it undefined.
106866
+ * @return {!proto.user.PrecisionRgBinding} returns this
106867
+ */
106868
+ proto.user.PrecisionRgBinding.prototype.clearFinancialAdmissionProtocolVersion = function() {
106869
+ return jspb.Message.setField(this, 13, undefined);
106870
+ };
106871
+
106872
+
106873
+ /**
106874
+ * Returns whether this field is set.
106875
+ * @return {boolean}
106876
+ */
106877
+ proto.user.PrecisionRgBinding.prototype.hasFinancialAdmissionProtocolVersion = function() {
106878
+ return jspb.Message.getField(this, 13) != null;
106879
+ };
106880
+
106881
+
106882
+ /**
106883
+ * optional string wallet_reference = 14;
106884
+ * @return {string}
106885
+ */
106886
+ proto.user.PrecisionRgBinding.prototype.getWalletReference = function() {
106887
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 14, ""));
106888
+ };
106889
+
106890
+
106891
+ /**
106892
+ * @param {string} value
106893
+ * @return {!proto.user.PrecisionRgBinding} returns this
106894
+ */
106895
+ proto.user.PrecisionRgBinding.prototype.setWalletReference = function(value) {
106896
+ return jspb.Message.setField(this, 14, value);
106897
+ };
106898
+
106899
+
106900
+ /**
106901
+ * Clears the field making it undefined.
106902
+ * @return {!proto.user.PrecisionRgBinding} returns this
106903
+ */
106904
+ proto.user.PrecisionRgBinding.prototype.clearWalletReference = function() {
106905
+ return jspb.Message.setField(this, 14, undefined);
106906
+ };
106907
+
106908
+
106909
+ /**
106910
+ * Returns whether this field is set.
106911
+ * @return {boolean}
106912
+ */
106913
+ proto.user.PrecisionRgBinding.prototype.hasWalletReference = function() {
106914
+ return jspb.Message.getField(this, 14) != null;
106915
+ };
106916
+
106917
+
106918
+ /**
106919
+ * optional string ownership_epoch = 15;
106920
+ * @return {string}
106921
+ */
106922
+ proto.user.PrecisionRgBinding.prototype.getOwnershipEpoch = function() {
106923
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, ""));
106924
+ };
106925
+
106926
+
106927
+ /**
106928
+ * @param {string} value
106929
+ * @return {!proto.user.PrecisionRgBinding} returns this
106930
+ */
106931
+ proto.user.PrecisionRgBinding.prototype.setOwnershipEpoch = function(value) {
106932
+ return jspb.Message.setField(this, 15, value);
106933
+ };
106934
+
106935
+
106936
+ /**
106937
+ * Clears the field making it undefined.
106938
+ * @return {!proto.user.PrecisionRgBinding} returns this
106939
+ */
106940
+ proto.user.PrecisionRgBinding.prototype.clearOwnershipEpoch = function() {
106941
+ return jspb.Message.setField(this, 15, undefined);
106942
+ };
106943
+
106944
+
106945
+ /**
106946
+ * Returns whether this field is set.
106947
+ * @return {boolean}
106948
+ */
106949
+ proto.user.PrecisionRgBinding.prototype.hasOwnershipEpoch = function() {
106950
+ return jspb.Message.getField(this, 15) != null;
106951
+ };
106952
+
106953
+
106954
+ /**
106955
+ * optional string admission_version = 16;
106956
+ * @return {string}
106957
+ */
106958
+ proto.user.PrecisionRgBinding.prototype.getAdmissionVersion = function() {
106959
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 16, ""));
106960
+ };
106961
+
106962
+
106963
+ /**
106964
+ * @param {string} value
106965
+ * @return {!proto.user.PrecisionRgBinding} returns this
106966
+ */
106967
+ proto.user.PrecisionRgBinding.prototype.setAdmissionVersion = function(value) {
106968
+ return jspb.Message.setField(this, 16, value);
106969
+ };
106970
+
106971
+
106972
+ /**
106973
+ * Clears the field making it undefined.
106974
+ * @return {!proto.user.PrecisionRgBinding} returns this
106975
+ */
106976
+ proto.user.PrecisionRgBinding.prototype.clearAdmissionVersion = function() {
106977
+ return jspb.Message.setField(this, 16, undefined);
106978
+ };
106979
+
106980
+
106981
+ /**
106982
+ * Returns whether this field is set.
106983
+ * @return {boolean}
106984
+ */
106985
+ proto.user.PrecisionRgBinding.prototype.hasAdmissionVersion = function() {
106986
+ return jspb.Message.getField(this, 16) != null;
106987
+ };
106988
+
106989
+
106798
106990
 
106799
106991
 
106800
106992