@atproto/bsky 0.0.15 → 0.0.16
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 +11 -0
- package/dist/api/com/atproto/moderation/util.d.ts +4 -3
- package/dist/context.d.ts +15 -0
- package/dist/db/index.js +26 -1
- package/dist/db/index.js.map +3 -3
- package/dist/db/migrations/20231003T202833377Z-create-moderation-subject-status.d.ts +3 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/pagination.d.ts +2 -1
- package/dist/db/{periodic-moderation-action-reversal.d.ts → periodic-moderation-event-reversal.d.ts} +3 -5
- package/dist/db/tables/moderation.d.ts +24 -34
- package/dist/feed-gen/types.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2750 -2121
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +11 -18
- package/dist/lexicon/lexicons.d.ts +414 -399
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -7
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +114 -48
- package/dist/lexicon/types/com/atproto/admin/{takeModerationAction.d.ts → emitModerationEvent.d.ts} +5 -6
- package/dist/lexicon/types/com/atproto/admin/{getModerationAction.d.ts → getModerationEvent.d.ts} +1 -1
- package/dist/lexicon/types/com/atproto/admin/{getModerationActions.d.ts → queryModerationEvents.d.ts} +5 -1
- package/dist/lexicon/types/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +12 -6
- package/dist/lexicon/types/com/atproto/admin/sendEmail.d.ts +1 -0
- package/dist/migrate-moderation-data.d.ts +1 -0
- package/dist/services/actor/views.d.ts +2 -5
- package/dist/services/feed/index.d.ts +1 -0
- package/dist/services/feed/util.d.ts +9 -1
- package/dist/services/feed/views.d.ts +6 -17
- package/dist/services/graph/index.d.ts +5 -29
- package/dist/services/graph/types.d.ts +1 -0
- package/dist/services/moderation/index.d.ts +135 -72
- package/dist/services/moderation/pagination.d.ts +36 -0
- package/dist/services/moderation/status.d.ts +13 -0
- package/dist/services/moderation/types.d.ts +35 -0
- package/dist/services/moderation/views.d.ts +18 -14
- package/dist/util/debug.d.ts +1 -1
- package/package.json +11 -11
- package/src/api/app/bsky/feed/getActorFeeds.ts +2 -1
- package/src/api/app/bsky/feed/getActorLikes.ts +1 -3
- package/src/api/app/bsky/feed/getAuthorFeed.ts +1 -3
- package/src/api/app/bsky/feed/getFeed.ts +9 -9
- package/src/api/app/bsky/feed/getFeedGenerator.ts +3 -0
- package/src/api/app/bsky/feed/getFeedGenerators.ts +2 -1
- package/src/api/app/bsky/feed/getListFeed.ts +1 -3
- package/src/api/app/bsky/feed/getPostThread.ts +15 -54
- package/src/api/app/bsky/feed/getPosts.ts +21 -18
- package/src/api/app/bsky/feed/getSuggestedFeeds.ts +2 -1
- package/src/api/app/bsky/feed/getTimeline.ts +1 -3
- package/src/api/app/bsky/feed/searchPosts.ts +20 -17
- package/src/api/app/bsky/graph/getList.ts +6 -3
- package/src/api/app/bsky/graph/getListBlocks.ts +3 -2
- package/src/api/app/bsky/graph/getListMutes.ts +2 -1
- package/src/api/app/bsky/graph/getLists.ts +2 -1
- package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +3 -1
- package/src/api/blob-resolver.ts +6 -11
- package/src/api/com/atproto/admin/emitModerationEvent.ts +220 -0
- package/src/api/com/atproto/admin/{getModerationActions.ts → getModerationEvent.ts} +5 -11
- package/src/api/com/atproto/admin/getRecord.ts +1 -0
- package/src/api/com/atproto/admin/{getModerationReports.ts → queryModerationEvents.ts} +13 -16
- package/src/api/com/atproto/admin/queryModerationStatuses.ts +55 -0
- package/src/api/com/atproto/moderation/createReport.ts +9 -7
- package/src/api/com/atproto/moderation/util.ts +38 -20
- package/src/api/index.ts +8 -14
- package/src/auth.ts +29 -21
- package/src/auto-moderator/index.ts +26 -19
- package/src/context.ts +4 -0
- package/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts +123 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/db/pagination.ts +26 -3
- package/src/db/{periodic-moderation-action-reversal.ts → periodic-moderation-event-reversal.ts} +50 -46
- package/src/db/tables/moderation.ts +35 -52
- package/src/feed-gen/best-of-follows.ts +6 -3
- package/src/feed-gen/bsky-team.ts +1 -1
- package/src/feed-gen/hot-classic.ts +1 -1
- package/src/feed-gen/mutuals.ts +6 -2
- package/src/feed-gen/types.ts +1 -1
- package/src/feed-gen/whats-hot.ts +1 -1
- package/src/feed-gen/with-friends.ts +7 -3
- package/src/index.ts +2 -1
- package/src/lexicon/index.ts +30 -67
- package/src/lexicon/lexicons.ts +526 -491
- package/src/lexicon/types/app/bsky/feed/defs.ts +1 -18
- package/src/lexicon/types/app/bsky/graph/defs.ts +1 -0
- package/src/lexicon/types/com/atproto/admin/defs.ts +276 -84
- package/src/lexicon/types/com/atproto/admin/{takeModerationAction.ts → emitModerationEvent.ts} +13 -11
- package/src/lexicon/types/com/atproto/admin/{getModerationReport.ts → getModerationEvent.ts} +1 -1
- package/src/lexicon/types/com/atproto/admin/{getModerationActions.ts → queryModerationEvents.ts} +8 -1
- package/src/lexicon/types/com/atproto/admin/{getModerationReports.ts → queryModerationStatuses.ts} +21 -14
- package/src/lexicon/types/com/atproto/admin/sendEmail.ts +1 -0
- package/src/migrate-moderation-data.ts +414 -0
- package/src/services/actor/views.ts +5 -14
- package/src/services/feed/index.ts +26 -7
- package/src/services/feed/util.ts +47 -19
- package/src/services/feed/views.ts +68 -4
- package/src/services/graph/index.ts +21 -3
- package/src/services/graph/types.ts +1 -0
- package/src/services/indexing/plugins/block.ts +2 -3
- package/src/services/indexing/plugins/feed-generator.ts +2 -3
- package/src/services/indexing/plugins/follow.ts +2 -3
- package/src/services/indexing/plugins/like.ts +2 -3
- package/src/services/indexing/plugins/list-block.ts +2 -3
- package/src/services/indexing/plugins/list-item.ts +2 -3
- package/src/services/indexing/plugins/list.ts +2 -3
- package/src/services/indexing/plugins/post.ts +3 -4
- package/src/services/indexing/plugins/repost.ts +2 -3
- package/src/services/indexing/plugins/thread-gate.ts +2 -3
- package/src/services/label/index.ts +2 -3
- package/src/services/moderation/index.ts +380 -395
- package/src/services/moderation/pagination.ts +96 -0
- package/src/services/moderation/status.ts +244 -0
- package/src/services/moderation/types.ts +49 -0
- package/src/services/moderation/views.ts +278 -329
- package/src/util/debug.ts +2 -2
- package/tests/__snapshots__/feed-generation.test.ts.snap +322 -6
- package/tests/__snapshots__/indexing.test.ts.snap +0 -6
- package/tests/admin/__snapshots__/get-record.test.ts.snap +30 -132
- package/tests/admin/__snapshots__/get-repo.test.ts.snap +14 -60
- package/tests/admin/__snapshots__/moderation-events.test.ts.snap +146 -0
- package/tests/admin/__snapshots__/moderation-statuses.test.ts.snap +64 -0
- package/tests/admin/__snapshots__/moderation.test.ts.snap +0 -125
- package/tests/admin/get-record.test.ts +5 -9
- package/tests/admin/get-repo.test.ts +5 -9
- package/tests/admin/moderation-events.test.ts +221 -0
- package/tests/admin/moderation-statuses.test.ts +145 -0
- package/tests/admin/moderation.test.ts +512 -860
- package/tests/admin/repo-search.test.ts +2 -3
- package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -1
- package/tests/auto-moderator/takedowns.test.ts +45 -18
- package/tests/feed-generation.test.ts +57 -9
- package/tests/views/__snapshots__/block-lists.test.ts.snap +3 -9
- package/tests/views/__snapshots__/blocks.test.ts.snap +0 -9
- package/tests/views/__snapshots__/mute-lists.test.ts.snap +5 -5
- package/tests/views/__snapshots__/mutes.test.ts.snap +0 -3
- package/tests/views/__snapshots__/thread.test.ts.snap +0 -30
- package/tests/views/actor-search.test.ts +2 -3
- package/tests/views/author-feed.test.ts +42 -36
- package/tests/views/follows.test.ts +40 -35
- package/tests/views/list-feed.test.ts +17 -9
- package/tests/views/notifications.test.ts +13 -9
- package/tests/views/profile.test.ts +20 -18
- package/tests/views/thread.test.ts +54 -26
- package/tests/views/threadgating.test.ts +51 -19
- package/tests/views/timeline.test.ts +21 -13
- package/dist/api/com/atproto/admin/resolveModerationReports.d.ts +0 -3
- package/dist/api/com/atproto/admin/reverseModerationAction.d.ts +0 -3
- package/dist/api/com/atproto/admin/takeModerationAction.d.ts +0 -3
- package/dist/lexicon/types/com/atproto/admin/getModerationReport.d.ts +0 -29
- package/dist/lexicon/types/com/atproto/admin/resolveModerationReports.d.ts +0 -36
- package/dist/lexicon/types/com/atproto/admin/reverseModerationAction.d.ts +0 -36
- package/src/api/com/atproto/admin/getModerationAction.ts +0 -44
- package/src/api/com/atproto/admin/getModerationReport.ts +0 -43
- package/src/api/com/atproto/admin/resolveModerationReports.ts +0 -24
- package/src/api/com/atproto/admin/reverseModerationAction.ts +0 -115
- package/src/api/com/atproto/admin/takeModerationAction.ts +0 -156
- package/src/lexicon/types/com/atproto/admin/getModerationAction.ts +0 -41
- package/src/lexicon/types/com/atproto/admin/resolveModerationReports.ts +0 -49
- package/src/lexicon/types/com/atproto/admin/reverseModerationAction.ts +0 -49
- package/tests/admin/__snapshots__/get-moderation-action.test.ts.snap +0 -172
- package/tests/admin/__snapshots__/get-moderation-actions.test.ts.snap +0 -178
- package/tests/admin/__snapshots__/get-moderation-report.test.ts.snap +0 -177
- package/tests/admin/__snapshots__/get-moderation-reports.test.ts.snap +0 -307
- package/tests/admin/get-moderation-action.test.ts +0 -100
- package/tests/admin/get-moderation-actions.test.ts +0 -164
- package/tests/admin/get-moderation-report.test.ts +0 -100
- package/tests/admin/get-moderation-reports.test.ts +0 -332
- /package/dist/api/com/atproto/admin/{getModerationAction.d.ts → emitModerationEvent.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationActions.d.ts → getModerationEvent.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationReport.d.ts → queryModerationEvents.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +0 -0
|
@@ -26,3 +26,4 @@ export * as _20230904T211011773Z from './20230904T211011773Z-block-lists';
|
|
|
26
26
|
export * as _20230906T222220386Z from './20230906T222220386Z-thread-gating';
|
|
27
27
|
export * as _20230920T213858047Z from './20230920T213858047Z-add-tags-to-post';
|
|
28
28
|
export * as _20230929T192920807Z from './20230929T192920807Z-record-cursor-indexes';
|
|
29
|
+
export * as _20231003T202833377Z from './20231003T202833377Z-create-moderation-subject-status';
|
package/dist/db/pagination.d.ts
CHANGED
|
@@ -40,8 +40,9 @@ export declare class TimeCidKeyset<TimeCidResult = SortAtCidResult> extends Gene
|
|
|
40
40
|
export declare const paginate: <QB extends AnyQb, K extends GenericKeyset<unknown, any>>(qb: QB, opts: {
|
|
41
41
|
limit?: number | undefined;
|
|
42
42
|
cursor?: string | undefined;
|
|
43
|
-
direction?: "
|
|
43
|
+
direction?: "desc" | "asc" | undefined;
|
|
44
44
|
keyset: K;
|
|
45
45
|
tryIndex?: boolean | undefined;
|
|
46
|
+
nullsLast?: boolean | undefined;
|
|
46
47
|
}) => QB;
|
|
47
48
|
export {};
|
package/dist/db/{periodic-moderation-action-reversal.d.ts → periodic-moderation-event-reversal.d.ts}
RENAMED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { Leader } from './leader';
|
|
2
2
|
import AppContext from '../context';
|
|
3
|
+
import { ModerationSubjectStatusRow } from '../services/moderation/types';
|
|
3
4
|
import AtpAgent from '@atproto/api';
|
|
4
|
-
import { LabelService } from '../services/label';
|
|
5
|
-
import { ModerationActionRow } from '../services/moderation';
|
|
6
5
|
export declare const MODERATION_ACTION_REVERSAL_ID = 1011;
|
|
7
|
-
export declare class
|
|
6
|
+
export declare class PeriodicModerationEventReversal {
|
|
8
7
|
private appContext;
|
|
9
8
|
leader: Leader;
|
|
10
9
|
destroyed: boolean;
|
|
11
10
|
pushAgent?: AtpAgent;
|
|
12
11
|
constructor(appContext: AppContext);
|
|
13
|
-
|
|
14
|
-
revertAction(actionRow: ModerationActionRow): Promise<void>;
|
|
12
|
+
revertState(eventRow: ModerationSubjectStatusRow): Promise<void>;
|
|
15
13
|
findAndRevertDueActions(): Promise<void>;
|
|
16
14
|
run(): Promise<void>;
|
|
17
15
|
destroy(): void;
|
|
@@ -1,52 +1,42 @@
|
|
|
1
1
|
import { Generated } from 'kysely';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
export
|
|
6
|
-
export declare const reportTableName = "moderation_report";
|
|
7
|
-
export declare const reportResolutionTableName = "moderation_report_resolution";
|
|
8
|
-
export interface ModerationAction {
|
|
2
|
+
import { REVIEWCLOSED, REVIEWOPEN, REVIEWESCALATED } from '../../lexicon/types/com/atproto/admin/defs';
|
|
3
|
+
export declare const eventTableName = "moderation_event";
|
|
4
|
+
export declare const subjectStatusTableName = "moderation_subject_status";
|
|
5
|
+
export interface ModerationEvent {
|
|
9
6
|
id: Generated<number>;
|
|
10
|
-
action:
|
|
7
|
+
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';
|
|
11
8
|
subjectType: 'com.atproto.admin.defs#repoRef' | 'com.atproto.repo.strongRef';
|
|
12
9
|
subjectDid: string;
|
|
13
10
|
subjectUri: string | null;
|
|
14
11
|
subjectCid: string | null;
|
|
15
12
|
createLabelVals: string | null;
|
|
16
13
|
negateLabelVals: string | null;
|
|
17
|
-
|
|
14
|
+
comment: string | null;
|
|
18
15
|
createdAt: string;
|
|
19
16
|
createdBy: string;
|
|
20
|
-
reversedAt: string | null;
|
|
21
|
-
reversedBy: string | null;
|
|
22
|
-
reversedReason: string | null;
|
|
23
17
|
durationInHours: number | null;
|
|
24
18
|
expiresAt: string | null;
|
|
19
|
+
meta: Record<string, string | boolean> | null;
|
|
20
|
+
legacyRefId: number | null;
|
|
25
21
|
}
|
|
26
|
-
export interface
|
|
27
|
-
actionId: number;
|
|
28
|
-
cid: string;
|
|
29
|
-
}
|
|
30
|
-
export interface ModerationReport {
|
|
22
|
+
export interface ModerationSubjectStatus {
|
|
31
23
|
id: Generated<number>;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
reason: string | null;
|
|
38
|
-
reportedByDid: string;
|
|
39
|
-
createdAt: string;
|
|
40
|
-
}
|
|
41
|
-
export interface ModerationReportResolution {
|
|
42
|
-
reportId: number;
|
|
43
|
-
actionId: number;
|
|
24
|
+
did: string;
|
|
25
|
+
recordPath: string;
|
|
26
|
+
recordCid: string | null;
|
|
27
|
+
blobCids: string[] | null;
|
|
28
|
+
reviewState: typeof REVIEWCLOSED | typeof REVIEWOPEN | typeof REVIEWESCALATED;
|
|
44
29
|
createdAt: string;
|
|
45
|
-
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
lastReviewedBy: string | null;
|
|
32
|
+
lastReviewedAt: string | null;
|
|
33
|
+
lastReportedAt: string | null;
|
|
34
|
+
muteUntil: string | null;
|
|
35
|
+
suspendUntil: string | null;
|
|
36
|
+
takendown: boolean;
|
|
37
|
+
comment: string | null;
|
|
46
38
|
}
|
|
47
39
|
export declare type PartialDB = {
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[reportTableName]: ModerationReport;
|
|
51
|
-
[reportResolutionTableName]: ModerationReportResolution;
|
|
40
|
+
[eventTableName]: ModerationEvent;
|
|
41
|
+
[subjectStatusTableName]: ModerationSubjectStatus;
|
|
52
42
|
};
|
package/dist/feed-gen/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type AlgoResponse = {
|
|
|
6
6
|
feedItems: FeedRow[];
|
|
7
7
|
cursor?: string;
|
|
8
8
|
};
|
|
9
|
-
export declare type AlgoHandler = (ctx: AppContext, params: SkeletonParams,
|
|
9
|
+
export declare type AlgoHandler = (ctx: AppContext, params: SkeletonParams, viewer: string | null) => Promise<AlgoResponse>;
|
|
10
10
|
export declare type MountedAlgos = Record<string, AlgoHandler>;
|
|
11
11
|
export declare const toSkeletonItem: (feedItem: {
|
|
12
12
|
uri: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,13 +11,14 @@ export type { ServerConfigValues } from './config';
|
|
|
11
11
|
export type { MountedAlgos } from './feed-gen/types';
|
|
12
12
|
export { ServerConfig } from './config';
|
|
13
13
|
export { Database, PrimaryDatabase, DatabaseCoordinator } from './db';
|
|
14
|
-
export {
|
|
14
|
+
export { PeriodicModerationEventReversal } from './db/periodic-moderation-event-reversal';
|
|
15
15
|
export { Redis } from './redis';
|
|
16
16
|
export { ViewMaintainer } from './db/views';
|
|
17
17
|
export { AppContext } from './context';
|
|
18
18
|
export { makeAlgos } from './feed-gen';
|
|
19
19
|
export * from './indexer';
|
|
20
20
|
export * from './ingester';
|
|
21
|
+
export { MigrateModerationData } from './migrate-moderation-data';
|
|
21
22
|
export declare class BskyAppView {
|
|
22
23
|
ctx: AppContext;
|
|
23
24
|
app: express.Application;
|