@atproto/dev-env 0.0.0-spaces-alpha-20260818163953

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 (187) hide show
  1. package/CHANGELOG.md +3424 -0
  2. package/LICENSE.txt +7 -0
  3. package/README.md +39 -0
  4. package/bin.js +7 -0
  5. package/dist/bin-multi-pds.d.ts +2 -0
  6. package/dist/bin-multi-pds.d.ts.map +1 -0
  7. package/dist/bin-multi-pds.js +130 -0
  8. package/dist/bin-multi-pds.js.map +1 -0
  9. package/dist/bin.d.ts +2 -0
  10. package/dist/bin.d.ts.map +1 -0
  11. package/dist/bin.js +56 -0
  12. package/dist/bin.js.map +1 -0
  13. package/dist/bsky.d.ts +27 -0
  14. package/dist/bsky.d.ts.map +1 -0
  15. package/dist/bsky.js +165 -0
  16. package/dist/bsky.js.map +1 -0
  17. package/dist/bsync.d.ts +22 -0
  18. package/dist/bsync.d.ts.map +1 -0
  19. package/dist/bsync.js +54 -0
  20. package/dist/bsync.js.map +1 -0
  21. package/dist/const.d.ts +4 -0
  22. package/dist/const.d.ts.map +1 -0
  23. package/dist/const.js +4 -0
  24. package/dist/const.js.map +1 -0
  25. package/dist/env.d.ts +2 -0
  26. package/dist/env.d.ts.map +1 -0
  27. package/dist/env.js +10 -0
  28. package/dist/env.js.map +1 -0
  29. package/dist/feed-gen.d.ts +15 -0
  30. package/dist/feed-gen.d.ts.map +1 -0
  31. package/dist/feed-gen.js +73 -0
  32. package/dist/feed-gen.js.map +1 -0
  33. package/dist/index.d.ts +17 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +17 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/introspect.d.ts +22 -0
  38. package/dist/introspect.d.ts.map +1 -0
  39. package/dist/introspect.js +65 -0
  40. package/dist/introspect.js.map +1 -0
  41. package/dist/mock/data.d.ts +3 -0
  42. package/dist/mock/data.d.ts.map +1 -0
  43. package/dist/mock/data.js +46 -0
  44. package/dist/mock/data.js.map +1 -0
  45. package/dist/mock/img/blur-hash-avatar-b64.d.ts +3 -0
  46. package/dist/mock/img/blur-hash-avatar-b64.d.ts.map +1 -0
  47. package/dist/mock/img/blur-hash-avatar-b64.js +2 -0
  48. package/dist/mock/img/blur-hash-avatar-b64.js.map +1 -0
  49. package/dist/mock/img/labeled-img-b64.d.ts +3 -0
  50. package/dist/mock/img/labeled-img-b64.d.ts.map +1 -0
  51. package/dist/mock/img/labeled-img-b64.js +2 -0
  52. package/dist/mock/img/labeled-img-b64.js.map +1 -0
  53. package/dist/mock/index.d.ts +3 -0
  54. package/dist/mock/index.d.ts.map +1 -0
  55. package/dist/mock/index.js +574 -0
  56. package/dist/mock/index.js.map +1 -0
  57. package/dist/moderator-client.d.ts +58 -0
  58. package/dist/moderator-client.d.ts.map +1 -0
  59. package/dist/moderator-client.js +110 -0
  60. package/dist/moderator-client.js.map +1 -0
  61. package/dist/network-no-appview.d.ts +21 -0
  62. package/dist/network-no-appview.d.ts.map +1 -0
  63. package/dist/network-no-appview.js +74 -0
  64. package/dist/network-no-appview.js.map +1 -0
  65. package/dist/network.d.ts +32 -0
  66. package/dist/network.d.ts.map +1 -0
  67. package/dist/network.js +190 -0
  68. package/dist/network.js.map +1 -0
  69. package/dist/ozone.d.ts +31 -0
  70. package/dist/ozone.d.ts.map +1 -0
  71. package/dist/ozone.js +254 -0
  72. package/dist/ozone.js.map +1 -0
  73. package/dist/pds.d.ts +23 -0
  74. package/dist/pds.d.ts.map +1 -0
  75. package/dist/pds.js +97 -0
  76. package/dist/pds.js.map +1 -0
  77. package/dist/plc.d.ts +14 -0
  78. package/dist/plc.d.ts.map +1 -0
  79. package/dist/plc.js +28 -0
  80. package/dist/plc.js.map +1 -0
  81. package/dist/seed/author-feed.d.ts +4 -0
  82. package/dist/seed/author-feed.d.ts.map +1 -0
  83. package/dist/seed/author-feed.js +50 -0
  84. package/dist/seed/author-feed.js.map +1 -0
  85. package/dist/seed/basic.d.ts +16 -0
  86. package/dist/seed/basic.d.ts.map +1 -0
  87. package/dist/seed/basic.js +113 -0
  88. package/dist/seed/basic.js.map +1 -0
  89. package/dist/seed/client.d.ts +151 -0
  90. package/dist/seed/client.d.ts.map +1 -0
  91. package/dist/seed/client.js +365 -0
  92. package/dist/seed/client.js.map +1 -0
  93. package/dist/seed/follows.d.ts +4 -0
  94. package/dist/seed/follows.d.ts.map +1 -0
  95. package/dist/seed/follows.js +55 -0
  96. package/dist/seed/follows.js.map +1 -0
  97. package/dist/seed/index.d.ts +11 -0
  98. package/dist/seed/index.d.ts.map +1 -0
  99. package/dist/seed/index.js +11 -0
  100. package/dist/seed/index.js.map +1 -0
  101. package/dist/seed/likes.d.ts +4 -0
  102. package/dist/seed/likes.d.ts.map +1 -0
  103. package/dist/seed/likes.js +37 -0
  104. package/dist/seed/likes.js.map +1 -0
  105. package/dist/seed/quotes.d.ts +4 -0
  106. package/dist/seed/quotes.d.ts.map +1 -0
  107. package/dist/seed/quotes.js +21 -0
  108. package/dist/seed/quotes.js.map +1 -0
  109. package/dist/seed/reposts.d.ts +4 -0
  110. package/dist/seed/reposts.d.ts.map +1 -0
  111. package/dist/seed/reposts.js +17 -0
  112. package/dist/seed/reposts.js.map +1 -0
  113. package/dist/seed/thread-v2.d.ts +227 -0
  114. package/dist/seed/thread-v2.d.ts.map +1 -0
  115. package/dist/seed/thread-v2.js +755 -0
  116. package/dist/seed/thread-v2.js.map +1 -0
  117. package/dist/seed/users-bulk.d.ts +3 -0
  118. package/dist/seed/users-bulk.d.ts.map +1 -0
  119. package/dist/seed/users-bulk.js +224 -0
  120. package/dist/seed/users-bulk.js.map +1 -0
  121. package/dist/seed/users.d.ts +3 -0
  122. package/dist/seed/users.d.ts.map +1 -0
  123. package/dist/seed/users.js +45 -0
  124. package/dist/seed/users.js.map +1 -0
  125. package/dist/seed/verifications.d.ts +5 -0
  126. package/dist/seed/verifications.d.ts.map +1 -0
  127. package/dist/seed/verifications.js +164 -0
  128. package/dist/seed/verifications.js.map +1 -0
  129. package/dist/service-profile-lexicon.d.ts +11 -0
  130. package/dist/service-profile-lexicon.d.ts.map +1 -0
  131. package/dist/service-profile-lexicon.js +115 -0
  132. package/dist/service-profile-lexicon.js.map +1 -0
  133. package/dist/service-profile-ozone.d.ts +18 -0
  134. package/dist/service-profile-ozone.d.ts.map +1 -0
  135. package/dist/service-profile-ozone.js +333 -0
  136. package/dist/service-profile-ozone.js.map +1 -0
  137. package/dist/service-profile.d.ts +24 -0
  138. package/dist/service-profile.d.ts.map +1 -0
  139. package/dist/service-profile.js +61 -0
  140. package/dist/service-profile.js.map +1 -0
  141. package/dist/types.d.ts +61 -0
  142. package/dist/types.d.ts.map +1 -0
  143. package/dist/types.js +2 -0
  144. package/dist/types.js.map +1 -0
  145. package/dist/util.d.ts +14 -0
  146. package/dist/util.d.ts.map +1 -0
  147. package/dist/util.js +86 -0
  148. package/dist/util.js.map +1 -0
  149. package/package.json +69 -0
  150. package/src/bin-multi-pds.ts +166 -0
  151. package/src/bin.ts +64 -0
  152. package/src/bsky.ts +198 -0
  153. package/src/bsync.ts +66 -0
  154. package/src/const.ts +3 -0
  155. package/src/env.ts +9 -0
  156. package/src/feed-gen.ts +96 -0
  157. package/src/index.ts +17 -0
  158. package/src/introspect.ts +91 -0
  159. package/src/mock/data.ts +46 -0
  160. package/src/mock/img/blur-hash-avatar-b64.ts +1 -0
  161. package/src/mock/img/labeled-img-b64.ts +1 -0
  162. package/src/mock/index.ts +702 -0
  163. package/src/moderator-client.ts +267 -0
  164. package/src/network-no-appview.ts +89 -0
  165. package/src/network.ts +243 -0
  166. package/src/ozone.ts +287 -0
  167. package/src/pds.ts +118 -0
  168. package/src/plc.ts +33 -0
  169. package/src/seed/author-feed.ts +98 -0
  170. package/src/seed/basic.ts +189 -0
  171. package/src/seed/client.ts +676 -0
  172. package/src/seed/follows.ts +57 -0
  173. package/src/seed/index.ts +11 -0
  174. package/src/seed/likes.ts +43 -0
  175. package/src/seed/quotes.ts +53 -0
  176. package/src/seed/reposts.ts +18 -0
  177. package/src/seed/thread-v2.ts +925 -0
  178. package/src/seed/users-bulk.ts +229 -0
  179. package/src/seed/users.ts +64 -0
  180. package/src/seed/verifications.ts +254 -0
  181. package/src/service-profile-lexicon.ts +127 -0
  182. package/src/service-profile-ozone.ts +375 -0
  183. package/src/service-profile.ts +95 -0
  184. package/src/types.ts +68 -0
  185. package/src/util.ts +118 -0
  186. package/tsconfig.build.json +25 -0
  187. package/tsconfig.json +4 -0
