@atcute/bluesky-moderation 2.0.4 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -128
- package/dist/_test-util/mock.d.ts +58 -0
- package/dist/_test-util/mock.d.ts.map +1 -0
- package/dist/_test-util/mock.js +109 -0
- package/dist/_test-util/mock.js.map +1 -0
- package/dist/_test-util/moderation-behavior.d.ts +57 -0
- package/dist/_test-util/moderation-behavior.d.ts.map +1 -0
- package/dist/_test-util/moderation-behavior.js +158 -0
- package/dist/_test-util/moderation-behavior.js.map +1 -0
- package/dist/behaviors.d.ts +21 -18
- package/dist/behaviors.d.ts.map +1 -1
- package/dist/behaviors.js +18 -21
- package/dist/behaviors.js.map +1 -1
- package/dist/decision.d.ts +21 -20
- package/dist/decision.d.ts.map +1 -1
- package/dist/decision.js +14 -16
- package/dist/decision.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/internal/keyword-filter.d.ts +1 -1
- package/dist/internal/keyword-filter.d.ts.map +1 -1
- package/dist/keyword-filter.d.ts +6 -5
- package/dist/keyword-filter.d.ts.map +1 -1
- package/dist/keyword-filter.js +8 -7
- package/dist/keyword-filter.js.map +1 -1
- package/dist/label.d.ts +29 -25
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +24 -28
- package/dist/label.js.map +1 -1
- package/dist/subjects/feed-generator.d.ts +2 -2
- package/dist/subjects/feed-generator.d.ts.map +1 -1
- package/dist/subjects/list.d.ts +2 -2
- package/dist/subjects/list.d.ts.map +1 -1
- package/dist/subjects/notification.d.ts +2 -2
- package/dist/subjects/notification.d.ts.map +1 -1
- package/dist/subjects/post.d.ts +2 -2
- package/dist/subjects/post.d.ts.map +1 -1
- package/dist/subjects/post.js.map +1 -1
- package/dist/subjects/profile.d.ts +2 -2
- package/dist/subjects/profile.d.ts.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/ui.d.ts +2 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +4 -4
- package/dist/ui.js.map +1 -1
- package/lib/_test-util/mock.ts +214 -0
- package/lib/_test-util/moderation-behavior.ts +259 -0
- package/lib/behaviors.ts +21 -18
- package/lib/decision.ts +26 -26
- package/lib/index.ts +11 -11
- package/lib/internal/keyword-filter.ts +1 -1
- package/lib/keyword-filter.ts +9 -6
- package/lib/label.ts +32 -28
- package/lib/subjects/feed-generator.ts +4 -4
- package/lib/subjects/list.ts +4 -4
- package/lib/subjects/notification.ts +4 -4
- package/lib/subjects/post.ts +6 -7
- package/lib/subjects/profile.ts +3 -3
- package/lib/types.ts +2 -2
- package/lib/ui.ts +7 -7
- package/package.json +17 -13
package/lib/subjects/post.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@atcute/bluesky';
|
|
9
9
|
import type { CanonicalResourceUri } from '@atcute/lexicons';
|
|
10
10
|
|
|
11
|
-
import { LabelTarget } from '../behaviors.
|
|
11
|
+
import { LabelTarget } from '../behaviors.ts';
|
|
12
12
|
import {
|
|
13
13
|
considerBlockedBy,
|
|
14
14
|
considerBlocking,
|
|
@@ -19,13 +19,12 @@ import {
|
|
|
19
19
|
downgradeDecision,
|
|
20
20
|
mergeModerationDecisions,
|
|
21
21
|
type ModerationDecision,
|
|
22
|
-
} from '../decision.
|
|
23
|
-
import
|
|
22
|
+
} from '../decision.ts';
|
|
23
|
+
import { matchesKeywordFilters } from '../internal/keyword-filter.ts';
|
|
24
|
+
import type { KeywordFilter } from '../keyword-filter.ts';
|
|
25
|
+
import type { ModerationOptions, PostSubject } from '../types.ts';
|
|
24
26
|
|
|
25
|
-
import {
|
|
26
|
-
import type { KeywordFilter } from '../keyword-filter.js';
|
|
27
|
-
|
|
28
|
-
import { moderateProfile } from './profile.js';
|
|
27
|
+
import { moderateProfile } from './profile.ts';
|
|
29
28
|
|
|
30
29
|
export const moderatePost = (subject: PostSubject, opts: ModerationOptions) => {
|
|
31
30
|
return mergeModerationDecisions(
|
package/lib/subjects/profile.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LabelTarget } from '../behaviors.
|
|
1
|
+
import { LabelTarget } from '../behaviors.ts';
|
|
2
2
|
import {
|
|
3
3
|
considerBlockedBy,
|
|
4
4
|
considerBlocking,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
considerPermanentMute,
|
|
7
7
|
createModerationDecision,
|
|
8
8
|
type ModerationDecision,
|
|
9
|
-
} from '../decision.
|
|
10
|
-
import type { ModerationOptions, ProfileSubject } from '../types.
|
|
9
|
+
} from '../decision.ts';
|
|
10
|
+
import type { ModerationOptions, ProfileSubject } from '../types.ts';
|
|
11
11
|
|
|
12
12
|
export const moderateProfile = (subject: ProfileSubject, opts: ModerationOptions): ModerationDecision => {
|
|
13
13
|
const decision = createModerationDecision(subject.did, opts);
|
package/lib/types.ts
CHANGED
|
@@ -8,8 +8,8 @@ import type {
|
|
|
8
8
|
} from '@atcute/bluesky';
|
|
9
9
|
import type { CanonicalResourceUri, Did } from '@atcute/lexicons';
|
|
10
10
|
|
|
11
|
-
import type { KeywordFilter } from './keyword-filter.
|
|
12
|
-
import type { InterpretedLabelMapping, LabelPreference } from './label.
|
|
11
|
+
import type { KeywordFilter } from './keyword-filter.ts';
|
|
12
|
+
import type { InterpretedLabelMapping, LabelPreference } from './label.ts';
|
|
13
13
|
|
|
14
14
|
export type Label = ComAtprotoLabelDefs.Label;
|
|
15
15
|
|
package/lib/ui.ts
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
LabelTarget,
|
|
7
7
|
ModerationAction,
|
|
8
8
|
MUTE_BEHAVIOR,
|
|
9
|
-
} from './behaviors.
|
|
10
|
-
import { ModerationCauseType, type ModerationCause, type ModerationDecision } from './decision.
|
|
11
|
-
import { LabelPreference } from './label.
|
|
9
|
+
} from './behaviors.ts';
|
|
10
|
+
import { ModerationCauseType, type ModerationCause, type ModerationDecision } from './decision.ts';
|
|
11
|
+
import { LabelPreference } from './label.ts';
|
|
12
12
|
|
|
13
13
|
export interface DisplayRestrictions {
|
|
14
14
|
noOverride: boolean;
|
|
@@ -171,10 +171,10 @@ export const getDisplayRestrictions = (
|
|
|
171
171
|
|
|
172
172
|
return {
|
|
173
173
|
noOverride,
|
|
174
|
-
filters: filters.sort(sortByPriority),
|
|
175
|
-
blurs: blurs.sort(sortByPriority),
|
|
176
|
-
alerts: alerts.sort(sortByPriority),
|
|
177
|
-
informs: informs.sort(sortByPriority),
|
|
174
|
+
filters: filters.sort(sortByPriority), // oxlint-disable-line unicorn/no-array-sort -- local array
|
|
175
|
+
blurs: blurs.sort(sortByPriority), // oxlint-disable-line unicorn/no-array-sort -- local array
|
|
176
|
+
alerts: alerts.sort(sortByPriority), // oxlint-disable-line unicorn/no-array-sort -- local array
|
|
177
|
+
informs: informs.sort(sortByPriority), // oxlint-disable-line unicorn/no-array-sort -- local array
|
|
178
178
|
};
|
|
179
179
|
};
|
|
180
180
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"type": "module",
|
|
3
2
|
"name": "@atcute/bluesky-moderation",
|
|
4
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
5
4
|
"description": "interprets Bluesky's content moderation labels",
|
|
6
5
|
"license": "0BSD",
|
|
7
6
|
"repository": {
|
|
@@ -12,27 +11,32 @@
|
|
|
12
11
|
"dist/",
|
|
13
12
|
"lib/",
|
|
14
13
|
"!lib/**/*.bench.ts",
|
|
15
|
-
"!lib/**/*.test.ts"
|
|
14
|
+
"!lib/**/*.test.ts",
|
|
15
|
+
"!dist/**/*.{test,bench}.*"
|
|
16
16
|
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"sideEffects": false,
|
|
17
19
|
"exports": {
|
|
18
20
|
".": "./dist/index.js"
|
|
19
21
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"@atcute/atproto": "^3.0.0",
|
|
23
|
-
"@atcute/bluesky": "^3.0.0"
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atcute/lexicons": "^1.
|
|
26
|
+
"@atcute/lexicons": "^1.3.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"@atcute/bluesky": "^3.
|
|
32
|
-
|
|
29
|
+
"vitest": "^4.1.5",
|
|
30
|
+
"@atcute/atproto": "^3.1.12",
|
|
31
|
+
"@atcute/bluesky": "^3.3.4"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@atcute/atproto": "^3.0.0",
|
|
35
|
+
"@atcute/bluesky": "^3.0.0",
|
|
36
|
+
"@atcute/lexicons": "^1.0.0"
|
|
33
37
|
},
|
|
34
38
|
"scripts": {
|
|
35
|
-
"build": "
|
|
39
|
+
"build": "tsgo",
|
|
36
40
|
"test": "vitest",
|
|
37
41
|
"prepublish": "rm -rf dist; pnpm run build"
|
|
38
42
|
}
|