@atproto/bsky 0.0.176 → 0.0.178

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 (64) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/api/app/bsky/graph/getList.js +1 -6
  3. package/dist/api/app/bsky/graph/getList.js.map +1 -1
  4. package/dist/api/app/bsky/graph/getLists.d.ts.map +1 -1
  5. package/dist/api/app/bsky/graph/getLists.js +16 -4
  6. package/dist/api/app/bsky/graph/getLists.js.map +1 -1
  7. package/dist/api/app/bsky/graph/getListsWithMembership.d.ts +4 -0
  8. package/dist/api/app/bsky/graph/getListsWithMembership.d.ts.map +1 -0
  9. package/dist/api/app/bsky/graph/getListsWithMembership.js +88 -0
  10. package/dist/api/app/bsky/graph/getListsWithMembership.js.map +1 -0
  11. package/dist/api/app/bsky/graph/getStarterPacksWithMembership.d.ts +4 -0
  12. package/dist/api/app/bsky/graph/getStarterPacksWithMembership.d.ts.map +1 -0
  13. package/dist/api/app/bsky/graph/getStarterPacksWithMembership.js +72 -0
  14. package/dist/api/app/bsky/graph/getStarterPacksWithMembership.js.map +1 -0
  15. package/dist/api/index.d.ts.map +1 -1
  16. package/dist/api/index.js +4 -0
  17. package/dist/api/index.js.map +1 -1
  18. package/dist/hydration/graph.d.ts +4 -0
  19. package/dist/hydration/graph.d.ts.map +1 -1
  20. package/dist/hydration/graph.js.map +1 -1
  21. package/dist/hydration/hydrator.d.ts +3 -1
  22. package/dist/hydration/hydrator.d.ts.map +1 -1
  23. package/dist/hydration/hydrator.js +27 -0
  24. package/dist/hydration/hydrator.js.map +1 -1
  25. package/dist/lexicon/index.d.ts +234 -230
  26. package/dist/lexicon/index.d.ts.map +1 -1
  27. package/dist/lexicon/index.js +682 -674
  28. package/dist/lexicon/index.js.map +1 -1
  29. package/dist/lexicon/lexicons.d.ts +17073 -16785
  30. package/dist/lexicon/lexicons.d.ts.map +1 -1
  31. package/dist/lexicon/lexicons.js +9126 -8980
  32. package/dist/lexicon/lexicons.js.map +1 -1
  33. package/dist/lexicon/types/app/bsky/graph/getLists.d.ts +2 -0
  34. package/dist/lexicon/types/app/bsky/graph/getLists.d.ts.map +1 -1
  35. package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.d.ts +40 -0
  36. package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.d.ts.map +1 -0
  37. package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.js +16 -0
  38. package/dist/lexicon/types/app/bsky/graph/getListsWithMembership.js.map +1 -0
  39. package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.d.ts +38 -0
  40. package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.d.ts.map +1 -0
  41. package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.js +16 -0
  42. package/dist/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.js.map +1 -0
  43. package/dist/views/index.d.ts +2 -1
  44. package/dist/views/index.d.ts.map +1 -1
  45. package/dist/views/index.js +6 -0
  46. package/dist/views/index.js.map +1 -1
  47. package/package.json +11 -11
  48. package/src/api/app/bsky/graph/getList.ts +3 -5
  49. package/src/api/app/bsky/graph/getLists.ts +18 -5
  50. package/src/api/app/bsky/graph/getListsWithMembership.ts +139 -0
  51. package/src/api/app/bsky/graph/getStarterPacksWithMembership.ts +135 -0
  52. package/src/api/index.ts +4 -0
  53. package/src/hydration/graph.ts +8 -0
  54. package/src/hydration/hydrator.ts +43 -0
  55. package/src/lexicon/index.ts +1247 -1221
  56. package/src/lexicon/lexicons.ts +9494 -9341
  57. package/src/lexicon/types/app/bsky/graph/getLists.ts +2 -0
  58. package/src/lexicon/types/app/bsky/graph/getListsWithMembership.ts +63 -0
  59. package/src/lexicon/types/app/bsky/graph/getStarterPacksWithMembership.ts +65 -0
  60. package/src/views/index.ts +11 -0
  61. package/tests/views/__snapshots__/lists.test.ts.snap +160 -8
  62. package/tests/views/lists.test.ts +270 -36
  63. package/tests/views/starter-packs.test.ts +132 -3
  64. package/tsconfig.build.tsbuildinfo +1 -1
