@atproto/bsky 0.0.147 → 0.0.148

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 (127) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/api/app/bsky/feed/getListFeed.js +1 -1
  3. package/dist/api/app/bsky/feed/getListFeed.js.map +1 -1
  4. package/dist/api/app/bsky/graph/getFollowers.js +1 -1
  5. package/dist/api/app/bsky/graph/getFollowers.js.map +1 -1
  6. package/dist/api/app/bsky/graph/getFollows.js +1 -1
  7. package/dist/api/app/bsky/graph/getFollows.js.map +1 -1
  8. package/dist/api/app/bsky/graph/getList.js +1 -1
  9. package/dist/api/app/bsky/graph/getList.js.map +1 -1
  10. package/dist/api/app/bsky/unspecced/getSuggestedStarterPacks.js +1 -1
  11. package/dist/api/app/bsky/unspecced/getSuggestedStarterPacks.js.map +1 -1
  12. package/dist/api/app/bsky/unspecced/getSuggestedUsers.js +1 -1
  13. package/dist/api/app/bsky/unspecced/getSuggestedUsers.js.map +1 -1
  14. package/dist/api/app/bsky/unspecced/getTrends.js +1 -1
  15. package/dist/api/app/bsky/unspecced/getTrends.js.map +1 -1
  16. package/dist/api/com/atproto/identity/resolveHandle.d.ts.map +1 -1
  17. package/dist/api/com/atproto/identity/resolveHandle.js +3 -13
  18. package/dist/api/com/atproto/identity/resolveHandle.js.map +1 -1
  19. package/dist/api/health.js +1 -1
  20. package/dist/api/health.js.map +1 -1
  21. package/dist/data-plane/server/background.js +1 -1
  22. package/dist/data-plane/server/background.js.map +1 -1
  23. package/dist/data-plane/server/indexing/index.d.ts +2 -0
  24. package/dist/data-plane/server/indexing/index.d.ts.map +1 -1
  25. package/dist/data-plane/server/indexing/index.js +2 -0
  26. package/dist/data-plane/server/indexing/index.js.map +1 -1
  27. package/dist/data-plane/server/indexing/plugins/status.d.ts +7 -0
  28. package/dist/data-plane/server/indexing/plugins/status.d.ts.map +1 -0
  29. package/dist/data-plane/server/indexing/plugins/status.js +73 -0
  30. package/dist/data-plane/server/indexing/plugins/status.js.map +1 -0
  31. package/dist/data-plane/server/routes/index.d.ts.map +1 -1
  32. package/dist/data-plane/server/routes/index.js +0 -2
  33. package/dist/data-plane/server/routes/index.js.map +1 -1
  34. package/dist/data-plane/server/routes/profile.d.ts.map +1 -1
  35. package/dist/data-plane/server/routes/profile.js +8 -1
  36. package/dist/data-plane/server/routes/profile.js.map +1 -1
  37. package/dist/data-plane/server/routes/records.d.ts.map +1 -1
  38. package/dist/data-plane/server/routes/records.js +1 -0
  39. package/dist/data-plane/server/routes/records.js.map +1 -1
  40. package/dist/error.js +1 -1
  41. package/dist/error.js.map +1 -1
  42. package/dist/hydration/actor.d.ts +8 -1
  43. package/dist/hydration/actor.d.ts.map +1 -1
  44. package/dist/hydration/actor.js +18 -2
  45. package/dist/hydration/actor.js.map +1 -1
  46. package/dist/hydration/feed.d.ts +2 -2
  47. package/dist/hydration/feed.d.ts.map +1 -1
  48. package/dist/hydration/feed.js +10 -4
  49. package/dist/hydration/feed.js.map +1 -1
  50. package/dist/hydration/hydrator.d.ts +4 -3
  51. package/dist/hydration/hydrator.d.ts.map +1 -1
  52. package/dist/hydration/hydrator.js +47 -22
  53. package/dist/hydration/hydrator.js.map +1 -1
  54. package/dist/hydration/label.d.ts +1 -1
  55. package/dist/hydration/label.d.ts.map +1 -1
  56. package/dist/hydration/label.js +5 -2
  57. package/dist/hydration/label.js.map +1 -1
  58. package/dist/image/server.js +1 -1
  59. package/dist/image/server.js.map +1 -1
  60. package/dist/lexicon/index.d.ts +3 -0
  61. package/dist/lexicon/index.d.ts.map +1 -1
  62. package/dist/lexicon/index.js +4 -1
  63. package/dist/lexicon/index.js.map +1 -1
  64. package/dist/lexicon/lexicons.d.ts +160 -0
  65. package/dist/lexicon/lexicons.d.ts.map +1 -1
  66. package/dist/lexicon/lexicons.js +81 -0
  67. package/dist/lexicon/lexicons.js.map +1 -1
  68. package/dist/lexicon/types/app/bsky/actor/defs.d.ts +21 -0
  69. package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
  70. package/dist/lexicon/types/app/bsky/actor/defs.js +9 -0
  71. package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
  72. package/dist/lexicon/types/app/bsky/actor/status.d.ts +23 -0
  73. package/dist/lexicon/types/app/bsky/actor/status.d.ts.map +1 -0
  74. package/dist/lexicon/types/app/bsky/actor/status.js +19 -0
  75. package/dist/lexicon/types/app/bsky/actor/status.js.map +1 -0
  76. package/dist/proto/bsky_connect.d.ts +10 -12
  77. package/dist/proto/bsky_connect.d.ts.map +1 -1
  78. package/dist/proto/bsky_connect.js +9 -11
  79. package/dist/proto/bsky_connect.js.map +1 -1
  80. package/dist/proto/bsky_pb.d.ts +58 -37
  81. package/dist/proto/bsky_pb.d.ts.map +1 -1
  82. package/dist/proto/bsky_pb.js +189 -115
  83. package/dist/proto/bsky_pb.js.map +1 -1
  84. package/dist/views/index.d.ts +2 -1
  85. package/dist/views/index.d.ts.map +1 -1
  86. package/dist/views/index.js +37 -10
  87. package/dist/views/index.js.map +1 -1
  88. package/package.json +13 -13
  89. package/proto/bsky.proto +16 -17
  90. package/src/api/app/bsky/feed/getListFeed.ts +1 -1
  91. package/src/api/app/bsky/graph/getFollowers.ts +4 -1
  92. package/src/api/app/bsky/graph/getFollows.ts +4 -1
  93. package/src/api/app/bsky/graph/getList.ts +1 -1
  94. package/src/api/app/bsky/unspecced/getSuggestedStarterPacks.ts +1 -1
  95. package/src/api/app/bsky/unspecced/getSuggestedUsers.ts +1 -1
  96. package/src/api/app/bsky/unspecced/getTrends.ts +1 -1
  97. package/src/api/com/atproto/identity/resolveHandle.ts +3 -16
  98. package/src/api/health.ts +1 -1
  99. package/src/data-plane/server/background.ts +1 -1
  100. package/src/data-plane/server/indexing/index.ts +3 -0
  101. package/src/data-plane/server/indexing/plugins/status.ts +61 -0
  102. package/src/data-plane/server/routes/index.ts +0 -2
  103. package/src/data-plane/server/routes/profile.ts +43 -27
  104. package/src/data-plane/server/routes/records.ts +1 -0
  105. package/src/error.ts +1 -1
  106. package/src/hydration/actor.ts +27 -2
  107. package/src/hydration/feed.ts +16 -4
  108. package/src/hydration/hydrator.ts +64 -21
  109. package/src/hydration/label.ts +8 -2
  110. package/src/image/server.ts +1 -1
  111. package/src/lexicon/index.ts +3 -0
  112. package/src/lexicon/lexicons.ts +85 -0
  113. package/src/lexicon/types/app/bsky/actor/defs.ts +26 -0
  114. package/src/lexicon/types/app/bsky/actor/status.ts +40 -0
  115. package/src/proto/bsky_connect.ts +11 -13
  116. package/src/proto/bsky_pb.ts +173 -119
  117. package/src/views/index.ts +47 -11
  118. package/tests/views/__snapshots__/profile.test.ts.snap +60 -0
  119. package/tests/views/__snapshots__/thread.test.ts.snap +203 -11
  120. package/tests/views/profile.test.ts +189 -1
  121. package/tests/views/thread.test.ts +134 -2
  122. package/tsconfig.build.tsbuildinfo +1 -1
  123. package/dist/data-plane/server/routes/posts.d.ts +0 -6
  124. package/dist/data-plane/server/routes/posts.d.ts.map +0 -1
  125. package/dist/data-plane/server/routes/posts.js +0 -20
  126. package/dist/data-plane/server/routes/posts.js.map +0 -1
  127. package/src/data-plane/server/routes/posts.ts +0 -21
