@pluto-khronos/types 0.2.1 → 0.2.3

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/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- export * from './schemas/colors';
2
- export * from './schemas/sports';
1
+ export * from './schemas/betting';
3
2
  export * from './schemas/channels';
3
+ export * from './schemas/colors';
4
4
  export * from './schemas/guilds';
5
5
  export * from './schemas/shared';
6
+ export * from './schemas/sports';
package/dist/index.js CHANGED
@@ -15,8 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // Export all schemas and types
18
- __exportStar(require("./schemas/colors"), exports);
19
- __exportStar(require("./schemas/sports"), exports);
18
+ __exportStar(require("./schemas/betting"), exports);
20
19
  __exportStar(require("./schemas/channels"), exports);
20
+ __exportStar(require("./schemas/colors"), exports);
21
21
  __exportStar(require("./schemas/guilds"), exports);
22
22
  __exportStar(require("./schemas/shared"), exports);
23
+ __exportStar(require("./schemas/sports"), exports);
@@ -13,3 +13,29 @@ export declare const matchOddsSchema: z.ZodObject<{
13
13
  away_team_odds: z.ZodNumber;
14
14
  }, z.core.$strip>;
15
15
  export type MatchOdds = z.infer<typeof matchOddsSchema>;
16
+ /**
17
+ * Schema for a pushed bet result (tie game refund)
18
+ * @group Betting
19
+ */
20
+ export declare const betslipPushSchema: z.ZodObject<{
21
+ userid: z.ZodString;
22
+ amount: z.ZodNumber;
23
+ betid: z.ZodNumber;
24
+ team: z.ZodString;
25
+ }, z.core.$strip>;
26
+ export type IBetslipPush = z.infer<typeof betslipPushSchema>;
27
+ /**
28
+ * Schema for bet result notification payload
29
+ * @group Betting
30
+ */
31
+ export declare const notificationBetResultsSchema: z.ZodObject<{
32
+ winners: z.ZodNullable<z.ZodArray<z.ZodAny>>;
33
+ losers: z.ZodArray<z.ZodAny>;
34
+ pushes: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ userid: z.ZodString;
36
+ amount: z.ZodNumber;
37
+ betid: z.ZodNumber;
38
+ team: z.ZodString;
39
+ }, z.core.$strip>>>;
40
+ }, z.core.$strip>;
41
+ export type INotificationBetResults = z.infer<typeof notificationBetResultsSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.matchOddsSchema = void 0;
3
+ exports.notificationBetResultsSchema = exports.betslipPushSchema = exports.matchOddsSchema = void 0;
4
4
  /**
5
5
  * @group Betting
6
6
  * Schemas for betting and odds-related data
@@ -17,3 +17,29 @@ exports.matchOddsSchema = zod_1.z
17
17
  away_team_odds: zod_1.z.number().describe('Betting odds for away team'),
18
18
  })
19
19
  .describe('Match betting odds information');
20
+ /**
21
+ * Schema for a pushed bet result (tie game refund)
22
+ * @group Betting
23
+ */
24
+ exports.betslipPushSchema = zod_1.z
25
+ .object({
26
+ userid: zod_1.z.string().describe('User ID who placed the bet'),
27
+ amount: zod_1.z.number().describe('Amount refunded to user'),
28
+ betid: zod_1.z.number().describe('Unique bet identifier'),
29
+ team: zod_1.z.string().describe('Team the user bet on'),
30
+ })
31
+ .describe('Information about a bet that was pushed due to a tie game');
32
+ /**
33
+ * Schema for bet result notification payload
34
+ * @group Betting
35
+ */
36
+ exports.notificationBetResultsSchema = zod_1.z
37
+ .object({
38
+ winners: zod_1.z.array(zod_1.z.any()).nullable().describe('Array of winning bets'),
39
+ losers: zod_1.z.array(zod_1.z.any()).describe('Array of losing bets'),
40
+ pushes: zod_1.z
41
+ .array(exports.betslipPushSchema)
42
+ .optional()
43
+ .describe('Array of pushed bets from tie games'),
44
+ })
45
+ .describe('Notification payload for bet results including pushes from ties');
@@ -37,7 +37,7 @@ export declare const channelDeletionEventSchema: z.ZodObject<{
37
37
  * @group Channel Data
38
38
  */
39
39
  export declare const channelAggregatedSchema: z.ZodObject<{
40
- metadata: z.ZodOptional<z.ZodObject<{
40
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
41
41
  headline: z.ZodNullable<z.ZodOptional<z.ZodString>>;
42
42
  records: z.ZodNullable<z.ZodOptional<z.ZodObject<{
43
43
  home_team: z.ZodObject<{
@@ -47,7 +47,7 @@ export declare const channelAggregatedSchema: z.ZodObject<{
47
47
  total_record: z.ZodString;
48
48
  }, z.core.$strip>;
49
49
  }, z.core.$strip>>>;
50
- }, z.core.$strip>>;
50
+ }, z.core.$strip>>>;
51
51
  home_team: z.ZodString;
52
52
  away_team: z.ZodString;
53
53
  id: z.ZodString;
@@ -56,14 +56,14 @@ export declare const channelAggregatedSchema: z.ZodObject<{
56
56
  nfl: "nfl";
57
57
  }>;
58
58
  created: z.ZodBoolean;
59
- gametime: z.ZodDate;
59
+ gametime: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodDate>;
60
60
  channelname: z.ZodString;
61
61
  matchOdds: z.ZodObject<{
62
62
  favored: z.ZodString;
63
63
  home_team_odds: z.ZodNumber;
64
64
  away_team_odds: z.ZodNumber;
65
65
  }, z.core.$strip>;
66
- }, z.core.$strip>;
66
+ }, z.core.$loose>;
67
67
  /**
68
68
  * Schema for match embed display data
69
69
  * @group Channel Creation
@@ -127,20 +127,20 @@ export declare const matchEmbedDisplaySchema: z.ZodObject<{
127
127
  * @group Guilds
128
128
  */
