@pokertools/types 1.0.1 → 1.0.6

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.
@@ -0,0 +1,289 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Shared Zod validation schemas for type-safe, client-side validation
4
+ *
5
+ * These schemas can be used by:
6
+ * - API endpoints for request validation
7
+ * - Engine for action validation
8
+ * - Client SDK for pre-flight validation (avoiding unnecessary network requests)
9
+ */
10
+ /**
11
+ * Schema for SIT action (joining a table)
12
+ */
13
+ export declare const SitActionSchema: z.ZodObject<{
14
+ type: z.ZodLiteral<"SIT">;
15
+ playerId: z.ZodString;
16
+ playerName: z.ZodString;
17
+ seat: z.ZodNumber;
18
+ stack: z.ZodNumber;
19
+ sitInOption: z.ZodOptional<z.ZodEnum<{
20
+ IMMEDIATE: "IMMEDIATE";
21
+ WAIT_FOR_BB: "WAIT_FOR_BB";
22
+ }>>;
23
+ }, z.core.$strip>;
24
+ /**
25
+ * Schema for STAND action (leaving a table)
26
+ */
27
+ export declare const StandActionSchema: z.ZodObject<{
28
+ type: z.ZodLiteral<"STAND">;
29
+ playerId: z.ZodString;
30
+ }, z.core.$strip>;
31
+ /**
32
+ * Schema for BET action
33
+ */
34
+ export declare const BetActionSchema: z.ZodObject<{
35
+ type: z.ZodLiteral<"BET">;
36
+ playerId: z.ZodString;
37
+ amount: z.ZodNumber;
38
+ }, z.core.$strip>;
39
+ /**
40
+ * Schema for RAISE action
41
+ */
42
+ export declare const RaiseActionSchema: z.ZodObject<{
43
+ type: z.ZodLiteral<"RAISE">;
44
+ playerId: z.ZodString;
45
+ amount: z.ZodNumber;
46
+ }, z.core.$strip>;
47
+ /**
48
+ * Schema for CALL action
49
+ */
50
+ export declare const CallActionSchema: z.ZodObject<{
51
+ type: z.ZodLiteral<"CALL">;
52
+ playerId: z.ZodString;
53
+ }, z.core.$strip>;
54
+ /**
55
+ * Schema for CHECK action
56
+ */
57
+ export declare const CheckActionSchema: z.ZodObject<{
58
+ type: z.ZodLiteral<"CHECK">;
59
+ playerId: z.ZodString;
60
+ }, z.core.$strip>;
61
+ /**
62
+ * Schema for FOLD action
63
+ */
64
+ export declare const FoldActionSchema: z.ZodObject<{
65
+ type: z.ZodLiteral<"FOLD">;
66
+ playerId: z.ZodString;
67
+ }, z.core.$strip>;
68
+ /**
69
+ * Schema for DEAL action
70
+ */
71
+ export declare const DealActionSchema: z.ZodObject<{
72
+ type: z.ZodLiteral<"DEAL">;
73
+ }, z.core.$strip>;
74
+ /**
75
+ * Schema for ADD_CHIPS action
76
+ */
77
+ export declare const AddChipsActionSchema: z.ZodObject<{
78
+ type: z.ZodLiteral<"ADD_CHIPS">;
79
+ playerId: z.ZodString;
80
+ amount: z.ZodNumber;
81
+ }, z.core.$strip>;
82
+ /**
83
+ * Schema for RESERVE_SEAT action
84
+ */
85
+ export declare const ReserveSeatActionSchema: z.ZodObject<{
86
+ type: z.ZodLiteral<"RESERVE_SEAT">;
87
+ playerId: z.ZodString;
88
+ playerName: z.ZodString;
89
+ seat: z.ZodNumber;
90
+ expiryTimestamp: z.ZodNumber;
91
+ }, z.core.$strip>;
92
+ /**
93
+ * Schema for SHOW action (showing cards at showdown)
94
+ */
95
+ export declare const ShowActionSchema: z.ZodObject<{
96
+ type: z.ZodLiteral<"SHOW">;
97
+ playerId: z.ZodString;
98
+ cardIndices: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
99
+ }, z.core.$strip>;
100
+ /**
101
+ * Schema for MUCK action (hiding cards at showdown)
102
+ */
103
+ export declare const MuckActionSchema: z.ZodObject<{
104
+ type: z.ZodLiteral<"MUCK">;
105
+ playerId: z.ZodString;
106
+ }, z.core.$strip>;
107
+ /**
108
+ * Schema for TIME_BANK action
109
+ */
110
+ export declare const TimeBankActionSchema: z.ZodObject<{
111
+ type: z.ZodLiteral<"TIME_BANK">;
112
+ playerId: z.ZodString;
113
+ }, z.core.$strip>;
114
+ /**
115
+ * Schema for TIMEOUT action
116
+ */
117
+ export declare const TimeoutActionSchema: z.ZodObject<{
118
+ type: z.ZodLiteral<"TIMEOUT">;
119
+ playerId: z.ZodString;
120
+ timestamp: z.ZodOptional<z.ZodNumber>;
121
+ }, z.core.$strip>;
122
+ /**
123
+ * Schema for NEXT_BLIND_LEVEL action (tournament)
124
+ */
125
+ export declare const NextBlindLevelActionSchema: z.ZodObject<{
126
+ type: z.ZodLiteral<"NEXT_BLIND_LEVEL">;
127
+ }, z.core.$strip>;
128
+ /**
129
+ * Schema for UNCALLED_BET_RETURNED action (internal engine action)
130
+ * Generated when an uncalled bet is returned to a player
131
+ */
132
+ export declare const UncalledBetReturnedActionSchema: z.ZodObject<{
133
+ type: z.ZodLiteral<"UNCALLED_BET_RETURNED">;
134
+ playerId: z.ZodString;
135
+ amount: z.ZodNumber;
136
+ }, z.core.$strip>;
137
+ /**
138
+ * Union of all action schemas
139
+ */
140
+ export declare const ActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
141
+ type: z.ZodLiteral<"SIT">;
142
+ playerId: z.ZodString;
143
+ playerName: z.ZodString;
144
+ seat: z.ZodNumber;
145
+ stack: z.ZodNumber;
146
+ sitInOption: z.ZodOptional<z.ZodEnum<{
147
+ IMMEDIATE: "IMMEDIATE";
148
+ WAIT_FOR_BB: "WAIT_FOR_BB";
149
+ }>>;
150
+ }, z.core.$strip>, z.ZodObject<{
151
+ type: z.ZodLiteral<"STAND">;
152
+ playerId: z.ZodString;
153
+ }, z.core.$strip>, z.ZodObject<{
154
+ type: z.ZodLiteral<"BET">;
155
+ playerId: z.ZodString;
156
+ amount: z.ZodNumber;
157
+ }, z.core.$strip>, z.ZodObject<{
158
+ type: z.ZodLiteral<"RAISE">;
159
+ playerId: z.ZodString;
160
+ amount: z.ZodNumber;
161
+ }, z.core.$strip>, z.ZodObject<{
162
+ type: z.ZodLiteral<"CALL">;
163
+ playerId: z.ZodString;
164
+ }, z.core.$strip>, z.ZodObject<{
165
+ type: z.ZodLiteral<"CHECK">;
166
+ playerId: z.ZodString;
167
+ }, z.core.$strip>, z.ZodObject<{
168
+ type: z.ZodLiteral<"FOLD">;
169
+ playerId: z.ZodString;
170
+ }, z.core.$strip>, z.ZodObject<{
171
+ type: z.ZodLiteral<"DEAL">;
172
+ }, z.core.$strip>, z.ZodObject<{
173
+ type: z.ZodLiteral<"ADD_CHIPS">;
174
+ playerId: z.ZodString;
175
+ amount: z.ZodNumber;
176
+ }, z.core.$strip>, z.ZodObject<{
177
+ type: z.ZodLiteral<"RESERVE_SEAT">;
178
+ playerId: z.ZodString;
179
+ playerName: z.ZodString;
180
+ seat: z.ZodNumber;
181
+ expiryTimestamp: z.ZodNumber;
182
+ }, z.core.$strip>, z.ZodObject<{
183
+ type: z.ZodLiteral<"SHOW">;
184
+ playerId: z.ZodString;
185
+ cardIndices: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
186
+ }, z.core.$strip>, z.ZodObject<{
187
+ type: z.ZodLiteral<"MUCK">;
188
+ playerId: z.ZodString;
189
+ }, z.core.$strip>, z.ZodObject<{
190
+ type: z.ZodLiteral<"TIME_BANK">;
191
+ playerId: z.ZodString;
192
+ }, z.core.$strip>, z.ZodObject<{
193
+ type: z.ZodLiteral<"TIMEOUT">;
194
+ playerId: z.ZodString;
195
+ timestamp: z.ZodOptional<z.ZodNumber>;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ type: z.ZodLiteral<"NEXT_BLIND_LEVEL">;
198
+ }, z.core.$strip>, z.ZodObject<{
199
+ type: z.ZodLiteral<"UNCALLED_BET_RETURNED">;
200
+ playerId: z.ZodString;
201
+ amount: z.ZodNumber;
202
+ }, z.core.$strip>], "type">;
203
+ /**
204
+ * Schema for blind level configuration
205
+ */
206
+ export declare const BlindLevelSchema: z.ZodObject<{
207
+ smallBlind: z.ZodNumber;
208
+ bigBlind: z.ZodNumber;
209
+ ante: z.ZodNumber;
210
+ }, z.core.$strip>;
211
+ /**
212
+ * Schema for table configuration
213
+ */
214
+ export declare const TableConfigSchema: z.ZodObject<{
215
+ smallBlind: z.ZodNumber;
216
+ bigBlind: z.ZodNumber;
217
+ ante: z.ZodOptional<z.ZodNumber>;
218
+ maxPlayers: z.ZodNumber;
219
+ blindStructure: z.ZodOptional<z.ZodArray<z.ZodObject<{
220
+ smallBlind: z.ZodNumber;
221
+ bigBlind: z.ZodNumber;
222
+ ante: z.ZodNumber;
223
+ }, z.core.$strip>>>;
224
+ rakePercent: z.ZodOptional<z.ZodNumber>;
225
+ rakeCap: z.ZodOptional<z.ZodNumber>;
226
+ timeBankSeconds: z.ZodOptional<z.ZodNumber>;
227
+ timeBankDeductionSeconds: z.ZodOptional<z.ZodNumber>;
228
+ }, z.core.$strip>;
229
+ /**
230
+ * Schema for creating a new table
231
+ */
232
+ export declare const CreateTableSchema: z.ZodObject<{
233
+ name: z.ZodString;
234
+ mode: z.ZodEnum<{
235
+ CASH: "CASH";
236
+ TOURNAMENT: "TOURNAMENT";
237
+ }>;
238
+ smallBlind: z.ZodNumber;
239
+ bigBlind: z.ZodNumber;
240
+ maxPlayers: z.ZodDefault<z.ZodNumber>;
241
+ minBuyIn: z.ZodOptional<z.ZodNumber>;
242
+ maxBuyIn: z.ZodOptional<z.ZodNumber>;
243
+ }, z.core.$strip>;
244
+ /**
245
+ * Schema for buy-in request
246
+ */
247
+ export declare const BuyInRequestSchema: z.ZodObject<{
248
+ amount: z.ZodNumber;
249
+ seat: z.ZodNumber;
250
+ idempotencyKey: z.ZodString;
251
+ sitInOption: z.ZodOptional<z.ZodEnum<{
252
+ IMMEDIATE: "IMMEDIATE";
253
+ WAIT_FOR_BB: "WAIT_FOR_BB";
254
+ }>>;
255
+ }, z.core.$strip>;
256
+ /**
257
+ * Schema for add chips request
258
+ */
259
+ export declare const AddChipsRequestSchema: z.ZodObject<{
260
+ amount: z.ZodNumber;
261
+ idempotencyKey: z.ZodString;
262
+ }, z.core.$strip>;
263
+ /**
264
+ * Schema for game action request
265
+ */
266
+ export declare const GameActionRequestSchema: z.ZodObject<{
267
+ type: z.ZodEnum<{
268
+ STAND: "STAND";
269
+ DEAL: "DEAL";
270
+ FOLD: "FOLD";
271
+ CHECK: "CHECK";
272
+ CALL: "CALL";
273
+ BET: "BET";
274
+ RAISE: "RAISE";
275
+ SHOW: "SHOW";
276
+ MUCK: "MUCK";
277
+ TIME_BANK: "TIME_BANK";
278
+ NEXT_BLIND_LEVEL: "NEXT_BLIND_LEVEL";
279
+ }>;
280
+ amount: z.ZodOptional<z.ZodNumber>;
281
+ cardIndices: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
282
+ }, z.core.$strip>;
283
+ export type ValidatedAction = z.infer<typeof ActionSchema>;
284
+ export type ValidatedBlindLevel = z.infer<typeof BlindLevelSchema>;
285
+ export type ValidatedTableConfig = z.infer<typeof TableConfigSchema>;
286
+ export type CreateTableRequest = z.infer<typeof CreateTableSchema>;
287
+ export type BuyInRequest = z.infer<typeof BuyInRequestSchema>;
288
+ export type AddChipsRequest = z.infer<typeof AddChipsRequestSchema>;
289
+ export type GameActionRequest = z.infer<typeof GameActionRequestSchema>;
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GameActionRequestSchema = exports.AddChipsRequestSchema = exports.BuyInRequestSchema = exports.CreateTableSchema = exports.TableConfigSchema = exports.BlindLevelSchema = exports.ActionSchema = exports.UncalledBetReturnedActionSchema = exports.NextBlindLevelActionSchema = exports.TimeoutActionSchema = exports.TimeBankActionSchema = exports.MuckActionSchema = exports.ShowActionSchema = exports.ReserveSeatActionSchema = exports.AddChipsActionSchema = exports.DealActionSchema = exports.FoldActionSchema = exports.CheckActionSchema = exports.CallActionSchema = exports.RaiseActionSchema = exports.BetActionSchema = exports.StandActionSchema = exports.SitActionSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Shared Zod validation schemas for type-safe, client-side validation
7
+ *
8
+ * These schemas can be used by:
9
+ * - API endpoints for request validation
10
+ * - Engine for action validation
11
+ * - Client SDK for pre-flight validation (avoiding unnecessary network requests)
12
+ */
13
+ // ============================================================================
14
+ // Action Schemas
15
+ // ============================================================================
16
+ /**
17
+ * Schema for SIT action (joining a table)
18
+ */
19
+ exports.SitActionSchema = zod_1.z.object({
20
+ type: zod_1.z.literal("SIT"),
21
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
22
+ playerName: zod_1.z.string().min(1, "Player name is required").max(50, "Name too long"),
23
+ seat: zod_1.z.number().int().min(0).max(9, "Seat must be between 0 and 9"),
24
+ stack: zod_1.z.number().int().positive("Stack must be positive"),
25
+ sitInOption: zod_1.z.enum(["IMMEDIATE", "WAIT_FOR_BB"]).optional(),
26
+ });
27
+ /**
28
+ * Schema for STAND action (leaving a table)
29
+ */
30
+ exports.StandActionSchema = zod_1.z.object({
31
+ type: zod_1.z.literal("STAND"),
32
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
33
+ });
34
+ /**
35
+ * Schema for BET action
36
+ */
37
+ exports.BetActionSchema = zod_1.z.object({
38
+ type: zod_1.z.literal("BET"),
39
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
40
+ amount: zod_1.z.number().int().positive("Bet amount must be positive"),
41
+ });
42
+ /**
43
+ * Schema for RAISE action
44
+ */
45
+ exports.RaiseActionSchema = zod_1.z.object({
46
+ type: zod_1.z.literal("RAISE"),
47
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
48
+ amount: zod_1.z.number().int().positive("Raise amount must be positive"),
49
+ });
50
+ /**
51
+ * Schema for CALL action
52
+ */
53
+ exports.CallActionSchema = zod_1.z.object({
54
+ type: zod_1.z.literal("CALL"),
55
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
56
+ });
57
+ /**
58
+ * Schema for CHECK action
59
+ */
60
+ exports.CheckActionSchema = zod_1.z.object({
61
+ type: zod_1.z.literal("CHECK"),
62
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
63
+ });
64
+ /**
65
+ * Schema for FOLD action
66
+ */
67
+ exports.FoldActionSchema = zod_1.z.object({
68
+ type: zod_1.z.literal("FOLD"),
69
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
70
+ });
71
+ /**
72
+ * Schema for DEAL action
73
+ */
74
+ exports.DealActionSchema = zod_1.z.object({
75
+ type: zod_1.z.literal("DEAL"),
76
+ });
77
+ /**
78
+ * Schema for ADD_CHIPS action
79
+ */
80
+ exports.AddChipsActionSchema = zod_1.z.object({
81
+ type: zod_1.z.literal("ADD_CHIPS"),
82
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
83
+ amount: zod_1.z.number().int().positive("Amount must be positive"),
84
+ });
85
+ /**
86
+ * Schema for RESERVE_SEAT action
87
+ */
88
+ exports.ReserveSeatActionSchema = zod_1.z.object({
89
+ type: zod_1.z.literal("RESERVE_SEAT"),
90
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
91
+ playerName: zod_1.z.string().min(1, "Player name is required").max(50, "Name too long"),
92
+ seat: zod_1.z.number().int().min(0).max(9, "Seat must be between 0 and 9"),
93
+ expiryTimestamp: zod_1.z.number().int().positive("Expiry timestamp must be positive"),
94
+ });
95
+ /**
96
+ * Schema for SHOW action (showing cards at showdown)
97
+ */
98
+ exports.ShowActionSchema = zod_1.z.object({
99
+ type: zod_1.z.literal("SHOW"),
100
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
101
+ cardIndices: zod_1.z.array(zod_1.z.number().int().min(0).max(1)).optional(),
102
+ });
103
+ /**
104
+ * Schema for MUCK action (hiding cards at showdown)
105
+ */
106
+ exports.MuckActionSchema = zod_1.z.object({
107
+ type: zod_1.z.literal("MUCK"),
108
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
109
+ });
110
+ /**
111
+ * Schema for TIME_BANK action
112
+ */
113
+ exports.TimeBankActionSchema = zod_1.z.object({
114
+ type: zod_1.z.literal("TIME_BANK"),
115
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
116
+ });
117
+ /**
118
+ * Schema for TIMEOUT action
119
+ */
120
+ exports.TimeoutActionSchema = zod_1.z.object({
121
+ type: zod_1.z.literal("TIMEOUT"),
122
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
123
+ timestamp: zod_1.z.number().int().positive("Timestamp must be positive").optional(),
124
+ });
125
+ /**
126
+ * Schema for NEXT_BLIND_LEVEL action (tournament)
127
+ */
128
+ exports.NextBlindLevelActionSchema = zod_1.z.object({
129
+ type: zod_1.z.literal("NEXT_BLIND_LEVEL"),
130
+ });
131
+ /**
132
+ * Schema for UNCALLED_BET_RETURNED action (internal engine action)
133
+ * Generated when an uncalled bet is returned to a player
134
+ */
135
+ exports.UncalledBetReturnedActionSchema = zod_1.z.object({
136
+ type: zod_1.z.literal("UNCALLED_BET_RETURNED"),
137
+ playerId: zod_1.z.string().min(1, "Player ID is required"),
138
+ amount: zod_1.z.number().int().positive("Amount must be positive"),
139
+ });
140
+ /**
141
+ * Union of all action schemas
142
+ */
143
+ exports.ActionSchema = zod_1.z.discriminatedUnion("type", [
144
+ exports.SitActionSchema,
145
+ exports.StandActionSchema,
146
+ exports.BetActionSchema,
147
+ exports.RaiseActionSchema,
148
+ exports.CallActionSchema,
149
+ exports.CheckActionSchema,
150
+ exports.FoldActionSchema,
151
+ exports.DealActionSchema,
152
+ exports.AddChipsActionSchema,
153
+ exports.ReserveSeatActionSchema,
154
+ exports.ShowActionSchema,
155
+ exports.MuckActionSchema,
156
+ exports.TimeBankActionSchema,
157
+ exports.TimeoutActionSchema,
158
+ exports.NextBlindLevelActionSchema,
159
+ exports.UncalledBetReturnedActionSchema,
160
+ ]);
161
+ // ============================================================================
162
+ // Table Configuration Schemas
163
+ // ============================================================================
164
+ /**
165
+ * Schema for blind level configuration
166
+ */
167
+ exports.BlindLevelSchema = zod_1.z.object({
168
+ smallBlind: zod_1.z.number().int().positive("Small blind must be positive"),
169
+ bigBlind: zod_1.z.number().int().positive("Big blind must be positive"),
170
+ ante: zod_1.z.number().int().min(0, "Ante cannot be negative"),
171
+ });
172
+ /**
173
+ * Schema for table configuration
174
+ */
175
+ exports.TableConfigSchema = zod_1.z
176
+ .object({
177
+ smallBlind: zod_1.z.number().int().positive("Small blind must be positive"),
178
+ bigBlind: zod_1.z.number().int().positive("Big blind must be positive"),
179
+ ante: zod_1.z.number().int().min(0, "Ante cannot be negative").optional(),
180
+ maxPlayers: zod_1.z
181
+ .number()
182
+ .int()
183
+ .min(2, "Must have at least 2 players")
184
+ .max(10, "Maximum 10 players"),
185
+ blindStructure: zod_1.z.array(exports.BlindLevelSchema).optional(),
186
+ rakePercent: zod_1.z.number().min(0).max(100).optional(),
187
+ rakeCap: zod_1.z.number().int().min(0).optional(),
188
+ timeBankSeconds: zod_1.z.number().int().positive().optional(),
189
+ timeBankDeductionSeconds: zod_1.z.number().int().positive().optional(),
190
+ })
191
+ .refine((config) => config.bigBlind > config.smallBlind, {
192
+ message: "Big blind must be greater than small blind",
193
+ path: ["bigBlind"],
194
+ });
195
+ /**
196
+ * Schema for creating a new table
197
+ */
198
+ exports.CreateTableSchema = zod_1.z
199
+ .object({
200
+ name: zod_1.z.string().min(1, "Table name is required").max(100, "Name too long"),
201
+ mode: zod_1.z.enum(["CASH", "TOURNAMENT"]),
202
+ smallBlind: zod_1.z.number().int().positive("Small blind must be positive"),
203
+ bigBlind: zod_1.z.number().int().positive("Big blind must be positive"),
204
+ maxPlayers: zod_1.z.number().int().min(2).max(10).default(9),
205
+ minBuyIn: zod_1.z.number().int().positive().optional(),
206
+ maxBuyIn: zod_1.z.number().int().positive().optional(),
207
+ })
208
+ .refine((config) => config.bigBlind > config.smallBlind, {
209
+ message: "Big blind must be greater than small blind",
210
+ path: ["bigBlind"],
211
+ })
212
+ .refine((config) => {
213
+ if (config.minBuyIn !== undefined && config.maxBuyIn !== undefined) {
214
+ return config.maxBuyIn >= config.minBuyIn;
215
+ }
216
+ return true;
217
+ }, {
218
+ message: "Max buy-in must be greater than or equal to min buy-in",
219
+ path: ["maxBuyIn"],
220
+ });
221
+ // ============================================================================
222
+ // API Request Schemas
223
+ // ============================================================================
224
+ /**
225
+ * Schema for buy-in request
226
+ */
227
+ exports.BuyInRequestSchema = zod_1.z.object({
228
+ amount: zod_1.z.number().int().positive("Buy-in amount must be positive"),
229
+ seat: zod_1.z.number().int().min(0).max(9, "Seat must be between 0 and 9"),
230
+ idempotencyKey: zod_1.z.string().min(1, "Idempotency key is required"),
231
+ sitInOption: zod_1.z.enum(["IMMEDIATE", "WAIT_FOR_BB"]).optional(),
232
+ });
233
+ /**
234
+ * Schema for add chips request
235
+ */
236
+ exports.AddChipsRequestSchema = zod_1.z.object({
237
+ amount: zod_1.z.number().int().positive("Amount must be positive"),
238
+ idempotencyKey: zod_1.z.string().min(1, "Idempotency key is required"),
239
+ });
240
+ /**
241
+ * Schema for game action request
242
+ */
243
+ exports.GameActionRequestSchema = zod_1.z.object({
244
+ type: zod_1.z.enum([
245
+ "DEAL",
246
+ "CHECK",
247
+ "CALL",
248
+ "RAISE",
249
+ "BET",
250
+ "FOLD",
251
+ "SHOW",
252
+ "MUCK",
253
+ "TIME_BANK",
254
+ "STAND",
255
+ "NEXT_BLIND_LEVEL",
256
+ ]),
257
+ amount: zod_1.z.number().int().positive().optional(),
258
+ cardIndices: zod_1.z.array(zod_1.z.number().int().min(0).max(1)).optional(),
259
+ });
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@pokertools/types",
3
- "version": "1.0.1",
3
+ "version": "1.0.6",
4
4
  "description": "TypeScript type definitions for poker game engine",
