@atproto/bsky 0.0.68 → 0.0.69
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 +9 -0
- package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.js +7 -2
- package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
- package/dist/api/app/bsky/notification/getUnreadCount.js +6 -0
- package/dist/api/app/bsky/notification/getUnreadCount.js.map +1 -1
- package/dist/api/app/bsky/notification/listNotifications.js +15 -2
- package/dist/api/app/bsky/notification/listNotifications.js.map +1 -1
- package/dist/api/app/bsky/notification/putPreferences.d.ts +4 -0
- package/dist/api/app/bsky/notification/putPreferences.d.ts.map +1 -0
- package/dist/api/app/bsky/notification/putPreferences.js +17 -0
- package/dist/api/app/bsky/notification/putPreferences.js.map +1 -0
- package/dist/api/app/bsky/notification/updateSeen.d.ts.map +1 -1
- package/dist/api/app/bsky/notification/updateSeen.js +14 -5
- package/dist/api/app/bsky/notification/updateSeen.js.map +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/auth-verifier.d.ts +1 -0
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +3 -2
- package/dist/auth-verifier.js.map +1 -1
- package/dist/data-plane/bsync/index.js +18 -0
- package/dist/data-plane/bsync/index.js.map +1 -1
- package/dist/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.d.ts +4 -0
- package/dist/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.d.ts.map +1 -0
- package/dist/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.js +26 -0
- package/dist/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.js.map +1 -0
- package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
- package/dist/data-plane/server/db/migrations/index.d.ts.map +1 -1
- package/dist/data-plane/server/db/migrations/index.js +2 -1
- package/dist/data-plane/server/db/migrations/index.js.map +1 -1
- package/dist/data-plane/server/db/tables/actor-state.d.ts +2 -0
- package/dist/data-plane/server/db/tables/actor-state.d.ts.map +1 -1
- package/dist/data-plane/server/db/tables/actor-state.js.map +1 -1
- package/dist/data-plane/server/routes/notifs.d.ts.map +1 -1
- package/dist/data-plane/server/routes/notifs.js +55 -12
- package/dist/data-plane/server/routes/notifs.js.map +1 -1
- package/dist/data-plane/server/routes/profile.d.ts.map +1 -1
- package/dist/data-plane/server/routes/profile.js +4 -1
- package/dist/data-plane/server/routes/profile.js.map +1 -1
- package/dist/hydration/actor.d.ts +1 -0
- package/dist/hydration/actor.d.ts.map +1 -1
- package/dist/hydration/actor.js +1 -0
- package/dist/hydration/actor.js.map +1 -1
- package/dist/hydration/hydrator.d.ts +2 -0
- package/dist/hydration/hydrator.d.ts.map +1 -1
- package/dist/hydration/hydrator.js +7 -0
- package/dist/hydration/hydrator.js.map +1 -1
- package/dist/lexicon/index.d.ts +2 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +4 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +32 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +32 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/getUnreadCount.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/notification/getUnreadCount.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/putPreferences.d.ts +29 -0
- package/dist/lexicon/types/app/bsky/notification/putPreferences.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/notification/putPreferences.js +3 -0
- package/dist/lexicon/types/app/bsky/notification/putPreferences.js.map +1 -0
- package/dist/proto/bsky_pb.d.ts +24 -0
- package/dist/proto/bsky_pb.d.ts.map +1 -1
- package/dist/proto/bsky_pb.js +65 -0
- package/dist/proto/bsky_pb.js.map +1 -1
- package/dist/proto/bsync_connect.d.ts +19 -1
- package/dist/proto/bsync_connect.d.ts.map +1 -1
- package/dist/proto/bsync_connect.js +18 -0
- package/dist/proto/bsync_connect.js.map +1 -1
- package/dist/proto/bsync_pb.d.ts +105 -0
- package/dist/proto/bsync_pb.d.ts.map +1 -1
- package/dist/proto/bsync_pb.js +324 -1
- package/dist/proto/bsync_pb.js.map +1 -1
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +6 -4
- package/dist/views/index.js.map +1 -1
- package/package.json +4 -4
- package/proto/bsky.proto +7 -1
- package/src/api/app/bsky/feed/getPostThread.ts +8 -3
- package/src/api/app/bsky/notification/getUnreadCount.ts +7 -0
- package/src/api/app/bsky/notification/listNotifications.ts +17 -2
- package/src/api/app/bsky/notification/putPreferences.ts +16 -0
- package/src/api/app/bsky/notification/updateSeen.ts +14 -5
- package/src/api/index.ts +2 -0
- package/src/auth-verifier.ts +3 -2
- package/src/data-plane/bsync/index.ts +22 -0
- package/src/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.ts +25 -0
- package/src/data-plane/server/db/migrations/index.ts +1 -0
- package/src/data-plane/server/db/tables/actor-state.ts +2 -0
- package/src/data-plane/server/routes/notifs.ts +61 -17
- package/src/data-plane/server/routes/profile.ts +4 -1
- package/src/hydration/actor.ts +2 -1
- package/src/hydration/hydrator.ts +3 -1
- package/src/lexicon/index.ts +12 -0
- package/src/lexicon/lexicons.ts +33 -0
- package/src/lexicon/types/app/bsky/notification/getUnreadCount.ts +1 -0
- package/src/lexicon/types/app/bsky/notification/listNotifications.ts +2 -0
- package/src/lexicon/types/app/bsky/notification/putPreferences.ts +38 -0
- package/src/proto/bsky_pb.ts +41 -0
- package/src/proto/bsync_connect.ts +22 -0
- package/src/proto/bsync_pb.ts +317 -0
- package/src/views/index.ts +8 -4
- package/tests/views/__snapshots__/notifications.test.ts.snap +415 -0
- package/tests/views/notifications.test.ts +42 -1
|
@@ -382,6 +382,421 @@ Array [
|
|
|
382
382
|
]
|
|
383
383
|
`;
|
|
384
384
|
|
|
385
|
+
exports[`notification views fetches notifications with default priority 1`] = `
|
|
386
|
+
Object {
|
|
387
|
+
"cursor": "0000000000000__bafycid",
|
|
388
|
+
"notifications": Array [
|
|
389
|
+
Object {
|
|
390
|
+
"author": Object {
|
|
391
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
392
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
393
|
+
"description": "its me!",
|
|
394
|
+
"did": "user(0)",
|
|
395
|
+
"displayName": "ali",
|
|
396
|
+
"handle": "alice.test",
|
|
397
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
398
|
+
"labels": Array [
|
|
399
|
+
Object {
|
|
400
|
+
"cid": "cids(2)",
|
|
401
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
402
|
+
"src": "user(0)",
|
|
403
|
+
"uri": "record(3)",
|
|
404
|
+
"val": "self-label-a",
|
|
405
|
+
},
|
|
406
|
+
Object {
|
|
407
|
+
"cid": "cids(2)",
|
|
408
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
409
|
+
"src": "user(0)",
|
|
410
|
+
"uri": "record(3)",
|
|
411
|
+
"val": "self-label-b",
|
|
412
|
+
},
|
|
413
|
+
],
|
|
414
|
+
"viewer": Object {
|
|
415
|
+
"blockedBy": false,
|
|
416
|
+
"followedBy": "record(2)",
|
|
417
|
+
"following": "record(1)",
|
|
418
|
+
"muted": false,
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
"cid": "cids(0)",
|
|
422
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
423
|
+
"isRead": true,
|
|
424
|
+
"labels": Array [],
|
|
425
|
+
"reason": "like",
|
|
426
|
+
"reasonSubject": "record(4)",
|
|
427
|
+
"record": Object {
|
|
428
|
+
"$type": "app.bsky.feed.like",
|
|
429
|
+
"createdAt": "1970-01-01T00:00:00.000000Z",
|
|
430
|
+
"subject": Object {
|
|
431
|
+
"cid": "cids(3)",
|
|
432
|
+
"uri": "record(4)",
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
"uri": "record(0)",
|
|
436
|
+
},
|
|
437
|
+
Object {
|
|
438
|
+
"author": Object {
|
|
439
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
440
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
441
|
+
"description": "its me!",
|
|
442
|
+
"did": "user(0)",
|
|
443
|
+
"displayName": "ali",
|
|
444
|
+
"handle": "alice.test",
|
|
445
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
446
|
+
"labels": Array [
|
|
447
|
+
Object {
|
|
448
|
+
"cid": "cids(2)",
|
|
449
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
450
|
+
"src": "user(0)",
|
|
451
|
+
"uri": "record(3)",
|
|
452
|
+
"val": "self-label-a",
|
|
453
|
+
},
|
|
454
|
+
Object {
|
|
455
|
+
"cid": "cids(2)",
|
|
456
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
457
|
+
"src": "user(0)",
|
|
458
|
+
"uri": "record(3)",
|
|
459
|
+
"val": "self-label-b",
|
|
460
|
+
},
|
|
461
|
+
],
|
|
462
|
+
"viewer": Object {
|
|
463
|
+
"blockedBy": false,
|
|
464
|
+
"followedBy": "record(2)",
|
|
465
|
+
"following": "record(1)",
|
|
466
|
+
"muted": false,
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
"cid": "cids(4)",
|
|
470
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
471
|
+
"isRead": true,
|
|
472
|
+
"labels": Array [],
|
|
473
|
+
"reason": "follow",
|
|
474
|
+
"record": Object {
|
|
475
|
+
"$type": "app.bsky.graph.follow",
|
|
476
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
477
|
+
"subject": "user(2)",
|
|
478
|
+
},
|
|
479
|
+
"uri": "record(2)",
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
"priority": true,
|
|
483
|
+
"seenAt": "1970-01-01T00:00:00.000Z",
|
|
484
|
+
}
|
|
485
|
+
`;
|
|
486
|
+
|
|
487
|
+
exports[`notification views fetches notifications with explicit priority 1`] = `
|
|
488
|
+
Object {
|
|
489
|
+
"cursor": "0000000000000__bafycid",
|
|
490
|
+
"notifications": Array [
|
|
491
|
+
Object {
|
|
492
|
+
"author": Object {
|
|
493
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
494
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
495
|
+
"description": "its me!",
|
|
496
|
+
"did": "user(0)",
|
|
497
|
+
"displayName": "ali",
|
|
498
|
+
"handle": "alice.test",
|
|
499
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
500
|
+
"labels": Array [
|
|
501
|
+
Object {
|
|
502
|
+
"cid": "cids(2)",
|
|
503
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
504
|
+
"src": "user(0)",
|
|
505
|
+
"uri": "record(3)",
|
|
506
|
+
"val": "self-label-a",
|
|
507
|
+
},
|
|
508
|
+
Object {
|
|
509
|
+
"cid": "cids(2)",
|
|
510
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
511
|
+
"src": "user(0)",
|
|
512
|
+
"uri": "record(3)",
|
|
513
|
+
"val": "self-label-b",
|
|
514
|
+
},
|
|
515
|
+
],
|
|
516
|
+
"viewer": Object {
|
|
517
|
+
"blockedBy": false,
|
|
518
|
+
"followedBy": "record(2)",
|
|
519
|
+
"following": "record(1)",
|
|
520
|
+
"muted": false,
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
"cid": "cids(0)",
|
|
524
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
525
|
+
"isRead": false,
|
|
526
|
+
"labels": Array [],
|
|
527
|
+
"reason": "like",
|
|
528
|
+
"reasonSubject": "record(4)",
|
|
529
|
+
"record": Object {
|
|
530
|
+
"$type": "app.bsky.feed.like",
|
|
531
|
+
"createdAt": "1970-01-01T00:00:00.000000Z",
|
|
532
|
+
"subject": Object {
|
|
533
|
+
"cid": "cids(3)",
|
|
534
|
+
"uri": "record(4)",
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
"uri": "record(0)",
|
|
538
|
+
},
|
|
539
|
+
Object {
|
|
540
|
+
"author": Object {
|
|
541
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
542
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
543
|
+
"description": "its me!",
|
|
544
|
+
"did": "user(0)",
|
|
545
|
+
"displayName": "ali",
|
|
546
|
+
"handle": "alice.test",
|
|
547
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
548
|
+
"labels": Array [
|
|
549
|
+
Object {
|
|
550
|
+
"cid": "cids(2)",
|
|
551
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
552
|
+
"src": "user(0)",
|
|
553
|
+
"uri": "record(3)",
|
|
554
|
+
"val": "self-label-a",
|
|
555
|
+
},
|
|
556
|
+
Object {
|
|
557
|
+
"cid": "cids(2)",
|
|
558
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
559
|
+
"src": "user(0)",
|
|
560
|
+
"uri": "record(3)",
|
|
561
|
+
"val": "self-label-b",
|
|
562
|
+
},
|
|
563
|
+
],
|
|
564
|
+
"viewer": Object {
|
|
565
|
+
"blockedBy": false,
|
|
566
|
+
"followedBy": "record(2)",
|
|
567
|
+
"following": "record(1)",
|
|
568
|
+
"muted": false,
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
"cid": "cids(4)",
|
|
572
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
573
|
+
"isRead": true,
|
|
574
|
+
"labels": Array [],
|
|
575
|
+
"reason": "follow",
|
|
576
|
+
"record": Object {
|
|
577
|
+
"$type": "app.bsky.graph.follow",
|
|
578
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
579
|
+
"subject": "user(2)",
|
|
580
|
+
},
|
|
581
|
+
"uri": "record(2)",
|
|
582
|
+
},
|
|
583
|
+
],
|
|
584
|
+
"priority": true,
|
|
585
|
+
"seenAt": "1970-01-01T00:00:00.000Z",
|
|
586
|
+
}
|
|
587
|
+
`;
|
|
588
|
+
|
|
589
|
+
exports[`notification views fetches notifications with explicit priority 2`] = `
|
|
590
|
+
Object {
|
|
591
|
+
"cursor": "0000000000000__bafycid",
|
|
592
|
+
"notifications": Array [
|
|
593
|
+
Object {
|
|
594
|
+
"author": Object {
|
|
595
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
596
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
597
|
+
"description": "hi im bob label_me",
|
|
598
|
+
"did": "user(0)",
|
|
599
|
+
"displayName": "bobby",
|
|
600
|
+
"handle": "bob.test",
|
|
601
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
602
|
+
"labels": Array [],
|
|
603
|
+
"viewer": Object {
|
|
604
|
+
"blockedBy": false,
|
|
605
|
+
"followedBy": "record(1)",
|
|
606
|
+
"muted": false,
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
"cid": "cids(0)",
|
|
610
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
611
|
+
"isRead": false,
|
|
612
|
+
"labels": Array [],
|
|
613
|
+
"reason": "like",
|
|
614
|
+
"reasonSubject": "record(2)",
|
|
615
|
+
"record": Object {
|
|
616
|
+
"$type": "app.bsky.feed.like",
|
|
617
|
+
"createdAt": "1970-01-01T00:00:00.000+00:00",
|
|
618
|
+
"subject": Object {
|
|
619
|
+
"cid": "cids(2)",
|
|
620
|
+
"uri": "record(2)",
|
|
621
|
+
},
|
|
622
|
+
},
|
|
623
|
+
"uri": "record(0)",
|
|
624
|
+
},
|
|
625
|
+
Object {
|
|
626
|
+
"author": Object {
|
|
627
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(3)/cids(1)@jpeg",
|
|
628
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
629
|
+
"description": "its me!",
|
|
630
|
+
"did": "user(2)",
|
|
631
|
+
"displayName": "ali",
|
|
632
|
+
"handle": "alice.test",
|
|
633
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
634
|
+
"labels": Array [
|
|
635
|
+
Object {
|
|
636
|
+
"cid": "cids(4)",
|
|
637
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
638
|
+
"src": "user(2)",
|
|
639
|
+
"uri": "record(6)",
|
|
640
|
+
"val": "self-label-a",
|
|
641
|
+
},
|
|
642
|
+
Object {
|
|
643
|
+
"cid": "cids(4)",
|
|
644
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
645
|
+
"src": "user(2)",
|
|
646
|
+
"uri": "record(6)",
|
|
647
|
+
"val": "self-label-b",
|
|
648
|
+
},
|
|
649
|
+
],
|
|
650
|
+
"viewer": Object {
|
|
651
|
+
"blockedBy": false,
|
|
652
|
+
"followedBy": "record(5)",
|
|
653
|
+
"following": "record(4)",
|
|
654
|
+
"muted": false,
|
|
655
|
+
},
|
|
656
|
+
},
|
|
657
|
+
"cid": "cids(3)",
|
|
658
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
659
|
+
"isRead": true,
|
|
660
|
+
"labels": Array [],
|
|
661
|
+
"reason": "like",
|
|
662
|
+
"reasonSubject": "record(2)",
|
|
663
|
+
"record": Object {
|
|
664
|
+
"$type": "app.bsky.feed.like",
|
|
665
|
+
"createdAt": "1970-01-01T00:00:00.000000Z",
|
|
666
|
+
"subject": Object {
|
|
667
|
+
"cid": "cids(2)",
|
|
668
|
+
"uri": "record(2)",
|
|
669
|
+
},
|
|
670
|
+
},
|
|
671
|
+
"uri": "record(3)",
|
|
672
|
+
},
|
|
673
|
+
Object {
|
|
674
|
+
"author": Object {
|
|
675
|
+
"associated": Object {
|
|
676
|
+
"chat": Object {
|
|
677
|
+
"allowIncoming": "none",
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
"did": "user(4)",
|
|
681
|
+
"handle": "dan.test",
|
|
682
|
+
"labels": Array [],
|
|
683
|
+
"viewer": Object {
|
|
684
|
+
"blockedBy": false,
|
|
685
|
+
"muted": false,
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
"cid": "cids(5)",
|
|
689
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
690
|
+
"isRead": true,
|
|
691
|
+
"labels": Array [],
|
|
692
|
+
"reason": "quote",
|
|
693
|
+
"reasonSubject": "record(2)",
|
|
694
|
+
"record": Object {
|
|
695
|
+
"$type": "app.bsky.feed.post",
|
|
696
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
697
|
+
"embed": Object {
|
|
698
|
+
"$type": "app.bsky.embed.record",
|
|
699
|
+
"record": Object {
|
|
700
|
+
"cid": "cids(2)",
|
|
701
|
+
"uri": "record(2)",
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
"facets": Array [
|
|
705
|
+
Object {
|
|
706
|
+
"features": Array [
|
|
707
|
+
Object {
|
|
708
|
+
"$type": "app.bsky.richtext.facet#mention",
|
|
709
|
+
"did": "user(2)",
|
|
710
|
+
},
|
|
711
|
+
],
|
|
712
|
+
"index": Object {
|
|
713
|
+
"byteEnd": 18,
|
|
714
|
+
"byteStart": 0,
|
|
715
|
+
},
|
|
716
|
+
},
|
|
717
|
+
],
|
|
718
|
+
"text": "@alice.bluesky.xyz is the best",
|
|
719
|
+
},
|
|
720
|
+
"uri": "record(7)",
|
|
721
|
+
},
|
|
722
|
+
Object {
|
|
723
|
+
"author": Object {
|
|
724
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
725
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
726
|
+
"description": "hi im bob label_me",
|
|
727
|
+
"did": "user(0)",
|
|
728
|
+
"displayName": "bobby",
|
|
729
|
+
"handle": "bob.test",
|
|
730
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
731
|
+
"labels": Array [],
|
|
732
|
+
"viewer": Object {
|
|
733
|
+
"blockedBy": false,
|
|
734
|
+
"followedBy": "record(1)",
|
|
735
|
+
"muted": false,
|
|
736
|
+
},
|
|
737
|
+
},
|
|
738
|
+
"cid": "cids(6)",
|
|
739
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
740
|
+
"isRead": true,
|
|
741
|
+
"labels": Array [],
|
|
742
|
+
"reason": "follow",
|
|
743
|
+
"record": Object {
|
|
744
|
+
"$type": "app.bsky.graph.follow",
|
|
745
|
+
"createdAt": "1970-01-01T00:00:00.000000Z",
|
|
746
|
+
"subject": "user(5)",
|
|
747
|
+
},
|
|
748
|
+
"uri": "record(1)",
|
|
749
|
+
},
|
|
750
|
+
Object {
|
|
751
|
+
"author": Object {
|
|
752
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(3)/cids(1)@jpeg",
|
|
753
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
754
|
+
"description": "its me!",
|
|
755
|
+
"did": "user(2)",
|
|
756
|
+
"displayName": "ali",
|
|
757
|
+
"handle": "alice.test",
|
|
758
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
759
|
+
"labels": Array [
|
|
760
|
+
Object {
|
|
761
|
+
"cid": "cids(4)",
|
|
762
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
763
|
+
"src": "user(2)",
|
|
764
|
+
"uri": "record(6)",
|
|
765
|
+
"val": "self-label-a",
|
|
766
|
+
},
|
|
767
|
+
Object {
|
|
768
|
+
"cid": "cids(4)",
|
|
769
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
770
|
+
"src": "user(2)",
|
|
771
|
+
"uri": "record(6)",
|
|
772
|
+
"val": "self-label-b",
|
|
773
|
+
},
|
|
774
|
+
],
|
|
775
|
+
"viewer": Object {
|
|
776
|
+
"blockedBy": false,
|
|
777
|
+
"followedBy": "record(5)",
|
|
778
|
+
"following": "record(4)",
|
|
779
|
+
"muted": false,
|
|
780
|
+
},
|
|
781
|
+
},
|
|
782
|
+
"cid": "cids(7)",
|
|
783
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
784
|
+
"isRead": true,
|
|
785
|
+
"labels": Array [],
|
|
786
|
+
"reason": "follow",
|
|
787
|
+
"record": Object {
|
|
788
|
+
"$type": "app.bsky.graph.follow",
|
|
789
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
790
|
+
"subject": "user(5)",
|
|
791
|
+
},
|
|
792
|
+
"uri": "record(5)",
|
|
793
|
+
},
|
|
794
|
+
],
|
|
795
|
+
"priority": false,
|
|
796
|
+
"seenAt": "1970-01-01T00:00:00.000Z",
|
|
797
|
+
}
|
|
798
|
+
`;
|
|
799
|
+
|
|
385
800
|
exports[`notification views fetches notifications without a last-seen 1`] = `
|
|
386
801
|
Array [
|
|
387
802
|
Object {
|
|
@@ -267,12 +267,53 @@ describe('notification views', () => {
|
|
|
267
267
|
)
|
|
268
268
|
})
|
|
269
269
|
|
|
270
|
+
it('fetches notifications with explicit priority', async () => {
|
|
271
|
+
const priority = await agent.api.app.bsky.notification.listNotifications(
|
|
272
|
+
{ priority: true },
|
|
273
|
+
{ headers: await network.serviceHeaders(sc.dids.carol) },
|
|
274
|
+
)
|
|
275
|
+
// only notifs from follow (alice)
|
|
276
|
+
expect(
|
|
277
|
+
priority.data.notifications.every(
|
|
278
|
+
(notif) => ![sc.dids.bob, sc.dids.dan].includes(notif.author.did),
|
|
279
|
+
),
|
|
280
|
+
).toBe(true)
|
|
281
|
+
expect(forSnapshot(priority.data)).toMatchSnapshot()
|
|
282
|
+
const noPriority = await agent.api.app.bsky.notification.listNotifications(
|
|
283
|
+
{ priority: false },
|
|
284
|
+
{ headers: await network.serviceHeaders(sc.dids.carol) },
|
|
285
|
+
)
|
|
286
|
+
expect(forSnapshot(noPriority.data)).toMatchSnapshot()
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
it('fetches notifications with default priority', async () => {
|
|
290
|
+
await agent.api.app.bsky.notification.putPreferences(
|
|
291
|
+
{ priority: true },
|
|
292
|
+
{
|
|
293
|
+
encoding: 'application/json',
|
|
294
|
+
headers: await network.serviceHeaders(sc.dids.carol),
|
|
295
|
+
},
|
|
296
|
+
)
|
|
297
|
+
await network.processAll()
|
|
298
|
+
const notifs = await agent.api.app.bsky.notification.listNotifications(
|
|
299
|
+
{},
|
|
300
|
+
{ headers: await network.serviceHeaders(sc.dids.carol) },
|
|
301
|
+
)
|
|
302
|
+
// only notifs from follow (alice)
|
|
303
|
+
expect(
|
|
304
|
+
notifs.data.notifications.every(
|
|
305
|
+
(notif) => ![sc.dids.bob, sc.dids.dan].includes(notif.author.did),
|
|
306
|
+
),
|
|
307
|
+
).toBe(true)
|
|
308
|
+
expect(forSnapshot(notifs.data)).toMatchSnapshot()
|
|
309
|
+
})
|
|
310
|
+
|
|
270
311
|
it('fails open on clearly bad cursor.', async () => {
|
|
271
312
|
const { data: notifs } =
|
|
272
313
|
await agent.api.app.bsky.notification.listNotifications(
|
|
273
314
|
{ cursor: '90210::bafycid' },
|
|
274
315
|
{ headers: await network.serviceHeaders(alice) },
|
|
275
316
|
)
|
|
276
|
-
expect(notifs).
|
|
317
|
+
expect(notifs).toMatchObject({ notifications: [] })
|
|
277
318
|
})
|
|
278
319
|
})
|