@@ -14,6 +14,7 @@ import type * as AppBskyGraphDefs from '../graph/defs.js'
14
14
  import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js'
15
15
  import type * as AppBskyFeedThreadgate from '../feed/threadgate.js'
16
16
  import type * as AppBskyFeedPostgate from '../feed/postgate.js'
17
+ import type * as AppBskyEmbedExternal from '../embed/external.js'
17
18
 
18
19
  const is$typed = _is$typed,
19
20
  validate = _validate
@@ -30,6 +31,7 @@ export interface ProfileViewBasic {
30
31
  labels?: ComAtprotoLabelDefs.Label[]
31
32
  createdAt?: string
32
33
  verification?: VerificationState
34
+ status?: StatusView
33
35
  }
34
36
 
35
37
  const hashProfileViewBasic = 'profileViewBasic'
@@ -55,6 +57,7 @@ export interface ProfileView {
55
57
  viewer?: ViewerState
56
58
  labels?: ComAtprotoLabelDefs.Label[]
57
59
  verification?: VerificationState
60
+ status?: StatusView
58
61
  }
59
62
 
60
63
  const hashProfileView = 'profileView'
@@ -86,6 +89,7 @@ export interface ProfileViewDetailed {
86
89
  labels?: ComAtprotoLabelDefs.Label[]
87
90
  pinnedPost?: ComAtprotoRepoStrongRef.Main
88
91
  verification?: VerificationState
92
+ status?: StatusView
89
93
  }
