gambling-bot-shared 0.1.54 → 1.0.1

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 (166) hide show
  1. package/README.MD +4 -0
  2. package/dist/{mongoose/atmRequest.schema.d.ts → atm/atmRequest.mongoose.d.ts} +18 -28
  3. package/dist/atm/index.d.ts +3 -0
  4. package/dist/{types → atm}/index.js +5 -10
  5. package/dist/atm/schemas/atm.forms.d.ts +5 -0
  6. package/dist/atm/schemas/atm.forms.js +11 -0
  7. package/dist/blackjack/index.d.ts +3 -0
  8. package/dist/blackjack/index.js +21 -0
  9. package/dist/bonus/index.d.ts +7 -0
  10. package/dist/bonus/index.js +23 -0
  11. package/dist/bonus/schemas/bonus.forms.d.ts +16 -0
  12. package/dist/bonus/schemas/bonus.forms.js +39 -0
  13. package/dist/{types → bonus/types}/bonus.d.ts +1 -1
  14. package/dist/{utils → bonus/utils}/calculateBonusReward.d.ts +1 -1
  15. package/dist/{utils → bonus/utils}/generateBonusPreview.d.ts +1 -1
  16. package/dist/{utils → bonus/utils}/normalizeBonusSettings.d.ts +1 -1
  17. package/dist/{mongoose/blackjackGame.schema.d.ts → casino/blackjackGame.mongoose.d.ts} +19 -29
  18. package/dist/{constants → casino/constants}/index.d.ts +4 -9
  19. package/dist/{constants → casino/constants}/index.js +4 -9
  20. package/dist/{constants → casino/constants}/plinkoConfig.js +1 -1
  21. package/dist/casino/index.d.ts +12 -0
  22. package/dist/casino/index.js +30 -0
  23. package/dist/{schemas/forms.d.ts → casino/schemas/casino.forms.d.ts} +0 -103
  24. package/dist/casino/schemas/casino.forms.js +80 -0
  25. package/dist/casino/services/casinoBet.service.d.ts +41 -0
  26. package/dist/casino/services/casinoBet.service.js +146 -0
  27. package/dist/casino/types/casinoSettings.d.ts +2 -0
  28. package/dist/{utils → casino/utils}/calculateRTP.d.ts +1 -1
  29. package/dist/{utils → casino/utils}/calculateRTP.js +0 -2
  30. package/dist/{utils → casino/utils}/normalizeCasinoSettings.d.ts +1 -1
  31. package/dist/{utils → common}/formatters.d.ts +1 -1
  32. package/dist/{utils → common}/formatters.js +2 -2
  33. package/dist/common/index.d.ts +4 -0
  34. package/dist/{server.js → common/index.js} +4 -1
  35. package/dist/common/zod.d.ts +2 -0
  36. package/dist/common/zod.js +16 -0
  37. package/dist/{mongoose/guildConfiguration.schema.d.ts → guild/guildConfiguration.mongoose.d.ts} +16 -26
  38. package/dist/{mongoose/guildConfiguration.schema.js → guild/guildConfiguration.mongoose.js} +6 -5
  39. package/dist/guild/index.d.ts +8 -0
  40. package/dist/guild/index.js +26 -0
  41. package/dist/guild/schemas/guild.forms.d.ts +68 -0
  42. package/dist/guild/schemas/guild.forms.js +43 -0
  43. package/dist/{types → guild/types}/guildConfiguration.d.ts +2 -2
  44. package/dist/{utils → guild/utils}/normalizeGlobalSettings.d.ts +1 -1
  45. package/dist/guild/utils/normalizeGlobalSettings.js +46 -0
  46. package/dist/mongoose/index.d.ts +8 -8
  47. package/dist/mongoose/index.js +17 -22
  48. package/dist/predictions/index.d.ts +11 -0
  49. package/dist/predictions/index.js +29 -0
  50. package/dist/{mongoose/prediction.schema.d.ts → predictions/prediction.mongoose.d.ts} +14 -24
  51. package/dist/predictions/schemas/prediction.forms.d.ts +20 -0
  52. package/dist/predictions/schemas/prediction.forms.js +24 -0
  53. package/dist/predictions/services/normalizePredictionInput.d.ts +6 -0
  54. package/dist/predictions/services/normalizePredictionInput.js +53 -0
  55. package/dist/predictions/services/parsePredictionAutolock.d.ts +9 -0
  56. package/dist/predictions/services/parsePredictionAutolock.js +20 -0
  57. package/dist/predictions/services/parsePredictionChoices.d.ts +11 -0
  58. package/dist/predictions/services/parsePredictionChoices.js +26 -0
  59. package/dist/predictions/services/prediction.db.d.ts +55 -0
  60. package/dist/predictions/services/prediction.db.js +72 -0
  61. package/dist/predictions/services/predictionLifecycle.service.d.ts +25 -0
  62. package/dist/predictions/services/predictionLifecycle.service.js +133 -0
  63. package/dist/predictions/services/predictionSummary.d.ts +30 -0
  64. package/dist/predictions/services/predictionSummary.js +58 -0
  65. package/dist/predictions/services/types.d.ts +27 -0
  66. package/dist/raffle/index.d.ts +6 -0
  67. package/dist/raffle/index.js +24 -0
  68. package/dist/{mongoose/raffle.schema.d.ts → raffle/raffle.mongoose.d.ts} +19 -32
  69. package/dist/raffle/schemas/raffle.forms.d.ts +11 -0
  70. package/dist/raffle/schemas/raffle.forms.js +17 -0
  71. package/dist/raffle/services/raffle.db.d.ts +51 -0
  72. package/dist/raffle/services/raffle.db.js +153 -0
  73. package/dist/raffle/services/raffleLifecycle.service.d.ts +15 -0
  74. package/dist/raffle/services/raffleLifecycle.service.js +34 -0
  75. package/dist/raffle/services/types.d.ts +27 -0
  76. package/dist/{types → raffle/types}/raffle.d.ts +7 -5
  77. package/dist/transactions/constants/index.d.ts +2 -0
  78. package/dist/{schemas → transactions/constants}/index.js +2 -1
  79. package/dist/transactions/index.d.ts +4 -0
  80. package/dist/{index.js → transactions/index.js} +3 -2
  81. package/dist/{mongoose/transaction.schema.d.ts → transactions/transaction.mongoose.d.ts} +13 -23
  82. package/dist/{types → transactions/types}/transaction.d.ts +1 -1
  83. package/dist/transactions/types/transaction.js +2 -0
  84. package/dist/user/index.d.ts +2 -0
  85. package/dist/user/index.js +20 -0
  86. package/dist/user/types/user.js +2 -0
  87. package/dist/{mongoose/user.schema.d.ts → user/user.mongoose.d.ts} +12 -22
  88. package/dist/vip/index.d.ts +3 -0
  89. package/dist/vip/index.js +21 -0
  90. package/dist/vip/schemas/vip.forms.d.ts +10 -0
  91. package/dist/vip/schemas/vip.forms.js +16 -0
  92. package/dist/vip/types/vipRoom.js +2 -0
  93. package/dist/{mongoose/vipRoom.schema.d.ts → vip/vipRoom.mongoose.d.ts} +10 -20
  94. package/package.json +66 -26
  95. package/dist/index.d.ts +0 -3
  96. package/dist/schemas/forms.js +0 -173
  97. package/dist/schemas/index.d.ts +0 -1
  98. package/dist/server.d.ts +0 -1
  99. package/dist/types/index.d.ts +0 -11
  100. package/dist/utils/index.d.ts +0 -15
  101. package/dist/utils/index.js +0 -31
  102. package/dist/utils/normalizeGlobalSettings.js +0 -45
  103. /package/dist/{mongoose/atmRequest.schema.js → atm/atmRequest.mongoose.js} +0 -0
  104. /package/dist/{types → atm/types}/atmRequest.d.ts +0 -0
  105. /package/dist/{types → atm/types}/atmRequest.js +0 -0
  106. /package/dist/{constants → bonus/constants}/bonusLimits.d.ts +0 -0
  107. /package/dist/{constants → bonus/constants}/bonusLimits.js +0 -0
  108. /package/dist/{types → bonus/types}/bonus.js +0 -0
  109. /package/dist/{utils → bonus/utils}/bonusStreak.d.ts +0 -0
  110. /package/dist/{utils → bonus/utils}/bonusStreak.js +0 -0
  111. /package/dist/{utils → bonus/utils}/calculateBonusReward.js +0 -0
  112. /package/dist/{utils → bonus/utils}/generateBonusPreview.js +0 -0
  113. /package/dist/{utils → bonus/utils}/normalizeBonusSettings.js +0 -0
  114. /package/dist/{mongoose/blackjackGame.schema.js → casino/blackjackGame.mongoose.js} +0 -0
  115. /package/dist/{constants → casino/constants}/blackjack.d.ts +0 -0
  116. /package/dist/{constants → casino/constants}/blackjack.js +0 -0
  117. /package/dist/{constants → casino/constants}/casinoGames.d.ts +0 -0
  118. /package/dist/{constants → casino/constants}/casinoGames.js +0 -0
  119. /package/dist/{constants → casino/constants}/defaultConfig.d.ts +0 -0
  120. /package/dist/{constants → casino/constants}/defaultConfig.js +0 -0
  121. /package/dist/{constants → casino/constants}/lotteryConfig.d.ts +0 -0
  122. /package/dist/{constants → casino/constants}/lotteryConfig.js +0 -0
  123. /package/dist/{constants → casino/constants}/maxSimulations.d.ts +0 -0
  124. /package/dist/{constants → casino/constants}/maxSimulations.js +0 -0
  125. /package/dist/{constants → casino/constants}/plinkoConfig.d.ts +0 -0
  126. /package/dist/{constants → casino/constants}/rouletteConfig.d.ts +0 -0
  127. /package/dist/{constants → casino/constants}/rouletteConfig.js +0 -0
  128. /package/dist/{types → casino/types}/blackjackGame.d.ts +0 -0
  129. /package/dist/{types → casino/types}/blackjackGame.js +0 -0
  130. /package/dist/{types/guildConfiguration.js → casino/types/casinoSettings.js} +0 -0
  131. /package/dist/{utils → casino/utils}/normalizeCasinoSettings.js +0 -0
  132. /package/dist/{utils → casino/utils}/validateBetAmount.d.ts +0 -0
  133. /package/dist/{utils → casino/utils}/validateBetAmount.js +0 -0
  134. /package/dist/{utils → casino/utils}/winAnnouncements.d.ts +0 -0
  135. /package/dist/{utils → casino/utils}/winAnnouncements.js +0 -0
  136. /package/dist/{utils → common}/generateId.d.ts +0 -0
  137. /package/dist/{utils → common}/generateId.js +0 -0
  138. /package/dist/{utils → common}/parseTimeToSeconds.d.ts +0 -0
  139. /package/dist/{utils → common}/parseTimeToSeconds.js +0 -0
  140. /package/dist/{constants → guild/constants}/commonTimezones.d.ts +0 -0
  141. /package/dist/{constants → guild/constants}/commonTimezones.js +0 -0
  142. /package/dist/{constants → guild/constants}/defaultGlobalSettings.d.ts +0 -0
  143. /package/dist/{constants → guild/constants}/defaultGlobalSettings.js +0 -0
  144. /package/dist/{types/prediction.js → guild/types/guildConfiguration.js} +0 -0
  145. /package/dist/{utils → guild/utils}/globalSettings.d.ts +0 -0
  146. /package/dist/{utils → guild/utils}/globalSettings.js +0 -0
  147. /package/dist/{utils → guild/utils}/guildTimezone.d.ts +0 -0
  148. /package/dist/{utils → guild/utils}/guildTimezone.js +0 -0
  149. /package/dist/{mongoose/prediction.schema.js → predictions/prediction.mongoose.js} +0 -0
  150. /package/dist/{types/raffle.js → predictions/services/types.js} +0 -0
  151. /package/dist/{types → predictions/types}/prediction.d.ts +0 -0
  152. /package/dist/{types/transaction.js → predictions/types/prediction.js} +0 -0
  153. /package/dist/{utils → predictions/utils}/validatePredictionBet.d.ts +0 -0
  154. /package/dist/{utils → predictions/utils}/validatePredictionBet.js +0 -0
  155. /package/dist/{mongoose/raffle.schema.js → raffle/raffle.mongoose.js} +0 -0
  156. /package/dist/{types/user.js → raffle/services/types.js} +0 -0
  157. /package/dist/{types/vipRoom.js → raffle/types/raffle.js} +0 -0
  158. /package/dist/{constants → transactions/constants}/gameRecordFields.d.ts +0 -0
  159. /package/dist/{constants → transactions/constants}/gameRecordFields.js +0 -0
  160. /package/dist/{constants → transactions/constants}/transaction.d.ts +0 -0
  161. /package/dist/{constants → transactions/constants}/transaction.js +0 -0
  162. /package/dist/{mongoose/transaction.schema.js → transactions/transaction.mongoose.js} +0 -0
  163. /package/dist/{types → user/types}/user.d.ts +0 -0
  164. /package/dist/{mongoose/user.schema.js → user/user.mongoose.js} +0 -0
  165. /package/dist/{types → vip/types}/vipRoom.d.ts +0 -0
  166. /package/dist/{mongoose/vipRoom.schema.js → vip/vipRoom.mongoose.js} +0 -0