@@ -0,0 +1,189 @@
1
+ import type { TestBsky } from '../bsky.js'
2
+ import { EXAMPLE_LABELER } from '../const.js'
3
+ import type { TestNetworkNoAppView } from '../network-no-appview.js'
4
+ import { TestNetwork } from '../network.js'
5
+ import type { SeedClient } from './client.js'
6
+ import usersSeed from './users.js'
7
+
8
+ export default async function basicSeed(
9
+ sc: SeedClient<TestNetwork | TestNetworkNoAppView>,
10
+ users = true,
11
+ ) {
12
+ if (users) await usersSeed(sc)
13
+
14
+ const alice = sc.dids.alice
15
+ const bob = sc.dids.bob
16
+ const carol = sc.dids.carol
17
+ const dan = sc.dids.dan
18
+ const createdAtMicroseconds = () => ({
19
+ createdAt: new Date().toISOString().replace('Z', '000Z'), // microseconds
20
+ })
21
+ const createdAtTimezone = () => ({
22
+ createdAt: new Date().toISOString().replace('Z', '+00:00'), // iso timezone format
23
+ })
24
+
25
+ await sc.follow(alice, bob)
26
+ await sc.follow(alice, carol)
27
+ await sc.follow(alice, dan)
28
+ await sc.follow(carol, alice)
29
+ await sc.follow(bob, alice)
30
+ await sc.follow(bob, carol, createdAtMicroseconds())
31
+ await sc.follow(dan, bob, createdAtTimezone())
32
+ await sc.post(alice, posts.alice[0], undefined, undefined, undefined, {
33
+ labels: {
34
+ $type: 'com.atproto.label.defs#selfLabels',
35
+ values: [{ val: 'self-label' }],
36
+ },
37
+ })
38
+ await sc.post(bob, posts.bob[0], undefined, undefined, undefined, {
39
+ langs: ['en-US', 'i-klingon'],
40
+ })
41
+ const img1 = await sc.uploadFile(
42
+ carol,
43
+ '../dev-env/assets/key-landscape-small.jpg',
44
+ 'image/jpeg',
45
+ )
46
+ const img2 = await sc.uploadFile(
47
+ carol,
48
+ '../dev-env/assets/key-alt.jpg',
49
+ 'image/jpeg',
50
+ )
51
+ await sc.post(
52
+ carol,
53
+ posts.carol[0],
54
+ undefined,
55
+ [img1, img2], // Contains both images and a quote
56
+ sc.posts[bob][0].ref,
57
+ )
58
+ await sc.post(dan, posts.dan[0])
59
+ await sc.post(
60
+ dan,
61
+ posts.dan[1],
62
+ [
63
+ {
64
+ index: { byteStart: 0, byteEnd: 18 },
65
+ features: [
66
+ {
67
+ $type: `app.bsky.richtext.facet#mention`,
68
+ did: alice,
69
+ },
70
+ ],
71
+ },
72
+ ],
73
+ undefined,
74
+ sc.posts[carol][0].ref, // This post contains an images embed
75
+ )
76
+ await sc.post(
77
+ alice,
78
+ posts.alice[1],
79
+ undefined,
80
+ undefined,
81
+ undefined,
82
+ createdAtMicroseconds(),
83
+ )
84
+ await sc.post(
85
+ bob,
86
+ posts.bob[1],
87
+ undefined,
88
+ undefined,
89
+ undefined,
90
+ createdAtTimezone(),
91
+ )
92
+ await sc.post(
93
+ alice,
94
+ posts.alice[2],
95
+ undefined,
96
+ undefined,
97
+ sc.posts[dan][1].ref, // This post contains a record embed which contains an images embed
98
+ )
99
+ await sc.like(bob, sc.posts[alice][1].ref)
100
+ await sc.like(bob, sc.posts[alice][2].ref)
101
+ await sc.like(carol, sc.posts[alice][1].ref)
102
+ await sc.like(carol, sc.posts[alice][2].ref)
103
+ await sc.like(dan, sc.posts[alice][1].ref)
104
+ await sc.like(alice, sc.posts[carol][0].ref, createdAtMicroseconds())
105
+ await sc.like(bob, sc.posts[carol][0].ref, createdAtTimezone())
106
+
107
+ const replyImg = await sc.uploadFile(
108
+ bob,
109
+ '../dev-env/assets/key-landscape-small.jpg',
110
+ 'image/jpeg',
111
+ )
112
+ // must ensure ordering of replies in indexing
113
+ await sc.network.processAll()
114
+ await sc.reply(
115
+ bob,
116
+ sc.posts[alice][1].ref,
117
+ sc.posts[alice][1].ref,
118
+ replies.bob[0],
119
+ undefined,
120
+ [replyImg],
121
+ )
122
+ await sc.reply(
123
+ carol,
124
+ sc.posts[alice][1].ref,
125
+ sc.posts[alice][1].ref,
126
+ replies.carol[0],
127
+ )
128
+ await sc.network.processAll()
129
+ const alicesReplyToBob = await sc.reply(
130
+ alice,
131
+ sc.posts[alice][1].ref,
132
+ sc.replies[bob][0].ref,
133
+ replies.alice[0],
134
+ )
135
+ await sc.repost(carol, sc.posts[dan][1].ref)
136
+ await sc.repost(dan, sc.posts[alice][1].ref)
137
+ await sc.repost(dan, alicesReplyToBob.ref)
138
+
139
+ if (sc.network instanceof TestNetwork) {
140
+ const bsky = sc.network.bsky
141
+ await createLabel(bsky, {
142
+ val: 'test-label',
143
+ uri: sc.posts[alice][2].ref.uriStr,
144
+ cid: sc.posts[alice][2].ref.cidStr,
145
+ })
146
+ await createLabel(bsky, {
147
+ val: 'test-label',
148
+ uri: sc.replies[bob][0].ref.uriStr,
149
+ cid: sc.replies[bob][0].ref.cidStr,
150
+ })
151
+ await createLabel(bsky, {
152
+ val: 'test-label-2',
153
+ uri: sc.replies[bob][0].ref.uriStr,
154
+ cid: sc.replies[bob][0].ref.cidStr,
155
+ })
156
+ }
157
+
158
+ return sc
159
+ }
160
+
161
+ export const posts = {
162
+ alice: ['hey there', 'again', 'yoohoo label_me'],
163
+ bob: ['bob back at it again!', 'bobby boy here', 'yoohoo'],
164
+ carol: ['hi im carol'],
165
+ dan: ['dan here!', '@alice.bluesky.xyz is the best'],
166
+ }
167
+
168
+ export const replies = {
169
+ alice: ['thanks bob'],
170
+ bob: ['hear that label_me label_me_2'],
171
+ carol: ['of course'],
172
+ }
173
+
174
+ const createLabel = async (
175
+ bsky: TestBsky,
176
+ opts: { uri: string; cid: string; val: string },
177
+ ) => {
178
+ await bsky.db.db
179
+ .insertInto('label')
180
+ .values({
181
+ uri: opts.uri,
182
+ cid: opts.cid,
183
+ val: opts.val,
184
+ cts: new Date().toISOString(),
185
+ neg: false,
186
+ src: EXAMPLE_LABELER, // this did is also configured on labelsFromIssuerDids
187
+ })
188
+ .execute()
189
+ }