Files
scrabble-game/ui/src/gen/fbs/scrabblefb/your-turn-event.ts
T
Ilia Denisov 41a642ef97
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 37s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m8s
R4: push enrichment — events carry a state delta, kill the last poll
Enrich the in-app live stream into a delta channel so the UI renders a move from the event without a follow-up game.state, and make the matchmaking poll a stream-down fallback.

- pkg/fbs: trailing fields on opponent_moved (move+game+bag_len), your_turn (move_count), match_found (state), game_over (game), notify (account/invitation/state), MoveResult (rack+bag_len); regenerate Go + TS.
- backend: notify owns the FB encoding (encode.go + payload.go input structs); game/lobby/social map their domain types in. emitMove builds the move delta; game.Service.InitialState feeds match_found/game_started the recipient's initial StateView; friends/invitations notify carry their account/invitation. The move-commit response (submit_play/pass/exchange/resign) returns the actor's refilled rack + bag size.
- gateway: MoveResult transcode carries rack+bag_len.
- ui: pure lib/gamedelta.ts reducer advances the per-game cache keyed on move_count (idempotent + gap-safe); app.svelte seeds the cache on match_found/game_started; Game.svelte applies the delta (commit/pass/exchange/resign drop their load()); NewGame polls only while app.streamAlive is false.
- docs: ARCHITECTURE §10, FUNCTIONAL(+ru), backend/gateway/ui READMEs; PRERELEASE R4 marked done + Refinements.
2026-06-10 08:01:50 +02:00

117 lines
4.4 KiB
TypeScript

// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class YourTurnEvent {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):YourTurnEvent {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsYourTurnEvent(bb:flatbuffers.ByteBuffer, obj?:YourTurnEvent):YourTurnEvent {
return (obj || new YourTurnEvent()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsYourTurnEvent(bb:flatbuffers.ByteBuffer, obj?:YourTurnEvent):YourTurnEvent {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new YourTurnEvent()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
gameId():string|null
gameId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
gameId(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
deadlineUnix():bigint {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}
opponentName():string|null
opponentName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
opponentName(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
lastAction():string|null
lastAction(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
lastAction(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
lastWord():string|null
lastWord(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
lastWord(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
scoreLine():string|null
scoreLine(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
scoreLine(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
moveCount():number {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
static startYourTurnEvent(builder:flatbuffers.Builder) {
builder.startObject(7);
}
static addGameId(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, gameIdOffset, 0);
}
static addDeadlineUnix(builder:flatbuffers.Builder, deadlineUnix:bigint) {
builder.addFieldInt64(1, deadlineUnix, BigInt('0'));
}
static addOpponentName(builder:flatbuffers.Builder, opponentNameOffset:flatbuffers.Offset) {
builder.addFieldOffset(2, opponentNameOffset, 0);
}
static addLastAction(builder:flatbuffers.Builder, lastActionOffset:flatbuffers.Offset) {
builder.addFieldOffset(3, lastActionOffset, 0);
}
static addLastWord(builder:flatbuffers.Builder, lastWordOffset:flatbuffers.Offset) {
builder.addFieldOffset(4, lastWordOffset, 0);
}
static addScoreLine(builder:flatbuffers.Builder, scoreLineOffset:flatbuffers.Offset) {
builder.addFieldOffset(5, scoreLineOffset, 0);
}
static addMoveCount(builder:flatbuffers.Builder, moveCount:number) {
builder.addFieldInt32(6, moveCount, 0);
}
static endYourTurnEvent(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createYourTurnEvent(builder:flatbuffers.Builder, gameIdOffset:flatbuffers.Offset, deadlineUnix:bigint, opponentNameOffset:flatbuffers.Offset, lastActionOffset:flatbuffers.Offset, lastWordOffset:flatbuffers.Offset, scoreLineOffset:flatbuffers.Offset, moveCount:number):flatbuffers.Offset {
YourTurnEvent.startYourTurnEvent(builder);
YourTurnEvent.addGameId(builder, gameIdOffset);
YourTurnEvent.addDeadlineUnix(builder, deadlineUnix);
YourTurnEvent.addOpponentName(builder, opponentNameOffset);
YourTurnEvent.addLastAction(builder, lastActionOffset);
YourTurnEvent.addLastWord(builder, lastWordOffset);
YourTurnEvent.addScoreLine(builder, scoreLineOffset);
YourTurnEvent.addMoveCount(builder, moveCount);
return YourTurnEvent.endYourTurnEvent(builder);
}
}