protobuf-platform 1.2.724 → 1.2.726

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.
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+ const assert = require('node:assert/strict');
3
+ const P = require('..');
4
+ const M = P.payment.messages;
5
+ const scope = new M.GameplayProviderScope();
6
+ scope.setNamespace('fixture'); scope.setProvider('engineio');
7
+ scope.setOperatorId('fixture-operator'); scope.setIntegrationGeneration('staging-1');
8
+ const fence = new M.FenceGameplayProviderTransactionsRequest();
9
+ fence.setProtocolVersion(1); fence.setScope(scope); fence.setRoundId('18446744073709551615');
10
+ fence.setTransactionRefsList(['ref-1', 'ref-2', 'ref-1']); fence.setCloseRound(true);
11
+ const back = M.FenceGameplayProviderTransactionsRequest.deserializeBinary(fence.serializeBinary());
12
+ assert.deepEqual(back.toObject(), fence.toObject());
13
+ assert.equal(back.getRoundId(), '18446744073709551615');
14
+ const orphan = new M.GameplayProviderIdentityResult();
15
+ orphan.setProtocolVersion(1); orphan.setIdentityKind(M.GameplayProviderIdentityKind.GAMEPLAY_PROVIDER_TRANSACTION);
16
+ orphan.setExternalId('ref-1'); orphan.setState(M.GameplayProviderIdentityState.GAMEPLAY_PROVIDER_FENCED);
17
+ orphan.setFenceId('stable-fence');
18
+ const orphanBack = M.GameplayProviderIdentityResult.deserializeBinary(orphan.serializeBinary());
19
+ assert.equal(orphanBack.hasBinding(), false);
20
+ assert.equal(orphanBack.getFenceId(), 'stable-fence');
21
+ const binding = new M.GameplayProviderBinding();
22
+ binding.setUserId('9007199254740993'); binding.setAccountingCurrency('EUR'); binding.setSessionId('session');
23
+ binding.setRoundId('18446744073709551615'); binding.setOriginalAction('debit');
24
+ binding.setDecisionId('decision'); binding.setJournalKey('journal');
25
+ orphan.setBinding(binding); orphan.setState(M.GameplayProviderIdentityState.GAMEPLAY_PROVIDER_BOUND);
26
+ assert.deepEqual(M.GameplayProviderIdentityResult.deserializeBinary(orphan.serializeBinary()).toObject(), orphan.toObject());
27
+ const settlement = new M.SettleGameplayRequest();
28
+ settlement.setProtocolVersion(1); settlement.setNamespace('fixture'); settlement.setRequestId('request');
29
+ settlement.setCommandJson('{"amount":"9007199254740993"}'); settlement.setSourceJson('{}');
30
+ settlement.setCandidateJson('{}'); settlement.setRgEvidenceJson('{}'); settlement.setAttemptId('attempt');
31
+ const wrapper = new M.SettleGuardedGameplayRequest();
32
+ wrapper.setProtocolVersion(1); wrapper.setSettlement(settlement); wrapper.setScope(scope);
33
+ wrapper.setRoundId('18446744073709551615'); wrapper.setCloseRound(true);
34
+ for (const action of ['debit', 'credit']) { const claim = new M.GameplayProviderLegClaim(); claim.setExternalId(action+'-id'); claim.setAction(action); wrapper.addClaims(claim); }
35
+ wrapper.setReversalRefsList(['original']);
36
+ assert.deepEqual(M.SettleGuardedGameplayRequest.deserializeBinary(wrapper.serializeBinary()).toObject(), wrapper.toObject());
37
+ for(const name of ['readGameplayProviderIdentity','fenceGameplayProviderTransactions','settleGuardedGameplay','settleGameplay','readGameplaySettlementFact'])
38
+ assert.equal(typeof P.payment.service.PaymentClient.prototype[name], 'function');
39
+ assert.equal(M.GameplayProviderIdentityState.GAMEPLAY_PROVIDER_STATE_UNSPECIFIED, 0);
40
+ assert.equal(M.GameplayProviderIdentityKind.GAMEPLAY_PROVIDER_IDENTITY_UNSPECIFIED, 0);
41
+ console.log('PASS: additive provider guard RPCs, ownerless fences, ordered refs and exact string identity roundtrips');
42
+ // Release baseline: every pre-existing declaration and RPC must remain byte-semantically unchanged.
43
+ const fs = require('node:fs');
44
+ const { execFileSync } = require('node:child_process');
45
+ const normalize = (text) => text.replace(/\/\/[^\n]*/g, '').replace(/\s+/g, ' ').trim();
46
+ const previous = execFileSync('git', ['show', 'bd0f644a2b6456e44b5631bfe6b20d112815e688:payment/payment.proto'], {encoding:'utf8'});
47
+ const current = fs.readFileSync(require('node:path').join(__dirname, '../payment/payment.proto'), 'utf8');
48
+ function declarations(source) {
49
+ const entries = new Map();
50
+ for (const match of source.matchAll(/\b(message|enum)\s+(\w+)\s*\{/g)) {
51
+ let depth=1, end=match.index+match[0].length, start=end;
52
+ while(depth) { const ch=source[end++]; assert(ch); if(ch==='{')depth++; if(ch==='}')depth--; }
53
+ entries.set(match[2],normalize(source.slice(start,end-1)));
54
+ }
55
+ return entries;
56
+ }
57
+ const before=declarations(previous), after=declarations(current);
58
+ for(const [name, body] of before) assert.equal(after.get(name),body,name);
59
+ const methods=new Set([...current.matchAll(/rpc\s+\w+\s*\([^;]+;/g)].map(m=>normalize(m[0])));
60
+ for(const method of previous.matchAll(/rpc\s+\w+\s*\([^;]+;/g))assert(methods.has(normalize(method[0])));
61
+ console.log(`PASS: ${before.size} pre-existing Payment declarations and every old RPC preserved against release baseline`);