90
94
 
91
95
  const hashProfileViewDetailed = 'profileViewDetailed'
@@ -592,3 +596,25 @@ export function validatePostInteractionSettingsPref<V>(v: V) {
592
596
  hashPostInteractionSettingsPref,
593
597
  )
594
598
  }
599
+
600
+ export interface StatusView {
601
+ $type?: 'app.bsky.actor.defs#statusView'
602
+ /** The status for the account. */
603
+ status: 'app.bsky.actor.status#live' | (string & {})
604
+ record: { [_ in string]: unknown }
605
+ embed?: $Typed<AppBskyEmbedExternal.View> | { $type: string }
606
+ /** The date when this status will expire. The application might choose to no longer return the status after expiration. */
607
+ expiresAt?: string
608
+ /** True if the status is not expired, false if it is expired. Only present if expiration was set. */
609
+ isActive?: boolean
610
+ }
611
+
612
+ const hashStatusView = 'statusView'
613
+
614
+ export function isStatusView<V>(v: V) {
615
+ return is$typed(v, id, hashStatusView)
616
+ }
617
+
618
+ export function validateStatusView<V>(v: V) {
619
+ return validate<StatusView & V>(v, id, hashStatusView)
620
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { CID } from 'multiformats/cid'
6
+ import { validate as _validate } from '../../../../lexicons'
7
+ import {
8
+ type $Typed,
9
+ is$typed as _is$typed,
10
+ type OmitKey,
11
+ } from '../../../../util'
12
+ import type * as AppBskyEmbedExternal from '../embed/external.js'
13
+
14
+ const is$typed = _is$typed,
15
+ validate = _validate
16
+ const id = 'app.bsky.actor.status'
17
+
18
+ export interface Record {
19
+ $type: 'app.bsky.actor.status'
20
+ /** The status for the account. */
21
+ status: 'app.bsky.actor.status#live' | (string & {})
22
+ embed?: $Typed<AppBskyEmbedExternal.Main> | { $type: string }
23
+ /** The duration of the status in minutes. Applications can choose to impose minimum and maximum limits. */
24
+ durationMinutes?: number
25
+ createdAt: string
26
+ [k: string]: unknown
27
+ }
28
+
29
+ const hashRecord = 'main'
30
+
31
+ export function isRecord<V>(v: V) {
32
+ return is$typed(v, id, hashRecord)
33
+ }
34
+
35
+ export function validateRecord<V>(v: V) {
36
+ return validate<Record & V>(v, id, hashRecord, true)
37
+ }
38
+
39
+ /** Advertises an account as currently offering live content. */
40
+ export const LIVE = `${id}#live`
@@ -134,8 +134,6 @@ import {
134
134
  GetPostgateRecordsResponse,
135
135
  GetPostRecordsRequest,
136
136
  GetPostRecordsResponse,
137
- GetPostReplyCountsRequest,
138
- GetPostReplyCountsResponse,
139
137
  GetProfileRecordsRequest,
140
138
  GetProfileRecordsResponse,
141
139
  GetQuotesBySubjectSortedRequest,
@@ -154,6 +152,8 @@ import {
154
152
  GetStarterPackCountsResponse,
155
153
  GetStarterPackRecordsRequest,
156
154
  GetStarterPackRecordsResponse,
155
+ GetStatusRecordsRequest,
156
+ GetStatusRecordsResponse,
157
157
  GetSuggestedEntitiesRequest,
158
158
  GetSuggestedEntitiesResponse,
159
159
  GetSuggestedFeedsRequest,
@@ -305,6 +305,15 @@ export const Service = {
305
305
  O: GetActorChatDeclarationRecordsResponse,
306
306
  kind: MethodKind.Unary,
307
307
  },
308
+ /**
309
+ * @generated from rpc bsky.Service.GetStatusRecords
310
+ */
311
+ getStatusRecords: {
312
+ name: 'GetStatusRecords',
313
+ I: GetStatusRecordsRequest,
314
+ O: GetStatusRecordsResponse,
315
+ kind: MethodKind.Unary,
316
+ },
308
317
  /**
309
318
  * @generated from rpc bsky.Service.GetRepostRecords
310
319
  */
@@ -885,17 +894,6 @@ export const Service = {
885
894
  O: GetSuggestedEntitiesResponse,
886
895
  kind: MethodKind.Unary,
887
896
  },
888
- /**
889
- * Posts
890
- *
891
- * @generated from rpc bsky.Service.GetPostReplyCounts
892
- */
893
- getPostReplyCounts: {
894
- name: 'GetPostReplyCounts',
895
- I: GetPostReplyCountsRequest,
896
- O: GetPostReplyCountsResponse,
897
- kind: MethodKind.Unary,
898
- },
899
897
  /**
900
898
  * Labels
901
899
  *
@@ -1418,6 +1418,122 @@ export class GetActorChatDeclarationRecordsResponse extends Message<GetActorChat
1418
1418
  }
1419
1419
  }
1420
1420
 
1421
+ /**
1422
+ * @generated from message bsky.GetStatusRecordsRequest
1423
+ */
1424
+ export class GetStatusRecordsRequest extends Message<GetStatusRecordsRequest> {
1425
+ /**
1426
+ * @generated from field: repeated string uris = 1;
1427
+ */
1428
+ uris: string[] = []
1429
+
1430
+ constructor(data?: PartialMessage<GetStatusRecordsRequest>) {
1431
+ super()
1432
+ proto3.util.initPartial(data, this)
1433
+ }
1434
+
1435
+ static readonly runtime: typeof proto3 = proto3
1436
+ static readonly typeName = 'bsky.GetStatusRecordsRequest'
1437
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1438
+ {
1439
+ no: 1,
1440
+ name: 'uris',
1441
+ kind: 'scalar',
1442
+ T: 9 /* ScalarType.STRING */,
1443
+ repeated: true,
1444
+ },
1445
+ ])
1446
+
1447
+ static fromBinary(
1448
+ bytes: Uint8Array,
1449
+ options?: Partial<BinaryReadOptions>,
1450
+ ): GetStatusRecordsRequest {
1451
+ return new GetStatusRecordsRequest().fromBinary(bytes, options)
1452
+ }
1453
+
1454
+ static fromJson(
1455
+ jsonValue: JsonValue,
1456
+ options?: Partial<JsonReadOptions>,
1457
+ ): GetStatusRecordsRequest {
1458
+ return new GetStatusRecordsRequest().fromJson(jsonValue, options)
1459
+ }
1460
+
1461
+ static fromJsonString(
1462
+ jsonString: string,
1463
+ options?: Partial<JsonReadOptions>,
1464
+ ): GetStatusRecordsRequest {
1465
+ return new GetStatusRecordsRequest().fromJsonString(jsonString, options)
1466
+ }
1467
+
1468
+ static equals(
1469
+ a:
1470
+ | GetStatusRecordsRequest
1471
+ | PlainMessage<GetStatusRecordsRequest>
1472
+ | undefined,
1473
+ b:
1474
+ | GetStatusRecordsRequest
1475
+ | PlainMessage<GetStatusRecordsRequest>
1476
+ | undefined,
1477
+ ): boolean {
1478
+ return proto3.util.equals(GetStatusRecordsRequest, a, b)
1479
+ }
1480
+ }
1481
+
1482
+ /**
1483
+ * @generated from message bsky.GetStatusRecordsResponse
1484
+ */
1485
+ export class GetStatusRecordsResponse extends Message<GetStatusRecordsResponse> {
1486
+ /**
1487
+ * @generated from field: repeated bsky.Record records = 1;
1488
+ */
1489
+ records: Record[] = []
1490
+
1491
+ constructor(data?: PartialMessage<GetStatusRecordsResponse>) {
1492
+ super()
1493
+ proto3.util.initPartial(data, this)
1494
+ }
1495
+
1496
+ static readonly runtime: typeof proto3 = proto3
1497
+ static readonly typeName = 'bsky.GetStatusRecordsResponse'
1498
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
1499
+ { no: 1, name: 'records', kind: 'message', T: Record, repeated: true },
1500
+ ])
1501
+
1502
+ static fromBinary(
1503
+ bytes: Uint8Array,
1504
+ options?: Partial<BinaryReadOptions>,
1505
+ ): GetStatusRecordsResponse {
1506
+ return new GetStatusRecordsResponse().fromBinary(bytes, options)
1507
+ }
1508
+
1509
+ static fromJson(
1510
+ jsonValue: JsonValue,
1511
+ options?: Partial<JsonReadOptions>,
1512
+ ): GetStatusRecordsResponse {
1513
+ return new GetStatusRecordsResponse().fromJson(jsonValue, options)
1514
+ }
1515
+
1516
+ static fromJsonString(
1517
+ jsonString: string,
1518
+ options?: Partial<JsonReadOptions>,
1519
+ ): GetStatusRecordsResponse {
1520
+ return new GetStatusRecordsResponse().fromJsonString(jsonString, options)
1521
+ }
1522
+
1523
+ static equals(
1524
+ a:
1525
+ | GetStatusRecordsResponse
1526
+ | PlainMessage<GetStatusRecordsResponse>
1527
+ | undefined,
1528
+ b:
1529
+ | GetStatusRecordsResponse
1530
+ | PlainMessage<GetStatusRecordsResponse>
1531
+ | undefined,
1532
+ ): boolean {
1533
+ return proto3.util.equals(GetStatusRecordsResponse, a, b)
1534
+ }
1535
+ }
1536
+
1421
1537
  /**
1422
1538
  * @generated from message bsky.GetRepostRecordsRequest
1423
1539
  */
