@openora/core 0.4.1-canary.39 → 0.4.1-canary.40

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 (142) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/audit/plugin.d.ts.map +1 -1
  3. package/dist/audit/plugin.js +27 -0
  4. package/dist/audit/plugin.js.map +1 -1
  5. package/dist/common/errors/errors.classes.js +3 -3
  6. package/dist/common/errors/errors.classes.js.map +1 -1
  7. package/dist/common/errors/errors.mapper.js +1 -1
  8. package/dist/common/errors/errors.mapper.js.map +1 -1
  9. package/dist/compliance/__tests__/kyc.service.test.js +5 -0
  10. package/dist/compliance/__tests__/kyc.service.test.js.map +1 -1
  11. package/dist/compliance/service/kyc.service.js +1 -1
  12. package/dist/compliance/service/kyc.service.js.map +1 -1
  13. package/dist/contracts/adapters/identity-reader.d.ts +9 -3
  14. package/dist/contracts/adapters/identity-reader.d.ts.map +1 -1
  15. package/dist/contracts/adapters/identity-reader.js.map +1 -1
  16. package/dist/contracts/adapters/index.d.ts +2 -0
  17. package/dist/contracts/adapters/index.d.ts.map +1 -1
  18. package/dist/contracts/adapters/index.js +1 -0
  19. package/dist/contracts/adapters/index.js.map +1 -1
  20. package/dist/contracts/adapters/tag-evaluation-commands.d.ts +10 -0
  21. package/dist/contracts/adapters/tag-evaluation-commands.d.ts.map +1 -0
  22. package/dist/contracts/adapters/tag-evaluation-commands.js +11 -0
  23. package/dist/contracts/adapters/tag-evaluation-commands.js.map +1 -0
  24. package/dist/contracts/adapters/wallet-reader.d.ts +8 -0
  25. package/dist/contracts/adapters/wallet-reader.d.ts.map +1 -1
  26. package/dist/contracts/adapters/wallet-reader.js.map +1 -1
  27. package/dist/contracts/schemas/events.d.ts +57 -0
  28. package/dist/contracts/schemas/events.d.ts.map +1 -1
  29. package/dist/contracts/schemas/events.js +12 -0
  30. package/dist/contracts/schemas/events.js.map +1 -1
  31. package/dist/contracts/schemas/platform-config.d.ts +9 -1
  32. package/dist/contracts/schemas/platform-config.d.ts.map +1 -1
  33. package/dist/contracts/schemas/player.d.ts +10 -2
  34. package/dist/contracts/schemas/player.d.ts.map +1 -1
  35. package/dist/contracts/schemas/tag.d.ts +65 -1
  36. package/dist/contracts/schemas/tag.d.ts.map +1 -1
  37. package/dist/contracts/schemas/tag.js +10 -0
  38. package/dist/contracts/schemas/tag.js.map +1 -1
  39. package/dist/iam/service/iam.service.d.ts +1 -1
  40. package/dist/pam/identity/adapters/identity-reader.service.d.ts +6 -4
  41. package/dist/pam/identity/adapters/identity-reader.service.d.ts.map +1 -1
  42. package/dist/pam/identity/adapters/identity-reader.service.js +19 -1
  43. package/dist/pam/identity/adapters/identity-reader.service.js.map +1 -1
  44. package/dist/pam/identity/service/identity.service.d.ts.map +1 -1
  45. package/dist/pam/identity/service/identity.service.js +4 -0
  46. package/dist/pam/identity/service/identity.service.js.map +1 -1
  47. package/dist/pam/player-management/__tests__/player.router.test.js +2 -2
  48. package/dist/pam/player-management/__tests__/player.router.test.js.map +1 -1
  49. package/dist/pam/player-management/__tests__/player.service.test.js +28 -2
  50. package/dist/pam/player-management/__tests__/player.service.test.js.map +1 -1
  51. package/dist/pam/player-management/contract/index.d.ts +21 -1
  52. package/dist/pam/player-management/contract/index.d.ts.map +1 -1
  53. package/dist/pam/player-management/plugin.js +1 -1
  54. package/dist/pam/player-management/plugin.js.map +1 -1
  55. package/dist/pam/player-management/router/index.d.ts +17 -1
  56. package/dist/pam/player-management/router/index.d.ts.map +1 -1
  57. package/dist/pam/player-management/service/player.service.d.ts +3 -1
  58. package/dist/pam/player-management/service/player.service.d.ts.map +1 -1
  59. package/dist/pam/player-management/service/player.service.js +14 -1
  60. package/dist/pam/player-management/service/player.service.js.map +1 -1
  61. package/dist/pam/tag/__tests__/tag-evaluation.service.test.js +600 -17
  62. package/dist/pam/tag/__tests__/tag-evaluation.service.test.js.map +1 -1
  63. package/dist/pam/tag/__tests__/tag-mappers.test.js +25 -0
  64. package/dist/pam/tag/__tests__/tag-mappers.test.js.map +1 -1
  65. package/dist/pam/tag/__tests__/tag.router.test.js +71 -1
  66. package/dist/pam/tag/__tests__/tag.router.test.js.map +1 -1
  67. package/dist/pam/tag/__tests__/tag.service.test.js +342 -15
  68. package/dist/pam/tag/__tests__/tag.service.test.js.map +1 -1
  69. package/dist/pam/tag/contract/index.d.ts +97 -0
  70. package/dist/pam/tag/contract/index.d.ts.map +1 -1
  71. package/dist/pam/tag/contract/index.js +3 -0
  72. package/dist/pam/tag/contract/index.js.map +1 -1
  73. package/dist/pam/tag/contract/player-tag-assign-metadata.d.ts +37 -0
  74. package/dist/pam/tag/contract/player-tag-assign-metadata.d.ts.map +1 -0
  75. package/dist/pam/tag/contract/player-tag-assign-metadata.js +20 -0
  76. package/dist/pam/tag/contract/player-tag-assign-metadata.js.map +1 -0
  77. package/dist/pam/tag/drizzle/migrations/0002_silent_skaar.sql +4 -0
  78. package/dist/pam/tag/drizzle/migrations/0003_overconfident_guardian.sql +3 -0
  79. package/dist/pam/tag/drizzle/migrations/meta/0002_snapshot.json +335 -0
  80. package/dist/pam/tag/drizzle/migrations/meta/0003_snapshot.json +343 -0
  81. package/dist/pam/tag/drizzle/migrations/meta/_journal.json +14 -0
  82. package/dist/pam/tag/migrate.d.ts.map +1 -1
  83. package/dist/pam/tag/migrate.js +34 -0
  84. package/dist/pam/tag/migrate.js.map +1 -1
  85. package/dist/pam/tag/plugin.d.ts.map +1 -1
  86. package/dist/pam/tag/plugin.js +35 -16
  87. package/dist/pam/tag/plugin.js.map +1 -1
  88. package/dist/pam/tag/router/index.d.ts +81 -0
  89. package/dist/pam/tag/router/index.d.ts.map +1 -1
  90. package/dist/pam/tag/router/index.js +34 -18
  91. package/dist/pam/tag/router/index.js.map +1 -1
  92. package/dist/pam/tag/schema/index.d.ts +42 -3
  93. package/dist/pam/tag/schema/index.d.ts.map +1 -1
  94. package/dist/pam/tag/schema/index.js +13 -2
  95. package/dist/pam/tag/schema/index.js.map +1 -1
  96. package/dist/pam/tag/seed/data/default-tag-rules.d.ts.map +1 -1
  97. package/dist/pam/tag/seed/data/default-tag-rules.js +28 -0
  98. package/dist/pam/tag/seed/data/default-tag-rules.js.map +1 -1
  99. package/dist/pam/tag/seed/data/default-tags.d.ts.map +1 -1
  100. package/dist/pam/tag/seed/data/default-tags.js +4 -0
  101. package/dist/pam/tag/seed/data/default-tags.js.map +1 -1
  102. package/dist/pam/tag/service/tag-evaluation.service.d.ts +113 -12
  103. package/dist/pam/tag/service/tag-evaluation.service.d.ts.map +1 -1
  104. package/dist/pam/tag/service/tag-evaluation.service.js +354 -35
  105. package/dist/pam/tag/service/tag-evaluation.service.js.map +1 -1
  106. package/dist/pam/tag/service/tag-mappers.d.ts +1 -1
  107. package/dist/pam/tag/service/tag-mappers.d.ts.map +1 -1
  108. package/dist/pam/tag/service/tag-mappers.js +1 -0
  109. package/dist/pam/tag/service/tag-mappers.js.map +1 -1
  110. package/dist/pam/tag/service/tag-rule.service.d.ts +3 -3
  111. package/dist/pam/tag/service/tag.service.d.ts +141 -11
  112. package/dist/pam/tag/service/tag.service.d.ts.map +1 -1
  113. package/dist/pam/tag/service/tag.service.js +242 -23
  114. package/dist/pam/tag/service/tag.service.js.map +1 -1
  115. package/dist/server/auth/permissions.d.ts +12 -0
  116. package/dist/server/auth/permissions.d.ts.map +1 -1
  117. package/dist/server/auth/permissions.js +2 -0
  118. package/dist/server/auth/permissions.js.map +1 -1
  119. package/dist/server/db/__tests__/migrate.test.js +79 -2
  120. package/dist/server/db/__tests__/migrate.test.js.map +1 -1
  121. package/dist/server/db/migrate.d.ts +11 -0
  122. package/dist/server/db/migrate.d.ts.map +1 -1
  123. package/dist/server/db/migrate.js +3 -0
  124. package/dist/server/db/migrate.js.map +1 -1
  125. package/dist/server/plugin-host/__tests__/core-plugins.test.js +1 -1
  126. package/dist/server/plugin-host/__tests__/core-plugins.test.js.map +1 -1
  127. package/dist/wallet/__tests__/wallet-auto-withdrawal.test.js +60 -0
  128. package/dist/wallet/__tests__/wallet-auto-withdrawal.test.js.map +1 -1
  129. package/dist/wallet/__tests__/wallet.service.test.js +41 -0
  130. package/dist/wallet/__tests__/wallet.service.test.js.map +1 -1
  131. package/dist/wallet/adapters/wallet-reader.service.d.ts +1 -0
  132. package/dist/wallet/adapters/wallet-reader.service.d.ts.map +1 -1
  133. package/dist/wallet/adapters/wallet-reader.service.js +18 -1
  134. package/dist/wallet/adapters/wallet-reader.service.js.map +1 -1
  135. package/dist/wallet/plugin.d.ts.map +1 -1
  136. package/dist/wallet/plugin.js +7 -4
  137. package/dist/wallet/plugin.js.map +1 -1
  138. package/dist/wallet/service/wallet.service.d.ts +4 -2
  139. package/dist/wallet/service/wallet.service.d.ts.map +1 -1
  140. package/dist/wallet/service/wallet.service.js +11 -1
  141. package/dist/wallet/service/wallet.service.js.map +1 -1
  142. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tag-evaluation.service.d.ts","sourceRoot":"","sources":["../../../../src/pam/tag/service/tag-evaluation.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAoD,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAwB,MAAM,uBAAuB,CAAC;AAK7E,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAHd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,cAAc,EACpB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc;IAGjD,wGAAwG;YAC1F,cAAc;IAe5B,iEAAiE;YACnD,YAAY;IAqB1B,uEAAuE;YACzD,YAAY;IAqB1B;;;OAGG;IACG,kBAAkB,CAAC,O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E,GAC3C,OAAO,CAAC,IAAI,CAAC;IA0BhB;;;;;;;;OAQG;IACG,qBAAqB,CAAC,OAAO,EAAE,OAAO;IAmC5C;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,OAAO;IAKlC;;;OAGG;IACG,gBAAgB,CAAC,OAAO,EAAE,OAAO;YAKzB,oBAAoB;YAOpB,qBAAqB;IAyCnC;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,OAAO;IAiBrC;;;;;;;;;OASG;IACG,kBAAkB,CAAC,OAAO,EAAE,OAAO;IAkCzC;;;OAGG;IACG,wBAAwB,CAAC,OAAO,EAAE,OAAO;IAS/C;;;OAGG;IACG,qBAAqB,CAAC,OAAO,EAAE,OAAO;IAK5C;;;;;;;;;;OAUG;IACG,oBAAoB,CAAC,OAAO,EAAE,OAAO;IAuB3C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,kBAAkB;YAMV,iBAAiB;YAoBjB,0BAA0B;IAuBxC;;;;;;;;;;;;;;;OAeG;YACW,mBAAmB;CA0ClC"}