@@ -1,18 +1,8 @@
1
1
  import { Schema } from 'mongoose';
2
- import { TVipRoom } from '../types';
3
- export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TVipRoom, any, any, any, (import("mongoose").Document<unknown, any, TVipRoom, any, import("mongoose").DefaultSchemaOptions> & TVipRoom & {
4
- _id: import("mongoose").Types.ObjectId;
5
- } & {
6
- __v: number;
7
- } & {
8
- id: string;
9
- }) | (import("mongoose").Document<unknown, any, TVipRoom, any, import("mongoose").DefaultSchemaOptions> & TVipRoom & {
10
- _id: import("mongoose").Types.ObjectId;
11
- } & {
12
- __v: number;
13
- }), any, TVipRoom>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
2
+ import { TVipRoom } from './types/vipRoom';
3
+ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TVipRoom, any, any, any, any, any, TVipRoom>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
14
4
  id: string;
15
- }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TVipRoom & {
5
+ }, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
16
6
  _id: import("mongoose").Types.ObjectId;
17
7
  } & {
18
8
  __v: number;
@@ -21,7 +11,7 @@ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TV
21
11
  }, {
22
12
  ownerId?: import("mongoose").SchemaDefinitionProperty<string, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
23
13
  id: string;
24
- }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TVipRoom & {
14
+ }, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
25
15
  _id: import("mongoose").Types.ObjectId;