@@ -3945,6 +4061,11 @@ export class GetInteractionCountsRequest extends Message<GetInteractionCountsReq
3945
4061
  */
3946
4062
  refs: RecordRef[] = []
3947
4063
 
4064
+ /**
4065
+ * @generated from field: repeated string skip_cache_for_dids = 2;
4066
+ */
4067
+ skipCacheForDids: string[] = []
4068
+
3948
4069
  constructor(data?: PartialMessage<GetInteractionCountsRequest>) {
3949
4070
  super()
3950
4071
  proto3.util.initPartial(data, this)
@@ -3954,6 +4075,13 @@ export class GetInteractionCountsRequest extends Message<GetInteractionCountsReq
3954
4075
  static readonly typeName = 'bsky.GetInteractionCountsRequest'
3955
4076
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
3956
4077
  { no: 1, name: 'refs', kind: 'message', T: RecordRef, repeated: true },
4078
+ {
4079
+ no: 2,
4080
+ name: 'skip_cache_for_dids',
4081
+ kind: 'scalar',
4082
+ T: 9 /* ScalarType.STRING */,
4083
+ repeated: true,
4084
+ },
3957
4085
  ])
3958
4086
 
3959
4087
  static fromBinary(
@@ -5253,6 +5381,25 @@ export class ActorInfo extends Message<ActorInfo> {
5253
5381
  */
5254
5382
  verifiedBy: { [key: string]: VerificationMeta } = {}
5255
5383
 
5384
+ /**
5385
+ * Tags being applied to the account itself
5386
+ *
5387
+ * @generated from field: repeated string tags = 15;
5388
+ */
5389
+ tags: string[] = []
5390
+
5391
+ /**
5392
+ * Tags being applied to the profile record
5393
+ *
5394
+ * @generated from field: repeated string profile_tags = 16;
5395
+ */
5396
+ profileTags: string[] = []
5397
+
5398
+ /**
5399
+ * @generated from field: bsky.Record status_record = 17;
5400
+ */
5401
+ statusRecord?: Record
5402
+
5256
5403
  constructor(data?: PartialMessage<ActorInfo>) {
5257
5404
  super()
5258
5405
  proto3.util.initPartial(data, this)
@@ -5306,6 +5453,21 @@ export class ActorInfo extends Message<ActorInfo> {
5306
5453
  K: 9 /* ScalarType.STRING */,
5307
5454
  V: { kind: 'message', T: VerificationMeta },
5308
5455
  },
5456
+ {
5457
+ no: 15,
5458
+ name: 'tags',
5459
+ kind: 'scalar',
5460
+ T: 9 /* ScalarType.STRING */,
5461
+ repeated: true,
5462
+ },
5463
+ {
5464
+ no: 16,
5465
+ name: 'profile_tags',
5466
+ kind: 'scalar',
5467
+ T: 9 /* ScalarType.STRING */,
5468
+ repeated: true,
5469
+ },
5470
+ { no: 17, name: 'status_record', kind: 'message', T: Record },
5309
5471
  ])
5310
5472
 
5311
5473
  static fromBinary(
@@ -5399,6 +5561,11 @@ export class GetDidsByHandlesRequest extends Message<GetDidsByHandlesRequest> {
5399
5561
  */
5400
5562
  handles: string[] = []
5401
5563
 
5564
+ /**
5565
+ * @generated from field: bool lookup_unidirectional = 2;
5566
+ */
5567
+ lookupUnidirectional = false
5568
+
5402
5569
  constructor(data?: PartialMessage<GetDidsByHandlesRequest>) {
5403
5570
  super()
5404
5571
  proto3.util.initPartial(data, this)
@@ -5414,6 +5581,12 @@ export class GetDidsByHandlesRequest extends Message<GetDidsByHandlesRequest> {
5414
5581
  T: 9 /* ScalarType.STRING */,
5415
5582
  repeated: true,
5416
5583
  },
5584
+ {
5585
+ no: 2,
5586
+ name: 'lookup_unidirectional',
5587
+ kind: 'scalar',
5588
+ T: 8 /* ScalarType.BOOL */,
5589
+ },
5417
5590
  ])
5418
5591
 
5419
5592
  static fromBinary(
@@ -10647,125 +10820,6 @@ export class GetSuggestedEntitiesResponse extends Message<GetSuggestedEntitiesRe
10647
10820
  }
10648
10821
  }
10649
10822
 
10650
- /**
10651
- * - Return post reply count with uris A, B, C…
10652
- * - All feed hydration
10653
- *
10654
- * @generated from message bsky.GetPostReplyCountsRequest
10655
- */
10656
- export class GetPostReplyCountsRequest extends Message<GetPostReplyCountsRequest> {
10657
- /**
10658
- * @generated from field: repeated bsky.RecordRef refs = 1;
10659
- */
10660
- refs: RecordRef[] = []
10661
-
10662
- constructor(data?: PartialMessage<GetPostReplyCountsRequest>) {
10663
- super()
10664
- proto3.util.initPartial(data, this)
10665
- }
10666
-
10667
- static readonly runtime: typeof proto3 = proto3
10668
- static readonly typeName = 'bsky.GetPostReplyCountsRequest'
10669
- static readonly fields: FieldList = proto3.util.newFieldList(() => [
10670
- { no: 1, name: 'refs', kind: 'message', T: RecordRef, repeated: true },
10671
- ])
10672
-
10673
- static fromBinary(
10674
- bytes: Uint8Array,
10675
- options?: Partial<BinaryReadOptions>,
10676
- ): GetPostReplyCountsRequest {
10677
- return new GetPostReplyCountsRequest().fromBinary(bytes, options)
10678
- }
10679
-
10680
- static fromJson(
10681
- jsonValue: JsonValue,
10682
- options?: Partial<JsonReadOptions>,
10683
- ): GetPostReplyCountsRequest {
10684
- return new GetPostReplyCountsRequest().fromJson(jsonValue, options)
10685
- }
10686
-
10687
- static fromJsonString(
10688
- jsonString: string,
10689
- options?: Partial<JsonReadOptions>,
10690
- ): GetPostReplyCountsRequest {
10691
- return new GetPostReplyCountsRequest().fromJsonString(jsonString, options)
10692
- }
10693
-
10694
- static equals(
10695
- a:
10696
- | GetPostReplyCountsRequest
10697
- | PlainMessage<GetPostReplyCountsRequest>
10698
- | undefined,
10699
- b:
10700
- | GetPostReplyCountsRequest
10701
- | PlainMessage<GetPostReplyCountsRequest>
10702
- | undefined,
10703
- ): boolean {
10704
- return proto3.util.equals(GetPostReplyCountsRequest, a, b)
10705
- }
10706
- }
10707
-
10708
- /**
10709
- * @generated from message bsky.GetPostReplyCountsResponse
10710
- */
10711
- export class GetPostReplyCountsResponse extends Message<GetPostReplyCountsResponse> {
10712
- /**
10713
- * @generated from field: repeated int32 counts = 1;
10714
- */
10715
- counts: number[] = []
10716
-
10717
- constructor(data?: PartialMessage<GetPostReplyCountsResponse>) {
10718
- super()
10719
- proto3.util.initPartial(data, this)
10720
- }
10721
-
10722
- static readonly runtime: typeof proto3 = proto3
10723
- static readonly typeName = 'bsky.GetPostReplyCountsResponse'
10724
- static readonly fields: FieldList = proto3.util.newFieldList(() => [
10725
- {
10726
- no: 1,
10727
- name: 'counts',
10728
- kind: 'scalar',
10729
- T: 5 /* ScalarType.INT32 */,
10730
- repeated: true,
10731
- },
10732
- ])
10733
-
10734
- static fromBinary(
10735
- bytes: Uint8Array,
10736
- options?: Partial<BinaryReadOptions>,
10737
- ): GetPostReplyCountsResponse {
10738
- return new GetPostReplyCountsResponse().fromBinary(bytes, options)
10739
- }
10740
-
10741
- static fromJson(
10742
- jsonValue: JsonValue,
10743
- options?: Partial<JsonReadOptions>,
10744
- ): GetPostReplyCountsResponse {
10745
- return new GetPostReplyCountsResponse().fromJson(jsonValue, options)
10746
- }
10747
-
10748
- static fromJsonString(
10749
- jsonString: string,
10750
- options?: Partial<JsonReadOptions>,
10751
- ): GetPostReplyCountsResponse {
10752
- return new GetPostReplyCountsResponse().fromJsonString(jsonString, options)
10753
- }
10754
-
10755
- static equals(
10756
- a:
10757
- | GetPostReplyCountsResponse
10758
- | PlainMessage<GetPostReplyCountsResponse>
10759
- | undefined,
10760
- b:
10761
- | GetPostReplyCountsResponse
10762
- | PlainMessage<GetPostReplyCountsResponse>
10763
- | undefined,
10764
- ): boolean {
10765
- return proto3.util.equals(GetPostReplyCountsResponse, a, b)
10766
- }
10767
- }
10768
-
10769
10823
  /**
10770
10824
  * - Get all labels on a subjects A, B, C (uri or did) issued by dids D, E, F…
10771
10825
  * - label hydration on nearly every view
@@ -1,4 +1,4 @@
1
- import { mapDefined } from '@atproto/common'
1
+ import { HOUR, MINUTE, mapDefined } from '@atproto/common'
2
2
  import { AtUri, INVALID_HANDLE, normalizeDatetimeAlways } from '@atproto/syntax'
3
3
  import { ProfileViewerState } from '../hydration/actor'
4
4
  import { FeedItem, Like, Post, Repost } from '../hydration/feed'
@@ -13,6 +13,7 @@ import {
13
13
  ProfileView,
14
14
  ProfileViewBasic,
15
15
  ProfileViewDetailed,
16
+ StatusView,
16
17
  VerificationState,
17
18
  VerificationView,
18
19
  ViewerState as ProfileViewer,
@@ -145,20 +146,20 @@ export class Views {
145
146
  }
146
147
 
147
148
  viewerBlockExists(did: string, state: HydrationState): boolean {
148
- const actor = state.profileViewers?.get(did)
149
- if (!actor) return false
149
+ const viewer = state.profileViewers?.get(did)
150
+ if (!viewer) return false
150
151
  return !!(
151
- actor.blockedBy ||
152
- actor.blocking ||
153
- this.blockedByList(actor, state) ||
154
- this.blockingByList(actor, state)
152
+ viewer.blockedBy ||
153
+ viewer.blocking ||
154
+ this.blockedByList(viewer, state) ||
155
+ this.blockingByList(viewer, state)
155
156
  )
156
157
  }
157
158
 
158
159
  viewerMuteExists(did: string, state: HydrationState): boolean {
159
- const actor = state.profileViewers?.get(did)
160
- if (!actor) return false
161
- return !!(actor.muted || this.mutedByList(actor, state))
160
+ const viewer = state.profileViewers?.get(did)
161
+ if (!viewer) return false
162
+ return !!(viewer.muted || this.mutedByList(viewer, state))
162
163
  }
163
164
 
164
165
  blockingByList(viewer: ProfileViewerState, state: HydrationState) {
@@ -330,6 +331,7 @@ export class Views {
330
331
  labels,
331
332
  createdAt: actor.createdAt?.toISOString(),
332
333
  verification: this.verification(did, state),
334
+ status: this.status(did, state),
333
335
  }
334
336
  }
335
337
 
@@ -386,7 +388,7 @@ export class Views {
386
388
  if (this.viewerBlockExists(followerDid, state)) {
387
389
  return undefined
388
390
  }
389
- if (blocks?.get(followerDid) === true) {
391
+ if (blocks?.get(followerDid)) {
390
392
  return undefined
391
393
  }
392
394
  if (this.actorIsNoHosted(followerDid, state)) {
@@ -453,6 +455,40 @@ export class Views {
453
455
  }
454
456
  }
455
457
 
458
+ status(did: string, state: HydrationState): StatusView | undefined {
459
+ const actor = state.actors?.get(did)
460
+ if (!actor?.status) return
461
+
462
+ const { status } = actor
463
+ const { record, sortedAt } = status
464
+
465
+ const minDuration = 5 * MINUTE
466
+ const maxDuration = 4 * HOUR
467
+
468
+ const expiresAtMs = record.durationMinutes
469
+ ? sortedAt.getTime() +
470
+ Math.max(
471
+ Math.min(record.durationMinutes * MINUTE, maxDuration),
472
+ minDuration,
473
+ )
474
+ : undefined
475
+ const expiresAt = expiresAtMs
476
+ ? new Date(expiresAtMs).toISOString()
477
+ : undefined
478
+
479
+ const isActive = expiresAtMs ? expiresAtMs > Date.now() : undefined
480
+
481
+ return {
482
+ record: record,
483
+ status: record.status,
484
+ embed: isExternalEmbed(record.embed)
485
+ ? this.externalEmbed(did, record.embed)
486
+ : undefined,
487
+ expiresAt,
488
+ isActive,
489
+ }
490
+ }
491
+
456
492
  blockedProfileViewer(
457
493
  did: string,
458
494
  state: HydrationState,
@@ -469,3 +469,63 @@ Object {
469
469
  },
470
470
  }
471
471
  `;
472
+
473
+ exports[`pds profile views status returns active status when within the duration 1`] = `
474
+ Object {
475
+ "embed": Object {
476
+ "$type": "app.bsky.embed.external#view",
477
+ "external": Object {
478
+ "description": "testLink",
479
+ "title": "TestImage",
480
+ "uri": "https://example.com",
481
+ },
482
+ },
483
+ "expiresAt": "1970-01-01T00:00:00.000Z",
484
+ "isActive": true,
485
+ "record": Object {
486
+ "$type": "app.bsky.actor.status",
487
+ "createdAt": "1970-01-01T00:00:00.000Z",
488
+ "durationMinutes": 10,
489
+ "embed": Object {
490
+ "$type": "app.bsky.embed.external",
491
+ "external": Object {
492
+ "description": "testLink",
493
+ "title": "TestImage",
494
+ "uri": "https://example.com",
495
+ },
496
+ },
497
+ "status": "app.bsky.actor.status#live",
498
+ },
499
+ "status": "app.bsky.actor.status#live",
500
+ }
501
+ `;
502
+
503
+ exports[`pds profile views status when outside the duration returns inactive status 1`] = `
504
+ Object {
505
+ "embed": Object {
506
+ "$type": "app.bsky.embed.external#view",
507
+ "external": Object {
508
+ "description": "testLink",
509
+ "title": "TestImage",
510
+ "uri": "https://example.com",
511
+ },
512
+ },
513
+ "expiresAt": "2021-01-01T01:10:00.000Z",
514
+ "isActive": false,
515
+ "record": Object {
516
+ "$type": "app.bsky.actor.status",
517
+ "createdAt": "2021-01-01T01:00:00.000Z",
518
+ "durationMinutes": 10,
519
+ "embed": Object {
520
+ "$type": "app.bsky.embed.external",
521
+ "external": Object {
522
+ "description": "testLink",
523
+ "title": "TestImage",
524
+ "uri": "https://example.com",
525
+ },
526
+ },
527
+ "status": "app.bsky.actor.status#live",
528
+ },
529
+ "status": "app.bsky.actor.status#live",
530
+ }
531
+ `;