@thegeem/protocol 0.1.40 → 0.1.41
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.cjs +9 -5
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +8 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
CHARACTER_IDS: () => CHARACTER_IDS,
|
|
24
24
|
COMEBACK_BONUS_MIN_PV: () => COMEBACK_BONUS_MIN_PV,
|
|
25
|
+
COMEBACK_EFFECTS: () => COMEBACK_EFFECTS,
|
|
25
26
|
ClientMsg: () => ClientMsg,
|
|
26
27
|
EMOTE_IDS: () => EMOTE_IDS,
|
|
27
28
|
GAMES: () => GAMES,
|
|
@@ -86,8 +87,9 @@ var GAMES = [
|
|
|
86
87
|
];
|
|
87
88
|
var hostActivityForPv = (activity, pv) => activity === "options" && (pv ?? MIN_SUPPORTED_PV) < 6 ? "configuring" : activity;
|
|
88
89
|
var COMEBACK_BONUS_MIN_PV = 7;
|
|
89
|
-
var COMEBACK_EFFECTS =
|
|
90
|
-
var
|
|
90
|
+
var COMEBACK_EFFECTS = ["comebackOffer", "comebackBonus", "comebackDeclined"];
|
|
91
|
+
var COMEBACK_EFFECT_SET = new Set(COMEBACK_EFFECTS);
|
|
92
|
+
var effectsForPv = (effects, pv) => (pv ?? MIN_SUPPORTED_PV) >= COMEBACK_BONUS_MIN_PV ? effects : effects.filter((e) => !COMEBACK_EFFECT_SET.has(e.t));
|
|
91
93
|
var gamesForPv = (pv) => GAMES.filter((g) => !g.deprecated && g.minPv <= pv);
|
|
92
94
|
var gameIdForPv = (gameId, pv) => {
|
|
93
95
|
const g = GAMES.find((x) => x.id === gameId);
|
|
@@ -122,6 +124,7 @@ var HelpType = import_zod.z.enum([
|
|
|
122
124
|
var Pv = import_zod.z.number().int().min(1).max(1e6).optional();
|
|
123
125
|
var IdToken = import_zod.z.string().max(4096).optional();
|
|
124
126
|
var Platform = import_zod.z.enum(["web", "ios", "android", "tv"]).optional();
|
|
127
|
+
var Games = import_zod.z.array(import_zod.z.enum(GAME_IDS)).max(GAME_IDS.length).optional();
|
|
125
128
|
var AppVersion = import_zod.z.string().trim().max(24).regex(/^[0-9]+(\.[0-9]+){0,3}([-+][0-9A-Za-z.-]+)?$/, "bad app version").optional();
|
|
126
129
|
var Avatar = import_zod.z.object({
|
|
127
130
|
emoji: import_zod.z.string().min(1).max(16).transform((s) => s.replace(UNSAFE_CHARS, "")).refine((s) => s.length >= 1, "empty emoji"),
|
|
@@ -130,7 +133,7 @@ var Avatar = import_zod.z.object({
|
|
|
130
133
|
var Character = import_zod.z.enum(CHARACTER_IDS);
|
|
131
134
|
var ClientMsg = import_zod.z.discriminatedUnion("t", [
|
|
132
135
|
// room / lobby
|
|
133
|
-
import_zod.z.object({ t: import_zod.z.literal("createRoom"), name: DisplayName.optional(), avatar: Avatar.optional(), game: import_zod.z.enum(GAME_IDS).optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, appVersion: AppVersion }),
|
|
136
|
+
import_zod.z.object({ t: import_zod.z.literal("createRoom"), name: DisplayName.optional(), avatar: Avatar.optional(), game: import_zod.z.enum(GAME_IDS).optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, games: Games, appVersion: AppVersion }),
|
|
134
137
|
// Host sets/changes their display name AFTER createRoom (for anonymous one-tap
|
|
135
138
|
// hosts who started nameless). Host-only; the relay re-broadcasts the lobby.
|
|
136
139
|
// SUPERSEDED by setProfile (kept working for shipped builds).
|
|
@@ -144,8 +147,8 @@ var ClientMsg = import_zod.z.discriminatedUnion("t", [
|
|
|
144
147
|
// view carries names+avatars so it updates live; dama/ersimha views are id-keyed (clients
|
|
145
148
|
// map ids→names from the lobby roster), so a change there lands on the next lobby.
|
|
146
149
|
import_zod.z.object({ t: import_zod.z.literal("setProfile"), name: DisplayName.optional(), avatar: Avatar.optional(), character: Character.optional() }),
|
|
147
|
-
import_zod.z.object({ t: import_zod.z.literal("joinRoom"), code: RoomCode, name: DisplayName, avatar: Avatar.optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, appVersion: AppVersion }),
|
|
148
|
-
import_zod.z.object({ t: import_zod.z.literal("resume"), code: RoomCode, token: import_zod.z.string().max(120), avatar: Avatar.optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, appVersion: AppVersion }),
|
|
150
|
+
import_zod.z.object({ t: import_zod.z.literal("joinRoom"), code: RoomCode, name: DisplayName, avatar: Avatar.optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, games: Games, appVersion: AppVersion }),
|
|
151
|
+
import_zod.z.object({ t: import_zod.z.literal("resume"), code: RoomCode, token: import_zod.z.string().max(120), avatar: Avatar.optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, games: Games, appVersion: AppVersion }),
|
|
149
152
|
// `tally` (gs#46) = wins per PLAYER across every game this room has played tonight — «نتيجة الليلة».
|
|
150
153
|
// Keyed by playerId, NOT by team: team names are recycled each game, so a per-team count means nothing
|
|
151
154
|
// across a night. Survives playAgain. A One Device game credits nobody (its team slots hold no players).
|
|
@@ -361,6 +364,7 @@ var REJECT_REASONS = ["duplicate", "unclear_answer", "not_family", "inaccurate",
|
|
|
361
364
|
0 && (module.exports = {
|
|
362
365
|
CHARACTER_IDS,
|
|
363
366
|
COMEBACK_BONUS_MIN_PV,
|
|
367
|
+
COMEBACK_EFFECTS,
|
|
364
368
|
ClientMsg,
|
|
365
369
|
EMOTE_IDS,
|
|
366
370
|
GAMES,
|
package/dist/index.d.cts
CHANGED
|
@@ -96,6 +96,19 @@ declare const hostActivityForPv: (activity: "options" | "configuring" | "idle",
|
|
|
96
96
|
* the honest degradation: the game stays correct, the animation is missing.
|
|
97
97
|
*/
|
|
98
98
|
declare const COMEBACK_BONUS_MIN_PV = 7;
|
|
99
|
+
/**
|
|
100
|
+
* The effects safe to send a client of version `pv`.
|
|
101
|
+
*
|
|
102
|
+
* ⚠️ WITHHOLDING IS THE ONLY OPTION FOR AN EFFECT, and it is why this is a filter rather than a
|
|
103
|
+
* mapper like `hostActivityForPv`. An unknown `hostActivity` string could be down-mapped to an older
|
|
104
|
+
* word that means nearly the same thing; an unknown effect VARIANT has no older equivalent, and
|
|
105
|
+
* inventing one (sending `scorePop` instead) would make the client animate a normal score change for
|
|
106
|
+
* an event that is not one.
|
|
107
|
+
*/
|
|
108
|
+
/** Every comeback effect, as ONE list. ⚠️ Exported because the relay's `CLIENT_FX` allow-list must be
|
|
109
|
+
* built from it rather than re-typed: I re-typed it, listed one of the three, and shipped a feature
|
|
110
|
+
* whose refusal rendered as silence on prod. A hand-list that fails by OMISSION errors nowhere. */
|
|
111
|
+
declare const COMEBACK_EFFECTS: readonly ["comebackOffer", "comebackBonus", "comebackDeclined"];
|
|
99
112
|
declare const effectsForPv: (effects: Effect[], pv: number | undefined) => Effect[];
|
|
100
113
|
declare const gamesForPv: (pv: number) => GameInfo[];
|
|
101
114
|
/** The gameId to SEND a client of version `pv`: new games need pv >= their minPv; older clients see 'trivia'. */
|
|
@@ -176,6 +189,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
176
189
|
pv: z.ZodOptional<z.ZodNumber>;
|
|
177
190
|
idToken: z.ZodOptional<z.ZodString>;
|
|
178
191
|
platform: z.ZodOptional<z.ZodEnum<["web", "ios", "android", "tv"]>>;
|
|
192
|
+
games: z.ZodOptional<z.ZodArray<z.ZodEnum<["seedha", "snag", "trivia", "dama", "ersimha", "sebaq"]>, "many">>;
|
|
179
193
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
180
194
|
}, "strip", z.ZodTypeAny, {
|
|
181
195
|
t: "createRoom";
|
|
@@ -189,6 +203,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
189
203
|
pv?: number | undefined;
|
|
190
204
|
idToken?: string | undefined;
|
|
191
205
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
206
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
192
207
|
appVersion?: string | undefined;
|
|
193
208
|
}, {
|
|
194
209
|
t: "createRoom";
|
|
@@ -202,6 +217,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
202
217
|
pv?: number | undefined;
|
|
203
218
|
idToken?: string | undefined;
|
|
204
219
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
220
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
205
221
|
appVersion?: string | undefined;
|
|
206
222
|
}>, z.ZodObject<{
|
|
207
223
|
t: z.ZodLiteral<"renameHost">;
|
|
@@ -260,6 +276,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
260
276
|
pv: z.ZodOptional<z.ZodNumber>;
|
|
261
277
|
idToken: z.ZodOptional<z.ZodString>;
|
|
262
278
|
platform: z.ZodOptional<z.ZodEnum<["web", "ios", "android", "tv"]>>;
|
|
279
|
+
games: z.ZodOptional<z.ZodArray<z.ZodEnum<["seedha", "snag", "trivia", "dama", "ersimha", "sebaq"]>, "many">>;
|
|
263
280
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
264
281
|
}, "strip", z.ZodTypeAny, {
|
|
265
282
|
code: string;
|
|
@@ -273,6 +290,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
273
290
|
pv?: number | undefined;
|
|
274
291
|
idToken?: string | undefined;
|
|
275
292
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
293
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
276
294
|
appVersion?: string | undefined;
|
|
277
295
|
}, {
|
|
278
296
|
code: string;
|
|
@@ -286,6 +304,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
286
304
|
pv?: number | undefined;
|
|
287
305
|
idToken?: string | undefined;
|
|
288
306
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
307
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
289
308
|
appVersion?: string | undefined;
|
|
290
309
|
}>, z.ZodObject<{
|
|
291
310
|
t: z.ZodLiteral<"resume">;
|
|
@@ -305,6 +324,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
305
324
|
pv: z.ZodOptional<z.ZodNumber>;
|
|
306
325
|
idToken: z.ZodOptional<z.ZodString>;
|
|
307
326
|
platform: z.ZodOptional<z.ZodEnum<["web", "ios", "android", "tv"]>>;
|
|
327
|
+
games: z.ZodOptional<z.ZodArray<z.ZodEnum<["seedha", "snag", "trivia", "dama", "ersimha", "sebaq"]>, "many">>;
|
|
308
328
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
309
329
|
}, "strip", z.ZodTypeAny, {
|
|
310
330
|
code: string;
|
|
@@ -318,6 +338,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
318
338
|
pv?: number | undefined;
|
|
319
339
|
idToken?: string | undefined;
|
|
320
340
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
341
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
321
342
|
appVersion?: string | undefined;
|
|
322
343
|
}, {
|
|
323
344
|
code: string;
|
|
@@ -331,6 +352,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
331
352
|
pv?: number | undefined;
|
|
332
353
|
idToken?: string | undefined;
|
|
333
354
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
355
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
334
356
|
appVersion?: string | undefined;
|
|
335
357
|
}>, z.ZodObject<{
|
|
336
358
|
t: z.ZodLiteral<"setPlaying">;
|
|
@@ -1340,4 +1362,4 @@ interface MyQuestionRow {
|
|
|
1340
1362
|
};
|
|
1341
1363
|
}
|
|
1342
1364
|
|
|
1343
|
-
export { type AvatarView, type BuzzerGameMode, CHARACTER_IDS, COMEBACK_BONUS_MIN_PV, type CategoryView, type CharacterId, ClientMsg, type DamaMoveView, type DamaPieceView, type DamaStateView, EMOTE_IDS, type Effect, type EmoteId, type ErsimhaStateView, GAMES, GAME_IDS, type GameId, type GameInfo, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, MIN_SUPPORTED_PV, MODES, MODE_IDS, type ModeId, type ModeInfo, type MyQuestionRow, PROTOCOL_VERSION, type PackView, type QuestionView, REJECT_REASONS, ROOM_ALPHABET, type RejectReason, type RosterEntry, SUBMISSION_KINDS, SUBMISSION_STATUSES, type SebaqStandingRow, type SebaqStateView, type ServerMsg, type SoundName, type StrokePointView, type SubmissionKind, type SubmissionStatus, type TeamSlotView, type TeamView, type YouContext, effectsForPv, gameIdForPv, gamesForPv, hostActivityForPv, modesForGame, normalizeWesternDigits, sanitizeName };
|
|
1365
|
+
export { type AvatarView, type BuzzerGameMode, CHARACTER_IDS, COMEBACK_BONUS_MIN_PV, COMEBACK_EFFECTS, type CategoryView, type CharacterId, ClientMsg, type DamaMoveView, type DamaPieceView, type DamaStateView, EMOTE_IDS, type Effect, type EmoteId, type ErsimhaStateView, GAMES, GAME_IDS, type GameId, type GameInfo, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, MIN_SUPPORTED_PV, MODES, MODE_IDS, type ModeId, type ModeInfo, type MyQuestionRow, PROTOCOL_VERSION, type PackView, type QuestionView, REJECT_REASONS, ROOM_ALPHABET, type RejectReason, type RosterEntry, SUBMISSION_KINDS, SUBMISSION_STATUSES, type SebaqStandingRow, type SebaqStateView, type ServerMsg, type SoundName, type StrokePointView, type SubmissionKind, type SubmissionStatus, type TeamSlotView, type TeamView, type YouContext, effectsForPv, gameIdForPv, gamesForPv, hostActivityForPv, modesForGame, normalizeWesternDigits, sanitizeName };
|
package/dist/index.d.ts
CHANGED
|
@@ -96,6 +96,19 @@ declare const hostActivityForPv: (activity: "options" | "configuring" | "idle",
|
|
|
96
96
|
* the honest degradation: the game stays correct, the animation is missing.
|
|
97
97
|
*/
|
|
98
98
|
declare const COMEBACK_BONUS_MIN_PV = 7;
|
|
99
|
+
/**
|
|
100
|
+
* The effects safe to send a client of version `pv`.
|
|
101
|
+
*
|
|
102
|
+
* ⚠️ WITHHOLDING IS THE ONLY OPTION FOR AN EFFECT, and it is why this is a filter rather than a
|
|
103
|
+
* mapper like `hostActivityForPv`. An unknown `hostActivity` string could be down-mapped to an older
|
|
104
|
+
* word that means nearly the same thing; an unknown effect VARIANT has no older equivalent, and
|
|
105
|
+
* inventing one (sending `scorePop` instead) would make the client animate a normal score change for
|
|
106
|
+
* an event that is not one.
|
|
107
|
+
*/
|
|
108
|
+
/** Every comeback effect, as ONE list. ⚠️ Exported because the relay's `CLIENT_FX` allow-list must be
|
|
109
|
+
* built from it rather than re-typed: I re-typed it, listed one of the three, and shipped a feature
|
|
110
|
+
* whose refusal rendered as silence on prod. A hand-list that fails by OMISSION errors nowhere. */
|
|
111
|
+
declare const COMEBACK_EFFECTS: readonly ["comebackOffer", "comebackBonus", "comebackDeclined"];
|
|
99
112
|
declare const effectsForPv: (effects: Effect[], pv: number | undefined) => Effect[];
|
|
100
113
|
declare const gamesForPv: (pv: number) => GameInfo[];
|
|
101
114
|
/** The gameId to SEND a client of version `pv`: new games need pv >= their minPv; older clients see 'trivia'. */
|
|
@@ -176,6 +189,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
176
189
|
pv: z.ZodOptional<z.ZodNumber>;
|
|
177
190
|
idToken: z.ZodOptional<z.ZodString>;
|
|
178
191
|
platform: z.ZodOptional<z.ZodEnum<["web", "ios", "android", "tv"]>>;
|
|
192
|
+
games: z.ZodOptional<z.ZodArray<z.ZodEnum<["seedha", "snag", "trivia", "dama", "ersimha", "sebaq"]>, "many">>;
|
|
179
193
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
180
194
|
}, "strip", z.ZodTypeAny, {
|
|
181
195
|
t: "createRoom";
|
|
@@ -189,6 +203,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
189
203
|
pv?: number | undefined;
|
|
190
204
|
idToken?: string | undefined;
|
|
191
205
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
206
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
192
207
|
appVersion?: string | undefined;
|
|
193
208
|
}, {
|
|
194
209
|
t: "createRoom";
|
|
@@ -202,6 +217,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
202
217
|
pv?: number | undefined;
|
|
203
218
|
idToken?: string | undefined;
|
|
204
219
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
220
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
205
221
|
appVersion?: string | undefined;
|
|
206
222
|
}>, z.ZodObject<{
|
|
207
223
|
t: z.ZodLiteral<"renameHost">;
|
|
@@ -260,6 +276,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
260
276
|
pv: z.ZodOptional<z.ZodNumber>;
|
|
261
277
|
idToken: z.ZodOptional<z.ZodString>;
|
|
262
278
|
platform: z.ZodOptional<z.ZodEnum<["web", "ios", "android", "tv"]>>;
|
|
279
|
+
games: z.ZodOptional<z.ZodArray<z.ZodEnum<["seedha", "snag", "trivia", "dama", "ersimha", "sebaq"]>, "many">>;
|
|
263
280
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
264
281
|
}, "strip", z.ZodTypeAny, {
|
|
265
282
|
code: string;
|
|
@@ -273,6 +290,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
273
290
|
pv?: number | undefined;
|
|
274
291
|
idToken?: string | undefined;
|
|
275
292
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
293
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
276
294
|
appVersion?: string | undefined;
|
|
277
295
|
}, {
|
|
278
296
|
code: string;
|
|
@@ -286,6 +304,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
286
304
|
pv?: number | undefined;
|
|
287
305
|
idToken?: string | undefined;
|
|
288
306
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
307
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
289
308
|
appVersion?: string | undefined;
|
|
290
309
|
}>, z.ZodObject<{
|
|
291
310
|
t: z.ZodLiteral<"resume">;
|
|
@@ -305,6 +324,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
305
324
|
pv: z.ZodOptional<z.ZodNumber>;
|
|
306
325
|
idToken: z.ZodOptional<z.ZodString>;
|
|
307
326
|
platform: z.ZodOptional<z.ZodEnum<["web", "ios", "android", "tv"]>>;
|
|
327
|
+
games: z.ZodOptional<z.ZodArray<z.ZodEnum<["seedha", "snag", "trivia", "dama", "ersimha", "sebaq"]>, "many">>;
|
|
308
328
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
309
329
|
}, "strip", z.ZodTypeAny, {
|
|
310
330
|
code: string;
|
|
@@ -318,6 +338,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
318
338
|
pv?: number | undefined;
|
|
319
339
|
idToken?: string | undefined;
|
|
320
340
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
341
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
321
342
|
appVersion?: string | undefined;
|
|
322
343
|
}, {
|
|
323
344
|
code: string;
|
|
@@ -331,6 +352,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
|
|
|
331
352
|
pv?: number | undefined;
|
|
332
353
|
idToken?: string | undefined;
|
|
333
354
|
platform?: "web" | "ios" | "android" | "tv" | undefined;
|
|
355
|
+
games?: ("seedha" | "snag" | "trivia" | "dama" | "ersimha" | "sebaq")[] | undefined;
|
|
334
356
|
appVersion?: string | undefined;
|
|
335
357
|
}>, z.ZodObject<{
|
|
336
358
|
t: z.ZodLiteral<"setPlaying">;
|
|
@@ -1340,4 +1362,4 @@ interface MyQuestionRow {
|
|
|
1340
1362
|
};
|
|
1341
1363
|
}
|
|
1342
1364
|
|
|
1343
|
-
export { type AvatarView, type BuzzerGameMode, CHARACTER_IDS, COMEBACK_BONUS_MIN_PV, type CategoryView, type CharacterId, ClientMsg, type DamaMoveView, type DamaPieceView, type DamaStateView, EMOTE_IDS, type Effect, type EmoteId, type ErsimhaStateView, GAMES, GAME_IDS, type GameId, type GameInfo, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, MIN_SUPPORTED_PV, MODES, MODE_IDS, type ModeId, type ModeInfo, type MyQuestionRow, PROTOCOL_VERSION, type PackView, type QuestionView, REJECT_REASONS, ROOM_ALPHABET, type RejectReason, type RosterEntry, SUBMISSION_KINDS, SUBMISSION_STATUSES, type SebaqStandingRow, type SebaqStateView, type ServerMsg, type SoundName, type StrokePointView, type SubmissionKind, type SubmissionStatus, type TeamSlotView, type TeamView, type YouContext, effectsForPv, gameIdForPv, gamesForPv, hostActivityForPv, modesForGame, normalizeWesternDigits, sanitizeName };
|
|
1365
|
+
export { type AvatarView, type BuzzerGameMode, CHARACTER_IDS, COMEBACK_BONUS_MIN_PV, COMEBACK_EFFECTS, type CategoryView, type CharacterId, ClientMsg, type DamaMoveView, type DamaPieceView, type DamaStateView, EMOTE_IDS, type Effect, type EmoteId, type ErsimhaStateView, GAMES, GAME_IDS, type GameId, type GameInfo, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, MIN_SUPPORTED_PV, MODES, MODE_IDS, type ModeId, type ModeInfo, type MyQuestionRow, PROTOCOL_VERSION, type PackView, type QuestionView, REJECT_REASONS, ROOM_ALPHABET, type RejectReason, type RosterEntry, SUBMISSION_KINDS, SUBMISSION_STATUSES, type SebaqStandingRow, type SebaqStateView, type ServerMsg, type SoundName, type StrokePointView, type SubmissionKind, type SubmissionStatus, type TeamSlotView, type TeamView, type YouContext, effectsForPv, gameIdForPv, gamesForPv, hostActivityForPv, modesForGame, normalizeWesternDigits, sanitizeName };
|
package/dist/index.js
CHANGED
|
@@ -41,8 +41,9 @@ var GAMES = [
|
|
|
41
41
|
];
|
|
42
42
|
var hostActivityForPv = (activity, pv) => activity === "options" && (pv ?? MIN_SUPPORTED_PV) < 6 ? "configuring" : activity;
|
|
43
43
|
var COMEBACK_BONUS_MIN_PV = 7;
|
|
44
|
-
var COMEBACK_EFFECTS =
|
|
45
|
-
var
|
|
44
|
+
var COMEBACK_EFFECTS = ["comebackOffer", "comebackBonus", "comebackDeclined"];
|
|
45
|
+
var COMEBACK_EFFECT_SET = new Set(COMEBACK_EFFECTS);
|
|
46
|
+
var effectsForPv = (effects, pv) => (pv ?? MIN_SUPPORTED_PV) >= COMEBACK_BONUS_MIN_PV ? effects : effects.filter((e) => !COMEBACK_EFFECT_SET.has(e.t));
|
|
46
47
|
var gamesForPv = (pv) => GAMES.filter((g) => !g.deprecated && g.minPv <= pv);
|
|
47
48
|
var gameIdForPv = (gameId, pv) => {
|
|
48
49
|
const g = GAMES.find((x) => x.id === gameId);
|
|
@@ -77,6 +78,7 @@ var HelpType = z.enum([
|
|
|
77
78
|
var Pv = z.number().int().min(1).max(1e6).optional();
|
|
78
79
|
var IdToken = z.string().max(4096).optional();
|
|
79
80
|
var Platform = z.enum(["web", "ios", "android", "tv"]).optional();
|
|
81
|
+
var Games = z.array(z.enum(GAME_IDS)).max(GAME_IDS.length).optional();
|
|
80
82
|
var AppVersion = z.string().trim().max(24).regex(/^[0-9]+(\.[0-9]+){0,3}([-+][0-9A-Za-z.-]+)?$/, "bad app version").optional();
|
|
81
83
|
var Avatar = z.object({
|
|
82
84
|
emoji: z.string().min(1).max(16).transform((s) => s.replace(UNSAFE_CHARS, "")).refine((s) => s.length >= 1, "empty emoji"),
|
|
@@ -85,7 +87,7 @@ var Avatar = z.object({
|
|
|
85
87
|
var Character = z.enum(CHARACTER_IDS);
|
|
86
88
|
var ClientMsg = z.discriminatedUnion("t", [
|
|
87
89
|
// room / lobby
|
|
88
|
-
z.object({ t: z.literal("createRoom"), name: DisplayName.optional(), avatar: Avatar.optional(), game: z.enum(GAME_IDS).optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, appVersion: AppVersion }),
|
|
90
|
+
z.object({ t: z.literal("createRoom"), name: DisplayName.optional(), avatar: Avatar.optional(), game: z.enum(GAME_IDS).optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, games: Games, appVersion: AppVersion }),
|
|
89
91
|
// Host sets/changes their display name AFTER createRoom (for anonymous one-tap
|
|
90
92
|
// hosts who started nameless). Host-only; the relay re-broadcasts the lobby.
|
|
91
93
|
// SUPERSEDED by setProfile (kept working for shipped builds).
|
|
@@ -99,8 +101,8 @@ var ClientMsg = z.discriminatedUnion("t", [
|
|
|
99
101
|
// view carries names+avatars so it updates live; dama/ersimha views are id-keyed (clients
|
|
100
102
|
// map ids→names from the lobby roster), so a change there lands on the next lobby.
|
|
101
103
|
z.object({ t: z.literal("setProfile"), name: DisplayName.optional(), avatar: Avatar.optional(), character: Character.optional() }),
|
|
102
|
-
z.object({ t: z.literal("joinRoom"), code: RoomCode, name: DisplayName, avatar: Avatar.optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, appVersion: AppVersion }),
|
|
103
|
-
z.object({ t: z.literal("resume"), code: RoomCode, token: z.string().max(120), avatar: Avatar.optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, appVersion: AppVersion }),
|
|
104
|
+
z.object({ t: z.literal("joinRoom"), code: RoomCode, name: DisplayName, avatar: Avatar.optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, games: Games, appVersion: AppVersion }),
|
|
105
|
+
z.object({ t: z.literal("resume"), code: RoomCode, token: z.string().max(120), avatar: Avatar.optional(), character: Character.optional(), pv: Pv, idToken: IdToken, platform: Platform, games: Games, appVersion: AppVersion }),
|
|
104
106
|
// `tally` (gs#46) = wins per PLAYER across every game this room has played tonight — «نتيجة الليلة».
|
|
105
107
|
// Keyed by playerId, NOT by team: team names are recycled each game, so a per-team count means nothing
|
|
106
108
|
// across a night. Survives playAgain. A One Device game credits nobody (its team slots hold no players).
|
|
@@ -315,6 +317,7 @@ var REJECT_REASONS = ["duplicate", "unclear_answer", "not_family", "inaccurate",
|
|
|
315
317
|
export {
|
|
316
318
|
CHARACTER_IDS,
|
|
317
319
|
COMEBACK_BONUS_MIN_PV,
|
|
320
|
+
COMEBACK_EFFECTS,
|
|
318
321
|
ClientMsg,
|
|
319
322
|
EMOTE_IDS,
|
|
320
323
|
GAMES,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegeem/protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"description": "Geem's wire protocol — shared zod schemas + TypeScript types for talking to the Geem game server over Socket.IO. The source of truth all clients implement against.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://geem.tv",
|