@atproto/ozone 0.0.9 → 0.0.11
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 +16 -0
- package/dist/api/moderation/util.d.ts +1 -1
- package/dist/db/index.js +20 -1
- package/dist/db/index.js.map +3 -3
- package/dist/db/migrations/20240208T213404429Z-add-tags-column-to-moderation-subject.d.ts +3 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/schema/moderation_event.d.ts +3 -1
- package/dist/db/schema/moderation_subject_status.d.ts +1 -0
- package/dist/index.js +1458 -596
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +20 -6
- package/dist/lexicon/lexicons.d.ts +449 -110
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +20 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +9 -0
- package/dist/lexicon/types/com/atproto/admin/emitModerationEvent.d.ts +1 -1
- package/dist/lexicon/types/com/atproto/admin/queryModerationEvents.d.ts +2 -0
- package/dist/lexicon/types/com/atproto/admin/queryModerationStatuses.d.ts +2 -0
- package/dist/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.d.ts +33 -0
- package/dist/lexicon/types/com/atproto/identity/requestPlcOperationSignature.d.ts +19 -0
- package/dist/lexicon/types/com/atproto/{temp/transferAccount.d.ts → identity/signPlcOperation.d.ts} +6 -8
- package/dist/lexicon/types/com/atproto/identity/submitPlcOperation.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/{temp/pushBlob.d.ts → repo/importRepo.d.ts} +1 -2
- package/dist/lexicon/types/com/atproto/repo/listMissingBlobs.d.ts +41 -0
- package/dist/lexicon/types/com/atproto/server/activateAccount.d.ts +19 -0
- package/dist/lexicon/types/com/atproto/server/checkAccountStatus.d.ts +38 -0
- package/dist/lexicon/types/com/atproto/server/deactivateAccount.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/server/describeServer.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/{temp/importRepo.d.ts → server/getServiceAuth.d.ts} +8 -9
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +9 -1
- package/dist/logger.d.ts +1 -0
- package/dist/mod-service/index.d.ts +18 -4
- package/dist/mod-service/lang.d.ts +15 -0
- package/dist/mod-service/status.d.ts +1 -1
- package/dist/mod-service/types.d.ts +1 -1
- package/dist/mod-service/views.d.ts +2 -1
- package/package.json +6 -6
- package/src/api/admin/emitModerationEvent.ts +22 -10
- package/src/api/admin/queryModerationEvents.ts +4 -0
- package/src/api/admin/queryModerationStatuses.ts +4 -0
- package/src/api/moderation/createReport.ts +15 -4
- package/src/api/moderation/util.ts +1 -0
- package/src/db/migrations/20240208T213404429Z-add-tags-column-to-moderation-subject.ts +31 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/db/schema/moderation_event.ts +3 -0
- package/src/db/schema/moderation_subject_status.ts +1 -0
- package/src/lexicon/index.ts +124 -36
- package/src/lexicon/lexicons.ts +491 -138
- package/src/lexicon/types/app/bsky/actor/defs.ts +59 -0
- package/src/lexicon/types/app/bsky/feed/post.ts +1 -1
- package/src/lexicon/types/com/atproto/admin/defs.ts +24 -0
- package/src/lexicon/types/com/atproto/admin/emitModerationEvent.ts +1 -0
- package/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts +4 -0
- package/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts +2 -0
- package/src/lexicon/types/com/atproto/identity/getRecommendedDidCredentials.ts +47 -0
- package/src/lexicon/types/com/atproto/identity/requestPlcOperationSignature.ts +31 -0
- package/src/lexicon/types/com/atproto/{temp/transferAccount.ts → identity/signPlcOperation.ts} +8 -15
- package/src/lexicon/types/com/atproto/identity/submitPlcOperation.ts +38 -0
- package/src/lexicon/types/com/atproto/{temp/pushBlob.ts → repo/importRepo.ts} +2 -5
- package/src/lexicon/types/com/atproto/repo/listMissingBlobs.ts +65 -0
- package/src/lexicon/types/com/atproto/server/activateAccount.ts +31 -0
- package/src/lexicon/types/com/atproto/server/checkAccountStatus.ts +51 -0
- package/src/lexicon/types/com/atproto/server/deactivateAccount.ts +39 -0
- package/src/lexicon/types/com/atproto/server/describeServer.ts +1 -0
- package/src/lexicon/types/com/atproto/{temp/importRepo.ts → server/getServiceAuth.ts} +10 -9
- package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +24 -3
- package/src/logger.ts +2 -0
- package/src/mod-service/index.ts +60 -10
- package/src/mod-service/lang.ts +82 -0
- package/src/mod-service/status.ts +18 -4
- package/src/mod-service/types.ts +1 -0
- package/src/mod-service/views.ts +21 -2
- package/tests/__snapshots__/get-record.test.ts.snap +6 -0
- package/tests/__snapshots__/get-repo.test.ts.snap +3 -0
- package/tests/__snapshots__/moderation-events.test.ts.snap +45 -4
- package/tests/__snapshots__/moderation-statuses.test.ts.snap +59 -3
- package/tests/__snapshots__/moderation.test.ts.snap +3 -3
- package/tests/get-record.test.ts +0 -8
- package/tests/moderation-events.test.ts +57 -5
- package/tests/moderation-status-tags.test.ts +92 -0
- package/tests/moderation-statuses.test.ts +20 -3
|
@@ -82,6 +82,7 @@ export interface SubjectStatusView {
|
|
|
82
82
|
takendown?: boolean;
|
|
83
83
|
appealed?: boolean;
|
|
84
84
|
suspendUntil?: string;
|
|
85
|
+
tags?: string[];
|
|
85
86
|
[k: string]: unknown;
|
|
86
87
|
}
|
|
87
88
|
export declare function isSubjectStatusView(v: unknown): v is SubjectStatusView;
|
|
@@ -317,6 +318,14 @@ export interface ModEventEmail {
|
|
|
317
318
|
}
|
|
318
319
|
export declare function isModEventEmail(v: unknown): v is ModEventEmail;
|
|
319
320
|
export declare function validateModEventEmail(v: unknown): ValidationResult;
|
|
321
|
+
export interface ModEventTag {
|
|
322
|
+
add: string[];
|
|
323
|
+
remove: string[];
|
|
324
|
+
comment?: string;
|
|
325
|
+
[k: string]: unknown;
|
|
326
|
+
}
|
|
327
|
+
export declare function isModEventTag(v: unknown): v is ModEventTag;
|
|
328
|
+
export declare function validateModEventTag(v: unknown): ValidationResult;
|
|
320
329
|
export interface CommunicationTemplateView {
|
|
321
330
|
id: string;
|
|
322
331
|
name: string;
|
|
@@ -5,7 +5,7 @@ import * as ComAtprotoRepoStrongRef from '../repo/strongRef';
|
|
|
5
5
|
export interface QueryParams {
|
|
6
6
|
}
|
|
7
7
|
export interface InputSchema {
|
|
8
|
-
event: ComAtprotoAdminDefs.ModEventTakedown | ComAtprotoAdminDefs.ModEventAcknowledge | ComAtprotoAdminDefs.ModEventEscalate | ComAtprotoAdminDefs.ModEventComment | ComAtprotoAdminDefs.ModEventLabel | ComAtprotoAdminDefs.ModEventReport | ComAtprotoAdminDefs.ModEventMute | ComAtprotoAdminDefs.ModEventReverseTakedown | ComAtprotoAdminDefs.ModEventUnmute | ComAtprotoAdminDefs.ModEventEmail | {
|
|
8
|
+
event: ComAtprotoAdminDefs.ModEventTakedown | ComAtprotoAdminDefs.ModEventAcknowledge | ComAtprotoAdminDefs.ModEventEscalate | ComAtprotoAdminDefs.ModEventComment | ComAtprotoAdminDefs.ModEventLabel | ComAtprotoAdminDefs.ModEventReport | ComAtprotoAdminDefs.ModEventMute | ComAtprotoAdminDefs.ModEventReverseTakedown | ComAtprotoAdminDefs.ModEventUnmute | ComAtprotoAdminDefs.ModEventEmail | ComAtprotoAdminDefs.ModEventTag | {
|
|
9
9
|
$type: string;
|
|
10
10
|
[k: string]: unknown;
|
|
11
11
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export type InputSchema = undefined;
|
|
6
|
+
export interface OutputSchema {
|
|
7
|
+
rotationKeys?: string[];
|
|
8
|
+
alsoKnownAs?: string[];
|
|
9
|
+
verificationMethods?: {};
|
|
10
|
+
services?: {};
|
|
11
|
+
[k: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export type HandlerInput = undefined;
|
|
14
|
+
export interface HandlerSuccess {
|
|
15
|
+
encoding: 'application/json';
|
|
16
|
+
body: OutputSchema;
|
|
17
|
+
headers?: {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface HandlerError {
|
|
22
|
+
status: number;
|
|
23
|
+
message?: string;
|
|
24
|
+
}
|
|
25
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
26
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
27
|
+
auth: HA;
|
|
28
|
+
params: QueryParams;
|
|
29
|
+
input: HandlerInput;
|
|
30
|
+
req: express.Request;
|
|
31
|
+
res: express.Response;
|
|
32
|
+
};
|
|
33
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export type InputSchema = undefined;
|
|
6
|
+
export type HandlerInput = undefined;
|
|
7
|
+
export interface HandlerError {
|
|
8
|
+
status: number;
|
|
9
|
+
message?: string;
|
|
10
|
+
}
|
|
11
|
+
export type HandlerOutput = HandlerError | void;
|
|
12
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
13
|
+
auth: HA;
|
|
14
|
+
params: QueryParams;
|
|
15
|
+
input: HandlerInput;
|
|
16
|
+
req: express.Request;
|
|
17
|
+
res: express.Response;
|
|
18
|
+
};
|
|
19
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
package/dist/lexicon/types/com/atproto/{temp/transferAccount.d.ts → identity/signPlcOperation.d.ts}
RENAMED
|
@@ -3,16 +3,15 @@ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
|
3
3
|
export interface QueryParams {
|
|
4
4
|
}
|
|
5
5
|
export interface InputSchema {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
token?: string;
|
|
7
|
+
rotationKeys?: string[];
|
|
8
|
+
alsoKnownAs?: string[];
|
|
9
|
+
verificationMethods?: {};
|
|
10
|
+
services?: {};
|
|
9
11
|
[k: string]: unknown;
|
|
10
12
|
}
|
|
11
13
|
export interface OutputSchema {
|
|
12
|
-
|
|
13
|
-
refreshJwt: string;
|
|
14
|
-
handle: string;
|
|
15
|
-
did: string;
|
|
14
|
+
operation: {};
|
|
16
15
|
[k: string]: unknown;
|
|
17
16
|
}
|
|
18
17
|
export interface HandlerInput {
|
|
@@ -29,7 +28,6 @@ export interface HandlerSuccess {
|
|
|
29
28
|
export interface HandlerError {
|
|
30
29
|
status: number;
|
|
31
30
|
message?: string;
|
|
32
|
-
error?: 'InvalidHandle' | 'InvalidPassword' | 'InvalidInviteCode' | 'HandleNotAvailable' | 'UnsupportedDomain' | 'UnresolvableDid' | 'IncompatibleDidDoc';
|
|
33
31
|
}
|
|
34
32
|
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
35
33
|
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export interface InputSchema {
|
|
6
|
+
operation: {};
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface HandlerInput {
|
|
10
|
+
encoding: 'application/json';
|
|
11
|
+
body: InputSchema;
|
|
12
|
+
}
|
|
13
|
+
export interface HandlerError {
|
|
14
|
+
status: number;
|
|
15
|
+
message?: string;
|
|
16
|
+
}
|
|
17
|
+
export type HandlerOutput = HandlerError | void;
|
|
18
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
19
|
+
auth: HA;
|
|
20
|
+
params: QueryParams;
|
|
21
|
+
input: HandlerInput;
|
|
22
|
+
req: express.Request;
|
|
23
|
+
res: express.Response;
|
|
24
|
+
};
|
|
25
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -3,11 +3,10 @@ import express from 'express';
|
|
|
3
3
|
import stream from 'stream';
|
|
4
4
|
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
5
5
|
export interface QueryParams {
|
|
6
|
-
did: string;
|
|
7
6
|
}
|
|
8
7
|
export type InputSchema = string | Uint8Array;
|
|
9
8
|
export interface HandlerInput {
|
|
10
|
-
encoding: '
|
|
9
|
+
encoding: 'application/vnd.ipld.car';
|
|
11
10
|
body: stream.Readable;
|
|
12
11
|
}
|
|
13
12
|
export interface HandlerError {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { ValidationResult } from '@atproto/lexicon';
|
|
3
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
4
|
+
export interface QueryParams {
|
|
5
|
+
limit: number;
|
|
6
|
+
cursor?: string;
|
|
7
|
+
}
|
|
8
|
+
export type InputSchema = undefined;
|
|
9
|
+
export interface OutputSchema {
|
|
10
|
+
cursor?: string;
|
|
11
|
+
blobs: RecordBlob[];
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export type HandlerInput = undefined;
|
|
15
|
+
export interface HandlerSuccess {
|
|
16
|
+
encoding: 'application/json';
|
|
17
|
+
body: OutputSchema;
|
|
18
|
+
headers?: {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface HandlerError {
|
|
23
|
+
status: number;
|
|
24
|
+
message?: string;
|
|
25
|
+
}
|
|
26
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
27
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
28
|
+
auth: HA;
|
|
29
|
+
params: QueryParams;
|
|
30
|
+
input: HandlerInput;
|
|
31
|
+
req: express.Request;
|
|
32
|
+
res: express.Response;
|
|
33
|
+
};
|
|
34
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
35
|
+
export interface RecordBlob {
|
|
36
|
+
cid: string;
|
|
37
|
+
recordUri: string;
|
|
38
|
+
[k: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
export declare function isRecordBlob(v: unknown): v is RecordBlob;
|
|
41
|
+
export declare function validateRecordBlob(v: unknown): ValidationResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export type InputSchema = undefined;
|
|
6
|
+
export type HandlerInput = undefined;
|
|
7
|
+
export interface HandlerError {
|
|
8
|
+
status: number;
|
|
9
|
+
message?: string;
|
|
10
|
+
}
|
|
11
|
+
export type HandlerOutput = HandlerError | void;
|
|
12
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
13
|
+
auth: HA;
|
|
14
|
+
params: QueryParams;
|
|
15
|
+
input: HandlerInput;
|
|
16
|
+
req: express.Request;
|
|
17
|
+
res: express.Response;
|
|
18
|
+
};
|
|
19
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export type InputSchema = undefined;
|
|
6
|
+
export interface OutputSchema {
|
|
7
|
+
activated: boolean;
|
|
8
|
+
validDid: boolean;
|
|
9
|
+
repoCommit: string;
|
|
10
|
+
repoRev: string;
|
|
11
|
+
repoBlocks: number;
|
|
12
|
+
indexedRecords: number;
|
|
13
|
+
privateStateValues: number;
|
|
14
|
+
expectedBlobs: number;
|
|
15
|
+
importedBlobs: number;
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export type HandlerInput = undefined;
|
|
19
|
+
export interface HandlerSuccess {
|
|
20
|
+
encoding: 'application/json';
|
|
21
|
+
body: OutputSchema;
|
|
22
|
+
headers?: {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface HandlerError {
|
|
27
|
+
status: number;
|
|
28
|
+
message?: string;
|
|
29
|
+
}
|
|
30
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
31
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
32
|
+
auth: HA;
|
|
33
|
+
params: QueryParams;
|
|
34
|
+
input: HandlerInput;
|
|
35
|
+
req: express.Request;
|
|
36
|
+
res: express.Response;
|
|
37
|
+
};
|
|
38
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { HandlerAuth } from '@atproto/xrpc-server';
|
|
3
|
+
export interface QueryParams {
|
|
4
|
+
}
|
|
5
|
+
export interface InputSchema {
|
|
6
|
+
deleteAfter?: string;
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface HandlerInput {
|
|
10
|
+
encoding: 'application/json';
|
|
11
|
+
body: InputSchema;
|
|
12
|
+
}
|
|
13
|
+
export interface HandlerError {
|
|
14
|
+
status: number;
|
|
15
|
+
message?: string;
|
|
16
|
+
}
|
|
17
|
+
export type HandlerOutput = HandlerError | void;
|
|
18
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
19
|
+
auth: HA;
|
|
20
|
+
params: QueryParams;
|
|
21
|
+
input: HandlerInput;
|
|
22
|
+
req: express.Request;
|
|
23
|
+
res: express.Response;
|
|
24
|
+
};
|
|
25
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import express from 'express';
|
|
3
|
-
import stream from 'stream';
|
|
4
2
|
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
5
3
|
export interface QueryParams {
|
|
6
|
-
|
|
4
|
+
aud: string;
|
|
7
5
|
}
|
|
8
|
-
export type InputSchema =
|
|
9
|
-
export interface
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export type InputSchema = undefined;
|
|
7
|
+
export interface OutputSchema {
|
|
8
|
+
token: string;
|
|
9
|
+
[k: string]: unknown;
|
|
12
10
|
}
|
|
11
|
+
export type HandlerInput = undefined;
|
|
13
12
|
export interface HandlerSuccess {
|
|
14
|
-
encoding: '
|
|
15
|
-
body:
|
|
13
|
+
encoding: 'application/json';
|
|
14
|
+
body: OutputSchema;
|
|
16
15
|
headers?: {
|
|
17
16
|
[key: string]: string;
|
|
18
17
|
};
|
|
@@ -7,7 +7,7 @@ import { IncomingMessage } from 'http';
|
|
|
7
7
|
export interface QueryParams {
|
|
8
8
|
cursor?: number;
|
|
9
9
|
}
|
|
10
|
-
export type OutputSchema = Commit | Handle | Migrate | Tombstone | Info | {
|
|
10
|
+
export type OutputSchema = Commit | Identity | Handle | Migrate | Tombstone | Info | {
|
|
11
11
|
$type: string;
|
|
12
12
|
[k: string]: unknown;
|
|
13
13
|
};
|
|
@@ -37,6 +37,14 @@ export interface Commit {
|
|
|
37
37
|
}
|
|
38
38
|
export declare function isCommit(v: unknown): v is Commit;
|
|
39
39
|
export declare function validateCommit(v: unknown): ValidationResult;
|
|
40
|
+
export interface Identity {
|
|
41
|
+
seq: number;
|
|
42
|
+
did: string;
|
|
43
|
+
time: string;
|
|
44
|
+
[k: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
export declare function isIdentity(v: unknown): v is Identity;
|
|
47
|
+
export declare function validateIdentity(v: unknown): ValidationResult;
|
|
40
48
|
export interface Handle {
|
|
41
49
|
seq: number;
|
|
42
50
|
did: string;
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { subsystemLogger } from '@atproto/common';
|
|
2
2
|
export declare const dbLogger: ReturnType<typeof subsystemLogger>;
|
|
3
3
|
export declare const httpLogger: ReturnType<typeof subsystemLogger>;
|
|
4
|
+
export declare const langLogger: ReturnType<typeof subsystemLogger>;
|
|
4
5
|
export declare const loggerMiddleware: import("pino-http").HttpLogger;
|
|
@@ -38,6 +38,8 @@ export declare class ModerationService {
|
|
|
38
38
|
createdBefore?: string;
|
|
39
39
|
addedLabels: string[];
|
|
40
40
|
removedLabels: string[];
|
|
41
|
+
addedTags: string[];
|
|
42
|
+
removedTags: string[];
|
|
41
43
|
reportTypes?: string[];
|
|
42
44
|
}): Promise<{
|
|
43
45
|
cursor?: string;
|
|
@@ -60,6 +62,7 @@ export declare class ModerationService {
|
|
|
60
62
|
comment: string | null;
|
|
61
63
|
lastReportedAt: string | null;
|
|
62
64
|
lastReviewedAt: string | null;
|
|
65
|
+
tags: string[] | null;
|
|
63
66
|
muteUntil: string | null;
|
|
64
67
|
lastReviewedBy: string | null;
|
|
65
68
|
lastAppealedAt: string | null;
|
|
@@ -74,7 +77,10 @@ export declare class ModerationService {
|
|
|
74
77
|
subject: ModSubject;
|
|
75
78
|
createdBy: string;
|
|
76
79
|
createdAt?: Date;
|
|
77
|
-
}): Promise<
|
|
80
|
+
}): Promise<{
|
|
81
|
+
event: ModerationEventRow;
|
|
82
|
+
subjectStatus: ModerationSubjectStatusRow | null;
|
|
83
|
+
}>;
|
|
78
84
|
getLastReversibleEventForSubject(subject: ReversalSubject): Promise<{
|
|
79
85
|
id: number;
|
|
80
86
|
subjectBlobCids: string[] | null;
|
|
@@ -84,7 +90,7 @@ export declare class ModerationService {
|
|
|
84
90
|
createLabelVals: string | null;
|
|
85
91
|
negateLabelVals: string | null;
|
|
86
92
|
durationInHours: number | null;
|
|
87
|
-
action: "com.atproto.admin.defs#modEventTakedown" | "com.atproto.admin.defs#modEventAcknowledge" | "com.atproto.admin.defs#modEventEscalate" | "com.atproto.admin.defs#modEventComment" | "com.atproto.admin.defs#modEventLabel" | "com.atproto.admin.defs#modEventReport" | "com.atproto.admin.defs#modEventMute" | "com.atproto.admin.defs#modEventReverseTakedown" | "com.atproto.admin.defs#modEventEmail" | "com.atproto.admin.defs#modEventResolveAppeal";
|
|
93
|
+
action: "com.atproto.admin.defs#modEventTakedown" | "com.atproto.admin.defs#modEventAcknowledge" | "com.atproto.admin.defs#modEventEscalate" | "com.atproto.admin.defs#modEventComment" | "com.atproto.admin.defs#modEventLabel" | "com.atproto.admin.defs#modEventReport" | "com.atproto.admin.defs#modEventMute" | "com.atproto.admin.defs#modEventReverseTakedown" | "com.atproto.admin.defs#modEventEmail" | "com.atproto.admin.defs#modEventResolveAppeal" | "com.atproto.admin.defs#modEventTag";
|
|
88
94
|
subjectType: "com.atproto.admin.defs#repoRef" | "com.atproto.repo.strongRef";
|
|
89
95
|
subjectDid: string;
|
|
90
96
|
subjectUri: string | null;
|
|
@@ -92,6 +98,8 @@ export declare class ModerationService {
|
|
|
92
98
|
meta: Record<string, string | boolean> | null;
|
|
93
99
|
expiresAt: string | null;
|
|
94
100
|
legacyRefId: number | null;
|
|
101
|
+
addedTags: string[] | null;
|
|
102
|
+
removedTags: string[] | null;
|
|
95
103
|
} | null | undefined>;
|
|
96
104
|
getSubjectsDueForReversal(): Promise<ReversalSubject[]>;
|
|
97
105
|
isSubjectSuspended(did: string): Promise<boolean>;
|
|
@@ -106,8 +114,11 @@ export declare class ModerationService {
|
|
|
106
114
|
subject: ModSubject;
|
|
107
115
|
reportedBy: string;
|
|
108
116
|
createdAt?: Date;
|
|
109
|
-
}): Promise<
|
|
110
|
-
|
|
117
|
+
}): Promise<{
|
|
118
|
+
event: ModerationEventRow;
|
|
119
|
+
subjectStatus: ModerationSubjectStatusRow | null;
|
|
120
|
+
}>;
|
|
121
|
+
getSubjectStatuses({ cursor, limit, takendown, appealed, reviewState, reviewedAfter, reviewedBefore, reportedAfter, reportedBefore, includeMuted, ignoreSubjects, sortDirection, lastReviewedBy, sortField, subject, tags, excludeTags, }: {
|
|
111
122
|
cursor?: string;
|
|
112
123
|
limit?: number;
|
|
113
124
|
takendown?: boolean;
|
|
@@ -123,6 +134,8 @@ export declare class ModerationService {
|
|
|
123
134
|
sortDirection: 'asc' | 'desc';
|
|
124
135
|
lastReviewedBy?: string;
|
|
125
136
|
sortField: 'lastReviewedAt' | 'lastReportedAt';
|
|
137
|
+
tags: string[];
|
|
138
|
+
excludeTags: string[];
|
|
126
139
|
}): Promise<{
|
|
127
140
|
statuses: {
|
|
128
141
|
handle: string;
|
|
@@ -135,6 +148,7 @@ export declare class ModerationService {
|
|
|
135
148
|
comment: string | null;
|
|
136
149
|
lastReportedAt: string | null;
|
|
137
150
|
lastReviewedAt: string | null;
|
|
151
|
+
tags: string[] | null;
|
|
138
152
|
muteUntil: string | null;
|
|
139
153
|
lastReviewedBy: string | null;
|
|
140
154
|
lastAppealedAt: string | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModerationService } from '.';
|
|
2
|
+
import { ModSubject } from './subject';
|
|
3
|
+
import { ModerationSubjectStatusRow } from './types';
|
|
4
|
+
export declare class ModerationLangService {
|
|
5
|
+
private moderationService;
|
|
6
|
+
constructor(moderationService: ModerationService);
|
|
7
|
+
tagSubjectWithLang({ subject, subjectStatus, createdBy, }: {
|
|
8
|
+
subject: ModSubject;
|
|
9
|
+
createdBy: string;
|
|
10
|
+
subjectStatus: ModerationSubjectStatusRow | null;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
getRecordLang({ subject, }: {
|
|
13
|
+
subject: ModSubject;
|
|
14
|
+
}): Promise<string[] | null>;
|
|
15
|
+
}
|
|
@@ -2,7 +2,7 @@ import { AtUri } from '@atproto/syntax';
|
|
|
2
2
|
import { Database } from '../db';
|
|
3
3
|
import { ModerationSubjectStatus } from '../db/schema/moderation_subject_status';
|
|
4
4
|
import { ModerationEventRow } from './types';
|
|
5
|
-
export declare const adjustModerationSubjectStatus: (db: Database, moderationEvent: ModerationEventRow, blobCids?: string[]) => Promise<import("kysely").
|
|
5
|
+
export declare const adjustModerationSubjectStatus: (db: Database, moderationEvent: ModerationEventRow, blobCids?: string[]) => Promise<import("kysely").Selectable<ModerationSubjectStatus> | null>;
|
|
6
6
|
type ModerationSubjectStatusFilter = Pick<ModerationSubjectStatus, 'did'> | Pick<ModerationSubjectStatus, 'did' | 'recordPath'> | Pick<ModerationSubjectStatus, 'did' | 'recordPath' | 'recordCid'>;
|
|
7
7
|
export declare const getModerationSubjectStatus: (db: Database, filters: ModerationSubjectStatusFilter) => Promise<{} | undefined>;
|
|
8
8
|
export declare const getStatusIdentifierFromSubject: (subject: string | AtUri) => {
|
|
@@ -16,6 +16,6 @@ export type ModerationSubjectStatusRow = Selectable<ModerationSubjectStatus>;
|
|
|
16
16
|
export type ModerationSubjectStatusRowWithHandle = ModerationSubjectStatusRow & {
|
|
17
17
|
handle: string | null;
|
|
18
18
|
};
|
|
19
|
-
export type ModEventType = ComAtprotoAdminDefs.ModEventTakedown | ComAtprotoAdminDefs.ModEventAcknowledge | ComAtprotoAdminDefs.ModEventEscalate | ComAtprotoAdminDefs.ModEventComment | ComAtprotoAdminDefs.ModEventLabel | ComAtprotoAdminDefs.ModEventReport | ComAtprotoAdminDefs.ModEventMute | ComAtprotoAdminDefs.ModEventReverseTakedown;
|
|
19
|
+
export type ModEventType = ComAtprotoAdminDefs.ModEventTakedown | ComAtprotoAdminDefs.ModEventAcknowledge | ComAtprotoAdminDefs.ModEventEscalate | ComAtprotoAdminDefs.ModEventComment | ComAtprotoAdminDefs.ModEventLabel | ComAtprotoAdminDefs.ModEventReport | ComAtprotoAdminDefs.ModEventMute | ComAtprotoAdminDefs.ModEventReverseTakedown | ComAtprotoAdminDefs.ModEventTag;
|
|
20
20
|
export declare const UNSPECCED_TAKEDOWN_LABEL = "!unspecced-takedown";
|
|
21
21
|
export declare const UNSPECCED_TAKEDOWN_BLOBS_LABEL = "!unspecced-takedown-blobs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AtpAgent from '@atproto/api';
|
|
1
|
+
import AtpAgent, { AppBskyFeedDefs } from '@atproto/api';
|
|
2
2
|
import { BlobRef } from '@atproto/lexicon';
|
|
3
3
|
import { Database } from '../db';
|
|
4
4
|
import { ModEventView, RepoView, RepoViewDetail, RecordView, RecordViewDetail, ReportViewDetail, BlobView, SubjectStatusView, ModEventViewDetail, AccountView } from '../lexicon/types/com/atproto/admin/defs';
|
|
@@ -29,6 +29,7 @@ export declare class ModerationViews {
|
|
|
29
29
|
labels(subject: string, includeNeg?: boolean): Promise<Label[]>;
|
|
30
30
|
getSubjectStatus(subjects: string[]): Promise<Map<string, ModerationSubjectStatusRowWithHandle>>;
|
|
31
31
|
formatSubjectStatus(status: ModerationSubjectStatusRowWithHandle): SubjectStatusView;
|
|
32
|
+
fetchAuthorFeed(actor: string): Promise<AppBskyFeedDefs.FeedViewPost[]>;
|
|
32
33
|
}
|
|
33
34
|
type RecordSubject = {
|
|
34
35
|
uri: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/ozone",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Backend service for moderating the Bluesky network.",
|
|
6
6
|
"keywords": [
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"pino-http": "^8.2.1",
|
|
31
31
|
"typed-emitter": "^2.1.0",
|
|
32
32
|
"uint8arrays": "3.0.0",
|
|
33
|
-
"@atproto/api": "^0.
|
|
33
|
+
"@atproto/api": "^0.10.0",
|
|
34
34
|
"@atproto/common": "^0.3.3",
|
|
35
35
|
"@atproto/crypto": "^0.3.0",
|
|
36
|
-
"@atproto/syntax": "^0.1.5",
|
|
37
36
|
"@atproto/identity": "^0.3.2",
|
|
38
37
|
"@atproto/lexicon": "^0.3.1",
|
|
38
|
+
"@atproto/syntax": "^0.1.5",
|
|
39
39
|
"@atproto/xrpc-server": "^0.4.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"@types/pg": "^8.6.6",
|
|
47
47
|
"@types/qs": "^6.9.7",
|
|
48
48
|
"axios": "^0.27.2",
|
|
49
|
-
"@atproto/api": "^0.
|
|
50
|
-
"@atproto/dev-env": "^0.2.
|
|
49
|
+
"@atproto/api": "^0.10.0",
|
|
50
|
+
"@atproto/dev-env": "^0.2.32",
|
|
51
51
|
"@atproto/lex-cli": "^0.3.0",
|
|
52
|
-
"@atproto/pds": "^0.
|
|
52
|
+
"@atproto/pds": "^0.4.0",
|
|
53
53
|
"@atproto/xrpc": "^0.4.1"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
isModEventTakedown,
|
|
8
8
|
} from '../../lexicon/types/com/atproto/admin/defs'
|
|
9
9
|
import { subjectFromInput } from '../../mod-service/subject'
|
|
10
|
+
import { ModerationLangService } from '../../mod-service/lang'
|
|
10
11
|
|
|
11
12
|
export default function (server: Server, ctx: AppContext) {
|
|
12
13
|
server.com.atproto.admin.emitModerationEvent({
|
|
@@ -77,10 +78,21 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
77
78
|
createdBy,
|
|
78
79
|
})
|
|
79
80
|
|
|
81
|
+
const moderationLangService = new ModerationLangService(moderationTxn)
|
|
82
|
+
await moderationLangService.tagSubjectWithLang({
|
|
83
|
+
subject,
|
|
84
|
+
createdBy: ctx.cfg.service.did,
|
|
85
|
+
subjectStatus: result.subjectStatus,
|
|
86
|
+
})
|
|
87
|
+
|
|
80
88
|
if (subject.isRepo()) {
|
|
81
89
|
if (isTakedownEvent) {
|
|
82
|
-
const isSuspend = !!result.durationInHours
|
|
83
|
-
await moderationTxn.takedownRepo(
|
|
90
|
+
const isSuspend = !!result.event.durationInHours
|
|
91
|
+
await moderationTxn.takedownRepo(
|
|
92
|
+
subject,
|
|
93
|
+
result.event.id,
|
|
94
|
+
isSuspend,
|
|
95
|
+
)
|
|
84
96
|
} else if (isReverseTakedownEvent) {
|
|
85
97
|
await moderationTxn.reverseTakedownRepo(subject)
|
|
86
98
|
}
|
|
@@ -88,7 +100,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
88
100
|
|
|
89
101
|
if (subject.isRecord()) {
|
|
90
102
|
if (isTakedownEvent) {
|
|
91
|
-
await moderationTxn.takedownRecord(subject, result.id)
|
|
103
|
+
await moderationTxn.takedownRecord(subject, result.event.id)
|
|
92
104
|
} else if (isReverseTakedownEvent) {
|
|
93
105
|
await moderationTxn.reverseTakedownRecord(subject)
|
|
94
106
|
}
|
|
@@ -96,20 +108,20 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
96
108
|
|
|
97
109
|
if (isLabelEvent) {
|
|
98
110
|
await moderationTxn.formatAndCreateLabels(
|
|
99
|
-
result.subjectUri ?? result.subjectDid,
|
|
100
|
-
result.subjectCid,
|
|
111
|
+
result.event.subjectUri ?? result.event.subjectDid,
|
|
112
|
+
result.event.subjectCid,
|
|
101
113
|
{
|
|
102
|
-
create: result.createLabelVals?.length
|
|
103
|
-
? result.createLabelVals.split(' ')
|
|
114
|
+
create: result.event.createLabelVals?.length
|
|
115
|
+
? result.event.createLabelVals.split(' ')
|
|
104
116
|
: undefined,
|
|
105
|
-
negate: result.negateLabelVals?.length
|
|
106
|
-
? result.negateLabelVals.split(' ')
|
|
117
|
+
negate: result.event.negateLabelVals?.length
|
|
118
|
+
? result.event.negateLabelVals.split(' ')
|
|
107
119
|
: undefined,
|
|
108
120
|
},
|
|
109
121
|
)
|
|
110
122
|
}
|
|
111
123
|
|
|
112
|
-
return result
|
|
124
|
+
return result.event
|
|
113
125
|
})
|
|
114
126
|
|
|
115
127
|
return {
|
|
@@ -20,6 +20,8 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
20
20
|
createdBefore,
|
|
21
21
|
addedLabels = [],
|
|
22
22
|
removedLabels = [],
|
|
23
|
+
addedTags = [],
|
|
24
|
+
removedTags = [],
|
|
23
25
|
reportTypes,
|
|
24
26
|
} = params
|
|
25
27
|
const db = ctx.db
|
|
@@ -37,7 +39,9 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
37
39
|
createdAfter,
|
|
38
40
|
createdBefore,
|
|
39
41
|
addedLabels,
|
|
42
|
+
addedTags,
|
|
40
43
|
removedLabels,
|
|
44
|
+
removedTags,
|
|
41
45
|
reportTypes,
|
|
42
46
|
})
|
|
43
47
|
return {
|
|
@@ -22,6 +22,8 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
22
22
|
includeMuted = false,
|
|
23
23
|
limit = 50,
|
|
24
24
|
cursor,
|
|
25
|
+
tags = [],
|
|
26
|
+
excludeTags = [],
|
|
25
27
|
} = params
|
|
26
28
|
const db = ctx.db
|
|
27
29
|
const modService = ctx.modService(db)
|
|
@@ -41,6 +43,8 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
41
43
|
sortField,
|
|
42
44
|
limit,
|
|
43
45
|
cursor,
|
|
46
|
+
tags,
|
|
47
|
+
excludeTags,
|
|
44
48
|
})
|
|
45
49
|
const subjectStatuses = results.statuses.map((status) =>
|
|
46
50
|
modService.views.formatSubjectStatus(status),
|