@wvdsh/sdk-js 0.0.33 → 0.0.34
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/dist/index.js +7449 -7447
- package/package.json +2 -13
- package/dist/index.d.mts +0 -1180
- package/dist/index.d.ts +0 -1180
- package/dist/index.global.js +0 -8041
- package/dist/index.mjs +0 -8033
package/dist/index.d.mts
DELETED
|
@@ -1,1180 +0,0 @@
|
|
|
1
|
-
import { ConvexClient } from 'convex/browser';
|
|
2
|
-
import { GenericId } from 'convex/values';
|
|
3
|
-
export { GenericId as Id } from 'convex/values';
|
|
4
|
-
import { FunctionReference, FunctionReturnType } from 'convex/server';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Default values used by Game SDKs
|
|
8
|
-
* These values are used externally, any changes need to be reflected in the Wavedash SDKs
|
|
9
|
-
*
|
|
10
|
-
* We use int values here rather than strings to speed up data marshalling in SDK calls
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
declare const GAME_ENGINE: {
|
|
14
|
-
readonly GODOT: "GODOT";
|
|
15
|
-
readonly UNITY: "UNITY";
|
|
16
|
-
readonly UNREAL: "UNREAL";
|
|
17
|
-
readonly CUSTOM: "CUSTOM";
|
|
18
|
-
};
|
|
19
|
-
declare const LOBBY_DEFAULTS: {
|
|
20
|
-
readonly MAX_PLAYERS: 100;
|
|
21
|
-
readonly EXPIRY_HOURS: 24;
|
|
22
|
-
readonly EXPIRY_MS: number;
|
|
23
|
-
};
|
|
24
|
-
declare const LOBBY_VISIBILITY: {
|
|
25
|
-
readonly PUBLIC: 0;
|
|
26
|
-
readonly FRIENDS_ONLY: 1;
|
|
27
|
-
readonly PRIVATE: 2;
|
|
28
|
-
};
|
|
29
|
-
declare const LOBBY_MESSAGE_MAX_LENGTH = 500;
|
|
30
|
-
declare const LEADERBOARD_SORT_ORDER: {
|
|
31
|
-
readonly ASC: 0;
|
|
32
|
-
readonly DESC: 1;
|
|
33
|
-
};
|
|
34
|
-
declare const LEADERBOARD_DISPLAY_TYPE: {
|
|
35
|
-
readonly NUMERIC: 0;
|
|
36
|
-
readonly TIME_SECONDS: 1;
|
|
37
|
-
readonly TIME_MILLISECONDS: 2;
|
|
38
|
-
};
|
|
39
|
-
declare const UGC_TYPE: {
|
|
40
|
-
readonly SCREENSHOT: 0;
|
|
41
|
-
readonly VIDEO: 1;
|
|
42
|
-
readonly COMMUNITY: 2;
|
|
43
|
-
readonly GAME_MANAGED: 3;
|
|
44
|
-
readonly OTHER: 4;
|
|
45
|
-
};
|
|
46
|
-
declare const UGC_VISIBILITY: {
|
|
47
|
-
readonly PUBLIC: 0;
|
|
48
|
-
readonly FRIENDS_ONLY: 1;
|
|
49
|
-
readonly PRIVATE: 2;
|
|
50
|
-
};
|
|
51
|
-
declare const UGC_UPLOAD_STATUS: {
|
|
52
|
-
readonly NOT_STARTED: 0;
|
|
53
|
-
readonly UPLOADING: 1;
|
|
54
|
-
readonly FAILED: 2;
|
|
55
|
-
readonly COMPLETED: 3;
|
|
56
|
-
};
|
|
57
|
-
declare const REMOTE_STORAGE: {
|
|
58
|
-
readonly DEFAULT_LIMIT_BYTES: number;
|
|
59
|
-
readonly UPLOADS_PER_MINUTE: 30;
|
|
60
|
-
readonly UPLOADS_PER_HOUR: 300;
|
|
61
|
-
};
|
|
62
|
-
declare const P2P_SIGNALING_MESSAGE_TYPE: {
|
|
63
|
-
readonly OFFER: "offer";
|
|
64
|
-
readonly ANSWER: "answer";
|
|
65
|
-
readonly ICE_CANDIDATE: "ice-candidate";
|
|
66
|
-
};
|
|
67
|
-
declare const GAME_AUTHORITY: {
|
|
68
|
-
readonly CLIENT: 0;
|
|
69
|
-
readonly SERVER: 1;
|
|
70
|
-
};
|
|
71
|
-
declare const STAT_TYPE: {
|
|
72
|
-
readonly INTEGER: 0;
|
|
73
|
-
readonly FLOAT: 1;
|
|
74
|
-
readonly AVG_RATE: 2;
|
|
75
|
-
};
|
|
76
|
-
declare const IFRAME_MESSAGE_TYPE: {
|
|
77
|
-
readonly GET_AUTH_TOKEN: "GetAuthToken";
|
|
78
|
-
readonly GET_SDK_CONFIG: "GetSDKConfig";
|
|
79
|
-
readonly PROGRESS_UPDATE: "ProgressUpdate";
|
|
80
|
-
readonly LOADING_COMPLETE: "LoadingComplete";
|
|
81
|
-
readonly TOGGLE_OVERLAY: "ToggleOverlay";
|
|
82
|
-
};
|
|
83
|
-
interface IFrameResponse<T> {
|
|
84
|
-
requestId: string;
|
|
85
|
-
requestType: (typeof IFRAME_MESSAGE_TYPE)[keyof typeof IFRAME_MESSAGE_TYPE];
|
|
86
|
-
data: T;
|
|
87
|
-
}
|
|
88
|
-
interface SDKUser {
|
|
89
|
-
id: GenericId<'users'>;
|
|
90
|
-
username: string;
|
|
91
|
-
}
|
|
92
|
-
interface SDKConfig {
|
|
93
|
-
convexCloudUrl: string;
|
|
94
|
-
wavedashUser: SDKUser;
|
|
95
|
-
gameCloudId: GenericId<'gameClouds'>;
|
|
96
|
-
ugcHost: string;
|
|
97
|
-
lobbyIdToJoin?: GenericId<'lobbies'>;
|
|
98
|
-
}
|
|
99
|
-
type IFrameResponseMap = {
|
|
100
|
-
[IFRAME_MESSAGE_TYPE.GET_AUTH_TOKEN]: string;
|
|
101
|
-
[IFRAME_MESSAGE_TYPE.GET_SDK_CONFIG]: SDKConfig;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
declare const Constants_GAME_AUTHORITY: typeof GAME_AUTHORITY;
|
|
105
|
-
declare const Constants_GAME_ENGINE: typeof GAME_ENGINE;
|
|
106
|
-
declare const Constants_IFRAME_MESSAGE_TYPE: typeof IFRAME_MESSAGE_TYPE;
|
|
107
|
-
type Constants_IFrameResponse<T> = IFrameResponse<T>;
|
|
108
|
-
type Constants_IFrameResponseMap = IFrameResponseMap;
|
|
109
|
-
declare const Constants_LEADERBOARD_DISPLAY_TYPE: typeof LEADERBOARD_DISPLAY_TYPE;
|
|
110
|
-
declare const Constants_LEADERBOARD_SORT_ORDER: typeof LEADERBOARD_SORT_ORDER;
|
|
111
|
-
declare const Constants_LOBBY_DEFAULTS: typeof LOBBY_DEFAULTS;
|
|
112
|
-
declare const Constants_LOBBY_MESSAGE_MAX_LENGTH: typeof LOBBY_MESSAGE_MAX_LENGTH;
|
|
113
|
-
declare const Constants_LOBBY_VISIBILITY: typeof LOBBY_VISIBILITY;
|
|
114
|
-
declare const Constants_P2P_SIGNALING_MESSAGE_TYPE: typeof P2P_SIGNALING_MESSAGE_TYPE;
|
|
115
|
-
declare const Constants_REMOTE_STORAGE: typeof REMOTE_STORAGE;
|
|
116
|
-
type Constants_SDKConfig = SDKConfig;
|
|
117
|
-
type Constants_SDKUser = SDKUser;
|
|
118
|
-
declare const Constants_STAT_TYPE: typeof STAT_TYPE;
|
|
119
|
-
declare const Constants_UGC_TYPE: typeof UGC_TYPE;
|
|
120
|
-
declare const Constants_UGC_UPLOAD_STATUS: typeof UGC_UPLOAD_STATUS;
|
|
121
|
-
declare const Constants_UGC_VISIBILITY: typeof UGC_VISIBILITY;
|
|
122
|
-
declare namespace Constants {
|
|
123
|
-
export { Constants_GAME_AUTHORITY as GAME_AUTHORITY, Constants_GAME_ENGINE as GAME_ENGINE, Constants_IFRAME_MESSAGE_TYPE as IFRAME_MESSAGE_TYPE, type Constants_IFrameResponse as IFrameResponse, type Constants_IFrameResponseMap as IFrameResponseMap, Constants_LEADERBOARD_DISPLAY_TYPE as LEADERBOARD_DISPLAY_TYPE, Constants_LEADERBOARD_SORT_ORDER as LEADERBOARD_SORT_ORDER, Constants_LOBBY_DEFAULTS as LOBBY_DEFAULTS, Constants_LOBBY_MESSAGE_MAX_LENGTH as LOBBY_MESSAGE_MAX_LENGTH, Constants_LOBBY_VISIBILITY as LOBBY_VISIBILITY, Constants_P2P_SIGNALING_MESSAGE_TYPE as P2P_SIGNALING_MESSAGE_TYPE, Constants_REMOTE_STORAGE as REMOTE_STORAGE, type Constants_SDKConfig as SDKConfig, type Constants_SDKUser as SDKUser, Constants_STAT_TYPE as STAT_TYPE, Constants_UGC_TYPE as UGC_TYPE, Constants_UGC_UPLOAD_STATUS as UGC_UPLOAD_STATUS, Constants_UGC_VISIBILITY as UGC_VISIBILITY };
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
declare const api: PublicApiType;
|
|
127
|
-
type PublicApiType = {
|
|
128
|
-
games: {
|
|
129
|
-
createCheckoutSession: FunctionReference<"action", "public", {
|
|
130
|
-
gameId: GenericId<"games">;
|
|
131
|
-
returnUrl: string;
|
|
132
|
-
}, any>;
|
|
133
|
-
createPlayKey: FunctionReference<"mutation", "public", {
|
|
134
|
-
gameBranchId?: GenericId<"gameBranches">;
|
|
135
|
-
gameBuildId?: GenericId<"gameBuilds">;
|
|
136
|
-
slug: string;
|
|
137
|
-
}, any>;
|
|
138
|
-
getPurchasedGameOrThrow: FunctionReference<"query", "public", {
|
|
139
|
-
gameId: GenericId<"games">;
|
|
140
|
-
}, any>;
|
|
141
|
-
listPurchased: FunctionReference<"query", "public", {
|
|
142
|
-
paginationOpts: {
|
|
143
|
-
cursor: string | null;
|
|
144
|
-
endCursor?: string | null;
|
|
145
|
-
id?: number;
|
|
146
|
-
maximumBytesRead?: number;
|
|
147
|
-
maximumRowsRead?: number;
|
|
148
|
-
numItems: number;
|
|
149
|
-
};
|
|
150
|
-
sortType?: "alphabetical" | "most-played" | "recently-played";
|
|
151
|
-
}, any>;
|
|
152
|
-
list: FunctionReference<"query", "public", {
|
|
153
|
-
paginationOpts: {
|
|
154
|
-
cursor: string | null;
|
|
155
|
-
endCursor?: string | null;
|
|
156
|
-
id?: number;
|
|
157
|
-
maximumBytesRead?: number;
|
|
158
|
-
maximumRowsRead?: number;
|
|
159
|
-
numItems: number;
|
|
160
|
-
};
|
|
161
|
-
}, any>;
|
|
162
|
-
getBySlug: FunctionReference<"query", "public", {
|
|
163
|
-
slug: string;
|
|
164
|
-
}, any>;
|
|
165
|
-
getGameAndAccess: FunctionReference<"query", "public", {
|
|
166
|
-
slug: string;
|
|
167
|
-
}, any>;
|
|
168
|
-
consumePlayKey: FunctionReference<"mutation", "public", {
|
|
169
|
-
playKeyIdOrCode: GenericId<"playKeys"> | string;
|
|
170
|
-
}, any>;
|
|
171
|
-
};
|
|
172
|
-
users: {
|
|
173
|
-
me: FunctionReference<"query", "public", Record<string, never>, any>;
|
|
174
|
-
};
|
|
175
|
-
gameLobby: {
|
|
176
|
-
createAndJoinLobby: FunctionReference<"mutation", "public", {
|
|
177
|
-
maxPlayers?: number;
|
|
178
|
-
visibility: 0 | 1 | 2;
|
|
179
|
-
}, GenericId<"lobbies">>;
|
|
180
|
-
getLobbyMetadata: FunctionReference<"query", "public", {
|
|
181
|
-
lobbyId: GenericId<"lobbies">;
|
|
182
|
-
}, Record<string, any>>;
|
|
183
|
-
joinLobby: FunctionReference<"mutation", "public", {
|
|
184
|
-
lobbyId: GenericId<"lobbies">;
|
|
185
|
-
}, boolean>;
|
|
186
|
-
leaveLobby: FunctionReference<"mutation", "public", {
|
|
187
|
-
lobbyId: GenericId<"lobbies">;
|
|
188
|
-
}, boolean>;
|
|
189
|
-
listAvailable: FunctionReference<"query", "public", {
|
|
190
|
-
filters?: Record<string, any>;
|
|
191
|
-
}, Array<{
|
|
192
|
-
lobbyId: GenericId<"lobbies">;
|
|
193
|
-
maxPlayers: number;
|
|
194
|
-
metadata: Record<string, any>;
|
|
195
|
-
playerCount: number;
|
|
196
|
-
visibility: 0 | 1 | 2;
|
|
197
|
-
}>>;
|
|
198
|
-
lobbyMessages: FunctionReference<"query", "public", {
|
|
199
|
-
lobbyId: GenericId<"lobbies">;
|
|
200
|
-
}, Array<{
|
|
201
|
-
lobbyId: GenericId<"lobbies">;
|
|
202
|
-
message: string;
|
|
203
|
-
messageId: GenericId<"lobbyMessages">;
|
|
204
|
-
timestamp: number;
|
|
205
|
-
userId: GenericId<"users">;
|
|
206
|
-
username: string;
|
|
207
|
-
}>>;
|
|
208
|
-
lobbyUsers: FunctionReference<"query", "public", {
|
|
209
|
-
lobbyId: GenericId<"lobbies">;
|
|
210
|
-
}, Array<{
|
|
211
|
-
isHost: boolean;
|
|
212
|
-
lobbyId: GenericId<"lobbies">;
|
|
213
|
-
userId: GenericId<"users">;
|
|
214
|
-
username: string;
|
|
215
|
-
}>>;
|
|
216
|
-
sendMessage: FunctionReference<"mutation", "public", {
|
|
217
|
-
lobbyId: GenericId<"lobbies">;
|
|
218
|
-
message: string;
|
|
219
|
-
}, string>;
|
|
220
|
-
setLobbyMetadata: FunctionReference<"mutation", "public", {
|
|
221
|
-
lobbyId: GenericId<"lobbies">;
|
|
222
|
-
updates: Record<string, any>;
|
|
223
|
-
}, boolean>;
|
|
224
|
-
};
|
|
225
|
-
auth: {
|
|
226
|
-
oauth: {
|
|
227
|
-
googleOAuthCallback: FunctionReference<"action", "public", {
|
|
228
|
-
allowAccountCreation: boolean;
|
|
229
|
-
code: string;
|
|
230
|
-
origin: string;
|
|
231
|
-
}, any>;
|
|
232
|
-
};
|
|
233
|
-
sessionTokens: {
|
|
234
|
-
authenticateUserForGame: FunctionReference<"mutation", "public", {
|
|
235
|
-
gameBranchId?: GenericId<"gameBranches">;
|
|
236
|
-
gameBuildId?: GenericId<"gameBuilds">;
|
|
237
|
-
gameSlug: string;
|
|
238
|
-
isSandbox?: boolean;
|
|
239
|
-
}, any>;
|
|
240
|
-
logout: FunctionReference<"mutation", "public", {
|
|
241
|
-
sessionToken: string;
|
|
242
|
-
}, any>;
|
|
243
|
-
refresh: FunctionReference<"mutation", "public", {
|
|
244
|
-
sessionToken: string;
|
|
245
|
-
}, any>;
|
|
246
|
-
};
|
|
247
|
-
emailPassword: {
|
|
248
|
-
changePassword: FunctionReference<"mutation", "public", {
|
|
249
|
-
currentPassword: string;
|
|
250
|
-
newPassword: string;
|
|
251
|
-
}, any>;
|
|
252
|
-
sendVerificationEmail: FunctionReference<"mutation", "public", Record<string, never>, any>;
|
|
253
|
-
signUp: FunctionReference<"mutation", "public", {
|
|
254
|
-
email: string;
|
|
255
|
-
password: string;
|
|
256
|
-
}, any>;
|
|
257
|
-
signIn: FunctionReference<"mutation", "public", {
|
|
258
|
-
email: string;
|
|
259
|
-
password: string;
|
|
260
|
-
}, any>;
|
|
261
|
-
verifyEmail: FunctionReference<"mutation", "public", {
|
|
262
|
-
token: string;
|
|
263
|
-
}, any>;
|
|
264
|
-
requestPasswordReset: FunctionReference<"mutation", "public", {
|
|
265
|
-
email: string;
|
|
266
|
-
}, any>;
|
|
267
|
-
resetPassword: FunctionReference<"mutation", "public", {
|
|
268
|
-
newPassword: string;
|
|
269
|
-
token: string;
|
|
270
|
-
}, any>;
|
|
271
|
-
};
|
|
272
|
-
linking: {
|
|
273
|
-
getLinkedAuthMethods: FunctionReference<"query", "public", Record<string, never>, any>;
|
|
274
|
-
linkEmailPassword: FunctionReference<"mutation", "public", {
|
|
275
|
-
email: string;
|
|
276
|
-
password: string;
|
|
277
|
-
}, any>;
|
|
278
|
-
linkOAuthAccount: FunctionReference<"mutation", "public", {
|
|
279
|
-
provider: "google";
|
|
280
|
-
providerAccountId: string;
|
|
281
|
-
providerEmail: string;
|
|
282
|
-
}, any>;
|
|
283
|
-
unlinkAuthMethod: FunctionReference<"mutation", "public", {
|
|
284
|
-
method: "email_password" | string;
|
|
285
|
-
}, any>;
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
ugcAccess: {
|
|
289
|
-
getUGCMetadata: FunctionReference<"query", "public", {
|
|
290
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
291
|
-
}, {
|
|
292
|
-
_creationTime: number;
|
|
293
|
-
_id: GenericId<"userGeneratedContent">;
|
|
294
|
-
canAccess: boolean;
|
|
295
|
-
description?: string;
|
|
296
|
-
title?: string;
|
|
297
|
-
ugcType: 0 | 1 | 2 | 3 | 4;
|
|
298
|
-
userId: GenericId<"users">;
|
|
299
|
-
visibility: 0 | 1 | 2;
|
|
300
|
-
} | null>;
|
|
301
|
-
};
|
|
302
|
-
userGeneratedContent: {
|
|
303
|
-
createUGCItem: FunctionReference<"mutation", "public", {
|
|
304
|
-
createPresignedUploadUrl?: boolean;
|
|
305
|
-
description?: string;
|
|
306
|
-
title?: string;
|
|
307
|
-
ugcType: 0 | 1 | 2 | 3 | 4;
|
|
308
|
-
visibility?: 0 | 1 | 2;
|
|
309
|
-
}, {
|
|
310
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
311
|
-
uploadUrl?: string;
|
|
312
|
-
}>;
|
|
313
|
-
startUGCUpload: FunctionReference<"mutation", "public", {
|
|
314
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
315
|
-
}, string>;
|
|
316
|
-
finishUGCUpload: FunctionReference<"mutation", "public", {
|
|
317
|
-
success: boolean;
|
|
318
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
319
|
-
}, boolean>;
|
|
320
|
-
getUGCItemDownloadUrl: FunctionReference<"query", "public", {
|
|
321
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
322
|
-
}, string>;
|
|
323
|
-
updateUGCItem: FunctionReference<"mutation", "public", {
|
|
324
|
-
createPresignedUploadUrl?: boolean;
|
|
325
|
-
description?: string;
|
|
326
|
-
title?: string;
|
|
327
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
328
|
-
visibility?: 0 | 1 | 2;
|
|
329
|
-
}, {
|
|
330
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
331
|
-
uploadUrl?: string;
|
|
332
|
-
}>;
|
|
333
|
-
deleteUGCItem: FunctionReference<"mutation", "public", {
|
|
334
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
335
|
-
}, boolean>;
|
|
336
|
-
};
|
|
337
|
-
leaderboards: {
|
|
338
|
-
attachLeaderboardUGC: FunctionReference<"mutation", "public", {
|
|
339
|
-
leaderboardId: GenericId<"leaderboards">;
|
|
340
|
-
ugcId: GenericId<"userGeneratedContent">;
|
|
341
|
-
}, boolean>;
|
|
342
|
-
getLeaderboard: FunctionReference<"query", "public", {
|
|
343
|
-
name: string;
|
|
344
|
-
}, {
|
|
345
|
-
id: GenericId<"leaderboards">;
|
|
346
|
-
name: string;
|
|
347
|
-
totalEntries: number;
|
|
348
|
-
}>;
|
|
349
|
-
getLeaderboardEntries: FunctionReference<"query", "public", {
|
|
350
|
-
leaderboardId: GenericId<"leaderboards">;
|
|
351
|
-
limit?: number;
|
|
352
|
-
}, any>;
|
|
353
|
-
getLeaderboardsForGame: FunctionReference<"query", "public", {
|
|
354
|
-
gameId: GenericId<"games">;
|
|
355
|
-
}, any>;
|
|
356
|
-
getMyLeaderboardEntry: FunctionReference<"query", "public", {
|
|
357
|
-
leaderboardId: GenericId<"leaderboards">;
|
|
358
|
-
}, {
|
|
359
|
-
entry: null | {
|
|
360
|
-
globalRank: number;
|
|
361
|
-
metadata?: ArrayBuffer;
|
|
362
|
-
score: number;
|
|
363
|
-
timestamp: number;
|
|
364
|
-
ugcId?: GenericId<"userGeneratedContent">;
|
|
365
|
-
};
|
|
366
|
-
totalEntries: number;
|
|
367
|
-
}>;
|
|
368
|
-
getOrCreateLeaderboard: FunctionReference<"mutation", "public", {
|
|
369
|
-
displayType?: 0 | 1 | 2;
|
|
370
|
-
name: string;
|
|
371
|
-
sortOrder?: 0 | 1;
|
|
372
|
-
}, {
|
|
373
|
-
created: boolean;
|
|
374
|
-
id: GenericId<"leaderboards">;
|
|
375
|
-
name: string;
|
|
376
|
-
totalEntries: number;
|
|
377
|
-
}>;
|
|
378
|
-
listEntries: FunctionReference<"query", "public", {
|
|
379
|
-
leaderboardId: GenericId<"leaderboards">;
|
|
380
|
-
limit: number;
|
|
381
|
-
offset: number;
|
|
382
|
-
}, {
|
|
383
|
-
entries: Array<{
|
|
384
|
-
globalRank: number;
|
|
385
|
-
metadata?: ArrayBuffer;
|
|
386
|
-
score: number;
|
|
387
|
-
timestamp: number;
|
|
388
|
-
ugcId?: GenericId<"userGeneratedContent">;
|
|
389
|
-
userId: GenericId<"users">;
|
|
390
|
-
username?: string;
|
|
391
|
-
}>;
|
|
392
|
-
totalEntries: number;
|
|
393
|
-
}>;
|
|
394
|
-
listEntriesAroundUser: FunctionReference<"query", "public", {
|
|
395
|
-
countAhead: number;
|
|
396
|
-
countBehind: number;
|
|
397
|
-
leaderboardId: GenericId<"leaderboards">;
|
|
398
|
-
}, {
|
|
399
|
-
entries: Array<{
|
|
400
|
-
globalRank: number;
|
|
401
|
-
metadata?: ArrayBuffer;
|
|
402
|
-
score: number;
|
|
403
|
-
timestamp: number;
|
|
404
|
-
ugcId?: GenericId<"userGeneratedContent">;
|
|
405
|
-
userId: GenericId<"users">;
|
|
406
|
-
username?: string;
|
|
407
|
-
}>;
|
|
408
|
-
totalEntries: number;
|
|
409
|
-
}>;
|
|
410
|
-
upsertLeaderboardEntry: FunctionReference<"mutation", "public", {
|
|
411
|
-
keepBest: boolean;
|
|
412
|
-
leaderboardId: GenericId<"leaderboards">;
|
|
413
|
-
score: number;
|
|
414
|
-
ugcId?: GenericId<"userGeneratedContent">;
|
|
415
|
-
}, {
|
|
416
|
-
entry: {
|
|
417
|
-
entryId: GenericId<"leaderboardEntries">;
|
|
418
|
-
globalRank: number;
|
|
419
|
-
score: number;
|
|
420
|
-
scoreChanged: boolean;
|
|
421
|
-
};
|
|
422
|
-
totalEntries: number;
|
|
423
|
-
}>;
|
|
424
|
-
};
|
|
425
|
-
developers: {
|
|
426
|
-
organizations: {
|
|
427
|
-
list: FunctionReference<"query", "public", any, any>;
|
|
428
|
-
get: FunctionReference<"query", "public", {
|
|
429
|
-
orgId: GenericId<"organizations">;
|
|
430
|
-
}, any>;
|
|
431
|
-
create: FunctionReference<"mutation", "public", {
|
|
432
|
-
name: string;
|
|
433
|
-
}, any>;
|
|
434
|
-
update: FunctionReference<"mutation", "public", {
|
|
435
|
-
name: string;
|
|
436
|
-
orgId: GenericId<"organizations">;
|
|
437
|
-
}, any>;
|
|
438
|
-
del: FunctionReference<"mutation", "public", {
|
|
439
|
-
orgId: GenericId<"organizations">;
|
|
440
|
-
}, any>;
|
|
441
|
-
switchTo: FunctionReference<"mutation", "public", {
|
|
442
|
-
orgId: GenericId<"organizations">;
|
|
443
|
-
}, any>;
|
|
444
|
-
};
|
|
445
|
-
games: {
|
|
446
|
-
list: FunctionReference<"query", "public", {
|
|
447
|
-
orgId: GenericId<"organizations">;
|
|
448
|
-
}, any>;
|
|
449
|
-
get: FunctionReference<"query", "public", {
|
|
450
|
-
gameId: GenericId<"games">;
|
|
451
|
-
}, any>;
|
|
452
|
-
create: FunctionReference<"mutation", "public", {
|
|
453
|
-
orgId: GenericId<"organizations">;
|
|
454
|
-
title: string;
|
|
455
|
-
}, any>;
|
|
456
|
-
del: FunctionReference<"mutation", "public", {
|
|
457
|
-
gameId: GenericId<"games">;
|
|
458
|
-
}, any>;
|
|
459
|
-
update: FunctionReference<"mutation", "public", {
|
|
460
|
-
gameId: GenericId<"games">;
|
|
461
|
-
title: string;
|
|
462
|
-
}, any>;
|
|
463
|
-
switchTo: FunctionReference<"mutation", "public", {
|
|
464
|
-
gameId: GenericId<"games">;
|
|
465
|
-
}, any>;
|
|
466
|
-
};
|
|
467
|
-
apiKeys: {
|
|
468
|
-
list: FunctionReference<"query", "public", Record<string, never>, any>;
|
|
469
|
-
create: FunctionReference<"mutation", "public", {
|
|
470
|
-
name: string;
|
|
471
|
-
}, any>;
|
|
472
|
-
del: FunctionReference<"mutation", "public", {
|
|
473
|
-
keyId: GenericId<"apiKeys">;
|
|
474
|
-
}, any>;
|
|
475
|
-
};
|
|
476
|
-
gameBranches: {
|
|
477
|
-
list: FunctionReference<"query", "public", {
|
|
478
|
-
gameId: GenericId<"games">;
|
|
479
|
-
}, any>;
|
|
480
|
-
listAvailable: FunctionReference<"query", "public", {
|
|
481
|
-
gameId: GenericId<"games">;
|
|
482
|
-
}, any>;
|
|
483
|
-
listClouds: FunctionReference<"query", "public", Record<string, never>, any>;
|
|
484
|
-
get: FunctionReference<"query", "public", {
|
|
485
|
-
gameBranchId: GenericId<"gameBranches">;
|
|
486
|
-
}, any>;
|
|
487
|
-
create: FunctionReference<"mutation", "public", {
|
|
488
|
-
gameCloud: "SANDBOX" | "PRODUCTION";
|
|
489
|
-
gameId: GenericId<"games">;
|
|
490
|
-
type: "INTERNAL" | "PRODUCTION" | "DEMO" | "PLAYTEST" | "ALPHA" | "BETA";
|
|
491
|
-
}, any>;
|
|
492
|
-
switchTo: FunctionReference<"mutation", "public", {
|
|
493
|
-
gameBranchId: GenericId<"gameBranches">;
|
|
494
|
-
}, any>;
|
|
495
|
-
};
|
|
496
|
-
gameBuilds: {
|
|
497
|
-
list: FunctionReference<"query", "public", {
|
|
498
|
-
gameBranchId: GenericId<"gameBranches">;
|
|
499
|
-
paginationOpts: {
|
|
500
|
-
cursor: string | null;
|
|
501
|
-
endCursor?: string | null;
|
|
502
|
-
id?: number;
|
|
503
|
-
maximumBytesRead?: number;
|
|
504
|
-
maximumRowsRead?: number;
|
|
505
|
-
numItems: number;
|
|
506
|
-
};
|
|
507
|
-
}, any>;
|
|
508
|
-
del: FunctionReference<"mutation", "public", {
|
|
509
|
-
buildId: GenericId<"gameBuilds">;
|
|
510
|
-
}, any>;
|
|
511
|
-
};
|
|
512
|
-
};
|
|
513
|
-
organizations: {
|
|
514
|
-
getBySlug: FunctionReference<"query", "public", {
|
|
515
|
-
slug: string;
|
|
516
|
-
}, any>;
|
|
517
|
-
get: FunctionReference<"query", "public", {
|
|
518
|
-
orgId: GenericId<"organizations">;
|
|
519
|
-
}, any>;
|
|
520
|
-
};
|
|
521
|
-
p2pSignaling: {
|
|
522
|
-
sendSignalingMessage: FunctionReference<"mutation", "public", {
|
|
523
|
-
data: any;
|
|
524
|
-
lobbyId: GenericId<"lobbies">;
|
|
525
|
-
messageType: "offer" | "answer" | "ice-candidate";
|
|
526
|
-
toUserId: GenericId<"users">;
|
|
527
|
-
}, any>;
|
|
528
|
-
getSignalingMessages: FunctionReference<"query", "public", {
|
|
529
|
-
lobbyId: GenericId<"lobbies">;
|
|
530
|
-
}, any>;
|
|
531
|
-
markSignalingMessagesProcessed: FunctionReference<"mutation", "public", {
|
|
532
|
-
messageIds: Array<GenericId<"p2pSignalingMessages">>;
|
|
533
|
-
}, any>;
|
|
534
|
-
};
|
|
535
|
-
remoteFileStorage: {
|
|
536
|
-
getUploadUrl: FunctionReference<"mutation", "public", {
|
|
537
|
-
path: string;
|
|
538
|
-
}, string>;
|
|
539
|
-
};
|
|
540
|
-
presence: {
|
|
541
|
-
heartbeat: FunctionReference<"mutation", "public", {
|
|
542
|
-
browsingSection?: string | null;
|
|
543
|
-
data?: Record<string, any>;
|
|
544
|
-
gameCloudId?: GenericId<"gameClouds">;
|
|
545
|
-
}, any>;
|
|
546
|
-
myActivePresence: FunctionReference<"query", "public", any, {
|
|
547
|
-
avatarUrl?: string;
|
|
548
|
-
browsingSection?: string;
|
|
549
|
-
currentlyActive: boolean;
|
|
550
|
-
gameName?: string;
|
|
551
|
-
lastActiveAt?: number;
|
|
552
|
-
presenceType: 5 | 10;
|
|
553
|
-
userId: GenericId<"users">;
|
|
554
|
-
username: string;
|
|
555
|
-
}>;
|
|
556
|
-
listOnlineFriends: FunctionReference<"query", "public", any, Array<{
|
|
557
|
-
avatarUrl?: string;
|
|
558
|
-
browsingSection?: string;
|
|
559
|
-
currentlyActive: boolean;
|
|
560
|
-
gameName?: string;
|
|
561
|
-
lastActiveAt?: number;
|
|
562
|
-
presenceType: 5 | 10;
|
|
563
|
-
userId: GenericId<"users">;
|
|
564
|
-
username: string;
|
|
565
|
-
}>>;
|
|
566
|
-
listOfflineFriends: FunctionReference<"query", "public", any, Array<{
|
|
567
|
-
avatarUrl?: string;
|
|
568
|
-
browsingSection?: string;
|
|
569
|
-
currentlyActive: boolean;
|
|
570
|
-
gameName?: string;
|
|
571
|
-
lastActiveAt?: number;
|
|
572
|
-
presenceType: 5 | 10;
|
|
573
|
-
userId: GenericId<"users">;
|
|
574
|
-
username: string;
|
|
575
|
-
}>>;
|
|
576
|
-
endUserPresence: FunctionReference<"mutation", "public", {
|
|
577
|
-
gameCloudId?: GenericId<"gameClouds">;
|
|
578
|
-
}, any>;
|
|
579
|
-
};
|
|
580
|
-
gameAchievements: {
|
|
581
|
-
getAllAchievementsWithProgress: FunctionReference<"query", "public", {
|
|
582
|
-
gameCloudId: GenericId<"gameClouds">;
|
|
583
|
-
}, Array<{
|
|
584
|
-
achievement: {
|
|
585
|
-
_id: GenericId<"gameAchievements">;
|
|
586
|
-
description: string;
|
|
587
|
-
displayName: string;
|
|
588
|
-
image: string;
|
|
589
|
-
points: number;
|
|
590
|
-
};
|
|
591
|
-
completedAt?: number;
|
|
592
|
-
currentValue?: number;
|
|
593
|
-
isCompleted: boolean;
|
|
594
|
-
targetValue?: number;
|
|
595
|
-
}>>;
|
|
596
|
-
getMyStatsForGame: FunctionReference<"query", "public", Record<string, never>, Array<{
|
|
597
|
-
identifier: string;
|
|
598
|
-
value: number;
|
|
599
|
-
}>>;
|
|
600
|
-
getTotalPointsForUserAndGame: FunctionReference<"query", "public", Record<string, never>, number>;
|
|
601
|
-
setUserGameAchievements: FunctionReference<"mutation", "public", {
|
|
602
|
-
achievements: Array<string>;
|
|
603
|
-
}, any>;
|
|
604
|
-
setUserGameStats: FunctionReference<"mutation", "public", {
|
|
605
|
-
stats: Array<{
|
|
606
|
-
identifier: string;
|
|
607
|
-
value: number;
|
|
608
|
-
}>;
|
|
609
|
-
}, any>;
|
|
610
|
-
getMyAchievementsForGame: FunctionReference<"query", "public", {
|
|
611
|
-
gameCloudId?: GenericId<"gameClouds">;
|
|
612
|
-
since?: number;
|
|
613
|
-
}, Array<{
|
|
614
|
-
achievement: {
|
|
615
|
-
_creationTime: number;
|
|
616
|
-
_id: GenericId<"gameAchievements">;
|
|
617
|
-
description: string;
|
|
618
|
-
displayName: string;
|
|
619
|
-
identifier: string;
|
|
620
|
-
image: string;
|
|
621
|
-
points: number;
|
|
622
|
-
};
|
|
623
|
-
completedAt: number;
|
|
624
|
-
}>>;
|
|
625
|
-
getAchievementsForGame: FunctionReference<"query", "public", {
|
|
626
|
-
gameId: GenericId<"games">;
|
|
627
|
-
}, any>;
|
|
628
|
-
getTotalPointsForUser: FunctionReference<"query", "public", {
|
|
629
|
-
userId: GenericId<"users">;
|
|
630
|
-
}, number>;
|
|
631
|
-
};
|
|
632
|
-
userTracking: {
|
|
633
|
-
getLastPlayedAt: FunctionReference<"query", "public", {
|
|
634
|
-
gameCloudId: GenericId<"gameClouds">;
|
|
635
|
-
userId: GenericId<"users">;
|
|
636
|
-
}, number | null>;
|
|
637
|
-
getTotalPlaytimeByGame: FunctionReference<"query", "public", {
|
|
638
|
-
gameCloudId: GenericId<"gameClouds">;
|
|
639
|
-
}, number>;
|
|
640
|
-
getTotalPlaytimeByUser: FunctionReference<"query", "public", {
|
|
641
|
-
userId: GenericId<"users">;
|
|
642
|
-
}, number>;
|
|
643
|
-
getTotalPlaytimeByUserAndGame: FunctionReference<"query", "public", {
|
|
644
|
-
gameCloudId: GenericId<"gameClouds">;
|
|
645
|
-
userId: GenericId<"users">;
|
|
646
|
-
}, number>;
|
|
647
|
-
};
|
|
648
|
-
stripe: {
|
|
649
|
-
checkout: {
|
|
650
|
-
createCheckoutSession: FunctionReference<"action", "public", {
|
|
651
|
-
gameId: GenericId<"games">;
|
|
652
|
-
returnUrl: string;
|
|
653
|
-
}, any>;
|
|
654
|
-
};
|
|
655
|
-
};
|
|
656
|
-
turnCredentials: {
|
|
657
|
-
getTurnCredentials: FunctionReference<"query", "public", Record<string, never>, {
|
|
658
|
-
expiresAt: number;
|
|
659
|
-
iceServers: Array<{
|
|
660
|
-
credential?: string;
|
|
661
|
-
url?: string;
|
|
662
|
-
urls: string | Array<string>;
|
|
663
|
-
username?: string;
|
|
664
|
-
}>;
|
|
665
|
-
} | null>;
|
|
666
|
-
refreshTurnCredentials: FunctionReference<"action", "public", Record<string, never>, any>;
|
|
667
|
-
};
|
|
668
|
-
gameReviews: {
|
|
669
|
-
getReviewStats: FunctionReference<"query", "public", {
|
|
670
|
-
gameId: GenericId<"games">;
|
|
671
|
-
}, any>;
|
|
672
|
-
getReviewsForGame: FunctionReference<"query", "public", {
|
|
673
|
-
gameId: GenericId<"games">;
|
|
674
|
-
}, any>;
|
|
675
|
-
};
|
|
676
|
-
wishlist: {
|
|
677
|
-
add: FunctionReference<"mutation", "public", {
|
|
678
|
-
gameId: GenericId<"games">;
|
|
679
|
-
}, any>;
|
|
680
|
-
isInWishlist: FunctionReference<"query", "public", {
|
|
681
|
-
gameId: GenericId<"games">;
|
|
682
|
-
}, any>;
|
|
683
|
-
list: FunctionReference<"query", "public", {
|
|
684
|
-
paginationOpts: {
|
|
685
|
-
cursor: string | null;
|
|
686
|
-
endCursor?: string | null;
|
|
687
|
-
id?: number;
|
|
688
|
-
maximumBytesRead?: number;
|
|
689
|
-
maximumRowsRead?: number;
|
|
690
|
-
numItems: number;
|
|
691
|
-
};
|
|
692
|
-
}, any>;
|
|
693
|
-
remove: FunctionReference<"mutation", "public", {
|
|
694
|
-
gameId: GenericId<"games">;
|
|
695
|
-
}, any>;
|
|
696
|
-
};
|
|
697
|
-
account: {
|
|
698
|
-
cancelEmailChange: FunctionReference<"mutation", "public", Record<string, never>, any>;
|
|
699
|
-
deleteAccount: FunctionReference<"mutation", "public", Record<string, never>, any>;
|
|
700
|
-
resendEmailChangeVerification: FunctionReference<"mutation", "public", Record<string, never>, any>;
|
|
701
|
-
updateEmail: FunctionReference<"mutation", "public", {
|
|
702
|
-
newEmail: string;
|
|
703
|
-
}, any>;
|
|
704
|
-
updateUsername: FunctionReference<"mutation", "public", {
|
|
705
|
-
newUsername: string;
|
|
706
|
-
}, any>;
|
|
707
|
-
verifyEmailChange: FunctionReference<"mutation", "public", {
|
|
708
|
-
token: string;
|
|
709
|
-
}, any>;
|
|
710
|
-
};
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* SDK-to-Engine Signals
|
|
715
|
-
*
|
|
716
|
-
* Defines all signals that the SDK sends to the game engine.
|
|
717
|
-
* These are maintained manually in the SDK (not autogenerated from backend).
|
|
718
|
-
*
|
|
719
|
-
* The game engine listens for these signals to react to SDK events.
|
|
720
|
-
*/
|
|
721
|
-
declare const Signals: {
|
|
722
|
-
readonly LOBBY_MESSAGE: "LobbyMessage";
|
|
723
|
-
readonly LOBBY_KICKED: "LobbyKicked";
|
|
724
|
-
readonly LOBBY_JOINED: "LobbyJoined";
|
|
725
|
-
readonly LOBBY_USERS_UPDATED: "LobbyUsersUpdated";
|
|
726
|
-
readonly LOBBY_DATA_UPDATED: "LobbyDataUpdated";
|
|
727
|
-
readonly P2P_MESSAGE: "P2PMessage";
|
|
728
|
-
readonly P2P_CONNECTION_ESTABLISHED: "P2PConnectionEstablished";
|
|
729
|
-
readonly P2P_CONNECTION_FAILED: "P2PConnectionFailed";
|
|
730
|
-
readonly P2P_PEER_DISCONNECTED: "P2PPeerDisconnected";
|
|
731
|
-
readonly BACKEND_CONNECTED: "BackendConnected";
|
|
732
|
-
readonly BACKEND_DISCONNECTED: "BackendDisconnected";
|
|
733
|
-
readonly BACKEND_RECONNECTING: "BackendReconnecting";
|
|
734
|
-
};
|
|
735
|
-
|
|
736
|
-
type LobbyVisibility = PublicApiType["gameLobby"]["createAndJoinLobby"]["_args"]["visibility"];
|
|
737
|
-
type LobbyUser = FunctionReturnType<typeof api.gameLobby.lobbyUsers>[0];
|
|
738
|
-
type LobbyMessage = FunctionReturnType<typeof api.gameLobby.lobbyMessages>[0];
|
|
739
|
-
type Lobby = FunctionReturnType<typeof api.gameLobby.listAvailable>[0];
|
|
740
|
-
type UGCType = PublicApiType["userGeneratedContent"]["createUGCItem"]["_args"]["ugcType"];
|
|
741
|
-
type UGCVisibility = PublicApiType["userGeneratedContent"]["createUGCItem"]["_args"]["visibility"];
|
|
742
|
-
type LeaderboardSortOrder = PublicApiType["leaderboards"]["getOrCreateLeaderboard"]["_args"]["sortOrder"];
|
|
743
|
-
type LeaderboardDisplayType = PublicApiType["leaderboards"]["getOrCreateLeaderboard"]["_args"]["displayType"];
|
|
744
|
-
type Leaderboard = FunctionReturnType<typeof api.leaderboards.getLeaderboard>;
|
|
745
|
-
type LeaderboardEntries = FunctionReturnType<typeof api.leaderboards.listEntriesAroundUser>["entries"];
|
|
746
|
-
type UpsertedLeaderboardEntry = FunctionReturnType<typeof api.leaderboards.upsertLeaderboardEntry>["entry"] & {
|
|
747
|
-
userId: GenericId<"users">;
|
|
748
|
-
username: string;
|
|
749
|
-
};
|
|
750
|
-
type P2PTurnCredentials = FunctionReturnType<typeof api.turnCredentials.getTurnCredentials>;
|
|
751
|
-
type Signal = (typeof Signals)[keyof typeof Signals];
|
|
752
|
-
interface WavedashConfig {
|
|
753
|
-
gameId: GenericId<"games">;
|
|
754
|
-
debug?: boolean;
|
|
755
|
-
remoteStorageOrigin?: string;
|
|
756
|
-
p2p?: Partial<P2PConfig>;
|
|
757
|
-
}
|
|
758
|
-
interface RemoteFileMetadata {
|
|
759
|
-
exists: boolean;
|
|
760
|
-
key: string;
|
|
761
|
-
name: string;
|
|
762
|
-
lastModified: number;
|
|
763
|
-
size: number;
|
|
764
|
-
etag: string;
|
|
765
|
-
}
|
|
766
|
-
interface EngineInstance {
|
|
767
|
-
type: (typeof GAME_ENGINE)[keyof typeof GAME_ENGINE];
|
|
768
|
-
SendMessage(objectName: string, methodName: Signal, value?: string | number | boolean): void;
|
|
769
|
-
FS: {
|
|
770
|
-
readFile(path: string, opts?: Record<string, any>): string | Uint8Array;
|
|
771
|
-
writeFile(path: string, data: string | ArrayBufferView, opts?: Record<string, any>): void;
|
|
772
|
-
mkdirTree(path: string, mode?: number): void;
|
|
773
|
-
syncfs(populate: boolean, callback?: (err: any) => void): void;
|
|
774
|
-
analyzePath(path: string): {
|
|
775
|
-
exists: boolean;
|
|
776
|
-
};
|
|
777
|
-
};
|
|
778
|
-
}
|
|
779
|
-
interface WavedashResponse<T> {
|
|
780
|
-
success: boolean;
|
|
781
|
-
data: T | null;
|
|
782
|
-
args: Record<string, any>;
|
|
783
|
-
message?: string;
|
|
784
|
-
}
|
|
785
|
-
interface P2PPeer {
|
|
786
|
-
userId: GenericId<"users">;
|
|
787
|
-
username: string;
|
|
788
|
-
}
|
|
789
|
-
interface P2PConnection {
|
|
790
|
-
lobbyId: GenericId<"lobbies">;
|
|
791
|
-
peers: Record<GenericId<"users">, P2PPeer>;
|
|
792
|
-
state: P2PConnectionState;
|
|
793
|
-
}
|
|
794
|
-
type P2PConnectionState = "connecting" | "connected" | "disconnected" | "failed";
|
|
795
|
-
interface P2PMessage {
|
|
796
|
-
fromUserId: GenericId<"users">;
|
|
797
|
-
channel: number;
|
|
798
|
-
payload: Uint8Array;
|
|
799
|
-
}
|
|
800
|
-
interface P2PSignalingMessage {
|
|
801
|
-
type: (typeof P2P_SIGNALING_MESSAGE_TYPE)[keyof typeof P2P_SIGNALING_MESSAGE_TYPE];
|
|
802
|
-
fromUserId?: GenericId<"users">;
|
|
803
|
-
toUserId: GenericId<"users">;
|
|
804
|
-
data: any;
|
|
805
|
-
}
|
|
806
|
-
interface P2PConfig {
|
|
807
|
-
maxPeers: number;
|
|
808
|
-
enableReliableChannel: boolean;
|
|
809
|
-
enableUnreliableChannel: boolean;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/**
|
|
813
|
-
* Lobby service
|
|
814
|
-
*
|
|
815
|
-
* Implements each of the lobby methods of the Wavedash SDK
|
|
816
|
-
*/
|
|
817
|
-
|
|
818
|
-
declare class LobbyManager {
|
|
819
|
-
private sdk;
|
|
820
|
-
private unsubscribeLobbyMessages;
|
|
821
|
-
private unsubscribeLobbyUsers;
|
|
822
|
-
private unsubscribeLobbyData;
|
|
823
|
-
private lobbyId;
|
|
824
|
-
private lobbyUsers;
|
|
825
|
-
private lobbyHostId;
|
|
826
|
-
private lobbyMetadata;
|
|
827
|
-
private recentMessageIds;
|
|
828
|
-
private lobbyDataUpdateTimeout;
|
|
829
|
-
private maybeBeingDeletedLobbyIds;
|
|
830
|
-
private resetMaybeBeingDeletedLobbyIdTimeouts;
|
|
831
|
-
private cachedLobbies;
|
|
832
|
-
constructor(sdk: WavedashSDK);
|
|
833
|
-
createLobby(visibility: LobbyVisibility, maxPlayers?: number): Promise<WavedashResponse<GenericId<"lobbies">>>;
|
|
834
|
-
/**
|
|
835
|
-
* Join a lobby
|
|
836
|
-
* @param lobbyId - The ID of the lobby to join
|
|
837
|
-
* @returns A WavedashResponse containing the lobby ID
|
|
838
|
-
* @emits LOBBY_JOINED signal to the game engine
|
|
839
|
-
*/
|
|
840
|
-
joinLobby(lobbyId: GenericId<"lobbies">): Promise<WavedashResponse<GenericId<"lobbies">>>;
|
|
841
|
-
getLobbyUsers(lobbyId: GenericId<"lobbies">): LobbyUser[];
|
|
842
|
-
getHostId(lobbyId: GenericId<"lobbies">): GenericId<"users"> | null;
|
|
843
|
-
getLobbyData(lobbyId: GenericId<"lobbies">, key: string): string;
|
|
844
|
-
setLobbyData(lobbyId: GenericId<"lobbies">, key: string, value: any): boolean;
|
|
845
|
-
getLobbyMaxPlayers(lobbyId: GenericId<"lobbies">): number;
|
|
846
|
-
getNumLobbyUsers(lobbyId: GenericId<"lobbies">): number;
|
|
847
|
-
leaveLobby(lobbyId: GenericId<"lobbies">): Promise<WavedashResponse<GenericId<"lobbies">>>;
|
|
848
|
-
listAvailableLobbies(): Promise<WavedashResponse<Lobby[]>>;
|
|
849
|
-
sendLobbyMessage(lobbyId: GenericId<"lobbies">, message: string): boolean;
|
|
850
|
-
/**
|
|
851
|
-
* Sets up Convex subscriptions for all relevant lobby updates
|
|
852
|
-
* @precondition - The user has already joined the lobby
|
|
853
|
-
* @param lobbyId - The ID of the lobby to subscribe to
|
|
854
|
-
*/
|
|
855
|
-
private subscribeToLobby;
|
|
856
|
-
private unsubscribeFromCurrentLobby;
|
|
857
|
-
private processPendingLobbyDataUpdates;
|
|
858
|
-
/**
|
|
859
|
-
* Process user updates and emit individual user events
|
|
860
|
-
* @param newUsers - The updated list of lobby users
|
|
861
|
-
*/
|
|
862
|
-
private processUserUpdates;
|
|
863
|
-
private processMessageUpdates;
|
|
864
|
-
/**
|
|
865
|
-
* Update P2P connections when lobby membership changes
|
|
866
|
-
* @param newUsers - The updated list of lobby users
|
|
867
|
-
*/
|
|
868
|
-
private updateP2PConnections;
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
/**
|
|
872
|
-
* P2P networking service
|
|
873
|
-
*
|
|
874
|
-
* Handles WebRTC peer-to-peer connections for lobbies
|
|
875
|
-
*/
|
|
876
|
-
|
|
877
|
-
declare class P2PManager {
|
|
878
|
-
private sdk;
|
|
879
|
-
private currentConnection;
|
|
880
|
-
private peerConnections;
|
|
881
|
-
private reliableChannels;
|
|
882
|
-
private unreliableChannels;
|
|
883
|
-
private config;
|
|
884
|
-
private processedSignalingMessages;
|
|
885
|
-
private connectionStateCheckInterval;
|
|
886
|
-
private turnCredentials;
|
|
887
|
-
private channelQueues;
|
|
888
|
-
private readonly CHECK_CONNECTION_INTERVAL_MS;
|
|
889
|
-
private readonly QUEUE_SIZE;
|
|
890
|
-
private readonly MESSAGE_SIZE;
|
|
891
|
-
private readonly HEADER_SIZE;
|
|
892
|
-
private readonly MAX_CHANNELS;
|
|
893
|
-
private readonly DEFAULT_NUM_CHANNELS;
|
|
894
|
-
private readonly USERID_SIZE;
|
|
895
|
-
private readonly CHANNEL_SIZE;
|
|
896
|
-
private readonly DATALENGTH_SIZE;
|
|
897
|
-
private readonly CHANNEL_OFFSET;
|
|
898
|
-
private readonly DATALENGTH_OFFSET;
|
|
899
|
-
private readonly PAYLOAD_OFFSET;
|
|
900
|
-
constructor(sdk: WavedashSDK, config?: Partial<P2PConfig>);
|
|
901
|
-
initializeP2PForCurrentLobby(lobbyId: GenericId<"lobbies">, members: SDKUser[]): Promise<WavedashResponse<P2PConnection>>;
|
|
902
|
-
private getIceServers;
|
|
903
|
-
private updateP2PConnection;
|
|
904
|
-
private establishWebRTCConnections;
|
|
905
|
-
private startConnectionStatePolling;
|
|
906
|
-
private stopConnectionStatePolling;
|
|
907
|
-
private updateConnectionState;
|
|
908
|
-
private unsubscribeFromSignalingMessages;
|
|
909
|
-
private pendingProcessedMessageIds;
|
|
910
|
-
private subscribeToSignalingMessages;
|
|
911
|
-
private stopSignalingMessageSubscription;
|
|
912
|
-
private processSignalingMessages;
|
|
913
|
-
private handleSignalingMessage;
|
|
914
|
-
private establishPeerConnections;
|
|
915
|
-
private createOfferToPeer;
|
|
916
|
-
private createPeerConnection;
|
|
917
|
-
private setupDataChannelHandlers;
|
|
918
|
-
sendP2PMessage(toUserId: GenericId<"users"> | undefined, appChannel: number | undefined, reliable: boolean | undefined, payload: string | Uint8Array): boolean;
|
|
919
|
-
private sendSignalingMessage;
|
|
920
|
-
disconnectP2P(): WavedashResponse<boolean>;
|
|
921
|
-
getCurrentP2PConnection(): P2PConnection | null;
|
|
922
|
-
updateConfig(config: Partial<P2PConfig>): void;
|
|
923
|
-
isPeerReady(userId: GenericId<"users">): boolean;
|
|
924
|
-
private allPeersConnected;
|
|
925
|
-
isBroadcastReady(): boolean;
|
|
926
|
-
getPeerStatuses(): Record<GenericId<"users">, {
|
|
927
|
-
reliable?: string;
|
|
928
|
-
unreliable?: string;
|
|
929
|
-
ready: boolean;
|
|
930
|
-
}>;
|
|
931
|
-
private initializeMessageQueue;
|
|
932
|
-
private createChannelQueue;
|
|
933
|
-
private enqueueMessage;
|
|
934
|
-
getMessageQueueInfo(): {
|
|
935
|
-
channels: number;
|
|
936
|
-
queueSize: number;
|
|
937
|
-
messageSize: number;
|
|
938
|
-
totalSize: number;
|
|
939
|
-
};
|
|
940
|
-
getChannelQueueBuffer(channel: number): SharedArrayBuffer | null;
|
|
941
|
-
readMessageFromChannel(appChannel: number): Uint8Array | P2PMessage | null;
|
|
942
|
-
private encodeBinaryMessage;
|
|
943
|
-
private decodeBinaryMessage;
|
|
944
|
-
private decodeBase64;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
declare class StatsManager {
|
|
948
|
-
private sdk;
|
|
949
|
-
private stats;
|
|
950
|
-
private achievementIdentifiers;
|
|
951
|
-
private updatedStatIdentifiers;
|
|
952
|
-
private updatedAchievementIdentifiers;
|
|
953
|
-
private unsubscribeStats?;
|
|
954
|
-
private unsubscribeAchievements?;
|
|
955
|
-
private hasLoadedStats;
|
|
956
|
-
private hasLoadedAchievements;
|
|
957
|
-
constructor(sdk: WavedashSDK);
|
|
958
|
-
ensureLoaded(): void;
|
|
959
|
-
requestStats(): Promise<WavedashResponse<boolean>>;
|
|
960
|
-
storeStats(): Promise<WavedashResponse<boolean>>;
|
|
961
|
-
setAchievement(identifier: string): void;
|
|
962
|
-
getAchievement(identifier: string): boolean;
|
|
963
|
-
setStat(identifier: string, value: number): void;
|
|
964
|
-
getStat(identifier: string): number;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
/**
|
|
968
|
-
* Heartbeat service
|
|
969
|
-
*
|
|
970
|
-
* Polls connection state and allows the game to update rich user presence
|
|
971
|
-
* Lets the game know if backend connection ever changes.
|
|
972
|
-
* Lets the game update userPresence in the backend
|
|
973
|
-
*/
|
|
974
|
-
|
|
975
|
-
declare class HeartbeatManager {
|
|
976
|
-
private sdk;
|
|
977
|
-
private testConnectionInterval;
|
|
978
|
-
private isConnected;
|
|
979
|
-
private sentDisconnectedSignal;
|
|
980
|
-
private disconnectedAt;
|
|
981
|
-
private readonly TEST_CONNECTION_INTERVAL_MS;
|
|
982
|
-
private readonly DISCONNECTED_TIMEOUT_MS;
|
|
983
|
-
constructor(sdk: WavedashSDK);
|
|
984
|
-
start(): void;
|
|
985
|
-
stop(): void;
|
|
986
|
-
/**
|
|
987
|
-
* Updates user presence in the backend
|
|
988
|
-
* @param data - Data to send to the backend
|
|
989
|
-
* @returns true if the presence was updated successfully
|
|
990
|
-
*/
|
|
991
|
-
updateUserPresence(data?: Record<string, any>): Promise<boolean>;
|
|
992
|
-
/**
|
|
993
|
-
* Tests the connection to the backend
|
|
994
|
-
*/
|
|
995
|
-
private testConnection;
|
|
996
|
-
isCurrentlyConnected(): boolean;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
/**
|
|
1000
|
-
* Logger interface and implementation
|
|
1001
|
-
* Simply logs to the console with customizable log level
|
|
1002
|
-
*
|
|
1003
|
-
* In the future we could extend this to write .log files to IndexedDB or cache storage
|
|
1004
|
-
*/
|
|
1005
|
-
interface Logger {
|
|
1006
|
-
debug(message: string, ...args: any[]): void;
|
|
1007
|
-
info(message: string, ...args: any[]): void;
|
|
1008
|
-
warn(message: string, ...args: any[]): void;
|
|
1009
|
-
error(message: string, ...args: any[]): void;
|
|
1010
|
-
}
|
|
1011
|
-
declare class WavedashLogger implements Logger {
|
|
1012
|
-
private logLevel;
|
|
1013
|
-
constructor(logLevel?: number);
|
|
1014
|
-
setLogLevel(level: number): void;
|
|
1015
|
-
debug(message: string, ...args: any[]): void;
|
|
1016
|
-
info(message: string, ...args: any[]): void;
|
|
1017
|
-
warn(message: string, ...args: any[]): void;
|
|
1018
|
-
error(message: string, ...args: any[]): void;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
declare class WavedashSDK {
|
|
1022
|
-
private initialized;
|
|
1023
|
-
private lobbyIdToJoinOnInit?;
|
|
1024
|
-
protected config: WavedashConfig | null;
|
|
1025
|
-
protected wavedashUser: SDKUser;
|
|
1026
|
-
protected gameCloudId: string;
|
|
1027
|
-
protected ugcHost: string;
|
|
1028
|
-
protected lobbyManager: LobbyManager;
|
|
1029
|
-
protected statsManager: StatsManager;
|
|
1030
|
-
protected heartbeatManager: HeartbeatManager;
|
|
1031
|
-
convexClient: ConvexClient;
|
|
1032
|
-
engineCallbackReceiver: string;
|
|
1033
|
-
engineInstance: EngineInstance | null;
|
|
1034
|
-
logger: WavedashLogger;
|
|
1035
|
-
p2pManager: P2PManager;
|
|
1036
|
-
Constants: typeof Constants;
|
|
1037
|
-
constructor(convexClient: ConvexClient, sdkConfig: SDKConfig);
|
|
1038
|
-
init(config: WavedashConfig): boolean;
|
|
1039
|
-
/**
|
|
1040
|
-
* Set the engine instance (Unity or Godot).
|
|
1041
|
-
* If using a game engine, call this function before starting the game.
|
|
1042
|
-
* @param engineInstance - The engine instance.
|
|
1043
|
-
*/
|
|
1044
|
-
setEngineInstance(engineInstance: EngineInstance): void;
|
|
1045
|
-
isReady(): boolean;
|
|
1046
|
-
toggleOverlay(): void;
|
|
1047
|
-
private setupOverlayListener;
|
|
1048
|
-
getUser(): string | SDKUser;
|
|
1049
|
-
getUsername(): string;
|
|
1050
|
-
getUserId(): GenericId<"users">;
|
|
1051
|
-
getLeaderboard(name: string): Promise<string | WavedashResponse<Leaderboard>>;
|
|
1052
|
-
getOrCreateLeaderboard(name: string, sortOrder: LeaderboardSortOrder, displayType: LeaderboardDisplayType): Promise<string | WavedashResponse<Leaderboard>>;
|
|
1053
|
-
getLeaderboardEntryCount(leaderboardId: GenericId<"leaderboards">): number;
|
|
1054
|
-
getMyLeaderboardEntries(leaderboardId: GenericId<"leaderboards">): Promise<string | WavedashResponse<LeaderboardEntries>>;
|
|
1055
|
-
listLeaderboardEntriesAroundUser(leaderboardId: GenericId<"leaderboards">, countAhead: number, countBehind: number): Promise<string | WavedashResponse<LeaderboardEntries>>;
|
|
1056
|
-
listLeaderboardEntries(leaderboardId: GenericId<"leaderboards">, offset: number, limit: number): Promise<string | WavedashResponse<LeaderboardEntries>>;
|
|
1057
|
-
uploadLeaderboardScore(leaderboardId: GenericId<"leaderboards">, score: number, keepBest: boolean, ugcId?: GenericId<"userGeneratedContent">): Promise<string | WavedashResponse<UpsertedLeaderboardEntry>>;
|
|
1058
|
-
/**
|
|
1059
|
-
* Creates a new UGC item and uploads the file to the server if a filePath is provided
|
|
1060
|
-
* @param ugcType
|
|
1061
|
-
* @param title
|
|
1062
|
-
* @param description
|
|
1063
|
-
* @param visibility
|
|
1064
|
-
* @param filePath - optional IndexedDB key file path to upload to the server. If not provided, the UGC item will be created but no file will be uploaded.
|
|
1065
|
-
* @returns ugcId
|
|
1066
|
-
*/
|
|
1067
|
-
createUGCItem(ugcType: UGCType, title?: string, description?: string, visibility?: UGCVisibility, filePath?: string): Promise<string | WavedashResponse<GenericId<"userGeneratedContent">>>;
|
|
1068
|
-
/**
|
|
1069
|
-
* Updates a UGC item and uploads the file to the server if a filePath is provided
|
|
1070
|
-
* TODO: GD Script cannot call with optional arguments, convert this to accept a single dictionary of updates
|
|
1071
|
-
* @param ugcId
|
|
1072
|
-
* @param title
|
|
1073
|
-
* @param description
|
|
1074
|
-
* @param visibility
|
|
1075
|
-
* @param filePath - optional IndexedDB key file path to upload to the server. If not provided, the UGC item will be updated but no file will be uploaded.
|
|
1076
|
-
* @returns ugcId
|
|
1077
|
-
*/
|
|
1078
|
-
updateUGCItem(ugcId: GenericId<"userGeneratedContent">, title?: string, description?: string, visibility?: UGCVisibility, filePath?: string): Promise<string | WavedashResponse<GenericId<"userGeneratedContent">>>;
|
|
1079
|
-
downloadUGCItem(ugcId: GenericId<"userGeneratedContent">, filePath: string): Promise<string | WavedashResponse<GenericId<"userGeneratedContent">>>;
|
|
1080
|
-
/**
|
|
1081
|
-
* Downloads a remote file to a local location
|
|
1082
|
-
* @param filePath - The path of the remote file to download
|
|
1083
|
-
* @param downloadTo - Optionally provide a path to download the file to, defaults to the same path as the remote file
|
|
1084
|
-
* @returns The path of the local file that the remote file was downloaded to
|
|
1085
|
-
*/
|
|
1086
|
-
downloadRemoteFile(filePath: string): Promise<string | WavedashResponse<string>>;
|
|
1087
|
-
/**
|
|
1088
|
-
* Uploads a local file to remote storage
|
|
1089
|
-
* @param filePath - The path of the local file to upload
|
|
1090
|
-
* @param uploadTo - Optionally provide a path to upload the file to, defaults to the same path as the local file
|
|
1091
|
-
* @returns The path of the remote file that the local file was uploaded to
|
|
1092
|
-
*/
|
|
1093
|
-
uploadRemoteFile(filePath: string): Promise<string | WavedashResponse<string>>;
|
|
1094
|
-
/**
|
|
1095
|
-
* Lists a remote directory
|
|
1096
|
-
* @param path - The path of the remote directory to list
|
|
1097
|
-
* @returns A list of metadata for each file in the remote directory
|
|
1098
|
-
*/
|
|
1099
|
-
listRemoteDirectory(path: string): Promise<string | WavedashResponse<RemoteFileMetadata[]>>;
|
|
1100
|
-
/**
|
|
1101
|
-
* Downloads a remote directory to a local location
|
|
1102
|
-
* @param path - The path of the remote directory to download
|
|
1103
|
-
* @returns The path of the local directory that the remote directory was downloaded to
|
|
1104
|
-
*/
|
|
1105
|
-
downloadRemoteDirectory(path: string): Promise<string | WavedashResponse<string>>;
|
|
1106
|
-
getAchievement(identifier: string): boolean;
|
|
1107
|
-
getStat(identifier: string): number;
|
|
1108
|
-
setAchievement(identifier: string): void;
|
|
1109
|
-
setStat(identifier: string, value: number): void;
|
|
1110
|
-
requestStats(): Promise<string | WavedashResponse<boolean>>;
|
|
1111
|
-
storeStats(): Promise<string | WavedashResponse<boolean>>;
|
|
1112
|
-
/**
|
|
1113
|
-
* Send a message through P2P to a specific peer using their userId
|
|
1114
|
-
* @param toUserId - Peer userId to send to (undefined = broadcast)
|
|
1115
|
-
* @param appChannel - Optional channel for message routing. All messages still use the same P2P connection under the hood.
|
|
1116
|
-
* @param reliable - Send reliably, meaning guaranteed delivery and ordering, but slower (default: true)
|
|
1117
|
-
* @param payload - The payload to send (either byte array or a base64 encoded string)
|
|
1118
|
-
* @returns true if the message was sent out successfully
|
|
1119
|
-
*/
|
|
1120
|
-
sendP2PMessage(toUserId: GenericId<"users"> | undefined, appChannel: number | undefined, reliable: boolean | undefined, payload: string | Uint8Array): boolean;
|
|
1121
|
-
/**
|
|
1122
|
-
* Send the same payload to all peers in the lobby
|
|
1123
|
-
* @param appChannel - Optional app-level channel for message routing. All messages still use the same P2P connection under the hood.
|
|
1124
|
-
* @param reliable - Send reliably, meaning guaranteed delivery and ordering, but slower (default: true)
|
|
1125
|
-
* @param payload - The payload to send (either byte array or a base64 encoded string)
|
|
1126
|
-
* @returns true if the message was sent out successfully
|
|
1127
|
-
*/
|
|
1128
|
-
broadcastP2PMessage(appChannel: number | undefined, reliable: boolean | undefined, payload: string | Uint8Array): boolean;
|
|
1129
|
-
/**
|
|
1130
|
-
* Read one binary message from a specific P2P message channel
|
|
1131
|
-
* @param appChannel - The channel to read from
|
|
1132
|
-
* @returns To Game Engine: Uint8Array (zero-copy view, empty if no message available)
|
|
1133
|
-
* To JS: P2PMessage (null if no message available)
|
|
1134
|
-
*/
|
|
1135
|
-
readP2PMessageFromChannel(appChannel: number): Uint8Array | P2PMessage | null;
|
|
1136
|
-
/**
|
|
1137
|
-
* Check if a specific peer is ready for messaging
|
|
1138
|
-
* @param userId - The peer user ID to check
|
|
1139
|
-
*/
|
|
1140
|
-
isPeerReady(userId: GenericId<"users">): boolean;
|
|
1141
|
-
/**
|
|
1142
|
-
* Check if the broadcast is ready for messaging
|
|
1143
|
-
* @returns true if at least one peer is ready for messaging
|
|
1144
|
-
*/
|
|
1145
|
-
isBroadcastReady(): boolean;
|
|
1146
|
-
createLobby(visibility: LobbyVisibility, maxPlayers?: number): Promise<string | WavedashResponse<GenericId<"lobbies">>>;
|
|
1147
|
-
/**
|
|
1148
|
-
* Join a lobby
|
|
1149
|
-
* @param lobbyId - The ID of the lobby to join
|
|
1150
|
-
* @returns A WavedashResponse containing the lobby ID
|
|
1151
|
-
* @emits LOBBY_JOINED signal to the game engine
|
|
1152
|
-
*/
|
|
1153
|
-
joinLobby(lobbyId: GenericId<"lobbies">): Promise<string | WavedashResponse<GenericId<"lobbies">>>;
|
|
1154
|
-
listAvailableLobbies(): Promise<string | WavedashResponse<Lobby[]>>;
|
|
1155
|
-
getLobbyUsers(lobbyId: GenericId<"lobbies">): string | LobbyUser[];
|
|
1156
|
-
getNumLobbyUsers(lobbyId: GenericId<"lobbies">): number;
|
|
1157
|
-
getLobbyHostId(lobbyId: GenericId<"lobbies">): GenericId<"users"> | null;
|
|
1158
|
-
getLobbyData(lobbyId: GenericId<"lobbies">, key: string): string;
|
|
1159
|
-
setLobbyData(lobbyId: GenericId<"lobbies">, key: string, value: any): boolean;
|
|
1160
|
-
leaveLobby(lobbyId: GenericId<"lobbies">): Promise<string | WavedashResponse<GenericId<"lobbies">>>;
|
|
1161
|
-
sendLobbyMessage(lobbyId: GenericId<"lobbies">, message: string): boolean;
|
|
1162
|
-
/**
|
|
1163
|
-
* Updates rich user presence so friends can see what the player is doing in game
|
|
1164
|
-
* TODO: data param should be more strongly typed
|
|
1165
|
-
* @param data Game data to send to the backend
|
|
1166
|
-
* @returns true if the presence was updated successfully
|
|
1167
|
-
*/
|
|
1168
|
-
updateUserPresence(data?: Record<string, any>): Promise<boolean>;
|
|
1169
|
-
notifyGame(signal: Signal, payload: string | number | boolean | object): void;
|
|
1170
|
-
private isGodot;
|
|
1171
|
-
private formatResponse;
|
|
1172
|
-
private ensureReady;
|
|
1173
|
-
loadScript(src: string): Promise<unknown>;
|
|
1174
|
-
updateLoadProgressZeroToOne(progress: number): void;
|
|
1175
|
-
loadComplete(): void;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
declare function setupWavedashSDK(): Promise<WavedashSDK>;
|
|
1179
|
-
|
|
1180
|
-
export { type EngineInstance, type Leaderboard, type LeaderboardDisplayType, type LeaderboardEntries, type LeaderboardSortOrder, type Lobby, type LobbyMessage, type LobbyUser, type LobbyVisibility, type P2PConfig, type P2PConnection, type P2PConnectionState, type P2PMessage, type P2PPeer, type P2PSignalingMessage, type P2PTurnCredentials, type RemoteFileMetadata, type Signal, type UGCType, type UGCVisibility, type UpsertedLeaderboardEntry, type WavedashConfig, type WavedashResponse, WavedashSDK, setupWavedashSDK };
|