@jgengine/convex 0.49.1 → 0.51.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/CHANGELOG.md +1401 -0
- package/dist/createConvexBackend.d.ts +2 -2
- package/dist/createConvexGameTransport.d.ts +10 -10
- package/dist/createConvexGameTransport.js +13 -0
- package/dist/hostedServer.d.ts +11 -11
- package/dist/hostedServer.js +3 -2
- package/dist/resolveConvexMultiplayer.d.ts +1 -1
- package/dist/server.d.ts +126 -102
- package/dist/server.js +49 -24
- package/dist/worldPresence.d.ts +1 -1
- package/dist/worldPresence.js +2 -1
- package/package.json +2 -2
- package/skills/jgengine/SKILL.md +43 -63
- package/skills/jgengine/api.md +29 -14
- package/skills/jgengine/capabilities.md +8 -0
- package/skills/jgengine/recipes/cookbook.md +752 -0
- package/skills/jgengine-multiplayer/SKILL.md +9 -0
- package/skills/jgengine-multiplayer/api.md +49 -32
- package/skills/jgengine-multiplayer/references/peer-worlds.md +1 -1
package/dist/server.d.ts
CHANGED
|
@@ -16,13 +16,13 @@ export { JG_MAX_MEMBERS_PER_SERVER, canJoinPrivateServer, isListablePublicly, va
|
|
|
16
16
|
export declare function jgengineTables(): {
|
|
17
17
|
jgGameServers: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
18
18
|
createdAt: number;
|
|
19
|
-
dirtyAt?: number
|
|
19
|
+
dirtyAt?: number;
|
|
20
20
|
gameId: string;
|
|
21
|
-
joinCode?: string
|
|
22
|
-
lastSavedAt?: number
|
|
23
|
-
memberCount?: number
|
|
21
|
+
joinCode?: string;
|
|
22
|
+
lastSavedAt?: number;
|
|
23
|
+
memberCount?: number;
|
|
24
24
|
memberUserIds: string[];
|
|
25
|
-
mode?: string
|
|
25
|
+
mode?: string;
|
|
26
26
|
modeConfig?: any;
|
|
27
27
|
revision: number;
|
|
28
28
|
save: "none" | {
|
|
@@ -34,9 +34,9 @@ export declare function jgengineTables(): {
|
|
|
34
34
|
slotsPerServer: number;
|
|
35
35
|
status: "closed" | "open" | "running";
|
|
36
36
|
tickAnchorMs: number;
|
|
37
|
-
topology?: "rooms" | "shared"
|
|
37
|
+
topology?: "rooms" | "shared";
|
|
38
38
|
updatedAt: number;
|
|
39
|
-
visibility?: "private" | "public"
|
|
39
|
+
visibility?: "private" | "public";
|
|
40
40
|
}, {
|
|
41
41
|
gameId: import("convex/values").VString<string, "required">;
|
|
42
42
|
status: import("convex/values").VUnion<"closed" | "open" | "running", [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"closed", "required">], "required", never>;
|
|
@@ -75,7 +75,7 @@ export declare function jgengineTables(): {
|
|
|
75
75
|
jgServerCapacity: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
76
76
|
gameId: string;
|
|
77
77
|
memberCount: number;
|
|
78
|
-
mode?: string
|
|
78
|
+
mode?: string;
|
|
79
79
|
serverId: GenericId<"jgGameServers">;
|
|
80
80
|
slotsPerServer: number;
|
|
81
81
|
status: "closed" | "open" | "running";
|
|
@@ -92,7 +92,7 @@ export declare function jgengineTables(): {
|
|
|
92
92
|
jgServerMembers: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
93
93
|
joinedAt: number;
|
|
94
94
|
serverId: GenericId<"jgGameServers">;
|
|
95
|
-
sessionIds?: string[]
|
|
95
|
+
sessionIds?: string[];
|
|
96
96
|
userId: string;
|
|
97
97
|
}, {
|
|
98
98
|
serverId: import("convex/values").VId<GenericId<"jgGameServers">, "required">;
|
|
@@ -133,11 +133,11 @@ export declare function jgengineTables(): {
|
|
|
133
133
|
}, {}, {}>;
|
|
134
134
|
jgPlayerProfiles: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
135
135
|
createdAt: number;
|
|
136
|
-
dirtyAt?: number
|
|
136
|
+
dirtyAt?: number;
|
|
137
137
|
gameId: string;
|
|
138
138
|
playerState: any;
|
|
139
139
|
revision: number;
|
|
140
|
-
sessionServerId?: GenericId<"jgGameServers"
|
|
140
|
+
sessionServerId?: GenericId<"jgGameServers">;
|
|
141
141
|
sessionState?: any;
|
|
142
142
|
updatedAt: number;
|
|
143
143
|
userId: string;
|
|
@@ -156,7 +156,7 @@ export declare function jgengineTables(): {
|
|
|
156
156
|
}, {}, {}>;
|
|
157
157
|
jgWorldChunks: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
158
158
|
chunkKey: string;
|
|
159
|
-
dirtyAt?: number
|
|
159
|
+
dirtyAt?: number;
|
|
160
160
|
serverId: GenericId<"jgGameServers">;
|
|
161
161
|
snapshot: any;
|
|
162
162
|
updatedAt: number;
|
|
@@ -173,7 +173,7 @@ export declare function jgengineTables(): {
|
|
|
173
173
|
jgLeaderboardRows: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
174
174
|
gameId: string;
|
|
175
175
|
scope: "global" | "profile" | "server";
|
|
176
|
-
serverId?: GenericId<"jgGameServers"
|
|
176
|
+
serverId?: GenericId<"jgGameServers">;
|
|
177
177
|
stat: string;
|
|
178
178
|
updatedAt: number;
|
|
179
179
|
userId: string;
|
|
@@ -204,17 +204,17 @@ export declare function jgengineTables(): {
|
|
|
204
204
|
by_server_and_action: ["serverId", "action", "_creationTime"];
|
|
205
205
|
}, {}, {}>;
|
|
206
206
|
jgPoses: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
207
|
-
chunkKey?: string
|
|
208
|
-
homeGameId?: string
|
|
209
|
-
kind?: string
|
|
210
|
-
label?: string
|
|
211
|
-
lastWorldSnapshotAt?: number
|
|
212
|
-
ownerActorId?: string
|
|
213
|
-
revokedAt?: number
|
|
207
|
+
chunkKey?: string;
|
|
208
|
+
homeGameId?: string;
|
|
209
|
+
kind?: string;
|
|
210
|
+
label?: string;
|
|
211
|
+
lastWorldSnapshotAt?: number;
|
|
212
|
+
ownerActorId?: string;
|
|
213
|
+
revokedAt?: number;
|
|
214
214
|
rotationPitch: number;
|
|
215
215
|
rotationY: number;
|
|
216
216
|
serverId: string;
|
|
217
|
-
sessionId?: string
|
|
217
|
+
sessionId?: string;
|
|
218
218
|
updatedAt: number;
|
|
219
219
|
userId: string;
|
|
220
220
|
x: number;
|
|
@@ -255,7 +255,7 @@ export declare function jgengineTables(): {
|
|
|
255
255
|
}, {}, {}>;
|
|
256
256
|
jgChatMessages: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
257
257
|
at: number;
|
|
258
|
-
authorName?: string
|
|
258
|
+
authorName?: string;
|
|
259
259
|
body: string;
|
|
260
260
|
channelId: string;
|
|
261
261
|
serverId: string;
|
|
@@ -307,13 +307,13 @@ export declare function jgengineHostedTables(): {
|
|
|
307
307
|
declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
308
308
|
jgGameServers: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
309
309
|
createdAt: number;
|
|
310
|
-
dirtyAt?: number
|
|
310
|
+
dirtyAt?: number;
|
|
311
311
|
gameId: string;
|
|
312
|
-
joinCode?: string
|
|
313
|
-
lastSavedAt?: number
|
|
314
|
-
memberCount?: number
|
|
312
|
+
joinCode?: string;
|
|
313
|
+
lastSavedAt?: number;
|
|
314
|
+
memberCount?: number;
|
|
315
315
|
memberUserIds: string[];
|
|
316
|
-
mode?: string
|
|
316
|
+
mode?: string;
|
|
317
317
|
modeConfig?: any;
|
|
318
318
|
revision: number;
|
|
319
319
|
save: "none" | {
|
|
@@ -325,9 +325,9 @@ declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
|
325
325
|
slotsPerServer: number;
|
|
326
326
|
status: "closed" | "open" | "running";
|
|
327
327
|
tickAnchorMs: number;
|
|
328
|
-
topology?: "rooms" | "shared"
|
|
328
|
+
topology?: "rooms" | "shared";
|
|
329
329
|
updatedAt: number;
|
|
330
|
-
visibility?: "private" | "public"
|
|
330
|
+
visibility?: "private" | "public";
|
|
331
331
|
}, {
|
|
332
332
|
gameId: import("convex/values").VString<string, "required">;
|
|
333
333
|
status: import("convex/values").VUnion<"closed" | "open" | "running", [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"closed", "required">], "required", never>;
|
|
@@ -366,7 +366,7 @@ declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
|
366
366
|
jgServerCapacity: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
367
367
|
gameId: string;
|
|
368
368
|
memberCount: number;
|
|
369
|
-
mode?: string
|
|
369
|
+
mode?: string;
|
|
370
370
|
serverId: GenericId<"jgGameServers">;
|
|
371
371
|
slotsPerServer: number;
|
|
372
372
|
status: "closed" | "open" | "running";
|
|
@@ -383,7 +383,7 @@ declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
|
383
383
|
jgServerMembers: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
384
384
|
joinedAt: number;
|
|
385
385
|
serverId: GenericId<"jgGameServers">;
|
|
386
|
-
sessionIds?: string[]
|
|
386
|
+
sessionIds?: string[];
|
|
387
387
|
userId: string;
|
|
388
388
|
}, {
|
|
389
389
|
serverId: import("convex/values").VId<GenericId<"jgGameServers">, "required">;
|
|
@@ -424,11 +424,11 @@ declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
|
424
424
|
}, {}, {}>;
|
|
425
425
|
jgPlayerProfiles: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
426
426
|
createdAt: number;
|
|
427
|
-
dirtyAt?: number
|
|
427
|
+
dirtyAt?: number;
|
|
428
428
|
gameId: string;
|
|
429
429
|
playerState: any;
|
|
430
430
|
revision: number;
|
|
431
|
-
sessionServerId?: GenericId<"jgGameServers"
|
|
431
|
+
sessionServerId?: GenericId<"jgGameServers">;
|
|
432
432
|
sessionState?: any;
|
|
433
433
|
updatedAt: number;
|
|
434
434
|
userId: string;
|
|
@@ -447,7 +447,7 @@ declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
|
447
447
|
}, {}, {}>;
|
|
448
448
|
jgWorldChunks: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
449
449
|
chunkKey: string;
|
|
450
|
-
dirtyAt?: number
|
|
450
|
+
dirtyAt?: number;
|
|
451
451
|
serverId: GenericId<"jgGameServers">;
|
|
452
452
|
snapshot: any;
|
|
453
453
|
updatedAt: number;
|
|
@@ -464,7 +464,7 @@ declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
|
464
464
|
jgLeaderboardRows: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
465
465
|
gameId: string;
|
|
466
466
|
scope: "global" | "profile" | "server";
|
|
467
|
-
serverId?: GenericId<"jgGameServers"
|
|
467
|
+
serverId?: GenericId<"jgGameServers">;
|
|
468
468
|
stat: string;
|
|
469
469
|
updatedAt: number;
|
|
470
470
|
userId: string;
|
|
@@ -495,17 +495,17 @@ declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
|
495
495
|
by_server_and_action: ["serverId", "action", "_creationTime"];
|
|
496
496
|
}, {}, {}>;
|
|
497
497
|
jgPoses: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
498
|
-
chunkKey?: string
|
|
499
|
-
homeGameId?: string
|
|
500
|
-
kind?: string
|
|
501
|
-
label?: string
|
|
502
|
-
lastWorldSnapshotAt?: number
|
|
503
|
-
ownerActorId?: string
|
|
504
|
-
revokedAt?: number
|
|
498
|
+
chunkKey?: string;
|
|
499
|
+
homeGameId?: string;
|
|
500
|
+
kind?: string;
|
|
501
|
+
label?: string;
|
|
502
|
+
lastWorldSnapshotAt?: number;
|
|
503
|
+
ownerActorId?: string;
|
|
504
|
+
revokedAt?: number;
|
|
505
505
|
rotationPitch: number;
|
|
506
506
|
rotationY: number;
|
|
507
507
|
serverId: string;
|
|
508
|
-
sessionId?: string
|
|
508
|
+
sessionId?: string;
|
|
509
509
|
updatedAt: number;
|
|
510
510
|
userId: string;
|
|
511
511
|
x: number;
|
|
@@ -546,7 +546,7 @@ declare const schemaForTypes: import("convex/server").SchemaDefinition<{
|
|
|
546
546
|
}, {}, {}>;
|
|
547
547
|
jgChatMessages: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
548
548
|
at: number;
|
|
549
|
-
authorName?: string
|
|
549
|
+
authorName?: string;
|
|
550
550
|
body: string;
|
|
551
551
|
channelId: string;
|
|
552
552
|
serverId: string;
|
|
@@ -626,7 +626,7 @@ export type RunCommandOutcome = {
|
|
|
626
626
|
};
|
|
627
627
|
/** Arguments of the `runCommand` mutation, and of the equivalent {@link GameServerHelpers.runCommand} helper. */
|
|
628
628
|
export type ConvexRunCommandArgs = RunCommandArgs & {
|
|
629
|
-
externalId?: string;
|
|
629
|
+
externalId?: string | undefined;
|
|
630
630
|
/**
|
|
631
631
|
* How much of the server to hydrate before applying the command. Overrides whatever the
|
|
632
632
|
* {@link CommandDef} declares through its own `scope`; omit both to hydrate the whole world.
|
|
@@ -662,6 +662,10 @@ export type LoadedServerSnapshot = {
|
|
|
662
662
|
*/
|
|
663
663
|
export type GameServerHelpers = {
|
|
664
664
|
ensureServer: (ctx: JGMutationCtx, gameId: string) => Promise<ServerDoc>;
|
|
665
|
+
/** The shared singleton world `ensureServer` would return, read without creating it, so a query can scope reads to it. `null` until a player or host mutation creates it. */
|
|
666
|
+
findServer: (ctx: {
|
|
667
|
+
db: Pick<JGQueryCtx["db"], "query">;
|
|
668
|
+
}, gameId: string) => Promise<ServerDoc | null>;
|
|
665
669
|
loadSnapshot: (ctx: JGMutationCtx, serverId: string, scope?: LoadSnapshotScope) => Promise<LoadedServerSnapshot | null>;
|
|
666
670
|
applyCommand: (args: {
|
|
667
671
|
gameId: string;
|
|
@@ -723,42 +727,42 @@ export declare function createGameServerFunctions(options?: {
|
|
|
723
727
|
allowedFeedActions?: readonly string[];
|
|
724
728
|
}): {
|
|
725
729
|
joinServer: import("convex/server").RegisteredMutation<"public", {
|
|
726
|
-
externalId?: string
|
|
730
|
+
externalId?: string;
|
|
727
731
|
gameId: string;
|
|
728
|
-
joinCode?: string
|
|
729
|
-
mode?: string
|
|
732
|
+
joinCode?: string;
|
|
733
|
+
mode?: string;
|
|
730
734
|
modeConfig?: any;
|
|
731
|
-
serverId?: GenericId<"jgGameServers"
|
|
732
|
-
sessionId?: string
|
|
733
|
-
visibility?: "private" | "public"
|
|
735
|
+
serverId?: GenericId<"jgGameServers">;
|
|
736
|
+
sessionId?: string;
|
|
737
|
+
visibility?: "private" | "public";
|
|
734
738
|
}, Promise<EnsureJoinedOutcome>>;
|
|
735
739
|
leaveServer: import("convex/server").RegisteredMutation<"public", {
|
|
736
|
-
externalId?: string
|
|
740
|
+
externalId?: string;
|
|
737
741
|
serverId: GenericId<"jgGameServers">;
|
|
738
|
-
sessionId?: string
|
|
742
|
+
sessionId?: string;
|
|
739
743
|
}, Promise<null>>;
|
|
740
744
|
runCommand: import("convex/server").RegisteredMutation<"public", {
|
|
741
745
|
command: string;
|
|
742
|
-
externalId?: string
|
|
746
|
+
externalId?: string;
|
|
743
747
|
input: any;
|
|
744
748
|
scope?: {
|
|
745
|
-
chunkKeys?: string[]
|
|
746
|
-
players?: string[]
|
|
747
|
-
}
|
|
749
|
+
chunkKeys?: string[];
|
|
750
|
+
players?: string[];
|
|
751
|
+
};
|
|
748
752
|
serverId: GenericId<"jgGameServers">;
|
|
749
753
|
}, Promise<RunCommandOutcome>>;
|
|
750
754
|
flushSave: import("convex/server").RegisteredMutation<"public", {
|
|
751
|
-
externalId?: string
|
|
755
|
+
externalId?: string;
|
|
752
756
|
serverId: GenericId<"jgGameServers">;
|
|
753
757
|
}, Promise<boolean>>;
|
|
754
758
|
getServer: import("convex/server").RegisteredQuery<"public", {
|
|
755
|
-
externalId?: string
|
|
759
|
+
externalId?: string;
|
|
756
760
|
serverId: GenericId<"jgGameServers">;
|
|
757
761
|
}, Promise<{
|
|
758
762
|
_id: GenericId<"jgGameServers">;
|
|
759
763
|
gameId: string;
|
|
760
764
|
status: "closed" | "open" | "running";
|
|
761
|
-
mode
|
|
765
|
+
mode?: string;
|
|
762
766
|
memberUserIds: string[];
|
|
763
767
|
slotsPerServer: number;
|
|
764
768
|
save: "none" | {
|
|
@@ -773,30 +777,30 @@ export declare function createGameServerFunctions(options?: {
|
|
|
773
777
|
updatedAt: number;
|
|
774
778
|
} | null>>;
|
|
775
779
|
getServerMeta: import("convex/server").RegisteredQuery<"public", {
|
|
776
|
-
externalId?: string
|
|
780
|
+
externalId?: string;
|
|
777
781
|
serverId: GenericId<"jgGameServers">;
|
|
778
|
-
}, Promise<{
|
|
782
|
+
}, Promise<import("@jgengine/core/data/definedOnly").DefinedOnly<{
|
|
779
783
|
_id: GenericId<"jgGameServers">;
|
|
780
784
|
gameId: string;
|
|
781
785
|
status: "closed" | "open" | "running";
|
|
782
786
|
mode: string | undefined;
|
|
783
787
|
memberCount: number;
|
|
784
788
|
slotsPerServer: number;
|
|
785
|
-
} | null>>;
|
|
789
|
+
}> | null>>;
|
|
786
790
|
getServerCapacity: import("convex/server").RegisteredQuery<"public", {
|
|
787
|
-
externalId?: string
|
|
791
|
+
externalId?: string;
|
|
788
792
|
serverId: GenericId<"jgGameServers">;
|
|
789
|
-
}, Promise<{
|
|
793
|
+
}, Promise<import("@jgengine/core/data/definedOnly").DefinedOnly<{
|
|
790
794
|
_id: GenericId<"jgGameServers">;
|
|
791
795
|
gameId: string;
|
|
792
796
|
status: "closed" | "open" | "running";
|
|
793
797
|
mode: string | undefined;
|
|
794
798
|
memberCount: number;
|
|
795
799
|
slotsPerServer: number;
|
|
796
|
-
} | null>>;
|
|
800
|
+
}> | null>>;
|
|
797
801
|
getChunks: import("convex/server").RegisteredQuery<"public", {
|
|
798
802
|
chunkKeys: string[];
|
|
799
|
-
externalId?: string
|
|
803
|
+
externalId?: string;
|
|
800
804
|
serverId: GenericId<"jgGameServers">;
|
|
801
805
|
}, Promise<{
|
|
802
806
|
chunkKey: string;
|
|
@@ -804,7 +808,7 @@ export declare function createGameServerFunctions(options?: {
|
|
|
804
808
|
updatedAt: number;
|
|
805
809
|
}[]>>;
|
|
806
810
|
getPlayerProfile: import("convex/server").RegisteredQuery<"public", {
|
|
807
|
-
externalId?: string
|
|
811
|
+
externalId?: string;
|
|
808
812
|
gameId: string;
|
|
809
813
|
}, Promise<{
|
|
810
814
|
userId: string;
|
|
@@ -815,27 +819,28 @@ export declare function createGameServerFunctions(options?: {
|
|
|
815
819
|
} | null>>;
|
|
816
820
|
getFeed: import("convex/server").RegisteredQuery<"public", {
|
|
817
821
|
action: string;
|
|
818
|
-
externalId?: string
|
|
822
|
+
externalId?: string;
|
|
819
823
|
serverId: GenericId<"jgGameServers">;
|
|
820
824
|
}, Promise<any[]>>;
|
|
821
825
|
pushFeedEntry: import("convex/server").RegisteredMutation<"public", {
|
|
822
826
|
action: string;
|
|
823
827
|
entry: any;
|
|
824
|
-
externalId?: string
|
|
828
|
+
externalId?: string;
|
|
825
829
|
serverId: GenericId<"jgGameServers">;
|
|
826
830
|
}, Promise<null>>;
|
|
827
831
|
listOpenServers: import("convex/server").RegisteredQuery<"public", {
|
|
828
|
-
externalId?: string
|
|
832
|
+
externalId?: string;
|
|
829
833
|
gameId: string;
|
|
830
|
-
limit?: number
|
|
831
|
-
}, Promise<{
|
|
834
|
+
limit?: number;
|
|
835
|
+
}, Promise<({
|
|
832
836
|
_id: GenericId<"jgGameServers">;
|
|
833
837
|
status: "closed" | "open" | "running";
|
|
834
838
|
memberCount: number;
|
|
835
839
|
slotsPerServer: number;
|
|
836
|
-
mode: string | undefined;
|
|
837
840
|
updatedAt: number;
|
|
838
|
-
}
|
|
841
|
+
} & {
|
|
842
|
+
mode?: string;
|
|
843
|
+
})[]>>;
|
|
839
844
|
tickActiveServers: import("convex/server").RegisteredMutation<"internal", {}, Promise<{
|
|
840
845
|
ticked: number;
|
|
841
846
|
saved: number;
|
|
@@ -850,18 +855,18 @@ export declare function createLeaderboardFunctions(options?: {
|
|
|
850
855
|
auth?: JgAuthMode;
|
|
851
856
|
}): {
|
|
852
857
|
getTop: import("convex/server").RegisteredQuery<"public", {
|
|
853
|
-
externalId?: string
|
|
858
|
+
externalId?: string;
|
|
854
859
|
gameId: string;
|
|
855
|
-
limit?: number
|
|
860
|
+
limit?: number;
|
|
856
861
|
scope: "global" | "profile" | "server";
|
|
857
|
-
serverId?: GenericId<"jgGameServers"
|
|
862
|
+
serverId?: GenericId<"jgGameServers">;
|
|
858
863
|
stat: string;
|
|
859
864
|
}, Promise<{
|
|
860
865
|
userId: string;
|
|
861
866
|
value: number;
|
|
862
867
|
}[]>>;
|
|
863
868
|
getProfile: import("convex/server").RegisteredQuery<"public", {
|
|
864
|
-
externalId?: string
|
|
869
|
+
externalId?: string;
|
|
865
870
|
gameId: string;
|
|
866
871
|
userId: string;
|
|
867
872
|
}, Promise<Record<string, number>>>;
|
|
@@ -869,7 +874,7 @@ export declare function createLeaderboardFunctions(options?: {
|
|
|
869
874
|
entries: {
|
|
870
875
|
by: number;
|
|
871
876
|
scope: "global" | "profile" | "server";
|
|
872
|
-
serverId?: GenericId<"jgGameServers"
|
|
877
|
+
serverId?: GenericId<"jgGameServers">;
|
|
873
878
|
stat: string;
|
|
874
879
|
userId: string;
|
|
875
880
|
}[];
|
|
@@ -903,6 +908,17 @@ export type PresenceSyncResult = {
|
|
|
903
908
|
lastSeenAt: number;
|
|
904
909
|
displaced: boolean;
|
|
905
910
|
};
|
|
911
|
+
/** A live pose row handed to a `checkpoint` writer, so a host can persist its own last-position state. */
|
|
912
|
+
export type PresenceCheckpoint = {
|
|
913
|
+
userId: string;
|
|
914
|
+
homeGameId?: string;
|
|
915
|
+
position: {
|
|
916
|
+
x: number;
|
|
917
|
+
y: number;
|
|
918
|
+
z: number;
|
|
919
|
+
};
|
|
920
|
+
rotationY: number;
|
|
921
|
+
};
|
|
906
922
|
/**
|
|
907
923
|
* The pose lane of a hosted server: the backend behind `PresenceSync`, which replicates where each
|
|
908
924
|
* member of one `jgGameServers` server is standing. It is not the backend for `PresenceTransport` —
|
|
@@ -925,7 +941,7 @@ export declare function createPresenceFunctions(options?: {
|
|
|
925
941
|
resolveSpawn?: (ctx: JGMutationCtx, args: {
|
|
926
942
|
serverId: string;
|
|
927
943
|
userId: string;
|
|
928
|
-
kind?: string;
|
|
944
|
+
kind?: string | undefined;
|
|
929
945
|
}) => Promise<{
|
|
930
946
|
x: number;
|
|
931
947
|
y: number;
|
|
@@ -935,30 +951,38 @@ export declare function createPresenceFunctions(options?: {
|
|
|
935
951
|
y: number;
|
|
936
952
|
z: number;
|
|
937
953
|
} | null;
|
|
954
|
+
/**
|
|
955
|
+
* Persist host-owned last-position state from a live row: on a sync at most once per `intervalMs`
|
|
956
|
+
* (default 30 s), and always when `leave` ends the row, so a returning player spawns where they stood.
|
|
957
|
+
*/
|
|
958
|
+
checkpoint?: {
|
|
959
|
+
intervalMs?: number;
|
|
960
|
+
write: (ctx: JGMutationCtx, row: PresenceCheckpoint, nowMs: number) => Promise<void>;
|
|
961
|
+
};
|
|
938
962
|
}): {
|
|
939
963
|
list: import("convex/server").RegisteredQuery<"public", {
|
|
940
|
-
externalId?: string
|
|
964
|
+
externalId?: string;
|
|
941
965
|
serverId: string;
|
|
942
|
-
viewerChunkKey?: string
|
|
966
|
+
viewerChunkKey?: string;
|
|
943
967
|
}, Promise<PresenceListRow[]>>;
|
|
944
968
|
sync: import("convex/server").RegisteredMutation<"public", {
|
|
945
|
-
externalId?: string
|
|
946
|
-
kind?: string
|
|
947
|
-
label?: string
|
|
969
|
+
externalId?: string;
|
|
970
|
+
kind?: string;
|
|
971
|
+
label?: string;
|
|
948
972
|
pose?: {
|
|
949
973
|
rotationPitch: number;
|
|
950
974
|
rotationY: number;
|
|
951
975
|
x: number;
|
|
952
976
|
y: number;
|
|
953
977
|
z: number;
|
|
954
|
-
}
|
|
978
|
+
};
|
|
955
979
|
serverId: string;
|
|
956
|
-
sessionId?: string
|
|
980
|
+
sessionId?: string;
|
|
957
981
|
}, Promise<PresenceSyncResult | null>>;
|
|
958
982
|
leave: import("convex/server").RegisteredMutation<"public", {
|
|
959
|
-
externalId?: string
|
|
983
|
+
externalId?: string;
|
|
960
984
|
serverId: string;
|
|
961
|
-
sessionId?: string
|
|
985
|
+
sessionId?: string;
|
|
962
986
|
}, Promise<null>>;
|
|
963
987
|
reapIdlePresence: import("convex/server").RegisteredMutation<"internal", {}, Promise<{
|
|
964
988
|
reaped: number;
|
|
@@ -1033,7 +1057,7 @@ export declare function recentChatMessages(ctx: {
|
|
|
1033
1057
|
_creationTime: number;
|
|
1034
1058
|
_id: GenericId<"jgChatMessages">;
|
|
1035
1059
|
at: number;
|
|
1036
|
-
authorName?: string
|
|
1060
|
+
authorName?: string;
|
|
1037
1061
|
body: string;
|
|
1038
1062
|
channelId: string;
|
|
1039
1063
|
serverId: string;
|
|
@@ -1045,19 +1069,19 @@ export declare function recentChatMessages(ctx: {
|
|
|
1045
1069
|
*/
|
|
1046
1070
|
export declare function createClientErrorFunctions(): {
|
|
1047
1071
|
reportClientError: import("convex/server").RegisteredMutation<"public", {
|
|
1048
|
-
agentPrompt?: string
|
|
1049
|
-
componentStack?: string
|
|
1050
|
-
kind?: string
|
|
1072
|
+
agentPrompt?: string;
|
|
1073
|
+
componentStack?: string;
|
|
1074
|
+
kind?: string;
|
|
1051
1075
|
message: string;
|
|
1052
|
-
pathname?: string
|
|
1053
|
-
stack?: string
|
|
1054
|
-
url?: string
|
|
1055
|
-
userAgent?: string
|
|
1076
|
+
pathname?: string;
|
|
1077
|
+
stack?: string;
|
|
1078
|
+
url?: string;
|
|
1079
|
+
userAgent?: string;
|
|
1056
1080
|
}, Promise<{
|
|
1057
1081
|
ok: boolean;
|
|
1058
1082
|
reason: string;
|
|
1059
1083
|
} | {
|
|
1060
|
-
reason?:
|
|
1084
|
+
reason?: never;
|
|
1061
1085
|
ok: boolean;
|
|
1062
1086
|
}>>;
|
|
1063
1087
|
pruneClientErrors: import("convex/server").RegisteredMutation<"internal", {}, Promise<{
|
|
@@ -1078,18 +1102,18 @@ export declare function createChatFunctions(options?: {
|
|
|
1078
1102
|
}): {
|
|
1079
1103
|
messages: import("convex/server").RegisteredQuery<"public", {
|
|
1080
1104
|
channelId: string;
|
|
1081
|
-
externalId?: string
|
|
1105
|
+
externalId?: string;
|
|
1082
1106
|
serverId: string;
|
|
1083
1107
|
}, Promise<ChatMessage[]>>;
|
|
1084
1108
|
recent: import("convex/server").RegisteredQuery<"public", {
|
|
1085
1109
|
channelId: string;
|
|
1086
|
-
externalId?: string
|
|
1110
|
+
externalId?: string;
|
|
1087
1111
|
serverId: string;
|
|
1088
1112
|
}, Promise<ChatMessage[]>>;
|
|
1089
1113
|
sendMessage: import("convex/server").RegisteredMutation<"public", {
|
|
1090
1114
|
body: string;
|
|
1091
1115
|
channelId: string;
|
|
1092
|
-
externalId?: string
|
|
1116
|
+
externalId?: string;
|
|
1093
1117
|
serverId: string;
|
|
1094
1118
|
}, Promise<ChatSendOutcome>>;
|
|
1095
1119
|
pruneChatMessages: import("convex/server").RegisteredMutation<"internal", {}, Promise<{
|