5
+ "author": "A.Aurelius",
6
+ "license": "MIT",
5
7
  "main": "dist/index.js",
6
8
  "types": "dist/index.d.ts",
7
9
  "exports": {
@@ -17,19 +19,26 @@
17
19
  "README.md",
18
20
  "LICENSE"
19
21
  ],
22
+ "sideEffects": false,
20
23
  "scripts": {
21
24
  "build": "tsc",
22
- "clean": "rm -rf dist",
23
- "test": "echo \"No tests for types package (types only)\" && exit 0"
25
+ "build:watch": "tsc --watch",
26
+ "clean": "rm -rf dist coverage",
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "eslint . --ext .ts",
29
+ "lint:fix": "eslint . --ext .ts --fix",
30
+ "test": "NODE_OPTIONS='--no-warnings' jest",
31
+ "test:watch": "NODE_OPTIONS='--no-warnings' jest --watch",
32
+ "test:coverage": "NODE_OPTIONS='--no-warnings' jest --coverage"
24
33
  },
25
34
  "keywords": [
26
35
  "poker",
27
36
  "types",
28
37
  "typescript",
29
- "texas-holdem"
38
+ "texas-holdem",
39
+ "game-engine",
40
+ "immutable"
30
41
  ],
31
- "author": "A.Aurelius",
32
- "license": "MIT",
33
42
  "repository": {
34
43
  "type": "git",
35
44
  "url": "https://github.com/aaurelions/pokertools.git",
@@ -42,7 +51,10 @@
42
51
  "publishConfig": {
43
52
  "access": "public"
44
53
  },
45
- "devDependencies": {
46
- "typescript": "^5.9.3"
54
+ "engines": {
55
+ "node": ">=18.0.0"
56
+ },
57
+ "dependencies": {
58
+ "zod": "^4.4.3"
47
59
  }
48
60
  }
@@ -1 +0,0 @@
1
- {"root":["../src/Action.ts","../src/Config.ts","../src/GameState.ts","../src/HandHistory.ts","../src/Player.ts","../src/Pot.ts","../src/PublicState.ts","../src/index.ts"],"version":"5.9.3"}