26
16
  } & {
27
17
  __v: number;
@@ -30,7 +20,7 @@ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TV
30
20
  }> | undefined;
31
21
  guildId?: import("mongoose").SchemaDefinitionProperty<string, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
32
22
  id: string;
33
- }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TVipRoom & {
23
+ }, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
34
24
  _id: import("mongoose").Types.ObjectId;
35
25
  } & {
36
26
  __v: number;
@@ -39,7 +29,7 @@ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TV
39
29
  }> | undefined;
40
30
  channelId?: import("mongoose").SchemaDefinitionProperty<string, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
41
31
  id: string;
42
- }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TVipRoom & {
32
+ }, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
43
33
  _id: import("mongoose").Types.ObjectId;
44
34
  } & {
45
35
  __v: number;
@@ -48,7 +38,7 @@ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TV
48
38
  }> | undefined;
49
39
  expiresAt?: import("mongoose").SchemaDefinitionProperty<Date, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
50
40
  id: string;
51
- }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TVipRoom & {
41
+ }, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
52
42
  _id: import("mongoose").Types.ObjectId;
53
43
  } & {
54
44
  __v: number;
@@ -57,7 +47,7 @@ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TV
57
47
  }> | undefined;
58
48
  memberIds?: import("mongoose").SchemaDefinitionProperty<string[], TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
