@atproto/ozone 0.4.3 → 0.5.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 (161) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/api/inbox/appealActionedSubject.d.ts +4 -0
  3. package/dist/api/inbox/appealActionedSubject.d.ts.map +1 -0
  4. package/dist/api/inbox/appealActionedSubject.js +60 -0
  5. package/dist/api/inbox/appealActionedSubject.js.map +1 -0
  6. package/dist/api/index.d.ts.map +1 -1
  7. package/dist/api/index.js +2 -0
  8. package/dist/api/index.js.map +1 -1
  9. package/dist/api/queue/createQueue.d.ts.map +1 -1
  10. package/dist/api/queue/createQueue.js +22 -17
  11. package/dist/api/queue/createQueue.js.map +1 -1
  12. package/dist/api/queue/updateQueue.d.ts.map +1 -1
  13. package/dist/api/queue/updateQueue.js +33 -18
  14. package/dist/api/queue/updateQueue.js.map +1 -1
  15. package/dist/assignment/index.d.ts +1 -0
  16. package/dist/assignment/index.d.ts.map +1 -1
  17. package/dist/assignment/index.js +5 -0
  18. package/dist/assignment/index.js.map +1 -1
  19. package/dist/config/config.d.ts +11 -0
  20. package/dist/config/config.d.ts.map +1 -1
  21. package/dist/config/config.js +4 -0
  22. package/dist/config/config.js.map +1 -1
  23. package/dist/config/env.d.ts +1 -0
  24. package/dist/config/env.d.ts.map +1 -1
  25. package/dist/config/env.js +1 -0
  26. package/dist/config/env.js.map +1 -1
  27. package/dist/daemon/stats-computer.d.ts +2 -8
  28. package/dist/daemon/stats-computer.d.ts.map +1 -1
  29. package/dist/daemon/stats-computer.js +21 -9
  30. package/dist/daemon/stats-computer.js.map +1 -1
  31. package/dist/db/migrations/20260219T164523000Z-create-report-table.js +2 -2
  32. package/dist/db/migrations/20260219T164523000Z-create-report-table.js.map +1 -1
  33. package/dist/db/migrations/20260810T000000000Z-add-report-stats-components.d.ts +4 -0
  34. package/dist/db/migrations/20260810T000000000Z-add-report-stats-components.d.ts.map +1 -0
  35. package/dist/db/migrations/20260810T000000000Z-add-report-stats-components.js +31 -0
  36. package/dist/db/migrations/20260810T000000000Z-add-report-stats-components.js.map +1 -0
  37. package/dist/db/migrations/20260922T153505234Z-add-report-closed-at-index.d.ts +4 -0
  38. package/dist/db/migrations/20260922T153505234Z-add-report-closed-at-index.d.ts.map +1 -0
  39. package/dist/db/migrations/20260922T153505234Z-add-report-closed-at-index.js +14 -0
  40. package/dist/db/migrations/20260922T153505234Z-add-report-closed-at-index.js.map +1 -0
  41. package/dist/db/migrations/20260928T000000000Z-inbox-appeal.d.ts +4 -0
  42. package/dist/db/migrations/20260928T000000000Z-inbox-appeal.d.ts.map +1 -0
  43. package/dist/db/migrations/20260928T000000000Z-inbox-appeal.js +25 -0
  44. package/dist/db/migrations/20260928T000000000Z-inbox-appeal.js.map +1 -0
  45. package/dist/db/migrations/index.d.ts +3 -0
  46. package/dist/db/migrations/index.d.ts.map +1 -1
  47. package/dist/db/migrations/index.js +3 -0
  48. package/dist/db/migrations/index.js.map +1 -1
  49. package/dist/db/schema/report.js.map +1 -1
  50. package/dist/db/schema/report_queue.d.ts +1 -0
  51. package/dist/db/schema/report_queue.d.ts.map +1 -1
  52. package/dist/db/schema/report_queue.js.map +1 -1
  53. package/dist/db/schema/report_stat.d.ts +11 -1
  54. package/dist/db/schema/report_stat.d.ts.map +1 -1
  55. package/dist/db/schema/report_stat.js.map +1 -1
  56. package/dist/inbox/appeal.d.ts +187 -0
  57. package/dist/inbox/appeal.d.ts.map +1 -0
  58. package/dist/inbox/appeal.js +340 -0
  59. package/dist/inbox/appeal.js.map +1 -0
  60. package/dist/inbox/views.d.ts +92 -0
  61. package/dist/inbox/views.d.ts.map +1 -0
  62. package/dist/inbox/views.js +313 -0
  63. package/dist/inbox/views.js.map +1 -0
  64. package/dist/lexicons/app/bsky/authFullApp.defs.d.ts.map +1 -1
  65. package/dist/lexicons/app/bsky/authFullApp.defs.js +10 -0
  66. package/dist/lexicons/app/bsky/authFullApp.defs.js.map +1 -1
  67. package/dist/lexicons/app/bsky/authManageNotifications.defs.d.ts.map +1 -1
  68. package/dist/lexicons/app/bsky/authManageNotifications.defs.js +1 -0
  69. package/dist/lexicons/app/bsky/authManageNotifications.defs.js.map +1 -1
  70. package/dist/lexicons/app/bsky/feed/defs.defs.d.ts +8 -0
  71. package/dist/lexicons/app/bsky/feed/defs.defs.d.ts.map +1 -1
  72. package/dist/lexicons/app/bsky/feed/defs.defs.js +2 -0
  73. package/dist/lexicons/app/bsky/feed/defs.defs.js.map +1 -1
  74. package/dist/lexicons/app/bsky/feed/getListFeed.defs.d.ts +4 -0
  75. package/dist/lexicons/app/bsky/feed/getListFeed.defs.d.ts.map +1 -1
  76. package/dist/lexicons/app/bsky/feed/getListFeed.defs.js +2 -0
  77. package/dist/lexicons/app/bsky/feed/getListFeed.defs.js.map +1 -1
  78. package/dist/lexicons/app/bsky/feed/getQuotes.defs.d.ts +6 -0
  79. package/dist/lexicons/app/bsky/feed/getQuotes.defs.d.ts.map +1 -1
  80. package/dist/lexicons/app/bsky/feed/getQuotes.defs.js +2 -0
  81. package/dist/lexicons/app/bsky/feed/getQuotes.defs.js.map +1 -1
  82. package/dist/lexicons/app/bsky/feed/getTimeline.defs.d.ts +4 -0
  83. package/dist/lexicons/app/bsky/feed/getTimeline.defs.d.ts.map +1 -1
  84. package/dist/lexicons/app/bsky/feed/getTimeline.defs.js +2 -0
  85. package/dist/lexicons/app/bsky/feed/getTimeline.defs.js.map +1 -1
  86. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.d.ts +3 -0
  87. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.d.ts.map +1 -0
  88. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.defs.d.ts +299 -0
  89. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.defs.d.ts.map +1 -0
  90. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.defs.js +231 -0
  91. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.defs.js.map +1 -0
  92. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.js +6 -0
  93. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.js.map +1 -0
  94. package/dist/lexicons/app/bsky/notification.d.ts +1 -0
  95. package/dist/lexicons/app/bsky/notification.d.ts.map +1 -1
  96. package/dist/lexicons/app/bsky/notification.js +1 -0
  97. package/dist/lexicons/app/bsky/notification.js.map +1 -1
  98. package/dist/lexicons/tools/ozone/inbox/appealActionedSubject.d.ts +3 -0
  99. package/dist/lexicons/tools/ozone/inbox/appealActionedSubject.d.ts.map +1 -0
  100. package/dist/lexicons/tools/ozone/inbox/appealActionedSubject.defs.d.ts +65 -0
  101. package/dist/lexicons/tools/ozone/inbox/appealActionedSubject.defs.d.ts.map +1 -0
  102. package/dist/lexicons/tools/ozone/inbox/appealActionedSubject.defs.js +49 -0
  103. package/dist/lexicons/tools/ozone/inbox/appealActionedSubject.defs.js.map +1 -0
  104. package/dist/lexicons/tools/ozone/inbox/appealActionedSubject.js +6 -0
  105. package/dist/lexicons/tools/ozone/inbox/appealActionedSubject.js.map +1 -0
  106. package/dist/lexicons/tools/ozone/inbox/defs.d.ts +2 -0
  107. package/dist/lexicons/tools/ozone/inbox/defs.d.ts.map +1 -0
  108. package/dist/lexicons/tools/ozone/inbox/defs.defs.d.ts +89 -0
  109. package/dist/lexicons/tools/ozone/inbox/defs.defs.d.ts.map +1 -0
  110. package/dist/lexicons/tools/ozone/inbox/defs.defs.js +73 -0
  111. package/dist/lexicons/tools/ozone/inbox/defs.defs.js.map +1 -0
  112. package/dist/lexicons/tools/ozone/inbox/defs.js +5 -0
  113. package/dist/lexicons/tools/ozone/inbox/defs.js.map +1 -0
  114. package/dist/lexicons/tools/ozone/inbox.d.ts +3 -0
  115. package/dist/lexicons/tools/ozone/inbox.d.ts.map +1 -0
  116. package/dist/lexicons/tools/ozone/inbox.js +6 -0
  117. package/dist/lexicons/tools/ozone/inbox.js.map +1 -0
  118. package/dist/lexicons/tools/ozone/queue/createQueue.defs.d.ts +2 -0
  119. package/dist/lexicons/tools/ozone/queue/createQueue.defs.d.ts.map +1 -1
  120. package/dist/lexicons/tools/ozone/queue/createQueue.defs.js +2 -0
  121. package/dist/lexicons/tools/ozone/queue/createQueue.defs.js.map +1 -1
  122. package/dist/lexicons/tools/ozone/queue/defs.defs.d.ts +4 -0
  123. package/dist/lexicons/tools/ozone/queue/defs.defs.d.ts.map +1 -1
  124. package/dist/lexicons/tools/ozone/queue/defs.defs.js +2 -0
  125. package/dist/lexicons/tools/ozone/queue/defs.defs.js.map +1 -1
  126. package/dist/lexicons/tools/ozone/queue/updateQueue.defs.d.ts +3 -1
  127. package/dist/lexicons/tools/ozone/queue/updateQueue.defs.d.ts.map +1 -1
  128. package/dist/lexicons/tools/ozone/queue/updateQueue.defs.js +3 -0
  129. package/dist/lexicons/tools/ozone/queue/updateQueue.defs.js.map +1 -1
  130. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts +89 -9
  131. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts.map +1 -1
  132. package/dist/lexicons/tools/ozone/report/defs.defs.js +20 -0
  133. package/dist/lexicons/tools/ozone/report/defs.defs.js.map +1 -1
  134. package/dist/lexicons/tools/ozone/report/getLiveStats.defs.d.ts +1 -1
  135. package/dist/lexicons/tools/ozone/report/getLiveStats.defs.d.ts.map +1 -1
  136. package/dist/lexicons/tools/ozone/report/getLiveStats.defs.js +1 -1
  137. package/dist/lexicons/tools/ozone/report/getLiveStats.defs.js.map +1 -1
  138. package/dist/lexicons/tools/ozone/report/refreshStats.defs.d.ts +1 -1
  139. package/dist/lexicons/tools/ozone/report/refreshStats.defs.d.ts.map +1 -1
  140. package/dist/lexicons/tools/ozone/report/refreshStats.defs.js +1 -1
  141. package/dist/lexicons/tools/ozone/report/refreshStats.defs.js.map +1 -1
  142. package/dist/lexicons/tools/ozone.d.ts +1 -0
  143. package/dist/lexicons/tools/ozone.d.ts.map +1 -1
  144. package/dist/lexicons/tools/ozone.js +1 -0
  145. package/dist/lexicons/tools/ozone.js.map +1 -1
  146. package/dist/mod-service/index.d.ts +2 -0
  147. package/dist/mod-service/index.d.ts.map +1 -1
  148. package/dist/mod-service/index.js +6 -3
  149. package/dist/mod-service/index.js.map +1 -1
  150. package/dist/queue/service.d.ts +16 -3
  151. package/dist/queue/service.d.ts.map +1 -1
  152. package/dist/queue/service.js +81 -27
  153. package/dist/queue/service.js.map +1 -1
  154. package/dist/report/stats.d.ts +25 -31
  155. package/dist/report/stats.d.ts.map +1 -1
  156. package/dist/report/stats.js +269 -175
  157. package/dist/report/stats.js.map +1 -1
  158. package/dist/report/views.d.ts.map +1 -1
  159. package/dist/report/views.js +20 -0
  160. package/dist/report/views.js.map +1 -1
  161. package/package.json +13 -13