@@ -4,6 +4,11 @@ import { TagAlreadyInUseError, TagAssignmentNotFoundError } from './tag.service.
4
4
  import { TagRuleNotFoundError } from './tag-rule.service.js';
5
5
  import { SYSTEM_ACTOR_ID } from './tag-mappers.js';
6
6
  const EVAL_CHUNK_SIZE = 100;
7
+ const MULTI_ACCOUNT_REASON = 'identity signal matched another player account';
8
+ const BONUS_ABUSER_REASON = 'multi-account risk rule matched';
9
+ function isPendingKycStatus(status) {
10
+ return status === 'pending' || status === 'resubmission_requested';
11
+ }
7
12
  export class TagEvaluationService {
8
13
  tag;
9
14
  rule;
@@ -32,7 +37,8 @@ export class TagEvaluationService {
32
37
  }
33
38
  }
34
39
  /** Idempotently assigns a tag; swallows TagAlreadyInUseError. */
35
- async tryAssignTag(userId, tagKey, reason) {
40
+ async tryAssignTag(args) {
41
+ const { userId, tagKey, reason, assignMetadata } = args;
36
42
  const playerId = await this.identityReader.getPlayerIdByUserId(userId);
37
43
  if (!playerId) {
38
44
  return;
@@ -44,6 +50,7 @@ export class TagEvaluationService {
44
50
  assignReason: reason,
45
51
  assignActor: 'scheduled',
46
52
  assignActorUserId: SYSTEM_ACTOR_ID,
53
+ assignMetadata,
47
54
  });
48
55
  }
49
56
  catch (e) {
@@ -54,7 +61,8 @@ export class TagEvaluationService {
54
61
  }
55
62
  }
56
63
  /** Idempotently removes a tag; swallows TagAssignmentNotFoundError. */
57
- async tryRemoveTag(userId, tagKey, reason) {
64
+ async tryRemoveTag(args) {
65
+ const { userId, tagKey, reason } = args;
58
66
  const playerId = await this.identityReader.getPlayerIdByUserId(userId);
59
67
  if (!playerId) {
60
68
  return;
@@ -90,23 +98,102 @@ export class TagEvaluationService {
90
98
  if (largeDepositor &&
91
99
  largeDepositor.threshold !== null &&
92
100
  moneyToNumber(amount) >= moneyToNumber(largeDepositor.threshold)) {
93
- await this.tryAssignTag(userId, 'large_depositor', 'single deposit crossed threshold');
101
+ await this.tryAssignTag({
102
+ userId,
103
+ tagKey: 'large_depositor',
104
+ reason: 'single deposit crossed threshold',
105
+ });
94
106
  }
95
107
  if (highRoller && highRoller.threshold !== null) {
96
108
  const lifetimeDeposit = await this.walletReader.getLifetimeDeposit(userId);
97
109
  if (moneyToNumber(lifetimeDeposit) >= moneyToNumber(highRoller.threshold)) {
98
- await this.tryAssignTag(userId, 'high_roller', 'lifetime deposits crossed threshold');
110
+ await this.tryAssignTag({
111
+ userId,
112
+ tagKey: 'high_roller',
113
+ reason: 'lifetime deposits crossed threshold',
114
+ });
99
115
  }
100
116
  else {
101
- await this.tryRemoveTag(userId, 'high_roller', 'lifetime deposits below threshold');
117
+ await this.tryRemoveTag({
118
+ userId,
119
+ tagKey: 'high_roller',
120
+ reason: 'lifetime deposits below threshold',
121
+ });
122
+ }
123
+ }
124
+ }
125
+ /** True when the withdrawal_review rule is enabled and amount crosses its threshold. Shared by the event path and the synchronous command-port path below so both stay in lockstep. */
126
+ async _withdrawalReviewThresholdCrossed(amount) {
127
+ const rule = await this.getEnabledRule('withdrawal_review');
128
+ if (!rule || rule.threshold === null) {
129
+ return false;
130
+ }
131
+ return moneyToNumber(amount) >= moneyToNumber(rule.threshold);
132
+ }
133
+ /**
134
+ * Assigns withdrawal_review when a single withdrawal attempt exceeds its threshold.
135
+ * Called on wallet.withdrawal.requested (the attempt, before funds move) so the
136
+ * review tag lands before payout. Sticky - never auto-removed here or anywhere else.
137
+ * This is the async, best-effort fan-out path (other consumers may want the event) -
138
+ * wallet's own auto-approval decision does NOT wait on this; it calls
139
+ * evaluateWithdrawalRequested below instead. Idempotent with that path via
140
+ * TagAlreadyInUseError (see tryAssignTag).
141
+ */
142
+ async onWithdrawalRequested(payload) {
143
+ const { userId, amount } = domainEventSchemas['wallet.withdrawal.requested'].parse(payload);
144
+ if (await this._withdrawalReviewThresholdCrossed(amount)) {
145
+ await this.tryAssignTag({
146
+ userId,
147
+ tagKey: 'withdrawal_review',
148
+ reason: 'single withdrawal attempt exceeded review threshold',
149
+ });
150
+ }
151
+ }
152
+ /**
153
+ * Synchronous, transactional counterpart to onWithdrawalRequested, bound behind
154
+ * TAG_EVALUATION_COMMANDS. wallet.withdraw() awaits this on its own transaction handle
155
+ * BEFORE its maybeAutoApprove reads risk tags, so a withdrawal_review assignment is
156
+ * guaranteed committed before the auto-approval decision runs - closing the race the
157
+ * fire-and-forget EventBus emit above cannot (an EventBus emit is never awaited by the
158
+ * emitter). Money-adjacent: never events-only for this decision (see
159
+ * messaging-and-microservices "money never flows over events"). Any error here
160
+ * propagates and aborts the caller's withdrawal transaction - a review-gate evaluation
161
+ * failure must block the withdrawal rather than silently skip review.
162
+ */
163
+ async evaluateWithdrawalRequested(tx, args) {
164
+ const { userId, amount } = args;
165
+ if (!(await this._withdrawalReviewThresholdCrossed(amount))) {
166
+ return;
167
+ }
168
+ const playerId = await this.identityReader.getPlayerIdByUserId(userId);
169
+ if (!playerId) {
170
+ return;
171
+ }
172
+ const trx = tx;
173
+ try {
174
+ await this.tag.assignPlayerTagInTx(trx, {
175
+ playerId,
176
+ tagKey: 'withdrawal_review',
177
+ assignReason: 'single withdrawal attempt exceeded review threshold',
178
+ assignActor: 'scheduled',
179
+ assignActorUserId: SYSTEM_ACTOR_ID,
180
+ });
181
+ }
182
+ catch (e) {
183
+ if (e instanceof TagAlreadyInUseError) {
184
+ return;
102
185
  }
186
+ throw e;
103
187
  }
104
188
  }
105
189
  /**
106
190
  * Evaluates the high_risk rule based on withdrawal amount and frequency.
107
- * Called on wallet.withdrawal.completed.
108
- * Only assigns the tag when a threshold is crossed; never auto-removes
109
- * (risk designation requires an explicit admin clear).
191
+ * Called on wallet.withdrawal.completed. Only assigns the tag when a threshold is
192
+ * crossed; removal is handled separately by the daily resweep in runDailyEvaluation
193
+ * (a rolling-window count/amount can drop back under threshold with no new
194
+ * withdrawal, so it can't be detected event-driven-only). Records which breach
195
+ * condition(s) fired in assignMetadata - the resweep uses this to know whether the
196
+ * amount dimension (never resweepable, see _runHighRiskResweep) was involved.
110
197
  */
111
198
  async onWithdrawalCompleted(payload) {
112
199
  const { userId, amount } = domainEventSchemas['wallet.withdrawal.completed'].parse(payload);
@@ -114,27 +201,90 @@ export class TagEvaluationService {
114
201
  if (!rule) {
115
202
  return;
116
203
  }
117
- const amountBreached = rule.threshold !== null && moneyToNumber(amount) >= moneyToNumber(rule.threshold);
118
- let countBreached = false;
204
+ const amountBreach = rule.threshold !== null && moneyToNumber(amount) >= moneyToNumber(rule.threshold)
205
+ ? { amount, threshold: rule.threshold }
206
+ : null;
207
+ let countBreach = null;
119
208
  if (rule.thresholdDays !== null && rule.thresholdCount !== null) {
120
209
  const count = await this.walletReader.getWithdrawalCountInWindow(userId, rule.thresholdDays);
121
- countBreached = count >= rule.thresholdCount;
210
+ if (count >= rule.thresholdCount) {
211
+ countBreach = {
212
+ count,
213
+ thresholdCount: rule.thresholdCount,
214
+ thresholdDays: rule.thresholdDays,
215
+ };
216
+ }
122
217
  }
123
- if (amountBreached || countBreached) {
124
- await this.tryAssignTag(userId, 'high_risk', 'withdrawal amount or frequency crossed threshold');
218
+ if (amountBreach || countBreach) {
219
+ await this.tryAssignTag({
220
+ userId,
221
+ tagKey: 'high_risk',
222
+ reason: 'withdrawal amount or frequency crossed threshold',
223
+ assignMetadata: { amountBreach, countBreach },
224
+ });
125
225
  }
126
226
  }
127
227
  /**
128
- * Removes the inactive tag when a player logs in.
129
- * Called on identity.user.login.
228
+ * Handles password login side effects:
229
+ * - removes inactive/dormant_high_roller on activity
230
+ * - assigns multi_account + bonus_abuser when another player has used this login IP
130
231
  */
131
232
  async onUserLogin(payload) {
132
- const { userId } = domainEventSchemas['identity.user.login'].parse(payload);
133
- await this.tryRemoveTag(userId, 'inactive', 'player logged in');
233
+ const { userId, ip } = domainEventSchemas['identity.user.login'].parse(payload);
234
+ await this.onAuthenticatedLogin({ userId, ip });
235
+ }
236
+ /**
237
+ * Phone-login path mirrors password-login risk evaluation. The signal is the same
238
+ * authenticated session IP; the login method is intentionally not encoded in the tag.
239
+ */
240
+ async onUserPhoneLogin(payload) {
241
+ const { userId, ip } = domainEventSchemas['identity.user.phone_login'].parse(payload);
242
+ await this.onAuthenticatedLogin({ userId, ip });
243
+ }
244
+ async onAuthenticatedLogin(args) {
245
+ const { userId, ip } = args;
246
+ await this.tryRemoveTag({ userId, tagKey: 'inactive', reason: 'player logged in' });
247
+ await this.tryRemoveTag({ userId, tagKey: 'dormant_high_roller', reason: 'player logged in' });
248
+ await this.evaluateSharedLoginIp(userId, ip);
249
+ }
250
+ async evaluateSharedLoginIp(userId, ip) {
251
+ const normalizedIp = ip?.trim();
252
+ if (!normalizedIp) {
253
+ return;
254
+ }
255
+ const [multiAccountRule, bonusAbuserRule] = await Promise.all([
256
+ this.getEnabledRule('multi_account'),
257
+ this.getEnabledRule('bonus_abuser'),
258
+ ]);
259
+ if (!multiAccountRule && !bonusAbuserRule) {
260
+ return;
261
+ }
262
+ const linkedUserIds = await this.identityReader.getPlayerUserIdsSharingLoginIp(userId, normalizedIp);
263
+ if (linkedUserIds.length === 0) {
264
+ return;
265
+ }
266
+ const userIds = [...new Set([userId, ...linkedUserIds])];
267
+ await mapConcurrent(userIds, EVAL_CHUNK_SIZE, async (linkedUserId) => {
268
+ if (multiAccountRule) {
269
+ await this.tryAssignTag({
270
+ userId: linkedUserId,
271
+ tagKey: 'multi_account',
272
+ reason: MULTI_ACCOUNT_REASON,
273
+ });
274
+ }
275
+ if (bonusAbuserRule) {
276
+ await this.tryAssignTag({
277
+ userId: linkedUserId,
278
+ tagKey: 'bonus_abuser',
279
+ reason: BONUS_ABUSER_REASON,
280
+ });
281
+ }
282
+ });
134
283
  }
135
284
  /**
136
- * Applies the kyc_pending tag on KYC submission and clears any prior kyc_rejected.
137
- * Called on compliance.kyc.submitted. Respects the kyc_pending rule's isEnabled flag.
285
+ * Applies kyc_pending on KYC submission only while the profile still has a pending-like
286
+ * status. Does not clear kyc_rejected: that sticky tag remains until a later approved
287
+ * state explicitly clears it.
138
288
  */
139
289
  async onKycSubmitted(payload) {
140
290
  const { userId } = domainEventSchemas['compliance.kyc.submitted'].parse(payload);
@@ -142,43 +292,140 @@ export class TagEvaluationService {
142
292
  if (!rule) {
143
293
  return;
144
294
  }
145
- await this.tryRemoveTag(userId, 'kyc_rejected', 'kyc resubmitted');
146
- await this.tryAssignTag(userId, 'kyc_pending', 'kyc verification initiated');
295
+ const status = await this.identityReader.getPlayerKycStatusByUserId(userId);
296
+ if (!status || !isPendingKycStatus(status)) {
297
+ return;
298
+ }
299
+ await this.tryAssignTag({
300
+ userId,
301
+ tagKey: 'kyc_pending',
302
+ reason: 'kyc verification initiated',
303
+ });
147
304
  }
148
305
  /**
149
306
  * Manages kyc_pending / kyc_rejected lifecycle on KYC status changes.
150
- * Called on compliance.kyc.updated. Respects the kyc_pending rule's isEnabled flag.
307
+ * Called on compliance.kyc.updated. Assignment respects each tag rule's isEnabled flag;
308
+ * terminal cleanup still runs so disabled rules cannot strand old active rows.
151
309
  *
152
310
  * Transitions:
153
311
  * verified / manually_overridden -> remove kyc_pending + kyc_rejected
154
312
  * rejected -> remove kyc_pending, assign kyc_rejected
155
- * resubmission_requested -> assign kyc_pending
313
+ * resubmission_requested -> assign kyc_pending, keep kyc_rejected sticky
156
314
  */
157
315
  async onKycStatusUpdated(payload) {
158
316
  const { userId, status } = domainEventSchemas['compliance.kyc.updated'].parse(payload);
159
- const rule = await this.getEnabledRule('kyc_pending');
160
- if (!rule) {
161
- return;
162
- }
163
317
  if (status === 'verified' || status === 'manually_overridden') {
164
- await this.tryRemoveTag(userId, 'kyc_pending', 'kyc approved');
165
- await this.tryRemoveTag(userId, 'kyc_rejected', 'kyc approved');
318
+ await this.tryRemoveTag({ userId, tagKey: 'kyc_pending', reason: 'kyc approved' });
319
+ await this.tryRemoveTag({ userId, tagKey: 'kyc_rejected', reason: 'kyc approved' });
166
320
  return;
167
321
  }
168
322
  if (status === 'rejected') {
169
- await this.tryRemoveTag(userId, 'kyc_pending', 'kyc rejected');
170
- await this.tryAssignTag(userId, 'kyc_rejected', 'kyc verification rejected');
323
+ await this.tryRemoveTag({ userId, tagKey: 'kyc_pending', reason: 'kyc rejected' });
324
+ const rule = await this.getEnabledRule('kyc_rejected');
325
+ if (rule) {
326
+ await this.tryAssignTag({
327
+ userId,
328
+ tagKey: 'kyc_rejected',
329
+ reason: 'kyc verification rejected',
330
+ });
331
+ }
171
332
  return;
172
333
  }
173
334
  if (status === 'resubmission_requested') {
174
- await this.tryAssignTag(userId, 'kyc_pending', 'kyc re-verification required');
335
+ const rule = await this.getEnabledRule('kyc_pending');
336
+ if (rule) {
337
+ await this.tryAssignTag({
338
+ userId,
339
+ tagKey: 'kyc_pending',
340
+ reason: 'kyc re-verification required',
341
+ });
342
+ }
343
+ }
344
+ }
345
+ /**
346
+ * Assigns self_excluded when a player activates self-exclusion.
347
+ * Called on rg.self_exclusion.activated.
348
+ */
349
+ async onSelfExclusionActivated(payload) {
350
+ const { userId } = domainEventSchemas['rg.self_exclusion.activated'].parse(payload);
351
+ await this.tryAssignTag({
352
+ userId,
353
+ tagKey: 'self_excluded',
354
+ reason: 'self-exclusion activated',
355
+ });
356
+ }
357
+ /**
358
+ * Removes self_excluded when a player's self-exclusion is lifted.
359
+ * Called on rg.self_exclusion.lifted.
360
+ */
361
+ async onSelfExclusionLifted(payload) {
362
+ const { userId } = domainEventSchemas['rg.self_exclusion.lifted'].parse(payload);
363
+ await this.tryRemoveTag({ userId, tagKey: 'self_excluded', reason: 'self-exclusion lifted' });
364
+ }
365
+ /**
366
+ * Replaces the single mutable `level` tag with the player's new level.
367
+ * Called on player.level.changed (emitted by PlayerService.update() after commit).
368
+ * Not sticky - the level value lives only in assignReason text, never as a separate
369
+ * tag key per level. The swap goes through TagService.replacePlayerTag: removal of
370
+ * the prior active row (silent no-op when absent) + insert of the new one on ONE
371
+ * transaction, so a mid-swap failure can never strand the player with the old row
372
+ * removed and no new one committed. The loser of a concurrent replace throws
373
+ * TagAlreadyInUseError with nothing committed - swallowed here as the usual
374
+ * idempotent no-op (player.level itself stays the source of truth).
375
+ */
376
+ async onPlayerLevelChanged(payload) {
377
+ const { userId, newLevel } = domainEventSchemas['player.level.changed'].parse(payload);
378
+ const playerId = await this.identityReader.getPlayerIdByUserId(userId);
379
+ if (!playerId) {
380
+ return;
381
+ }
382
+ try {
383
+ await this.tag.replacePlayerTag({
384
+ playerId,
385
+ tagKey: 'level',
386
+ removalReason: 'player level changed',
387
+ assignReason: `player level set to ${newLevel}`,
388
+ assignActor: 'scheduled',
389
+ assignActorUserId: SYSTEM_ACTOR_ID,
390
+ });
391
+ }
392
+ catch (e) {
393
+ if (e instanceof TagAlreadyInUseError) {
394
+ return;
395
+ }
396
+ throw e;
175
397
  }
176
398
  }
177
399
  /**
178
- * Daily scheduled evaluation: assigns inactive to players who have not logged in
179
- * for rule.thresholdDays days. Removal is handled by onUserLogin on next login.
400
+ * Daily scheduled evaluation, three independent sweeps:
401
+ * - inactive: assigns to players who have not logged in for rule.thresholdDays
402
+ * days. Removal is handled by onUserLogin on next login.
403
+ * - dormant_high_roller: a co-occurrence check, not a history lookup - high_roller
404
+ * is only re-evaluated on deposit, so a player who goes quiet never loses it via
405
+ * that path. Assigns to players who are both currently inactive (per this tag's
406
+ * OWN thresholdDays, decoupled from the inactive rule's) and currently hold an
407
+ * active high_roller tag. Removal is handled by onUserLogin on next login.
408
+ * - high_risk resweep: removal-only, frequency dimension only. A rolling
409
+ * withdrawal-count window can drop back under threshold with no new withdrawal
410
+ * to trigger onWithdrawalCompleted, so current holders are rechecked here and
411
+ * removed once the count falls below threshold. Deliberately does NOT recheck
412
+ * the amount dimension - assignment's amount check has no time bound, so a
413
+ * windowed recheck would silently de-designate a still-risky player once their
414
+ * triggering withdrawal ages out of the window (an AML false negative). Now gated
415
+ * on each holder's assignMetadata (recorded at assignment): a holder whose
416
+ * metadata shows an amount breach is skipped regardless of their current count,
417
+ * and a holder with null metadata (pre-migration/legacy row, or manually
418
+ * assigned) is also skipped - "unknown why this was assigned" is treated as
419
+ * "do not auto-remove". Skipped entirely when thresholdDays or thresholdCount is
420
+ * null - an amount-only high_risk rule isn't resweepable by the cron; it stays
421
+ * until an admin clears it or a future withdrawal re-triggers assignment.
180
422
  */
181
423
  async runDailyEvaluation() {
424
+ await this._runInactiveSweep();
425
+ await this._runDormantHighRollerSweep();
426
+ await this._runHighRiskResweep();
427
+ }
428
+ async _runInactiveSweep() {
182
429
  const rule = await this.getEnabledRule('inactive');
183
430
  if (!rule || rule.thresholdDays === null) {
184
431
  return;
@@ -187,7 +434,79 @@ export class TagEvaluationService {
187
434
  const userIds = await this.identityReader.getPlayerIdsInactiveSince(sinceDate);
188
435
  // Capped fan-out: the inactive-player set is unbounded, so hold at most EVAL_CHUNK_SIZE
189
436
  // assignments in flight rather than one giant Promise.all that would exhaust the pool.
190
- await mapConcurrent(userIds, EVAL_CHUNK_SIZE, (userId) => this.tryAssignTag(userId, 'inactive', 'no login for configured threshold'));
437
+ await mapConcurrent(userIds, EVAL_CHUNK_SIZE, (userId) => this.tryAssignTag({
438
+ userId,
439
+ tagKey: 'inactive',
440
+ reason: 'no login for configured threshold',
441
+ }));
442
+ }
443
+ async _runDormantHighRollerSweep() {
444
+ const rule = await this.getEnabledRule('dormant_high_roller');
445
+ if (!rule || rule.thresholdDays === null) {
446
+ return;
447
+ }
448
+ const sinceDate = new Date(Date.now() - rule.thresholdDays * 24 * 60 * 60 * 1000);
449
+ const inactiveUserIds = await this.identityReader.getPlayerIdsInactiveSince(sinceDate);
450
+ const activeTagsByUser = await this.tag.getActiveTagKeys(inactiveUserIds);
451
+ const highRollerUserIds = inactiveUserIds.filter((userId) => (activeTagsByUser.get(userId) ?? []).includes('high_roller'));
452
+ await mapConcurrent(highRollerUserIds, EVAL_CHUNK_SIZE, (userId) => this.tryAssignTag({
453
+ userId,
454
+ tagKey: 'dormant_high_roller',
455
+ reason: 'holds high_roller and inactive for configured threshold',
456
+ }));
457
+ }
458
+ /**
459
+ * Frequency-only removal. Assignment (onWithdrawalCompleted) checks a single
460
+ * withdrawal's amount with no time bound, so an amount-only breach from outside
461
+ * this rolling window is invisible to a windowed recheck - resweeping it would
462
+ * silently de-designate a still-risky player (an AML false negative). Only the
463
+ * count dimension, which IS windowed at assignment time, is safe to resweep. Each
464
+ * holder's assignMetadata (recorded at assignment) records which breach dimension(s)
465
+ * fired; a holder whose metadata shows an amount breach, or whose metadata is null
466
+ * (pre-migration/legacy row or manual assignment - unknown why it was assigned), is
467
+ * skipped regardless of their current windowed count - pinned until an admin
468
+ * manually clears the tag or a future onWithdrawalCompleted re-evaluation populates
469
+ * metadata. Skipped entirely when thresholdDays or thresholdCount is null - an
470
+ * amount-only rule has no frequency dimension to resweep against and is never
471
+ * auto-cleared by the cron, only by an admin or a future onWithdrawalCompleted
472
+ * re-evaluation.
473
+ */
474
+ async _runHighRiskResweep() {
475
+ const rule = await this.getEnabledRule('high_risk');
476
+ if (!rule || rule.thresholdDays === null || rule.thresholdCount === null) {
477
+ return;
478
+ }
479
+ const { thresholdDays, thresholdCount } = rule;
480
+ const holders = await this.tag.listActiveHoldersByTagKey('high_risk');
481
+ if (holders.length === 0) {
482
+ return;
483
+ }
484
+ const holderUserIds = holders.map((h) => h.userId);
485
+ const metadataByUser = new Map(holders.map((h) => [h.userId, h.assignMetadata]));
486
+ // One set-based query for all holders' counts, then bound only the per-user
487
+ // removal writes - the reads are already batched, not per-row. The batched method
488
+ // is optional on the port (an external WalletReader may predate it), so fall back to
489
+ // bounded fan-out over the singular getWithdrawalCountInWindow when it's absent.
490
+ const countsByUser = this.walletReader.getWithdrawalCountsInWindow
491
+ ? await this.walletReader.getWithdrawalCountsInWindow(holderUserIds, thresholdDays)
492
+ : new Map(await mapConcurrent(holderUserIds, EVAL_CHUNK_SIZE, async (userId) => {
493
+ const count = await this.walletReader.getWithdrawalCountInWindow(userId, thresholdDays);
494
+ return [userId, count];
495
+ }));
496
+ await mapConcurrent(holderUserIds, EVAL_CHUNK_SIZE, async (userId) => {
497
+ const metadata = metadataByUser.get(userId) ?? null;
498
+ if (!metadata || metadata.amountBreach) {
499
+ return;
500
+ }
501
+ const countInWindow = countsByUser.get(userId) ?? 0;
502
+ if (countInWindow < thresholdCount) {
503
+ await this.tryRemoveTag({
504
+ userId,
505
+ tagKey: 'high_risk',
506
+ reason: 'withdrawal frequency dropped below threshold within window',
507
+ });
508
+ }
509
+ });
191
510
  }
192
511
  }
193
512
  //# sourceMappingURL=tag-evaluation.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag-evaluation.service.js","sourceRoot":"","sources":["../../../../src/pam/tag/service/tag-evaluation.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,GAMnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAc,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAkB,oBAAoB,EAAE,MAA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CAAC;YACpD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;gBACvC,OAAO;YACT,CAAC;YACD,MAAM,aAAa,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACpD,IAAI,aAAa,GAAG,cAAc,EAAE,CAAC;gBACnC,MAAM,IAAI,CAAC,YAAY,CAAC;oBACtB,MAAM;oBACN,MAAM,EAAE,WAAW;oBACnB,MAAM,EAAE,4DAA4D;iBACrE,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -6,7 +6,7 @@ export declare function toTag(row: typeof tag.$inferSelect): import("@openora/co
6
6
  id: string;
7
7
  createdAt: Date;
8
8
  updatedAt: Date;
9
- key: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
9
+ key: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account" | "dormant_high_roller" | "withdrawal_review" | "multi_account" | "level";
10
10
  isSticky: boolean;
11
11
  }, "createdAt" | "updatedAt">;
12
12
  export declare function toPlayerTagWithTag(pt: typeof playerTag.$inferSelect, tagKey: TagKey): PlayerTagWithTag;
@@ -1 +1 @@
1
- {"version":3,"file":"tag-mappers.d.ts","sourceRoot":"","sources":["../../../../src/pam/tag/service/tag-mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,eAAe,yCAAyC,CAAC;AAEtE,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,YAAY;;;;;;8BAEjD;AAED,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,OAAO,SAAS,CAAC,YAAY,EACjC,MAAM,EAAE,MAAM,GACb,gBAAgB,CAgBlB;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,OAAO,CAAC,YAAY,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAYxF"}
1
+ {"version":3,"file":"tag-mappers.d.ts","sourceRoot":"","sources":["../../../../src/pam/tag/service/tag-mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,eAAe,yCAAyC,CAAC;AAEtE,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,YAAY;;;;;;8BAEjD;AAED,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,OAAO,SAAS,CAAC,YAAY,EACjC,MAAM,EAAE,MAAM,GACb,gBAAgB,CAiBlB;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,OAAO,CAAC,YAAY,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAYxF"}
@@ -11,6 +11,7 @@ export function toPlayerTagWithTag(pt, tagKey) {
11
11
  assignReason: pt.assignReason,
12
12
  assignActor: pt.assignActor,
13
13
  assignActorUserId: pt.assignActorUserId ?? null,
14
+ assignMetadata: pt.assignMetadata ?? null,
14
15
  removedAt: pt.removedAt ?? null,
15
16
  removalReason: pt.removalReason ?? null,
16
17
  removalActor: pt.removalActor ?? null,
@@ -1 +1 @@
1
- {"version":3,"file":"tag-mappers.js","sourceRoot":"","sources":["../../../../src/pam/tag/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rB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAqD;IAC7E,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,aAAa,EAAE,GAAG,CAAC,aAAa,IAAI,IAAI;QACxC,cAAc,EAAE,GAAG,CAAC,cAAc,IAAI,IAAI;QAC1C,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE;QACtC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE;KACvC,CAAC;AACJ,CAAC"}
@@ -8,7 +8,7 @@ export declare class TagRuleService {
8
8
  listTagRules(): Promise<{
9
9
  id: string;
10
10
  tagId: string;
11
- tagKey: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
11
+ tagKey: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account" | "dormant_high_roller" | "withdrawal_review" | "multi_account" | "level";
12
12
  isEnabled: boolean;
13
13
  threshold: string | null;
14
14
  thresholdDays: number | null;
@@ -19,7 +19,7 @@ export declare class TagRuleService {
19
19
  getTagRule(tagKey: TagKey): Promise<{
20
20
  id: string;
21
21
  tagId: string;
22
- tagKey: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
22
+ tagKey: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account" | "dormant_high_roller" | "withdrawal_review" | "multi_account" | "level";
23
23
  isEnabled: boolean;
24
24
  threshold: string | null;
25
25
  thresholdDays: number | null;
@@ -30,7 +30,7 @@ export declare class TagRuleService {
30
30
  upsertTagRule(input: UpsertTagRuleInput, actorId: User['id'], meta?: ClientMeta): Promise<{
31
31
  id: string;
32
32
  tagId: string;
33
- tagKey: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
33
+ tagKey: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account" | "dormant_high_roller" | "withdrawal_review" | "multi_account" | "level";
34
34
  isEnabled: boolean;
35
35
  threshold: string | null;
36
36
  thresholdDays: number | null;