@fundedfast/sdk 1.3.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 (52) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +352 -0
  3. package/dist/cjs/client.d.ts +130 -0
  4. package/dist/cjs/client.d.ts.map +1 -0
  5. package/dist/cjs/client.js +362 -0
  6. package/dist/cjs/client.js.map +1 -0
  7. package/dist/cjs/index.d.ts +27 -0
  8. package/dist/cjs/index.d.ts.map +1 -0
  9. package/dist/cjs/index.js +33 -0
  10. package/dist/cjs/index.js.map +1 -0
  11. package/dist/cjs/package.json +1 -0
  12. package/dist/cjs/resources/admin.d.ts +597 -0
  13. package/dist/cjs/resources/admin.d.ts.map +1 -0
  14. package/dist/cjs/resources/admin.js +842 -0
  15. package/dist/cjs/resources/admin.js.map +1 -0
  16. package/dist/cjs/resources/public.d.ts +519 -0
  17. package/dist/cjs/resources/public.d.ts.map +1 -0
  18. package/dist/cjs/resources/public.js +588 -0
  19. package/dist/cjs/resources/public.js.map +1 -0
  20. package/dist/cjs/types.d.ts +651 -0
  21. package/dist/cjs/types.d.ts.map +1 -0
  22. package/dist/cjs/types.js +11 -0
  23. package/dist/cjs/types.js.map +1 -0
  24. package/dist/cjs/webhooks.d.ts +104 -0
  25. package/dist/cjs/webhooks.d.ts.map +1 -0
  26. package/dist/cjs/webhooks.js +199 -0
  27. package/dist/cjs/webhooks.js.map +1 -0
  28. package/dist/esm/client.d.ts +130 -0
  29. package/dist/esm/client.d.ts.map +1 -0
  30. package/dist/esm/client.js +355 -0
  31. package/dist/esm/client.js.map +1 -0
  32. package/dist/esm/index.d.ts +27 -0
  33. package/dist/esm/index.d.ts.map +1 -0
  34. package/dist/esm/index.js +26 -0
  35. package/dist/esm/index.js.map +1 -0
  36. package/dist/esm/resources/admin.d.ts +597 -0
  37. package/dist/esm/resources/admin.d.ts.map +1 -0
  38. package/dist/esm/resources/admin.js +816 -0
  39. package/dist/esm/resources/admin.js.map +1 -0
  40. package/dist/esm/resources/public.d.ts +519 -0
  41. package/dist/esm/resources/public.d.ts.map +1 -0
  42. package/dist/esm/resources/public.js +578 -0
  43. package/dist/esm/resources/public.js.map +1 -0
  44. package/dist/esm/types.d.ts +651 -0
  45. package/dist/esm/types.d.ts.map +1 -0
  46. package/dist/esm/types.js +10 -0
  47. package/dist/esm/types.js.map +1 -0
  48. package/dist/esm/webhooks.d.ts +104 -0
  49. package/dist/esm/webhooks.d.ts.map +1 -0
  50. package/dist/esm/webhooks.js +159 -0
  51. package/dist/esm/webhooks.js.map +1 -0
  52. package/package.json +72 -0
