@caisual/kit 0.10.0 → 0.13.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,6 +1,11 @@
1
+ export type { MatchResult } from '../contracts/index.js';
1
2
  export type JsonValue = null | boolean | number | string | JsonValue[] | {
2
3
  [key: string]: JsonValue;
3
4
  };
5
+ export type RematchOptions = boolean | {
6
+ keepSetup?: boolean;
7
+ autoStart?: boolean;
8
+ };
4
9
  export type RoomStatus = 'lobby' | 'countdown' | 'playing' | 'finished' | 'ended';
5
10
  export type VoiceMode = 'none' | 'room' | 'team' | 'proximity';
6
11
  export type LeaveReason = 'left' | 'timeout' | 'kicked';
@@ -36,20 +41,26 @@ export interface Room<State extends JsonValue = JsonValue> {
36
41
  setRole(player: Player | string, role: string): void;
37
42
  setTeam(player: Player | string, team: number): void;
38
43
  end(result: JsonValue, options?: {
39
- rematch?: boolean;
44
+ rematch?: RematchOptions;
40
45
  }): void;
41
46
  save(key: string, value: JsonValue): Promise<void>;
42
47
  load(key: string): Promise<JsonValue | null>;
43
48
  readonly shared: SharedGameStore;
44
49
  schedule(milliseconds: number, handler: string, payload: JsonValue): void;
45
50
  readonly board: {
51
+ submit(board: string, score: number, options?: {
52
+ daily?: boolean;
53
+ day?: string;
54
+ }): void;
46
55
  submit(player: Player | string, board: string, score: number, options?: {
47
56
  daily?: boolean;
57
+ day?: string;
48
58
  }): void;
49
59
  };
50
60
  readonly daily: {
51
61
  readonly day: string;
52
62
  readonly seed: number;
63
+ readonly expiresAt: number;
53
64
  };
54
65
  readonly time: {
55
66
  now(): number;
@@ -36,7 +36,7 @@ export declare function createSession(base: BaseConnection, configuration?: Over
36
36
  onState(listener: (value: OverlaySessionState) => void): () => void;
37
37
  onOpen(listener: (value: OverlayPanel) => void): () => void;
38
38
  onError(listener: (value: {
39
- sessionId: string;
39
+ sessionId: string | null;
40
40
  error: {
41
41
  code: string;
42
42
  message: string;
@@ -46,6 +46,8 @@ export declare class NucleoStanza {
46
46
  private giocatorePerModificaDalServer;
47
47
  private erroreMinimi;
48
48
  private rivincita;
49
+ private prontiRivincita;
50
+ private avviaRivincita;
49
51
  private avviaCountdown;
50
52
  private verificaCountdown;
51
53
  private messaggioErrato;
@@ -55,6 +57,7 @@ export declare class NucleoStanza {
55
57
  private eseguiTimer;
56
58
  private pianifica;
57
59
  private giornata;
60
+ private contestoGiornaliero;
58
61
  private accodaPunteggio;
59
62
  private richiediFine;
60
63
  private salva;
@@ -8,6 +8,10 @@ export interface ManifestStanza {
8
8
  };
9
9
  lobby: boolean;
10
10
  persistent?: boolean;
11
+ boards?: Record<string, {
12
+ source: 'client' | 'server';
13
+ day?: 'submit' | 'start';
14
+ }>;
11
15
  roles: Array<{
12
16
  id: string;
13
17
  min: number;
@@ -96,6 +100,13 @@ export interface StatoPersistito {
96
100
  hostId: string | null;
97
101
  result: JsonValue | null;
98
102
  resultAt: number | null;
103
+ daily?: import('../daily.js').DailyContext;
104
+ rivincita?: {
105
+ keepSetup: boolean;
106
+ autoStart: boolean;
107
+ } | null;
108
+ prontiPrecedenti?: string[];
109
+ countdownRivincita?: boolean;
99
110
  rivincitaFinoA?: number | null;
100
111
  countdownAt: number | null;
101
112
  timer: TimerPersistito[];
@@ -1,4 +1,5 @@
1
1
  import type { Rooms } from '../index.js';
2
+ import { type ErroreCaisual } from '../errors.js';
2
3
  import type { GestoreBiglietto } from '../handshake.js';
3
4
  import { type DipendenzeVoce } from '../voce/index.js';
4
5
  interface TimerStanza {
@@ -8,6 +9,9 @@ interface TimerStanza {
8
9
  clearInterval(id: number): void;
9
10
  }
10
11
  export interface DipendenzeStanze extends TimerStanza {
12
+ n: number;
13
+ reload?(target?: import('../contracts/index.js').RicaricaGioco): void;
14
+ onVersionError?(error: ErroreCaisual, target?: import('../contracts/index.js').RicaricaGioco): void;
11
15
  appOrigin: string;
12
16
  liveOrigin: string;
13
17
  fetcher: typeof fetch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caisual/kit",
3
- "version": "0.10.0",
3
+ "version": "0.13.0",
4
4
  "description": "Client and server kit for Caisual games",
5
5
  "type": "module",
6
6
  "files": [