@atproto/bsky 0.0.67 → 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.
Files changed (114) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/api/app/bsky/feed/getPostThread.d.ts.map +1 -1
  3. package/dist/api/app/bsky/feed/getPostThread.js +7 -2
  4. package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
  5. package/dist/api/app/bsky/notification/getUnreadCount.js +6 -0
  6. package/dist/api/app/bsky/notification/getUnreadCount.js.map +1 -1
  7. package/dist/api/app/bsky/notification/listNotifications.js +15 -2
  8. package/dist/api/app/bsky/notification/listNotifications.js.map +1 -1
  9. package/dist/api/app/bsky/notification/putPreferences.d.ts +4 -0
  10. package/dist/api/app/bsky/notification/putPreferences.d.ts.map +1 -0
  11. package/dist/api/app/bsky/notification/putPreferences.js +17 -0
  12. package/dist/api/app/bsky/notification/putPreferences.js.map +1 -0
  13. package/dist/api/app/bsky/notification/updateSeen.d.ts.map +1 -1
  14. package/dist/api/app/bsky/notification/updateSeen.js +14 -5
  15. package/dist/api/app/bsky/notification/updateSeen.js.map +1 -1
  16. package/dist/api/index.d.ts.map +1 -1
  17. package/dist/api/index.js +2 -0
  18. package/dist/api/index.js.map +1 -1
  19. package/dist/auth-verifier.d.ts +1 -0
  20. package/dist/auth-verifier.d.ts.map +1 -1
  21. package/dist/auth-verifier.js +3 -2
  22. package/dist/auth-verifier.js.map +1 -1
  23. package/dist/data-plane/bsync/index.js +18 -0
  24. package/dist/data-plane/bsync/index.js.map +1 -1
  25. package/dist/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.d.ts +4 -0
  26. package/dist/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.d.ts.map +1 -0
  27. package/dist/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.js +26 -0
  28. package/dist/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.js.map +1 -0
  29. package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
  30. package/dist/data-plane/server/db/migrations/index.d.ts.map +1 -1
  31. package/dist/data-plane/server/db/migrations/index.js +2 -1
  32. package/dist/data-plane/server/db/migrations/index.js.map +1 -1
  33. package/dist/data-plane/server/db/tables/actor-state.d.ts +2 -0
  34. package/dist/data-plane/server/db/tables/actor-state.d.ts.map +1 -1
  35. package/dist/data-plane/server/db/tables/actor-state.js.map +1 -1
  36. package/dist/data-plane/server/routes/notifs.d.ts.map +1 -1
  37. package/dist/data-plane/server/routes/notifs.js +55 -12
  38. package/dist/data-plane/server/routes/notifs.js.map +1 -1
  39. package/dist/data-plane/server/routes/profile.d.ts.map +1 -1
  40. package/dist/data-plane/server/routes/profile.js +4 -1
  41. package/dist/data-plane/server/routes/profile.js.map +1 -1
  42. package/dist/hydration/actor.d.ts +1 -0
  43. package/dist/hydration/actor.d.ts.map +1 -1
  44. package/dist/hydration/actor.js +1 -0
  45. package/dist/hydration/actor.js.map +1 -1
  46. package/dist/hydration/hydrator.d.ts +2 -0
  47. package/dist/hydration/hydrator.d.ts.map +1 -1
  48. package/dist/hydration/hydrator.js +7 -0
  49. package/dist/hydration/hydrator.js.map +1 -1
  50. package/dist/lexicon/index.d.ts +2 -0
  51. package/dist/lexicon/index.d.ts.map +1 -1
  52. package/dist/lexicon/index.js +4 -0
  53. package/dist/lexicon/index.js.map +1 -1
  54. package/dist/lexicon/lexicons.d.ts +32 -0
  55. package/dist/lexicon/lexicons.d.ts.map +1 -1
  56. package/dist/lexicon/lexicons.js +32 -0
  57. package/dist/lexicon/lexicons.js.map +1 -1
  58. package/dist/lexicon/types/app/bsky/notification/getUnreadCount.d.ts +1 -0
  59. package/dist/lexicon/types/app/bsky/notification/getUnreadCount.d.ts.map +1 -1
  60. package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +2 -0
  61. package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts.map +1 -1
  62. package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
  63. package/dist/lexicon/types/app/bsky/notification/putPreferences.d.ts +29 -0
  64. package/dist/lexicon/types/app/bsky/notification/putPreferences.d.ts.map +1 -0
  65. package/dist/lexicon/types/app/bsky/notification/putPreferences.js +3 -0
  66. package/dist/lexicon/types/app/bsky/notification/putPreferences.js.map +1 -0
  67. package/dist/logger.d.ts +3 -1
  68. package/dist/logger.d.ts.map +1 -1
  69. package/dist/logger.js +9 -76
  70. package/dist/logger.js.map +1 -1
  71. package/dist/proto/bsky_pb.d.ts +24 -0
  72. package/dist/proto/bsky_pb.d.ts.map +1 -1
  73. package/dist/proto/bsky_pb.js +65 -0
  74. package/dist/proto/bsky_pb.js.map +1 -1
  75. package/dist/proto/bsync_connect.d.ts +19 -1
  76. package/dist/proto/bsync_connect.d.ts.map +1 -1
  77. package/dist/proto/bsync_connect.js +18 -0
  78. package/dist/proto/bsync_connect.js.map +1 -1
  79. package/dist/proto/bsync_pb.d.ts +105 -0
  80. package/dist/proto/bsync_pb.d.ts.map +1 -1
  81. package/dist/proto/bsync_pb.js +324 -1
  82. package/dist/proto/bsync_pb.js.map +1 -1
  83. package/dist/views/index.d.ts.map +1 -1
  84. package/dist/views/index.js +6 -4
  85. package/dist/views/index.js.map +1 -1
  86. package/package.json +7 -7
  87. package/proto/bsky.proto +7 -1
  88. package/src/api/app/bsky/feed/getPostThread.ts +8 -3
  89. package/src/api/app/bsky/notification/getUnreadCount.ts +7 -0
  90. package/src/api/app/bsky/notification/listNotifications.ts +17 -2
  91. package/src/api/app/bsky/notification/putPreferences.ts +16 -0
  92. package/src/api/app/bsky/notification/updateSeen.ts +14 -5
  93. package/src/api/index.ts +2 -0
  94. package/src/auth-verifier.ts +3 -2
  95. package/src/data-plane/bsync/index.ts +22 -0
  96. package/src/data-plane/server/db/migrations/20240719T203853939Z-priority-notifs.ts +25 -0
  97. package/src/data-plane/server/db/migrations/index.ts +1 -0
  98. package/src/data-plane/server/db/tables/actor-state.ts +2 -0
  99. package/src/data-plane/server/routes/notifs.ts +61 -17
  100. package/src/data-plane/server/routes/profile.ts +4 -1
  101. package/src/hydration/actor.ts +2 -1
  102. package/src/hydration/hydrator.ts +3 -1
  103. package/src/lexicon/index.ts +12 -0
  104. package/src/lexicon/lexicons.ts +33 -0
  105. package/src/lexicon/types/app/bsky/notification/getUnreadCount.ts +1 -0
  106. package/src/lexicon/types/app/bsky/notification/listNotifications.ts +2 -0
  107. package/src/lexicon/types/app/bsky/notification/putPreferences.ts +38 -0
  108. package/src/logger.ts +11 -81
  109. package/src/proto/bsky_pb.ts +41 -0
  110. package/src/proto/bsync_connect.ts +22 -0
  111. package/src/proto/bsync_pb.ts +317 -0
  112. package/src/views/index.ts +8 -4
  113. package/tests/views/__snapshots__/notifications.test.ts.snap +415 -0
  114. package/tests/views/notifications.test.ts +42 -1