@@ -0,0 +1,31 @@
1
+ export async function up(db) {
2
+ await db.schema
3
+ .alterTable('report_stat')
4
+ .addColumn('closedCount', 'integer')
5
+ .addColumn('acknowledgedCount', 'integer')
6
+ .addColumn('labelActionCount', 'integer')
7
+ .addColumn('tagActionCount', 'integer')
8
+ .addColumn('takedownActionCount', 'integer')
9
+ .addColumn('ahtDurationSec', 'bigint')
10
+ .addColumn('ahtSampleCount', 'integer')
11
+ .addColumn('resolutionDurationSec', 'bigint')
12
+ .addColumn('resolutionSampleCount', 'integer')
13
+ .addColumn('avgResolutionTimeSec', 'integer')
14
+ .execute();
15
+ }
16
+ export async function down(db) {
17
+ await db.schema
18
+ .alterTable('report_stat')
19
+ .dropColumn('closedCount')
20
+ .dropColumn('acknowledgedCount')
21
+ .dropColumn('labelActionCount')
22
+ .dropColumn('tagActionCount')
23
+ .dropColumn('takedownActionCount')
24
+ .dropColumn('ahtDurationSec')
25
+ .dropColumn('ahtSampleCount')
26
+ .dropColumn('resolutionDurationSec')
27
+ .dropColumn('resolutionSampleCount')
28
+ .dropColumn('avgResolutionTimeSec')
29
+ .execute();
30
+ }
31
+ //# sourceMappingURL=20260810T000000000Z-add-report-stats-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20260810T000000000Z-add-report-stats-components.js","sourceRoot":"","sources":["../../../src/db/migrations/20260810T000000000Z-add-report-stats-components.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,EAAmB;IAC1C,MAAM,EAAE,CAAC,MAAM;SACZ,UAAU,CAAC,aAAa,CAAC;SACzB,SAAS,CAAC,aAAa,EAAE,SAAS,CAAC;SACnC,SAAS,CAAC,mBAAmB,EAAE,SAAS,CAAC;SACzC,SAAS,CAAC,kBAAkB,EAAE,SAAS,CAAC;SACxC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC;SACtC,SAAS,CAAC,qBAAqB,EAAE,SAAS,CAAC;SAC3C,SAAS,CAAC,gBAAgB,EAAE,QAAQ,CAAC;SACrC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC;SACtC,SAAS,CAAC,uBAAuB,EAAE,QAAQ,CAAC;SAC5C,SAAS,CAAC,uBAAuB,EAAE,SAAS,CAAC;SAC7C,SAAS,CAAC,sBAAsB,EAAE,SAAS,CAAC;SAC5C,OAAO,EAAE,CAAA;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,EAAmB;IAC5C,MAAM,EAAE,CAAC,MAAM;SACZ,UAAU,CAAC,aAAa,CAAC;SACzB,UAAU,CAAC,aAAa,CAAC;SACzB,UAAU,CAAC,mBAAmB,CAAC;SAC/B,UAAU,CAAC,kBAAkB,CAAC;SAC9B,UAAU,CAAC,gBAAgB,CAAC;SAC5B,UAAU,CAAC,qBAAqB,CAAC;SACjC,UAAU,CAAC,gBAAgB,CAAC;SAC5B,UAAU,CAAC,gBAAgB,CAAC;SAC5B,UAAU,CAAC,uBAAuB,CAAC;SACnC,UAAU,CAAC,uBAAuB,CAAC;SACnC,UAAU,CAAC,sBAAsB,CAAC;SAClC,OAAO,EAAE,CAAA;AACd,CAAC","sourcesContent":["import type { Kysely } from 'kysely'\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .alterTable('report_stat')\n .addColumn('closedCount', 'integer')\n .addColumn('acknowledgedCount', 'integer')\n .addColumn('labelActionCount', 'integer')\n .addColumn('tagActionCount', 'integer')\n .addColumn('takedownActionCount', 'integer')\n .addColumn('ahtDurationSec', 'bigint')\n .addColumn('ahtSampleCount', 'integer')\n .addColumn('resolutionDurationSec', 'bigint')\n .addColumn('resolutionSampleCount', 'integer')\n .addColumn('avgResolutionTimeSec', 'integer')\n .execute()\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .alterTable('report_stat')\n .dropColumn('closedCount')\n .dropColumn('acknowledgedCount')\n .dropColumn('labelActionCount')\n .dropColumn('tagActionCount')\n .dropColumn('takedownActionCount')\n .dropColumn('ahtDurationSec')\n .dropColumn('ahtSampleCount')\n .dropColumn('resolutionDurationSec')\n .dropColumn('resolutionSampleCount')\n .dropColumn('avgResolutionTimeSec')\n .execute()\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { Kysely } from 'kysely';
2
+ export declare function up(db: Kysely<unknown>): Promise<void>;
3
+ export declare function down(db: Kysely<unknown>): Promise<void>;
4
+ //# sourceMappingURL=20260922T153505234Z-add-report-closed-at-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20260922T153505234Z-add-report-closed-at-index.d.ts","sourceRoot":"","sources":["../../../src/db/migrations/20260922T153505234Z-add-report-closed-at-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,wBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAS3D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D"}
@@ -0,0 +1,14 @@
1
+ export async function up(db) {
2
+ // @NOTE Daily closure statistics filter by closedAt rather than createdAt.
3
+ // Index only closed reports so date-range queries can avoid scanning report history.
4
+ await db.schema
5
+ .createIndex('idx_report_closed_at')
6
+ .on('report')
7
+ .column('closedAt')
8
+ .where('closedAt', 'is not', null)
9
+ .execute();
10
+ }
11
+ export async function down(db) {
12
+ await db.schema.dropIndex('idx_report_closed_at').execute();
13
+ }
14
+ //# sourceMappingURL=20260922T153505234Z-add-report-closed-at-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20260922T153505234Z-add-report-closed-at-index.js","sourceRoot":"","sources":["../../../src/db/migrations/20260922T153505234Z-add-report-closed-at-index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,EAAmB;IAC1C,2EAA2E;IAC3E,qFAAqF;IACrF,MAAM,EAAE,CAAC,MAAM;SACZ,WAAW,CAAC,sBAAsB,CAAC;SACnC,EAAE,CAAC,QAAQ,CAAC;SACZ,MAAM,CAAC,UAAU,CAAC;SAClB,KAAK,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC;SACjC,OAAO,EAAE,CAAA;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,EAAmB;IAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,OAAO,EAAE,CAAA;AAC7D,CAAC","sourcesContent":["import type { Kysely } from 'kysely'\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n // @NOTE Daily closure statistics filter by closedAt rather than createdAt.\n // Index only closed reports so date-range queries can avoid scanning report history.\n await db.schema\n .createIndex('idx_report_closed_at')\n .on('report')\n .column('closedAt')\n .where('closedAt', 'is not', null)\n .execute()\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await db.schema.dropIndex('idx_report_closed_at').execute()\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { type Kysely } from 'kysely';
2
+ export declare function up(db: Kysely<unknown>): Promise<void>;
3
+ export declare function down(db: Kysely<unknown>): Promise<void>;
4
+ //# sourceMappingURL=20260928T000000000Z-inbox-appeal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20260928T000000000Z-inbox-appeal.d.ts","sourceRoot":"","sources":["../../../src/db/migrations/20260928T000000000Z-inbox-appeal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAO,MAAM,QAAQ,CAAA;AAEzC,wBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB3D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7D"}
@@ -0,0 +1,25 @@
1
+ import { sql } from 'kysely';
2
+ export async function up(db) {
3
+ await db.schema
4
+ .alterTable('report_queue')
5
+ .addColumn('recommendedLabels', 'jsonb', (col) => col.notNull().defaultTo(sql `'[]'::jsonb`))
6
+ .execute();
7
+ // @NOTE: This index should be created CONCURRENTLY in production. Kysely's
8
+ // migration transaction does not support that option.
9
+ // Appeal lookups span open and closed reports - a record gets one appeal
10
+ // ever, so a closed one still blocks - which the existing partial indexes on
11
+ // report deliberately do not cover.
12
+ await sql `
13
+ CREATE INDEX IF NOT EXISTS idx_report_appeal_subject
14
+ ON report (did, "recordPath", id DESC)
15
+ WHERE "reportType" = 'tools.ozone.report.defs#reasonAppeal'
16
+ `.execute(db);
17
+ }
18
+ export async function down(db) {
19
+ await db.schema.dropIndex('idx_report_appeal_subject').ifExists().execute();
20
+ await db.schema
21
+ .alterTable('report_queue')
22
+ .dropColumn('recommendedLabels')
23
+ .execute();
24
+ }
25
+ //# sourceMappingURL=20260928T000000000Z-inbox-appeal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20260928T000000000Z-inbox-appeal.js","sourceRoot":"","sources":["../../../src/db/migrations/20260928T000000000Z-inbox-appeal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEzC,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,EAAmB;IAC1C,MAAM,EAAE,CAAC,MAAM;SACZ,UAAU,CAAC,cAAc,CAAC;SAC1B,SAAS,CAAC,mBAAmB,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAC/C,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,GAAG,CAAA,aAAa,CAAC,CAC1C;SACA,OAAO,EAAE,CAAA;IAEZ,2EAA2E;IAC3E,sDAAsD;IACtD,yEAAyE;IACzE,6EAA6E;IAC7E,oCAAoC;IACpC,MAAM,GAAG,CAAA;;;;GAIR,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,EAAmB;IAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAA;IAC3E,MAAM,EAAE,CAAC,MAAM;SACZ,UAAU,CAAC,cAAc,CAAC;SAC1B,UAAU,CAAC,mBAAmB,CAAC;SAC/B,OAAO,EAAE,CAAA;AACd,CAAC","sourcesContent":["import { type Kysely, sql } from 'kysely'\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n await db.schema\n .alterTable('report_queue')\n .addColumn('recommendedLabels', 'jsonb', (col) =>\n col.notNull().defaultTo(sql`'[]'::jsonb`),\n )\n .execute()\n\n // @NOTE: This index should be created CONCURRENTLY in production. Kysely's\n // migration transaction does not support that option.\n // Appeal lookups span open and closed reports - a record gets one appeal\n // ever, so a closed one still blocks - which the existing partial indexes on\n // report deliberately do not cover.\n await sql`\n CREATE INDEX IF NOT EXISTS idx_report_appeal_subject\n ON report (did, \"recordPath\", id DESC)\n WHERE \"reportType\" = 'tools.ozone.report.defs#reasonAppeal'\n `.execute(db)\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await db.schema.dropIndex('idx_report_appeal_subject').ifExists().execute()\n await db.schema\n .alterTable('report_queue')\n .dropColumn('recommendedLabels')\n .execute()\n}\n"]}
@@ -41,4 +41,7 @@ export * as _20260602T120000000Z from './20260602T120000000Z-add-report-activity
41
41
  export * as _20260617T210022765Z from './20260617T210022765Z-add-report-isautomated.js';
