@crowdedkingdoms/crowdyjs 13.0.2 → 13.2.0
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/README.md +1 -1
- package/dist/binary-relay.d.ts +69 -0
- package/dist/binary-relay.d.ts.map +1 -0
- package/dist/binary-relay.js +226 -0
- package/dist/binary-wire.d.ts +111 -0
- package/dist/binary-wire.d.ts.map +1 -0
- package/dist/binary-wire.js +446 -0
- package/dist/crowdy-client.d.ts +14 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/domains/gameModel.d.ts +68 -6
- package/dist/domains/gameModel.d.ts.map +1 -1
- package/dist/domains/gameModel.js +77 -6
- package/dist/domains/udp.d.ts +6 -0
- package/dist/domains/udp.d.ts.map +1 -1
- package/dist/domains/udp.js +78 -0
- package/dist/generated/graphql.d.ts +305 -11
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +19 -15
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/kit/decks.d.ts +2 -1
- package/dist/kit/decks.d.ts.map +1 -1
- package/dist/kit/npcs.d.ts +4 -2
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/kit/worldsim.d.ts +2 -1
- package/dist/kit/worldsim.d.ts.map +1 -1
- package/dist/realtime.d.ts +40 -0
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +128 -0
- package/package.json +2 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Buddy client wire-format codec for the binary realtime relay
|
|
3
|
+
* (`crowdy-relay-v1`).
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the game-api's `UdpMessageParserService` byte-for-byte: uplink
|
|
6
|
+
* serializers build the complete client→Buddy datagram (spatial header +
|
|
7
|
+
* payload + HMAC + gameTokenId + sequence) and downlink parsing produces the
|
|
8
|
+
* same `__typename`-tagged notification objects the GraphQL
|
|
9
|
+
* `udpNotifications` subscription delivers, so handler code is transport
|
|
10
|
+
* agnostic.
|
|
11
|
+
*
|
|
12
|
+
* The per-message HMAC key is the 64-octet game token string itself — the
|
|
13
|
+
* same bearer token the SDK already holds — computed with WebCrypto
|
|
14
|
+
* (HMAC-SHA256). Buddy verifies it server-side; the relay does not.
|
|
15
|
+
*/
|
|
16
|
+
import { decodeBase64, encodeBase64 } from './utils.js';
|
|
17
|
+
export const RELAY_MAX_DATAGRAM_BYTES = 1232;
|
|
18
|
+
/** Wire opcodes (mirror of game-api / Buddy `UdpMessageType`). */
|
|
19
|
+
export const WireMessageType = {
|
|
20
|
+
MESSAGE_BUNDLE: 2,
|
|
21
|
+
GENERIC_ERROR_MESSAGE: 3,
|
|
22
|
+
CHANNEL_MESSAGE_REQUEST: 17,
|
|
23
|
+
CHANNEL_MESSAGE_NOTIFICATION: 18,
|
|
24
|
+
ACTOR_UPDATE_REQUEST_2: 128,
|
|
25
|
+
ACTOR_UPDATE_RESPONSE_2: 129,
|
|
26
|
+
ACTOR_UPDATE_NOTIFICATION_2: 130,
|
|
27
|
+
VOXEL_UPDATE_REQUEST_2: 131,
|
|
28
|
+
VOXEL_UPDATE_RESPONSE_2: 132,
|
|
29
|
+
VOXEL_UPDATE_NOTIFICATION_2: 133,
|
|
30
|
+
CLIENT_AUDIO_PACKET_2: 134,
|
|
31
|
+
CLIENT_AUDIO_NOTIFICATION_2: 135,
|
|
32
|
+
CLIENT_TEXT_PACKET_2: 136,
|
|
33
|
+
CLIENT_TEXT_NOTIFICATION_2: 137,
|
|
34
|
+
CLIENT_EVENT_NOTIFICATION_2: 138,
|
|
35
|
+
SERVER_EVENT_NOTIFICATION_2: 139,
|
|
36
|
+
SINGLE_ACTOR_MESSAGE: 142,
|
|
37
|
+
};
|
|
38
|
+
const SPATIAL_HEADER_SIZE = 68;
|
|
39
|
+
const UUID_SIZE = 32;
|
|
40
|
+
const HMAC_SIZE = 32;
|
|
41
|
+
/** Client→server tail with auth: hmac(32) + gameTokenId(8) + seq(1). */
|
|
42
|
+
const TAIL_AUTH_BYTES = 41;
|
|
43
|
+
/** Server→client tail: epochMillis(8) + seq(1). */
|
|
44
|
+
const TAIL_NO_AUTH_BYTES = 9;
|
|
45
|
+
/**
|
|
46
|
+
* Wire error byte → GraphQL `UdpErrorCode` enum name (mirror of the game-api
|
|
47
|
+
* `ErrorType` numeric enum, which GraphQL serializes by name).
|
|
48
|
+
*/
|
|
49
|
+
const UDP_ERROR_NAMES = {
|
|
50
|
+
0: 'NO_ERROR',
|
|
51
|
+
1: 'UNKNOWN_ERROR',
|
|
52
|
+
2: 'EMAIL_NOT_FOUND',
|
|
53
|
+
3: 'BAD_PASSWORD',
|
|
54
|
+
4: 'EMAIL_ALREADY_EXISTS',
|
|
55
|
+
5: 'INVALID_TOKEN',
|
|
56
|
+
6: 'APP_NOT_FOUND',
|
|
57
|
+
7: 'UNAUTHORIZED',
|
|
58
|
+
8: 'APP_NOT_LOADED',
|
|
59
|
+
9: 'EMAIL_TOO_SHORT',
|
|
60
|
+
10: 'EMAIL_TOO_LONG',
|
|
61
|
+
11: 'PASSWORD_TOO_SHORT',
|
|
62
|
+
12: 'PASSWORD_TOO_LONG',
|
|
63
|
+
13: 'GAME_TOKEN_WRONG_SIZE',
|
|
64
|
+
14: 'NAME_TOO_LONG',
|
|
65
|
+
15: 'INVALID_REQUEST',
|
|
66
|
+
16: 'EMAIL_INVALID',
|
|
67
|
+
17: 'INVALID_TOKEN_LENGTH',
|
|
68
|
+
18: 'INVALID_APP_ID',
|
|
69
|
+
19: 'CHUNK_NOT_FOUND',
|
|
70
|
+
20: 'USER_NOT_AUTHENTICATED',
|
|
71
|
+
21: 'INVALID_STATE_DATA',
|
|
72
|
+
22: 'USER_NOT_APP_ADMIN',
|
|
73
|
+
23: 'GRID_OUTSIDE_ASSIGNMENT',
|
|
74
|
+
24: 'NO_MATCHING_GRID_ASSIGNMENT',
|
|
75
|
+
25: 'INVALID_GRID_COORDINATES',
|
|
76
|
+
26: 'GRID_ALREADY_EXISTS',
|
|
77
|
+
27: 'GRID_OVERLAPS_EXISTING',
|
|
78
|
+
28: 'GAMERTAG_ALREADY_EXISTS',
|
|
79
|
+
29: 'GRID_NOT_FOUND',
|
|
80
|
+
30: 'CANNOT_DELETE_DEFAULT_WORLD_GRID',
|
|
81
|
+
31: 'GRID_HAS_NESTED_CHILDREN',
|
|
82
|
+
32: 'TOKEN_EXPIRED',
|
|
83
|
+
};
|
|
84
|
+
const textEncoder = new TextEncoder();
|
|
85
|
+
const textDecoder = new TextDecoder();
|
|
86
|
+
function latin1Bytes(value) {
|
|
87
|
+
const bytes = new Uint8Array(value.length);
|
|
88
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
89
|
+
bytes[i] = value.charCodeAt(i) & 0xff;
|
|
90
|
+
}
|
|
91
|
+
return bytes;
|
|
92
|
+
}
|
|
93
|
+
/** Import the game token as an HMAC-SHA256 WebCrypto key (once per session). */
|
|
94
|
+
export async function createSignContext(gameTokenId, gameTokenString) {
|
|
95
|
+
const tokenBytes = latin1Bytes(gameTokenString);
|
|
96
|
+
const key = await crypto.subtle.importKey('raw', tokenBytes, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
|
|
97
|
+
return { gameTokenId, tokenBytes, key };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Spatial-message HMAC: key = token bytes; signed data =
|
|
101
|
+
* `dataBeforeHmac || tokenBytes` (mirror of `computeSpatialHmac`).
|
|
102
|
+
*/
|
|
103
|
+
async function signWithToken(ctx, dataBeforeHmac) {
|
|
104
|
+
const signed = new Uint8Array(dataBeforeHmac.length + ctx.tokenBytes.length);
|
|
105
|
+
signed.set(dataBeforeHmac, 0);
|
|
106
|
+
signed.set(ctx.tokenBytes, dataBeforeHmac.length);
|
|
107
|
+
const mac = await crypto.subtle.sign('HMAC', ctx.key, signed);
|
|
108
|
+
return new Uint8Array(mac);
|
|
109
|
+
}
|
|
110
|
+
function clampDistance(distance) {
|
|
111
|
+
return Math.max(0, Math.min(8, distance));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Build a complete client→Buddy spatial datagram:
|
|
115
|
+
* `header(68) + payload + hmac(32) + gameTokenId(8) + seq(1)` with
|
|
116
|
+
* `containsAuth = 1` (mirror of `serializeSpatialMessage`).
|
|
117
|
+
*/
|
|
118
|
+
async function serializeSpatial(ctx, messageType, appId, chunk, distance, decayRate, uuid, payload, sequenceNumber) {
|
|
119
|
+
const dataLen = SPATIAL_HEADER_SIZE + payload.length;
|
|
120
|
+
const data = new Uint8Array(dataLen);
|
|
121
|
+
const view = new DataView(data.buffer);
|
|
122
|
+
let off = 0;
|
|
123
|
+
view.setUint8(off, messageType);
|
|
124
|
+
off += 1;
|
|
125
|
+
view.setBigInt64(off, BigInt(appId), true);
|
|
126
|
+
off += 8;
|
|
127
|
+
view.setBigInt64(off, BigInt(chunk.x), true);
|
|
128
|
+
off += 8;
|
|
129
|
+
view.setBigInt64(off, BigInt(chunk.y), true);
|
|
130
|
+
off += 8;
|
|
131
|
+
view.setBigInt64(off, BigInt(chunk.z), true);
|
|
132
|
+
off += 8;
|
|
133
|
+
view.setUint8(off, clampDistance(distance));
|
|
134
|
+
off += 1;
|
|
135
|
+
view.setUint8(off, decayRate & 0xff);
|
|
136
|
+
off += 1;
|
|
137
|
+
view.setUint8(off, 1); // containsAuth
|
|
138
|
+
off += 1;
|
|
139
|
+
const uuidBytes = textEncoder.encode(uuid);
|
|
140
|
+
if (uuidBytes.length > UUID_SIZE) {
|
|
141
|
+
throw new Error(`UUID too long: ${uuidBytes.length} > ${UUID_SIZE}`);
|
|
142
|
+
}
|
|
143
|
+
data.set(uuidBytes, off);
|
|
144
|
+
off += UUID_SIZE;
|
|
145
|
+
data.set(payload, off);
|
|
146
|
+
const hmac = await signWithToken(ctx, data);
|
|
147
|
+
const total = dataLen + TAIL_AUTH_BYTES;
|
|
148
|
+
if (total > RELAY_MAX_DATAGRAM_BYTES) {
|
|
149
|
+
throw new Error(`Datagram exceeds maximum size: ${total} > ${RELAY_MAX_DATAGRAM_BYTES}`);
|
|
150
|
+
}
|
|
151
|
+
const out = new Uint8Array(total);
|
|
152
|
+
out.set(data, 0);
|
|
153
|
+
out.set(hmac, dataLen);
|
|
154
|
+
const tailView = new DataView(out.buffer);
|
|
155
|
+
tailView.setBigInt64(dataLen + HMAC_SIZE, ctx.gameTokenId, true);
|
|
156
|
+
tailView.setUint8(dataLen + HMAC_SIZE + 8, sequenceNumber & 0xff);
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
export function serializeActorUpdate(ctx, input) {
|
|
160
|
+
return serializeSpatial(ctx, WireMessageType.ACTOR_UPDATE_REQUEST_2, input.appId, input.chunk, input.distance ?? 8, input.decayRate ?? 1, input.uuid, decodeBase64(input.state ?? ''), input.sequenceNumber ?? 0);
|
|
161
|
+
}
|
|
162
|
+
export function serializeVoxelUpdate(ctx, input) {
|
|
163
|
+
const voxelState = decodeBase64(input.voxelState ?? '');
|
|
164
|
+
const payload = new Uint8Array(10 + voxelState.length);
|
|
165
|
+
const view = new DataView(payload.buffer);
|
|
166
|
+
view.setInt16(0, input.voxel.x, true);
|
|
167
|
+
view.setInt16(2, input.voxel.y, true);
|
|
168
|
+
view.setInt16(4, input.voxel.z, true);
|
|
169
|
+
view.setInt16(6, input.voxelType, true);
|
|
170
|
+
view.setUint16(8, voxelState.length, true);
|
|
171
|
+
payload.set(voxelState, 10);
|
|
172
|
+
return serializeSpatial(ctx, WireMessageType.VOXEL_UPDATE_REQUEST_2, input.appId, input.chunk, input.distance ?? 8, input.decayRate ?? 0, input.uuid, payload, input.sequenceNumber ?? 0);
|
|
173
|
+
}
|
|
174
|
+
export function serializeAudioPacket(ctx, input) {
|
|
175
|
+
return serializeSpatial(ctx, WireMessageType.CLIENT_AUDIO_PACKET_2, input.appId, input.chunk, input.distance ?? 1, input.decayRate ?? 0, input.uuid, decodeBase64(input.audioData ?? ''), input.sequenceNumber ?? 0);
|
|
176
|
+
}
|
|
177
|
+
export function serializeTextPacket(ctx, input) {
|
|
178
|
+
return serializeSpatial(ctx, WireMessageType.CLIENT_TEXT_PACKET_2, input.appId, input.chunk, input.distance ?? 8, input.decayRate ?? 0, input.uuid, textEncoder.encode(input.text ?? ''), input.sequenceNumber ?? 0);
|
|
179
|
+
}
|
|
180
|
+
export function serializeClientEvent(ctx, input) {
|
|
181
|
+
const state = decodeBase64(input.state ?? '');
|
|
182
|
+
const payload = new Uint8Array(2 + state.length);
|
|
183
|
+
new DataView(payload.buffer).setUint16(0, input.eventType, true);
|
|
184
|
+
payload.set(state, 2);
|
|
185
|
+
return serializeSpatial(ctx, WireMessageType.CLIENT_EVENT_NOTIFICATION_2, input.appId, input.chunk, input.distance ?? 8, input.decayRate ?? 0, input.uuid, payload, input.sequenceNumber ?? 0);
|
|
186
|
+
}
|
|
187
|
+
export function serializeSingleActorMessage(ctx, input) {
|
|
188
|
+
return serializeSpatial(ctx, WireMessageType.SINGLE_ACTOR_MESSAGE, input.appId, input.chunk, 0, 0, input.targetUuid, input.payload ? decodeBase64(input.payload) : new Uint8Array(0), input.sequenceNumber ?? 0);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* CHANNEL_MESSAGE_REQUEST:
|
|
192
|
+
* `[1B type=17][8B channelId][32B uuid][2B payloadLen][payload][1B containsAuth]
|
|
193
|
+
* [32B HMAC][8B gameTokenId][1B seq]` — HMAC over everything before it.
|
|
194
|
+
*/
|
|
195
|
+
export async function serializeChannelMessage(ctx, input) {
|
|
196
|
+
const payload = input.payload ? decodeBase64(input.payload) : new Uint8Array(0);
|
|
197
|
+
if (payload.length > 1024) {
|
|
198
|
+
throw new Error(`Channel payload exceeds 1024 bytes: ${payload.length}`);
|
|
199
|
+
}
|
|
200
|
+
const uuidBytes = textEncoder.encode(input.uuid);
|
|
201
|
+
if (uuidBytes.length !== UUID_SIZE) {
|
|
202
|
+
throw new Error(`Invalid uuid length: must be exactly ${UUID_SIZE} bytes when UTF-8 encoded. Received ${uuidBytes.length} bytes.`);
|
|
203
|
+
}
|
|
204
|
+
const prefixLen = 1 + 8 + UUID_SIZE + 2 + payload.length + 1;
|
|
205
|
+
const prefix = new Uint8Array(prefixLen);
|
|
206
|
+
const view = new DataView(prefix.buffer);
|
|
207
|
+
let off = 0;
|
|
208
|
+
view.setUint8(off, WireMessageType.CHANNEL_MESSAGE_REQUEST);
|
|
209
|
+
off += 1;
|
|
210
|
+
view.setBigUint64(off, BigInt(input.channelId), true);
|
|
211
|
+
off += 8;
|
|
212
|
+
prefix.set(uuidBytes, off);
|
|
213
|
+
off += UUID_SIZE;
|
|
214
|
+
view.setUint16(off, payload.length, true);
|
|
215
|
+
off += 2;
|
|
216
|
+
prefix.set(payload, off);
|
|
217
|
+
off += payload.length;
|
|
218
|
+
view.setUint8(off, 1); // containsAuth
|
|
219
|
+
const hmac = await signWithToken(ctx, prefix);
|
|
220
|
+
const out = new Uint8Array(prefixLen + HMAC_SIZE + 8 + 1);
|
|
221
|
+
out.set(prefix, 0);
|
|
222
|
+
out.set(hmac, prefixLen);
|
|
223
|
+
const tail = new DataView(out.buffer);
|
|
224
|
+
tail.setBigUint64(prefixLen + HMAC_SIZE, ctx.gameTokenId, true);
|
|
225
|
+
tail.setUint8(prefixLen + HMAC_SIZE + 8, (input.sequenceNumber ?? 0) & 0xff);
|
|
226
|
+
return out;
|
|
227
|
+
}
|
|
228
|
+
function stripNulls(value) {
|
|
229
|
+
return value.replace(/\0/g, '');
|
|
230
|
+
}
|
|
231
|
+
function parseSpatialParts(bytes, view) {
|
|
232
|
+
if (bytes.length < SPATIAL_HEADER_SIZE) {
|
|
233
|
+
throw new Error(`Spatial message too short for header: ${bytes.length} < ${SPATIAL_HEADER_SIZE}`);
|
|
234
|
+
}
|
|
235
|
+
let off = 1;
|
|
236
|
+
const appId = view.getBigInt64(off, true);
|
|
237
|
+
off += 8;
|
|
238
|
+
const chunkX = view.getBigInt64(off, true);
|
|
239
|
+
off += 8;
|
|
240
|
+
const chunkY = view.getBigInt64(off, true);
|
|
241
|
+
off += 8;
|
|
242
|
+
const chunkZ = view.getBigInt64(off, true);
|
|
243
|
+
off += 8;
|
|
244
|
+
const distance = view.getUint8(off);
|
|
245
|
+
off += 1;
|
|
246
|
+
const decayRate = view.getUint8(off);
|
|
247
|
+
off += 1;
|
|
248
|
+
const containsAuth = view.getUint8(off) !== 0;
|
|
249
|
+
off += 1;
|
|
250
|
+
const uuid = stripNulls(textDecoder.decode(bytes.subarray(off, off + UUID_SIZE)));
|
|
251
|
+
off += UUID_SIZE;
|
|
252
|
+
const tailBytes = containsAuth ? TAIL_AUTH_BYTES : TAIL_NO_AUTH_BYTES;
|
|
253
|
+
let payload;
|
|
254
|
+
let sequenceNumber = 0;
|
|
255
|
+
let epochMillis = 0n;
|
|
256
|
+
if (bytes.length >= SPATIAL_HEADER_SIZE + tailBytes) {
|
|
257
|
+
const payloadEnd = bytes.length - tailBytes;
|
|
258
|
+
payload = bytes.subarray(off, payloadEnd);
|
|
259
|
+
let tOff = payloadEnd;
|
|
260
|
+
if (containsAuth)
|
|
261
|
+
tOff += HMAC_SIZE;
|
|
262
|
+
epochMillis = view.getBigInt64(tOff, true);
|
|
263
|
+
sequenceNumber = view.getUint8(tOff + 8);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
payload = bytes.subarray(off);
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
appId: appId.toString(),
|
|
270
|
+
chunkX: chunkX.toString(),
|
|
271
|
+
chunkY: chunkY.toString(),
|
|
272
|
+
chunkZ: chunkZ.toString(),
|
|
273
|
+
distance,
|
|
274
|
+
decayRate,
|
|
275
|
+
uuid,
|
|
276
|
+
payload,
|
|
277
|
+
sequenceNumber,
|
|
278
|
+
epochMillis: epochMillis.toString(),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function spatialCommon(p) {
|
|
282
|
+
return {
|
|
283
|
+
appId: p.appId,
|
|
284
|
+
chunkX: p.chunkX,
|
|
285
|
+
chunkY: p.chunkY,
|
|
286
|
+
chunkZ: p.chunkZ,
|
|
287
|
+
distance: p.distance,
|
|
288
|
+
decayRate: p.decayRate,
|
|
289
|
+
uuid: p.uuid,
|
|
290
|
+
sequenceNumber: p.sequenceNumber,
|
|
291
|
+
epochMillis: p.epochMillis,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function parseOne(bytes) {
|
|
295
|
+
if (bytes.length < 1)
|
|
296
|
+
return null;
|
|
297
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
298
|
+
const messageType = bytes[0];
|
|
299
|
+
if (messageType === WireMessageType.GENERIC_ERROR_MESSAGE) {
|
|
300
|
+
if (bytes.length < 3)
|
|
301
|
+
return null;
|
|
302
|
+
return {
|
|
303
|
+
__typename: 'GenericErrorResponse',
|
|
304
|
+
sequenceNumber: view.getUint8(1),
|
|
305
|
+
errorCode: (UDP_ERROR_NAMES[view.getUint8(2)] ??
|
|
306
|
+
'UNKNOWN_ERROR'),
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
if (messageType === WireMessageType.CHANNEL_MESSAGE_NOTIFICATION) {
|
|
310
|
+
// [1B type][8B channelId][32B senderUuid][2B payloadLen][payload][8B epochMillis][1B seq]
|
|
311
|
+
if (bytes.length < 1 + 8 + UUID_SIZE + 2)
|
|
312
|
+
return null;
|
|
313
|
+
let off = 1;
|
|
314
|
+
const channelId = view.getBigUint64(off, true);
|
|
315
|
+
off += 8;
|
|
316
|
+
const uuid = stripNulls(textDecoder.decode(bytes.subarray(off, off + UUID_SIZE)));
|
|
317
|
+
off += UUID_SIZE;
|
|
318
|
+
const payloadLen = view.getUint16(off, true);
|
|
319
|
+
off += 2;
|
|
320
|
+
if (bytes.length < off + payloadLen + 8 + 1)
|
|
321
|
+
return null;
|
|
322
|
+
const payload = bytes.subarray(off, off + payloadLen);
|
|
323
|
+
off += payloadLen;
|
|
324
|
+
const epochMillis = view.getBigUint64(off, true);
|
|
325
|
+
off += 8;
|
|
326
|
+
const sequenceNumber = view.getUint8(off);
|
|
327
|
+
return {
|
|
328
|
+
__typename: 'ChannelMessageNotification',
|
|
329
|
+
channelId: channelId.toString(),
|
|
330
|
+
uuid,
|
|
331
|
+
payload: encodeBase64(payload),
|
|
332
|
+
sequenceNumber,
|
|
333
|
+
epochMillis: epochMillis.toString(),
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
if ((messageType & 0x80) === 0) {
|
|
337
|
+
return null; // control opcodes (COMMAND_RECONNECT etc.) never reach the client
|
|
338
|
+
}
|
|
339
|
+
const p = parseSpatialParts(bytes, view);
|
|
340
|
+
switch (messageType) {
|
|
341
|
+
case WireMessageType.ACTOR_UPDATE_RESPONSE_2:
|
|
342
|
+
return {
|
|
343
|
+
__typename: 'ActorUpdateResponse',
|
|
344
|
+
...spatialCommon(p),
|
|
345
|
+
};
|
|
346
|
+
case WireMessageType.ACTOR_UPDATE_NOTIFICATION_2:
|
|
347
|
+
return {
|
|
348
|
+
__typename: 'ActorUpdateNotification',
|
|
349
|
+
...spatialCommon(p),
|
|
350
|
+
state: encodeBase64(p.payload),
|
|
351
|
+
};
|
|
352
|
+
case WireMessageType.VOXEL_UPDATE_RESPONSE_2:
|
|
353
|
+
return {
|
|
354
|
+
__typename: 'VoxelUpdateResponse',
|
|
355
|
+
...spatialCommon(p),
|
|
356
|
+
};
|
|
357
|
+
case WireMessageType.VOXEL_UPDATE_NOTIFICATION_2: {
|
|
358
|
+
if (p.payload.length < 10)
|
|
359
|
+
return null;
|
|
360
|
+
const pv = new DataView(p.payload.buffer, p.payload.byteOffset, p.payload.byteLength);
|
|
361
|
+
const stateLength = pv.getUint16(8, true);
|
|
362
|
+
return {
|
|
363
|
+
__typename: 'VoxelUpdateNotification',
|
|
364
|
+
...spatialCommon(p),
|
|
365
|
+
voxelX: pv.getInt16(0, true),
|
|
366
|
+
voxelY: pv.getInt16(2, true),
|
|
367
|
+
voxelZ: pv.getInt16(4, true),
|
|
368
|
+
voxelType: pv.getInt16(6, true),
|
|
369
|
+
voxelState: encodeBase64(p.payload.subarray(10, 10 + stateLength)),
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
case WireMessageType.CLIENT_AUDIO_NOTIFICATION_2:
|
|
373
|
+
return {
|
|
374
|
+
__typename: 'ClientAudioNotification',
|
|
375
|
+
...spatialCommon(p),
|
|
376
|
+
audioData: encodeBase64(p.payload),
|
|
377
|
+
};
|
|
378
|
+
case WireMessageType.CLIENT_TEXT_NOTIFICATION_2:
|
|
379
|
+
return {
|
|
380
|
+
__typename: 'ClientTextNotification',
|
|
381
|
+
...spatialCommon(p),
|
|
382
|
+
text: stripNulls(textDecoder.decode(p.payload)),
|
|
383
|
+
};
|
|
384
|
+
case WireMessageType.CLIENT_EVENT_NOTIFICATION_2:
|
|
385
|
+
case WireMessageType.SERVER_EVENT_NOTIFICATION_2: {
|
|
386
|
+
if (p.payload.length < 2)
|
|
387
|
+
return null;
|
|
388
|
+
const pv = new DataView(p.payload.buffer, p.payload.byteOffset, p.payload.byteLength);
|
|
389
|
+
return {
|
|
390
|
+
__typename: messageType === WireMessageType.CLIENT_EVENT_NOTIFICATION_2
|
|
391
|
+
? 'ClientEventNotification'
|
|
392
|
+
: 'ServerEventNotification',
|
|
393
|
+
...spatialCommon(p),
|
|
394
|
+
eventType: pv.getUint16(0, true),
|
|
395
|
+
state: encodeBase64(p.payload.subarray(2)),
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
case WireMessageType.SINGLE_ACTOR_MESSAGE: {
|
|
399
|
+
const { distance: _d, decayRate: _r, ...rest } = spatialCommon(p);
|
|
400
|
+
return {
|
|
401
|
+
__typename: 'SingleActorMessageNotification',
|
|
402
|
+
...rest,
|
|
403
|
+
payload: encodeBase64(p.payload),
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
default:
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Parse one relay BINARY frame (one Buddy datagram, possibly a
|
|
412
|
+
* MESSAGE_BUNDLE) into notification objects. Unparseable inner messages are
|
|
413
|
+
* skipped, mirroring the server-side bundle behavior.
|
|
414
|
+
*/
|
|
415
|
+
export function parseRelayFrame(bytes) {
|
|
416
|
+
if (bytes.length < 1)
|
|
417
|
+
return [];
|
|
418
|
+
if (bytes[0] === WireMessageType.MESSAGE_BUNDLE) {
|
|
419
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
420
|
+
const out = [];
|
|
421
|
+
let off = 1;
|
|
422
|
+
while (off + 2 <= bytes.length) {
|
|
423
|
+
const len = view.getUint16(off, true);
|
|
424
|
+
off += 2;
|
|
425
|
+
if (off + len > bytes.length)
|
|
426
|
+
break;
|
|
427
|
+
try {
|
|
428
|
+
const parsed = parseOne(bytes.subarray(off, off + len));
|
|
429
|
+
if (parsed)
|
|
430
|
+
out.push(parsed);
|
|
431
|
+
}
|
|
432
|
+
catch {
|
|
433
|
+
// skip unparseable bundle member
|
|
434
|
+
}
|
|
435
|
+
off += len;
|
|
436
|
+
}
|
|
437
|
+
return out;
|
|
438
|
+
}
|
|
439
|
+
try {
|
|
440
|
+
const parsed = parseOne(bytes);
|
|
441
|
+
return parsed ? [parsed] : [];
|
|
442
|
+
}
|
|
443
|
+
catch {
|
|
444
|
+
return [];
|
|
445
|
+
}
|
|
446
|
+
}
|
package/dist/crowdy-client.d.ts
CHANGED
|
@@ -114,6 +114,20 @@ export interface CrowdyClientConfig {
|
|
|
114
114
|
* instead of HTTP POST (requires active `udp.subscribe`).
|
|
115
115
|
*/
|
|
116
116
|
wsUplinkMutations?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Use the game-api's binary realtime relay (`crowdy-relay-v1`): raw
|
|
119
|
+
* WebSocket BINARY frames carrying complete client-signed Buddy wire
|
|
120
|
+
* datagrams both ways, bypassing the GraphQL hot path. All `udp.*` /
|
|
121
|
+
* `world()` / stores APIs behave identically; the SDK falls back to the
|
|
122
|
+
* GraphQL transport when the relay endpoint is unavailable. Check server
|
|
123
|
+
* support via `gameClientBootstrap.binaryRelayEnabled`.
|
|
124
|
+
*/
|
|
125
|
+
binaryTransport?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Absolute ws(s) URL of the binary relay endpoint. Defaults to the
|
|
128
|
+
* realtime WebSocket URL with its path replaced by `/realtime`.
|
|
129
|
+
*/
|
|
130
|
+
binaryRelayUrl?: string;
|
|
117
131
|
};
|
|
118
132
|
/**
|
|
119
133
|
* Optional sticky-LB cookie jar shared with the game-api HTTP client. Node
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crowdy-client.d.ts","sourceRoot":"","sources":["../src/crowdy-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,SAAS,EACT,KAAK,gBAAg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E,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa;IAS3D,gEAAgE;IAChE,KAAK,IAAI,IAAI;CAKd;AAED,wBAAgB,kBAAkB,CAChC,MAAM,GAAE,kBAAuB,GAC9B,YAAY,CAEd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GraphQLClient } from '../client.js';
|
|
2
|
-
import { type GameModelCreateSessionMutation, type GameModelCreateSessionMutationVariables, type GameModelJoinSessionMutation, type GameModelJoinSessionMutationVariables, type GameModelSetSessionTurnMutation, type GameModelSetSessionTurnMutationVariables, type GameModelCreateContainerMutation, type GameModelCreateContainerMutationVariables, type GameModelDeleteContainerMutation, type GameModelDeleteContainerMutationVariables, type GameModelSetPropertyMutation, type GameModelSetPropertyMutationVariables, type GameModelAddEdgeMutation, type GameModelAddEdgeMutationVariables, type GameModelDeleteEdgeMutation, type GameModelDeleteEdgeMutationVariables, type GameModelInvokeMutation, type GameModelInvokeMutationVariables, type GameModelContainerQuery, type GameModelContainerQueryVariables, GameModelContainerChangedSubscription, GameModelContainerChangedSubscriptionVariables, type GameModelActivePlayerCountQuery, type GameModelActivePlayerCountQueryVariables, type GameModelActivePlayerCountChangedSubscription, type GameModelActivePlayerCountChangedSubscriptionVariables, type GameModelContainersQuery, type GameModelContainersQueryVariables, type GameModelContainerStateQuery, type GameModelContainerStateQueryVariables, type GameModelTraverseQuery, type GameModelTraverseQueryVariables, type GameModelSessionQuery, type GameModelSessionQueryVariables, type GameModelSessionsQuery, type GameModelSessionsQueryVariables, type GameModelEventsQuery, type GameModelEventsQueryVariables, type GameModelFlowQuery, type GameModelFlowQueryVariables, type GameModelSeedMutation, type GameModelSeedMutationVariables, type GameModelUpsertContainerTypeMutation, type GameModelUpsertContainerTypeMutationVariables, type GameModelUpsertPropertyDefMutation, type GameModelUpsertPropertyDefMutationVariables, type GameModelDeletePropertyDefMutation, type GameModelDeletePropertyDefMutationVariables, type GameModelDeleteContainerTypeMutation, type GameModelDeleteContainerTypeMutationVariables, type GameModelUpsertFunctionMutation, type GameModelUpsertFunctionMutationVariables, type GameModelDeleteFunctionMutation, type GameModelDeleteFunctionMutationVariables, type GameModelDefineFeatureMutation, type GameModelDefineFeatureMutationVariables, type GameModelGrantTierFeatureMutation, type GameModelGrantTierFeatureMutationVariables, type GameModelSetPolicyMutation, type GameModelSetPolicyMutationVariables, type GameModelTypeSchemaQuery, type GameModelTypeSchemaQueryVariables, type GameModelContainerTypesQuery, type GameModelContainerTypesQueryVariables, type GameModelPropertyDefsQuery, type GameModelPropertyDefsQueryVariables, type GameModelFunctionQuery, type GameModelFunctionQueryVariables, type GameModelFunctionsQuery, type GameModelFunctionsQueryVariables, type GameModelFeaturesQuery, type GameModelFeaturesQueryVariables, type GameModelTierFeaturesQuery, type GameModelTierFeaturesQueryVariables, type GameModelPolicyQuery, type GameModelPolicyQueryVariables, type GameModelRevokeTierFeatureMutation, type GameModelRevokeTierFeatureMutationVariables, type GameModelEventsConnectionQuery, type GameModelEventsConnectionQueryVariables, type GameModelUpsertAutomationMutation, type GameModelUpsertAutomationMutationVariables, type GameModelDeleteAutomationMutation, type GameModelDeleteAutomationMutationVariables, type GameModelSetAutomationEnabledMutation, type GameModelSetAutomationEnabledMutationVariables, type GameModelUpsertAutomationTriggerMutation, type GameModelUpsertAutomationTriggerMutationVariables, type GameModelDeleteAutomationTriggerMutation, type GameModelDeleteAutomationTriggerMutationVariables, type GameModelSetAutomationPolicyMutation, type GameModelSetAutomationPolicyMutationVariables, type GameModelRunAutomationMutation, type GameModelRunAutomationMutationVariables, type GameModelAutomationsQuery, type GameModelAutomationsQueryVariables, type GameModelAutomationQuery, type GameModelAutomationQueryVariables, type GameModelAutomationTriggersQuery, type GameModelAutomationTriggersQueryVariables, type GameModelAutomationPolicyQuery, type GameModelAutomationPolicyQueryVariables, type GameModelAutomationRunsQuery, type GameModelAutomationRunsQueryVariables, type GameModelAutomationStatsQuery, type GameModelAutomationStatsQueryVariables, type GameModelAppDiagnosticsQuery, type GameModelAppDiagnosticsQueryVariables } from '../generated/graphql.js';
|
|
2
|
+
import { type GameModelCreateSessionMutation, type GameModelCreateSessionMutationVariables, type GameModelJoinSessionMutation, type GameModelJoinSessionMutationVariables, type GameModelSetSessionTurnMutation, type GameModelSetSessionTurnMutationVariables, type GameModelCreateContainerMutation, type GameModelCreateContainerMutationVariables, type GameModelDeleteContainerMutation, type GameModelDeleteContainerMutationVariables, type GameModelSetPropertyMutation, type GameModelSetPropertyMutationVariables, type GameModelAddEdgeMutation, type GameModelAddEdgeMutationVariables, type GameModelDeleteEdgeMutation, type GameModelDeleteEdgeMutationVariables, type GameModelInvokeMutation, type GameModelInvokeMutationVariables, type GameModelContainerQuery, type GameModelContainerQueryVariables, GameModelContainerChangedSubscription, GameModelContainerChangedSubscriptionVariables, type GameModelActivePlayerCountQuery, type GameModelActivePlayerCountQueryVariables, type GameModelActivePlayerCountChangedSubscription, type GameModelActivePlayerCountChangedSubscriptionVariables, type GameModelContainersQuery, type GameModelContainersQueryVariables, type GameModelContainerStateQuery, type GameModelContainerStateQueryVariables, type GameModelTraverseQuery, type GameModelTraverseQueryVariables, type GameModelSessionQuery, type GameModelSessionQueryVariables, type GameModelSessionsQuery, type GameModelSessionsQueryVariables, type GameModelEventsQuery, type GameModelEventsQueryVariables, type GameModelFlowQuery, type GameModelFlowQueryVariables, type GameModelSeedMutation, type GameModelSeedMutationVariables, type GameModelUpsertContainerTypeMutation, type GameModelUpsertContainerTypeMutationVariables, type GameModelUpsertPropertyDefMutation, type GameModelUpsertPropertyDefMutationVariables, type GameModelDeletePropertyDefMutation, type GameModelDeletePropertyDefMutationVariables, type GameModelDeleteContainerTypeMutation, type GameModelDeleteContainerTypeMutationVariables, type GameModelUpsertFunctionMutation, type GameModelUpsertFunctionMutationVariables, type GameModelDeleteFunctionMutation, type GameModelDeleteFunctionMutationVariables, type GameModelDefineFeatureMutation, type GameModelDefineFeatureMutationVariables, type GameModelGrantTierFeatureMutation, type GameModelGrantTierFeatureMutationVariables, type GameModelSetPolicyMutation, type GameModelSetPolicyMutationVariables, type GameModelTypeSchemaQuery, type GameModelTypeSchemaQueryVariables, type GameModelContainerTypesQuery, type GameModelContainerTypesQueryVariables, type GameModelPropertyDefsQuery, type GameModelPropertyDefsQueryVariables, type GameModelFunctionQuery, type GameModelFunctionQueryVariables, type GameModelFunctionsQuery, type GameModelFunctionsQueryVariables, type GameModelFeaturesQuery, type GameModelFeaturesQueryVariables, type GameModelTierFeaturesQuery, type GameModelTierFeaturesQueryVariables, type GameModelPolicyQuery, type GameModelPolicyQueryVariables, type GameModelRevokeTierFeatureMutation, type GameModelRevokeTierFeatureMutationVariables, type GameModelEventsConnectionQuery, type GameModelEventsConnectionQueryVariables, type GameModelUpsertAutomationMutation, type GameModelUpsertAutomationMutationVariables, type GameModelDeleteAutomationMutation, type GameModelDeleteAutomationMutationVariables, type GameModelSetAutomationEnabledMutation, type GameModelSetAutomationEnabledMutationVariables, type GameModelUpsertAutomationTriggerMutation, type GameModelUpsertAutomationTriggerMutationVariables, type GameModelDeleteAutomationTriggerMutation, type GameModelDeleteAutomationTriggerMutationVariables, type GameModelSetAutomationPolicyMutation, type GameModelSetAutomationPolicyMutationVariables, type GameModelRunAutomationMutation, type GameModelRunAutomationMutationVariables, type GameModelAutomationsQuery, type GameModelAutomationsQueryVariables, type GameModelAutomationQuery, type GameModelAutomationQueryVariables, type GameModelAutomationTriggersQuery, type GameModelAutomationTriggersQueryVariables, type GameModelAutomationPolicyQuery, type GameModelAutomationPolicyQueryVariables, type GameModelAutomationRunsQuery, type GameModelAutomationRunsQueryVariables, type GameModelAutomationStatsQuery, type GameModelAutomationStatsQueryVariables, type GameModelAppDiagnosticsQuery, type GameModelAppDiagnosticsQueryVariables, type GameModelScheduleInvokeMutation, type GameModelScheduleInvokeMutationVariables, type GameModelCancelTimerMutation, type GameModelCancelTimerMutationVariables, type GameModelTimersQuery, type GameModelTimersQueryVariables } from '../generated/graphql.js';
|
|
3
3
|
/**
|
|
4
4
|
* Abstract **game-model** sub-client on the **game-api** — a schema-driven,
|
|
5
5
|
* server-authoritative layer for modelling game/world logic on top of the
|
|
@@ -761,12 +761,26 @@ export declare class GameModelAPI {
|
|
|
761
761
|
/**
|
|
762
762
|
* **Automations** — create an event trigger that fires an automation in
|
|
763
763
|
* reaction to model activity (`function_invoked` | `property_changed` |
|
|
764
|
-
* `container_created`), matched in the API server
|
|
765
|
-
* app-admin **`manage_apps`** permission.
|
|
764
|
+
* `container_created` | `player_count_changed`), matched in the API server
|
|
765
|
+
* post-commit. Requires the app-admin **`manage_apps`** permission.
|
|
766
|
+
*
|
|
767
|
+
* Each event matches on its own filters, and a filter the event does not
|
|
768
|
+
* match on is rejected rather than silently never firing:
|
|
769
|
+
* `function_invoked` takes `functionName` and `containerTypeName` (the type
|
|
770
|
+
* of the invocation's `self` container); `property_changed` takes
|
|
771
|
+
* `containerTypeName`, `propertyKey`, and `writeSource`;
|
|
772
|
+
* `container_created` takes `containerTypeName`; `player_count_changed`
|
|
773
|
+
* takes none.
|
|
774
|
+
*
|
|
775
|
+
* `writeSource` decides which writes a `property_changed` trigger sees:
|
|
776
|
+
* `direct` (a {@link GameModelAPI.setProperty} call), `function` (a mutation
|
|
777
|
+
* applied inside an invoke, automation run, or timer fire), or `any`
|
|
778
|
+
* (default). Most game logic writes properties from inside functions, so a
|
|
779
|
+
* trigger watching such a property needs `function` or `any`.
|
|
766
780
|
*
|
|
767
781
|
* @param input - {@link UpsertAutomationTriggerInput}: `appId`,
|
|
768
|
-
* `automationName`, `onEvent`,
|
|
769
|
-
* `
|
|
782
|
+
* `automationName`, `onEvent`, the filters valid for that event, and
|
|
783
|
+
* `debounceMs`.
|
|
770
784
|
* @returns The created {@link GmAutomationTrigger}.
|
|
771
785
|
*/
|
|
772
786
|
upsertAutomationTrigger(input: GameModelUpsertAutomationTriggerMutationVariables['input']): Promise<GameModelUpsertAutomationTriggerMutation['gameModelUpsertAutomationTrigger']>;
|
|
@@ -781,7 +795,8 @@ export declare class GameModelAPI {
|
|
|
781
795
|
/**
|
|
782
796
|
* **Automations** — set the app's automation policy (platform guardrails: the
|
|
783
797
|
* kill switch, max automations, the minimum schedule interval floor, max
|
|
784
|
-
* fan-out, max event cascade depth,
|
|
798
|
+
* fan-out, max event cascade depth, the aggregate per-minute run ceiling, and
|
|
799
|
+
* the timer floor / pending-timer ceiling).
|
|
785
800
|
* Requires the app-admin **`manage_apps`** permission.
|
|
786
801
|
*
|
|
787
802
|
* @param input - {@link SetAutomationPolicyInput}.
|
|
@@ -818,6 +833,10 @@ export declare class GameModelAPI {
|
|
|
818
833
|
* **Automations** — list event triggers for an app, optionally filtered to one
|
|
819
834
|
* automation by name. Requires the app-admin **`manage_apps`** permission.
|
|
820
835
|
*
|
|
836
|
+
* Use this to debug a trigger that isn't firing: `warnings` reports filters
|
|
837
|
+
* that can never match, `lastMatchedAt` is null until the trigger has
|
|
838
|
+
* actually dispatched a run, and `matchCount24h` shows recent activity.
|
|
839
|
+
*
|
|
821
840
|
* @param variables - `{ appId, automationName? }`.
|
|
822
841
|
* @returns The {@link GmAutomationTrigger}s.
|
|
823
842
|
*/
|
|
@@ -859,5 +878,48 @@ export declare class GameModelAPI {
|
|
|
859
878
|
* @returns The {@link GmAppDiagnostics}.
|
|
860
879
|
*/
|
|
861
880
|
appDiagnostics(variables: GameModelAppDiagnosticsQueryVariables): Promise<GameModelAppDiagnosticsQuery['gameModelAppDiagnostics']>;
|
|
881
|
+
/**
|
|
882
|
+
* **Timers** — arm a one-shot timer: invoke a function once, after a delay.
|
|
883
|
+
* The timer is durable (it survives an API restart) and claimed by exactly one
|
|
884
|
+
* replica, so it fires once. Requires the app-admin **`manage_apps`**
|
|
885
|
+
* permission, because a timer fires headlessly with system authority rather
|
|
886
|
+
* than a player's.
|
|
887
|
+
*
|
|
888
|
+
* For player-driven delays, declare a `timers` effect on the function instead
|
|
889
|
+
* (see {@link GameModelAPI.upsertFunction}) so the delay is part of your game
|
|
890
|
+
* logic and is armed atomically with that invocation's mutations.
|
|
891
|
+
*
|
|
892
|
+
* The target function must be `autonomousInvocable`. Pass `dedupeKey` to make
|
|
893
|
+
* re-arming replace the pending timer instead of queueing another fire, which
|
|
894
|
+
* is how you implement "reset the countdown".
|
|
895
|
+
*
|
|
896
|
+
* @param input - {@link ScheduleInvokeInput}: `appId`, `functionName`,
|
|
897
|
+
* `selfContainerId`, `delayMs`, and optional `paramsJson`, `sessionId`, and
|
|
898
|
+
* `dedupeKey`.
|
|
899
|
+
* @returns The armed {@link GmTimer}.
|
|
900
|
+
*/
|
|
901
|
+
scheduleInvoke(input: GameModelScheduleInvokeMutationVariables['input']): Promise<GameModelScheduleInvokeMutation['gameModelScheduleInvoke']>;
|
|
902
|
+
/**
|
|
903
|
+
* **Timers** — cancel pending timers by id or by dedupe key. A timer already
|
|
904
|
+
* claimed for execution cannot be cancelled. Requires the app-admin
|
|
905
|
+
* **`manage_apps`** permission.
|
|
906
|
+
*
|
|
907
|
+
* @param variables - `{ appId, timerId?, dedupeKey? }` (supply at least one
|
|
908
|
+
* selector).
|
|
909
|
+
* @returns How many pending timers were removed.
|
|
910
|
+
*/
|
|
911
|
+
cancelTimer(variables: GameModelCancelTimerMutationVariables): Promise<GameModelCancelTimerMutation['gameModelCancelTimer']>;
|
|
912
|
+
/**
|
|
913
|
+
* **Timers** — list pending one-shot timers, soonest first. A timer leaves
|
|
914
|
+
* this list the instant it is claimed for execution, so an empty list means
|
|
915
|
+
* nothing is *scheduled* — not that nothing ran. Fires that already happened
|
|
916
|
+
* appear in {@link GameModelAPI.automationRuns} with
|
|
917
|
+
* `triggerSource: 'timer'`. Requires the app-admin **`manage_apps`**
|
|
918
|
+
* permission.
|
|
919
|
+
*
|
|
920
|
+
* @param variables - `{ appId, sessionId?, limit? }` (limit 1-200, default 50).
|
|
921
|
+
* @returns The pending {@link GmTimer}s.
|
|
922
|
+
*/
|
|
923
|
+
timers(variables: GameModelTimersQueryVariables): Promise<GameModelTimersQuery['gameModelTimers']>;
|
|
862
924
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