@atproto/ozone 0.16.0 → 0.16.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.
- package/CHANGELOG.md +14 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/report/getStatGroupDetails.d.ts +4 -0
- package/dist/api/report/getStatGroupDetails.d.ts.map +1 -0
- package/dist/api/report/getStatGroupDetails.js +39 -0
- package/dist/api/report/getStatGroupDetails.js.map +1 -0
- package/dist/lexicons/tools/ozone/report/getStatGroupDetails.d.ts +3 -0
- package/dist/lexicons/tools/ozone/report/getStatGroupDetails.d.ts.map +1 -0
- package/dist/lexicons/tools/ozone/report/getStatGroupDetails.defs.d.ts +89 -0
- package/dist/lexicons/tools/ozone/report/getStatGroupDetails.defs.d.ts.map +1 -0
- package/dist/lexicons/tools/ozone/report/getStatGroupDetails.defs.js +19 -0
- package/dist/lexicons/tools/ozone/report/getStatGroupDetails.defs.js.map +1 -0
- package/dist/lexicons/tools/ozone/report/getStatGroupDetails.js +6 -0
- package/dist/lexicons/tools/ozone/report/getStatGroupDetails.js.map +1 -0
- package/dist/lexicons/tools/ozone/report.d.ts +1 -0
- package/dist/lexicons/tools/ozone/report.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/report.js +1 -0
- package/dist/lexicons/tools/ozone/report.js.map +1 -1
- package/dist/report/stats.d.ts +4 -0
- package/dist/report/stats.d.ts.map +1 -1
- package/dist/report/stats.js +56 -0
- package/dist/report/stats.js.map +1 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atproto/ozone
|
|
2
2
|
|
|
3
|
+
## 0.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#5956](https://github.com/bluesky-social/atproto/pull/5956) [`1403383`](https://github.com/bluesky-social/atproto/commit/1403383ea89737ff1910346107a4ef822e4ef6d5) Thanks [@gcwill70](https://github.com/gcwill70)! - Add stat group details with an inbound report-type breakdown for a selected UTC date range.
|
|
8
|
+
- Updated dependencies [[`ee63e5e`](https://github.com/bluesky-social/atproto/commit/ee63e5ede255e40251a9e761befec9d623dfb1ec), [`ee63e5e`](https://github.com/bluesky-social/atproto/commit/ee63e5ede255e40251a9e761befec9d623dfb1ec), [`33d620b`](https://github.com/bluesky-social/atproto/commit/33d620b2ffc4b9a5b4959cbcc1262c5138c8a506)]:
|
|
9
|
+
- @atproto/syntax@0.7.9
|
|
10
|
+
- @atproto/lex-schema@0.3.1
|
|
11
|
+
- @atproto/lex-client@0.6.1
|
|
12
|
+
- @atproto/lex-password-session@0.3.5
|
|
13
|
+
- @atproto/xrpc-server@0.13.15
|
|
14
|
+
- @atproto/common@0.8.12
|
|
15
|
+
- @atproto/identity@0.5.25
|
|
16
|
+
|
|
3
17
|
## 0.16.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AA4F/C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAE5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,UA4FvD"}
|
package/dist/api/index.js
CHANGED
|
@@ -55,6 +55,7 @@ import getHistoricalStats from './report/getHistoricalStats.js';
|
|
|
55
55
|
import getLatestReport from './report/getLatestReport.js';
|
|
56
56
|
import getLiveStats from './report/getLiveStats.js';
|
|
57
57
|
import getReport from './report/getReport.js';
|
|
58
|
+
import getStatGroupDetails from './report/getStatGroupDetails.js';
|
|
58
59
|
import listActivities from './report/listActivities.js';
|
|
59
60
|
import queryActivities from './report/queryActivities.js';
|
|
60
61
|
import queryModeratorActivity from './report/queryModeratorActivity.js';
|
|
@@ -164,6 +165,7 @@ export default function (server, ctx) {
|
|
|
164
165
|
cancelScheduledActions(server, ctx);
|
|
165
166
|
routeReports(server, ctx);
|
|
166
167
|
getLiveStats(server, ctx);
|
|
168
|
+
getStatGroupDetails(server, ctx);
|
|
167
169
|
getHistoricalStats(server, ctx);
|
|
168
170
|
refreshStats(server, ctx);
|
|
169
171
|
assignQueueModerator(server, ctx);
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,iBAAiB,CAAA;AAClC,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,aAAa,MAAM,kCAAkC,CAAA;AAC5D,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,oBAAoB,MAAM,iCAAiC,CAAA;AAClE,OAAO,qBAAqB,MAAM,kCAAkC,CAAA;AACpE,OAAO,sBAAsB,MAAM,mCAAmC,CAAA;AACtE,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAC1D,OAAO,kBAAkB,MAAM,+BAA+B,CAAA;AAC9D,OAAO,0BAA0B,MAAM,uCAAuC,CAAA;AAC9E,OAAO,iBAAiB,MAAM,8BAA8B,CAAA;AAC5D,OAAO,cAAc,MAAM,sBAAsB,CAAA;AACjD,OAAO,cAAc,MA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e,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import type { Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../context.js'\nimport chat from './chat/index.js'\nimport createTemplate from './communication/createTemplate.js'\nimport deleteTemplate from './communication/deleteTemplate.js'\nimport listTemplates from './communication/listTemplates.js'\nimport updateTemplate from './communication/updateTemplate.js'\nimport ackPushNotifications from './inbox/ackPushNotifications.js'\nimport appealActionedSubject from './inbox/appealActionedSubject.js'\nimport claimPushNotifications from './inbox/claimPushNotifications.js'\nimport getAccountStatus from './inbox/getAccountStatus.js'\nimport getActionedSubject from './inbox/getActionedSubject.js'\nimport getNotificationPreferences from './inbox/getNotificationPreferences.js'\nimport getPushPreference from './inbox/getPushPreference.js'\nimport getInboxReport from './inbox/getReport.js'\nimport getUnreadCount from './inbox/getUnreadCount.js'\nimport listActionedSubjects from './inbox/listActionedSubjects.js'\nimport listNotifications from './inbox/listNotifications.js'\nimport listReports from './inbox/listReports.js'\nimport putNotificationPreferences from './inbox/putNotificationPreferences.js'\nimport updateSeen from './inbox/updateSeen.js'\nimport fetchLabels from './label/fetchLabels.js'\nimport queryLabels from './label/queryLabels.js'\nimport subscribeLabels from './label/subscribeLabels.js'\nimport cancelScheduledActions from './moderation/cancelScheduledActions.js'\nimport emitEvent from './moderation/emitEvent.js'\nimport emitEvents from './moderation/emitEvents.js'\nimport getAccountPreferences from './moderation/getAccountPreferences.js'\nimport getAccountTimeline from './moderation/getAccountTimeline.js'\nimport getEvent from './moderation/getEvent.js'\nimport adminGetRecord from './moderation/getRecord.js'\nimport adminGetRecords from './moderation/getRecords.js'\nimport getRepo from './moderation/getRepo.js'\nimport getReporterStats from './moderation/getReporterStats.js'\nimport getRepos from './moderation/getRepos.js'\nimport getSubjects from './moderation/getSubjects.js'\nimport listScheduledActions from './moderation/listScheduledActions.js'\nimport queryEvents from './moderation/queryEvents.js'\nimport queryStatuses from './moderation/queryStatuses.js'\nimport scheduleAction from './moderation/scheduleAction.js'\nimport searchRepos from './moderation/searchRepos.js'\nimport proxied from './proxied.js'\nimport assignQueueModerator from './queue/assignModerator.js'\nimport createQueue from './queue/createQueue.js'\nimport deleteQueue from './queue/deleteQueue.js'\nimport getQueueAssignments from './queue/getAssignments.js'\nimport listQueues from './queue/listQueues.js'\nimport routeReports from './queue/routeReports.js'\nimport unassignQueueModerator from './queue/unassignModerator.js'\nimport updateQueue from './queue/updateQueue.js'\nimport assignReportModerator from './report/assignModerator.js'\nimport closeReports from './report/closeReports.js'\nimport createActivity from './report/createActivity.js'\nimport createReport from './report/createReport.js'\nimport getReportAssignments from './report/getAssignments.js'\nimport getHistoricalStats from './report/getHistoricalStats.js'\nimport getLatestReport from './report/getLatestReport.js'\nimport getLiveStats from './report/getLiveStats.js'\nimport getReport from './report/getReport.js'\nimport listActivities from './report/listActivities.js'\nimport queryActivities from './report/queryActivities.js'\nimport queryModeratorActivity from './report/queryModeratorActivity.js'\nimport queryReports from './report/queryReports.js'\nimport reassignQueue from './report/reassignQueue.js'\nimport refreshStats from './report/refreshStats.js'\nimport unassignReportModerator from './report/unassignModerator.js'\nimport addSafelinkRule from './safelink/addRule.js'\nimport querySafelinkEvents from './safelink/queryEvents.js'\nimport querySafelinkRules from './safelink/queryRules.js'\nimport removeSafelinkRule from './safelink/removeRule.js'\nimport syncSource from './safelink/syncSource.js'\nimport updateSafelinkRule from './safelink/updateRule.js'\nimport getCapabilities from './server/getCapabilities.js'\nimport getConfig from './server/getConfig.js'\nimport setAddValues from './set/addValues.js'\nimport deleteSet from './set/deleteSet.js'\nimport setDeleteValues from './set/deleteValues.js'\nimport setGetValues from './set/getValues.js'\nimport querySets from './set/querySets.js'\nimport upsertSet from './set/upsertSet.js'\nimport listOptions from './setting/listOptions.js'\nimport removeOptions from './setting/removeOptions.js'\nimport upsertOption from './setting/upsertOption.js'\nimport addMember from './team/addMember.js'\nimport deleteMember from './team/deleteMember.js'\nimport listMembers from './team/listMembers.js'\nimport listOnlineMembers from './team/listOnlineMembers.js'\nimport updateMember from './team/updateMember.js'\nimport grantVerifications from './verification/grantVerifications.js'\nimport listVerifications from './verification/listVerifications.js'\nimport revokeVerifications from './verification/revokeVerifications.js'\n\nexport * as health from './health.js'\n\nexport * as wellKnown from './well-known.js'\n\nexport default function (server: Server, ctx: AppContext) {\n createReport(server, ctx)\n appealActionedSubject(server, ctx)\n ackPushNotifications(server, ctx)\n claimPushNotifications(server, ctx)\n getAccountStatus(server, ctx)\n getNotificationPreferences(server, ctx)\n getPushPreference(server, ctx)\n getUnreadCount(server, ctx)\n getActionedSubject(server, ctx)\n getInboxReport(server, ctx)\n listActionedSubjects(server, ctx)\n listReports(server, ctx)\n listNotifications(server, ctx)\n putNotificationPreferences(server, ctx)\n updateSeen(server, ctx)\n emitEvent(server, ctx)\n emitEvents(server, ctx)\n searchRepos(server, ctx)\n adminGetRecord(server, ctx)\n adminGetRecords(server, ctx)\n getRepo(server, ctx)\n getRepos(server, ctx)\n getEvent(server, ctx)\n queryEvents(server, ctx)\n getReport(server, ctx)\n queryReports(server, ctx)\n queryStatuses(server, ctx)\n queryLabels(server, ctx)\n subscribeLabels(server, ctx)\n fetchLabels(server, ctx)\n getAccountPreferences(server, ctx)\n listTemplates(server, ctx)\n createTemplate(server, ctx)\n updateTemplate(server, ctx)\n deleteTemplate(server, ctx)\n listMembers(server, ctx)\n listOnlineMembers(server, ctx)\n addMember(server, ctx)\n updateMember(server, ctx)\n deleteMember(server, ctx)\n chat(server, ctx)\n proxied(server, ctx)\n getCapabilities(server, ctx)\n getConfig(server, ctx)\n createQueue(server, ctx)\n listQueues(server, ctx)\n updateQueue(server, ctx)\n deleteQueue(server, ctx)\n setAddValues(server, ctx)\n setGetValues(server, ctx)\n querySets(server, ctx)\n upsertSet(server, ctx)\n setDeleteValues(server, ctx)\n deleteSet(server, ctx)\n upsertOption(server, ctx)\n listOptions(server, ctx)\n removeOptions(server, ctx)\n getReporterStats(server, ctx)\n getSubjects(server, ctx)\n grantVerifications(server, ctx)\n revokeVerifications(server, ctx)\n listVerifications(server, ctx)\n addSafelinkRule(server, ctx)\n updateSafelinkRule(server, ctx)\n removeSafelinkRule(server, ctx)\n syncSource(server, ctx)\n querySafelinkEvents(server, ctx)\n querySafelinkRules(server, ctx)\n getAccountTimeline(server, ctx)\n scheduleAction(server, ctx)\n listScheduledActions(server, ctx)\n cancelScheduledActions(server, ctx)\n routeReports(server, ctx)\n getLiveStats(server, ctx)\n getHistoricalStats(server, ctx)\n refreshStats(server, ctx)\n assignQueueModerator(server, ctx)\n unassignQueueModerator(server, ctx)\n getQueueAssignments(server, ctx)\n getLatestReport(server, ctx)\n assignReportModerator(server, ctx)\n unassignReportModerator(server, ctx)\n getReportAssignments(server, ctx)\n createActivity(server, ctx)\n closeReports(server, ctx)\n listActivities(server, ctx)\n queryActivities(server, ctx)\n queryModeratorActivity(server, ctx)\n reassignQueue(server, ctx)\n return server\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,iBAAiB,CAAA;AAClC,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,aAAa,MAAM,kCAAkC,CAAA;AAC5D,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,oBAAoB,MAAM,iCAAiC,CAAA;AAClE,OAAO,qBAAqB,MAAM,kCAAkC,CAAA;AACpE,OAAO,sBAAsB,MAAM,mCAAmC,CAAA;AACtE,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAC1D,OAAO,kBAAkB,MAAM,+BAA+B,CAAA;AAC9D,OAAO,0BAA0B,MAAM,uCAAuC,CAAA;AAC9E,OAAO,iBAAi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GAAG,CAAC,CAAA;IACjC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACzB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import type { Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../context.js'\nimport chat from './chat/index.js'\nimport createTemplate from './communication/createTemplate.js'\nimport deleteTemplate from './communication/deleteTemplate.js'\nimport listTemplates from './communication/listTemplates.js'\nimport updateTemplate from './communication/updateTemplate.js'\nimport ackPushNotifications from './inbox/ackPushNotifications.js'\nimport appealActionedSubject from './inbox/appealActionedSubject.js'\nimport claimPushNotifications from './inbox/claimPushNotifications.js'\nimport getAccountStatus from './inbox/getAccountStatus.js'\nimport getActionedSubject from './inbox/getActionedSubject.js'\nimport getNotificationPreferences from './inbox/getNotificationPreferences.js'\nimport getPushPreference from './inbox/getPushPreference.js'\nimport getInboxReport from './inbox/getReport.js'\nimport getUnreadCount from './inbox/getUnreadCount.js'\nimport listActionedSubjects from './inbox/listActionedSubjects.js'\nimport listNotifications from './inbox/listNotifications.js'\nimport listReports from './inbox/listReports.js'\nimport putNotificationPreferences from './inbox/putNotificationPreferences.js'\nimport updateSeen from './inbox/updateSeen.js'\nimport fetchLabels from './label/fetchLabels.js'\nimport queryLabels from './label/queryLabels.js'\nimport subscribeLabels from './label/subscribeLabels.js'\nimport cancelScheduledActions from './moderation/cancelScheduledActions.js'\nimport emitEvent from './moderation/emitEvent.js'\nimport emitEvents from './moderation/emitEvents.js'\nimport getAccountPreferences from './moderation/getAccountPreferences.js'\nimport getAccountTimeline from './moderation/getAccountTimeline.js'\nimport getEvent from './moderation/getEvent.js'\nimport adminGetRecord from './moderation/getRecord.js'\nimport adminGetRecords from './moderation/getRecords.js'\nimport getRepo from './moderation/getRepo.js'\nimport getReporterStats from './moderation/getReporterStats.js'\nimport getRepos from './moderation/getRepos.js'\nimport getSubjects from './moderation/getSubjects.js'\nimport listScheduledActions from './moderation/listScheduledActions.js'\nimport queryEvents from './moderation/queryEvents.js'\nimport queryStatuses from './moderation/queryStatuses.js'\nimport scheduleAction from './moderation/scheduleAction.js'\nimport searchRepos from './moderation/searchRepos.js'\nimport proxied from './proxied.js'\nimport assignQueueModerator from './queue/assignModerator.js'\nimport createQueue from './queue/createQueue.js'\nimport deleteQueue from './queue/deleteQueue.js'\nimport getQueueAssignments from './queue/getAssignments.js'\nimport listQueues from './queue/listQueues.js'\nimport routeReports from './queue/routeReports.js'\nimport unassignQueueModerator from './queue/unassignModerator.js'\nimport updateQueue from './queue/updateQueue.js'\nimport assignReportModerator from './report/assignModerator.js'\nimport closeReports from './report/closeReports.js'\nimport createActivity from './report/createActivity.js'\nimport createReport from './report/createReport.js'\nimport getReportAssignments from './report/getAssignments.js'\nimport getHistoricalStats from './report/getHistoricalStats.js'\nimport getLatestReport from './report/getLatestReport.js'\nimport getLiveStats from './report/getLiveStats.js'\nimport getReport from './report/getReport.js'\nimport getStatGroupDetails from './report/getStatGroupDetails.js'\nimport listActivities from './report/listActivities.js'\nimport queryActivities from './report/queryActivities.js'\nimport queryModeratorActivity from './report/queryModeratorActivity.js'\nimport queryReports from './report/queryReports.js'\nimport reassignQueue from './report/reassignQueue.js'\nimport refreshStats from './report/refreshStats.js'\nimport unassignReportModerator from './report/unassignModerator.js'\nimport addSafelinkRule from './safelink/addRule.js'\nimport querySafelinkEvents from './safelink/queryEvents.js'\nimport querySafelinkRules from './safelink/queryRules.js'\nimport removeSafelinkRule from './safelink/removeRule.js'\nimport syncSource from './safelink/syncSource.js'\nimport updateSafelinkRule from './safelink/updateRule.js'\nimport getCapabilities from './server/getCapabilities.js'\nimport getConfig from './server/getConfig.js'\nimport setAddValues from './set/addValues.js'\nimport deleteSet from './set/deleteSet.js'\nimport setDeleteValues from './set/deleteValues.js'\nimport setGetValues from './set/getValues.js'\nimport querySets from './set/querySets.js'\nimport upsertSet from './set/upsertSet.js'\nimport listOptions from './setting/listOptions.js'\nimport removeOptions from './setting/removeOptions.js'\nimport upsertOption from './setting/upsertOption.js'\nimport addMember from './team/addMember.js'\nimport deleteMember from './team/deleteMember.js'\nimport listMembers from './team/listMembers.js'\nimport listOnlineMembers from './team/listOnlineMembers.js'\nimport updateMember from './team/updateMember.js'\nimport grantVerifications from './verification/grantVerifications.js'\nimport listVerifications from './verification/listVerifications.js'\nimport revokeVerifications from './verification/revokeVerifications.js'\n\nexport * as health from './health.js'\n\nexport * as wellKnown from './well-known.js'\n\nexport default function (server: Server, ctx: AppContext) {\n createReport(server, ctx)\n appealActionedSubject(server, ctx)\n ackPushNotifications(server, ctx)\n claimPushNotifications(server, ctx)\n getAccountStatus(server, ctx)\n getNotificationPreferences(server, ctx)\n getPushPreference(server, ctx)\n getUnreadCount(server, ctx)\n getActionedSubject(server, ctx)\n getInboxReport(server, ctx)\n listActionedSubjects(server, ctx)\n listReports(server, ctx)\n listNotifications(server, ctx)\n putNotificationPreferences(server, ctx)\n updateSeen(server, ctx)\n emitEvent(server, ctx)\n emitEvents(server, ctx)\n searchRepos(server, ctx)\n adminGetRecord(server, ctx)\n adminGetRecords(server, ctx)\n getRepo(server, ctx)\n getRepos(server, ctx)\n getEvent(server, ctx)\n queryEvents(server, ctx)\n getReport(server, ctx)\n queryReports(server, ctx)\n queryStatuses(server, ctx)\n queryLabels(server, ctx)\n subscribeLabels(server, ctx)\n fetchLabels(server, ctx)\n getAccountPreferences(server, ctx)\n listTemplates(server, ctx)\n createTemplate(server, ctx)\n updateTemplate(server, ctx)\n deleteTemplate(server, ctx)\n listMembers(server, ctx)\n listOnlineMembers(server, ctx)\n addMember(server, ctx)\n updateMember(server, ctx)\n deleteMember(server, ctx)\n chat(server, ctx)\n proxied(server, ctx)\n getCapabilities(server, ctx)\n getConfig(server, ctx)\n createQueue(server, ctx)\n listQueues(server, ctx)\n updateQueue(server, ctx)\n deleteQueue(server, ctx)\n setAddValues(server, ctx)\n setGetValues(server, ctx)\n querySets(server, ctx)\n upsertSet(server, ctx)\n setDeleteValues(server, ctx)\n deleteSet(server, ctx)\n upsertOption(server, ctx)\n listOptions(server, ctx)\n removeOptions(server, ctx)\n getReporterStats(server, ctx)\n getSubjects(server, ctx)\n grantVerifications(server, ctx)\n revokeVerifications(server, ctx)\n listVerifications(server, ctx)\n addSafelinkRule(server, ctx)\n updateSafelinkRule(server, ctx)\n removeSafelinkRule(server, ctx)\n syncSource(server, ctx)\n querySafelinkEvents(server, ctx)\n querySafelinkRules(server, ctx)\n getAccountTimeline(server, ctx)\n scheduleAction(server, ctx)\n listScheduledActions(server, ctx)\n cancelScheduledActions(server, ctx)\n routeReports(server, ctx)\n getLiveStats(server, ctx)\n getStatGroupDetails(server, ctx)\n getHistoricalStats(server, ctx)\n refreshStats(server, ctx)\n assignQueueModerator(server, ctx)\n unassignQueueModerator(server, ctx)\n getQueueAssignments(server, ctx)\n getLatestReport(server, ctx)\n assignReportModerator(server, ctx)\n unassignReportModerator(server, ctx)\n getReportAssignments(server, ctx)\n createActivity(server, ctx)\n closeReports(server, ctx)\n listActivities(server, ctx)\n queryActivities(server, ctx)\n queryModeratorActivity(server, ctx)\n reassignQueue(server, ctx)\n return server\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStatGroupDetails.d.ts","sourceRoot":"","sources":["../../../src/api/report/getStatGroupDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAsCvD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ForbiddenError, InvalidRequestError, } from '@atproto/xrpc-server';
|
|
2
|
+
import { tools } from '../../lexicons/index.js';
|
|
3
|
+
import { QueueAccess } from '../../queue/access.js';
|
|
4
|
+
export default function (server, ctx) {
|
|
5
|
+
server.add(tools.ozone.report.getStatGroupDetails, {
|
|
6
|
+
auth: ctx.authVerifier.modOrAdminToken,
|
|
7
|
+
handler: async ({ params, auth, signal }) => {
|
|
8
|
+
const { queueId, moderatorDid, reportTypes } = params;
|
|
9
|
+
const groupCount = [
|
|
10
|
+
queueId !== undefined,
|
|
11
|
+
moderatorDid !== undefined,
|
|
12
|
+
reportTypes !== undefined,
|
|
13
|
+
].filter(Boolean).length;
|
|
14
|
+
if (groupCount > 1 || queueId === 0) {
|
|
15
|
+
throw new InvalidRequestError('Select at most one stat group');
|
|
16
|
+
}
|
|
17
|
+
if (moderatorDid && !auth.credentials.isAdmin) {
|
|
18
|
+
throw new ForbiddenError('Unauthorized');
|
|
19
|
+
}
|
|
20
|
+
const access = await QueueAccess.forActor(ctx.db, auth.credentials);
|
|
21
|
+
if (queueId !== undefined && queueId > 0) {
|
|
22
|
+
access.assertQueue(queueId);
|
|
23
|
+
const queue = await ctx.db.db
|
|
24
|
+
.selectFrom('report_queue')
|
|
25
|
+
.select('id')
|
|
26
|
+
.where('id', '=', queueId)
|
|
27
|
+
.where('deletedAt', 'is', null)
|
|
28
|
+
.executeTakeFirst();
|
|
29
|
+
if (!queue) {
|
|
30
|
+
throw new InvalidRequestError('Queue not found', 'QueueNotFound');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const reportStatsService = ctx.reportStatsService(ctx.db);
|
|
34
|
+
const body = await reportStatsService.getStatGroupDetails(params, access, signal);
|
|
35
|
+
return { encoding: 'application/json', body };
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=getStatGroupDetails.js.map
|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CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;gBAC3B,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE;qBAC1B,UAAU,CAAC,cAAc,CAAC;qBAC1B,MAAM,CAAC,IAAI,CAAC;qBACZ,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC;qBACzB,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC;qBAC9B,gBAAgB,EAAE,CAAA;gBACrB,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,MAAM,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAA;gBACnE,CAAC;YACH,CAAC;YACD,MAAM,kBAAkB,GAAG,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YACzD,MAAM,IAAI,GAAG,MAAM,kBAAkB,CAAC,mBAAmB,CACvD,MAAM,EACN,MAAM,EACN,MAAM,CACP,CAAA;YACD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAA;QAC/C,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n ForbiddenError,\n InvalidRequestError,\n type Server,\n} from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\nimport { QueueAccess } from '../../queue/access.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.report.getStatGroupDetails, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ params, auth, signal }) => {\n const { queueId, moderatorDid, reportTypes } = params\n const groupCount = [\n queueId !== undefined,\n moderatorDid !== undefined,\n reportTypes !== undefined,\n ].filter(Boolean).length\n if (groupCount > 1 || queueId === 0) {\n throw new InvalidRequestError('Select at most one stat group')\n }\n if (moderatorDid && !auth.credentials.isAdmin) {\n throw new ForbiddenError('Unauthorized')\n }\n const access = await QueueAccess.forActor(ctx.db, auth.credentials)\n if (queueId !== undefined && queueId > 0) {\n access.assertQueue(queueId)\n const queue = await ctx.db.db\n .selectFrom('report_queue')\n .select('id')\n .where('id', '=', queueId)\n .where('deletedAt', 'is', null)\n .executeTakeFirst()\n if (!queue) {\n throw new InvalidRequestError('Queue not found', 'QueueNotFound')\n }\n }\n const reportStatsService = ctx.reportStatsService(ctx.db)\n const body = await reportStatsService.getStatGroupDetails(\n params,\n access,\n signal,\n )\n return { encoding: 'application/json', body }\n },\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStatGroupDetails.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/tools/ozone/report/getStatGroupDetails.ts"],"names":[],"mappings":"AAIA,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { l } from "@atproto/lex-schema";
|
|
2
|
+
declare const $nsid = "tools.ozone.report.getStatGroupDetails";
|
|
3
|
+
type $nsid = typeof $nsid;
|
|
4
|
+
export { $nsid };
|
|
5
|
+
export declare const $params: l.ParamsSchema<{
|
|
6
|
+
readonly queueId: l.OptionalSchema<l.IntegerSchema>;
|
|
7
|
+
readonly moderatorDid: l.OptionalSchema<l.StringSchema<{
|
|
8
|
+
readonly format: "did";
|
|
9
|
+
}>>;
|
|
10
|
+
readonly reportTypes: l.OptionalSchema<l.ArraySchema<l.StringSchema<{}>>>;
|
|
11
|
+
readonly startDate: l.OptionalSchema<l.StringSchema<{
|
|
12
|
+
readonly format: "datetime";
|
|
13
|
+
}>>;
|
|
14
|
+
readonly endDate: l.OptionalSchema<l.StringSchema<{
|
|
15
|
+
readonly format: "datetime";
|
|
16
|
+
}>>;
|
|
17
|
+
}>;
|
|
18
|
+
export type $Params = l.InferOutput<typeof $params>;
|
|
19
|
+
export declare const $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
20
|
+
computedAt: l.StringSchema<{
|
|
21
|
+
readonly format: "datetime";
|
|
22
|
+
}>;
|
|
23
|
+
startDate: l.StringSchema<{
|
|
24
|
+
readonly format: "datetime";
|
|
25
|
+
}>;
|
|
26
|
+
endDate: l.StringSchema<{
|
|
27
|
+
readonly format: "datetime";
|
|
28
|
+
}>;
|
|
29
|
+
reportTypeBreakdown: l.RefSchema<l.Validator<ReportTypeBreakdown, ReportTypeBreakdown>>;
|
|
30
|
+
}>>;
|
|
31
|
+
export type $Output<B = l.BinaryData> = l.InferPayload<typeof $output, B>;
|
|
32
|
+
export type $OutputBody<B = l.BinaryData> = l.InferPayloadBody<typeof $output, B>;
|
|
33
|
+
/** Get additional details for a stat group. Omit all group selectors for aggregate details. */
|
|
34
|
+
declare const main: l.Query<"tools.ozone.report.getStatGroupDetails", l.ParamsSchema<{
|
|
35
|
+
readonly queueId: l.OptionalSchema<l.IntegerSchema>;
|
|
36
|
+
readonly moderatorDid: l.OptionalSchema<l.StringSchema<{
|
|
37
|
+
readonly format: "did";
|
|
38
|
+
}>>;
|
|
39
|
+
readonly reportTypes: l.OptionalSchema<l.ArraySchema<l.StringSchema<{}>>>;
|
|
40
|
+
readonly startDate: l.OptionalSchema<l.StringSchema<{
|
|
41
|
+
readonly format: "datetime";
|
|
42
|
+
}>>;
|
|
43
|
+
readonly endDate: l.OptionalSchema<l.StringSchema<{
|
|
44
|
+
readonly format: "datetime";
|
|
45
|
+
}>>;
|
|
46
|
+
}>, l.Payload<"application/json", l.ObjectSchema<{
|
|
47
|
+
computedAt: l.StringSchema<{
|
|
48
|
+
readonly format: "datetime";
|
|
49
|
+
}>;
|
|
50
|
+
startDate: l.StringSchema<{
|
|
51
|
+
readonly format: "datetime";
|
|
52
|
+
}>;
|
|
53
|
+
endDate: l.StringSchema<{
|
|
54
|
+
readonly format: "datetime";
|
|
55
|
+
}>;
|
|
56
|
+
reportTypeBreakdown: l.RefSchema<l.Validator<ReportTypeBreakdown, ReportTypeBreakdown>>;
|
|
57
|
+
}>>, readonly ["QueueNotFound"]>;
|
|
58
|
+
export { main };
|
|
59
|
+
declare const $lxm = "tools.ozone.report.getStatGroupDetails";
|
|
60
|
+
type $lxm = typeof $lxm;
|
|
61
|
+
export { $lxm };
|
|
62
|
+
type ReportTypeStats = {
|
|
63
|
+
$type?: "tools.ozone.report.getStatGroupDetails#reportTypeStats";
|
|
64
|
+
/**
|
|
65
|
+
* Fully qualified report reason.
|
|
66
|
+
*/
|
|
67
|
+
"reportType": string;
|
|
68
|
+
/**
|
|
69
|
+
* Unmuted reports received during the requested UTC calendar days.
|
|
70
|
+
*/
|
|
71
|
+
"inboundCount": number;
|
|
72
|
+
};
|
|
73
|
+
export type { ReportTypeStats };
|
|
74
|
+
declare const reportTypeStats: l.TypedObjectSchema<"tools.ozone.report.getStatGroupDetails#reportTypeStats", l.Validator<ReportTypeStats, ReportTypeStats>>;
|
|
75
|
+
export { reportTypeStats };
|
|
76
|
+
/** Unmuted inbound reports by actual reason, across all statuses, within the selected stat group and UTC date range. */
|
|
77
|
+
type ReportTypeBreakdown = {
|
|
78
|
+
$type?: "tools.ozone.report.getStatGroupDetails#reportTypeBreakdown";
|
|
79
|
+
/**
|
|
80
|
+
* Total unmuted inbound reports in this breakdown.
|
|
81
|
+
*/
|
|
82
|
+
"totalCount": number;
|
|
83
|
+
"stats": (ReportTypeStats)[];
|
|
84
|
+
};
|
|
85
|
+
export type { ReportTypeBreakdown };
|
|
86
|
+
/** Unmuted inbound reports by actual reason, across all statuses, within the selected stat group and UTC date range. */
|
|
87
|
+
declare const reportTypeBreakdown: l.TypedObjectSchema<"tools.ozone.report.getStatGroupDetails#reportTypeBreakdown", l.Validator<ReportTypeBreakdown, ReportTypeBreakdown>>;
|
|
88
|
+
export { reportTypeBreakdown };
|
|
89
|
+
//# sourceMappingURL=getStatGroupDetails.defs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStatGroupDetails.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/tools/ozone/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CAAC;IAEhG;;OAEG;IACH,YAAY,EAAC,MAAM,CAAC;IAAA,OAAO,EAAC,CAAC,eAAe,CAAC,EAAE,CAAA;CAAE,CAAC;AAEpD,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,wHAAwH;AACxH,QAAA,MAAM,mBAAmB,0IAAsQ,CAAC;AAEhS,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { l } from "@atproto/lex-schema";
|
|
5
|
+
const $nsid = "tools.ozone.report.getStatGroupDetails";
|
|
6
|
+
export { $nsid };
|
|
7
|
+
export const $params = /*#__PURE__*/ l.params({ "queueId": /*#__PURE__*/ l.optional(/*#__PURE__*/ l.integer({ "minimum": -1 })), "moderatorDid": /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string({ "format": "did" })), "reportTypes": /*#__PURE__*/ l.optional(/*#__PURE__*/ l.array(/*#__PURE__*/ l.string(), { "minLength": 1, "maxLength": 100 })), "startDate": /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string({ "format": "datetime" })), "endDate": /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string({ "format": "datetime" })) });
|
|
8
|
+
export const $output = /*#__PURE__*/ l.jsonPayload({ "computedAt": /*#__PURE__*/ l.string({ "format": "datetime" }), "startDate": /*#__PURE__*/ l.string({ "format": "datetime" }), "endDate": /*#__PURE__*/ l.string({ "format": "datetime" }), "reportTypeBreakdown": /*#__PURE__*/ l.ref((() => reportTypeBreakdown)) });
|
|
9
|
+
/** Get additional details for a stat group. Omit all group selectors for aggregate details. */
|
|
10
|
+
const main = /*#__PURE__*/ l.query($nsid, $params, $output, ["QueueNotFound"]);
|
|
11
|
+
export { main };
|
|
12
|
+
const $lxm = $nsid;
|
|
13
|
+
export { $lxm };
|
|
14
|
+
const reportTypeStats = /*#__PURE__*/ l.typedObject($nsid, "reportTypeStats", /*#__PURE__*/ l.object({ "reportType": /*#__PURE__*/ l.string(), "inboundCount": /*#__PURE__*/ l.integer({ "minimum": 0 }) }));
|
|
15
|
+
export { reportTypeStats };
|
|
16
|
+
/** Unmuted inbound reports by actual reason, across all statuses, within the selected stat group and UTC date range. */
|
|
17
|
+
const reportTypeBreakdown = /*#__PURE__*/ l.typedObject($nsid, "reportTypeBreakdown", /*#__PURE__*/ l.object({ "totalCount": /*#__PURE__*/ l.integer({ "minimum": 0 }), "stats": /*#__PURE__*/ l.array(/*#__PURE__*/ l.ref((() => reportTypeStats))) }));
|
|
18
|
+
export { reportTypeBreakdown };
|
|
19
|
+
//# sourceMappingURL=getStatGroupDetails.defs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStatGroupDetails.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/tools/ozone/report/getStatGroupDetails.defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAC;AAExC,MAAM,KAAK,GAAG,wCAAwC,CAAC;AAIvD,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAC,SAAS,EAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,SAAS,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,cAAc,EAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAC,QAAQ,EAAC,KAAK,EAAC,CAAC,CAAC,EAAC,aAAa,EAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,EA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AAC,CAAC,MAAM,EAAE,EAAC,cAAc,EAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,SAAS,EAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAEtN,OAAO,EAAE,eAAe,EAAE,CAAC;AAY3B,wHAAwH;AACxH,MAAM,mBAAmB,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CAAsB,KAAK,EAAE,qBAAqB,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAC,YAAY,EAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,SAAS,EAAC,CAAC,EAAC,CAAC,EAAC,OAAO,EAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAkB,CAAC,GAAG,EAAE,CAAC,eAAe,CAAQ,CAAC,CAAG,EAAC,CAAC,CAAC,CAAC;AAEhS,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from \"@atproto/lex-schema\";\n\nconst $nsid = \"tools.ozone.report.getStatGroupDetails\";\n\ntype $nsid = typeof $nsid;\n\nexport { $nsid };\n\nexport const $params = /*#__PURE__*/ l.params({\"queueId\":/*#__PURE__*/ l.optional(/*#__PURE__*/ l.integer({\"minimum\":-1})),\"moderatorDid\":/*#__PURE__*/ l.optional(/*#__PURE__*/ l.string({\"format\":\"did\"})),\"reportTypes\":/*#__PURE__*/ l.optional(/*#__PURE__*/ l.array(/*#__PURE__*/ l.string(), {\"minLength\":1,\"maxLength\":100})),\"startDate\":/*#__PURE__*/ l.optional(/*#__PURE__*/ l.string({\"format\":\"datetime\"})),\"endDate\":/*#__PURE__*/ l.optional(/*#__PURE__*/ l.string({\"format\":\"datetime\"}))});\n\nexport type $Params = l.InferOutput<typeof $params>;\n\nexport const $output = /*#__PURE__*/ l.jsonPayload({\"computedAt\":/*#__PURE__*/ l.string({\"format\":\"datetime\"}),\"startDate\":/*#__PURE__*/ l.string({\"format\":\"datetime\"}),\"endDate\":/*#__PURE__*/ l.string({\"format\":\"datetime\"}),\"reportTypeBreakdown\":/*#__PURE__*/ l.ref<ReportTypeBreakdown>((() => reportTypeBreakdown) as any)});\n\nexport type $Output<B = l.BinaryData> = l.InferPayload<typeof $output, B>;\nexport type $OutputBody<B = l.BinaryData> = l.InferPayloadBody<typeof $output, B>;\n\n/** Get additional details for a stat group. Omit all group selectors for aggregate details. */\nconst main = /*#__PURE__*/ l.query($nsid, $params, $output, [\"QueueNotFound\"]);\n\nexport { main };\n\nconst $lxm = $nsid;\n\ntype $lxm = typeof $lxm;\n\nexport { $lxm };\n\ntype ReportTypeStats = { $type?: \"tools.ozone.report.getStatGroupDetails#reportTypeStats\";\n\n /**\n * Fully qualified report reason.\n */\n \"reportType\":string;\n\n /**\n * Unmuted reports received during the requested UTC calendar days.\n */\n \"inboundCount\":number };\n\nexport type { ReportTypeStats };\n\nconst reportTypeStats = /*#__PURE__*/ l.typedObject<ReportTypeStats>($nsid, \"reportTypeStats\", /*#__PURE__*/ l.object({\"reportType\":/*#__PURE__*/ l.string(),\"inboundCount\":/*#__PURE__*/ l.integer({\"minimum\":0})}));\n\nexport { reportTypeStats };\n\n/** Unmuted inbound reports by actual reason, across all statuses, within the selected stat group and UTC date range. */\ntype ReportTypeBreakdown = { $type?: \"tools.ozone.report.getStatGroupDetails#reportTypeBreakdown\";\n\n /**\n * Total unmuted inbound reports in this breakdown.\n */\n \"totalCount\":number;\"stats\":(ReportTypeStats)[] };\n\nexport type { ReportTypeBreakdown };\n\n/** Unmuted inbound reports by actual reason, across all statuses, within the selected stat group and UTC date range. */\nconst reportTypeBreakdown = /*#__PURE__*/ l.typedObject<ReportTypeBreakdown>($nsid, \"reportTypeBreakdown\", /*#__PURE__*/ l.object({\"totalCount\":/*#__PURE__*/ l.integer({\"minimum\":0}),\"stats\":/*#__PURE__*/ l.array(/*#__PURE__*/ l.ref<ReportTypeStats>((() => reportTypeStats) as any), )}));\n\nexport { reportTypeBreakdown };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStatGroupDetails.js","sourceRoot":"","sources":["../../../../../src/lexicons/tools/ozone/report/getStatGroupDetails.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * from \"./getStatGroupDetails.defs.js\";\nexport { main as default } from \"./getStatGroupDetails.defs.js\";\n"]}
|
|
@@ -4,6 +4,7 @@ export * as getHistoricalStats from "./report/getHistoricalStats.js";
|
|
|
4
4
|
export * as getLatestReport from "./report/getLatestReport.js";
|
|
5
5
|
export * as getLiveStats from "./report/getLiveStats.js";
|
|
6
6
|
export * as getReport from "./report/getReport.js";
|
|
7
|
+
export * as getStatGroupDetails from "./report/getStatGroupDetails.js";
|
|
7
8
|
export * as listActivities from "./report/listActivities.js";
|
|
8
9
|
export * as queryActivities from "./report/queryActivities.js";
|
|
9
10
|
export * as queryModeratorActivity from "./report/queryModeratorActivity.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../src/lexicons/tools/ozone/report.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC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AC7D,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC"}
|
|
@@ -7,6 +7,7 @@ export * as getHistoricalStats from "./report/getHistoricalStats.js";
|
|
|
7
7
|
export * as getLatestReport from "./report/getLatestReport.js";
|
|
8
8
|
export * as getLiveStats from "./report/getLiveStats.js";
|
|
9
9
|
export * as getReport from "./report/getReport.js";
|
|
10
|
+
export * as getStatGroupDetails from "./report/getStatGroupDetails.js";
|
|
10
11
|
export * as listActivities from "./report/listActivities.js";
|
|
11
12
|
export * as queryActivities from "./report/queryActivities.js";
|
|
12
13
|
export * as queryModeratorActivity from "./report/queryModeratorActivity.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../../src/lexicons/tools/ozone/report.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,sBAAsB,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * as assignModerator from \"./report/assignModerator.js\";\nexport * as getAssignments from \"./report/getAssignments.js\";\nexport * as getHistoricalStats from \"./report/getHistoricalStats.js\";\nexport * as getLatestReport from \"./report/getLatestReport.js\";\nexport * as getLiveStats from \"./report/getLiveStats.js\";\nexport * as getReport from \"./report/getReport.js\";\nexport * as listActivities from \"./report/listActivities.js\";\nexport * as queryActivities from \"./report/queryActivities.js\";\nexport * as queryModeratorActivity from \"./report/queryModeratorActivity.js\";\nexport * as queryReports from \"./report/queryReports.js\";\nexport * as reassignQueue from \"./report/reassignQueue.js\";\nexport * as refreshStats from \"./report/refreshStats.js\";\nexport * as unassignModerator from \"./report/unassignModerator.js\";\nexport * as closeReports from \"./report/closeReports.js\";\nexport * as createActivity from \"./report/createActivity.js\";\nexport * as defs from \"./report/defs.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../../src/lexicons/tools/ozone/report.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,sBAAsB,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * as assignModerator from \"./report/assignModerator.js\";\nexport * as getAssignments from \"./report/getAssignments.js\";\nexport * as getHistoricalStats from \"./report/getHistoricalStats.js\";\nexport * as getLatestReport from \"./report/getLatestReport.js\";\nexport * as getLiveStats from \"./report/getLiveStats.js\";\nexport * as getReport from \"./report/getReport.js\";\nexport * as getStatGroupDetails from \"./report/getStatGroupDetails.js\";\nexport * as listActivities from \"./report/listActivities.js\";\nexport * as queryActivities from \"./report/queryActivities.js\";\nexport * as queryModeratorActivity from \"./report/queryModeratorActivity.js\";\nexport * as queryReports from \"./report/queryReports.js\";\nexport * as reassignQueue from \"./report/reassignQueue.js\";\nexport * as refreshStats from \"./report/refreshStats.js\";\nexport * as unassignModerator from \"./report/unassignModerator.js\";\nexport * as closeReports from \"./report/closeReports.js\";\nexport * as createActivity from \"./report/createActivity.js\";\nexport * as defs from \"./report/defs.js\";\n"]}
|
package/dist/report/stats.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type Selectable } from 'kysely';
|
|
|
2
2
|
import type { DidString } from '@atproto/lex-schema';
|
|
3
3
|
import type { Database } from '../db/index.js';
|
|
4
4
|
import type { ReportStat } from '../db/schema/report_stat.js';
|
|
5
|
+
import { tools } from '../lexicons/index.js';
|
|
6
|
+
import type { QueueAccess } from '../queue/access.js';
|
|
5
7
|
/**
|
|
6
8
|
* Grouped report types. Stats are computed per group rather than per individual report type.
|
|
7
9
|
* Frontend should match for proper stat lookup.
|
|
@@ -84,6 +86,8 @@ export declare class ReportStatsService {
|
|
|
84
86
|
* the existing PG <15 NULL semantics without needing a unique index.
|
|
85
87
|
*/
|
|
86
88
|
private bulkUpsert;
|
|
89
|
+
/** Fetch additional details for one report stat group and UTC calendar window. */
|
|
90
|
+
getStatGroupDetails(params: tools.ozone.report.getStatGroupDetails.$Params, access: QueueAccess, signal?: AbortSignal): Promise<tools.ozone.report.getStatGroupDetails.$OutputBody>;
|
|
87
91
|
/** Get a single stat row for a date + group. */
|
|
88
92
|
private getStatForDate;
|
|
89
93
|
/** Get today's live stats for a group. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/report/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAO,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAGpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/report/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAO,MAAM,QAAQ,CAAA;AAE7C,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAGpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAEzE,OAAO,EAAO,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAKrD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAqEvD,CAAA;AAKD,MAAM,MAAM,yBAAyB,GAAG,CAAC,EAAE,EAA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QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CA2ChE;CACF"}
|
package/dist/report/stats.js
CHANGED
|
@@ -84,6 +84,7 @@ export const REPORT_TYPE_GROUPS = {
|
|
|
84
84
|
],
|
|
85
85
|
};
|
|
86
86
|
const REPORT_STAT_LIVE_TTL = 15 * MINUTE;
|
|
87
|
+
const MAX_STAT_GROUP_DETAILS_DAYS = 120;
|
|
87
88
|
export class ReportStatsService {
|
|
88
89
|
constructor(db) {
|
|
89
90
|
this.db = db;
|
|
@@ -586,6 +587,61 @@ export class ReportStatsService {
|
|
|
586
587
|
});
|
|
587
588
|
}
|
|
588
589
|
// ─── Read methods ───
|
|
590
|
+
/** Fetch additional details for one report stat group and UTC calendar window. */
|
|
591
|
+
async getStatGroupDetails(params, access, signal) {
|
|
592
|
+
const computedAt = currentDatetimeString();
|
|
593
|
+
const startDate = toDatetimeString(`${toDatetimeString(params.startDate ?? computedAt).slice(0, 10)}T00:00:00.000Z`);
|
|
594
|
+
const endDate = toDatetimeString(`${toDatetimeString(params.endDate ?? computedAt).slice(0, 10)}T00:00:00.000Z`);
|
|
595
|
+
const day = 86_400_000;
|
|
596
|
+
const duration = Date.parse(endDate) - Date.parse(startDate) + day;
|
|
597
|
+
if (!Number.isFinite(duration) ||
|
|
598
|
+
duration <= 0 ||
|
|
599
|
+
duration > MAX_STAT_GROUP_DETAILS_DAYS * day) {
|
|
600
|
+
throw new InvalidRequestError(`Date range must be ordered and include at most ${MAX_STAT_GROUP_DETAILS_DAYS} calendar days`);
|
|
601
|
+
}
|
|
602
|
+
const endExclusive = toDatetimeString(Date.parse(endDate) + day);
|
|
603
|
+
const { queueId, moderatorDid, reportTypes } = params;
|
|
604
|
+
const predicates = [
|
|
605
|
+
sql `"isMuted" = false`,
|
|
606
|
+
sql `"createdAt" >= ${startDate} and "createdAt" < ${endExclusive}`,
|
|
607
|
+
sql `("queueId" is null or ${access.filter('queueId')})`,
|
|
608
|
+
];
|
|
609
|
+
if (queueId === -1) {
|
|
610
|
+
predicates.push(sql `("queueId" is null or "queueId" = -1)`);
|
|
611
|
+
}
|
|
612
|
+
else if (queueId !== undefined) {
|
|
613
|
+
predicates.push(sql `"queueId" = ${queueId}`);
|
|
614
|
+
}
|
|
615
|
+
else if (moderatorDid) {
|
|
616
|
+
predicates.push(sql `"assignedTo" = ${moderatorDid}`);
|
|
617
|
+
}
|
|
618
|
+
else if (reportTypes?.length) {
|
|
619
|
+
predicates.push(sql `"reportType" in (${sql.join(reportTypes)})`);
|
|
620
|
+
}
|
|
621
|
+
const result = await sql `
|
|
622
|
+
select "reportType", count(*) as "inboundCount"
|
|
623
|
+
from report
|
|
624
|
+
where ${sql.join(predicates, sql ` and `)}
|
|
625
|
+
group by "reportType"
|
|
626
|
+
order by "inboundCount" desc, "reportType"
|
|
627
|
+
`.execute(this.db.db, {
|
|
628
|
+
signal,
|
|
629
|
+
inflightQueryAbortStrategy: 'cancel query',
|
|
630
|
+
});
|
|
631
|
+
const stats = result.rows.map((row) => ({
|
|
632
|
+
reportType: row.reportType,
|
|
633
|
+
inboundCount: Number(row.inboundCount),
|
|
634
|
+
}));
|
|
635
|
+
return {
|
|
636
|
+
computedAt,
|
|
637
|
+
startDate,
|
|
638
|
+
endDate,
|
|
639
|
+
reportTypeBreakdown: {
|
|
640
|
+
totalCount: stats.reduce((total, row) => total + row.inboundCount, 0),
|
|
641
|
+
stats,
|
|
642
|
+
},
|
|
643
|
+
};
|
|
644
|
+
}
|
|
589
645
|
/** Get a single stat row for a date + group. */
|
|
590
646
|
async getStatForDate(date, group) {
|
|
591
647
|
let qb = this.db.db
|
package/dist/report/stats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/report/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,O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,OAAO,IAAI,MAAM;QACnB,CAAC,CAAC,YAAY,IAAI,MAAM;QACxB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM;KACvD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACb,CAAC;AAED,yDAAyD;AACzD,SAAS,YAAY,CAAC,CAAO;IAC3B,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAe,CAAA;AACvD,CAAC;AAED,yCAAyC;AACzC,SAAS,QAAQ,CAAC,OAAmB;IACnC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,OAAO,gBAAgB,CAAC,CAAA;IAC9C,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAA;IAChC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAA;AACxB,CAAC","sourcesContent":["import { type Selectable, sql } from 'kysely'\nimport { MINUTE } from '@atproto/common'\nimport type { DatetimeString, DidString } from '@atproto/lex-schema'\nimport { currentDatetimeString, toDatetimeString } from '@atproto/lex-schema'\nimport { InvalidRequestError } from '@atproto/xrpc-server'\nimport type { Database } from '../db/index.js'\nimport { ComputedAtIdKeyset, paginate } from '../db/pagination.js'\nimport type { DateString, ReportStat } from '../db/schema/report_stat.js'\nimport { jsonb } from '../db/types.js'\nimport { com, tools } from '../lexicons/index.js'\nimport { dbLogger } from '../logger.js'\n\n// @NOTE Note some values here are not part of the lexicon and hard coded for\n// legacy reasons.\n\n/**\n * Grouped report types. Stats are computed per group rather than per individual report type.\n * Frontend should match for proper stat lookup.\n * https://github.com/bluesky-social/ozone/blob/main/components/reports/helpers/getType.ts\n */\nexport const REPORT_TYPE_GROUPS: Record<string, string[]> = {\n Legacy: [\n com.atproto.moderation.defs.ReasonSpam,\n com.atproto.moderation.defs.ReasonViolation,\n com.atproto.moderation.defs.ReasonMisleading,\n com.atproto.moderation.defs.ReasonSexual,\n com.atproto.moderation.defs.ReasonRude,\n com.atproto.moderation.defs.ReasonOther,\n com.atproto.moderation.defs.ReasonAppeal,\n ],\n Appeal: [tools.ozone.report.defs.ReasonAppeal],\n Violence: [\n 'tools.ozone.report.defs#reasonViolenceAnimalWelfare',\n tools.ozone.report.defs.ReasonViolenceThreats,\n tools.ozone.report.defs.ReasonViolenceGraphicContent,\n 'tools.ozone.report.defs#reasonViolenceSelfHarm',\n tools.ozone.report.defs.ReasonViolenceGlorification,\n tools.ozone.report.defs.ReasonViolenceExtremistContent,\n tools.ozone.report.defs.ReasonViolenceTrafficking,\n tools.ozone.report.defs.ReasonViolenceOther,\n ],\n Sexual: [\n tools.ozone.report.defs.ReasonSexualAbuseContent,\n 'tools.ozone.report.defs#reasonSexualNCII',\n 'tools.ozone.report.defs#reasonSexualSextortion',\n tools.ozone.report.defs.ReasonSexualDeepfake,\n tools.ozone.report.defs.ReasonSexualAnimal,\n tools.ozone.report.defs.ReasonSexualUnlabeled,\n tools.ozone.report.defs.ReasonSexualOther,\n ],\n 'Child Safety': [\n 'tools.ozone.report.defs#reasonChildSafetyCSAM',\n tools.ozone.report.defs.ReasonChildSafetyGroom,\n 'tools.ozone.report.defs#reasonChildSafetyMinorPrivacy',\n 'tools.ozone.report.defs#reasonChildSafetyEndangerment',\n tools.ozone.report.defs.ReasonChildSafetyHarassment,\n 'tools.ozone.report.defs#reasonChildSafetyPromotion',\n tools.ozone.report.defs.ReasonChildSafetyOther,\n ],\n Harassment: [\n tools.ozone.report.defs.ReasonHarassmentTroll,\n tools.ozone.report.defs.ReasonHarassmentTargeted,\n tools.ozone.report.defs.ReasonHarassmentHateSpeech,\n tools.ozone.report.defs.ReasonHarassmentDoxxing,\n tools.ozone.report.defs.ReasonHarassmentOther,\n ],\n Misleading: [\n tools.ozone.report.defs.ReasonMisleadingBot,\n tools.ozone.report.defs.ReasonMisleadingImpersonation,\n tools.ozone.report.defs.ReasonMisleadingSpam,\n tools.ozone.report.defs.ReasonMisleadingScam,\n 'tools.ozone.report.defs#reasonMisleadingSyntheticContent',\n 'tools.ozone.report.defs#reasonMisleadingMisinformation',\n tools.ozone.report.defs.ReasonMisleadingOther,\n ],\n 'Rule Violations': [\n tools.ozone.report.defs.ReasonRuleSiteSecurity,\n 'tools.ozone.report.defs#reasonRuleStolenContent',\n tools.ozone.report.defs.ReasonRuleProhibitedSales,\n tools.ozone.report.defs.ReasonRuleBanEvasion,\n tools.ozone.report.defs.ReasonRuleOther,\n ],\n Civic: [\n 'tools.ozone.report.defs#reasonCivicElectoralProcess',\n 'tools.ozone.report.defs#reasonCivicDisclosure',\n 'tools.ozone.report.defs#reasonCivicInterference',\n 'tools.ozone.report.defs#reasonCivicMisinformation',\n 'tools.ozone.report.defs#reasonCivicImpersonation',\n ],\n}\n\nconst REPORT_STAT_LIVE_TTL = 15 * MINUTE\n\nexport type ReportStatsServiceCreator = (db: Database) => ReportStatsService\n\nexport type ReportStatGroup = {\n queueId: number | null\n moderatorDid: DidString | null\n reportTypes: string[] | null\n}\nexport type ReportStatistics = {\n inboundCount: number\n pendingCount?: number\n closureTargetOverdueCount?: number\n closureTargetMetCount: number\n closureTargetMissedCount: number\n closedCount: number\n actionedCount: number\n acknowledgedCount: number\n escalatedCount: number\n labelActionCount: number\n tagActionCount: number\n takedownActionCount: number\n ahtDurationSec: number\n ahtSampleCount: number\n resolutionDurationSec: number\n resolutionSampleCount: number\n actionRate?: number\n avgHandlingTimeSec?: number\n avgResolutionTimeSec?: number\n}\n\n// DB types\ntype StatGroup = {\n group: 'aggregate' | 'queue' | 'reportType' | 'moderator'\n queueId: number | null\n reportType: string | null\n moderatorDid: string | null\n}\ntype StatsRow = StatGroup & {\n inboundCount: string\n pendingCount: string\n closureTargetOverdueCount: string\n closureTargetMetCount: string\n closureTargetMissedCount: string\n closedCount: string\n actionedCount: string\n acknowledgedCount: string\n escalatedCount: string\n labelActionCount: string\n tagActionCount: string\n takedownActionCount: string\n ahtDurationSec: string\n ahtSampleCount: string\n resolutionDurationSec: string\n resolutionSampleCount: string\n}\ntype StatsMetric = Exclude<keyof StatsRow, keyof StatGroup>\ntype StatsQueryRow<Metric extends StatsMetric> = StatGroup &\n Pick<StatsRow, Metric>\ntype LifecycleMetric = Exclude<\n StatsMetric,\n | 'inboundCount'\n | 'pendingCount'\n | 'closureTargetOverdueCount'\n | 'escalatedCount'\n>\ntype InboundStatsRow = StatsQueryRow<'inboundCount'>\ntype PendingStatsRow = StatsQueryRow<\n 'pendingCount' | 'closureTargetOverdueCount'\n>\ntype ClosureStatsRow = StatsQueryRow<LifecycleMetric>\ntype EscalationStatsRow = StatsQueryRow<'escalatedCount'>\ntype BatchedStats = Map<string, StatsRow>\ntype UpsertRow = {\n date: DateString\n queueId: number | null\n moderatorDid: DidString | null\n reportTypes: string[] | null\n inboundCount: number | null\n pendingCount: number | null\n closureTargetOverdueCount: number | null\n closureTargetMetCount: number | null\n closureTargetMissedCount: number | null\n closedCount: number | null\n actionedCount: number | null\n acknowledgedCount: number | null\n escalatedCount: number | null\n labelActionCount: number | null\n tagActionCount: number | null\n takedownActionCount: number | null\n ahtDurationSec: number | null\n ahtSampleCount: number | null\n resolutionDurationSec: number | null\n resolutionSampleCount: number | null\n actionRate: number | null\n avgHandlingTimeSec: number | null\n avgResolutionTimeSec: number | null\n computedAt: DatetimeString\n}\n\nexport class ReportStatsService {\n constructor(public db: Database) {}\n\n static creator(): ReportStatsServiceCreator {\n return (db: Database) => new ReportStatsService(db)\n }\n\n /**\n * Compute stats for today and finalize yesterday if needed.\n * Called periodically by the StatsComputer daemon.\n */\n async materializeAll(opts?: { force?: boolean }): Promise<{\n rowsWritten: number\n }> {\n try {\n const start = Date.now()\n const today = toDateString(new Date(start))\n const yesterday = toDateString(new Date(start - 24 * 60 * 60 * 1000))\n\n // Always compute today's stats\n let rowsWritten = await this.materializeDate(today, opts)\n\n // Finalize yesterday if its snapshot is missing or stale\n if (!opts?.force) {\n const yesterdayRow = await this.db.db\n .selectFrom('report_stat')\n .select('computedAt')\n .where('date', '=', yesterday)\n .where('queueId', 'is', null)\n .where('moderatorDid', 'is', null)\n .where('reportTypes', 'is', null)\n .orderBy('computedAt', 'desc')\n .executeTakeFirst()\n const endOfYesterday = new Date(`${today}T00:00:00.000Z`).getTime()\n if (\n !yesterdayRow ||\n new Date(yesterdayRow.computedAt).getTime() < endOfYesterday\n ) {\n rowsWritten += await this.materializeDate(yesterday, { force: true })\n }\n } else {\n rowsWritten += await this.materializeDate(yesterday, { force: true })\n }\n\n const duration = Date.now() - start\n dbLogger.info({ duration }, 'report stats materialization completed')\n return { rowsWritten }\n } catch (err) {\n dbLogger.error({ err }, 'report stats materialization errored')\n throw err\n }\n }\n\n /**\n * Compute stats for a specific date range. Used by the refreshStats endpoint.\n */\n async refreshDateRange(opts: {\n startDate: string\n endDate: string\n queueIds?: number[]\n }): Promise<void> {\n const start = new Date(opts.startDate)\n const end = new Date(opts.endDate)\n const endOfToday = new Date()\n endOfToday.setUTCHours(23, 59, 59, 999)\n if (end > endOfToday) {\n throw new InvalidRequestError(\n 'Cannot refresh statistics for future dates',\n )\n }\n\n for (let d = new Date(start); d <= end; d.setUTCDate(d.getUTCDate() + 1)) {\n const dateStr = toDateString(d)\n if (opts.queueIds?.length) {\n // Recompute only specific queue groups for this date\n const computedAt = currentDatetimeString()\n const batched = await this.computeBatchedStats(dateStr, computedAt)\n const rows: UpsertRow[] = []\n for (const queueId of opts.queueIds) {\n const group: ReportStatGroup = {\n queueId,\n moderatorDid: null,\n reportTypes: null,\n }\n const stats = this.resolveGroupStats(group, batched)\n rows.push(this.buildUpsertRow(dateStr, group, stats, computedAt))\n }\n await this.bulkUpsert(rows)\n } else {\n await this.materializeDate(dateStr, { force: true })\n }\n }\n }\n\n /** Compute and write all groups for a single date. */\n private async materializeDate(\n date: DateString,\n opts?: { force?: boolean },\n ): Promise<number> {\n // @NOTE Timestamp the start so a computation crossing midnight still needs\n // historical finalization on the next cycle.\n const computedAt = currentDatetimeString()\n const groups = await this.enumerateGroups()\n const batched = await this.computeBatchedStats(date, computedAt)\n const today = computedAt.slice(0, 10)\n const isToday = date === today\n\n // Batch the cache check so we don't issue one SELECT per group.\n const existingByKey = !opts?.force\n ? await this.fetchExistingStatsByKey(date)\n : null\n\n const rows: UpsertRow[] = []\n for (const group of groups) {\n try {\n if (existingByKey) {\n const cached = existingByKey.get(groupKey(group))\n if (cached) {\n // Historical dates: never recompute. Today: recompute if stale.\n if (!isToday) continue\n const age = Date.now() - new Date(cached.computedAt).getTime()\n if (age < REPORT_STAT_LIVE_TTL) continue\n }\n }\n const stats = this.resolveGroupStats(group, batched)\n rows.push(this.buildUpsertRow(date, group, stats, computedAt))\n } catch (err) {\n dbLogger.error(\n { err, group, date },\n 'error preparing report stats group',\n )\n }\n }\n\n await this.bulkUpsert(rows)\n return rows.length\n }\n\n /** Fetch all stat rows for a date, keyed by groupKey for O(1) lookup. */\n private async fetchExistingStatsByKey(\n date: DateString,\n ): Promise<Map<string, Selectable<ReportStat>>> {\n const existing = await this.db.db\n .selectFrom('report_stat')\n .selectAll()\n .where('date', '=', date)\n .execute()\n const map = new Map<string, Selectable<ReportStat>>()\n for (const row of existing) {\n map.set(\n groupKey({\n queueId: row.queueId,\n moderatorDid: row.moderatorDid,\n reportTypes: row.reportTypes,\n }),\n row,\n )\n }\n return map\n }\n\n /** List out the groups to compute stats for. */\n private async enumerateGroups(): Promise<ReportStatGroup[]> {\n const groups: ReportStatGroup[] = []\n\n const queues = await this.db.db\n .selectFrom('report_queue')\n .selectAll()\n .where('enabled', '=', true)\n .where('deletedAt', 'is', null)\n .execute()\n const members = await this.db.db\n .selectFrom('member')\n .select('did')\n .where('disabled', '=', false)\n .where('role', 'in', [\n tools.ozone.team.defs.RoleAdmin,\n tools.ozone.team.defs.RoleModerator,\n tools.ozone.team.defs.RoleTriage,\n ])\n .execute()\n\n // aggregate\n groups.push({ queueId: null, moderatorDid: null, reportTypes: null })\n // per queue\n for (const queue of queues) {\n groups.push({ queueId: queue.id, moderatorDid: null, reportTypes: null })\n }\n // unqueued\n groups.push({ queueId: -1, moderatorDid: null, reportTypes: null })\n // per moderator\n for (const member of members) {\n groups.push({\n queueId: null,\n moderatorDid: member.did,\n reportTypes: null,\n })\n }\n // per report type group\n for (const groupTypes of Object.values(REPORT_TYPE_GROUPS)) {\n groups.push({\n queueId: null,\n moderatorDid: null,\n reportTypes: groupTypes,\n })\n }\n\n return groups\n }\n\n /**\n * Run batched queries for a calendar date.\n *\n * @description\n * For each cohort, compute relevant groupings.\n *\n * Stat cohorts: inbound, pending, closed, escalated\n *\n * Stat groups: aggregate, per queue, per report type, and per moderator.\n */\n private async computeBatchedStats(\n date: DateString,\n computedAt: DatetimeString,\n ): Promise<BatchedStats> {\n const dayStart: DatetimeString = `${date}T00:00:00.000Z`\n const dayEnd: DatetimeString = `${nextDate(date)}T00:00:00.000Z`\n\n // 1. create report grouping statements\n const statGroups = sql`\n case\n when grouping(coalesce(r.\"queueId\", -1)) = 0 then 'queue'\n when grouping(r.\"reportType\") = 0 then 'reportType'\n when grouping(r.\"assignedTo\") = 0 then 'moderator'\n else 'aggregate'\n end as \"group\",\n case when grouping(coalesce(r.\"queueId\", -1)) = 0 then coalesce(r.\"queueId\", -1) end as \"queueId\",\n case when grouping(r.\"reportType\") = 0 then r.\"reportType\" end as \"reportType\",\n case when grouping(r.\"assignedTo\") = 0 then r.\"assignedTo\" end as \"moderatorDid\"`\n const statGroupsExceptModerator = sql`\n case\n when grouping(coalesce(r.\"queueId\", -1)) = 0 then 'queue'\n when grouping(r.\"reportType\") = 0 then 'reportType'\n else 'aggregate'\n end as \"group\",\n case when grouping(coalesce(r.\"queueId\", -1)) = 0 then coalesce(r.\"queueId\", -1) end as \"queueId\",\n case when grouping(r.\"reportType\") = 0 then r.\"reportType\" end as \"reportType\",\n null as \"moderatorDid\"`\n\n // 2. inbound stats\n const inboundStats = () =>\n sql<InboundStatsRow>`\n select ${statGroups}, count(*) as \"inboundCount\"\n from report r\n where r.\"createdAt\" >= ${dayStart} and r.\"createdAt\" < ${dayEnd}\n and r.\"isMuted\" = false\n group by grouping sets ((), (coalesce(r.\"queueId\", -1)), (r.\"reportType\"), (r.\"assignedTo\"))\n `.execute(this.db.db)\n\n // 3. pending stats\n const computedAtDate = computedAt.slice(0, 10)\n const pendingAsOf = date < computedAtDate ? dayEnd : computedAt\n const pendingReports =\n date < computedAtDate\n ? sql`\n with subsequent_transitions as (\n select distinct on (\"reportId\") \"reportId\", \"activityType\"\n from report_activity\n where \"createdAt\" >= ${dayEnd}\n and \"activityType\" in ('closeActivity', 'reopenActivity')\n order by \"reportId\", \"createdAt\", id\n ), candidates as (\n select id, \"queueId\", \"reportType\", \"createdAt\", \"priorityTargetMinutes\" from report\n where status != 'closed' and \"isMuted\" = false\n and \"createdAt\" < ${dayEnd}\n union all\n select id, \"queueId\", \"reportType\", \"createdAt\", \"priorityTargetMinutes\" from report\n where status = 'closed' and \"closedAt\" >= ${dayEnd}\n and \"isMuted\" = false and \"createdAt\" < ${dayEnd}\n )\n select r.\"queueId\", r.\"reportType\", r.\"createdAt\", r.\"priorityTargetMinutes\"\n from candidates r\n left join subsequent_transitions t on t.\"reportId\" = r.id\n where t.\"activityType\" is distinct from 'reopenActivity'\n `\n : sql`\n select \"queueId\", \"reportType\", \"createdAt\", \"priorityTargetMinutes\"\n from report where status != 'closed' and \"isMuted\" = false\n `\n const pendingStats = () =>\n sql<PendingStatsRow>`\n select ${statGroupsExceptModerator}, count(*) as \"pendingCount\",\n count(*) filter (\n where r.\"priorityTargetMinutes\" > 0\n and extract(epoch from (${pendingAsOf}::timestamptz - r.\"createdAt\"::timestamptz))\n > r.\"priorityTargetMinutes\"::bigint * 60\n ) as \"closureTargetOverdueCount\"\n from (${pendingReports}) r\n group by grouping sets ((), (coalesce(r.\"queueId\", -1)), (r.\"reportType\"))\n `.execute(this.db.db)\n\n // 4. closure stats\n const closureStats = () =>\n sql<ClosureStatsRow>`\n with closed_reports as (\n select\n r.\"queueId\", r.\"reportType\", r.\"assignedTo\",\n r.\"createdAt\", r.\"assignedAt\", r.\"closedAt\", r.\"priorityTargetMinutes\",\n -- @NOTE Explicit no-action closures retain earlier action links as history.\n case when (\n select activity.meta ->> 'resolution'\n from report_activity activity\n where activity.\"reportId\" = r.id\n and activity.\"activityType\" = 'closeActivity'\n order by activity.\"createdAt\" desc, activity.id desc\n limit 1\n ) = 'noAction' then null\n else (r.\"actionEventIds\" ->> -1)::integer\n end as \"actionEventId\"\n from report r\n where r.\"closedAt\" >= ${dayStart} and r.\"closedAt\" < ${dayEnd}\n ), closure_outcomes as (\n select r.*,\n case me.action\n when ${tools.ozone.moderation.defs.modEventLabel.$type} then 'label'\n when ${tools.ozone.moderation.defs.modEventTag.$type} then 'tag'\n when ${tools.ozone.moderation.defs.modEventTakedown.$type} then 'takedown'\n else 'acknowledged'\n end as outcome\n from closed_reports r\n left join moderation_event me on me.id = r.\"actionEventId\"\n ), closure_durations as (\n select r.*,\n case when r.\"assignedAt\" is not null then\n greatest(0, extract(epoch from (r.\"closedAt\"::timestamp - r.\"assignedAt\"::timestamp)))\n end as \"handlingTimeSec\",\n greatest(0, extract(epoch from (r.\"closedAt\"::timestamp - r.\"createdAt\"::timestamp))) as \"resolutionTimeSec\",\n case when r.\"priorityTargetMinutes\" > 0\n and r.\"closedAt\"::timestamptz >= r.\"createdAt\"::timestamptz\n then extract(epoch from (r.\"closedAt\"::timestamptz - r.\"createdAt\"::timestamptz))\n <= r.\"priorityTargetMinutes\"::bigint * 60\n end as \"closureTargetMet\"\n from closure_outcomes r\n )\n select ${statGroups},\n count(*) as \"closedCount\",\n count(*) filter (where r.\"closureTargetMet\") as \"closureTargetMetCount\",\n count(*) filter (where not r.\"closureTargetMet\") as \"closureTargetMissedCount\",\n count(*) filter (where r.outcome != 'acknowledged') as \"actionedCount\",\n count(*) filter (where r.outcome = 'acknowledged') as \"acknowledgedCount\",\n count(*) filter (where r.outcome = 'label') as \"labelActionCount\",\n count(*) filter (where r.outcome = 'tag') as \"tagActionCount\",\n count(*) filter (where r.outcome = 'takedown') as \"takedownActionCount\",\n coalesce(sum(r.\"handlingTimeSec\"), 0) as \"ahtDurationSec\",\n count(r.\"handlingTimeSec\") as \"ahtSampleCount\",\n coalesce(sum(r.\"resolutionTimeSec\"), 0) as \"resolutionDurationSec\",\n count(*) as \"resolutionSampleCount\"\n from closure_durations r\n group by grouping sets ((), (coalesce(r.\"queueId\", -1)), (r.\"reportType\"), (r.\"assignedTo\"))\n `.execute(this.db.db)\n\n // 5. escalation stats\n const escalationStats = () =>\n sql<EscalationStatsRow>`\n select ${statGroups}, count(*) as \"escalatedCount\"\n from report_activity ra\n join report r on r.id = ra.\"reportId\"\n where ra.\"activityType\" = 'escalationActivity'\n and ra.\"createdAt\" >= ${dayStart} and ra.\"createdAt\" < ${dayEnd}\n group by grouping sets ((), (coalesce(r.\"queueId\", -1)), (r.\"reportType\"), (r.\"assignedTo\"))\n `.execute(this.db.db)\n\n // 6. execute all\n const [inbound, pending, closures, escalations] = await Promise.all([\n inboundStats(),\n pendingStats(),\n closureStats(),\n escalationStats(),\n ])\n\n return mergeStats([\n ...inbound.rows,\n ...pending.rows,\n ...closures.rows,\n ...escalations.rows,\n ])\n }\n\n /** Resolve a single group's stats from batched query results (pure in-memory). */\n private resolveGroupStats(\n group: ReportStatGroup,\n batched: BatchedStats,\n ): ReportStatistics {\n if (group.moderatorDid) {\n const row = batched.get(\n statKey({\n group: 'moderator',\n queueId: null,\n reportType: null,\n moderatorDid: group.moderatorDid,\n }),\n )\n const {\n // remove stats that arent relevant for moderator group\n pendingCount: _omit1,\n closureTargetOverdueCount: _omit2,\n ...stats\n } = this.resolveRows(row ? [row] : [])\n return stats\n }\n if (group.reportTypes !== null) {\n const rows = group.reportTypes.flatMap((reportType) => {\n const row = batched.get(\n statKey({\n group: 'reportType',\n queueId: null,\n reportType,\n moderatorDid: null,\n }),\n )\n return row ? [row] : []\n })\n return this.resolveRows(rows)\n }\n const row = batched.get(\n statKey({\n group: group.queueId === null ? 'aggregate' : 'queue',\n queueId: group.queueId,\n reportType: null,\n moderatorDid: null,\n }),\n )\n return this.resolveRows(row ? [row] : [])\n }\n\n private resolveRows(rows: StatsRow[]): ReportStatistics {\n const sum = (field: keyof StatsRow) => sumNum(rows, field)\n const inboundCount = sum('inboundCount')\n const pendingCount = sum('pendingCount')\n const closedCount = sum('closedCount')\n const actionedCount = sum('actionedCount')\n const ahtDurationSec = Math.round(sum('ahtDurationSec'))\n const ahtSampleCount = sum('ahtSampleCount')\n const resolutionDurationSec = Math.round(sum('resolutionDurationSec'))\n const resolutionSampleCount = sum('resolutionSampleCount')\n\n return {\n inboundCount,\n pendingCount,\n closedCount,\n closureTargetOverdueCount: sum('closureTargetOverdueCount'),\n closureTargetMetCount: sum('closureTargetMetCount'),\n closureTargetMissedCount: sum('closureTargetMissedCount'),\n actionedCount,\n acknowledgedCount: sum('acknowledgedCount'),\n escalatedCount: sum('escalatedCount'),\n labelActionCount: sum('labelActionCount'),\n tagActionCount: sum('tagActionCount'),\n takedownActionCount: sum('takedownActionCount'),\n ahtDurationSec,\n ahtSampleCount,\n resolutionDurationSec,\n resolutionSampleCount,\n actionRate:\n closedCount > 0\n ? Math.round((actionedCount / closedCount) * 100)\n : undefined,\n avgHandlingTimeSec:\n ahtSampleCount > 0\n ? Math.round(ahtDurationSec / ahtSampleCount)\n : undefined,\n avgResolutionTimeSec:\n resolutionSampleCount > 0\n ? Math.round(resolutionDurationSec / resolutionSampleCount)\n : undefined,\n }\n }\n\n /** Build an upsert row from (date, group, stats). */\n private buildUpsertRow(\n date: DateString,\n group: ReportStatGroup,\n stats: ReportStatistics,\n computedAt: DatetimeString,\n ): UpsertRow {\n const pendingCount =\n 'pendingCount' in stats ? (stats.pendingCount ?? null) : null\n const escalatedCount =\n 'escalatedCount' in stats ? (stats.escalatedCount ?? null) : null\n const actionRate = 'actionRate' in stats ? (stats.actionRate ?? null) : null\n\n return {\n date,\n queueId: group.queueId,\n moderatorDid: group.moderatorDid,\n reportTypes: group.reportTypes,\n inboundCount: stats.inboundCount ?? null,\n pendingCount,\n closedCount: stats.closedCount,\n closureTargetOverdueCount: stats.closureTargetOverdueCount ?? null,\n closureTargetMetCount: stats.closureTargetMetCount,\n closureTargetMissedCount: stats.closureTargetMissedCount,\n actionedCount: stats.actionedCount ?? null,\n acknowledgedCount: stats.acknowledgedCount,\n escalatedCount,\n labelActionCount: stats.labelActionCount,\n tagActionCount: stats.tagActionCount,\n takedownActionCount: stats.takedownActionCount,\n ahtDurationSec: stats.ahtDurationSec,\n ahtSampleCount: stats.ahtSampleCount,\n resolutionDurationSec: stats.resolutionDurationSec,\n resolutionSampleCount: stats.resolutionSampleCount,\n actionRate,\n avgHandlingTimeSec: stats.avgHandlingTimeSec ?? null,\n avgResolutionTimeSec: stats.avgResolutionTimeSec ?? null,\n computedAt,\n }\n }\n\n /**\n * Wraps a DELETE+INSERT for each row in a single transaction so we pay one\n * commit per cycle instead of one per group. NULL-aware WHERE clauses match\n * the existing PG <15 NULL semantics without needing a unique index.\n */\n private async bulkUpsert(rows: UpsertRow[]): Promise<void> {\n if (!rows.length) return\n\n await this.db.transaction(async (dbTxn) => {\n for (const r of rows) {\n let del = dbTxn.db.deleteFrom('report_stat').where('date', '=', r.date)\n del =\n r.queueId !== null\n ? del.where('queueId', '=', r.queueId)\n : del.where('queueId', 'is', null)\n del =\n r.moderatorDid !== null\n ? del.where('moderatorDid', '=', r.moderatorDid)\n : del.where('moderatorDid', 'is', null)\n del =\n r.reportTypes !== null\n ? del.where(\n sql<boolean>`\"reportTypes\"::jsonb = ${jsonb(r.reportTypes)}::jsonb`,\n )\n : del.where('reportTypes', 'is', null)\n await del.execute()\n\n await dbTxn.db\n .insertInto('report_stat')\n .values({\n date: r.date,\n queueId: r.queueId,\n moderatorDid: r.moderatorDid,\n reportTypes: r.reportTypes !== null ? jsonb(r.reportTypes) : null,\n inboundCount: r.inboundCount,\n pendingCount: r.pendingCount,\n closureTargetOverdueCount: r.closureTargetOverdueCount,\n closureTargetMetCount: r.closureTargetMetCount,\n closureTargetMissedCount: r.closureTargetMissedCount,\n closedCount: r.closedCount,\n actionedCount: r.actionedCount,\n acknowledgedCount: r.acknowledgedCount,\n escalatedCount: r.escalatedCount,\n labelActionCount: r.labelActionCount,\n tagActionCount: r.tagActionCount,\n takedownActionCount: r.takedownActionCount,\n ahtDurationSec: r.ahtDurationSec,\n ahtSampleCount: r.ahtSampleCount,\n resolutionDurationSec: r.resolutionDurationSec,\n resolutionSampleCount: r.resolutionSampleCount,\n actionRate: r.actionRate,\n avgHandlingTimeSec: r.avgHandlingTimeSec,\n avgResolutionTimeSec: r.avgResolutionTimeSec,\n computedAt: r.computedAt,\n })\n .execute()\n }\n })\n }\n\n // ─── Read methods ───\n\n /** Get a single stat row for a date + group. */\n private async getStatForDate(\n date: DateString,\n group: ReportStatGroup,\n ): Promise<Selectable<ReportStat> | undefined> {\n let qb = this.db.db\n .selectFrom('report_stat')\n .selectAll()\n .where('date', '=', date)\n if (group.queueId !== null) {\n qb = qb.where('queueId', '=', group.queueId)\n } else {\n qb = qb.where('queueId', 'is', null)\n }\n if (group.moderatorDid) {\n qb = qb.where('moderatorDid', '=', group.moderatorDid)\n } else {\n qb = qb.where('moderatorDid', 'is', null)\n }\n if (group.reportTypes !== null) {\n qb = qb.where(\n sql<boolean>`\"reportTypes\"::jsonb = ${jsonb(group.reportTypes)}::jsonb`,\n )\n } else {\n qb = qb.where('reportTypes', 'is', null)\n }\n return qb.executeTakeFirst()\n }\n\n /** Get today's live stats for a group. */\n async getLiveStats(\n group: ReportStatGroup,\n ): Promise<Selectable<ReportStat> | undefined> {\n const today = toDateString(new Date())\n return this.getStatForDate(today, group)\n }\n\n /** Get live stats for multiple queues in a single query. */\n async getLiveStatsForQueues(\n queueIds: number[],\n ): Promise<Map<number, Selectable<ReportStat>>> {\n if (!queueIds.length) return new Map()\n\n const today = toDateString(new Date())\n const rows = await this.db.db\n .selectFrom('report_stat')\n .selectAll()\n .where('date', '=', today)\n .where('queueId', 'in', queueIds)\n .where('moderatorDid', 'is', null)\n .where('reportTypes', 'is', null)\n .execute()\n\n const result = new Map<number, Selectable<ReportStat>>()\n for (const row of rows) {\n if (row.queueId !== null) {\n result.set(row.queueId, row)\n }\n }\n return result\n }\n\n /** Get historical stats for a date range, paginated. */\n async getHistoricalStats(opts: {\n group: ReportStatGroup\n startDate?: string\n endDate?: string\n limit: number\n cursor?: string\n }): Promise<{ stats: Selectable<ReportStat>[]; cursor?: string }> {\n const { group, startDate, endDate, limit } = opts\n const { queueId, moderatorDid, reportTypes } = group\n const { ref } = this.db.db.dynamic\n\n let qb = this.db.db.selectFrom('report_stat').selectAll()\n\n if (queueId !== null) {\n qb = qb.where('queueId', '=', queueId)\n } else {\n qb = qb.where('queueId', 'is', null)\n }\n if (moderatorDid) {\n qb = qb.where('moderatorDid', '=', moderatorDid)\n } else {\n qb = qb.where('moderatorDid', 'is', null)\n }\n if (reportTypes !== null) {\n qb = qb.where(\n sql<boolean>`\"reportTypes\"::jsonb = ${jsonb(reportTypes)}::jsonb`,\n )\n } else {\n qb = qb.where('reportTypes', 'is', null)\n }\n if (startDate) {\n qb = qb.where('date', '>=', toDateString(new Date(startDate)))\n }\n if (endDate) {\n qb = qb.where('date', '<=', toDateString(new Date(endDate)))\n }\n\n const keyset = new ComputedAtIdKeyset(ref('computedAt'), ref('id'))\n const paginatedBuilder = paginate(qb, {\n limit,\n cursor: opts.cursor,\n keyset,\n direction: 'desc',\n tryIndex: true,\n })\n\n const stats = await paginatedBuilder.execute()\n\n return { stats, cursor: keyset.packFromResult(stats) }\n }\n}\n\n// ─── Helpers ───\n\n/** Sum a numeric string field across rows. */\nfunction sumNum<T>(rows: T[], field: keyof T): number {\n return rows.reduce((sum, r) => sum + Number(r[field] ?? 0), 0)\n}\n\nfunction emptyStats(group: StatGroup): StatsRow {\n return {\n ...group,\n inboundCount: '0',\n pendingCount: '0',\n closureTargetOverdueCount: '0',\n closureTargetMetCount: '0',\n closureTargetMissedCount: '0',\n closedCount: '0',\n actionedCount: '0',\n acknowledgedCount: '0',\n escalatedCount: '0',\n labelActionCount: '0',\n tagActionCount: '0',\n takedownActionCount: '0',\n ahtDurationSec: '0',\n ahtSampleCount: '0',\n resolutionDurationSec: '0',\n resolutionSampleCount: '0',\n }\n}\n\nfunction statKey(group: StatGroup): string {\n return [\n group.group,\n group.queueId,\n group.reportType,\n group.moderatorDid,\n ].join('|')\n}\n\nfunction mergeStats(\n statsRows: Array<\n InboundStatsRow | PendingStatsRow | ClosureStatsRow | EscalationStatsRow\n >,\n): Map<string, StatsRow> {\n const stats = new Map<string, StatsRow>()\n for (const row of statsRows) {\n const key = statKey(row)\n stats.set(key, {\n ...(stats.get(key) ?? emptyStats(row)),\n ...row,\n })\n }\n return stats\n}\n\n/**\n * Stable cache-key for a stat group. Used to look up an existing row in the\n * batched cache map without issuing per-group SELECTs. Report types are\n * stringified in stored order, which matches REPORT_TYPE_GROUPS.\n */\nfunction groupKey(g: ReportStatGroup): string {\n return [\n g.queueId ?? 'null',\n g.moderatorDid ?? 'null',\n g.reportTypes ? JSON.stringify(g.reportTypes) : 'null',\n ].join('|')\n}\n\n/** Convert a Date to an ISO date string (YYYY-MM-DD). */\nfunction toDateString(d: Date): DateString {\n return toDatetimeString(d).slice(0, 10) as DateString\n}\n\n/** Get the next calendar date string. */\nfunction nextDate(dateStr: DateString): DateString {\n const d = new Date(`${dateStr}T00:00:00.000Z`)\n d.setUTCDate(d.getUTCDate() + 1)\n return toDateString(d)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/report/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAA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SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM;KACvD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACb,CAAC;AAED,yDAAyD;AACzD,SAAS,YAAY,CAAC,CAAO;IAC3B,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAe,CAAA;AACvD,CAAC;AAED,yCAAyC;AACzC,SAAS,QAAQ,CAAC,OAAmB;IACnC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,OAAO,gBAAgB,CAAC,CAAA;IAC9C,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAA;IAChC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAA;AACxB,CAAC","sourcesContent":["import { type Selectable, sql } from 'kysely'\nimport { MINUTE } from '@atproto/common'\nimport type { DatetimeString, DidString } from '@atproto/lex-schema'\nimport { currentDatetimeString, toDatetimeString } from '@atproto/lex-schema'\nimport { InvalidRequestError } from '@atproto/xrpc-server'\nimport type { Database } from '../db/index.js'\nimport { ComputedAtIdKeyset, paginate } from '../db/pagination.js'\nimport type { DateString, ReportStat } from '../db/schema/report_stat.js'\nimport { jsonb } from '../db/types.js'\nimport { com, tools } from '../lexicons/index.js'\nimport { dbLogger } from '../logger.js'\nimport type { QueueAccess } from '../queue/access.js'\n\n// @NOTE Note some values here are not part of the lexicon and hard coded for\n// legacy reasons.\n\n/**\n * Grouped report types. Stats are computed per group rather than per individual report type.\n * Frontend should match for proper stat lookup.\n * https://github.com/bluesky-social/ozone/blob/main/components/reports/helpers/getType.ts\n */\nexport const REPORT_TYPE_GROUPS: Record<string, string[]> = {\n Legacy: [\n com.atproto.moderation.defs.ReasonSpam,\n com.atproto.moderation.defs.ReasonViolation,\n com.atproto.moderation.defs.ReasonMisleading,\n com.atproto.moderation.defs.ReasonSexual,\n com.atproto.moderation.defs.ReasonRude,\n com.atproto.moderation.defs.ReasonOther,\n com.atproto.moderation.defs.ReasonAppeal,\n ],\n Appeal: [tools.ozone.report.defs.ReasonAppeal],\n Violence: [\n 'tools.ozone.report.defs#reasonViolenceAnimalWelfare',\n tools.ozone.report.defs.ReasonViolenceThreats,\n tools.ozone.report.defs.ReasonViolenceGraphicContent,\n 'tools.ozone.report.defs#reasonViolenceSelfHarm',\n tools.ozone.report.defs.ReasonViolenceGlorification,\n tools.ozone.report.defs.ReasonViolenceExtremistContent,\n tools.ozone.report.defs.ReasonViolenceTrafficking,\n tools.ozone.report.defs.ReasonViolenceOther,\n ],\n Sexual: [\n tools.ozone.report.defs.ReasonSexualAbuseContent,\n 'tools.ozone.report.defs#reasonSexualNCII',\n 'tools.ozone.report.defs#reasonSexualSextortion',\n tools.ozone.report.defs.ReasonSexualDeepfake,\n tools.ozone.report.defs.ReasonSexualAnimal,\n tools.ozone.report.defs.ReasonSexualUnlabeled,\n tools.ozone.report.defs.ReasonSexualOther,\n ],\n 'Child Safety': [\n 'tools.ozone.report.defs#reasonChildSafetyCSAM',\n tools.ozone.report.defs.ReasonChildSafetyGroom,\n 'tools.ozone.report.defs#reasonChildSafetyMinorPrivacy',\n 'tools.ozone.report.defs#reasonChildSafetyEndangerment',\n tools.ozone.report.defs.ReasonChildSafetyHarassment,\n 'tools.ozone.report.defs#reasonChildSafetyPromotion',\n tools.ozone.report.defs.ReasonChildSafetyOther,\n ],\n Harassment: [\n tools.ozone.report.defs.ReasonHarassmentTroll,\n tools.ozone.report.defs.ReasonHarassmentTargeted,\n tools.ozone.report.defs.ReasonHarassmentHateSpeech,\n tools.ozone.report.defs.ReasonHarassmentDoxxing,\n tools.ozone.report.defs.ReasonHarassmentOther,\n ],\n Misleading: [\n tools.ozone.report.defs.ReasonMisleadingBot,\n tools.ozone.report.defs.ReasonMisleadingImpersonation,\n tools.ozone.report.defs.ReasonMisleadingSpam,\n tools.ozone.report.defs.ReasonMisleadingScam,\n 'tools.ozone.report.defs#reasonMisleadingSyntheticContent',\n 'tools.ozone.report.defs#reasonMisleadingMisinformation',\n tools.ozone.report.defs.ReasonMisleadingOther,\n ],\n 'Rule Violations': [\n tools.ozone.report.defs.ReasonRuleSiteSecurity,\n 'tools.ozone.report.defs#reasonRuleStolenContent',\n tools.ozone.report.defs.ReasonRuleProhibitedSales,\n tools.ozone.report.defs.ReasonRuleBanEvasion,\n tools.ozone.report.defs.ReasonRuleOther,\n ],\n Civic: [\n 'tools.ozone.report.defs#reasonCivicElectoralProcess',\n 'tools.ozone.report.defs#reasonCivicDisclosure',\n 'tools.ozone.report.defs#reasonCivicInterference',\n 'tools.ozone.report.defs#reasonCivicMisinformation',\n 'tools.ozone.report.defs#reasonCivicImpersonation',\n ],\n}\n\nconst REPORT_STAT_LIVE_TTL = 15 * MINUTE\nconst MAX_STAT_GROUP_DETAILS_DAYS = 120\n\nexport type ReportStatsServiceCreator = (db: Database) => ReportStatsService\n\nexport type ReportStatGroup = {\n queueId: number | null\n moderatorDid: DidString | null\n reportTypes: string[] | null\n}\nexport type ReportStatistics = {\n inboundCount: number\n pendingCount?: number\n closureTargetOverdueCount?: number\n closureTargetMetCount: number\n closureTargetMissedCount: number\n closedCount: number\n actionedCount: number\n acknowledgedCount: number\n escalatedCount: number\n labelActionCount: number\n tagActionCount: number\n takedownActionCount: number\n ahtDurationSec: number\n ahtSampleCount: number\n resolutionDurationSec: number\n resolutionSampleCount: number\n actionRate?: number\n avgHandlingTimeSec?: number\n avgResolutionTimeSec?: number\n}\n\n// DB types\ntype StatGroup = {\n group: 'aggregate' | 'queue' | 'reportType' | 'moderator'\n queueId: number | null\n reportType: string | null\n moderatorDid: string | null\n}\ntype StatsRow = StatGroup & {\n inboundCount: string\n pendingCount: string\n closureTargetOverdueCount: string\n closureTargetMetCount: string\n closureTargetMissedCount: string\n closedCount: string\n actionedCount: string\n acknowledgedCount: string\n escalatedCount: string\n labelActionCount: string\n tagActionCount: string\n takedownActionCount: string\n ahtDurationSec: string\n ahtSampleCount: string\n resolutionDurationSec: string\n resolutionSampleCount: string\n}\ntype StatsMetric = Exclude<keyof StatsRow, keyof StatGroup>\ntype StatsQueryRow<Metric extends StatsMetric> = StatGroup &\n Pick<StatsRow, Metric>\ntype LifecycleMetric = Exclude<\n StatsMetric,\n | 'inboundCount'\n | 'pendingCount'\n | 'closureTargetOverdueCount'\n | 'escalatedCount'\n>\ntype InboundStatsRow = StatsQueryRow<'inboundCount'>\ntype BreakdownRow = {\n reportType: string\n inboundCount: string | number\n}\ntype PendingStatsRow = StatsQueryRow<\n 'pendingCount' | 'closureTargetOverdueCount'\n>\ntype ClosureStatsRow = StatsQueryRow<LifecycleMetric>\ntype EscalationStatsRow = StatsQueryRow<'escalatedCount'>\ntype BatchedStats = Map<string, StatsRow>\ntype UpsertRow = {\n date: DateString\n queueId: number | null\n moderatorDid: DidString | null\n reportTypes: string[] | null\n inboundCount: number | null\n pendingCount: number | null\n closureTargetOverdueCount: number | null\n closureTargetMetCount: number | null\n closureTargetMissedCount: number | null\n closedCount: number | null\n actionedCount: number | null\n acknowledgedCount: number | null\n escalatedCount: number | null\n labelActionCount: number | null\n tagActionCount: number | null\n takedownActionCount: number | null\n ahtDurationSec: number | null\n ahtSampleCount: number | null\n resolutionDurationSec: number | null\n resolutionSampleCount: number | null\n actionRate: number | null\n avgHandlingTimeSec: number | null\n avgResolutionTimeSec: number | null\n computedAt: DatetimeString\n}\n\nexport class ReportStatsService {\n constructor(public db: Database) {}\n\n static creator(): ReportStatsServiceCreator {\n return (db: Database) => new ReportStatsService(db)\n }\n\n /**\n * Compute stats for today and finalize yesterday if needed.\n * Called periodically by the StatsComputer daemon.\n */\n async materializeAll(opts?: { force?: boolean }): Promise<{\n rowsWritten: number\n }> {\n try {\n const start = Date.now()\n const today = toDateString(new Date(start))\n const yesterday = toDateString(new Date(start - 24 * 60 * 60 * 1000))\n\n // Always compute today's stats\n let rowsWritten = await this.materializeDate(today, opts)\n\n // Finalize yesterday if its snapshot is missing or stale\n if (!opts?.force) {\n const yesterdayRow = await this.db.db\n .selectFrom('report_stat')\n .select('computedAt')\n .where('date', '=', yesterday)\n .where('queueId', 'is', null)\n .where('moderatorDid', 'is', null)\n .where('reportTypes', 'is', null)\n .orderBy('computedAt', 'desc')\n .executeTakeFirst()\n const endOfYesterday = new Date(`${today}T00:00:00.000Z`).getTime()\n if (\n !yesterdayRow ||\n new Date(yesterdayRow.computedAt).getTime() < endOfYesterday\n ) {\n rowsWritten += await this.materializeDate(yesterday, { force: true })\n }\n } else {\n rowsWritten += await this.materializeDate(yesterday, { force: true })\n }\n\n const duration = Date.now() - start\n dbLogger.info({ duration }, 'report stats materialization completed')\n return { rowsWritten }\n } catch (err) {\n dbLogger.error({ err }, 'report stats materialization errored')\n throw err\n }\n }\n\n /**\n * Compute stats for a specific date range. Used by the refreshStats endpoint.\n */\n async refreshDateRange(opts: {\n startDate: string\n endDate: string\n queueIds?: number[]\n }): Promise<void> {\n const start = new Date(opts.startDate)\n const end = new Date(opts.endDate)\n const endOfToday = new Date()\n endOfToday.setUTCHours(23, 59, 59, 999)\n if (end > endOfToday) {\n throw new InvalidRequestError(\n 'Cannot refresh statistics for future dates',\n )\n }\n\n for (let d = new Date(start); d <= end; d.setUTCDate(d.getUTCDate() + 1)) {\n const dateStr = toDateString(d)\n if (opts.queueIds?.length) {\n // Recompute only specific queue groups for this date\n const computedAt = currentDatetimeString()\n const batched = await this.computeBatchedStats(dateStr, computedAt)\n const rows: UpsertRow[] = []\n for (const queueId of opts.queueIds) {\n const group: ReportStatGroup = {\n queueId,\n moderatorDid: null,\n reportTypes: null,\n }\n const stats = this.resolveGroupStats(group, batched)\n rows.push(this.buildUpsertRow(dateStr, group, stats, computedAt))\n }\n await this.bulkUpsert(rows)\n } else {\n await this.materializeDate(dateStr, { force: true })\n }\n }\n }\n\n /** Compute and write all groups for a single date. */\n private async materializeDate(\n date: DateString,\n opts?: { force?: boolean },\n ): Promise<number> {\n // @NOTE Timestamp the start so a computation crossing midnight still needs\n // historical finalization on the next cycle.\n const computedAt = currentDatetimeString()\n const groups = await this.enumerateGroups()\n const batched = await this.computeBatchedStats(date, computedAt)\n const today = computedAt.slice(0, 10)\n const isToday = date === today\n\n // Batch the cache check so we don't issue one SELECT per group.\n const existingByKey = !opts?.force\n ? await this.fetchExistingStatsByKey(date)\n : null\n\n const rows: UpsertRow[] = []\n for (const group of groups) {\n try {\n if (existingByKey) {\n const cached = existingByKey.get(groupKey(group))\n if (cached) {\n // Historical dates: never recompute. Today: recompute if stale.\n if (!isToday) continue\n const age = Date.now() - new Date(cached.computedAt).getTime()\n if (age < REPORT_STAT_LIVE_TTL) continue\n }\n }\n const stats = this.resolveGroupStats(group, batched)\n rows.push(this.buildUpsertRow(date, group, stats, computedAt))\n } catch (err) {\n dbLogger.error(\n { err, group, date },\n 'error preparing report stats group',\n )\n }\n }\n\n await this.bulkUpsert(rows)\n return rows.length\n }\n\n /** Fetch all stat rows for a date, keyed by groupKey for O(1) lookup. */\n private async fetchExistingStatsByKey(\n date: DateString,\n ): Promise<Map<string, Selectable<ReportStat>>> {\n const existing = await this.db.db\n .selectFrom('report_stat')\n .selectAll()\n .where('date', '=', date)\n .execute()\n const map = new Map<string, Selectable<ReportStat>>()\n for (const row of existing) {\n map.set(\n groupKey({\n queueId: row.queueId,\n moderatorDid: row.moderatorDid,\n reportTypes: row.reportTypes,\n }),\n row,\n )\n }\n return map\n }\n\n /** List out the groups to compute stats for. */\n private async enumerateGroups(): Promise<ReportStatGroup[]> {\n const groups: ReportStatGroup[] = []\n\n const queues = await this.db.db\n .selectFrom('report_queue')\n .selectAll()\n .where('enabled', '=', true)\n .where('deletedAt', 'is', null)\n .execute()\n const members = await this.db.db\n .selectFrom('member')\n .select('did')\n .where('disabled', '=', false)\n .where('role', 'in', [\n tools.ozone.team.defs.RoleAdmin,\n tools.ozone.team.defs.RoleModerator,\n tools.ozone.team.defs.RoleTriage,\n ])\n .execute()\n\n // aggregate\n groups.push({ queueId: null, moderatorDid: null, reportTypes: null })\n // per queue\n for (const queue of queues) {\n groups.push({ queueId: queue.id, moderatorDid: null, reportTypes: null })\n }\n // unqueued\n groups.push({ queueId: -1, moderatorDid: null, reportTypes: null })\n // per moderator\n for (const member of members) {\n groups.push({\n queueId: null,\n moderatorDid: member.did,\n reportTypes: null,\n })\n }\n // per report type group\n for (const groupTypes of Object.values(REPORT_TYPE_GROUPS)) {\n groups.push({\n queueId: null,\n moderatorDid: null,\n reportTypes: groupTypes,\n })\n }\n\n return groups\n }\n\n /**\n * Run batched queries for a calendar date.\n *\n * @description\n * For each cohort, compute relevant groupings.\n *\n * Stat cohorts: inbound, pending, closed, escalated\n *\n * Stat groups: aggregate, per queue, per report type, and per moderator.\n */\n private async computeBatchedStats(\n date: DateString,\n computedAt: DatetimeString,\n ): Promise<BatchedStats> {\n const dayStart: DatetimeString = `${date}T00:00:00.000Z`\n const dayEnd: DatetimeString = `${nextDate(date)}T00:00:00.000Z`\n\n // 1. create report grouping statements\n const statGroups = sql`\n case\n when grouping(coalesce(r.\"queueId\", -1)) = 0 then 'queue'\n when grouping(r.\"reportType\") = 0 then 'reportType'\n when grouping(r.\"assignedTo\") = 0 then 'moderator'\n else 'aggregate'\n end as \"group\",\n case when grouping(coalesce(r.\"queueId\", -1)) = 0 then coalesce(r.\"queueId\", -1) end as \"queueId\",\n case when grouping(r.\"reportType\") = 0 then r.\"reportType\" end as \"reportType\",\n case when grouping(r.\"assignedTo\") = 0 then r.\"assignedTo\" end as \"moderatorDid\"`\n const statGroupsExceptModerator = sql`\n case\n when grouping(coalesce(r.\"queueId\", -1)) = 0 then 'queue'\n when grouping(r.\"reportType\") = 0 then 'reportType'\n else 'aggregate'\n end as \"group\",\n case when grouping(coalesce(r.\"queueId\", -1)) = 0 then coalesce(r.\"queueId\", -1) end as \"queueId\",\n case when grouping(r.\"reportType\") = 0 then r.\"reportType\" end as \"reportType\",\n null as \"moderatorDid\"`\n\n // 2. inbound stats\n const inboundStats = () =>\n sql<InboundStatsRow>`\n select ${statGroups}, count(*) as \"inboundCount\"\n from report r\n where r.\"createdAt\" >= ${dayStart} and r.\"createdAt\" < ${dayEnd}\n and r.\"isMuted\" = false\n group by grouping sets ((), (coalesce(r.\"queueId\", -1)), (r.\"reportType\"), (r.\"assignedTo\"))\n `.execute(this.db.db)\n\n // 3. pending stats\n const computedAtDate = computedAt.slice(0, 10)\n const pendingAsOf = date < computedAtDate ? dayEnd : computedAt\n const pendingReports =\n date < computedAtDate\n ? sql`\n with subsequent_transitions as (\n select distinct on (\"reportId\") \"reportId\", \"activityType\"\n from report_activity\n where \"createdAt\" >= ${dayEnd}\n and \"activityType\" in ('closeActivity', 'reopenActivity')\n order by \"reportId\", \"createdAt\", id\n ), candidates as (\n select id, \"queueId\", \"reportType\", \"createdAt\", \"priorityTargetMinutes\" from report\n where status != 'closed' and \"isMuted\" = false\n and \"createdAt\" < ${dayEnd}\n union all\n select id, \"queueId\", \"reportType\", \"createdAt\", \"priorityTargetMinutes\" from report\n where status = 'closed' and \"closedAt\" >= ${dayEnd}\n and \"isMuted\" = false and \"createdAt\" < ${dayEnd}\n )\n select r.\"queueId\", r.\"reportType\", r.\"createdAt\", r.\"priorityTargetMinutes\"\n from candidates r\n left join subsequent_transitions t on t.\"reportId\" = r.id\n where t.\"activityType\" is distinct from 'reopenActivity'\n `\n : sql`\n select \"queueId\", \"reportType\", \"createdAt\", \"priorityTargetMinutes\"\n from report where status != 'closed' and \"isMuted\" = false\n `\n const pendingStats = () =>\n sql<PendingStatsRow>`\n select ${statGroupsExceptModerator}, count(*) as \"pendingCount\",\n count(*) filter (\n where r.\"priorityTargetMinutes\" > 0\n and extract(epoch from (${pendingAsOf}::timestamptz - r.\"createdAt\"::timestamptz))\n > r.\"priorityTargetMinutes\"::bigint * 60\n ) as \"closureTargetOverdueCount\"\n from (${pendingReports}) r\n group by grouping sets ((), (coalesce(r.\"queueId\", -1)), (r.\"reportType\"))\n `.execute(this.db.db)\n\n // 4. closure stats\n const closureStats = () =>\n sql<ClosureStatsRow>`\n with closed_reports as (\n select\n r.\"queueId\", r.\"reportType\", r.\"assignedTo\",\n r.\"createdAt\", r.\"assignedAt\", r.\"closedAt\", r.\"priorityTargetMinutes\",\n -- @NOTE Explicit no-action closures retain earlier action links as history.\n case when (\n select activity.meta ->> 'resolution'\n from report_activity activity\n where activity.\"reportId\" = r.id\n and activity.\"activityType\" = 'closeActivity'\n order by activity.\"createdAt\" desc, activity.id desc\n limit 1\n ) = 'noAction' then null\n else (r.\"actionEventIds\" ->> -1)::integer\n end as \"actionEventId\"\n from report r\n where r.\"closedAt\" >= ${dayStart} and r.\"closedAt\" < ${dayEnd}\n ), closure_outcomes as (\n select r.*,\n case me.action\n when ${tools.ozone.moderation.defs.modEventLabel.$type} then 'label'\n when ${tools.ozone.moderation.defs.modEventTag.$type} then 'tag'\n when ${tools.ozone.moderation.defs.modEventTakedown.$type} then 'takedown'\n else 'acknowledged'\n end as outcome\n from closed_reports r\n left join moderation_event me on me.id = r.\"actionEventId\"\n ), closure_durations as (\n select r.*,\n case when r.\"assignedAt\" is not null then\n greatest(0, extract(epoch from (r.\"closedAt\"::timestamp - r.\"assignedAt\"::timestamp)))\n end as \"handlingTimeSec\",\n greatest(0, extract(epoch from (r.\"closedAt\"::timestamp - r.\"createdAt\"::timestamp))) as \"resolutionTimeSec\",\n case when r.\"priorityTargetMinutes\" > 0\n and r.\"closedAt\"::timestamptz >= r.\"createdAt\"::timestamptz\n then extract(epoch from (r.\"closedAt\"::timestamptz - r.\"createdAt\"::timestamptz))\n <= r.\"priorityTargetMinutes\"::bigint * 60\n end as \"closureTargetMet\"\n from closure_outcomes r\n )\n select ${statGroups},\n count(*) as \"closedCount\",\n count(*) filter (where r.\"closureTargetMet\") as \"closureTargetMetCount\",\n count(*) filter (where not r.\"closureTargetMet\") as \"closureTargetMissedCount\",\n count(*) filter (where r.outcome != 'acknowledged') as \"actionedCount\",\n count(*) filter (where r.outcome = 'acknowledged') as \"acknowledgedCount\",\n count(*) filter (where r.outcome = 'label') as \"labelActionCount\",\n count(*) filter (where r.outcome = 'tag') as \"tagActionCount\",\n count(*) filter (where r.outcome = 'takedown') as \"takedownActionCount\",\n coalesce(sum(r.\"handlingTimeSec\"), 0) as \"ahtDurationSec\",\n count(r.\"handlingTimeSec\") as \"ahtSampleCount\",\n coalesce(sum(r.\"resolutionTimeSec\"), 0) as \"resolutionDurationSec\",\n count(*) as \"resolutionSampleCount\"\n from closure_durations r\n group by grouping sets ((), (coalesce(r.\"queueId\", -1)), (r.\"reportType\"), (r.\"assignedTo\"))\n `.execute(this.db.db)\n\n // 5. escalation stats\n const escalationStats = () =>\n sql<EscalationStatsRow>`\n select ${statGroups}, count(*) as \"escalatedCount\"\n from report_activity ra\n join report r on r.id = ra.\"reportId\"\n where ra.\"activityType\" = 'escalationActivity'\n and ra.\"createdAt\" >= ${dayStart} and ra.\"createdAt\" < ${dayEnd}\n group by grouping sets ((), (coalesce(r.\"queueId\", -1)), (r.\"reportType\"), (r.\"assignedTo\"))\n `.execute(this.db.db)\n\n // 6. execute all\n const [inbound, pending, closures, escalations] = await Promise.all([\n inboundStats(),\n pendingStats(),\n closureStats(),\n escalationStats(),\n ])\n\n return mergeStats([\n ...inbound.rows,\n ...pending.rows,\n ...closures.rows,\n ...escalations.rows,\n ])\n }\n\n /** Resolve a single group's stats from batched query results (pure in-memory). */\n private resolveGroupStats(\n group: ReportStatGroup,\n batched: BatchedStats,\n ): ReportStatistics {\n if (group.moderatorDid) {\n const row = batched.get(\n statKey({\n group: 'moderator',\n queueId: null,\n reportType: null,\n moderatorDid: group.moderatorDid,\n }),\n )\n const {\n // remove stats that arent relevant for moderator group\n pendingCount: _omit1,\n closureTargetOverdueCount: _omit2,\n ...stats\n } = this.resolveRows(row ? [row] : [])\n return stats\n }\n if (group.reportTypes !== null) {\n const rows = group.reportTypes.flatMap((reportType) => {\n const row = batched.get(\n statKey({\n group: 'reportType',\n queueId: null,\n reportType,\n moderatorDid: null,\n }),\n )\n return row ? [row] : []\n })\n return this.resolveRows(rows)\n }\n const row = batched.get(\n statKey({\n group: group.queueId === null ? 'aggregate' : 'queue',\n queueId: group.queueId,\n reportType: null,\n moderatorDid: null,\n }),\n )\n return this.resolveRows(row ? [row] : [])\n }\n\n private resolveRows(rows: StatsRow[]): ReportStatistics {\n const sum = (field: keyof StatsRow) => sumNum(rows, field)\n const inboundCount = sum('inboundCount')\n const pendingCount = sum('pendingCount')\n const closedCount = sum('closedCount')\n const actionedCount = sum('actionedCount')\n const ahtDurationSec = Math.round(sum('ahtDurationSec'))\n const ahtSampleCount = sum('ahtSampleCount')\n const resolutionDurationSec = Math.round(sum('resolutionDurationSec'))\n const resolutionSampleCount = sum('resolutionSampleCount')\n\n return {\n inboundCount,\n pendingCount,\n closedCount,\n closureTargetOverdueCount: sum('closureTargetOverdueCount'),\n closureTargetMetCount: sum('closureTargetMetCount'),\n closureTargetMissedCount: sum('closureTargetMissedCount'),\n actionedCount,\n acknowledgedCount: sum('acknowledgedCount'),\n escalatedCount: sum('escalatedCount'),\n labelActionCount: sum('labelActionCount'),\n tagActionCount: sum('tagActionCount'),\n takedownActionCount: sum('takedownActionCount'),\n ahtDurationSec,\n ahtSampleCount,\n resolutionDurationSec,\n resolutionSampleCount,\n actionRate:\n closedCount > 0\n ? Math.round((actionedCount / closedCount) * 100)\n : undefined,\n avgHandlingTimeSec:\n ahtSampleCount > 0\n ? Math.round(ahtDurationSec / ahtSampleCount)\n : undefined,\n avgResolutionTimeSec:\n resolutionSampleCount > 0\n ? Math.round(resolutionDurationSec / resolutionSampleCount)\n : undefined,\n }\n }\n\n /** Build an upsert row from (date, group, stats). */\n private buildUpsertRow(\n date: DateString,\n group: ReportStatGroup,\n stats: ReportStatistics,\n computedAt: DatetimeString,\n ): UpsertRow {\n const pendingCount =\n 'pendingCount' in stats ? (stats.pendingCount ?? null) : null\n const escalatedCount =\n 'escalatedCount' in stats ? (stats.escalatedCount ?? null) : null\n const actionRate = 'actionRate' in stats ? (stats.actionRate ?? null) : null\n\n return {\n date,\n queueId: group.queueId,\n moderatorDid: group.moderatorDid,\n reportTypes: group.reportTypes,\n inboundCount: stats.inboundCount ?? null,\n pendingCount,\n closedCount: stats.closedCount,\n closureTargetOverdueCount: stats.closureTargetOverdueCount ?? null,\n closureTargetMetCount: stats.closureTargetMetCount,\n closureTargetMissedCount: stats.closureTargetMissedCount,\n actionedCount: stats.actionedCount ?? null,\n acknowledgedCount: stats.acknowledgedCount,\n escalatedCount,\n labelActionCount: stats.labelActionCount,\n tagActionCount: stats.tagActionCount,\n takedownActionCount: stats.takedownActionCount,\n ahtDurationSec: stats.ahtDurationSec,\n ahtSampleCount: stats.ahtSampleCount,\n resolutionDurationSec: stats.resolutionDurationSec,\n resolutionSampleCount: stats.resolutionSampleCount,\n actionRate,\n avgHandlingTimeSec: stats.avgHandlingTimeSec ?? null,\n avgResolutionTimeSec: stats.avgResolutionTimeSec ?? null,\n computedAt,\n }\n }\n\n /**\n * Wraps a DELETE+INSERT for each row in a single transaction so we pay one\n * commit per cycle instead of one per group. NULL-aware WHERE clauses match\n * the existing PG <15 NULL semantics without needing a unique index.\n */\n private async bulkUpsert(rows: UpsertRow[]): Promise<void> {\n if (!rows.length) return\n\n await this.db.transaction(async (dbTxn) => {\n for (const r of rows) {\n let del = dbTxn.db.deleteFrom('report_stat').where('date', '=', r.date)\n del =\n r.queueId !== null\n ? del.where('queueId', '=', r.queueId)\n : del.where('queueId', 'is', null)\n del =\n r.moderatorDid !== null\n ? del.where('moderatorDid', '=', r.moderatorDid)\n : del.where('moderatorDid', 'is', null)\n del =\n r.reportTypes !== null\n ? del.where(\n sql<boolean>`\"reportTypes\"::jsonb = ${jsonb(r.reportTypes)}::jsonb`,\n )\n : del.where('reportTypes', 'is', null)\n await del.execute()\n\n await dbTxn.db\n .insertInto('report_stat')\n .values({\n date: r.date,\n queueId: r.queueId,\n moderatorDid: r.moderatorDid,\n reportTypes: r.reportTypes !== null ? jsonb(r.reportTypes) : null,\n inboundCount: r.inboundCount,\n pendingCount: r.pendingCount,\n closureTargetOverdueCount: r.closureTargetOverdueCount,\n closureTargetMetCount: r.closureTargetMetCount,\n closureTargetMissedCount: r.closureTargetMissedCount,\n closedCount: r.closedCount,\n actionedCount: r.actionedCount,\n acknowledgedCount: r.acknowledgedCount,\n escalatedCount: r.escalatedCount,\n labelActionCount: r.labelActionCount,\n tagActionCount: r.tagActionCount,\n takedownActionCount: r.takedownActionCount,\n ahtDurationSec: r.ahtDurationSec,\n ahtSampleCount: r.ahtSampleCount,\n resolutionDurationSec: r.resolutionDurationSec,\n resolutionSampleCount: r.resolutionSampleCount,\n actionRate: r.actionRate,\n avgHandlingTimeSec: r.avgHandlingTimeSec,\n avgResolutionTimeSec: r.avgResolutionTimeSec,\n computedAt: r.computedAt,\n })\n .execute()\n }\n })\n }\n\n // ─── Read methods ───\n\n /** Fetch additional details for one report stat group and UTC calendar window. */\n async getStatGroupDetails(\n params: tools.ozone.report.getStatGroupDetails.$Params,\n access: QueueAccess,\n signal?: AbortSignal,\n ): Promise<tools.ozone.report.getStatGroupDetails.$OutputBody> {\n const computedAt = currentDatetimeString()\n const startDate = toDatetimeString(\n `${toDatetimeString(params.startDate ?? computedAt).slice(0, 10)}T00:00:00.000Z`,\n )\n const endDate = toDatetimeString(\n `${toDatetimeString(params.endDate ?? computedAt).slice(0, 10)}T00:00:00.000Z`,\n )\n const day = 86_400_000\n const duration = Date.parse(endDate) - Date.parse(startDate) + day\n if (\n !Number.isFinite(duration) ||\n duration <= 0 ||\n duration > MAX_STAT_GROUP_DETAILS_DAYS * day\n ) {\n throw new InvalidRequestError(\n `Date range must be ordered and include at most ${MAX_STAT_GROUP_DETAILS_DAYS} calendar days`,\n )\n }\n const endExclusive = toDatetimeString(Date.parse(endDate) + day)\n const { queueId, moderatorDid, reportTypes } = params\n const predicates = [\n sql`\"isMuted\" = false`,\n sql`\"createdAt\" >= ${startDate} and \"createdAt\" < ${endExclusive}`,\n sql`(\"queueId\" is null or ${access.filter('queueId')})`,\n ]\n if (queueId === -1) {\n predicates.push(sql`(\"queueId\" is null or \"queueId\" = -1)`)\n } else if (queueId !== undefined) {\n predicates.push(sql`\"queueId\" = ${queueId}`)\n } else if (moderatorDid) {\n predicates.push(sql`\"assignedTo\" = ${moderatorDid}`)\n } else if (reportTypes?.length) {\n predicates.push(sql`\"reportType\" in (${sql.join(reportTypes)})`)\n }\n const result = await sql<BreakdownRow>`\n select \"reportType\", count(*) as \"inboundCount\"\n from report\n where ${sql.join(predicates, sql` and `)}\n group by \"reportType\"\n order by \"inboundCount\" desc, \"reportType\"\n `.execute(this.db.db, {\n signal,\n inflightQueryAbortStrategy: 'cancel query',\n })\n\n const stats = result.rows.map((row) => ({\n reportType: row.reportType,\n inboundCount: Number(row.inboundCount),\n }))\n return {\n computedAt,\n startDate,\n endDate,\n reportTypeBreakdown: {\n totalCount: stats.reduce((total, row) => total + row.inboundCount, 0),\n stats,\n },\n }\n }\n\n /** Get a single stat row for a date + group. */\n private async getStatForDate(\n date: DateString,\n group: ReportStatGroup,\n ): Promise<Selectable<ReportStat> | undefined> {\n let qb = this.db.db\n .selectFrom('report_stat')\n .selectAll()\n .where('date', '=', date)\n if (group.queueId !== null) {\n qb = qb.where('queueId', '=', group.queueId)\n } else {\n qb = qb.where('queueId', 'is', null)\n }\n if (group.moderatorDid) {\n qb = qb.where('moderatorDid', '=', group.moderatorDid)\n } else {\n qb = qb.where('moderatorDid', 'is', null)\n }\n if (group.reportTypes !== null) {\n qb = qb.where(\n sql<boolean>`\"reportTypes\"::jsonb = ${jsonb(group.reportTypes)}::jsonb`,\n )\n } else {\n qb = qb.where('reportTypes', 'is', null)\n }\n return qb.executeTakeFirst()\n }\n\n /** Get today's live stats for a group. */\n async getLiveStats(\n group: ReportStatGroup,\n ): Promise<Selectable<ReportStat> | undefined> {\n const today = toDateString(new Date())\n return this.getStatForDate(today, group)\n }\n\n /** Get live stats for multiple queues in a single query. */\n async getLiveStatsForQueues(\n queueIds: number[],\n ): Promise<Map<number, Selectable<ReportStat>>> {\n if (!queueIds.length) return new Map()\n\n const today = toDateString(new Date())\n const rows = await this.db.db\n .selectFrom('report_stat')\n .selectAll()\n .where('date', '=', today)\n .where('queueId', 'in', queueIds)\n .where('moderatorDid', 'is', null)\n .where('reportTypes', 'is', null)\n .execute()\n\n const result = new Map<number, Selectable<ReportStat>>()\n for (const row of rows) {\n if (row.queueId !== null) {\n result.set(row.queueId, row)\n }\n }\n return result\n }\n\n /** Get historical stats for a date range, paginated. */\n async getHistoricalStats(opts: {\n group: ReportStatGroup\n startDate?: string\n endDate?: string\n limit: number\n cursor?: string\n }): Promise<{ stats: Selectable<ReportStat>[]; cursor?: string }> {\n const { group, startDate, endDate, limit } = opts\n const { queueId, moderatorDid, reportTypes } = group\n const { ref } = this.db.db.dynamic\n\n let qb = this.db.db.selectFrom('report_stat').selectAll()\n\n if (queueId !== null) {\n qb = qb.where('queueId', '=', queueId)\n } else {\n qb = qb.where('queueId', 'is', null)\n }\n if (moderatorDid) {\n qb = qb.where('moderatorDid', '=', moderatorDid)\n } else {\n qb = qb.where('moderatorDid', 'is', null)\n }\n if (reportTypes !== null) {\n qb = qb.where(\n sql<boolean>`\"reportTypes\"::jsonb = ${jsonb(reportTypes)}::jsonb`,\n )\n } else {\n qb = qb.where('reportTypes', 'is', null)\n }\n if (startDate) {\n qb = qb.where('date', '>=', toDateString(new Date(startDate)))\n }\n if (endDate) {\n qb = qb.where('date', '<=', toDateString(new Date(endDate)))\n }\n\n const keyset = new ComputedAtIdKeyset(ref('computedAt'), ref('id'))\n const paginatedBuilder = paginate(qb, {\n limit,\n cursor: opts.cursor,\n keyset,\n direction: 'desc',\n tryIndex: true,\n })\n\n const stats = await paginatedBuilder.execute()\n\n return { stats, cursor: keyset.packFromResult(stats) }\n }\n}\n\n// ─── Helpers ───\n\n/** Sum a numeric string field across rows. */\nfunction sumNum<T>(rows: T[], field: keyof T): number {\n return rows.reduce((sum, r) => sum + Number(r[field] ?? 0), 0)\n}\n\nfunction emptyStats(group: StatGroup): StatsRow {\n return {\n ...group,\n inboundCount: '0',\n pendingCount: '0',\n closureTargetOverdueCount: '0',\n closureTargetMetCount: '0',\n closureTargetMissedCount: '0',\n closedCount: '0',\n actionedCount: '0',\n acknowledgedCount: '0',\n escalatedCount: '0',\n labelActionCount: '0',\n tagActionCount: '0',\n takedownActionCount: '0',\n ahtDurationSec: '0',\n ahtSampleCount: '0',\n resolutionDurationSec: '0',\n resolutionSampleCount: '0',\n }\n}\n\nfunction statKey(group: StatGroup): string {\n return [\n group.group,\n group.queueId,\n group.reportType,\n group.moderatorDid,\n ].join('|')\n}\n\nfunction mergeStats(\n statsRows: Array<\n InboundStatsRow | PendingStatsRow | ClosureStatsRow | EscalationStatsRow\n >,\n): Map<string, StatsRow> {\n const stats = new Map<string, StatsRow>()\n for (const row of statsRows) {\n const key = statKey(row)\n stats.set(key, {\n ...(stats.get(key) ?? emptyStats(row)),\n ...row,\n })\n }\n return stats\n}\n\n/**\n * Stable cache-key for a stat group. Used to look up an existing row in the\n * batched cache map without issuing per-group SELECTs. Report types are\n * stringified in stored order, which matches REPORT_TYPE_GROUPS.\n */\nfunction groupKey(g: ReportStatGroup): string {\n return [\n g.queueId ?? 'null',\n g.moderatorDid ?? 'null',\n g.reportTypes ? JSON.stringify(g.reportTypes) : 'null',\n ].join('|')\n}\n\n/** Convert a Date to an ISO date string (YYYY-MM-DD). */\nfunction toDateString(d: Date): DateString {\n return toDatetimeString(d).slice(0, 10) as DateString\n}\n\n/** Get the next calendar date string. */\nfunction nextDate(dateStr: DateString): DateString {\n const d = new Date(`${dateStr}T00:00:00.000Z`)\n d.setUTCDate(d.getUTCDate() + 1)\n return toDateString(d)\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/ozone",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Backend service for moderating the Bluesky network.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@atproto-labs/fetch-node": "^0.4.6",
|
|
42
42
|
"@atproto-labs/opentelemetry-node": "^0.5.1",
|
|
43
|
-
"@atproto/common": "^0.8.
|
|
43
|
+
"@atproto/common": "^0.8.12",
|
|
44
44
|
"@atproto/crypto": "^0.5.8",
|
|
45
|
-
"@atproto/identity": "^0.5.
|
|
46
|
-
"@atproto/lex-client": "^0.6.
|
|
45
|
+
"@atproto/identity": "^0.5.25",
|
|
46
|
+
"@atproto/lex-client": "^0.6.1",
|
|
47
47
|
"@atproto/lex-data": "^0.1.11",
|
|
48
|
-
"@atproto/lex-password-session": "^0.3.
|
|
49
|
-
"@atproto/lex-schema": "^0.3.
|
|
50
|
-
"@atproto/syntax": "^0.7.
|
|
48
|
+
"@atproto/lex-password-session": "^0.3.5",
|
|
49
|
+
"@atproto/lex-schema": "^0.3.1",
|
|
50
|
+
"@atproto/syntax": "^0.7.9",
|
|
51
51
|
"@atproto/ws-client": "^0.2.2",
|
|
52
|
-
"@atproto/xrpc-server": "^0.13.
|
|
52
|
+
"@atproto/xrpc-server": "^0.13.15",
|
|
53
53
|
"@did-plc/lib": "^0.0.1",
|
|
54
54
|
"@opentelemetry/instrumentation-pg": "^0.77.0",
|
|
55
55
|
"compression": "^1.7.4",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"ws": "^8.12.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@atproto/api": "^0.32.
|
|
73
|
-
"@atproto/lex": "^0.6.
|
|
74
|
-
"@atproto/lexicon": "^0.7.
|
|
75
|
-
"@atproto/pds": "^0.5.
|
|
72
|
+
"@atproto/api": "^0.32.4",
|
|
73
|
+
"@atproto/lex": "^0.6.1",
|
|
74
|
+
"@atproto/lexicon": "^0.7.21",
|
|
75
|
+
"@atproto/pds": "^0.5.63",
|
|
76
76
|
"@did-plc/server": "^0.0.1",
|
|
77
77
|
"@jest/globals": "^30.0.0",
|
|
78
78
|
"@types/cors": "^2.8.12",
|