@atproto/dev-env 0.7.5 → 0.7.7
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 +27 -0
- package/README.md +21 -0
- package/assets/at.png +0 -0
- package/assets/hd-key.jpg +0 -0
- package/assets/key-alt.jpg +0 -0
- package/assets/key-landscape-large.jpg +0 -0
- package/assets/key-landscape-small.jpg +0 -0
- package/assets/key-portrait-large.jpg +0 -0
- package/assets/key-portrait-small.jpg +0 -0
- package/dist/bin.js +0 -1
- package/dist/bin.js.map +1 -1
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +12 -0
- package/dist/mock/index.js.map +1 -1
- package/dist/seed/atmosphere.d.ts +23 -0
- package/dist/seed/atmosphere.d.ts.map +1 -0
- package/dist/seed/atmosphere.js +227 -0
- package/dist/seed/atmosphere.js.map +1 -0
- package/dist/seed/index.d.ts +1 -0
- package/dist/seed/index.d.ts.map +1 -1
- package/dist/seed/index.js +1 -0
- package/dist/seed/index.js.map +1 -1
- package/package.json +9 -8
- package/src/bin.ts +0 -1
- package/src/mock/index.ts +15 -0
- package/src/seed/atmosphere.ts +394 -0
- package/src/seed/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atproto/dev-env
|
|
2
2
|
|
|
3
|
+
## 0.7.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#5802](https://github.com/bluesky-social/atproto/pull/5802) [`d930c3b`](https://github.com/bluesky-social/atproto/commit/d930c3b6b401df7085b8e85f3fc83dbbc3e28605) Thanks [@foysalit](https://github.com/foysalit)! - Retire moderation subject statistics and count-based filters. Legacy count-based
|
|
8
|
+
sorts fall back to last reported time.
|
|
9
|
+
- Updated dependencies [[`dd74699`](https://github.com/bluesky-social/atproto/commit/dd74699050a2ef0049736466e45c13842b71e0b9), [`b30ea73`](https://github.com/bluesky-social/atproto/commit/b30ea7305be8df27524ed70d4af7f246014194c2), [`d930c3b`](https://github.com/bluesky-social/atproto/commit/d930c3b6b401df7085b8e85f3fc83dbbc3e28605), [`211c9e8`](https://github.com/bluesky-social/atproto/commit/211c9e8acceccca2e983b7bc8ebfc0756664c956), [`bae981e`](https://github.com/bluesky-social/atproto/commit/bae981e238a7bc192b52a53c14f051a76a9f5507)]:
|
|
10
|
+
- @atproto/bsky@0.5.6
|
|
11
|
+
- @atproto/xrpc-server@0.13.11
|
|
12
|
+
- @atproto/pds@0.5.57
|
|
13
|
+
- @atproto/ozone@0.14.0
|
|
14
|
+
- @atproto/api@0.31.0
|
|
15
|
+
- @atproto/sync@0.4.25
|
|
16
|
+
|
|
17
|
+
## 0.7.6
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#5835](https://github.com/bluesky-social/atproto/pull/5835) [`1ec24ff`](https://github.com/bluesky-social/atproto/commit/1ec24ff2a123e3ea9d125d0dea950a8ee3adfca4) Thanks [@gcwill70](https://github.com/gcwill70)! - Support local Atmosphere record hydration and backlinks, and seed reusable moderation fixtures.
|
|
22
|
+
- Updated dependencies [[`39d702c`](https://github.com/bluesky-social/atproto/commit/39d702c851d469d7340fc0c5946959063769f849), [`0849c24`](https://github.com/bluesky-social/atproto/commit/0849c24d492a9286e90c1734f2483d6ed7423d73), [`7f619af`](https://github.com/bluesky-social/atproto/commit/7f619aff86f452f1ac2320b6926d88a8968b319d), [`1033419`](https://github.com/bluesky-social/atproto/commit/103341946f8bdb2abb5409866b234ad17812f7b8), [`1ec24ff`](https://github.com/bluesky-social/atproto/commit/1ec24ff2a123e3ea9d125d0dea950a8ee3adfca4), [`870a534`](https://github.com/bluesky-social/atproto/commit/870a5346d0e9374cb99e60bf88a98c27d3d34cfe), [`c03fb8d`](https://github.com/bluesky-social/atproto/commit/c03fb8dde754508529f82b80d626332198f33f44), [`7a46712`](https://github.com/bluesky-social/atproto/commit/7a467120982d9ff1559afeb3a26989dad5877d17), [`fe343a1`](https://github.com/bluesky-social/atproto/commit/fe343a1b90c1de470a45b0469628a9e75e7d883f)]:
|
|
23
|
+
- @atproto/pds@0.5.56
|
|
24
|
+
- @atproto/bsky@0.5.5
|
|
25
|
+
- @atproto/ozone@0.13.0
|
|
26
|
+
- @atproto/bsync@0.1.9
|
|
27
|
+
- @atproto/xrpc-server@0.13.10
|
|
28
|
+
- @atproto/sync@0.4.24
|
|
29
|
+
|
|
3
30
|
## 0.7.5
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -5,6 +5,27 @@ A command-line application for developers to construct and manage development en
|
|
|
5
5
|
[](https://www.npmjs.com/package/@atproto/dev-env)
|
|
6
6
|
[](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)
|
|
7
7
|
|
|
8
|
+
## Run the local stack
|
|
9
|
+
|
|
10
|
+
Use the Node version in the repository's `.nvmrc`. From the repository root,
|
|
11
|
+
install dependencies and build the generated schemas, services, and PDS UI:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm install --frozen-lockfile
|
|
15
|
+
pnpm run build
|
|
16
|
+
cd packages/dev-env
|
|
17
|
+
pnpm start
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Docker must be running. The startup helper starts disposable PostgreSQL and Redis
|
|
21
|
+
containers, or reuses the existing test containers. Use a fresh database for a
|
|
22
|
+
fresh fixture set; the seed is intended to run once per environment. Stopping the
|
|
23
|
+
helper removes containers it created. Do not reset shared test containers while
|
|
24
|
+
another test or development environment is using them.
|
|
25
|
+
|
|
26
|
+
The stack includes PLC (2582), PDS (2583), AppView (2584), Ozone (2587), and bsync.
|
|
27
|
+
Service URLs and DIDs are available at `http://localhost:2581/`.
|
|
28
|
+
|
|
8
29
|
## REPL API
|
|
9
30
|
|
|
10
31
|
The following methods are available in the REPL.
|
package/assets/at.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/bin.js
CHANGED
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE;IACrB,OAAO,CAAC,GAAG,CAAC;;;;;;;;uBAQS,CAAC,CAAA;IAEtB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC;QACvC,GAAG,EAAE;YACH,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,WAAW;YACrB,uBAAuB,EAAE,IAAI;SAC9B;QACD,IAAI,EAAE;YACJ,gBAAgB,EAAE,MAAM;YACxB,IAAI,EAAE,IAAI;YACV,SAAS,EAAE,uBAAuB;SACnC;QACD,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QACnB,KAAK,EAAE;YACL,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,uBAAuB,EAAE,iCAAiC;YACnE,OAAO,EAAE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE;IACrB,OAAO,CAAC,GAAG,CAAC;;;;;;;;uBAQS,CAAC,CAAA;IAEtB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC;QACvC,GAAG,EAAE;YACH,IAAI,EAAE,IAAI;YACV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C,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IACrE,OAAO,CAAC,GAAG,CAAC,oCAAoC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;IACpE,OAAO,CAAC,GAAG,CAAC,uBAAuB,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;IAC5D,KAAK,MAAM,EAAE,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC,GAAG,sBAAsB,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1E,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;IAC1C,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAChC,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAA;AAC/C,CAAC,CAAA;AAED,GAAG,EAAE,CAAA","sourcesContent":["import { generateMockSetup } from './mock/index.js'\nimport { TestNetwork } from './network.js'\nimport { mockMailer } from './util.js'\n\nconst run = async () => {\n console.log(`\n██████╗\n██╔═══██╗\n██║██╗██║\n██║██║██║\n╚█║████╔╝\n ╚╝╚═══╝ protocol\n\n[ created by Bluesky ]`)\n\n const network = await TestNetwork.create({\n pds: {\n port: 2583,\n hostname: 'localhost',\n enableDidDocWithSession: true,\n },\n bsky: {\n dbPostgresSchema: 'bsky',\n port: 2584,\n publicUrl: 'http://localhost:2584',\n },\n plc: { port: 2582 },\n ozone: {\n port: 2587,\n chatUrl: 'http://localhost:2590', // must run separate chat service\n chatDid: 'did:example:chat',\n },\n introspect: { port: 2581 },\n })\n mockMailer(network.pds)\n\n if (network.introspect) {\n console.log(\n `🔍 Dev-env introspection server http://localhost:${network.introspect.port}`,\n )\n }\n console.log(`👤 DID Placeholder server http://localhost:${network.plc.port}`)\n console.log(`🌞 Main PDS http://localhost:${network.pds.port}`)\n console.log(`🌞 Main PDS account DB`, network.pds.ctx.cfg.db.accountDbLoc)\n console.log(\n `🔨 Lexicon authority DID ${network.pds.ctx.cfg.lexicon.didAuthority}`,\n )\n console.log(`🗼 Ozone server http://localhost:${network.ozone.port}`)\n console.log(`🗼 Ozone service DID ${network.ozone.ctx.cfg.service.did}`)\n console.log(`🔄 Bsync server http://localhost:${network.bsync.port}`)\n console.log(`🌅 Bsky Appview http://localhost:${network.bsky.port}`)\n console.log(`🌅 Bsky Appview DID ${network.bsky.serverDid}`)\n for (const fg of network.feedGens) {\n console.log(`🤖 Feed Generator (${fg.did}) http://localhost:${fg.port}`)\n }\n\n console.time('✅ Dev environment is ready')\n await generateMockSetup(network)\n console.timeEnd('✅ Dev environment is ready')\n}\n\nrun()\n"]}
|
package/dist/mock/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mock/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mock/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAmB1E,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,WAAW,iBA6qBvD"}
|
package/dist/mock/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { COM_ATPROTO_MODERATION, ToolsOzoneQueueCreateQueue, } from '@atproto/api';
|
|
2
2
|
import { AtUri } from '@atproto/syntax';
|
|
3
3
|
import { EXAMPLE_LABELER, RecordRef } from '../index.js';
|
|
4
|
+
import { seedAtmosphere } from '../seed/atmosphere.js';
|
|
4
5
|
import { postTexts, replyTexts } from './data.js';
|
|
5
6
|
import blurHashB64 from './img/blur-hash-avatar-b64.js';
|
|
6
7
|
import labeledImgB64 from './img/labeled-img-b64.js';
|
|
@@ -551,6 +552,17 @@ export async function generateMockSetup(env) {
|
|
|
551
552
|
});
|
|
552
553
|
}
|
|
553
554
|
await setVerifier(env.bsky.db, alice.assertDid);
|
|
555
|
+
const atmosphere = await seedAtmosphere(env, {
|
|
556
|
+
author: alice,
|
|
557
|
+
photographer: bob,
|
|
558
|
+
streamer: carla,
|
|
559
|
+
reporter: triage,
|
|
560
|
+
});
|
|
561
|
+
console.table(atmosphere.records.map(({ title, reportId, uri }) => ({
|
|
562
|
+
fixture: title,
|
|
563
|
+
reportId,
|
|
564
|
+
uri,
|
|
565
|
+
})));
|
|
554
566
|
// @TODO These are useful when testing complex threads, but don't need to be enabled all the time. We could make it configurable.
|
|
555
567
|
// import * as seedThreadV2 from '../seed/thread-v2.js'
|
|
556
568
|
// const sc = env.getSeedClient()
|
package/dist/mock/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mock/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,KAAK,EAAoB,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,WAAW,MAAM,+BAA+B,CAAA;AACvD,OAAO,aAAa,MAAM,0BAA0B,CAAA;AAEpD,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;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAg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3E,+BAA+B;IAC/B,qCAAqC;IACrC,8BAA8B;AAChC,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,eAAe;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 {\n type AtpAgent,\n COM_ATPROTO_MODERATION,\n ToolsOzoneQueueCreateQueue,\n} from '@atproto/api'\nimport type { Database } from '@atproto/bsky'\nimport { AtUri, type AtUriString } from '@atproto/syntax'\nimport { EXAMPLE_LABELER, RecordRef, type TestNetwork } from '../index.js'\nimport { postTexts, replyTexts } from './data.js'\nimport blurHashB64 from './img/blur-hash-avatar-b64.js'\nimport labeledImgB64 from './img/labeled-img-b64.js'\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 agent: AtpAgent = env.pds.getAgent()\n await agent.createAccount(user)\n agent.assertAuthenticated()\n if (user.displayName || user.description) {\n await agent.app.bsky.actor.profile.create(\n { repo: agent.did },\n {\n displayName: user.displayName,\n description: user.description,\n },\n )\n }\n return agent\n }),\n )\n\n const [alice, bob, carla, triage, mod, adminMod, labeler] = userAgents\n\n // @NOTE The client uses declared age outside regions requiring age assurance.\n for (const user of [alice, bob]) {\n await user.app.bsky.actor.putPreferences({\n preferences: [\n {\n $type: 'app.bsky.actor.defs#personalDetailsPref',\n birthDate: '1990-01-01T00:00:00.000Z',\n },\n ],\n })\n }\n\n // @NOTE Wait for actor rows to exist before seeding age assurance state.\n await env.processAll()\n await env.bsky.db.db\n .updateTable('actor')\n .set({ ageAssuranceStatus: 'assured', ageAssuranceAccess: 'full' })\n .where('did', 'in', [alice.did, bob.did])\n .execute()\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 // Create report queues\n const ozoneAgent = env.ozone.getAgent()\n const adminHeaders = async (nsid: string) =>\n env.ozone.modHeaders(nsid, 'admin')\n\n const createQueue = async (input: {\n name: string\n subjectTypes: string[]\n reportTypes: string[]\n collection?: string\n }): Promise<void> => {\n try {\n await ozoneAgent.tools.ozone.queue.createQueue(input, {\n encoding: 'application/json',\n headers: await adminHeaders('tools.ozone.queue.createQueue'),\n })\n } catch (err) {\n if (!(err instanceof ToolsOzoneQueueCreateQueue.ConflictingQueueError)) {\n throw err\n }\n }\n }\n\n await Promise.all([\n createQueue({\n name: 'Spammy Accounts',\n subjectTypes: ['account'],\n reportTypes: [COM_ATPROTO_MODERATION.DefsReasonSpam],\n }),\n createQueue({\n name: 'Threatening Accounts',\n subjectTypes: ['account'],\n reportTypes: ['tools.ozone.report.defs#reasonViolenceThreats'],\n }),\n createQueue({\n name: 'Spammy Posts',\n subjectTypes: ['record'],\n reportTypes: [COM_ATPROTO_MODERATION.DefsReasonSpam],\n collection: 'app.bsky.feed.post',\n }),\n ])\n\n // Report one user (random)\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 // Reports that target queues\n await alice.com.atproto.moderation.createReport({\n reasonType: COM_ATPROTO_MODERATION.DefsReasonSpam,\n reason: 'This account is spamming',\n subject: { $type: 'com.atproto.admin.defs#repoRef', did: bob.did },\n })\n await bob.com.atproto.moderation.createReport({\n reasonType: 'tools.ozone.report.defs#reasonViolenceThreats',\n reason: 'Threatened me',\n subject: {\n $type: 'com.atproto.admin.defs#repoRef',\n did: carla.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 // Spam post report\n if (posts.length > 0) {\n await carla.com.atproto.moderation.createReport({\n reasonType: COM_ATPROTO_MODERATION.DefsReasonSpam,\n reason: 'This post is spam',\n subject: {\n $type: 'com.atproto.repo.strongRef',\n uri: posts[0].uri,\n cid: posts[0].cid,\n },\n })\n }\n\n // Route all reports to queues\n await env.ozone.daemon.ctx.queueRouter.routeReports()\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 // post with a gallery of images\n const galleryItems: Array<any> = []\n for (let i = 0; i < 10; i++) {\n galleryItems.push({\n $type: 'app.bsky.embed.gallery#image',\n image: uploadedImg.data.blob,\n alt: 'naughty ' + (i + 1),\n aspectRatio: {\n $type: 'app.bsky.embed.defs#aspectRatio',\n width: 10,\n height: 10,\n },\n })\n }\n const galleryPost = await bob.app.bsky.feed.post.create(\n { repo: bob.assertDid },\n {\n text: 'look at my cool pics',\n embed: {\n $type: 'app.bsky.embed.gallery',\n items: galleryItems,\n },\n createdAt: date.next().value,\n },\n )\n posts.push(galleryPost)\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 targetRef = { uri: target.uri, cid: target.cid }\n const author = picka(userAgents)\n try {\n const post = await author.app.bsky.feed.post.create(\n { repo: author.did },\n {\n text: picka(replyTexts),\n reply: {\n root: target.value.reply?.root ?? targetRef,\n parent: targetRef,\n },\n createdAt: date.next().value,\n },\n )\n\n posts.push(post)\n } catch (err) {\n console.error('Failed to create reply', err)\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 as AtUriString }))\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 as AtUriString }))\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 as AtUriString }))\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.js'\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"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mock/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,KAAK,EAAoB,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,WAAW,MAAM,+BAA+B,CAAA;AACvD,OAAO,aAAa,MAAM,0BAA0B,CAAA;AAEpD,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,MA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G,EAAE,GAAG,CAAC;SACtB,OAAO,EAAE,CAAA;AACd,CAAC,CAAA","sourcesContent":["import {\n type AtpAgent,\n COM_ATPROTO_MODERATION,\n ToolsOzoneQueueCreateQueue,\n} from '@atproto/api'\nimport type { Database } from '@atproto/bsky'\nimport { AtUri, type AtUriString } from '@atproto/syntax'\nimport { EXAMPLE_LABELER, RecordRef, type TestNetwork } from '../index.js'\nimport { seedAtmosphere } from '../seed/atmosphere.js'\nimport { postTexts, replyTexts } from './data.js'\nimport blurHashB64 from './img/blur-hash-avatar-b64.js'\nimport labeledImgB64 from './img/labeled-img-b64.js'\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 agent: AtpAgent = env.pds.getAgent()\n await agent.createAccount(user)\n agent.assertAuthenticated()\n if (user.displayName || user.description) {\n await agent.app.bsky.actor.profile.create(\n { repo: agent.did },\n {\n displayName: user.displayName,\n description: user.description,\n },\n )\n }\n return agent\n }),\n )\n\n const [alice, bob, carla, triage, mod, adminMod, labeler] = userAgents\n\n // @NOTE The client uses declared age outside regions requiring age assurance.\n for (const user of [alice, bob]) {\n await user.app.bsky.actor.putPreferences({\n preferences: [\n {\n $type: 'app.bsky.actor.defs#personalDetailsPref',\n birthDate: '1990-01-01T00:00:00.000Z',\n },\n ],\n })\n }\n\n // @NOTE Wait for actor rows to exist before seeding age assurance state.\n await env.processAll()\n await env.bsky.db.db\n .updateTable('actor')\n .set({ ageAssuranceStatus: 'assured', ageAssuranceAccess: 'full' })\n .where('did', 'in', [alice.did, bob.did])\n .execute()\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 // Create report queues\n const ozoneAgent = env.ozone.getAgent()\n const adminHeaders = async (nsid: string) =>\n env.ozone.modHeaders(nsid, 'admin')\n\n const createQueue = async (input: {\n name: string\n subjectTypes: string[]\n reportTypes: string[]\n collection?: string\n }): Promise<void> => {\n try {\n await ozoneAgent.tools.ozone.queue.createQueue(input, {\n encoding: 'application/json',\n headers: await adminHeaders('tools.ozone.queue.createQueue'),\n })\n } catch (err) {\n if (!(err instanceof ToolsOzoneQueueCreateQueue.ConflictingQueueError)) {\n throw err\n }\n }\n }\n\n await Promise.all([\n createQueue({\n name: 'Spammy Accounts',\n subjectTypes: ['account'],\n reportTypes: [COM_ATPROTO_MODERATION.DefsReasonSpam],\n }),\n createQueue({\n name: 'Threatening Accounts',\n subjectTypes: ['account'],\n reportTypes: ['tools.ozone.report.defs#reasonViolenceThreats'],\n }),\n createQueue({\n name: 'Spammy Posts',\n subjectTypes: ['record'],\n reportTypes: [COM_ATPROTO_MODERATION.DefsReasonSpam],\n collection: 'app.bsky.feed.post',\n }),\n ])\n\n // Report one user (random)\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 // Reports that target queues\n await alice.com.atproto.moderation.createReport({\n reasonType: COM_ATPROTO_MODERATION.DefsReasonSpam,\n reason: 'This account is spamming',\n subject: { $type: 'com.atproto.admin.defs#repoRef', did: bob.did },\n })\n await bob.com.atproto.moderation.createReport({\n reasonType: 'tools.ozone.report.defs#reasonViolenceThreats',\n reason: 'Threatened me',\n subject: {\n $type: 'com.atproto.admin.defs#repoRef',\n did: carla.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 // Spam post report\n if (posts.length > 0) {\n await carla.com.atproto.moderation.createReport({\n reasonType: COM_ATPROTO_MODERATION.DefsReasonSpam,\n reason: 'This post is spam',\n subject: {\n $type: 'com.atproto.repo.strongRef',\n uri: posts[0].uri,\n cid: posts[0].cid,\n },\n })\n }\n\n // Route all reports to queues\n await env.ozone.daemon.ctx.queueRouter.routeReports()\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 // post with a gallery of images\n const galleryItems: Array<any> = []\n for (let i = 0; i < 10; i++) {\n galleryItems.push({\n $type: 'app.bsky.embed.gallery#image',\n image: uploadedImg.data.blob,\n alt: 'naughty ' + (i + 1),\n aspectRatio: {\n $type: 'app.bsky.embed.defs#aspectRatio',\n width: 10,\n height: 10,\n },\n })\n }\n const galleryPost = await bob.app.bsky.feed.post.create(\n { repo: bob.assertDid },\n {\n text: 'look at my cool pics',\n embed: {\n $type: 'app.bsky.embed.gallery',\n items: galleryItems,\n },\n createdAt: date.next().value,\n },\n )\n posts.push(galleryPost)\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 targetRef = { uri: target.uri, cid: target.cid }\n const author = picka(userAgents)\n try {\n const post = await author.app.bsky.feed.post.create(\n { repo: author.did },\n {\n text: picka(replyTexts),\n reply: {\n root: target.value.reply?.root ?? targetRef,\n parent: targetRef,\n },\n createdAt: date.next().value,\n },\n )\n\n posts.push(post)\n } catch (err) {\n console.error('Failed to create reply', err)\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 as AtUriString }))\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 as AtUriString }))\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 as AtUriString }))\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 const atmosphere = await seedAtmosphere(env, {\n author: alice,\n photographer: bob,\n streamer: carla,\n reporter: triage,\n })\n console.table(\n atmosphere.records.map(({ title, reportId, uri }) => ({\n fixture: title,\n reportId,\n uri,\n })),\n )\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.js'\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"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AtpAgent } from '@atproto/api';
|
|
2
|
+
import type { TestNetwork } from '../network.js';
|
|
3
|
+
export type AtmosphereFixture = {
|
|
4
|
+
title: string;
|
|
5
|
+
collection: string;
|
|
6
|
+
uri: string;
|
|
7
|
+
cid: string;
|
|
8
|
+
eventId?: number;
|
|
9
|
+
reportId?: number;
|
|
10
|
+
queueId?: number;
|
|
11
|
+
};
|
|
12
|
+
export type AtmosphereSeed = {
|
|
13
|
+
records: AtmosphereFixture[];
|
|
14
|
+
queues: Record<string, number>;
|
|
15
|
+
};
|
|
16
|
+
/** Seed synthetic third-party records, their dependencies, and queued Ozone reports. */
|
|
17
|
+
export declare function seedAtmosphere(network: TestNetwork, agents: {
|
|
18
|
+
author: AtpAgent;
|
|
19
|
+
photographer: AtpAgent;
|
|
20
|
+
streamer: AtpAgent;
|
|
21
|
+
reporter: AtpAgent;
|
|
22
|
+
}): Promise<AtmosphereSeed>;
|
|
23
|
+
//# sourceMappingURL=atmosphere.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atmosphere.d.ts","sourceRoot":"","sources":["../../src/seed/atmosphere.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAA0B,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,CAAA;AAED,wFAAwF;AACxF,wBAAsB,cAAc,CAClC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE;IACN,MAAM,EAAE,QAAQ,CAAA;IAChB,YAAY,EAAE,QAAQ,CAAA;IACtB,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;CACnB,GACA,OAAO,CAAC,cAAc,CAAC,CA6WzB"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { COM_ATPROTO_MODERATION } from '@atproto/api';
|
|
3
|
+
/** Seed synthetic third-party records, their dependencies, and queued Ozone reports. */
|
|
4
|
+
export async function seedAtmosphere(network, agents) {
|
|
5
|
+
const { author, photographer, streamer, reporter } = agents;
|
|
6
|
+
const records = [];
|
|
7
|
+
const now = new Date().toISOString();
|
|
8
|
+
const yesterday = new Date(Date.now() - 86_400_000).toISOString();
|
|
9
|
+
const photos = [
|
|
10
|
+
[
|
|
11
|
+
0,
|
|
12
|
+
'Landscape photograph',
|
|
13
|
+
'key-landscape-small.jpg',
|
|
14
|
+
150,
|
|
15
|
+
87,
|
|
16
|
+
'A key in a landscape image.',
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
1,
|
|
20
|
+
'Portrait photograph',
|
|
21
|
+
'key-portrait-small.jpg',
|
|
22
|
+
87,
|
|
23
|
+
150,
|
|
24
|
+
'A key in a portrait image.',
|
|
25
|
+
],
|
|
26
|
+
[2, 'Photo without alt text', 'key-alt.jpg', 400, 400, ''],
|
|
27
|
+
];
|
|
28
|
+
const put = async (agent, collection, value, title, report = true) => {
|
|
29
|
+
const record = { $type: collection, ...value };
|
|
30
|
+
const { data } = await agent.com.atproto.repo.createRecord({
|
|
31
|
+
repo: agent.assertDid,
|
|
32
|
+
collection,
|
|
33
|
+
record,
|
|
34
|
+
});
|
|
35
|
+
const saved = { uri: data.uri, cid: data.cid, value: record };
|
|
36
|
+
if (report)
|
|
37
|
+
records.push({ title, collection, uri: data.uri, cid: data.cid });
|
|
38
|
+
return saved;
|
|
39
|
+
};
|
|
40
|
+
const picture = async (agent, filename) => {
|
|
41
|
+
const image = await readFile(new URL(`../../assets/${filename}`, import.meta.url));
|
|
42
|
+
const { data } = await agent.com.atproto.repo.uploadBlob(image, {
|
|
43
|
+
encoding: 'image/jpeg',
|
|
44
|
+
});
|
|
45
|
+
return data.blob;
|
|
46
|
+
};
|
|
47
|
+
const cover = await picture(author, 'key-landscape-small.jpg');
|
|
48
|
+
const icon = await picture(author, 'key-alt.jpg');
|
|
49
|
+
const publication = await put(author, 'site.standard.publication', {
|
|
50
|
+
name: 'Local journal — publication with icon',
|
|
51
|
+
url: 'https://journal.example.test',
|
|
52
|
+
description: 'A local Standard publication for reviewing article and publication cards.',
|
|
53
|
+
icon,
|
|
54
|
+
preferences: { showInDiscover: true },
|
|
55
|
+
basicTheme: {
|
|
56
|
+
$type: 'site.standard.theme.basic',
|
|
57
|
+
background: {
|
|
58
|
+
$type: 'site.standard.theme.color#rgb',
|
|
59
|
+
r: 240,
|
|
60
|
+
g: 249,
|
|
61
|
+
b: 255,
|
|
62
|
+
},
|
|
63
|
+
foreground: {
|
|
64
|
+
$type: 'site.standard.theme.color#rgb',
|
|
65
|
+
r: 15,
|
|
66
|
+
g: 23,
|
|
67
|
+
b: 42,
|
|
68
|
+
},
|
|
69
|
+
accent: {
|
|
70
|
+
$type: 'site.standard.theme.color#rgb',
|
|
71
|
+
r: 37,
|
|
72
|
+
g: 99,
|
|
73
|
+
b: 235,
|
|
74
|
+
},
|
|
75
|
+
accentForeground: {
|
|
76
|
+
$type: 'site.standard.theme.color#rgb',
|
|
77
|
+
r: 255,
|
|
78
|
+
g: 255,
|
|
79
|
+
b: 255,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
}, 'Publication with icon and description');
|
|
83
|
+
await put(author, 'site.standard.publication', { name: 'Minimal publication', url: 'https://minimal.example.test' }, 'Minimal publication');
|
|
84
|
+
const post = await put(author, 'app.bsky.feed.post', {
|
|
85
|
+
text: 'A new article from the Local journal. This post is linked from a Standard document fixture.',
|
|
86
|
+
createdAt: now,
|
|
87
|
+
}, 'Article announcement post', false);
|
|
88
|
+
const article = await put(author, 'site.standard.document', {
|
|
89
|
+
site: publication.uri,
|
|
90
|
+
path: '/articles/complete-example',
|
|
91
|
+
title: 'Complete article with publication and linked post',
|
|
92
|
+
description: 'Check the cover image, publication link, tags, timestamps, and linked Bluesky post.',
|
|
93
|
+
textContent: 'This article lives on the local PDS.\n\nThe publication and the linked post are real local records. You can inspect both the simple record and the AppView context.\n\nAll content is synthetic test data.',
|
|
94
|
+
publishedAt: yesterday,
|
|
95
|
+
updatedAt: now,
|
|
96
|
+
coverImage: cover,
|
|
97
|
+
tags: ['local', 'article', 'moderation'],
|
|
98
|
+
bskyPostRef: { uri: post.uri, cid: post.cid },
|
|
99
|
+
}, 'Complete article');
|
|
100
|
+
await put(author, 'site.standard.document', {
|
|
101
|
+
site: 'https://independent.example.test',
|
|
102
|
+
path: '/standalone',
|
|
103
|
+
title: 'Standalone article with HTTPS site',
|
|
104
|
+
publishedAt: now,
|
|
105
|
+
description: 'No publication record is needed for this document.',
|
|
106
|
+
textContent: 'A standalone article whose source URL is formed directly from its HTTPS site and path.',
|
|
107
|
+
}, 'Standalone HTTPS article');
|
|
108
|
+
await put(author, 'site.standard.document', {
|
|
109
|
+
site: publication.uri,
|
|
110
|
+
path: '/structured',
|
|
111
|
+
title: 'Structured article without plain text',
|
|
112
|
+
publishedAt: now,
|
|
113
|
+
description: 'Exercises the missing plaintext message and raw record view.',
|
|
114
|
+
content: {
|
|
115
|
+
$type: 'com.example.article.content',
|
|
116
|
+
blocks: [
|
|
117
|
+
{
|
|
118
|
+
type: 'paragraph',
|
|
119
|
+
text: 'Structured-only content is visible in the raw record.',
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
}, 'Structured-only article');
|
|
124
|
+
await put(author, 'site.standard.document', {
|
|
125
|
+
site: `at://${author.assertDid}/site.standard.publication/2222222222222`,
|
|
126
|
+
path: '/missing-publication',
|
|
127
|
+
title: 'Article with unavailable publication',
|
|
128
|
+
publishedAt: now,
|
|
129
|
+
textContent: 'The document exists, but its referenced publication does not. The simple record should remain usable.',
|
|
130
|
+
}, 'Unavailable-publication article');
|
|
131
|
+
await put(author, 'site.standard.document', {
|
|
132
|
+
site: publication.uri,
|
|
133
|
+
path: '/long-read',
|
|
134
|
+
title: 'Long article — scrolling and multiline text',
|
|
135
|
+
publishedAt: now,
|
|
136
|
+
description: 'An article with enough text to exercise bounded scrolling.',
|
|
137
|
+
textContent: Array.from({ length: 32 }, (_, i) => `Paragraph ${i + 1}: This is synthetic local content for reviewing article cards, text wrapping, scrolling, and moderation details. The record is stored on the development PDS.`).join('\n\n'),
|
|
138
|
+
coverImage: cover,
|
|
139
|
+
tags: ['longread', 'local'],
|
|
140
|
+
}, 'Long article');
|
|
141
|
+
await put(author, 'site.standard.document', { site: publication.uri, title: 'Minimal article', publishedAt: now }, 'Minimal article');
|
|
142
|
+
const gallery = await put(photographer, 'social.grain.gallery', {
|
|
143
|
+
title: 'Local gallery — three photos',
|
|
144
|
+
description: 'Three local photos with landscape, portrait, and missing-alt cases.',
|
|
145
|
+
createdAt: now,
|
|
146
|
+
}, 'Gallery with three photos');
|
|
147
|
+
await put(photographer, 'social.grain.gallery', { title: 'Empty local gallery', createdAt: now }, 'Empty gallery');
|
|
148
|
+
for (const [position, title, filename, width, height, alt] of photos) {
|
|
149
|
+
const photo = await put(photographer, 'social.grain.photo', {
|
|
150
|
+
photo: await picture(photographer, filename),
|
|
151
|
+
alt: alt ?? '',
|
|
152
|
+
aspectRatio: { width, height },
|
|
153
|
+
createdAt: now,
|
|
154
|
+
}, title);
|
|
155
|
+
await put(photographer, 'social.grain.gallery.item', { gallery: gallery.uri, item: photo.uri, position, createdAt: now }, 'Gallery item', false);
|
|
156
|
+
}
|
|
157
|
+
const streamPost = await put(streamer, 'app.bsky.feed.post', {
|
|
158
|
+
text: 'Announcing a synthetic local livestream for Ozone frontend testing.',
|
|
159
|
+
createdAt: now,
|
|
160
|
+
}, 'Livestream announcement', false);
|
|
161
|
+
const thumb = await picture(streamer, 'key-landscape-small.jpg');
|
|
162
|
+
await put(streamer, 'place.stream.livestream', {
|
|
163
|
+
title: 'Local livestream with thumbnail and announcement',
|
|
164
|
+
createdAt: now,
|
|
165
|
+
lastSeenAt: now,
|
|
166
|
+
canonicalUrl: 'https://stream.example.test/watch/local',
|
|
167
|
+
url: 'https://stream.example.test/replicate/local',
|
|
168
|
+
thumb,
|
|
169
|
+
agent: 'LocalFixture/1.0',
|
|
170
|
+
tags: ['local', 'lang:en'],
|
|
171
|
+
post: { uri: streamPost.uri, cid: streamPost.cid },
|
|
172
|
+
}, 'Livestream with announcement');
|
|
173
|
+
await put(streamer, 'place.stream.livestream', {
|
|
174
|
+
title: 'Ended local livestream',
|
|
175
|
+
createdAt: yesterday,
|
|
176
|
+
endedAt: now,
|
|
177
|
+
canonicalUrl: 'https://stream.example.test/watch/ended',
|
|
178
|
+
}, 'Ended livestream');
|
|
179
|
+
await put(author, 'com.example.note', {
|
|
180
|
+
title: 'Unknown record collection',
|
|
181
|
+
text: 'This record exercises the generic JSON fallback.',
|
|
182
|
+
createdAt: now,
|
|
183
|
+
}, 'Generic record fallback');
|
|
184
|
+
await put(reporter, 'site.standard.graph.recommend', { document: article.uri, createdAt: now }, 'Article recommendation', false);
|
|
185
|
+
await put(reporter, 'site.standard.graph.subscription', { publication: publication.uri, createdAt: now }, 'Publication subscription', false);
|
|
186
|
+
await put(reporter, 'social.grain.favorite', { subject: gallery.uri, createdAt: now }, 'Gallery favorite', false);
|
|
187
|
+
await network.processAll();
|
|
188
|
+
const ozone = network.ozone.getAgent();
|
|
189
|
+
const queues = {};
|
|
190
|
+
for (const collection of new Set(records.map((record) => record.collection))) {
|
|
191
|
+
const { data } = await ozone.tools.ozone.queue.createQueue({
|
|
192
|
+
name: `Atmosphere: ${collection}`,
|
|
193
|
+
subjectTypes: ['record'],
|
|
194
|
+
reportTypes: [COM_ATPROTO_MODERATION.DefsReasonOther],
|
|
195
|
+
collection,
|
|
196
|
+
}, {
|
|
197
|
+
encoding: 'application/json',
|
|
198
|
+
headers: await network.ozone.modHeaders('tools.ozone.queue.createQueue', 'admin'),
|
|
199
|
+
});
|
|
200
|
+
queues[collection] = data.queue.id;
|
|
201
|
+
}
|
|
202
|
+
for (const record of records) {
|
|
203
|
+
const { data } = await reporter.com.atproto.moderation.createReport({
|
|
204
|
+
reasonType: COM_ATPROTO_MODERATION.DefsReasonOther,
|
|
205
|
+
reason: `Local frontend test: ${record.title}. Synthetic content for reviewing ${record.collection} rendering.`,
|
|
206
|
+
subject: {
|
|
207
|
+
$type: 'com.atproto.repo.strongRef',
|
|
208
|
+
uri: record.uri,
|
|
209
|
+
cid: record.cid,
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
record.eventId = data.id;
|
|
213
|
+
}
|
|
214
|
+
await network.ozone.daemon.ctx.queueRouter.routeReports();
|
|
215
|
+
const { data } = await ozone.tools.ozone.report.queryReports({ status: 'queued', limit: 100 }, {
|
|
216
|
+
headers: await network.ozone.modHeaders('tools.ozone.report.queryReports', 'admin'),
|
|
217
|
+
});
|
|
218
|
+
for (const record of records) {
|
|
219
|
+
const report = data.reports.find((report) => report.eventId === record.eventId);
|
|
220
|
+
if (!report)
|
|
221
|
+
throw new Error(`Fixture report was not queued: ${record.title}`);
|
|
222
|
+
record.reportId = report.id;
|
|
223
|
+
record.queueId = queues[record.collection];
|
|
224
|
+
}
|
|
225
|
+
return { records, queues };
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=atmosphere.js.map
|
|
@@ -0,0 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G,IAAI,CAAC,EAAE,CAAA;IAC1B,CAAC;IACD,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,YAAY,EAAE,CAAA;IACzD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAC1D,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,EAChC;QACE,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,UAAU,CACrC,iCAAiC,EACjC,OAAO,CACR;KACF,CACF,CAAA;IACD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAC9B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,CAC9C,CAAA;QACD,IAAI,CAAC,MAAM;YACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;QACnE,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAA;QAC3B,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAC5C,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AAC5B,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises'\nimport { type AtpAgent, COM_ATPROTO_MODERATION } from '@atproto/api'\nimport type { TestNetwork } from '../network.js'\n\nexport type AtmosphereFixture = {\n title: string\n collection: string\n uri: string\n cid: string\n eventId?: number\n reportId?: number\n queueId?: number\n}\n\nexport type AtmosphereSeed = {\n records: AtmosphereFixture[]\n queues: Record<string, number>\n}\n\n/** Seed synthetic third-party records, their dependencies, and queued Ozone reports. */\nexport async function seedAtmosphere(\n network: TestNetwork,\n agents: {\n author: AtpAgent\n photographer: AtpAgent\n streamer: AtpAgent\n reporter: AtpAgent\n },\n): Promise<AtmosphereSeed> {\n const { author, photographer, streamer, reporter } = agents\n const records: AtmosphereFixture[] = []\n const now = new Date().toISOString()\n const yesterday = new Date(Date.now() - 86_400_000).toISOString()\n const photos: [number, string, string, number, number, string][] = [\n [\n 0,\n 'Landscape photograph',\n 'key-landscape-small.jpg',\n 150,\n 87,\n 'A key in a landscape image.',\n ],\n [\n 1,\n 'Portrait photograph',\n 'key-portrait-small.jpg',\n 87,\n 150,\n 'A key in a portrait image.',\n ],\n [2, 'Photo without alt text', 'key-alt.jpg', 400, 400, ''],\n ]\n const put = async (\n agent: AtpAgent,\n collection: string,\n value: Record<string, unknown>,\n title: string,\n report = true,\n ) => {\n const record = { $type: collection, ...value }\n const { data } = await agent.com.atproto.repo.createRecord({\n repo: agent.assertDid,\n collection,\n record,\n })\n const saved = { uri: data.uri, cid: data.cid, value: record }\n if (report)\n records.push({ title, collection, uri: data.uri, cid: data.cid })\n return saved\n }\n const picture = async (agent: AtpAgent, filename: string) => {\n const image = await readFile(\n new URL(`../../assets/${filename}`, import.meta.url),\n )\n const { data } = await agent.com.atproto.repo.uploadBlob(image, {\n encoding: 'image/jpeg',\n })\n return data.blob\n }\n const cover = await picture(author, 'key-landscape-small.jpg')\n const icon = await picture(author, 'key-alt.jpg')\n const publication = await put(\n author,\n 'site.standard.publication',\n {\n name: 'Local journal — publication with icon',\n url: 'https://journal.example.test',\n description:\n 'A local Standard publication for reviewing article and publication cards.',\n icon,\n preferences: { showInDiscover: true },\n basicTheme: {\n $type: 'site.standard.theme.basic',\n background: {\n $type: 'site.standard.theme.color#rgb',\n r: 240,\n g: 249,\n b: 255,\n },\n foreground: {\n $type: 'site.standard.theme.color#rgb',\n r: 15,\n g: 23,\n b: 42,\n },\n accent: {\n $type: 'site.standard.theme.color#rgb',\n r: 37,\n g: 99,\n b: 235,\n },\n accentForeground: {\n $type: 'site.standard.theme.color#rgb',\n r: 255,\n g: 255,\n b: 255,\n },\n },\n },\n 'Publication with icon and description',\n )\n await put(\n author,\n 'site.standard.publication',\n { name: 'Minimal publication', url: 'https://minimal.example.test' },\n 'Minimal publication',\n )\n const post = await put(\n author,\n 'app.bsky.feed.post',\n {\n text: 'A new article from the Local journal. This post is linked from a Standard document fixture.',\n createdAt: now,\n },\n 'Article announcement post',\n false,\n )\n const article = await put(\n author,\n 'site.standard.document',\n {\n site: publication.uri,\n path: '/articles/complete-example',\n title: 'Complete article with publication and linked post',\n description:\n 'Check the cover image, publication link, tags, timestamps, and linked Bluesky post.',\n textContent:\n 'This article lives on the local PDS.\\n\\nThe publication and the linked post are real local records. You can inspect both the simple record and the AppView context.\\n\\nAll content is synthetic test data.',\n publishedAt: yesterday,\n updatedAt: now,\n coverImage: cover,\n tags: ['local', 'article', 'moderation'],\n bskyPostRef: { uri: post.uri, cid: post.cid },\n },\n 'Complete article',\n )\n await put(\n author,\n 'site.standard.document',\n {\n site: 'https://independent.example.test',\n path: '/standalone',\n title: 'Standalone article with HTTPS site',\n publishedAt: now,\n description: 'No publication record is needed for this document.',\n textContent:\n 'A standalone article whose source URL is formed directly from its HTTPS site and path.',\n },\n 'Standalone HTTPS article',\n )\n await put(\n author,\n 'site.standard.document',\n {\n site: publication.uri,\n path: '/structured',\n title: 'Structured article without plain text',\n publishedAt: now,\n description:\n 'Exercises the missing plaintext message and raw record view.',\n content: {\n $type: 'com.example.article.content',\n blocks: [\n {\n type: 'paragraph',\n text: 'Structured-only content is visible in the raw record.',\n },\n ],\n },\n },\n 'Structured-only article',\n )\n await put(\n author,\n 'site.standard.document',\n {\n site: `at://${author.assertDid}/site.standard.publication/2222222222222`,\n path: '/missing-publication',\n title: 'Article with unavailable publication',\n publishedAt: now,\n textContent:\n 'The document exists, but its referenced publication does not. The simple record should remain usable.',\n },\n 'Unavailable-publication article',\n )\n await put(\n author,\n 'site.standard.document',\n {\n site: publication.uri,\n path: '/long-read',\n title: 'Long article — scrolling and multiline text',\n publishedAt: now,\n description: 'An article with enough text to exercise bounded scrolling.',\n textContent: Array.from(\n { length: 32 },\n (_, i) =>\n `Paragraph ${i + 1}: This is synthetic local content for reviewing article cards, text wrapping, scrolling, and moderation details. The record is stored on the development PDS.`,\n ).join('\\n\\n'),\n coverImage: cover,\n tags: ['longread', 'local'],\n },\n 'Long article',\n )\n await put(\n author,\n 'site.standard.document',\n { site: publication.uri, title: 'Minimal article', publishedAt: now },\n 'Minimal article',\n )\n\n const gallery = await put(\n photographer,\n 'social.grain.gallery',\n {\n title: 'Local gallery — three photos',\n description:\n 'Three local photos with landscape, portrait, and missing-alt cases.',\n createdAt: now,\n },\n 'Gallery with three photos',\n )\n await put(\n photographer,\n 'social.grain.gallery',\n { title: 'Empty local gallery', createdAt: now },\n 'Empty gallery',\n )\n for (const [position, title, filename, width, height, alt] of photos) {\n const photo = await put(\n photographer,\n 'social.grain.photo',\n {\n photo: await picture(photographer, filename),\n alt: alt ?? '',\n aspectRatio: { width, height },\n createdAt: now,\n },\n title,\n )\n await put(\n photographer,\n 'social.grain.gallery.item',\n { gallery: gallery.uri, item: photo.uri, position, createdAt: now },\n 'Gallery item',\n false,\n )\n }\n const streamPost = await put(\n streamer,\n 'app.bsky.feed.post',\n {\n text: 'Announcing a synthetic local livestream for Ozone frontend testing.',\n createdAt: now,\n },\n 'Livestream announcement',\n false,\n )\n const thumb = await picture(streamer, 'key-landscape-small.jpg')\n await put(\n streamer,\n 'place.stream.livestream',\n {\n title: 'Local livestream with thumbnail and announcement',\n createdAt: now,\n lastSeenAt: now,\n canonicalUrl: 'https://stream.example.test/watch/local',\n url: 'https://stream.example.test/replicate/local',\n thumb,\n agent: 'LocalFixture/1.0',\n tags: ['local', 'lang:en'],\n post: { uri: streamPost.uri, cid: streamPost.cid },\n },\n 'Livestream with announcement',\n )\n await put(\n streamer,\n 'place.stream.livestream',\n {\n title: 'Ended local livestream',\n createdAt: yesterday,\n endedAt: now,\n canonicalUrl: 'https://stream.example.test/watch/ended',\n },\n 'Ended livestream',\n )\n await put(\n author,\n 'com.example.note',\n {\n title: 'Unknown record collection',\n text: 'This record exercises the generic JSON fallback.',\n createdAt: now,\n },\n 'Generic record fallback',\n )\n\n await put(\n reporter,\n 'site.standard.graph.recommend',\n { document: article.uri, createdAt: now },\n 'Article recommendation',\n false,\n )\n await put(\n reporter,\n 'site.standard.graph.subscription',\n { publication: publication.uri, createdAt: now },\n 'Publication subscription',\n false,\n )\n await put(\n reporter,\n 'social.grain.favorite',\n { subject: gallery.uri, createdAt: now },\n 'Gallery favorite',\n false,\n )\n await network.processAll()\n const ozone = network.ozone.getAgent()\n const queues: Record<string, number> = {}\n for (const collection of new Set(\n records.map((record) => record.collection),\n )) {\n const { data } = await ozone.tools.ozone.queue.createQueue(\n {\n name: `Atmosphere: ${collection}`,\n subjectTypes: ['record'],\n reportTypes: [COM_ATPROTO_MODERATION.DefsReasonOther],\n collection,\n },\n {\n encoding: 'application/json',\n headers: await network.ozone.modHeaders(\n 'tools.ozone.queue.createQueue',\n 'admin',\n ),\n },\n )\n queues[collection] = data.queue.id\n }\n for (const record of records) {\n const { data } = await reporter.com.atproto.moderation.createReport({\n reasonType: COM_ATPROTO_MODERATION.DefsReasonOther,\n reason: `Local frontend test: ${record.title}. Synthetic content for reviewing ${record.collection} rendering.`,\n subject: {\n $type: 'com.atproto.repo.strongRef',\n uri: record.uri,\n cid: record.cid,\n },\n })\n record.eventId = data.id\n }\n await network.ozone.daemon.ctx.queueRouter.routeReports()\n const { data } = await ozone.tools.ozone.report.queryReports(\n { status: 'queued', limit: 100 },\n {\n headers: await network.ozone.modHeaders(\n 'tools.ozone.report.queryReports',\n 'admin',\n ),\n },\n )\n for (const record of records) {\n const report = data.reports.find(\n (report) => report.eventId === record.eventId,\n )\n if (!report)\n throw new Error(`Fixture report was not queued: ${record.title}`)\n record.reportId = report.id\n record.queueId = queues[record.collection]\n }\n return { records, queues }\n}\n"]}
|
package/dist/seed/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export { default as repostsSeed } from './reposts.js';
|
|
|
7
7
|
export { default as usersBulkSeed } from './users-bulk.js';
|
|
8
8
|
export { default as usersSeed } from './users.js';
|
|
9
9
|
export { default as verificationsSeed } from './verifications.js';
|
|
10
|
+
export * from './atmosphere.js';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/seed/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/seed/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/seed/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEjE,cAAc,iBAAiB,CAAA"}
|
package/dist/seed/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { default as repostsSeed } from './reposts.js';
|
|
|
7
7
|
export { default as usersBulkSeed } from './users-bulk.js';
|
|
8
8
|
export { default as usersSeed } from './users.js';
|
|
9
9
|
export { default as verificationsSeed } from './verifications.js';
|
|
10
|
+
export * from './atmosphere.js';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/dist/seed/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/seed/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAA","sourcesContent":["export * from './client.js'\n\nexport { default as authorFeedSeed } from './author-feed.js'\nexport { default as basicSeed } from './basic.js'\nexport { default as followsSeed } from './follows.js'\nexport { default as quotesSeed } from './quotes.js'\nexport { default as repostsSeed } from './reposts.js'\nexport { default as usersBulkSeed } from './users-bulk.js'\nexport { default as usersSeed } from './users.js'\nexport { default as verificationsSeed } from './verifications.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/seed/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEjE,cAAc,iBAAiB,CAAA","sourcesContent":["export * from './client.js'\n\nexport { default as authorFeedSeed } from './author-feed.js'\nexport { default as basicSeed } from './basic.js'\nexport { default as followsSeed } from './follows.js'\nexport { default as quotesSeed } from './quotes.js'\nexport { default as repostsSeed } from './reposts.js'\nexport { default as usersBulkSeed } from './users-bulk.js'\nexport { default as usersSeed } from './users.js'\nexport { default as verificationsSeed } from './verifications.js'\n\nexport * from './atmosphere.js'\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/dev-env",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Local development environment helper for atproto development",
|
|
6
6
|
"keywords": [
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"./src",
|
|
17
|
+
"./assets",
|
|
17
18
|
"./tsconfig.json",
|
|
18
19
|
"./tsconfig.build.json",
|
|
19
20
|
"./dist",
|
|
@@ -34,20 +35,20 @@
|
|
|
34
35
|
"node": ">=22"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@atproto/api": "^0.
|
|
38
|
-
"@atproto/bsky": "^0.5.
|
|
39
|
-
"@atproto/bsync": "^0.1.
|
|
38
|
+
"@atproto/api": "^0.31.0",
|
|
39
|
+
"@atproto/bsky": "^0.5.6",
|
|
40
|
+
"@atproto/bsync": "^0.1.9",
|
|
40
41
|
"@atproto/common-web": "^0.5.17",
|
|
41
42
|
"@atproto/crypto": "^0.5.7",
|
|
42
43
|
"@atproto/identity": "^0.5.23",
|
|
43
44
|
"@atproto/lex-client": "^0.4.2",
|
|
44
45
|
"@atproto/lex-schema": "^0.2.11",
|
|
45
46
|
"@atproto/lexicon": "^0.7.19",
|
|
46
|
-
"@atproto/ozone": "^0.
|
|
47
|
-
"@atproto/pds": "^0.5.
|
|
48
|
-
"@atproto/sync": "^0.4.
|
|
47
|
+
"@atproto/ozone": "^0.14.0",
|
|
48
|
+
"@atproto/pds": "^0.5.57",
|
|
49
|
+
"@atproto/sync": "^0.4.25",
|
|
49
50
|
"@atproto/syntax": "^0.7.7",
|
|
50
|
-
"@atproto/xrpc-server": "^0.13.
|
|
51
|
+
"@atproto/xrpc-server": "^0.13.11",
|
|
51
52
|
"@did-plc/lib": "^0.0.1",
|
|
52
53
|
"@did-plc/server": "^0.0.1",
|
|
53
54
|
"express": "^4.18.2",
|
package/src/bin.ts
CHANGED
package/src/mock/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
import type { Database } from '@atproto/bsky'
|
|
7
7
|
import { AtUri, type AtUriString } from '@atproto/syntax'
|
|
8
8
|
import { EXAMPLE_LABELER, RecordRef, type TestNetwork } from '../index.js'
|
|
9
|
+
import { seedAtmosphere } from '../seed/atmosphere.js'
|
|
9
10
|
import { postTexts, replyTexts } from './data.js'
|
|
10
11
|
import blurHashB64 from './img/blur-hash-avatar-b64.js'
|
|
11
12
|
import labeledImgB64 from './img/labeled-img-b64.js'
|
|
@@ -677,6 +678,20 @@ export async function generateMockSetup(env: TestNetwork) {
|
|
|
677
678
|
|
|
678
679
|
await setVerifier(env.bsky.db, alice.assertDid)
|
|
679
680
|
|
|
681
|
+
const atmosphere = await seedAtmosphere(env, {
|
|
682
|
+
author: alice,
|
|
683
|
+
photographer: bob,
|
|
684
|
+
streamer: carla,
|
|
685
|
+
reporter: triage,
|
|
686
|
+
})
|
|
687
|
+
console.table(
|
|
688
|
+
atmosphere.records.map(({ title, reportId, uri }) => ({
|
|
689
|
+
fixture: title,
|
|
690
|
+
reportId,
|
|
691
|
+
uri,
|
|
692
|
+
})),
|
|
693
|
+
)
|
|
694
|
+
|
|
680
695
|
// @TODO These are useful when testing complex threads, but don't need to be enabled all the time. We could make it configurable.
|
|
681
696
|
// import * as seedThreadV2 from '../seed/thread-v2.js'
|
|
682
697
|
// const sc = env.getSeedClient()
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises'
|
|
2
|
+
import { type AtpAgent, COM_ATPROTO_MODERATION } from '@atproto/api'
|
|
3
|
+
import type { TestNetwork } from '../network.js'
|
|
4
|
+
|
|
5
|
+
export type AtmosphereFixture = {
|
|
6
|
+
title: string
|
|
7
|
+
collection: string
|
|
8
|
+
uri: string
|
|
9
|
+
cid: string
|
|
10
|
+
eventId?: number
|
|
11
|
+
reportId?: number
|
|
12
|
+
queueId?: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type AtmosphereSeed = {
|
|
16
|
+
records: AtmosphereFixture[]
|
|
17
|
+
queues: Record<string, number>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Seed synthetic third-party records, their dependencies, and queued Ozone reports. */
|
|
21
|
+
export async function seedAtmosphere(
|
|
22
|
+
network: TestNetwork,
|
|
23
|
+
agents: {
|
|
24
|
+
author: AtpAgent
|
|
25
|
+
photographer: AtpAgent
|
|
26
|
+
streamer: AtpAgent
|
|
27
|
+
reporter: AtpAgent
|
|
28
|
+
},
|
|
29
|
+
): Promise<AtmosphereSeed> {
|
|
30
|
+
const { author, photographer, streamer, reporter } = agents
|
|
31
|
+
const records: AtmosphereFixture[] = []
|
|
32
|
+
const now = new Date().toISOString()
|
|
33
|
+
const yesterday = new Date(Date.now() - 86_400_000).toISOString()
|
|
34
|
+
const photos: [number, string, string, number, number, string][] = [
|
|
35
|
+
[
|
|
36
|
+
0,
|
|
37
|
+
'Landscape photograph',
|
|
38
|
+
'key-landscape-small.jpg',
|
|
39
|
+
150,
|
|
40
|
+
87,
|
|
41
|
+
'A key in a landscape image.',
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
1,
|
|
45
|
+
'Portrait photograph',
|
|
46
|
+
'key-portrait-small.jpg',
|
|
47
|
+
87,
|
|
48
|
+
150,
|
|
49
|
+
'A key in a portrait image.',
|
|
50
|
+
],
|
|
51
|
+
[2, 'Photo without alt text', 'key-alt.jpg', 400, 400, ''],
|
|
52
|
+
]
|
|
53
|
+
const put = async (
|
|
54
|
+
agent: AtpAgent,
|
|
55
|
+
collection: string,
|
|
56
|
+
value: Record<string, unknown>,
|
|
57
|
+
title: string,
|
|
58
|
+
report = true,
|
|
59
|
+
) => {
|
|
60
|
+
const record = { $type: collection, ...value }
|
|
61
|
+
const { data } = await agent.com.atproto.repo.createRecord({
|
|
62
|
+
repo: agent.assertDid,
|
|
63
|
+
collection,
|
|
64
|
+
record,
|
|
65
|
+
})
|
|
66
|
+
const saved = { uri: data.uri, cid: data.cid, value: record }
|
|
67
|
+
if (report)
|
|
68
|
+
records.push({ title, collection, uri: data.uri, cid: data.cid })
|
|
69
|
+
return saved
|
|
70
|
+
}
|
|
71
|
+
const picture = async (agent: AtpAgent, filename: string) => {
|
|
72
|
+
const image = await readFile(
|
|
73
|
+
new URL(`../../assets/${filename}`, import.meta.url),
|
|
74
|
+
)
|
|
75
|
+
const { data } = await agent.com.atproto.repo.uploadBlob(image, {
|
|
76
|
+
encoding: 'image/jpeg',
|
|
77
|
+
})
|
|
78
|
+
return data.blob
|
|
79
|
+
}
|
|
80
|
+
const cover = await picture(author, 'key-landscape-small.jpg')
|
|
81
|
+
const icon = await picture(author, 'key-alt.jpg')
|
|
82
|
+
const publication = await put(
|
|
83
|
+
author,
|
|
84
|
+
'site.standard.publication',
|
|
85
|
+
{
|
|
86
|
+
name: 'Local journal — publication with icon',
|
|
87
|
+
url: 'https://journal.example.test',
|
|
88
|
+
description:
|
|
89
|
+
'A local Standard publication for reviewing article and publication cards.',
|
|
90
|
+
icon,
|
|
91
|
+
preferences: { showInDiscover: true },
|
|
92
|
+
basicTheme: {
|
|
93
|
+
$type: 'site.standard.theme.basic',
|
|
94
|
+
background: {
|
|
95
|
+
$type: 'site.standard.theme.color#rgb',
|
|
96
|
+
r: 240,
|
|
97
|
+
g: 249,
|
|
98
|
+
b: 255,
|
|
99
|
+
},
|
|
100
|
+
foreground: {
|
|
101
|
+
$type: 'site.standard.theme.color#rgb',
|
|
102
|
+
r: 15,
|
|
103
|
+
g: 23,
|
|
104
|
+
b: 42,
|
|
105
|
+
},
|
|
106
|
+
accent: {
|
|
107
|
+
$type: 'site.standard.theme.color#rgb',
|
|
108
|
+
r: 37,
|
|
109
|
+
g: 99,
|
|
110
|
+
b: 235,
|
|
111
|
+
},
|
|
112
|
+
accentForeground: {
|
|
113
|
+
$type: 'site.standard.theme.color#rgb',
|
|
114
|
+
r: 255,
|
|
115
|
+
g: 255,
|
|
116
|
+
b: 255,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
'Publication with icon and description',
|
|
121
|
+
)
|
|
122
|
+
await put(
|
|
123
|
+
author,
|
|
124
|
+
'site.standard.publication',
|
|
125
|
+
{ name: 'Minimal publication', url: 'https://minimal.example.test' },
|
|
126
|
+
'Minimal publication',
|
|
127
|
+
)
|
|
128
|
+
const post = await put(
|
|
129
|
+
author,
|
|
130
|
+
'app.bsky.feed.post',
|
|
131
|
+
{
|
|
132
|
+
text: 'A new article from the Local journal. This post is linked from a Standard document fixture.',
|
|
133
|
+
createdAt: now,
|
|
134
|
+
},
|
|
135
|
+
'Article announcement post',
|
|
136
|
+
false,
|
|
137
|
+
)
|
|
138
|
+
const article = await put(
|
|
139
|
+
author,
|
|
140
|
+
'site.standard.document',
|
|
141
|
+
{
|
|
142
|
+
site: publication.uri,
|
|
143
|
+
path: '/articles/complete-example',
|
|
144
|
+
title: 'Complete article with publication and linked post',
|
|
145
|
+
description:
|
|
146
|
+
'Check the cover image, publication link, tags, timestamps, and linked Bluesky post.',
|
|
147
|
+
textContent:
|
|
148
|
+
'This article lives on the local PDS.\n\nThe publication and the linked post are real local records. You can inspect both the simple record and the AppView context.\n\nAll content is synthetic test data.',
|
|
149
|
+
publishedAt: yesterday,
|
|
150
|
+
updatedAt: now,
|
|
151
|
+
coverImage: cover,
|
|
152
|
+
tags: ['local', 'article', 'moderation'],
|
|
153
|
+
bskyPostRef: { uri: post.uri, cid: post.cid },
|
|
154
|
+
},
|
|
155
|
+
'Complete article',
|
|
156
|
+
)
|
|
157
|
+
await put(
|
|
158
|
+
author,
|
|
159
|
+
'site.standard.document',
|
|
160
|
+
{
|
|
161
|
+
site: 'https://independent.example.test',
|
|
162
|
+
path: '/standalone',
|
|
163
|
+
title: 'Standalone article with HTTPS site',
|
|
164
|
+
publishedAt: now,
|
|
165
|
+
description: 'No publication record is needed for this document.',
|
|
166
|
+
textContent:
|
|
167
|
+
'A standalone article whose source URL is formed directly from its HTTPS site and path.',
|
|
168
|
+
},
|
|
169
|
+
'Standalone HTTPS article',
|
|
170
|
+
)
|
|
171
|
+
await put(
|
|
172
|
+
author,
|
|
173
|
+
'site.standard.document',
|
|
174
|
+
{
|
|
175
|
+
site: publication.uri,
|
|
176
|
+
path: '/structured',
|
|
177
|
+
title: 'Structured article without plain text',
|
|
178
|
+
publishedAt: now,
|
|
179
|
+
description:
|
|
180
|
+
'Exercises the missing plaintext message and raw record view.',
|
|
181
|
+
content: {
|
|
182
|
+
$type: 'com.example.article.content',
|
|
183
|
+
blocks: [
|
|
184
|
+
{
|
|
185
|
+
type: 'paragraph',
|
|
186
|
+
text: 'Structured-only content is visible in the raw record.',
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
'Structured-only article',
|
|
192
|
+
)
|
|
193
|
+
await put(
|
|
194
|
+
author,
|
|
195
|
+
'site.standard.document',
|
|
196
|
+
{
|
|
197
|
+
site: `at://${author.assertDid}/site.standard.publication/2222222222222`,
|
|
198
|
+
path: '/missing-publication',
|
|
199
|
+
title: 'Article with unavailable publication',
|
|
200
|
+
publishedAt: now,
|
|
201
|
+
textContent:
|
|
202
|
+
'The document exists, but its referenced publication does not. The simple record should remain usable.',
|
|
203
|
+
},
|
|
204
|
+
'Unavailable-publication article',
|
|
205
|
+
)
|
|
206
|
+
await put(
|
|
207
|
+
author,
|
|
208
|
+
'site.standard.document',
|
|
209
|
+
{
|
|
210
|
+
site: publication.uri,
|
|
211
|
+
path: '/long-read',
|
|
212
|
+
title: 'Long article — scrolling and multiline text',
|
|
213
|
+
publishedAt: now,
|
|
214
|
+
description: 'An article with enough text to exercise bounded scrolling.',
|
|
215
|
+
textContent: Array.from(
|
|
216
|
+
{ length: 32 },
|
|
217
|
+
(_, i) =>
|
|
218
|
+
`Paragraph ${i + 1}: This is synthetic local content for reviewing article cards, text wrapping, scrolling, and moderation details. The record is stored on the development PDS.`,
|
|
219
|
+
).join('\n\n'),
|
|
220
|
+
coverImage: cover,
|
|
221
|
+
tags: ['longread', 'local'],
|
|
222
|
+
},
|
|
223
|
+
'Long article',
|
|
224
|
+
)
|
|
225
|
+
await put(
|
|
226
|
+
author,
|
|
227
|
+
'site.standard.document',
|
|
228
|
+
{ site: publication.uri, title: 'Minimal article', publishedAt: now },
|
|
229
|
+
'Minimal article',
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
const gallery = await put(
|
|
233
|
+
photographer,
|
|
234
|
+
'social.grain.gallery',
|
|
235
|
+
{
|
|
236
|
+
title: 'Local gallery — three photos',
|
|
237
|
+
description:
|
|
238
|
+
'Three local photos with landscape, portrait, and missing-alt cases.',
|
|
239
|
+
createdAt: now,
|
|
240
|
+
},
|
|
241
|
+
'Gallery with three photos',
|
|
242
|
+
)
|
|
243
|
+
await put(
|
|
244
|
+
photographer,
|
|
245
|
+
'social.grain.gallery',
|
|
246
|
+
{ title: 'Empty local gallery', createdAt: now },
|
|
247
|
+
'Empty gallery',
|
|
248
|
+
)
|
|
249
|
+
for (const [position, title, filename, width, height, alt] of photos) {
|
|
250
|
+
const photo = await put(
|
|
251
|
+
photographer,
|
|
252
|
+
'social.grain.photo',
|
|
253
|
+
{
|
|
254
|
+
photo: await picture(photographer, filename),
|
|
255
|
+
alt: alt ?? '',
|
|
256
|
+
aspectRatio: { width, height },
|
|
257
|
+
createdAt: now,
|
|
258
|
+
},
|
|
259
|
+
title,
|
|
260
|
+
)
|
|
261
|
+
await put(
|
|
262
|
+
photographer,
|
|
263
|
+
'social.grain.gallery.item',
|
|
264
|
+
{ gallery: gallery.uri, item: photo.uri, position, createdAt: now },
|
|
265
|
+
'Gallery item',
|
|
266
|
+
false,
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
const streamPost = await put(
|
|
270
|
+
streamer,
|
|
271
|
+
'app.bsky.feed.post',
|
|
272
|
+
{
|
|
273
|
+
text: 'Announcing a synthetic local livestream for Ozone frontend testing.',
|
|
274
|
+
createdAt: now,
|
|
275
|
+
},
|
|
276
|
+
'Livestream announcement',
|
|
277
|
+
false,
|
|
278
|
+
)
|
|
279
|
+
const thumb = await picture(streamer, 'key-landscape-small.jpg')
|
|
280
|
+
await put(
|
|
281
|
+
streamer,
|
|
282
|
+
'place.stream.livestream',
|
|
283
|
+
{
|
|
284
|
+
title: 'Local livestream with thumbnail and announcement',
|
|
285
|
+
createdAt: now,
|
|
286
|
+
lastSeenAt: now,
|
|
287
|
+
canonicalUrl: 'https://stream.example.test/watch/local',
|
|
288
|
+
url: 'https://stream.example.test/replicate/local',
|
|
289
|
+
thumb,
|
|
290
|
+
agent: 'LocalFixture/1.0',
|
|
291
|
+
tags: ['local', 'lang:en'],
|
|
292
|
+
post: { uri: streamPost.uri, cid: streamPost.cid },
|
|
293
|
+
},
|
|
294
|
+
'Livestream with announcement',
|
|
295
|
+
)
|
|
296
|
+
await put(
|
|
297
|
+
streamer,
|
|
298
|
+
'place.stream.livestream',
|
|
299
|
+
{
|
|
300
|
+
title: 'Ended local livestream',
|
|
301
|
+
createdAt: yesterday,
|
|
302
|
+
endedAt: now,
|
|
303
|
+
canonicalUrl: 'https://stream.example.test/watch/ended',
|
|
304
|
+
},
|
|
305
|
+
'Ended livestream',
|
|
306
|
+
)
|
|
307
|
+
await put(
|
|
308
|
+
author,
|
|
309
|
+
'com.example.note',
|
|
310
|
+
{
|
|
311
|
+
title: 'Unknown record collection',
|
|
312
|
+
text: 'This record exercises the generic JSON fallback.',
|
|
313
|
+
createdAt: now,
|
|
314
|
+
},
|
|
315
|
+
'Generic record fallback',
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
await put(
|
|
319
|
+
reporter,
|
|
320
|
+
'site.standard.graph.recommend',
|
|
321
|
+
{ document: article.uri, createdAt: now },
|
|
322
|
+
'Article recommendation',
|
|
323
|
+
false,
|
|
324
|
+
)
|
|
325
|
+
await put(
|
|
326
|
+
reporter,
|
|
327
|
+
'site.standard.graph.subscription',
|
|
328
|
+
{ publication: publication.uri, createdAt: now },
|
|
329
|
+
'Publication subscription',
|
|
330
|
+
false,
|
|
331
|
+
)
|
|
332
|
+
await put(
|
|
333
|
+
reporter,
|
|
334
|
+
'social.grain.favorite',
|
|
335
|
+
{ subject: gallery.uri, createdAt: now },
|
|
336
|
+
'Gallery favorite',
|
|
337
|
+
false,
|
|
338
|
+
)
|
|
339
|
+
await network.processAll()
|
|
340
|
+
const ozone = network.ozone.getAgent()
|
|
341
|
+
const queues: Record<string, number> = {}
|
|
342
|
+
for (const collection of new Set(
|
|
343
|
+
records.map((record) => record.collection),
|
|
344
|
+
)) {
|
|
345
|
+
const { data } = await ozone.tools.ozone.queue.createQueue(
|
|
346
|
+
{
|
|
347
|
+
name: `Atmosphere: ${collection}`,
|
|
348
|
+
subjectTypes: ['record'],
|
|
349
|
+
reportTypes: [COM_ATPROTO_MODERATION.DefsReasonOther],
|
|
350
|
+
collection,
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
encoding: 'application/json',
|
|
354
|
+
headers: await network.ozone.modHeaders(
|
|
355
|
+
'tools.ozone.queue.createQueue',
|
|
356
|
+
'admin',
|
|
357
|
+
),
|
|
358
|
+
},
|
|
359
|
+
)
|
|
360
|
+
queues[collection] = data.queue.id
|
|
361
|
+
}
|
|
362
|
+
for (const record of records) {
|
|
363
|
+
const { data } = await reporter.com.atproto.moderation.createReport({
|
|
364
|
+
reasonType: COM_ATPROTO_MODERATION.DefsReasonOther,
|
|
365
|
+
reason: `Local frontend test: ${record.title}. Synthetic content for reviewing ${record.collection} rendering.`,
|
|
366
|
+
subject: {
|
|
367
|
+
$type: 'com.atproto.repo.strongRef',
|
|
368
|
+
uri: record.uri,
|
|
369
|
+
cid: record.cid,
|
|
370
|
+
},
|
|
371
|
+
})
|
|
372
|
+
record.eventId = data.id
|
|
373
|
+
}
|
|
374
|
+
await network.ozone.daemon.ctx.queueRouter.routeReports()
|
|
375
|
+
const { data } = await ozone.tools.ozone.report.queryReports(
|
|
376
|
+
{ status: 'queued', limit: 100 },
|
|
377
|
+
{
|
|
378
|
+
headers: await network.ozone.modHeaders(
|
|
379
|
+
'tools.ozone.report.queryReports',
|
|
380
|
+
'admin',
|
|
381
|
+
),
|
|
382
|
+
},
|
|
383
|
+
)
|
|
384
|
+
for (const record of records) {
|
|
385
|
+
const report = data.reports.find(
|
|
386
|
+
(report) => report.eventId === record.eventId,
|
|
387
|
+
)
|
|
388
|
+
if (!report)
|
|
389
|
+
throw new Error(`Fixture report was not queued: ${record.title}`)
|
|
390
|
+
record.reportId = report.id
|
|
391
|
+
record.queueId = queues[record.collection]
|
|
392
|
+
}
|
|
393
|
+
return { records, queues }
|
|
394
|
+
}
|
package/src/seed/index.ts
CHANGED
|
@@ -8,3 +8,5 @@ export { default as repostsSeed } from './reposts.js'
|
|
|
8
8
|
export { default as usersBulkSeed } from './users-bulk.js'
|
|
9
9
|
export { default as usersSeed } from './users.js'
|
|
10
10
|
export { default as verificationsSeed } from './verifications.js'
|
|
11
|
+
|
|
12
|
+
export * from './atmosphere.js'
|