@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.
- package/CHANGELOG.md +13 -0
- package/dist/helpers/index.js +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +2 -515
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/language/I18NextPlugin.types.d.ts +2 -2
- package/dist/state-machine/StateMachine.d.ts +18 -0
- package/dist/state-machine/StateMachine.d.ts.map +1 -1
- package/dist/state-machine/index.js +37 -10
- package/dist/state-machine/index.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/plugins/service/ServiceAdapter.d.ts +0 -88
- package/dist/plugins/service/ServiceAdapter.d.ts.map +0 -1
- package/dist/plugins/service/ServiceEventHelper.d.ts +0 -6
- package/dist/plugins/service/ServiceEventHelper.d.ts.map +0 -1
- package/dist/plugins/service/ServicePlugin.d.ts +0 -135
- package/dist/plugins/service/ServicePlugin.d.ts.map +0 -1
- package/dist/plugins/service/ServicePlugin.types.d.ts +0 -14
- package/dist/plugins/service/ServicePlugin.types.d.ts.map +0 -1
- package/dist/plugins/service/adapters/DevAuthAdapter.d.ts +0 -56
- package/dist/plugins/service/adapters/DevAuthAdapter.d.ts.map +0 -1
- package/dist/plugins/service/adapters/RGSAdapter.d.ts +0 -82
- package/dist/plugins/service/adapters/RGSAdapter.d.ts.map +0 -1
- package/dist/plugins/service/adapters/index.d.ts +0 -7
- package/dist/plugins/service/adapters/index.d.ts.map +0 -1
- package/dist/plugins/service/adapters/resolvePublicIp.d.ts +0 -10
- package/dist/plugins/service/adapters/resolvePublicIp.d.ts.map +0 -1
- package/dist/plugins/service/index.d.ts +0 -10
- package/dist/plugins/service/index.d.ts.map +0 -1
- package/dist/plugins/service/types/api.types.d.ts +0 -299
- package/dist/plugins/service/types/api.types.d.ts.map +0 -1
- package/dist/plugins/service/types/index.d.ts +0 -6
- package/dist/plugins/service/types/index.d.ts.map +0 -1
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { DataInjector, NumberFormatter, __arrayUtilsLoaded, applyAnchor, applyCommonProperties, applyScale, calculateAnimationSpeed, darkenColor, debounce, lightenColor, throttle, updateBounds } from '../chunk-XHUPUPPW.js';
|
|
2
|
-
export { ContextLogger, LogLevel, Logger, getLogger, logger } from '../chunk-C45KDREE.js';
|
|
3
2
|
export { deepClone, getNestedValue, hasNestedProperty, setNestedValue } from '../chunk-5BLUF2HG.js';
|
|
4
3
|
import '../chunk-NAQG7TMS.js';
|
|
4
|
+
export { ContextLogger, LogLevel, Logger, getLogger, logger } from '../chunk-C45KDREE.js';
|
|
5
5
|
import '../chunk-G3PMV62Z.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Abstract service adapter for backend API communication
|
|
3
|
-
* @module ServicePlugin
|
|
4
|
-
*/
|
|
5
|
-
import { EventEmitter } from 'pixi.js';
|
|
6
|
-
import type { SessionResponse, GameplayRequest, GameplayResponse, HistoryEntry, HistoryResponse, PlatformResponse, ServiceActions } from './types';
|
|
7
|
-
/**
|
|
8
|
-
* Abstract base class for service adapters
|
|
9
|
-
*
|
|
10
|
-
* Service adapters handle the low-level communication with the backend API.
|
|
11
|
-
* Different adapters can be implemented for different environments
|
|
12
|
-
* (RGSAdapter for production, OfflineAdapter for development).
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* class CustomAdapter extends ServiceAdapter {
|
|
17
|
-
* async getSession(): Promise<SessionResponse> {
|
|
18
|
-
* // Fetch session and game config
|
|
19
|
-
* }
|
|
20
|
-
*
|
|
21
|
-
* async spin(request: GameplayRequest): Promise<GameplayResponse> {
|
|
22
|
-
* // Execute spin action
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare abstract class ServiceAdapter extends EventEmitter {
|
|
28
|
-
/**
|
|
29
|
-
* Session ID for the current game session
|
|
30
|
-
*/
|
|
31
|
-
abstract get sessionId(): string;
|
|
32
|
-
/**
|
|
33
|
-
* Get session info and game configuration
|
|
34
|
-
* GET /session
|
|
35
|
-
*
|
|
36
|
-
* @returns Promise resolving to session response with gameConfig
|
|
37
|
-
*/
|
|
38
|
-
abstract getSession(): Promise<SessionResponse>;
|
|
39
|
-
/**
|
|
40
|
-
* Execute a gameplay action (spin)
|
|
41
|
-
* POST /gameplay
|
|
42
|
-
*
|
|
43
|
-
* @param request - Gameplay request with action and optional clientSeed
|
|
44
|
-
* @returns Promise resolving to gameplay response
|
|
45
|
-
*/
|
|
46
|
-
abstract spin(request: GameplayRequest): Promise<GameplayResponse>;
|
|
47
|
-
/**
|
|
48
|
-
* Get game history
|
|
49
|
-
* GET /session/{sessionId}/history
|
|
50
|
-
*
|
|
51
|
-
* @param limit - Maximum number of entries to return
|
|
52
|
-
* @param pointer - Pagination pointer for next page
|
|
53
|
-
* @returns Promise resolving to history response
|
|
54
|
-
*/
|
|
55
|
-
abstract getHistory(limit?: number, pointer?: number): Promise<HistoryResponse>;
|
|
56
|
-
/**
|
|
57
|
-
* Get a single round summary by round ID
|
|
58
|
-
* GET /session/{sessionId}/round/{roundId}
|
|
59
|
-
*
|
|
60
|
-
* @param roundId - Round identifier
|
|
61
|
-
* @returns Promise resolving to history entry (single or range)
|
|
62
|
-
*/
|
|
63
|
-
abstract getRound(roundId: string): Promise<HistoryEntry>;
|
|
64
|
-
/**
|
|
65
|
-
* Get player balance
|
|
66
|
-
* GET /session/{sessionId}/balance
|
|
67
|
-
*
|
|
68
|
-
* @returns Promise resolving to platform response with balance
|
|
69
|
-
*/
|
|
70
|
-
abstract getBalance(): Promise<PlatformResponse>;
|
|
71
|
-
/**
|
|
72
|
-
* Replay a completed spin by nonce
|
|
73
|
-
* GET /session/{sessionId}/replay/{nonce}
|
|
74
|
-
*
|
|
75
|
-
* @param nonce - The nonce of the spin to replay
|
|
76
|
-
* @returns Promise resolving to gameplay response
|
|
77
|
-
*/
|
|
78
|
-
abstract replay(nonce: number): Promise<GameplayResponse>;
|
|
79
|
-
/**
|
|
80
|
-
* Emit a service action event
|
|
81
|
-
*
|
|
82
|
-
* @param action - Service action type
|
|
83
|
-
* @param data - Event data
|
|
84
|
-
* @protected
|
|
85
|
-
*/
|
|
86
|
-
protected emitAction(action: ServiceActions, data: unknown): void;
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=ServiceAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceAdapter.d.ts","sourceRoot":"","sources":["../../../plugins/service/ServiceAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8BAAsB,cAAe,SAAQ,YAAY;IACvD;;OAEG;IACH,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC;IAEjC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC;IAE/C;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAElE;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAE/E;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAEzD;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAEhD;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAEzD;;;;;;OAMG;IACH,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;CAGlE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceEventHelper.d.ts","sourceRoot":"","sources":["../../../plugins/service/ServiceEventHelper.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Service plugin for backend API communication
|
|
3
|
-
* @module ServicePlugin
|
|
4
|
-
*/
|
|
5
|
-
import { EventEmitter } from 'pixi.js';
|
|
6
|
-
import type { PixiEngine } from '../../engine/PixiEngine';
|
|
7
|
-
import type { EnginePlugin } from '../Plugin.types';
|
|
8
|
-
import type { ServicePluginConfig } from './ServicePlugin.types';
|
|
9
|
-
import type { ServiceAdapter } from './ServiceAdapter';
|
|
10
|
-
import { type SessionResponse, type GameplayResponse, type HistoryEntry, type HistoryResponse, type PlatformResponse, type GameConfig } from './types';
|
|
11
|
-
/**
|
|
12
|
-
* Service plugin for managing backend API communication
|
|
13
|
-
*
|
|
14
|
-
* This plugin provides a unified interface for all game-server communication including:
|
|
15
|
-
* - Session management and game configuration
|
|
16
|
-
* - Spin requests
|
|
17
|
-
* - Game history
|
|
18
|
-
*
|
|
19
|
-
* The plugin uses an adapter pattern to support different environments
|
|
20
|
-
* (RGSAdapter for production, OfflineAdapter for development).
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* // Create adapter
|
|
25
|
-
* const adapter = new RGSAdapter({
|
|
26
|
-
* baseUrl: 'http://localhost:3000',
|
|
27
|
-
* sessionId: 'test-session-123',
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* // Create plugin
|
|
31
|
-
* const servicePlugin = new ServicePlugin({
|
|
32
|
-
* adapter,
|
|
33
|
-
* debug: true,
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* // Register with engine
|
|
37
|
-
* engine.registerPlugin(servicePlugin);
|
|
38
|
-
* await engine.initialize();
|
|
39
|
-
*
|
|
40
|
-
* // Use in GameLogic
|
|
41
|
-
* const servicePlugin = engine.getPluginThrow<ServicePlugin>('servicePlugin');
|
|
42
|
-
* const session = await servicePlugin.getSession();
|
|
43
|
-
* const response = await servicePlugin.spin(2000);
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare class ServicePlugin extends EventEmitter implements EnginePlugin {
|
|
47
|
-
name: string;
|
|
48
|
-
priority: number;
|
|
49
|
-
dependencies: string[];
|
|
50
|
-
[key: symbol]: unknown;
|
|
51
|
-
private engine;
|
|
52
|
-
private adapter;
|
|
53
|
-
private config;
|
|
54
|
-
/** Cached session response */
|
|
55
|
-
private _session;
|
|
56
|
-
/** Cached game config */
|
|
57
|
-
private _gameConfig;
|
|
58
|
-
constructor(config: ServicePluginConfig);
|
|
59
|
-
/**
|
|
60
|
-
* Initialize the plugin
|
|
61
|
-
*/
|
|
62
|
-
initialize(engine: PixiEngine): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Called when plugin is ready
|
|
65
|
-
*/
|
|
66
|
-
onReady(_engine: PixiEngine): Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* Cleanup plugin resources
|
|
69
|
-
*/
|
|
70
|
-
cleanup(): void;
|
|
71
|
-
/**
|
|
72
|
-
* Handle adapter events
|
|
73
|
-
*/
|
|
74
|
-
private onAdapterEvent;
|
|
75
|
-
/**
|
|
76
|
-
* Get session info and game configuration
|
|
77
|
-
* Fetches from backend and caches the result
|
|
78
|
-
*
|
|
79
|
-
* @returns Promise resolving to session response with gameConfig
|
|
80
|
-
*/
|
|
81
|
-
getSession(): Promise<SessionResponse>;
|
|
82
|
-
/**
|
|
83
|
-
* Execute a spin action
|
|
84
|
-
*
|
|
85
|
-
* @param totalBet - Total bet amount
|
|
86
|
-
* @param clientSeed - Optional client seed for provably fair
|
|
87
|
-
* @returns Promise resolving to gameplay response
|
|
88
|
-
*/
|
|
89
|
-
spin(action: string, totalBet: number, clientSeed?: string): Promise<GameplayResponse>;
|
|
90
|
-
/**
|
|
91
|
-
* Get game history
|
|
92
|
-
*
|
|
93
|
-
* @param limit - Maximum number of entries to return
|
|
94
|
-
* @param pointer - Pagination pointer for next page
|
|
95
|
-
* @returns Promise resolving to history response
|
|
96
|
-
*/
|
|
97
|
-
getHistory(limit?: number, pointer?: number): Promise<HistoryResponse>;
|
|
98
|
-
/**
|
|
99
|
-
* Get a single round summary by round ID
|
|
100
|
-
*
|
|
101
|
-
* @param roundId - Round identifier
|
|
102
|
-
* @returns Promise resolving to history entry (single or range)
|
|
103
|
-
*/
|
|
104
|
-
getRound(roundId: string): Promise<HistoryEntry>;
|
|
105
|
-
/**
|
|
106
|
-
* Get player balance
|
|
107
|
-
*
|
|
108
|
-
* @returns Promise resolving to platform response with balance
|
|
109
|
-
*/
|
|
110
|
-
getBalance(): Promise<PlatformResponse>;
|
|
111
|
-
/**
|
|
112
|
-
* Replay a completed spin by nonce
|
|
113
|
-
*
|
|
114
|
-
* @param nonce - The nonce of the spin to replay
|
|
115
|
-
* @returns Promise resolving to gameplay response
|
|
116
|
-
*/
|
|
117
|
-
replay(nonce: number): Promise<GameplayResponse>;
|
|
118
|
-
/**
|
|
119
|
-
* Get session ID from adapter
|
|
120
|
-
*/
|
|
121
|
-
get sessionId(): string;
|
|
122
|
-
/**
|
|
123
|
-
* Get cached session response
|
|
124
|
-
*/
|
|
125
|
-
get session(): SessionResponse | null;
|
|
126
|
-
/**
|
|
127
|
-
* Get cached game config
|
|
128
|
-
*/
|
|
129
|
-
get gameConfig(): GameConfig | null;
|
|
130
|
-
/**
|
|
131
|
-
* Get the adapter instance
|
|
132
|
-
*/
|
|
133
|
-
get serviceAdapter(): ServiceAdapter;
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=ServicePlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServicePlugin.d.ts","sourceRoot":"","sources":["../../../plugins/service/ServicePlugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EAErB,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,aAAc,SAAQ,YAAa,YAAW,YAAY;IAC9D,IAAI,SAAmB;IACvB,QAAQ,SAAM;IACd,YAAY,WAAsB;IAGzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAsB;IAEpC,8BAA8B;IAC9B,OAAO,CAAC,QAAQ,CAAgC;IAEhD,yBAAyB;IACzB,OAAO,CAAC,WAAW,CAA2B;gBAElC,MAAM,EAAE,mBAAmB;IAyBvC;;OAEG;IACU,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1D;;OAEG;IACU,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD;;OAEG;IACI,OAAO,IAAI,IAAI;IAStB;;OAEG;IACH,OAAO,CAAC,cAAc;IAgBtB;;;;;OAKG;IACU,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC;IAmBnD;;;;;;OAMG;IACU,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAanG;;;;;;OAMG;IACU,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAcnF;;;;;OAKG;IACU,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAa7D;;;;OAIG;IACU,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAcpD;;;;;OAKG;IACU,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkB7D;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,eAAe,GAAG,IAAI,CAE3C;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,UAAU,GAAG,IAAI,CAEzC;IAED;;OAEG;IACH,IAAW,cAAc,IAAI,cAAc,CAE1C;CACF"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ServicePlugin configuration and types
|
|
3
|
-
* @module ServicePlugin
|
|
4
|
-
*/
|
|
5
|
-
import type { PluginConfig } from '../Plugin.types';
|
|
6
|
-
import type { ServiceAdapter } from './ServiceAdapter';
|
|
7
|
-
/**
|
|
8
|
-
* ServicePlugin configuration
|
|
9
|
-
*/
|
|
10
|
-
export interface ServicePluginConfig extends PluginConfig {
|
|
11
|
-
/** Service adapter instance */
|
|
12
|
-
adapter: ServiceAdapter;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=ServicePlugin.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServicePlugin.types.d.ts","sourceRoot":"","sources":["../../../plugins/service/ServicePlugin.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,+BAA+B;IAC/B,OAAO,EAAE,cAAc,CAAC;CACzB"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Development adapter that creates session via POST /session
|
|
3
|
-
* Use this in development to auto-create sessions
|
|
4
|
-
* @module ServicePlugin/Adapters
|
|
5
|
-
*/
|
|
6
|
-
import { RGSAdapter, type RGSAdapterConfig } from './RGSAdapter';
|
|
7
|
-
import type { SessionResponse } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* Development adapter configuration
|
|
10
|
-
*/
|
|
11
|
-
export interface DevAdapterConfig extends Omit<RGSAdapterConfig, 'sessionId'> {
|
|
12
|
-
/** Operator ID (UUID) */
|
|
13
|
-
operatorId?: string;
|
|
14
|
-
/** Player ID */
|
|
15
|
-
playerId?: string;
|
|
16
|
-
/** Game ID (UUID) */
|
|
17
|
-
gameId?: string;
|
|
18
|
-
/** Currency code */
|
|
19
|
-
currency?: string;
|
|
20
|
-
/** Optional public IP override (also overridable via ?clientIP= or ?ip=) */
|
|
21
|
-
ip?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Development adapter that auto-creates sessions
|
|
25
|
-
*
|
|
26
|
-
* This adapter calls POST /session to create a new session,
|
|
27
|
-
* then uses the returned sessionId for subsequent requests.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* const adapter = new DevAdapter({
|
|
32
|
-
* baseUrl: 'http://localhost:3000',
|
|
33
|
-
* debug: true,
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* // Creates session and returns session info
|
|
37
|
-
* const session = await adapter.getSession();
|
|
38
|
-
* console.log('Session ID:', adapter.sessionId);
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare class DevAdapter extends RGSAdapter {
|
|
42
|
-
private createSessionData;
|
|
43
|
-
private configIp?;
|
|
44
|
-
private queryParams;
|
|
45
|
-
private _sessionCreated;
|
|
46
|
-
constructor(config: DevAdapterConfig);
|
|
47
|
-
/**
|
|
48
|
-
* Get session - creates session if not exists, then fetches session info
|
|
49
|
-
*/
|
|
50
|
-
getSession(): Promise<SessionResponse>;
|
|
51
|
-
/**
|
|
52
|
-
* Create a new session via POST /session
|
|
53
|
-
*/
|
|
54
|
-
private createSession;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=DevAuthAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DevAuthAdapter.d.ts","sourceRoot":"","sources":["../../../../plugins/service/adapters/DevAuthAdapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAehD;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC;IAC3E,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,OAAO,CAAC,iBAAiB,CAAmC;IAC5D,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,eAAe,CAAS;gBAEpB,MAAM,EAAE,gBAAgB;IA2BpC;;OAEG;IACmB,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC;IAU5D;;OAEG;YACW,aAAa;CAkE5B"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RGS Adapter for production use with backend API
|
|
3
|
-
* @module ServicePlugin/Adapters
|
|
4
|
-
*/
|
|
5
|
-
import { ServiceAdapter } from '../ServiceAdapter';
|
|
6
|
-
import { type SessionResponse, type GameplayRequest, type GameplayResponse, type HistoryEntry, type HistoryResponse, type PlatformResponse } from '../types';
|
|
7
|
-
/**
|
|
8
|
-
* RGS Adapter configuration
|
|
9
|
-
*/
|
|
10
|
-
export interface RGSAdapterConfig {
|
|
11
|
-
/** Base URL for the backend API (e.g., 'http://localhost:3000') */
|
|
12
|
-
baseUrl: string;
|
|
13
|
-
/** Session ID for authentication */
|
|
14
|
-
sessionId: string;
|
|
15
|
-
/** Request timeout in milliseconds */
|
|
16
|
-
requestTimeout?: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Production RGS adapter for backend API communication
|
|
20
|
-
*
|
|
21
|
-
* This adapter handles HTTP communication with the backend API:
|
|
22
|
-
* - GET /session/{sessionId} - Fetch session and game config
|
|
23
|
-
* - POST /session/{sessionId}/play - Execute spin action
|
|
24
|
-
* - GET /session/{sessionId}/history - Fetch game history
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const adapter = new RGSAdapter({
|
|
29
|
-
* baseUrl: 'http://localhost:3000',
|
|
30
|
-
* sessionId: 'test-session-123',
|
|
31
|
-
* debug: true,
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* const session = await adapter.getSession();
|
|
35
|
-
* const spin = await adapter.spin({ action: { type: 'spin', totalBet: 2000 } });
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare class RGSAdapter extends ServiceAdapter {
|
|
39
|
-
private _sessionId;
|
|
40
|
-
private baseUrl;
|
|
41
|
-
private requestTimeout;
|
|
42
|
-
constructor(config: RGSAdapterConfig);
|
|
43
|
-
/**
|
|
44
|
-
* Get the current session ID
|
|
45
|
-
*/
|
|
46
|
-
get sessionId(): string;
|
|
47
|
-
/**
|
|
48
|
-
* Get session info and game configuration
|
|
49
|
-
* GET /session/{sessionId}
|
|
50
|
-
*/
|
|
51
|
-
getSession(): Promise<SessionResponse>;
|
|
52
|
-
/**
|
|
53
|
-
* Execute a gameplay action (spin)
|
|
54
|
-
* POST /session/{sessionId}/play
|
|
55
|
-
*/
|
|
56
|
-
spin(request: GameplayRequest): Promise<GameplayResponse>;
|
|
57
|
-
/**
|
|
58
|
-
* Get game history
|
|
59
|
-
* GET /session/{sessionId}/history
|
|
60
|
-
*/
|
|
61
|
-
getHistory(limit?: number, pointer?: number): Promise<HistoryResponse>;
|
|
62
|
-
/**
|
|
63
|
-
* Get a single round summary by round ID
|
|
64
|
-
* GET /session/{sessionId}/round/{roundId}
|
|
65
|
-
*/
|
|
66
|
-
getRound(roundId: string): Promise<HistoryEntry>;
|
|
67
|
-
/**
|
|
68
|
-
* Get player balance
|
|
69
|
-
* GET /session/{sessionId}/balance
|
|
70
|
-
*/
|
|
71
|
-
getBalance(): Promise<PlatformResponse>;
|
|
72
|
-
/**
|
|
73
|
-
* Replay a completed spin by nonce
|
|
74
|
-
* GET /session/{sessionId}/replay/{nonce}
|
|
75
|
-
*/
|
|
76
|
-
replay(nonce: number): Promise<GameplayResponse>;
|
|
77
|
-
/**
|
|
78
|
-
* Make an HTTP request to the backend API
|
|
79
|
-
*/
|
|
80
|
-
private request;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=RGSAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RGSAdapter.d.ts","sourceRoot":"","sources":["../../../../plugins/service/adapters/RGSAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EAEtB,MAAM,UAAU,CAAC;AAGlB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,UAAW,SAAQ,cAAc;IAC5C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAS;gBAEnB,MAAM,EAAE,gBAAgB;IAcpC;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;OAGG;IACU,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC;IAanD;;;OAGG;IACU,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAYtE;;;OAGG;IACU,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAmBnF;;;OAGG;IACU,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAc7D;;;OAGG;IACU,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAYpD;;;OAGG;IACU,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAY7D;;OAEG;YACW,OAAO;CAwFtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugins/service/adapters/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface ResolvePublicIpOptions {
|
|
2
|
-
configIp?: string;
|
|
3
|
-
queryParams?: URLSearchParams;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Resolves the client's public IP for dev session creation.
|
|
7
|
-
* Priority: ?clientIP= / ?ip= query param → config override → ipify.org lookup.
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolvePublicIp(options?: ResolvePublicIpOptions): Promise<string>;
|
|
10
|
-
//# sourceMappingURL=resolvePublicIp.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePublicIp.d.ts","sourceRoot":"","sources":["../../../../plugins/service/adapters/resolvePublicIp.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyC3F"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Service plugin for backend API communication
|
|
3
|
-
* @module ServicePlugin
|
|
4
|
-
*/
|
|
5
|
-
export * from './ServicePlugin';
|
|
6
|
-
export * from './ServiceAdapter';
|
|
7
|
-
export * from './adapters';
|
|
8
|
-
export * from './types';
|
|
9
|
-
export * from './ServicePlugin.types';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../plugins/service/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC"}
|