@rb-games/core 0.1.5 → 0.2.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/helpers/index.js +1 -1
  3. package/dist/plugins/index.d.ts +1 -1
  4. package/dist/plugins/index.d.ts.map +1 -1
  5. package/dist/plugins/index.js +2 -515
  6. package/dist/plugins/index.js.map +1 -1
  7. package/dist/plugins/language/I18NextPlugin.types.d.ts +2 -2
  8. package/dist/state-machine/StateMachine.d.ts +18 -0
  9. package/dist/state-machine/StateMachine.d.ts.map +1 -1
  10. package/dist/state-machine/index.js +37 -10
  11. package/dist/state-machine/index.js.map +1 -1
  12. package/dist/utils/index.js +1 -1
  13. package/package.json +1 -1
  14. package/dist/plugins/service/ServiceAdapter.d.ts +0 -88
  15. package/dist/plugins/service/ServiceAdapter.d.ts.map +0 -1
  16. package/dist/plugins/service/ServiceEventHelper.d.ts +0 -6
  17. package/dist/plugins/service/ServiceEventHelper.d.ts.map +0 -1
  18. package/dist/plugins/service/ServicePlugin.d.ts +0 -135
  19. package/dist/plugins/service/ServicePlugin.d.ts.map +0 -1
  20. package/dist/plugins/service/ServicePlugin.types.d.ts +0 -14
  21. package/dist/plugins/service/ServicePlugin.types.d.ts.map +0 -1
  22. package/dist/plugins/service/adapters/DevAuthAdapter.d.ts +0 -56
  23. package/dist/plugins/service/adapters/DevAuthAdapter.d.ts.map +0 -1
  24. package/dist/plugins/service/adapters/RGSAdapter.d.ts +0 -82
  25. package/dist/plugins/service/adapters/RGSAdapter.d.ts.map +0 -1
  26. package/dist/plugins/service/adapters/index.d.ts +0 -7
  27. package/dist/plugins/service/adapters/index.d.ts.map +0 -1
  28. package/dist/plugins/service/adapters/resolvePublicIp.d.ts +0 -10
  29. package/dist/plugins/service/adapters/resolvePublicIp.d.ts.map +0 -1
  30. package/dist/plugins/service/index.d.ts +0 -10
  31. package/dist/plugins/service/index.d.ts.map +0 -1
  32. package/dist/plugins/service/types/api.types.d.ts +0 -299
  33. package/dist/plugins/service/types/api.types.d.ts.map +0 -1
  34. package/dist/plugins/service/types/index.d.ts +0 -6
  35. package/dist/plugins/service/types/index.d.ts.map +0 -1