129
129
  export declare const channelEligibleGuildSchema: z.ZodObject<{
130
+ eligibleMatches: z.ZodArray<z.ZodString>;
130
131
  guildId: z.ZodString;
131
132
  bettingChannelId: z.ZodString;
132
133
  gameCategoryId: z.ZodString;
133
134
  preferredTeams: z.ZodOptional<z.ZodArray<z.ZodString>>;
134
135
  sport: z.ZodString;
135
- eligibleMatches: z.ZodArray<z.ZodString>;
136
- }, z.core.$strip>;
136
+ }, z.core.$loose>;
137
137
  /**
138
138
  * Schema for channel creation events
139
139
  * @group Channel Creation
140
140
  */
141
141
  export declare const channelCreationEventSchema: z.ZodObject<{
142
142
  channel: z.ZodObject<{
143
- metadata: z.ZodOptional<z.ZodObject<{
143
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
144
144
  headline: z.ZodNullable<z.ZodOptional<z.ZodString>>;
145
145
  records: z.ZodNullable<z.ZodOptional<z.ZodObject<{
146
146
  home_team: z.ZodObject<{
@@ -150,7 +150,7 @@ export declare const channelCreationEventSchema: z.ZodObject<{
150
150
  total_record: z.ZodString;
151
151
  }, z.core.$strip>;
152
152
  }, z.core.$strip>>>;
153
- }, z.core.$strip>>;
153
+ }, z.core.$strip>>>;
154
154
  home_team: z.ZodString;
155
155
  away_team: z.ZodString;
156
156
  id: z.ZodString;
@@ -159,34 +159,34 @@ export declare const channelCreationEventSchema: z.ZodObject<{
159
159
  nfl: "nfl";
160
160
  }>;
161
161
  created: z.ZodBoolean;
162
- gametime: z.ZodDate;
162
+ gametime: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodDate>;
163
163
  channelname: z.ZodString;
164
164
  matchOdds: z.ZodObject<{
165
165
  favored: z.ZodString;
166
166
  home_team_odds: z.ZodNumber;
167
167
  away_team_odds: z.ZodNumber;
168
168
  }, z.core.$strip>;
169
- }, z.core.$strip>;
169
+ }, z.core.$loose>;
170
170
  guild: z.ZodObject<{
171
+ eligibleMatches: z.ZodArray<z.ZodString>;
171
172
  guildId: z.ZodString;
172
173
  bettingChannelId: z.ZodString;
173
174
  gameCategoryId: z.ZodString;
174
175
  preferredTeams: z.ZodOptional<z.ZodArray<z.ZodString>>;
175
176
  sport: z.ZodString;
176
- eligibleMatches: z.ZodArray<z.ZodString>;
177
- }, z.core.$strip>;
178
- metadata: z.ZodOptional<z.ZodObject<{
179
- publishedAt: z.ZodDate;
177
+ }, z.core.$loose>;
178
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
179
+ publishedAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodDate>;
180
180
  eventId: z.ZodString;
