@atproto/api 0.6.21 → 0.6.23

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 (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE.txt +7 -0
  3. package/README.md +6 -1
  4. package/dist/client/index.d.ts +9 -0
  5. package/dist/client/lexicons.d.ts +203 -3
  6. package/dist/client/types/com/atproto/admin/defs.d.ts +28 -0
  7. package/dist/client/types/com/atproto/admin/getAccountInfo.d.ts +16 -0
  8. package/dist/client/types/com/atproto/admin/getSubjectStatus.d.ts +26 -0
  9. package/dist/client/types/com/atproto/admin/searchRepos.d.ts +0 -1
  10. package/dist/client/types/com/atproto/admin/updateSubjectStatus.d.ts +32 -0
  11. package/dist/client/types/com/atproto/server/createAccount.d.ts +3 -3
  12. package/dist/client/types/com/atproto/server/getSession.d.ts +1 -0
  13. package/dist/client/types/com/atproto/server/reserveSigningKey.d.ts +5 -1
  14. package/dist/index.js +604 -338
  15. package/dist/index.js.map +3 -3
  16. package/package.json +7 -7
  17. package/src/agent.ts +1 -0
  18. package/src/client/index.ts +39 -0
  19. package/src/client/lexicons.ts +219 -5
  20. package/src/client/types/com/atproto/admin/defs.ts +61 -0
  21. package/src/client/types/com/atproto/admin/getAccountInfo.ts +32 -0
  22. package/src/client/types/com/atproto/admin/getSubjectStatus.ts +44 -0
  23. package/src/client/types/com/atproto/admin/searchRepos.ts +0 -1
  24. package/src/client/types/com/atproto/admin/updateSubjectStatus.ts +50 -0
  25. package/src/client/types/com/atproto/server/createAccount.ts +3 -3
  26. package/src/client/types/com/atproto/server/getSession.ts +1 -0
  27. package/src/client/types/com/atproto/server/reserveSigningKey.ts +6 -1
  28. package/src/moderation/accumulator.ts +0 -1
  29. package/tests/agent.test.ts +14 -3
  30. package/LICENSE +0 -21
@@ -10,13 +10,13 @@ import { CID } from 'multiformats/cid'
10
10
  export interface QueryParams {}
11
11
 
12
12
  export interface InputSchema {
13
- email: string
13
+ email?: string
14
14
  handle: string
15
15
  did?: string
16
16
  inviteCode?: string
17
- password: string
17
+ password?: string
18
18
  recoveryKey?: string
19
- plcOp?: Uint8Array
19
+ plcOp?: {}
20
20
  [k: string]: unknown
21
21
  }
22
22
 
@@ -16,6 +16,7 @@ export interface OutputSchema {
16
16
  did: string
17
17
  email?: string
18
18
  emailConfirmed?: boolean
19
+ didDoc?: {}
19
20
  [k: string]: unknown
20
21
  }
21
22
 
@@ -9,7 +9,11 @@ import { CID } from 'multiformats/cid'
9
9
 
10
10
  export interface QueryParams {}
11
11
 
12
- export type InputSchema = undefined
12
+ export interface InputSchema {
13
+ /** The did to reserve a new did:key for */
14
+ did?: string
15
+ [k: string]: unknown
16
+ }
13
17
 
14
18
  export interface OutputSchema {
15
19
  /** Public signing key in the form of a did:key. */
@@ -20,6 +24,7 @@ export interface OutputSchema {
20
24
  export interface CallOptions {
21
25
  headers?: Headers
22
26
  qp?: QueryParams
27
+ encoding: 'application/json'
23
28
  }
24
29
 
25
30
  export interface Response {
@@ -1,5 +1,4 @@
1
1
  import { AppBskyGraphDefs } from '../client/index'
2
- import { AtUri } from '@atproto/syntax'
3
2
  import {
4
3
  Label,
5
4
  LabelPreference,
@@ -1,3 +1,4 @@
1
+ import assert from 'assert'
1
2
  import { defaultFetchHandler } from '@atproto/xrpc'
2
3
  import {
3
4
  AtpAgent,
@@ -6,6 +7,7 @@ import {
6
7
  AtpSessionData,
7
8
  } from '..'
8
9
  import { TestNetworkNoAppView } from '@atproto/dev-env'
10
+ import { getPdsEndpoint, isValidDidDoc } from '@atproto/common-web'
9
11
 
10
12
  describe('agent', () => {
11
13
  let network: TestNetworkNoAppView
@@ -46,16 +48,19 @@ describe('agent', () => {
46
48
  expect(agent.session?.did).toEqual(res.data.did)
47
49
  expect(agent.session?.email).toEqual('user1@test.com')
48
50
  expect(agent.session?.emailConfirmed).toEqual(false)
51
+ assert(isValidDidDoc(res.data.didDoc))
52
+ expect(agent.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res.data.didDoc))
49
53
 
50
54
  const { data: sessionInfo } = await agent.api.com.atproto.server.getSession(
51
55
  {},
52
56
  )
53
- expect(sessionInfo).toEqual({
57
+ expect(sessionInfo).toMatchObject({
54
58
  did: res.data.did,
55
59
  handle: res.data.handle,
56
60
  email: 'user1@test.com',
57
61
  emailConfirmed: false,
58
62
  })
63
+ expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true)
59
64
 
60
65
  expect(events.length).toEqual(1)
61
66
  expect(events[0]).toEqual('create')
@@ -93,15 +98,18 @@ describe('agent', () => {
93
98
  expect(agent2.session?.did).toEqual(res1.data.did)
94
99
  expect(agent2.session?.email).toEqual('user2@test.com')
95
100
  expect(agent2.session?.emailConfirmed).toEqual(false)
101
+ assert(isValidDidDoc(res1.data.didDoc))
102
+ expect(agent2.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res1.data.didDoc))
96
103
 
97
104
  const { data: sessionInfo } =
98
105
  await agent2.api.com.atproto.server.getSession({})
99
- expect(sessionInfo).toEqual({
106
+ expect(sessionInfo).toMatchObject({
100
107
  did: res1.data.did,
101
108
  handle: res1.data.handle,
102
109
  email,
103
110
  emailConfirmed: false,
104
111
  })
112
+ expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true)
105
113
 
106
114
  expect(events.length).toEqual(2)
107
115
  expect(events[0]).toEqual('create')
@@ -136,15 +144,18 @@ describe('agent', () => {
136
144
  expect(agent2.hasSession).toEqual(true)
137
145
  expect(agent2.session?.handle).toEqual(res1.data.handle)
138
146
  expect(agent2.session?.did).toEqual(res1.data.did)
147
+ assert(isValidDidDoc(res1.data.didDoc))
148
+ expect(agent2.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res1.data.didDoc))
139
149
 
140
150
  const { data: sessionInfo } =
141
151
  await agent2.api.com.atproto.server.getSession({})
142
- expect(sessionInfo).toEqual({
152
+ expect(sessionInfo).toMatchObject({
143
153
  did: res1.data.did,
144
154
  handle: res1.data.handle,
145
155
  email: res1.data.email,
146
156
  emailConfirmed: false,
147
157
  })
158
+ expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true)
148
159
 
149
160
  expect(events.length).toEqual(2)
150
161
  expect(events[0]).toEqual('create')
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022-2023 Bluesky PBC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.