@caisual/kit 0.15.0 → 0.16.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.
@@ -1,5 +1,6 @@
1
+ import type { ReplayClient } from '../replay/index.js';
1
2
  import { type OverlayCapabilities, type OverlayConfiguration, type OverlayPanel, type OverlayRequest, type OverlaySessionState, type OverlayView, type QueuedScore } from '../contracts/index.js';
2
- import type { BaseConnection, Room, Rooms, Spectate } from '../index.js';
3
+ import type { BaseConnection, Room, Rooms, ReplayRooms, Spectate } from '../index.js';
3
4
  export type GameSession = {
4
5
  kind: 'idle';
5
6
  } | {
@@ -27,10 +28,10 @@ export interface Overlay {
27
28
  open(panel: OverlayPanel): void;
28
29
  onChange(listener: (view: OverlayView) => void): () => void;
29
30
  }
30
- export declare function createSession(base: BaseConnection, configuration?: OverlayConfiguration | null, roomsAvailable?: boolean): {
31
+ export declare function createSession(base: BaseConnection, configuration?: OverlayConfiguration | null, roomsAvailable?: boolean, replay?: ReplayClient | null): {
31
32
  session: Session;
32
33
  overlay: Overlay;
33
- rooms: Rooms;
34
+ rooms: ReplayRooms | Rooms;
34
35
  snapshot: () => OverlaySessionState;
35
36
  serverTime: () => number;
36
37
  onState(listener: (value: OverlaySessionState) => void): () => void;
@@ -71,6 +71,7 @@ export declare class NucleoStanza {
71
71
  private eliminaDeposito;
72
72
  private elencaDeposito;
73
73
  private incrementaDeposito;
74
+ private messaggioCreatore;
74
75
  private broadcastCreatore;
75
76
  private inviaCreatore;
76
77
  private broadcast;
@@ -81,6 +82,7 @@ export declare class NucleoStanza {
81
82
  private inviaGiocatori;
82
83
  private inviaStatus;
83
84
  private inviaDiff;
85
+ private iniziaReplay;
84
86
  private inviaSnapshotTutti;
85
87
  private chiama;
86
88
  private applicaAzioni;
@@ -8,6 +8,7 @@ export interface ManifestStanza {
8
8
  };
9
9
  lobby: boolean;
10
10
  persistent?: boolean;
11
+ replays?: boolean;
11
12
  boards?: Record<string, {
12
13
  source: 'client' | 'server';
13
14
  day?: 'submit' | 'start';
@@ -43,6 +44,7 @@ export interface AdattatoreStanza {
43
44
  readonly storage: ArchivioStanza;
44
45
  readonly deposito: DepositoCondiviso | null;
45
46
  invia(connessione: string, messaggio: MessaggioServerStanza): void;
47
+ inizioReplay?(fotografia: import('../protocollo.js').FotografiaStanza): void;
46
48
  pubblica(messaggio: MessaggioServerStanza): void;
47
49
  chiudi(connessione: string, codice: number, motivo: string): void;
48
50
  connessioniAttive(): readonly string[];
@@ -1,6 +1,7 @@
1
- import type { Rooms } from '../index.js';
1
+ import type { JsonValue, Rooms } from '../index.js';
2
2
  import { type ErroreCaisual } from '../errors.js';
3
3
  import type { GestoreBiglietto } from '../handshake.js';
4
+ import type { OperazioneDiff } from '../protocollo.js';
4
5
  import { type DipendenzeVoce } from '../voce/index.js';
5
6
  interface TimerStanza {
6
7
  setTimeout(handler: () => void, timeout: number): number;
@@ -23,6 +24,13 @@ export interface DipendenzeStanze extends TimerStanza {
23
24
  code: string;
24
25
  } | null): void;
25
26
  }
27
+ type RisultatoPatch = {
28
+ ok: true;
29
+ state: JsonValue;
30
+ } | {
31
+ ok: false;
32
+ };
33
+ export declare function applicaPatch(state: JsonValue, value: OperazioneDiff[]): RisultatoPatch;
26
34
  export declare function creaStanzeOffline(invited?: string | null): Rooms;
27
35
  export declare function creaGestoreStanze(input: DipendenzeStanze, invited: string | null): Rooms;
28
36
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caisual/kit",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Client and server kit for Caisual games",
5
5
  "type": "module",
6
6
  "files": [