@google-cloud/agones-sdk 1.40.0 → 1.41.0-dev
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/lib/alpha/alpha_grpc_pb.js +0 -175
- package/lib/alpha/alpha_pb.js +0 -1811
- package/lib/beta/beta_grpc_pb.js +217 -0
- package/lib/beta/beta_pb.js +1971 -0
- package/lib/beta/google/api/annotations_pb.js +63 -0
- package/lib/beta/google/api/http_pb.js +1021 -0
- package/lib/beta/protoc-gen-openapiv2/options/annotations_pb.js +167 -0
- package/lib/beta/protoc-gen-openapiv2/options/openapiv2_pb.js +5618 -0
- package/package.json +4 -4
- package/spec/betaAgonesSDK.spec.js +419 -0
- package/src/agonesSDK.js +2 -0
- package/src/alpha.js +3 -3
- package/src/beta.d.ts +43 -0
- package/src/beta.js +248 -0
- /package/lib/{alpha → beta}/google/api/client_pb.js +0 -0
- /package/lib/{alpha → beta}/google/api/field_behavior_pb.js +0 -0
- /package/lib/{alpha → beta}/google/api/launch_stage_pb.js +0 -0
- /package/lib/{alpha → beta}/google/api/resource_pb.js +0 -0
package/package.json
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
"url": "https://github.com/googleforgames/agones/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@grpc/grpc-js": "1.7
|
|
7
|
+
"@grpc/grpc-js": "1.10.7",
|
|
8
8
|
"google-protobuf": "3.21.2"
|
|
9
9
|
},
|
|
10
10
|
"description": "Game Server SDK for Agones, the open source project for hosting dedicated game servers on Kubernetes",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"eslint": "^8.
|
|
13
|
-
"jasmine": "^
|
|
12
|
+
"eslint": "^8.57.0",
|
|
13
|
+
"jasmine": "^5.1.0",
|
|
14
14
|
"nyc": "^15.1.0"
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://agones.dev",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"version": "1.
|
|
29
|
+
"version": "1.41.0-dev"
|
|
30
30
|
}
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
// Copyright 2020 Google LLC All Rights Reserved.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
const grpc = require('@grpc/grpc-js');
|
|
16
|
+
|
|
17
|
+
const messages = require('../lib/beta/beta_pb');
|
|
18
|
+
const Beta = require('../src/beta');
|
|
19
|
+
|
|
20
|
+
describe('Beta', () => {
|
|
21
|
+
let beta;
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
const address = 'localhost:9357';
|
|
25
|
+
const credentials = grpc.credentials.createInsecure();
|
|
26
|
+
beta = new Beta(address, credentials);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('getCounterCount', () => {
|
|
30
|
+
it('calls the server and handles the response', async () => {
|
|
31
|
+
spyOn(beta.client, 'getCounter').and.callFake((request, callback) => {
|
|
32
|
+
let counter = new messages.Counter();
|
|
33
|
+
counter.setCount(10);
|
|
34
|
+
callback(undefined, counter);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
let count = await beta.getCounterCount('key');
|
|
38
|
+
expect(beta.client.getCounter).toHaveBeenCalled();
|
|
39
|
+
expect(count).toEqual(10);
|
|
40
|
+
let request = beta.client.getCounter.calls.argsFor(0)[0];
|
|
41
|
+
expect(request.getName()).toEqual('key');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('calls the server and handles failure', async () => {
|
|
45
|
+
spyOn(beta.client, 'getCounter').and.callFake((request, callback) => {
|
|
46
|
+
callback('error', undefined);
|
|
47
|
+
});
|
|
48
|
+
try {
|
|
49
|
+
await beta.getCounterCount('key');
|
|
50
|
+
fail();
|
|
51
|
+
} catch (error) {
|
|
52
|
+
expect(beta.client.getCounter).toHaveBeenCalled();
|
|
53
|
+
expect(error).toEqual('error');
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('incrementCounter', () => {
|
|
59
|
+
it('calls the server and handles the response while under capacity', async () => {
|
|
60
|
+
spyOn(beta.client, 'updateCounter').and.callFake((request, callback) => {
|
|
61
|
+
let counter = new messages.Counter();
|
|
62
|
+
callback(undefined, counter);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
let response = await beta.incrementCounter('key', 5);
|
|
66
|
+
expect(beta.client.updateCounter).toHaveBeenCalled();
|
|
67
|
+
expect(response).toEqual(undefined);
|
|
68
|
+
let request = beta.client.updateCounter.calls.argsFor(0)[0];
|
|
69
|
+
expect(request.getCounterupdaterequest().getName()).toEqual('key');
|
|
70
|
+
expect(request.getCounterupdaterequest().getCountdiff()).toEqual(5);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('calls the server and handles failure', async () => {
|
|
74
|
+
spyOn(beta.client, 'updateCounter').and.callFake((request, callback) => {
|
|
75
|
+
callback('error', undefined);
|
|
76
|
+
});
|
|
77
|
+
try {
|
|
78
|
+
await beta.incrementCounter('key', 5);
|
|
79
|
+
fail();
|
|
80
|
+
} catch (error) {
|
|
81
|
+
expect(beta.client.updateCounter).toHaveBeenCalled();
|
|
82
|
+
expect(error).toEqual('error');
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('decrementCounter', () => {
|
|
88
|
+
it('calls the server and handles the response', async () => {
|
|
89
|
+
spyOn(beta.client, 'updateCounter').and.callFake((request, callback) => {
|
|
90
|
+
let counter = new messages.Counter();
|
|
91
|
+
callback(undefined, counter);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
let response = await beta.decrementCounter('key', 5);
|
|
95
|
+
expect(beta.client.updateCounter).toHaveBeenCalled();
|
|
96
|
+
expect(response).toEqual(undefined);
|
|
97
|
+
let request = beta.client.updateCounter.calls.argsFor(0)[0];
|
|
98
|
+
expect(request.getCounterupdaterequest().getName()).toEqual('key');
|
|
99
|
+
expect(request.getCounterupdaterequest().getCountdiff()).toEqual(-5);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('calls the server and handles failure', async () => {
|
|
103
|
+
spyOn(beta.client, 'updateCounter').and.callFake((request, callback) => {
|
|
104
|
+
callback('error', undefined);
|
|
105
|
+
});
|
|
106
|
+
try {
|
|
107
|
+
await beta.decrementCounter('key', 5);
|
|
108
|
+
fail();
|
|
109
|
+
} catch (error) {
|
|
110
|
+
expect(beta.client.updateCounter).toHaveBeenCalled();
|
|
111
|
+
expect(error).toEqual('error');
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('setCounterCount', () => {
|
|
117
|
+
it('calls the server and handles the response', async () => {
|
|
118
|
+
spyOn(beta.client, 'updateCounter').and.callFake((request, callback) => {
|
|
119
|
+
let counter = new messages.Counter();
|
|
120
|
+
callback(undefined, counter);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
let response = await beta.setCounterCount('key', 5);
|
|
124
|
+
expect(beta.client.updateCounter).toHaveBeenCalled();
|
|
125
|
+
expect(response).toEqual(undefined);
|
|
126
|
+
let request = beta.client.updateCounter.calls.argsFor(0)[0];
|
|
127
|
+
expect(request.getCounterupdaterequest().getName()).toEqual('key');
|
|
128
|
+
expect(request.getCounterupdaterequest().getCount().getValue()).toEqual(5);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('calls the server and handles failure', async () => {
|
|
132
|
+
spyOn(beta.client, 'updateCounter').and.callFake((request, callback) => {
|
|
133
|
+
callback('error', undefined);
|
|
134
|
+
});
|
|
135
|
+
try {
|
|
136
|
+
await beta.setCounterCount('key', 5);
|
|
137
|
+
fail();
|
|
138
|
+
} catch (error) {
|
|
139
|
+
expect(beta.client.updateCounter).toHaveBeenCalled();
|
|
140
|
+
expect(error).toEqual('error');
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe('getCounterCapacity', () => {
|
|
146
|
+
it('calls the server and handles the response', async () => {
|
|
147
|
+
spyOn(beta.client, 'getCounter').and.callFake((request, callback) => {
|
|
148
|
+
let counter = new messages.Counter();
|
|
149
|
+
counter.setCapacity(10);
|
|
150
|
+
callback(undefined, counter);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
let capacity = await beta.getCounterCapacity('key');
|
|
154
|
+
expect(beta.client.getCounter).toHaveBeenCalled();
|
|
155
|
+
expect(capacity).toEqual(10);
|
|
156
|
+
let request = beta.client.getCounter.calls.argsFor(0)[0];
|
|
157
|
+
expect(request.getName()).toEqual('key');
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('calls the server and handles failure', async () => {
|
|
161
|
+
spyOn(beta.client, 'getCounter').and.callFake((request, callback) => {
|
|
162
|
+
callback('error', undefined);
|
|
163
|
+
});
|
|
164
|
+
try {
|
|
165
|
+
await beta.getCounterCapacity('key');
|
|
166
|
+
fail();
|
|
167
|
+
} catch (error) {
|
|
168
|
+
expect(beta.client.getCounter).toHaveBeenCalled();
|
|
169
|
+
expect(error).toEqual('error');
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
describe('setCounterCapacity', () => {
|
|
175
|
+
it('calls the server and handles the response', async () => {
|
|
176
|
+
spyOn(beta.client, 'updateCounter').and.callFake((request, callback) => {
|
|
177
|
+
let counter = new messages.Counter();
|
|
178
|
+
callback(undefined, counter);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
let response = await beta.setCounterCapacity('key', 5);
|
|
182
|
+
expect(beta.client.updateCounter).toHaveBeenCalled();
|
|
183
|
+
expect(response).toEqual(undefined);
|
|
184
|
+
let request = beta.client.updateCounter.calls.argsFor(0)[0];
|
|
185
|
+
expect(request.getCounterupdaterequest().getName()).toEqual('key');
|
|
186
|
+
expect(request.getCounterupdaterequest().getCapacity().getValue()).toEqual(5);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('calls the server and handles failure', async () => {
|
|
190
|
+
spyOn(beta.client, 'updateCounter').and.callFake((request, callback) => {
|
|
191
|
+
callback('error', undefined);
|
|
192
|
+
});
|
|
193
|
+
try {
|
|
194
|
+
await beta.setCounterCapacity('key', 5);
|
|
195
|
+
fail();
|
|
196
|
+
} catch (error) {
|
|
197
|
+
expect(beta.client.updateCounter).toHaveBeenCalled();
|
|
198
|
+
expect(error).toEqual('error');
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe('getListCapacity', () => {
|
|
204
|
+
it('calls the server and handles the response', async () => {
|
|
205
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
206
|
+
let list = new messages.List();
|
|
207
|
+
list.setCapacity(10);
|
|
208
|
+
callback(undefined, list);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
let capacity = await beta.getListCapacity('key');
|
|
212
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
213
|
+
expect(capacity).toEqual(10);
|
|
214
|
+
let request = beta.client.getList.calls.argsFor(0)[0];
|
|
215
|
+
expect(request.getName()).toEqual('key');
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('calls the server and handles failure', async () => {
|
|
219
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
220
|
+
callback('error', undefined);
|
|
221
|
+
});
|
|
222
|
+
try {
|
|
223
|
+
await beta.getListCapacity('key');
|
|
224
|
+
fail();
|
|
225
|
+
} catch (error) {
|
|
226
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
227
|
+
expect(error).toEqual('error');
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
describe('setListCapacity', () => {
|
|
233
|
+
it('calls the server and handles the response while in range', async () => {
|
|
234
|
+
spyOn(beta.client, 'updateList').and.callFake((request, callback) => {
|
|
235
|
+
let list = new messages.List();
|
|
236
|
+
callback(undefined, list);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
let response = await beta.setListCapacity('key', 5);
|
|
240
|
+
expect(beta.client.updateList).toHaveBeenCalled();
|
|
241
|
+
expect(response).toEqual(undefined);
|
|
242
|
+
let request = beta.client.updateList.calls.argsFor(0)[0];
|
|
243
|
+
expect(request.getList().getName()).toEqual('key');
|
|
244
|
+
expect(request.getList().getCapacity()).toEqual(5);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('calls the server and handles failure', async () => {
|
|
248
|
+
spyOn(beta.client, 'updateList').and.callFake((request, callback) => {
|
|
249
|
+
callback('error', undefined);
|
|
250
|
+
});
|
|
251
|
+
try {
|
|
252
|
+
await beta.setListCapacity('key', 5);
|
|
253
|
+
fail();
|
|
254
|
+
} catch (error) {
|
|
255
|
+
expect(beta.client.updateList).toHaveBeenCalled();
|
|
256
|
+
expect(error).toEqual('error');
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
describe('listContains', () => {
|
|
262
|
+
it('calls the server and handles the response when the value is contained', async () => {
|
|
263
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
264
|
+
let list = new messages.List();
|
|
265
|
+
list.setValuesList(['firstValue', 'secondValue']);
|
|
266
|
+
callback(undefined, list);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
let contains = await beta.listContains('key', 'secondValue');
|
|
270
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
271
|
+
expect(contains).toEqual(true);
|
|
272
|
+
let request = beta.client.getList.calls.argsFor(0)[0];
|
|
273
|
+
expect(request.getName()).toEqual('key');
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
it('calls the server and handles the response when the value is not contained', async () => {
|
|
277
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
278
|
+
let list = new messages.List();
|
|
279
|
+
list.setValuesList(['firstValue', 'secondValue']);
|
|
280
|
+
callback(undefined, list);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
let contains = await beta.listContains('key', 'thirdValue');
|
|
284
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
285
|
+
expect(contains).toEqual(false);
|
|
286
|
+
let request = beta.client.getList.calls.argsFor(0)[0];
|
|
287
|
+
expect(request.getName()).toEqual('key');
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it('calls the server and handles failure', async () => {
|
|
291
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
292
|
+
callback('error', undefined);
|
|
293
|
+
});
|
|
294
|
+
try {
|
|
295
|
+
await beta.listContains('key', 'value');
|
|
296
|
+
fail();
|
|
297
|
+
} catch (error) {
|
|
298
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
299
|
+
expect(error).toEqual('error');
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
describe('getListLength', () => {
|
|
305
|
+
it('calls the server and handles the response', async () => {
|
|
306
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
307
|
+
let list = new messages.List();
|
|
308
|
+
list.setValuesList(['firstValue', 'secondValue']);
|
|
309
|
+
callback(undefined, list);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
let length = await beta.getListLength('key');
|
|
313
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
314
|
+
expect(length).toEqual(2);
|
|
315
|
+
let request = beta.client.getList.calls.argsFor(0)[0];
|
|
316
|
+
expect(request.getName()).toEqual('key');
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
it('calls the server and handles failure', async () => {
|
|
320
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
321
|
+
callback('error', undefined);
|
|
322
|
+
});
|
|
323
|
+
try {
|
|
324
|
+
await beta.getListLength('key');
|
|
325
|
+
fail();
|
|
326
|
+
} catch (error) {
|
|
327
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
328
|
+
expect(error).toEqual('error');
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
describe('getListValues', () => {
|
|
334
|
+
it('calls the server and handles the response', async () => {
|
|
335
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
336
|
+
let list = new messages.List();
|
|
337
|
+
list.setValuesList(['firstValue', 'secondValue']);
|
|
338
|
+
callback(undefined, list);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
let values = await beta.getListValues('key');
|
|
342
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
343
|
+
expect(values).toEqual(['firstValue', 'secondValue']);
|
|
344
|
+
let request = beta.client.getList.calls.argsFor(0)[0];
|
|
345
|
+
expect(request.getName()).toEqual('key');
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('calls the server and handles failure', async () => {
|
|
349
|
+
spyOn(beta.client, 'getList').and.callFake((request, callback) => {
|
|
350
|
+
callback('error', undefined);
|
|
351
|
+
});
|
|
352
|
+
try {
|
|
353
|
+
await beta.getListValues('key');
|
|
354
|
+
fail();
|
|
355
|
+
} catch (error) {
|
|
356
|
+
expect(beta.client.getList).toHaveBeenCalled();
|
|
357
|
+
expect(error).toEqual('error');
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
describe('appendListValue', () => {
|
|
363
|
+
it('calls the server and handles the response', async () => {
|
|
364
|
+
spyOn(beta.client, 'addListValue').and.callFake((request, callback) => {
|
|
365
|
+
let list = new messages.List();
|
|
366
|
+
callback(undefined, list);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
let response = await beta.appendListValue('key', 'value');
|
|
370
|
+
expect(beta.client.addListValue).toHaveBeenCalled();
|
|
371
|
+
expect(response).toEqual(undefined);
|
|
372
|
+
let request = beta.client.addListValue.calls.argsFor(0)[0];
|
|
373
|
+
expect(request.getName()).toEqual('key');
|
|
374
|
+
expect(request.getValue()).toEqual('value');
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it('calls the server and handles failure', async () => {
|
|
378
|
+
spyOn(beta.client, 'addListValue').and.callFake((request, callback) => {
|
|
379
|
+
callback('error', undefined);
|
|
380
|
+
});
|
|
381
|
+
try {
|
|
382
|
+
await beta.appendListValue('key', 'value');
|
|
383
|
+
fail();
|
|
384
|
+
} catch (error) {
|
|
385
|
+
expect(beta.client.addListValue).toHaveBeenCalled();
|
|
386
|
+
expect(error).toEqual('error');
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
describe('deleteListValue', () => {
|
|
392
|
+
it('calls the server and handles the response', async () => {
|
|
393
|
+
spyOn(beta.client, 'removeListValue').and.callFake((request, callback) => {
|
|
394
|
+
let list = new messages.List();
|
|
395
|
+
callback(undefined, list);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
let response = await beta.deleteListValue('key', 'value');
|
|
399
|
+
expect(beta.client.removeListValue).toHaveBeenCalled();
|
|
400
|
+
expect(response).toEqual(undefined);
|
|
401
|
+
let request = beta.client.removeListValue.calls.argsFor(0)[0];
|
|
402
|
+
expect(request.getName()).toEqual('key');
|
|
403
|
+
expect(request.getValue()).toEqual('value');
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
it('calls the server and handles failure', async () => {
|
|
407
|
+
spyOn(beta.client, 'removeListValue').and.callFake((request, callback) => {
|
|
408
|
+
callback('error', undefined);
|
|
409
|
+
});
|
|
410
|
+
try {
|
|
411
|
+
await beta.deleteListValue('key', 'value');
|
|
412
|
+
fail();
|
|
413
|
+
} catch (error) {
|
|
414
|
+
expect(beta.client.removeListValue).toHaveBeenCalled();
|
|
415
|
+
expect(error).toEqual('error');
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
});
|
package/src/agonesSDK.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
const grpc = require('@grpc/grpc-js');
|
|
16
16
|
|
|
17
17
|
const Alpha = require('./alpha');
|
|
18
|
+
const Beta = require('./beta');
|
|
18
19
|
|
|
19
20
|
const messages = require('../lib/sdk_pb');
|
|
20
21
|
const servicesPackageDefinition = require('../lib/sdk_grpc_pb');
|
|
@@ -28,6 +29,7 @@ class AgonesSDK {
|
|
|
28
29
|
this.healthStream = undefined;
|
|
29
30
|
this.streams = [];
|
|
30
31
|
this.alpha = new Alpha(address, credentials);
|
|
32
|
+
this.beta = new Beta(address, credentials);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
get port() {
|
package/src/alpha.js
CHANGED
|
@@ -83,7 +83,7 @@ class Alpha {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
getPlayerCount() {
|
|
86
|
+
async getPlayerCount() {
|
|
87
87
|
const request = new messages.Empty();
|
|
88
88
|
|
|
89
89
|
return new Promise((resolve, reject) => {
|
|
@@ -97,7 +97,7 @@ class Alpha {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
isPlayerConnected(playerID) {
|
|
100
|
+
async isPlayerConnected(playerID) {
|
|
101
101
|
const request = new messages.PlayerID();
|
|
102
102
|
request.setPlayerid(playerID);
|
|
103
103
|
|
|
@@ -112,7 +112,7 @@ class Alpha {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
getConnectedPlayers() {
|
|
115
|
+
async getConnectedPlayers() {
|
|
116
116
|
const request = new messages.Empty();
|
|
117
117
|
|
|
118
118
|
return new Promise((resolve, reject) => {
|
package/src/beta.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright 2023 Google LLC All Rights Reserved.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
declare class Beta {
|
|
16
|
+
getCounterCount(key: string): Promise<number>
|
|
17
|
+
|
|
18
|
+
incrementCounter(key: string, amount: number): Promise<void>
|
|
19
|
+
|
|
20
|
+
decrementCounter(key: string, amount: number): Promise<void>
|
|
21
|
+
|
|
22
|
+
setCounterCount(key: string, amount: number): Promise<void>
|
|
23
|
+
|
|
24
|
+
getCounterCapacity(key: string): Promise<number>
|
|
25
|
+
|
|
26
|
+
setCounterCapacity(key: string, amount: number): Promise<void>
|
|
27
|
+
|
|
28
|
+
getListCapacity(key: string): Promise<number>
|
|
29
|
+
|
|
30
|
+
setListCapacity(key: string, amount: number): Promise<void>
|
|
31
|
+
|
|
32
|
+
listContains(key: string, value: string): Promise<boolean>
|
|
33
|
+
|
|
34
|
+
getListLength(key: string): Promise<number>
|
|
35
|
+
|
|
36
|
+
getListValues(key: string): Promise<string[]>
|
|
37
|
+
|
|
38
|
+
appendListValue(key: string, value: string): Promise<void>
|
|
39
|
+
|
|
40
|
+
deleteListValue(key:string , value: string): Promise<void>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default Beta;
|