@atproto/dev-env 0.3.215 → 0.4.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/CHANGELOG.md +18 -0
- package/bin.js +12 -0
- package/dist/bin.js +0 -0
- package/dist/bsky.d.ts +3 -1
- package/dist/bsky.d.ts.map +1 -1
- package/dist/bsky.js +7 -1
- package/dist/bsky.js.map +1 -1
- package/dist/feed-gen.d.ts.map +1 -1
- package/dist/feed-gen.js +7 -10
- package/dist/feed-gen.js.map +1 -1
- package/dist/mock/index.js +5 -5
- package/dist/mock/index.js.map +1 -1
- package/dist/moderator-client.js +1 -1
- package/dist/moderator-client.js.map +1 -1
- package/dist/network-no-appview.d.ts.map +1 -1
- package/dist/network-no-appview.js +3 -2
- package/dist/network-no-appview.js.map +1 -1
- package/dist/ozone.d.ts +1 -1
- package/dist/ozone.d.ts.map +1 -1
- package/dist/ozone.js +1 -1
- package/dist/ozone.js.map +1 -1
- package/dist/pds.d.ts +3 -1
- package/dist/pds.d.ts.map +1 -1
- package/dist/pds.js +7 -1
- package/dist/pds.js.map +1 -1
- package/dist/seed/client.d.ts +11 -9
- package/dist/seed/client.d.ts.map +1 -1
- package/dist/seed/client.js +10 -2
- package/dist/seed/client.js.map +1 -1
- package/dist/service-profile-lexicon.js +5 -5
- package/dist/service-profile-lexicon.js.map +1 -1
- package/dist/service-profile-ozone.d.ts +1 -1
- package/dist/service-profile-ozone.d.ts.map +1 -1
- package/dist/service-profile-ozone.js +8 -8
- package/dist/service-profile-ozone.js.map +1 -1
- package/dist/service-profile.d.ts +4 -3
- package/dist/service-profile.d.ts.map +1 -1
- package/dist/service-profile.js +16 -16
- package/dist/service-profile.js.map +1 -1
- package/package.json +10 -9
- package/src/bsky.ts +8 -1
- package/src/feed-gen.ts +17 -16
- package/src/mock/index.ts +10 -10
- package/src/moderator-client.ts +1 -1
- package/src/network-no-appview.ts +3 -2
- package/src/ozone.ts +1 -1
- package/src/pds.ts +8 -1
- package/src/seed/client.ts +11 -7
- package/src/service-profile-lexicon.ts +5 -5
- package/src/service-profile-ozone.ts +8 -8
- package/src/service-profile.ts +16 -15
|
@@ -17,26 +17,26 @@ export class OzoneServiceProfile extends ServiceProfile {
|
|
|
17
17
|
password: 'hunter2',
|
|
18
18
|
},
|
|
19
19
|
) {
|
|
20
|
-
const
|
|
21
|
-
await
|
|
20
|
+
const agent = pds.getAgent()
|
|
21
|
+
await agent.createAccount(userDetails)
|
|
22
22
|
|
|
23
23
|
const key = await Secp256k1Keypair.create({ exportable: true })
|
|
24
24
|
|
|
25
|
-
return new OzoneServiceProfile(pds,
|
|
25
|
+
return new OzoneServiceProfile(pds, agent, userDetails, ozoneUrl, key)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
protected constructor(
|
|
29
29
|
pds: TestPds,
|
|
30
|
-
|
|
30
|
+
agent: AtpAgent,
|
|
31
31
|
userDetails: ServiceUserDetails,
|
|
32
32
|
readonly ozoneUrl: string,
|
|
33
33
|
readonly key: Secp256k1Keypair,
|
|
34
34
|
) {
|
|
35
|
-
super(pds,
|
|
35
|
+
super(pds, agent, userDetails)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
async createAppPasswordForVerification() {
|
|
39
|
-
const { data } = await this.
|
|
39
|
+
const { data } = await this.agent.com.atproto.server.createAppPassword({
|
|
40
40
|
name: 'ozone-verifier',
|
|
41
41
|
})
|
|
42
42
|
return data.password
|
|
@@ -60,7 +60,7 @@ export class OzoneServiceProfile extends ServiceProfile {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
async createRecords() {
|
|
63
|
-
await this.
|
|
63
|
+
await this.agent.app.bsky.actor.profile.create(
|
|
64
64
|
{ repo: this.did },
|
|
65
65
|
{
|
|
66
66
|
displayName: 'Dev-env Moderation',
|
|
@@ -68,7 +68,7 @@ export class OzoneServiceProfile extends ServiceProfile {
|
|
|
68
68
|
},
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
await this.
|
|
71
|
+
await this.agent.app.bsky.labeler.service.create(
|
|
72
72
|
{ repo: this.did, rkey: 'self' },
|
|
73
73
|
{
|
|
74
74
|
policies: {
|
package/src/service-profile.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AtpAgent } from '@atproto/api'
|
|
2
|
+
import { DidString } from '@atproto/lex'
|
|
2
3
|
import { TestPds } from './pds'
|
|
3
4
|
|
|
4
5
|
export type ServiceUserDetails = {
|
|
@@ -16,25 +17,25 @@ export class ServiceProfile {
|
|
|
16
17
|
protected constructor(
|
|
17
18
|
protected pds: TestPds,
|
|
18
19
|
/** @note assumes the session is already authenticated */
|
|
19
|
-
protected
|
|
20
|
+
protected agent: AtpAgent,
|
|
20
21
|
protected userDetails: ServiceUserDetails,
|
|
21
22
|
) {}
|
|
22
23
|
|
|
23
|
-
get did() {
|
|
24
|
-
return this.
|
|
24
|
+
get did(): DidString {
|
|
25
|
+
return this.agent.assertDid
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
async migrateTo(newPds: TestPds, options: ServiceMigrationOptions = {}) {
|
|
28
|
-
const
|
|
29
|
+
const newAgent = newPds.getAgent()
|
|
29
30
|
|
|
30
|
-
const newPdsDesc = await
|
|
31
|
-
const serviceAuth = await this.
|
|
31
|
+
const newPdsDesc = await newAgent.com.atproto.server.describeServer()
|
|
32
|
+
const serviceAuth = await this.agent.com.atproto.server.getServiceAuth({
|
|
32
33
|
aud: newPdsDesc.data.did,
|
|
33
34
|
lxm: 'com.atproto.server.createAccount',
|
|
34
35
|
})
|
|
35
36
|
|
|
36
37
|
const inviteCode = newPds.ctx.cfg.invites.required
|
|
37
|
-
? await
|
|
38
|
+
? await newAgent.com.atproto.server
|
|
38
39
|
.createInviteCode(
|
|
39
40
|
{ useCount: 1 },
|
|
40
41
|
{
|
|
@@ -45,7 +46,7 @@ export class ServiceProfile {
|
|
|
45
46
|
.then((res) => res.data.code)
|
|
46
47
|
: undefined
|
|
47
48
|
|
|
48
|
-
await
|
|
49
|
+
await newAgent.createAccount(
|
|
49
50
|
{
|
|
50
51
|
...this.userDetails,
|
|
51
52
|
inviteCode,
|
|
@@ -62,12 +63,12 @@ export class ServiceProfile {
|
|
|
62
63
|
// process of migrating, that didDoc references the old PDS. In order to
|
|
63
64
|
// avoid calling the old PDS, let's clear the pdsUrl, which will result in
|
|
64
65
|
// the (new) serviceUrl being used.
|
|
65
|
-
|
|
66
|
+
newAgent.sessionManager.pdsUrl = undefined
|
|
66
67
|
|
|
67
68
|
const newDidCredentialsRes =
|
|
68
|
-
await
|
|
69
|
+
await newAgent.com.atproto.identity.getRecommendedDidCredentials()
|
|
69
70
|
|
|
70
|
-
await this.
|
|
71
|
+
await this.agent.com.atproto.identity.requestPlcOperationSignature()
|
|
71
72
|
const { token } = await this.pds.ctx.accountManager.db.db
|
|
72
73
|
.selectFrom('email_token')
|
|
73
74
|
.select('token')
|
|
@@ -80,15 +81,15 @@ export class ServiceProfile {
|
|
|
80
81
|
Object.assign((op.verificationMethods ??= {}), options.verificationMethods)
|
|
81
82
|
|
|
82
83
|
const signedPlcOperation =
|
|
83
|
-
await this.
|
|
84
|
+
await this.agent.com.atproto.identity.signPlcOperation(op)
|
|
84
85
|
|
|
85
|
-
await
|
|
86
|
+
await newAgent.com.atproto.identity.submitPlcOperation({
|
|
86
87
|
operation: signedPlcOperation.data.operation,
|
|
87
88
|
})
|
|
88
89
|
|
|
89
|
-
await
|
|
90
|
+
await newAgent.com.atproto.server.activateAccount()
|
|
90
91
|
|
|
91
92
|
this.pds = newPds
|
|
92
|
-
this.
|
|
93
|
+
this.agent = newAgent
|
|
93
94
|
}
|
|
94
95
|
}
|