@atproto/dev-env 0.3.215 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/bin.js +12 -0
  3. package/dist/bin.js +0 -0
  4. package/dist/bsky.d.ts +3 -1
  5. package/dist/bsky.d.ts.map +1 -1
  6. package/dist/bsky.js +7 -1
  7. package/dist/bsky.js.map +1 -1
  8. package/dist/feed-gen.d.ts.map +1 -1
  9. package/dist/feed-gen.js +7 -10
  10. package/dist/feed-gen.js.map +1 -1
  11. package/dist/mock/index.js +5 -5
  12. package/dist/mock/index.js.map +1 -1
  13. package/dist/moderator-client.js +1 -1
  14. package/dist/moderator-client.js.map +1 -1
  15. package/dist/network-no-appview.d.ts.map +1 -1
  16. package/dist/network-no-appview.js +3 -2
  17. package/dist/network-no-appview.js.map +1 -1
  18. package/dist/ozone.d.ts +1 -1
  19. package/dist/ozone.d.ts.map +1 -1
  20. package/dist/ozone.js +1 -1
  21. package/dist/ozone.js.map +1 -1
  22. package/dist/pds.d.ts +3 -1
  23. package/dist/pds.d.ts.map +1 -1
  24. package/dist/pds.js +7 -1
  25. package/dist/pds.js.map +1 -1
  26. package/dist/seed/client.d.ts +11 -9
  27. package/dist/seed/client.d.ts.map +1 -1
  28. package/dist/seed/client.js +10 -2
  29. package/dist/seed/client.js.map +1 -1
  30. package/dist/service-profile-lexicon.js +5 -5
  31. package/dist/service-profile-lexicon.js.map +1 -1
  32. package/dist/service-profile-ozone.d.ts +1 -1
  33. package/dist/service-profile-ozone.d.ts.map +1 -1
  34. package/dist/service-profile-ozone.js +8 -8
  35. package/dist/service-profile-ozone.js.map +1 -1
  36. package/dist/service-profile.d.ts +4 -3
  37. package/dist/service-profile.d.ts.map +1 -1
  38. package/dist/service-profile.js +16 -16
  39. package/dist/service-profile.js.map +1 -1
  40. package/package.json +10 -9
  41. package/src/bsky.ts +8 -1
  42. package/src/feed-gen.ts +17 -16
  43. package/src/mock/index.ts +10 -10
  44. package/src/moderator-client.ts +1 -1
  45. package/src/network-no-appview.ts +3 -2
  46. package/src/ozone.ts +1 -1
  47. package/src/pds.ts +8 -1
  48. package/src/seed/client.ts +11 -7
  49. package/src/service-profile-lexicon.ts +5 -5
  50. package/src/service-profile-ozone.ts +8 -8
  51. package/src/service-profile.ts +16 -15
