@atcute/bluesky-moderation 2.0.3 → 3.0.0
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 +2735 -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 +22 -18
- package/dist/behaviors.d.ts.map +1 -0
- package/dist/behaviors.js +18 -21
- package/dist/behaviors.js.map +1 -1
- package/dist/decision.d.ts +26 -24
- package/dist/decision.d.ts.map +1 -0
- package/dist/decision.js +14 -16
- package/dist/decision.js.map +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.d.ts.map +1 -0
- package/dist/internal/keyword-filter.d.ts +4 -3
- package/dist/internal/keyword-filter.d.ts.map +1 -0
- package/dist/internal/keyword-filter.js.map +1 -1
- package/dist/keyword-filter.d.ts +8 -6
- package/dist/keyword-filter.d.ts.map +1 -0
- package/dist/keyword-filter.js +8 -7
- package/dist/keyword-filter.js.map +1 -1
- package/dist/label.d.ts +31 -27
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +24 -28
- package/dist/label.js.map +1 -1
- package/dist/subjects/feed-generator.d.ts +4 -3
- package/dist/subjects/feed-generator.d.ts.map +1 -0
- package/dist/subjects/feed-generator.js.map +1 -1
- package/dist/subjects/list.d.ts +3 -2
- package/dist/subjects/list.d.ts.map +1 -0
- package/dist/subjects/list.js.map +1 -1
- package/dist/subjects/notification.d.ts +4 -3
- package/dist/subjects/notification.d.ts.map +1 -0
- package/dist/subjects/notification.js.map +1 -1
- package/dist/subjects/post.d.ts +5 -3
- package/dist/subjects/post.d.ts.map +1 -0
- package/dist/subjects/post.js.map +1 -1
- package/dist/subjects/profile.d.ts +3 -2
- package/dist/subjects/profile.d.ts.map +1 -0
- package/dist/subjects/profile.js.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -0
- package/dist/ui.d.ts +3 -2
- package/dist/ui.d.ts.map +1 -0
- 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 +14 -12
package/lib/decision.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import type { AppBskyGraphDefs } from '@atcute/bluesky';
|
|
2
2
|
import type { Did } from '@atcute/lexicons';
|
|
3
3
|
|
|
4
|
-
import { DisplayContext, ModerationAction, type BehaviorMapping, type LabelTarget } from './behaviors.
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
import type { KeywordFilter } from './keyword-filter.js';
|
|
4
|
+
import { DisplayContext, ModerationAction, type BehaviorMapping, type LabelTarget } from './behaviors.ts';
|
|
5
|
+
import type { KeywordFilter } from './keyword-filter.ts';
|
|
8
6
|
import {
|
|
9
7
|
BUILTIN_LABELS,
|
|
10
8
|
isCustomLabelValue,
|
|
11
9
|
LabelFlags,
|
|
12
10
|
LabelPreference,
|
|
13
11
|
type InterpretedLabelDefinition,
|
|
14
|
-
} from './label.
|
|
12
|
+
} from './label.ts';
|
|
13
|
+
import type { Label, LabelerPreference, ModerationOptions } from './types.ts';
|
|
15
14
|
|
|
16
|
-
const
|
|
17
|
-
High
|
|
18
|
-
Medium
|
|
19
|
-
Low
|
|
20
|
-
}
|
|
15
|
+
const ModerationSeverity = {
|
|
16
|
+
High: 1,
|
|
17
|
+
Medium: 2,
|
|
18
|
+
Low: 3,
|
|
19
|
+
} as const;
|
|
21
20
|
|
|
22
|
-
export
|
|
21
|
+
export const ModerationCauseType = {
|
|
23
22
|
/** caused by a label */
|
|
24
|
-
Label
|
|
23
|
+
Label: 1,
|
|
25
24
|
/** caused by viewer blocking the subject */
|
|
26
|
-
Blocking
|
|
25
|
+
Blocking: 2,
|
|
27
26
|
/** caused by subject blocking the viewer */
|
|
28
|
-
BlockedBy
|
|
27
|
+
BlockedBy: 3,
|
|
29
28
|
/** caused by viewer having a (permanent) mute on subject */
|
|
30
|
-
MutedPermanent
|
|
29
|
+
MutedPermanent: 4,
|
|
31
30
|
/** caused by a temporary mute */
|
|
32
|
-
MutedTemporary
|
|
31
|
+
MutedTemporary: 5,
|
|
33
32
|
/** caused by a keyword mute */
|
|
34
|
-
MutedKeyword
|
|
33
|
+
MutedKeyword: 6,
|
|
35
34
|
/** caused by a hidden post */
|
|
36
|
-
Hidden
|
|
37
|
-
}
|
|
35
|
+
Hidden: 7,
|
|
36
|
+
} as const;
|
|
37
|
+
export type ModerationCauseType = (typeof ModerationCauseType)[keyof typeof ModerationCauseType];
|
|
38
38
|
|
|
39
39
|
export interface BlockingModerationCause {
|
|
40
|
-
type: ModerationCauseType.Blocking;
|
|
40
|
+
type: typeof ModerationCauseType.Blocking;
|
|
41
41
|
priority: 3;
|
|
42
42
|
source: AppBskyGraphDefs.ListViewBasic | null;
|
|
43
43
|
|
|
@@ -45,21 +45,21 @@ export interface BlockingModerationCause {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface BlockedByModerationCause {
|
|
48
|
-
type: ModerationCauseType.BlockedBy;
|
|
48
|
+
type: typeof ModerationCauseType.BlockedBy;
|
|
49
49
|
priority: 4;
|
|
50
50
|
|
|
51
51
|
downgraded: boolean;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export interface HiddenModerationCause {
|
|
55
|
-
type: ModerationCauseType.Hidden;
|
|
55
|
+
type: typeof ModerationCauseType.Hidden;
|
|
56
56
|
priority: 6;
|
|
57
57
|
|
|
58
58
|
downgraded: boolean;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export interface LabelModerationCause {
|
|
62
|
-
type: ModerationCauseType.Label;
|
|
62
|
+
type: typeof ModerationCauseType.Label;
|
|
63
63
|
priority: 1 | 2 | 5 | 7 | 8;
|
|
64
64
|
source: Did | null;
|
|
65
65
|
|
|
@@ -75,7 +75,7 @@ export interface LabelModerationCause {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export interface MutedPermanentModerationCause {
|
|
78
|
-
type: ModerationCauseType.MutedPermanent;
|
|
78
|
+
type: typeof ModerationCauseType.MutedPermanent;
|
|
79
79
|
priority: 6;
|
|
80
80
|
source: AppBskyGraphDefs.ListViewBasic | null;
|
|
81
81
|
|
|
@@ -83,14 +83,14 @@ export interface MutedPermanentModerationCause {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export interface MutedTemporaryModerationCause {
|
|
86
|
-
type: ModerationCauseType.MutedTemporary;
|
|
86
|
+
type: typeof ModerationCauseType.MutedTemporary;
|
|
87
87
|
priority: 6;
|
|
88
88
|
|
|
89
89
|
downgraded: boolean;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export interface MutedKeywordModerationCause {
|
|
93
|
-
type: ModerationCauseType.MutedKeyword;
|
|
93
|
+
type: typeof ModerationCauseType.MutedKeyword;
|
|
94
94
|
priority: 6;
|
|
95
95
|
source: KeywordFilter;
|
|
96
96
|
|
package/lib/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ export {
|
|
|
4
4
|
ModerationAction,
|
|
5
5
|
type BehaviorMapping,
|
|
6
6
|
type LabelBehaviorMatrix,
|
|
7
|
-
} from './behaviors.
|
|
7
|
+
} from './behaviors.ts';
|
|
8
8
|
export {
|
|
9
9
|
ModerationCauseType,
|
|
10
10
|
type BlockedByModerationCause,
|
|
@@ -16,7 +16,7 @@ export {
|
|
|
16
16
|
type MutedKeywordModerationCause,
|
|
17
17
|
type MutedPermanentModerationCause,
|
|
18
18
|
type MutedTemporaryModerationCause,
|
|
19
|
-
} from './decision.
|
|
19
|
+
} from './decision.ts';
|
|
20
20
|
|
|
21
21
|
export {
|
|
22
22
|
createKeywordPattern,
|
|
@@ -25,7 +25,7 @@ export {
|
|
|
25
25
|
KeywordFilterFlags,
|
|
26
26
|
type KeywordFilter,
|
|
27
27
|
type KeywordMatch,
|
|
28
|
-
} from './keyword-filter.
|
|
28
|
+
} from './keyword-filter.ts';
|
|
29
29
|
export {
|
|
30
30
|
BlurLevel,
|
|
31
31
|
interpretLabelerDefinition,
|
|
@@ -38,7 +38,7 @@ export {
|
|
|
38
38
|
type InterpretedLabelDefinition,
|
|
39
39
|
type InterpretedLabelMapping,
|
|
40
40
|
type LabelLocale,
|
|
41
|
-
} from './label.
|
|
41
|
+
} from './label.ts';
|
|
42
42
|
|
|
43
43
|
export {
|
|
44
44
|
type FeedGeneratorSubject,
|
|
@@ -50,12 +50,12 @@ export {
|
|
|
50
50
|
type NotificationSubject,
|
|
51
51
|
type PostSubject,
|
|
52
52
|
type ProfileSubject,
|
|
53
|
-
} from './types.
|
|
53
|
+
} from './types.ts';
|
|
54
54
|
|
|
55
|
-
export { getDisplayRestrictions, type DisplayRestrictions } from './ui.
|
|
55
|
+
export { getDisplayRestrictions, type DisplayRestrictions } from './ui.ts';
|
|
56
56
|
|
|
57
|
-
export { moderateFeedGenerator } from './subjects/feed-generator.
|
|
58
|
-
export { moderateList } from './subjects/list.
|
|
59
|
-
export { moderateNotification } from './subjects/notification.
|
|
60
|
-
export { moderatePost } from './subjects/post.
|
|
61
|
-
export { moderateProfile } from './subjects/profile.
|
|
57
|
+
export { moderateFeedGenerator } from './subjects/feed-generator.ts';
|
|
58
|
+
export { moderateList } from './subjects/list.ts';
|
|
59
|
+
export { moderateNotification } from './subjects/notification.ts';
|
|
60
|
+
export { moderatePost } from './subjects/post.ts';
|
|
61
|
+
export { moderateProfile } from './subjects/profile.ts';
|
package/lib/keyword-filter.ts
CHANGED
|
@@ -28,7 +28,9 @@ export const createKeywordPattern = (matchers: KeywordMatch | KeywordMatch[]): R
|
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
if (re) {
|
|
32
|
+
re += '|';
|
|
33
|
+
}
|
|
32
34
|
|
|
33
35
|
if (whole && WORD_CHAR_RE.test(value.at(0)!)) {
|
|
34
36
|
re += '\\b';
|
|
@@ -49,14 +51,15 @@ const escape = (str: string) => {
|
|
|
49
51
|
return str.replace(ESCAPE_RE, '\\$&');
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
export
|
|
54
|
+
export const KeywordFilterFlags = {
|
|
53
55
|
/** filter applies to content */
|
|
54
|
-
ApplyContent
|
|
56
|
+
ApplyContent: 1 << 0,
|
|
55
57
|
/** filter applies to tags */
|
|
56
|
-
ApplyTopic
|
|
58
|
+
ApplyTopic: 1 << 1,
|
|
57
59
|
/** filter shouldn't apply to following users */
|
|
58
|
-
NoFollowing
|
|
59
|
-
}
|
|
60
|
+
NoFollowing: 1 << 2,
|
|
61
|
+
} as const;
|
|
62
|
+
export type KeywordFilterFlags = (typeof KeywordFilterFlags)[keyof typeof KeywordFilterFlags];
|
|
60
63
|
|
|
61
64
|
export interface KeywordFilter {
|
|
62
65
|
/** unique identifier for this filter */
|
package/lib/label.ts
CHANGED
|
@@ -2,53 +2,57 @@ import type { ComAtprotoLabelDefs } from '@atcute/atproto';
|
|
|
2
2
|
import type { AppBskyLabelerDefs } from '@atcute/bluesky';
|
|
3
3
|
import type { Did } from '@atcute/lexicons';
|
|
4
4
|
|
|
5
|
-
import { DisplayContext, LabelTarget, ModerationAction, type LabelBehaviorMatrix } from './behaviors.
|
|
5
|
+
import { DisplayContext, LabelTarget, ModerationAction, type LabelBehaviorMatrix } from './behaviors.ts';
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const LabelPreference = {
|
|
8
8
|
/** ignore this label */
|
|
9
|
-
Ignore
|
|
9
|
+
Ignore: 'ignore',
|
|
10
10
|
/** warn when viewing content or profile with this label */
|
|
11
|
-
Warn
|
|
11
|
+
Warn: 'warn',
|
|
12
12
|
/** hide content or profile containing this label */
|
|
13
|
-
Hide
|
|
14
|
-
}
|
|
13
|
+
Hide: 'hide',
|
|
14
|
+
} as const;
|
|
15
|
+
export type LabelPreference = (typeof LabelPreference)[keyof typeof LabelPreference];
|
|
15
16
|
|
|
16
|
-
export
|
|
17
|
+
export const LabelFlags = {
|
|
17
18
|
/** no flags */
|
|
18
|
-
None
|
|
19
|
+
None: 0,
|
|
19
20
|
|
|
20
21
|
/** unblurring shouldn't be allowed */
|
|
21
|
-
NoOverride
|
|
22
|
+
NoOverride: 1 << 0,
|
|
22
23
|
/** label can't be configured */
|
|
23
|
-
NoConfigurable
|
|
24
|
+
NoConfigurable: 1 << 1,
|
|
24
25
|
/** label can't be applied as a self-label */
|
|
25
|
-
NoSelf
|
|
26
|
+
NoSelf: 1 << 2,
|
|
26
27
|
/** label is adult-only */
|
|
27
|
-
AdultOnly
|
|
28
|
+
AdultOnly: 1 << 3,
|
|
28
29
|
/** label can't be applied if authenticated */
|
|
29
|
-
UnauthenticatedOnly
|
|
30
|
-
}
|
|
30
|
+
UnauthenticatedOnly: 1 << 4,
|
|
31
|
+
} as const;
|
|
32
|
+
export type LabelFlags = (typeof LabelFlags)[keyof typeof LabelFlags];
|
|
31
33
|
|
|
32
|
-
export
|
|
34
|
+
export const BlurLevel = {
|
|
33
35
|
/** don't blur any parts of the content */
|
|
34
|
-
None
|
|
36
|
+
None: 'none',
|
|
35
37
|
/** only blur the media present in the content */
|
|
36
|
-
Media
|
|
38
|
+
Media: 'media',
|
|
37
39
|
/** blur the entire content */
|
|
38
|
-
Content
|
|
40
|
+
Content: 'content',
|
|
39
41
|
|
|
40
42
|
/** special blur value, guaranteed blurring of profile and content */
|
|
41
|
-
Forced
|
|
42
|
-
}
|
|
43
|
+
Forced: 'forced',
|
|
44
|
+
} as const;
|
|
45
|
+
export type BlurLevel = (typeof BlurLevel)[keyof typeof BlurLevel];
|
|
43
46
|
|
|
44
|
-
export
|
|
47
|
+
export const SeverityLevel = {
|
|
45
48
|
/** don't inform the user */
|
|
46
|
-
None
|
|
49
|
+
None: 'none',
|
|
47
50
|
/** lightly inform the user about this label's presence */
|
|
48
|
-
Inform
|
|
51
|
+
Inform: 'inform',
|
|
49
52
|
/** alert the user about this label's presence */
|
|
50
|
-
Alert
|
|
51
|
-
}
|
|
53
|
+
Alert: 'alert',
|
|
54
|
+
} as const;
|
|
55
|
+
export type SeverityLevel = (typeof SeverityLevel)[keyof typeof SeverityLevel];
|
|
52
56
|
|
|
53
57
|
export interface LabelLocale {
|
|
54
58
|
/** language code */
|
|
@@ -253,9 +257,9 @@ export const isCustomLabelValue = (value: string): boolean => {
|
|
|
253
257
|
export const interpretLabelValueDefinition = (
|
|
254
258
|
def: ComAtprotoLabelDefs.LabelValueDefinition,
|
|
255
259
|
): InterpretedLabelDefinition => {
|
|
256
|
-
let defaultPref = LabelPreference.Warn;
|
|
257
|
-
let blur = BlurLevel.None;
|
|
258
|
-
let severity = SeverityLevel.None;
|
|
260
|
+
let defaultPref: LabelPreference = LabelPreference.Warn;
|
|
261
|
+
let blur: BlurLevel = BlurLevel.None;
|
|
262
|
+
let severity: SeverityLevel = SeverityLevel.None;
|
|
259
263
|
let flags = LabelFlags.NoSelf;
|
|
260
264
|
|
|
261
265
|
switch (def.blurs) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { LabelTarget } from '../behaviors.
|
|
1
|
+
import { LabelTarget } from '../behaviors.ts';
|
|
2
2
|
import {
|
|
3
3
|
considerLabels,
|
|
4
4
|
createModerationDecision,
|
|
5
5
|
mergeModerationDecisions,
|
|
6
6
|
type ModerationDecision,
|
|
7
|
-
} from '../decision.
|
|
8
|
-
import type { FeedGeneratorSubject, ModerationOptions } from '../types.
|
|
7
|
+
} from '../decision.ts';
|
|
8
|
+
import type { FeedGeneratorSubject, ModerationOptions } from '../types.ts';
|
|
9
9
|
|
|
10
|
-
import { moderateProfile } from './profile.
|
|
10
|
+
import { moderateProfile } from './profile.ts';
|
|
11
11
|
|
|
12
12
|
export const moderateFeedGenerator = (
|
|
13
13
|
subject: FeedGeneratorSubject,
|
package/lib/subjects/list.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { parseCanonicalResourceUri } from '@atcute/lexicons';
|
|
2
2
|
|
|
3
|
-
import { LabelTarget } from '../behaviors.
|
|
3
|
+
import { LabelTarget } from '../behaviors.ts';
|
|
4
4
|
import {
|
|
5
5
|
considerLabels,
|
|
6
6
|
createModerationDecision,
|
|
7
7
|
mergeModerationDecisions,
|
|
8
8
|
type ModerationDecision,
|
|
9
|
-
} from '../decision.
|
|
10
|
-
import type { ListSubject, ModerationOptions } from '../types.
|
|
9
|
+
} from '../decision.ts';
|
|
10
|
+
import type { ListSubject, ModerationOptions } from '../types.ts';
|
|
11
11
|
|
|
12
|
-
import { moderateProfile } from './profile.
|
|
12
|
+
import { moderateProfile } from './profile.ts';
|
|
13
13
|
|
|
14
14
|
export const moderateList = (subject: ListSubject, opts: ModerationOptions): ModerationDecision => {
|
|
15
15
|
if ('creator' in subject) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { LabelTarget } from '../behaviors.
|
|
1
|
+
import { LabelTarget } from '../behaviors.ts';
|
|
2
2
|
import {
|
|
3
3
|
considerLabels,
|
|
4
4
|
createModerationDecision,
|
|
5
5
|
mergeModerationDecisions,
|
|
6
6
|
type ModerationDecision,
|
|
7
|
-
} from '../decision.
|
|
8
|
-
import type { ModerationOptions, NotificationSubject } from '../types.
|
|
7
|
+
} from '../decision.ts';
|
|
8
|
+
import type { ModerationOptions, NotificationSubject } from '../types.ts';
|
|
9
9
|
|
|
10
|
-
import { moderateProfile } from './profile.
|
|
10
|
+
import { moderateProfile } from './profile.ts';
|
|
11
11
|
|
|
12
12
|
export const moderateNotification = (
|
|
13
13
|
subject: NotificationSubject,
|
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.0",
|
|
5
4
|
"description": "interprets Bluesky's content moderation labels",
|
|
6
5
|
"license": "0BSD",
|
|
7
6
|
"repository": {
|
|
@@ -14,25 +13,28 @@
|
|
|
14
13
|
"!lib/**/*.bench.ts",
|
|
15
14
|
"!lib/**/*.test.ts"
|
|
16
15
|
],
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": false,
|
|
17
18
|
"exports": {
|
|
18
19
|
".": "./dist/index.js"
|
|
19
20
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"@atcute/atproto": "^3.0.0",
|
|
23
|
-
"@atcute/bluesky": "^3.0.0"
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@atcute/lexicons": "^1.
|
|
25
|
+
"@atcute/lexicons": "^1.2.9"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"@atcute/bluesky": "^3.2.
|
|
32
|
-
|
|
28
|
+
"vitest": "^4.0.18",
|
|
29
|
+
"@atcute/atproto": "^3.1.10",
|
|
30
|
+
"@atcute/bluesky": "^3.2.20"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@atcute/atproto": "^3.0.0",
|
|
34
|
+
"@atcute/bluesky": "^3.0.0"
|
|
33
35
|
},
|
|
34
36
|
"scripts": {
|
|
35
|
-
"build": "
|
|
37
|
+
"build": "tsgo --project tsconfig.build.json",
|
|
36
38
|
"test": "vitest",
|
|
37
39
|
"prepublish": "rm -rf dist; pnpm run build"
|
|
38
40
|
}
|