42
42
  export * as _20260720T000000000Z from './20260720T000000000Z-add-convo-subjects-to-stats-views.js';
43
43
  export * as _20260731T000000000Z from './20260731T000000000Z-add-recommended-policies-to-report-queue.js';
44
+ export * as _20260810T000000000Z from './20260810T000000000Z-add-report-stats-components.js';
45
+ export * as _20260922T153505234Z from './20260922T153505234Z-add-report-closed-at-index.js';
46
+ export * as _20260928T000000000Z from './20260928T000000000Z-inbox-appeal.js';
44
47
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/migrations/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,oBAAoB,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,oBAAoB,MAAM,iDAAiD,CAAA;AACvF,OAAO,KAAK,oBAAoB,MAAM,0CAA0C,CAAA;AAChF,OAAO,KAAK,oBAAoB,MAAM,gEAAgE,CAAA;AACtG,OAAO,KAAK,oBAAoB,MAAM,yCAAyC,CAAA;AAC/E,OAAO,KAAK,oBAAoB,MAAM,yCAAyC,CAAA;AAC/E,OAAO,KAAK,oBAAoB,MAAM,0CAA0C,CAAA;AAChF,OAAO,KAAK,oBAAoB,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,oBAAoB,MAAM,iDAAiD,CAAA;AACvF,OAAO,KAAK,oBAAoB,MAAM,4CAA4C,CAAA;AAClF,OAAO,KAAK,oBAAoB,MAAM,gDAAgD,CAAA;AACtF,OAAO,KAAK,oBAAoB,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,oBAAoB,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,oBAAoB,MAAM,kCAAkC,CAAA;AACxE,O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260617T210022765Z-add-report-isautomated.js';
45
45
  export * as _20260720T000000000Z from './20260720T000000000Z-add-convo-subjects-to-stats-views.js';
