@atproto/ozone 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +8 -0
  3. package/dist/api/label/subscribeLabels.d.ts.map +1 -1
  4. package/dist/api/label/subscribeLabels.js +36 -2
  5. package/dist/api/label/subscribeLabels.js.map +1 -1
  6. package/dist/api/queue/assignModerator.d.ts.map +1 -1
  7. package/dist/api/queue/assignModerator.js +1 -1
  8. package/dist/api/queue/assignModerator.js.map +1 -1
  9. package/dist/api/queue/createQueue.d.ts.map +1 -1
  10. package/dist/api/queue/createQueue.js +5 -1
  11. package/dist/api/queue/createQueue.js.map +1 -1
  12. package/dist/api/queue/deleteQueue.d.ts.map +1 -1
  13. package/dist/api/queue/deleteQueue.js +27 -14
  14. package/dist/api/queue/deleteQueue.js.map +1 -1
  15. package/dist/api/queue/listQueues.d.ts.map +1 -1
  16. package/dist/api/queue/listQueues.js +3 -1
  17. package/dist/api/queue/listQueues.js.map +1 -1
  18. package/dist/api/queue/updateQueue.d.ts.map +1 -1
  19. package/dist/api/queue/updateQueue.js +11 -2
  20. package/dist/api/queue/updateQueue.js.map +1 -1
  21. package/dist/api/report/getReport.d.ts.map +1 -1
  22. package/dist/api/report/getReport.js +6 -2
  23. package/dist/api/report/getReport.js.map +1 -1
  24. package/dist/api/report/queryReports.d.ts.map +1 -1
  25. package/dist/api/report/queryReports.js +5 -0
  26. package/dist/api/report/queryReports.js.map +1 -1
  27. package/dist/api/safelink/queryRules.d.ts.map +1 -1
  28. package/dist/api/safelink/queryRules.js +2 -1
  29. package/dist/api/safelink/queryRules.js.map +1 -1
  30. package/dist/assignment/index.d.ts +3 -1
  31. package/dist/assignment/index.d.ts.map +1 -1
  32. package/dist/assignment/index.js +29 -19
  33. package/dist/assignment/index.js.map +1 -1
  34. package/dist/config/config.d.ts +2 -0
  35. package/dist/config/config.d.ts.map +1 -1
  36. package/dist/config/config.js +1 -0
  37. package/dist/config/config.js.map +1 -1
  38. package/dist/config/env.d.ts +1 -0
  39. package/dist/config/env.d.ts.map +1 -1
  40. package/dist/config/env.js +1 -0
  41. package/dist/config/env.js.map +1 -1
  42. package/dist/db/migrations/20261020T000000000Z-add-queue-strict-access.d.ts +4 -0
  43. package/dist/db/migrations/20261020T000000000Z-add-queue-strict-access.d.ts.map +1 -0
  44. package/dist/db/migrations/20261020T000000000Z-add-queue-strict-access.js +13 -0
  45. package/dist/db/migrations/20261020T000000000Z-add-queue-strict-access.js.map +1 -0
  46. package/dist/db/migrations/index.d.ts +1 -0
  47. package/dist/db/migrations/index.d.ts.map +1 -1
  48. package/dist/db/migrations/index.js +1 -0
  49. package/dist/db/migrations/index.js.map +1 -1
  50. package/dist/db/schema/report_queue.d.ts +1 -0
  51. package/dist/db/schema/report_queue.d.ts.map +1 -1
  52. package/dist/db/schema/report_queue.js.map +1 -1
  53. package/dist/db/schema/report_stat.js.map +1 -1
  54. package/dist/lexicons/tools/ozone/queue/createQueue.defs.d.ts +2 -0
  55. package/dist/lexicons/tools/ozone/queue/createQueue.defs.d.ts.map +1 -1
  56. package/dist/lexicons/tools/ozone/queue/createQueue.defs.js +1 -1
  57. package/dist/lexicons/tools/ozone/queue/createQueue.defs.js.map +1 -1
  58. package/dist/lexicons/tools/ozone/queue/defs.defs.d.ts +4 -0
  59. package/dist/lexicons/tools/ozone/queue/defs.defs.d.ts.map +1 -1
  60. package/dist/lexicons/tools/ozone/queue/defs.defs.js +1 -1
  61. package/dist/lexicons/tools/ozone/queue/defs.defs.js.map +1 -1
  62. package/dist/lexicons/tools/ozone/queue/updateQueue.defs.d.ts +2 -0
  63. package/dist/lexicons/tools/ozone/queue/updateQueue.defs.d.ts.map +1 -1
  64. package/dist/lexicons/tools/ozone/queue/updateQueue.defs.js +1 -1
  65. package/dist/lexicons/tools/ozone/queue/updateQueue.defs.js.map +1 -1
  66. package/dist/lexicons/tools/ozone/safelink/queryRules.defs.d.ts +6 -0
  67. package/dist/lexicons/tools/ozone/safelink/queryRules.defs.d.ts.map +1 -1
  68. package/dist/lexicons/tools/ozone/safelink/queryRules.defs.js +1 -1
  69. package/dist/lexicons/tools/ozone/safelink/queryRules.defs.js.map +1 -1
  70. package/dist/logger.d.ts +1 -0
  71. package/dist/logger.d.ts.map +1 -1
  72. package/dist/logger.js +1 -0
  73. package/dist/logger.js.map +1 -1
  74. package/dist/queue/access.d.ts +19 -0
  75. package/dist/queue/access.d.ts.map +1 -0
  76. package/dist/queue/access.js +51 -0
  77. package/dist/queue/access.js.map +1 -0
  78. package/dist/queue/service.d.ts +7 -3
  79. package/dist/queue/service.d.ts.map +1 -1
  80. package/dist/queue/service.js +10 -3
  81. package/dist/queue/service.js.map +1 -1
  82. package/dist/report/stats.d.ts.map +1 -1
  83. package/dist/report/stats.js +1 -0
  84. package/dist/report/stats.js.map +1 -1
  85. package/dist/safelink/service.d.ts +2 -1
  86. package/dist/safelink/service.d.ts.map +1 -1
  87. package/dist/safelink/service.js +4 -1
  88. package/dist/safelink/service.js.map +1 -1
  89. package/dist/sequencer/backfill-rate-limiter.d.ts +10 -0
  90. package/dist/sequencer/backfill-rate-limiter.d.ts.map +1 -0
  91. package/dist/sequencer/backfill-rate-limiter.js +34 -0
  92. package/dist/sequencer/backfill-rate-limiter.js.map +1 -0
  93. package/dist/sequencer/outbox.d.ts +3 -1
  94. package/dist/sequencer/outbox.d.ts.map +1 -1
  95. package/dist/sequencer/outbox.js +12 -4
  96. package/dist/sequencer/outbox.js.map +1 -1
  97. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atproto/ozone
2
2
 