181
- }, z.core.$strip>>;
182
- }, z.core.$strip>;
181
+ }, z.core.$loose>>>;
182
+ }, z.core.$loose>;
183
183
  /**
184
184
  * Schema for incoming channel data from Pluto
185
185
  * @group Channel Data
186
186
  */
187
187
  export declare const incomingChannelDataSchema: z.ZodObject<{
188
188
  channels: z.ZodArray<z.ZodObject<{
189
- metadata: z.ZodOptional<z.ZodObject<{
189
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
190
190
  headline: z.ZodNullable<z.ZodOptional<z.ZodString>>;
191
191
  records: z.ZodNullable<z.ZodOptional<z.ZodObject<{
192
192
  home_team: z.ZodObject<{
@@ -196,7 +196,7 @@ export declare const incomingChannelDataSchema: z.ZodObject<{
196
196
  total_record: z.ZodString;
197
197
  }, z.core.$strip>;
198
198
  }, z.core.$strip>>>;
199
- }, z.core.$strip>>;
199
+ }, z.core.$strip>>>;
200
200
  home_team: z.ZodString;
201
201
  away_team: z.ZodString;
202
202
  id: z.ZodString;
@@ -205,26 +205,26 @@ export declare const incomingChannelDataSchema: z.ZodObject<{
205
205
  nfl: "nfl";
206
206
  }>;
207
207
  created: z.ZodBoolean;
208
- gametime: z.ZodDate;
208
+ gametime: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodDate>;
209
209
  channelname: z.ZodString;
210
210
  matchOdds: z.ZodObject<{
211
211
  favored: z.ZodString;
212
212
  home_team_odds: z.ZodNumber;
213
213
  away_team_odds: z.ZodNumber;
214
214
  }, z.core.$strip>;
215
- }, z.core.$strip>>;
215
+ }, z.core.$loose>>;
216
216
  guilds: z.ZodArray<z.ZodObject<{
217
+ eligibleMatches: z.ZodArray<z.ZodString>;
217
218
  guildId: z.ZodString;
218
219
  bettingChannelId: z.ZodString;
219
220
  gameCategoryId: z.ZodString;
220
221
  preferredTeams: z.ZodOptional<z.ZodArray<z.ZodString>>;
221
222
  sport: z.ZodString;
222
- eligibleMatches: z.ZodArray<z.ZodString>;
223
- }, z.core.$strip>>;
223
+ }, z.core.$loose>>;
224
224
  }, z.core.$strip>;
225
225
  export declare const ChannelWithGuildAggregatedSchema: z.ZodObject<{
226
226
  channel: z.ZodObject<{
227
- metadata: z.ZodOptional<z.ZodObject<{
227
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
228
228
  headline: z.ZodNullable<z.ZodOptional<z.ZodString>>;
229
229
  records: z.ZodNullable<z.ZodOptional<z.ZodObject<{
230
230
  home_team: z.ZodObject<{
@@ -234,7 +234,7 @@ export declare const ChannelWithGuildAggregatedSchema: z.ZodObject<{
234
234
  total_record: z.ZodString;
235
235
  }, z.core.$strip>;
236
236
  }, z.core.$strip>>>;
237
- }, z.core.$strip>>;
237
+ }, z.core.$strip>>>;
238
238
  home_team: z.ZodString;
239
239
  away_team: z.ZodString;
240
240
  id: z.ZodString;
@@ -243,22 +243,22 @@ export declare const ChannelWithGuildAggregatedSchema: z.ZodObject<{
243
243
  nfl: "nfl";
244
244
  }>;
245
245
  created: z.ZodBoolean;
246
- gametime: z.ZodDate;
246
+ gametime: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodDate>;
247
247
  channelname: z.ZodString;
248
248
  matchOdds: z.ZodObject<{
249
249
  favored: z.ZodString;
250
250
  home_team_odds: z.ZodNumber;
251
251
  away_team_odds: z.ZodNumber;
252
252
  }, z.core.$strip>;
253
- }, z.core.$strip>;
253
+ }, z.core.$loose>;
254
254
  guild: z.ZodObject<{
255
+ eligibleMatches: z.ZodArray<z.ZodString>;
255
256
  guildId: z.ZodString;
256
257
  bettingChannelId: z.ZodString;
257
258
  gameCategoryId: z.ZodString;
258
259
  preferredTeams: z.ZodOptional<z.ZodArray<z.ZodString>>;
259
260
  sport: z.ZodString;
260
- eligibleMatches: z.ZodArray<z.ZodString>;
261
- }, z.core.$strip>;
261
+ }, z.core.$loose>;
262
262
  }, z.core.$strip>;