@@ -372,6 +372,323 @@ export class ScanMuteOperationsResponse extends Message<ScanMuteOperationsRespon
372
372
  }
373
373
  }
374
374
 
375
+ /**
376
+ * @generated from message bsync.NotifOperation
377
+ */
378
+ export class NotifOperation extends Message<NotifOperation> {
379
+ /**
380
+ * @generated from field: string id = 1;
381
+ */
382
+ id = ''
383
+
384
+ /**
385
+ * @generated from field: string actor_did = 2;
386
+ */
387
+ actorDid = ''
388
+
389
+ /**
390
+ * @generated from field: optional bool priority = 3;
391
+ */
392
+ priority?: boolean
393
+
394
+ constructor(data?: PartialMessage<NotifOperation>) {
395
+ super()
396
+ proto3.util.initPartial(data, this)
397
+ }
398
+
399
+ static readonly runtime: typeof proto3 = proto3
400
+ static readonly typeName = 'bsync.NotifOperation'
401
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
402
+ { no: 1, name: 'id', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
403
+ { no: 2, name: 'actor_did', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
404
+ {
405
+ no: 3,
406
+ name: 'priority',
407
+ kind: 'scalar',
408
+ T: 8 /* ScalarType.BOOL */,
409
+ opt: true,
410
+ },
411
+ ])
412
+
413
+ static fromBinary(
414
+ bytes: Uint8Array,
415
+ options?: Partial<BinaryReadOptions>,
416
+ ): NotifOperation {
417
+ return new NotifOperation().fromBinary(bytes, options)
418
+ }
419
+
420
+ static fromJson(
421
+ jsonValue: JsonValue,
422
+ options?: Partial<JsonReadOptions>,
423
+ ): NotifOperation {
424
+ return new NotifOperation().fromJson(jsonValue, options)
425
+ }
426
+
427
+ static fromJsonString(
428
+ jsonString: string,
429
+ options?: Partial<JsonReadOptions>,
430
+ ): NotifOperation {
431
+ return new NotifOperation().fromJsonString(jsonString, options)
432
+ }
433
+
434
+ static equals(
435
+ a: NotifOperation | PlainMessage<NotifOperation> | undefined,
436
+ b: NotifOperation | PlainMessage<NotifOperation> | undefined,
437
+ ): boolean {
438
+ return proto3.util.equals(NotifOperation, a, b)
439
+ }
440
+ }
441
+
442
+ /**
443
+ * @generated from message bsync.AddNotifOperationRequest
444
+ */
445
+ export class AddNotifOperationRequest extends Message<AddNotifOperationRequest> {
446
+ /**
447
+ * @generated from field: string actor_did = 1;
448
+ */
449
+ actorDid = ''
450
+
451
+ /**
452
+ * @generated from field: optional bool priority = 2;
453
+ */
454
+ priority?: boolean
455
+
456
+ constructor(data?: PartialMessage<AddNotifOperationRequest>) {
457
+ super()
458
+ proto3.util.initPartial(data, this)
459
+ }
460
+
461
+ static readonly runtime: typeof proto3 = proto3
462
+ static readonly typeName = 'bsync.AddNotifOperationRequest'
463
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
464
+ { no: 1, name: 'actor_did', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
465
+ {
466
+ no: 2,
467
+ name: 'priority',
468
+ kind: 'scalar',
469
+ T: 8 /* ScalarType.BOOL */,
470
+ opt: true,
471
+ },
472
+ ])
473
+
474
+ static fromBinary(
475
+ bytes: Uint8Array,
476
+ options?: Partial<BinaryReadOptions>,
477
+ ): AddNotifOperationRequest {
478
+ return new AddNotifOperationRequest().fromBinary(bytes, options)
479
+ }
480
+
481
+ static fromJson(
482
+ jsonValue: JsonValue,
483
+ options?: Partial<JsonReadOptions>,
484
+ ): AddNotifOperationRequest {
485
+ return new AddNotifOperationRequest().fromJson(jsonValue, options)
486
+ }
487
+
488
+ static fromJsonString(
489
+ jsonString: string,
490
+ options?: Partial<JsonReadOptions>,
491
+ ): AddNotifOperationRequest {
492
+ return new AddNotifOperationRequest().fromJsonString(jsonString, options)
493
+ }
494
+
495
+ static equals(
496
+ a:
497
+ | AddNotifOperationRequest
498
+ | PlainMessage<AddNotifOperationRequest>
499
+ | undefined,
500
+ b:
501
+ | AddNotifOperationRequest
502
+ | PlainMessage<AddNotifOperationRequest>
503
+ | undefined,
504
+ ): boolean {
505
+ return proto3.util.equals(AddNotifOperationRequest, a, b)
506
+ }
507
+ }
508
+
509
+ /**
510
+ * @generated from message bsync.AddNotifOperationResponse
511
+ */
512
+ export class AddNotifOperationResponse extends Message<AddNotifOperationResponse> {
513
+ /**
514
+ * @generated from field: bsync.NotifOperation operation = 1;
515
+ */
516
+ operation?: NotifOperation
517
+
518
+ constructor(data?: PartialMessage<AddNotifOperationResponse>) {
519
+ super()
520
+ proto3.util.initPartial(data, this)
521
+ }
522
+
523
+ static readonly runtime: typeof proto3 = proto3
524
+ static readonly typeName = 'bsync.AddNotifOperationResponse'
525
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
526
+ { no: 1, name: 'operation', kind: 'message', T: NotifOperation },
527
+ ])
528
+
529
+ static fromBinary(
530
+ bytes: Uint8Array,
531
+ options?: Partial<BinaryReadOptions>,
532
+ ): AddNotifOperationResponse {
533
+ return new AddNotifOperationResponse().fromBinary(bytes, options)
534
+ }
535
+
536
+ static fromJson(
537
+ jsonValue: JsonValue,
538
+ options?: Partial<JsonReadOptions>,
539
+ ): AddNotifOperationResponse {
540
+ return new AddNotifOperationResponse().fromJson(jsonValue, options)
541
+ }
542
+
543
+ static fromJsonString(
544
+ jsonString: string,
545
+ options?: Partial<JsonReadOptions>,
546
+ ): AddNotifOperationResponse {
547
+ return new AddNotifOperationResponse().fromJsonString(jsonString, options)
548
+ }
549
+
550
+ static equals(
551
+ a:
552
+ | AddNotifOperationResponse
553
+ | PlainMessage<AddNotifOperationResponse>
554
+ | undefined,
555
+ b:
556
+ | AddNotifOperationResponse
557
+ | PlainMessage<AddNotifOperationResponse>
558
+ | undefined,
559
+ ): boolean {
560
+ return proto3.util.equals(AddNotifOperationResponse, a, b)
561
+ }
562
+ }
563
+
564
+ /**
565
+ * @generated from message bsync.ScanNotifOperationsRequest
566
+ */
567
+ export class ScanNotifOperationsRequest extends Message<ScanNotifOperationsRequest> {
568
+ /**
569
+ * @generated from field: string cursor = 1;
570
+ */
571
+ cursor = ''
572
+
573
+ /**
574
+ * @generated from field: int32 limit = 2;
575
+ */
576
+ limit = 0
577
+
578
+ constructor(data?: PartialMessage<ScanNotifOperationsRequest>) {
579
+ super()
580
+ proto3.util.initPartial(data, this)
581
+ }
582
+
583
+ static readonly runtime: typeof proto3 = proto3
584
+ static readonly typeName = 'bsync.ScanNotifOperationsRequest'
585
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
586
+ { no: 1, name: 'cursor', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
587
+ { no: 2, name: 'limit', kind: 'scalar', T: 5 /* ScalarType.INT32 */ },
588
+ ])
589
+
590
+ static fromBinary(
591
+ bytes: Uint8Array,
592
+ options?: Partial<BinaryReadOptions>,
593
+ ): ScanNotifOperationsRequest {
594
+ return new ScanNotifOperationsRequest().fromBinary(bytes, options)
595
+ }
596
+
597
+ static fromJson(
598
+ jsonValue: JsonValue,
599
+ options?: Partial<JsonReadOptions>,
600
+ ): ScanNotifOperationsRequest {
601
+ return new ScanNotifOperationsRequest().fromJson(jsonValue, options)
602
+ }
603
+
604
+ static fromJsonString(
605
+ jsonString: string,
606
+ options?: Partial<JsonReadOptions>,
607
+ ): ScanNotifOperationsRequest {
608
+ return new ScanNotifOperationsRequest().fromJsonString(jsonString, options)
609
+ }
610
+
611
+ static equals(
612
+ a:
613
+ | ScanNotifOperationsRequest
614
+ | PlainMessage<ScanNotifOperationsRequest>
615
+ | undefined,
616
+ b:
617
+ | ScanNotifOperationsRequest
618
+ | PlainMessage<ScanNotifOperationsRequest>
619
+ | undefined,
620
+ ): boolean {
621
+ return proto3.util.equals(ScanNotifOperationsRequest, a, b)
622
+ }
623
+ }
624
+
625
+ /**
626
+ * @generated from message bsync.ScanNotifOperationsResponse
627
+ */
628
+ export class ScanNotifOperationsResponse extends Message<ScanNotifOperationsResponse> {
629
+ /**
630
+ * @generated from field: repeated bsync.NotifOperation operations = 1;
631
+ */
632
+ operations: NotifOperation[] = []
633
+
634
+ /**
635
+ * @generated from field: string cursor = 2;
636
+ */
637
+ cursor = ''
638
+
639
+ constructor(data?: PartialMessage<ScanNotifOperationsResponse>) {
640
+ super()
641
+ proto3.util.initPartial(data, this)
642
+ }
643
+
644
+ static readonly runtime: typeof proto3 = proto3
645
+ static readonly typeName = 'bsync.ScanNotifOperationsResponse'
646
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
647
+ {
648
+ no: 1,
649
+ name: 'operations',
650
+ kind: 'message',
651
+ T: NotifOperation,
652
+ repeated: true,
653
+ },
654
+ { no: 2, name: 'cursor', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
655
+ ])
656
+
657
+ static fromBinary(
658
+ bytes: Uint8Array,
659
+ options?: Partial<BinaryReadOptions>,
660
+ ): ScanNotifOperationsResponse {
661
+ return new ScanNotifOperationsResponse().fromBinary(bytes, options)
662
+ }
663
+
664
+ static fromJson(
665
+ jsonValue: JsonValue,
666
+ options?: Partial<JsonReadOptions>,
667
+ ): ScanNotifOperationsResponse {
668
+ return new ScanNotifOperationsResponse().fromJson(jsonValue, options)
669
+ }
670
+
671
+ static fromJsonString(
672
+ jsonString: string,
673
+ options?: Partial<JsonReadOptions>,
674
+ ): ScanNotifOperationsResponse {
675
+ return new ScanNotifOperationsResponse().fromJsonString(jsonString, options)
676
+ }
677
+
678
+ static equals(
679
+ a:
680
+ | ScanNotifOperationsResponse
681
+ | PlainMessage<ScanNotifOperationsResponse>
682
+ | undefined,
683
+ b:
684
+ | ScanNotifOperationsResponse
685
+ | PlainMessage<ScanNotifOperationsResponse>
686
+ | undefined,
687
+ ): boolean {
688
+ return proto3.util.equals(ScanNotifOperationsResponse, a, b)
689
+ }
690
+ }
691
+
375
692
  /**
376
693
  * Ping
377
694
  *
@@ -622,7 +622,11 @@ export class Views {
622
622
  if (!postRecord?.reply) return
623
623
  let root = this.maybePost(postRecord.reply.root.uri, state)
624
624
  let parent = this.maybePost(postRecord.reply.parent.uri, state)
625
- if (state.postBlocks?.get(uri)?.reply && isPostView(parent)) {
625
+ if (
626
+ !state.ctx?.include3pBlocks &&
627
+ state.postBlocks?.get(uri)?.reply &&
628
+ isPostView(parent)
629
+ ) {
626
630
  parent = this.blockedPost(parent.uri, parent.author.did, state)
627
631
  // in a reply to the root of a thread, parent and root are the same post.
628
632
  if (root.uri === parent.uri) {
@@ -751,7 +755,7 @@ export class Views {
751
755
  if (height < 1) return undefined
752
756
  const parentUri = state.posts?.get(childUri)?.record.reply?.parent.uri
753
757
  if (!parentUri) return undefined
754
- if (state.postBlocks?.get(childUri)?.reply) {
758
+ if (!state.ctx?.include3pBlocks && state.postBlocks?.get(childUri)?.reply) {
755
759
  return this.blockedPost(parentUri, creatorFromUri(parentUri), state)
756
760
  }
757
761
  const post = this.post(parentUri, state)
@@ -782,7 +786,7 @@ export class Views {
782
786
  if (postInfo?.violatesThreadGate) {
783
787
  return undefined
784
788
  }
785
- if (state.postBlocks?.get(uri)?.reply) {
789
+ if (!state.ctx?.include3pBlocks && state.postBlocks?.get(uri)?.reply) {
786
790
  return undefined
787
791
  }
788
792
  const post = this.post(uri, state)
@@ -935,7 +939,7 @@ export class Views {
935
939
  const parsedUri = new AtUri(uri)
936
940
  if (
937
941
  this.viewerBlockExists(parsedUri.hostname, state) ||
938
- state.postBlocks?.get(postUri)?.embed
942
+ (!state.ctx?.include3pBlocks && state.postBlocks?.get(postUri)?.embed)
939
943
  ) {
940
944
  return this.embedBlocked(uri, state)
941
945
  }