@atproto/bsky 0.0.14 → 0.0.15
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 +11 -0
- package/dist/api/app/bsky/feed/searchPosts.d.ts +3 -0
- package/dist/api/com/atproto/temp/fetchLabels.d.ts +3 -0
- package/dist/config.d.ts +2 -2
- package/dist/context.d.ts +1 -1
- package/dist/index.js +716 -443
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +7 -0
- package/dist/lexicon/lexicons.d.ts +60 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +2 -0
- package/dist/lexicon/types/com/atproto/temp/fetchLabels.d.ts +33 -0
- package/package.json +8 -9
- package/src/api/app/bsky/actor/getSuggestions.ts +45 -21
- package/src/api/app/bsky/feed/getPostThread.ts +16 -4
- package/src/api/app/bsky/feed/searchPosts.ts +127 -0
- package/src/api/com/atproto/admin/reverseModerationAction.ts +3 -3
- package/src/api/com/atproto/admin/takeModerationAction.ts +2 -2
- package/src/api/com/atproto/admin/util.ts +3 -1
- package/src/api/com/atproto/temp/fetchLabels.ts +30 -0
- package/src/api/index.ts +4 -0
- package/src/config.ts +6 -6
- package/src/context.ts +11 -9
- package/src/db/periodic-moderation-action-reversal.ts +1 -9
- package/src/lexicon/index.ts +22 -0
- package/src/lexicon/lexicons.ts +189 -129
- package/src/lexicon/types/app/bsky/actor/defs.ts +2 -2
- package/src/lexicon/types/app/bsky/actor/searchActors.ts +2 -2
- package/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts +2 -2
- package/src/lexicon/types/app/bsky/feed/searchPosts.ts +3 -3
- package/src/lexicon/types/app/bsky/graph/defs.ts +2 -2
- package/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts +4 -4
- package/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts +3 -3
- package/src/lexicon/types/com/atproto/admin/defs.ts +5 -3
- package/src/lexicon/types/com/atproto/admin/disableAccountInvites.ts +1 -1
- package/src/lexicon/types/com/atproto/admin/enableAccountInvites.ts +1 -1
- package/src/lexicon/types/com/atproto/admin/getModerationReports.ts +3 -3
- package/src/lexicon/types/com/atproto/admin/takeModerationAction.ts +1 -1
- package/src/lexicon/types/com/atproto/label/defs.ts +9 -9
- package/src/lexicon/types/com/atproto/label/queryLabels.ts +2 -2
- package/src/lexicon/types/com/atproto/repo/applyWrites.ts +1 -1
- package/src/lexicon/types/com/atproto/repo/createRecord.ts +2 -2
- package/src/lexicon/types/com/atproto/repo/deleteRecord.ts +2 -2
- package/src/lexicon/types/com/atproto/repo/listRecords.ts +1 -1
- package/src/lexicon/types/com/atproto/repo/putRecord.ts +3 -3
- package/src/lexicon/types/com/atproto/sync/listBlobs.ts +1 -1
- package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +4 -4
- package/src/lexicon/types/com/atproto/temp/fetchLabels.ts +47 -0
- package/tests/admin/get-repo.test.ts +33 -0
- package/tests/views/suggestions.test.ts +15 -7
|
@@ -169,7 +169,7 @@ export function validateSavedFeedsPref(v: unknown): ValidationResult {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
export interface PersonalDetailsPref {
|
|
172
|
-
/** The birth date of
|
|
172
|
+
/** The birth date of account owner. */
|
|
173
173
|
birthDate?: string
|
|
174
174
|
[k: string]: unknown
|
|
175
175
|
}
|
|
@@ -215,7 +215,7 @@ export function validateFeedViewPref(v: unknown): ValidationResult {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
export interface ThreadViewPref {
|
|
218
|
-
/** Sorting mode. */
|
|
218
|
+
/** Sorting mode for threads. */
|
|
219
219
|
sort?: 'oldest' | 'newest' | 'most-likes' | 'random' | (string & {})
|
|
220
220
|
/** Show followed users at the top of all replies. */
|
|
221
221
|
prioritizeFollowedUsers?: boolean
|
|
@@ -10,9 +10,9 @@ import { HandlerAuth } from '@atproto/xrpc-server'
|
|
|
10
10
|
import * as AppBskyActorDefs from './defs'
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
|
-
/** DEPRECATED: use 'q' instead */
|
|
13
|
+
/** DEPRECATED: use 'q' instead. */
|
|
14
14
|
term?: string
|
|
15
|
-
/**
|
|
15
|
+
/** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
|
|
16
16
|
q?: string
|
|
17
17
|
limit: number
|
|
18
18
|
cursor?: string
|
|
@@ -10,9 +10,9 @@ import { HandlerAuth } from '@atproto/xrpc-server'
|
|
|
10
10
|
import * as AppBskyActorDefs from './defs'
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
|
-
/** DEPRECATED: use 'q' instead */
|
|
13
|
+
/** DEPRECATED: use 'q' instead. */
|
|
14
14
|
term?: string
|
|
15
|
-
/**
|
|
15
|
+
/** Search query prefix; not a full query string. */
|
|
16
16
|
q?: string
|
|
17
17
|
limit: number
|
|
18
18
|
}
|
|
@@ -10,10 +10,10 @@ import { HandlerAuth } from '@atproto/xrpc-server'
|
|
|
10
10
|
import * as AppBskyFeedDefs from './defs'
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
|
-
/**
|
|
13
|
+
/** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
|
|
14
14
|
q: string
|
|
15
15
|
limit: number
|
|
16
|
-
/**
|
|
16
|
+
/** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */
|
|
17
17
|
cursor?: string
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ export type InputSchema = undefined
|
|
|
21
21
|
|
|
22
22
|
export interface OutputSchema {
|
|
23
23
|
cursor?: string
|
|
24
|
-
/**
|
|
24
|
+
/** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */
|
|
25
25
|
hitsTotal?: number
|
|
26
26
|
posts: AppBskyFeedDefs.PostView[]
|
|
27
27
|
[k: string]: unknown
|
|
@@ -79,9 +79,9 @@ export type ListPurpose =
|
|
|
79
79
|
| 'app.bsky.graph.defs#curatelist'
|
|
80
80
|
| (string & {})
|
|
81
81
|
|
|
82
|
-
/** A list of actors to apply an aggregate moderation action (mute/block) on */
|
|
82
|
+
/** A list of actors to apply an aggregate moderation action (mute/block) on. */
|
|
83
83
|
export const MODLIST = 'app.bsky.graph.defs#modlist'
|
|
84
|
-
/** A list of actors used for curation purposes such as list feeds or interaction gating */
|
|
84
|
+
/** A list of actors used for curation purposes such as list feeds or interaction gating. */
|
|
85
85
|
export const CURATELIST = 'app.bsky.graph.defs#curatelist'
|
|
86
86
|
|
|
87
87
|
export interface ListViewerState {
|
|
@@ -10,12 +10,12 @@ import { HandlerAuth } from '@atproto/xrpc-server'
|
|
|
10
10
|
import * as AppBskyUnspeccedDefs from './defs'
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
|
-
/**
|
|
13
|
+
/** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. */
|
|
14
14
|
q: string
|
|
15
|
-
/**
|
|
15
|
+
/** If true, acts as fast/simple 'typeahead' query. */
|
|
16
16
|
typeahead?: boolean
|
|
17
17
|
limit: number
|
|
18
|
-
/**
|
|
18
|
+
/** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */
|
|
19
19
|
cursor?: string
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ export type InputSchema = undefined
|
|
|
23
23
|
|
|
24
24
|
export interface OutputSchema {
|
|
25
25
|
cursor?: string
|
|
26
|
-
/**
|
|
26
|
+
/** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */
|
|
27
27
|
hitsTotal?: number
|
|
28
28
|
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
|
|
29
29
|
[k: string]: unknown
|
|
@@ -10,10 +10,10 @@ import { HandlerAuth } from '@atproto/xrpc-server'
|
|
|
10
10
|
import * as AppBskyUnspeccedDefs from './defs'
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
|
-
/**
|
|
13
|
+
/** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
|
|
14
14
|
q: string
|
|
15
15
|
limit: number
|
|
16
|
-
/**
|
|
16
|
+
/** Optional pagination mechanism; may not necessarily allow scrolling through entire result set. */
|
|
17
17
|
cursor?: string
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ export type InputSchema = undefined
|
|
|
21
21
|
|
|
22
22
|
export interface OutputSchema {
|
|
23
23
|
cursor?: string
|
|
24
|
-
/**
|
|
24
|
+
/** Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. */
|
|
25
25
|
hitsTotal?: number
|
|
26
26
|
posts: AppBskyUnspeccedDefs.SkeletonSearchPost[]
|
|
27
27
|
[k: string]: unknown
|
|
@@ -31,7 +31,7 @@ export function validateStatusAttr(v: unknown): ValidationResult {
|
|
|
31
31
|
export interface ActionView {
|
|
32
32
|
id: number
|
|
33
33
|
action: ActionType
|
|
34
|
-
/** Indicates how long this action
|
|
34
|
+
/** Indicates how long this action is meant to be in effect before automatically expiring. */
|
|
35
35
|
durationInHours?: number
|
|
36
36
|
subject:
|
|
37
37
|
| RepoRef
|
|
@@ -63,7 +63,7 @@ export function validateActionView(v: unknown): ValidationResult {
|
|
|
63
63
|
export interface ActionViewDetail {
|
|
64
64
|
id: number
|
|
65
65
|
action: ActionType
|
|
66
|
-
/** Indicates how long this action
|
|
66
|
+
/** Indicates how long this action is meant to be in effect before automatically expiring. */
|
|
67
67
|
durationInHours?: number
|
|
68
68
|
subject:
|
|
69
69
|
| RepoView
|
|
@@ -97,7 +97,7 @@ export function validateActionViewDetail(v: unknown): ValidationResult {
|
|
|
97
97
|
export interface ActionViewCurrent {
|
|
98
98
|
id: number
|
|
99
99
|
action: ActionType
|
|
100
|
-
/** Indicates how long this action
|
|
100
|
+
/** Indicates how long this action is meant to be in effect before automatically expiring. */
|
|
101
101
|
durationInHours?: number
|
|
102
102
|
[k: string]: unknown
|
|
103
103
|
}
|
|
@@ -241,6 +241,7 @@ export interface RepoViewDetail {
|
|
|
241
241
|
invites?: ComAtprotoServerDefs.InviteCode[]
|
|
242
242
|
invitesDisabled?: boolean
|
|
243
243
|
inviteNote?: string
|
|
244
|
+
emailConfirmedAt?: string
|
|
244
245
|
[k: string]: unknown
|
|
245
246
|
}
|
|
246
247
|
|
|
@@ -264,6 +265,7 @@ export interface AccountView {
|
|
|
264
265
|
invitedBy?: ComAtprotoServerDefs.InviteCode
|
|
265
266
|
invites?: ComAtprotoServerDefs.InviteCode[]
|
|
266
267
|
invitesDisabled?: boolean
|
|
268
|
+
emailConfirmedAt?: string
|
|
267
269
|
inviteNote?: string
|
|
268
270
|
[k: string]: unknown
|
|
269
271
|
}
|
|
@@ -12,9 +12,9 @@ import * as ComAtprotoAdminDefs from './defs'
|
|
|
12
12
|
export interface QueryParams {
|
|
13
13
|
subject?: string
|
|
14
14
|
ignoreSubjects?: string[]
|
|
15
|
-
/** Get all reports that were actioned by a specific moderator */
|
|
15
|
+
/** Get all reports that were actioned by a specific moderator. */
|
|
16
16
|
actionedBy?: string
|
|
17
|
-
/** Filter reports made by one or more DIDs */
|
|
17
|
+
/** Filter reports made by one or more DIDs. */
|
|
18
18
|
reporters?: string[]
|
|
19
19
|
resolved?: boolean
|
|
20
20
|
actionType?:
|
|
@@ -25,7 +25,7 @@ export interface QueryParams {
|
|
|
25
25
|
| (string & {})
|
|
26
26
|
limit: number
|
|
27
27
|
cursor?: string
|
|
28
|
-
/** Reverse the order of the returned records
|
|
28
|
+
/** Reverse the order of the returned records. When true, returns reports in chronological order. */
|
|
29
29
|
reverse?: boolean
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -26,7 +26,7 @@ export interface InputSchema {
|
|
|
26
26
|
createLabelVals?: string[]
|
|
27
27
|
negateLabelVals?: string[]
|
|
28
28
|
reason: string
|
|
29
|
-
/** Indicates how long this action
|
|
29
|
+
/** Indicates how long this action is meant to be in effect before automatically expiring. */
|
|
30
30
|
durationInHours?: number
|
|
31
31
|
createdBy: string
|
|
32
32
|
[k: string]: unknown
|
|
@@ -6,19 +6,19 @@ import { lexicons } from '../../../../lexicons'
|
|
|
6
6
|
import { isObj, hasProp } from '../../../../util'
|
|
7
7
|
import { CID } from 'multiformats/cid'
|
|
8
8
|
|
|
9
|
-
/** Metadata tag on an atproto resource (eg, repo or record) */
|
|
9
|
+
/** Metadata tag on an atproto resource (eg, repo or record). */
|
|
10
10
|
export interface Label {
|
|
11
|
-
/** DID of the actor who created this label */
|
|
11
|
+
/** DID of the actor who created this label. */
|
|
12
12
|
src: string
|
|
13
|
-
/** AT URI of the record, repository (account), or other resource
|
|
13
|
+
/** AT URI of the record, repository (account), or other resource that this label applies to. */
|
|
14
14
|
uri: string
|
|
15
|
-
/**
|
|
15
|
+
/** Optionally, CID specifying the specific version of 'uri' resource this label applies to. */
|
|
16
16
|
cid?: string
|
|
17
|
-
/**
|
|
17
|
+
/** The short string name of the value or type of this label. */
|
|
18
18
|
val: string
|
|
19
|
-
/**
|
|
19
|
+
/** If true, this is a negation label, overwriting a previous label. */
|
|
20
20
|
neg?: boolean
|
|
21
|
-
/**
|
|
21
|
+
/** Timestamp when this label was created. */
|
|
22
22
|
cts: string
|
|
23
23
|
[k: string]: unknown
|
|
24
24
|
}
|
|
@@ -53,9 +53,9 @@ export function validateSelfLabels(v: unknown): ValidationResult {
|
|
|
53
53
|
return lexicons.validate('com.atproto.label.defs#selfLabels', v)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/** Metadata tag on an atproto record, published by the author within the record. Note
|
|
56
|
+
/** Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. */
|
|
57
57
|
export interface SelfLabel {
|
|
58
|
-
/**
|
|
58
|
+
/** The short string name of the value or type of this label. */
|
|
59
59
|
val: string
|
|
60
60
|
[k: string]: unknown
|
|
61
61
|
}
|
|
@@ -10,9 +10,9 @@ import { HandlerAuth } from '@atproto/xrpc-server'
|
|
|
10
10
|
import * as ComAtprotoLabelDefs from './defs'
|
|
11
11
|
|
|
12
12
|
export interface QueryParams {
|
|
13
|
-
/** List of AT URI patterns to match (boolean 'OR'). Each may be a prefix (ending with '*'; will match inclusive of the string leading to '*'), or a full URI */
|
|
13
|
+
/** List of AT URI patterns to match (boolean 'OR'). Each may be a prefix (ending with '*'; will match inclusive of the string leading to '*'), or a full URI. */
|
|
14
14
|
uriPatterns: string[]
|
|
15
|
-
/** Optional list of label sources (DIDs) to filter on */
|
|
15
|
+
/** Optional list of label sources (DIDs) to filter on. */
|
|
16
16
|
sources?: string[]
|
|
17
17
|
limit: number
|
|
18
18
|
cursor?: string
|
|
@@ -13,7 +13,7 @@ export interface QueryParams {}
|
|
|
13
13
|
export interface InputSchema {
|
|
14
14
|
/** The handle or DID of the repo. */
|
|
15
15
|
repo: string
|
|
16
|
-
/**
|
|
16
|
+
/** Flag for validating the records. */
|
|
17
17
|
validate: boolean
|
|
18
18
|
writes: (Create | Update | Delete)[]
|
|
19
19
|
swapCommit?: string
|
|
@@ -17,11 +17,11 @@ export interface InputSchema {
|
|
|
17
17
|
collection: string
|
|
18
18
|
/** The key of the record. */
|
|
19
19
|
rkey?: string
|
|
20
|
-
/**
|
|
20
|
+
/** Flag for validating the record. */
|
|
21
21
|
validate: boolean
|
|
22
22
|
/** The record to create. */
|
|
23
23
|
record: {}
|
|
24
|
-
/** Compare and swap with the previous commit by
|
|
24
|
+
/** Compare and swap with the previous commit by CID. */
|
|
25
25
|
swapCommit?: string
|
|
26
26
|
[k: string]: unknown
|
|
27
27
|
}
|
|
@@ -17,9 +17,9 @@ export interface InputSchema {
|
|
|
17
17
|
collection: string
|
|
18
18
|
/** The key of the record. */
|
|
19
19
|
rkey: string
|
|
20
|
-
/** Compare and swap with the previous record by
|
|
20
|
+
/** Compare and swap with the previous record by CID. */
|
|
21
21
|
swapRecord?: string
|
|
22
|
-
/** Compare and swap with the previous commit by
|
|
22
|
+
/** Compare and swap with the previous commit by CID. */
|
|
23
23
|
swapCommit?: string
|
|
24
24
|
[k: string]: unknown
|
|
25
25
|
}
|
|
@@ -20,7 +20,7 @@ export interface QueryParams {
|
|
|
20
20
|
rkeyStart?: string
|
|
21
21
|
/** DEPRECATED: The highest sort-ordered rkey to stop at (exclusive) */
|
|
22
22
|
rkeyEnd?: string
|
|
23
|
-
/**
|
|
23
|
+
/** Flag to reverse the order of the returned records. */
|
|
24
24
|
reverse?: boolean
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -17,13 +17,13 @@ export interface InputSchema {
|
|
|
17
17
|
collection: string
|
|
18
18
|
/** The key of the record. */
|
|
19
19
|
rkey: string
|
|
20
|
-
/**
|
|
20
|
+
/** Flag for validating the record. */
|
|
21
21
|
validate: boolean
|
|
22
22
|
/** The record to write. */
|
|
23
23
|
record: {}
|
|
24
|
-
/** Compare and swap with the previous record by
|
|
24
|
+
/** Compare and swap with the previous record by CID. */
|
|
25
25
|
swapRecord?: string | null
|
|
26
|
-
/** Compare and swap with the previous commit by
|
|
26
|
+
/** Compare and swap with the previous commit by CID. */
|
|
27
27
|
swapCommit?: string
|
|
28
28
|
[k: string]: unknown
|
|
29
29
|
}
|
|
@@ -11,7 +11,7 @@ import { HandlerAuth } from '@atproto/xrpc-server'
|
|
|
11
11
|
export interface QueryParams {
|
|
12
12
|
/** The DID of the repo. */
|
|
13
13
|
did: string
|
|
14
|
-
/** Optional revision of the repo to list blobs since */
|
|
14
|
+
/** Optional revision of the repo to list blobs since. */
|
|
15
15
|
since?: string
|
|
16
16
|
limit: number
|
|
17
17
|
cursor?: string
|
|
@@ -39,11 +39,11 @@ export interface Commit {
|
|
|
39
39
|
repo: string
|
|
40
40
|
commit: CID
|
|
41
41
|
prev?: CID | null
|
|
42
|
-
/** The rev of the emitted commit */
|
|
42
|
+
/** The rev of the emitted commit. */
|
|
43
43
|
rev: string
|
|
44
|
-
/** The rev of the last emitted commit from this repo */
|
|
44
|
+
/** The rev of the last emitted commit from this repo. */
|
|
45
45
|
since: string | null
|
|
46
|
-
/** CAR file containing relevant blocks */
|
|
46
|
+
/** CAR file containing relevant blocks. */
|
|
47
47
|
blocks: Uint8Array
|
|
48
48
|
ops: RepoOp[]
|
|
49
49
|
blobs: CID[]
|
|
@@ -140,7 +140,7 @@ export function validateInfo(v: unknown): ValidationResult {
|
|
|
140
140
|
return lexicons.validate('com.atproto.sync.subscribeRepos#info', v)
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
/** A repo operation, ie a write of a single record. For creates and updates,
|
|
143
|
+
/** A repo operation, ie a write of a single record. For creates and updates, CID is the record's CID as of this operation. For deletes, it's null. */
|
|
144
144
|
export interface RepoOp {
|
|
145
145
|
action: 'create' | 'update' | 'delete' | (string & {})
|
|
146
146
|
path: string
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth } from '@atproto/xrpc-server'
|
|
10
|
+
import * as ComAtprotoLabelDefs from '../label/defs'
|
|
11
|
+
|
|
12
|
+
export interface QueryParams {
|
|
13
|
+
since?: number
|
|
14
|
+
limit: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type InputSchema = undefined
|
|
18
|
+
|
|
19
|
+
export interface OutputSchema {
|
|
20
|
+
labels: ComAtprotoLabelDefs.Label[]
|
|
21
|
+
[k: string]: unknown
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type HandlerInput = undefined
|
|
25
|
+
|
|
26
|
+
export interface HandlerSuccess {
|
|
27
|
+
encoding: 'application/json'
|
|
28
|
+
body: OutputSchema
|
|
29
|
+
headers?: { [key: string]: string }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface HandlerError {
|
|
33
|
+
status: number
|
|
34
|
+
message?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type HandlerOutput = HandlerError | HandlerSuccess
|
|
38
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
39
|
+
auth: HA
|
|
40
|
+
params: QueryParams
|
|
41
|
+
input: HandlerInput
|
|
42
|
+
req: express.Request
|
|
43
|
+
res: express.Response
|
|
44
|
+
}
|
|
45
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
46
|
+
ctx: HandlerReqCtx<HA>,
|
|
47
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -91,6 +91,39 @@ describe('admin get repo view', () => {
|
|
|
91
91
|
expect(triage).toEqual({ ...admin, email: undefined })
|
|
92
92
|
})
|
|
93
93
|
|
|
94
|
+
it('includes emailConfirmedAt timestamp', async () => {
|
|
95
|
+
const { data: beforeEmailVerification } =
|
|
96
|
+
await agent.api.com.atproto.admin.getRepo(
|
|
97
|
+
{ did: sc.dids.bob },
|
|
98
|
+
{ headers: network.pds.adminAuthHeaders() },
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
expect(beforeEmailVerification.emailConfirmedAt).toBeUndefined()
|
|
102
|
+
const timestampBeforeVerification = Date.now()
|
|
103
|
+
const bobsAccount = sc.accounts[sc.dids.bob]
|
|
104
|
+
const verificationToken = await network.pds.ctx.services
|
|
105
|
+
.account(network.pds.ctx.db)
|
|
106
|
+
.createEmailToken(sc.dids.bob, 'confirm_email')
|
|
107
|
+
await agent.api.com.atproto.server.confirmEmail(
|
|
108
|
+
{ email: bobsAccount.email, token: verificationToken },
|
|
109
|
+
{
|
|
110
|
+
encoding: 'application/json',
|
|
111
|
+
|
|
112
|
+
headers: sc.getHeaders(sc.dids.bob),
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
const { data: afterEmailVerification } =
|
|
116
|
+
await agent.api.com.atproto.admin.getRepo(
|
|
117
|
+
{ did: sc.dids.bob },
|
|
118
|
+
{ headers: network.pds.adminAuthHeaders() },
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
expect(afterEmailVerification.emailConfirmedAt).toBeTruthy()
|
|
122
|
+
expect(
|
|
123
|
+
new Date(afterEmailVerification.emailConfirmedAt as string).getTime(),
|
|
124
|
+
).toBeGreaterThan(timestampBeforeVerification)
|
|
125
|
+
})
|
|
126
|
+
|
|
94
127
|
it('fails when repo does not exist.', async () => {
|
|
95
128
|
const promise = agent.api.com.atproto.admin.getRepo(
|
|
96
129
|
{ did: 'did:plc:doesnotexist' },
|
|
@@ -19,10 +19,12 @@ describe('pds user search views', () => {
|
|
|
19
19
|
await network.bsky.processAll()
|
|
20
20
|
|
|
21
21
|
const suggestions = [
|
|
22
|
-
{ did: sc.dids.
|
|
23
|
-
{ did: sc.dids.
|
|
24
|
-
{ did: sc.dids.
|
|
22
|
+
{ did: sc.dids.alice, order: 1 },
|
|
23
|
+
{ did: sc.dids.bob, order: 2 },
|
|
24
|
+
{ did: sc.dids.carol, order: 3 },
|
|
25
|
+
{ did: sc.dids.dan, order: 4 },
|
|
25
26
|
]
|
|
27
|
+
|
|
26
28
|
await network.bsky.ctx.db
|
|
27
29
|
.getPrimary()
|
|
28
30
|
.db.insertInto('suggested_follow')
|
|
@@ -63,16 +65,22 @@ describe('pds user search views', () => {
|
|
|
63
65
|
{ limit: 1 },
|
|
64
66
|
{ headers: await network.serviceHeaders(sc.dids.carol) },
|
|
65
67
|
)
|
|
68
|
+
expect(result1.data.actors.length).toBe(1)
|
|
69
|
+
expect(result1.data.actors[0].handle).toEqual('bob.test')
|
|
70
|
+
|
|
66
71
|
const result2 = await agent.api.app.bsky.actor.getSuggestions(
|
|
67
72
|
{ limit: 1, cursor: result1.data.cursor },
|
|
68
73
|
{ headers: await network.serviceHeaders(sc.dids.carol) },
|
|
69
74
|
)
|
|
70
|
-
|
|
71
|
-
expect(result1.data.actors.length).toBe(1)
|
|
72
|
-
expect(result1.data.actors[0].handle).toEqual('bob.test')
|
|
73
|
-
|
|
74
75
|
expect(result2.data.actors.length).toBe(1)
|
|
75
76
|
expect(result2.data.actors[0].handle).toEqual('dan.test')
|
|
77
|
+
|
|
78
|
+
const result3 = await agent.api.app.bsky.actor.getSuggestions(
|
|
79
|
+
{ limit: 1, cursor: result2.data.cursor },
|
|
80
|
+
{ headers: await network.serviceHeaders(sc.dids.carol) },
|
|
81
|
+
)
|
|
82
|
+
expect(result3.data.actors.length).toBe(0)
|
|
83
|
+
expect(result3.data.cursor).toBeUndefined()
|
|
76
84
|
})
|
|
77
85
|
|
|
78
86
|
it('fetches suggestions unauthed', async () => {
|