@atproto/ozone 0.1.37 → 0.1.38
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 +9 -0
- package/dist/api/chat/getActorMetadata.d.ts.map +1 -1
- package/dist/api/chat/getActorMetadata.js +2 -1
- package/dist/api/chat/getActorMetadata.js.map +1 -1
- package/dist/api/chat/getMessageContext.d.ts.map +1 -1
- package/dist/api/chat/getMessageContext.js +2 -1
- package/dist/api/chat/getMessageContext.js.map +1 -1
- package/dist/api/moderation/searchRepos.d.ts.map +1 -1
- package/dist/api/moderation/searchRepos.js +2 -1
- package/dist/api/moderation/searchRepos.js.map +1 -1
- package/dist/api/proxied.d.ts.map +1 -1
- package/dist/api/proxied.js +18 -17
- package/dist/api/proxied.js.map +1 -1
- package/dist/api/util.d.ts.map +1 -1
- package/dist/api/util.js +2 -1
- package/dist/api/util.js.map +1 -1
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +2 -1
- package/dist/auth-verifier.js.map +1 -1
- package/dist/context.d.ts +4 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +10 -10
- package/dist/context.js.map +1 -1
- package/dist/daemon/context.js +2 -2
- package/dist/daemon/context.js.map +1 -1
- package/dist/daemon/event-pusher.d.ts +2 -2
- package/dist/daemon/event-pusher.d.ts.map +1 -1
- package/dist/daemon/event-pusher.js +2 -1
- package/dist/daemon/event-pusher.js.map +1 -1
- package/dist/db/migrations/20240814T003647759Z-event-created-at-index.d.ts +4 -0
- package/dist/db/migrations/20240814T003647759Z-event-created-at-index.d.ts.map +1 -0
- package/dist/db/migrations/20240814T003647759Z-event-created-at-index.js +16 -0
- package/dist/db/migrations/20240814T003647759Z-event-created-at-index.js.map +1 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +2 -1
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/mod-service/index.d.ts +2 -2
- package/dist/mod-service/index.d.ts.map +1 -1
- package/dist/mod-service/index.js +4 -3
- package/dist/mod-service/index.js.map +1 -1
- package/dist/mod-service/views.d.ts +1 -1
- package/dist/mod-service/views.d.ts.map +1 -1
- package/dist/mod-service/views.js +4 -3
- package/dist/mod-service/views.js.map +1 -1
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +2 -1
- package/dist/team/index.js.map +1 -1
- package/package.json +3 -3
- package/src/api/chat/getActorMetadata.ts +2 -1
- package/src/api/chat/getMessageContext.ts +2 -1
- package/src/api/moderation/searchRepos.ts +2 -1
- package/src/api/proxied.ts +18 -17
- package/src/api/util.ts +2 -1
- package/src/auth-verifier.ts +7 -2
- package/src/context.ts +10 -10
- package/src/daemon/context.ts +2 -2
- package/src/daemon/event-pusher.ts +9 -2
- package/src/db/migrations/20240814T003647759Z-event-created-at-index.ts +13 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/mod-service/index.ts +15 -5
- package/src/mod-service/views.ts +5 -4
- package/src/team/index.ts +2 -1
- package/tests/3p-labeler.test.ts +23 -6
- package/tests/communication-templates.test.ts +29 -7
- package/tests/get-config.test.ts +5 -1
- package/tests/get-lists.test.ts +2 -1
- package/tests/get-record.test.ts +5 -4
- package/tests/get-repo.test.ts +19 -8
- package/tests/get-starter-pack.test.ts +15 -4
- package/tests/moderation.test.ts +11 -2
- package/tests/repo-search.test.ts +4 -1
package/tests/get-repo.test.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
REASONSPAM,
|
|
12
12
|
} from '../src/lexicon/types/com/atproto/moderation/defs'
|
|
13
13
|
import { forSnapshot } from './_util'
|
|
14
|
+
import { ids } from '../src/lexicon/lexicons'
|
|
14
15
|
|
|
15
16
|
describe('admin get repo view', () => {
|
|
16
17
|
let network: TestNetwork
|
|
@@ -78,7 +79,7 @@ describe('admin get repo view', () => {
|
|
|
78
79
|
it('gets a repo by did, even when taken down.', async () => {
|
|
79
80
|
const result = await agent.api.tools.ozone.moderation.getRepo(
|
|
80
81
|
{ did: sc.dids.alice },
|
|
81
|
-
{ headers: await ozone.modHeaders() },
|
|
82
|
+
{ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRepo) },
|
|
82
83
|
)
|
|
83
84
|
expect(forSnapshot(result.data)).toMatchSnapshot()
|
|
84
85
|
})
|
|
@@ -86,15 +87,25 @@ describe('admin get repo view', () => {
|
|
|
86
87
|
it('does not include account emails for triage mods.', async () => {
|
|
87
88
|
const { data: admin } = await agent.api.tools.ozone.moderation.getRepo(
|
|
88
89
|
{ did: sc.dids.bob },
|
|
89
|
-
{ headers: await ozone.modHeaders() },
|
|
90
|
+
{ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRepo) },
|
|
90
91
|
)
|
|
91
92
|
const { data: moderator } = await agent.api.tools.ozone.moderation.getRepo(
|
|
92
93
|
{ did: sc.dids.bob },
|
|
93
|
-
{
|
|
94
|
+
{
|
|
95
|
+
headers: await ozone.modHeaders(
|
|
96
|
+
ids.ToolsOzoneModerationGetRepo,
|
|
97
|
+
'moderator',
|
|
98
|
+
),
|
|
99
|
+
},
|
|
94
100
|
)
|
|
95
101
|
const { data: triage } = await agent.api.tools.ozone.moderation.getRepo(
|
|
96
102
|
{ did: sc.dids.bob },
|
|
97
|
-
{
|
|
103
|
+
{
|
|
104
|
+
headers: await ozone.modHeaders(
|
|
105
|
+
ids.ToolsOzoneModerationGetRepo,
|
|
106
|
+
'triage',
|
|
107
|
+
),
|
|
108
|
+
},
|
|
98
109
|
)
|
|
99
110
|
expect(admin.email).toEqual('bob@test.com')
|
|
100
111
|
expect(moderator.email).toEqual('bob@test.com')
|
|
@@ -106,7 +117,7 @@ describe('admin get repo view', () => {
|
|
|
106
117
|
const { data: beforeEmailVerification } =
|
|
107
118
|
await agent.api.tools.ozone.moderation.getRepo(
|
|
108
119
|
{ did: sc.dids.bob },
|
|
109
|
-
{ headers: await ozone.modHeaders() },
|
|
120
|
+
{ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRepo) },
|
|
110
121
|
)
|
|
111
122
|
|
|
112
123
|
expect(beforeEmailVerification.emailConfirmedAt).toBeUndefined()
|
|
@@ -128,7 +139,7 @@ describe('admin get repo view', () => {
|
|
|
128
139
|
const { data: afterEmailVerification } =
|
|
129
140
|
await agent.api.tools.ozone.moderation.getRepo(
|
|
130
141
|
{ did: sc.dids.bob },
|
|
131
|
-
{ headers: await ozone.modHeaders() },
|
|
142
|
+
{ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRepo) },
|
|
132
143
|
)
|
|
133
144
|
|
|
134
145
|
expect(afterEmailVerification.emailConfirmedAt).toBeTruthy()
|
|
@@ -140,7 +151,7 @@ describe('admin get repo view', () => {
|
|
|
140
151
|
it('returns deactivation state', async () => {
|
|
141
152
|
const res = await agent.api.tools.ozone.moderation.getRepo(
|
|
142
153
|
{ did: sc.dids.dan },
|
|
143
|
-
{ headers: await ozone.modHeaders() },
|
|
154
|
+
{ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRepo) },
|
|
144
155
|
)
|
|
145
156
|
|
|
146
157
|
expect(res.data.deactivatedAt).toBeDefined()
|
|
@@ -149,7 +160,7 @@ describe('admin get repo view', () => {
|
|
|
149
160
|
it('fails when repo does not exist.', async () => {
|
|
150
161
|
const promise = agent.api.tools.ozone.moderation.getRepo(
|
|
151
162
|
{ did: 'did:plc:doesnotexist' },
|
|
152
|
-
{ headers: await ozone.modHeaders() },
|
|
163
|
+
{ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRepo) },
|
|
153
164
|
)
|
|
154
165
|
await expect(promise).rejects.toThrow('Repo not found')
|
|
155
166
|
})
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { AtpAgent } from '@atproto/api'
|
|
9
9
|
import { forSnapshot } from './_util'
|
|
10
10
|
import { TAKEDOWN_LABEL } from '../src/mod-service'
|
|
11
|
+
import { ids } from '../src/lexicon/lexicons'
|
|
11
12
|
|
|
12
13
|
describe('admin get starter pack view', () => {
|
|
13
14
|
let network: TestNetwork
|
|
@@ -51,7 +52,7 @@ describe('admin get starter pack view', () => {
|
|
|
51
52
|
it('gets a starterpack by uri', async () => {
|
|
52
53
|
const result = await agent.api.app.bsky.graph.getStarterPack(
|
|
53
54
|
{ starterPack: sp1.uriStr },
|
|
54
|
-
{ headers: await ozone.modHeaders() },
|
|
55
|
+
{ headers: await ozone.modHeaders(ids.AppBskyGraphGetStarterPack) },
|
|
55
56
|
)
|
|
56
57
|
expect(forSnapshot(result.data)).toMatchSnapshot()
|
|
57
58
|
})
|
|
@@ -62,7 +63,12 @@ describe('admin get starter pack view', () => {
|
|
|
62
63
|
const beforeTakedownFromAppview =
|
|
63
64
|
await appviewAgent.api.app.bsky.graph.getStarterPack(
|
|
64
65
|
{ starterPack: sp1.uriStr },
|
|
65
|
-
{
|
|
66
|
+
{
|
|
67
|
+
headers: await network.serviceHeaders(
|
|
68
|
+
sc.dids.alice,
|
|
69
|
+
ids.AppBskyGraphGetStarterPack,
|
|
70
|
+
),
|
|
71
|
+
},
|
|
66
72
|
)
|
|
67
73
|
|
|
68
74
|
expect(
|
|
@@ -84,7 +90,7 @@ describe('admin get starter pack view', () => {
|
|
|
84
90
|
const afterTakedownFromOzone =
|
|
85
91
|
await agent.api.app.bsky.graph.getStarterPack(
|
|
86
92
|
{ starterPack: sp1.uriStr },
|
|
87
|
-
{ headers: await ozone.modHeaders() },
|
|
93
|
+
{ headers: await ozone.modHeaders(ids.AppBskyGraphGetStarterPack) },
|
|
88
94
|
)
|
|
89
95
|
|
|
90
96
|
// validate that ozone returns starterpacks after takedown
|
|
@@ -96,7 +102,12 @@ describe('admin get starter pack view', () => {
|
|
|
96
102
|
await expect(
|
|
97
103
|
appviewAgent.api.app.bsky.graph.getStarterPack(
|
|
98
104
|
{ starterPack: sp1.uriStr },
|
|
99
|
-
{
|
|
105
|
+
{
|
|
106
|
+
headers: await network.serviceHeaders(
|
|
107
|
+
sc.dids.alice,
|
|
108
|
+
ids.AppBskyGraphGetStarterPack,
|
|
109
|
+
),
|
|
110
|
+
},
|
|
100
111
|
),
|
|
101
112
|
).rejects.toThrow('Starter pack not found')
|
|
102
113
|
})
|
package/tests/moderation.test.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
import { EventReverser } from '../src'
|
|
24
24
|
import { ImageInvalidator } from '../src/image-invalidator'
|
|
25
25
|
import { TAKEDOWN_LABEL } from '../src/mod-service'
|
|
26
|
+
import { ids } from '../src/lexicon/lexicons'
|
|
26
27
|
|
|
27
28
|
describe('moderation', () => {
|
|
28
29
|
let network: TestNetwork
|
|
@@ -741,7 +742,11 @@ describe('moderation', () => {
|
|
|
741
742
|
async function getRecordLabels(uri: string) {
|
|
742
743
|
const result = await agent.api.tools.ozone.moderation.getRecord(
|
|
743
744
|
{ uri },
|
|
744
|
-
{
|
|
745
|
+
{
|
|
746
|
+
headers: await network.ozone.modHeaders(
|
|
747
|
+
ids.ToolsOzoneModerationGetRecord,
|
|
748
|
+
),
|
|
749
|
+
},
|
|
745
750
|
)
|
|
746
751
|
const labels = result.data.labels ?? []
|
|
747
752
|
return labels.map((l) => l.val)
|
|
@@ -750,7 +755,11 @@ describe('moderation', () => {
|
|
|
750
755
|
async function getRepoLabels(did: string) {
|
|
751
756
|
const result = await agent.api.tools.ozone.moderation.getRepo(
|
|
752
757
|
{ did },
|
|
753
|
-
{
|
|
758
|
+
{
|
|
759
|
+
headers: await network.ozone.modHeaders(
|
|
760
|
+
ids.ToolsOzoneModerationGetRepo,
|
|
761
|
+
),
|
|
762
|
+
},
|
|
754
763
|
)
|
|
755
764
|
const labels = result.data.labels ?? []
|
|
756
765
|
return labels.map((l) => l.val)
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from '@atproto/dev-env'
|
|
7
7
|
import { AtpAgent } from '@atproto/api'
|
|
8
8
|
import { paginateAll } from './_util'
|
|
9
|
+
import { ids } from '../src/lexicon/lexicons'
|
|
9
10
|
|
|
10
11
|
describe('admin repo search view', () => {
|
|
11
12
|
let network: TestNetwork
|
|
@@ -22,7 +23,9 @@ describe('admin repo search view', () => {
|
|
|
22
23
|
sc = network.getSeedClient()
|
|
23
24
|
modClient = network.ozone.getModClient()
|
|
24
25
|
await usersBulkSeed(sc)
|
|
25
|
-
headers = await network.ozone.modHeaders(
|
|
26
|
+
headers = await network.ozone.modHeaders(
|
|
27
|
+
ids.ToolsOzoneModerationSearchRepos,
|
|
28
|
+
)
|
|
26
29
|
await network.processAll()
|
|
27
30
|
})
|
|
28
31
|
|