@atproto/dev-env 0.3.214 → 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.
Files changed (51) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/bin.js +12 -0
  3. package/dist/bin.js +0 -0
  4. package/dist/bsky.d.ts +3 -1
  5. package/dist/bsky.d.ts.map +1 -1
  6. package/dist/bsky.js +7 -1
  7. package/dist/bsky.js.map +1 -1
  8. package/dist/feed-gen.d.ts.map +1 -1
  9. package/dist/feed-gen.js +7 -10
  10. package/dist/feed-gen.js.map +1 -1
  11. package/dist/mock/index.js +5 -5
  12. package/dist/mock/index.js.map +1 -1
  13. package/dist/moderator-client.js +1 -1
  14. package/dist/moderator-client.js.map +1 -1
  15. package/dist/network-no-appview.d.ts.map +1 -1
  16. package/dist/network-no-appview.js +3 -2
  17. package/dist/network-no-appview.js.map +1 -1
  18. package/dist/ozone.d.ts +1 -1
  19. package/dist/ozone.d.ts.map +1 -1
  20. package/dist/ozone.js +1 -1
  21. package/dist/ozone.js.map +1 -1
  22. package/dist/pds.d.ts +3 -1
  23. package/dist/pds.d.ts.map +1 -1
  24. package/dist/pds.js +7 -1
  25. package/dist/pds.js.map +1 -1
  26. package/dist/seed/client.d.ts +11 -9
  27. package/dist/seed/client.d.ts.map +1 -1
  28. package/dist/seed/client.js +10 -2
  29. package/dist/seed/client.js.map +1 -1
  30. package/dist/service-profile-lexicon.js +5 -5
  31. package/dist/service-profile-lexicon.js.map +1 -1
  32. package/dist/service-profile-ozone.d.ts +1 -1
  33. package/dist/service-profile-ozone.d.ts.map +1 -1
  34. package/dist/service-profile-ozone.js +8 -8
  35. package/dist/service-profile-ozone.js.map +1 -1
  36. package/dist/service-profile.d.ts +4 -3
  37. package/dist/service-profile.d.ts.map +1 -1
  38. package/dist/service-profile.js +16 -16
  39. package/dist/service-profile.js.map +1 -1
  40. package/package.json +11 -10
  41. package/src/bsky.ts +8 -1
  42. package/src/feed-gen.ts +17 -16
  43. package/src/mock/index.ts +10 -10
  44. package/src/moderator-client.ts +1 -1
  45. package/src/network-no-appview.ts +3 -2
  46. package/src/ozone.ts +1 -1
  47. package/src/pds.ts +8 -1
  48. package/src/seed/client.ts +11 -7
  49. package/src/service-profile-lexicon.ts +5 -5
  50. package/src/service-profile-ozone.ts +8 -8
  51. 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 client = pds.getClient()
21
- await client.createAccount(userDetails)
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, client, userDetails, ozoneUrl, key)
25
+ return new OzoneServiceProfile(pds, agent, userDetails, ozoneUrl, key)
26
26
  }
27
27
 
28
28
  protected constructor(
29
29
  pds: TestPds,
30
- client: AtpAgent,
30
+ agent: AtpAgent,
31
31
  userDetails: ServiceUserDetails,
32
32
  readonly ozoneUrl: string,
33
33
  readonly key: Secp256k1Keypair,
34
34
  ) {
35
- super(pds, client, userDetails)
35
+ super(pds, agent, userDetails)
36
36
  }
37
37
 
38
38
  async createAppPasswordForVerification() {
39
- const { data } = await this.client.com.atproto.server.createAppPassword({
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.client.app.bsky.actor.profile.create(
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.client.app.bsky.labeler.service.create(
71
+ await this.agent.app.bsky.labeler.service.create(
72
72
  { repo: this.did, rkey: 'self' },
73
73
  {
74
74
  policies: {
@@ -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 client: AtpAgent,
20
+ protected agent: AtpAgent,
20
21
  protected userDetails: ServiceUserDetails,
21
22
  ) {}
22
23
 
23
- get did() {
24
- return this.client.assertDid
24
+ get did(): DidString {
25
+ return this.agent.assertDid
25
26
  }
26
27
 
27
28
  async migrateTo(newPds: TestPds, options: ServiceMigrationOptions = {}) {
28
- const newClient = newPds.getClient()
29
+ const newAgent = newPds.getAgent()
29
30
 
30
- const newPdsDesc = await newClient.com.atproto.server.describeServer()
31
- const serviceAuth = await this.client.com.atproto.server.getServiceAuth({
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 newClient.com.atproto.server
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 newClient.createAccount(
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
- newClient.sessionManager.pdsUrl = undefined
66
+ newAgent.sessionManager.pdsUrl = undefined
66
67
 
67
68
  const newDidCredentialsRes =
68
- await newClient.com.atproto.identity.getRecommendedDidCredentials()
69
+ await newAgent.com.atproto.identity.getRecommendedDidCredentials()
69
70
 
70
- await this.client.com.atproto.identity.requestPlcOperationSignature()
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.client.com.atproto.identity.signPlcOperation(op)
84
+ await this.agent.com.atproto.identity.signPlcOperation(op)
84
85
 
85
- await newClient.com.atproto.identity.submitPlcOperation({
86
+ await newAgent.com.atproto.identity.submitPlcOperation({
86
87
  operation: signedPlcOperation.data.operation,
87
88
  })
88
89
 
89
- await newClient.com.atproto.server.activateAccount()
90
+ await newAgent.com.atproto.server.activateAccount()
90
91
 
91
92
  this.pds = newPds
92
- this.client = newClient
93
+ this.agent = newAgent
93
94
  }
94
95
  }