3
+ ## 0.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5701](https://github.com/bluesky-social/atproto/pull/5701) [`33a5ccc`](https://github.com/bluesky-social/atproto/commit/33a5ccc99d55e135d4e68ad1928fe75a23091bb2) Thanks [@gcwill70](https://github.com/gcwill70)! - Exclude muted reports from inbound statistics across aggregate, queue, category, and moderator groups. Historical snapshots adopt the new definition when recomputed.
8
+
9
+ - [#5700](https://github.com/bluesky-social/atproto/pull/5700) [`53d307b`](https://github.com/bluesky-social/atproto/commit/53d307b614120947d7a11687e9bd0868c1c02dd1) Thanks [@gcwill70](https://github.com/gcwill70)! - Add strict access flag to report queues. Non-admin users will only be able to access strict queues and their reports if they are assigned to them.
10
+
11
+ Allow filtering SafeLink rules by exact source in queryRules, combining with existing filters and pagination.
12
+
13
+ - [#5669](https://github.com/bluesky-social/atproto/pull/5669) [`bb7a1c7`](https://github.com/bluesky-social/atproto/commit/bb7a1c7c1f04c29213f9c0107653748bf05c06aa) Thanks [@foysalit](https://github.com/foysalit)! - Bound historical label replay across subscriptions on each API process to protect request latency. Log subscription cursors and bounded caller metadata at connection start and close for incident attribution.
14
+
3
15
  ## 0.10.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -19,6 +19,14 @@ Wildcard patterns in `com.atproto.label.queryLabels` are disabled by default, in
19
19
 
20
20
  Set `OZONE_LABEL_QUERY_WILDCARDS_ENABLED=true` and restart the API to restore wildcard support. Unset or `false` disables it.
21
21
 
22
+ ## Historical label replay
23
+
24
+ `com.atproto.label.subscribeLabels` connections with a cursor share a historical replay budget on each API process. `OZONE_LABEL_STREAM_BACKFILL_RATE` sets the positive integer number of labels per second; the default is 2000. Pages contain at most 500 labels, so brief page-sized bursts are possible. Restart the API after changing the setting.
25
+
26
+ This bounds bulk replay work while preserving history and cursor ordering. Large backfills take longer, and multiple replaying clients share the budget. Live subscriptions and sequencer polling do not wait for this budget; cutover queries remain bounded by the existing stream buffer limit.
27
+
28
+ Subscription start and close logs include a connection ID, cursor, proxy socket address/port, User-Agent and forwarded address chain. Close logs add the last sequence, yielded event count and duration. Forwarded headers and User-Agent are attribution hints, not authenticated caller identities; cookies and authorization headers are excluded.
29
+
22
30
  ## Moderation query cancellation
23
31
 
24
32
  `queryEvents` and `queryStatuses` cancel their listing SQL when the HTTP client disconnects, using Kysely's `cancel query` abort strategy. Kysely uses a separate PostgreSQL connection for cancellation and holds the listing connection until SQL and cancellation finish. This adds no query deadline.
@@ -1 +1 @@
1
- {"version":3,"file":"subscribeLabels.d.ts","sourceRoot":"","sources":["../../../src/api/label/subscribeLabels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAyBvD"}
1
+ {"version":3,"file":"subscribeLabels.d.ts","sourceRoot":"","sources":["../../../src/api/label/subscribeLabels.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAMlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA4DvD"}
@@ -1,10 +1,16 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { performance } from 'node:perf_hooks';
1
3
  import { InvalidRequestError } from '@atproto/xrpc-server';
2
4
  import { com } from '../../lexicons/index.js';
5
+ import { labelStreamLogger as log } from '../../logger.js';
6
+ import { BackfillRateLimiter } from '../../sequencer/backfill-rate-limiter.js';
3
7
  import { Outbox } from '../../sequencer/outbox.js';
4
8
  export default function (server, ctx) {
9
+ const backfillLimiter = new BackfillRateLimiter(ctx.cfg.service.labelStreamBackfillRate);
5
10
  server.add(com.atproto.label.subscribeLabels, async function* ({ req, params, signal, }) {
6
11
  const { cursor } = params;
7
12
  const outbox = new Outbox(ctx.sequencer, {
13
+ backfillLimiter,
8
14
  onOverflow: () => req.socket.destroy(),
9
15
  });
10
16
  if (cursor !== undefined) {
@@ -13,8 +19,36 @@ export default function (server, ctx) {
13
19
  throw new InvalidRequestError('Cursor in the future.', 'FutureCursor');
14
20
  }
15
21
  }
16
- for await (const evt of outbox.events(cursor, signal)) {
17
- yield com.atproto.label.subscribeLabels.labels.$build(evt);
22
+ const forwardedFor = req.headers['x-forwarded-for'];
23
+ const connection = {
24
+ connectionId: randomUUID(),
25
+ cursor,
26
+ remoteAddress: req.socket.remoteAddress,
27
+ remotePort: req.socket.remotePort,
28
+ userAgent: req.headers['user-agent']?.slice(0, 256),
29
+ // @NOTE These headers aid attribution but are not authenticated identity.
30
+ forwardedFor: (Array.isArray(forwardedFor)
31
+ ? forwardedFor.join(',')
32
+ : forwardedFor)?.slice(0, 512),
33
+ };
34
+ const startedAt = performance.now();
35
+ let eventsSent = 0;
36
+ let lastSeq = cursor;
37
+ log.info(connection, 'label subscription started');
38
+ try {
39
+ for await (const evt of outbox.events(cursor, signal)) {
40
+ eventsSent++;
41
+ lastSeq = evt.seq;
42
+ yield com.atproto.label.subscribeLabels.labels.$build(evt);
43
+ }
44
+ }
45
+ finally {
46
+ log.info({
47
+ ...connection,
48
+ eventsSent,
49
+ lastSeq,
50
+ durationMs: Math.round(performance.now() - startedAt),
51
+ }, 'label subscription closed');
18
52
  }
19
53
  });
20
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"subscribeLabels.js","sourceRoot":"","sources":["../../../src/api/label/subscribeLabels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAe,MAAM,sBAAsB,CAAA;AAEvE,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CACR,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,EACjC,KAAK,SAAS,CAAC,EAAE,EACf,GAAG,EACH,MAAM,EACN,MAAM,GACP;QACC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;QACzB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE;YACvC,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE;SACvC,CAAC,CAAA;QAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;YACvC,IAAI,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,mBAAmB,CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAA;YACxE,CAAC;QACH,CAAC;QAED,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;YACtD,MAAM,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC","sourcesContent":["import { InvalidRequestError, type Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { com } from '../../lexicons/index.js'\nimport { Outbox } from '../../sequencer/outbox.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(\n com.atproto.label.subscribeLabels,\n async function* ({\n req,\n params,\n signal,\n }): AsyncGenerator<com.atproto.label.subscribeLabels.$Message> {\n const { cursor } = params\n const outbox = new Outbox(ctx.sequencer, {\n onOverflow: () => req.socket.destroy(),\n })\n\n if (cursor !== undefined) {\n const curr = await ctx.sequencer.curr()\n if (cursor > (curr ?? 0)) {\n throw new InvalidRequestError('Cursor in the future.', 'FutureCursor')\n }\n }\n\n for await (const evt of outbox.events(cursor, signal)) {\n yield com.atproto.label.subscribeLabels.labels.$build(evt)\n }\n },\n )\n}\n"]}
1
+ {"version":3,"file":"subscribeLabels.js","sourceRo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F,CAAA;AACH,CAAC","sourcesContent":["import { randomUUID } from 'node:crypto'\nimport { performance } from 'node:perf_hooks'\nimport { InvalidRequestError, type Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { com } from '../../lexicons/index.js'\nimport { labelStreamLogger as log } from '../../logger.js'\nimport { BackfillRateLimiter } from '../../sequencer/backfill-rate-limiter.js'\nimport { Outbox } from '../../sequencer/outbox.js'\n\nexport default function (server: Server, ctx: AppContext) {\n const backfillLimiter = new BackfillRateLimiter(\n ctx.cfg.service.labelStreamBackfillRate,\n )\n server.add(\n com.atproto.label.subscribeLabels,\n async function* ({\n req,\n params,\n signal,\n }): AsyncGenerator<com.atproto.label.subscribeLabels.$Message> {\n const { cursor } = params\n const outbox = new Outbox(ctx.sequencer, {\n backfillLimiter,\n onOverflow: () => req.socket.destroy(),\n })\n\n if (cursor !== undefined) {\n const curr = await ctx.sequencer.curr()\n if (cursor > (curr ?? 0)) {\n throw new InvalidRequestError('Cursor in the future.', 'FutureCursor')\n }\n }\n\n const forwardedFor = req.headers['x-forwarded-for']\n const connection = {\n connectionId: randomUUID(),\n cursor,\n remoteAddress: req.socket.remoteAddress,\n remotePort: req.socket.remotePort,\n userAgent: req.headers['user-agent']?.slice(0, 256),\n // @NOTE These headers aid attribution but are not authenticated identity.\n forwardedFor: (Array.isArray(forwardedFor)\n ? forwardedFor.join(',')\n : forwardedFor\n )?.slice(0, 512),\n }\n const startedAt = performance.now()\n let eventsSent = 0\n let lastSeq = cursor\n log.info(connection, 'label subscription started')\n try {\n for await (const evt of outbox.events(cursor, signal)) {\n eventsSent++\n lastSeq = evt.seq\n yield com.atproto.label.subscribeLabels.labels.$build(evt)\n }\n } finally {\n log.info(\n {\n ...connection,\n eventsSent,\n lastSeq,\n durationMs: Math.round(performance.now() - startedAt),\n },\n 'label subscription closed',\n )\n }\n },\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"assignModerator.d.ts","sourceRoot":"","sources":["../../../src/api/queue/assignModerator.ts"],"names":[],"mappings":"AACA,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,QAgCvD"}
1
+ {"version":3,"file":"assignModerator.d.ts","sourceRoot":"","sources":["../../../src/api/queue/assignModerator.ts"],"names":[],"mappings":"AACA,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,QAmCvD"}
@@ -21,7 +21,7 @@ export default function (server, ctx) {
21
21
  if (did !== authDid && !auth.credentials.isAdmin) {
22
22
  throw new ForbiddenError('Unauthorized');
23
23
  }
24
- const result = await ctx.assignmentService.assignQueue({ did, queueId });
24
+ const result = await ctx.assignmentService.assignQueue({ did, queueId }, auth.credentials);
25
25
  return {
26
26
  encoding: 'application/json',
27
27
  body: result,
@@ -1 +1 @@
1
- {"version":3,"file":"assignModerator.js","sourceRoot":"","sources":["../../../src/api/queue/assignModerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EACL,cAAc,EACd,mBAAmB,GAEpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE;QAC5C,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;YACjC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,IAAI,CAAA;YAEnC,qEAAqE;YACrE,iCAAiC;YACjC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,MAAM,IAAI,mBAAmB,CAAC,oBAAoB,CAAC,CAAA;YACrD,CAAC;YAED,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YAErD,OAAO;YACP,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;gBAClC,MAAM,IAAI,cAAc,CAAC,cAAc,CAAC,CAAA;YAC1C,CAAC;YAED,QAAQ;YACR,IAAI,GAAG,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBACjD,MAAM,IAAI,cAAc,CAAC,cAAc,CAAC,CAAA;YAC1C,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;YAExE,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,MAAM;aACb,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { isDidString } from '@atproto/lex'\nimport {\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 { getAuthDid } from '../util.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.queue.assignModerator, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const { queueId, did } = input.body\n\n // @TODO The lexicon schema should define the \"did\" property as a did\n // string format (but it doesn't)\n if (!isDidString(did)) {\n throw new InvalidRequestError('Invalid DID format')\n }\n\n const authDid = getAuthDid(auth, ctx.cfg.service.did)\n\n // RBAC\n if (!auth.credentials.isModerator) {\n throw new ForbiddenError('Unauthorized')\n }\n\n // RuBAC\n if (did !== authDid && !auth.credentials.isAdmin) {\n throw new ForbiddenError('Unauthorized')\n }\n\n const result = await ctx.assignmentService.assignQueue({ did, queueId })\n\n return {\n encoding: 'application/json',\n body: result,\n }\n },\n })\n}\n"]}
1
+ {"version":3,"file":"assignModerator.js","sourceRoot":"","sources":["../../../src/api/queue/assignModerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EACL,cAAc,EACd,mBAAmB,GAEpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE;QAC5C,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;YACjC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,IAAI,CAAA;YAEnC,qEAAqE;YACrE,iCAAiC;YACjC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,MAAM,IAAI,mBAAmB,CAAC,oBAAoB,CAAC,CAAA;YACrD,CAAC;YAED,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YAErD,OAAO;YACP,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;gBAClC,MAAM,IAAI,cAAc,CAAC,cAAc,CAAC,CAAA;YAC1C,CAAC;YAED,QAAQ;YACR,IAAI,GAAG,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBACjD,MAAM,IAAI,cAAc,CAAC,cAAc,CAAC,CAAA;YAC1C,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,iBAAiB,CAAC,WAAW,CACpD,EAAE,GAAG,EAAE,OAAO,EAAE,EAChB,IAAI,CAAC,WAAW,CACjB,CAAA;YAED,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,MAAM;aACb,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { isDidString } from '@atproto/lex'\nimport {\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 { getAuthDid } from '../util.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.queue.assignModerator, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const { queueId, did } = input.body\n\n // @TODO The lexicon schema should define the \"did\" property as a did\n // string format (but it doesn't)\n if (!isDidString(did)) {\n throw new InvalidRequestError('Invalid DID format')\n }\n\n const authDid = getAuthDid(auth, ctx.cfg.service.did)\n\n // RBAC\n if (!auth.credentials.isModerator) {\n throw new ForbiddenError('Unauthorized')\n }\n\n // RuBAC\n if (did !== authDid && !auth.credentials.isAdmin) {\n throw new ForbiddenError('Unauthorized')\n }\n\n const result = await ctx.assignmentService.assignQueue(\n { did, queueId },\n auth.credentials,\n )\n\n return {\n encoding: 'application/json',\n body: result,\n }\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createQueue.d.ts","sourceRoot":"","sources":["../../../src/api/queue/createQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAKlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA0EvD"}
1
+ {"version":3,"file":"createQueue.d.ts","sourceRoot":"","sources":["../../../src/api/queue/createQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAKlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA+EvD"}
@@ -9,7 +9,10 @@ export default function (server, ctx) {
9
9
  if (!access.isModerator) {
10
10
  throw new AuthRequiredError('Must be a moderator to create a queue');
11
11
  }
12
- const { name, subjectTypes = [], collection, reportTypes = [], reporterTags = [], accountTags = [], description, recommendedPolicies = [], recommendedLabels = [], } = input.body;
12
+ const { strictAccess = false, name, subjectTypes = [], collection, reportTypes = [], reporterTags = [], accountTags = [], description, recommendedPolicies = [], recommendedLabels = [], } = input.body;
13
+ if (strictAccess && !access.isAdmin) {
14
+ throw new AuthRequiredError('Only admins can create strict queues');
15
+ }
13
16
  const createdBy = access.type === 'admin_token' ? 'admin_token' : access.iss;
14
17
  const invalidTypes = subjectTypes.filter((t) => !VALID_SUBJECT_TYPES.includes(t));
15
18
  if (invalidTypes.length > 0) {
@@ -31,6 +34,7 @@ export default function (server, ctx) {
31
34
  recommendedLabels,
32
35
  });
33
36
  return queueService.create({
37
+ strictAccess,
34
38
  name,
35
39
  subjectTypes,
36
40
  collection,
@@ -1 +1 @@
1
- {"version":3,"file":"createQueue.js","sourceRoot":"","sources":["../../../src/api/queue/createQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,sBAAsB,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tG,oBAAoB,CACrB,CAAA;YACH,CAAC;YAED,IAAI,UAAU,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACnD,MAAM,IAAI,mBAAmB,CAC3B,sEAAsE,EACtE,mBAAmB,CACpB,CAAA;YACH,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACrD,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;gBAC5C,MAAM,YAAY,CAAC,yBAAyB,CAAC,mBAAmB,CAAC,CAAA;gBACjE,MAAM,YAAY,CAAC,aAAa,CAAC;oBAC/B,IAAI;oBACJ,YAAY;oBACZ,UAAU;oBACV,WAAW;oBACX,YAAY;oBACZ,WAAW;oBACX,iBAAiB;iBAClB,CAAC,CAAA;gBACF,OAAO,YAAY,CAAC,MAAM,CAAC;oBACzB,IAAI;oBACJ,YAAY;oBACZ,UAAU;oBACV,WAAW;oBACX,YAAY;oBACZ,WAAW;oBACX,WAAW;oBACX,mBAAmB;oBACnB,iBAAiB;oBACjB,SAAS;iBACV,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;YACF,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAE7C,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;aAC1C,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n AuthRequiredError,\n InvalidRequestError,\n type Server,\n} from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\n\nconst VALID_SUBJECT_TYPES = ['account', 'record', 'message', 'conversation']\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.queue.createQueue, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const access = auth.credentials\n\n if (!access.isModerator) {\n throw new AuthRequiredError('Must be a moderator to create a queue')\n }\n\n const {\n name,\n subjectTypes = [],\n collection,\n reportTypes = [],\n reporterTags = [],\n accountTags = [],\n description,\n recommendedPolicies = [],\n recommendedLabels = [],\n } = input.body\n const createdBy =\n access.type === 'admin_token' ? 'admin_token' : access.iss\n\n const invalidTypes = subjectTypes.filter(\n (t) => !VALID_SUBJECT_TYPES.includes(t),\n )\n if (invalidTypes.length > 0) {\n throw new InvalidRequestError(\n `Invalid subject types: ${invalidTypes.join(', ')}. Allowed values: ${VALID_SUBJECT_TYPES.join(', ')}`,\n 'InvalidSubjectType',\n )\n }\n\n if (collection && !subjectTypes.includes('record')) {\n throw new InvalidRequestError(\n 'collection can only be specified when subjectTypes includes \"record\"',\n 'InvalidCollection',\n )\n }\n\n const queue = await ctx.db.transaction(async (dbTxn) => {\n const queueService = ctx.queueService(dbTxn)\n await queueService.assertRecommendedPolicies(recommendedPolicies)\n await queueService.checkConflict({\n name,\n subjectTypes,\n collection,\n reportTypes,\n reporterTags,\n accountTags,\n recommendedLabels,\n })\n return queueService.create({\n name,\n subjectTypes,\n collection,\n reportTypes,\n reporterTags,\n accountTags,\n description,\n recommendedPolicies,\n recommendedLabels,\n createdBy,\n })\n })\n const queueService = ctx.queueService(ctx.db)\n\n return {\n encoding: 'application/json',\n body: { queue: queueService.view(queue) },\n }\n },\n })\n}\n"]}
1
+ {"version":3,"file":"createQueue.js","sourceRoot":"","sources":["../../../src/api/queue/createQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAA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E,EACtG,oBAAoB,CACrB,CAAA;YACH,CAAC;YAED,IAAI,UAAU,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACnD,MAAM,IAAI,mBAAmB,CAC3B,sEAAsE,EACtE,mBAAmB,CACpB,CAAA;YACH,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACrD,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;gBAC5C,MAAM,YAAY,CAAC,yBAAyB,CAAC,mBAAmB,CAAC,CAAA;gBACjE,MAAM,YAAY,CAAC,aAAa,CAAC;oBAC/B,IAAI;oBACJ,YAAY;oBACZ,UAAU;oBACV,WAAW;oBACX,YAAY;oBACZ,WAAW;oBACX,iBAAiB;iBAClB,CAAC,CAAA;gBACF,OAAO,YAAY,CAAC,MAAM,CAAC;oBACzB,YAAY;oBACZ,IAAI;oBACJ,YAAY;oBACZ,UAAU;oBACV,WAAW;oBACX,YAAY;oBACZ,WAAW;oBACX,WAAW;oBACX,mBAAmB;oBACnB,iBAAiB;oBACjB,SAAS;iBACV,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;YACF,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAE7C,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;aAC1C,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n AuthRequiredError,\n InvalidRequestError,\n type Server,\n} from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\n\nconst VALID_SUBJECT_TYPES = ['account', 'record', 'message', 'conversation']\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.queue.createQueue, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const access = auth.credentials\n\n if (!access.isModerator) {\n throw new AuthRequiredError('Must be a moderator to create a queue')\n }\n\n const {\n strictAccess = false,\n name,\n subjectTypes = [],\n collection,\n reportTypes = [],\n reporterTags = [],\n accountTags = [],\n description,\n recommendedPolicies = [],\n recommendedLabels = [],\n } = input.body\n if (strictAccess && !access.isAdmin) {\n throw new AuthRequiredError('Only admins can create strict queues')\n }\n const createdBy =\n access.type === 'admin_token' ? 'admin_token' : access.iss\n\n const invalidTypes = subjectTypes.filter(\n (t) => !VALID_SUBJECT_TYPES.includes(t),\n )\n if (invalidTypes.length > 0) {\n throw new InvalidRequestError(\n `Invalid subject types: ${invalidTypes.join(', ')}. Allowed values: ${VALID_SUBJECT_TYPES.join(', ')}`,\n 'InvalidSubjectType',\n )\n }\n\n if (collection && !subjectTypes.includes('record')) {\n throw new InvalidRequestError(\n 'collection can only be specified when subjectTypes includes \"record\"',\n 'InvalidCollection',\n )\n }\n\n const queue = await ctx.db.transaction(async (dbTxn) => {\n const queueService = ctx.queueService(dbTxn)\n await queueService.assertRecommendedPolicies(recommendedPolicies)\n await queueService.checkConflict({\n name,\n subjectTypes,\n collection,\n reportTypes,\n reporterTags,\n accountTags,\n recommendedLabels,\n })\n return queueService.create({\n strictAccess,\n name,\n subjectTypes,\n collection,\n reportTypes,\n reporterTags,\n accountTags,\n description,\n recommendedPolicies,\n recommendedLabels,\n createdBy,\n })\n })\n const queueService = ctx.queueService(ctx.db)\n\n return {\n encoding: 'application/json',\n body: { queue: queueService.view(queue) },\n }\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deleteQueue.d.ts","sourceRoot":"","sources":["../../../src/api/queue/deleteQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAmDvD"}
1
+ {"version":3,"file":"deleteQueue.d.ts","sourceRoot":"","sources":["../../../src/api/queue/deleteQueue.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,QA8DvD"}
@@ -1,5 +1,6 @@
1
1
  import { AuthRequiredError, InvalidRequestError, } from '@atproto/xrpc-server';
2
2
  import { tools } from '../../lexicons/index.js';
3
+ import { QueueAccess } from '../../queue/access.js';
3
4
  export default function (server, ctx) {
4
5
  server.add(tools.ozone.queue.deleteQueue, {
5
6
  auth: ctx.authVerifier.modOrAdminToken,
@@ -9,22 +10,34 @@ export default function (server, ctx) {
9
10
  throw new AuthRequiredError('Must be a moderator to delete a queue');
10
11
  }
11
12
  const { queueId, migrateToQueueId } = input.body;
12
- const queueService = ctx.queueService(ctx.db);
13
- const existing = await queueService.getById(queueId);
14
- if (!existing) {
15
- throw new InvalidRequestError(`Queue with id ${queueId} does not exist`, 'QueueNotFound');
16
- }
17
- if (migrateToQueueId !== undefined) {
18
- const targetQueue = await queueService.getById(migrateToQueueId);
19
- if (!targetQueue) {
13
+ const reportsMigrated = await ctx.db.transaction(async (dbTxn) => {
14
+ const queueService = ctx.queueService(dbTxn);
15
+ const queueIds = new Set([queueId]);
16
+ if (migrateToQueueId !== undefined)
17
+ queueIds.add(migrateToQueueId);
18
+ const existingQueueIds = new Set();
19
+ // @NOTE Lock in ID order so opposing migrations cannot deadlock on queues.
20
+ for (const id of [...queueIds].sort((a, b) => a - b)) {
21
+ if (await queueService.getById(id, true))
22
+ existingQueueIds.add(id);
23
+ }
24
+ if (!existingQueueIds.has(queueId)) {
25
+ throw new InvalidRequestError(`Queue with id ${queueId} does not exist`, 'QueueNotFound');
26
+ }
27
+ if (migrateToQueueId !== undefined &&
28
+ !existingQueueIds.has(migrateToQueueId)) {
20
29
  throw new InvalidRequestError(`Target queue with id ${migrateToQueueId} does not exist`, 'QueueNotFound');
21
30
  }
22
- }
23
- // Migrate non-closed reports before soft-deleting the queue.
24
- // Closed reports are left assigned to the deleted queue — their history is preserved.
25
- // Non-closed reports go to migrateToQueueId if specified, otherwise to -1 (unmatched).
26
- const reportsMigrated = await queueService.migrateReports(queueId, migrateToQueueId);
27
- await queueService.delete(queueId);
31
+ const queueAccess = await QueueAccess.forActor(dbTxn, access);
32
+ for (const id of queueIds)
33
+ queueAccess.assertQueue(id);
34
+ // Migrate non-closed reports before soft-deleting the queue.
35
+ // Closed reports are left assigned to the deleted queue — their history is preserved.
36
+ // Non-closed reports go to migrateToQueueId if specified, otherwise to -1 (unmatched).
37
+ const migrated = await queueService.migrateReports(queueId, migrateToQueueId);
38
+ await queueService.delete(queueId);
39
+ return migrated;
40
+ });
28
41
  return {
29
42
  encoding: 'application/json',
30
43
  body: {
@@ -1 +1 @@
1
- {"version":3,"file":"deleteQueue.js","sourceRoot":"","sources":["../../../src/api/queue/deleteQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE;QACxC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;YACjC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;YAE/B,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;gBACxB,MAAM,IAAI,iBAAiB,CAAC,uCAAuC,CAAC,CAAA;YACtE,CAAC;YAED,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC,IAAI,CAAA;YAEhD,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAE7C,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YACpD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,mBAAmB,CAC3B,iBAAiB,OAAO,iBAAiB,EACzC,eAAe,CAChB,CAAA;YACH,CAAC;YAED,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;gBAChE,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,MAAM,IAAI,mBAAmB,CAC3B,wBAAwB,gBAAgB,iBAAiB,EACzD,eAAe,CAChB,CAAA;gBACH,CAAC;YACH,CAAC;YAED,6DAA6D;YAC7D,sFAAsF;YACtF,uFAAuF;YACvF,MAAM,eAAe,GAAG,MAAM,YAAY,CAAC,cAAc,CACvD,OAAO,EACP,gBAAgB,CACjB,CAAA;YAED,MAAM,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAElC,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,OAAO,EAAE,IAAI;oBACb,eAAe;iBAChB;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n AuthRequiredError,\n InvalidRequestError,\n type Server,\n} from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.queue.deleteQueue, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const access = auth.credentials\n\n if (!access.isModerator) {\n throw new AuthRequiredError('Must be a moderator to delete a queue')\n }\n\n const { queueId, migrateToQueueId } = input.body\n\n const queueService = ctx.queueService(ctx.db)\n\n const existing = await queueService.getById(queueId)\n if (!existing) {\n throw new InvalidRequestError(\n `Queue with id ${queueId} does not exist`,\n 'QueueNotFound',\n )\n }\n\n if (migrateToQueueId !== undefined) {\n const targetQueue = await queueService.getById(migrateToQueueId)\n if (!targetQueue) {\n throw new InvalidRequestError(\n `Target queue with id ${migrateToQueueId} does not exist`,\n 'QueueNotFound',\n )\n }\n }\n\n // Migrate non-closed reports before soft-deleting the queue.\n // Closed reports are left assigned to the deleted queue — their history is preserved.\n // Non-closed reports go to migrateToQueueId if specified, otherwise to -1 (unmatched).\n const reportsMigrated = await queueService.migrateReports(\n queueId,\n migrateToQueueId,\n )\n\n await queueService.delete(queueId)\n\n return {\n encoding: 'application/json',\n body: {\n deleted: true,\n reportsMigrated,\n },\n }\n },\n })\n}\n"]}
1
+ {"version":3,"file":"deleteQueue.js","sourceRoot":"","sources":["../../../src/api/queue/deleteQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE;QACxC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;YACjC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;YAE/B,IA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AAW,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;gBAC7D,KAAK,MAAM,EAAE,IAAI,QAAQ;oBAAE,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;gBAEtD,6DAA6D;gBAC7D,sFAAsF;gBACtF,uFAAuF;gBACvF,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,cAAc,CAChD,OAAO,EACP,gBAAgB,CACjB,CAAA;gBAED,MAAM,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;gBAClC,OAAO,QAAQ,CAAA;YACjB,CAAC,CAAC,CAAA;YAEF,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,OAAO,EAAE,IAAI;oBACb,eAAe;iBAChB;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n AuthRequiredError,\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.queue.deleteQueue, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const access = auth.credentials\n\n if (!access.isModerator) {\n throw new AuthRequiredError('Must be a moderator to delete a queue')\n }\n\n const { queueId, migrateToQueueId } = input.body\n\n const reportsMigrated = await ctx.db.transaction(async (dbTxn) => {\n const queueService = ctx.queueService(dbTxn)\n const queueIds = new Set([queueId])\n if (migrateToQueueId !== undefined) queueIds.add(migrateToQueueId)\n const existingQueueIds = new Set<number>()\n // @NOTE Lock in ID order so opposing migrations cannot deadlock on queues.\n for (const id of [...queueIds].sort((a, b) => a - b)) {\n if (await queueService.getById(id, true)) existingQueueIds.add(id)\n }\n\n if (!existingQueueIds.has(queueId)) {\n throw new InvalidRequestError(\n `Queue with id ${queueId} does not exist`,\n 'QueueNotFound',\n )\n }\n if (\n migrateToQueueId !== undefined &&\n !existingQueueIds.has(migrateToQueueId)\n ) {\n throw new InvalidRequestError(\n `Target queue with id ${migrateToQueueId} does not exist`,\n 'QueueNotFound',\n )\n }\n\n const queueAccess = await QueueAccess.forActor(dbTxn, access)\n for (const id of queueIds) queueAccess.assertQueue(id)\n\n // Migrate non-closed reports before soft-deleting the queue.\n // Closed reports are left assigned to the deleted queue — their history is preserved.\n // Non-closed reports go to migrateToQueueId if specified, otherwise to -1 (unmatched).\n const migrated = await queueService.migrateReports(\n queueId,\n migrateToQueueId,\n )\n\n await queueService.delete(queueId)\n return migrated\n })\n\n return {\n encoding: 'application/json',\n body: {\n deleted: true,\n reportsMigrated,\n },\n }\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"listQueues.d.ts","sourceRoot":"","sources":["../../../src/api/queue/listQueues.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA4CvD"}
1
+ {"version":3,"file":"listQueues.d.ts","sourceRoot":"","sources":["../../../src/api/queue/listQueues.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA6CvD"}
@@ -1,10 +1,11 @@
1
1
  import { isNsidString } from '@atproto/lex';
2
2
  import { InvalidRequestError } from '@atproto/xrpc-server';
3
3
  import { tools } from '../../lexicons/index.js';
4
+ import { QueueAccess } from '../../queue/access.js';
4
5
  export default function (server, ctx) {
5
6
  server.add(tools.ozone.queue.listQueues, {
6
7
  auth: ctx.authVerifier.modOrAdminToken,
7
- handler: async ({ params }) => {
8
+ handler: async ({ params, auth }) => {
8
9
  const { limit = 50, cursor, enabled, subjectType, collection, reportTypes, } = params;
9
10
  // @TODO The lexicon should define the "collection" property as a NSID
10
11
  // string format (but it doesn't)
@@ -13,6 +14,7 @@ export default function (server, ctx) {
13
14
  }
14
15
  const queueService = ctx.queueService(ctx.db);
15
16
  const result = await queueService.list({
17
+ access: await QueueAccess.forActor(ctx.db, auth.credentials),
16
18
  limit,
17
19
  cursor,
18
20
  enabled,
@@ -1 +1 @@
1
- {"version":3,"file":"listQueues.js","sourceRoot":"","sources":["../../../src/api/queue/listQueues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAe,MAAM,sBAAsB,CAAA;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE;QACvC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YAC5B,MAAM,EACJ,KAAK,GAAG,EAAE,EACV,MAAM,EACN,OAAO,EACP,WAAW,EACX,UAAU,EACV,WAAW,GACZ,GAAG,MAAM,CAAA;YAEV,sEAAsE;YACtE,iCAAiC;YACjC,IAAI,UAAU,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;gBACpD,MAAM,IAAI,mBAAmB,CAC3B,yBAAyB,EACzB,gBAAgB,CACjB,CAAA;YACH,CAAC;YAED,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAE7C,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC;gBACrC,KAAK;gBACL,MAAM;gBACN,OAAO;gBACP,WAAW;gBACX,UAAU;gBACV,WAAW;aACZ,CAAC,CAAA;YAEF,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;YAE/D,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,MAAM;oBACN,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { isNsidString } from '@atproto/lex'\nimport { InvalidRequestError, type Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.queue.listQueues, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ params }) => {\n const {\n limit = 50,\n cursor,\n enabled,\n subjectType,\n collection,\n reportTypes,\n } = params\n\n // @TODO The lexicon should define the \"collection\" property as a NSID\n // string format (but it doesn't)\n if (collection != null && !isNsidString(collection)) {\n throw new InvalidRequestError(\n 'Invalid collection NSID',\n 'InvalidRequest',\n )\n }\n\n const queueService = ctx.queueService(ctx.db)\n\n const result = await queueService.list({\n limit,\n cursor,\n enabled,\n subjectType,\n collection,\n reportTypes,\n })\n\n const queues = await queueService.viewsWithStats(result.queues)\n\n return {\n encoding: 'application/json',\n body: {\n queues,\n cursor: result.cursor,\n },\n }\n },\n })\n}\n"]}
1
+ {"version":3,"file":"listQueues.js","sourceRoot":"","sources":["../../../src/api/queue/listQueues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAe,MAAM,sBAAsB,CAAA;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OA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pc-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.queue.listQueues, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ params, auth }) => {\n const {\n limit = 50,\n cursor,\n enabled,\n subjectType,\n collection,\n reportTypes,\n } = params\n\n // @TODO The lexicon should define the \"collection\" property as a NSID\n // string format (but it doesn't)\n if (collection != null && !isNsidString(collection)) {\n throw new InvalidRequestError(\n 'Invalid collection NSID',\n 'InvalidRequest',\n )\n }\n\n const queueService = ctx.queueService(ctx.db)\n\n const result = await queueService.list({\n access: await QueueAccess.forActor(ctx.db, auth.credentials),\n limit,\n cursor,\n enabled,\n subjectType,\n collection,\n reportTypes,\n })\n\n const queues = await queueService.viewsWithStats(result.queues)\n\n return {\n encoding: 'application/json',\n body: {\n queues,\n cursor: result.cursor,\n },\n }\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"updateQueue.d.ts","sourceRoot":"","sources":["../../../src/api/queue/updateQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAgFvD"}
1
+ {"version":3,"file":"updateQueue.d.ts","sourceRoot":"","sources":["../../../src/api/queue/updateQueue.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,QAyFvD"}
@@ -1,5 +1,6 @@
1
1
  import { AuthRequiredError, InvalidRequestError, } from '@atproto/xrpc-server';
2
2
  import { tools } from '../../lexicons/index.js';
3
+ import { QueueAccess } from '../../queue/access.js';
3
4
  export default function (server, ctx) {
4
5
  server.add(tools.ozone.queue.updateQueue, {
5
6
  auth: ctx.authVerifier.modOrAdminToken,
@@ -8,21 +9,29 @@ export default function (server, ctx) {
8
9
  if (!access.isModerator) {
9
10
  throw new AuthRequiredError('Must be a moderator to update a queue');
10
11
  }
11
- const { queueId, name, enabled, description, recommendedPolicies, recommendedLabels, } = input.body;
12
+ const { queueId, name, enabled, strictAccess, description, recommendedPolicies, recommendedLabels, } = input.body;
12
13
  if (name === undefined &&
13
14
  enabled === undefined &&
15
+ strictAccess === undefined &&
14
16
  description === undefined &&
15
17
  recommendedPolicies === undefined &&
16
18
  recommendedLabels === undefined) {
17
19
  throw new InvalidRequestError('At least one queue property must be provided');
18
20
  }
21
+ if (strictAccess !== undefined && !access.isAdmin) {
22
+ throw new AuthRequiredError('Only admins can change strict access');
23
+ }
19
24
  const queue = await ctx.db.transaction(async (dbTxn) => {
20
25
  const queueService = ctx.queueService(dbTxn);
21
- const existing = await queueService.getById(queueId);
26
+ const existing = await queueService.getById(queueId, true);
22
27
  if (!existing) {
23
28
  throw new InvalidRequestError(`Queue with id ${queueId} does not exist`, 'QueueNotFound');
24
29
  }
30
+ const queueAccess = await QueueAccess.forActor(dbTxn, access);
31
+ queueAccess.assertQueue(queueId);
25
32
  const updates = {};
33
+ if (strictAccess !== undefined)
34
+ updates.strictAccess = strictAccess;
26
35
  if (name !== undefined)
27
36
  updates.name = name;
28
37
  if (enabled !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"updateQueue.js","sourceRoot":"","sources":["../../../src/api/queue/updateQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,MAAM,CAAC,OAAO,WAAW,MAA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AO,CAAC,OAAO,GAAG,OAAO,CAAA;gBACpD,IAAI,WAAW,KAAK,SAAS;oBAAE,OAAO,CAAC,WAAW,GAAG,WAAW,CAAA;gBAChE,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;oBACtC,MAAM,YAAY,CAAC,yBAAyB,CAAC,mBAAmB,CAAC,CAAA;oBACjE,OAAO,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;gBACnD,CAAC;gBACD,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;oBACpC,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;gBAC/C,CAAC;gBAED,MAAM,YAAY,CAAC,aAAa,CAAC;oBAC/B,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI;oBAC3B,YAAY,EAAE,QAAQ,CAAC,YAAY;oBACnC,UAAU,EAAE,QAAQ,CAAC,UAAU;oBAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;oBACjC,YAAY,EAAE,QAAQ,CAAC,YAAY;oBACnC,WAAW,EAAE,QAAQ,CAAC,WAAW;oBACjC,iBAAiB,EAAE,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB;oBAClE,SAAS,EAAE,OAAO;iBACnB,CAAC,CAAA;gBAEF,OAAO,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YAC9C,CAAC,CAAC,CAAA;YACF,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAE7C,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;aAC1C,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n AuthRequiredError,\n InvalidRequestError,\n type Server,\n} from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.queue.updateQueue, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const access = auth.credentials\n\n if (!access.isModerator) {\n throw new AuthRequiredError('Must be a moderator to update a queue')\n }\n\n const {\n queueId,\n name,\n enabled,\n description,\n recommendedPolicies,\n recommendedLabels,\n } = input.body\n\n if (\n name === undefined &&\n enabled === undefined &&\n description === undefined &&\n recommendedPolicies === undefined &&\n recommendedLabels === undefined\n ) {\n throw new InvalidRequestError(\n 'At least one queue property must be provided',\n )\n }\n\n const queue = await ctx.db.transaction(async (dbTxn) => {\n const queueService = ctx.queueService(dbTxn)\n const existing = await queueService.getById(queueId)\n if (!existing) {\n throw new InvalidRequestError(\n `Queue with id ${queueId} does not exist`,\n 'QueueNotFound',\n )\n }\n\n const updates: {\n name?: string\n enabled?: boolean\n description?: string\n recommendedPolicies?: string[]\n recommendedLabels?: string[]\n } = {}\n if (name !== undefined) updates.name = name\n if (enabled !== undefined) updates.enabled = enabled\n if (description !== undefined) updates.description = description\n if (recommendedPolicies !== undefined) {\n await queueService.assertRecommendedPolicies(recommendedPolicies)\n updates.recommendedPolicies = recommendedPolicies\n }\n if (recommendedLabels !== undefined) {\n updates.recommendedLabels = recommendedLabels\n }\n\n await queueService.checkConflict({\n name: name ?? existing.name,\n subjectTypes: existing.subjectTypes,\n collection: existing.collection,\n reportTypes: existing.reportTypes,\n reporterTags: existing.reporterTags,\n accountTags: existing.accountTags,\n recommendedLabels: recommendedLabels ?? existing.recommendedLabels,\n excludeId: queueId,\n })\n\n return queueService.update(queueId, updates)\n })\n const queueService = ctx.queueService(ctx.db)\n\n return {\n encoding: 'application/json',\n body: { queue: queueService.view(queue) },\n }\n },\n })\n}\n"]}
1
+ {"version":3,"file":"updateQueue.js","sourceRoot":"","sources":["../../../src/api/queue/updateQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,sBAA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AAE,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB;oBAClE,SAAS,EAAE,OAAO;iBACnB,CAAC,CAAA;gBAEF,OAAO,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YAC9C,CAAC,CAAC,CAAA;YACF,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAE7C,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;aAC1C,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n AuthRequiredError,\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.queue.updateQueue, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input, auth }) => {\n const access = auth.credentials\n\n if (!access.isModerator) {\n throw new AuthRequiredError('Must be a moderator to update a queue')\n }\n\n const {\n queueId,\n name,\n enabled,\n strictAccess,\n description,\n recommendedPolicies,\n recommendedLabels,\n } = input.body\n\n if (\n name === undefined &&\n enabled === undefined &&\n strictAccess === undefined &&\n description === undefined &&\n recommendedPolicies === undefined &&\n recommendedLabels === undefined\n ) {\n throw new InvalidRequestError(\n 'At least one queue property must be provided',\n )\n }\n\n if (strictAccess !== undefined && !access.isAdmin) {\n throw new AuthRequiredError('Only admins can change strict access')\n }\n const queue = await ctx.db.transaction(async (dbTxn) => {\n const queueService = ctx.queueService(dbTxn)\n const existing = await queueService.getById(queueId, true)\n if (!existing) {\n throw new InvalidRequestError(\n `Queue with id ${queueId} does not exist`,\n 'QueueNotFound',\n )\n }\n const queueAccess = await QueueAccess.forActor(dbTxn, access)\n queueAccess.assertQueue(queueId)\n\n const updates: {\n name?: string\n enabled?: boolean\n strictAccess?: boolean\n description?: string\n recommendedPolicies?: string[]\n recommendedLabels?: string[]\n } = {}\n if (strictAccess !== undefined) updates.strictAccess = strictAccess\n if (name !== undefined) updates.name = name\n if (enabled !== undefined) updates.enabled = enabled\n if (description !== undefined) updates.description = description\n if (recommendedPolicies !== undefined) {\n await queueService.assertRecommendedPolicies(recommendedPolicies)\n updates.recommendedPolicies = recommendedPolicies\n }\n if (recommendedLabels !== undefined) {\n updates.recommendedLabels = recommendedLabels\n }\n\n await queueService.checkConflict({\n name: name ?? existing.name,\n subjectTypes: existing.subjectTypes,\n collection: existing.collection,\n reportTypes: existing.reportTypes,\n reporterTags: existing.reporterTags,\n accountTags: existing.accountTags,\n recommendedLabels: recommendedLabels ?? existing.recommendedLabels,\n excludeId: queueId,\n })\n\n return queueService.update(queueId, updates)\n })\n const queueService = ctx.queueService(ctx.db)\n\n return {\n encoding: 'application/json',\n body: { queue: queueService.view(queue) },\n }\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getReport.d.ts","sourceRoot":"","sources":["../../../src/api/report/getReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAMlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA+CvD"}
1
+ {"version":3,"file":"getReport.d.ts","sourceRoot":"","sources":["../../../src/api/report/getReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAOlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAkDvD"}
@@ -1,6 +1,7 @@
1
1
  import { InvalidRequestError } from '@atproto/xrpc-server';
2
2
  import { tools } from '../../lexicons/index.js';
3
3
  import { getReportById } from '../../mod-service/report.js';
4
+ import { QueueAccess } from '../../queue/access.js';
4
5
  import { buildReportView, hydrateReportInfo } from '../../report/views.js';
5
6
  import { getPdsAccountInfos } from '../util.js';
6
7
  export default function (server, ctx) {
@@ -10,8 +11,11 @@ export default function (server, ctx) {
10
11
  const db = ctx.db;
11
12
  const modService = ctx.modService(db);
12
13
  const labelers = ctx.reqLabelers(req);
13
- const report = await getReportById(db, params.id);
14
- if (!report) {
14
+ const [report, access] = await Promise.all([
15
+ getReportById(db, params.id),
16
+ QueueAccess.forActor(db, auth.credentials),
17
+ ]);
18
+ if (!report || !access.canAccessQueue(report.queueId ?? -1)) {
15
19
  throw new InvalidRequestError(`Report not found: ${params.id}`, 'NotFound');
16
20
  }
17
21
  const queueService = ctx.queueService(db);
@@ -1 +1 @@
1
- {"version":3,"file":"getReport.js","sourceRoot":"","sources":["../../../src/api/report/getReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAe,MAAM,sBAAsB,CAAA;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE;QACvC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;YACvC,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAA;YACjB,MAAM,U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AO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,eAAe,CACnB,MAAM,EACN,QAAQ,EACR,IAAI,CAAC,WAAW,CAAC,WAAW,EAC5B,OAAO,CACR;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { InvalidRequestError, type Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\nimport { getReportById } from '../../mod-service/report.js'\nimport { buildReportView, hydrateReportInfo } from '../../report/views.js'\nimport { getPdsAccountInfos } from '../util.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.report.getReport, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ params, auth, req }) => {\n const db = ctx.db\n const modService = ctx.modService(db)\n const labelers = ctx.reqLabelers(req)\n\n const report = await getReportById(db, params.id)\n if (!report) {\n throw new InvalidRequestError(\n `Report not found: ${params.id}`,\n 'NotFound',\n )\n }\n\n const queueService = ctx.queueService(db)\n const teamService = ctx.teamService(db)\n const [hydrated, actionEvents] = await Promise.all([\n hydrateReportInfo(\n [report],\n modService.views,\n (dids) => getPdsAccountInfos(ctx, dids),\n (queueIds) => queueService.getViewsByIds(queueIds),\n (dids) => teamService.viewByDids(dids),\n labelers,\n ),\n Array.isArray(report.actionEventIds) && report.actionEventIds.length\n ? modService.getEventsByIds(report.actionEventIds as number[])\n : Promise.resolve([]),\n ])\n\n const actions = actionEvents.map((evt) =>\n modService.views.formatEvent(evt),\n )\n\n return {\n encoding: 'application/json',\n body: buildReportView(\n report,\n hydrated,\n auth.credentials.isModerator,\n actions,\n ),\n }\n },\n })\n}\n"]}
1
+ {"version":3,"file":"getReport.js","sourceRoot":"","sources":["../../../src/api/report/getReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAe,MAAM,sBAAsB,CAAA;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,O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M,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACjD,iBAAiB,CACf,CAAC,MAAM,CAAC,EACR,UAAU,CAAC,KAAK,EAChB,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,EACvC,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,QAAQ,CAAC,EAClD,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EACtC,QAAQ,CACT;gBACD,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM;oBAClE,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,cAA0B,CAAC;oBAC9D,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;aACxB,CAAC,CAAA;YAEF,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACvC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAClC,CAAA;YAED,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,eAAe,CACnB,MAAM,EACN,QAAQ,EACR,IAAI,CAAC,WAAW,CAAC,WAAW,EAC5B,OAAO,CACR;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { InvalidRequestError, type Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\nimport { getReportById } from '../../mod-service/report.js'\nimport { QueueAccess } from '../../queue/access.js'\nimport { buildReportView, hydrateReportInfo } from '../../report/views.js'\nimport { getPdsAccountInfos } from '../util.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.report.getReport, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ params, auth, req }) => {\n const db = ctx.db\n const modService = ctx.modService(db)\n const labelers = ctx.reqLabelers(req)\n\n const [report, access] = await Promise.all([\n getReportById(db, params.id),\n QueueAccess.forActor(db, auth.credentials),\n ])\n if (!report || !access.canAccessQueue(report.queueId ?? -1)) {\n throw new InvalidRequestError(\n `Report not found: ${params.id}`,\n 'NotFound',\n )\n }\n\n const queueService = ctx.queueService(db)\n const teamService = ctx.teamService(db)\n const [hydrated, actionEvents] = await Promise.all([\n hydrateReportInfo(\n [report],\n modService.views,\n (dids) => getPdsAccountInfos(ctx, dids),\n (queueIds) => queueService.getViewsByIds(queueIds),\n (dids) => teamService.viewByDids(dids),\n labelers,\n ),\n Array.isArray(report.actionEventIds) && report.actionEventIds.length\n ? modService.getEventsByIds(report.actionEventIds as number[])\n : Promise.resolve([]),\n ])\n\n const actions = actionEvents.map((evt) =>\n modService.views.formatEvent(evt),\n )\n\n return {\n encoding: 'application/json',\n body: buildReportView(\n report,\n hydrated,\n auth.credentials.isModerator,\n actions,\n ),\n }\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"queryReports.d.ts","sourceRoot":"","sources":["../../../src/api/report/queryReports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAMlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAqCvD"}
1
+ {"version":3,"file":"queryReports.d.ts","sourceRoot":"","sources":["../../../src/api/report/queryReports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAOlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAyCvD"}
@@ -1,5 +1,6 @@
1
1
  import { tools } from '../../lexicons/index.js';
2
2
  import { queryReports } from '../../mod-service/report.js';
3
+ import { QueueAccess } from '../../queue/access.js';
3
4
  import { buildReportView, hydrateReportInfo } from '../../report/views.js';
4
5
  import { getPdsAccountInfos } from '../util.js';
5
6
  export default function (server, ctx) {
@@ -7,6 +8,10 @@ export default function (server, ctx) {
7
8
  auth: ctx.authVerifier.modOrAdminToken,
8
9
  handler: async ({ params, auth, req }) => {
9
10
  const db = ctx.db;
11
+ if (params.queueId != null && params.queueId !== -1) {
12
+ const access = await QueueAccess.forActor(db, auth.credentials);
13
+ access.assertQueue(params.queueId);
14
+ }
10
15
  const modService = ctx.modService(db);
11
16
  const labelers = ctx.reqLabelers(req);
12
17
  const { reports: reportsToReturn, cursor } = await queryReports(db, params);
@@ -1 +1 @@
1
- {"version":3,"file":"queryReports.js","sourceRoot":"","sources":["../../../src/api/report/queryReports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE;QAC1C,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;YACvC,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAA;YACjB,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;YACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;YAErC,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAC7D,EAAE,EACF,MAAM,CACP,CAAA;YAED,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;YACzC,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;YACvC,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CACtC,eAAe,EACf,UAAU,CAAC,KAAK,EAChB,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,EACvC,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,QAAQ,CAAC,EAClD,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EACtC,QAAQ,CACT,CAAA;YAED,MAAM,WAAW,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACjD,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAChE,CAAA;YAED,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,MAAM;oBACN,OAAO,EAAE,WAAW;iBACrB;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import type { Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\nimport { queryReports } from '../../mod-service/report.js'\nimport { buildReportView, hydrateReportInfo } from '../../report/views.js'\nimport { getPdsAccountInfos } from '../util.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.report.queryReports, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ params, auth, req }) => {\n const db = ctx.db\n const modService = ctx.modService(db)\n const labelers = ctx.reqLabelers(req)\n\n const { reports: reportsToReturn, cursor } = await queryReports(\n db,\n params,\n )\n\n const queueService = ctx.queueService(db)\n const teamService = ctx.teamService(db)\n const hydrated = await hydrateReportInfo(\n reportsToReturn,\n modService.views,\n (dids) => getPdsAccountInfos(ctx, dids),\n (queueIds) => queueService.getViewsByIds(queueIds),\n (dids) => teamService.viewByDids(dids),\n labelers,\n )\n\n const reportViews = reportsToReturn.map((report) =>\n buildReportView(report, hydrated, auth.credentials.isModerator),\n )\n\n return {\n encoding: 'application/json',\n body: {\n cursor,\n reports: reportViews,\n },\n }\n },\n })\n}\n"]}
1
+ {"version":3,"file":"queryReports.js","sourceRoot":"","sources":["../../../src/api/report/queryReports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE;QAC1C,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;YACvC,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAA;YACjB,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC;gBACpD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;gBAC/D,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YACpC,CAAC;YACD,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;YACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;YAErC,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAC7D,EAAE,EACF,MAAM,CACP,CAAA;YAED,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;YACzC,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;YACvC,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CACtC,eAAe,EACf,UAAU,CAAC,KAAK,EAChB,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,EACvC,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,QAAQ,CAAC,EAClD,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EACtC,QAAQ,CACT,CAAA;YAED,MAAM,WAAW,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACjD,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAChE,CAAA;YAED,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,MAAM;oBACN,OAAO,EAAE,WAAW;iBACrB;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import type { Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\nimport { queryReports } from '../../mod-service/report.js'\nimport { QueueAccess } from '../../queue/access.js'\nimport { buildReportView, hydrateReportInfo } from '../../report/views.js'\nimport { getPdsAccountInfos } from '../util.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.report.queryReports, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ params, auth, req }) => {\n const db = ctx.db\n if (params.queueId != null && params.queueId !== -1) {\n const access = await QueueAccess.forActor(db, auth.credentials)\n access.assertQueue(params.queueId)\n }\n const modService = ctx.modService(db)\n const labelers = ctx.reqLabelers(req)\n\n const { reports: reportsToReturn, cursor } = await queryReports(\n db,\n params,\n )\n\n const queueService = ctx.queueService(db)\n const teamService = ctx.teamService(db)\n const hydrated = await hydrateReportInfo(\n reportsToReturn,\n modService.views,\n (dids) => getPdsAccountInfos(ctx, dids),\n (queueIds) => queueService.getViewsByIds(queueIds),\n (dids) => teamService.viewByDids(dids),\n labelers,\n )\n\n const reportViews = reportsToReturn.map((report) =>\n buildReportView(report, hydrated, auth.credentials.isModerator),\n )\n\n return {\n encoding: 'application/json',\n body: {\n cursor,\n reports: reportViews,\n },\n }\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"queryRules.d.ts","sourceRoot":"","sources":["../../../src/api/safelink/queryRules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAQlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAkDvD"}
1
+ {"version":3,"file":"queryRules.d.ts","sourceRoot":"","sources":["../../../src/api/safelink/queryRules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAQlD,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAoDvD"}
@@ -6,7 +6,7 @@ export default function (server, ctx) {
6
6
  auth: ctx.authVerifier.modOrAdminToken,
7
7
  handler: async ({ input }) => {
8
8
  const db = ctx.db;
9
- const { cursor, limit, urls, patternType, actions, reason, createdBy, sortDirection, } = input.body;
9
+ const { cursor, limit, urls, patternType, actions, reason, source, createdBy, sortDirection, } = input.body;
10
10
  const safelinkRuleService = ctx.safelinkRuleService(db);
11
11
  const result = await safelinkRuleService.getActiveRules({
12
12
  cursor,
@@ -17,6 +17,7 @@ export default function (server, ctx) {
17
17
  ? actions.map(getSafelinkAction)
18
18
  : undefined,
19
19
  reason: reason ? getSafelinkReason(reason) : undefined,
20
+ source,
20
21
  createdBy,
21
22
  direction: sortDirection,
22
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"queryRules.js","sourceRoot":"","sources":["../../../src/api/safelink/queryRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAG/C,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAA;AAEnB,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE;QAC1C,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;YAC3B,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,CAAA;YACjB,MAAM,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,aAAa,GACd,GAAG,KAAK,CAAC,IAAI,CAAA;YAEd,MAAM,mBAAmB,GAAG,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAA;YACvD,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,cAAc,CAAC;gBACtD,MAAM;gBACN,KAAK;gBACL,IAAI;gBACJ,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;gBACtE,OAAO,EACL,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;oBAC3B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;oBAChC,CAAC,CAAC,SAAS;gBACf,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;gBACtD,SAAS;gBACT,SAAS,EAAE,aAA2C;aACvD,CAAC,CAAA;YAEF,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBACjC,GAAG,EAAE,IAAI,CAAC,GAAG;wBACb,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,MAAM,EAAE,IAAI,CAAC,MAAM;wBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;wBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;wBACnB,SAAS,EAAE,IAAI,CAAC,SAAS;wBACzB,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC;wBAC3C,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC;wBAC3C,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,SAAS;qBACnC,CAAC,CAAC;iBACJ;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { toDatetimeString } from '@atproto/lex'\nimport type { Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\nimport {\n getSafelinkAction,\n getSafelinkPattern,\n getSafelinkReason,\n} from '../util.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.safelink.queryRules, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input }) => {\n const db = ctx.db\n const {\n cursor,\n limit,\n urls,\n patternType,\n actions,\n reason,\n createdBy,\n sortDirection,\n } = input.body\n\n const safelinkRuleService = ctx.safelinkRuleService(db)\n const result = await safelinkRuleService.getActiveRules({\n cursor,\n limit,\n urls,\n patternType: patternType ? getSafelinkPattern(patternType) : undefined,\n actions:\n actions && actions.length > 0\n ? actions.map(getSafelinkAction)\n : undefined,\n reason: reason ? getSafelinkReason(reason) : undefined,\n createdBy,\n direction: sortDirection as 'asc' | 'desc' | undefined,\n })\n\n return {\n encoding: 'application/json',\n body: {\n cursor: result.cursor,\n rules: result.rules.map((rule) => ({\n url: rule.url,\n pattern: rule.pattern,\n action: rule.action,\n reason: rule.reason,\n source: rule.source,\n createdBy: rule.createdBy,\n createdAt: toDatetimeString(rule.createdAt),\n updatedAt: toDatetimeString(rule.updatedAt),\n comment: rule.comment || undefined,\n })),\n },\n }\n },\n })\n}\n"]}
1
+ {"version":3,"file":"queryRules.js","sourceRoot":"","sources":["../../../src/api/safelink/queryRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAG/C,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAA;AAEnB,MAAM,CAAC,OAAO,WAAW,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE;QAC1C,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,eAAe;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;YAC3B,MAAM,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AAE,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC;wBAC3C,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,SAAS;qBACnC,CAAC,CAAC;iBACJ;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { toDatetimeString } from '@atproto/lex'\nimport type { Server } from '@atproto/xrpc-server'\nimport type { AppContext } from '../../context.js'\nimport { tools } from '../../lexicons/index.js'\nimport {\n getSafelinkAction,\n getSafelinkPattern,\n getSafelinkReason,\n} from '../util.js'\n\nexport default function (server: Server, ctx: AppContext) {\n server.add(tools.ozone.safelink.queryRules, {\n auth: ctx.authVerifier.modOrAdminToken,\n handler: async ({ input }) => {\n const db = ctx.db\n const {\n cursor,\n limit,\n urls,\n patternType,\n actions,\n reason,\n source,\n createdBy,\n sortDirection,\n } = input.body\n\n const safelinkRuleService = ctx.safelinkRuleService(db)\n const result = await safelinkRuleService.getActiveRules({\n cursor,\n limit,\n urls,\n patternType: patternType ? getSafelinkPattern(patternType) : undefined,\n actions:\n actions && actions.length > 0\n ? actions.map(getSafelinkAction)\n : undefined,\n reason: reason ? getSafelinkReason(reason) : undefined,\n source,\n createdBy,\n direction: sortDirection as 'asc' | 'desc' | undefined,\n })\n\n return {\n encoding: 'application/json',\n body: {\n cursor: result.cursor,\n rules: result.rules.map((rule) => ({\n url: rule.url,\n pattern: rule.pattern,\n action: rule.action,\n reason: rule.reason,\n source: rule.source,\n createdBy: rule.createdBy,\n createdAt: toDatetimeString(rule.createdAt),\n updatedAt: toDatetimeString(rule.updatedAt),\n comment: rule.comment || undefined,\n })),\n },\n }\n },\n })\n}\n"]}
@@ -4,6 +4,7 @@ import type { Database } from '../db/index.js';
4
4
  import type { ModeratorAssignment } from '../db/schema/moderator_assignment.js';
5
5
  import type { ReportQueue } from '../db/schema/report_queue.js';
6
6
  import type { tools } from '../lexicons/index.js';
7
+ import type { QueueAccessCredentials } from '../queue/access.js';
7
8
  import type { QueueService, QueueServiceCreator } from '../queue/service.js';
8
9
  import type { TeamService, TeamServiceCreator } from '../team/index.js';
9
10
  export interface AssignmentServiceOpts {
@@ -57,6 +58,7 @@ type AssignmentRowWithQueue = Selectable<ModeratorAssignment> & {
57
58
  queueCreatedBy: DidString | 'admin_token' | null;
58
59
  queueCreatedAt: DatetimeString | null;
59
60
  queueUpdatedAt: DatetimeString | null;
61
+ queueStrictAccess: boolean | null;
60
62
  queueEnabled: boolean | null;
61
63
  queueDeletedAt: string | null;
62
64
  };
@@ -77,7 +79,7 @@ export declare class AssignmentService {
77
79
  assignments: tools.ozone.report.defs.AssignmentView[];
78
80
  cursor?: string;
79
81
  }>;
80
- assignQueue(input: AssignQueueInput): Promise<tools.ozone.queue.defs.AssignmentView>;
82
+ assignQueue(input: AssignQueueInput, credentials?: QueueAccessCredentials): Promise<tools.ozone.queue.defs.AssignmentView>;
81
83
  unassignQueue(input: UnassignQueueInput): Promise<void>;
82
84
  assignReport(input: AssignReportInput): Promise<tools.ozone.report.defs.AssignmentView>;
83
85
  unassignReport(input: UnassignReportInput): Promise<tools.ozone.report.defs.AssignmentView>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assignment/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAM5E,OAAO,KAAK,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