@atproto/dev-env 0.7.11 → 0.7.14
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
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @atproto/dev-env
|
|
2
2
|
|
|
3
|
+
## 0.7.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`8ed6d3d`](https://github.com/bluesky-social/atproto/commit/8ed6d3d48b0a02a665a5931866d1259cc31c5bfd), [`8d84a6c`](https://github.com/bluesky-social/atproto/commit/8d84a6cea64c5d0aa064f291b09c3eea2eb61b65), [`3f7eb87`](https://github.com/bluesky-social/atproto/commit/3f7eb87d02831bffc2f8a67907ce739aeaa300f0), [`e1c4481`](https://github.com/bluesky-social/atproto/commit/e1c448148c7ecf21aff45edc8c922630049b9b14), [`b575ca1`](https://github.com/bluesky-social/atproto/commit/b575ca131e66ae2f71efcd9d1cabe03e392c218f), [`137591c`](https://github.com/bluesky-social/atproto/commit/137591c05548c263fad91062376ecdb320c11ff3), [`b5dfe0b`](https://github.com/bluesky-social/atproto/commit/b5dfe0b80ac4f14f56b3c9b797e0e50d2e194a3b), [`7efa83f`](https://github.com/bluesky-social/atproto/commit/7efa83ff50c31069b730443978e8a7edc4f1da62), [`ce21dda`](https://github.com/bluesky-social/atproto/commit/ce21dda25d4ab002bccbcb7b0ea16629ea2ea88b), [`b5dfe0b`](https://github.com/bluesky-social/atproto/commit/b5dfe0b80ac4f14f56b3c9b797e0e50d2e194a3b)]:
|
|
8
|
+
- @atproto/bsync@0.1.10
|
|
9
|
+
- @atproto/pds@0.5.61
|
|
10
|
+
- @atproto/bsky@0.5.13
|
|
11
|
+
- @atproto/api@0.32.2
|
|
12
|
+
- @atproto/ozone@0.15.2
|
|
13
|
+
- @atproto/lex-client@0.5.0
|
|
14
|
+
- @atproto/xrpc-server@0.13.13
|
|
15
|
+
- @atproto/sync@0.4.27
|
|
16
|
+
|
|
17
|
+
## 0.7.13
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#4722](https://github.com/bluesky-social/atproto/pull/4722) [`b9f1f1d`](https://github.com/bluesky-social/atproto/commit/b9f1f1d2b169cc509e192350496049cf93d6115d) Thanks [@gcwill70](https://github.com/gcwill70)! - Add bounded bulk moderation actions with per-subject report targeting, external IDs, and partial-failure results.
|
|
22
|
+
- Updated dependencies [[`9f605e0`](https://github.com/bluesky-social/atproto/commit/9f605e0fb117173dea8b5c1e9d6ad13bd6995c7f), [`56201be`](https://github.com/bluesky-social/atproto/commit/56201be4acdcb4333f2da430ce62f6e9a42aa79d), [`7dd086d`](https://github.com/bluesky-social/atproto/commit/7dd086d4de20d22777a64043ee29f4afa9a5811b), [`d330b0c`](https://github.com/bluesky-social/atproto/commit/d330b0ca6ff6ecdaaef4ef6ab56caf750d0c4b74), [`1e5118f`](https://github.com/bluesky-social/atproto/commit/1e5118f626ed91f65df248b7c2c9bb1bf37a9407), [`b9f1f1d`](https://github.com/bluesky-social/atproto/commit/b9f1f1d2b169cc509e192350496049cf93d6115d), [`918a000`](https://github.com/bluesky-social/atproto/commit/918a0002850b65e370f32779e17682531fda9c29), [`50877cc`](https://github.com/bluesky-social/atproto/commit/50877ccd37254ad8170c6cdcdd38014b377203d5)]:
|
|
23
|
+
- @atproto/bsky@0.5.12
|
|
24
|
+
- @atproto/pds@0.5.60
|
|
25
|
+
- @atproto/ozone@0.15.1
|
|
26
|
+
- @atproto/api@0.32.1
|
|
27
|
+
|
|
28
|
+
## 0.7.12
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`156b4a4`](https://github.com/bluesky-social/atproto/commit/156b4a4ed722d02f0f30f8ab9a00aa366c74782c)]:
|
|
33
|
+
- @atproto/bsky@0.5.11
|
|
34
|
+
|
|
3
35
|
## 0.7.11
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type $Typed, type AtpAgent, type ChatBskyConvoDefs, type ComAtprotoAdminDefs, type ComAtprotoRepoStrongRef, type ToolsOzoneModerationDefs, type ToolsOzoneModerationEmitEvent as EmitModerationEvent, ToolsOzoneModerationGetReporterStats as _GetReporterStats, // includes types for getReporterStats()
|
|
1
|
+
import { type $Typed, type AtpAgent, type ChatBskyConvoDefs, type ComAtprotoAdminDefs, type ComAtprotoRepoStrongRef, type ToolsOzoneModerationDefs, type ToolsOzoneModerationEmitEvent as EmitModerationEvent, type ToolsOzoneModerationEmitEvents as EmitModerationEvents, ToolsOzoneModerationGetReporterStats as _GetReporterStats, // includes types for getReporterStats()
|
|
2
2
|
type ToolsOzoneModerationQueryEvents as QueryModerationEvents, type ToolsOzoneModerationQueryStatuses as QueryModerationStatuses, type ToolsOzoneReportQueryReports as QueryModerationReports, type ToolsOzoneSettingRemoveOptions, type ToolsOzoneSettingUpsertOption } from '@atproto/api';
|
|
3
3
|
import type { TestOzone } from './ozone.js';
|
|
4
4
|
type TakeActionInput = EmitModerationEvent.InputSchema;
|
|
@@ -28,6 +28,9 @@ export declare class ModeratorClient {
|
|
|
28
28
|
externalId?: string;
|
|
29
29
|
reportAction?: TakeActionInput['reportAction'];
|
|
30
30
|
}, role?: ModLevel): Promise<ToolsOzoneModerationDefs.ModEventView>;
|
|
31
|
+
emitEvents(input: Omit<EmitModerationEvents.InputSchema, 'createdBy'> & {
|
|
32
|
+
createdBy?: string;
|
|
33
|
+
}, role?: ModLevel): Promise<EmitModerationEvents.OutputSchema>;
|
|
31
34
|
reverseAction(opts: {
|
|
32
35
|
id: number;
|
|
33
36
|
subject: TakeActionInput['subject'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderator-client.d.ts","sourceRoot":"","sources":["../src/moderator-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,K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M,CAAC,EAAE,MAAM,CAAA;KAChB,EACD,IAAI,CAAC,EAAE,QAAQ,kDAWhB;IAEK,mBAAmB,CACvB,OAAO,EAAE,6BAA6B,CAAC,WAAW,EAClD,UAAU,GAAE,OAAO,GAAG,WAAW,GAAG,QAAkB,uDAcvD;IAEK,oBAAoB,CACxB,MAAM,EAAE,8BAA8B,CAAC,WAAW,EAClD,UAAU,GAAE,OAAO,GAAG,WAAW,GAAG,QAAkB,wDAcvD;IAEK,YAAY,kBAIjB;CACF"}
|
package/dist/moderator-client.js
CHANGED
|
@@ -51,6 +51,13 @@ export class ModeratorClient {
|
|
|
51
51
|
});
|
|
52
52
|
return result.data;
|
|
53
53
|
}
|
|
54
|
+
async emitEvents(input, role) {
|
|
55
|
+
const result = await this.agent.tools.ozone.moderation.emitEvents({ ...input, createdBy: input.createdBy ?? 'did:example:admin' }, {
|
|
56
|
+
encoding: 'application/json',
|
|
57
|
+
headers: await this.ozone.modHeaders('tools.ozone.moderation.emitEvents', role),
|
|
58
|
+
});
|
|
59
|
+
return result.data;
|
|
60
|
+
}
|
|
54
61
|
async reverseAction(opts, role) {
|
|
55
62
|
const { subject, reason = 'X', createdBy = 'did:example:admin', modTool, } = opts;
|
|
56
63
|
const result = await this.agent.tools.ozone.moderation.emitEvent({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderator-client.js","sourceRoot":"","sources":["../src/moderator-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,oCAAoC,IAAI,iBAAiB,EAAE,wCAAwC;EAMpG,MAAM,cAAc,CAAA;AASrB,MAAM,OAAO,eAAe;IAE1B,YAAmB,KAAgB;qBAAhB,KAAK;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,IAAe;QACxC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK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,CACX;SACF,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAA;QAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;QAC1D,MAAM,YAAY,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;CACF","sourcesContent":["import {\n type $Typed,\n type AtpAgent,\n type ChatBskyConvoDefs,\n type ComAtprotoAdminDefs,\n type ComAtprotoRepoStrongRef,\n type ToolsOzoneModerationDefs,\n type ToolsOzoneModerationEmitEvent as EmitModerationEvent,\n ToolsOzoneModerationGetReporterStats as _GetReporterStats, // includes types for getReporterStats()\n type ToolsOzoneModerationQueryEvents as QueryModerationEvents,\n type ToolsOzoneModerationQueryStatuses as QueryModerationStatuses,\n type ToolsOzoneReportQueryReports as QueryModerationReports,\n type ToolsOzoneSettingRemoveOptions,\n type ToolsOzoneSettingUpsertOption,\n} from '@atproto/api'\nimport type { TestOzone } from './ozone.js'\n\ntype TakeActionInput = EmitModerationEvent.InputSchema\ntype QueryStatusesParams = QueryModerationStatuses.QueryParams\ntype QueryEventsParams = QueryModerationEvents.QueryParams\ntype QueryReportsParams = QueryModerationReports.QueryParams\ntype ModLevel = 'admin' | 'moderator' | 'triage'\n\nexport class ModeratorClient {\n agent: AtpAgent\n constructor(public ozone: TestOzone) {\n this.agent = ozone.getAgent()\n }\n\n async getEvent(id: number, role?: ModLevel) {\n const result = await this.agent.tools.ozone.moderation.getEvent(\n { id },\n {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.getEvent',\n role,\n ),\n },\n )\n return result.data\n }\n\n async queryStatuses(input: QueryStatusesParams, role?: ModLevel) {\n const result = await this.agent.tools.ozone.moderation.queryStatuses(\n input,\n {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.queryStatuses',\n role,\n ),\n },\n )\n return result.data\n }\n\n async getReporterStats(dids: string[]) {\n const result = await this.agent.tools.ozone.moderation.getReporterStats(\n { dids },\n {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.getReporterStats',\n 'admin',\n ),\n },\n )\n return result.data\n }\n\n async queryEvents(input: QueryEventsParams, role?: ModLevel) {\n const result = await this.agent.tools.ozone.moderation.queryEvents(input, {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.queryEvents',\n role,\n ),\n })\n return result.data\n }\n\n async queryReports(input: QueryReportsParams, role?: ModLevel) {\n const result = await this.agent.tools.ozone.report.queryReports(input, {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.report.queryReports',\n role,\n ),\n })\n return result.data\n }\n\n async emitEvent(\n opts: {\n event: TakeActionInput['event']\n subject:\n | $Typed<ComAtprotoAdminDefs.RepoRef>\n | $Typed<ComAtprotoRepoStrongRef.Main>\n | $Typed<ChatBskyConvoDefs.MessageRef>\n | $Typed<ChatBskyConvoDefs.ConvoRef>\n | { $type: string }\n subjectBlobCids?: TakeActionInput['subjectBlobCids']\n reason?: string\n createdBy?: string\n meta?: unknown\n modTool?: ToolsOzoneModerationDefs.ModTool\n externalId?: string\n reportAction?: TakeActionInput['reportAction']\n },\n role?: ModLevel,\n ) {\n const {\n event,\n subject,\n subjectBlobCids,\n createdBy = 'did:example:admin',\n modTool,\n externalId,\n reportAction,\n } = opts\n const result = await this.agent.tools.ozone.moderation.emitEvent(\n {\n event,\n subject,\n subjectBlobCids,\n createdBy,\n modTool,\n externalId,\n reportAction,\n },\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.emitEvent',\n role,\n ),\n },\n )\n return result.data\n }\n\n async reverseAction(\n opts: {\n id: number\n subject: TakeActionInput['subject']\n reason?: string\n createdBy?: string\n modTool?: ToolsOzoneModerationDefs.ModTool\n },\n role?: ModLevel,\n ) {\n const {\n subject,\n reason = 'X',\n createdBy = 'did:example:admin',\n modTool,\n } = opts\n const result = await this.agent.tools.ozone.moderation.emitEvent(\n {\n subject,\n event: {\n $type: 'tools.ozone.moderation.defs#modEventReverseTakedown',\n comment: reason,\n },\n createdBy,\n modTool,\n },\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.emitEvent',\n role,\n ),\n },\n )\n return result.data\n }\n\n async performTakedown(\n opts: {\n subject:\n | $Typed<ComAtprotoAdminDefs.RepoRef>\n | $Typed<ComAtprotoRepoStrongRef.Main>\n | $Typed<ChatBskyConvoDefs.MessageRef>\n | $Typed<ChatBskyConvoDefs.ConvoRef>\n | { $type: string }\n subjectBlobCids?: TakeActionInput['subjectBlobCids']\n durationInHours?: number\n acknowledgeAccountSubjects?: boolean\n reason?: string\n policies?: string[]\n },\n role?: ModLevel,\n ) {\n const { durationInHours, acknowledgeAccountSubjects, policies, ...rest } =\n opts\n return this.emitEvent(\n {\n event: {\n $type: 'tools.ozone.moderation.defs#modEventTakedown',\n acknowledgeAccountSubjects,\n durationInHours,\n policies,\n },\n ...rest,\n },\n role,\n )\n }\n\n async performReverseTakedown(\n opts: {\n subject: TakeActionInput['subject']\n subjectBlobCids?: TakeActionInput['subjectBlobCids']\n reason?: string\n },\n role?: ModLevel,\n ) {\n return this.emitEvent(\n {\n event: {\n $type: 'tools.ozone.moderation.defs#modEventReverseTakedown',\n },\n ...opts,\n },\n role,\n )\n }\n\n async upsertSettingOption(\n setting: ToolsOzoneSettingUpsertOption.InputSchema,\n callerRole: 'admin' | 'moderator' | 'triage' = 'admin',\n ) {\n const { data } = await this.agent.tools.ozone.setting.upsertOption(\n setting,\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.setting.upsertOption',\n callerRole,\n ),\n },\n )\n\n return data\n }\n\n async removeSettingOptions(\n params: ToolsOzoneSettingRemoveOptions.InputSchema,\n callerRole: 'admin' | 'moderator' | 'triage' = 'admin',\n ) {\n const { data } = await this.agent.tools.ozone.setting.removeOptions(\n params,\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.setting.removeOptions',\n callerRole,\n ),\n },\n )\n\n return data\n }\n\n async computeStats() {\n const db = this.ozone.ctx.db\n const statsService = this.ozone.ctx.reportStatsService(db)\n await statsService.materializeAll({ force: true })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"moderator-client.js","sourceRoot":"","sources":["../src/moderator-client.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,oCAAoC,IAAI,iBAAiB,EAAE,wCAAwC;EAMpG,MAAM,cAAc,CAAA;AASrB,MAAM,OAAO,eAAe;IAE1B,YAAmB,KAAgB;qBAAhB,KAAK;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,IAAe;QACxC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAC7D,EAAE,EAAE,EAAE,EACN;YACE,OAAO,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAClC,iCAAiC,EACjC,IAAI,CACL;SACF,CACF,CAAA;QACD,OAAO,MAAM,CAAC,IAAI,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,KAA0B,EAAE,IAAe;QAC7D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAClE,KAAK,EACL;YACE,OAAO,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAClC,sCAAsC,EACtC,IAAI,CACL;SACF,CACF,CAAA;QACD,OAAO,MAAM,CAAC,IAAI,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,IAAc;QACnC,MAAM,MAAM,GAAG,MAAM,IA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AAI,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;QAC1D,MAAM,YAAY,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;CACF","sourcesContent":["import {\n type $Typed,\n type AtpAgent,\n type ChatBskyConvoDefs,\n type ComAtprotoAdminDefs,\n type ComAtprotoRepoStrongRef,\n type ToolsOzoneModerationDefs,\n type ToolsOzoneModerationEmitEvent as EmitModerationEvent,\n type ToolsOzoneModerationEmitEvents as EmitModerationEvents,\n ToolsOzoneModerationGetReporterStats as _GetReporterStats, // includes types for getReporterStats()\n type ToolsOzoneModerationQueryEvents as QueryModerationEvents,\n type ToolsOzoneModerationQueryStatuses as QueryModerationStatuses,\n type ToolsOzoneReportQueryReports as QueryModerationReports,\n type ToolsOzoneSettingRemoveOptions,\n type ToolsOzoneSettingUpsertOption,\n} from '@atproto/api'\nimport type { TestOzone } from './ozone.js'\n\ntype TakeActionInput = EmitModerationEvent.InputSchema\ntype QueryStatusesParams = QueryModerationStatuses.QueryParams\ntype QueryEventsParams = QueryModerationEvents.QueryParams\ntype QueryReportsParams = QueryModerationReports.QueryParams\ntype ModLevel = 'admin' | 'moderator' | 'triage'\n\nexport class ModeratorClient {\n agent: AtpAgent\n constructor(public ozone: TestOzone) {\n this.agent = ozone.getAgent()\n }\n\n async getEvent(id: number, role?: ModLevel) {\n const result = await this.agent.tools.ozone.moderation.getEvent(\n { id },\n {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.getEvent',\n role,\n ),\n },\n )\n return result.data\n }\n\n async queryStatuses(input: QueryStatusesParams, role?: ModLevel) {\n const result = await this.agent.tools.ozone.moderation.queryStatuses(\n input,\n {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.queryStatuses',\n role,\n ),\n },\n )\n return result.data\n }\n\n async getReporterStats(dids: string[]) {\n const result = await this.agent.tools.ozone.moderation.getReporterStats(\n { dids },\n {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.getReporterStats',\n 'admin',\n ),\n },\n )\n return result.data\n }\n\n async queryEvents(input: QueryEventsParams, role?: ModLevel) {\n const result = await this.agent.tools.ozone.moderation.queryEvents(input, {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.queryEvents',\n role,\n ),\n })\n return result.data\n }\n\n async queryReports(input: QueryReportsParams, role?: ModLevel) {\n const result = await this.agent.tools.ozone.report.queryReports(input, {\n headers: await this.ozone.modHeaders(\n 'tools.ozone.report.queryReports',\n role,\n ),\n })\n return result.data\n }\n\n async emitEvent(\n opts: {\n event: TakeActionInput['event']\n subject:\n | $Typed<ComAtprotoAdminDefs.RepoRef>\n | $Typed<ComAtprotoRepoStrongRef.Main>\n | $Typed<ChatBskyConvoDefs.MessageRef>\n | $Typed<ChatBskyConvoDefs.ConvoRef>\n | { $type: string }\n subjectBlobCids?: TakeActionInput['subjectBlobCids']\n reason?: string\n createdBy?: string\n meta?: unknown\n modTool?: ToolsOzoneModerationDefs.ModTool\n externalId?: string\n reportAction?: TakeActionInput['reportAction']\n },\n role?: ModLevel,\n ) {\n const {\n event,\n subject,\n subjectBlobCids,\n createdBy = 'did:example:admin',\n modTool,\n externalId,\n reportAction,\n } = opts\n const result = await this.agent.tools.ozone.moderation.emitEvent(\n {\n event,\n subject,\n subjectBlobCids,\n createdBy,\n modTool,\n externalId,\n reportAction,\n },\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.emitEvent',\n role,\n ),\n },\n )\n return result.data\n }\n\n async emitEvents(\n input: Omit<EmitModerationEvents.InputSchema, 'createdBy'> & {\n createdBy?: string\n },\n role?: ModLevel,\n ) {\n const result = await this.agent.tools.ozone.moderation.emitEvents(\n { ...input, createdBy: input.createdBy ?? 'did:example:admin' },\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.emitEvents',\n role,\n ),\n },\n )\n return result.data\n }\n\n async reverseAction(\n opts: {\n id: number\n subject: TakeActionInput['subject']\n reason?: string\n createdBy?: string\n modTool?: ToolsOzoneModerationDefs.ModTool\n },\n role?: ModLevel,\n ) {\n const {\n subject,\n reason = 'X',\n createdBy = 'did:example:admin',\n modTool,\n } = opts\n const result = await this.agent.tools.ozone.moderation.emitEvent(\n {\n subject,\n event: {\n $type: 'tools.ozone.moderation.defs#modEventReverseTakedown',\n comment: reason,\n },\n createdBy,\n modTool,\n },\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.moderation.emitEvent',\n role,\n ),\n },\n )\n return result.data\n }\n\n async performTakedown(\n opts: {\n subject:\n | $Typed<ComAtprotoAdminDefs.RepoRef>\n | $Typed<ComAtprotoRepoStrongRef.Main>\n | $Typed<ChatBskyConvoDefs.MessageRef>\n | $Typed<ChatBskyConvoDefs.ConvoRef>\n | { $type: string }\n subjectBlobCids?: TakeActionInput['subjectBlobCids']\n durationInHours?: number\n acknowledgeAccountSubjects?: boolean\n reason?: string\n policies?: string[]\n },\n role?: ModLevel,\n ) {\n const { durationInHours, acknowledgeAccountSubjects, policies, ...rest } =\n opts\n return this.emitEvent(\n {\n event: {\n $type: 'tools.ozone.moderation.defs#modEventTakedown',\n acknowledgeAccountSubjects,\n durationInHours,\n policies,\n },\n ...rest,\n },\n role,\n )\n }\n\n async performReverseTakedown(\n opts: {\n subject: TakeActionInput['subject']\n subjectBlobCids?: TakeActionInput['subjectBlobCids']\n reason?: string\n },\n role?: ModLevel,\n ) {\n return this.emitEvent(\n {\n event: {\n $type: 'tools.ozone.moderation.defs#modEventReverseTakedown',\n },\n ...opts,\n },\n role,\n )\n }\n\n async upsertSettingOption(\n setting: ToolsOzoneSettingUpsertOption.InputSchema,\n callerRole: 'admin' | 'moderator' | 'triage' = 'admin',\n ) {\n const { data } = await this.agent.tools.ozone.setting.upsertOption(\n setting,\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.setting.upsertOption',\n callerRole,\n ),\n },\n )\n\n return data\n }\n\n async removeSettingOptions(\n params: ToolsOzoneSettingRemoveOptions.InputSchema,\n callerRole: 'admin' | 'moderator' | 'triage' = 'admin',\n ) {\n const { data } = await this.agent.tools.ozone.setting.removeOptions(\n params,\n {\n encoding: 'application/json',\n headers: await this.ozone.modHeaders(\n 'tools.ozone.setting.removeOptions',\n callerRole,\n ),\n },\n )\n\n return data\n }\n\n async computeStats() {\n const db = this.ozone.ctx.db\n const statsService = this.ozone.ctx.reportStatsService(db)\n await statsService.materializeAll({ force: true })\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/dev-env",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Local development environment helper for atproto development",
|
|
6
6
|
"keywords": [
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
"node": ">=22"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@atproto/api": "^0.32.
|
|
39
|
-
"@atproto/bsky": "^0.5.
|
|
40
|
-
"@atproto/bsync": "^0.1.
|
|
38
|
+
"@atproto/api": "^0.32.2",
|
|
39
|
+
"@atproto/bsky": "^0.5.13",
|
|
40
|
+
"@atproto/bsync": "^0.1.10",
|
|
41
41
|
"@atproto/common-web": "^0.5.17",
|
|
42
42
|
"@atproto/crypto": "^0.5.7",
|
|
43
43
|
"@atproto/identity": "^0.5.23",
|
|
44
|
-
"@atproto/lex-client": "^0.
|
|
44
|
+
"@atproto/lex-client": "^0.5.0",
|
|
45
45
|
"@atproto/lex-schema": "^0.2.11",
|
|
46
46
|
"@atproto/lexicon": "^0.7.19",
|
|
47
|
-
"@atproto/ozone": "^0.15.
|
|
48
|
-
"@atproto/pds": "^0.5.
|
|
49
|
-
"@atproto/sync": "^0.4.
|
|
47
|
+
"@atproto/ozone": "^0.15.2",
|
|
48
|
+
"@atproto/pds": "^0.5.61",
|
|
49
|
+
"@atproto/sync": "^0.4.27",
|
|
50
50
|
"@atproto/syntax": "^0.7.7",
|
|
51
|
-
"@atproto/xrpc-server": "^0.13.
|
|
51
|
+
"@atproto/xrpc-server": "^0.13.13",
|
|
52
52
|
"@did-plc/lib": "^0.0.1",
|
|
53
53
|
"@did-plc/server": "^0.0.1",
|
|
54
54
|
"express": "^4.18.2",
|
package/src/moderator-client.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type ComAtprotoRepoStrongRef,
|
|
7
7
|
type ToolsOzoneModerationDefs,
|
|
8
8
|
type ToolsOzoneModerationEmitEvent as EmitModerationEvent,
|
|
9
|
+
type ToolsOzoneModerationEmitEvents as EmitModerationEvents,
|
|
9
10
|
ToolsOzoneModerationGetReporterStats as _GetReporterStats, // includes types for getReporterStats()
|
|
10
11
|
type ToolsOzoneModerationQueryEvents as QueryModerationEvents,
|
|
11
12
|
type ToolsOzoneModerationQueryStatuses as QueryModerationStatuses,
|
|
@@ -135,6 +136,25 @@ export class ModeratorClient {
|
|
|
135
136
|
return result.data
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
async emitEvents(
|
|
140
|
+
input: Omit<EmitModerationEvents.InputSchema, 'createdBy'> & {
|
|
141
|
+
createdBy?: string
|
|
142
|
+
},
|
|
143
|
+
role?: ModLevel,
|
|
144
|
+
) {
|
|
145
|
+
const result = await this.agent.tools.ozone.moderation.emitEvents(
|
|
146
|
+
{ ...input, createdBy: input.createdBy ?? 'did:example:admin' },
|
|
147
|
+
{
|
|
148
|
+
encoding: 'application/json',
|
|
149
|
+
headers: await this.ozone.modHeaders(
|
|
150
|
+
'tools.ozone.moderation.emitEvents',
|
|
151
|
+
role,
|
|
152
|
+
),
|
|
153
|
+
},
|
|
154
|
+
)
|
|
155
|
+
return result.data
|
|
156
|
+
}
|
|
157
|
+
|
|
138
158
|
async reverseAction(
|
|
139
159
|
opts: {
|
|
140
160
|
id: number
|