59
49
  id: string;
60
- }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TVipRoom & {
50
+ }, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
61
51
  _id: import("mongoose").Types.ObjectId;
62
52
  } & {
63
53
  __v: number;
@@ -66,7 +56,7 @@ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TV
66
56
  }> | undefined;
67
57
  createdAt?: import("mongoose").SchemaDefinitionProperty<Date, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
68
58
  id: string;
69
- }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TVipRoom & {
59
+ }, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
70
60
  _id: import("mongoose").Types.ObjectId;
71
61
  } & {
72
62
  __v: number;
@@ -75,7 +65,7 @@ export declare const VipRoomSchema: Schema<TVipRoom, import("mongoose").Model<TV
75
65
  }> | undefined;
76
66
  updatedAt?: import("mongoose").SchemaDefinitionProperty<Date, TVipRoom, import("mongoose").Document<unknown, {}, TVipRoom, {
77
67
  id: string;
78
- }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TVipRoom & {
68
+ }, import("mongoose").DefaultSchemaOptions> & Omit<TVipRoom & {
79
69
  _id: import("mongoose").Types.ObjectId;
80
70
  } & {
81
71
  __v: number;
package/package.json CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "name": "gambling-bot-shared",
3
- "version": "0.1.54",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
3
+ "version": "1.0.1",
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
103
  "packageManager": "pnpm@11.5.0"
64
104
  }
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './constants';
2
- export * from './types';
3
- export * from './utils';
@@ -1,173 +0,0 @@
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.bonusFormSchema = exports.globalSettingsFormSchema = exports.managerRoleFormSchema = exports.vipSettingsFormSchema = exports.casinoSettingsSchema = exports.channelsFormSchema = exports.raffleChannelsFormSchema = exports.predictionChannelsFormSchema = exports.casinoChannelsFormSchema = exports.atmChannelsFormSchema = void 0;
7
- const zod_1 = __importDefault(require("zod"));
8
- const bonusLimits_1 = require("../constants/bonusLimits");
9
- const commonTimezones_1 = require("../constants/commonTimezones");
10
- const plinkoConfig_1 = require("../constants/plinkoConfig");
11
- exports.atmChannelsFormSchema = zod_1.default.object({
12
- actions: zod_1.default.string(),
13
- logs: zod_1.default.string()
14
- });
15
- exports.casinoChannelsFormSchema = zod_1.default.object({
16
- casinoChannelIds: zod_1.default.array(zod_1.default.string()),
17
- winAnnouncementsChannelId: zod_1.default.string()
18
- });
19
- exports.predictionChannelsFormSchema = zod_1.default.object({
20
- actions: zod_1.default.string(),
21
- logs: zod_1.default.string()
22
- });
23
- exports.raffleChannelsFormSchema = zod_1.default.object({
24
- actions: zod_1.default.string(),
25
- logs: zod_1.default.string()
26
- });
27
- exports.channelsFormSchema = zod_1.default.object({
28
- atm: exports.atmChannelsFormSchema,
29
- casino: exports.casinoChannelsFormSchema,
30
- prediction: exports.predictionChannelsFormSchema,
31
- raffle: exports.raffleChannelsFormSchema
32
- });
33
- const num = zod_1.default
34
- .union([zod_1.default.number(), zod_1.default.string()])
35
- .transform((val) => {
36
- if (val === '' || val === undefined || val === null)
37
- return 0;
38
- const parsed = typeof val === 'string' ? Number(val) : val;
39
- return Number.isNaN(parsed) ? 0 : parsed;
40
- })
41
- .pipe(zod_1.default.number());
42
- exports.casinoSettingsSchema = zod_1.default.object({
43
- dice: zod_1.default.object({
44
- winMultiplier: num,
45
- minBet: num,
46
- maxBet: num
47
- }),
48
- coinflip: zod_1.default.object({
49
- winMultiplier: num,
50
- minBet: num,
51
- maxBet: num
52
- }),
53
- slots: zod_1.default.object({
54
- winMultipliers: zod_1.default.record(zod_1.default.string(), num),
55
- symbolWeights: zod_1.default.record(zod_1.default.string(), num),
56
- minBet: num,
57
- maxBet: num
58
- }),
59
- lottery: zod_1.default.object({
60
- winMultipliers: zod_1.default.record(zod_1.default.string(), num),
61
- minBet: num,
62
- maxBet: num
63
- }),
64
- roulette: zod_1.default.object({
65
- winMultipliers: zod_1.default.record(zod_1.default.string(), num),
66
- minBet: num,
67
- maxBet: num
68
- }),
69
- rps: zod_1.default.object({
70
- casinoCut: num,
71
- minBet: num,
72
- maxBet: num
73
- }),
74
- goldenJackpot: zod_1.default.object({
75
- winMultiplier: num,
76
- oneInChance: num,
77
- minBet: num,
78
- maxBet: num
79
- }),
80
- blackjack: zod_1.default.object({
81
- minBet: num,
82
- maxBet: num
83
- }),
84
- prediction: zod_1.default.object({
85
- minBet: num,
86
- maxBet: num
87
- }),
88
- raffle: zod_1.default.object({
89
- casinoCut: num
90
- }),
91
- plinko: zod_1.default.object({
92
- binMultipliers: zod_1.default
93
- .record(zod_1.default.string(), num)
94
- .transform(plinkoConfig_1.normalizePlinkoBinMultipliers),
95
- minBet: num,
96
- maxBet: num
97
- }),
98
- winAnnouncements: zod_1.default.object({
99
- plinkoMinMultiplier: num,
100
- goldenJackpotMinMultiplier: num,
101
- slotsMinMultiplier: num,
102
- lotteryMinMultiplier: num,
103
- rouletteMinMultiplier: num,
104
- blackjackMinMultiplier: num,
105
- diceMinMultiplier: num,
106
- coinflipMinMultiplier: num
107
- })
108
- });
109
- exports.vipSettingsFormSchema = zod_1.default.object({
110
- roleOwnerId: zod_1.default.string(),
111
- roleMemberId: zod_1.default.string(),
112
- pricePerDay: zod_1.default.number().min(0, 'Must be ≥ 0'),
113
- pricePerCreate: zod_1.default.number().min(0, 'Must be ≥ 0'),
114
- pricePerAdditionalMember: zod_1.default.number().min(0, 'Must be ≥ 0'),
115
- maxMembers: zod_1.default.number().min(0, 'Must be ≥ 0'),
116
- categoryId: zod_1.default.string()
117
- });
118
- exports.managerRoleFormSchema = zod_1.default.object({
119
- managerRoleId: zod_1.default.string()
120
- });
121
- const bonusAmountSchema = zod_1.default
122
- .number()
123
- .min(0, 'Must be ≥ 0')
124
- .max(bonusLimits_1.BONUS_MAX_AMOUNT, `Must be ≤ ${bonusLimits_1.BONUS_MAX_AMOUNT.toLocaleString()}`);
125
- const bonusMultiplierSchema = zod_1.default
126
- .number()
127
- .min(0, 'Must be ≥ 0')
128
- .max(bonusLimits_1.BONUS_MAX_STREAK_MULTIPLIER, `Must be ≤ ${bonusLimits_1.BONUS_MAX_STREAK_MULTIPLIER}`)
129
- .optional();
130
- const bonusMultiplierInputSchema = zod_1.default
131
- .union([zod_1.default.number(), zod_1.default.string()])
132
- .optional()
133
- .transform((val) => {
134
- if (val === '' || val === undefined || val === null)
135
- return undefined;
136
- const num = typeof val === 'string' ? Number(val) : val;
137
- return Number.isNaN(num) ? undefined : num;
138
- })
139
- .pipe(bonusMultiplierSchema);
140
- exports.globalSettingsFormSchema = zod_1.default.object({
141
- disableRegistrations: zod_1.default.boolean(),
142
- disableDeposits: zod_1.default.boolean(),
143
- disableWithdrawals: zod_1.default.boolean(),
144
- disableCasinoGames: zod_1.default.boolean(),
145
- disableCasinoGamesForMods: zod_1.default.boolean(),
146
- disablePredictions: zod_1.default.boolean(),
147
- disablePredictionManagement: zod_1.default.boolean(),
148
- disableRaffles: zod_1.default.boolean(),
149
- disableRaffleManagement: zod_1.default.boolean(),
150
- disableDailyBonus: zod_1.default.boolean(),
151
- disableVip: zod_1.default.boolean(),
152
- maintenanceMode: zod_1.default.boolean(),
153
- timezone: zod_1.default.enum(commonTimezones_1.COMMON_TIMEZONES),
154
- currencySymbol: zod_1.default
155
- .string()
156
- .max(8)
157
- .refine((value) => value.trim().length > 0, {
158
- message: 'Currency symbol is required'
159
- }),
160
- currencyPlacement: zod_1.default.enum(['prefix', 'suffix'])
161
- });
162
- exports.bonusFormSchema = zod_1.default.object({
163
- rewardMode: zod_1.default.enum(['linear', 'exponential']),
164
- baseReward: bonusAmountSchema,
165
- streakIncrement: bonusAmountSchema.optional(),
166
- streakMultiplier: bonusMultiplierInputSchema,
167
- maxReward: bonusAmountSchema,
168
- resetOnMax: zod_1.default.boolean(),
169
- milestoneBonus: zod_1.default.object({
170
- weekly: bonusAmountSchema,
171
- monthly: bonusAmountSchema
172
- })
173
- });
@@ -1 +0,0 @@
1
- export * from './forms';
package/dist/server.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './mongoose';
@@ -1,11 +0,0 @@
1
- import { defaultCasinoSettings } from '../constants';
2
- export type TCasinoSettings = typeof defaultCasinoSettings;
3
- export * from './user';
4
- export * from './vipRoom';
5
- export * from './prediction';
6
- export * from './transaction';
7
- export * from './guildConfiguration';
8
- export * from './atmRequest';
9
- export * from './raffle';
10
- export * from './blackjackGame';
11
- export * from './bonus';
@@ -1,15 +0,0 @@
1
- export * from './calculateRTP';
2
- export * from './calculateBonusReward';
3
- export * from './normalizeBonusSettings';
4
- export * from './generateBonusPreview';
5
- export * from './formatters';
6
- export * from './globalSettings';
7
- export * from './normalizeGlobalSettings';
8
- export * from './normalizeCasinoSettings';
9
- export * from './guildTimezone';
10
- export * from './generateId';
11
- export * from './parseTimeToSeconds';
12
- export * from './validateBetAmount';
13
- export * from './bonusStreak';
14
- export * from './validatePredictionBet';
15
- export * from './winAnnouncements';
@@ -1,31 +0,0 @@
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
- __exportStar(require("./calculateRTP"), exports);
18
- __exportStar(require("./calculateBonusReward"), exports);
19
- __exportStar(require("./normalizeBonusSettings"), exports);
20
- __exportStar(require("./generateBonusPreview"), exports);
21
- __exportStar(require("./formatters"), exports);
22
- __exportStar(require("./globalSettings"), exports);
23
- __exportStar(require("./normalizeGlobalSettings"), exports);
24
- __exportStar(require("./normalizeCasinoSettings"), exports);
25
- __exportStar(require("./guildTimezone"), exports);
26
- __exportStar(require("./generateId"), exports);
27
- __exportStar(require("./parseTimeToSeconds"), exports);
28
- __exportStar(require("./validateBetAmount"), exports);
29
- __exportStar(require("./bonusStreak"), exports);
30
- __exportStar(require("./validatePredictionBet"), exports);
31
- __exportStar(require("./winAnnouncements"), exports);
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeGlobalSettings = void 0;
4
- const constants_1 = require("../constants");
5
- const coerceBool = (value, fallback) => {
6
- if (typeof value === 'boolean')
7
- return value;
8
- if (value === 'true')
9
- return true;
10
- if (value === 'false')
11
- return false;
12
- return fallback;
13
- };
14
- const normalizeCurrencySymbol = (value) => {
15
- if (typeof value !== 'string' || value.trim().length === 0) {
16
- return constants_1.defaultGlobalSettings.currencySymbol;
17
- }
18
- return value.slice(0, 8);
19
- };
20
- const normalizeCurrencyPlacement = (value) => value === 'suffix' ? 'suffix' : 'prefix';
21
- const normalizeTimezone = (value) => {
22
- const raw = typeof value === 'string' ? value.trim() : '';
23
- if (raw.length > 0 && constants_1.COMMON_TIMEZONES.includes(raw)) {
24
- return raw;
25
- }
26
- return constants_1.defaultGlobalSettings.timezone;
27
- };
28
- const normalizeGlobalSettings = (settings) => ({
29
- disableRegistrations: coerceBool(settings?.disableRegistrations, constants_1.defaultGlobalSettings.disableRegistrations),
30
- disableDeposits: coerceBool(settings?.disableDeposits, constants_1.defaultGlobalSettings.disableDeposits),
31
- disableWithdrawals: coerceBool(settings?.disableWithdrawals, constants_1.defaultGlobalSettings.disableWithdrawals),
32
- disableCasinoGames: coerceBool(settings?.disableCasinoGames, constants_1.defaultGlobalSettings.disableCasinoGames),
33
- disableCasinoGamesForMods: coerceBool(settings?.disableCasinoGamesForMods, constants_1.defaultGlobalSettings.disableCasinoGamesForMods),
34
- disablePredictions: coerceBool(settings?.disablePredictions, constants_1.defaultGlobalSettings.disablePredictions),
35
- disablePredictionManagement: coerceBool(settings?.disablePredictionManagement, constants_1.defaultGlobalSettings.disablePredictionManagement),
36
- disableRaffles: coerceBool(settings?.disableRaffles, constants_1.defaultGlobalSettings.disableRaffles),
37
- disableRaffleManagement: coerceBool(settings?.disableRaffleManagement, constants_1.defaultGlobalSettings.disableRaffleManagement),
38
- disableDailyBonus: coerceBool(settings?.disableDailyBonus, constants_1.defaultGlobalSettings.disableDailyBonus),
39
- disableVip: coerceBool(settings?.disableVip, constants_1.defaultGlobalSettings.disableVip),
40
- maintenanceMode: coerceBool(settings?.maintenanceMode, constants_1.defaultGlobalSettings.maintenanceMode),
41
- timezone: normalizeTimezone(settings?.timezone),
42
- currencySymbol: normalizeCurrencySymbol(settings?.currencySymbol),
43
- currencyPlacement: normalizeCurrencyPlacement(settings?.currencyPlacement)
44
- });
45
- exports.normalizeGlobalSettings = normalizeGlobalSettings;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes