@helyx/module-automod 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 (79) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +725 -0
  3. package/README.md +80 -0
  4. package/dist/activity-resource.d.ts +3 -0
  5. package/dist/activity-resource.js +114 -0
  6. package/dist/case-link-provider.d.ts +3 -0
  7. package/dist/case-link-provider.js +13 -0
  8. package/dist/configuration.d.ts +22 -0
  9. package/dist/configuration.js +85 -0
  10. package/dist/constants.d.ts +30 -0
  11. package/dist/constants.js +37 -0
  12. package/dist/contracts.d.ts +30 -0
  13. package/dist/contracts.js +51 -0
  14. package/dist/domain.d.ts +61 -0
  15. package/dist/domain.js +274 -0
  16. package/dist/engine/canonicalisation.d.ts +9 -0
  17. package/dist/engine/canonicalisation.js +150 -0
  18. package/dist/engine/compile.d.ts +4 -0
  19. package/dist/engine/compile.js +169 -0
  20. package/dist/engine/confidence.d.ts +13 -0
  21. package/dist/engine/confidence.js +57 -0
  22. package/dist/engine/configuration-cache.d.ts +29 -0
  23. package/dist/engine/configuration-cache.js +115 -0
  24. package/dist/engine/contracts.d.ts +82 -0
  25. package/dist/engine/contracts.js +25 -0
  26. package/dist/engine/index.d.ts +11 -0
  27. package/dist/engine/index.js +11 -0
  28. package/dist/engine/matcher.d.ts +3 -0
  29. package/dist/engine/matcher.js +206 -0
  30. package/dist/engine/observations.d.ts +45 -0
  31. package/dist/engine/observations.js +105 -0
  32. package/dist/engine/operation-id.d.ts +18 -0
  33. package/dist/engine/operation-id.js +24 -0
  34. package/dist/engine/similar-message-window.d.ts +68 -0
  35. package/dist/engine/similar-message-window.js +259 -0
  36. package/dist/engine/term-import.d.ts +15 -0
  37. package/dist/engine/term-import.js +43 -0
  38. package/dist/enhanced-configuration.d.ts +16 -0
  39. package/dist/enhanced-configuration.js +91 -0
  40. package/dist/events.d.ts +4 -0
  41. package/dist/events.js +371 -0
  42. package/dist/health.d.ts +9 -0
  43. package/dist/health.js +45 -0
  44. package/dist/index.d.ts +10 -0
  45. package/dist/index.js +141 -0
  46. package/dist/policy-provider.d.ts +3 -0
  47. package/dist/policy-provider.js +66 -0
  48. package/dist/publication-support.d.ts +14 -0
  49. package/dist/publication-support.js +69 -0
  50. package/dist/publication.d.ts +32 -0
  51. package/dist/publication.js +333 -0
  52. package/dist/receipt-statistics.d.ts +11 -0
  53. package/dist/receipt-statistics.js +58 -0
  54. package/dist/records.d.ts +299 -0
  55. package/dist/records.js +288 -0
  56. package/dist/repository-model.d.ts +54 -0
  57. package/dist/repository-model.js +132 -0
  58. package/dist/repository.d.ts +133 -0
  59. package/dist/repository.js +523 -0
  60. package/dist/resource-cursor.d.ts +5 -0
  61. package/dist/resource-cursor.js +45 -0
  62. package/dist/resource-presentation.d.ts +21 -0
  63. package/dist/resource-presentation.js +111 -0
  64. package/dist/resource-validation.d.ts +6 -0
  65. package/dist/resource-validation.js +80 -0
  66. package/dist/resources.d.ts +4 -0
  67. package/dist/resources.js +319 -0
  68. package/dist/scanner-configuration.d.ts +10 -0
  69. package/dist/scanner-configuration.js +146 -0
  70. package/dist/scanner-provider.d.ts +5 -0
  71. package/dist/scanner-provider.js +310 -0
  72. package/dist/scanner-result-validation.d.ts +3 -0
  73. package/dist/scanner-result-validation.js +61 -0
  74. package/dist/settings-preview.d.ts +6 -0
  75. package/dist/settings-preview.js +84 -0
  76. package/manifest.json +1601 -0
  77. package/migrations/0001_automod_standard.sql +114 -0
  78. package/migrations/0002_automod_enhanced_receipts.sql +40 -0
  79. package/package.json +61 -0
@@ -0,0 +1,299 @@
1
+ export declare const automodRecords: {
2
+ readonly rules: {
3
+ readonly table: "automod_rules";
4
+ readonly fields: {
5
+ readonly rule_id: {
6
+ readonly type: "string";
7
+ };
8
+ readonly guild_id: {
9
+ readonly type: "string";
10
+ };
11
+ readonly name: {
12
+ readonly type: "string";
13
+ };
14
+ readonly name_key: {
15
+ readonly type: "string";
16
+ };
17
+ readonly category: {
18
+ readonly type: "string";
19
+ };
20
+ readonly rule_kind: {
21
+ readonly type: "string";
22
+ };
23
+ readonly status: {
24
+ readonly type: "string";
25
+ };
26
+ readonly document_json: {
27
+ readonly type: "json";
28
+ };
29
+ readonly native_rule_id: {
30
+ readonly type: "string";
31
+ readonly optional: true;
32
+ };
33
+ readonly native_fingerprint: {
34
+ readonly type: "string";
35
+ readonly optional: true;
36
+ };
37
+ readonly operation_key: {
38
+ readonly type: "string";
39
+ };
40
+ readonly configuration_revision: {
41
+ readonly type: "string";
42
+ };
43
+ readonly revision: {
44
+ readonly type: "number";
45
+ };
46
+ readonly created_by_user_id: {
47
+ readonly type: "string";
48
+ readonly optional: true;
49
+ };
50
+ readonly updated_by_user_id: {
51
+ readonly type: "string";
52
+ readonly optional: true;
53
+ };
54
+ readonly created_at: {
55
+ readonly type: "date";
56
+ };
57
+ readonly updated_at: {
58
+ readonly type: "date";
59
+ };
60
+ };
61
+ readonly ownedSetLimit: 100;
62
+ readonly uniqueKeys: readonly [readonly ["rule_id"], readonly ["guild_id", "rule_id"], readonly ["guild_id", "name_key"], readonly ["guild_id", "native_rule_id"]];
63
+ readonly readableFields: readonly ["rule_id", "guild_id", "name", "name_key", "category", "rule_kind", "status", "document_json", "native_rule_id", "native_fingerprint", "operation_key", "configuration_revision", "revision", "created_by_user_id", "updated_by_user_id", "created_at", "updated_at"];
64
+ readonly writableFields: readonly ["rule_id", "guild_id", "name", "name_key", "category", "rule_kind", "status", "document_json", "native_rule_id", "native_fingerprint", "operation_key", "configuration_revision", "revision", "created_by_user_id", "updated_by_user_id", "created_at", "updated_at"];
65
+ readonly orderKeys: readonly [readonly ["updated_at", "rule_id"], readonly ["name_key", "rule_id"]];
66
+ readonly groupableFields: readonly ["guild_id", "status", "category", "rule_kind"];
67
+ readonly searchableFields: readonly ["name", "name_key"];
68
+ };
69
+ readonly action_receipts: {
70
+ readonly table: "automod_action_receipts";
71
+ readonly fields: {
72
+ readonly receipt_id: {
73
+ readonly type: "string";
74
+ };
75
+ readonly guild_id: {
76
+ readonly type: "string";
77
+ };
78
+ readonly event_key: {
79
+ readonly type: "string";
80
+ };
81
+ readonly rule_id: {
82
+ readonly type: "string";
83
+ };
84
+ readonly rule_revision: {
85
+ readonly type: "number";
86
+ };
87
+ readonly configuration_revision: {
88
+ readonly type: "string";
89
+ };
90
+ readonly native_rule_id: {
91
+ readonly type: "string";
92
+ readonly optional: true;
93
+ };
94
+ readonly source: {
95
+ readonly type: "string";
96
+ };
97
+ readonly detector_version: {
98
+ readonly type: "string";
99
+ readonly optional: true;
100
+ };
101
+ readonly scoring_version: {
102
+ readonly type: "string";
103
+ readonly optional: true;
104
+ };
105
+ readonly term_id: {
106
+ readonly type: "string";
107
+ readonly optional: true;
108
+ };
109
+ readonly detection_method: {
110
+ readonly type: "string";
111
+ readonly optional: true;
112
+ };
113
+ readonly confidence_class: {
114
+ readonly type: "string";
115
+ readonly optional: true;
116
+ };
117
+ readonly confidence_score: {
118
+ readonly type: "number";
119
+ readonly optional: true;
120
+ };
121
+ readonly effective_threshold: {
122
+ readonly type: "number";
123
+ readonly optional: true;
124
+ };
125
+ readonly correlation_id: {
126
+ readonly type: "string";
127
+ readonly optional: true;
128
+ };
129
+ readonly subject_user_id: {
130
+ readonly type: "string";
131
+ readonly optional: true;
132
+ };
133
+ readonly channel_id: {
134
+ readonly type: "string";
135
+ readonly optional: true;
136
+ };
137
+ readonly message_id: {
138
+ readonly type: "string";
139
+ readonly optional: true;
140
+ };
141
+ readonly alert_system_message_id: {
142
+ readonly type: "string";
143
+ readonly optional: true;
144
+ };
145
+ readonly action_type: {
146
+ readonly type: "string";
147
+ };
148
+ readonly claim_key: {
149
+ readonly type: "string";
150
+ };
151
+ readonly moderation_case_id: {
152
+ readonly type: "string";
153
+ readonly optional: true;
154
+ };
155
+ readonly outcome: {
156
+ readonly type: "string";
157
+ };
158
+ readonly safe_code: {
159
+ readonly type: "string";
160
+ readonly optional: true;
161
+ };
162
+ readonly occurred_at: {
163
+ readonly type: "date";
164
+ };
165
+ readonly retention_expires_at: {
166
+ readonly type: "date";
167
+ };
168
+ readonly created_at: {
169
+ readonly type: "date";
170
+ };
171
+ };
172
+ readonly uniqueKeys: readonly [readonly ["receipt_id"], readonly ["guild_id", "event_key"]];
173
+ readonly readableFields: readonly ["receipt_id", "guild_id", "event_key", "rule_id", "rule_revision", "configuration_revision", "native_rule_id", "source", "detector_version", "scoring_version", "term_id", "detection_method", "confidence_class", "confidence_score", "effective_threshold", "correlation_id", "subject_user_id", "channel_id", "message_id", "alert_system_message_id", "action_type", "claim_key", "moderation_case_id", "outcome", "safe_code", "occurred_at", "retention_expires_at", "created_at"];
174
+ readonly writableFields: readonly ["receipt_id", "guild_id", "event_key", "rule_id", "rule_revision", "configuration_revision", "native_rule_id", "source", "detector_version", "scoring_version", "term_id", "detection_method", "confidence_class", "confidence_score", "effective_threshold", "correlation_id", "subject_user_id", "channel_id", "message_id", "alert_system_message_id", "action_type", "claim_key", "moderation_case_id", "outcome", "safe_code", "occurred_at", "retention_expires_at", "created_at"];
175
+ readonly orderKeys: readonly [readonly ["occurred_at", "receipt_id"]];
176
+ readonly groupableFields: readonly ["outcome", "source", "action_type", "rule_id"];
177
+ };
178
+ readonly enforcement_claims: {
179
+ readonly table: "automod_enforcement_claims";
180
+ readonly fields: {
181
+ readonly claim_key: {
182
+ readonly type: "string";
183
+ };
184
+ readonly guild_id: {
185
+ readonly type: "string";
186
+ };
187
+ readonly rule_id: {
188
+ readonly type: "string";
189
+ };
190
+ readonly rule_revision: {
191
+ readonly type: "number";
192
+ };
193
+ readonly configuration_revision: {
194
+ readonly type: "string";
195
+ };
196
+ readonly subject_user_id: {
197
+ readonly type: "string";
198
+ readonly optional: true;
199
+ };
200
+ readonly channel_id: {
201
+ readonly type: "string";
202
+ readonly optional: true;
203
+ };
204
+ readonly message_id: {
205
+ readonly type: "string";
206
+ readonly optional: true;
207
+ };
208
+ readonly category: {
209
+ readonly type: "string";
210
+ };
211
+ readonly action_family: {
212
+ readonly type: "string";
213
+ };
214
+ readonly source: {
215
+ readonly type: "string";
216
+ };
217
+ readonly request_fingerprint: {
218
+ readonly type: "string";
219
+ };
220
+ readonly moderation_case_id: {
221
+ readonly type: "string";
222
+ readonly optional: true;
223
+ };
224
+ readonly repeat_ordinal: {
225
+ readonly type: "number";
226
+ readonly optional: true;
227
+ };
228
+ readonly selected_action: {
229
+ readonly type: "string";
230
+ readonly optional: true;
231
+ };
232
+ readonly outcome: {
233
+ readonly type: "string";
234
+ };
235
+ readonly safe_code: {
236
+ readonly type: "string";
237
+ readonly optional: true;
238
+ };
239
+ readonly revision: {
240
+ readonly type: "number";
241
+ };
242
+ readonly occurred_at: {
243
+ readonly type: "date";
244
+ };
245
+ readonly settled_at: {
246
+ readonly type: "date";
247
+ readonly optional: true;
248
+ };
249
+ readonly retention_expires_at: {
250
+ readonly type: "date";
251
+ };
252
+ readonly created_at: {
253
+ readonly type: "date";
254
+ };
255
+ readonly updated_at: {
256
+ readonly type: "date";
257
+ };
258
+ };
259
+ readonly uniqueKeys: readonly [readonly ["guild_id", "claim_key"]];
260
+ readonly readableFields: readonly ["claim_key", "guild_id", "rule_id", "rule_revision", "configuration_revision", "subject_user_id", "channel_id", "message_id", "category", "action_family", "source", "request_fingerprint", "moderation_case_id", "repeat_ordinal", "selected_action", "outcome", "safe_code", "revision", "occurred_at", "settled_at", "retention_expires_at", "created_at", "updated_at"];
261
+ readonly writableFields: readonly ["claim_key", "guild_id", "rule_id", "rule_revision", "configuration_revision", "subject_user_id", "channel_id", "message_id", "category", "action_family", "source", "request_fingerprint", "moderation_case_id", "repeat_ordinal", "selected_action", "outcome", "safe_code", "revision", "occurred_at", "settled_at", "retention_expires_at", "created_at", "updated_at"];
262
+ readonly orderKeys: readonly [readonly ["occurred_at", "guild_id", "claim_key"]];
263
+ readonly groupableFields: readonly ["outcome", "source", "rule_id"];
264
+ };
265
+ readonly daily_counts: {
266
+ readonly table: "automod_daily_counts";
267
+ readonly fields: {
268
+ readonly guild_id: {
269
+ readonly type: "string";
270
+ };
271
+ readonly rule_id: {
272
+ readonly type: "string";
273
+ };
274
+ readonly day: {
275
+ readonly type: "string";
276
+ };
277
+ readonly source: {
278
+ readonly type: "string";
279
+ };
280
+ readonly action_type: {
281
+ readonly type: "string";
282
+ };
283
+ readonly observed_count: {
284
+ readonly type: "number";
285
+ };
286
+ readonly last_observed_at: {
287
+ readonly type: "date";
288
+ };
289
+ };
290
+ readonly uniqueKeys: readonly [readonly ["guild_id", "rule_id", "day", "source", "action_type"]];
291
+ readonly readableFields: readonly ["guild_id", "rule_id", "day", "source", "action_type", "observed_count", "last_observed_at"];
292
+ readonly writableFields: readonly ["guild_id", "rule_id", "day", "source", "action_type", "observed_count", "last_observed_at"];
293
+ readonly orderKeys: readonly [readonly ["day", "source", "action_type", "guild_id", "rule_id"]];
294
+ readonly groupableFields: readonly ["source", "action_type"];
295
+ readonly incrementableFields: readonly ["observed_count"];
296
+ readonly maximumFields: readonly ["last_observed_at"];
297
+ };
298
+ };
299
+ //# sourceMappingURL=records.d.ts.map
@@ -0,0 +1,288 @@
1
+ export const automodRecords = {
2
+ rules: {
3
+ table: "automod_rules",
4
+ fields: {
5
+ rule_id: { type: "string" },
6
+ guild_id: { type: "string" },
7
+ name: { type: "string" },
8
+ name_key: { type: "string" },
9
+ category: { type: "string" },
10
+ rule_kind: { type: "string" },
11
+ status: { type: "string" },
12
+ document_json: { type: "json" },
13
+ native_rule_id: { type: "string", optional: true },
14
+ native_fingerprint: { type: "string", optional: true },
15
+ operation_key: { type: "string" },
16
+ configuration_revision: { type: "string" },
17
+ revision: { type: "number" },
18
+ created_by_user_id: { type: "string", optional: true },
19
+ updated_by_user_id: { type: "string", optional: true },
20
+ created_at: { type: "date" },
21
+ updated_at: { type: "date" },
22
+ },
23
+ ownedSetLimit: 100,
24
+ uniqueKeys: [
25
+ ["rule_id"],
26
+ ["guild_id", "rule_id"],
27
+ ["guild_id", "name_key"],
28
+ ["guild_id", "native_rule_id"],
29
+ ],
30
+ readableFields: [
31
+ "rule_id",
32
+ "guild_id",
33
+ "name",
34
+ "name_key",
35
+ "category",
36
+ "rule_kind",
37
+ "status",
38
+ "document_json",
39
+ "native_rule_id",
40
+ "native_fingerprint",
41
+ "operation_key",
42
+ "configuration_revision",
43
+ "revision",
44
+ "created_by_user_id",
45
+ "updated_by_user_id",
46
+ "created_at",
47
+ "updated_at",
48
+ ],
49
+ writableFields: [
50
+ "rule_id",
51
+ "guild_id",
52
+ "name",
53
+ "name_key",
54
+ "category",
55
+ "rule_kind",
56
+ "status",
57
+ "document_json",
58
+ "native_rule_id",
59
+ "native_fingerprint",
60
+ "operation_key",
61
+ "configuration_revision",
62
+ "revision",
63
+ "created_by_user_id",
64
+ "updated_by_user_id",
65
+ "created_at",
66
+ "updated_at",
67
+ ],
68
+ orderKeys: [
69
+ ["updated_at", "rule_id"],
70
+ ["name_key", "rule_id"],
71
+ ],
72
+ groupableFields: ["guild_id", "status", "category", "rule_kind"],
73
+ searchableFields: ["name", "name_key"],
74
+ },
75
+ action_receipts: {
76
+ table: "automod_action_receipts",
77
+ fields: {
78
+ receipt_id: { type: "string" },
79
+ guild_id: { type: "string" },
80
+ event_key: { type: "string" },
81
+ rule_id: { type: "string" },
82
+ rule_revision: { type: "number" },
83
+ configuration_revision: { type: "string" },
84
+ native_rule_id: { type: "string", optional: true },
85
+ source: { type: "string" },
86
+ detector_version: { type: "string", optional: true },
87
+ scoring_version: { type: "string", optional: true },
88
+ term_id: { type: "string", optional: true },
89
+ detection_method: { type: "string", optional: true },
90
+ confidence_class: { type: "string", optional: true },
91
+ confidence_score: { type: "number", optional: true },
92
+ effective_threshold: { type: "number", optional: true },
93
+ correlation_id: { type: "string", optional: true },
94
+ subject_user_id: { type: "string", optional: true },
95
+ channel_id: { type: "string", optional: true },
96
+ message_id: { type: "string", optional: true },
97
+ alert_system_message_id: { type: "string", optional: true },
98
+ action_type: { type: "string" },
99
+ claim_key: { type: "string" },
100
+ moderation_case_id: { type: "string", optional: true },
101
+ outcome: { type: "string" },
102
+ safe_code: { type: "string", optional: true },
103
+ occurred_at: { type: "date" },
104
+ retention_expires_at: { type: "date" },
105
+ created_at: { type: "date" },
106
+ },
107
+ uniqueKeys: [["receipt_id"], ["guild_id", "event_key"]],
108
+ readableFields: [
109
+ "receipt_id",
110
+ "guild_id",
111
+ "event_key",
112
+ "rule_id",
113
+ "rule_revision",
114
+ "configuration_revision",
115
+ "native_rule_id",
116
+ "source",
117
+ "detector_version",
118
+ "scoring_version",
119
+ "term_id",
120
+ "detection_method",
121
+ "confidence_class",
122
+ "confidence_score",
123
+ "effective_threshold",
124
+ "correlation_id",
125
+ "subject_user_id",
126
+ "channel_id",
127
+ "message_id",
128
+ "alert_system_message_id",
129
+ "action_type",
130
+ "claim_key",
131
+ "moderation_case_id",
132
+ "outcome",
133
+ "safe_code",
134
+ "occurred_at",
135
+ "retention_expires_at",
136
+ "created_at",
137
+ ],
138
+ writableFields: [
139
+ "receipt_id",
140
+ "guild_id",
141
+ "event_key",
142
+ "rule_id",
143
+ "rule_revision",
144
+ "configuration_revision",
145
+ "native_rule_id",
146
+ "source",
147
+ "detector_version",
148
+ "scoring_version",
149
+ "term_id",
150
+ "detection_method",
151
+ "confidence_class",
152
+ "confidence_score",
153
+ "effective_threshold",
154
+ "correlation_id",
155
+ "subject_user_id",
156
+ "channel_id",
157
+ "message_id",
158
+ "alert_system_message_id",
159
+ "action_type",
160
+ "claim_key",
161
+ "moderation_case_id",
162
+ "outcome",
163
+ "safe_code",
164
+ "occurred_at",
165
+ "retention_expires_at",
166
+ "created_at",
167
+ ],
168
+ orderKeys: [["occurred_at", "receipt_id"]],
169
+ groupableFields: ["outcome", "source", "action_type", "rule_id"],
170
+ },
171
+ enforcement_claims: {
172
+ table: "automod_enforcement_claims",
173
+ fields: {
174
+ claim_key: { type: "string" },
175
+ guild_id: { type: "string" },
176
+ rule_id: { type: "string" },
177
+ rule_revision: { type: "number" },
178
+ configuration_revision: { type: "string" },
179
+ subject_user_id: { type: "string", optional: true },
180
+ channel_id: { type: "string", optional: true },
181
+ message_id: { type: "string", optional: true },
182
+ category: { type: "string" },
183
+ action_family: { type: "string" },
184
+ source: { type: "string" },
185
+ request_fingerprint: { type: "string" },
186
+ moderation_case_id: { type: "string", optional: true },
187
+ repeat_ordinal: { type: "number", optional: true },
188
+ selected_action: { type: "string", optional: true },
189
+ outcome: { type: "string" },
190
+ safe_code: { type: "string", optional: true },
191
+ revision: { type: "number" },
192
+ occurred_at: { type: "date" },
193
+ settled_at: { type: "date", optional: true },
194
+ retention_expires_at: { type: "date" },
195
+ created_at: { type: "date" },
196
+ updated_at: { type: "date" },
197
+ },
198
+ uniqueKeys: [["guild_id", "claim_key"]],
199
+ readableFields: [
200
+ "claim_key",
201
+ "guild_id",
202
+ "rule_id",
203
+ "rule_revision",
204
+ "configuration_revision",
205
+ "subject_user_id",
206
+ "channel_id",
207
+ "message_id",
208
+ "category",
209
+ "action_family",
210
+ "source",
211
+ "request_fingerprint",
212
+ "moderation_case_id",
213
+ "repeat_ordinal",
214
+ "selected_action",
215
+ "outcome",
216
+ "safe_code",
217
+ "revision",
218
+ "occurred_at",
219
+ "settled_at",
220
+ "retention_expires_at",
221
+ "created_at",
222
+ "updated_at",
223
+ ],
224
+ writableFields: [
225
+ "claim_key",
226
+ "guild_id",
227
+ "rule_id",
228
+ "rule_revision",
229
+ "configuration_revision",
230
+ "subject_user_id",
231
+ "channel_id",
232
+ "message_id",
233
+ "category",
234
+ "action_family",
235
+ "source",
236
+ "request_fingerprint",
237
+ "moderation_case_id",
238
+ "repeat_ordinal",
239
+ "selected_action",
240
+ "outcome",
241
+ "safe_code",
242
+ "revision",
243
+ "occurred_at",
244
+ "settled_at",
245
+ "retention_expires_at",
246
+ "created_at",
247
+ "updated_at",
248
+ ],
249
+ orderKeys: [["occurred_at", "guild_id", "claim_key"]],
250
+ groupableFields: ["outcome", "source", "rule_id"],
251
+ },
252
+ daily_counts: {
253
+ table: "automod_daily_counts",
254
+ fields: {
255
+ guild_id: { type: "string" },
256
+ rule_id: { type: "string" },
257
+ day: { type: "string" },
258
+ source: { type: "string" },
259
+ action_type: { type: "string" },
260
+ observed_count: { type: "number" },
261
+ last_observed_at: { type: "date" },
262
+ },
263
+ uniqueKeys: [["guild_id", "rule_id", "day", "source", "action_type"]],
264
+ readableFields: [
265
+ "guild_id",
266
+ "rule_id",
267
+ "day",
268
+ "source",
269
+ "action_type",
270
+ "observed_count",
271
+ "last_observed_at",
272
+ ],
273
+ writableFields: [
274
+ "guild_id",
275
+ "rule_id",
276
+ "day",
277
+ "source",
278
+ "action_type",
279
+ "observed_count",
280
+ "last_observed_at",
281
+ ],
282
+ orderKeys: [["day", "source", "action_type", "guild_id", "rule_id"]],
283
+ groupableFields: ["source", "action_type"],
284
+ incrementableFields: ["observed_count"],
285
+ maximumFields: ["last_observed_at"],
286
+ },
287
+ };
288
+ //# sourceMappingURL=records.js.map
@@ -0,0 +1,54 @@
1
+ import type { ModuleRecordValue } from "@helyx/sdk";
2
+ import type { AutoModerationRuleDraft, AutoModerationRuleStatus } from "./domain.js";
3
+ export declare const RULE_FIELDS: readonly ["rule_id", "guild_id", "name", "category", "rule_kind", "status", "document_json", "native_rule_id", "native_fingerprint", "operation_key", "configuration_revision", "revision", "created_by_user_id", "updated_by_user_id", "created_at", "updated_at"];
4
+ export declare const RECEIPT_FIELDS: readonly ["receipt_id", "guild_id", "event_key", "rule_id", "rule_revision", "configuration_revision", "native_rule_id", "source", "detector_version", "scoring_version", "term_id", "detection_method", "confidence_class", "confidence_score", "effective_threshold", "correlation_id", "subject_user_id", "channel_id", "message_id", "alert_system_message_id", "action_type", "claim_key", "moderation_case_id", "outcome", "safe_code", "occurred_at", "created_at"];
5
+ export interface StoredAutoModerationRule {
6
+ ruleId: string;
7
+ guildId: string;
8
+ name: string;
9
+ category: AutoModerationRuleDraft["category"];
10
+ kind: AutoModerationRuleDraft["kind"];
11
+ status: AutoModerationRuleStatus;
12
+ draft: AutoModerationRuleDraft;
13
+ nativeRuleId: string | null;
14
+ nativeFingerprint: string | null;
15
+ operationKey: string;
16
+ configurationRevision: string;
17
+ revision: number;
18
+ createdByUserId: string | null;
19
+ updatedByUserId: string | null;
20
+ createdAt: Date;
21
+ updatedAt: Date;
22
+ }
23
+ export interface StoredAutoModerationReceipt {
24
+ receiptId: string;
25
+ guildId: string;
26
+ eventKey: string;
27
+ ruleId: string;
28
+ ruleRevision: number;
29
+ configurationRevision: string;
30
+ nativeRuleId: string | null;
31
+ source: "native" | "enhanced";
32
+ detectorVersion: string | null;
33
+ scoringVersion: string | null;
34
+ termId: string | null;
35
+ detectionMethod: string | null;
36
+ confidenceClass: string | null;
37
+ confidenceScore: number | null;
38
+ effectiveThreshold: number | null;
39
+ correlationId: string | null;
40
+ subjectUserId: string | null;
41
+ channelId: string | null;
42
+ messageId: string | null;
43
+ alertSystemMessageId: string | null;
44
+ actionType: string;
45
+ claimKey: string;
46
+ moderationCaseId: string | null;
47
+ outcome: string;
48
+ safeCode: string | null;
49
+ occurredAt: Date;
50
+ createdAt: Date;
51
+ }
52
+ export declare function mapRule(row: Readonly<Record<string, ModuleRecordValue>>): StoredAutoModerationRule;
53
+ export declare function mapReceipt(row: Readonly<Record<string, ModuleRecordValue>>): StoredAutoModerationReceipt;
54
+ //# sourceMappingURL=repository-model.d.ts.map