protobuf-platform 1.2.758 → 1.2.759
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/game/game.proto +35 -0
- package/game/game_grpc_pb.js +34 -0
- package/game/game_pb.js +1331 -0
- package/package.json +1 -1
- package/scripts/verify-historical-casino-identity-contract.js +27 -0
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const assert = require('node:assert/strict');
|
|
3
|
+
const { game, gRPC: grpc } = require('..');
|
|
4
|
+
const M = game.messages;
|
|
5
|
+
async function main() {
|
|
6
|
+
const identity = new M.HistoricalCasinoIdentity();
|
|
7
|
+
for (const [k,v] of Object.entries({SourceActionId:'9007199254740993',UserId:'7',Action:'bet',TransactionId:'tx',SessionId:'session',RoundId:'round',GameUuid:'uuid',Currency:'USD'})) identity['set'+k](v);
|
|
8
|
+
const req = new M.HistoricalCasinoIdentityRequest();
|
|
9
|
+
req.setCustomer('fixture'); req.setEnvironment('localhost'); req.addIdentities(identity);
|
|
10
|
+
assert.deepEqual(M.HistoricalCasinoIdentityRequest.deserializeBinary(req.serializeBinary()).toObject(), req.toObject());
|
|
11
|
+
const result = new M.HistoricalCasinoIdentityResult();
|
|
12
|
+
result.setIdentity(identity); result.setPrIntId('42'); result.setSlugAbsenceProven(true); result.setCurrencyScale(0); result.setSourceService('game'); result.setProvenance('game_legacy_ordering_v1'); result.setEvidenceSha256('a'.repeat(64));
|
|
13
|
+
const decoded = M.HistoricalCasinoIdentityResult.deserializeBinary(result.serializeBinary());
|
|
14
|
+
assert.equal(decoded.hasPrSlug(),false); assert.equal(decoded.hasCurrencyScale(),true); assert.equal(decoded.getCurrencyScale(),0); assert.equal(decoded.getSlugAbsenceProven(),true);
|
|
15
|
+
result.setPrSlug(''); assert.equal(M.HistoricalCasinoIdentityResult.deserializeBinary(result.serializeBinary()).hasPrSlug(),true);
|
|
16
|
+
const server = new grpc.Server();
|
|
17
|
+
server.addService(game.service.GameService,{getHistoricalCasinoIdentityEvidence:(call,cb)=>{
|
|
18
|
+
assert.deepEqual(call.request.toObject(),req.toObject());
|
|
19
|
+
const response = new M.HistoricalCasinoIdentityResponse(); response.setCustomer('fixture'); response.setEnvironment('localhost'); response.addResults(result); cb(null,response);
|
|
20
|
+
}});
|
|
21
|
+
const port = await new Promise((res,rej)=>server.bindAsync('127.0.0.1:0',grpc.ServerCredentials.createInsecure(),(e,p)=>e?rej(e):res(p)));
|
|
22
|
+
const client = new game.service.GameClient('127.0.0.1:'+port,grpc.credentials.createInsecure());
|
|
23
|
+
try { const response=await new Promise((res,rej)=>client.getHistoricalCasinoIdentityEvidence(req,{deadline:Date.now()+3000},(e,v)=>e?rej(e):res(v))); assert.deepEqual(response.getResultsList()[0].toObject(),result.toObject()); }
|
|
24
|
+
finally {client.close();await new Promise(r=>server.tryShutdown(r));}
|
|
25
|
+
console.log('PASS historical Casino identity wire + real gRPC');
|
|
26
|
+
}
|
|
27
|
+
main().catch(e=>{console.error(e);process.exitCode=1;});
|