@@ -1 +1 @@
1
- {"version":3,"file":"service-profile-ozone.js","sourceRoot":"","sources":["../src/service-profile-ozone.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAElD,uDAI0B;AAE1B,MAAa,mBAAoB,SAAQ,gCAAc;IACrD,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,GAAY,EACZ,QAAgB,EAChB,WAAW,GAAG;QACZ,KAAK,EAAE,wBAAwB;QAC/B,MAAM,EAAE,oBAAoB;QAC5B,QAAQ,EAAE,SAAS;KACpB;QAED,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,EAAE,CAAA;QAC9B,MAAM,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;QAEvC,MAAM,GAAG,GAAG,MAAM,yBAAgB,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;QAE/D,OAAO,IAAI,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;IACzE,CAAC;IAED,YACE,GAAY,EACZ,MAAgB,EAChB,WAA+B,EACtB,QAAgB,EAChB,GAAqB;QAE9B,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;QAH/B;;;;mBAAS,QAAQ;WAAQ;QACzB;;;;mBAAS,GAAG;WAAkB;IAGhC,CAAC;IAED,KAAK,CAAC,gCAAgC;QACpC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;YAC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tB,SAAS,EAAE,KAAK;wBAChB,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,IAAI;gCACV,IAAI,EAAE,WAAW;gCACjB,WAAW,EACT,+GAA+G;6BAClH;yBACF;qBACF;oBACD;wBACE,UAAU,EAAE,oBAAoB;wBAChC,KAAK,EAAE,SAAS;wBAChB,QAAQ,EAAE,OAAO;wBACjB,cAAc,EAAE,MAAM;wBACtB,SAAS,EAAE,KAAK;wBAChB,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,IAAI;gCACV,IAAI,EAAE,oBAAoB;gCAC1B,WAAW,EACT,6GAA6G;6BAChH;yBACF;qBACF;oBACD;wBACE,UAAU,EAAE,aAAa;wBACzB,KAAK,EAAE,SAAS;wBAChB,QAAQ,EAAE,OAAO;wBACjB,cAAc,EAAE,MAAM;wBACtB,SAAS,EAAE,KAAK;wBAChB,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,IAAI;gCACV,IAAI,EAAE,qBAAqB;gCAC3B,WAAW,EAAE,gDAAgD;6BAC9D;yBACF;qBACF;oBACD;wBACE,UAAU,EAAE,mBAAmB;wBAC/B,KAAK,EAAE,OAAO;wBACd,QAAQ,EAAE,MAAM;wBAChB,cAAc,EAAE,MAAM;wBACtB,SAAS,EAAE,IAAI;wBACf,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,IAAI;gCACV,IAAI,EAAE,+BAA+B;gCACrC,WAAW,EACT,iGAAiG;6BACpG;yBACF;qBACF;iBACF;aACF;YACD,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CACF,CAAA;IACH,CAAC;CACF;AA7WD,kDA6WC","sourcesContent":["import { AtpAgent } from '@atproto/api'\nimport { Secp256k1Keypair } from '@atproto/crypto'\nimport { TestPds } from './pds'\nimport {\n ServiceMigrationOptions,\n ServiceProfile,\n ServiceUserDetails,\n} from './service-profile'\n\nexport class OzoneServiceProfile extends ServiceProfile {\n static async create(\n pds: TestPds,\n ozoneUrl: string,\n userDetails = {\n email: 'mod-authority@test.com',\n handle: 'mod-authority.test',\n password: 'hunter2',\n },\n ) {\n const client = pds.getClient()\n await client.createAccount(userDetails)\n\n const key = await Secp256k1Keypair.create({ exportable: true })\n\n return new OzoneServiceProfile(pds, client, userDetails, ozoneUrl, key)\n }\n\n protected constructor(\n pds: TestPds,\n client: AtpAgent,\n userDetails: ServiceUserDetails,\n readonly ozoneUrl: string,\n readonly key: Secp256k1Keypair,\n ) {\n super(pds, client, userDetails)\n }\n\n async createAppPasswordForVerification() {\n const { data } = await this.client.com.atproto.server.createAppPassword({\n name: 'ozone-verifier',\n })\n return data.password\n }\n\n async migrateTo(pds: TestPds, options: ServiceMigrationOptions = {}) {\n await super.migrateTo(pds, {\n ...options,\n services: {\n ...options.services,\n atproto_labeler: {\n type: 'AtprotoLabeler',\n endpoint: this.ozoneUrl,\n },\n },\n verificationMethods: {\n ...options.verificationMethods,\n atproto_label: this.key.did(),\n },\n })\n }\n\n async createRecords() {\n await this.client.app.bsky.actor.profile.create(\n { repo: this.did },\n {\n displayName: 'Dev-env Moderation',\n description: `The pretend version of mod.bsky.app`,\n },\n )\n\n await this.client.app.bsky.labeler.service.create(\n { repo: this.did, rkey: 'self' },\n {\n policies: {\n labelValues: [\n '!hide',\n '!warn',\n 'porn',\n 'sexual',\n 'nudity',\n 'sexual-figurative',\n 'graphic-media',\n 'self-harm',\n 'sensitive',\n 'extremist',\n 'intolerant',\n 'threat',\n 'rude',\n 'illicit',\n 'security',\n 'unsafe-link',\n 'impersonation',\n 'misinformation',\n 'scam',\n 'engagement-farming',\n 'spam',\n 'rumor',\n 'misleading',\n 'inauthentic',\n ],\n labelValueDefinitions: [\n {\n identifier: 'spam',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Spam',\n description:\n 'Unwanted, repeated, or unrelated actions that bother users.',\n },\n ],\n },\n {\n identifier: 'impersonation',\n blurs: 'none',\n severity: 'inform',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Impersonation',\n description:\n 'Pretending to be someone else without permission.',\n },\n ],\n },\n {\n identifier: 'scam',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Scam',\n description: 'Scams, phishing & fraud.',\n },\n ],\n },\n {\n identifier: 'intolerant',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Intolerance',\n description: 'Discrimination against protected groups.',\n },\n ],\n },\n {\n identifier: 'self-harm',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Self-Harm',\n description:\n 'Promotes self-harm, including graphic images, glorifying discussions, or triggering stories.',\n },\n ],\n },\n {\n identifier: 'security',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Security Concerns',\n description:\n 'May be unsafe and could harm your device, steal your info, or get your account hacked.',\n },\n ],\n },\n {\n identifier: 'misleading',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Misleading',\n description:\n 'Altered images/videos, deceptive links, or false statements.',\n },\n ],\n },\n {\n identifier: 'threat',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Threats',\n description:\n 'Promotes violence or harm towards others, including threats, incitement, or advocacy of harm.',\n },\n ],\n },\n {\n identifier: 'unsafe-link',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Unsafe link',\n description:\n 'Links to harmful sites with malware, phishing, or violating content that risk security and privacy.',\n },\n ],\n },\n {\n identifier: 'illicit',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Illicit',\n description:\n 'Promoting or selling potentially illicit goods, services, or activities.',\n },\n ],\n },\n {\n identifier: 'misinformation',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Misinformation',\n description:\n 'Spreading false or misleading info, including unverified claims and harmful conspiracy theories.',\n },\n ],\n },\n {\n identifier: 'rumor',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Rumor',\n description:\n 'Approach with caution, as these claims lack evidence from credible sources.',\n },\n ],\n },\n {\n identifier: 'rude',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Rude',\n description:\n 'Rude or impolite, including crude language and disrespectful comments, without constructive purpose.',\n },\n ],\n },\n {\n identifier: 'extremist',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Extremist',\n description:\n 'Radical views advocating violence, hate, or discrimination against individuals or groups.',\n },\n ],\n },\n {\n identifier: 'sensitive',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Sensitive',\n description:\n 'May be upsetting, covering topics like substance abuse or mental health issues, cautioning sensitive viewers.',\n },\n ],\n },\n {\n identifier: 'engagement-farming',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Engagement Farming',\n description:\n 'Insincere content or bulk actions aimed at gaining followers, including frequent follows, posts, and likes.',\n },\n ],\n },\n {\n identifier: 'inauthentic',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Inauthentic Account',\n description: 'Bot or a person pretending to be someone else.',\n },\n ],\n },\n {\n identifier: 'sexual-figurative',\n blurs: 'media',\n severity: 'none',\n defaultSetting: 'show',\n adultOnly: true,\n locales: [\n {\n lang: 'en',\n name: 'Sexually Suggestive (Cartoon)',\n description:\n 'Art with explicit or suggestive sexual themes, including provocative imagery or partial nudity.',\n },\n ],\n },\n ],\n },\n createdAt: new Date().toISOString(),\n },\n )\n }\n}\n"]}
1
+ {"version":3,"file":"service-profile-ozone.js","sourceRoot":"","sources":["../src/service-profile-ozone.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAElD,uDAI0B;AAE1B,MAAa,mBAAoB,SAAQ,gCAAc;IACrD,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,GAAY,EACZ,QAAgB,EAChB,WAAW,GAAG;QACZ,KAAK,EAAE,wBAAwB;QAC/B,MAAM,EAAE,oBAAoB;QAC5B,QAAQ,EAAE,SAAS;KACpB;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAA;QAC5B,MAAM,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;QAEtC,MAAM,GAAG,GAAG,MAAM,yBAAgB,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;QAE/D,OAAO,IAAI,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;IACxE,CAAC;IAED,YACE,GAAY,EACZ,KAAe,EACf,WAA+B,EACtB,QAAgB,EAChB,GAAqB;QAE9B,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,CAAA;QAH9B;;;;mBAAS,QAAQ;WAAQ;QACzB;;;;mBAAS,GAAG;WAAkB;IAGhC,CAAC;IAED,KAAK,CAAC,gCAAgC;QACpC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC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c,EAAE,MAAM;wBACtB,SAAS,EAAE,KAAK;wBAChB,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,IAAI;gCACV,IAAI,EAAE,WAAW;gCACjB,WAAW,EACT,+GAA+G;6BAClH;yBACF;qBACF;oBACD;wBACE,UAAU,EAAE,oBAAoB;wBAChC,KAAK,EAAE,SAAS;wBAChB,QAAQ,EAAE,OAAO;wBACjB,cAAc,EAAE,MAAM;wBACtB,SAAS,EAAE,KAAK;wBAChB,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,IAAI;gCACV,IAAI,EAAE,oBAAoB;gCAC1B,WAAW,EACT,6GAA6G;6BAChH;yBACF;qBACF;oBACD;wBACE,UAAU,EAAE,aAAa;wBACzB,KAAK,EAAE,SAAS;wBAChB,QAAQ,EAAE,OAAO;wBACjB,cAAc,EAAE,MAAM;wBACtB,SAAS,EAAE,KAAK;wBAChB,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,IAAI;gCACV,IAAI,EAAE,qBAAqB;gCAC3B,WAAW,EAAE,gDAAgD;6BAC9D;yBACF;qBACF;oBACD;wBACE,UAAU,EAAE,mBAAmB;wBAC/B,KAAK,EAAE,OAAO;wBACd,QAAQ,EAAE,MAAM;wBAChB,cAAc,EAAE,MAAM;wBACtB,SAAS,EAAE,IAAI;wBACf,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,IAAI;gCACV,IAAI,EAAE,+BAA+B;gCACrC,WAAW,EACT,iGAAiG;6BACpG;yBACF;qBACF;iBACF;aACF;YACD,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CACF,CAAA;IACH,CAAC;CACF;AA7WD,kDA6WC","sourcesContent":["import { AtpAgent } from '@atproto/api'\nimport { Secp256k1Keypair } from '@atproto/crypto'\nimport { TestPds } from './pds'\nimport {\n ServiceMigrationOptions,\n ServiceProfile,\n ServiceUserDetails,\n} from './service-profile'\n\nexport class OzoneServiceProfile extends ServiceProfile {\n static async create(\n pds: TestPds,\n ozoneUrl: string,\n userDetails = {\n email: 'mod-authority@test.com',\n handle: 'mod-authority.test',\n password: 'hunter2',\n },\n ) {\n const agent = pds.getAgent()\n await agent.createAccount(userDetails)\n\n const key = await Secp256k1Keypair.create({ exportable: true })\n\n return new OzoneServiceProfile(pds, agent, userDetails, ozoneUrl, key)\n }\n\n protected constructor(\n pds: TestPds,\n agent: AtpAgent,\n userDetails: ServiceUserDetails,\n readonly ozoneUrl: string,\n readonly key: Secp256k1Keypair,\n ) {\n super(pds, agent, userDetails)\n }\n\n async createAppPasswordForVerification() {\n const { data } = await this.agent.com.atproto.server.createAppPassword({\n name: 'ozone-verifier',\n })\n return data.password\n }\n\n async migrateTo(pds: TestPds, options: ServiceMigrationOptions = {}) {\n await super.migrateTo(pds, {\n ...options,\n services: {\n ...options.services,\n atproto_labeler: {\n type: 'AtprotoLabeler',\n endpoint: this.ozoneUrl,\n },\n },\n verificationMethods: {\n ...options.verificationMethods,\n atproto_label: this.key.did(),\n },\n })\n }\n\n async createRecords() {\n await this.agent.app.bsky.actor.profile.create(\n { repo: this.did },\n {\n displayName: 'Dev-env Moderation',\n description: `The pretend version of mod.bsky.app`,\n },\n )\n\n await this.agent.app.bsky.labeler.service.create(\n { repo: this.did, rkey: 'self' },\n {\n policies: {\n labelValues: [\n '!hide',\n '!warn',\n 'porn',\n 'sexual',\n 'nudity',\n 'sexual-figurative',\n 'graphic-media',\n 'self-harm',\n 'sensitive',\n 'extremist',\n 'intolerant',\n 'threat',\n 'rude',\n 'illicit',\n 'security',\n 'unsafe-link',\n 'impersonation',\n 'misinformation',\n 'scam',\n 'engagement-farming',\n 'spam',\n 'rumor',\n 'misleading',\n 'inauthentic',\n ],\n labelValueDefinitions: [\n {\n identifier: 'spam',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Spam',\n description:\n 'Unwanted, repeated, or unrelated actions that bother users.',\n },\n ],\n },\n {\n identifier: 'impersonation',\n blurs: 'none',\n severity: 'inform',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Impersonation',\n description:\n 'Pretending to be someone else without permission.',\n },\n ],\n },\n {\n identifier: 'scam',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Scam',\n description: 'Scams, phishing & fraud.',\n },\n ],\n },\n {\n identifier: 'intolerant',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Intolerance',\n description: 'Discrimination against protected groups.',\n },\n ],\n },\n {\n identifier: 'self-harm',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Self-Harm',\n description:\n 'Promotes self-harm, including graphic images, glorifying discussions, or triggering stories.',\n },\n ],\n },\n {\n identifier: 'security',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Security Concerns',\n description:\n 'May be unsafe and could harm your device, steal your info, or get your account hacked.',\n },\n ],\n },\n {\n identifier: 'misleading',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Misleading',\n description:\n 'Altered images/videos, deceptive links, or false statements.',\n },\n ],\n },\n {\n identifier: 'threat',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Threats',\n description:\n 'Promotes violence or harm towards others, including threats, incitement, or advocacy of harm.',\n },\n ],\n },\n {\n identifier: 'unsafe-link',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Unsafe link',\n description:\n 'Links to harmful sites with malware, phishing, or violating content that risk security and privacy.',\n },\n ],\n },\n {\n identifier: 'illicit',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Illicit',\n description:\n 'Promoting or selling potentially illicit goods, services, or activities.',\n },\n ],\n },\n {\n identifier: 'misinformation',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Misinformation',\n description:\n 'Spreading false or misleading info, including unverified claims and harmful conspiracy theories.',\n },\n ],\n },\n {\n identifier: 'rumor',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Rumor',\n description:\n 'Approach with caution, as these claims lack evidence from credible sources.',\n },\n ],\n },\n {\n identifier: 'rude',\n blurs: 'content',\n severity: 'inform',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Rude',\n description:\n 'Rude or impolite, including crude language and disrespectful comments, without constructive purpose.',\n },\n ],\n },\n {\n identifier: 'extremist',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Extremist',\n description:\n 'Radical views advocating violence, hate, or discrimination against individuals or groups.',\n },\n ],\n },\n {\n identifier: 'sensitive',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'warn',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Sensitive',\n description:\n 'May be upsetting, covering topics like substance abuse or mental health issues, cautioning sensitive viewers.',\n },\n ],\n },\n {\n identifier: 'engagement-farming',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Engagement Farming',\n description:\n 'Insincere content or bulk actions aimed at gaining followers, including frequent follows, posts, and likes.',\n },\n ],\n },\n {\n identifier: 'inauthentic',\n blurs: 'content',\n severity: 'alert',\n defaultSetting: 'hide',\n adultOnly: false,\n locales: [\n {\n lang: 'en',\n name: 'Inauthentic Account',\n description: 'Bot or a person pretending to be someone else.',\n },\n ],\n },\n {\n identifier: 'sexual-figurative',\n blurs: 'media',\n severity: 'none',\n defaultSetting: 'show',\n adultOnly: true,\n locales: [\n {\n lang: 'en',\n name: 'Sexually Suggestive (Cartoon)',\n description:\n 'Art with explicit or suggestive sexual themes, including provocative imagery or partial nudity.',\n },\n ],\n },\n ],\n },\n createdAt: new Date().toISOString(),\n },\n )\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { AtpAgent } from '@atproto/api';
2
+ import { DidString } from '@atproto/lex';
2
3
  import { TestPds } from './pds';
3
4
  export type ServiceUserDetails = {
4
5
  email: string;
@@ -12,12 +13,12 @@ export type ServiceMigrationOptions = {
12
13
  export declare class ServiceProfile {
13
14
  protected pds: TestPds;
14
15
  /** @note assumes the session is already authenticated */
15
- protected client: AtpAgent;
16
+ protected agent: AtpAgent;
16
17
  protected userDetails: ServiceUserDetails;
17
18
  protected constructor(pds: TestPds,
18
19
  /** @note assumes the session is already authenticated */
19
- client: AtpAgent, userDetails: ServiceUserDetails);
20
- get did(): string;
20
+ agent: AtpAgent, userDetails: ServiceUserDetails);
21
+ get did(): DidString;
21
22
  migrateTo(newPds: TestPds, options?: ServiceMigrationOptions): Promise<void>;
22
23
  }
23
24
  //# sourceMappingURL=service-profile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-profile.d.ts","sourceRoot":"","sources":["../src/service-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC,MA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E,kBAAkB;IAG3C,IAAI,GAAG,IAAI,SAAS,CAEnB;IAEK,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,GAAE,uBAA4B;CAmEvE"}
@@ -4,18 +4,18 @@ exports.ServiceProfile = void 0;
4
4
  class ServiceProfile {
5
5
  constructor(pds,
6
6
  /** @note assumes the session is already authenticated */
7
- client, userDetails) {
7
+ agent, userDetails) {
8
8
  Object.defineProperty(this, "pds", {
9
9
  enumerable: true,
10
10
  configurable: true,
11
11
  writable: true,
12
12
  value: pds
13
13
  });
14
- Object.defineProperty(this, "client", {
14
+ Object.defineProperty(this, "agent", {
15
15
  enumerable: true,
16
16
  configurable: true,
17
17
  writable: true,
18
- value: client
18
+ value: agent
19
19
  });
20
20
  Object.defineProperty(this, "userDetails", {
21
21
  enumerable: true,
@@ -25,24 +25,24 @@ class ServiceProfile {
25
25
  });
26
26
  }
27
27
  get did() {
28
- return this.client.assertDid;
28
+ return this.agent.assertDid;
29
29
  }
30
30
  async migrateTo(newPds, options = {}) {
31
- const newClient = newPds.getClient();
32
- const newPdsDesc = await newClient.com.atproto.server.describeServer();
33
- const serviceAuth = await this.client.com.atproto.server.getServiceAuth({
31
+ const newAgent = newPds.getAgent();
32
+ const newPdsDesc = await newAgent.com.atproto.server.describeServer();
33
+ const serviceAuth = await this.agent.com.atproto.server.getServiceAuth({
34
34
  aud: newPdsDesc.data.did,
35
35
  lxm: 'com.atproto.server.createAccount',
36
36
  });
37
37
  const inviteCode = newPds.ctx.cfg.invites.required
38
- ? await newClient.com.atproto.server
38
+ ? await newAgent.com.atproto.server
39
39
  .createInviteCode({ useCount: 1 }, {
40
40
  encoding: 'application/json',
41
41
  headers: newPds.adminAuthHeaders(),
42
42
  })
43
43
  .then((res) => res.data.code)
44
44
  : undefined;
45
- await newClient.createAccount({
45
+ await newAgent.createAccount({
46
46
  ...this.userDetails,
47
47
  inviteCode,
48
48
  did: this.did,
@@ -55,9 +55,9 @@ class ServiceProfile {
55
55
  // process of migrating, that didDoc references the old PDS. In order to
56
56
  // avoid calling the old PDS, let's clear the pdsUrl, which will result in
57
57
  // the (new) serviceUrl being used.
58
- newClient.sessionManager.pdsUrl = undefined;
59
- const newDidCredentialsRes = await newClient.com.atproto.identity.getRecommendedDidCredentials();
60
- await this.client.com.atproto.identity.requestPlcOperationSignature();
58
+ newAgent.sessionManager.pdsUrl = undefined;
59
+ const newDidCredentialsRes = await newAgent.com.atproto.identity.getRecommendedDidCredentials();
60
+ await this.agent.com.atproto.identity.requestPlcOperationSignature();
61
61
  const { token } = await this.pds.ctx.accountManager.db.db
62
62
  .selectFrom('email_token')
63
63
  .select('token')
@@ -67,13 +67,13 @@ class ServiceProfile {
67
67
  const op = { ...newDidCredentialsRes.data, token };
68
68
  Object.assign((op.services ?? (op.services = {})), options.services);
69
69
  Object.assign((op.verificationMethods ?? (op.verificationMethods = {})), options.verificationMethods);
70
- const signedPlcOperation = await this.client.com.atproto.identity.signPlcOperation(op);
71
- await newClient.com.atproto.identity.submitPlcOperation({
70
+ const signedPlcOperation = await this.agent.com.atproto.identity.signPlcOperation(op);
71
+ await newAgent.com.atproto.identity.submitPlcOperation({
72
72
  operation: signedPlcOperation.data.operation,
73
73
  });
74
- await newClient.com.atproto.server.activateAccount();
74
+ await newAgent.com.atproto.server.activateAccount();
75
75
  this.pds = newPds;
76
- this.client = newClient;
76
+ this.agent = newAgent;
77
77
  }
78
78
  }
79
79
  exports.ServiceProfile = ServiceProfile;
@@ -1 +1 @@
1
- {"version":3,"file":"service-profile.js","sourceRoot":"","sources":["../src/service-profile.ts"],"names":[],"mappings":";;;AAcA,MAAa,cAAc;IACzB,YACY,GAAY;IACtB,yDAAyD;IAC/C,MAAgB,EAChB,WAA+B;QAHzC;;;;mBAAU,GAAG;WAAS;QAEtB;;;;mBAAU,MAAM;WAAU;QAC1B;;;;mBAAU,WAAW;WAAoB;IACxC,CAAC;IAEJ,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,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,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;IACzB,CAAC;CACF;AA/ED,wCA+EC","sourcesContent":["import { AtpAgent } from '@atproto/api'\nimport { TestPds } from './pds'\n\nexport type ServiceUserDetails = {\n email: string\n handle: string\n password: string\n}\n\nexport type ServiceMigrationOptions = {\n services?: Record<string, unknown>\n verificationMethods?: Record<string, unknown>\n}\n\nexport class ServiceProfile {\n protected constructor(\n protected pds: TestPds,\n /** @note assumes the session is already authenticated */\n protected client: AtpAgent,\n protected userDetails: ServiceUserDetails,\n ) {}\n\n get did() {\n return this.client.assertDid\n }\n\n async migrateTo(newPds: TestPds, options: ServiceMigrationOptions = {}) {\n const newClient = newPds.getClient()\n\n const newPdsDesc = await newClient.com.atproto.server.describeServer()\n const serviceAuth = await this.client.com.atproto.server.getServiceAuth({\n aud: newPdsDesc.data.did,\n lxm: 'com.atproto.server.createAccount',\n })\n\n const inviteCode = newPds.ctx.cfg.invites.required\n ? await newClient.com.atproto.server\n .createInviteCode(\n { useCount: 1 },\n {\n encoding: 'application/json',\n headers: newPds.adminAuthHeaders(),\n },\n )\n .then((res) => res.data.code)\n : undefined\n\n await newClient.createAccount(\n {\n ...this.userDetails,\n inviteCode,\n did: this.did,\n },\n {\n encoding: 'application/json',\n headers: { authorization: `Bearer ${serviceAuth.data.token}` },\n },\n )\n\n // The session manager will use the \"didDoc\" in the result of\n // \"createAccount\" in order to setup the pdsUrl. However, since are in the\n // process of migrating, that didDoc references the old PDS. In order to\n // avoid calling the old PDS, let's clear the pdsUrl, which will result in\n // the (new) serviceUrl being used.\n newClient.sessionManager.pdsUrl = undefined\n\n const newDidCredentialsRes =\n await newClient.com.atproto.identity.getRecommendedDidCredentials()\n\n await this.client.com.atproto.identity.requestPlcOperationSignature()\n const { token } = await this.pds.ctx.accountManager.db.db\n .selectFrom('email_token')\n .select('token')\n .where('did', '=', this.did)\n .where('purpose', '=', 'plc_operation')\n .executeTakeFirstOrThrow()\n\n const op = { ...newDidCredentialsRes.data, token }\n Object.assign((op.services ??= {}), options.services)\n Object.assign((op.verificationMethods ??= {}), options.verificationMethods)\n\n const signedPlcOperation =\n await this.client.com.atproto.identity.signPlcOperation(op)\n\n await newClient.com.atproto.identity.submitPlcOperation({\n operation: signedPlcOperation.data.operation,\n })\n\n await newClient.com.atproto.server.activateAccount()\n\n this.pds = newPds\n this.client = newClient\n }\n}\n"]}
1
+ {"version":3,"file":"service-profile.js","sourceRoot":"","sources":["../src/service-profile.ts"],"names":[],"mappings":";;;AAeA,MAAa,cAAc;IACzB,YACY,GAAY;IACtB,yDAAyD;IAC/C,KAAe,EACf,WAA+B;QAHzC;;;;mBAAU,GAAG;WAAS;QAEtB;;;;mBAAU,KAAK;WAAU;QACzB;;;;mBAAU,WAAW;WAAoB;IACxC,CAAC;IAEJ,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAe,EAAE,UAAmC,EAAE;QACpE,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;QAElC,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,CAAA;QACrE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;YACrE,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG;YACxB,GAAG,EAAE,kCAAkC;SACxC,CAAC,CAAA;QAEF,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ;YAChD,CAAC,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM;iBAC9B,gBAAgB,CACf,EAAE,QAAQ,EAAE,CAAC,EAAE,EACf;gBACE,QAAQ,EAAE,kBAAkB;gBAC5B,OAAO,EAA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,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;QACrD,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,mBAAmB,KAAtB,EAAE,CAAC,mBAAmB,GAAK,EAAE,EAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;QAE3E,MAAM,kBAAkB,GACtB,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAA;QAE5D,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACrD,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS;SAC7C,CAAC,CAAA;QAEF,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,CAAA;QAEnD,IAAI,CAAC,GAAG,GAAG,MAAM,CAAA;QACjB,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAA;IACvB,CAAC;CACF;AA/ED,wCA+EC","sourcesContent":["import { AtpAgent } from '@atproto/api'\nimport { DidString } from '@atproto/lex'\nimport { TestPds } from './pds'\n\nexport type ServiceUserDetails = {\n email: string\n handle: string\n password: string\n}\n\nexport type ServiceMigrationOptions = {\n services?: Record<string, unknown>\n verificationMethods?: Record<string, unknown>\n}\n\nexport class ServiceProfile {\n protected constructor(\n protected pds: TestPds,\n /** @note assumes the session is already authenticated */\n protected agent: AtpAgent,\n protected userDetails: ServiceUserDetails,\n ) {}\n\n get did(): DidString {\n return this.agent.assertDid\n }\n\n async migrateTo(newPds: TestPds, options: ServiceMigrationOptions = {}) {\n const newAgent = newPds.getAgent()\n\n const newPdsDesc = await newAgent.com.atproto.server.describeServer()\n const serviceAuth = await this.agent.com.atproto.server.getServiceAuth({\n aud: newPdsDesc.data.did,\n lxm: 'com.atproto.server.createAccount',\n })\n\n const inviteCode = newPds.ctx.cfg.invites.required\n ? await newAgent.com.atproto.server\n .createInviteCode(\n { useCount: 1 },\n {\n encoding: 'application/json',\n headers: newPds.adminAuthHeaders(),\n },\n )\n .then((res) => res.data.code)\n : undefined\n\n await newAgent.createAccount(\n {\n ...this.userDetails,\n inviteCode,\n did: this.did,\n },\n {\n encoding: 'application/json',\n headers: { authorization: `Bearer ${serviceAuth.data.token}` },\n },\n )\n\n // The session manager will use the \"didDoc\" in the result of\n // \"createAccount\" in order to setup the pdsUrl. However, since are in the\n // process of migrating, that didDoc references the old PDS. In order to\n // avoid calling the old PDS, let's clear the pdsUrl, which will result in\n // the (new) serviceUrl being used.\n newAgent.sessionManager.pdsUrl = undefined\n\n const newDidCredentialsRes =\n await newAgent.com.atproto.identity.getRecommendedDidCredentials()\n\n await this.agent.com.atproto.identity.requestPlcOperationSignature()\n const { token } = await this.pds.ctx.accountManager.db.db\n .selectFrom('email_token')\n .select('token')\n .where('did', '=', this.did)\n .where('purpose', '=', 'plc_operation')\n .executeTakeFirstOrThrow()\n\n const op = { ...newDidCredentialsRes.data, token }\n Object.assign((op.services ??= {}), options.services)\n Object.assign((op.verificationMethods ??= {}), options.verificationMethods)\n\n const signedPlcOperation =\n await this.agent.com.atproto.identity.signPlcOperation(op)\n\n await newAgent.com.atproto.identity.submitPlcOperation({\n operation: signedPlcOperation.data.operation,\n })\n\n await newAgent.com.atproto.server.activateAccount()\n\n this.pds = newPds\n this.agent = newAgent\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/dev-env",
3
- "version": "0.3.215",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "description": "Local development environment helper for atproto development",
6
6
  "keywords": [
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "main": "dist/index.js",
16
16
  "types": "dist/index.d.ts",
17
- "bin": "dist/bin.js",
17
+ "bin": "bin.js",
18
18
  "engines": {
19
19
  "node": ">=18.7.0"
20
20
  },
@@ -27,18 +27,19 @@
27
27
  "multiformats": "^9.9.0",
28
28
  "uint8arrays": "3.0.0",
29
29
  "undici": "^6.14.1",
30
- "@atproto/api": "^0.19.4",
31
- "@atproto/bsky": "^0.0.221",
30
+ "@atproto/api": "^0.19.5",
31
+ "@atproto/bsky": "^0.0.222",
32
32
  "@atproto/bsync": "^0.0.25",
33
33
  "@atproto/common-web": "^0.4.19",
34
34
  "@atproto/crypto": "^0.4.5",
35
35
  "@atproto/identity": "^0.4.12",
36
+ "@atproto/lex": "^0.0.23",
36
37
  "@atproto/lexicon": "^0.6.2",
37
- "@atproto/ozone": "^0.1.167",
38
- "@atproto/pds": "^0.4.216",
39
- "@atproto/sync": "^0.1.40",
40
- "@atproto/syntax": "^0.5.1",
41
- "@atproto/xrpc-server": "^0.10.17"
38
+ "@atproto/ozone": "^0.1.168",
39
+ "@atproto/pds": "^0.4.217",
40
+ "@atproto/sync": "^0.2.0",
41
+ "@atproto/syntax": "^0.5.2",
42
+ "@atproto/xrpc-server": "^0.10.18"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@types/express": "^4.17.13",
package/src/bsky.ts CHANGED
@@ -4,6 +4,7 @@ import * as ui8 from 'uint8arrays'
4
4
  import { AtpAgent } from '@atproto/api'
5
5
  import * as bsky from '@atproto/bsky'
6
6
  import { Secp256k1Keypair } from '@atproto/crypto'
7
+ import { Client } from '@atproto/lex'
7
8
  import { ADMIN_PASSWORD, EXAMPLE_LABELER } from './const'
8
9
  import { BskyConfig } from './types'
9
10
  export * from '@atproto/bsky'
@@ -130,12 +131,18 @@ export class TestBsky {
130
131
  return this.server.ctx
131
132
  }
132
133
 
133
- getClient(): AtpAgent {
134
+ getAgent(): AtpAgent {
134
135
  const agent = new AtpAgent({ service: this.url })
135
136
  agent.configureLabelers([EXAMPLE_LABELER])
136
137
  return agent
137
138
  }
138
139
 
140
+ getClient(): Client {
141
+ const client = new Client({ service: this.url })
142
+ client.setLabelers([EXAMPLE_LABELER])
143
+ return client
144
+ }
145
+
139
146
  adminAuth(): string {
140
147
  const [password] = this.ctx.cfg.adminPasswords
141
148
  return (
package/src/feed-gen.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import events from 'node:events'
2
2
  import http from 'node:http'
3
3
  import * as plc from '@did-plc/lib'
4
- import express from 'express'
5
4
  import getPort from 'get-port'
6
5
  import { Secp256k1Keypair } from '@atproto/crypto'
7
- import { SkeletonHandler, createLexiconServer } from '@atproto/pds'
8
- import { InvalidRequestError } from '@atproto/xrpc-server'
6
+ import { SkeletonHandler, app } from '@atproto/pds'
7
+ import { AtUriString, DidString } from '@atproto/syntax'
8
+ import { InvalidRequestError, createServer } from '@atproto/xrpc-server'
9
9
 
10
10
  export class TestFeedGen {
11
11
  destroyed = false
@@ -22,10 +22,9 @@ export class TestFeedGen {
22
22
  ): Promise<TestFeedGen> {
23
23
  const port = await getPort()
24
24
  const did = await createFgDid(plcUrl, port)
25
- const app = express()
26
- const lexServer = createLexiconServer()
25
+ const xrpcServer = createServer()
27
26
 
28
- lexServer.app.bsky.feed.getFeedSkeleton(async (args) => {
27
+ xrpcServer.add(app.bsky.feed.getFeedSkeleton, async (args) => {
29
28
  const handler = feeds[args.params.feed]
30
29
  if (!handler) {
31
30
  throw new InvalidRequestError('unknown feed', 'UnknownFeed')
@@ -33,22 +32,21 @@ export class TestFeedGen {
33
32
  return handler(args)
34
33
  })
35
34
 
36
- lexServer.app.bsky.feed.describeFeedGenerator(async () => {
35
+ xrpcServer.add(app.bsky.feed.describeFeedGenerator, async () => {
37
36
  return {
38
- encoding: 'application/json',
37
+ encoding: 'application/json' as const,
39
38
  body: {
40
- did,
41
- feeds: Object.keys(feeds).map((uri) => ({
39
+ did: did as DidString,
40
+ feeds: (Object.keys(feeds) as AtUriString[]).map((uri) => ({
42
41
  uri,
43
42
  })),
44
43
  },
45
44
  }
46
45
  })
47
46
 
48
- app.use(lexServer.xrpc.router)
49
- const server = app.listen(port)
50
- await events.once(server, 'listening')
51
- return new TestFeedGen(port, server, did)
47
+ const httpServer = xrpcServer.listen(port)
48
+ await events.once(httpServer, 'listening')
49
+ return new TestFeedGen(port, httpServer, did)
52
50
  }
53
51
 
54
52
  close(): Promise<void> {
@@ -63,7 +61,10 @@ export class TestFeedGen {
63
61
  }
64
62
  }
65
63
 
66
- const createFgDid = async (plcUrl: string, port: number): Promise<string> => {
64
+ const createFgDid = async (
65
+ plcUrl: string,
66
+ port: number,
67
+ ): Promise<DidString> => {
67
68
  const keypair = await Secp256k1Keypair.create()
68
69
  const plcClient = new plc.Client(plcUrl)
69
70
  const op = await plc.signOperation(
@@ -86,5 +87,5 @@ const createFgDid = async (plcUrl: string, port: number): Promise<string> => {
86
87
  )
87
88
  const did = await plc.didForCreateOp(op)
88
89
  await plcClient.sendOperation(did, op)
89
- return did
90
+ return did as DidString
90
91
  }
package/src/mock/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AtpAgent, COM_ATPROTO_MODERATION } from '@atproto/api'
2
2
  import { Database } from '@atproto/bsky'
3
- import { AtUri } from '@atproto/syntax'
3
+ import { AtUri, AtUriString } from '@atproto/syntax'
4
4
  import { EXAMPLE_LABELER, RecordRef, TestNetwork } from '../index'
5
5
  import { postTexts, replyTexts } from './data'
6
6
  import blurHashB64 from './img/blur-hash-avatar-b64'
@@ -78,19 +78,19 @@ export async function generateMockSetup(env: TestNetwork) {
78
78
 
79
79
  const userAgents = await Promise.all(
80
80
  users.map(async (user) => {
81
- const client: AtpAgent = env.pds.getClient()
82
- await client.createAccount(user)
83
- client.assertAuthenticated()
81
+ const agent: AtpAgent = env.pds.getAgent()
82
+ await agent.createAccount(user)
83
+ agent.assertAuthenticated()
84
84
  if (user.displayName || user.description) {
85
- await client.app.bsky.actor.profile.create(
86
- { repo: client.did },
85
+ await agent.app.bsky.actor.profile.create(
86
+ { repo: agent.did },
87
87
  {
88
88
  displayName: user.displayName,
89
89
  description: user.description,
90
90
  },
91
91
  )
92
92
  }
93
- return client
93
+ return agent
94
94
  }),
95
95
  )
96
96
 
@@ -269,7 +269,7 @@ export async function generateMockSetup(env: TestNetwork) {
269
269
  [fg1Uri.toString()]: async () => {
270
270
  const feed = posts
271
271
  .filter(() => rand(2) === 0)
272
- .map((post) => ({ post: post.uri }))
272
+ .map((post) => ({ post: post.uri as AtUriString }))
273
273
  return {
274
274
  encoding: 'application/json',
275
275
  body: {
@@ -323,7 +323,7 @@ export async function generateMockSetup(env: TestNetwork) {
323
323
  [fg2Uri.toString()]: async () => {
324
324
  const feed = posts
325
325
  .filter(() => rand(2) === 0)
326
- .map((post) => ({ post: post.uri }))
326
+ .map((post) => ({ post: post.uri as AtUriString }))
327
327
  return {
328
328
  encoding: 'application/json',
329
329
  body: {
@@ -362,7 +362,7 @@ export async function generateMockSetup(env: TestNetwork) {
362
362
  [fg3Uri.toString()]: async () => {
363
363
  const feed = posts
364
364
  .filter(() => rand(2) === 0)
365
- .map((post) => ({ post: post.uri }))
365
+ .map((post) => ({ post: post.uri as AtUriString }))
366
366
  return {
367
367
  encoding: 'application/json',
368
368
  body: {
@@ -17,7 +17,7 @@ type ModLevel = 'admin' | 'moderator' | 'triage'
17
17
  export class ModeratorClient {
18
18
  agent: AtpAgent
19
19
  constructor(public ozone: TestOzone) {
20
- this.agent = ozone.getClient()
20
+ this.agent = ozone.getAgent()
21
21
  }
22
22
 
23
23
  async getEvent(id: number, role?: ModLevel) {
@@ -36,8 +36,9 @@ export class TestNetworkNoAppView {
36
36
  }
37
37
 
38
38
  getSeedClient(): SeedClient<typeof this> {
39
- const agent = this.pds.getClient()
40
- return new SeedClient(this, agent)
39
+ const agent = this.pds.getAgent()
40
+ const client = this.pds.getClient()
41
+ return new SeedClient(this, agent, client)
41
42
  }
42
43
 
43
44
  async processAll() {
package/src/ozone.ts CHANGED
@@ -103,7 +103,7 @@ export class TestOzone {
103
103
  return this.server.ctx
104
104
  }
105
105
 
106
- getClient(): AtpAgent {
106
+ getAgent(): AtpAgent {
107
107
  const agent = new AtpAgent({ service: this.url })
108
108
  agent.configureLabelers([EXAMPLE_LABELER])
109
109
  return agent
package/src/pds.ts CHANGED
@@ -5,6 +5,7 @@ import getPort from 'get-port'
5
5
  import * as ui8 from 'uint8arrays'
6
6
  import { AtpAgent } from '@atproto/api'
7
7
  import { Secp256k1Keypair, randomStr } from '@atproto/crypto'
8
+ import { Client } from '@atproto/lex'
8
9
  import * as pds from '@atproto/pds'
9
10
  import { createSecretKeyObject } from '@atproto/pds'
10
11
  import { ADMIN_PASSWORD, EXAMPLE_LABELER, JWT_SECRET } from './const'
@@ -77,12 +78,18 @@ export class TestPds {
77
78
  return this.server.ctx
78
79
  }
79
80
 
80
- getClient(): AtpAgent {
81
+ getAgent(): AtpAgent {
81
82
  const agent = new AtpAgent({ service: this.url })
82
83
  agent.configureLabelers([EXAMPLE_LABELER])
83
84
  return agent
84
85
  }
85
86
 
87
+ getClient(): Client {
88
+ const client = new Client({ service: this.url })
89
+ client.setLabelers([EXAMPLE_LABELER])
90
+ return client
91
+ }
92
+
86
93
  adminAuth(): string {
87
94
  return (
88
95
  'Basic ' +
@@ -14,8 +14,9 @@ import {
14
14
  AtpAgent,
15
15
  ComAtprotoModerationCreateReport,
16
16
  } from '@atproto/api'
17
+ import { CidString, Client } from '@atproto/lex'
17
18
  import { BlobRef } from '@atproto/lexicon'
18
- import { AtUri } from '@atproto/syntax'
19
+ import { AtUri, AtUriString, DidString } from '@atproto/syntax'
19
20
  import { TestNetworkNoAppView } from '../network-no-appview'
20
21
 
21
22
  // Makes it simple to create data via the XRPC client,
@@ -44,18 +45,18 @@ export class RecordRef {
44
45
  this.cid = CID.parse(cid.toString())
45
46
  }
46
47
 
47
- get raw(): { uri: string; cid: string } {
48
+ get raw(): { uri: AtUriString; cid: CidString } {
48
49
  return {
49
50
  uri: this.uri.toString(),
50
51
  cid: this.cid.toString(),
51
52
  }
52
53
  }
53
54
 
54
- get uriStr(): string {
55
+ get uriStr(): AtUriString {
55
56
  return this.uri.toString()
56
57
  }
57
58
 
58
- get cidStr(): string {
59
+ get cidStr(): CidString {
59
60
  return this.cid.toString()
60
61
  }
61
62
  }
@@ -66,7 +67,7 @@ export class SeedClient<
66
67
  accounts: Record<
67
68
  string,
68
69
  {
69
- did: string
70
+ did: DidString
70
71
  accessJwt: string
71
72
  refreshJwt: string
72
73
  handle: string
@@ -120,11 +121,12 @@ export class SeedClient<
120
121
 
121
122
  verifications: Record<string, Record<string, AtUri>>
122
123
 
123
- dids: Record<string, string>
124
+ dids: Record<string, DidString>
124
125
 
125
126
  constructor(
126
127
  public network: Network,
127
128
  public agent: AtpAgent,
129
+ public client: Client,
128
130
  ) {
129
131
  this.accounts = {}
130
132
  this.profiles = {}
@@ -153,9 +155,11 @@ export class SeedClient<
153
155
  ) {
154
156
  const { data: account } =
155
157
  await this.agent.com.atproto.server.createAccount(params)
156
- this.dids[shortName] = account.did
158
+ const did = account.did as DidString
159
+ this.dids[shortName] = did
157
160
  this.accounts[account.did] = {
158
161
  ...account,
162
+ did,
159
163
  email: params.email,
160
164
  password: params.password,
161
165
  }
@@ -77,14 +77,14 @@ export class LexiconAuthorityProfile extends ServiceProfile {
77
77
  password: 'hunter2',
78
78
  },
79
79
  ) {
80
- const client = pds.getClient()
81
- await client.createAccount(userDetails)
80
+ const agent = pds.getAgent()
81
+ await agent.createAccount(userDetails)
82
82
 
83
- return new LexiconAuthorityProfile(pds, client, userDetails)
83
+ return new LexiconAuthorityProfile(pds, agent, userDetails)
84
84
  }
85
85
 
86
86
  async createRecords() {
87
- await this.client.app.bsky.actor.profile.create(
87
+ await this.agent.app.bsky.actor.profile.create(
88
88
  { repo: this.did },
89
89
  {
90
90
  displayName: 'Lexicon Authority',
@@ -93,7 +93,7 @@ export class LexiconAuthorityProfile extends ServiceProfile {
93
93
  )
94
94
 
95
95
  for (const doc of LEXICONS) {
96
- await this.client.com.atproto.repo.createRecord({
96
+ await this.agent.com.atproto.repo.createRecord({
97
97
  repo: this.did,
98
98
  collection: 'com.atproto.lexicon.schema',
99
99
  rkey: doc.id,