263
263
  /**
264
264
  * Pluto aggregated data structure when creating a channel
@@ -267,7 +267,7 @@ export declare const ChannelWithGuildAggregatedSchema: z.ZodObject<{
267
267
  */
268
268
  export declare const channelEmbedPayloadSchema: z.ZodObject<{
269
269
  channel: z.ZodObject<{
270
- metadata: z.ZodOptional<z.ZodObject<{
270
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
271
271
  headline: z.ZodNullable<z.ZodOptional<z.ZodString>>;
272
272
  records: z.ZodNullable<z.ZodOptional<z.ZodObject<{
273
273
  home_team: z.ZodObject<{
@@ -277,7 +277,7 @@ export declare const channelEmbedPayloadSchema: z.ZodObject<{
277
277
  total_record: z.ZodString;
278
278
  }, z.core.$strip>;
279
279
  }, z.core.$strip>>>;
280
- }, z.core.$strip>>;
280
+ }, z.core.$strip>>>;
281
281
  home_team: z.ZodString;
282
282
  away_team: z.ZodString;
283
283
  id: z.ZodString;
@@ -286,22 +286,22 @@ export declare const channelEmbedPayloadSchema: z.ZodObject<{
286
286
  nfl: "nfl";
287
287
  }>;
288
288
  created: z.ZodBoolean;
289
- gametime: z.ZodDate;
289
+ gametime: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodDate>;
290
290
  channelname: z.ZodString;
291
291
  matchOdds: z.ZodObject<{
292
292
  favored: z.ZodString;
293
293
  home_team_odds: z.ZodNumber;
294
294
  away_team_odds: z.ZodNumber;
295
295
  }, z.core.$strip>;
296
- }, z.core.$strip>;
296
+ }, z.core.$loose>;
297
297
  guild: z.ZodObject<{
298
+ eligibleMatches: z.ZodArray<z.ZodString>;
298
299
  guildId: z.ZodString;
299
300
  bettingChannelId: z.ZodString;
300
301
  gameCategoryId: z.ZodString;
301
302
  preferredTeams: z.ZodOptional<z.ZodArray<z.ZodString>>;
302
303
  sport: z.ZodString;
303
- eligibleMatches: z.ZodArray<z.ZodString>;
304
- }, z.core.$strip>;
304
+ }, z.core.$loose>;
305
305
  metadata: z.ZodObject<{
306
306
  headline: z.ZodNullable<z.ZodOptional<z.ZodString>>;
307
307
  records: z.ZodNullable<z.ZodOptional<z.ZodObject<{
@@ -96,7 +96,7 @@ exports.channelDeletionEventSchema = zod_1.z
96
96
  * @group Channel Data
97
97
  */
98
98
  exports.channelAggregatedSchema = zod_1.z
99
- .object({
99
+ .looseObject({
100
100
  id: zod_1.z
101
101
  .string({
102
102
  error: (issue) => issue.input === undefined
@@ -113,11 +113,8 @@ exports.channelAggregatedSchema = zod_1.z
113
113
  })
114
114
  .describe('Whether the channel has been created in Discord [DEPRECATED FLAG]'),
115
115
  gametime: zod_1.z
116
- .date({
117
- error: (issue) => issue.input === undefined
118
- ? { message: 'Game time is required.' }
119
- : { message: 'Game time must be a valid date.' },
120
- })
116
+ .union([zod_1.z.date(), zod_1.z.string().transform((val) => new Date(val))])
117
+ .pipe(zod_1.z.date())
121
118
  .describe('Scheduled time for the game/match'),
122
119
  channelname: zod_1.z
123
120
  .string({
@@ -128,7 +125,7 @@ exports.channelAggregatedSchema = zod_1.z
128
125
  .describe('Name of the Discord channel'),
129
126
  matchOdds: betting_1.matchOddsSchema,
130
127
  ...teams_1.matchTeamsSchema.shape,
131
- metadata: match_metadata_1.matchMetadataSchema.optional(),
128
+ metadata: match_metadata_1.matchMetadataSchema.nullable().optional(),
132
129
  })
133
130
  .describe('Aggregated channel information including match and odds details');
134
131
  /**
@@ -198,8 +195,9 @@ exports.matchEmbedDisplaySchema = zod_1.z
198
195
  * Schema for guild data with channel creation eligibility
199
196
  * @group Guilds
200
197
  */
201
- exports.channelEligibleGuildSchema = guilds_1.guildConfigSchema
202
- .extend({
198
+ exports.channelEligibleGuildSchema = zod_1.z
199
+ .looseObject({
200
+ ...guilds_1.guildConfigSchema.shape,
203
201
  eligibleMatches: zod_1.z
204
202
  .array(zod_1.z.string({ error: 'Each match ID must be a string.' }), {
205
203
  error: (issue) => issue.input === undefined
@@ -214,10 +212,10 @@ exports.channelEligibleGuildSchema = guilds_1.guildConfigSchema
214
212
  * @group Channel Creation
215
213
  */
216
214
  exports.channelCreationEventSchema = zod_1.z
217
- .object({
215
+ .looseObject({
218
216
  channel: exports.channelAggregatedSchema,
219
217
  guild: exports.channelEligibleGuildSchema,
220
- metadata: shared_1.bullMqMetadataSchema.optional(),
218
+ metadata: shared_1.bullMqMetadataSchema.nullable().optional(),
221
219
  })
222
220
  .describe('Event data for channel creation operations');
223
221
  /**
@@ -13,7 +13,7 @@ export declare const guildConfigSchema: z.ZodObject<{
13
13
  gameCategoryId: z.ZodString;
14
14
  preferredTeams: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
15
  sport: z.ZodString;
16
- }, z.core.$strip>;
16
+ }, z.core.$loose>;
17
17
  /**
18
18
  * Type representing base guild configuration
19
19
  * @group Guilds
@@ -11,7 +11,7 @@ const zod_1 = require("zod");
11
11
  * @group Guilds
12
12
  */
13
13
  exports.guildConfigSchema = zod_1.z
14
- .object({
14
+ .looseObject({
15
15
  guildId: zod_1.z.string().describe('Discord guild (server) ID'),
16
16
  bettingChannelId: zod_1.z
17
17
  .string()
@@ -8,9 +8,9 @@ import { z } from 'zod';
8
8
  * @group Queue
9
9
  */
10
10
  export declare const bullMqMetadataSchema: z.ZodObject<{
11
- publishedAt: z.ZodDate;
11
+ publishedAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodDate>;
12
12
  eventId: z.ZodString;
13
- }, z.core.$strip>;
13
+ }, z.core.$loose>;
14
14
  /**
15
15
  * Type representing BullMQ job metadata
16
16
  * @group Queue
@@ -11,8 +11,11 @@ const zod_1 = require("zod");
11
11
  * @group Queue
12
12
  */
13
13
  exports.bullMqMetadataSchema = zod_1.z
14
- .object({
15
- publishedAt: zod_1.z.date().describe('Timestamp when the event was published'),
14
+ .looseObject({
15
+ publishedAt: zod_1.z
16
+ .union([zod_1.z.date(), zod_1.z.string().transform((val) => new Date(val))])
17
+ .pipe(zod_1.z.date())
18
+ .describe('Timestamp when the event was published'),
16
19
  eventId: zod_1.z.string().describe('Unique identifier for tracking the event'),
17
20
  })
18
21
  .describe('Common metadata structure for BullMQ jobs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluto-khronos/types",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Shared TypeScript types for Pluto & Khronos projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",