@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,23 +1,41 @@
1
- import { DrizzleService, EventBus } from '@openora/core/server';
2
- import { AssignPlayerTagInput, CreateTagInput, DeleteTagInput, RemovePlayerTagInput, type PlayerTags, type Player, type ClientMeta, type PaginationOptions } from '@openora/core/contracts';
1
+ import { DrizzleService, DrizzleTx, EventBus } from '@openora/core/server';
2
+ import { AssignPlayerTagInput, CreateTagInput, DeleteTagInput, RemovePlayerTagInput, ReplacePlayerTagInput, type PlayerTags, type Player, type TagKey, type User, type ClientMeta, type PaginationOptions } from '@openora/core/contracts';
3
3
  import type { PlayerTagSortBy } from '../contract/index.js';
4
+ import type { PlayerTagAssignMetadata } from '../contract/player-tag-assign-metadata.js';
5
+ type AssignPlayerTagArgs = AssignPlayerTagInput & {
6
+ assignMetadata?: PlayerTagAssignMetadata | null;
7
+ };
4
8
  export declare const TagNotFoundError: new (id: string) => Error;
5
9
  export declare const TagAlreadyInUseError: new () => Error;
6
10
  export declare const TagAssignmentNotFoundError: new (id: string) => Error;
11
+ export declare const TagKeyConflictError: new () => Error;
12
+ export declare const TagInUseError: new () => Error;
7
13
  export declare class TagService implements PlayerTags {
8
14
  private readonly drizzle;
9
15
  private readonly event;
10
16
  constructor(drizzle: DrizzleService, event: EventBus);
11
- getActiveTagKeys(userIds: readonly string[]): Promise<Map<string, ("high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account")[]>>;
17
+ getActiveTagKeys(userIds: readonly string[]): Promise<Map<string, ("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")[]>>;
18
+ /**
19
+ * Active holders (auth `userId`, not `player.id`) of tagKey, each with the
20
+ * assignMetadata recorded at assignment time. Internal to this module - used only by
21
+ * TagEvaluationService for the daily high_risk resweep to gate removal on WHICH breach
22
+ * condition originally fired (an amount breach, or a null/legacy row, must never be
23
+ * auto-cleared); deliberately not exposed on the PLAYER_TAGS port since no other module
24
+ * needs "list holders of tag X" today.
25
+ */
26
+ listActiveHoldersByTagKey(tagKey: TagKey): Promise<{
27
+ userId: string;
28
+ assignMetadata: PlayerTagAssignMetadata | null;
29
+ }[]>;
12
30
  private _findTagByKeyOrThrow;
13
- createTag(args: CreateTagInput): Promise<import("@openora/core/server").SerializedRow<{
31
+ createTag(args: CreateTagInput, actorId: User['id']): Promise<import("@openora/core/server").SerializedRow<{
14
32
  id: string;
15
33
  createdAt: Date;
16
34
  updatedAt: Date;
17
- key: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
35
+ 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";
18
36
  isSticky: boolean;
19
37
  }, "createdAt" | "updatedAt">>;
20
- deleteTag(args: DeleteTagInput): Promise<boolean>;
38
+ deleteTag(args: DeleteTagInput, actorId: User['id']): Promise<boolean>;
21
39
  listPlayerTags({ playerId, page, limit, sortBy, sortOrder, }: PaginationOptions<{
22
40
  playerId: Player['id'];
23
41
  }, PlayerTagSortBy>): Promise<{
@@ -35,8 +53,19 @@ export declare class TagService implements PlayerTags {
35
53
  createdAt: string;
36
54
  updatedAt: string;
37
55
  tag: {
38
- key: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
56
+ 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";
39
57
  };
58
+ assignMetadata: {
59
+ amountBreach: {
60
+ amount: string;
61
+ threshold: string;
62
+ } | null;
63
+ countBreach: {
64
+ count: number;
65
+ thresholdCount: number;
66
+ thresholdDays: number;
67
+ } | null;
68
+ } | null;
40
69
  }[];
41
70
  total: number;
42
71
  page: number;
@@ -46,10 +75,11 @@ export declare class TagService implements PlayerTags {
46
75
  id: string;
47
76
  createdAt: Date;
48
77
  updatedAt: Date;
49
- key: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
78
+ 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";
50
79
  isSticky: boolean;
51
80
  }, "createdAt" | "updatedAt">[]>;
52
- assignPlayerTag(args: AssignPlayerTagInput, meta?: ClientMeta): Promise<{
81
+ private _assignPlayerTagOnTx;
82
+ assignPlayerTag(args: AssignPlayerTagArgs, meta?: ClientMeta): Promise<{
53
83
  id: string;
54
84
  playerId: string;
55
85
  tagId: string;
@@ -63,9 +93,58 @@ export declare class TagService implements PlayerTags {
63
93
  createdAt: string;
64
94
  updatedAt: string;
65
95
  tag: {
66
- key: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
96
+ 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";
67
97
  };
98
+ assignMetadata: {
99
+ amountBreach: {
100
+ amount: string;
101
+ threshold: string;
102
+ } | null;
103
+ countBreach: {
104
+ count: number;
105
+ thresholdCount: number;
106
+ thresholdDays: number;
107
+ } | null;
108
+ } | null;
68
109
  }>;
110
+ /**
111
+ * Same idempotent assign as assignPlayerTag, but on a caller-supplied transaction handle
112
+ * (the TAG_EVALUATION_COMMANDS command-port idiom, ADR-0017) so the write commits
113
+ * atomically with the caller's own writes - eg wallet's withdraw() inserting the
114
+ * withdrawal request row. Emits tag.player.assigned right after the write (mirrors
115
+ * PlayerKycStatusWriter.setStatus): this method has no visibility into when the
116
+ * caller's own transaction actually commits, so - like every other caller-supplied-tx
117
+ * command port in this repo - it cannot defer the emit past that point.
118
+ */
119
+ assignPlayerTagInTx(trx: DrizzleTx, args: AssignPlayerTagArgs): Promise<{
120
+ id: string;
121
+ playerId: string;
122
+ tagId: string;
123
+ assignReason: string;
124
+ assignActor: "scheduled" | "manual";
125
+ assignActorUserId: string | null;
126
+ removedAt: Date | null;
127
+ removalReason: string | null;
128
+ removalActor: "scheduled" | "manual" | null;
129
+ removalActorUserId: string | null;
130
+ createdAt: string;
131
+ updatedAt: string;
132
+ tag: {
133
+ 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";
134
+ };
135
+ assignMetadata: {
136
+ amountBreach: {
137
+ amount: string;
138
+ threshold: string;
139
+ } | null;
140
+ countBreach: {
141
+ count: number;
142
+ thresholdCount: number;
143
+ thresholdDays: number;
144
+ } | null;
145
+ } | null;
146
+ }>;
147
+ private _removePlayerTagOnTx;
69
148
  removePlayerTag(args: RemovePlayerTagInput, meta?: ClientMeta): Promise<{
70
149
  id: string;
71
150
  playerId: string;
@@ -80,8 +159,59 @@ export declare class TagService implements PlayerTags {
80
159
  createdAt: string;
81
160
  updatedAt: string;
82
161
  tag: {
83
- key: "high_roller" | "vip" | "bonus_abuser" | "high_risk" | "inactive" | "large_depositor" | "self_excluded" | "kyc_pending" | "kyc_rejected" | "test_account";
162
+ 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";
163
+ };
164
+ assignMetadata: {
165
+ amountBreach: {
166
+ amount: string;
167
+ threshold: string;
168
+ } | null;
169
+ countBreach: {
170
+ count: number;
171
+ thresholdCount: number;
172
+ thresholdDays: number;
173
+ } | null;
174
+ } | null;
175
+ }>;
176
+ /**
177
+ * Atomically replaces a player's active assignment of tagKey - the same-key value
178
+ * swap the mutable `level` tag needs. Both halves run on ONE transaction: a missing
179
+ * active row makes the removal a silent no-op (unlike removePlayerTag), and a
180
+ * failure in the assign half rolls the removal back too, so the swap can never
181
+ * commit half-way and strand the player with no active row. Under a genuine
182
+ * concurrent replace for the same (tag, player), the loser serializes on the row
183
+ * lock + the player_tag_active_key unique index and throws TagAlreadyInUseError
184
+ * with NOTHING committed. Emits tag.player.removed (only when a row was actually
185
+ * removed) and tag.player.assigned after the commit.
186
+ */
187
+ replacePlayerTag(args: ReplacePlayerTagInput): Promise<{
188
+ id: string;
189
+ playerId: string;
190
+ tagId: string;
191
+ assignReason: string;
192
+ assignActor: "scheduled" | "manual";
193
+ assignActorUserId: string | null;
194
+ removedAt: Date | null;
195
+ removalReason: string | null;
196
+ removalActor: "scheduled" | "manual" | null;
197
+ removalActorUserId: string | null;
198
+ createdAt: string;
199
+ updatedAt: string;
200
+ tag: {
201
+ 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";
84
202
  };
203
+ assignMetadata: {
204
+ amountBreach: {
205
+ amount: string;
206
+ threshold: string;
207
+ } | null;
208
+ countBreach: {
209
+ count: number;
210
+ thresholdCount: number;
211
+ thresholdDays: number;
212
+ } | null;
213
+ } | null;
85
214
  }>;
86
215
  }
216
+ export {};
87
217
  //# sourceMappingURL=tag.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag.service.d.ts","sourceRoot":"","sources":["../../../../src/pam/tag/service/tag.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAEd,QAAQ,EAKT,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,MAAM,EAEX,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AACzD,eAAO,MAAM,oBAAoB,iBAA2B,CAAC;AAC7D,eAAO,MAAM,0BAA0B,2BAAsC,CAAC;AAE9E,qBAAa,UAAW,YAAW,UAAU;IAEzC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,QAAQ;IAIrB,gBAAgB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE;YAmB1C,oBAAoB;IAKrB,SAAS,CAAC,IAAI,EAAE,cAAc;;;;;;;IAU9B,SAAS,CAAC,IAAI,EAAE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A6C1E;;;;;;;;;;OAUG;IACU,gBAAgB,CAAC,IAAI,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoD1D"}
@@ -1,12 +1,50 @@
1
- import { findOneOrThrow, makeNotFoundError, pageToOffset, alreadyInUseError, } from '@openora/core/server';
1
+ import { findOneOrThrow, makeNotFoundError, makeConflictError, pageToOffset, alreadyInUseError, } from '@openora/core/server';
2
2
  import { and, asc, count, desc, eq, inArray, isNull, notInArray } from 'drizzle-orm';
3
+ import { DatabaseError } from 'pg';
3
4
  import { player } from '@openora/core/pam/schema/profile';
4
5
  import { playerTag, tag } from '../schema/index.js';
5
6
  import { mapDbError } from '@openora/core/common/errors';
6
7
  import { toTag, toPlayerTagWithTag, SYSTEM_ACTOR_ID } from './tag-mappers.js';
8
+ function pgErrorCode(e) {
9
+ if (e instanceof DatabaseError) {
10
+ return e.code;
11
+ }
12
+ // drizzle-orm wraps every driver-thrown error in DrizzleQueryError, exposing the
13
+ // real pg DatabaseError only via `.cause`.
14
+ if (e instanceof Error && e.cause instanceof DatabaseError) {
15
+ return e.cause.code;
16
+ }
17
+ return undefined;
18
+ }
7
19
  export const TagNotFoundError = makeNotFoundError('Tag');
8
20
  export const TagAlreadyInUseError = alreadyInUseError('Tag');
9
21
  export const TagAssignmentNotFoundError = makeNotFoundError('Tag Assignment');
22
+ // Distinct from TagAlreadyInUseError above (a player already holding this tag active) -
23
+ // this is the tag CATALOG key colliding on create.
24
+ export const TagKeyConflictError = makeConflictError('TagKeyConflictError', 'Tag key already exists');
25
+ // A tag can't be deleted while a playerTag/tagRule row still references it
26
+ // (onDelete: 'restrict' in the schema).
27
+ export const TagInUseError = makeConflictError('TagInUseError', 'Tag is still referenced by a player tag or tag rule and cannot be deleted');
28
+ // "First evidence wins per breach dimension, but a dimension that was never recorded gets
29
+ // filled in the moment it's observed." Never overwrites an already-populated dimension with
30
+ // fresher numbers - once a dimension has ever been recorded, the resweep treats it as sticky.
31
+ // Returns the SAME `existing` reference when nothing new was merged in, so the caller can
32
+ // detect a no-op write via reference equality.
33
+ function mergeAssignMetadata(existing, incoming) {
34
+ if (!incoming) {
35
+ return existing;
36
+ }
37
+ if (!existing) {
38
+ return incoming;
39
+ }
40
+ if (existing.amountBreach && existing.countBreach) {
41
+ return existing;
42
+ }
43
+ return {
44
+ amountBreach: existing.amountBreach ?? incoming.amountBreach,
45
+ countBreach: existing.countBreach ?? incoming.countBreach,
46
+ };
47
+ }
10
48
  export class TagService {
11
49
  drizzle;
12
50
  event;
@@ -33,27 +71,59 @@ export class TagService {
33
71
  }
34
72
  return result;
35
73
  }
74
+ /**
75
+ * Active holders (auth `userId`, not `player.id`) of tagKey, each with the
76
+ * assignMetadata recorded at assignment time. Internal to this module - used only by
77
+ * TagEvaluationService for the daily high_risk resweep to gate removal on WHICH breach
78
+ * condition originally fired (an amount breach, or a null/legacy row, must never be
79
+ * auto-cleared); deliberately not exposed on the PLAYER_TAGS port since no other module
80
+ * needs "list holders of tag X" today.
81
+ */
82
+ async listActiveHoldersByTagKey(tagKey) {
83
+ const rows = await this.drizzle.db
84
+ .select({ userId: player.userId, assignMetadata: playerTag.assignMetadata })
85
+ .from(playerTag)
86
+ .innerJoin(tag, eq(playerTag.tagId, tag.id))
87
+ .innerJoin(player, eq(player.id, playerTag.playerId))
88
+ .where(and(eq(tag.key, tagKey), isNull(playerTag.removedAt)));
89
+ return rows.map((r) => ({ userId: r.userId, assignMetadata: r.assignMetadata ?? null }));
90
+ }
36
91
  async _findTagByKeyOrThrow(tagKey, trx) {
37
92
  const results = await trx.select().from(tag).where(eq(tag.key, tagKey)).limit(1);
38
93
  return toTag(findOneOrThrow(results, new TagNotFoundError(tagKey)));
39
94
  }
40
- async createTag(args) {
95
+ async createTag(args, actorId) {
41
96
  try {
42
97
  const db = this.drizzle.db;
43
98
  const [created] = await db.insert(tag).values(args).returning();
44
- return toTag(created);
99
+ const result = toTag(created);
100
+ void this.event.emit('tag.created', { key: result.key, isSticky: result.isSticky, actorId });
101
+ return result;
45
102
  }
46
103
  catch (e) {
104
+ if (pgErrorCode(e) === '23505') {
105
+ throw new TagKeyConflictError();
106
+ }
47
107
  mapDbError(e);
48
108
  }
49
109
  }
50
- async deleteTag(args) {
110
+ async deleteTag(args, actorId) {
51
111
  try {
52
112
  const db = this.drizzle.db;
53
- await db.delete(tag).where(eq(tag.key, args.key));
113
+ // .returning() is the only signal a genuine delete happened - without it a
114
+ // no-op delete of a missing key would still fall through and emit tag.deleted,
115
+ // which the audit module records as a real deletion that never occurred.
116
+ const deleted = await db.delete(tag).where(eq(tag.key, args.key)).returning();
117
+ if (deleted.length === 0) {
118
+ throw new TagNotFoundError(args.key);
119
+ }
120
+ void this.event.emit('tag.deleted', { key: args.key, actorId });
54
121
  return true;
55
122
  }
56
123
  catch (e) {
124
+ if (pgErrorCode(e) === '23503') {
125
+ throw new TagInUseError();
126
+ }
57
127
  mapDbError(e);
58
128
  }
59
129
  }
@@ -99,26 +169,64 @@ export class TagService {
99
169
  .orderBy(asc(tag.key));
100
170
  return rows.map(toTag);
101
171
  }
172
+ // Core idempotent assign, shared by assignPlayerTag (own transaction) and
173
+ // assignPlayerTagInTx (caller-supplied transaction). Does NOT emit - callers decide
174
+ // when, since assignPlayerTagInTx's caller owns a transaction this method has no
175
+ // visibility into committing.
176
+ //
177
+ // Returns a status instead of throwing for the "already active" case: throwing here
178
+ // would roll back the merge UPDATE below along with the whole transaction when this
179
+ // runs inside assignPlayerTag's own db.transaction(...). Returning lets that
180
+ // transaction commit the metadata enrichment first; the public methods translate
181
+ // 'already_active' into TagAlreadyInUseError only after the transaction has resolved.
182
+ async _assignPlayerTagOnTx(trx, args) {
183
+ const { tagKey, ...restArgs } = args;
184
+ const foundTag = await this._findTagByKeyOrThrow(tagKey, trx);
185
+ // Fast/friendly pre-check only - the real guard is the partial unique index
186
+ // (player_tag_active_key) backing the onConflictDoNothing below. Without it, two
187
+ // concurrent calls (or the same at-least-once event redelivered) can both pass
188
+ // this SELECT before either commits, creating duplicate active rows.
189
+ const [existing] = await trx
190
+ .select()
191
+ .from(playerTag)
192
+ .where(and(eq(playerTag.tagId, foundTag.id), eq(playerTag.playerId, args.playerId), isNull(playerTag.removedAt)))
193
+ .limit(1);
194
+ if (existing) {
195
+ // A later event can reveal a breach dimension absent from the original assignment;
196
+ // without merging it in, the resweep would act on stale metadata and could wrongly
197
+ // clear a still-risky player.
198
+ const merged = mergeAssignMetadata(existing.assignMetadata, args.assignMetadata);
199
+ if (merged !== existing.assignMetadata) {
200
+ await trx
201
+ .update(playerTag)
202
+ .set({ assignMetadata: merged })
203
+ .where(eq(playerTag.id, existing.id));
204
+ }
205
+ return { status: 'already_active' };
206
+ }
207
+ // The loser of a genuine race hits the unique index here instead: its insert is a
208
+ // no-op (empty returning()), so it also reports 'already_active' - tryAssignTag
209
+ // already treats the resulting TagAlreadyInUseError as an idempotent no-op.
210
+ const [created] = await trx
211
+ .insert(playerTag)
212
+ .values({ ...restArgs, tagId: foundTag.id })
213
+ .onConflictDoNothing({
214
+ target: [playerTag.tagId, playerTag.playerId],
215
+ where: isNull(playerTag.removedAt),
216
+ })
217
+ .returning();
218
+ if (!created) {
219
+ return { status: 'already_active' };
220
+ }
221
+ return { status: 'created', row: toPlayerTagWithTag(created, foundTag.key) };
222
+ }
102
223
  async assignPlayerTag(args, meta) {
103
224
  try {
104
- const { tagKey, ...restArgs } = args;
105
225
  const db = this.drizzle.db;
106
- const result = await db.transaction(async (trx) => {
107
- const foundTag = await this._findTagByKeyOrThrow(tagKey, trx);
108
- const [existing] = await trx
109
- .select()
110
- .from(playerTag)
111
- .where(and(eq(playerTag.tagId, foundTag.id), eq(playerTag.playerId, args.playerId), isNull(playerTag.removedAt)))
112
- .limit(1);
113
- if (existing) {
114
- throw new TagAlreadyInUseError();
115
- }
116
- const [created] = await trx
117
- .insert(playerTag)
118
- .values({ ...restArgs, tagId: foundTag.id })
119
- .returning();
120
- return toPlayerTagWithTag(created, foundTag.key);
121
- });
226
+ const outcome = await db.transaction((trx) => this._assignPlayerTagOnTx(trx, args));
227
+ if (outcome.status === 'already_active') {
228
+ throw new TagAlreadyInUseError();
229
+ }
122
230
  void this.event.emit('tag.player.assigned', {
123
231
  playerId: args.playerId,
124
232
  tagKey: args.tagKey,
@@ -127,12 +235,58 @@ export class TagService {
127
235
  ip: meta?.ip ?? null,
128
236
  userAgent: meta?.userAgent ?? null,
129
237
  });
130
- return result;
238
+ return outcome.row;
239
+ }
240
+ catch (e) {
241
+ mapDbError(e);
242
+ }
243
+ }
244
+ /**
245
+ * Same idempotent assign as assignPlayerTag, but on a caller-supplied transaction handle
246
+ * (the TAG_EVALUATION_COMMANDS command-port idiom, ADR-0017) so the write commits
247
+ * atomically with the caller's own writes - eg wallet's withdraw() inserting the
248
+ * withdrawal request row. Emits tag.player.assigned right after the write (mirrors
249
+ * PlayerKycStatusWriter.setStatus): this method has no visibility into when the
250
+ * caller's own transaction actually commits, so - like every other caller-supplied-tx
251
+ * command port in this repo - it cannot defer the emit past that point.
252
+ */
253
+ async assignPlayerTagInTx(trx, args) {
254
+ try {
255
+ const outcome = await this._assignPlayerTagOnTx(trx, args);
256
+ if (outcome.status === 'already_active') {
257
+ throw new TagAlreadyInUseError();
258
+ }
259
+ void this.event.emit('tag.player.assigned', {
260
+ playerId: args.playerId,
261
+ tagKey: args.tagKey,
262
+ reason: args.assignReason,
263
+ actorId: args.assignActorUserId ?? SYSTEM_ACTOR_ID,
264
+ });
265
+ return outcome.row;
131
266
  }
132
267
  catch (e) {
133
268
  mapDbError(e);
134
269
  }
135
270
  }
271
+ async _removePlayerTagOnTx(trx, args) {
272
+ const foundTag = await this._findTagByKeyOrThrow(args.tagKey, trx);
273
+ const active = findOneOrThrow(await trx
274
+ .select()
275
+ .from(playerTag)
276
+ .where(and(eq(playerTag.tagId, foundTag.id), eq(playerTag.playerId, args.playerId), isNull(playerTag.removedAt)))
277
+ .limit(1), new TagAssignmentNotFoundError(args.playerId));
278
+ const [updated] = await trx
279
+ .update(playerTag)
280
+ .set({
281
+ removedAt: new Date(),
282
+ removalReason: args.removalReason,
283
+ removalActor: args.removalActor,
284
+ removalActorUserId: args.removalActorUserId,
285
+ })
286
+ .where(eq(playerTag.id, active.id))
287
+ .returning();
288
+ return toPlayerTagWithTag(updated, foundTag.key);
289
+ }
136
290
  async removePlayerTag(args, meta) {
137
291
  try {
138
292
  const db = this.drizzle.db;
@@ -169,5 +323,70 @@ export class TagService {
169
323
  mapDbError(e);
170
324
  }
171
325
  }
326
+ /**
327
+ * Atomically replaces a player's active assignment of tagKey - the same-key value
328
+ * swap the mutable `level` tag needs. Both halves run on ONE transaction: a missing
329
+ * active row makes the removal a silent no-op (unlike removePlayerTag), and a
330
+ * failure in the assign half rolls the removal back too, so the swap can never
331
+ * commit half-way and strand the player with no active row. Under a genuine
332
+ * concurrent replace for the same (tag, player), the loser serializes on the row
333
+ * lock + the player_tag_active_key unique index and throws TagAlreadyInUseError
334
+ * with NOTHING committed. Emits tag.player.removed (only when a row was actually
335
+ * removed) and tag.player.assigned after the commit.
336
+ */
337
+ async replacePlayerTag(args) {
338
+ try {
339
+ const db = this.drizzle.db;
340
+ const { removalReason, ...assignArgs } = args;
341
+ const result = await db.transaction(async (trx) => {
342
+ let removed = false;
343
+ try {
344
+ // App-level throw from findOneOrThrow, not a failed SQL statement, so
345
+ // catching it here does not abort the surrounding Postgres transaction.
346
+ await this._removePlayerTagOnTx(trx, {
347
+ playerId: args.playerId,
348
+ tagKey: args.tagKey,
349
+ removalReason,
350
+ removalActor: args.assignActor,
351
+ removalActorUserId: args.assignActorUserId,
352
+ });
353
+ removed = true;
354
+ }
355
+ catch (e) {
356
+ if (!(e instanceof TagAssignmentNotFoundError)) {
357
+ throw e;
358
+ }
359
+ }
360
+ const assigned = await this._assignPlayerTagOnTx(trx, assignArgs);
361
+ if (assigned.status === 'already_active') {
362
+ // Unlike assignPlayerTag/assignPlayerTagInTx (where a lost race is an
363
+ // idempotent no-op that must still let a metadata merge commit), a lost
364
+ // race HERE must roll back the whole swap, including the removal above -
365
+ // see the class doc: nothing may commit half-way. Throwing inside this
366
+ // db.transaction callback is exactly how that rollback happens.
367
+ throw new TagAlreadyInUseError();
368
+ }
369
+ return { row: assigned.row, removed };
370
+ });
371
+ if (result.removed) {
372
+ void this.event.emit('tag.player.removed', {
373
+ playerId: args.playerId,
374
+ tagKey: args.tagKey,
375
+ reason: removalReason,
376
+ actorId: args.assignActorUserId ?? SYSTEM_ACTOR_ID,
377
+ });
378
+ }
379
+ void this.event.emit('tag.player.assigned', {
380
+ playerId: args.playerId,
381
+ tagKey: args.tagKey,
382
+ reason: args.assignReason,
383
+ actorId: args.assignActorUserId ?? SYSTEM_ACTOR_ID,
384
+ });
385
+ return result.row;
386
+ }
387
+ catch (e) {
388
+ mapDbError(e);
389
+ }
390
+ }
172
391
  }
173
392
  //# sourceMappingURL=tag.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag.service.js","sourceRoot":"","sources":["../../../../src/pam/tag/service/tag.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAarF,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,KAAK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