46
46
  export * as _20260731T000000000Z from './20260731T000000000Z-add-recommended-policies-to-report-queue.js';
47
+ export * as _20260810T000000000Z from './20260810T000000000Z-add-report-stats-components.js';
48
+ export * as _20260922T153505234Z from './20260922T153505234Z-add-report-closed-at-index.js';
49
+ export * as _20260928T000000000Z from './20260928T000000000Z-inbox-appeal.js';
47
50
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/migrations/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,gGAAgG;AAChG,+FAA+F;AAE/F,OAAO,KAAK,oBAAoB,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,oBAAoB,MAAM,iDAAiD,CAAA;AACvF,OAAO,KAAK,oBAAoB,MAAM,0CAA0C,CAAA;AAChF,OAAO,KAAK,oBAAoB,MAAM,gEAAgE,CAAA;AACtG,OAAO,KAAK,oBAAoB,MAAM,yCAAyC,CAAA;AAC/E,OAAO,KAAK,oBAAoB,MAAM,yCAAyC,CAAA;AAC/E,OAAO,KAAK,oBAAoB,MAAM,0CAA0C,CAAA;AAChF,OAAO,KAAK,oBAAoB,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,oBAAoB,MAAM,iDAAiD,CAAA;AACvF,OAAO,KAAK,oBAAoB,MAAM,4CAA4C,CAAA;AAClF,OAAO,KAAK,oBAAoB,MAAM,gDAAgD,CAAA;AACtF,OAAO,KAAK,oBAAoB,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,oBAAoB,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,oBAAoB,MAAM,kCAAkC,CAAA;AACxE,OAAO,KAAK,oBAAoB,MAAM,+DAA+D,CAAA;AACrG,OAAO,KAAK,oBAAoB,MAAM,mDAAmD,CAAA;AACzF,OAAO,KAAK,oBAAoB,MAAM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AAmE,CAAA","sourcesContent":["// NOTE this file can be edited by hand, but it is also appended to by the migration:create command.\n// It's important that every migration is exported from here with the proper name. We'd simplify\n// this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process.\n\nexport * as _20231219T205730722Z from './20231219T205730722Z-init.js'\nexport * as _20240116T085607200Z from './20240116T085607200Z-communication-template.js'\nexport * as _20240201T051104136Z from './20240201T051104136Z-mod-event-blobs.js'\nexport * as _20240208T213404429Z from './20240208T213404429Z-add-tags-column-to-moderation-subject.js'\nexport * as _20240228T003647759Z from './20240228T003647759Z-add-label-sigs.js'\nexport * as _20240408T192432676Z from './20240408T192432676Z-mute-reporting.js'\nexport * as _20240506T225055595Z from './20240506T225055595Z-message-subject.js'\nexport * as _20240430T211332580Z from './20240521T211332580Z-member.js'\nexport * as _20240814T003647759Z from './20240814T003647759Z-event-created-at-index.js'\nexport * as _20240903T205730722Z from './20240903T205730722Z-add-template-lang.js'\nexport * as _20240904T205730722Z from './20240904T205730722Z-add-subject-did-index.js'\nexport * as _20241001T205730722Z from './20241001T205730722Z-subject-status-review-state-index.js'\nexport * as _20241008T205730722Z from './20241008T205730722Z-sets.js'\nexport * as _20241018T205730722Z from './20241018T205730722Z-setting.js'\nexport * as _20241026T205730722Z from './20241026T205730722Z-add-hosting-status-to-subject-status.js'\nexport * as _20241220T144630860Z from './20241220T144630860Z-stats-materialized-views.js'\nexport * as _20250204T003647759Z from './20250204T003647759Z-add-subject-priority-score.js'\nexport * as _20250211T003647759Z from './20250211T003647759Z-add-reporter-stats-index.js'\nexport * as _20250211T132135150Z from './20250211T132135150Z-moderation-event-message-partial-idx.js'\nexport * as _20250221T132135150Z from './20250221T132135150Z-member-details.js'\nexport * as _20250404T201720309Z from './20250404T201720309Z-subject-status-sort-idxs.js'\nexport * as _20250415T201720309Z from './20250415T201720309Z-verification.js'\nexport * as _20250417T201720309Z from './20250417T201720309Z-firehose-cursor.js'\nexport * as _20250609T110704000Z from './20250609T110704000Z-safelink.js'\nexport * as _20250618T180246000Z from './20250618T180246000Z-add-mod-tool-to-moderation-event.js'\nexport * as _20250701T000000000Z from './20250701T000000000Z-add-age-assurance-state.js'\nexport * as _20250715T000000000Z from './20250715T000000000Z-add-mod-event-external-id.js'\nexport * as _20250718T150931000Z from './20250718T150931000Z-update-appeal-reason-stats.js'\nexport * as _20250813T000000000Z from './20250813T000000000Z-mod-tool-batch-id-index.js'\nexport * as _20250923T000000000Z from './20250923T000000000Z-scheduled-actions.js'\nexport * as _20251008T120000000Z from './20251008T120000000Z-add-strike-system.js'\nexport * as _20260210T154806448Z from './20260210T154806448Z-mod-event-created-by-indexes.js'\nexport * as _20260219T164523000Z from './20260219T164523000Z-create-report-table.js'\nexport * as _20260219T165302248Z from './20260219T165302248Z-moderator-assignment.js'\nexport * as _20260225T000000000Z from './20260225T000000000Z-add-report-queue-table.js'\nexport * as _20260313T000000000Z from './20260313T000000000Z-add-report-activity-table.js'\nexport * as _20260318T152058935Z from './20260318T152058935Z-add-report-stat.js'\nexport * as _20260428T000000000Z from './20260428T000000000Z-add-expiring-tag-table.js'\nexport * as _20260513T202941104Z from './20260513T202941104Z-add-subject-convo-id.js'\nexport * as _20260602T120000000Z from './20260602T120000000Z-add-report-activity-created-index.js'\nexport * as _20260617T210022765Z from './20260617T210022765Z-add-report-isautomated.js'\nexport * as _20260720T000000000Z from './20260720T000000000Z-add-convo-subjects-to-stats-views.js'\nexport * as _20260731T000000000Z from './20260731T000000000Z-add-recommended-policies-to-report-queue.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/migrations/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,gGAAgG;AAChG,+FAA+F;AAE/F,OAAO,KAAK,oBAAoB,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,oBAAoB,MAAM,iDAAiD,CAAA;AACvF,OAAO,KAAK,oBAAoB,MAAM,0CAA0C,CAAA;AAChF,OAAO,KAAK,oBAAoB,MAAM,gEAAgE,CAAA;AAC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OAAO,KAAK,oBAAoB,MAAM,4CAA4C,CAAA;AAClF,OAAO,KAAK,oBAAoB,MAAM,uDAAuD,CAAA;AAC7F,OAAO,KAAK,oBAAoB,MAAM,8CAA8C,CAAA;AACpF,OAAO,KAAK,oBAAoB,MAAM,+CAA+C,CAAA;AACrF,OAAO,KAAK,oBAAoB,MAAM,iDAAiD,CAAA;AACvF,OAAO,KAAK,oBAAoB,MAAM,oDAAoD,CAAA;AAC1F,OAAO,KAAK,oBAAoB,MAAM,0CAA0C,CAAA;AAChF,OAAO,KAAK,oBAAoB,MAAM,iDAAiD,CAAA;AACvF,OAAO,KAAK,oBAAoB,MAAM,+CAA+C,CAAA;AACrF,OAAO,KAAK,oBAAoB,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,oBAAoB,MAAM,iDAAiD,CAAA;AACvF,OAAO,KAAK,oBAAoB,MAAM,4DAA4D,CAAA;AAClG,OAAO,KAAK,oBAAoB,MAAM,mEAAmE,CAAA;AACzG,OAAO,KAAK,oBAAoB,MAAM,sDAAsD,CAAA;AAC5F,OAAO,KAAK,oBAAoB,MAAM,qDAAqD,CAAA;AAC3F,OAAO,KAAK,oBAAoB,MAAM,uCAAuC,CAAA","sourcesContent":["// NOTE this file can be edited by hand, but it is also appended to by the migration:create command.\n// It's important that every migration is exported from here with the proper name. We'd simplify\n// this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process.\n\nexport * as _20231219T205730722Z from './20231219T205730722Z-init.js'\nexport * as _20240116T085607200Z from './20240116T085607200Z-communication-template.js'\nexport * as _20240201T051104136Z from './20240201T051104136Z-mod-event-blobs.js'\nexport * as _20240208T213404429Z from './20240208T213404429Z-add-tags-column-to-moderation-subject.js'\nexport * as _20240228T003647759Z from './20240228T003647759Z-add-label-sigs.js'\nexport * as _20240408T192432676Z from './20240408T192432676Z-mute-reporting.js'\nexport * as _20240506T225055595Z from './20240506T225055595Z-message-subject.js'\nexport * as _20240430T211332580Z from './20240521T211332580Z-member.js'\nexport * as _20240814T003647759Z from './20240814T003647759Z-event-created-at-index.js'\nexport * as _20240903T205730722Z from './20240903T205730722Z-add-template-lang.js'\nexport * as _20240904T205730722Z from './20240904T205730722Z-add-subject-did-index.js'\nexport * as _20241001T205730722Z from './20241001T205730722Z-subject-status-review-state-index.js'\nexport * as _20241008T205730722Z from './20241008T205730722Z-sets.js'\nexport * as _20241018T205730722Z from './20241018T205730722Z-setting.js'\nexport * as _20241026T205730722Z from './20241026T205730722Z-add-hosting-status-to-subject-status.js'\nexport * as _20241220T144630860Z from './20241220T144630860Z-stats-materialized-views.js'\nexport * as _20250204T003647759Z from './20250204T003647759Z-add-subject-priority-score.js'\nexport * as _20250211T003647759Z from './20250211T003647759Z-add-reporter-stats-index.js'\nexport * as _20250211T132135150Z from './20250211T132135150Z-moderation-event-message-partial-idx.js'\nexport * as _20250221T132135150Z from './20250221T132135150Z-member-details.js'\nexport * as _20250404T201720309Z from './20250404T201720309Z-subject-status-sort-idxs.js'\nexport * as _20250415T201720309Z from './20250415T201720309Z-verification.js'\nexport * as _20250417T201720309Z from './20250417T201720309Z-firehose-cursor.js'\nexport * as _20250609T110704000Z from './20250609T110704000Z-safelink.js'\nexport * as _20250618T180246000Z from './20250618T180246000Z-add-mod-tool-to-moderation-event.js'\nexport * as _20250701T000000000Z from './20250701T000000000Z-add-age-assurance-state.js'\nexport * as _20250715T000000000Z from './20250715T000000000Z-add-mod-event-external-id.js'\nexport * as _20250718T150931000Z from './20250718T150931000Z-update-appeal-reason-stats.js'\nexport * as _20250813T000000000Z from './20250813T000000000Z-mod-tool-batch-id-index.js'\nexport * as _20250923T000000000Z from './20250923T000000000Z-scheduled-actions.js'\nexport * as _20251008T120000000Z from './20251008T120000000Z-add-strike-system.js'\nexport * as _20260210T154806448Z from './20260210T154806448Z-mod-event-created-by-indexes.js'\nexport * as _20260219T164523000Z from './20260219T164523000Z-create-report-table.js'\nexport * as _20260219T165302248Z from './20260219T165302248Z-moderator-assignment.js'\nexport * as _20260225T000000000Z from './20260225T000000000Z-add-report-queue-table.js'\nexport * as _20260313T000000000Z from './20260313T000000000Z-add-report-activity-table.js'\nexport * as _20260318T152058935Z from './20260318T152058935Z-add-report-stat.js'\nexport * as _20260428T000000000Z from './20260428T000000000Z-add-expiring-tag-table.js'\nexport * as _20260513T202941104Z from './20260513T202941104Z-add-subject-convo-id.js'\nexport * as _20260602T120000000Z from './20260602T120000000Z-add-report-activity-created-index.js'\nexport * as _20260617T210022765Z from './20260617T210022765Z-add-report-isautomated.js'\nexport * as _20260720T000000000Z from './20260720T000000000Z-add-convo-subjects-to-stats-views.js'\nexport * as _20260731T000000000Z from './20260731T000000000Z-add-recommended-policies-to-report-queue.js'\nexport * as _20260810T000000000Z from './20260810T000000000Z-add-report-stats-components.js'\nexport * as _20260922T153505234Z from './20260922T153505234Z-add-report-closed-at-index.js'\nexport * as _20260928T000000000Z from './20260928T000000000Z-inbox-appeal.js'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/db/schema/report.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["import type { Generated } from 'kysely'\nimport type { DatetimeString, DidString } from '@atproto/lex'\n\nexport const reportTableName = 'report'\n\nexport interface Report {\n id: Generated<number>\n eventId: number // References moderation_event.id\n queueId: number | null // NULL = not yet assigned, -1 = no matching queue\n queuedAt: DatetimeString | null\n actionEventIds: number[] | null // Array of event IDs, sorted DESC [newest, ..., oldest]\n actionNote: string | null\n isMuted: boolean\n isAutomated: boolean // Denormalized from moderation_event.modTool.meta.isAutomated\n status: string // 'open', 'closed', 'escalated', 'queued', 'assigned'\n reportType: string // Denormalized from moderation_event.meta.reportType\n did: DidString // Denormalized from moderation_event.subjectDid\n recordPath: string // '' = account/message/conversation, 'collection/rkey' = record\n subjectMessageId: string | null // Denormalized from moderation_event.subjectMessageId\n subjectConvoId: string | null // Denormalized from moderation_event.subjectConvoId\n createdAt: DatetimeString\n updatedAt: DatetimeString\n assignedTo: DidString | null // DID of permanently assigned moderator, null if unassigned\n assignedAt: DatetimeString | null // When the permanent assignment was created\n closedAt: DatetimeString | null\n}\n\nexport type PartialDB = {\n [reportTableName]: Report\n}\n"]}
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../src/db/schema/report.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["import type { Generated } from 'kysely'\nimport type { DatetimeString, DidString } from '@atproto/lex'\n\nexport const reportTableName = 'report'\n\nexport interface Report {\n id: Generated<number>\n eventId: number // References moderation_event.id\n queueId: number | null // NULL = not yet assigned, -1 = no matching queue\n queuedAt: DatetimeString | null\n actionEventIds: number[] | null // Event IDs in append order (most recently linked last)\n actionNote: string | null\n isMuted: boolean\n isAutomated: boolean // Denormalized from moderation_event.modTool.meta.isAutomated\n status: string // 'open', 'closed', 'escalated', 'queued', 'assigned'\n reportType: string // Denormalized from moderation_event.meta.reportType\n did: DidString // Denormalized from moderation_event.subjectDid\n recordPath: string // '' = account/message/conversation, 'collection/rkey' = record\n subjectMessageId: string | null // Denormalized from moderation_event.subjectMessageId\n subjectConvoId: string | null // Denormalized from moderation_event.subjectConvoId\n createdAt: DatetimeString\n updatedAt: DatetimeString\n assignedTo: DidString | null // DID of permanently assigned moderator, null if unassigned\n assignedAt: DatetimeString | null // When the permanent assignment was created\n closedAt: DatetimeString | null\n}\n\nexport type PartialDB = {\n [reportTableName]: Report\n}\n"]}
@@ -9,6 +9,7 @@ export interface ReportQueue {
9
9
  reportTypes: string[];
10
10
  description: string | null;
11
11
  recommendedPolicies: string[];
12
+ recommendedLabels: string[];
12
13
  createdBy: DidString | 'admin_token';
13
14
  createdAt: DatetimeString;
14
15
  updatedAt: DatetimeString;
@@ -1 +1 @@
1
- {"version":3,"file":"report_queue.d.ts","sourceRoot":"","sources":["../../../src/db/schema/report_queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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IAAI,CAAA;IAC1B,mBAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,SAAS,EAAE,SAAS,GAAG,aAAa,CAAA;IACpC,SAAS,EAAE,cAAc,CAAA;IACzB,SAAS,EAAE,cAAc,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,oBAAoB,CAAC,EAAE,WAAW,CAAA;CACpC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"report_queue.js","sourceRoot":"","sources":["../../../src/db/schema/report_queue.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAA","sourcesContent":["import type { Generated } from 'kysely'\nimport type { DatetimeString, DidString, NsidString } from '@atproto/lex'\n\nexport const reportQueueTableName = 'report_queue'\n\nexport interface ReportQueue {\n id: Generated<number>\n name: string\n subjectTypes: string[] // ['account'] or ['record'] or ['account', 'record']\n collection: NsidString | null // Collection name (e.g., 'app.bsky.feed.post'), NULL for accounts\n reportTypes: string[] // Array of report reason types (fully qualified NSIDs)\n description: string | null // Optional description of the queue\n recommendedPolicies: string[] // Policy keys recommended for reports in this queue\n createdBy: DidString | 'admin_token' // DID of moderator who created this queue\n createdAt: DatetimeString\n updatedAt: DatetimeString\n enabled: boolean\n deletedAt: string | null // NULL = active, timestamp = soft-deleted\n}\n\nexport type PartialDB = {\n [reportQueueTableName]: ReportQueue\n}\n"]}
1
+ {"version":3,"file":"report_queue.js","sourceRoot":"","sources":["../../../src/db/schema/report_queue.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAA","sourcesContent":["import type { Generated } from 'kysely'\nimport type { DatetimeString, DidString, NsidString } from '@atproto/lex'\n\nexport const reportQueueTableName = 'report_queue'\n\nexport interface ReportQueue {\n id: Generated<number>\n name: string\n subjectTypes: string[] // ['account'] or ['record'] or ['account', 'record']\n collection: NsidString | null // Collection name (e.g., 'app.bsky.feed.post'), NULL for accounts\n reportTypes: string[] // Array of report reason types (fully qualified NSIDs)\n description: string | null // Optional description of the queue\n recommendedPolicies: string[] // Policy keys recommended for reports in this queue\n recommendedLabels: string[] // Label values recommended for this queue and used for appeal routing\n createdBy: DidString | 'admin_token' // DID of moderator who created this queue\n createdAt: DatetimeString\n updatedAt: DatetimeString\n enabled: boolean\n deletedAt: string | null // NULL = active, timestamp = soft-deleted\n}\n\nexport type PartialDB = {\n [reportQueueTableName]: ReportQueue\n}\n"]}
@@ -15,10 +15,20 @@ export interface ReportStat {
15
15
  moderatorDid: DidString | null;
16
16
  inboundCount: number | null;
17
17
  pendingCount: number | null;
18
- actionedCount: number | null;
19
18
  escalatedCount: number | null;
19
+ actionedCount: number | null;
20
20
  actionRate: number | null;
21
+ labelActionCount: number | null;
22
+ tagActionCount: number | null;
23
+ takedownActionCount: number | null;
24
+ acknowledgedCount: number | null;
25
+ closedCount: number | null;
21
26
  avgHandlingTimeSec: number | null;
27
+ ahtDurationSec: number | null;
28
+ ahtSampleCount: number | null;
29
+ resolutionDurationSec: number | null;
30
+ resolutionSampleCount: number | null;
31
+ avgResolutionTimeSec: number | null;
22
32
  }
23
33
  export type PartialDB = {
24
34
  [reportStatTableName]: ReportStat;
@@ -1 +1 @@
1
- {"version":3,"file":"report_stat.d.ts","sourceRoot":"","sources":["../../../src/db/schema/report_stat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAA;AAExD,eAAO,MAAM,mBAAmB,gBAAgB,CAAA;AAEhD,MAAM,WAAW,UAAU;IAEz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AAI,CAAA;IAG3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAG7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAG1B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAG7B,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,mBAAmB,CAAC,EAAE,UAAU,CAAA;CAClC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"report_stat.js","sourceRoot":"","sources":["../../../src/db/schema/report_stat.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAA","sourcesContent":["import type { Generated } from 'kysely'\nimport type { DatetimeString, DidString } from '@atproto/lex'\n\n/**\n * A calendar day in `YYYY-MM-DD` form. Typed as a template literal so it\n * composes into a {@link DatetimeString} without a cast.\n */\nexport type DateString = `${string}-${string}-${string}`\n\nexport const reportStatTableName = 'report_stat'\n\nexport interface ReportStat {\n // metadata\n id: Generated<number>\n computedAt: DatetimeString // When this snapshot was last computed\n\n // group\n date: DateString // ISO date e.g. '2026-04-15' — the calendar day this snapshot covers\n queueId: number | null // NULL = aggregate across all queues\n reportTypes: string[] | null // NULL = aggregate across all report types\n moderatorDid: DidString | null // NULL = aggregate, non-null = per-moderator\n\n // stats\n inboundCount: number | null // Reports received during this calendar day\n pendingCount: number | null // Reports with status != 'closed' at time of computation\n actionedCount: number | null // Reports closed during this calendar day\n escalatedCount: number | null // Reports escalated during this calendar day\n actionRate: number | null // actionedCount / inboundCount * 100\n avgHandlingTimeSec: number | null // Average time from creation/assignment to close, in seconds\n}\n\nexport type PartialDB = {\n [reportStatTableName]: ReportStat\n}\n"]}
1
+ {"version":3,"file":"report_stat.js","sourceRoot":"","sources":["../../../src/db/schema/report_stat.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAA","sourcesContent":["import type { Generated } from 'kysely'\nimport type { DatetimeString, DidString } from '@atproto/lex'\n\n/**\n * A calendar day in `YYYY-MM-DD` form. Typed as a template literal so it\n * composes into a {@link DatetimeString} without a cast.\n */\nexport type DateString = `${string}-${string}-${string}`\n\nexport const reportStatTableName = 'report_stat'\n\nexport interface ReportStat {\n // metadata\n id: Generated<number>\n computedAt: DatetimeString // When this snapshot was last computed\n\n // group\n date: DateString // ISO date e.g. '2026-04-15' — the calendar day this snapshot covers\n queueId: number | null // NULL = aggregate across all queues\n reportTypes: string[] | null // NULL = aggregate across all report types\n moderatorDid: DidString | null // NULL = aggregate, non-null = per-moderator\n\n // inbound\n inboundCount: number | null // Reports received during this calendar day\n\n // unresolved\n pendingCount: number | null // Reports with status != 'closed' at time of computation\n escalatedCount: number | null // Reports escalated during this calendar day\n\n // resolved\n actionedCount: number | null // Current closures whose last action was enforcement\n actionRate: number | null // actionedCount / closedCount * 100\n labelActionCount: number | null // Current closures whose last action was label\n tagActionCount: number | null // Current closures whose last action was tag\n takedownActionCount: number | null // Current closures whose last action was takedown\n acknowledgedCount: number | null // Current closures without a last enforcement action\n closedCount: number | null // Current reports with closedAt in this calendar day\n\n // handling time\n avgHandlingTimeSec: number | null // Average time from assignment to close, in seconds\n ahtDurationSec: number | null // Sum of assignment-to-close durations\n ahtSampleCount: number | null // Assigned closed-report samples in ahtDurationSec\n\n // resolution time\n resolutionDurationSec: number | null // Sum of creation-to-close durations\n resolutionSampleCount: number | null // Closed-report samples in resolutionDurationSec\n avgResolutionTimeSec: number | null // Average time from creation to close, in seconds\n}\n\nexport type PartialDB = {\n [reportStatTableName]: ReportStat\n}\n"]}
@@ -0,0 +1,187 @@
1
+ import type { Expression, ExpressionBuilder, SqlBool } from 'kysely';
2
+ import { type DatetimeString, type DidString, type UriString } from '@atproto/lex';
3
+ import type { AppContext } from '../context.js';
4
+ import type { Database } from '../db/index.js';
5
+ import type { DatabaseSchemaType } from '../db/schema/index.js';
6
+ import { tools } from '../lexicons/index.js';
7
+ import type { AppealView } from '../lexicons/tools/ozone/inbox/defs.js';
8
+ import type { ModSubject } from '../mod-service/subject.js';
9
+ import type { ModerationSubjectStatusRow } from '../mod-service/types.js';
10
+ export declare const APPEAL_REASON_TYPE = "tools.ozone.report.defs#reasonAppeal";
11
+ export declare const TAKEDOWN = "tools.ozone.moderation.defs#modEventTakedown";
12
+ export declare const REVERSE_TAKEDOWN = "tools.ozone.moderation.defs#modEventReverseTakedown";
13
+ export declare const LABEL = "tools.ozone.moderation.defs#modEventLabel";
14
+ export declare const EMAIL = "tools.ozone.moderation.defs#modEventEmail";
15
+ export declare const MUTE_REPORTER = "tools.ozone.moderation.defs#modEventMuteReporter";
16
+ export declare const REVOKE_CREDENTIALS = "tools.ozone.moderation.defs#revokeAccountCredentialsEvent";
17
+ /**
18
+ * The subject's most recent `reasonAppeal` report, reduced to the columns the
19
+ * appeal state derives from. Deliberately excludes `actionNote` and everything
20
+ * else a moderator wrote for other moderators.
21
+ */
22
+ export type AppealReport = {
23
+ id: number;
24
+ status: string;
25
+ createdAt: DatetimeString;
26
+ closedAt: DatetimeString | null;
27
+ };
28
+ export type AppealInput = {
29
+ subject: ModSubject;
30
+ status: ModerationSubjectStatusRow | null;
31
+ report: AppealReport | null;
32
+ publicNote: string | null;
33
+ /** Calendar months an action stays appealable, from `InboxConfig`. */
34
+ windowMonths: number;
35
+ latestAppealableAt: DatetimeString | null;
36
+ };
37
+ export type AppealState = {
38
+ view: AppealView;
39
+ availableActions: string[];
40
+ };
41
+ export declare const PUBLIC_EVENT_ACTIONS: readonly ["tools.ozone.moderation.defs#modEventTakedown", "tools.ozone.moderation.defs#modEventLabel", "tools.ozone.moderation.defs#modEventEmail", "tools.ozone.moderation.defs#modEventMuteReporter", "tools.ozone.moderation.defs#revokeAccountCredentialsEvent", "tools.ozone.moderation.defs#modEventReverseTakedown"];
42
+ export declare const APPEALABLE_EVENT_ACTIONS: readonly ["tools.ozone.moderation.defs#modEventTakedown", "tools.ozone.moderation.defs#modEventLabel"];
43
+ export declare const isAppealableEvent: (action: string) => boolean;
44
+ export declare const appealWindowEnd: (actionCreatedAt: DatetimeString, windowMonths: number) => DatetimeString;
45
+ export declare const isAppealWindowOpen: (actionCreatedAt: DatetimeString, windowMonths: number, now?: Date) => boolean;
46
+ /**
47
+ * Appeal state, derived entirely from data Ozone already records.
48
+ */
49
+ export declare const toAppealState: ({ subject, status, report, publicNote, latestAppealableAt, windowMonths, }: AppealInput) => AppealState;
50
+ /**
51
+ * Stable identity of a moderated subject, independent of which action touched
52
+ * it. Two appeals against the same record - or the same message, or the same
53
+ * conversation - share a key even when they name different action IDs.
54
+ */
55
+ export declare const subjectKey: (subject: ModSubject) => string;
56
+ /**
57
+ * Match report rows by that identity. Mirrors the subject normalization in
58
+ * `mod-service/report.ts`: `recordPath` is '' for accounts, messages, and
59
+ * conversations alike, so an account match has to exclude the chat columns.
60
+ */
61
+ export declare const reportSubjectFilter: (eb: ExpressionBuilder<DatabaseSchemaType, 'report'>, subject: ModSubject) => Expression<SqlBool>;
62
+ export declare const eventSubjectFilter: (eb: ExpressionBuilder<DatabaseSchemaType, 'moderation_event'>, subject: ModSubject) => Expression<SqlBool>;
63
+ export declare const findAppealedEvent: (ctx: AppContext, subject: ModSubject, action: {
64
+ type: 'label';
65
+ val: string;
66
+ } | {
67
+ type: 'takedown';
68
+ }) => Promise<{
69
+ action: "tools.ozone.moderation.defs#accountEvent" | "tools.ozone.moderation.defs#ageAssuranceEvent" | "tools.ozone.moderation.defs#ageAssuranceOverrideEvent" | "tools.ozone.moderation.defs#ageAssurancePurgeEvent" | "tools.ozone.moderation.defs#identityEvent" | "tools.ozone.moderation.defs#modEventAcknowledge" | "tools.ozone.moderation.defs#modEventComment" | "tools.ozone.moderation.defs#modEventEmail" | "tools.ozone.moderation.defs#modEventEscalate" | "tools.ozone.moderation.defs#modEventLabel" | "tools.ozone.moderation.defs#modEventMute" | "tools.ozone.moderation.defs#modEventMuteReporter" | "tools.ozone.moderation.defs#modEventPriorityScore" | "tools.ozone.moderation.defs#modEventReport" | "tools.ozone.moderation.defs#modEventResolveAppeal" | "tools.ozone.moderation.defs#modEventReverseTakedown" | "tools.ozone.moderation.defs#modEventTag" | "tools.ozone.moderation.defs#modEventTakedown" | "tools.ozone.moderation.defs#modEventUnmute" | "tools.ozone.moderation.defs#modEventUnmuteReporter" | "tools.ozone.moderation.defs#recordEvent" | "tools.ozone.moderation.defs#revokeAccountCredentialsEvent";
70
+ addedTags: string[] | null;
71
+ comment: string | null;
72
+ createLabelVals: string | null;
73
+ createdAt: DatetimeString;
74
+ createdBy: `did:${string}:${string}`;
75
+ durationInHours: number | null;
76
+ expiresAt: DatetimeString | null;
77
+ externalId: string | null;
78
+ id: number;
79
+ legacyRefId: number | null;
80
+ meta: Record<string, string | number | boolean> | null;
81
+ modTool: {
82
+ name: string;
83
+ meta?: { [_ in string]: unknown; };
84
+ } | null;
85
+ negateLabelVals: string | null;
86
+ removedTags: string[] | null;
87
+ severityLevel: string | null;
88
+ strikeCount: number | null;
89
+ strikeExpiresAt: DatetimeString | null;
90
+ subjectBlobCids: string[] | null;
91
+ subjectCid: string | null;
92
+ subjectConvoId: string | null;
93
+ subjectDid: `did:${string}:${string}`;
94
+ subjectMessageId: string | null;
95
+ subjectType: "chat.bsky.convo.defs#convoRef" | "chat.bsky.convo.defs#messageRef" | "com.atproto.admin.defs#repoRef" | "com.atproto.repo.strongRef";
96
+ subjectUri: import("@atproto/lex").AtUriString | null;
97
+ } | undefined>;
98
+ export declare const resolveAppealAction: (ctx: AppContext, subject: ModSubject, action: tools.ozone.inbox.appealActionedSubject.$InputBody['action']) => Promise<{
99
+ action: "tools.ozone.moderation.defs#accountEvent" | "tools.ozone.moderation.defs#ageAssuranceEvent" | "tools.ozone.moderation.defs#ageAssuranceOverrideEvent" | "tools.ozone.moderation.defs#ageAssurancePurgeEvent" | "tools.ozone.moderation.defs#identityEvent" | "tools.ozone.moderation.defs#modEventAcknowledge" | "tools.ozone.moderation.defs#modEventComment" | "tools.ozone.moderation.defs#modEventEmail" | "tools.ozone.moderation.defs#modEventEscalate" | "tools.ozone.moderation.defs#modEventLabel" | "tools.ozone.moderation.defs#modEventMute" | "tools.ozone.moderation.defs#modEventMuteReporter" | "tools.ozone.moderation.defs#modEventPriorityScore" | "tools.ozone.moderation.defs#modEventReport" | "tools.ozone.moderation.defs#modEventResolveAppeal" | "tools.ozone.moderation.defs#modEventReverseTakedown" | "tools.ozone.moderation.defs#modEventTag" | "tools.ozone.moderation.defs#modEventTakedown" | "tools.ozone.moderation.defs#modEventUnmute" | "tools.ozone.moderation.defs#modEventUnmuteReporter" | "tools.ozone.moderation.defs#recordEvent" | "tools.ozone.moderation.defs#revokeAccountCredentialsEvent";
100
+ addedTags: string[] | null;
101
+ comment: string | null;
102
+ createLabelVals: string | null;
103
+ createdAt: DatetimeString;
104
+ createdBy: `did:${string}:${string}`;
105
+ durationInHours: number | null;
106
+ expiresAt: DatetimeString | null;
107
+ externalId: string | null;
108
+ id: number;
109
+ legacyRefId: number | null;
110
+ meta: Record<string, string | number | boolean> | null;
111
+ modTool: {
112
+ name: string;
113
+ meta?: { [_ in string]: unknown; };
114
+ } | null;
115
+ negateLabelVals: string | null;
116
+ removedTags: string[] | null;
117
+ severityLevel: string | null;
118
+ strikeCount: number | null;
119
+ strikeExpiresAt: DatetimeString | null;
120
+ subjectBlobCids: string[] | null;
121
+ subjectCid: string | null;
122
+ subjectConvoId: string | null;
123
+ subjectDid: `did:${string}:${string}`;
124
+ subjectMessageId: string | null;
125
+ subjectType: "chat.bsky.convo.defs#convoRef" | "chat.bsky.convo.defs#messageRef" | "com.atproto.admin.defs#repoRef" | "com.atproto.repo.strongRef";
126
+ subjectUri: import("@atproto/lex").AtUriString | null;
127
+ } | undefined>;
128
+ /**
129
+ * Label rows are keyed by a single string: the record URI, or the DID for an
130
+ * account.
131
+ */
132
+ export declare const subjectLabelUri: (subject: ModSubject) => UriString;
133
+ /**
134
+ * Whether the subject has used up its appeals.
135
+ *
136
+ * Non-account subjects get one ever, closed or not. An account gets one at a
137
+ * time - and an appeal whose report is still open counts even when the
138
+ * `appealed` flag was cleared out from under it, which is what happens when a
139
+ * takedown supersedes an appeal nobody ever worked.
140
+ *
141
+ * The read path calls this to decide whether to offer `appeal`, and the write
142
+ * path calls it to decide whether to accept one. They have to be the same
143
+ * question: anything else advertises an appeal that submission will refuse.
144
+ */
145
+ export declare const appealsExhausted: (subject: ModSubject, report: AppealReport | null) => boolean;
146
+ export declare const findLatestAppealReport: (db: Database, subject: ModSubject) => Promise<AppealReport | null>;
147
+ /**
148
+ * Reject an appeal the subject is no longer entitled to.
149
+ *
150
+ * Answers the same question as the `availableActions` the read path
151
+ * advertises, through {@link appealsExhausted}, so the two cannot drift.
152
+ */
153
+ export declare const assertAppealAllowed: (dbTxn: Database, subject: ModSubject) => Promise<void>;
154
+ export type FileAppealInput = {
155
+ /** DID of the authenticated account filing the appeal. */
156
+ requester: DidString;
157
+ /** The subject being appealed, already resolved and authorized. */
158
+ subject: ModSubject;
159
+ /** Resolved moderation event ID, when one could be found. */
160
+ resolvedActionId?: number;
161
+ /** The action reference supplied by the caller. */
162
+ action?: tools.ozone.inbox.appealActionedSubject.$InputBody['action'];
163
+ /** Optional: an appeal is a request for review, not an argued case. */
164
+ reason?: string;
165
+ modTool?: {
166
+ name: string;
167
+ meta?: {
168
+ [_ in string]: unknown;
169
+ };
170
+ };
171
+ };
172
+ /**
173
+ * File an appeal: validate the subject, route it, and record it.
174
+ *
175
+ * An appeal is an ordinary `reasonAppeal` report, so it inherits the report
176
+ * lifecycle, queue routing, and activity machinery rather than introducing a
177
+ * parallel one. What makes it a *linked* appeal is `actionEventIds`, whose
178
+ * first entry is the action being challenged.
179
+ *
180
+ * Everything that must be atomic - the eligibility guard, the report event,
181
+ * and the report row - shares one transaction. Everything that needs
182
+ * not be, is already done by the time it opens.
183
+ */
184
+ export declare const fileAppeal: (ctx: AppContext, { requester, subject, resolvedActionId, action, reason, modTool, }: FileAppealInput) => Promise<{
185
+ reportId: number;
186
+ }>;
187
+ //# sourceMappingURL=appeal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appeal.d.ts","sourceRoot":"","sources":["../../src/inbox/appeal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EAGf,MAAM,cAAc,CAAA;AAGrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAGzE,eAAO,MAAM,kBAAkB,yCAAyC,C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