@atproto/api 0.9.3 → 0.9.4
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 +7 -0
- package/dist/bsky-agent.d.ts +2 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/lexicons.d.ts +105 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts +7 -1
- package/dist/client/types/app/bsky/graph/defs.d.ts +15 -0
- package/dist/client/types/app/bsky/graph/getRelationships.d.ts +27 -0
- package/dist/index.js +219 -45
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +5 -0
- package/package.json +2 -2
- package/src/bsky-agent.ts +27 -0
- package/src/client/index.ts +13 -0
- package/src/client/lexicons.ts +117 -0
- package/src/client/types/app/bsky/actor/defs.ts +19 -0
- package/src/client/types/app/bsky/graph/defs.ts +41 -0
- package/src/client/types/app/bsky/graph/getRelationships.ts +49 -0
- package/src/types.ts +9 -0
- package/tests/bsky-agent.test.ts +109 -0
package/dist/types.d.ts
CHANGED
|
@@ -41,6 +41,10 @@ export interface BskyThreadViewPreference {
|
|
|
41
41
|
prioritizeFollowedUsers: boolean;
|
|
42
42
|
[key: string]: any;
|
|
43
43
|
}
|
|
44
|
+
export interface BskyInterestsPreference {
|
|
45
|
+
tags: string[];
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
|
44
48
|
export interface BskyPreferences {
|
|
45
49
|
feeds: {
|
|
46
50
|
saved?: string[];
|
|
@@ -51,5 +55,6 @@ export interface BskyPreferences {
|
|
|
51
55
|
adultContentEnabled: boolean;
|
|
52
56
|
contentLabels: Record<string, BskyLabelPreference>;
|
|
53
57
|
birthDate: Date | undefined;
|
|
58
|
+
interests: BskyInterestsPreference;
|
|
54
59
|
}
|
|
55
60
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/api",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client library for atproto and Bluesky",
|
|
6
6
|
"keywords": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"common-tags": "^1.8.2",
|
|
30
30
|
"@atproto/lex-cli": "^0.3.0",
|
|
31
|
-
"@atproto/dev-env": "^0.2.
|
|
31
|
+
"@atproto/dev-env": "^0.2.27"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"codegen": "pnpm docgen && node ./scripts/generate-code.mjs && lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
|
package/src/bsky-agent.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
BskyLabelPreference,
|
|
12
12
|
BskyFeedViewPreference,
|
|
13
13
|
BskyThreadViewPreference,
|
|
14
|
+
BskyInterestsPreference,
|
|
14
15
|
} from './types'
|
|
15
16
|
|
|
16
17
|
const FEED_VIEW_PREF_DEFAULTS = {
|
|
@@ -323,6 +324,9 @@ export class BskyAgent extends AtpAgent {
|
|
|
323
324
|
adultContentEnabled: false,
|
|
324
325
|
contentLabels: {},
|
|
325
326
|
birthDate: undefined,
|
|
327
|
+
interests: {
|
|
328
|
+
tags: [],
|
|
329
|
+
},
|
|
326
330
|
}
|
|
327
331
|
const res = await this.app.bsky.actor.getPreferences({})
|
|
328
332
|
for (const pref of res.data.preferences) {
|
|
@@ -369,6 +373,13 @@ export class BskyAgent extends AtpAgent {
|
|
|
369
373
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
370
374
|
const { $type, ...v } = pref
|
|
371
375
|
prefs.threadViewPrefs = { ...prefs.threadViewPrefs, ...v }
|
|
376
|
+
} else if (
|
|
377
|
+
AppBskyActorDefs.isInterestsPref(pref) &&
|
|
378
|
+
AppBskyActorDefs.validateInterestsPref(pref).success
|
|
379
|
+
) {
|
|
380
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
381
|
+
const { $type, ...v } = pref
|
|
382
|
+
prefs.interests = { ...prefs.interests, ...v }
|
|
372
383
|
}
|
|
373
384
|
}
|
|
374
385
|
return prefs
|
|
@@ -521,6 +532,22 @@ export class BskyAgent extends AtpAgent {
|
|
|
521
532
|
.concat([{ ...pref, $type: 'app.bsky.actor.defs#threadViewPref' }])
|
|
522
533
|
})
|
|
523
534
|
}
|
|
535
|
+
|
|
536
|
+
async setInterestsPref(pref: Partial<BskyInterestsPreference>) {
|
|
537
|
+
await updatePreferences(this, (prefs: AppBskyActorDefs.Preferences) => {
|
|
538
|
+
const existing = prefs.findLast(
|
|
539
|
+
(pref) =>
|
|
540
|
+
AppBskyActorDefs.isInterestsPref(pref) &&
|
|
541
|
+
AppBskyActorDefs.validateInterestsPref(pref).success,
|
|
542
|
+
)
|
|
543
|
+
if (existing) {
|
|
544
|
+
pref = { ...existing, ...pref }
|
|
545
|
+
}
|
|
546
|
+
return prefs
|
|
547
|
+
.filter((p) => !AppBskyActorDefs.isInterestsPref(p))
|
|
548
|
+
.concat([{ ...pref, $type: 'app.bsky.actor.defs#interestsPref' }])
|
|
549
|
+
})
|
|
550
|
+
}
|
|
524
551
|
}
|
|
525
552
|
|
|
526
553
|
/**
|
package/src/client/index.ts
CHANGED
|
@@ -132,6 +132,7 @@ import * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
|
|
|
132
132
|
import * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
133
133
|
import * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
134
134
|
import * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
135
|
+
import * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships'
|
|
135
136
|
import * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor'
|
|
136
137
|
import * as AppBskyGraphList from './types/app/bsky/graph/list'
|
|
137
138
|
import * as AppBskyGraphListblock from './types/app/bsky/graph/listblock'
|
|
@@ -277,6 +278,7 @@ export * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
|
|
|
277
278
|
export * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
278
279
|
export * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
279
280
|
export * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
281
|
+
export * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships'
|
|
280
282
|
export * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor'
|
|
281
283
|
export * as AppBskyGraphList from './types/app/bsky/graph/list'
|
|
282
284
|
export * as AppBskyGraphListblock from './types/app/bsky/graph/listblock'
|
|
@@ -2057,6 +2059,17 @@ export class AppBskyGraphNS {
|
|
|
2057
2059
|
})
|
|
2058
2060
|
}
|
|
2059
2061
|
|
|
2062
|
+
getRelationships(
|
|
2063
|
+
params?: AppBskyGraphGetRelationships.QueryParams,
|
|
2064
|
+
opts?: AppBskyGraphGetRelationships.CallOptions,
|
|
2065
|
+
): Promise<AppBskyGraphGetRelationships.Response> {
|
|
2066
|
+
return this._service.xrpc
|
|
2067
|
+
.call('app.bsky.graph.getRelationships', params, undefined, opts)
|
|
2068
|
+
.catch((e) => {
|
|
2069
|
+
throw AppBskyGraphGetRelationships.toKnownErr(e)
|
|
2070
|
+
})
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2060
2073
|
getSuggestedFollowsByActor(
|
|
2061
2074
|
params?: AppBskyGraphGetSuggestedFollowsByActor.QueryParams,
|
|
2062
2075
|
opts?: AppBskyGraphGetSuggestedFollowsByActor.CallOptions,
|
package/src/client/lexicons.ts
CHANGED
|
@@ -4615,6 +4615,7 @@ export const schemaDict = {
|
|
|
4615
4615
|
'lex:app.bsky.actor.defs#personalDetailsPref',
|
|
4616
4616
|
'lex:app.bsky.actor.defs#feedViewPref',
|
|
4617
4617
|
'lex:app.bsky.actor.defs#threadViewPref',
|
|
4618
|
+
'lex:app.bsky.actor.defs#interestsPref',
|
|
4618
4619
|
],
|
|
4619
4620
|
},
|
|
4620
4621
|
},
|
|
@@ -4718,6 +4719,23 @@ export const schemaDict = {
|
|
|
4718
4719
|
},
|
|
4719
4720
|
},
|
|
4720
4721
|
},
|
|
4722
|
+
interestsPref: {
|
|
4723
|
+
type: 'object',
|
|
4724
|
+
required: ['tags'],
|
|
4725
|
+
properties: {
|
|
4726
|
+
tags: {
|
|
4727
|
+
type: 'array',
|
|
4728
|
+
maxLength: 100,
|
|
4729
|
+
items: {
|
|
4730
|
+
type: 'string',
|
|
4731
|
+
maxLength: 640,
|
|
4732
|
+
maxGraphemes: 64,
|
|
4733
|
+
},
|
|
4734
|
+
description:
|
|
4735
|
+
"A list of tags which describe the account owner's interests gathered during onboarding.",
|
|
4736
|
+
},
|
|
4737
|
+
},
|
|
4738
|
+
},
|
|
4721
4739
|
},
|
|
4722
4740
|
},
|
|
4723
4741
|
AppBskyActorGetPreferences: {
|
|
@@ -6925,6 +6943,45 @@ export const schemaDict = {
|
|
|
6925
6943
|
},
|
|
6926
6944
|
},
|
|
6927
6945
|
},
|
|
6946
|
+
notFoundActor: {
|
|
6947
|
+
type: 'object',
|
|
6948
|
+
description: 'indicates that a handle or DID could not be resolved',
|
|
6949
|
+
required: ['actor', 'notFound'],
|
|
6950
|
+
properties: {
|
|
6951
|
+
actor: {
|
|
6952
|
+
type: 'string',
|
|
6953
|
+
format: 'at-identifier',
|
|
6954
|
+
},
|
|
6955
|
+
notFound: {
|
|
6956
|
+
type: 'boolean',
|
|
6957
|
+
const: true,
|
|
6958
|
+
},
|
|
6959
|
+
},
|
|
6960
|
+
},
|
|
6961
|
+
relationship: {
|
|
6962
|
+
type: 'object',
|
|
6963
|
+
description:
|
|
6964
|
+
'lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object)',
|
|
6965
|
+
required: ['did'],
|
|
6966
|
+
properties: {
|
|
6967
|
+
did: {
|
|
6968
|
+
type: 'string',
|
|
6969
|
+
format: 'did',
|
|
6970
|
+
},
|
|
6971
|
+
following: {
|
|
6972
|
+
type: 'string',
|
|
6973
|
+
format: 'at-uri',
|
|
6974
|
+
description:
|
|
6975
|
+
'if the actor follows this DID, this is the AT-URI of the follow record',
|
|
6976
|
+
},
|
|
6977
|
+
followedBy: {
|
|
6978
|
+
type: 'string',
|
|
6979
|
+
format: 'at-uri',
|
|
6980
|
+
description:
|
|
6981
|
+
'if the actor is followed by this DID, contains the AT-URI of the follow record',
|
|
6982
|
+
},
|
|
6983
|
+
},
|
|
6984
|
+
},
|
|
6928
6985
|
},
|
|
6929
6986
|
},
|
|
6930
6987
|
AppBskyGraphFollow: {
|
|
@@ -7328,6 +7385,65 @@ export const schemaDict = {
|
|
|
7328
7385
|
},
|
|
7329
7386
|
},
|
|
7330
7387
|
},
|
|
7388
|
+
AppBskyGraphGetRelationships: {
|
|
7389
|
+
lexicon: 1,
|
|
7390
|
+
id: 'app.bsky.graph.getRelationships',
|
|
7391
|
+
defs: {
|
|
7392
|
+
main: {
|
|
7393
|
+
type: 'query',
|
|
7394
|
+
description:
|
|
7395
|
+
'Enumerates public relationships between one account, and a list of other accounts',
|
|
7396
|
+
parameters: {
|
|
7397
|
+
type: 'params',
|
|
7398
|
+
required: ['actor'],
|
|
7399
|
+
properties: {
|
|
7400
|
+
actor: {
|
|
7401
|
+
type: 'string',
|
|
7402
|
+
format: 'at-identifier',
|
|
7403
|
+
},
|
|
7404
|
+
others: {
|
|
7405
|
+
type: 'array',
|
|
7406
|
+
maxLength: 30,
|
|
7407
|
+
items: {
|
|
7408
|
+
type: 'string',
|
|
7409
|
+
format: 'at-identifier',
|
|
7410
|
+
},
|
|
7411
|
+
},
|
|
7412
|
+
},
|
|
7413
|
+
},
|
|
7414
|
+
output: {
|
|
7415
|
+
encoding: 'application/json',
|
|
7416
|
+
schema: {
|
|
7417
|
+
type: 'object',
|
|
7418
|
+
required: ['relationships'],
|
|
7419
|
+
properties: {
|
|
7420
|
+
actor: {
|
|
7421
|
+
type: 'string',
|
|
7422
|
+
format: 'did',
|
|
7423
|
+
},
|
|
7424
|
+
relationships: {
|
|
7425
|
+
type: 'array',
|
|
7426
|
+
items: {
|
|
7427
|
+
type: 'union',
|
|
7428
|
+
refs: [
|
|
7429
|
+
'lex:app.bsky.graph.defs#relationship',
|
|
7430
|
+
'lex:app.bsky.graph.defs#notFoundActor',
|
|
7431
|
+
],
|
|
7432
|
+
},
|
|
7433
|
+
},
|
|
7434
|
+
},
|
|
7435
|
+
},
|
|
7436
|
+
},
|
|
7437
|
+
errors: [
|
|
7438
|
+
{
|
|
7439
|
+
name: 'ActorNotFound',
|
|
7440
|
+
description:
|
|
7441
|
+
'the primary actor at-identifier could not be resolved',
|
|
7442
|
+
},
|
|
7443
|
+
],
|
|
7444
|
+
},
|
|
7445
|
+
},
|
|
7446
|
+
},
|
|
7331
7447
|
AppBskyGraphGetSuggestedFollowsByActor: {
|
|
7332
7448
|
lexicon: 1,
|
|
7333
7449
|
id: 'app.bsky.graph.getSuggestedFollowsByActor',
|
|
@@ -8272,6 +8388,7 @@ export const ids = {
|
|
|
8272
8388
|
AppBskyGraphGetListMutes: 'app.bsky.graph.getListMutes',
|
|
8273
8389
|
AppBskyGraphGetLists: 'app.bsky.graph.getLists',
|
|
8274
8390
|
AppBskyGraphGetMutes: 'app.bsky.graph.getMutes',
|
|
8391
|
+
AppBskyGraphGetRelationships: 'app.bsky.graph.getRelationships',
|
|
8275
8392
|
AppBskyGraphGetSuggestedFollowsByActor:
|
|
8276
8393
|
'app.bsky.graph.getSuggestedFollowsByActor',
|
|
8277
8394
|
AppBskyGraphList: 'app.bsky.graph.list',
|
|
@@ -112,6 +112,7 @@ export type Preferences = (
|
|
|
112
112
|
| PersonalDetailsPref
|
|
113
113
|
| FeedViewPref
|
|
114
114
|
| ThreadViewPref
|
|
115
|
+
| InterestsPref
|
|
115
116
|
| { $type: string; [k: string]: unknown }
|
|
116
117
|
)[]
|
|
117
118
|
|
|
@@ -233,3 +234,21 @@ export function isThreadViewPref(v: unknown): v is ThreadViewPref {
|
|
|
233
234
|
export function validateThreadViewPref(v: unknown): ValidationResult {
|
|
234
235
|
return lexicons.validate('app.bsky.actor.defs#threadViewPref', v)
|
|
235
236
|
}
|
|
237
|
+
|
|
238
|
+
export interface InterestsPref {
|
|
239
|
+
/** A list of tags which describe the account owner's interests gathered during onboarding. */
|
|
240
|
+
tags: string[]
|
|
241
|
+
[k: string]: unknown
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function isInterestsPref(v: unknown): v is InterestsPref {
|
|
245
|
+
return (
|
|
246
|
+
isObj(v) &&
|
|
247
|
+
hasProp(v, '$type') &&
|
|
248
|
+
v.$type === 'app.bsky.actor.defs#interestsPref'
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function validateInterestsPref(v: unknown): ValidationResult {
|
|
253
|
+
return lexicons.validate('app.bsky.actor.defs#interestsPref', v)
|
|
254
|
+
}
|
|
@@ -102,3 +102,44 @@ export function isListViewerState(v: unknown): v is ListViewerState {
|
|
|
102
102
|
export function validateListViewerState(v: unknown): ValidationResult {
|
|
103
103
|
return lexicons.validate('app.bsky.graph.defs#listViewerState', v)
|
|
104
104
|
}
|
|
105
|
+
|
|
106
|
+
/** indicates that a handle or DID could not be resolved */
|
|
107
|
+
export interface NotFoundActor {
|
|
108
|
+
actor: string
|
|
109
|
+
notFound: true
|
|
110
|
+
[k: string]: unknown
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function isNotFoundActor(v: unknown): v is NotFoundActor {
|
|
114
|
+
return (
|
|
115
|
+
isObj(v) &&
|
|
116
|
+
hasProp(v, '$type') &&
|
|
117
|
+
v.$type === 'app.bsky.graph.defs#notFoundActor'
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function validateNotFoundActor(v: unknown): ValidationResult {
|
|
122
|
+
return lexicons.validate('app.bsky.graph.defs#notFoundActor', v)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */
|
|
126
|
+
export interface Relationship {
|
|
127
|
+
did: string
|
|
128
|
+
/** if the actor follows this DID, this is the AT-URI of the follow record */
|
|
129
|
+
following?: string
|
|
130
|
+
/** if the actor is followed by this DID, contains the AT-URI of the follow record */
|
|
131
|
+
followedBy?: string
|
|
132
|
+
[k: string]: unknown
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function isRelationship(v: unknown): v is Relationship {
|
|
136
|
+
return (
|
|
137
|
+
isObj(v) &&
|
|
138
|
+
hasProp(v, '$type') &&
|
|
139
|
+
v.$type === 'app.bsky.graph.defs#relationship'
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function validateRelationship(v: unknown): ValidationResult {
|
|
144
|
+
return lexicons.validate('app.bsky.graph.defs#relationship', v)
|
|
145
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 AppBskyGraphDefs from './defs'
|
|
10
|
+
|
|
11
|
+
export interface QueryParams {
|
|
12
|
+
actor: string
|
|
13
|
+
others?: string[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type InputSchema = undefined
|
|
17
|
+
|
|
18
|
+
export interface OutputSchema {
|
|
19
|
+
actor?: string
|
|
20
|
+
relationships: (
|
|
21
|
+
| AppBskyGraphDefs.Relationship
|
|
22
|
+
| AppBskyGraphDefs.NotFoundActor
|
|
23
|
+
| { $type: string; [k: string]: unknown }
|
|
24
|
+
)[]
|
|
25
|
+
[k: string]: unknown
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface CallOptions {
|
|
29
|
+
headers?: Headers
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Response {
|
|
33
|
+
success: boolean
|
|
34
|
+
headers: Headers
|
|
35
|
+
data: OutputSchema
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class ActorNotFoundError extends XRPCError {
|
|
39
|
+
constructor(src: XRPCError) {
|
|
40
|
+
super(src.status, src.error, src.message, src.headers)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function toKnownErr(e: any) {
|
|
45
|
+
if (e instanceof XRPCError) {
|
|
46
|
+
if (e.error === 'ActorNotFound') return new ActorNotFoundError(e)
|
|
47
|
+
}
|
|
48
|
+
return e
|
|
49
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -97,6 +97,14 @@ export interface BskyThreadViewPreference {
|
|
|
97
97
|
[key: string]: any
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Bluesky interests preferences
|
|
102
|
+
*/
|
|
103
|
+
export interface BskyInterestsPreference {
|
|
104
|
+
tags: string[]
|
|
105
|
+
[key: string]: any
|
|
106
|
+
}
|
|
107
|
+
|
|
100
108
|
/**
|
|
101
109
|
* Bluesky preferences
|
|
102
110
|
*/
|
|
@@ -110,4 +118,5 @@ export interface BskyPreferences {
|
|
|
110
118
|
adultContentEnabled: boolean
|
|
111
119
|
contentLabels: Record<string, BskyLabelPreference>
|
|
112
120
|
birthDate: Date | undefined
|
|
121
|
+
interests: BskyInterestsPreference
|
|
113
122
|
}
|
package/tests/bsky-agent.test.ts
CHANGED
|
@@ -236,6 +236,9 @@ describe('agent', () => {
|
|
|
236
236
|
sort: 'oldest',
|
|
237
237
|
prioritizeFollowedUsers: true,
|
|
238
238
|
},
|
|
239
|
+
interests: {
|
|
240
|
+
tags: [],
|
|
241
|
+
},
|
|
239
242
|
})
|
|
240
243
|
|
|
241
244
|
await agent.setAdultContentEnabled(true)
|
|
@@ -257,6 +260,9 @@ describe('agent', () => {
|
|
|
257
260
|
sort: 'oldest',
|
|
258
261
|
prioritizeFollowedUsers: true,
|
|
259
262
|
},
|
|
263
|
+
interests: {
|
|
264
|
+
tags: [],
|
|
265
|
+
},
|
|
260
266
|
})
|
|
261
267
|
|
|
262
268
|
await agent.setAdultContentEnabled(false)
|
|
@@ -278,6 +284,9 @@ describe('agent', () => {
|
|
|
278
284
|
sort: 'oldest',
|
|
279
285
|
prioritizeFollowedUsers: true,
|
|
280
286
|
},
|
|
287
|
+
interests: {
|
|
288
|
+
tags: [],
|
|
289
|
+
},
|
|
281
290
|
})
|
|
282
291
|
|
|
283
292
|
await agent.setContentLabelPref('impersonation', 'warn')
|
|
@@ -301,6 +310,9 @@ describe('agent', () => {
|
|
|
301
310
|
sort: 'oldest',
|
|
302
311
|
prioritizeFollowedUsers: true,
|
|
303
312
|
},
|
|
313
|
+
interests: {
|
|
314
|
+
tags: [],
|
|
315
|
+
},
|
|
304
316
|
})
|
|
305
317
|
|
|
306
318
|
await agent.setContentLabelPref('spam', 'show') // will convert to 'ignore'
|
|
@@ -326,6 +338,9 @@ describe('agent', () => {
|
|
|
326
338
|
sort: 'oldest',
|
|
327
339
|
prioritizeFollowedUsers: true,
|
|
328
340
|
},
|
|
341
|
+
interests: {
|
|
342
|
+
tags: [],
|
|
343
|
+
},
|
|
329
344
|
})
|
|
330
345
|
|
|
331
346
|
await agent.addSavedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -353,6 +368,9 @@ describe('agent', () => {
|
|
|
353
368
|
sort: 'oldest',
|
|
354
369
|
prioritizeFollowedUsers: true,
|
|
355
370
|
},
|
|
371
|
+
interests: {
|
|
372
|
+
tags: [],
|
|
373
|
+
},
|
|
356
374
|
})
|
|
357
375
|
|
|
358
376
|
await agent.addPinnedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -380,6 +398,9 @@ describe('agent', () => {
|
|
|
380
398
|
sort: 'oldest',
|
|
381
399
|
prioritizeFollowedUsers: true,
|
|
382
400
|
},
|
|
401
|
+
interests: {
|
|
402
|
+
tags: [],
|
|
403
|
+
},
|
|
383
404
|
})
|
|
384
405
|
|
|
385
406
|
await agent.removePinnedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -407,6 +428,9 @@ describe('agent', () => {
|
|
|
407
428
|
sort: 'oldest',
|
|
408
429
|
prioritizeFollowedUsers: true,
|
|
409
430
|
},
|
|
431
|
+
interests: {
|
|
432
|
+
tags: [],
|
|
433
|
+
},
|
|
410
434
|
})
|
|
411
435
|
|
|
412
436
|
await agent.removeSavedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -434,6 +458,9 @@ describe('agent', () => {
|
|
|
434
458
|
sort: 'oldest',
|
|
435
459
|
prioritizeFollowedUsers: true,
|
|
436
460
|
},
|
|
461
|
+
interests: {
|
|
462
|
+
tags: [],
|
|
463
|
+
},
|
|
437
464
|
})
|
|
438
465
|
|
|
439
466
|
await agent.addPinnedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -461,6 +488,9 @@ describe('agent', () => {
|
|
|
461
488
|
sort: 'oldest',
|
|
462
489
|
prioritizeFollowedUsers: true,
|
|
463
490
|
},
|
|
491
|
+
interests: {
|
|
492
|
+
tags: [],
|
|
493
|
+
},
|
|
464
494
|
})
|
|
465
495
|
|
|
466
496
|
await agent.addPinnedFeed('at://bob.com/app.bsky.feed.generator/fake2')
|
|
@@ -494,6 +524,9 @@ describe('agent', () => {
|
|
|
494
524
|
sort: 'oldest',
|
|
495
525
|
prioritizeFollowedUsers: true,
|
|
496
526
|
},
|
|
527
|
+
interests: {
|
|
528
|
+
tags: [],
|
|
529
|
+
},
|
|
497
530
|
})
|
|
498
531
|
|
|
499
532
|
await agent.removeSavedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -521,6 +554,9 @@ describe('agent', () => {
|
|
|
521
554
|
sort: 'oldest',
|
|
522
555
|
prioritizeFollowedUsers: true,
|
|
523
556
|
},
|
|
557
|
+
interests: {
|
|
558
|
+
tags: [],
|
|
559
|
+
},
|
|
524
560
|
})
|
|
525
561
|
|
|
526
562
|
await agent.setPersonalDetails({ birthDate: '2023-09-11T18:05:42.556Z' })
|
|
@@ -548,6 +584,9 @@ describe('agent', () => {
|
|
|
548
584
|
sort: 'oldest',
|
|
549
585
|
prioritizeFollowedUsers: true,
|
|
550
586
|
},
|
|
587
|
+
interests: {
|
|
588
|
+
tags: [],
|
|
589
|
+
},
|
|
551
590
|
})
|
|
552
591
|
|
|
553
592
|
await agent.setFeedViewPrefs('home', { hideReplies: true })
|
|
@@ -575,6 +614,9 @@ describe('agent', () => {
|
|
|
575
614
|
sort: 'oldest',
|
|
576
615
|
prioritizeFollowedUsers: true,
|
|
577
616
|
},
|
|
617
|
+
interests: {
|
|
618
|
+
tags: [],
|
|
619
|
+
},
|
|
578
620
|
})
|
|
579
621
|
|
|
580
622
|
await agent.setFeedViewPrefs('home', { hideReplies: false })
|
|
@@ -602,6 +644,9 @@ describe('agent', () => {
|
|
|
602
644
|
sort: 'oldest',
|
|
603
645
|
prioritizeFollowedUsers: true,
|
|
604
646
|
},
|
|
647
|
+
interests: {
|
|
648
|
+
tags: [],
|
|
649
|
+
},
|
|
605
650
|
})
|
|
606
651
|
|
|
607
652
|
await agent.setFeedViewPrefs('other', { hideReplies: true })
|
|
@@ -636,6 +681,9 @@ describe('agent', () => {
|
|
|
636
681
|
sort: 'oldest',
|
|
637
682
|
prioritizeFollowedUsers: true,
|
|
638
683
|
},
|
|
684
|
+
interests: {
|
|
685
|
+
tags: [],
|
|
686
|
+
},
|
|
639
687
|
})
|
|
640
688
|
|
|
641
689
|
await agent.setThreadViewPrefs({ sort: 'random' })
|
|
@@ -670,6 +718,9 @@ describe('agent', () => {
|
|
|
670
718
|
sort: 'random',
|
|
671
719
|
prioritizeFollowedUsers: true,
|
|
672
720
|
},
|
|
721
|
+
interests: {
|
|
722
|
+
tags: [],
|
|
723
|
+
},
|
|
673
724
|
})
|
|
674
725
|
|
|
675
726
|
await agent.setThreadViewPrefs({ sort: 'oldest' })
|
|
@@ -704,6 +755,46 @@ describe('agent', () => {
|
|
|
704
755
|
sort: 'oldest',
|
|
705
756
|
prioritizeFollowedUsers: true,
|
|
706
757
|
},
|
|
758
|
+
interests: {
|
|
759
|
+
tags: [],
|
|
760
|
+
},
|
|
761
|
+
})
|
|
762
|
+
|
|
763
|
+
await agent.setInterestsPref({ tags: ['foo', 'bar'] })
|
|
764
|
+
await expect(agent.getPreferences()).resolves.toStrictEqual({
|
|
765
|
+
feeds: {
|
|
766
|
+
pinned: ['at://bob.com/app.bsky.feed.generator/fake2'],
|
|
767
|
+
saved: ['at://bob.com/app.bsky.feed.generator/fake2'],
|
|
768
|
+
},
|
|
769
|
+
adultContentEnabled: false,
|
|
770
|
+
contentLabels: {
|
|
771
|
+
impersonation: 'hide',
|
|
772
|
+
spam: 'ignore',
|
|
773
|
+
},
|
|
774
|
+
birthDate: new Date('2023-09-11T18:05:42.556Z'),
|
|
775
|
+
feedViewPrefs: {
|
|
776
|
+
home: {
|
|
777
|
+
hideReplies: false,
|
|
778
|
+
hideRepliesByUnfollowed: false,
|
|
779
|
+
hideRepliesByLikeCount: 0,
|
|
780
|
+
hideReposts: false,
|
|
781
|
+
hideQuotePosts: false,
|
|
782
|
+
},
|
|
783
|
+
other: {
|
|
784
|
+
hideReplies: true,
|
|
785
|
+
hideRepliesByUnfollowed: false,
|
|
786
|
+
hideRepliesByLikeCount: 0,
|
|
787
|
+
hideReposts: false,
|
|
788
|
+
hideQuotePosts: false,
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
threadViewPrefs: {
|
|
792
|
+
sort: 'oldest',
|
|
793
|
+
prioritizeFollowedUsers: true,
|
|
794
|
+
},
|
|
795
|
+
interests: {
|
|
796
|
+
tags: ['foo', 'bar'],
|
|
797
|
+
},
|
|
707
798
|
})
|
|
708
799
|
})
|
|
709
800
|
|
|
@@ -827,6 +918,9 @@ describe('agent', () => {
|
|
|
827
918
|
sort: 'newest',
|
|
828
919
|
prioritizeFollowedUsers: false,
|
|
829
920
|
},
|
|
921
|
+
interests: {
|
|
922
|
+
tags: [],
|
|
923
|
+
},
|
|
830
924
|
})
|
|
831
925
|
|
|
832
926
|
await agent.setAdultContentEnabled(false)
|
|
@@ -853,6 +947,9 @@ describe('agent', () => {
|
|
|
853
947
|
sort: 'newest',
|
|
854
948
|
prioritizeFollowedUsers: false,
|
|
855
949
|
},
|
|
950
|
+
interests: {
|
|
951
|
+
tags: [],
|
|
952
|
+
},
|
|
856
953
|
})
|
|
857
954
|
|
|
858
955
|
await agent.setContentLabelPref('nsfw', 'hide')
|
|
@@ -879,6 +976,9 @@ describe('agent', () => {
|
|
|
879
976
|
sort: 'newest',
|
|
880
977
|
prioritizeFollowedUsers: false,
|
|
881
978
|
},
|
|
979
|
+
interests: {
|
|
980
|
+
tags: [],
|
|
981
|
+
},
|
|
882
982
|
})
|
|
883
983
|
|
|
884
984
|
await agent.addPinnedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -905,6 +1005,9 @@ describe('agent', () => {
|
|
|
905
1005
|
sort: 'newest',
|
|
906
1006
|
prioritizeFollowedUsers: false,
|
|
907
1007
|
},
|
|
1008
|
+
interests: {
|
|
1009
|
+
tags: [],
|
|
1010
|
+
},
|
|
908
1011
|
})
|
|
909
1012
|
|
|
910
1013
|
await agent.setPersonalDetails({ birthDate: '2023-09-11T18:05:42.556Z' })
|
|
@@ -931,6 +1034,9 @@ describe('agent', () => {
|
|
|
931
1034
|
sort: 'newest',
|
|
932
1035
|
prioritizeFollowedUsers: false,
|
|
933
1036
|
},
|
|
1037
|
+
interests: {
|
|
1038
|
+
tags: [],
|
|
1039
|
+
},
|
|
934
1040
|
})
|
|
935
1041
|
|
|
936
1042
|
await agent.setFeedViewPrefs('home', {
|
|
@@ -968,6 +1074,9 @@ describe('agent', () => {
|
|
|
968
1074
|
sort: 'oldest',
|
|
969
1075
|
prioritizeFollowedUsers: true,
|
|
970
1076
|
},
|
|
1077
|
+
interests: {
|
|
1078
|
+
tags: [],
|
|
1079
|
+
},
|
|
971
1080
|
})
|
|
972
1081
|
|
|
973
1082
|
const res = await agent.app.bsky.actor.getPreferences()
|