gambling-bot-shared 0.1.53 → 1.0.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 (134) hide show
  1. package/README.MD +4 -0
  2. package/dist/{mongoose/atmRequest.schema.js → atm/atmRequest.mongoose.js} +4 -1
  3. package/dist/{types → atm}/index.js +5 -10
  4. package/dist/atm/schemas/atm.forms.js +11 -0
  5. package/dist/blackjack/index.js +21 -0
  6. package/dist/bonus/index.js +23 -0
  7. package/dist/bonus/schemas/bonus.forms.js +39 -0
  8. package/dist/{utils → bonus/utils}/bonusStreak.js +10 -1
  9. package/dist/{utils → bonus/utils}/calculateBonusReward.js +4 -3
  10. package/dist/casino/constants/casinoGames.js +5 -0
  11. package/dist/{constants → casino/constants}/index.js +4 -8
  12. package/dist/{constants → casino/constants}/plinkoConfig.js +1 -1
  13. package/dist/casino/index.js +30 -0
  14. package/dist/casino/schemas/casino.forms.js +80 -0
  15. package/dist/casino/services/casinoBet.service.js +146 -0
  16. package/dist/{utils → casino/utils}/calculateRTP.js +7 -4
  17. package/dist/{utils → common}/formatters.js +9 -2
  18. package/dist/{server.js → common/index.js} +4 -1
  19. package/dist/common/zod.js +16 -0
  20. package/dist/{mongoose/guildConfiguration.schema.js → guild/guildConfiguration.mongoose.js} +6 -5
  21. package/dist/guild/index.js +26 -0
  22. package/dist/guild/schemas/guild.forms.js +43 -0
  23. package/dist/guild/utils/normalizeGlobalSettings.js +46 -0
  24. package/dist/mongoose/index.js +17 -22
  25. package/dist/predictions/index.js +29 -0
  26. package/dist/{mongoose/prediction.schema.js → predictions/prediction.mongoose.js} +3 -2
  27. package/dist/predictions/schemas/prediction.forms.js +24 -0
  28. package/dist/predictions/services/normalizePredictionInput.js +53 -0
  29. package/dist/predictions/services/parsePredictionAutolock.js +20 -0
  30. package/dist/predictions/services/parsePredictionChoices.js +26 -0
  31. package/dist/predictions/services/prediction.db.js +72 -0
  32. package/dist/predictions/services/predictionLifecycle.service.js +133 -0
  33. package/dist/predictions/services/predictionSummary.js +58 -0
  34. package/dist/raffle/index.js +24 -0
  35. package/dist/raffle/schemas/raffle.forms.js +17 -0
  36. package/dist/raffle/services/raffle.db.js +153 -0
  37. package/dist/raffle/services/raffleLifecycle.service.js +34 -0
  38. package/dist/{schemas → transactions/constants}/index.js +2 -1
  39. package/dist/{index.js → transactions/index.js} +3 -2
  40. package/dist/transactions/types/transaction.js +2 -0
  41. package/dist/user/index.js +20 -0
  42. package/dist/user/types/user.js +2 -0
  43. package/dist/vip/index.js +21 -0
  44. package/dist/vip/schemas/vip.forms.js +16 -0
  45. package/dist/vip/types/vipRoom.js +2 -0
  46. package/package.json +67 -27
  47. package/dist/constants/blackjack.d.ts +0 -41
  48. package/dist/constants/bonusLimits.d.ts +0 -4
  49. package/dist/constants/commonTimezones.d.ts +0 -4
  50. package/dist/constants/defaultConfig.d.ts +0 -108
  51. package/dist/constants/defaultGlobalSettings.d.ts +0 -20
  52. package/dist/constants/gameRecordFields.d.ts +0 -8
  53. package/dist/constants/index.d.ts +0 -11
  54. package/dist/constants/lotteryConfig.d.ts +0 -2
  55. package/dist/constants/maxSimulations.d.ts +0 -5
  56. package/dist/constants/plinkoConfig.d.ts +0 -15
  57. package/dist/constants/rouletteConfig.d.ts +0 -1
  58. package/dist/constants/transaction.d.ts +0 -2
  59. package/dist/index.d.ts +0 -3
  60. package/dist/mongoose/atmRequest.schema.d.ts +0 -139
  61. package/dist/mongoose/blackjackGame.schema.d.ts +0 -139
  62. package/dist/mongoose/guildConfiguration.schema.d.ts +0 -237
  63. package/dist/mongoose/index.d.ts +0 -8
  64. package/dist/mongoose/prediction.schema.d.ts +0 -112
  65. package/dist/mongoose/raffle.schema.d.ts +0 -151
  66. package/dist/mongoose/transaction.schema.d.ts +0 -103
  67. package/dist/mongoose/user.schema.d.ts +0 -103
  68. package/dist/mongoose/vipRoom.schema.d.ts +0 -85
  69. package/dist/schemas/forms.d.ts +0 -183
  70. package/dist/schemas/forms.js +0 -173
  71. package/dist/schemas/index.d.ts +0 -1
  72. package/dist/server.d.ts +0 -1
  73. package/dist/types/atmRequest.d.ts +0 -15
  74. package/dist/types/blackjackGame.d.ts +0 -30
  75. package/dist/types/bonus.d.ts +0 -13
  76. package/dist/types/guildConfiguration.d.ts +0 -35
  77. package/dist/types/index.d.ts +0 -11
  78. package/dist/types/prediction.d.ts +0 -20
  79. package/dist/types/raffle.d.ts +0 -19
  80. package/dist/types/transaction.d.ts +0 -11
  81. package/dist/types/user.d.ts +0 -11
  82. package/dist/types/vipRoom.d.ts +0 -9
  83. package/dist/utils/bonusStreak.d.ts +0 -6
  84. package/dist/utils/calculateBonusReward.d.ts +0 -13
  85. package/dist/utils/calculateRTP.d.ts +0 -2
  86. package/dist/utils/formatters.d.ts +0 -13
  87. package/dist/utils/generateBonusPreview.d.ts +0 -11
  88. package/dist/utils/generateId.d.ts +0 -1
  89. package/dist/utils/globalSettings.d.ts +0 -6
  90. package/dist/utils/guildTimezone.d.ts +0 -6
  91. package/dist/utils/index.d.ts +0 -15
  92. package/dist/utils/index.js +0 -31
  93. package/dist/utils/normalizeBonusSettings.d.ts +0 -6
  94. package/dist/utils/normalizeCasinoSettings.d.ts +0 -2
  95. package/dist/utils/normalizeGlobalSettings.d.ts +0 -2
  96. package/dist/utils/normalizeGlobalSettings.js +0 -45
  97. package/dist/utils/parseTimeToSeconds.d.ts +0 -1
  98. package/dist/utils/validateBetAmount.d.ts +0 -8
  99. package/dist/utils/validatePredictionBet.d.ts +0 -13
  100. package/dist/utils/winAnnouncements.d.ts +0 -4
  101. /package/dist/{types → atm/types}/atmRequest.js +0 -0
  102. /package/dist/{constants → bonus/constants}/bonusLimits.js +0 -0
  103. /package/dist/{types → bonus/types}/bonus.js +0 -0
  104. /package/dist/{utils → bonus/utils}/generateBonusPreview.js +0 -0
  105. /package/dist/{utils → bonus/utils}/normalizeBonusSettings.js +0 -0
  106. /package/dist/{mongoose/blackjackGame.schema.js → casino/blackjackGame.mongoose.js} +0 -0
  107. /package/dist/{constants → casino/constants}/blackjack.js +0 -0
  108. /package/dist/{constants → casino/constants}/defaultConfig.js +0 -0
  109. /package/dist/{constants → casino/constants}/lotteryConfig.js +0 -0
  110. /package/dist/{constants → casino/constants}/maxSimulations.js +0 -0
  111. /package/dist/{constants → casino/constants}/rouletteConfig.js +0 -0
  112. /package/dist/{types → casino/types}/blackjackGame.js +0 -0
  113. /package/dist/{types/guildConfiguration.js → casino/types/casinoSettings.js} +0 -0
  114. /package/dist/{utils → casino/utils}/normalizeCasinoSettings.js +0 -0
  115. /package/dist/{utils → casino/utils}/validateBetAmount.js +0 -0
  116. /package/dist/{utils → casino/utils}/winAnnouncements.js +0 -0
  117. /package/dist/{utils → common}/generateId.js +0 -0
  118. /package/dist/{utils → common}/parseTimeToSeconds.js +0 -0
  119. /package/dist/{constants → guild/constants}/commonTimezones.js +0 -0
  120. /package/dist/{constants → guild/constants}/defaultGlobalSettings.js +0 -0
  121. /package/dist/{types/prediction.js → guild/types/guildConfiguration.js} +0 -0
  122. /package/dist/{utils → guild/utils}/globalSettings.js +0 -0
  123. /package/dist/{utils → guild/utils}/guildTimezone.js +0 -0
  124. /package/dist/{types/raffle.js → predictions/services/types.js} +0 -0
  125. /package/dist/{types/transaction.js → predictions/types/prediction.js} +0 -0
  126. /package/dist/{utils → predictions/utils}/validatePredictionBet.js +0 -0
  127. /package/dist/{mongoose/raffle.schema.js → raffle/raffle.mongoose.js} +0 -0
  128. /package/dist/{types/user.js → raffle/services/types.js} +0 -0
  129. /package/dist/{types/vipRoom.js → raffle/types/raffle.js} +0 -0
  130. /package/dist/{constants → transactions/constants}/gameRecordFields.js +0 -0
  131. /package/dist/{constants → transactions/constants}/transaction.js +0 -0
  132. /package/dist/{mongoose/transaction.schema.js → transactions/transaction.mongoose.js} +0 -0
  133. /package/dist/{mongoose/user.schema.js → user/user.mongoose.js} +0 -0
  134. /package/dist/{mongoose/vipRoom.schema.js → vip/vipRoom.mongoose.js} +0 -0
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRaffleDb = createRaffleDb;
4
+ function createRaffleDb(raffleModel) {
5
+ const getRaffleById = async ({ raffleId, guildId }) => {
6
+ return raffleModel.findOne({ raffleId, guildId });
7
+ };
8
+ const upsertRaffle = async ({ guildId, drawId, raffleId, creatorId, channelId, ticketPrice, maxTicketsPerUser, nextDrawAt, drawIntervalMs }) => {
9
+ return raffleModel.findOneAndUpdate({ raffleId, guildId }, {
10
+ $set: {
11
+ drawId,
12
+ creatorId,
13
+ channelId,
14
+ ticketPrice,
15
+ maxTicketsPerUser,
16
+ nextDrawAt,
17
+ drawIntervalMs
18
+ }
19
+ }, {
20
+ upsert: true,
21
+ returnDocument: 'after'
22
+ });
23
+ };
24
+ const addRaffleTickets = async ({ raffleId, guildId, userId, tickets, maxTicketsPerUser }) => {
25
+ const now = new Date();
26
+ const updateExisting = await raffleModel.updateOne({
27
+ raffleId,
28
+ guildId,
29
+ status: 'active',
30
+ nextDrawAt: { $gt: now },
31
+ 'participants.userId': userId,
32
+ $expr: {
33
+ $lte: [
34
+ {
35
+ $add: [
36
+ {
37
+ $ifNull: [
38
+ {
39
+ $first: {
40
+ $map: {
41
+ input: {
42
+ $filter: {
43
+ input: '$participants',
44
+ as: 'p',
45
+ cond: { $eq: ['$$p.userId', userId] }
46
+ }
47
+ },
48
+ as: 'p',
49
+ in: '$$p.tickets'
50
+ }
51
+ }
52
+ },
53
+ 0
54
+ ]
55
+ },
56
+ tickets
57
+ ]
58
+ },
59
+ maxTicketsPerUser
60
+ ]
61
+ }
62
+ }, { $inc: { 'participants.$.tickets': tickets } });
63
+ if (updateExisting.modifiedCount > 0)
64
+ return true;
65
+ const addNew = await raffleModel.updateOne({
66
+ raffleId,
67
+ guildId,
68
+ status: 'active',
69
+ nextDrawAt: { $gt: now },
70
+ participants: { $not: { $elemMatch: { userId } } },
71
+ $expr: {
72
+ $lte: [
73
+ {
74
+ $cond: [{ $gte: [tickets, 0] }, tickets, maxTicketsPerUser]
75
+ },
76
+ maxTicketsPerUser
77
+ ]
78
+ }
79
+ }, { $push: { participants: { userId, tickets } } });
80
+ return addNew.modifiedCount > 0;
81
+ };
82
+ const cancelRaffleAtomic = async ({ raffleId, guildId }) => {
83
+ return raffleModel.findOneAndUpdate({ raffleId, guildId, status: { $ne: 'canceled' } }, { $set: { status: 'canceled' } }, { returnDocument: 'after' });
84
+ };
85
+ const searchRafflesForAutocomplete = async ({ guildId, query }) => {
86
+ return raffleModel.aggregate([
87
+ {
88
+ $match: {
89
+ guildId,
90
+ raffleId: { $regex: query, $options: 'i' },
91
+ status: 'active'
92
+ }
93
+ },
94
+ { $sort: { createdAt: -1 } },
95
+ { $limit: 25 },
96
+ {
97
+ $addFields: {
98
+ totalTickets: {
99
+ $sum: {
100
+ $map: {
101
+ input: '$participants',
102
+ as: 'p',
103
+ in: '$$p.tickets'
104
+ }
105
+ }
106
+ }
107
+ }
108
+ },
109
+ {
110
+ $addFields: {
111
+ totalPot: { $multiply: ['$totalTickets', '$ticketPrice'] }
112
+ }
113
+ },
114
+ {
115
+ $project: {
116
+ raffleId: 1,
117
+ nextDrawAt: 1,
118
+ ticketPrice: 1,
119
+ maxTicketsPerUser: 1,
120
+ totalPot: 1
121
+ }
122
+ }
123
+ ]);
124
+ };
125
+ const getRafflesReadyToDraw = async () => {
126
+ return raffleModel.find({
127
+ status: 'active',
128
+ nextDrawAt: { $lte: new Date() }
129
+ });
130
+ };
131
+ const completeRaffleDraw = async ({ raffleId, nextDrawAt, lastDrawAt, drawId }) => {
132
+ await raffleModel.updateOne({
133
+ raffleId,
134
+ status: 'active'
135
+ }, {
136
+ $set: {
137
+ nextDrawAt,
138
+ lastDrawAt,
139
+ participants: [],
140
+ drawId
141
+ }
142
+ });
143
+ };
144
+ return {
145
+ getRaffleById,
146
+ upsertRaffle,
147
+ addRaffleTickets,
148
+ cancelRaffleAtomic,
149
+ searchRafflesForAutocomplete,
150
+ getRafflesReadyToDraw,
151
+ completeRaffleDraw
152
+ };
153
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRaffleLifecycleService = createRaffleLifecycleService;
4
+ function createRaffleLifecycleService({ raffleDb, casinoBet }) {
5
+ const { cancelRaffleAtomic } = raffleDb;
6
+ const { refundRafflePurchase } = casinoBet;
7
+ const cancelRaffle = async ({ raffleId, guildId }) => {
8
+ const raffle = await cancelRaffleAtomic({ raffleId, guildId });
9
+ if (!raffle)
10
+ return { ok: false, code: 'NOT_FOUND' };
11
+ const refundErrors = [];
12
+ for (const entry of raffle.participants) {
13
+ const refundAmount = entry.tickets * raffle.ticketPrice;
14
+ if (refundAmount <= 0)
15
+ continue;
16
+ try {
17
+ await refundRafflePurchase({
18
+ userId: entry.userId,
19
+ guildId,
20
+ amount: refundAmount,
21
+ raffleId: raffle.drawId,
22
+ game: 'raffle'
23
+ });
24
+ }
25
+ catch {
26
+ refundErrors.push(entry.userId);
27
+ }
28
+ }
29
+ return { ok: true, raffle, refundErrors };
30
+ };
31
+ return {
32
+ cancelRaffle
33
+ };
34
+ }
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./forms"), exports);
17
+ __exportStar(require("./transaction"), exports);
18
+ __exportStar(require("./gameRecordFields"), exports);
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./constants"), exports);
18
- __exportStar(require("./types"), exports);
19
- __exportStar(require("./utils"), exports);
18
+ __exportStar(require("./constants/gameRecordFields"), exports);
19
+ __exportStar(require("./types/transaction"), exports);
20
+ __exportStar(require("./constants/transaction"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.UserSchema = void 0;
18
+ __exportStar(require("./types/user"), exports);
19
+ var user_mongoose_1 = require("./user.mongoose");
20
+ Object.defineProperty(exports, "UserSchema", { enumerable: true, get: function () { return user_mongoose_1.UserSchema; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.VipRoomSchema = void 0;
18
+ __exportStar(require("./types/vipRoom"), exports);
19
+ var vipRoom_mongoose_1 = require("./vipRoom.mongoose");
20
+ Object.defineProperty(exports, "VipRoomSchema", { enumerable: true, get: function () { return vipRoom_mongoose_1.VipRoomSchema; } });
21
+ __exportStar(require("./schemas/vip.forms"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.vipSettingsFormSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ exports.vipSettingsFormSchema = zod_1.default.object({
9
+ roleOwnerId: zod_1.default.string(),
10
+ roleMemberId: zod_1.default.string(),
11
+ pricePerDay: zod_1.default.number().min(0, 'Must be ≥ 0'),
12
+ pricePerCreate: zod_1.default.number().min(0, 'Must be ≥ 0'),
13
+ pricePerAdditionalMember: zod_1.default.number().min(0, 'Must be ≥ 0'),
14
+ maxMembers: zod_1.default.number().min(0, 'Must be ≥ 0'),
15
+ categoryId: zod_1.default.string()
16
+ });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "name": "gambling-bot-shared",
3
- "version": "0.1.53",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
3
+ "version": "1.0.0",
6
4
  "license": "MIT",
7
5
  "type": "commonjs",
8
6
  "repository": {
@@ -13,28 +11,67 @@
13
11
  "dist"
14
12
  ],
15
13
  "exports": {
16
- ".": {
17
- "types": "./dist/index.d.ts",
18
- "default": "./dist/index.js"
14
+ "./common": {
15
+ "types": "./dist/common/index.d.ts",
16
+ "default": "./dist/common/index.js"
19
17
  },
20
- "./server": {
21
- "types": "./dist/server.d.ts",
22
- "default": "./dist/server.js"
18
+ "./casino": {
19
+ "types": "./dist/casino/index.d.ts",
20
+ "default": "./dist/casino/index.js"
23
21
  },
24
- "./schemas": {
25
- "types": "./dist/schemas/index.d.ts",
26
- "default": "./dist/schemas/index.js"
22
+ "./predictions": {
23
+ "types": "./dist/predictions/index.d.ts",
24
+ "default": "./dist/predictions/index.js"
25
+ },
26
+ "./bonus": {
27
+ "types": "./dist/bonus/index.d.ts",
28
+ "default": "./dist/bonus/index.js"
29
+ },
30
+ "./guild": {
31
+ "types": "./dist/guild/index.d.ts",
32
+ "default": "./dist/guild/index.js"
33
+ },
34
+ "./transactions": {
35
+ "types": "./dist/transactions/index.d.ts",
36
+ "default": "./dist/transactions/index.js"
37
+ },
38
+ "./raffle": {
39
+ "types": "./dist/raffle/index.d.ts",
40
+ "default": "./dist/raffle/index.js"
41
+ },
42
+ "./blackjack": {
43
+ "types": "./dist/blackjack/index.d.ts",
44
+ "default": "./dist/blackjack/index.js"
45
+ },
46
+ "./user": {
47
+ "types": "./dist/user/index.d.ts",
48
+ "default": "./dist/user/index.js"
49
+ },
50
+ "./atm": {
51
+ "types": "./dist/atm/index.d.ts",
52
+ "default": "./dist/atm/index.js"
53
+ },
54
+ "./vip": {
55
+ "types": "./dist/vip/index.d.ts",
56
+ "default": "./dist/vip/index.js"
57
+ },
58
+ "./mongoose": {
59
+ "types": "./dist/mongoose/index.d.ts",
60
+ "default": "./dist/mongoose/index.js"
27
61
  }
28
62
  },
29
63
  "scripts": {
30
- "build": "tsc -p tsconfig.json",
31
- "dev": "tsc -p tsconfig.json --watch",
32
- "format:check": "prettier --check \"src/**/*.ts\"",
33
- "format:fix": "prettier --write \"src/**/*.ts\"",
34
- "lint:check": "eslint src --max-warnings 0",
35
- "lint:fix": "eslint src --fix --max-warnings 0",
64
+ "build": "tsc -p tsconfig.build.json",
65
+ "dev": "tsc -p tsconfig.build.json --watch",
66
+ "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
67
+ "format:fix": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
68
+ "lint:check": "eslint src test --max-warnings 0",
69
+ "lint:fix": "eslint src test --fix --max-warnings 0",
36
70
  "type:check": "tsc --noEmit",
37
- "check": "pnpm format:check && pnpm lint:check && pnpm type:check",
71
+ "test:check": "vitest run",
72
+ "test:coverage:check": "vitest run --coverage",
73
+ "test:watch": "vitest",
74
+ "check": "pnpm format:check && pnpm lint:check && pnpm type:check && pnpm test:check && pnpm test:coverage:check",
38
75
  "prepublishOnly": "pnpm build",
39
76
  "prepare": "bash scripts/setup-git-hooks.sh",
40
77
  "link-local": "bash scripts/link-local.sh",
@@ -49,16 +86,19 @@
49
86
  "devDependencies": {
50
87
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
51
88
  "@types/luxon": "^3.7.1",
52
- "@typescript-eslint/eslint-plugin": "^8.59.4",
53
- "@typescript-eslint/parser": "^8.59.4",
54
- "eslint": "^10.4.0",
55
- "mongoose": "^9.1.4",
56
- "prettier": "^3.8.3",
57
- "typescript": "^5.9.3"
89
+ "@typescript-eslint/eslint-plugin": "^8.61.0",
90
+ "@typescript-eslint/parser": "^8.61.0",
91
+ "eslint": "^10.4.1",
92
+ "eslint-plugin-import": "^2.32.0",
93
+ "mongoose": "^9.7.0",
94
+ "prettier": "^3.8.4",
95
+ "typescript": "^5.9.3",
96
+ "@vitest/coverage-v8": "^3.2.4",
97
+ "vitest": "^3.2.4"
58
98
  },
59
99
  "dependencies": {
60
100
  "luxon": "^3.7.2",
61
- "zod": "^4.3.6"
101
+ "zod": "^4.4.3"
62
102
  },
63
- "packageManager": "pnpm@10.28.0"
103
+ "packageManager": "pnpm@11.5.0"
64
104
  }
@@ -1,41 +0,0 @@
1
- export declare const SUITES: readonly ["♠️", "♣️", "♥️", "♦️"];
2
- export declare const VALUES: readonly [{
3
- readonly label: "A";
4
- readonly value: 11;
5
- }, {
6
- readonly label: "2";
7
- readonly value: 2;
8
- }, {
9
- readonly label: "3";
10
- readonly value: 3;
11
- }, {
12
- readonly label: "4";
13
- readonly value: 4;
14
- }, {
15
- readonly label: "5";
16
- readonly value: 5;
17
- }, {
18
- readonly label: "6";
19
- readonly value: 6;
20
- }, {
21
- readonly label: "7";
22
- readonly value: 7;
23
- }, {
24
- readonly label: "8";
25
- readonly value: 8;
26
- }, {
27
- readonly label: "9";
28
- readonly value: 9;
29
- }, {
30
- readonly label: "10";
31
- readonly value: 10;
32
- }, {
33
- readonly label: "J";
34
- readonly value: 10;
35
- }, {
36
- readonly label: "Q";
37
- readonly value: 10;
38
- }, {
39
- readonly label: "K";
40
- readonly value: 10;
41
- }];
@@ -1,4 +0,0 @@
1
- /** Max currency amount for any single bonus field (base, cap, milestones, increment). */
2
- export declare const BONUS_MAX_AMOUNT = 10000000;
3
- /** Max daily streak multiplier in exponential mode (prevents Math.pow overflow). */
4
- export declare const BONUS_MAX_STREAK_MULTIPLIER = 10;
@@ -1,4 +0,0 @@
1
- /** Curated IANA zones for admin selects (v1). */
2
- export declare const COMMON_TIMEZONES: readonly ["UTC", "Europe/London", "Europe/Paris", "Europe/Berlin", "Europe/Prague", "Europe/Warsaw", "Europe/Athens", "Europe/Moscow", "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles", "America/Toronto", "America/Sao_Paulo", "America/Mexico_City", "Asia/Dubai", "Asia/Kolkata", "Asia/Bangkok", "Asia/Singapore", "Asia/Hong_Kong", "Asia/Tokyo", "Asia/Seoul", "Australia/Sydney", "Australia/Melbourne", "Pacific/Auckland"];
3
- export type CommonTimezone = (typeof COMMON_TIMEZONES)[number];
4
- export declare const isCommonTimezone: (value: string) => value is CommonTimezone;
@@ -1,108 +0,0 @@
1
- export declare const readableGameValueNames: {
2
- name: string;
3
- value: string;
4
- }[];
5
- export declare const readableGameNames: {
6
- name: string;
7
- value: string;
8
- }[];
9
- export declare const defaultCasinoSettings: {
10
- dice: {
11
- winMultiplier: number;
12
- maxBet: number;
13
- minBet: number;
14
- };
15
- coinflip: {
16
- winMultiplier: number;
17
- maxBet: number;
18
- minBet: number;
19
- };
20
- slots: {
21
- winMultipliers: {
22
- '\uD83C\uDF52\uD83C\uDF52\uD83C\uDF52': number;
23
- '\uD83E\uDED0\uD83E\uDED0\uD83E\uDED0': number;
24
- '\uD83C\uDF49\uD83C\uDF49\uD83C\uDF49': number;
25
- '\uD83D\uDD14\uD83D\uDD14\uD83D\uDD14': number;
26
- '7\uFE0F\u20E37\uFE0F\u20E37\uFE0F\u20E3': number;
27
- };
28
- symbolWeights: {
29
- '\uD83C\uDF52': number;
30
- '\uD83E\uDED0': number;
31
- '\uD83C\uDF49': number;
32
- '\uD83D\uDD14': number;
33
- '7\uFE0F\u20E3': number;
34
- };
35
- maxBet: number;
36
- minBet: number;
37
- };
38
- lottery: {
39
- winMultipliers: {
40
- 4: number;
41
- 3: number;
42
- 2: number;
43
- 1: number;
44
- 0: number;
45
- };
46
- maxBet: number;
47
- minBet: number;
48
- };
49
- roulette: {
50
- winMultipliers: {
51
- number: number;
52
- color: number;
53
- parity: number;
54
- range: number;
55
- dozen: number;
56
- column: number;
57
- };
58
- maxBet: number;
59
- minBet: number;
60
- };
61
- rps: {
62
- casinoCut: number;
63
- maxBet: number;
64
- minBet: number;
65
- };
66
- goldenJackpot: {
67
- winMultiplier: number;
68
- oneInChance: number;
69
- maxBet: number;
70
- minBet: number;
71
- };
72
- blackjack: {
73
- maxBet: number;
74
- minBet: number;
75
- };
76
- prediction: {
77
- maxBet: number;
78
- minBet: number;
79
- };
80
- raffle: {
81
- casinoCut: number;
82
- };
83
- plinko: {
84
- binMultipliers: {
85
- 1: number;
86
- 2: number;
87
- 3: number;
88
- 4: number;
89
- 5: number;
90
- 6: number;
91
- 7: number;
92
- 8: number;
93
- 9: number;
94
- };
95
- maxBet: number;
96
- minBet: number;
97
- };
98
- winAnnouncements: {
99
- plinkoMinMultiplier: number;
100
- goldenJackpotMinMultiplier: number;
101
- slotsMinMultiplier: number;
102
- lotteryMinMultiplier: number;
103
- rouletteMinMultiplier: number;
104
- blackjackMinMultiplier: number;
105
- diceMinMultiplier: number;
106
- coinflipMinMultiplier: number;
107
- };
108
- };
@@ -1,20 +0,0 @@
1
- export type CurrencyPlacement = 'prefix' | 'suffix';
2
- export type GlobalSettings = {
3
- disableRegistrations: boolean;
4
- disableDeposits: boolean;
5
- disableWithdrawals: boolean;
6
- disableCasinoGames: boolean;
7
- disableCasinoGamesForMods: boolean;
8
- disablePredictions: boolean;
9
- disablePredictionManagement: boolean;
10
- disableRaffles: boolean;
11
- disableRaffleManagement: boolean;
12
- disableDailyBonus: boolean;
13
- disableVip: boolean;
14
- maintenanceMode: boolean;
15
- timezone: string;
16
- currencySymbol: string;
17
- /** prefix: symbol before amount ($1.5k). suffix: symbol after amount (1.5kCZK). Spacing is part of currencySymbol. */
18
- currencyPlacement: CurrencyPlacement;
19
- };
20
- export declare const defaultGlobalSettings: GlobalSettings;
@@ -1,8 +0,0 @@
1
- export declare const GAME_RECORD_FIELDS: {
2
- readonly slots: readonly ["winMultipliers", "symbolWeights"];
3
- readonly lottery: readonly ["winMultipliers"];
4
- readonly roulette: readonly ["winMultipliers"];
5
- readonly plinko: readonly ["binMultipliers"];
6
- };
7
- export type GameWithRecords = keyof typeof GAME_RECORD_FIELDS;
8
- export type RecordKey = (typeof GAME_RECORD_FIELDS)[GameWithRecords][number];
@@ -1,11 +0,0 @@
1
- export * from './bonusLimits';
2
- export * from './commonTimezones';
3
- export * from './defaultGlobalSettings';
4
- export * from './defaultConfig';
5
- export * from './maxSimulations';
6
- export * from './lotteryConfig';
7
- export * from './rouletteConfig';
8
- export * from './gameRecordFields';
9
- export * from './plinkoConfig';
10
- export * from './transaction';
11
- export * from './blackjack';
@@ -1,2 +0,0 @@
1
- export declare const LOTTERY_TOTAL_NUMBERS = 40;
2
- export declare const LOTTERY_NUM_TO_DRAW = 4;
@@ -1,5 +0,0 @@
1
- export declare const DICE_MAX_SIMULATE_ROLLS = 100000000;
2
- export declare const COINFLIP_MAX_SIMULATE_FLIPS = 200000000;
3
- export declare const SLOT_MAX_SIMULATE_SPINS = 50000000;
4
- export declare const LOTTERY_MAX_SIMULATE_ENTRIES = 999999500000;
5
- export declare const GOLDEN_JACKPOT_MAX_SIMULATE_ENTRIES = 100000000;
@@ -1,15 +0,0 @@
1
- import { defaultCasinoSettings } from './defaultConfig';
2
- export declare const PLINKO_BIN_COUNT = 9;
3
- export declare const PLINKO_ROW_COUNT: number;
4
- export declare const PLINKO_CENTER_BIN = 5;
5
- export declare const PLINKO_EDITABLE_BINS: readonly [1, 2, 3, 4, 5];
6
- export type PlinkoEditableBin = (typeof PLINKO_EDITABLE_BINS)[number];
7
- export type PlinkoBinMultipliers = (typeof defaultCasinoSettings)['plinko']['binMultipliers'];
8
- export declare const getPlinkoMirrorBin: (bin: number) => number;
9
- export declare const pathIndexToPlinkoBin: (pathIndex: number) => number;
10
- export declare const plinkoBinToPathIndex: (bin: number) => number;
11
- export declare const expandPlinkoBinMultipliers: (editable: Record<string | number, number | string>) => PlinkoBinMultipliers;
12
- /** Migrate legacy 0-indexed bins and enforce symmetric 1–9 layout. */
13
- export declare const normalizePlinkoBinMultipliers: (input: Record<string | number, number | string> | null | undefined) => PlinkoBinMultipliers;
14
- export declare const getPlinkoMultiplierAtPathIndex: (binMultipliers: Record<string | number, number | string>, pathIndex: number) => number;
15
- export declare const formatPlinkoBinMultipliersForDisplay: (binMultipliers: Record<string | number, number | string>) => Record<string, number>;
@@ -1 +0,0 @@
1
- export declare const MINI_NUMBERS: Record<string, 'red' | 'black' | 'green'>;
@@ -1,2 +0,0 @@
1
- export declare const TRANSACTION_TYPES: readonly ["deposit", "withdraw", "bet", "win", "refund", "bonus", "vip"];
2
- export declare const TRANSACTION_SOURCES: readonly ["command", "manual", "web", "system", "casino"];
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './constants';
2
- export * from './types';
3
- export * from './utils';