@@ -20,6 +20,8 @@ export type QueryParams = {
20
20
  actor: string
21
21
  limit: number
22
22
  cursor?: string
23
+ /** Optional filter by list purpose. If not specified, all supported types are returned. */
24
+ purposes?: 'modlist' | 'curatelist' | (string & {})[]
23
25
  }
24
26
  export type InputSchema = undefined
25
27
 
@@ -0,0 +1,63 @@
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 AppBskyGraphDefs from './defs.js'
13
+
14
+ const is$typed = _is$typed,
15
+ validate = _validate
16
+ const id = 'app.bsky.graph.getListsWithMembership'
17
+
18
+ export type QueryParams = {
19
+ /** The account (actor) to check for membership. */
20
+ actor: string
21
+ limit: number
22
+ cursor?: string
23
+ /** Optional filter by list purpose. If not specified, all supported types are returned. */
24
+ purposes?: 'modlist' | 'curatelist' | (string & {})[]
25
+ }
26
+ export type InputSchema = undefined
27
+
28
+ export interface OutputSchema {
29
+ cursor?: string
30
+ listsWithMembership: ListWithMembership[]
31
+ }
32
+
33
+ export type HandlerInput = void
34
+
35
+ export interface HandlerSuccess {
36
+ encoding: 'application/json'
37
+ body: OutputSchema
38
+ headers?: { [key: string]: string }
39
+ }
40
+
41
+ export interface HandlerError {
42
+ status: number
43
+ message?: string
44
+ }
45
+
46
+ export type HandlerOutput = HandlerError | HandlerSuccess
47
+
48
+ /** A list and an optional list item indicating membership of a target user to that list. */
49
+ export interface ListWithMembership {
50
+ $type?: 'app.bsky.graph.getListsWithMembership#listWithMembership'
51
+ list: AppBskyGraphDefs.ListView
52
+ listItem?: AppBskyGraphDefs.ListItemView
53
+ }
54
+
55
+ const hashListWithMembership = 'listWithMembership'
56
+
57
+ export function isListWithMembership<V>(v: V) {
58
+ return is$typed(v, id, hashListWithMembership)
59
+ }
60
+
61
+ export function validateListWithMembership<V>(v: V) {
62
+ return validate<ListWithMembership & V>(v, id, hashListWithMembership)
63
+ }
@@ -0,0 +1,65 @@
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 AppBskyGraphDefs from './defs.js'
13
+
14
+ const is$typed = _is$typed,
15
+ validate = _validate
16
+ const id = 'app.bsky.graph.getStarterPacksWithMembership'
17
+
18
+ export type QueryParams = {
19
+ /** The account (actor) to check for membership. */
20
+ actor: string
21
+ limit: number
22
+ cursor?: string
23
+ }
24
+ export type InputSchema = undefined
25
+
26
+ export interface OutputSchema {
27
+ cursor?: string
28
+ starterPacksWithMembership: StarterPackWithMembership[]
29
+ }
30
+
31
+ export type HandlerInput = void
32
+
33
+ export interface HandlerSuccess {
34
+ encoding: 'application/json'
35
+ body: OutputSchema
36
+ headers?: { [key: string]: string }
37
+ }
38
+
39
+ export interface HandlerError {
40
+ status: number
41
+ message?: string
42
+ }
43
+
44
+ export type HandlerOutput = HandlerError | HandlerSuccess
45
+
46
+ /** A starter pack and an optional list item indicating membership of a target user to that starter pack. */
47
+ export interface StarterPackWithMembership {
48
+ $type?: 'app.bsky.graph.getStarterPacksWithMembership#starterPackWithMembership'
49
+ starterPack: AppBskyGraphDefs.StarterPackView
50
+ listItem?: AppBskyGraphDefs.ListItemView
51
+ }
52
+
53
+ const hashStarterPackWithMembership = 'starterPackWithMembership'
54
+
55
+ export function isStarterPackWithMembership<V>(v: V) {
56
+ return is$typed(v, id, hashStarterPackWithMembership)
57
+ }
58
+
59
+ export function validateStarterPackWithMembership<V>(v: V) {
60
+ return validate<StarterPackWithMembership & V>(
61
+ v,
62
+ id,
63
+ hashStarterPackWithMembership,
64
+ )
65
+ }
@@ -44,6 +44,7 @@ import {
44
44
  import { Record as RepostRecord } from '../lexicon/types/app/bsky/feed/repost'
45
45
  import { isListRule } from '../lexicon/types/app/bsky/feed/threadgate'
46
46
  import {
47
+ ListItemView,
47
48
  ListView,
48
49
  ListViewBasic,
49
50
  StarterPackView,
@@ -625,6 +626,16 @@ export class Views {
625
626
  }
626
627
  }
627
628
 
629
+ listItemView(
630
+ uri: string,
631
+ did: string,
632
+ state: HydrationState,
633
+ ): Un$Typed<ListItemView> | undefined {
634
+ const subject = this.profile(did, state)
635
+ if (!subject) return
636
+ return { uri, subject }
637
+ }
638
+
628
639
  starterPackBasic(
629
640
  uri: string,
630
641
  state: HydrationState,
@@ -139,8 +139,8 @@ Array [
139
139
  "indexedAt": "1970-01-01T00:00:00.000Z",
140
140
  "labels": Array [],
141
141
  "listItemCount": 0,
142
- "name": "cool curate list",
143
- "purpose": "app.bsky.graph.defs#curatelist",
142
+ "name": "mod2",
143
+ "purpose": "app.bsky.graph.defs#modlist",
144
144
  "uri": "record(0)",
145
145
  },
146
146
  Object {
@@ -157,10 +157,86 @@ Array [
157
157
  },
158
158
  "indexedAt": "1970-01-01T00:00:00.000Z",
159
159
  "labels": Array [],
160
+ "listItemCount": 0,
161
+ "name": "mod1",
162
+ "purpose": "app.bsky.graph.defs#modlist",
163
+ "uri": "record(1)",
164
+ },
165
+ Object {
166
+ "cid": "cids(2)",
167
+ "creator": Object {
168
+ "associated": Object {
169
+ "activitySubscription": Object {
170
+ "allowSubscriptions": "followers",
171
+ },
172
+ },
173
+ "did": "user(0)",
174
+ "handle": "eve.test",
175
+ "labels": Array [],
176
+ },
177
+ "indexedAt": "1970-01-01T00:00:00.000Z",
178
+ "labels": Array [],
179
+ "listItemCount": 2,
180
+ "name": "mod0",
181
+ "purpose": "app.bsky.graph.defs#modlist",
182
+ "uri": "record(2)",
183
+ },
184
+ Object {
185
+ "cid": "cids(3)",
186
+ "creator": Object {
187
+ "associated": Object {
188
+ "activitySubscription": Object {
189
+ "allowSubscriptions": "followers",
190
+ },
191
+ },
192
+ "did": "user(0)",
193
+ "handle": "eve.test",
194
+ "labels": Array [],
195
+ },
196
+ "indexedAt": "1970-01-01T00:00:00.000Z",
197
+ "labels": Array [],
198
+ "listItemCount": 0,
199
+ "name": "cur2",
200
+ "purpose": "app.bsky.graph.defs#curatelist",
201
+ "uri": "record(3)",
202
+ },
203
+ Object {
204
+ "cid": "cids(4)",
205
+ "creator": Object {
206
+ "associated": Object {
207
+ "activitySubscription": Object {
208
+ "allowSubscriptions": "followers",
209
+ },
210
+ },
211
+ "did": "user(0)",
212
+ "handle": "eve.test",
213
+ "labels": Array [],
214
+ },
215
+ "indexedAt": "1970-01-01T00:00:00.000Z",
216
+ "labels": Array [],
217
+ "listItemCount": 0,
218
+ "name": "cur1",
219
+ "purpose": "app.bsky.graph.defs#curatelist",
220
+ "uri": "record(4)",
221
+ },
222
+ Object {
223
+ "cid": "cids(5)",
224
+ "creator": Object {
225
+ "associated": Object {
226
+ "activitySubscription": Object {
227
+ "allowSubscriptions": "followers",
228
+ },
229
+ },
230
+ "did": "user(0)",
231
+ "handle": "eve.test",
232
+ "labels": Array [],
233
+ },
234
+ "indexedAt": "1970-01-01T00:00:00.000Z",
235
+ "labels": Array [],
160
236
  "listItemCount": 3,
161
- "name": "blah curate list!",
237
+ "name": "cur0",
162
238
  "purpose": "app.bsky.graph.defs#curatelist",
163
- "uri": "record(1)",
239
+ "uri": "record(5)",
164
240
  },
165
241
  ]
166
242
  `;
@@ -471,8 +547,8 @@ Array [
471
547
  "indexedAt": "1970-01-01T00:00:00.000Z",
472
548
  "labels": Array [],
473
549
  "listItemCount": 0,
474
- "name": "cool curate list",
475
- "purpose": "app.bsky.graph.defs#curatelist",
550
+ "name": "mod2",
551
+ "purpose": "app.bsky.graph.defs#modlist",
476
552
  "uri": "record(0)",
477
553
  },
478
554
  Object {
@@ -489,10 +565,86 @@ Array [
489
565
  },
490
566
  "indexedAt": "1970-01-01T00:00:00.000Z",
491
567
  "labels": Array [],
568
+ "listItemCount": 0,
569
+ "name": "mod1",
570
+ "purpose": "app.bsky.graph.defs#modlist",
571
+ "uri": "record(1)",
572
+ },
573
+ Object {
574
+ "cid": "cids(2)",
575
+ "creator": Object {
576
+ "associated": Object {
577
+ "activitySubscription": Object {
578
+ "allowSubscriptions": "followers",
579
+ },
580
+ },
581
+ "did": "user(0)",
582
+ "handle": "eve.test",
583
+ "labels": Array [],
584
+ },
585
+ "indexedAt": "1970-01-01T00:00:00.000Z",
586
+ "labels": Array [],
587
+ "listItemCount": 2,
588
+ "name": "mod0",
589
+ "purpose": "app.bsky.graph.defs#modlist",
590
+ "uri": "record(2)",
591
+ },
592
+ Object {
593
+ "cid": "cids(3)",
594
+ "creator": Object {
595
+ "associated": Object {
596
+ "activitySubscription": Object {
597
+ "allowSubscriptions": "followers",
598
+ },
599
+ },
600
+ "did": "user(0)",
601
+ "handle": "eve.test",
602
+ "labels": Array [],
603
+ },
604
+ "indexedAt": "1970-01-01T00:00:00.000Z",
605
+ "labels": Array [],
606
+ "listItemCount": 0,
607
+ "name": "cur2",
608
+ "purpose": "app.bsky.graph.defs#curatelist",
609
+ "uri": "record(3)",
610
+ },
611
+ Object {
612
+ "cid": "cids(4)",
613
+ "creator": Object {
614
+ "associated": Object {
615
+ "activitySubscription": Object {
616
+ "allowSubscriptions": "followers",
617
+ },
618
+ },
619
+ "did": "user(0)",
620
+ "handle": "eve.test",
621
+ "labels": Array [],
622
+ },
623
+ "indexedAt": "1970-01-01T00:00:00.000Z",
624
+ "labels": Array [],
625
+ "listItemCount": 0,
626
+ "name": "cur1",
627
+ "purpose": "app.bsky.graph.defs#curatelist",
628
+ "uri": "record(4)",
629
+ },
630
+ Object {
631
+ "cid": "cids(5)",
632
+ "creator": Object {
633
+ "associated": Object {
634
+ "activitySubscription": Object {
635
+ "allowSubscriptions": "followers",
636
+ },
637
+ },
638
+ "did": "user(0)",
639
+ "handle": "eve.test",
640
+ "labels": Array [],
641
+ },
642
+ "indexedAt": "1970-01-01T00:00:00.000Z",
643
+ "labels": Array [],
492
644
  "listItemCount": 3,
493
- "name": "blah curate list!",
645
+ "name": "cur0",
494
646
  "purpose": "app.bsky.graph.defs#curatelist",
495
- "uri": "record(1)",
647
+ "uri": "record(5)",
496
648
  },
497
649
  ]
498
650
  `;