@atproto/dev-env 0.3.212 → 0.3.214

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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @atproto/dev-env
2
2
 
3
+ ## 0.3.214
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4763](https://github.com/bluesky-social/atproto/pull/4763) [`c89225f`](https://github.com/bluesky-social/atproto/commit/c89225f9724f281308e59b8f32fbe4e420fb4f8c) Thanks [@rafaeleyng](https://github.com/rafaeleyng)! - Create chat declarations for dev-env
8
+
9
+ - Updated dependencies [[`383e157`](https://github.com/bluesky-social/atproto/commit/383e157021564a6fb51baac584dd3e4f988f1d33), [`efb2b58`](https://github.com/bluesky-social/atproto/commit/efb2b58fb27a242d5308bf15916ee222daa2019b), [`7ed5704`](https://github.com/bluesky-social/atproto/commit/7ed57043c12aedb0faf6b7dc947adfcfff570b6d), [`eaee3d4`](https://github.com/bluesky-social/atproto/commit/eaee3d430554436964d45f38bbeb1132ae9b8862), [`9f9f71a`](https://github.com/bluesky-social/atproto/commit/9f9f71a6a3e58ccbd5e6d3ee079b570096cb11fa), [`67eb0c1`](https://github.com/bluesky-social/atproto/commit/67eb0c19ac415e762e221b2ccda9f0bcf7b3dd6f), [`ff42a3a`](https://github.com/bluesky-social/atproto/commit/ff42a3afc3a0d4146a6618a910fa612c7e878ea7), [`bc69b03`](https://github.com/bluesky-social/atproto/commit/bc69b03f53da3ec52bc3eed0738308f320386e75), [`139b294`](https://github.com/bluesky-social/atproto/commit/139b2941d640bafa1e7d3a56e0608dc42bb0006c)]:
10
+ - @atproto/bsky@0.0.220
11
+ - @atproto/pds@0.4.215
12
+ - @atproto/bsync@0.0.25
13
+ - @atproto/ozone@0.1.167
14
+ - @atproto/api@0.19.4
15
+ - @atproto/syntax@0.5.1
16
+ - @atproto/xrpc-server@0.10.16
17
+
18
+ ## 0.3.213
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`6634140`](https://github.com/bluesky-social/atproto/commit/66341400d49d1210619b000a040852d87085c32c), [`0e5df95`](https://github.com/bluesky-social/atproto/commit/0e5df95e3a8d81931524848d301cd43d1f12fb78)]:
23
+ - @atproto/ozone@0.1.166
24
+ - @atproto/bsky@0.0.219
25
+ - @atproto/api@0.19.2
26
+ - @atproto/pds@0.4.214
27
+
3
28
  ## 0.3.212
4
29
 
5
30
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mock/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,WAAW,EAAE,MAAM,UAAU,CAAA;AAmBlE,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,WAAW,iBA0hBvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mock/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,WAAW,EAAE,MAAM,UAAU,CAAA;AAkBlE,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,WAAW,iBAkiBvD"}
@@ -1,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
@@ -40,7 +7,6 @@ exports.generateMockSetup = generateMockSetup;
40
7
  const api_1 = require("@atproto/api");
41
8
  const syntax_1 = require("@atproto/syntax");
42
9
  const index_1 = require("../index");
43
- const seedThreadV2 = __importStar(require("../seed/thread-v2"));
44
10
  const data_1 = require("./data");
45
11
  const blur_hash_avatar_b64_1 = __importDefault(require("./img/blur-hash-avatar-b64"));
46
12
  const labeled_img_b64_1 = __importDefault(require("./img/labeled-img-b64"));
@@ -65,54 +31,72 @@ async function generateMockSetup(env) {
65
31
  }
66
32
  throw new Error('Not found');
67
33
  };
68
- const loggedOut = env.pds.getClient();
69
34
  const users = [
70
35
  {
71
36
  email: 'alice@test.com',
72
37
  handle: `alice.test`,
73
38
  password: 'hunter2',
39
+ displayName: 'Alice',
40
+ description: 'Test user 0',
74
41
  },
75
42
  {
76
43
  email: 'bob@test.com',
77
44
  handle: `bob.test`,
78
45
  password: 'hunter2',
46
+ displayName: 'Bob',
47
+ description: 'Test user 1',
79
48
  },
80
49
  {
81
50
  email: 'carla@test.com',
82
51
  handle: `carla.test`,
83
52
  password: 'hunter2',
53
+ displayName: 'Carla',
54
+ description: 'Test user 2',
55
+ },
56
+ {
57
+ email: 'triage@test.com',
58
+ handle: 'triage.test',
59
+ password: 'triage-pass',
60
+ },
61
+ {
62
+ email: 'mod@test.com',
63
+ handle: 'mod.test',
64
+ password: 'mod-pass',
65
+ },
66
+ {
67
+ email: 'admin-mod@test.com',
68
+ handle: 'admin-mod.test',
69
+ password: 'admin-mod-pass',
70
+ },
71
+ {
72
+ email: 'labeler@test.com',
73
+ handle: 'labeler.test',
74
+ password: 'hunter2',
75
+ displayName: 'Test Labeler',
76
+ description: 'Labeling things across the atmosphere',
84
77
  },
85
78
  ];
86
- const userAgents = await Promise.all(users.map(async (user, i) => {
79
+ const userAgents = await Promise.all(users.map(async (user) => {
87
80
  const client = env.pds.getClient();
88
81
  await client.createAccount(user);
89
82
  client.assertAuthenticated();
90
- await client.app.bsky.actor.profile.create({ repo: client.did }, {
91
- displayName: ucfirst(user.handle).slice(0, -5),
92
- description: `Test user ${i}`,
93
- });
83
+ if (user.displayName || user.description) {
84
+ await client.app.bsky.actor.profile.create({ repo: client.did }, {
85
+ displayName: user.displayName,
86
+ description: user.description,
87
+ });
88
+ }
94
89
  return client;
95
90
  }));
96
- const [alice, bob, carla] = userAgents;
97
- // Create moderator accounts
98
- const triageRes = await loggedOut.com.atproto.server.createAccount({
99
- email: 'triage@test.com',
100
- handle: 'triage.test',
101
- password: 'triage-pass',
102
- });
103
- await env.ozone.addTriageDid(triageRes.data.did);
104
- const modRes = await loggedOut.com.atproto.server.createAccount({
105
- email: 'mod@test.com',
106
- handle: 'mod.test',
107
- password: 'mod-pass',
108
- });
109
- await env.ozone.addModeratorDid(modRes.data.did);
110
- const adminRes = await loggedOut.com.atproto.server.createAccount({
111
- email: 'admin-mod@test.com',
112
- handle: 'admin-mod.test',
113
- password: 'admin-mod-pass',
114
- });
115
- await env.ozone.addAdminDid(adminRes.data.did);
91
+ const [alice, bob, carla, triage, mod, adminMod, labeler] = userAgents;
92
+ // Create chat declarations for all users
93
+ for (const user of userAgents) {
94
+ await user.chat.bsky.actor.declaration.create({ repo: user.did }, { allowIncoming: 'all' });
95
+ }
96
+ // Add moderator roles
97
+ await env.ozone.addTriageDid(triage.did);
98
+ await env.ozone.addModeratorDid(mod.did);
99
+ await env.ozone.addAdminDid(adminMod.did);
116
100
  // Report one user
117
101
  const reporter = picka(userAgents);
118
102
  await reporter.com.atproto.moderation.createReport({
@@ -128,8 +112,8 @@ async function generateMockSetup(env) {
128
112
  });
129
113
  // everybody follows everybody
130
114
  const follow = async (author, subject) => {
131
- await author.app.bsky.graph.follow.create({ repo: author.accountDid }, {
132
- subject: subject.accountDid,
115
+ await author.app.bsky.graph.follow.create({ repo: author.assertDid }, {
116
+ subject: subject.assertDid,
133
117
  createdAt: date.next().value,
134
118
  });
135
119
  };
@@ -176,7 +160,7 @@ async function generateMockSetup(env) {
176
160
  const uploadedImg = await bob.com.atproto.repo.uploadBlob(file, {
177
161
  encoding: 'image/png',
178
162
  });
179
- const labeledPost = await bob.app.bsky.feed.post.create({ repo: bob.accountDid }, {
163
+ const labeledPost = await bob.app.bsky.feed.post.create({ repo: bob.assertDid }, {
180
164
  text: 'naughty post',
181
165
  embed: {
182
166
  $type: 'app.bsky.embed.images',
@@ -189,7 +173,7 @@ async function generateMockSetup(env) {
189
173
  },
190
174
  createdAt: date.next().value,
191
175
  });
192
- const filteredPost = await bob.app.bsky.feed.post.create({ repo: bob.accountDid }, {
176
+ const filteredPost = await bob.app.bsky.feed.post.create({ repo: bob.assertDid }, {
193
177
  text: 'really bad post should be deleted',
194
178
  createdAt: date.next().value,
195
179
  });
@@ -233,7 +217,7 @@ async function generateMockSetup(env) {
233
217
  }
234
218
  }
235
219
  // a couple feed generators that returns some posts
236
- const fg1Uri = syntax_1.AtUri.make(alice.accountDid, 'app.bsky.feed.generator', 'alice-favs');
220
+ const fg1Uri = syntax_1.AtUri.make(alice.assertDid, 'app.bsky.feed.generator', 'alice-favs');
237
221
  const fg1 = await env.createFeedGen({
238
222
  [fg1Uri.toString()]: async () => {
239
223
  const feed = posts
@@ -251,14 +235,14 @@ async function generateMockSetup(env) {
251
235
  const avatarRes = await alice.com.atproto.repo.uploadBlob(avatarImg, {
252
236
  encoding: 'image/png',
253
237
  });
254
- const fgAliceRes = await alice.app.bsky.feed.generator.create({ repo: alice.accountDid, rkey: fg1Uri.rkey }, {
238
+ const fgAliceRes = await alice.app.bsky.feed.generator.create({ repo: alice.assertDid, rkey: fg1Uri.rkey }, {
255
239
  did: fg1.did,
256
240
  displayName: 'alices feed',
257
241
  description: 'all my fav stuff',
258
242
  avatar: avatarRes.data.blob,
259
243
  createdAt: date.next().value,
260
244
  });
261
- await alice.app.bsky.feed.post.create({ repo: alice.accountDid }, {
245
+ await alice.app.bsky.feed.post.create({ repo: alice.assertDid }, {
262
246
  text: 'check out my algorithm!',
263
247
  embed: {
264
248
  $type: 'app.bsky.embed.record',
@@ -272,7 +256,7 @@ async function generateMockSetup(env) {
272
256
  createdAt: date.next().value,
273
257
  });
274
258
  }
275
- const fg2Uri = syntax_1.AtUri.make(bob.accountDid, 'app.bsky.feed.generator', 'bob-redux');
259
+ const fg2Uri = syntax_1.AtUri.make(bob.assertDid, 'app.bsky.feed.generator', 'bob-redux');
276
260
  const fg2 = await env.createFeedGen({
277
261
  [fg2Uri.toString()]: async () => {
278
262
  const feed = posts
@@ -286,12 +270,12 @@ async function generateMockSetup(env) {
286
270
  };
287
271
  },
288
272
  });
289
- const fgBobRes = await bob.app.bsky.feed.generator.create({ repo: bob.accountDid, rkey: fg2Uri.rkey }, {
273
+ const fgBobRes = await bob.app.bsky.feed.generator.create({ repo: bob.assertDid, rkey: fg2Uri.rkey }, {
290
274
  did: fg2.did,
291
275
  displayName: 'Bobby boy hot new algo',
292
276
  createdAt: date.next().value,
293
277
  });
294
- await alice.app.bsky.feed.post.create({ repo: alice.accountDid }, {
278
+ await alice.app.bsky.feed.post.create({ repo: alice.assertDid }, {
295
279
  text: `bobs feed is neat too`,
296
280
  embed: {
297
281
  $type: 'app.bsky.embed.record',
@@ -299,7 +283,7 @@ async function generateMockSetup(env) {
299
283
  },
300
284
  createdAt: date.next().value,
301
285
  });
302
- const fg3Uri = syntax_1.AtUri.make(carla.accountDid, 'app.bsky.feed.generator', 'carla-intr-algo');
286
+ const fg3Uri = syntax_1.AtUri.make(carla.assertDid, 'app.bsky.feed.generator', 'carla-intr-algo');
303
287
  const fg3 = await env.createFeedGen({
304
288
  [fg3Uri.toString()]: async () => {
305
289
  const feed = posts
@@ -313,13 +297,13 @@ async function generateMockSetup(env) {
313
297
  };
314
298
  },
315
299
  });
316
- const fgCarlaRes = await carla.app.bsky.feed.generator.create({ repo: carla.accountDid, rkey: fg3Uri.rkey }, {
300
+ const fgCarlaRes = await carla.app.bsky.feed.generator.create({ repo: carla.assertDid, rkey: fg3Uri.rkey }, {
317
301
  did: fg3.did,
318
302
  displayName: `Acceptin' Generator`,
319
303
  acceptsInteractions: true,
320
304
  createdAt: date.next().value,
321
305
  });
322
- await alice.app.bsky.feed.post.create({ repo: alice.accountDid }, {
306
+ await alice.app.bsky.feed.post.create({ repo: alice.assertDid }, {
323
307
  text: `carla accepts interactions on her feed`,
324
308
  embed: {
325
309
  $type: 'app.bsky.embed.record',
@@ -327,19 +311,9 @@ async function generateMockSetup(env) {
327
311
  },
328
312
  createdAt: date.next().value,
329
313
  });
330
- // create a labeler account
314
+ // create labeler service
331
315
  {
332
- const labeler = env.pds.getClient();
333
- const res = await labeler.createAccount({
334
- email: 'labeler@test.com',
335
- handle: 'labeler.test',
336
- password: 'hunter2',
337
- });
338
- await labeler.app.bsky.actor.profile.create({ repo: res.data.did }, {
339
- displayName: 'Test Labeler',
340
- description: `Labeling things across the atmosphere`,
341
- });
342
- await labeler.app.bsky.labeler.service.create({ repo: res.data.did, rkey: 'self' }, {
316
+ await labeler.app.bsky.labeler.service.create({ repo: labeler.did, rkey: 'self' }, {
343
317
  policies: {
344
318
  labelValues: [
345
319
  '!hide',
@@ -423,75 +397,73 @@ async function generateMockSetup(env) {
423
397
  createdAt: date.next().value,
424
398
  });
425
399
  await createLabel(env.bsky.db, {
426
- uri: alice.accountDid,
400
+ uri: alice.assertDid,
427
401
  cid: '',
428
402
  val: 'rude',
429
- src: res.data.did,
403
+ src: labeler.did,
430
404
  });
431
405
  await createLabel(env.bsky.db, {
432
- uri: `at://${alice.accountDid}/app.bsky.feed.generator/alice-favs`,
406
+ uri: `at://${alice.assertDid}/app.bsky.feed.generator/alice-favs`,
433
407
  cid: '',
434
408
  val: 'cool',
435
- src: res.data.did,
409
+ src: labeler.did,
436
410
  });
437
411
  await createLabel(env.bsky.db, {
438
- uri: bob.accountDid,
412
+ uri: bob.assertDid,
439
413
  cid: '',
440
414
  val: 'cool',
441
- src: res.data.did,
415
+ src: labeler.did,
442
416
  });
443
417
  await createLabel(env.bsky.db, {
444
- uri: carla.accountDid,
418
+ uri: carla.assertDid,
445
419
  cid: '',
446
420
  val: 'spam',
447
- src: res.data.did,
421
+ src: labeler.did,
448
422
  });
449
423
  }
450
424
  // Create lists and add people to the lists
451
425
  {
452
- const flowerLovers = await alice.app.bsky.graph.list.create({ repo: alice.accountDid }, {
426
+ const flowerLovers = await alice.app.bsky.graph.list.create({ repo: alice.assertDid }, {
453
427
  name: 'Flower Lovers',
454
428
  purpose: 'app.bsky.graph.defs#curatelist',
455
429
  createdAt: new Date().toISOString(),
456
430
  description: 'A list of posts about flowers',
457
431
  });
458
- const labelHaters = await bob.app.bsky.graph.list.create({ repo: bob.accountDid }, {
432
+ const labelHaters = await bob.app.bsky.graph.list.create({ repo: bob.assertDid }, {
459
433
  name: 'Label Haters',
460
434
  purpose: 'app.bsky.graph.defs#modlist',
461
435
  createdAt: new Date().toISOString(),
462
436
  description: 'A list of people who hate labels',
463
437
  });
464
- await alice.app.bsky.graph.listitem.create({ repo: alice.accountDid }, {
465
- subject: bob.accountDid,
438
+ await alice.app.bsky.graph.listitem.create({ repo: alice.assertDid }, {
439
+ subject: bob.assertDid,
466
440
  createdAt: new Date().toISOString(),
467
441
  list: new index_1.RecordRef(flowerLovers.uri, flowerLovers.cid).uriStr,
468
442
  });
469
- await bob.app.bsky.graph.listitem.create({ repo: bob.accountDid }, {
470
- subject: alice.accountDid,
443
+ await bob.app.bsky.graph.listitem.create({ repo: bob.assertDid }, {
444
+ subject: alice.assertDid,
471
445
  createdAt: new Date().toISOString(),
472
446
  list: new index_1.RecordRef(labelHaters.uri, labelHaters.cid).uriStr,
473
447
  });
474
448
  }
475
- await setVerifier(env.bsky.db, alice.accountDid);
476
- // @TODO the following should be optimized as it makes dev-env start very slow (>10 sec)
477
- const sc = env.getSeedClient();
478
- await seedThreadV2.simple(sc);
479
- await seedThreadV2.long(sc);
480
- await seedThreadV2.deep(sc);
481
- await seedThreadV2.branchingFactor(sc);
482
- await seedThreadV2.annotateMoreReplies(sc);
483
- await seedThreadV2.annotateOP(sc);
484
- await seedThreadV2.sort(sc);
485
- await seedThreadV2.bumpOpAndViewer(sc);
486
- await seedThreadV2.bumpGroupSorting(sc);
487
- await seedThreadV2.bumpFollows(sc);
488
- await seedThreadV2.blockDeletionAuth(sc, env.bsky.ctx.cfg.modServiceDid);
489
- await seedThreadV2.mutes(sc);
490
- await seedThreadV2.threadgated(sc);
491
- await seedThreadV2.tags(sc);
492
- }
493
- function ucfirst(str) {
494
- return str.at(0)?.toUpperCase() + str.slice(1);
449
+ await setVerifier(env.bsky.db, alice.assertDid);
450
+ // @TODO These are useful when testing complex threads, but don't need to be enabled all the time. We could make it configurable.
451
+ // import * as seedThreadV2 from '../seed/thread-v2'
452
+ // const sc = env.getSeedClient()
453
+ // await seedThreadV2.simple(sc)
454
+ // await seedThreadV2.long(sc)
455
+ // await seedThreadV2.deep(sc)
456
+ // await seedThreadV2.branchingFactor(sc)
457
+ // await seedThreadV2.annotateMoreReplies(sc)
458
+ // await seedThreadV2.annotateOP(sc)
459
+ // await seedThreadV2.sort(sc)
460
+ // await seedThreadV2.bumpOpAndViewer(sc)
461
+ // await seedThreadV2.bumpGroupSorting(sc)
462
+ // await seedThreadV2.bumpFollows(sc)
463
+ // await seedThreadV2.blockDeletionAuth(sc, env.bsky.ctx.cfg.modServiceDid)
464
+ // await seedThreadV2.mutes(sc)
465
+ // await seedThreadV2.threadgated(sc)
466
+ // await seedThreadV2.tags(sc)
495
467
  }
496
468
  const createLabel = async (db, opts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AY,CAAC,iBAAiB,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACxE,MAAM,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC5B,MAAM,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;IAClC,MAAM,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC7B,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAChD,CAAC;AAED,MAAM,WAAW,GAAG,KAAK,EACvB,EAAY,EACZ,IAA6D,EAC7D,EAAE;IACF,MAAM,EAAE,CAAC,EAAE;SACR,UAAU,CAAC,OAAO,CAAC;SACnB,MAAM,CAAC;QACN,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC7B,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,uBAAe;KACjC,CAAC;SACD,OAAO,EAAE,CAAA;AACd,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,KAAK,EAAE,EAAY,EAAE,GAAW,EAAE,EAAE;IACtD,MAAM,EAAE,CAAC,EAAE;SACR,WAAW,CAAC,OAAO,CAAC;SACpB,GAAG,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;SAC9B,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;SACtB,OAAO,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { AtpAgent, COM_ATPROTO_MODERATION } from '@atproto/api'\nimport { Database } from '@atproto/bsky'\nimport { AtUri } from '@atproto/syntax'\nimport { EXAMPLE_LABELER, RecordRef, TestNetwork } from '../index'\nimport * as seedThreadV2 from '../seed/thread-v2'\nimport { postTexts, replyTexts } from './data'\nimport blurHashB64 from './img/blur-hash-avatar-b64'\nimport labeledImgB64 from './img/labeled-img-b64'\n\n// NOTE\n// deterministic date generator\n// we use this to ensure the mock dataset is always the same\n// which is very useful when testing\n// (not everything is currently deterministic but it could be)\nfunction* dateGen(): Generator<string, never> {\n let start = 1657846031914\n while (true) {\n yield new Date(start).toISOString()\n start += 1e3\n }\n}\n\nexport async function generateMockSetup(env: TestNetwork) {\n const date = dateGen()\n\n const rand = (n: number) => Math.floor(Math.random() * n)\n const picka = <T>(arr: Array<T>): T => {\n if (arr.length) {\n return arr[rand(arr.length)] || arr[0]\n }\n throw new Error('Not found')\n }\n\n const loggedOut = env.pds.getClient()\n\n const users = [\n {\n email: 'alice@test.com',\n handle: `alice.test`,\n password: 'hunter2',\n },\n {\n email: 'bob@test.com',\n handle: `bob.test`,\n password: 'hunter2',\n },\n {\n email: 'carla@test.com',\n handle: `carla.test`,\n password: 'hunter2',\n },\n ]\n\n const userAgents = await Promise.all(\n users.map(async (user, i) => {\n const client: AtpAgent = env.pds.getClient()\n await client.createAccount(user)\n client.assertAuthenticated()\n await client.app.bsky.actor.profile.create(\n { repo: client.did },\n {\n displayName: ucfirst(user.handle).slice(0, -5),\n description: `Test user ${i}`,\n },\n )\n return client\n }),\n )\n\n const [alice, bob, carla] = userAgents\n\n // Create moderator accounts\n const triageRes = await loggedOut.com.atproto.server.createAccount({\n email: 'triage@test.com',\n handle: 'triage.test',\n password: 'triage-pass',\n })\n await env.ozone.addTriageDid(triageRes.data.did)\n const modRes = await loggedOut.com.atproto.server.createAccount({\n email: 'mod@test.com',\n handle: 'mod.test',\n password: 'mod-pass',\n })\n await env.ozone.addModeratorDid(modRes.data.did)\n const adminRes = await loggedOut.com.atproto.server.createAccount({\n email: 'admin-mod@test.com',\n handle: 'admin-mod.test',\n password: 'admin-mod-pass',\n })\n await env.ozone.addAdminDid(adminRes.data.did)\n\n // Report one user\n const reporter = picka(userAgents)\n await reporter.com.atproto.moderation.createReport({\n reasonType: picka([\n COM_ATPROTO_MODERATION.DefsReasonSpam,\n COM_ATPROTO_MODERATION.DefsReasonOther,\n ]),\n reason: picka([\"Didn't look right to me\", undefined, undefined]),\n subject: {\n $type: 'com.atproto.admin.defs#repoRef',\n did: picka(userAgents).did,\n },\n })\n\n // everybody follows everybody\n const follow = async (author: AtpAgent, subject: AtpAgent) => {\n await author.app.bsky.graph.follow.create(\n { repo: author.accountDid },\n {\n subject: subject.accountDid,\n createdAt: date.next().value,\n },\n )\n }\n await follow(alice, bob)\n await follow(alice, carla)\n await follow(bob, alice)\n await follow(bob, carla)\n await follow(carla, alice)\n await follow(carla, bob)\n\n // a set of posts and reposts\n const posts: { uri: string; cid: string }[] = []\n for (let i = 0; i < postTexts.length; i++) {\n const author = picka(userAgents)\n const post = await author.app.bsky.feed.post.create(\n { repo: author.did },\n {\n text: postTexts[i],\n createdAt: date.next().value,\n },\n )\n posts.push(post)\n if (rand(10) === 0) {\n const reposter = picka(userAgents)\n await reposter.app.bsky.feed.repost.create(\n { repo: reposter.did },\n {\n subject: picka(posts),\n createdAt: date.next().value,\n },\n )\n }\n if (rand(6) === 0) {\n const reporter = picka(userAgents)\n await reporter.com.atproto.moderation.createReport({\n reasonType: picka([\n COM_ATPROTO_MODERATION.DefsReasonSpam,\n COM_ATPROTO_MODERATION.DefsReasonOther,\n ]),\n reason: picka([\"Didn't look right to me\", undefined, undefined]),\n subject: {\n $type: 'com.atproto.repo.strongRef',\n uri: post.uri,\n cid: post.cid,\n },\n })\n }\n }\n\n // make some naughty posts & label them\n const file = Buffer.from(labeledImgB64, 'base64')\n const uploadedImg = await bob.com.atproto.repo.uploadBlob(file, {\n encoding: 'image/png',\n })\n const labeledPost = await bob.app.bsky.feed.post.create(\n { repo: bob.accountDid },\n {\n text: 'naughty post',\n embed: {\n $type: 'app.bsky.embed.images',\n images: [\n {\n image: uploadedImg.data.blob,\n alt: 'naughty naughty',\n },\n ],\n },\n createdAt: date.next().value,\n },\n )\n\n const filteredPost = await bob.app.bsky.feed.post.create(\n { repo: bob.accountDid },\n {\n text: 'really bad post should be deleted',\n createdAt: date.next().value,\n },\n )\n\n await createLabel(env.bsky.db, {\n uri: labeledPost.uri,\n cid: labeledPost.cid,\n val: 'nudity',\n })\n await createLabel(env.bsky.db, {\n uri: filteredPost.uri,\n cid: filteredPost.cid,\n val: 'dmca-violation',\n })\n\n // a set of replies\n for (let i = 0; i < 100; i++) {\n const targetUri = picka(posts).uri\n const urip = new AtUri(targetUri)\n const target = await alice.app.bsky.feed.post.get({\n repo: urip.host,\n rkey: urip.rkey,\n })\n const author = picka(userAgents)\n posts.push(\n await author.app.bsky.feed.post.create(\n { repo: author.did },\n {\n text: picka(replyTexts),\n reply: {\n root: target.value.reply ? target.value.reply.root : target,\n parent: target,\n },\n createdAt: date.next().value,\n },\n ),\n )\n }\n\n // a set of likes\n for (const post of posts) {\n for (const user of userAgents) {\n if (rand(3) === 0) {\n await user.app.bsky.feed.like.create(\n { repo: user.did },\n {\n subject: post,\n createdAt: date.next().value,\n },\n )\n }\n }\n }\n\n // a couple feed generators that returns some posts\n const fg1Uri = AtUri.make(\n alice.accountDid,\n 'app.bsky.feed.generator',\n 'alice-favs',\n )\n const fg1 = await env.createFeedGen({\n [fg1Uri.toString()]: async () => {\n const feed = posts\n .filter(() => rand(2) === 0)\n .map((post) => ({ post: post.uri }))\n return {\n encoding: 'application/json',\n body: {\n feed,\n },\n }\n },\n })\n const avatarImg = Buffer.from(blurHashB64, 'base64')\n const avatarRes = await alice.com.atproto.repo.uploadBlob(avatarImg, {\n encoding: 'image/png',\n })\n const fgAliceRes = await alice.app.bsky.feed.generator.create(\n { repo: alice.accountDid, rkey: fg1Uri.rkey },\n {\n did: fg1.did,\n displayName: 'alices feed',\n description: 'all my fav stuff',\n avatar: avatarRes.data.blob,\n createdAt: date.next().value,\n },\n )\n\n await alice.app.bsky.feed.post.create(\n { repo: alice.accountDid },\n {\n text: 'check out my algorithm!',\n embed: {\n $type: 'app.bsky.embed.record',\n record: fgAliceRes,\n },\n createdAt: date.next().value,\n },\n )\n for (const user of [alice, bob, carla]) {\n await user.app.bsky.feed.like.create(\n { repo: user.did },\n {\n subject: fgAliceRes,\n createdAt: date.next().value,\n },\n )\n }\n\n const fg2Uri = AtUri.make(\n bob.accountDid,\n 'app.bsky.feed.generator',\n 'bob-redux',\n )\n const fg2 = await env.createFeedGen({\n [fg2Uri.toString()]: async () => {\n const feed = posts\n .filter(() => rand(2) === 0)\n .map((post) => ({ post: post.uri }))\n return {\n encoding: 'application/json',\n body: {\n feed,\n },\n }\n },\n })\n const fgBobRes = await bob.app.bsky.feed.generator.create(\n { repo: bob.accountDid, rkey: fg2Uri.rkey },\n {\n did: fg2.did,\n displayName: 'Bobby boy hot new algo',\n createdAt: date.next().value,\n },\n )\n\n await alice.app.bsky.feed.post.create(\n { repo: alice.accountDid },\n {\n text: `bobs feed is neat too`,\n embed: {\n $type: 'app.bsky.embed.record',\n record: fgBobRes,\n },\n createdAt: date.next().value,\n },\n )\n\n const fg3Uri = AtUri.make(\n carla.accountDid,\n 'app.bsky.feed.generator',\n 'carla-intr-algo',\n )\n const fg3 = await env.createFeedGen({\n [fg3Uri.toString()]: async () => {\n const feed = posts\n .filter(() => rand(2) === 0)\n .map((post) => ({ post: post.uri }))\n return {\n encoding: 'application/json',\n body: {\n feed,\n },\n }\n },\n })\n const fgCarlaRes = await carla.app.bsky.feed.generator.create(\n { repo: carla.accountDid, rkey: fg3Uri.rkey },\n {\n did: fg3.did,\n displayName: `Acceptin' Generator`,\n acceptsInteractions: true,\n createdAt: date.next().value,\n },\n )\n\n await alice.app.bsky.feed.post.create(\n { repo: alice.accountDid },\n {\n text: `carla accepts interactions on her feed`,\n embed: {\n $type: 'app.bsky.embed.record',\n record: fgCarlaRes,\n },\n createdAt: date.next().value,\n },\n )\n\n // create a labeler account\n {\n const labeler = env.pds.getClient()\n const res = await labeler.createAccount({\n email: 'labeler@test.com',\n handle: 'labeler.test',\n password: 'hunter2',\n })\n await labeler.app.bsky.actor.profile.create(\n { repo: res.data.did },\n {\n displayName: 'Test Labeler',\n description: `Labeling things across the atmosphere`,\n },\n )\n\n await labeler.app.bsky.labeler.service.create(\n { repo: res.data.did, rkey: 'self' },\n {\n policies: {\n labelValues: [\n '!hide',\n 'porn',\n 'rude',\n 'spam',\n 'spider',\n 'misinfo',\n 'cool',\n 'curate',\n ],\n labelValueDefinitions: [\n {\n identifier: 'rude',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: true,\n locales: [\n {\n lang: 'en',\n name: 'Rude',\n description: 'Just such a jerk, you wouldnt believe it.',\n },\n ],\n },\n {\n identifier: 'spam',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'hide',\n locales: [\n {\n lang: 'en',\n name: 'Spam',\n description:\n 'Low quality posts that dont add to the conversation.',\n },\n ],\n },\n {\n identifier: 'spider',\n blurs: 'media',\n severity: 'alert',\n defaultSetting: 'warn',\n locales: [\n {\n lang: 'en',\n name: 'Spider!',\n description: 'Oh no its a spider.',\n },\n ],\n },\n {\n identifier: 'cool',\n blurs: 'none',\n severity: 'inform',\n defaultSetting: 'warn',\n locales: [\n {\n lang: 'en',\n name: 'Cool',\n description: 'The coolest peeps in the atmosphere.',\n },\n ],\n },\n {\n identifier: 'curate',\n blurs: 'none',\n severity: 'none',\n defaultSetting: 'warn',\n locales: [\n {\n lang: 'en',\n name: 'Curation filter',\n description: 'We just dont want to see it as much.',\n },\n ],\n },\n ],\n },\n createdAt: date.next().value,\n },\n )\n await createLabel(env.bsky.db, {\n uri: alice.accountDid,\n cid: '',\n val: 'rude',\n src: res.data.did,\n })\n await createLabel(env.bsky.db, {\n uri: `at://${alice.accountDid}/app.bsky.feed.generator/alice-favs`,\n cid: '',\n val: 'cool',\n src: res.data.did,\n })\n await createLabel(env.bsky.db, {\n uri: bob.accountDid,\n cid: '',\n val: 'cool',\n src: res.data.did,\n })\n await createLabel(env.bsky.db, {\n uri: carla.accountDid,\n cid: '',\n val: 'spam',\n src: res.data.did,\n })\n }\n\n // Create lists and add people to the lists\n {\n const flowerLovers = await alice.app.bsky.graph.list.create(\n { repo: alice.accountDid },\n {\n name: 'Flower Lovers',\n purpose: 'app.bsky.graph.defs#curatelist',\n createdAt: new Date().toISOString(),\n description: 'A list of posts about flowers',\n },\n )\n const labelHaters = await bob.app.bsky.graph.list.create(\n { repo: bob.accountDid },\n {\n name: 'Label Haters',\n purpose: 'app.bsky.graph.defs#modlist',\n createdAt: new Date().toISOString(),\n description: 'A list of people who hate labels',\n },\n )\n await alice.app.bsky.graph.listitem.create(\n { repo: alice.accountDid },\n {\n subject: bob.accountDid,\n createdAt: new Date().toISOString(),\n list: new RecordRef(flowerLovers.uri, flowerLovers.cid).uriStr,\n },\n )\n await bob.app.bsky.graph.listitem.create(\n { repo: bob.accountDid },\n {\n subject: alice.accountDid,\n createdAt: new Date().toISOString(),\n list: new RecordRef(labelHaters.uri, labelHaters.cid).uriStr,\n },\n )\n }\n\n await setVerifier(env.bsky.db, alice.accountDid)\n\n // @TODO the following should be optimized as it makes dev-env start very slow (>10 sec)\n const sc = env.getSeedClient()\n await seedThreadV2.simple(sc)\n await seedThreadV2.long(sc)\n await seedThreadV2.deep(sc)\n await seedThreadV2.branchingFactor(sc)\n await seedThreadV2.annotateMoreReplies(sc)\n await seedThreadV2.annotateOP(sc)\n await seedThreadV2.sort(sc)\n await seedThreadV2.bumpOpAndViewer(sc)\n await seedThreadV2.bumpGroupSorting(sc)\n await seedThreadV2.bumpFollows(sc)\n await seedThreadV2.blockDeletionAuth(sc, env.bsky.ctx.cfg.modServiceDid)\n await seedThreadV2.mutes(sc)\n await seedThreadV2.threadgated(sc)\n await seedThreadV2.tags(sc)\n}\n\nfunction ucfirst(str: string): string {\n return str.at(0)?.toUpperCase() + str.slice(1)\n}\n\nconst createLabel = async (\n db: Database,\n opts: { uri: string; cid: string; val: string; src?: string },\n) => {\n await db.db\n .insertInto('label')\n .values({\n uri: opts.uri,\n cid: opts.cid,\n val: opts.val,\n cts: new Date().toISOString(),\n neg: false,\n src: opts.src ?? EXAMPLE_LABELER,\n })\n .execute()\n}\n\nconst setVerifier = async (db: Database, did: string) => {\n await db.db\n .updateTable('actor')\n .set({ trustedVerifier: true })\n .where('did', '=', did)\n .execute()\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mock/index.ts"],"names":[],"mappings":";;;;;AAqBA,8CAkiBC;AAvjBD,sCAA+D;AAE/D,4CAAuC;AACvC,oCAAkE;AAClE,iCAA8C;AAC9C,sFAAoD;AACpD,4EAAiD;AAEjD,OAAO;AACP,+BAA+B;AAC/B,4DAA4D;AAC5D,oCAAoC;AACpC,8DAA8D;AAC9D,QAAQ,CAAC,CAAC,OAAO;IACf,IAAI,KAAK,GAAG,aAAa,CAAA;IACzB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;QACnC,KAAK,IAAI,GAAG,CAAA;IACd,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,GAAgB;IACtD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IAEtB,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;IACzD,MAAM,KAAK,GAAG,CAAI,GAAa,EAAK,EAAE;QACpC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;QACxC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAA;IAC9B,CAAC,CAAA;IAED,MAAM,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AE;IACtD,MAAM,EAAE,CAAC,EAAE;SACR,WAAW,CAAC,OAAO,CAAC;SACpB,GAAG,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;SAC9B,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;SACtB,OAAO,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { AtpAgent, COM_ATPROTO_MODERATION } from '@atproto/api'\nimport { Database } from '@atproto/bsky'\nimport { AtUri } from '@atproto/syntax'\nimport { EXAMPLE_LABELER, RecordRef, TestNetwork } from '../index'\nimport { postTexts, replyTexts } from './data'\nimport blurHashB64 from './img/blur-hash-avatar-b64'\nimport labeledImgB64 from './img/labeled-img-b64'\n\n// NOTE\n// deterministic date generator\n// we use this to ensure the mock dataset is always the same\n// which is very useful when testing\n// (not everything is currently deterministic but it could be)\nfunction* dateGen(): Generator<string, never> {\n let start = 1657846031914\n while (true) {\n yield new Date(start).toISOString()\n start += 1e3\n }\n}\n\nexport async function generateMockSetup(env: TestNetwork) {\n const date = dateGen()\n\n const rand = (n: number) => Math.floor(Math.random() * n)\n const picka = <T>(arr: Array<T>): T => {\n if (arr.length) {\n return arr[rand(arr.length)] || arr[0]\n }\n throw new Error('Not found')\n }\n\n const users = [\n {\n email: 'alice@test.com',\n handle: `alice.test`,\n password: 'hunter2',\n displayName: 'Alice',\n description: 'Test user 0',\n },\n {\n email: 'bob@test.com',\n handle: `bob.test`,\n password: 'hunter2',\n displayName: 'Bob',\n description: 'Test user 1',\n },\n {\n email: 'carla@test.com',\n handle: `carla.test`,\n password: 'hunter2',\n displayName: 'Carla',\n description: 'Test user 2',\n },\n {\n email: 'triage@test.com',\n handle: 'triage.test',\n password: 'triage-pass',\n },\n {\n email: 'mod@test.com',\n handle: 'mod.test',\n password: 'mod-pass',\n },\n {\n email: 'admin-mod@test.com',\n handle: 'admin-mod.test',\n password: 'admin-mod-pass',\n },\n {\n email: 'labeler@test.com',\n handle: 'labeler.test',\n password: 'hunter2',\n displayName: 'Test Labeler',\n description: 'Labeling things across the atmosphere',\n },\n ]\n\n const userAgents = await Promise.all(\n users.map(async (user) => {\n const client: AtpAgent = env.pds.getClient()\n await client.createAccount(user)\n client.assertAuthenticated()\n if (user.displayName || user.description) {\n await client.app.bsky.actor.profile.create(\n { repo: client.did },\n {\n displayName: user.displayName,\n description: user.description,\n },\n )\n }\n return client\n }),\n )\n\n const [alice, bob, carla, triage, mod, adminMod, labeler] = userAgents\n\n // Create chat declarations for all users\n for (const user of userAgents) {\n await user.chat.bsky.actor.declaration.create(\n { repo: user.did },\n { allowIncoming: 'all' },\n )\n }\n\n // Add moderator roles\n await env.ozone.addTriageDid(triage.did)\n await env.ozone.addModeratorDid(mod.did)\n await env.ozone.addAdminDid(adminMod.did)\n\n // Report one user\n const reporter = picka(userAgents)\n await reporter.com.atproto.moderation.createReport({\n reasonType: picka([\n COM_ATPROTO_MODERATION.DefsReasonSpam,\n COM_ATPROTO_MODERATION.DefsReasonOther,\n ]),\n reason: picka([\"Didn't look right to me\", undefined, undefined]),\n subject: {\n $type: 'com.atproto.admin.defs#repoRef',\n did: picka(userAgents).did,\n },\n })\n\n // everybody follows everybody\n const follow = async (author: AtpAgent, subject: AtpAgent) => {\n await author.app.bsky.graph.follow.create(\n { repo: author.assertDid },\n {\n subject: subject.assertDid,\n createdAt: date.next().value,\n },\n )\n }\n await follow(alice, bob)\n await follow(alice, carla)\n await follow(bob, alice)\n await follow(bob, carla)\n await follow(carla, alice)\n await follow(carla, bob)\n\n // a set of posts and reposts\n const posts: { uri: string; cid: string }[] = []\n for (let i = 0; i < postTexts.length; i++) {\n const author = picka(userAgents)\n const post = await author.app.bsky.feed.post.create(\n { repo: author.did },\n {\n text: postTexts[i],\n createdAt: date.next().value,\n },\n )\n posts.push(post)\n if (rand(10) === 0) {\n const reposter = picka(userAgents)\n await reposter.app.bsky.feed.repost.create(\n { repo: reposter.did },\n {\n subject: picka(posts),\n createdAt: date.next().value,\n },\n )\n }\n if (rand(6) === 0) {\n const reporter = picka(userAgents)\n await reporter.com.atproto.moderation.createReport({\n reasonType: picka([\n COM_ATPROTO_MODERATION.DefsReasonSpam,\n COM_ATPROTO_MODERATION.DefsReasonOther,\n ]),\n reason: picka([\"Didn't look right to me\", undefined, undefined]),\n subject: {\n $type: 'com.atproto.repo.strongRef',\n uri: post.uri,\n cid: post.cid,\n },\n })\n }\n }\n\n // make some naughty posts & label them\n const file = Buffer.from(labeledImgB64, 'base64')\n const uploadedImg = await bob.com.atproto.repo.uploadBlob(file, {\n encoding: 'image/png',\n })\n const labeledPost = await bob.app.bsky.feed.post.create(\n { repo: bob.assertDid },\n {\n text: 'naughty post',\n embed: {\n $type: 'app.bsky.embed.images',\n images: [\n {\n image: uploadedImg.data.blob,\n alt: 'naughty naughty',\n },\n ],\n },\n createdAt: date.next().value,\n },\n )\n\n const filteredPost = await bob.app.bsky.feed.post.create(\n { repo: bob.assertDid },\n {\n text: 'really bad post should be deleted',\n createdAt: date.next().value,\n },\n )\n\n await createLabel(env.bsky.db, {\n uri: labeledPost.uri,\n cid: labeledPost.cid,\n val: 'nudity',\n })\n await createLabel(env.bsky.db, {\n uri: filteredPost.uri,\n cid: filteredPost.cid,\n val: 'dmca-violation',\n })\n\n // a set of replies\n for (let i = 0; i < 100; i++) {\n const targetUri = picka(posts).uri\n const urip = new AtUri(targetUri)\n const target = await alice.app.bsky.feed.post.get({\n repo: urip.host,\n rkey: urip.rkey,\n })\n const author = picka(userAgents)\n posts.push(\n await author.app.bsky.feed.post.create(\n { repo: author.did },\n {\n text: picka(replyTexts),\n reply: {\n root: target.value.reply ? target.value.reply.root : target,\n parent: target,\n },\n createdAt: date.next().value,\n },\n ),\n )\n }\n\n // a set of likes\n for (const post of posts) {\n for (const user of userAgents) {\n if (rand(3) === 0) {\n await user.app.bsky.feed.like.create(\n { repo: user.did },\n {\n subject: post,\n createdAt: date.next().value,\n },\n )\n }\n }\n }\n\n // a couple feed generators that returns some posts\n const fg1Uri = AtUri.make(\n alice.assertDid,\n 'app.bsky.feed.generator',\n 'alice-favs',\n )\n const fg1 = await env.createFeedGen({\n [fg1Uri.toString()]: async () => {\n const feed = posts\n .filter(() => rand(2) === 0)\n .map((post) => ({ post: post.uri }))\n return {\n encoding: 'application/json',\n body: {\n feed,\n },\n }\n },\n })\n const avatarImg = Buffer.from(blurHashB64, 'base64')\n const avatarRes = await alice.com.atproto.repo.uploadBlob(avatarImg, {\n encoding: 'image/png',\n })\n const fgAliceRes = await alice.app.bsky.feed.generator.create(\n { repo: alice.assertDid, rkey: fg1Uri.rkey },\n {\n did: fg1.did,\n displayName: 'alices feed',\n description: 'all my fav stuff',\n avatar: avatarRes.data.blob,\n createdAt: date.next().value,\n },\n )\n\n await alice.app.bsky.feed.post.create(\n { repo: alice.assertDid },\n {\n text: 'check out my algorithm!',\n embed: {\n $type: 'app.bsky.embed.record',\n record: fgAliceRes,\n },\n createdAt: date.next().value,\n },\n )\n for (const user of [alice, bob, carla]) {\n await user.app.bsky.feed.like.create(\n { repo: user.did },\n {\n subject: fgAliceRes,\n createdAt: date.next().value,\n },\n )\n }\n\n const fg2Uri = AtUri.make(\n bob.assertDid,\n 'app.bsky.feed.generator',\n 'bob-redux',\n )\n const fg2 = await env.createFeedGen({\n [fg2Uri.toString()]: async () => {\n const feed = posts\n .filter(() => rand(2) === 0)\n .map((post) => ({ post: post.uri }))\n return {\n encoding: 'application/json',\n body: {\n feed,\n },\n }\n },\n })\n const fgBobRes = await bob.app.bsky.feed.generator.create(\n { repo: bob.assertDid, rkey: fg2Uri.rkey },\n {\n did: fg2.did,\n displayName: 'Bobby boy hot new algo',\n createdAt: date.next().value,\n },\n )\n\n await alice.app.bsky.feed.post.create(\n { repo: alice.assertDid },\n {\n text: `bobs feed is neat too`,\n embed: {\n $type: 'app.bsky.embed.record',\n record: fgBobRes,\n },\n createdAt: date.next().value,\n },\n )\n\n const fg3Uri = AtUri.make(\n carla.assertDid,\n 'app.bsky.feed.generator',\n 'carla-intr-algo',\n )\n const fg3 = await env.createFeedGen({\n [fg3Uri.toString()]: async () => {\n const feed = posts\n .filter(() => rand(2) === 0)\n .map((post) => ({ post: post.uri }))\n return {\n encoding: 'application/json',\n body: {\n feed,\n },\n }\n },\n })\n const fgCarlaRes = await carla.app.bsky.feed.generator.create(\n { repo: carla.assertDid, rkey: fg3Uri.rkey },\n {\n did: fg3.did,\n displayName: `Acceptin' Generator`,\n acceptsInteractions: true,\n createdAt: date.next().value,\n },\n )\n\n await alice.app.bsky.feed.post.create(\n { repo: alice.assertDid },\n {\n text: `carla accepts interactions on her feed`,\n embed: {\n $type: 'app.bsky.embed.record',\n record: fgCarlaRes,\n },\n createdAt: date.next().value,\n },\n )\n\n // create labeler service\n {\n await labeler.app.bsky.labeler.service.create(\n { repo: labeler.did, rkey: 'self' },\n {\n policies: {\n labelValues: [\n '!hide',\n 'porn',\n 'rude',\n 'spam',\n 'spider',\n 'misinfo',\n 'cool',\n 'curate',\n ],\n labelValueDefinitions: [\n {\n identifier: 'rude',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: true,\n locales: [\n {\n lang: 'en',\n name: 'Rude',\n description: 'Just such a jerk, you wouldnt believe it.',\n },\n ],\n },\n {\n identifier: 'spam',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'hide',\n locales: [\n {\n lang: 'en',\n name: 'Spam',\n description:\n 'Low quality posts that dont add to the conversation.',\n },\n ],\n },\n {\n identifier: 'spider',\n blurs: 'media',\n severity: 'alert',\n defaultSetting: 'warn',\n locales: [\n {\n lang: 'en',\n name: 'Spider!',\n description: 'Oh no its a spider.',\n },\n ],\n },\n {\n identifier: 'cool',\n blurs: 'none',\n severity: 'inform',\n defaultSetting: 'warn',\n locales: [\n {\n lang: 'en',\n name: 'Cool',\n description: 'The coolest peeps in the atmosphere.',\n },\n ],\n },\n {\n identifier: 'curate',\n blurs: 'none',\n severity: 'none',\n defaultSetting: 'warn',\n locales: [\n {\n lang: 'en',\n name: 'Curation filter',\n description: 'We just dont want to see it as much.',\n },\n ],\n },\n ],\n },\n createdAt: date.next().value,\n },\n )\n await createLabel(env.bsky.db, {\n uri: alice.assertDid,\n cid: '',\n val: 'rude',\n src: labeler.did,\n })\n await createLabel(env.bsky.db, {\n uri: `at://${alice.assertDid}/app.bsky.feed.generator/alice-favs`,\n cid: '',\n val: 'cool',\n src: labeler.did,\n })\n await createLabel(env.bsky.db, {\n uri: bob.assertDid,\n cid: '',\n val: 'cool',\n src: labeler.did,\n })\n await createLabel(env.bsky.db, {\n uri: carla.assertDid,\n cid: '',\n val: 'spam',\n src: labeler.did,\n })\n }\n\n // Create lists and add people to the lists\n {\n const flowerLovers = await alice.app.bsky.graph.list.create(\n { repo: alice.assertDid },\n {\n name: 'Flower Lovers',\n purpose: 'app.bsky.graph.defs#curatelist',\n createdAt: new Date().toISOString(),\n description: 'A list of posts about flowers',\n },\n )\n const labelHaters = await bob.app.bsky.graph.list.create(\n { repo: bob.assertDid },\n {\n name: 'Label Haters',\n purpose: 'app.bsky.graph.defs#modlist',\n createdAt: new Date().toISOString(),\n description: 'A list of people who hate labels',\n },\n )\n await alice.app.bsky.graph.listitem.create(\n { repo: alice.assertDid },\n {\n subject: bob.assertDid,\n createdAt: new Date().toISOString(),\n list: new RecordRef(flowerLovers.uri, flowerLovers.cid).uriStr,\n },\n )\n await bob.app.bsky.graph.listitem.create(\n { repo: bob.assertDid },\n {\n subject: alice.assertDid,\n createdAt: new Date().toISOString(),\n list: new RecordRef(labelHaters.uri, labelHaters.cid).uriStr,\n },\n )\n }\n\n await setVerifier(env.bsky.db, alice.assertDid)\n\n // @TODO These are useful when testing complex threads, but don't need to be enabled all the time. We could make it configurable.\n // import * as seedThreadV2 from '../seed/thread-v2'\n // const sc = env.getSeedClient()\n // await seedThreadV2.simple(sc)\n // await seedThreadV2.long(sc)\n // await seedThreadV2.deep(sc)\n // await seedThreadV2.branchingFactor(sc)\n // await seedThreadV2.annotateMoreReplies(sc)\n // await seedThreadV2.annotateOP(sc)\n // await seedThreadV2.sort(sc)\n // await seedThreadV2.bumpOpAndViewer(sc)\n // await seedThreadV2.bumpGroupSorting(sc)\n // await seedThreadV2.bumpFollows(sc)\n // await seedThreadV2.blockDeletionAuth(sc, env.bsky.ctx.cfg.modServiceDid)\n // await seedThreadV2.mutes(sc)\n // await seedThreadV2.threadgated(sc)\n // await seedThreadV2.tags(sc)\n}\n\nconst createLabel = async (\n db: Database,\n opts: { uri: string; cid: string; val: string; src?: string },\n) => {\n await db.db\n .insertInto('label')\n .values({\n uri: opts.uri,\n cid: opts.cid,\n val: opts.val,\n cts: new Date().toISOString(),\n neg: false,\n src: opts.src ?? EXAMPLE_LABELER,\n })\n .execute()\n}\n\nconst setVerifier = async (db: Database, did: string) => {\n await db.db\n .updateTable('actor')\n .set({ trustedVerifier: true })\n .where('did', '=', did)\n .execute()\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/dev-env",
3
- "version": "0.3.212",
3
+ "version": "0.3.214",
4
4
  "license": "MIT",
5
5
  "description": "Local development environment helper for atproto development",
6
6
  "keywords": [
@@ -27,18 +27,18 @@
27
27
  "multiformats": "^9.9.0",
28
28
  "uint8arrays": "3.0.0",
29
29
  "undici": "^6.14.1",
30
- "@atproto/api": "^0.19.1",
31
- "@atproto/bsky": "^0.0.218",
32
- "@atproto/bsync": "^0.0.24",
30
+ "@atproto/api": "^0.19.4",
31
+ "@atproto/bsky": "^0.0.220",
32
+ "@atproto/bsync": "^0.0.25",
33
33
  "@atproto/common-web": "^0.4.18",
34
34
  "@atproto/crypto": "^0.4.5",
35
35
  "@atproto/identity": "^0.4.12",
36
36
  "@atproto/lexicon": "^0.6.2",
37
- "@atproto/ozone": "^0.1.165",
38
- "@atproto/pds": "^0.4.213",
37
+ "@atproto/ozone": "^0.1.167",
38
+ "@atproto/pds": "^0.4.215",
39
39
  "@atproto/sync": "^0.1.40",
40
- "@atproto/syntax": "^0.5.0",
41
- "@atproto/xrpc-server": "^0.10.15"
40
+ "@atproto/syntax": "^0.5.1",
41
+ "@atproto/xrpc-server": "^0.10.16"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/express": "^4.17.13",
package/src/mock/index.ts CHANGED
@@ -2,7 +2,6 @@ import { AtpAgent, COM_ATPROTO_MODERATION } from '@atproto/api'
2
2
  import { Database } from '@atproto/bsky'
3
3
  import { AtUri } from '@atproto/syntax'
4
4
  import { EXAMPLE_LABELER, RecordRef, TestNetwork } from '../index'
5
- import * as seedThreadV2 from '../seed/thread-v2'
6
5
  import { postTexts, replyTexts } from './data'
7
6
  import blurHashB64 from './img/blur-hash-avatar-b64'
8
7
  import labeledImgB64 from './img/labeled-img-b64'
@@ -31,63 +30,84 @@ export async function generateMockSetup(env: TestNetwork) {
31
30
  throw new Error('Not found')
32
31
  }
33
32
 
34
- const loggedOut = env.pds.getClient()
35
-
36
33
  const users = [
37
34
  {
38
35
  email: 'alice@test.com',
39
36
  handle: `alice.test`,
40
37
  password: 'hunter2',
38
+ displayName: 'Alice',
39
+ description: 'Test user 0',
41
40
  },
42
41
  {
43
42
  email: 'bob@test.com',
44
43
  handle: `bob.test`,
45
44
  password: 'hunter2',
45
+ displayName: 'Bob',
46
+ description: 'Test user 1',
46
47
  },
47
48
  {
48
49
  email: 'carla@test.com',
49
50
  handle: `carla.test`,
50
51
  password: 'hunter2',
52
+ displayName: 'Carla',
53
+ description: 'Test user 2',
54
+ },
55
+ {
56
+ email: 'triage@test.com',
57
+ handle: 'triage.test',
58
+ password: 'triage-pass',
59
+ },
60
+ {
61
+ email: 'mod@test.com',
62
+ handle: 'mod.test',
63
+ password: 'mod-pass',
64
+ },
65
+ {
66
+ email: 'admin-mod@test.com',
67
+ handle: 'admin-mod.test',
68
+ password: 'admin-mod-pass',
69
+ },
70
+ {
71
+ email: 'labeler@test.com',
72
+ handle: 'labeler.test',
73
+ password: 'hunter2',
74
+ displayName: 'Test Labeler',
75
+ description: 'Labeling things across the atmosphere',
51
76
  },
52
77
  ]
53
78
 
54
79
  const userAgents = await Promise.all(
55
- users.map(async (user, i) => {
80
+ users.map(async (user) => {
56
81
  const client: AtpAgent = env.pds.getClient()
57
82
  await client.createAccount(user)
58
83
  client.assertAuthenticated()
59
- await client.app.bsky.actor.profile.create(
60
- { repo: client.did },
61
- {
62
- displayName: ucfirst(user.handle).slice(0, -5),
63
- description: `Test user ${i}`,
64
- },
65
- )
84
+ if (user.displayName || user.description) {
85
+ await client.app.bsky.actor.profile.create(
86
+ { repo: client.did },
87
+ {
88
+ displayName: user.displayName,
89
+ description: user.description,
90
+ },
91
+ )
92
+ }
66
93
  return client
67
94
  }),
68
95
  )
69
96
 
70
- const [alice, bob, carla] = userAgents
97
+ const [alice, bob, carla, triage, mod, adminMod, labeler] = userAgents
71
98
 
72
- // Create moderator accounts
73
- const triageRes = await loggedOut.com.atproto.server.createAccount({
74
- email: 'triage@test.com',
75
- handle: 'triage.test',
76
- password: 'triage-pass',
77
- })
78
- await env.ozone.addTriageDid(triageRes.data.did)
79
- const modRes = await loggedOut.com.atproto.server.createAccount({
80
- email: 'mod@test.com',
81
- handle: 'mod.test',
82
- password: 'mod-pass',
83
- })
84
- await env.ozone.addModeratorDid(modRes.data.did)
85
- const adminRes = await loggedOut.com.atproto.server.createAccount({
86
- email: 'admin-mod@test.com',
87
- handle: 'admin-mod.test',
88
- password: 'admin-mod-pass',
89
- })
90
- await env.ozone.addAdminDid(adminRes.data.did)
99
+ // Create chat declarations for all users
100
+ for (const user of userAgents) {
101
+ await user.chat.bsky.actor.declaration.create(
102
+ { repo: user.did },
103
+ { allowIncoming: 'all' },
104
+ )
105
+ }
106
+
107
+ // Add moderator roles
108
+ await env.ozone.addTriageDid(triage.did)
109
+ await env.ozone.addModeratorDid(mod.did)
110
+ await env.ozone.addAdminDid(adminMod.did)
91
111
 
92
112
  // Report one user
93
113
  const reporter = picka(userAgents)
@@ -106,9 +126,9 @@ export async function generateMockSetup(env: TestNetwork) {
106
126
  // everybody follows everybody
107
127
  const follow = async (author: AtpAgent, subject: AtpAgent) => {
108
128
  await author.app.bsky.graph.follow.create(
109
- { repo: author.accountDid },
129
+ { repo: author.assertDid },
110
130
  {
111
- subject: subject.accountDid,
131
+ subject: subject.assertDid,
112
132
  createdAt: date.next().value,
113
133
  },
114
134
  )
@@ -165,7 +185,7 @@ export async function generateMockSetup(env: TestNetwork) {
165
185
  encoding: 'image/png',
166
186
  })
167
187
  const labeledPost = await bob.app.bsky.feed.post.create(
168
- { repo: bob.accountDid },
188
+ { repo: bob.assertDid },
169
189
  {
170
190
  text: 'naughty post',
171
191
  embed: {
@@ -182,7 +202,7 @@ export async function generateMockSetup(env: TestNetwork) {
182
202
  )
183
203
 
184
204
  const filteredPost = await bob.app.bsky.feed.post.create(
185
- { repo: bob.accountDid },
205
+ { repo: bob.assertDid },
186
206
  {
187
207
  text: 'really bad post should be deleted',
188
208
  createdAt: date.next().value,
@@ -241,7 +261,7 @@ export async function generateMockSetup(env: TestNetwork) {
241
261
 
242
262
  // a couple feed generators that returns some posts
243
263
  const fg1Uri = AtUri.make(
244
- alice.accountDid,
264
+ alice.assertDid,
245
265
  'app.bsky.feed.generator',
246
266
  'alice-favs',
247
267
  )
@@ -263,7 +283,7 @@ export async function generateMockSetup(env: TestNetwork) {
263
283
  encoding: 'image/png',
264
284
  })
265
285
  const fgAliceRes = await alice.app.bsky.feed.generator.create(
266
- { repo: alice.accountDid, rkey: fg1Uri.rkey },
286
+ { repo: alice.assertDid, rkey: fg1Uri.rkey },
267
287
  {
268
288
  did: fg1.did,
269
289
  displayName: 'alices feed',
@@ -274,7 +294,7 @@ export async function generateMockSetup(env: TestNetwork) {
274
294
  )
275
295
 
276
296
  await alice.app.bsky.feed.post.create(
277
- { repo: alice.accountDid },
297
+ { repo: alice.assertDid },
278
298
  {
279
299
  text: 'check out my algorithm!',
280
300
  embed: {
@@ -295,7 +315,7 @@ export async function generateMockSetup(env: TestNetwork) {
295
315
  }
296
316
 
297
317
  const fg2Uri = AtUri.make(
298
- bob.accountDid,
318
+ bob.assertDid,
299
319
  'app.bsky.feed.generator',
300
320
  'bob-redux',
301
321
  )
@@ -313,7 +333,7 @@ export async function generateMockSetup(env: TestNetwork) {
313
333
  },
314
334
  })
315
335
  const fgBobRes = await bob.app.bsky.feed.generator.create(
316
- { repo: bob.accountDid, rkey: fg2Uri.rkey },
336
+ { repo: bob.assertDid, rkey: fg2Uri.rkey },
317
337
  {
318
338
  did: fg2.did,
319
339
  displayName: 'Bobby boy hot new algo',
@@ -322,7 +342,7 @@ export async function generateMockSetup(env: TestNetwork) {
322
342
  )
323
343
 
324
344
  await alice.app.bsky.feed.post.create(
325
- { repo: alice.accountDid },
345
+ { repo: alice.assertDid },
326
346
  {
327
347
  text: `bobs feed is neat too`,
328
348
  embed: {
@@ -334,7 +354,7 @@ export async function generateMockSetup(env: TestNetwork) {
334
354
  )
335
355
 
336
356
  const fg3Uri = AtUri.make(
337
- carla.accountDid,
357
+ carla.assertDid,
338
358
  'app.bsky.feed.generator',
339
359
  'carla-intr-algo',
340
360
  )
@@ -352,7 +372,7 @@ export async function generateMockSetup(env: TestNetwork) {
352
372
  },
353
373
  })
354
374
  const fgCarlaRes = await carla.app.bsky.feed.generator.create(
355
- { repo: carla.accountDid, rkey: fg3Uri.rkey },
375
+ { repo: carla.assertDid, rkey: fg3Uri.rkey },
356
376
  {
357
377
  did: fg3.did,
358
378
  displayName: `Acceptin' Generator`,
@@ -362,7 +382,7 @@ export async function generateMockSetup(env: TestNetwork) {
362
382
  )
363
383
 
364
384
  await alice.app.bsky.feed.post.create(
365
- { repo: alice.accountDid },
385
+ { repo: alice.assertDid },
366
386
  {
367
387
  text: `carla accepts interactions on her feed`,
368
388
  embed: {
@@ -373,24 +393,10 @@ export async function generateMockSetup(env: TestNetwork) {
373
393
  },
374
394
  )
375
395
 
376
- // create a labeler account
396
+ // create labeler service
377
397
  {
378
- const labeler = env.pds.getClient()
379
- const res = await labeler.createAccount({
380
- email: 'labeler@test.com',
381
- handle: 'labeler.test',
382
- password: 'hunter2',
383
- })
384
- await labeler.app.bsky.actor.profile.create(
385
- { repo: res.data.did },
386
- {
387
- displayName: 'Test Labeler',
388
- description: `Labeling things across the atmosphere`,
389
- },
390
- )
391
-
392
398
  await labeler.app.bsky.labeler.service.create(
393
- { repo: res.data.did, rkey: 'self' },
399
+ { repo: labeler.did, rkey: 'self' },
394
400
  {
395
401
  policies: {
396
402
  labelValues: [
@@ -477,35 +483,35 @@ export async function generateMockSetup(env: TestNetwork) {
477
483
  },
478
484
  )
479
485
  await createLabel(env.bsky.db, {
480
- uri: alice.accountDid,
486
+ uri: alice.assertDid,
481
487
  cid: '',
482
488
  val: 'rude',
483
- src: res.data.did,
489
+ src: labeler.did,
484
490
  })
485
491
  await createLabel(env.bsky.db, {
486
- uri: `at://${alice.accountDid}/app.bsky.feed.generator/alice-favs`,
492
+ uri: `at://${alice.assertDid}/app.bsky.feed.generator/alice-favs`,
487
493
  cid: '',
488
494
  val: 'cool',
489
- src: res.data.did,
495
+ src: labeler.did,
490
496
  })
491
497
  await createLabel(env.bsky.db, {
492
- uri: bob.accountDid,
498
+ uri: bob.assertDid,
493
499
  cid: '',
494
500
  val: 'cool',
495
- src: res.data.did,
501
+ src: labeler.did,
496
502
  })
497
503
  await createLabel(env.bsky.db, {
498
- uri: carla.accountDid,
504
+ uri: carla.assertDid,
499
505
  cid: '',
500
506
  val: 'spam',
501
- src: res.data.did,
507
+ src: labeler.did,
502
508
  })
503
509
  }
504
510
 
505
511
  // Create lists and add people to the lists
506
512
  {
507
513
  const flowerLovers = await alice.app.bsky.graph.list.create(
508
- { repo: alice.accountDid },
514
+ { repo: alice.assertDid },
509
515
  {
510
516
  name: 'Flower Lovers',
511
517
  purpose: 'app.bsky.graph.defs#curatelist',
@@ -514,7 +520,7 @@ export async function generateMockSetup(env: TestNetwork) {
514
520
  },
515
521
  )
516
522
  const labelHaters = await bob.app.bsky.graph.list.create(
517
- { repo: bob.accountDid },
523
+ { repo: bob.assertDid },
518
524
  {
519
525
  name: 'Label Haters',
520
526
  purpose: 'app.bsky.graph.defs#modlist',
@@ -523,45 +529,42 @@ export async function generateMockSetup(env: TestNetwork) {
523
529
  },
524
530
  )
525
531
  await alice.app.bsky.graph.listitem.create(
526
- { repo: alice.accountDid },
532
+ { repo: alice.assertDid },
527
533
  {
528
- subject: bob.accountDid,
534
+ subject: bob.assertDid,
529
535
  createdAt: new Date().toISOString(),
530
536
  list: new RecordRef(flowerLovers.uri, flowerLovers.cid).uriStr,
531
537
  },
532
538
  )
533
539
  await bob.app.bsky.graph.listitem.create(
534
- { repo: bob.accountDid },
540
+ { repo: bob.assertDid },
535
541
  {
536
- subject: alice.accountDid,
542
+ subject: alice.assertDid,
537
543
  createdAt: new Date().toISOString(),
538
544
  list: new RecordRef(labelHaters.uri, labelHaters.cid).uriStr,
539
545
  },
540
546
  )
541
547
  }
542
548
 
543
- await setVerifier(env.bsky.db, alice.accountDid)
544
-
545
- // @TODO the following should be optimized as it makes dev-env start very slow (>10 sec)
546
- const sc = env.getSeedClient()
547
- await seedThreadV2.simple(sc)
548
- await seedThreadV2.long(sc)
549
- await seedThreadV2.deep(sc)
550
- await seedThreadV2.branchingFactor(sc)
551
- await seedThreadV2.annotateMoreReplies(sc)
552
- await seedThreadV2.annotateOP(sc)
553
- await seedThreadV2.sort(sc)
554
- await seedThreadV2.bumpOpAndViewer(sc)
555
- await seedThreadV2.bumpGroupSorting(sc)
556
- await seedThreadV2.bumpFollows(sc)
557
- await seedThreadV2.blockDeletionAuth(sc, env.bsky.ctx.cfg.modServiceDid)
558
- await seedThreadV2.mutes(sc)
559
- await seedThreadV2.threadgated(sc)
560
- await seedThreadV2.tags(sc)
561
- }
549
+ await setVerifier(env.bsky.db, alice.assertDid)
562
550
 
563
- function ucfirst(str: string): string {
564
- return str.at(0)?.toUpperCase() + str.slice(1)
551
+ // @TODO These are useful when testing complex threads, but don't need to be enabled all the time. We could make it configurable.
552
+ // import * as seedThreadV2 from '../seed/thread-v2'
553
+ // const sc = env.getSeedClient()
554
+ // await seedThreadV2.simple(sc)
555
+ // await seedThreadV2.long(sc)
556
+ // await seedThreadV2.deep(sc)
557
+ // await seedThreadV2.branchingFactor(sc)
558
+ // await seedThreadV2.annotateMoreReplies(sc)
559
+ // await seedThreadV2.annotateOP(sc)
560
+ // await seedThreadV2.sort(sc)
561
+ // await seedThreadV2.bumpOpAndViewer(sc)
562
+ // await seedThreadV2.bumpGroupSorting(sc)
563
+ // await seedThreadV2.bumpFollows(sc)
564
+ // await seedThreadV2.blockDeletionAuth(sc, env.bsky.ctx.cfg.modServiceDid)
565
+ // await seedThreadV2.mutes(sc)
566
+ // await seedThreadV2.threadgated(sc)
567
+ // await seedThreadV2.tags(sc)
565
568
  }
566
569
 
567
570
  const createLabel = async (