@atproto/api 0.12.22 → 0.12.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.
- package/CHANGELOG.md +6 -0
- package/dist/bsky-agent.d.ts +5 -0
- package/dist/bsky-agent.d.ts.map +1 -1
- package/dist/bsky-agent.js +89 -8
- package/dist/bsky-agent.js.map +1 -1
- package/dist/client/lexicons.d.ts +30 -0
- package/dist/client/lexicons.d.ts.map +1 -1
- package/dist/client/lexicons.js +32 -1
- package/dist/client/lexicons.js.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.d.ts +17 -1
- package/dist/client/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.js +21 -1
- package/dist/client/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/bsky-agent.ts +109 -8
- package/src/client/lexicons.ts +35 -1
- package/src/client/types/app/bsky/actor/defs.ts +39 -0
- package/src/types.ts +4 -0
- package/tests/bsky-agent.test.ts +195 -0
- package/tests/moderation-prefs.test.ts +16 -0
package/tests/bsky-agent.test.ts
CHANGED
|
@@ -276,6 +276,10 @@ describe('agent', () => {
|
|
|
276
276
|
interests: {
|
|
277
277
|
tags: [],
|
|
278
278
|
},
|
|
279
|
+
bskyAppState: {
|
|
280
|
+
activeProgressGuide: undefined,
|
|
281
|
+
queuedNudges: [],
|
|
282
|
+
},
|
|
279
283
|
})
|
|
280
284
|
|
|
281
285
|
await agent.setAdultContentEnabled(true)
|
|
@@ -313,6 +317,10 @@ describe('agent', () => {
|
|
|
313
317
|
interests: {
|
|
314
318
|
tags: [],
|
|
315
319
|
},
|
|
320
|
+
bskyAppState: {
|
|
321
|
+
activeProgressGuide: undefined,
|
|
322
|
+
queuedNudges: [],
|
|
323
|
+
},
|
|
316
324
|
})
|
|
317
325
|
|
|
318
326
|
await agent.setAdultContentEnabled(false)
|
|
@@ -350,6 +358,10 @@ describe('agent', () => {
|
|
|
350
358
|
interests: {
|
|
351
359
|
tags: [],
|
|
352
360
|
},
|
|
361
|
+
bskyAppState: {
|
|
362
|
+
activeProgressGuide: undefined,
|
|
363
|
+
queuedNudges: [],
|
|
364
|
+
},
|
|
353
365
|
})
|
|
354
366
|
|
|
355
367
|
await agent.setContentLabelPref('misinfo', 'hide')
|
|
@@ -387,6 +399,10 @@ describe('agent', () => {
|
|
|
387
399
|
interests: {
|
|
388
400
|
tags: [],
|
|
389
401
|
},
|
|
402
|
+
bskyAppState: {
|
|
403
|
+
activeProgressGuide: undefined,
|
|
404
|
+
queuedNudges: [],
|
|
405
|
+
},
|
|
390
406
|
})
|
|
391
407
|
|
|
392
408
|
await agent.setContentLabelPref('spam', 'ignore')
|
|
@@ -428,6 +444,10 @@ describe('agent', () => {
|
|
|
428
444
|
interests: {
|
|
429
445
|
tags: [],
|
|
430
446
|
},
|
|
447
|
+
bskyAppState: {
|
|
448
|
+
activeProgressGuide: undefined,
|
|
449
|
+
queuedNudges: [],
|
|
450
|
+
},
|
|
431
451
|
})
|
|
432
452
|
|
|
433
453
|
await agent.addSavedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -472,6 +492,10 @@ describe('agent', () => {
|
|
|
472
492
|
interests: {
|
|
473
493
|
tags: [],
|
|
474
494
|
},
|
|
495
|
+
bskyAppState: {
|
|
496
|
+
activeProgressGuide: undefined,
|
|
497
|
+
queuedNudges: [],
|
|
498
|
+
},
|
|
475
499
|
})
|
|
476
500
|
|
|
477
501
|
await agent.addPinnedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -516,6 +540,10 @@ describe('agent', () => {
|
|
|
516
540
|
interests: {
|
|
517
541
|
tags: [],
|
|
518
542
|
},
|
|
543
|
+
bskyAppState: {
|
|
544
|
+
activeProgressGuide: undefined,
|
|
545
|
+
queuedNudges: [],
|
|
546
|
+
},
|
|
519
547
|
})
|
|
520
548
|
|
|
521
549
|
await agent.removePinnedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -560,6 +588,10 @@ describe('agent', () => {
|
|
|
560
588
|
interests: {
|
|
561
589
|
tags: [],
|
|
562
590
|
},
|
|
591
|
+
bskyAppState: {
|
|
592
|
+
activeProgressGuide: undefined,
|
|
593
|
+
queuedNudges: [],
|
|
594
|
+
},
|
|
563
595
|
})
|
|
564
596
|
|
|
565
597
|
await agent.removeSavedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -604,6 +636,10 @@ describe('agent', () => {
|
|
|
604
636
|
interests: {
|
|
605
637
|
tags: [],
|
|
606
638
|
},
|
|
639
|
+
bskyAppState: {
|
|
640
|
+
activeProgressGuide: undefined,
|
|
641
|
+
queuedNudges: [],
|
|
642
|
+
},
|
|
607
643
|
})
|
|
608
644
|
|
|
609
645
|
await agent.addPinnedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -648,6 +684,10 @@ describe('agent', () => {
|
|
|
648
684
|
interests: {
|
|
649
685
|
tags: [],
|
|
650
686
|
},
|
|
687
|
+
bskyAppState: {
|
|
688
|
+
activeProgressGuide: undefined,
|
|
689
|
+
queuedNudges: [],
|
|
690
|
+
},
|
|
651
691
|
})
|
|
652
692
|
|
|
653
693
|
await agent.addPinnedFeed('at://bob.com/app.bsky.feed.generator/fake2')
|
|
@@ -698,6 +738,10 @@ describe('agent', () => {
|
|
|
698
738
|
interests: {
|
|
699
739
|
tags: [],
|
|
700
740
|
},
|
|
741
|
+
bskyAppState: {
|
|
742
|
+
activeProgressGuide: undefined,
|
|
743
|
+
queuedNudges: [],
|
|
744
|
+
},
|
|
701
745
|
})
|
|
702
746
|
|
|
703
747
|
await agent.removeSavedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -742,6 +786,10 @@ describe('agent', () => {
|
|
|
742
786
|
interests: {
|
|
743
787
|
tags: [],
|
|
744
788
|
},
|
|
789
|
+
bskyAppState: {
|
|
790
|
+
activeProgressGuide: undefined,
|
|
791
|
+
queuedNudges: [],
|
|
792
|
+
},
|
|
745
793
|
})
|
|
746
794
|
|
|
747
795
|
await agent.setPersonalDetails({ birthDate: '2023-09-11T18:05:42.556Z' })
|
|
@@ -786,6 +834,10 @@ describe('agent', () => {
|
|
|
786
834
|
interests: {
|
|
787
835
|
tags: [],
|
|
788
836
|
},
|
|
837
|
+
bskyAppState: {
|
|
838
|
+
activeProgressGuide: undefined,
|
|
839
|
+
queuedNudges: [],
|
|
840
|
+
},
|
|
789
841
|
})
|
|
790
842
|
|
|
791
843
|
await agent.setFeedViewPrefs('home', { hideReplies: true })
|
|
@@ -830,6 +882,10 @@ describe('agent', () => {
|
|
|
830
882
|
interests: {
|
|
831
883
|
tags: [],
|
|
832
884
|
},
|
|
885
|
+
bskyAppState: {
|
|
886
|
+
activeProgressGuide: undefined,
|
|
887
|
+
queuedNudges: [],
|
|
888
|
+
},
|
|
833
889
|
})
|
|
834
890
|
|
|
835
891
|
await agent.setFeedViewPrefs('home', { hideReplies: false })
|
|
@@ -874,6 +930,10 @@ describe('agent', () => {
|
|
|
874
930
|
interests: {
|
|
875
931
|
tags: [],
|
|
876
932
|
},
|
|
933
|
+
bskyAppState: {
|
|
934
|
+
activeProgressGuide: undefined,
|
|
935
|
+
queuedNudges: [],
|
|
936
|
+
},
|
|
877
937
|
})
|
|
878
938
|
|
|
879
939
|
await agent.setFeedViewPrefs('other', { hideReplies: true })
|
|
@@ -925,6 +985,10 @@ describe('agent', () => {
|
|
|
925
985
|
interests: {
|
|
926
986
|
tags: [],
|
|
927
987
|
},
|
|
988
|
+
bskyAppState: {
|
|
989
|
+
activeProgressGuide: undefined,
|
|
990
|
+
queuedNudges: [],
|
|
991
|
+
},
|
|
928
992
|
})
|
|
929
993
|
|
|
930
994
|
await agent.setThreadViewPrefs({ sort: 'random' })
|
|
@@ -976,6 +1040,10 @@ describe('agent', () => {
|
|
|
976
1040
|
interests: {
|
|
977
1041
|
tags: [],
|
|
978
1042
|
},
|
|
1043
|
+
bskyAppState: {
|
|
1044
|
+
activeProgressGuide: undefined,
|
|
1045
|
+
queuedNudges: [],
|
|
1046
|
+
},
|
|
979
1047
|
})
|
|
980
1048
|
|
|
981
1049
|
await agent.setThreadViewPrefs({ sort: 'oldest' })
|
|
@@ -1027,6 +1095,10 @@ describe('agent', () => {
|
|
|
1027
1095
|
interests: {
|
|
1028
1096
|
tags: [],
|
|
1029
1097
|
},
|
|
1098
|
+
bskyAppState: {
|
|
1099
|
+
activeProgressGuide: undefined,
|
|
1100
|
+
queuedNudges: [],
|
|
1101
|
+
},
|
|
1030
1102
|
})
|
|
1031
1103
|
|
|
1032
1104
|
await agent.setInterestsPref({ tags: ['foo', 'bar'] })
|
|
@@ -1078,6 +1150,10 @@ describe('agent', () => {
|
|
|
1078
1150
|
interests: {
|
|
1079
1151
|
tags: ['foo', 'bar'],
|
|
1080
1152
|
},
|
|
1153
|
+
bskyAppState: {
|
|
1154
|
+
activeProgressGuide: undefined,
|
|
1155
|
+
queuedNudges: [],
|
|
1156
|
+
},
|
|
1081
1157
|
})
|
|
1082
1158
|
})
|
|
1083
1159
|
|
|
@@ -1195,6 +1271,15 @@ describe('agent', () => {
|
|
|
1195
1271
|
sort: 'newest',
|
|
1196
1272
|
prioritizeFollowedUsers: false,
|
|
1197
1273
|
},
|
|
1274
|
+
{
|
|
1275
|
+
$type: 'app.bsky.actor.defs#bskyAppStatePref',
|
|
1276
|
+
queuedNudges: ['one'],
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
$type: 'app.bsky.actor.defs#bskyAppStatePref',
|
|
1280
|
+
activeProgressGuide: undefined,
|
|
1281
|
+
queuedNudges: ['two'],
|
|
1282
|
+
},
|
|
1198
1283
|
],
|
|
1199
1284
|
})
|
|
1200
1285
|
await expect(agent.getPreferences()).resolves.toStrictEqual({
|
|
@@ -1247,6 +1332,10 @@ describe('agent', () => {
|
|
|
1247
1332
|
interests: {
|
|
1248
1333
|
tags: [],
|
|
1249
1334
|
},
|
|
1335
|
+
bskyAppState: {
|
|
1336
|
+
activeProgressGuide: undefined,
|
|
1337
|
+
queuedNudges: ['two'],
|
|
1338
|
+
},
|
|
1250
1339
|
})
|
|
1251
1340
|
|
|
1252
1341
|
await agent.setAdultContentEnabled(false)
|
|
@@ -1300,6 +1389,10 @@ describe('agent', () => {
|
|
|
1300
1389
|
interests: {
|
|
1301
1390
|
tags: [],
|
|
1302
1391
|
},
|
|
1392
|
+
bskyAppState: {
|
|
1393
|
+
activeProgressGuide: undefined,
|
|
1394
|
+
queuedNudges: ['two'],
|
|
1395
|
+
},
|
|
1303
1396
|
})
|
|
1304
1397
|
|
|
1305
1398
|
await agent.setContentLabelPref('porn', 'ignore')
|
|
@@ -1354,6 +1447,10 @@ describe('agent', () => {
|
|
|
1354
1447
|
interests: {
|
|
1355
1448
|
tags: [],
|
|
1356
1449
|
},
|
|
1450
|
+
bskyAppState: {
|
|
1451
|
+
activeProgressGuide: undefined,
|
|
1452
|
+
queuedNudges: ['two'],
|
|
1453
|
+
},
|
|
1357
1454
|
})
|
|
1358
1455
|
|
|
1359
1456
|
await agent.removeLabeler('did:plc:other')
|
|
@@ -1404,6 +1501,10 @@ describe('agent', () => {
|
|
|
1404
1501
|
interests: {
|
|
1405
1502
|
tags: [],
|
|
1406
1503
|
},
|
|
1504
|
+
bskyAppState: {
|
|
1505
|
+
activeProgressGuide: undefined,
|
|
1506
|
+
queuedNudges: ['two'],
|
|
1507
|
+
},
|
|
1407
1508
|
})
|
|
1408
1509
|
|
|
1409
1510
|
await agent.addPinnedFeed('at://bob.com/app.bsky.feed.generator/fake')
|
|
@@ -1454,6 +1555,10 @@ describe('agent', () => {
|
|
|
1454
1555
|
interests: {
|
|
1455
1556
|
tags: [],
|
|
1456
1557
|
},
|
|
1558
|
+
bskyAppState: {
|
|
1559
|
+
activeProgressGuide: undefined,
|
|
1560
|
+
queuedNudges: ['two'],
|
|
1561
|
+
},
|
|
1457
1562
|
})
|
|
1458
1563
|
|
|
1459
1564
|
await agent.setPersonalDetails({ birthDate: '2023-09-11T18:05:42.556Z' })
|
|
@@ -1504,6 +1609,10 @@ describe('agent', () => {
|
|
|
1504
1609
|
interests: {
|
|
1505
1610
|
tags: [],
|
|
1506
1611
|
},
|
|
1612
|
+
bskyAppState: {
|
|
1613
|
+
activeProgressGuide: undefined,
|
|
1614
|
+
queuedNudges: ['two'],
|
|
1615
|
+
},
|
|
1507
1616
|
})
|
|
1508
1617
|
|
|
1509
1618
|
await agent.setFeedViewPrefs('home', {
|
|
@@ -1518,6 +1627,7 @@ describe('agent', () => {
|
|
|
1518
1627
|
prioritizeFollowedUsers: true,
|
|
1519
1628
|
})
|
|
1520
1629
|
await agent.setPersonalDetails({ birthDate: '2023-09-11T18:05:42.556Z' })
|
|
1630
|
+
await agent.bskyAppQueueNudges('three')
|
|
1521
1631
|
await expect(agent.getPreferences()).resolves.toStrictEqual({
|
|
1522
1632
|
feeds: {
|
|
1523
1633
|
pinned: ['at://bob.com/app.bsky.feed.generator/fake'],
|
|
@@ -1565,11 +1675,19 @@ describe('agent', () => {
|
|
|
1565
1675
|
interests: {
|
|
1566
1676
|
tags: [],
|
|
1567
1677
|
},
|
|
1678
|
+
bskyAppState: {
|
|
1679
|
+
activeProgressGuide: undefined,
|
|
1680
|
+
queuedNudges: ['two', 'three'],
|
|
1681
|
+
},
|
|
1568
1682
|
})
|
|
1569
1683
|
|
|
1570
1684
|
const res = await agent.app.bsky.actor.getPreferences()
|
|
1571
1685
|
expect(res.data.preferences.sort(byType)).toStrictEqual(
|
|
1572
1686
|
[
|
|
1687
|
+
{
|
|
1688
|
+
$type: 'app.bsky.actor.defs#bskyAppStatePref',
|
|
1689
|
+
queuedNudges: ['two', 'three'],
|
|
1690
|
+
},
|
|
1573
1691
|
{
|
|
1574
1692
|
$type: 'app.bsky.actor.defs#adultContentPref',
|
|
1575
1693
|
enabled: false,
|
|
@@ -2693,6 +2811,83 @@ describe('agent', () => {
|
|
|
2693
2811
|
})
|
|
2694
2812
|
})
|
|
2695
2813
|
|
|
2814
|
+
describe('queued nudges', () => {
|
|
2815
|
+
let agent: BskyAgent
|
|
2816
|
+
|
|
2817
|
+
beforeAll(async () => {
|
|
2818
|
+
agent = new BskyAgent({ service: network.pds.url })
|
|
2819
|
+
await agent.createAccount({
|
|
2820
|
+
handle: 'user11.test',
|
|
2821
|
+
email: 'user11@test.com',
|
|
2822
|
+
password: 'password',
|
|
2823
|
+
})
|
|
2824
|
+
})
|
|
2825
|
+
|
|
2826
|
+
it('queueNudges & dismissNudges', async () => {
|
|
2827
|
+
await agent.bskyAppQueueNudges('first')
|
|
2828
|
+
await expect(agent.getPreferences()).resolves.toHaveProperty(
|
|
2829
|
+
'bskyAppState.queuedNudges',
|
|
2830
|
+
['first'],
|
|
2831
|
+
)
|
|
2832
|
+
await agent.bskyAppQueueNudges(['second', 'third'])
|
|
2833
|
+
await expect(agent.getPreferences()).resolves.toHaveProperty(
|
|
2834
|
+
'bskyAppState.queuedNudges',
|
|
2835
|
+
['first', 'second', 'third'],
|
|
2836
|
+
)
|
|
2837
|
+
await agent.bskyAppDismissNudges('second')
|
|
2838
|
+
await expect(agent.getPreferences()).resolves.toHaveProperty(
|
|
2839
|
+
'bskyAppState.queuedNudges',
|
|
2840
|
+
['first', 'third'],
|
|
2841
|
+
)
|
|
2842
|
+
await agent.bskyAppDismissNudges(['first', 'third'])
|
|
2843
|
+
await expect(agent.getPreferences()).resolves.toHaveProperty(
|
|
2844
|
+
'bskyAppState.queuedNudges',
|
|
2845
|
+
[],
|
|
2846
|
+
)
|
|
2847
|
+
})
|
|
2848
|
+
})
|
|
2849
|
+
|
|
2850
|
+
describe('guided tours', () => {
|
|
2851
|
+
let agent: BskyAgent
|
|
2852
|
+
|
|
2853
|
+
beforeAll(async () => {
|
|
2854
|
+
agent = new BskyAgent({ service: network.pds.url })
|
|
2855
|
+
await agent.createAccount({
|
|
2856
|
+
handle: 'user12.test',
|
|
2857
|
+
email: 'user12@test.com',
|
|
2858
|
+
password: 'password',
|
|
2859
|
+
})
|
|
2860
|
+
})
|
|
2861
|
+
|
|
2862
|
+
it('setActiveProgressGuide', async () => {
|
|
2863
|
+
await agent.bskyAppSetActiveProgressGuide({
|
|
2864
|
+
guide: 'test-guide',
|
|
2865
|
+
numThings: 0,
|
|
2866
|
+
})
|
|
2867
|
+
await expect(agent.getPreferences()).resolves.toHaveProperty(
|
|
2868
|
+
'bskyAppState.activeProgressGuide.guide',
|
|
2869
|
+
'test-guide',
|
|
2870
|
+
)
|
|
2871
|
+
await agent.bskyAppSetActiveProgressGuide({
|
|
2872
|
+
guide: 'test-guide',
|
|
2873
|
+
numThings: 1,
|
|
2874
|
+
})
|
|
2875
|
+
await expect(agent.getPreferences()).resolves.toHaveProperty(
|
|
2876
|
+
'bskyAppState.activeProgressGuide.guide',
|
|
2877
|
+
'test-guide',
|
|
2878
|
+
)
|
|
2879
|
+
await expect(agent.getPreferences()).resolves.toHaveProperty(
|
|
2880
|
+
'bskyAppState.activeProgressGuide.numThings',
|
|
2881
|
+
1,
|
|
2882
|
+
)
|
|
2883
|
+
await agent.bskyAppSetActiveProgressGuide(undefined)
|
|
2884
|
+
await expect(agent.getPreferences()).resolves.toHaveProperty(
|
|
2885
|
+
'bskyAppState.activeProgressGuide',
|
|
2886
|
+
undefined,
|
|
2887
|
+
)
|
|
2888
|
+
})
|
|
2889
|
+
})
|
|
2890
|
+
|
|
2696
2891
|
// end
|
|
2697
2892
|
})
|
|
2698
2893
|
})
|
|
@@ -83,6 +83,10 @@ describe('agent', () => {
|
|
|
83
83
|
prioritizeFollowedUsers: true,
|
|
84
84
|
sort: 'oldest',
|
|
85
85
|
},
|
|
86
|
+
bskyAppState: {
|
|
87
|
+
activeProgressGuide: undefined,
|
|
88
|
+
queuedNudges: [],
|
|
89
|
+
},
|
|
86
90
|
})
|
|
87
91
|
})
|
|
88
92
|
|
|
@@ -128,6 +132,10 @@ describe('agent', () => {
|
|
|
128
132
|
sort: 'oldest',
|
|
129
133
|
prioritizeFollowedUsers: true,
|
|
130
134
|
},
|
|
135
|
+
bskyAppState: {
|
|
136
|
+
activeProgressGuide: undefined,
|
|
137
|
+
queuedNudges: [],
|
|
138
|
+
},
|
|
131
139
|
})
|
|
132
140
|
expect(agent.labelersHeader).toStrictEqual(['did:plc:other'])
|
|
133
141
|
|
|
@@ -160,6 +168,10 @@ describe('agent', () => {
|
|
|
160
168
|
sort: 'oldest',
|
|
161
169
|
prioritizeFollowedUsers: true,
|
|
162
170
|
},
|
|
171
|
+
bskyAppState: {
|
|
172
|
+
activeProgressGuide: undefined,
|
|
173
|
+
queuedNudges: [],
|
|
174
|
+
},
|
|
163
175
|
})
|
|
164
176
|
expect(agent.labelersHeader).toStrictEqual([])
|
|
165
177
|
})
|
|
@@ -212,6 +224,10 @@ describe('agent', () => {
|
|
|
212
224
|
sort: 'oldest',
|
|
213
225
|
prioritizeFollowedUsers: true,
|
|
214
226
|
},
|
|
227
|
+
bskyAppState: {
|
|
228
|
+
activeProgressGuide: undefined,
|
|
229
|
+
queuedNudges: [],
|
|
230
|
+
},
|
|
215
231
|
})
|
|
216
232
|
})
|
|
217
233
|
|