diff --git a/packages/dev-env/package.json b/packages/dev-env/package.json index 7db9f2a317c..22a76b721ac 100644 --- a/packages/dev-env/package.json +++ b/packages/dev-env/package.json @@ -31,6 +31,7 @@ "@atproto/crypto": "workspace:^", "@atproto/identity": "workspace:^", "@atproto/lexicon": "workspace:^", + "@atproto/ozone": "workspace:^", "@atproto/pds": "workspace:^", "@atproto/syntax": "workspace:^", "@atproto/xrpc-server": "workspace:^", diff --git a/packages/dev-env/src/network.ts b/packages/dev-env/src/network.ts index 6079ec4c968..784ffa7e6c0 100644 --- a/packages/dev-env/src/network.ts +++ b/packages/dev-env/src/network.ts @@ -7,6 +7,7 @@ import { TestServerParams } from './types' import { TestPlc } from './plc' import { TestPds } from './pds' import { TestBsky } from './bsky' +import { TestOzone } from './ozone' import { mockNetworkUtilities } from './util' import { TestNetworkNoAppView } from './network-no-appview' @@ -14,7 +15,12 @@ const ADMIN_USERNAME = 'admin' const ADMIN_PASSWORD = 'admin-pass' export class TestNetwork extends TestNetworkNoAppView { - constructor(public plc: TestPlc, public pds: TestPds, public bsky: TestBsky) { + constructor( + public plc: TestPlc, + public pds: TestPds, + public bsky: TestBsky, + public ozone?: TestOzone, + ) { super(plc, pds) } @@ -30,6 +36,16 @@ export class TestNetwork extends TestNetworkNoAppView { const plc = await TestPlc.create(params.plc ?? {}) + let ozone: TestOzone | undefined = undefined + if (params.ozone?.enabled) { + ozone = await TestOzone.create({ + plcUrl: plc.url, + dbPostgresSchema: `ozone_${dbPostgresSchema}`, + dbPrimaryPostgresUrl: dbPostgresUrl, + ...params.ozone, + }) + } + const bskyPort = params.bsky?.port ?? (await getPort()) const pdsPort = params.pds?.port ?? (await getPort()) const bsky = await TestBsky.create({ @@ -48,7 +64,8 @@ export class TestNetwork extends TestNetworkNoAppView { didPlcUrl: plc.url, bskyAppViewUrl: bsky.url, bskyAppViewDid: bsky.ctx.cfg.serverDid, - bskyAppViewModeration: true, + modServiceUrl: ozone?.url ?? 'https://admin.invalid', + modServiceDid: ozone?.ctx.cfg.serverDid ?? 'did:example:admin_invalid', ...params.pds, }) diff --git a/packages/dev-env/src/ozone.ts b/packages/dev-env/src/ozone.ts new file mode 100644 index 00000000000..14c4e321d77 --- /dev/null +++ b/packages/dev-env/src/ozone.ts @@ -0,0 +1,117 @@ +import getPort from 'get-port' +import * as ui8 from 'uint8arrays' +import * as ozone from '@atproto/ozone' +import { DAY, HOUR, MINUTE, SECOND } from '@atproto/common-web' +import { AtpAgent } from '@atproto/api' +import { Secp256k1Keypair } from '@atproto/crypto' +import { Client as PlcClient } from '@did-plc/lib' +import { OzoneConfig } from './types' +import { ADMIN_PASSWORD, MOD_PASSWORD, TRIAGE_PASSWORD } from './const' + +export class TestOzone { + constructor( + public url: string, + public port: number, + public server: ozone.OzoneService, + ) {} + + static async create(cfg: OzoneConfig): Promise { + const serviceKeypair = await Secp256k1Keypair.create() + const plcClient = new PlcClient(cfg.plcUrl) + + const port = cfg.port || (await getPort()) + const url = `http://localhost:${port}` + const serverDid = await plcClient.createDid({ + signingKey: serviceKeypair.did(), + rotationKeys: [serviceKeypair.did()], + handle: 'bsky.test', + pds: `http://localhost:${port}`, + signer: serviceKeypair, + }) + + const config = new ozone.ServerConfig({ + version: '0.0.0', + port, + didPlcUrl: cfg.plcUrl, + publicUrl: 'https://bsky.public.url', + serverDid, + didCacheStaleTTL: HOUR, + didCacheMaxTTL: DAY, + labelCacheStaleTTL: 30 * SECOND, + labelCacheMaxTTL: MINUTE, + ...cfg, + // Each test suite gets its own lock id for the repo subscription + adminPassword: ADMIN_PASSWORD, + moderatorPassword: MOD_PASSWORD, + triagePassword: TRIAGE_PASSWORD, + labelerDid: 'did:example:labeler', + feedGenDid: 'did:example:feedGen', + rateLimitsEnabled: false, + }) + + // shared across server, ingester, and indexer in order to share pool, avoid too many pg connections. + const db = new ozone.Database({ + schema: cfg.dbPostgresSchema, + url: cfg.dbPrimaryPostgresUrl, + poolSize: 10, + }) + + // Separate migration db in case migration changes some connection state that we need in the tests, e.g. "alter database ... set ..." + const migrationDb = new ozone.Database({ + schema: cfg.dbPostgresSchema, + url: cfg.dbPrimaryPostgresUrl, + }) + if (cfg.migration) { + await migrationDb.migrateToOrThrow(cfg.migration) + } else { + await migrationDb.migrateToLatestOrThrow() + } + await migrationDb.close() + + // api server + const server = ozone.OzoneService.create({ + db, + config, + signingKey: serviceKeypair, + }) + + await server.start() + + return new TestOzone(url, port, server) + } + + get ctx(): ozone.AppContext { + return this.server.ctx + } + + getClient() { + return new AtpAgent({ service: this.url }) + } + + adminAuth(role: 'admin' | 'moderator' | 'triage' = 'admin'): string { + const password = + role === 'triage' + ? this.ctx.cfg.triagePassword + : role === 'moderator' + ? this.ctx.cfg.moderatorPassword + : this.ctx.cfg.adminPassword + return ( + 'Basic ' + + ui8.toString(ui8.fromString(`admin:${password}`, 'utf8'), 'base64pad') + ) + } + + adminAuthHeaders(role?: 'admin' | 'moderator' | 'triage') { + return { + authorization: this.adminAuth(role), + } + } + + async processAll() { + await Promise.all([this.ctx.backgroundQueue.processAll()]) + } + + async close() { + await this.server.destroy() + } +} diff --git a/packages/dev-env/src/types.ts b/packages/dev-env/src/types.ts index 3bbcaf15257..e186c68c2fc 100644 --- a/packages/dev-env/src/types.ts +++ b/packages/dev-env/src/types.ts @@ -1,5 +1,6 @@ import * as pds from '@atproto/pds' import * as bsky from '@atproto/bsky' +import * as ozone from '@atproto/ozone' import { ImageInvalidator } from '@atproto/bsky/src/image/invalidator' export type PlcConfig = { @@ -25,10 +26,18 @@ export type BskyConfig = Partial & { ingester?: Partial } +export type OzoneConfig = Partial & { + enabled?: boolean + plcUrl: string + dbPrimaryPostgresUrl: string + migration?: string +} + export type TestServerParams = { dbPostgresUrl: string dbPostgresSchema: string pds: Partial plc: Partial bsky: Partial + ozone: Partial } diff --git a/packages/mod-service/src/db/migrations/20230309T045948368Z-init.ts b/packages/mod-service/src/db/migrations/20230309T045948368Z-init.ts deleted file mode 100644 index 1ddfa30acbc..00000000000 --- a/packages/mod-service/src/db/migrations/20230309T045948368Z-init.ts +++ /dev/null @@ -1,305 +0,0 @@ -import { Kysely, sql } from 'kysely' - -// @TODO subject indexes, naming? -// @TODO drop indexes in down()? - -export async function up(db: Kysely): Promise { - try { - // Add trigram support, supporting user search. - // Explicitly add to public schema, so the extension can be seen in all schemas. - await sql`create extension if not exists pg_trgm with schema public`.execute( - db, - ) - } catch (err: unknown) { - // The "if not exists" isn't bulletproof against races, and we see test suites racing to - // create the extension. So we can just ignore errors indicating the extension already exists. - if (!err?.['detail']?.includes?.('(pg_trgm) already exists')) throw err - } - - // duplicateRecords - await db.schema - .createTable('duplicate_record') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('duplicateOf', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .execute() - - // profile - await db.schema - .createTable('profile') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('displayName', 'varchar') - .addColumn('description', 'varchar') - .addColumn('avatarCid', 'varchar') - .addColumn('bannerCid', 'varchar') - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .execute() - // for, eg, profile views - await db.schema - .createIndex('profile_creator_idx') - .on('profile') - .column('creator') - .execute() - await db.schema // Supports user search - .createIndex(`profile_display_name_tgrm_idx`) - .on('profile') - .using('gist') - .expression(sql`"displayName" gist_trgm_ops`) - .execute() - - // post - await db.schema - .createTable('post') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('text', 'varchar', (col) => col.notNull()) - .addColumn('replyRoot', 'varchar') - .addColumn('replyRootCid', 'varchar') - .addColumn('replyParent', 'varchar') - .addColumn('replyParentCid', 'varchar') - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - .execute() - // for, eg, "postsCount" on profile views - await db.schema - .createIndex('post_creator_idx') - .on('post') - .column('creator') - .execute() - // for, eg, "replyCount" on posts in feed views - await db.schema - .createIndex('post_replyparent_idx') - .on('post') - .column('replyParent') - .execute() - await db.schema - .createIndex('post_order_by_idx') - .on('post') - .columns(['sortAt', 'cid']) - .execute() - - // postEmbedImage - await db.schema - .createTable('post_embed_image') - .addColumn('postUri', 'varchar', (col) => col.notNull()) - .addColumn('position', 'varchar', (col) => col.notNull()) - .addColumn('imageCid', 'varchar', (col) => col.notNull()) - .addColumn('alt', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('post_embed_image_pkey', ['postUri', 'position']) - .execute() - - // postEmbedExternal - await db.schema - .createTable('post_embed_external') - .addColumn('postUri', 'varchar', (col) => col.primaryKey()) - .addColumn('uri', 'varchar', (col) => col.notNull()) - .addColumn('title', 'varchar', (col) => col.notNull()) - .addColumn('description', 'varchar', (col) => col.notNull()) - .addColumn('thumbCid', 'varchar') - .execute() - - // postEmbedRecord - await db.schema - .createTable('post_embed_record') - .addColumn('postUri', 'varchar', (col) => col.notNull()) - .addColumn('embedUri', 'varchar', (col) => col.notNull()) - .addColumn('embedCid', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('post_embed_record_pkey', ['postUri', 'embedUri']) - .execute() - - // postHierarchy - await db.schema - .createTable('post_hierarchy') - .addColumn('uri', 'varchar', (col) => col.notNull()) - .addColumn('ancestorUri', 'varchar', (col) => col.notNull()) - .addColumn('depth', 'integer', (col) => col.notNull()) - .addPrimaryKeyConstraint('post_hierarchy_pkey', ['uri', 'ancestorUri']) - .execute() - // Supports fetching all children for a post - await db.schema - .createIndex('post_hierarchy_ancestoruri_idx') - .on('post_hierarchy') - .column('ancestorUri') - .execute() - - // repost - await db.schema - .createTable('repost') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('subject', 'varchar', (col) => col.notNull()) - .addColumn('subjectCid', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - .addUniqueConstraint('repost_unique_subject', ['creator', 'subject']) - .execute() - // for, eg, "repostCount" on posts in feed views - await db.schema - .createIndex('repost_subject_idx') - .on('repost') - .column('subject') - .execute() - await db.schema - .createIndex('repost_order_by_idx') - .on('repost') - .columns(['sortAt', 'cid']) - .execute() - - // feedItem - await db.schema - .createTable('feed_item') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('type', 'varchar', (col) => col.notNull()) - .addColumn('postUri', 'varchar', (col) => col.notNull()) - .addColumn('originatorDid', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => col.notNull()) - .execute() - await db.schema - .createIndex('feed_item_originator_idx') - .on('feed_item') - .column('originatorDid') - .execute() - await db.schema - .createIndex('feed_item_cursor_idx') - .on('feed_item') - .columns(['sortAt', 'cid']) - .execute() - - // follow - await db.schema - .createTable('follow') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('subjectDid', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - .addUniqueConstraint('follow_unique_subject', ['creator', 'subjectDid']) - .execute() - // for, eg, "followersCount" on profile views - await db.schema - .createIndex('follow_subjectdid_idx') - .on('follow') - .column('subjectDid') - .execute() - - // like - await db.schema - .createTable('like') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('subject', 'varchar', (col) => col.notNull()) - .addColumn('subjectCid', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - // Aids in index uniqueness plus post like counts - .addUniqueConstraint('like_unique_subject', ['subject', 'creator']) - .execute() - - // subscription - await db.schema - .createTable('subscription') - .addColumn('service', 'varchar', (col) => col.notNull()) - .addColumn('method', 'varchar', (col) => col.notNull()) - .addColumn('state', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('subscription_pkey', ['service', 'method']) - .execute() - - // actor - await db.schema - .createTable('actor') - .addColumn('did', 'varchar', (col) => col.primaryKey()) - .addColumn('handle', 'varchar', (col) => col.unique()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('takedownId', 'integer') // foreign key created in moderation-init migration - .execute() - await db.schema // Supports user search - .createIndex(`actor_handle_tgrm_idx`) - .on('actor') - .using('gist') - .expression(sql`"handle" gist_trgm_ops`) - .execute() - - // actor sync state - await db.schema - .createTable('actor_sync') - .addColumn('did', 'varchar', (col) => col.primaryKey()) - .addColumn('commitCid', 'varchar', (col) => col.notNull()) - .addColumn('commitDataCid', 'varchar', (col) => col.notNull()) - .addColumn('rebaseCount', 'integer', (col) => col.notNull()) - .addColumn('tooBigCount', 'integer', (col) => col.notNull()) - .execute() - - //record - await db.schema - .createTable('record') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('did', 'varchar', (col) => col.notNull()) - .addColumn('json', 'text', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('takedownId', 'integer') // foreign key created in moderation-init migration - .execute() -} - -export async function down(db: Kysely): Promise { - // record - await db.schema.dropTable('record').execute() - // actor - await db.schema.dropTable('actor').execute() - // subscription - await db.schema.dropTable('subscription').execute() - // like - await db.schema.dropTable('like').execute() - // follow - await db.schema.dropTable('follow').execute() - // feedItem - await db.schema.dropTable('feed_item').execute() - // repost - await db.schema.dropTable('repost').execute() - // postHierarchy - await db.schema.dropTable('post_hierarchy').execute() - // postEmbedRecord - await db.schema.dropTable('post_embed_record').execute() - // postEmbedExternal - await db.schema.dropTable('post_embed_external').execute() - // postEmbedImage - await db.schema.dropTable('post_embed_image').execute() - // post - await db.schema.dropTable('post').execute() - // profile - await db.schema.dropTable('profile').execute() - // duplicateRecords - await db.schema.dropTable('duplicate_record').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230408T152211201Z-notification-init.ts b/packages/mod-service/src/db/migrations/20230408T152211201Z-notification-init.ts deleted file mode 100644 index 9c11ed9835f..00000000000 --- a/packages/mod-service/src/db/migrations/20230408T152211201Z-notification-init.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - // Notifications - await db.schema - .createTable('notification') - .addColumn('id', 'bigserial', (col) => col.primaryKey()) - .addColumn('did', 'varchar', (col) => col.notNull()) - .addColumn('recordUri', 'varchar', (col) => col.notNull()) - .addColumn('recordCid', 'varchar', (col) => col.notNull()) - .addColumn('author', 'varchar', (col) => col.notNull()) - .addColumn('reason', 'varchar', (col) => col.notNull()) - .addColumn('reasonSubject', 'varchar') - .addColumn('sortAt', 'varchar', (col) => col.notNull()) - .execute() - await db.schema - .createIndex('notification_did_sortat_idx') - .on('notification') - .columns(['did', 'sortAt']) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('notification').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230417T210628672Z-moderation-init.ts b/packages/mod-service/src/db/migrations/20230417T210628672Z-moderation-init.ts deleted file mode 100644 index b4778510005..00000000000 --- a/packages/mod-service/src/db/migrations/20230417T210628672Z-moderation-init.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - // moderation actions - await db.schema - .createTable('moderation_action') - .addColumn('id', 'serial', (col) => col.primaryKey()) - .addColumn('action', 'varchar', (col) => col.notNull()) - .addColumn('subjectType', 'varchar', (col) => col.notNull()) - .addColumn('subjectDid', 'varchar', (col) => col.notNull()) - .addColumn('subjectUri', 'varchar') - .addColumn('subjectCid', 'varchar') - .addColumn('reason', 'text', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('createdBy', 'varchar', (col) => col.notNull()) - .addColumn('reversedAt', 'varchar') - .addColumn('reversedBy', 'varchar') - .addColumn('reversedReason', 'text') - .addColumn('createLabelVals', 'varchar') - .addColumn('negateLabelVals', 'varchar') - .execute() - await db.schema - .createTable('moderation_action_subject_blob') - .addColumn('actionId', 'integer', (col) => - col.notNull().references('moderation_action.id'), - ) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('moderation_action_subject_blob_pkey', [ - 'actionId', - 'cid', - ]) - .execute() - await db.schema - .createIndex('moderation_action_subject_blob_cid_idx') - .on('moderation_action_subject_blob') - .column('cid') - .execute() - - // moderation reports - await db.schema - .createTable('moderation_report') - .addColumn('id', 'serial', (col) => col.primaryKey()) - .addColumn('subjectType', 'varchar', (col) => col.notNull()) - .addColumn('subjectDid', 'varchar', (col) => col.notNull()) - .addColumn('subjectUri', 'varchar') - .addColumn('subjectCid', 'varchar') - .addColumn('reasonType', 'varchar', (col) => col.notNull()) - .addColumn('reason', 'text') - .addColumn('reportedByDid', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .execute() - - // moderation report resolutions - await db.schema - .createTable('moderation_report_resolution') - .addColumn('reportId', 'integer', (col) => - col.notNull().references('moderation_report.id'), - ) - .addColumn('actionId', 'integer', (col) => - col.notNull().references('moderation_action.id'), - ) - .addColumn('createdBy', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('moderation_report_resolution_pkey', [ - 'reportId', - 'actionId', - ]) - .execute() - await db.schema - .createIndex('moderation_report_resolution_action_id_idx') - .on('moderation_report_resolution') - .column('actionId') - .execute() - - // labels - await db.schema - .createTable('label') - .addColumn('src', 'varchar', (col) => col.notNull()) - .addColumn('uri', 'varchar', (col) => col.notNull()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('val', 'varchar', (col) => col.notNull()) - .addColumn('neg', 'boolean', (col) => col.notNull()) - .addColumn('cts', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('label_pkey', ['src', 'uri', 'cid', 'val']) - .execute() - await db.schema - .createIndex('label_uri_index') - .on('label') - .column('uri') - .execute() - - // foreign keys - await db.schema - .alterTable('actor') - .addForeignKeyConstraint( - 'actor_takedown_id_fkey', - ['takedownId'], - 'moderation_action', - ['id'], - ) - .execute() - await db.schema - .alterTable('record') - .addForeignKeyConstraint( - 'record_takedown_id_fkey', - ['takedownId'], - 'moderation_action', - ['id'], - ) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema - .alterTable('record') - .dropConstraint('record_takedown_id_fkey') - .execute() - await db.schema - .alterTable('actor') - .dropConstraint('actor_takedown_id_fkey') - .execute() - await db.schema.dropTable('label').execute() - await db.schema.dropTable('moderation_report_resolution').execute() - await db.schema.dropTable('moderation_report').execute() - await db.schema.dropTable('moderation_action_subject_blob').execute() - await db.schema.dropTable('moderation_action').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230420T211446071Z-did-cache.ts b/packages/mod-service/src/db/migrations/20230420T211446071Z-did-cache.ts deleted file mode 100644 index 2546c07eebc..00000000000 --- a/packages/mod-service/src/db/migrations/20230420T211446071Z-did-cache.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('did_cache') - .addColumn('did', 'varchar', (col) => col.primaryKey()) - .addColumn('doc', 'jsonb', (col) => col.notNull()) - .addColumn('updatedAt', 'bigint', (col) => col.notNull()) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('did_cache').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230427T194702079Z-notif-record-index.ts b/packages/mod-service/src/db/migrations/20230427T194702079Z-notif-record-index.ts deleted file mode 100644 index d95279e1a69..00000000000 --- a/packages/mod-service/src/db/migrations/20230427T194702079Z-notif-record-index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - // Supports record deletion - await db.schema - .createIndex('notification_record_idx') - .on('notification') - .column('recordUri') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropIndex('notification_record_idx').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230605T144730094Z-post-profile-aggs.ts b/packages/mod-service/src/db/migrations/20230605T144730094Z-post-profile-aggs.ts deleted file mode 100644 index a9b829c3526..00000000000 --- a/packages/mod-service/src/db/migrations/20230605T144730094Z-post-profile-aggs.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('post_agg') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('likeCount', 'bigint', (col) => col.notNull().defaultTo(0)) - .addColumn('replyCount', 'bigint', (col) => col.notNull().defaultTo(0)) - .addColumn('repostCount', 'bigint', (col) => col.notNull().defaultTo(0)) - .execute() - await db.schema - .createTable('profile_agg') - .addColumn('did', 'varchar', (col) => col.primaryKey()) - .addColumn('followersCount', 'bigint', (col) => col.notNull().defaultTo(0)) - .addColumn('followsCount', 'bigint', (col) => col.notNull().defaultTo(0)) - .addColumn('postsCount', 'bigint', (col) => col.notNull().defaultTo(0)) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('profile_agg').execute() - await db.schema.dropTable('post_agg').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230607T211442112Z-feed-generator-init.ts b/packages/mod-service/src/db/migrations/20230607T211442112Z-feed-generator-init.ts deleted file mode 100644 index 89543c01819..00000000000 --- a/packages/mod-service/src/db/migrations/20230607T211442112Z-feed-generator-init.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Kysely, sql } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('feed_generator') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('feedDid', 'varchar', (col) => col.notNull()) - .addColumn('displayName', 'varchar') - .addColumn('description', 'varchar') - .addColumn('descriptionFacets', 'varchar') - .addColumn('avatarCid', 'varchar') - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - .execute() - - await db.schema - .createIndex('feed_generator_creator_index') - .on('feed_generator') - .column('creator') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropIndex('feed_generator_creator_index').execute() - await db.schema.dropTable('feed_generator').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230608T155101190Z-algo-whats-hot-view.ts b/packages/mod-service/src/db/migrations/20230608T155101190Z-algo-whats-hot-view.ts deleted file mode 100644 index 63fb9850ae1..00000000000 --- a/packages/mod-service/src/db/migrations/20230608T155101190Z-algo-whats-hot-view.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { Kysely, sql } from 'kysely' - -export async function up(db: Kysely): Promise { - const { ref } = db.dynamic - - // materialized views are difficult to change, - // so we parameterize them at runtime with contents of this table. - await db.schema - .createTable('view_param') - .addColumn('name', 'varchar', (col) => col.primaryKey()) - .addColumn('value', 'varchar') - .execute() - - await db - .insertInto('view_param') - .values([ - { name: 'whats_hot_like_threshold', value: '2' }, - { name: 'whats_hot_interval', value: '1day' }, - ]) - .execute() - - // define view query for whats-hot feed - // tldr: scored by like count depreciated over time. - - // From: https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm-works-1d9b0cf2c08d - // Score = (P-1) / (T+2)^G - // where, - // P = points of an item (and -1 is to negate submitters vote) - // T = time since submission (in hours) - // G = Gravity, defaults to 1.8 in news.arc - - const likeCount = ref('post_agg.likeCount') - const indexedAt = ref('post.indexedAt') - const computeScore = sql`round(1000000 * (${likeCount} / ((EXTRACT(epoch FROM AGE(now(), ${indexedAt}::timestamp)) / 3600 + 2) ^ 1.8)))` - - const viewQb = db - .selectFrom('post') - .innerJoin('post_agg', 'post_agg.uri', 'post.uri') - .where( - 'post.indexedAt', - '>', - db - .selectFrom('view_param') - .where('name', '=', 'whats_hot_interval') - .select( - sql`to_char(now() - value::interval, 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`.as( - 'val', - ), - ), - ) - .where('post.replyParent', 'is', null) - .where( - 'post_agg.likeCount', - '>', - db // helps cull result set that needs to be sorted - .selectFrom('view_param') - .where('name', '=', 'whats_hot_like_threshold') - .select(sql`value::integer`.as('val')), - ) - .select(['post.uri as uri', 'post.cid as cid', computeScore.as('score')]) - - await db.schema - .createView('algo_whats_hot_view') - .materialized() - .as(viewQb) - .execute() - - // unique index required for pg to refresh view w/ "concurrently" param. - await db.schema - .createIndex('algo_whats_hot_view_uri_idx') - .on('algo_whats_hot_view') - .column('uri') - .unique() - .execute() - await db.schema - .createIndex('algo_whats_hot_view_cursor_idx') - .on('algo_whats_hot_view') - .columns(['score', 'cid']) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropView('algo_whats_hot_view').materialized().execute() - await db.schema.dropTable('view_param').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230608T201813132Z-mute-lists.ts b/packages/mod-service/src/db/migrations/20230608T201813132Z-mute-lists.ts deleted file mode 100644 index f9463f7c47b..00000000000 --- a/packages/mod-service/src/db/migrations/20230608T201813132Z-mute-lists.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Kysely, sql } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('list') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('name', 'varchar', (col) => col.notNull()) - .addColumn('purpose', 'varchar', (col) => col.notNull()) - .addColumn('description', 'varchar') - .addColumn('descriptionFacets', 'varchar') - .addColumn('avatarCid', 'varchar') - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - .execute() - - await db.schema - .createIndex('list_creator_idx') - .on('list') - .column('creator') - .execute() - - await db.schema - .createTable('list_item') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('subjectDid', 'varchar', (col) => col.notNull()) - .addColumn('listUri', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - .addUniqueConstraint('list_item_unique_subject_in_list', [ - 'listUri', - 'subjectDid', - ]) - .execute() - - await db.schema - .createIndex('list_item_creator_idx') - .on('list_item') - .column('creator') - .execute() - - await db.schema - .createIndex('list_item_subject_idx') - .on('list_item') - .column('subjectDid') - .execute() - - await db.schema - .createTable('list_mute') - .addColumn('listUri', 'varchar', (col) => col.notNull()) - .addColumn('mutedByDid', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('list_mute_pkey', ['mutedByDid', 'listUri']) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropIndex('list_creator_idx').execute() - await db.schema.dropIndex('list_item_subject_idx').execute() - await db.schema.dropTable('list').execute() - await db.schema.dropTable('list_item').execute() - await db.schema.dropTable('list_mute').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230608T205147239Z-mutes.ts b/packages/mod-service/src/db/migrations/20230608T205147239Z-mutes.ts deleted file mode 100644 index d5e7663020c..00000000000 --- a/packages/mod-service/src/db/migrations/20230608T205147239Z-mutes.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('mute') - .addColumn('subjectDid', 'varchar', (col) => col.notNull()) - .addColumn('mutedByDid', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('mute_pkey', ['mutedByDid', 'subjectDid']) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('mute').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230609T153623961Z-blocks.ts b/packages/mod-service/src/db/migrations/20230609T153623961Z-blocks.ts deleted file mode 100644 index 0ee11c3997b..00000000000 --- a/packages/mod-service/src/db/migrations/20230609T153623961Z-blocks.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Kysely, sql } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('actor_block') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('subjectDid', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - .addUniqueConstraint('actor_block_unique_subject', [ - 'creator', - 'subjectDid', - ]) - .execute() - await db.schema - .createIndex('actor_block_subjectdid_idx') - .on('actor_block') - .column('subjectDid') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropIndex('actor_block_subjectdid_idx').execute() - await db.schema.dropTable('actor_block').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230609T232122649Z-actor-deletion-indexes.ts b/packages/mod-service/src/db/migrations/20230609T232122649Z-actor-deletion-indexes.ts deleted file mode 100644 index 08c31ae9996..00000000000 --- a/packages/mod-service/src/db/migrations/20230609T232122649Z-actor-deletion-indexes.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Kysely } from 'kysely' - -// Indexes to support efficient actor deletion/unindexing - -export async function up(db: Kysely): Promise { - await db.schema // Also supports record deletes - .createIndex('duplicate_record_duplicate_of_idx') - .on('duplicate_record') - .column('duplicateOf') - .execute() - await db.schema - .createIndex('like_creator_idx') - .on('like') - .column('creator') - .execute() - await db.schema - .createIndex('notification_author_idx') - .on('notification') - .column('author') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropIndex('notification_author_idx').execute() - await db.schema.dropIndex('like_creator_idx').execute() - await db.schema.dropIndex('duplicate_record_duplicate_of_idx').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230610T203555962Z-suggested-follows.ts b/packages/mod-service/src/db/migrations/20230610T203555962Z-suggested-follows.ts deleted file mode 100644 index 11d4ce09be6..00000000000 --- a/packages/mod-service/src/db/migrations/20230610T203555962Z-suggested-follows.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('suggested_follow') - .addColumn('did', 'varchar', (col) => col.primaryKey()) - .addColumn('order', 'integer', (col) => col.notNull()) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('suggested_follow').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230611T215300060Z-actor-state.ts b/packages/mod-service/src/db/migrations/20230611T215300060Z-actor-state.ts deleted file mode 100644 index b22be213710..00000000000 --- a/packages/mod-service/src/db/migrations/20230611T215300060Z-actor-state.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('actor_state') - .addColumn('did', 'varchar', (col) => col.primaryKey()) - .addColumn('lastSeenNotifs', 'varchar', (col) => col.notNull()) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('actor_state').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230620T161134972Z-post-langs.ts b/packages/mod-service/src/db/migrations/20230620T161134972Z-post-langs.ts deleted file mode 100644 index 3bfae433445..00000000000 --- a/packages/mod-service/src/db/migrations/20230620T161134972Z-post-langs.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema.alterTable('post').addColumn('langs', 'jsonb').execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.alterTable('post').dropColumn('langs').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230627T212437895Z-optional-handle.ts b/packages/mod-service/src/db/migrations/20230627T212437895Z-optional-handle.ts deleted file mode 100644 index 74279ef12e1..00000000000 --- a/packages/mod-service/src/db/migrations/20230627T212437895Z-optional-handle.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .alterTable('actor') - .alterColumn('handle') - .dropNotNull() - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema - .alterTable('actor') - .alterColumn('handle') - .setNotNull() - .execute() -} diff --git a/packages/mod-service/src/db/migrations/20230629T220835893Z-remove-post-hierarchy.ts b/packages/mod-service/src/db/migrations/20230629T220835893Z-remove-post-hierarchy.ts deleted file mode 100644 index 36d9b7cd37d..00000000000 --- a/packages/mod-service/src/db/migrations/20230629T220835893Z-remove-post-hierarchy.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Kysely, sql } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema.dropTable('post_hierarchy').execute() - // recreate index that calculates e.g. "replyCount", turning it into a covering index - // for uri so that recursive query for post descendents can use an index-only scan. - await db.schema.dropIndex('post_replyparent_idx').execute() - await sql`create index "post_replyparent_idx" on "post" ("replyParent") include ("uri")`.execute( - db, - ) -} - -export async function down(db: Kysely): Promise { - await db.schema - .createTable('post_hierarchy') - .addColumn('uri', 'varchar', (col) => col.notNull()) - .addColumn('ancestorUri', 'varchar', (col) => col.notNull()) - .addColumn('depth', 'integer', (col) => col.notNull()) - .addPrimaryKeyConstraint('post_hierarchy_pkey', ['uri', 'ancestorUri']) - .execute() - await db.schema - .createIndex('post_hierarchy_ancestoruri_idx') - .on('post_hierarchy') - .column('ancestorUri') - .execute() - await db.schema.dropIndex('post_replyparent_idx').execute() - await db.schema - .createIndex('post_replyparent_idx') - .on('post') - .column('replyParent') - .execute() -} diff --git a/packages/mod-service/src/db/migrations/20230703T045536691Z-feed-and-label-indices.ts b/packages/mod-service/src/db/migrations/20230703T045536691Z-feed-and-label-indices.ts deleted file mode 100644 index bf54deeae2a..00000000000 --- a/packages/mod-service/src/db/migrations/20230703T045536691Z-feed-and-label-indices.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createIndex('label_cts_idx') - .on('label') - .column('cts') - .execute() - await db.schema.dropIndex('feed_item_originator_idx').execute() - await db.schema - .createIndex('feed_item_originator_cursor_idx') - .on('feed_item') - .columns(['originatorDid', 'sortAt', 'cid']) - .execute() - await db.schema - .createIndex('record_did_idx') - .on('record') - .column('did') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropIndex('label_cts_idx').execute() - await db.schema.dropIndex('feed_item_originator_cursor_idx').execute() - await db.schema - .createIndex('feed_item_originator_idx') - .on('feed_item') - .column('originatorDid') - .execute() - await db.schema.dropIndex('record_did_idx').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230720T164800037Z-posts-cursor-idx.ts b/packages/mod-service/src/db/migrations/20230720T164800037Z-posts-cursor-idx.ts deleted file mode 100644 index 4bf7539b1c3..00000000000 --- a/packages/mod-service/src/db/migrations/20230720T164800037Z-posts-cursor-idx.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createIndex('post_creator_cursor_idx') - .on('post') - .columns(['creator', 'sortAt', 'cid']) - .execute() - await db.schema.dropIndex('post_creator_idx').execute() -} - -export async function down(db: Kysely): Promise { - await db.schema - .createIndex('post_creator_idx') - .on('post') - .column('creator') - .execute() - await db.schema.dropIndex('post_creator_cursor_idx').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230807T035309811Z-feed-item-delete-invite-for-user-idx.ts b/packages/mod-service/src/db/migrations/20230807T035309811Z-feed-item-delete-invite-for-user-idx.ts deleted file mode 100644 index 2e1c05ba33a..00000000000 --- a/packages/mod-service/src/db/migrations/20230807T035309811Z-feed-item-delete-invite-for-user-idx.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - // supports post deletion - await db.schema - .createIndex('feed_item_post_uri_idx') - .on('feed_item') - .column('postUri') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropIndex('feed_item_post_uri_idx').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230808T172902639Z-repo-rev.ts b/packages/mod-service/src/db/migrations/20230808T172902639Z-repo-rev.ts deleted file mode 100644 index 0e0141b073b..00000000000 --- a/packages/mod-service/src/db/migrations/20230808T172902639Z-repo-rev.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .alterTable('actor_sync') - .addColumn('repoRev', 'varchar') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.alterTable('actor_sync').dropColumn('repoRev').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230810T203349843Z-action-duration.ts b/packages/mod-service/src/db/migrations/20230810T203349843Z-action-duration.ts deleted file mode 100644 index 0530d4d74fd..00000000000 --- a/packages/mod-service/src/db/migrations/20230810T203349843Z-action-duration.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .alterTable('moderation_action') - .addColumn('durationInHours', 'integer') - .execute() - await db.schema - .alterTable('moderation_action') - .addColumn('expiresAt', 'varchar') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema - .alterTable('moderation_action') - .dropColumn('durationInHours') - .execute() - await db.schema - .alterTable('moderation_action') - .dropColumn('expiresAt') - .execute() -} diff --git a/packages/mod-service/src/db/migrations/20230817T195936007Z-native-notifications.ts b/packages/mod-service/src/db/migrations/20230817T195936007Z-native-notifications.ts deleted file mode 100644 index 22cda5b78a4..00000000000 --- a/packages/mod-service/src/db/migrations/20230817T195936007Z-native-notifications.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('notification_push_token') - .addColumn('did', 'varchar', (col) => col.notNull()) - .addColumn('platform', 'varchar', (col) => col.notNull()) - .addColumn('token', 'varchar', (col) => col.notNull()) - .addColumn('appId', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('notification_push_token_pkey', ['did', 'token']) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('notification_push_token').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230830T205507322Z-suggested-feeds.ts b/packages/mod-service/src/db/migrations/20230830T205507322Z-suggested-feeds.ts deleted file mode 100644 index fd99206be25..00000000000 --- a/packages/mod-service/src/db/migrations/20230830T205507322Z-suggested-feeds.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('suggested_feed') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('order', 'integer', (col) => col.notNull()) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('suggested_feed').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230904T211011773Z-block-lists.ts b/packages/mod-service/src/db/migrations/20230904T211011773Z-block-lists.ts deleted file mode 100644 index e61996c573f..00000000000 --- a/packages/mod-service/src/db/migrations/20230904T211011773Z-block-lists.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Kysely, sql } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('list_block') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('subjectUri', 'varchar', (col) => col.notNull()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .addColumn('sortAt', 'varchar', (col) => - col - .generatedAlwaysAs(sql`least("createdAt", "indexedAt")`) - .stored() - .notNull(), - ) - .addUniqueConstraint('list_block_unique_subject', ['creator', 'subjectUri']) - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('list_block').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230906T222220386Z-thread-gating.ts b/packages/mod-service/src/db/migrations/20230906T222220386Z-thread-gating.ts deleted file mode 100644 index 4c417278d67..00000000000 --- a/packages/mod-service/src/db/migrations/20230906T222220386Z-thread-gating.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('thread_gate') - .addColumn('uri', 'varchar', (col) => col.primaryKey()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('creator', 'varchar', (col) => col.notNull()) - .addColumn('postUri', 'varchar', (col) => col.notNull().unique()) - .addColumn('createdAt', 'varchar', (col) => col.notNull()) - .addColumn('indexedAt', 'varchar', (col) => col.notNull()) - .execute() - await db.schema - .alterTable('post') - .addColumn('invalidReplyRoot', 'boolean') - .execute() - await db.schema - .alterTable('post') - .addColumn('violatesThreadGate', 'boolean') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('thread_gate').execute() - await db.schema.alterTable('post').dropColumn('invalidReplyRoot').execute() - await db.schema.alterTable('post').dropColumn('violatesThreadGate').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230920T213858047Z-add-tags-to-post.ts b/packages/mod-service/src/db/migrations/20230920T213858047Z-add-tags-to-post.ts deleted file mode 100644 index 9d4e5bd4cfb..00000000000 --- a/packages/mod-service/src/db/migrations/20230920T213858047Z-add-tags-to-post.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema.alterTable('post').addColumn('tags', 'jsonb').execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.alterTable('post').dropColumn('tags').execute() -} diff --git a/packages/mod-service/src/db/migrations/20230929T192920807Z-record-cursor-indexes.ts b/packages/mod-service/src/db/migrations/20230929T192920807Z-record-cursor-indexes.ts deleted file mode 100644 index 0b587fe0eaf..00000000000 --- a/packages/mod-service/src/db/migrations/20230929T192920807Z-record-cursor-indexes.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createIndex('like_creator_cursor_idx') - .on('like') - .columns(['creator', 'sortAt', 'cid']) - .execute() - await db.schema - .createIndex('follow_creator_cursor_idx') - .on('follow') - .columns(['creator', 'sortAt', 'cid']) - .execute() - await db.schema - .createIndex('follow_subject_cursor_idx') - .on('follow') - .columns(['subjectDid', 'sortAt', 'cid']) - .execute() - - // drop old indices that are superceded by these - await db.schema.dropIndex('like_creator_idx').execute() - await db.schema.dropIndex('follow_subjectdid_idx').execute() -} - -export async function down(db: Kysely): Promise { - await db.schema - .createIndex('like_creator_idx') - .on('like') - .column('creator') - .execute() - await db.schema - .createIndex('follow_subjectdid_idx') - .on('follow') - .column('subjectDid') - .execute() - - await db.schema.dropIndex('like_creator_cursor_idx').execute() - await db.schema.dropIndex('follow_creator_cursor_idx').execute() - await db.schema.dropIndex('follow_subject_cursor_idx').execute() -} diff --git a/packages/mod-service/src/db/migrations/20231205T000257238Z-remove-did-cache.ts b/packages/mod-service/src/db/migrations/20231205T000257238Z-remove-did-cache.ts deleted file mode 100644 index 6b57a88bbb9..00000000000 --- a/packages/mod-service/src/db/migrations/20231205T000257238Z-remove-did-cache.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema.dropTable('did_cache').execute() -} - -export async function down(db: Kysely): Promise { - await db.schema - .createTable('did_cache') - .addColumn('did', 'varchar', (col) => col.primaryKey()) - .addColumn('doc', 'jsonb', (col) => col.notNull()) - .addColumn('updatedAt', 'bigint', (col) => col.notNull()) - .execute() -} diff --git a/packages/mod-service/src/db/migrations/index.ts b/packages/mod-service/src/db/migrations/index.ts deleted file mode 100644 index f3ed5bc4dbd..00000000000 --- a/packages/mod-service/src/db/migrations/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -// NOTE this file can be edited by hand, but it is also appended to by the migration:create command. -// It's important that every migration is exported from here with the proper name. We'd simplify -// this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process. - -export * as _20230309T045948368Z from './20230309T045948368Z-init' -export * as _20230408T152211201Z from './20230408T152211201Z-notification-init' -export * as _20230417T210628672Z from './20230417T210628672Z-moderation-init' -export * as _20230420T211446071Z from './20230420T211446071Z-did-cache' -export * as _20230427T194702079Z from './20230427T194702079Z-notif-record-index' -export * as _20230605T144730094Z from './20230605T144730094Z-post-profile-aggs' -export * as _20230607T211442112Z from './20230607T211442112Z-feed-generator-init' -export * as _20230608T155101190Z from './20230608T155101190Z-algo-whats-hot-view' -export * as _20230608T201813132Z from './20230608T201813132Z-mute-lists' -export * as _20230608T205147239Z from './20230608T205147239Z-mutes' -export * as _20230609T153623961Z from './20230609T153623961Z-blocks' -export * as _20230609T232122649Z from './20230609T232122649Z-actor-deletion-indexes' -export * as _20230610T203555962Z from './20230610T203555962Z-suggested-follows' -export * as _20230611T215300060Z from './20230611T215300060Z-actor-state' -export * as _20230620T161134972Z from './20230620T161134972Z-post-langs' -export * as _20230627T212437895Z from './20230627T212437895Z-optional-handle' -export * as _20230629T220835893Z from './20230629T220835893Z-remove-post-hierarchy' -export * as _20230703T045536691Z from './20230703T045536691Z-feed-and-label-indices' -export * as _20230720T164800037Z from './20230720T164800037Z-posts-cursor-idx' -export * as _20230807T035309811Z from './20230807T035309811Z-feed-item-delete-invite-for-user-idx' -export * as _20230808T172902639Z from './20230808T172902639Z-repo-rev' -export * as _20230810T203349843Z from './20230810T203349843Z-action-duration' -export * as _20230817T195936007Z from './20230817T195936007Z-native-notifications' -export * as _20230830T205507322Z from './20230830T205507322Z-suggested-feeds' -export * as _20230904T211011773Z from './20230904T211011773Z-block-lists' -export * as _20230906T222220386Z from './20230906T222220386Z-thread-gating' -export * as _20230920T213858047Z from './20230920T213858047Z-add-tags-to-post' -export * as _20230929T192920807Z from './20230929T192920807Z-record-cursor-indexes' -export * as _20231003T202833377Z from './20231003T202833377Z-create-moderation-subject-status' -export * as _20231205T000257238Z from './20231205T000257238Z-remove-did-cache' diff --git a/packages/mod-service/CHANGELOG.md b/packages/ozone/CHANGELOG.md similarity index 100% rename from packages/mod-service/CHANGELOG.md rename to packages/ozone/CHANGELOG.md diff --git a/packages/mod-service/README.md b/packages/ozone/README.md similarity index 100% rename from packages/mod-service/README.md rename to packages/ozone/README.md diff --git a/packages/mod-service/babel.config.js b/packages/ozone/babel.config.js similarity index 100% rename from packages/mod-service/babel.config.js rename to packages/ozone/babel.config.js diff --git a/packages/mod-service/bin/migration-create.ts b/packages/ozone/bin/migration-create.ts similarity index 100% rename from packages/mod-service/bin/migration-create.ts rename to packages/ozone/bin/migration-create.ts diff --git a/packages/mod-service/build.js b/packages/ozone/build.js similarity index 100% rename from packages/mod-service/build.js rename to packages/ozone/build.js diff --git a/packages/mod-service/jest.config.js b/packages/ozone/jest.config.js similarity index 100% rename from packages/mod-service/jest.config.js rename to packages/ozone/jest.config.js diff --git a/packages/mod-service/package.json b/packages/ozone/package.json similarity index 97% rename from packages/mod-service/package.json rename to packages/ozone/package.json index a00effa98ef..ddf8a076f47 100644 --- a/packages/mod-service/package.json +++ b/packages/ozone/package.json @@ -1,5 +1,5 @@ { - "name": "@atproto/mod-service", + "name": "@atproto/ozone", "version": "0.0.21", "license": "MIT", "description": "Reference implementation of app.bsky App View (Bluesky API)", @@ -11,7 +11,7 @@ "repository": { "type": "git", "url": "https://github.com/bluesky-social/atproto", - "directory": "packages/bsky" + "directory": "packages/ozone" }, "main": "src/index.ts", "publishConfig": { diff --git a/packages/mod-service/src/api/com/atproto/admin/emitModerationEvent.ts b/packages/ozone/src/api/com/atproto/admin/emitModerationEvent.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/admin/emitModerationEvent.ts rename to packages/ozone/src/api/com/atproto/admin/emitModerationEvent.ts diff --git a/packages/mod-service/src/api/com/atproto/admin/getModerationEvent.ts b/packages/ozone/src/api/com/atproto/admin/getModerationEvent.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/admin/getModerationEvent.ts rename to packages/ozone/src/api/com/atproto/admin/getModerationEvent.ts diff --git a/packages/mod-service/src/api/com/atproto/admin/getRecord.ts b/packages/ozone/src/api/com/atproto/admin/getRecord.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/admin/getRecord.ts rename to packages/ozone/src/api/com/atproto/admin/getRecord.ts diff --git a/packages/mod-service/src/api/com/atproto/admin/getRepo.ts b/packages/ozone/src/api/com/atproto/admin/getRepo.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/admin/getRepo.ts rename to packages/ozone/src/api/com/atproto/admin/getRepo.ts diff --git a/packages/mod-service/src/api/com/atproto/admin/queryModerationEvents.ts b/packages/ozone/src/api/com/atproto/admin/queryModerationEvents.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/admin/queryModerationEvents.ts rename to packages/ozone/src/api/com/atproto/admin/queryModerationEvents.ts diff --git a/packages/mod-service/src/api/com/atproto/admin/queryModerationStatuses.ts b/packages/ozone/src/api/com/atproto/admin/queryModerationStatuses.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/admin/queryModerationStatuses.ts rename to packages/ozone/src/api/com/atproto/admin/queryModerationStatuses.ts diff --git a/packages/mod-service/src/api/com/atproto/admin/searchRepos.ts b/packages/ozone/src/api/com/atproto/admin/searchRepos.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/admin/searchRepos.ts rename to packages/ozone/src/api/com/atproto/admin/searchRepos.ts diff --git a/packages/mod-service/src/api/com/atproto/admin/util.ts b/packages/ozone/src/api/com/atproto/admin/util.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/admin/util.ts rename to packages/ozone/src/api/com/atproto/admin/util.ts diff --git a/packages/mod-service/src/api/com/atproto/moderation/createReport.ts b/packages/ozone/src/api/com/atproto/moderation/createReport.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/moderation/createReport.ts rename to packages/ozone/src/api/com/atproto/moderation/createReport.ts diff --git a/packages/mod-service/src/api/com/atproto/moderation/util.ts b/packages/ozone/src/api/com/atproto/moderation/util.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/moderation/util.ts rename to packages/ozone/src/api/com/atproto/moderation/util.ts diff --git a/packages/mod-service/src/api/com/atproto/temp/fetchLabels.ts b/packages/ozone/src/api/com/atproto/temp/fetchLabels.ts similarity index 100% rename from packages/mod-service/src/api/com/atproto/temp/fetchLabels.ts rename to packages/ozone/src/api/com/atproto/temp/fetchLabels.ts diff --git a/packages/mod-service/src/api/health.ts b/packages/ozone/src/api/health.ts similarity index 100% rename from packages/mod-service/src/api/health.ts rename to packages/ozone/src/api/health.ts diff --git a/packages/mod-service/src/api/index.ts b/packages/ozone/src/api/index.ts similarity index 100% rename from packages/mod-service/src/api/index.ts rename to packages/ozone/src/api/index.ts diff --git a/packages/mod-service/src/api/util.ts b/packages/ozone/src/api/util.ts similarity index 100% rename from packages/mod-service/src/api/util.ts rename to packages/ozone/src/api/util.ts diff --git a/packages/mod-service/src/api/well-known.ts b/packages/ozone/src/api/well-known.ts similarity index 100% rename from packages/mod-service/src/api/well-known.ts rename to packages/ozone/src/api/well-known.ts diff --git a/packages/mod-service/src/auth.ts b/packages/ozone/src/auth.ts similarity index 100% rename from packages/mod-service/src/auth.ts rename to packages/ozone/src/auth.ts diff --git a/packages/mod-service/src/background.ts b/packages/ozone/src/background.ts similarity index 100% rename from packages/mod-service/src/background.ts rename to packages/ozone/src/background.ts diff --git a/packages/mod-service/src/config.ts b/packages/ozone/src/config.ts similarity index 100% rename from packages/mod-service/src/config.ts rename to packages/ozone/src/config.ts diff --git a/packages/mod-service/src/context.ts b/packages/ozone/src/context.ts similarity index 100% rename from packages/mod-service/src/context.ts rename to packages/ozone/src/context.ts diff --git a/packages/mod-service/src/db/index.ts b/packages/ozone/src/db/index.ts similarity index 94% rename from packages/mod-service/src/db/index.ts rename to packages/ozone/src/db/index.ts index 9a5d538e18c..85702af2b79 100644 --- a/packages/mod-service/src/db/index.ts +++ b/packages/ozone/src/db/index.ts @@ -16,6 +16,8 @@ import DatabaseSchema, { DatabaseSchemaType } from './schema' import { PgOptions } from './types' import { dbLogger } from '../logger' import { EventEmitter } from 'stream' +import * as migrations from './migrations' +import { CtxMigrationProvider } from './migrations/provider' export class Database { pool: PgPool @@ -70,6 +72,11 @@ export class Database { this.db = new Kysely({ dialect: new PostgresDialect({ pool }), }) + this.migrator = new Migrator({ + db: this.db, + migrationTableSchema: opts.schema, + provider: new CtxMigrationProvider(migrations, 'pg'), + }) } get schema(): string | undefined { diff --git a/packages/mod-service/src/db/leader.ts b/packages/ozone/src/db/leader.ts similarity index 100% rename from packages/mod-service/src/db/leader.ts rename to packages/ozone/src/db/leader.ts diff --git a/packages/mod-service/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts b/packages/ozone/src/db/migrations/20231219T205730722Z-init.ts similarity index 68% rename from packages/mod-service/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts rename to packages/ozone/src/db/migrations/20231219T205730722Z-init.ts index 5419233804e..beac37d7277 100644 --- a/packages/mod-service/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts +++ b/packages/ozone/src/db/migrations/20231219T205730722Z-init.ts @@ -1,6 +1,7 @@ import { Kysely } from 'kysely' export async function up(db: Kysely): Promise { + // Moderation event await db.schema .createTable('moderation_event') .addColumn('id', 'serial', (col) => col.primaryKey()) @@ -22,6 +23,8 @@ export async function up(db: Kysely): Promise { .addColumn('negateLabelVals', 'varchar') .addColumn('legacyRefId', 'integer') .execute() + + // Moderation subject status await db.schema .createTable('moderation_subject_status') .addColumn('id', 'serial', (col) => col.primaryKey()) @@ -60,64 +63,45 @@ export async function up(db: Kysely): Promise { .column('blobCids') .execute() - // Move foreign keys from moderation_action to moderation_event - await db.schema - .alterTable('record') - .dropConstraint('record_takedown_id_fkey') - .execute() + // Label await db.schema - .alterTable('actor') - .dropConstraint('actor_takedown_id_fkey') + .createTable('label') + .addColumn('src', 'varchar', (col) => col.notNull()) + .addColumn('uri', 'varchar', (col) => col.notNull()) + .addColumn('cid', 'varchar', (col) => col.notNull()) + .addColumn('val', 'varchar', (col) => col.notNull()) + .addColumn('neg', 'boolean', (col) => col.notNull()) + .addColumn('cts', 'varchar', (col) => col.notNull()) + .addPrimaryKeyConstraint('label_pkey', ['src', 'uri', 'cid', 'val']) .execute() await db.schema - .alterTable('actor') - .addForeignKeyConstraint( - 'actor_takedown_id_fkey', - ['takedownId'], - 'moderation_event', - ['id'], - ) + .createIndex('label_uri_index') + .on('label') + .column('uri') .execute() + + // PushEvent await db.schema - .alterTable('record') - .addForeignKeyConstraint( - 'record_takedown_id_fkey', - ['takedownId'], - 'moderation_event', - ['id'], - ) + .createTable('push_event') + .addColumn('eventType', 'varchar', (col) => col.notNull()) + .addColumn('subjectDid', 'varchar', (col) => col.notNull()) + .addColumn('subjectUri', 'varchar') + .addColumn('subjectCid', 'varchar') + .addColumn('subjectBlobCid', 'varchar') + .addColumn('takedownId', 'integer') + .addColumn('confirmedAt', 'varchar') + .addPrimaryKeyConstraint('push_event_pkey', [ + 'eventType', + 'subjectDid', + 'subjectUri', + 'subjectBlobCid', + ]) .execute() } export async function down(db: Kysely): Promise { await db.schema.dropTable('moderation_event').execute() await db.schema.dropTable('moderation_subject_status').execute() - - // Revert foreign key constraints - await db.schema - .alterTable('record') - .dropConstraint('record_takedown_id_fkey') - .execute() - await db.schema - .alterTable('actor') - .dropConstraint('actor_takedown_id_fkey') - .execute() - await db.schema - .alterTable('actor') - .addForeignKeyConstraint( - 'actor_takedown_id_fkey', - ['takedownId'], - 'moderation_action', - ['id'], - ) - .execute() - await db.schema - .alterTable('record') - .addForeignKeyConstraint( - 'record_takedown_id_fkey', - ['takedownId'], - 'moderation_action', - ['id'], - ) - .execute() + await db.schema.dropTable('label').execute() + await db.schema.dropTable('push_event').execute() } diff --git a/packages/ozone/src/db/migrations/index.ts b/packages/ozone/src/db/migrations/index.ts new file mode 100644 index 00000000000..de73f4b118f --- /dev/null +++ b/packages/ozone/src/db/migrations/index.ts @@ -0,0 +1,5 @@ +// NOTE this file can be edited by hand, but it is also appended to by the migration:create command. +// It's important that every migration is exported from here with the proper name. We'd simplify +// this with kysely's FileMigrationProvider, but it doesn't play nicely with the build process. + +export * as _20231219T205730722Z from './20231219T205730722Z-init' diff --git a/packages/mod-service/src/db/migrations/provider.ts b/packages/ozone/src/db/migrations/provider.ts similarity index 100% rename from packages/mod-service/src/db/migrations/provider.ts rename to packages/ozone/src/db/migrations/provider.ts diff --git a/packages/mod-service/src/db/pagination.ts b/packages/ozone/src/db/pagination.ts similarity index 100% rename from packages/mod-service/src/db/pagination.ts rename to packages/ozone/src/db/pagination.ts diff --git a/packages/mod-service/src/db/periodic-moderation-event-reversal.ts b/packages/ozone/src/db/periodic-moderation-event-reversal.ts similarity index 100% rename from packages/mod-service/src/db/periodic-moderation-event-reversal.ts rename to packages/ozone/src/db/periodic-moderation-event-reversal.ts diff --git a/packages/mod-service/src/db/schema/index.ts b/packages/ozone/src/db/schema/index.ts similarity index 100% rename from packages/mod-service/src/db/schema/index.ts rename to packages/ozone/src/db/schema/index.ts diff --git a/packages/mod-service/src/db/schema/label.ts b/packages/ozone/src/db/schema/label.ts similarity index 100% rename from packages/mod-service/src/db/schema/label.ts rename to packages/ozone/src/db/schema/label.ts diff --git a/packages/mod-service/src/db/schema/moderation_event.ts b/packages/ozone/src/db/schema/moderation_event.ts similarity index 100% rename from packages/mod-service/src/db/schema/moderation_event.ts rename to packages/ozone/src/db/schema/moderation_event.ts diff --git a/packages/mod-service/src/db/schema/moderation_subject_status.ts b/packages/ozone/src/db/schema/moderation_subject_status.ts similarity index 100% rename from packages/mod-service/src/db/schema/moderation_subject_status.ts rename to packages/ozone/src/db/schema/moderation_subject_status.ts diff --git a/packages/mod-service/src/db/schema/push_event.ts b/packages/ozone/src/db/schema/push_event.ts similarity index 100% rename from packages/mod-service/src/db/schema/push_event.ts rename to packages/ozone/src/db/schema/push_event.ts diff --git a/packages/mod-service/src/db/types.ts b/packages/ozone/src/db/types.ts similarity index 100% rename from packages/mod-service/src/db/types.ts rename to packages/ozone/src/db/types.ts diff --git a/packages/mod-service/src/db/util.ts b/packages/ozone/src/db/util.ts similarity index 100% rename from packages/mod-service/src/db/util.ts rename to packages/ozone/src/db/util.ts diff --git a/packages/mod-service/src/error.ts b/packages/ozone/src/error.ts similarity index 100% rename from packages/mod-service/src/error.ts rename to packages/ozone/src/error.ts diff --git a/packages/mod-service/src/index.ts b/packages/ozone/src/index.ts similarity index 97% rename from packages/mod-service/src/index.ts rename to packages/ozone/src/index.ts index d76438ed310..c06ae6b91c9 100644 --- a/packages/mod-service/src/index.ts +++ b/packages/ozone/src/index.ts @@ -24,7 +24,7 @@ export { Database } from './db' export { PeriodicModerationEventReversal } from './db/periodic-moderation-event-reversal' export { AppContext } from './context' -export class BskyAppView { +export class OzoneService { public ctx: AppContext public app: express.Application public server?: http.Server @@ -40,7 +40,7 @@ export class BskyAppView { db: Database config: ServerConfig signingKey: Keypair - }): BskyAppView { + }): OzoneService { const { db, config, signingKey } = opts const app = express() app.set('trust proxy', true) @@ -85,7 +85,7 @@ export class BskyAppView { app.use(server.xrpc.router) app.use(error.handler) - return new BskyAppView({ ctx, app }) + return new OzoneService({ ctx, app }) } async start(): Promise { @@ -137,4 +137,4 @@ export class BskyAppView { } } -export default BskyAppView +export default OzoneService diff --git a/packages/mod-service/src/lexicon/index.ts b/packages/ozone/src/lexicon/index.ts similarity index 100% rename from packages/mod-service/src/lexicon/index.ts rename to packages/ozone/src/lexicon/index.ts diff --git a/packages/mod-service/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts similarity index 100% rename from packages/mod-service/src/lexicon/lexicons.ts rename to packages/ozone/src/lexicon/lexicons.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/defs.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/defs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/defs.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/defs.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/getPreferences.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/getPreferences.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/getPreferences.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/getPreferences.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/getProfile.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/getProfile.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/getProfile.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/getProfile.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/getProfiles.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/getProfiles.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/getProfiles.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/getProfiles.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/getSuggestions.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/getSuggestions.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/getSuggestions.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/getSuggestions.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/profile.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/profile.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/profile.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/profile.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/putPreferences.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/putPreferences.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/putPreferences.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/putPreferences.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/searchActors.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/searchActors.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/searchActors.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/searchActors.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts b/packages/ozone/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts rename to packages/ozone/src/lexicon/types/app/bsky/actor/searchActorsTypeahead.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/embed/external.ts b/packages/ozone/src/lexicon/types/app/bsky/embed/external.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/embed/external.ts rename to packages/ozone/src/lexicon/types/app/bsky/embed/external.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/embed/images.ts b/packages/ozone/src/lexicon/types/app/bsky/embed/images.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/embed/images.ts rename to packages/ozone/src/lexicon/types/app/bsky/embed/images.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/embed/record.ts b/packages/ozone/src/lexicon/types/app/bsky/embed/record.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/embed/record.ts rename to packages/ozone/src/lexicon/types/app/bsky/embed/record.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/embed/recordWithMedia.ts b/packages/ozone/src/lexicon/types/app/bsky/embed/recordWithMedia.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/embed/recordWithMedia.ts rename to packages/ozone/src/lexicon/types/app/bsky/embed/recordWithMedia.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/defs.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/defs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/defs.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/defs.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/describeFeedGenerator.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/describeFeedGenerator.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/describeFeedGenerator.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/describeFeedGenerator.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/generator.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/generator.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/generator.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/generator.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getActorFeeds.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getActorFeeds.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getActorFeeds.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getActorFeeds.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getActorLikes.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getActorLikes.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getActorLikes.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getActorLikes.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getFeed.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getFeed.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getFeed.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getFeed.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getFeedGenerator.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getFeedGenerator.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getFeedGenerator.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getFeedGenerator.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getFeedGenerators.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getFeedGenerators.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getFeedGenerators.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getFeedGenerators.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getFeedSkeleton.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getFeedSkeleton.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getFeedSkeleton.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getFeedSkeleton.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getLikes.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getLikes.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getLikes.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getLikes.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getListFeed.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getListFeed.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getListFeed.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getListFeed.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getPostThread.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getPostThread.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getPostThread.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getPostThread.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getPosts.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getPosts.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getPosts.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getPosts.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getRepostedBy.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getRepostedBy.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getRepostedBy.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getRepostedBy.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getSuggestedFeeds.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getSuggestedFeeds.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getSuggestedFeeds.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getSuggestedFeeds.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/getTimeline.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/getTimeline.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/getTimeline.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/getTimeline.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/like.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/like.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/like.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/like.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/post.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/post.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/post.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/post.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/repost.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/repost.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/repost.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/repost.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/searchPosts.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/searchPosts.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/searchPosts.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/searchPosts.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/feed/threadgate.ts b/packages/ozone/src/lexicon/types/app/bsky/feed/threadgate.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/feed/threadgate.ts rename to packages/ozone/src/lexicon/types/app/bsky/feed/threadgate.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/block.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/block.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/block.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/block.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/defs.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/defs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/defs.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/defs.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/follow.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/follow.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/follow.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/follow.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getBlocks.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getBlocks.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getBlocks.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getBlocks.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getFollowers.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getFollowers.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getFollowers.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getFollowers.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getFollows.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getFollows.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getFollows.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getFollows.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getList.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getList.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getList.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getList.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getListBlocks.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getListBlocks.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getListBlocks.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getListBlocks.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getListMutes.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getListMutes.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getListMutes.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getListMutes.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getLists.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getLists.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getLists.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getLists.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getMutes.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getMutes.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getMutes.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getMutes.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/list.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/list.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/list.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/list.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/listblock.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/listblock.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/listblock.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/listblock.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/listitem.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/listitem.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/listitem.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/listitem.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/muteActor.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/muteActor.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/muteActor.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/muteActor.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/muteActorList.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/muteActorList.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/muteActorList.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/muteActorList.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/unmuteActor.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/unmuteActor.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/unmuteActor.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/unmuteActor.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/graph/unmuteActorList.ts b/packages/ozone/src/lexicon/types/app/bsky/graph/unmuteActorList.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/graph/unmuteActorList.ts rename to packages/ozone/src/lexicon/types/app/bsky/graph/unmuteActorList.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/notification/getUnreadCount.ts b/packages/ozone/src/lexicon/types/app/bsky/notification/getUnreadCount.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/notification/getUnreadCount.ts rename to packages/ozone/src/lexicon/types/app/bsky/notification/getUnreadCount.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/notification/listNotifications.ts b/packages/ozone/src/lexicon/types/app/bsky/notification/listNotifications.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/notification/listNotifications.ts rename to packages/ozone/src/lexicon/types/app/bsky/notification/listNotifications.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/notification/registerPush.ts b/packages/ozone/src/lexicon/types/app/bsky/notification/registerPush.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/notification/registerPush.ts rename to packages/ozone/src/lexicon/types/app/bsky/notification/registerPush.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/notification/updateSeen.ts b/packages/ozone/src/lexicon/types/app/bsky/notification/updateSeen.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/notification/updateSeen.ts rename to packages/ozone/src/lexicon/types/app/bsky/notification/updateSeen.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/richtext/facet.ts b/packages/ozone/src/lexicon/types/app/bsky/richtext/facet.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/richtext/facet.ts rename to packages/ozone/src/lexicon/types/app/bsky/richtext/facet.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/unspecced/defs.ts b/packages/ozone/src/lexicon/types/app/bsky/unspecced/defs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/unspecced/defs.ts rename to packages/ozone/src/lexicon/types/app/bsky/unspecced/defs.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/unspecced/getPopular.ts b/packages/ozone/src/lexicon/types/app/bsky/unspecced/getPopular.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/unspecced/getPopular.ts rename to packages/ozone/src/lexicon/types/app/bsky/unspecced/getPopular.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/unspecced/getPopularFeedGenerators.ts b/packages/ozone/src/lexicon/types/app/bsky/unspecced/getPopularFeedGenerators.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/unspecced/getPopularFeedGenerators.ts rename to packages/ozone/src/lexicon/types/app/bsky/unspecced/getPopularFeedGenerators.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/unspecced/getTimelineSkeleton.ts b/packages/ozone/src/lexicon/types/app/bsky/unspecced/getTimelineSkeleton.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/unspecced/getTimelineSkeleton.ts rename to packages/ozone/src/lexicon/types/app/bsky/unspecced/getTimelineSkeleton.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts b/packages/ozone/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts rename to packages/ozone/src/lexicon/types/app/bsky/unspecced/searchActorsSkeleton.ts diff --git a/packages/mod-service/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts b/packages/ozone/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts rename to packages/ozone/src/lexicon/types/app/bsky/unspecced/searchPostsSkeleton.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/defs.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/defs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/defs.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/defs.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/deleteAccount.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/deleteAccount.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/deleteAccount.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/deleteAccount.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/disableAccountInvites.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/disableAccountInvites.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/disableAccountInvites.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/disableAccountInvites.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/disableInviteCodes.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/disableInviteCodes.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/disableInviteCodes.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/disableInviteCodes.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/emitModerationEvent.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/emitModerationEvent.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/emitModerationEvent.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/emitModerationEvent.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/enableAccountInvites.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/enableAccountInvites.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/enableAccountInvites.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/enableAccountInvites.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/getAccountInfo.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/getAccountInfo.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/getAccountInfo.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/getAccountInfo.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/getAccountInfos.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/getAccountInfos.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/getAccountInfos.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/getAccountInfos.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/getInviteCodes.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/getInviteCodes.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/getInviteCodes.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/getInviteCodes.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/getModerationEvent.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/getModerationEvent.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/getModerationEvent.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/getModerationEvent.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/getRecord.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/getRecord.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/getRecord.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/getRecord.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/getRepo.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/getRepo.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/getRepo.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/getRepo.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/queryModerationStatuses.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/searchRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/searchRepos.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/searchRepos.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/searchRepos.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/sendEmail.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/sendEmail.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/sendEmail.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/sendEmail.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/updateAccountEmail.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/updateAccountEmail.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/updateAccountEmail.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/updateAccountEmail.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/updateAccountHandle.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/updateAccountHandle.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/updateAccountHandle.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/updateAccountHandle.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts rename to packages/ozone/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/identity/resolveHandle.ts b/packages/ozone/src/lexicon/types/com/atproto/identity/resolveHandle.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/identity/resolveHandle.ts rename to packages/ozone/src/lexicon/types/com/atproto/identity/resolveHandle.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/identity/updateHandle.ts b/packages/ozone/src/lexicon/types/com/atproto/identity/updateHandle.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/identity/updateHandle.ts rename to packages/ozone/src/lexicon/types/com/atproto/identity/updateHandle.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/label/defs.ts b/packages/ozone/src/lexicon/types/com/atproto/label/defs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/label/defs.ts rename to packages/ozone/src/lexicon/types/com/atproto/label/defs.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/label/queryLabels.ts b/packages/ozone/src/lexicon/types/com/atproto/label/queryLabels.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/label/queryLabels.ts rename to packages/ozone/src/lexicon/types/com/atproto/label/queryLabels.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/label/subscribeLabels.ts b/packages/ozone/src/lexicon/types/com/atproto/label/subscribeLabels.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/label/subscribeLabels.ts rename to packages/ozone/src/lexicon/types/com/atproto/label/subscribeLabels.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/moderation/createReport.ts b/packages/ozone/src/lexicon/types/com/atproto/moderation/createReport.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/moderation/createReport.ts rename to packages/ozone/src/lexicon/types/com/atproto/moderation/createReport.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/moderation/defs.ts b/packages/ozone/src/lexicon/types/com/atproto/moderation/defs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/moderation/defs.ts rename to packages/ozone/src/lexicon/types/com/atproto/moderation/defs.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/applyWrites.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/applyWrites.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/applyWrites.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/applyWrites.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/createRecord.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/createRecord.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/createRecord.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/createRecord.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/deleteRecord.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/deleteRecord.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/deleteRecord.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/deleteRecord.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/describeRepo.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/describeRepo.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/describeRepo.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/describeRepo.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/getRecord.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/getRecord.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/getRecord.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/getRecord.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/listRecords.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/listRecords.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/listRecords.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/listRecords.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/putRecord.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/putRecord.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/putRecord.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/putRecord.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/strongRef.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/strongRef.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/strongRef.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/strongRef.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/repo/uploadBlob.ts b/packages/ozone/src/lexicon/types/com/atproto/repo/uploadBlob.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/repo/uploadBlob.ts rename to packages/ozone/src/lexicon/types/com/atproto/repo/uploadBlob.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/confirmEmail.ts b/packages/ozone/src/lexicon/types/com/atproto/server/confirmEmail.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/confirmEmail.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/confirmEmail.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/createAccount.ts b/packages/ozone/src/lexicon/types/com/atproto/server/createAccount.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/createAccount.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/createAccount.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/createAppPassword.ts b/packages/ozone/src/lexicon/types/com/atproto/server/createAppPassword.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/createAppPassword.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/createAppPassword.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/createInviteCode.ts b/packages/ozone/src/lexicon/types/com/atproto/server/createInviteCode.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/createInviteCode.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/createInviteCode.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/createInviteCodes.ts b/packages/ozone/src/lexicon/types/com/atproto/server/createInviteCodes.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/createInviteCodes.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/createInviteCodes.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/createSession.ts b/packages/ozone/src/lexicon/types/com/atproto/server/createSession.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/createSession.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/createSession.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/defs.ts b/packages/ozone/src/lexicon/types/com/atproto/server/defs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/defs.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/defs.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/deleteAccount.ts b/packages/ozone/src/lexicon/types/com/atproto/server/deleteAccount.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/deleteAccount.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/deleteAccount.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/deleteSession.ts b/packages/ozone/src/lexicon/types/com/atproto/server/deleteSession.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/deleteSession.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/deleteSession.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/describeServer.ts b/packages/ozone/src/lexicon/types/com/atproto/server/describeServer.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/describeServer.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/describeServer.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/getAccountInviteCodes.ts b/packages/ozone/src/lexicon/types/com/atproto/server/getAccountInviteCodes.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/getAccountInviteCodes.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/getAccountInviteCodes.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/getSession.ts b/packages/ozone/src/lexicon/types/com/atproto/server/getSession.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/getSession.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/getSession.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/listAppPasswords.ts b/packages/ozone/src/lexicon/types/com/atproto/server/listAppPasswords.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/listAppPasswords.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/listAppPasswords.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/refreshSession.ts b/packages/ozone/src/lexicon/types/com/atproto/server/refreshSession.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/refreshSession.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/refreshSession.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/requestAccountDelete.ts b/packages/ozone/src/lexicon/types/com/atproto/server/requestAccountDelete.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/requestAccountDelete.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/requestAccountDelete.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/requestEmailConfirmation.ts b/packages/ozone/src/lexicon/types/com/atproto/server/requestEmailConfirmation.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/requestEmailConfirmation.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/requestEmailConfirmation.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/requestEmailUpdate.ts b/packages/ozone/src/lexicon/types/com/atproto/server/requestEmailUpdate.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/requestEmailUpdate.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/requestEmailUpdate.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/requestPasswordReset.ts b/packages/ozone/src/lexicon/types/com/atproto/server/requestPasswordReset.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/requestPasswordReset.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/requestPasswordReset.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/reserveSigningKey.ts b/packages/ozone/src/lexicon/types/com/atproto/server/reserveSigningKey.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/reserveSigningKey.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/reserveSigningKey.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/resetPassword.ts b/packages/ozone/src/lexicon/types/com/atproto/server/resetPassword.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/resetPassword.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/resetPassword.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/revokeAppPassword.ts b/packages/ozone/src/lexicon/types/com/atproto/server/revokeAppPassword.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/revokeAppPassword.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/revokeAppPassword.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/server/updateEmail.ts b/packages/ozone/src/lexicon/types/com/atproto/server/updateEmail.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/server/updateEmail.ts rename to packages/ozone/src/lexicon/types/com/atproto/server/updateEmail.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/getBlob.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getBlob.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/getBlob.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/getBlob.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/getBlocks.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getBlocks.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/getBlocks.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/getBlocks.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/getCheckout.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getCheckout.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/getCheckout.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/getCheckout.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/getHead.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getHead.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/getHead.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/getHead.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/getLatestCommit.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getLatestCommit.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/getLatestCommit.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/getLatestCommit.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/getRecord.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getRecord.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/getRecord.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/getRecord.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/getRepo.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/getRepo.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/getRepo.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/getRepo.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/listBlobs.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/listBlobs.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/listBlobs.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/listBlobs.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/listRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/listRepos.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/listRepos.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/listRepos.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/notifyOfUpdate.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/notifyOfUpdate.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/notifyOfUpdate.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/notifyOfUpdate.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/requestCrawl.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/requestCrawl.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/requestCrawl.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/requestCrawl.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/sync/subscribeRepos.ts b/packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/sync/subscribeRepos.ts rename to packages/ozone/src/lexicon/types/com/atproto/sync/subscribeRepos.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/temp/fetchLabels.ts b/packages/ozone/src/lexicon/types/com/atproto/temp/fetchLabels.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/temp/fetchLabels.ts rename to packages/ozone/src/lexicon/types/com/atproto/temp/fetchLabels.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/temp/importRepo.ts b/packages/ozone/src/lexicon/types/com/atproto/temp/importRepo.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/temp/importRepo.ts rename to packages/ozone/src/lexicon/types/com/atproto/temp/importRepo.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/temp/pushBlob.ts b/packages/ozone/src/lexicon/types/com/atproto/temp/pushBlob.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/temp/pushBlob.ts rename to packages/ozone/src/lexicon/types/com/atproto/temp/pushBlob.ts diff --git a/packages/mod-service/src/lexicon/types/com/atproto/temp/transferAccount.ts b/packages/ozone/src/lexicon/types/com/atproto/temp/transferAccount.ts similarity index 100% rename from packages/mod-service/src/lexicon/types/com/atproto/temp/transferAccount.ts rename to packages/ozone/src/lexicon/types/com/atproto/temp/transferAccount.ts diff --git a/packages/mod-service/src/lexicon/util.ts b/packages/ozone/src/lexicon/util.ts similarity index 100% rename from packages/mod-service/src/lexicon/util.ts rename to packages/ozone/src/lexicon/util.ts diff --git a/packages/mod-service/src/logger.ts b/packages/ozone/src/logger.ts similarity index 100% rename from packages/mod-service/src/logger.ts rename to packages/ozone/src/logger.ts diff --git a/packages/mod-service/src/services/index.ts b/packages/ozone/src/services/index.ts similarity index 100% rename from packages/mod-service/src/services/index.ts rename to packages/ozone/src/services/index.ts diff --git a/packages/mod-service/src/services/moderation/index.ts b/packages/ozone/src/services/moderation/index.ts similarity index 100% rename from packages/mod-service/src/services/moderation/index.ts rename to packages/ozone/src/services/moderation/index.ts diff --git a/packages/mod-service/src/services/moderation/pagination.ts b/packages/ozone/src/services/moderation/pagination.ts similarity index 100% rename from packages/mod-service/src/services/moderation/pagination.ts rename to packages/ozone/src/services/moderation/pagination.ts diff --git a/packages/mod-service/src/services/moderation/status.ts b/packages/ozone/src/services/moderation/status.ts similarity index 100% rename from packages/mod-service/src/services/moderation/status.ts rename to packages/ozone/src/services/moderation/status.ts diff --git a/packages/mod-service/src/services/moderation/types.ts b/packages/ozone/src/services/moderation/types.ts similarity index 100% rename from packages/mod-service/src/services/moderation/types.ts rename to packages/ozone/src/services/moderation/types.ts diff --git a/packages/mod-service/src/services/moderation/views.ts b/packages/ozone/src/services/moderation/views.ts similarity index 100% rename from packages/mod-service/src/services/moderation/views.ts rename to packages/ozone/src/services/moderation/views.ts diff --git a/packages/mod-service/src/services/types.ts b/packages/ozone/src/services/types.ts similarity index 100% rename from packages/mod-service/src/services/types.ts rename to packages/ozone/src/services/types.ts diff --git a/packages/mod-service/src/util/date.ts b/packages/ozone/src/util/date.ts similarity index 100% rename from packages/mod-service/src/util/date.ts rename to packages/ozone/src/util/date.ts diff --git a/packages/mod-service/src/util/debug.ts b/packages/ozone/src/util/debug.ts similarity index 100% rename from packages/mod-service/src/util/debug.ts rename to packages/ozone/src/util/debug.ts diff --git a/packages/mod-service/src/util/retry.ts b/packages/ozone/src/util/retry.ts similarity index 100% rename from packages/mod-service/src/util/retry.ts rename to packages/ozone/src/util/retry.ts diff --git a/packages/mod-service/test.env b/packages/ozone/test.env similarity index 100% rename from packages/mod-service/test.env rename to packages/ozone/test.env diff --git a/packages/mod-service/tests/__snapshots__/feed-generation.test.ts.snap b/packages/ozone/tests/__snapshots__/feed-generation.test.ts.snap similarity index 100% rename from packages/mod-service/tests/__snapshots__/feed-generation.test.ts.snap rename to packages/ozone/tests/__snapshots__/feed-generation.test.ts.snap diff --git a/packages/mod-service/tests/__snapshots__/indexing.test.ts.snap b/packages/ozone/tests/__snapshots__/indexing.test.ts.snap similarity index 100% rename from packages/mod-service/tests/__snapshots__/indexing.test.ts.snap rename to packages/ozone/tests/__snapshots__/indexing.test.ts.snap diff --git a/packages/mod-service/tests/_util.ts b/packages/ozone/tests/_util.ts similarity index 100% rename from packages/mod-service/tests/_util.ts rename to packages/ozone/tests/_util.ts diff --git a/packages/mod-service/tests/admin/__snapshots__/get-record.test.ts.snap b/packages/ozone/tests/admin/__snapshots__/get-record.test.ts.snap similarity index 100% rename from packages/mod-service/tests/admin/__snapshots__/get-record.test.ts.snap rename to packages/ozone/tests/admin/__snapshots__/get-record.test.ts.snap diff --git a/packages/mod-service/tests/admin/__snapshots__/get-repo.test.ts.snap b/packages/ozone/tests/admin/__snapshots__/get-repo.test.ts.snap similarity index 100% rename from packages/mod-service/tests/admin/__snapshots__/get-repo.test.ts.snap rename to packages/ozone/tests/admin/__snapshots__/get-repo.test.ts.snap diff --git a/packages/mod-service/tests/admin/__snapshots__/moderation-events.test.ts.snap b/packages/ozone/tests/admin/__snapshots__/moderation-events.test.ts.snap similarity index 100% rename from packages/mod-service/tests/admin/__snapshots__/moderation-events.test.ts.snap rename to packages/ozone/tests/admin/__snapshots__/moderation-events.test.ts.snap diff --git a/packages/mod-service/tests/admin/__snapshots__/moderation-statuses.test.ts.snap b/packages/ozone/tests/admin/__snapshots__/moderation-statuses.test.ts.snap similarity index 100% rename from packages/mod-service/tests/admin/__snapshots__/moderation-statuses.test.ts.snap rename to packages/ozone/tests/admin/__snapshots__/moderation-statuses.test.ts.snap diff --git a/packages/mod-service/tests/admin/__snapshots__/moderation.test.ts.snap b/packages/ozone/tests/admin/__snapshots__/moderation.test.ts.snap similarity index 100% rename from packages/mod-service/tests/admin/__snapshots__/moderation.test.ts.snap rename to packages/ozone/tests/admin/__snapshots__/moderation.test.ts.snap diff --git a/packages/mod-service/tests/admin/get-record.test.ts b/packages/ozone/tests/admin/get-record.test.ts similarity index 96% rename from packages/mod-service/tests/admin/get-record.test.ts rename to packages/ozone/tests/admin/get-record.test.ts index 3807724fa6c..e026770814d 100644 --- a/packages/mod-service/tests/admin/get-record.test.ts +++ b/packages/ozone/tests/admin/get-record.test.ts @@ -16,6 +16,7 @@ describe('admin get record view', () => { beforeAll(async () => { network = await TestNetwork.create({ dbPostgresSchema: 'views_admin_get_record', + ozone: { enabled: true }, }) agent = network.pds.getClient() sc = network.getSeedClient() @@ -65,7 +66,7 @@ describe('admin get record view', () => { }) }) - it('gets a record by uri, even when taken down.', async () => { + it.only('gets a record by uri, even when taken down.', async () => { const result = await agent.api.com.atproto.admin.getRecord( { uri: sc.posts[sc.dids.alice][0].ref.uriStr }, { headers: network.pds.adminAuthHeaders() }, diff --git a/packages/mod-service/tests/admin/get-repo.test.ts b/packages/ozone/tests/admin/get-repo.test.ts similarity index 100% rename from packages/mod-service/tests/admin/get-repo.test.ts rename to packages/ozone/tests/admin/get-repo.test.ts diff --git a/packages/mod-service/tests/admin/moderation-events.test.ts b/packages/ozone/tests/admin/moderation-events.test.ts similarity index 100% rename from packages/mod-service/tests/admin/moderation-events.test.ts rename to packages/ozone/tests/admin/moderation-events.test.ts diff --git a/packages/mod-service/tests/admin/moderation-statuses.test.ts b/packages/ozone/tests/admin/moderation-statuses.test.ts similarity index 100% rename from packages/mod-service/tests/admin/moderation-statuses.test.ts rename to packages/ozone/tests/admin/moderation-statuses.test.ts diff --git a/packages/mod-service/tests/admin/moderation.test.ts b/packages/ozone/tests/admin/moderation.test.ts similarity index 100% rename from packages/mod-service/tests/admin/moderation.test.ts rename to packages/ozone/tests/admin/moderation.test.ts diff --git a/packages/mod-service/tests/admin/repo-search.test.ts b/packages/ozone/tests/admin/repo-search.test.ts similarity index 100% rename from packages/mod-service/tests/admin/repo-search.test.ts rename to packages/ozone/tests/admin/repo-search.test.ts diff --git a/packages/mod-service/tests/algos/hot-classic.test.ts b/packages/ozone/tests/algos/hot-classic.test.ts similarity index 100% rename from packages/mod-service/tests/algos/hot-classic.test.ts rename to packages/ozone/tests/algos/hot-classic.test.ts diff --git a/packages/mod-service/tests/auth.test.ts b/packages/ozone/tests/auth.test.ts similarity index 100% rename from packages/mod-service/tests/auth.test.ts rename to packages/ozone/tests/auth.test.ts diff --git a/packages/mod-service/tests/auto-moderator/fixtures/hiveai_resp_example.json b/packages/ozone/tests/auto-moderator/fixtures/hiveai_resp_example.json similarity index 100% rename from packages/mod-service/tests/auto-moderator/fixtures/hiveai_resp_example.json rename to packages/ozone/tests/auto-moderator/fixtures/hiveai_resp_example.json diff --git a/packages/mod-service/tests/auto-moderator/fuzzy-matcher.test.ts b/packages/ozone/tests/auto-moderator/fuzzy-matcher.test.ts similarity index 100% rename from packages/mod-service/tests/auto-moderator/fuzzy-matcher.test.ts rename to packages/ozone/tests/auto-moderator/fuzzy-matcher.test.ts diff --git a/packages/mod-service/tests/auto-moderator/hive.test.ts b/packages/ozone/tests/auto-moderator/hive.test.ts similarity index 100% rename from packages/mod-service/tests/auto-moderator/hive.test.ts rename to packages/ozone/tests/auto-moderator/hive.test.ts diff --git a/packages/mod-service/tests/auto-moderator/labeler.test.ts b/packages/ozone/tests/auto-moderator/labeler.test.ts similarity index 100% rename from packages/mod-service/tests/auto-moderator/labeler.test.ts rename to packages/ozone/tests/auto-moderator/labeler.test.ts diff --git a/packages/mod-service/tests/auto-moderator/takedowns.test.ts b/packages/ozone/tests/auto-moderator/takedowns.test.ts similarity index 100% rename from packages/mod-service/tests/auto-moderator/takedowns.test.ts rename to packages/ozone/tests/auto-moderator/takedowns.test.ts diff --git a/packages/mod-service/tests/blob-resolver.test.ts b/packages/ozone/tests/blob-resolver.test.ts similarity index 100% rename from packages/mod-service/tests/blob-resolver.test.ts rename to packages/ozone/tests/blob-resolver.test.ts diff --git a/packages/mod-service/tests/daemon.test.ts b/packages/ozone/tests/daemon.test.ts similarity index 100% rename from packages/mod-service/tests/daemon.test.ts rename to packages/ozone/tests/daemon.test.ts diff --git a/packages/mod-service/tests/db.test.ts b/packages/ozone/tests/db.test.ts similarity index 100% rename from packages/mod-service/tests/db.test.ts rename to packages/ozone/tests/db.test.ts diff --git a/packages/mod-service/tests/did-cache.test.ts b/packages/ozone/tests/did-cache.test.ts similarity index 100% rename from packages/mod-service/tests/did-cache.test.ts rename to packages/ozone/tests/did-cache.test.ts diff --git a/packages/mod-service/tests/duplicate-records.test.ts b/packages/ozone/tests/duplicate-records.test.ts similarity index 100% rename from packages/mod-service/tests/duplicate-records.test.ts rename to packages/ozone/tests/duplicate-records.test.ts diff --git a/packages/mod-service/tests/feed-generation.test.ts b/packages/ozone/tests/feed-generation.test.ts similarity index 100% rename from packages/mod-service/tests/feed-generation.test.ts rename to packages/ozone/tests/feed-generation.test.ts diff --git a/packages/mod-service/tests/handle-invalidation.test.ts b/packages/ozone/tests/handle-invalidation.test.ts similarity index 100% rename from packages/mod-service/tests/handle-invalidation.test.ts rename to packages/ozone/tests/handle-invalidation.test.ts diff --git a/packages/mod-service/tests/image/server.test.ts b/packages/ozone/tests/image/server.test.ts similarity index 100% rename from packages/mod-service/tests/image/server.test.ts rename to packages/ozone/tests/image/server.test.ts diff --git a/packages/mod-service/tests/image/sharp.test.ts b/packages/ozone/tests/image/sharp.test.ts similarity index 100% rename from packages/mod-service/tests/image/sharp.test.ts rename to packages/ozone/tests/image/sharp.test.ts diff --git a/packages/mod-service/tests/image/uri.test.ts b/packages/ozone/tests/image/uri.test.ts similarity index 100% rename from packages/mod-service/tests/image/uri.test.ts rename to packages/ozone/tests/image/uri.test.ts diff --git a/packages/mod-service/tests/indexing.test.ts b/packages/ozone/tests/indexing.test.ts similarity index 100% rename from packages/mod-service/tests/indexing.test.ts rename to packages/ozone/tests/indexing.test.ts diff --git a/packages/mod-service/tests/notification-server.test.ts b/packages/ozone/tests/notification-server.test.ts similarity index 100% rename from packages/mod-service/tests/notification-server.test.ts rename to packages/ozone/tests/notification-server.test.ts diff --git a/packages/mod-service/tests/pipeline/backpressure.test.ts b/packages/ozone/tests/pipeline/backpressure.test.ts similarity index 100% rename from packages/mod-service/tests/pipeline/backpressure.test.ts rename to packages/ozone/tests/pipeline/backpressure.test.ts diff --git a/packages/mod-service/tests/pipeline/reingest.test.ts b/packages/ozone/tests/pipeline/reingest.test.ts similarity index 100% rename from packages/mod-service/tests/pipeline/reingest.test.ts rename to packages/ozone/tests/pipeline/reingest.test.ts diff --git a/packages/mod-service/tests/pipeline/repartition.test.ts b/packages/ozone/tests/pipeline/repartition.test.ts similarity index 100% rename from packages/mod-service/tests/pipeline/repartition.test.ts rename to packages/ozone/tests/pipeline/repartition.test.ts diff --git a/packages/mod-service/tests/redis-cache.test.ts b/packages/ozone/tests/redis-cache.test.ts similarity index 100% rename from packages/mod-service/tests/redis-cache.test.ts rename to packages/ozone/tests/redis-cache.test.ts diff --git a/packages/mod-service/tests/reprocessing.test.ts b/packages/ozone/tests/reprocessing.test.ts similarity index 100% rename from packages/mod-service/tests/reprocessing.test.ts rename to packages/ozone/tests/reprocessing.test.ts diff --git a/packages/mod-service/tests/sample-img/at.png b/packages/ozone/tests/sample-img/at.png similarity index 100% rename from packages/mod-service/tests/sample-img/at.png rename to packages/ozone/tests/sample-img/at.png diff --git a/packages/mod-service/tests/sample-img/hd-key.jpg b/packages/ozone/tests/sample-img/hd-key.jpg similarity index 100% rename from packages/mod-service/tests/sample-img/hd-key.jpg rename to packages/ozone/tests/sample-img/hd-key.jpg diff --git a/packages/mod-service/tests/sample-img/key-alt.jpg b/packages/ozone/tests/sample-img/key-alt.jpg similarity index 100% rename from packages/mod-service/tests/sample-img/key-alt.jpg rename to packages/ozone/tests/sample-img/key-alt.jpg diff --git a/packages/mod-service/tests/sample-img/key-landscape-large.jpg b/packages/ozone/tests/sample-img/key-landscape-large.jpg similarity index 100% rename from packages/mod-service/tests/sample-img/key-landscape-large.jpg rename to packages/ozone/tests/sample-img/key-landscape-large.jpg diff --git a/packages/mod-service/tests/sample-img/key-landscape-small.jpg b/packages/ozone/tests/sample-img/key-landscape-small.jpg similarity index 100% rename from packages/mod-service/tests/sample-img/key-landscape-small.jpg rename to packages/ozone/tests/sample-img/key-landscape-small.jpg diff --git a/packages/mod-service/tests/sample-img/key-portrait-large.jpg b/packages/ozone/tests/sample-img/key-portrait-large.jpg similarity index 100% rename from packages/mod-service/tests/sample-img/key-portrait-large.jpg rename to packages/ozone/tests/sample-img/key-portrait-large.jpg diff --git a/packages/mod-service/tests/sample-img/key-portrait-small.jpg b/packages/ozone/tests/sample-img/key-portrait-small.jpg similarity index 100% rename from packages/mod-service/tests/sample-img/key-portrait-small.jpg rename to packages/ozone/tests/sample-img/key-portrait-small.jpg diff --git a/packages/mod-service/tests/seeds/author-feed.ts b/packages/ozone/tests/seeds/author-feed.ts similarity index 100% rename from packages/mod-service/tests/seeds/author-feed.ts rename to packages/ozone/tests/seeds/author-feed.ts diff --git a/packages/mod-service/tests/seeds/basic.ts b/packages/ozone/tests/seeds/basic.ts similarity index 100% rename from packages/mod-service/tests/seeds/basic.ts rename to packages/ozone/tests/seeds/basic.ts diff --git a/packages/mod-service/tests/seeds/follows.ts b/packages/ozone/tests/seeds/follows.ts similarity index 100% rename from packages/mod-service/tests/seeds/follows.ts rename to packages/ozone/tests/seeds/follows.ts diff --git a/packages/mod-service/tests/seeds/likes.ts b/packages/ozone/tests/seeds/likes.ts similarity index 100% rename from packages/mod-service/tests/seeds/likes.ts rename to packages/ozone/tests/seeds/likes.ts diff --git a/packages/mod-service/tests/seeds/reposts.ts b/packages/ozone/tests/seeds/reposts.ts similarity index 100% rename from packages/mod-service/tests/seeds/reposts.ts rename to packages/ozone/tests/seeds/reposts.ts diff --git a/packages/mod-service/tests/seeds/users-bulk.ts b/packages/ozone/tests/seeds/users-bulk.ts similarity index 100% rename from packages/mod-service/tests/seeds/users-bulk.ts rename to packages/ozone/tests/seeds/users-bulk.ts diff --git a/packages/mod-service/tests/seeds/users.ts b/packages/ozone/tests/seeds/users.ts similarity index 100% rename from packages/mod-service/tests/seeds/users.ts rename to packages/ozone/tests/seeds/users.ts diff --git a/packages/mod-service/tests/server.test.ts b/packages/ozone/tests/server.test.ts similarity index 100% rename from packages/mod-service/tests/server.test.ts rename to packages/ozone/tests/server.test.ts diff --git a/packages/mod-service/tests/subscription/repo.test.ts b/packages/ozone/tests/subscription/repo.test.ts similarity index 100% rename from packages/mod-service/tests/subscription/repo.test.ts rename to packages/ozone/tests/subscription/repo.test.ts diff --git a/packages/mod-service/tests/subscription/util.test.ts b/packages/ozone/tests/subscription/util.test.ts similarity index 100% rename from packages/mod-service/tests/subscription/util.test.ts rename to packages/ozone/tests/subscription/util.test.ts diff --git a/packages/mod-service/tests/views/__snapshots__/actor-search.test.ts.snap b/packages/ozone/tests/views/__snapshots__/actor-search.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/actor-search.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/actor-search.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/author-feed.test.ts.snap b/packages/ozone/tests/views/__snapshots__/author-feed.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/author-feed.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/author-feed.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/block-lists.test.ts.snap b/packages/ozone/tests/views/__snapshots__/block-lists.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/block-lists.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/block-lists.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/blocks.test.ts.snap b/packages/ozone/tests/views/__snapshots__/blocks.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/blocks.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/blocks.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/follows.test.ts.snap b/packages/ozone/tests/views/__snapshots__/follows.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/follows.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/follows.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/likes.test.ts.snap b/packages/ozone/tests/views/__snapshots__/likes.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/likes.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/likes.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/list-feed.test.ts.snap b/packages/ozone/tests/views/__snapshots__/list-feed.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/list-feed.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/list-feed.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/mute-lists.test.ts.snap b/packages/ozone/tests/views/__snapshots__/mute-lists.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/mute-lists.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/mute-lists.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/mutes.test.ts.snap b/packages/ozone/tests/views/__snapshots__/mutes.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/mutes.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/mutes.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/notifications.test.ts.snap b/packages/ozone/tests/views/__snapshots__/notifications.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/notifications.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/notifications.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/posts.test.ts.snap b/packages/ozone/tests/views/__snapshots__/posts.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/posts.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/posts.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/profile.test.ts.snap b/packages/ozone/tests/views/__snapshots__/profile.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/profile.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/profile.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/reposts.test.ts.snap b/packages/ozone/tests/views/__snapshots__/reposts.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/reposts.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/reposts.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/thread.test.ts.snap b/packages/ozone/tests/views/__snapshots__/thread.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/thread.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/thread.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/threadgating.test.ts.snap b/packages/ozone/tests/views/__snapshots__/threadgating.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/threadgating.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/threadgating.test.ts.snap diff --git a/packages/mod-service/tests/views/__snapshots__/timeline.test.ts.snap b/packages/ozone/tests/views/__snapshots__/timeline.test.ts.snap similarity index 100% rename from packages/mod-service/tests/views/__snapshots__/timeline.test.ts.snap rename to packages/ozone/tests/views/__snapshots__/timeline.test.ts.snap diff --git a/packages/mod-service/tests/views/actor-likes.test.ts b/packages/ozone/tests/views/actor-likes.test.ts similarity index 100% rename from packages/mod-service/tests/views/actor-likes.test.ts rename to packages/ozone/tests/views/actor-likes.test.ts diff --git a/packages/mod-service/tests/views/actor-search.test.ts b/packages/ozone/tests/views/actor-search.test.ts similarity index 100% rename from packages/mod-service/tests/views/actor-search.test.ts rename to packages/ozone/tests/views/actor-search.test.ts diff --git a/packages/mod-service/tests/views/admin/repo-search.test.ts b/packages/ozone/tests/views/admin/repo-search.test.ts similarity index 100% rename from packages/mod-service/tests/views/admin/repo-search.test.ts rename to packages/ozone/tests/views/admin/repo-search.test.ts diff --git a/packages/mod-service/tests/views/author-feed.test.ts b/packages/ozone/tests/views/author-feed.test.ts similarity index 100% rename from packages/mod-service/tests/views/author-feed.test.ts rename to packages/ozone/tests/views/author-feed.test.ts diff --git a/packages/mod-service/tests/views/block-lists.test.ts b/packages/ozone/tests/views/block-lists.test.ts similarity index 100% rename from packages/mod-service/tests/views/block-lists.test.ts rename to packages/ozone/tests/views/block-lists.test.ts diff --git a/packages/mod-service/tests/views/blocks.test.ts b/packages/ozone/tests/views/blocks.test.ts similarity index 100% rename from packages/mod-service/tests/views/blocks.test.ts rename to packages/ozone/tests/views/blocks.test.ts diff --git a/packages/mod-service/tests/views/follows.test.ts b/packages/ozone/tests/views/follows.test.ts similarity index 100% rename from packages/mod-service/tests/views/follows.test.ts rename to packages/ozone/tests/views/follows.test.ts diff --git a/packages/mod-service/tests/views/likes.test.ts b/packages/ozone/tests/views/likes.test.ts similarity index 100% rename from packages/mod-service/tests/views/likes.test.ts rename to packages/ozone/tests/views/likes.test.ts diff --git a/packages/mod-service/tests/views/list-feed.test.ts b/packages/ozone/tests/views/list-feed.test.ts similarity index 100% rename from packages/mod-service/tests/views/list-feed.test.ts rename to packages/ozone/tests/views/list-feed.test.ts diff --git a/packages/mod-service/tests/views/mute-lists.test.ts b/packages/ozone/tests/views/mute-lists.test.ts similarity index 100% rename from packages/mod-service/tests/views/mute-lists.test.ts rename to packages/ozone/tests/views/mute-lists.test.ts diff --git a/packages/mod-service/tests/views/mutes.test.ts b/packages/ozone/tests/views/mutes.test.ts similarity index 100% rename from packages/mod-service/tests/views/mutes.test.ts rename to packages/ozone/tests/views/mutes.test.ts diff --git a/packages/mod-service/tests/views/notifications.test.ts b/packages/ozone/tests/views/notifications.test.ts similarity index 100% rename from packages/mod-service/tests/views/notifications.test.ts rename to packages/ozone/tests/views/notifications.test.ts diff --git a/packages/mod-service/tests/views/posts.test.ts b/packages/ozone/tests/views/posts.test.ts similarity index 100% rename from packages/mod-service/tests/views/posts.test.ts rename to packages/ozone/tests/views/posts.test.ts diff --git a/packages/mod-service/tests/views/profile.test.ts b/packages/ozone/tests/views/profile.test.ts similarity index 100% rename from packages/mod-service/tests/views/profile.test.ts rename to packages/ozone/tests/views/profile.test.ts diff --git a/packages/mod-service/tests/views/reposts.test.ts b/packages/ozone/tests/views/reposts.test.ts similarity index 100% rename from packages/mod-service/tests/views/reposts.test.ts rename to packages/ozone/tests/views/reposts.test.ts diff --git a/packages/mod-service/tests/views/suggested-follows.test.ts b/packages/ozone/tests/views/suggested-follows.test.ts similarity index 100% rename from packages/mod-service/tests/views/suggested-follows.test.ts rename to packages/ozone/tests/views/suggested-follows.test.ts diff --git a/packages/mod-service/tests/views/suggestions.test.ts b/packages/ozone/tests/views/suggestions.test.ts similarity index 100% rename from packages/mod-service/tests/views/suggestions.test.ts rename to packages/ozone/tests/views/suggestions.test.ts diff --git a/packages/mod-service/tests/views/thread.test.ts b/packages/ozone/tests/views/thread.test.ts similarity index 100% rename from packages/mod-service/tests/views/thread.test.ts rename to packages/ozone/tests/views/thread.test.ts diff --git a/packages/mod-service/tests/views/threadgating.test.ts b/packages/ozone/tests/views/threadgating.test.ts similarity index 100% rename from packages/mod-service/tests/views/threadgating.test.ts rename to packages/ozone/tests/views/threadgating.test.ts diff --git a/packages/mod-service/tests/views/timeline.test.ts b/packages/ozone/tests/views/timeline.test.ts similarity index 100% rename from packages/mod-service/tests/views/timeline.test.ts rename to packages/ozone/tests/views/timeline.test.ts diff --git a/packages/mod-service/tsconfig.build.json b/packages/ozone/tsconfig.build.json similarity index 100% rename from packages/mod-service/tsconfig.build.json rename to packages/ozone/tsconfig.build.json diff --git a/packages/mod-service/tsconfig.json b/packages/ozone/tsconfig.json similarity index 100% rename from packages/mod-service/tsconfig.json rename to packages/ozone/tsconfig.json diff --git a/packages/pds/src/api/app/bsky/actor/getProfile.ts b/packages/pds/src/api/app/bsky/actor/getProfile.ts index 4c4f0958abe..732c7babe1a 100644 --- a/packages/pds/src/api/app/bsky/actor/getProfile.ts +++ b/packages/pds/src/api/app/bsky/actor/getProfile.ts @@ -16,7 +16,7 @@ export default function (server: Server, ctx: AppContext) { auth.credentials.type === 'access' ? auth.credentials.did : null const res = await ctx.appViewAgent.api.app.bsky.actor.getProfile( params, - requester ? await ctx.serviceAuthHeaders(requester) : authPassthru(req), + requester ? await ctx.appviewAuthHeaders(requester) : authPassthru(req), ) if (res.data.did === requester) { return await handleReadAfterWrite(ctx, requester, res, getProfileMunge) diff --git a/packages/pds/src/api/app/bsky/actor/getProfiles.ts b/packages/pds/src/api/app/bsky/actor/getProfiles.ts index bc78a26044e..2f0f1405378 100644 --- a/packages/pds/src/api/app/bsky/actor/getProfiles.ts +++ b/packages/pds/src/api/app/bsky/actor/getProfiles.ts @@ -14,7 +14,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.actor.getProfiles( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) const hasSelf = res.data.profiles.some((prof) => prof.did === requester) if (hasSelf) { diff --git a/packages/pds/src/api/app/bsky/actor/getSuggestions.ts b/packages/pds/src/api/app/bsky/actor/getSuggestions.ts index 70f6bb6adef..5fd8b260276 100644 --- a/packages/pds/src/api/app/bsky/actor/getSuggestions.ts +++ b/packages/pds/src/api/app/bsky/actor/getSuggestions.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.actor.getSuggestions( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/actor/searchActors.ts b/packages/pds/src/api/app/bsky/actor/searchActors.ts index 86b028f5242..7c184de1116 100644 --- a/packages/pds/src/api/app/bsky/actor/searchActors.ts +++ b/packages/pds/src/api/app/bsky/actor/searchActors.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.actor.searchActors( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/actor/searchActorsTypeahead.ts b/packages/pds/src/api/app/bsky/actor/searchActorsTypeahead.ts index 9e969c4700a..c1a8738488d 100644 --- a/packages/pds/src/api/app/bsky/actor/searchActorsTypeahead.ts +++ b/packages/pds/src/api/app/bsky/actor/searchActorsTypeahead.ts @@ -9,7 +9,7 @@ export default function (server: Server, ctx: AppContext) { const res = await ctx.appViewAgent.api.app.bsky.actor.searchActorsTypeahead( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getActorFeeds.ts b/packages/pds/src/api/app/bsky/feed/getActorFeeds.ts index 1a5f3a15ed3..384d68500d4 100644 --- a/packages/pds/src/api/app/bsky/feed/getActorFeeds.ts +++ b/packages/pds/src/api/app/bsky/feed/getActorFeeds.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getActorFeeds( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getActorLikes.ts b/packages/pds/src/api/app/bsky/feed/getActorLikes.ts index d0d18787f9d..07fb66fd828 100644 --- a/packages/pds/src/api/app/bsky/feed/getActorLikes.ts +++ b/packages/pds/src/api/app/bsky/feed/getActorLikes.ts @@ -17,7 +17,7 @@ export default function (server: Server, ctx: AppContext) { const res = await ctx.appViewAgent.api.app.bsky.feed.getActorLikes( params, - requester ? await ctx.serviceAuthHeaders(requester) : authPassthru(req), + requester ? await ctx.appviewAuthHeaders(requester) : authPassthru(req), ) if (requester) { return await handleReadAfterWrite(ctx, requester, res, getAuthorMunge) diff --git a/packages/pds/src/api/app/bsky/feed/getAuthorFeed.ts b/packages/pds/src/api/app/bsky/feed/getAuthorFeed.ts index 26c001990e3..17ae8f0ac10 100644 --- a/packages/pds/src/api/app/bsky/feed/getAuthorFeed.ts +++ b/packages/pds/src/api/app/bsky/feed/getAuthorFeed.ts @@ -17,7 +17,7 @@ export default function (server: Server, ctx: AppContext) { auth.credentials.type === 'access' ? auth.credentials.did : null const res = await ctx.appViewAgent.api.app.bsky.feed.getAuthorFeed( params, - requester ? await ctx.serviceAuthHeaders(requester) : authPassthru(req), + requester ? await ctx.appviewAuthHeaders(requester) : authPassthru(req), ) if (requester) { return await handleReadAfterWrite(ctx, requester, res, getAuthorMunge) diff --git a/packages/pds/src/api/app/bsky/feed/getFeed.ts b/packages/pds/src/api/app/bsky/feed/getFeed.ts index 3a768905dc2..82bb2e30b16 100644 --- a/packages/pds/src/api/app/bsky/feed/getFeed.ts +++ b/packages/pds/src/api/app/bsky/feed/getFeed.ts @@ -10,7 +10,7 @@ export default function (server: Server, ctx: AppContext) { const { data: feed } = await ctx.appViewAgent.api.app.bsky.feed.getFeedGenerator( { feed: params.feed }, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) const res = await ctx.appViewAgent.api.app.bsky.feed.getFeed( params, diff --git a/packages/pds/src/api/app/bsky/feed/getFeedGenerator.ts b/packages/pds/src/api/app/bsky/feed/getFeedGenerator.ts index 78ee243bc08..57c4731db53 100644 --- a/packages/pds/src/api/app/bsky/feed/getFeedGenerator.ts +++ b/packages/pds/src/api/app/bsky/feed/getFeedGenerator.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getFeedGenerator( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getFeedGenerators.ts b/packages/pds/src/api/app/bsky/feed/getFeedGenerators.ts index 064525afcec..1370fbbd6f3 100644 --- a/packages/pds/src/api/app/bsky/feed/getFeedGenerators.ts +++ b/packages/pds/src/api/app/bsky/feed/getFeedGenerators.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getFeedGenerators( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getLikes.ts b/packages/pds/src/api/app/bsky/feed/getLikes.ts index 20d96690ac6..ad656dfbd4c 100644 --- a/packages/pds/src/api/app/bsky/feed/getLikes.ts +++ b/packages/pds/src/api/app/bsky/feed/getLikes.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getLikes( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getListFeed.ts b/packages/pds/src/api/app/bsky/feed/getListFeed.ts index 7cc5d1f2bd2..06e2abcbfe5 100644 --- a/packages/pds/src/api/app/bsky/feed/getListFeed.ts +++ b/packages/pds/src/api/app/bsky/feed/getListFeed.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getListFeed( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getPostThread.ts b/packages/pds/src/api/app/bsky/feed/getPostThread.ts index 93cd5fd641f..00bf0b01d82 100644 --- a/packages/pds/src/api/app/bsky/feed/getPostThread.ts +++ b/packages/pds/src/api/app/bsky/feed/getPostThread.ts @@ -44,7 +44,7 @@ export default function (server: Server, ctx: AppContext) { try { const res = await ctx.appViewAgent.api.app.bsky.feed.getPostThread( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return await handleReadAfterWrite( @@ -207,7 +207,7 @@ const readAfterWriteNotFound = async ( try { const parentsRes = await ctx.appViewAgent.api.app.bsky.feed.getPostThread( { uri: highestParent, parentHeight: params.parentHeight, depth: 0 }, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) thread.parent = parentsRes.data.thread } catch (err) { diff --git a/packages/pds/src/api/app/bsky/feed/getPosts.ts b/packages/pds/src/api/app/bsky/feed/getPosts.ts index 2f7a75d71fc..f04927a4997 100644 --- a/packages/pds/src/api/app/bsky/feed/getPosts.ts +++ b/packages/pds/src/api/app/bsky/feed/getPosts.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getPosts( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getRepostedBy.ts b/packages/pds/src/api/app/bsky/feed/getRepostedBy.ts index b84a9dc27b7..e797967fc2a 100644 --- a/packages/pds/src/api/app/bsky/feed/getRepostedBy.ts +++ b/packages/pds/src/api/app/bsky/feed/getRepostedBy.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getRepostedBy( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getSuggestedFeeds.ts b/packages/pds/src/api/app/bsky/feed/getSuggestedFeeds.ts index 179570f6d4f..17fbf947471 100644 --- a/packages/pds/src/api/app/bsky/feed/getSuggestedFeeds.ts +++ b/packages/pds/src/api/app/bsky/feed/getSuggestedFeeds.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getSuggestedFeeds( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/feed/getTimeline.ts b/packages/pds/src/api/app/bsky/feed/getTimeline.ts index d8515bcbfbb..6139432580a 100644 --- a/packages/pds/src/api/app/bsky/feed/getTimeline.ts +++ b/packages/pds/src/api/app/bsky/feed/getTimeline.ts @@ -14,7 +14,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.getTimeline( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return await handleReadAfterWrite(ctx, requester, res, getTimelineMunge) }, diff --git a/packages/pds/src/api/app/bsky/feed/searchPosts.ts b/packages/pds/src/api/app/bsky/feed/searchPosts.ts index 85384751ea1..e9942432fde 100644 --- a/packages/pds/src/api/app/bsky/feed/searchPosts.ts +++ b/packages/pds/src/api/app/bsky/feed/searchPosts.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.feed.searchPosts( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getBlocks.ts b/packages/pds/src/api/app/bsky/graph/getBlocks.ts index 14aa3b3de5f..ff1f299f43f 100644 --- a/packages/pds/src/api/app/bsky/graph/getBlocks.ts +++ b/packages/pds/src/api/app/bsky/graph/getBlocks.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.graph.getBlocks( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getFollowers.ts b/packages/pds/src/api/app/bsky/graph/getFollowers.ts index e3e5d8ba64e..18f1e0df397 100644 --- a/packages/pds/src/api/app/bsky/graph/getFollowers.ts +++ b/packages/pds/src/api/app/bsky/graph/getFollowers.ts @@ -10,7 +10,7 @@ export default function (server: Server, ctx: AppContext) { auth.credentials.type === 'access' ? auth.credentials.did : null const res = await ctx.appViewAgent.api.app.bsky.graph.getFollowers( params, - requester ? await ctx.serviceAuthHeaders(requester) : authPassthru(req), + requester ? await ctx.appviewAuthHeaders(requester) : authPassthru(req), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getFollows.ts b/packages/pds/src/api/app/bsky/graph/getFollows.ts index 821b83fa359..91955965ed6 100644 --- a/packages/pds/src/api/app/bsky/graph/getFollows.ts +++ b/packages/pds/src/api/app/bsky/graph/getFollows.ts @@ -10,7 +10,7 @@ export default function (server: Server, ctx: AppContext) { auth.credentials.type === 'access' ? auth.credentials.did : null const res = await ctx.appViewAgent.api.app.bsky.graph.getFollows( params, - requester ? await ctx.serviceAuthHeaders(requester) : authPassthru(req), + requester ? await ctx.appviewAuthHeaders(requester) : authPassthru(req), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getList.ts b/packages/pds/src/api/app/bsky/graph/getList.ts index 6b4f3762d38..fb5776f5df2 100644 --- a/packages/pds/src/api/app/bsky/graph/getList.ts +++ b/packages/pds/src/api/app/bsky/graph/getList.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.graph.getList( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getListBlocks.ts b/packages/pds/src/api/app/bsky/graph/getListBlocks.ts index 4e1ba8de8ca..376de0ba914 100644 --- a/packages/pds/src/api/app/bsky/graph/getListBlocks.ts +++ b/packages/pds/src/api/app/bsky/graph/getListBlocks.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.graph.getListBlocks( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getListMutes.ts b/packages/pds/src/api/app/bsky/graph/getListMutes.ts index fc0d8c2f051..c489124642c 100644 --- a/packages/pds/src/api/app/bsky/graph/getListMutes.ts +++ b/packages/pds/src/api/app/bsky/graph/getListMutes.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.graph.getListMutes( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getLists.ts b/packages/pds/src/api/app/bsky/graph/getLists.ts index 0c680321f9c..61a1cb89079 100644 --- a/packages/pds/src/api/app/bsky/graph/getLists.ts +++ b/packages/pds/src/api/app/bsky/graph/getLists.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.graph.getLists( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getMutes.ts b/packages/pds/src/api/app/bsky/graph/getMutes.ts index 51177137b3a..0dc0e72412c 100644 --- a/packages/pds/src/api/app/bsky/graph/getMutes.ts +++ b/packages/pds/src/api/app/bsky/graph/getMutes.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did const res = await ctx.appViewAgent.api.app.bsky.graph.getMutes( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts b/packages/pds/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts index b8d578bfd25..0a11361f05c 100644 --- a/packages/pds/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts +++ b/packages/pds/src/api/app/bsky/graph/getSuggestedFollowsByActor.ts @@ -9,7 +9,7 @@ export default function (server: Server, ctx: AppContext) { const res = await ctx.appViewAgent.api.app.bsky.graph.getSuggestedFollowsByActor( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/graph/muteActor.ts b/packages/pds/src/api/app/bsky/graph/muteActor.ts index 7e38d21ee42..2b2f218b44d 100644 --- a/packages/pds/src/api/app/bsky/graph/muteActor.ts +++ b/packages/pds/src/api/app/bsky/graph/muteActor.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did await ctx.appViewAgent.api.app.bsky.graph.muteActor(input.body, { - ...(await ctx.serviceAuthHeaders(requester)), + ...(await ctx.appviewAuthHeaders(requester)), encoding: 'application/json', }) }, diff --git a/packages/pds/src/api/app/bsky/graph/muteActorList.ts b/packages/pds/src/api/app/bsky/graph/muteActorList.ts index c224d85e3f3..97d524900f7 100644 --- a/packages/pds/src/api/app/bsky/graph/muteActorList.ts +++ b/packages/pds/src/api/app/bsky/graph/muteActorList.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did await ctx.appViewAgent.api.app.bsky.graph.muteActorList(input.body, { - ...(await ctx.serviceAuthHeaders(requester)), + ...(await ctx.appviewAuthHeaders(requester)), encoding: 'application/json', }) }, diff --git a/packages/pds/src/api/app/bsky/graph/unmuteActor.ts b/packages/pds/src/api/app/bsky/graph/unmuteActor.ts index 37166420f31..0f7a1610321 100644 --- a/packages/pds/src/api/app/bsky/graph/unmuteActor.ts +++ b/packages/pds/src/api/app/bsky/graph/unmuteActor.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did await ctx.appViewAgent.api.app.bsky.graph.unmuteActor(input.body, { - ...(await ctx.serviceAuthHeaders(requester)), + ...(await ctx.appviewAuthHeaders(requester)), encoding: 'application/json', }) }, diff --git a/packages/pds/src/api/app/bsky/graph/unmuteActorList.ts b/packages/pds/src/api/app/bsky/graph/unmuteActorList.ts index 0dea669feb6..aaf5225bded 100644 --- a/packages/pds/src/api/app/bsky/graph/unmuteActorList.ts +++ b/packages/pds/src/api/app/bsky/graph/unmuteActorList.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did await ctx.appViewAgent.api.app.bsky.graph.unmuteActorList(input.body, { - ...(await ctx.serviceAuthHeaders(requester)), + ...(await ctx.appviewAuthHeaders(requester)), encoding: 'application/json', }) }, diff --git a/packages/pds/src/api/app/bsky/notification/getUnreadCount.ts b/packages/pds/src/api/app/bsky/notification/getUnreadCount.ts index da8be8aec50..bca4bf3d46f 100644 --- a/packages/pds/src/api/app/bsky/notification/getUnreadCount.ts +++ b/packages/pds/src/api/app/bsky/notification/getUnreadCount.ts @@ -9,7 +9,7 @@ export default function (server: Server, ctx: AppContext) { const res = await ctx.appViewAgent.api.app.bsky.notification.getUnreadCount( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/notification/listNotifications.ts b/packages/pds/src/api/app/bsky/notification/listNotifications.ts index 21f4e8db642..4a514ae03f4 100644 --- a/packages/pds/src/api/app/bsky/notification/listNotifications.ts +++ b/packages/pds/src/api/app/bsky/notification/listNotifications.ts @@ -9,7 +9,7 @@ export default function (server: Server, ctx: AppContext) { const res = await ctx.appViewAgent.api.app.bsky.notification.listNotifications( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/app/bsky/notification/updateSeen.ts b/packages/pds/src/api/app/bsky/notification/updateSeen.ts index 3678cacd37f..dc0217ffb67 100644 --- a/packages/pds/src/api/app/bsky/notification/updateSeen.ts +++ b/packages/pds/src/api/app/bsky/notification/updateSeen.ts @@ -8,7 +8,7 @@ export default function (server: Server, ctx: AppContext) { const requester = auth.credentials.did await ctx.appViewAgent.api.app.bsky.notification.updateSeen(input.body, { - ...(await ctx.serviceAuthHeaders(requester)), + ...(await ctx.appviewAuthHeaders(requester)), encoding: 'application/json', }) }, diff --git a/packages/pds/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts b/packages/pds/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts index 0d7eb366a03..08466ed9f5c 100644 --- a/packages/pds/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +++ b/packages/pds/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts @@ -10,7 +10,7 @@ export default function (server: Server, ctx: AppContext) { const res = await ctx.appViewAgent.api.app.bsky.unspecced.getPopularFeedGenerators( params, - await ctx.serviceAuthHeaders(requester), + await ctx.appviewAuthHeaders(requester), ) return { encoding: 'application/json', diff --git a/packages/pds/src/api/com/atproto/admin/emitModerationEvent.ts b/packages/pds/src/api/com/atproto/admin/emitModerationEvent.ts index cea8a9fb664..b2befdd53cc 100644 --- a/packages/pds/src/api/com/atproto/admin/emitModerationEvent.ts +++ b/packages/pds/src/api/com/atproto/admin/emitModerationEvent.ts @@ -7,7 +7,7 @@ export default function (server: Server, ctx: AppContext) { auth: ctx.authVerifier.role, handler: async ({ req, input }) => { const { data: result } = - await ctx.appViewAgent.com.atproto.admin.emitModerationEvent( + await ctx.moderationAgent.com.atproto.admin.emitModerationEvent( input.body, authPassthru(req, true), ) diff --git a/packages/pds/src/api/com/atproto/admin/getModerationEvent.ts b/packages/pds/src/api/com/atproto/admin/getModerationEvent.ts index 3ac6e0f72be..d368c3bfd72 100644 --- a/packages/pds/src/api/com/atproto/admin/getModerationEvent.ts +++ b/packages/pds/src/api/com/atproto/admin/getModerationEvent.ts @@ -7,7 +7,7 @@ export default function (server: Server, ctx: AppContext) { auth: ctx.authVerifier.role, handler: async ({ req, params }) => { const { data } = - await ctx.appViewAgent.com.atproto.admin.getModerationEvent( + await ctx.moderationAgent.com.atproto.admin.getModerationEvent( params, authPassthru(req), ) diff --git a/packages/pds/src/api/com/atproto/admin/getRecord.ts b/packages/pds/src/api/com/atproto/admin/getRecord.ts index 9b6860ca1f2..90575354028 100644 --- a/packages/pds/src/api/com/atproto/admin/getRecord.ts +++ b/packages/pds/src/api/com/atproto/admin/getRecord.ts @@ -7,7 +7,7 @@ export default function (server: Server, ctx: AppContext) { auth: ctx.authVerifier.role, handler: async ({ req, params }) => { const { data: recordDetailAppview } = - await ctx.appViewAgent.com.atproto.admin.getRecord( + await ctx.moderationAgent.com.atproto.admin.getRecord( params, authPassthru(req), ) diff --git a/packages/pds/src/api/com/atproto/admin/getRepo.ts b/packages/pds/src/api/com/atproto/admin/getRepo.ts index f70ddc7e0fe..85592c52b14 100644 --- a/packages/pds/src/api/com/atproto/admin/getRepo.ts +++ b/packages/pds/src/api/com/atproto/admin/getRepo.ts @@ -6,7 +6,7 @@ export default function (server: Server, ctx: AppContext) { server.com.atproto.admin.getRepo({ auth: ctx.authVerifier.role, handler: async ({ req, params }) => { - const res = await ctx.appViewAgent.com.atproto.admin.getRepo( + const res = await ctx.moderationAgent.com.atproto.admin.getRepo( params, authPassthru(req), ) diff --git a/packages/pds/src/api/com/atproto/admin/queryModerationEvents.ts b/packages/pds/src/api/com/atproto/admin/queryModerationEvents.ts index 4ccb0ac9f6b..00e12439649 100644 --- a/packages/pds/src/api/com/atproto/admin/queryModerationEvents.ts +++ b/packages/pds/src/api/com/atproto/admin/queryModerationEvents.ts @@ -7,7 +7,7 @@ export default function (server: Server, ctx: AppContext) { auth: ctx.authVerifier.role, handler: async ({ req, params }) => { const { data: result } = - await ctx.appViewAgent.com.atproto.admin.queryModerationEvents( + await ctx.moderationAgent.com.atproto.admin.queryModerationEvents( params, authPassthru(req), ) diff --git a/packages/pds/src/api/com/atproto/admin/queryModerationStatuses.ts b/packages/pds/src/api/com/atproto/admin/queryModerationStatuses.ts index 4f6c85e17d2..d2b2f36a1fe 100644 --- a/packages/pds/src/api/com/atproto/admin/queryModerationStatuses.ts +++ b/packages/pds/src/api/com/atproto/admin/queryModerationStatuses.ts @@ -7,7 +7,7 @@ export default function (server: Server, ctx: AppContext) { auth: ctx.authVerifier.role, handler: async ({ req, params }) => { const { data } = - await ctx.appViewAgent.com.atproto.admin.queryModerationStatuses( + await ctx.moderationAgent.com.atproto.admin.queryModerationStatuses( params, authPassthru(req), ) diff --git a/packages/pds/src/api/com/atproto/admin/searchRepos.ts b/packages/pds/src/api/com/atproto/admin/searchRepos.ts index 4125b84eed9..5e21b2ab894 100644 --- a/packages/pds/src/api/com/atproto/admin/searchRepos.ts +++ b/packages/pds/src/api/com/atproto/admin/searchRepos.ts @@ -7,7 +7,7 @@ export default function (server: Server, ctx: AppContext) { auth: ctx.authVerifier.role, handler: async ({ req, params }) => { const { data: result } = - await ctx.appViewAgent.com.atproto.admin.searchRepos( + await ctx.moderationAgent.com.atproto.admin.searchRepos( params, authPassthru(req), ) diff --git a/packages/pds/src/api/com/atproto/moderation/createReport.ts b/packages/pds/src/api/com/atproto/moderation/createReport.ts index 315b72c080a..7b3cc998e22 100644 --- a/packages/pds/src/api/com/atproto/moderation/createReport.ts +++ b/packages/pds/src/api/com/atproto/moderation/createReport.ts @@ -7,10 +7,13 @@ export default function (server: Server, ctx: AppContext) { handler: async ({ input, auth }) => { const requester = auth.credentials.did const { data: result } = - await ctx.appViewAgent.com.atproto.moderation.createReport(input.body, { - ...(await ctx.serviceAuthHeaders(requester)), - encoding: 'application/json', - }) + await ctx.moderationAgent.com.atproto.moderation.createReport( + input.body, + { + ...(await ctx.moderationAuthHeaders(requester)), + encoding: 'application/json', + }, + ) return { encoding: 'application/json', body: result, diff --git a/packages/pds/src/config/config.ts b/packages/pds/src/config/config.ts index c1676c25908..0d737fbd0fa 100644 --- a/packages/pds/src/config/config.ts +++ b/packages/pds/src/config/config.ts @@ -175,10 +175,20 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => { const bskyAppViewCfg: ServerConfig['bskyAppView'] = { url: env.bskyAppViewUrl, did: env.bskyAppViewDid, - proxyModeration: env.bskyAppViewModeration ?? false, cdnUrlPattern: env.bskyAppViewCdnUrlPattern, } + if (!env.modServiceUrl) { + throw new Error('Must configure PDS_MOD_SERVICE_URL') + } else if (!env.modServiceDid) { + throw new Error('Must configure PDS_MOD_SERVICE_DID') + } + + const modServiceCfg: ServerConfig['modService'] = { + url: env.modServiceUrl, + did: env.modServiceDid, + } + const redisCfg: ServerConfig['redis'] = env.redisScratchAddress ? { address: env.redisScratchAddress, @@ -211,6 +221,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => { moderationEmail: moderationEmailCfg, subscription: subscriptionCfg, bskyAppView: bskyAppViewCfg, + modService: modServiceCfg, redis: redisCfg, rateLimits: rateLimitsCfg, crawlers: crawlersCfg, @@ -229,6 +240,7 @@ export type ServerConfig = { moderationEmail: EmailConfig | null subscription: SubscriptionConfig bskyAppView: BksyAppViewConfig + modService: ModServiceConfig redis: RedisScratchConfig | null rateLimits: RateLimitsConfig crawlers: string[] @@ -330,6 +342,10 @@ export type RateLimitsConfig = export type BksyAppViewConfig = { url: string did: string - proxyModeration: boolean cdnUrlPattern?: string } + +export type ModServiceConfig = { + url: string + did: string +} diff --git a/packages/pds/src/config/env.ts b/packages/pds/src/config/env.ts index bfcf4e36956..c9b8d06aa45 100644 --- a/packages/pds/src/config/env.ts +++ b/packages/pds/src/config/env.ts @@ -69,9 +69,12 @@ export const readEnv = (): ServerEnvironment => { // appview bskyAppViewUrl: envStr('PDS_BSKY_APP_VIEW_URL'), bskyAppViewDid: envStr('PDS_BSKY_APP_VIEW_DID'), - bskyAppViewModeration: envBool('PDS_BSKY_APP_VIEW_MODERATION'), bskyAppViewCdnUrlPattern: envStr('PDS_BSKY_APP_VIEW_CDN_URL_PATTERN'), + // mod service + modServiceUrl: envStr('PDS_MOD_SERVICE_URL'), + modServiceDid: envStr('PDS_MOD_SERVICE_DID'), + // rate limits rateLimitsEnabled: envBool('PDS_RATE_LIMITS_ENABLED'), rateLimitBypassKey: envStr('PDS_RATE_LIMIT_BYPASS_KEY'), @@ -165,9 +168,12 @@ export type ServerEnvironment = { // appview bskyAppViewUrl?: string bskyAppViewDid?: string - bskyAppViewModeration?: boolean bskyAppViewCdnUrlPattern?: string + // mod service + modServiceUrl?: string + modServiceDid?: string + // rate limits rateLimitsEnabled?: boolean rateLimitBypassKey?: string diff --git a/packages/pds/src/context.ts b/packages/pds/src/context.ts index 8f47992c008..874ee276272 100644 --- a/packages/pds/src/context.ts +++ b/packages/pds/src/context.ts @@ -43,6 +43,7 @@ export type AppContextOptions = { redisScratch?: Redis crawlers: Crawlers appViewAgent: AtpAgent + moderationAgent: AtpAgent entrywayAgent?: AtpAgent authVerifier: AuthVerifier plcRotationKey: crypto.Keypair @@ -67,6 +68,7 @@ export class AppContext { public redisScratch?: Redis public crawlers: Crawlers public appViewAgent: AtpAgent + public moderationAgent: AtpAgent public entrywayAgent: AtpAgent | undefined public authVerifier: AuthVerifier public plcRotationKey: crypto.Keypair @@ -87,6 +89,7 @@ export class AppContext { this.redisScratch = opts.redisScratch this.crawlers = opts.crawlers this.appViewAgent = opts.appViewAgent + this.moderationAgent = opts.moderationAgent this.entrywayAgent = opts.entrywayAgent this.authVerifier = opts.authVerifier this.plcRotationKey = opts.plcRotationKey @@ -159,6 +162,7 @@ export class AppContext { : undefined const appViewAgent = new AtpAgent({ service: cfg.bskyAppView.url }) + const moderationAgent = new AtpAgent({ service: cfg.modService.url }) const entrywayAgent = cfg.entryway ? new AtpAgent({ service: cfg.entryway.url }) @@ -226,6 +230,7 @@ export class AppContext { redisScratch, crawlers, appViewAgent, + moderationAgent, entrywayAgent, authVerifier, plcRotationKey, @@ -234,11 +239,15 @@ export class AppContext { }) } - async serviceAuthHeaders(did: string, audience?: string) { - const aud = audience ?? this.cfg.bskyAppView.did - if (!aud) { - throw new Error('Could not find bsky appview did') - } + async appviewAuthHeaders(did: string) { + return this.serviceAuthHeaders(did, this.cfg.bskyAppView.did) + } + + async moderationAuthHeaders(did: string) { + return this.serviceAuthHeaders(did, this.cfg.modService.did) + } + + async serviceAuthHeaders(did: string, aud: string) { const keypair = await this.actorStore.keypair(did) return createServiceAuthHeaders({ iss: did, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b923df4a355..ede4cc42e39 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -343,7 +343,7 @@ importers: version: link:../api '@atproto/bsky': specifier: workspace:^ - version: link:../mod-service + version: link:../bsky '@atproto/common-web': specifier: workspace:^ version: link:../common-web @@ -356,6 +356,9 @@ importers: '@atproto/lexicon': specifier: workspace:^ version: link:../lexicon + '@atproto/ozone': + specifier: workspace:^ + version: link:../ozone '@atproto/pds': specifier: workspace:^ version: link:../pds @@ -473,7 +476,7 @@ importers: specifier: ^3.21.4 version: 3.21.4 - packages/mod-service: + packages/ozone: dependencies: '@atproto/api': specifier: workspace:^ @@ -710,7 +713,7 @@ importers: devDependencies: '@atproto/bsky': specifier: workspace:^ - version: link:../mod-service + version: link:../bsky '@atproto/dev-env': specifier: workspace:^ version: link:../dev-env @@ -876,7 +879,7 @@ importers: version: link:../../packages/aws '@atproto/bsky': specifier: workspace:^ - version: link:../../packages/mod-service + version: link:../../packages/bsky dd-trace: specifier: 3.13.2 version: 3.13.2 diff --git a/tsconfig.json b/tsconfig.json index f95058f243d..3307ccb7e4b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,7 +25,7 @@ "references": [ { "path": "./packages/pds/tsconfig.build.json" }, { "path": "./packages/bsky/tsconfig.build.json" }, - { "path": "./packages/mod-service/tsconfig.build.json" }, + { "path": "./packages/ozone/tsconfig.build.json" }, { "path": "./packages/api/tsconfig.build.json" }, { "path": "./packages/aws/tsconfig.build.json" }, { "path": "./packages/common/tsconfig.build.json" },