@@ -0,0 +1,588 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SandboxApi = exports.WidgetApi = exports.EventsApi = exports.ReconciliationApi = exports.UsersApi = exports.BetsApi = exports.ChallengesApi = void 0;
4
+ class ChallengesApi {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * List all enabled challenge tiers available for purchase.
11
+ *
12
+ * @returns Array of challenge tiers with pricing, rules, and configuration.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const tiers = await fast.challenges.listTiers();
17
+ * for (const tier of tiers) {
18
+ * console.log(`${tier.name}: ${tier.purchasePrice} ${tier.currency}`);
19
+ * }
20
+ * ```
21
+ */
22
+ async listTiers() {
23
+ const res = await this.client.request('GET', '/challenge-tiers');
24
+ return res.challengeTiers;
25
+ }
26
+ /**
27
+ * Get terms, rules, and disclosures for a tier.
28
+ * Display these to the user before purchase for regulatory compliance.
29
+ *
30
+ * @param tierId - UUID of the challenge tier
31
+ */
32
+ async getTierTerms(tierId) {
33
+ return this.client.request('GET', `/challenge-tiers/${tierId}/terms`);
34
+ }
35
+ /**
36
+ * Purchase a challenge for a user.
37
+ *
38
+ * Your sportsbook collects payment first, then calls this endpoint to activate
39
+ * the challenge in FAST. If an approvalUrl is configured, FAST will call your
40
+ * backend for approval (type: 'purchase') before proceeding.
41
+ *
42
+ * @param data - Purchase details (userId + challengeTierId)
43
+ * @returns The created challenge with starting balance and expiry
44
+ *
45
+ * @throws {FastApiError} 409 if user already has an active challenge or funded account
46
+ * @throws {FastApiError} 400 if tier is disabled or not found
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const challenge = await fast.challenges.purchase({
51
+ * userId: 'player-42',
52
+ * challengeTierId: 'tier-uuid',
53
+ * referralCode: 'PARTNER-100',
54
+ * });
55
+ * console.log(`Challenge started, expires: ${challenge.expiresAt}`);
56
+ * ```
57
+ */
58
+ async purchase(data) {
59
+ const res = await this.client.request('POST', '/challenges/purchase', { body: data });
60
+ return res.challenge;
61
+ }
62
+ /**
63
+ * Get the public leaderboard.
64
+ *
65
+ * Returns top challengers by balance. User IDs are anonymized.
66
+ *
67
+ * @param period - Time window: 'week', 'month', or 'all' (default: 'week')
68
+ * @param limit - Max entries to return (default: 10, max: 50)
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const leaders = await fast.challenges.leaderboard('week', 10);
73
+ * for (const entry of leaders) {
74
+ * console.log(`${entry.displayName}: ${entry.currentBalance}`);
75
+ * }
76
+ * ```
77
+ */
78
+ async leaderboard(period, limit) {
79
+ const query = {};
80
+ if (period)
81
+ query.period = period;
82
+ if (limit)
83
+ query.limit = String(limit);
84
+ const res = await this.client.request('GET', '/leaderboard', { query });
85
+ return res.leaderboard;
86
+ }
87
+ }
88
+ exports.ChallengesApi = ChallengesApi;
89
+ /**
90
+ * Bet validation and ingestion.
91
+ */
92
+ class BetsApi {
93
+ client;
94
+ constructor(client) {
95
+ this.client = client;
96
+ }
97
+ /**
98
+ * Validate a bet against the active ruleset without recording it.
99
+ *
100
+ * Call this before confirming a bet placement. Returns accept/reject
101
+ * with specific reason codes. Does not affect balance or counters.
102
+ *
103
+ * @param bet - The bet to validate
104
+ * @returns Validation result with status and reason codes
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const result = await fast.bets.validate({
109
+ * userId: 'player-42',
110
+ * externalBetId: 'BET-001',
111
+ * stakeAmount: 5.00,
112
+ * odds: 2.10,
113
+ * status: 'placed',
114
+ * });
115
+ *
116
+ * if (result.status === 'rejected') {
117
+ * console.log('Rejected:', result.reasonCodes);
118
+ * // Show rejection reason to user in sportsbook UI
119
+ * }
120
+ * ```
121
+ */
122
+ async validate(bet) {
123
+ const res = await this.client.request('POST', '/bets/validate', { body: bet });
124
+ return res.validationResult;
125
+ }
126
+ /**
127
+ * Ingest a bet event (placement or settlement).
128
+ *
129
+ * Send ALL bet events here: placements, settlements (won/lost), and voids.
130
+ * Behavior depends on your integration mode:
131
+ * - **sync**: Validates, records in shadow ledger, returns full result (200)
132
+ * - **async**: Accepts immediately (202), processes in background
133
+ *
134
+ * @param bet - The bet event to ingest
135
+ * @returns Processing result with mode and optional validation result
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * // Placement
140
+ * await fast.bets.ingest({
141
+ * userId: 'player-42',
142
+ * externalBetId: 'BET-001',
143
+ * stakeAmount: 5.00,
144
+ * odds: 2.10,
145
+ * status: 'placed',
146
+ * });
147
+ *
148
+ * // Settlement
149
+ * await fast.bets.ingest({
150
+ * userId: 'player-42',
151
+ * externalBetId: 'BET-001',
152
+ * stakeAmount: 5.00,
153
+ * odds: 2.10,
154
+ * status: 'settled-won',
155
+ * settlementAmount: 10.50,
156
+ * });
157
+ * ```
158
+ */
159
+ async ingest(bet) {
160
+ return this.client.request('POST', '/bets', { body: bet });
161
+ }
162
+ /**
163
+ * Ingest a batch of bet events (up to 100 per request).
164
+ *
165
+ * Supports partial success - some bets may fail while others succeed.
166
+ * Check the `results` array for per-bet status.
167
+ *
168
+ * @param bets - Array of bet events (max 100)
169
+ * @returns Batch result with per-bet status
170
+ *
171
+ * @throws {FastApiError} 400 if batch exceeds 100 bets
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * const result = await fast.bets.ingestBatch(betEvents);
176
+ * console.log(`${result.processed}/${result.total} processed`);
177
+ * for (const r of result.results.filter(r => r.status === 'failed')) {
178
+ * console.error(`${r.externalBetId}: ${r.error}`);
179
+ * }
180
+ * ```
181
+ */
182
+ async ingestBatch(bets) {
183
+ return this.client.request('POST', '/bets/batch', { body: { bets } });
184
+ }
185
+ }
186
+ exports.BetsApi = BetsApi;
187
+ /**
188
+ * User progress, history, and withdrawals.
189
+ */
190
+ class UsersApi {
191
+ client;
192
+ constructor(client) {
193
+ this.client = client;
194
+ }
195
+ /**
196
+ * Get user progress (challenge, funded account, or none).
197
+ *
198
+ * Returns a discriminated union - check the `type` field:
199
+ * - `challenge`: user has an active challenge
200
+ * - `funded_account`: user has an active funded account
201
+ * - `none`: user has no active position
202
+ *
203
+ * @param userId - Your sportsbook user identifier
204
+ *
205
+ * @example
206
+ * ```typescript
207
+ * const progress = await fast.users.getProgress('player-42');
208
+ *
209
+ * switch (progress.type) {
210
+ * case 'challenge':
211
+ * showChallengeUI(progress.currentBalance, progress.targetBalance);
212
+ * break;
213
+ * case 'funded_account':
214
+ * showFundedUI(progress.withdrawableProfit);
215
+ * break;
216
+ * case 'none':
217
+ * showChallengePurchaseUI();
218
+ * break;
219
+ * }
220
+ * ```
221
+ */
222
+ async getProgress(userId) {
223
+ return this.client.request('GET', `/users/${userId}/progress`);
224
+ }
225
+ /**
226
+ * Get the active ruleset for a user.
227
+ *
228
+ * Returns the full ruleset currently governing this user's bets.
229
+ * Useful for displaying bet limits in your sportsbook UI.
230
+ *
231
+ * @param userId - Your sportsbook user identifier
232
+ * @throws {FastApiError} 404 if user has no active challenge or funded account
233
+ */
234
+ async getRuleset(userId) {
235
+ const res = await this.client.request('GET', `/users/${userId}/ruleset`);
236
+ return res.ruleset;
237
+ }
238
+ /**
239
+ * Get user challenge and funded account history.
240
+ *
241
+ * Returns all past challenges and funded accounts ordered by creation date descending.
242
+ *
243
+ * @param userId - Your sportsbook user identifier
244
+ */
245
+ async getHistory(userId) {
246
+ return this.client.request('GET', `/users/${userId}/history`);
247
+ }
248
+ /**
249
+ * Get detailed withdrawable profit calculation.
250
+ *
251
+ * Shows the exact amount the user can withdraw right now, factoring in
252
+ * profit split, payout cap, active day requirements, and pending bets.
253
+ *
254
+ * @param userId - Your sportsbook user identifier
255
+ * @throws {FastApiError} 404 if user has no active funded account
256
+ */
257
+ async getWithdrawable(userId) {
258
+ return this.client.request('GET', `/users/${userId}/withdrawable`);
259
+ }
260
+ /**
261
+ * Process a withdrawal from a funded account.
262
+ *
263
+ * Deducts the amount from the user's funded account balance and returns
264
+ * the profit split breakdown. Your sportsbook handles the actual payout.
265
+ *
266
+ * If an approvalUrl is configured, FAST will call your backend for approval
267
+ * (type: 'withdrawal') before proceeding.
268
+ *
269
+ * @param userId - Your sportsbook user identifier
270
+ * @param data - Withdrawal amount
271
+ * @returns Balance after withdrawal and profit split breakdown
272
+ *
273
+ * @throws {FastApiError} 400 if amount exceeds withdrawable profit
274
+ * @throws {FastApiError} 400 if active day requirement not met
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * const result = await fast.users.withdraw('player-42', { amount: 200 });
279
+ * console.log(`Paid user: ${result.userPayout}, kept: ${result.operatorShare}`);
280
+ * // Now process the actual payout in your payment system
281
+ * ```
282
+ */
283
+ async withdraw(userId, data) {
284
+ return this.client.request('POST', `/users/${userId}/withdraw`, { body: data });
285
+ }
286
+ /**
287
+ * Get user event timeline.
288
+ *
289
+ * Chronological timeline of all events: purchases, bets, settlements,
290
+ * state changes, achievements, rewards. Designed for dispute resolution.
291
+ *
292
+ * @param userId - Your sportsbook user identifier
293
+ */
294
+ async getTimeline(userId) {
295
+ const res = await this.client.request('GET', `/users/${userId}/timeline`);
296
+ return res.timeline;
297
+ }
298
+ /**
299
+ * Get user achievements with progress.
300
+ *
301
+ * Returns earned and locked achievements, streak info, total points, and level.
302
+ *
303
+ * @param userId - Your sportsbook user identifier
304
+ *
305
+ * @example
306
+ * ```typescript
307
+ * const data = await fast.users.getAchievements('player-42');
308
+ * console.log(`Level ${data.level}, ${data.totalPoints} points`);
309
+ * for (const a of data.achievements.filter(a => a.earned)) {
310
+ * console.log(`Earned: ${a.name} (${a.rarity})`);
311
+ * }
312
+ * ```
313
+ */
314
+ async getAchievements(userId) {
315
+ return this.client.request('GET', `/users/${userId}/achievements`);
316
+ }
317
+ /**
318
+ * Get user rewards (active and claimable).
319
+ *
320
+ * Returns two lists: rewards already applied (auto-mode) and rewards
321
+ * waiting for the user to claim.
322
+ *
323
+ * @param userId - Your sportsbook user identifier
324
+ */
325
+ async getRewards(userId) {
326
+ return this.client.request('GET', `/users/${userId}/rewards`);
327
+ }
328
+ /**
329
+ * Claim a pending reward.
330
+ *
331
+ * Only works for rewards with applyMode='claim'. For balance_boost_percent
332
+ * rewards, applies the boost immediately to the active challenge/funded account.
333
+ *
334
+ * @param userId - Your sportsbook user identifier
335
+ * @param rewardId - UUID of the reward to claim
336
+ *
337
+ * @throws {FastApiError} 404 if reward not found or already claimed
338
+ */
339
+ async claimReward(userId, rewardId) {
340
+ return this.client.request('POST', `/users/${userId}/rewards/${rewardId}/claim`);
341
+ }
342
+ /**
343
+ * Notify FAST of a sportsbook withdrawal.
344
+ *
345
+ * Triggers engagement side-effects (e.g. forfeiting bonuses with
346
+ * forfeitOnWithdrawal flag). Independent of FAST funded accounts.
347
+ *
348
+ * @param userId - Your sportsbook user identifier
349
+ * @param amount - Withdrawal amount in base currency
350
+ * @param currency - ISO 4217 currency code (default: EUR)
351
+ */
352
+ async notifyWithdrawal(userId, amount, currency) {
353
+ return this.client.request('POST', `/users/${userId}/withdrawal-event`, {
354
+ body: { amount, currency },
355
+ });
356
+ }
357
+ /**
358
+ * Continue a passed challenge into the Reward (funded) Account.
359
+ *
360
+ * Call when a challenge is in `passed_pending_choice` and the user chooses
361
+ * to continue instead of exiting with a stake refund. Creates the funded
362
+ * account and marks the challenge completed.
363
+ *
364
+ * @param userId - Your sportsbook user identifier
365
+ * @returns The id of the created funded account
366
+ *
367
+ * @throws {FastApiError} 404 if no challenge is awaiting a continue/refund choice
368
+ * @throws {FastApiError} 409 if the funded account could not be created
369
+ *
370
+ * @example
371
+ * ```typescript
372
+ * const { fundedAccountId } = await fast.users.continueChallenge('player-42');
373
+ * ```
374
+ */
375
+ async continueChallenge(userId) {
376
+ return this.client.request('POST', `/users/${userId}/challenge/continue`);
377
+ }
378
+ /**
379
+ * Exit a passed challenge and refund ONLY the user's own stake.
380
+ *
381
+ * The alternative to {@link continueChallenge}: the user takes back their
382
+ * own stake and the entire bonus is voided. Irreversible - the SDK sends
383
+ * `confirm: true` on your behalf. FAST records the exit and emits
384
+ * `challenge.stake_refunded` + `challenge.bonus_voided`; your sportsbook
385
+ * executes the actual refund payout.
386
+ *
387
+ * If a withdrawal approval URL is configured, FAST calls your backend for
388
+ * approval before proceeding.
389
+ *
390
+ * @param userId - Your sportsbook user identifier
391
+ * @returns The own stake to refund and the voided bonus amount
392
+ *
393
+ * @throws {FastApiError} 404 if no challenge is awaiting a continue/refund choice
394
+ * @throws {FastApiError} 402 if your approval endpoint rejected the refund
395
+ */
396
+ async refundChallengeStake(userId) {
397
+ return this.client.request('POST', `/users/${userId}/challenge/refund-stake`, { body: { confirm: true } });
398
+ }
399
+ /**
400
+ * Refund the own stake during the Reward (funded) Account phase.
401
+ *
402
+ * Only available when the tier was configured with `fundedStakeRefundable`.
403
+ * Voids the bonus, closes the funded account, and forfeits any accrued
404
+ * profit above the funded base. Irreversible - the SDK sends `confirm: true`
405
+ * on your behalf. FAST emits `funded_account.stake_refunded`; your
406
+ * sportsbook executes the refund payout.
407
+ *
408
+ * @param userId - Your sportsbook user identifier
409
+ * @returns The own stake to refund
410
+ *
411
+ * @throws {FastApiError} 404 if the user has no active funded account
412
+ * @throws {FastApiError} 409 if the tier does not allow an own-stake refund
413
+ */
414
+ async refundFundedStake(userId) {
415
+ return this.client.request('POST', `/users/${userId}/funded/refund-stake`, { body: { confirm: true } });
416
+ }
417
+ /**
418
+ * Get the user's tournament participation.
419
+ *
420
+ * Returns active, upcoming (entered or invited), and completed tournaments.
421
+ *
422
+ * @param userId - Your sportsbook user identifier
423
+ */
424
+ async getTournaments(userId) {
425
+ return this.client.request('GET', `/users/${userId}/tournaments`);
426
+ }
427
+ /**
428
+ * Get the user's loyalty status (points, tier, cashback).
429
+ *
430
+ * Returns null if the tenant has no loyalty program configured or the
431
+ * user has no loyalty record yet.
432
+ *
433
+ * @param userId - Your sportsbook user identifier
434
+ */
435
+ async getLoyalty(userId) {
436
+ const res = await this.client.request('GET', `/users/${userId}/loyalty`);
437
+ return res.loyalty;
438
+ }
439
+ /**
440
+ * Cancel an active challenge. No refunds are issued.
441
+ * Stake is forfeited, bonus is voided, challenge status becomes 'cancelled'.
442
+ *
443
+ * @param userId - Your sportsbook user identifier
444
+ */
445
+ async cancelChallenge(userId) {
446
+ return this.client.request('POST', `/users/${userId}/challenge/cancel`, {
447
+ body: { confirm: true },
448
+ });
449
+ }
450
+ /**
451
+ * Cancel an active reward (funded) account. No refunds are issued.
452
+ * Everything is forfeited, account status becomes 'revoked'.
453
+ *
454
+ * @param userId - Your sportsbook user identifier
455
+ */
456
+ async cancelFundedAccount(userId) {
457
+ return this.client.request('POST', `/users/${userId}/funded/cancel`, {
458
+ body: { confirm: true },
459
+ });
460
+ }
461
+ }
462
+ exports.UsersApi = UsersApi;
463
+ /**
464
+ * Bet event reconciliation for cross-referencing with sportsbook records.
465
+ */
466
+ class ReconciliationApi {
467
+ client;
468
+ constructor(client) {
469
+ this.client = client;
470
+ }
471
+ /**
472
+ * Get bet events and current balances for reconciliation.
473
+ *
474
+ * Use to cross-reference FAST shadow ledger data with your sportsbook records.
475
+ * Supports optional date range filtering.
476
+ *
477
+ * @param userId - Your sportsbook user identifier
478
+ * @param options - Optional date range (ISO 8601)
479
+ */
480
+ async getForUser(userId, options) {
481
+ const query = {};
482
+ if (options?.from)
483
+ query.from = options.from;
484
+ if (options?.to)
485
+ query.to = options.to;
486
+ return this.client.request('GET', `/reconciliation/${userId}`, { query });
487
+ }
488
+ }
489
+ exports.ReconciliationApi = ReconciliationApi;
490
+ /**
491
+ * Real-time event streaming (Server-Sent Events).
492
+ */
493
+ class EventsApi {
494
+ client;
495
+ constructor(client) {
496
+ this.client = client;
497
+ }
498
+ /**
499
+ * Issue an SSE connection token.
500
+ *
501
+ * Call from your backend, then pass the token to your frontend for SSE connection.
502
+ * Tokens are HMAC-signed, user-scoped, and expire after 1 hour.
503
+ *
504
+ * @param userId - The user to scope the event stream to
505
+ *
506
+ * @example
507
+ * ```typescript
508
+ * // Backend: issue token
509
+ * const { token } = await fast.events.issueToken('player-42');
510
+ *
511
+ * // Frontend: connect
512
+ * const url = fast.events.getStreamUrl(token, 'player-42');
513
+ * const source = new EventSource(url);
514
+ * ```
515
+ */
516
+ async issueToken(userId) {
517
+ return this.client.request('POST', '/sse/token', { body: { userId } });
518
+ }
519
+ /**
520
+ * Build the SSE stream URL for EventSource connection.
521
+ *
522
+ * @param token - Token from issueToken()
523
+ * @param userId - Same userId used to issue the token
524
+ * @returns Full URL for EventSource constructor
525
+ */
526
+ getStreamUrl(token, userId) {
527
+ return `${this.client['baseUrl']}/events?token=${encodeURIComponent(token)}&userId=${encodeURIComponent(userId)}`;
528
+ }
529
+ }
530
+ exports.EventsApi = EventsApi;
531
+ /**
532
+ * Widget configuration.
533
+ */
534
+ class WidgetApi {
535
+ client;
536
+ constructor(client) {
537
+ this.client = client;
538
+ }
539
+ /**
540
+ * Get the widget module and branding configuration for the tenant.
541
+ *
542
+ * Returns which widget modules are enabled (challenges, bonuses, missions,
543
+ * tournaments, loyalty, leaderboard, badges, rewards, history) and the
544
+ * branding config (colors, font, logo, currency). The hosted widget calls
545
+ * this itself on init; use it directly if you build your own UI.
546
+ *
547
+ * @example
548
+ * ```typescript
549
+ * const { modules, branding } = await fast.widget.getConfig();
550
+ * if (modules.tournaments) showTournamentsTab();
551
+ * ```
552
+ */
553
+ async getConfig() {
554
+ return this.client.request('GET', '/widget/config');
555
+ }
556
+ }
557
+ exports.WidgetApi = WidgetApi;
558
+ /**
559
+ * Sandbox operations for staging tenants.
560
+ */
561
+ class SandboxApi {
562
+ client;
563
+ constructor(client) {
564
+ this.client = client;
565
+ }
566
+ /**
567
+ * Reset all data for the staging tenant.
568
+ *
569
+ * Deletes all challenges, funded accounts, bet events, webhook deliveries,
570
+ * and reconciliation flags. Only works on staging tenants.
571
+ *
572
+ * @throws {FastApiError} 403 if tenant is not staging
573
+ */
574
+ async reset() {
575
+ return this.client.request('POST', '/sandbox/reset');
576
+ }
577
+ /**
578
+ * Reset data for a specific user on a staging tenant.
579
+ *
580
+ * @param userId - The user to reset
581
+ * @throws {FastApiError} 403 if tenant is not staging
582
+ */
583
+ async resetUser(userId) {
584
+ return this.client.request('POST', `/sandbox/reset/${userId}`);
585
+ }
586
+ }
587
+ exports.SandboxApi = SandboxApi;
588
+ //# sourceMappingURL=public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/resources/public.ts"],"names":[],"mappings":";;;AA4BA,MAAa,aAAa;IACK;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,SAAS;QACb,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsC,KAAK,EAAE,kBAAkB,CAAC,CAAC;QACtG,OAAO,GAAG,CAAC,cAAc,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAY,KAAK,EAAE,oBAAoB,MAAM,QAAQ,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAqB;QAClC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA2B,MAAM,EAAE,sBAAsB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,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