@@ -1,299 +0,0 @@
1
- /**
2
- * Backend API Type Definitions
3
- * Based on Swagger API at /api-json
4
- * @module ServicePlugin/Types
5
- */
6
- /**
7
- * Session state enum
8
- */
9
- export type SessionState = 'ready' | 'processing' | 'finished';
10
- /**
11
- * Symbol type enum
12
- */
13
- export type SymbolType = 'regular' | 'wild' | 'scatter' | 'bonus' | 'cluster';
14
- /**
15
- * Win model type
16
- */
17
- export type WinModel = 'cluster' | 'line' | 'ways';
18
- /**
19
- * Game state type
20
- */
21
- export type GameStateType = 'basic' | 'bonus';
22
- /**
23
- * Symbol definition
24
- */
25
- export interface SymbolDefinition {
26
- id: number;
27
- name: string;
28
- type: SymbolType;
29
- }
30
- /**
31
- * Board configuration
32
- */
33
- export interface BoardConfig {
34
- reels: number;
35
- rows: number;
36
- }
37
- /**
38
- * Payout entry for a specific count
39
- */
40
- export interface PayoutEntry {
41
- count: number;
42
- value: number;
43
- andMore?: boolean;
44
- }
45
- /**
46
- * Symbol payout configuration
47
- */
48
- export interface SymbolPayout {
49
- symbolId: number;
50
- payouts: PayoutEntry[];
51
- }
52
- /**
53
- * Cluster paytable configuration
54
- */
55
- export interface ClusterPaytable {
56
- minCount: number;
57
- decimalBase: number;
58
- payouts: SymbolPayout[];
59
- }
60
- /**
61
- * Paytable configuration
62
- */
63
- export interface PaytableConfig {
64
- cluster?: ClusterPaytable;
65
- }
66
- /**
67
- * Free spins award entry
68
- */
69
- export interface FreeSpinsAward {
70
- count: number;
71
- spins: number;
72
- andMore?: boolean;
73
- }
74
- /**
75
- * Free spins configuration
76
- */
77
- export interface FreeSpinsConfig {
78
- awards: FreeSpinsAward[];
79
- }
80
- /**
81
- * buy bonus configuration
82
- */
83
- export interface GameActions {
84
- type: string;
85
- totalBetMultiplier: number;
86
- count?: number;
87
- }
88
- /**
89
- * Complete game configuration from backend
90
- */
91
- export interface GameConfig {
92
- winModel: WinModel;
93
- spinCost: number;
94
- betMultipliers: BetMultiplierDefinition[];
95
- board: BoardConfig;
96
- symbols: SymbolDefinition[];
97
- reels: number[][];
98
- paytable: PaytableConfig;
99
- freeSpins: FreeSpinsConfig;
100
- actions: GameActions[];
101
- }
102
- /**
103
- * Basic game state
104
- */
105
- export interface BasicGameState {
106
- state: 'basic';
107
- totalWin?: number;
108
- }
109
- /**
110
- * Bonus game state (active freespin round)
111
- */
112
- export interface BonusGameState {
113
- state: 'bonus';
114
- bonusOrigin: 'spin' | 'buy-bonus' | 'buy-super-bonus';
115
- remainingFreespins: number;
116
- usedFreespins: number;
117
- totalFreespins: number;
118
- bet: number;
119
- totalWin: number;
120
- }
121
- /**
122
- * Bonus ended game state (carries summary until next spin)
123
- */
124
- export interface BonusEndedGameState {
125
- state: 'bonus_ended';
126
- bonusOrigin: 'spin' | 'buy-bonus' | 'buy-super-bonus';
127
- usedFreespins: number;
128
- totalFreespins: number;
129
- bet: number;
130
- totalWin: number;
131
- }
132
- /**
133
- * Game state union type
134
- */
135
- export type GameState = BasicGameState | BonusGameState | BonusEndedGameState;
136
- /**
137
- * Session response from GET /session
138
- */
139
- export interface SessionResponse {
140
- sessionId: string;
141
- state: SessionState;
142
- nonce: number;
143
- serverSeedCommit: string;
144
- gameState: GameState;
145
- currentRoundId?: string | null;
146
- gameConfig: GameConfig;
147
- platform: PlatformResponse;
148
- }
149
- /**
150
- * Spin action request
151
- */
152
- export interface SpinAction {
153
- type: string;
154
- totalBet: number;
155
- }
156
- /**
157
- * Gameplay request body
158
- */
159
- export interface GameplayRequest {
160
- action: SpinAction;
161
- clientSeed?: string;
162
- }
163
- /**
164
- * Platform response (balance info)
165
- */
166
- export interface PlatformResponse {
167
- balanceMinor: number;
168
- currency: string;
169
- }
170
- /**
171
- * Bet multiplier response
172
- */
173
- export type BetMultiplierDefinition = number;
174
- /**
175
- * Cluster win information
176
- */
177
- export interface ClusterWin {
178
- id: number;
179
- symbol: number;
180
- size: number;
181
- multiplier: number;
182
- payout: number;
183
- cells: number[];
184
- }
185
- /**
186
- * Scatter win information (temporary frontend implementation)
187
- */
188
- export interface ScatterWin {
189
- symbol: number;
190
- count: number;
191
- cells: number[];
192
- }
193
- /**
194
- * Cluster mutation (one cascade step)
195
- */
196
- export interface ClusterMutation {
197
- generationId: number;
198
- board: number[];
199
- cellMultipliers: number[];
200
- hitCounts?: number[];
201
- win: number;
202
- clusters: ClusterWin[];
203
- scatters?: ScatterWin;
204
- }
205
- /**
206
- * Gameplay action result payload
207
- */
208
- export interface GameplayPayload {
209
- type?: 'spin-result';
210
- mutations: ClusterMutation[];
211
- }
212
- /**
213
- * Game state info for basic/bonus transitions
214
- */
215
- export interface GameStateInfo {
216
- state: 'basic' | 'bonus' | 'bonus_ended';
217
- bonusOrigin?: string;
218
- remainingFreespins?: number;
219
- usedFreespins?: number;
220
- totalFreespins?: number;
221
- bet?: number;
222
- totalWin?: number;
223
- }
224
- /**
225
- * Gameplay response from POST /gameplay
226
- */
227
- export interface GameplayResponse {
228
- type: 'finished';
229
- action: string;
230
- sessionId: string;
231
- roundId: string;
232
- roundStartNonce?: number;
233
- totalBet: number;
234
- winAmount: number;
235
- actionCost: number;
236
- actionResult: GameplayPayload;
237
- /** @deprecated Prefer `state` / `previousState` — not always present on play responses */
238
- gameState?: GameState;
239
- previousState?: GameStateInfo;
240
- state?: GameStateInfo;
241
- usedNonce: number;
242
- nextNonce: number;
243
- platform: PlatformResponse;
244
- }
245
- /**
246
- * History entry nonce — single action uses a number; multi-action range uses start/end.
247
- */
248
- export type HistoryNonce = number | {
249
- start: number;
250
- end: number;
251
- };
252
- /**
253
- * History entry
254
- */
255
- export interface HistoryEntry {
256
- roundId: string;
257
- nonce: HistoryNonce;
258
- action: string;
259
- totalBet: number;
260
- winAmount: number;
261
- timestamp?: number;
262
- nonces?: number[];
263
- kind?: 'single' | 'range';
264
- }
265
- /**
266
- * History response from GET /history
267
- */
268
- export interface HistoryResponse {
269
- entries: HistoryEntry[];
270
- nextPointer?: number | null;
271
- }
272
- /**
273
- * Service action event types
274
- */
275
- export declare enum ServiceActions {
276
- SESSION = "service:session",
277
- GAMEPLAY = "service:gameplay",
278
- HISTORY = "service:history",
279
- ERROR = "service:error",
280
- TIMEOUT = "service:timeout",
281
- BALANCE_UPDATE = "service:balance"
282
- }
283
- /**
284
- * Service event structure
285
- */
286
- export interface ServiceEvent<T = unknown> {
287
- target: unknown;
288
- data: T;
289
- error?: unknown;
290
- }
291
- /**
292
- * Service error response
293
- */
294
- export interface ServiceError {
295
- code?: number;
296
- message?: string;
297
- error?: string;
298
- }
299
- //# sourceMappingURL=api.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../plugins/service/types/api.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAM9C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,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AAG,OAAO;IACvC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAMD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Service plugin type definitions
3
- * @module ServicePlugin/Types
4
- */
5
- export * from './api.types';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugins/service/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,aAAa,CAAC"}