@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.
Files changed (60) hide show
  1. package/README.md +126 -128
  2. package/dist/_test-util/mock.d.ts +58 -0
  3. package/dist/_test-util/mock.d.ts.map +1 -0
  4. package/dist/_test-util/mock.js +109 -0
  5. package/dist/_test-util/mock.js.map +1 -0
  6. package/dist/_test-util/moderation-behavior.d.ts +57 -0
  7. package/dist/_test-util/moderation-behavior.d.ts.map +1 -0
  8. package/dist/_test-util/moderation-behavior.js +158 -0
  9. package/dist/_test-util/moderation-behavior.js.map +1 -0
  10. package/dist/behaviors.d.ts +21 -18
  11. package/dist/behaviors.d.ts.map +1 -1
  12. package/dist/behaviors.js +18 -21
  13. package/dist/behaviors.js.map +1 -1
  14. package/dist/decision.d.ts +21 -20
  15. package/dist/decision.d.ts.map +1 -1
  16. package/dist/decision.js +14 -16
  17. package/dist/decision.js.map +1 -1
  18. package/dist/index.d.ts +11 -11
  19. package/dist/internal/keyword-filter.d.ts +1 -1
  20. package/dist/internal/keyword-filter.d.ts.map +1 -1
  21. package/dist/keyword-filter.d.ts +6 -5
  22. package/dist/keyword-filter.d.ts.map +1 -1
  23. package/dist/keyword-filter.js +8 -7
  24. package/dist/keyword-filter.js.map +1 -1
  25. package/dist/label.d.ts +29 -25
  26. package/dist/label.d.ts.map +1 -1
  27. package/dist/label.js +24 -28
  28. package/dist/label.js.map +1 -1
  29. package/dist/subjects/feed-generator.d.ts +2 -2
  30. package/dist/subjects/feed-generator.d.ts.map +1 -1
  31. package/dist/subjects/list.d.ts +2 -2
  32. package/dist/subjects/list.d.ts.map +1 -1
  33. package/dist/subjects/notification.d.ts +2 -2
  34. package/dist/subjects/notification.d.ts.map +1 -1
  35. package/dist/subjects/post.d.ts +2 -2
  36. package/dist/subjects/post.d.ts.map +1 -1
  37. package/dist/subjects/post.js.map +1 -1
  38. package/dist/subjects/profile.d.ts +2 -2
  39. package/dist/subjects/profile.d.ts.map +1 -1
  40. package/dist/types.d.ts +2 -2
  41. package/dist/ui.d.ts +2 -2
  42. package/dist/ui.d.ts.map +1 -1
  43. package/dist/ui.js +4 -4
  44. package/dist/ui.js.map +1 -1
  45. package/lib/_test-util/mock.ts +214 -0
  46. package/lib/_test-util/moderation-behavior.ts +259 -0
  47. package/lib/behaviors.ts +21 -18
  48. package/lib/decision.ts +26 -26
  49. package/lib/index.ts +11 -11
  50. package/lib/internal/keyword-filter.ts +1 -1
  51. package/lib/keyword-filter.ts +9 -6
  52. package/lib/label.ts +32 -28
  53. package/lib/subjects/feed-generator.ts +4 -4
  54. package/lib/subjects/list.ts +4 -4
  55. package/lib/subjects/notification.ts +4 -4
  56. package/lib/subjects/post.ts +6 -7
  57. package/lib/subjects/profile.ts +3 -3
  58. package/lib/types.ts +2 -2
  59. package/lib/ui.ts +7 -7
  60. package/package.json +17 -13
@@ -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.js';
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.js';
23
- import type { ModerationOptions, PostSubject } from '../types.js';
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 { matchesKeywordFilters } from '../internal/keyword-filter.js';
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(
@@ -1,4 +1,4 @@
1
- import { LabelTarget } from '../behaviors.js';
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.js';
10
- import type { ModerationOptions, ProfileSubject } from '../types.js';
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.js';
12
- import type { InterpretedLabelMapping, LabelPreference } from './label.js';
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.js';
10
- import { ModerationCauseType, type ModerationCause, type ModerationDecision } from './decision.js';
11
- import { LabelPreference } from './label.js';
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": "2.0.4",
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
- "sideEffects": false,
21
- "peerDependencies": {
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.2.2"
26
+ "@atcute/lexicons": "^1.3.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@types/bun": "^1.2.21",
30
- "vitest": "^3.2.4",
31
- "@atcute/bluesky": "^3.2.5",
32
- "@atcute/atproto": "^3.1.6"
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": "tsc --project tsconfig.build.json",
39
+ "build": "tsgo",
36
40
  "test": "vitest",
37
41
  "prepublish": "rm -rf dist; pnpm run build"
38
42
  }