@atproto/api 0.6.18 → 0.6.20
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/dist/client/index.d.ts +22 -3
- package/dist/client/lexicons.d.ts +302 -14
- package/dist/client/types/app/bsky/actor/searchActors.d.ts +1 -0
- package/dist/client/types/app/bsky/actor/searchActorsTypeahead.d.ts +1 -0
- package/dist/client/types/app/bsky/feed/searchPosts.d.ts +26 -0
- package/dist/client/types/app/bsky/unspecced/defs.d.ts +13 -0
- package/dist/client/types/app/bsky/unspecced/searchActorsSkeleton.d.ts +27 -0
- package/dist/client/types/app/bsky/unspecced/searchPostsSkeleton.d.ts +26 -0
- package/dist/client/types/com/atproto/admin/searchRepos.d.ts +1 -0
- package/dist/client/types/com/atproto/server/confirmEmail.d.ts +30 -0
- package/dist/client/types/com/atproto/server/createSession.d.ts +1 -0
- package/dist/client/types/com/atproto/server/getSession.d.ts +1 -0
- package/dist/client/types/com/atproto/server/requestEmailConfirmation.d.ts +13 -0
- package/dist/client/types/{app/bsky/unspecced/applyLabels.d.ts → com/atproto/server/requestEmailUpdate.d.ts} +4 -4
- package/dist/client/types/com/atproto/server/updateEmail.d.ts +27 -0
- package/dist/index.js +850 -336
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +1 -0
- package/package.json +7 -7
- package/src/agent.ts +4 -0
- package/src/client/index.ts +93 -13
- package/src/client/lexicons.ts +351 -23
- package/src/client/types/app/bsky/actor/searchActors.ts +3 -0
- package/src/client/types/app/bsky/actor/searchActorsTypeahead.ts +3 -0
- package/src/client/types/app/bsky/feed/searchPosts.ts +50 -0
- package/src/client/types/app/bsky/unspecced/defs.ts +41 -0
- package/src/client/types/app/bsky/unspecced/searchActorsSkeleton.ts +52 -0
- package/src/client/types/app/bsky/unspecced/searchPostsSkeleton.ts +50 -0
- package/src/client/types/com/atproto/admin/searchRepos.ts +2 -0
- package/src/client/types/com/atproto/server/confirmEmail.ts +61 -0
- package/src/client/types/com/atproto/server/createSession.ts +1 -0
- package/src/client/types/com/atproto/server/getSession.ts +1 -0
- package/src/client/types/com/atproto/server/requestEmailConfirmation.ts +28 -0
- package/src/client/types/{app/bsky/unspecced/applyLabels.ts → com/atproto/server/requestEmailUpdate.ts} +5 -4
- package/src/client/types/com/atproto/server/updateEmail.ts +55 -0
- package/src/rich-text/detection.ts +1 -1
- package/src/types.ts +1 -0
- package/tests/agent.test.ts +9 -0
- package/tests/rich-text-detection.test.ts +17 -17
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import * as AppBskyUnspeccedDefs from './defs'
|
|
10
|
+
|
|
11
|
+
export interface QueryParams {
|
|
12
|
+
/** search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended */
|
|
13
|
+
q: string
|
|
14
|
+
limit?: number
|
|
15
|
+
/** optional pagination mechanism; may not necessarily allow scrolling through entire result set */
|
|
16
|
+
cursor?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type InputSchema = undefined
|
|
20
|
+
|
|
21
|
+
export interface OutputSchema {
|
|
22
|
+
cursor?: string
|
|
23
|
+
/** count of search hits. optional, may be rounded/truncated, and may not be possible to paginate through all hits */
|
|
24
|
+
hitsTotal?: number
|
|
25
|
+
posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]
|
|
26
|
+
[k: string]: unknown
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CallOptions {
|
|
30
|
+
headers?: Headers
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface Response {
|
|
34
|
+
success: boolean
|
|
35
|
+
headers: Headers
|
|
36
|
+
data: OutputSchema
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class BadQueryStringError extends XRPCError {
|
|
40
|
+
constructor(src: XRPCError) {
|
|
41
|
+
super(src.status, src.error, src.message, src.headers)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function toKnownErr(e: any) {
|
|
46
|
+
if (e instanceof XRPCError) {
|
|
47
|
+
if (e.error === 'BadQueryString') return new BadQueryStringError(e)
|
|
48
|
+
}
|
|
49
|
+
return e
|
|
50
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
|
|
10
|
+
export interface QueryParams {}
|
|
11
|
+
|
|
12
|
+
export interface InputSchema {
|
|
13
|
+
email: string
|
|
14
|
+
token: string
|
|
15
|
+
[k: string]: unknown
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface CallOptions {
|
|
19
|
+
headers?: Headers
|
|
20
|
+
qp?: QueryParams
|
|
21
|
+
encoding: 'application/json'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Response {
|
|
25
|
+
success: boolean
|
|
26
|
+
headers: Headers
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class AccountNotFoundError extends XRPCError {
|
|
30
|
+
constructor(src: XRPCError) {
|
|
31
|
+
super(src.status, src.error, src.message, src.headers)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class ExpiredTokenError extends XRPCError {
|
|
36
|
+
constructor(src: XRPCError) {
|
|
37
|
+
super(src.status, src.error, src.message, src.headers)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class InvalidTokenError extends XRPCError {
|
|
42
|
+
constructor(src: XRPCError) {
|
|
43
|
+
super(src.status, src.error, src.message, src.headers)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class InvalidEmailError extends XRPCError {
|
|
48
|
+
constructor(src: XRPCError) {
|
|
49
|
+
super(src.status, src.error, src.message, src.headers)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function toKnownErr(e: any) {
|
|
54
|
+
if (e instanceof XRPCError) {
|
|
55
|
+
if (e.error === 'AccountNotFound') return new AccountNotFoundError(e)
|
|
56
|
+
if (e.error === 'ExpiredToken') return new ExpiredTokenError(e)
|
|
57
|
+
if (e.error === 'InvalidToken') return new InvalidTokenError(e)
|
|
58
|
+
if (e.error === 'InvalidEmail') return new InvalidEmailError(e)
|
|
59
|
+
}
|
|
60
|
+
return e
|
|
61
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
|
|
10
|
+
export interface QueryParams {}
|
|
11
|
+
|
|
12
|
+
export type InputSchema = undefined
|
|
13
|
+
|
|
14
|
+
export interface CallOptions {
|
|
15
|
+
headers?: Headers
|
|
16
|
+
qp?: QueryParams
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface Response {
|
|
20
|
+
success: boolean
|
|
21
|
+
headers: Headers
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function toKnownErr(e: any) {
|
|
25
|
+
if (e instanceof XRPCError) {
|
|
26
|
+
}
|
|
27
|
+
return e
|
|
28
|
+
}
|
|
@@ -6,24 +6,25 @@ import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { lexicons } from '../../../../lexicons'
|
|
8
8
|
import { CID } from 'multiformats/cid'
|
|
9
|
-
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
|
|
10
9
|
|
|
11
10
|
export interface QueryParams {}
|
|
12
11
|
|
|
13
|
-
export
|
|
14
|
-
|
|
12
|
+
export type InputSchema = undefined
|
|
13
|
+
|
|
14
|
+
export interface OutputSchema {
|
|
15
|
+
tokenRequired: boolean
|
|
15
16
|
[k: string]: unknown
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export interface CallOptions {
|
|
19
20
|
headers?: Headers
|
|
20
21
|
qp?: QueryParams
|
|
21
|
-
encoding: 'application/json'
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export interface Response {
|
|
25
25
|
success: boolean
|
|
26
26
|
headers: Headers
|
|
27
|
+
data: OutputSchema
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export function toKnownErr(e: any) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
|
|
10
|
+
export interface QueryParams {}
|
|
11
|
+
|
|
12
|
+
export interface InputSchema {
|
|
13
|
+
email: string
|
|
14
|
+
/** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */
|
|
15
|
+
token?: string
|
|
16
|
+
[k: string]: unknown
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CallOptions {
|
|
20
|
+
headers?: Headers
|
|
21
|
+
qp?: QueryParams
|
|
22
|
+
encoding: 'application/json'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface Response {
|
|
26
|
+
success: boolean
|
|
27
|
+
headers: Headers
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class ExpiredTokenError extends XRPCError {
|
|
31
|
+
constructor(src: XRPCError) {
|
|
32
|
+
super(src.status, src.error, src.message, src.headers)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class InvalidTokenError extends XRPCError {
|
|
37
|
+
constructor(src: XRPCError) {
|
|
38
|
+
super(src.status, src.error, src.message, src.headers)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class TokenRequiredError extends XRPCError {
|
|
43
|
+
constructor(src: XRPCError) {
|
|
44
|
+
super(src.status, src.error, src.message, src.headers)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function toKnownErr(e: any) {
|
|
49
|
+
if (e instanceof XRPCError) {
|
|
50
|
+
if (e.error === 'ExpiredToken') return new ExpiredTokenError(e)
|
|
51
|
+
if (e.error === 'InvalidToken') return new InvalidTokenError(e)
|
|
52
|
+
if (e.error === 'TokenRequired') return new TokenRequiredError(e)
|
|
53
|
+
}
|
|
54
|
+
return e
|
|
55
|
+
}
|
package/src/types.ts
CHANGED
package/tests/agent.test.ts
CHANGED
|
@@ -48,6 +48,7 @@ describe('agent', () => {
|
|
|
48
48
|
expect(agent.session?.handle).toEqual(res.data.handle)
|
|
49
49
|
expect(agent.session?.did).toEqual(res.data.did)
|
|
50
50
|
expect(agent.session?.email).toEqual('user1@test.com')
|
|
51
|
+
expect(agent.session?.emailConfirmed).toEqual(false)
|
|
51
52
|
|
|
52
53
|
const { data: sessionInfo } = await agent.api.com.atproto.server.getSession(
|
|
53
54
|
{},
|
|
@@ -56,6 +57,7 @@ describe('agent', () => {
|
|
|
56
57
|
did: res.data.did,
|
|
57
58
|
handle: res.data.handle,
|
|
58
59
|
email: 'user1@test.com',
|
|
60
|
+
emailConfirmed: false,
|
|
59
61
|
})
|
|
60
62
|
|
|
61
63
|
expect(events.length).toEqual(1)
|
|
@@ -93,6 +95,7 @@ describe('agent', () => {
|
|
|
93
95
|
expect(agent2.session?.handle).toEqual(res1.data.handle)
|
|
94
96
|
expect(agent2.session?.did).toEqual(res1.data.did)
|
|
95
97
|
expect(agent2.session?.email).toEqual('user2@test.com')
|
|
98
|
+
expect(agent2.session?.emailConfirmed).toEqual(false)
|
|
96
99
|
|
|
97
100
|
const { data: sessionInfo } =
|
|
98
101
|
await agent2.api.com.atproto.server.getSession({})
|
|
@@ -100,6 +103,7 @@ describe('agent', () => {
|
|
|
100
103
|
did: res1.data.did,
|
|
101
104
|
handle: res1.data.handle,
|
|
102
105
|
email,
|
|
106
|
+
emailConfirmed: false,
|
|
103
107
|
})
|
|
104
108
|
|
|
105
109
|
expect(events.length).toEqual(2)
|
|
@@ -142,6 +146,7 @@ describe('agent', () => {
|
|
|
142
146
|
did: res1.data.did,
|
|
143
147
|
handle: res1.data.handle,
|
|
144
148
|
email: res1.data.email,
|
|
149
|
+
emailConfirmed: false,
|
|
145
150
|
})
|
|
146
151
|
|
|
147
152
|
expect(events.length).toEqual(2)
|
|
@@ -206,6 +211,8 @@ describe('agent', () => {
|
|
|
206
211
|
expect(agent.session?.refreshJwt).not.toEqual(session1.refreshJwt)
|
|
207
212
|
expect(agent.session?.handle).toEqual(session1.handle)
|
|
208
213
|
expect(agent.session?.did).toEqual(session1.did)
|
|
214
|
+
expect(agent.session?.email).toEqual(session1.email)
|
|
215
|
+
expect(agent.session?.emailConfirmed).toEqual(session1.emailConfirmed)
|
|
209
216
|
|
|
210
217
|
expect(events.length).toEqual(2)
|
|
211
218
|
expect(events[0]).toEqual('create')
|
|
@@ -283,6 +290,8 @@ describe('agent', () => {
|
|
|
283
290
|
expect(agent.session?.refreshJwt).not.toEqual(session1.refreshJwt)
|
|
284
291
|
expect(agent.session?.handle).toEqual(session1.handle)
|
|
285
292
|
expect(agent.session?.did).toEqual(session1.did)
|
|
293
|
+
expect(agent.session?.email).toEqual(session1.email)
|
|
294
|
+
expect(agent.session?.emailConfirmed).toEqual(session1.emailConfirmed)
|
|
286
295
|
|
|
287
296
|
expect(events.length).toEqual(2)
|
|
288
297
|
expect(events[0]).toEqual('create')
|
|
@@ -216,28 +216,28 @@ describe('detectFacets', () => {
|
|
|
216
216
|
string[],
|
|
217
217
|
{ byteStart: number; byteEnd: number }[],
|
|
218
218
|
][] = [
|
|
219
|
-
['#a', ['
|
|
219
|
+
['#a', ['a'], [{ byteStart: 0, byteEnd: 2 }]],
|
|
220
220
|
[
|
|
221
221
|
'#a #b',
|
|
222
|
-
['
|
|
222
|
+
['a', 'b'],
|
|
223
223
|
[
|
|
224
224
|
{ byteStart: 0, byteEnd: 2 },
|
|
225
225
|
{ byteStart: 3, byteEnd: 5 },
|
|
226
226
|
],
|
|
227
227
|
],
|
|
228
228
|
['#1', [], []],
|
|
229
|
-
['#tag', ['
|
|
230
|
-
['body #tag', ['
|
|
231
|
-
['#tag body', ['
|
|
232
|
-
['body #tag body', ['
|
|
229
|
+
['#tag', ['tag'], [{ byteStart: 0, byteEnd: 4 }]],
|
|
230
|
+
['body #tag', ['tag'], [{ byteStart: 5, byteEnd: 9 }]],
|
|
231
|
+
['#tag body', ['tag'], [{ byteStart: 0, byteEnd: 4 }]],
|
|
232
|
+
['body #tag body', ['tag'], [{ byteStart: 5, byteEnd: 9 }]],
|
|
233
233
|
['body #1', [], []],
|
|
234
|
-
['body #a1', ['
|
|
234
|
+
['body #a1', ['a1'], [{ byteStart: 5, byteEnd: 8 }]],
|
|
235
235
|
['#', [], []],
|
|
236
236
|
['text #', [], []],
|
|
237
237
|
['text # text', [], []],
|
|
238
238
|
[
|
|
239
239
|
'body #thisisa64characterstring_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
|
240
|
-
['
|
|
240
|
+
['thisisa64characterstring_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'],
|
|
241
241
|
[{ byteStart: 5, byteEnd: 71 }],
|
|
242
242
|
],
|
|
243
243
|
[
|
|
@@ -247,19 +247,19 @@ describe('detectFacets', () => {
|
|
|
247
247
|
],
|
|
248
248
|
[
|
|
249
249
|
'its a #double#rainbow',
|
|
250
|
-
['
|
|
250
|
+
['double#rainbow'],
|
|
251
251
|
[{ byteStart: 6, byteEnd: 21 }],
|
|
252
252
|
],
|
|
253
|
-
['##hashash', ['
|
|
254
|
-
['some #n0n3s@n5e!', ['
|
|
253
|
+
['##hashash', ['#hashash'], [{ byteStart: 0, byteEnd: 9 }]],
|
|
254
|
+
['some #n0n3s@n5e!', ['n0n3s@n5e'], [{ byteStart: 5, byteEnd: 15 }]],
|
|
255
255
|
[
|
|
256
256
|
'works #with,punctuation',
|
|
257
|
-
['
|
|
257
|
+
['with,punctuation'],
|
|
258
258
|
[{ byteStart: 6, byteEnd: 23 }],
|
|
259
259
|
],
|
|
260
260
|
[
|
|
261
261
|
'strips trailing #punctuation, #like. #this!',
|
|
262
|
-
['
|
|
262
|
+
['punctuation', 'like', 'this'],
|
|
263
263
|
[
|
|
264
264
|
{ byteStart: 16, byteEnd: 28 },
|
|
265
265
|
{ byteStart: 30, byteEnd: 35 },
|
|
@@ -268,12 +268,12 @@ describe('detectFacets', () => {
|
|
|
268
268
|
],
|
|
269
269
|
[
|
|
270
270
|
'strips #multi_trailing___...',
|
|
271
|
-
['
|
|
271
|
+
['multi_trailing'],
|
|
272
272
|
[{ byteStart: 7, byteEnd: 22 }],
|
|
273
273
|
],
|
|
274
274
|
[
|
|
275
275
|
'works with #🦋 emoji, and #butter🦋fly',
|
|
276
|
-
['
|
|
276
|
+
['🦋', 'butter🦋fly'],
|
|
277
277
|
[
|
|
278
278
|
{ byteStart: 11, byteEnd: 16 },
|
|
279
279
|
{ byteStart: 28, byteEnd: 42 },
|
|
@@ -281,7 +281,7 @@ describe('detectFacets', () => {
|
|
|
281
281
|
],
|
|
282
282
|
[
|
|
283
283
|
'#same #same #but #diff',
|
|
284
|
-
['
|
|
284
|
+
['same', 'same', 'but', 'diff'],
|
|
285
285
|
[
|
|
286
286
|
{ byteStart: 0, byteEnd: 5 },
|
|
287
287
|
{ byteStart: 6, byteEnd: 11 },
|
|
@@ -298,7 +298,7 @@ describe('detectFacets', () => {
|
|
|
298
298
|
let detectedTags: string[] = []
|
|
299
299
|
let detectedIndices: { byteStart: number; byteEnd: number }[] = []
|
|
300
300
|
|
|
301
|
-
for (const { facet } of rt.segments()) {
|
|
301
|
+
for (const { facet, ...rest } of rt.segments()) {
|
|
302
302
|
if (!facet) continue
|
|
303
303
|
for (const feature of facet.features) {
|
|
304
304
|
if (isTag(feature)) {
|