@atproto/ozone 0.12.3 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +16 -0
- package/dist/api/moderation/emitEvent.d.ts.map +1 -1
- package/dist/api/moderation/emitEvent.js +4 -1
- package/dist/api/moderation/emitEvent.js.map +1 -1
- package/dist/api/report/createReport.d.ts.map +1 -1
- package/dist/api/report/createReport.js +3 -1
- package/dist/api/report/createReport.js.map +1 -1
- package/dist/config/config.d.ts +0 -2
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +0 -2
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +0 -2
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +0 -2
- package/dist/config/env.js.map +1 -1
- package/dist/context.d.ts +2 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +2 -2
- package/dist/context.js.map +1 -1
- package/dist/daemon/context.d.ts +0 -3
- package/dist/daemon/context.d.ts.map +1 -1
- package/dist/daemon/context.js +0 -10
- package/dist/daemon/context.js.map +1 -1
- package/dist/daemon/locks.d.ts +0 -1
- package/dist/daemon/locks.d.ts.map +1 -1
- package/dist/daemon/locks.js +0 -1
- package/dist/daemon/locks.js.map +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/schema/index.d.ts +1 -5
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.d.ts +1 -1
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.js +1 -1
- package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.js.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts +0 -76
- package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/defs.defs.js +1 -7
- package/dist/lexicons/tools/ozone/moderation/defs.defs.js.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.d.ts +0 -6
- package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.js +1 -1
- package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +2 -1
- package/dist/logger.js.map +1 -1
- package/dist/mod-service/index.d.ts +1 -1
- package/dist/mod-service/index.d.ts.map +1 -1
- package/dist/mod-service/index.js +8 -17
- package/dist/mod-service/index.js.map +1 -1
- package/dist/mod-service/profile.d.ts +8 -5
- package/dist/mod-service/profile.d.ts.map +1 -1
- package/dist/mod-service/profile.js +44 -60
- package/dist/mod-service/profile.js.map +1 -1
- package/dist/mod-service/report.d.ts +6 -0
- package/dist/mod-service/report.d.ts.map +1 -1
- package/dist/mod-service/report.js +20 -6
- package/dist/mod-service/report.js.map +1 -1
- package/dist/mod-service/status.d.ts +1 -33
- package/dist/mod-service/status.d.ts.map +1 -1
- package/dist/mod-service/status.js +0 -26
- package/dist/mod-service/status.js.map +1 -1
- package/dist/mod-service/types.d.ts +0 -13
- package/dist/mod-service/types.d.ts.map +1 -1
- package/dist/mod-service/types.js.map +1 -1
- package/dist/mod-service/views.d.ts.map +1 -1
- package/dist/mod-service/views.js +0 -22
- package/dist/mod-service/views.js.map +1 -1
- package/dist/set/service.d.ts +1 -1
- package/package.json +6 -6
- package/dist/daemon/materialized-view-refresher.d.ts +0 -5
- package/dist/daemon/materialized-view-refresher.d.ts.map +0 -1
- package/dist/daemon/materialized-view-refresher.js +0 -58
- package/dist/daemon/materialized-view-refresher.js.map +0 -1
- package/dist/db/schema/account_events_stats.d.ts +0 -15
- package/dist/db/schema/account_events_stats.d.ts.map +0 -1
- package/dist/db/schema/account_events_stats.js +0 -2
- package/dist/db/schema/account_events_stats.js.map +0 -1
- package/dist/db/schema/account_record_events_stats.d.ts +0 -15
- package/dist/db/schema/account_record_events_stats.d.ts.map +0 -1
- package/dist/db/schema/account_record_events_stats.js +0 -2
- package/dist/db/schema/account_record_events_stats.js.map +0 -1
- package/dist/db/schema/account_record_status_stats.d.ts +0 -15
- package/dist/db/schema/account_record_status_stats.d.ts.map +0 -1
- package/dist/db/schema/account_record_status_stats.js +0 -2
- package/dist/db/schema/account_record_status_stats.js.map +0 -1
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAgB,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAiB,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EACL,4BAA4B,GAE7B,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EACL,iB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AI,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;QAC/C,CAAC;QACD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACxD,CAAC;IAED,WAAW,CAAC,SAAqC;QAC/C,IAAI,CAAC,IAAI,GAAG;YACV,GAAG,IAAI,CAAC,IAAI;YACZ,GAAG,SAAS;SACb,CAAA;IACH,CAAC;IAED,WAAW,CAAC,GAAoB;QAC9B,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;QAC3C,IAAI,MAA6B,CAAA;QACjC,IAAI,CAAC;YACH,MAAM,GAAG,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACxD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,IAAI,CAAA;QACf,CAAC;QACD,IAAI,CAAC,MAAM;YAAE,OAAO,oBAAoB,CAAC,EAAE,CAAC,CAAA;QAC5C,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import assert from 'node:assert'\nimport * as plc from '@did-plc/lib'\nimport type express from 'express'\nimport { type Keypair, Secp256k1Keypair } from '@atproto/crypto'\nimport { type DidCache, IdResolver, MemoryCache } from '@atproto/identity'\nimport { Client } from '@atproto/lex-client'\nimport { createServiceAuthHeaders } from '@atproto/xrpc-server'\nimport { AssignmentService } from './assignment/index.js'\nimport { AuthVerifier } from './auth-verifier.js'\nimport { BackgroundQueue } from './background.js'\nimport {\n CommunicationTemplateService,\n type CommunicationTemplateServiceCreator,\n} from './communication-service/template.js'\nimport type { OzoneConfig, OzoneSecrets } from './config/index.js'\nimport { BlobDiverter } from './daemon/blob-diverter.js'\nimport { EventPusher } from './daemon/index.js'\nimport { Database } from './db/index.js'\nimport type { ImageInvalidator } from './image-invalidator.js'\nimport {\n ModerationService,\n type ModerationServiceCreator,\n} from './mod-service/index.js'\nimport {\n ModerationServiceProfile,\n type ModerationServiceProfileCreator,\n} from './mod-service/profile.js'\nimport {\n StrikeService,\n type StrikeServiceCreator,\n} from './mod-service/strike.js'\nimport { QueueService, type QueueServiceCreator } from './queue/service.js'\nimport {\n ReportStatsService,\n type ReportStatsServiceCreator,\n} from './report/stats.js'\nimport {\n SafelinkRuleService,\n type SafelinkRuleServiceCreator,\n} from './safelink/service.js'\nimport {\n ScheduledActionService,\n type ScheduledActionServiceCreator,\n} from './scheduled-action/service.js'\nimport { Sequencer } from './sequencer/sequencer.js'\nimport { SetService, type SetServiceCreator } from './set/service.js'\nimport {\n SettingService,\n type SettingServiceCreator,\n} from './setting/service.js'\nimport { TeamService, type TeamServiceCreator } from './team/index.js'\nimport {\n LABELER_HEADER_NAME,\n type ParsedLabelers,\n defaultLabelerHeader,\n getSigningKeyId,\n parseLabelerHeader,\n} from './util.js'\nimport {\n VerificationIssuer,\n type VerificationIssuerCreator,\n} from './verification/issuer.js'\nimport {\n VerificationService,\n type VerificationServiceCreator,\n} from './verification/service.js'\nimport type { VideoInvalidator } from './video-invalidator.js'\n\nexport type AppContextOptions = {\n db: Database\n cfg: OzoneConfig\n modService: ModerationServiceCreator\n moderationServiceProfile: ModerationServiceProfileCreator\n communicationTemplateService: CommunicationTemplateServiceCreator\n safelinkRuleService: SafelinkRuleServiceCreator\n scheduledActionService: ScheduledActionServiceCreator\n queueService: QueueServiceCreator\n reportStatsService: ReportStatsServiceCreator\n setService: SetServiceCreator\n settingService: SettingServiceCreator\n strikeService: StrikeServiceCreator\n teamService: TeamServiceCreator\n appviewClient: Client\n pdsClient: Client | undefined\n chatClient: Client | undefined\n blobDiverter?: BlobDiverter\n signingKey: Keypair\n signingKeyId: number\n didCache: DidCache\n idResolver: IdResolver\n imgInvalidator?: ImageInvalidator\n videoInvalidator?: VideoInvalidator\n backgroundQueue: BackgroundQueue\n sequencer: Sequencer\n assignmentService: AssignmentService\n authVerifier: AuthVerifier\n verificationService: VerificationServiceCreator\n verificationIssuer: VerificationIssuerCreator\n}\n\nexport class AppContext {\n constructor(private opts: AppContextOptions) {}\n\n static async fromConfig(\n cfg: OzoneConfig,\n secrets: OzoneSecrets,\n overrides?: Partial<AppContextOptions>,\n ): Promise<AppContext> {\n const db = new Database({\n url: cfg.db.postgresUrl,\n schema: cfg.db.postgresSchema,\n poolSize: cfg.db.poolSize,\n poolMaxUses: cfg.db.poolMaxUses,\n poolIdleTimeoutMs: cfg.db.poolIdleTimeoutMs,\n })\n const signingKey = await Secp256k1Keypair.import(secrets.signingKeyHex)\n const signingKeyId = await getSigningKeyId(db, signingKey.did())\n // Trust internal services to send us well-formed responses\n const clientOpts = { strictResponseProcessing: false }\n const appviewClient = new Client({ service: cfg.appview.url }, clientOpts)\n // OZONE_PDS_HEADERS is applied only to the operator-configured PDS.\n const pdsClient = cfg.pds\n ? new Client(\n { service: cfg.pds.url },\n { ...clientOpts, headers: secrets.pdsHeaders },\n )\n : undefined\n const chatClient = cfg.chat\n ? new Client({ service: cfg.chat.url }, clientOpts)\n : undefined\n\n const didCache = new MemoryCache(\n cfg.identity.cacheStaleTTL,\n cfg.identity.cacheMaxTTL,\n {\n maxEntries: cfg.identity.cacheMaxEntries,\n maxBytes: cfg.identity.cacheMaxBytes,\n maxDocBytes: cfg.identity.cacheMaxDocBytes,\n },\n )\n const idResolver = new IdResolver({\n plcUrl: cfg.identity.plcUrl,\n didCache,\n fetch: cfg.service.devMode ? globalThis.fetch : undefined,\n })\n\n const createAuthHeaders = (aud: string, lxm: string) =>\n createServiceAuthHeaders({\n iss: `${cfg.service.did}#atproto_labeler`,\n aud,\n lxm,\n keypair: signingKey,\n })\n\n const backgroundQueue = new BackgroundQueue(db, { concurrency: 20 })\n const blobDiverter = cfg.blobDivert\n ? new BlobDiverter(db, {\n idResolver,\n serviceConfig: cfg.blobDivert,\n devMode: cfg.service.devMode,\n })\n : undefined\n const eventPusher = new EventPusher(db, createAuthHeaders, {\n appview: cfg.appview.pushEvents ? cfg.appview : undefined,\n pds: cfg.pds ? { ...cfg.pds, headers: secrets.pdsHeaders } : undefined,\n })\n\n const communicationTemplateService = CommunicationTemplateService.creator()\n const safelinkRuleService = SafelinkRuleService.creator()\n const scheduledActionService = ScheduledActionService.creator()\n const teamService = TeamService.creator(\n appviewClient,\n cfg.appview.did,\n createAuthHeaders,\n )\n const queueService = QueueService.creator(cfg.service.did)\n const reportStatsService = ReportStatsService.creator()\n const setService = SetService.creator()\n const settingService = SettingService.creator()\n const strikeService = StrikeService.creator()\n const verificationService = VerificationService.creator()\n const verificationIssuer = VerificationIssuer.creator()\n const moderationServiceProfile = ModerationServiceProfile.creator(\n cfg,\n appviewClient,\n )\n const modService = ModerationService.creator(\n signingKey,\n signingKeyId,\n cfg,\n backgroundQueue,\n idResolver,\n eventPusher,\n appviewClient,\n createAuthHeaders,\n strikeService,\n overrides?.imgInvalidator,\n overrides?.videoInvalidator,\n )\n const assignmentService = AssignmentService.creator(\n {\n queueDurationMs: cfg.assignments.queueDurationMs,\n reportDurationMs: cfg.assignments.reportDurationMs,\n },\n queueService,\n teamService,\n )(db)\n\n const sequencer = new Sequencer(modService(db))\n\n const authVerifier = new AuthVerifier(idResolver, {\n serviceDid: cfg.service.did,\n adminPassword: secrets.adminPassword,\n teamService: teamService(db),\n })\n\n return new AppContext({\n db,\n cfg,\n modService,\n moderationServiceProfile,\n communicationTemplateService,\n safelinkRuleService,\n scheduledActionService,\n teamService,\n queueService,\n reportStatsService,\n setService,\n settingService,\n strikeService,\n appviewClient,\n pdsClient,\n chatClient,\n signingKey,\n signingKeyId,\n didCache,\n idResolver,\n backgroundQueue,\n sequencer,\n assignmentService,\n authVerifier,\n blobDiverter,\n verificationService,\n verificationIssuer,\n ...(overrides ?? {}),\n })\n }\n\n assignPort(port: number) {\n assert(\n !this.cfg.service.port || this.cfg.service.port === port,\n 'Conflicting port in config',\n )\n this.opts.cfg.service.port = port\n }\n\n get db(): Database {\n return this.opts.db\n }\n\n get cfg(): OzoneConfig {\n return this.opts.cfg\n }\n\n get modService(): ModerationServiceCreator {\n return this.opts.modService\n }\n\n get blobDiverter(): BlobDiverter | undefined {\n return this.opts.blobDiverter\n }\n\n get communicationTemplateService(): CommunicationTemplateServiceCreator {\n return this.opts.communicationTemplateService\n }\n\n get safelinkRuleService(): SafelinkRuleServiceCreator {\n return this.opts.safelinkRuleService\n }\n\n get scheduledActionService(): ScheduledActionServiceCreator {\n return this.opts.scheduledActionService\n }\n\n get teamService(): TeamServiceCreator {\n return this.opts.teamService\n }\n\n get queueService(): QueueServiceCreator {\n return this.opts.queueService\n }\n\n get reportStatsService(): ReportStatsServiceCreator {\n return this.opts.reportStatsService\n }\n\n get setService(): SetServiceCreator {\n return this.opts.setService\n }\n\n get settingService(): SettingServiceCreator {\n return this.opts.settingService\n }\n\n get strikeService(): StrikeServiceCreator {\n return this.opts.strikeService\n }\n\n get verificationService(): VerificationServiceCreator {\n return this.opts.verificationService\n }\n\n get verificationIssuer(): VerificationIssuerCreator {\n return this.opts.verificationIssuer\n }\n\n get moderationServiceProfile(): ModerationServiceProfileCreator {\n return this.opts.moderationServiceProfile\n }\n\n get appviewClient(): Client {\n return this.opts.appviewClient\n }\n\n get pdsClient(): Client | undefined {\n return this.opts.pdsClient\n }\n\n get chatClient(): Client | undefined {\n return this.opts.chatClient\n }\n\n get signingKey(): Keypair {\n return this.opts.signingKey\n }\n\n get signingKeyId(): number {\n return this.opts.signingKeyId\n }\n\n get plcClient(): plc.Client {\n return new plc.Client(this.cfg.identity.plcUrl)\n }\n\n get didCache(): DidCache {\n return this.opts.didCache\n }\n\n get idResolver(): IdResolver {\n return this.opts.idResolver\n }\n\n get backgroundQueue(): BackgroundQueue {\n return this.opts.backgroundQueue\n }\n\n get sequencer(): Sequencer {\n return this.opts.sequencer\n }\n\n get assignmentService(): AssignmentService {\n return this.opts.assignmentService\n }\n\n get authVerifier(): AuthVerifier {\n return this.opts.authVerifier\n }\n\n async serviceAuthHeaders(aud: string, lxm: string) {\n const iss = `${this.cfg.service.did}#atproto_labeler`\n return createServiceAuthHeaders({\n iss,\n aud,\n lxm,\n keypair: this.signingKey,\n })\n }\n\n async pdsAuth(lxm: string) {\n if (!this.cfg.pds) {\n return undefined\n }\n return this.serviceAuthHeaders(this.cfg.pds.did, lxm)\n }\n\n async appviewAuth(lxm: string) {\n return this.serviceAuthHeaders(this.cfg.appview.did, lxm)\n }\n\n async chatAuth(lxm: string) {\n if (!this.cfg.chat) {\n throw new Error('No chat service configured')\n }\n return this.serviceAuthHeaders(this.cfg.chat.did, lxm)\n }\n\n devOverride(overrides: Partial<AppContextOptions>) {\n this.opts = {\n ...this.opts,\n ...overrides,\n }\n }\n\n reqLabelers(req: express.Request): ParsedLabelers {\n const val = req.header(LABELER_HEADER_NAME)\n let parsed: ParsedLabelers | null\n try {\n parsed = parseLabelerHeader(val, this.cfg.service.did)\n } catch (err) {\n parsed = null\n }\n if (!parsed) return defaultLabelerHeader([])\n return parsed\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAGnC,OAAO,EAAgB,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAiB,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EACL,4BAA4B,GAE7B,MAAM,qCAAqC,CAAA;A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3B,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAW;QACxB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;QAC/C,CAAC;QACD,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACxD,CAAC;IAED,WAAW,CAAC,SAAqC;QAC/C,IAAI,CAAC,IAAI,GAAG;YACV,GAAG,IAAI,CAAC,IAAI;YACZ,GAAG,SAAS;SACb,CAAA;IACH,CAAC;IAED,WAAW,CAAC,GAAoB;QAC9B,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAA;QAC3C,IAAI,MAA6B,CAAA;QACjC,IAAI,CAAC;YACH,MAAM,GAAG,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACxD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,IAAI,CAAA;QACf,CAAC;QACD,IAAI,CAAC,MAAM;YAAE,OAAO,oBAAoB,CAAC,EAAE,CAAC,CAAA;QAC5C,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import assert from 'node:assert'\nimport * as plc from '@did-plc/lib'\nimport type express from 'express'\nimport type { Registry } from 'prom-client'\nimport { type Keypair, Secp256k1Keypair } from '@atproto/crypto'\nimport { type DidCache, IdResolver, MemoryCache } from '@atproto/identity'\nimport { Client } from '@atproto/lex-client'\nimport { createServiceAuthHeaders } from '@atproto/xrpc-server'\nimport { AssignmentService } from './assignment/index.js'\nimport { AuthVerifier } from './auth-verifier.js'\nimport { BackgroundQueue } from './background.js'\nimport {\n CommunicationTemplateService,\n type CommunicationTemplateServiceCreator,\n} from './communication-service/template.js'\nimport type { OzoneConfig, OzoneSecrets } from './config/index.js'\nimport { BlobDiverter } from './daemon/blob-diverter.js'\nimport { EventPusher } from './daemon/index.js'\nimport { Database } from './db/index.js'\nimport type { ImageInvalidator } from './image-invalidator.js'\nimport {\n ModerationService,\n type ModerationServiceCreator,\n} from './mod-service/index.js'\nimport {\n ModerationServiceProfile,\n type ModerationServiceProfileCreator,\n} from './mod-service/profile.js'\nimport {\n StrikeService,\n type StrikeServiceCreator,\n} from './mod-service/strike.js'\nimport { QueueService, type QueueServiceCreator } from './queue/service.js'\nimport {\n ReportStatsService,\n type ReportStatsServiceCreator,\n} from './report/stats.js'\nimport {\n SafelinkRuleService,\n type SafelinkRuleServiceCreator,\n} from './safelink/service.js'\nimport {\n ScheduledActionService,\n type ScheduledActionServiceCreator,\n} from './scheduled-action/service.js'\nimport { Sequencer } from './sequencer/sequencer.js'\nimport { SetService, type SetServiceCreator } from './set/service.js'\nimport {\n SettingService,\n type SettingServiceCreator,\n} from './setting/service.js'\nimport { TeamService, type TeamServiceCreator } from './team/index.js'\nimport {\n LABELER_HEADER_NAME,\n type ParsedLabelers,\n defaultLabelerHeader,\n getSigningKeyId,\n parseLabelerHeader,\n} from './util.js'\nimport {\n VerificationIssuer,\n type VerificationIssuerCreator,\n} from './verification/issuer.js'\nimport {\n VerificationService,\n type VerificationServiceCreator,\n} from './verification/service.js'\nimport type { VideoInvalidator } from './video-invalidator.js'\n\nexport type AppContextOptions = {\n db: Database\n cfg: OzoneConfig\n modService: ModerationServiceCreator\n moderationServiceProfile: ModerationServiceProfileCreator\n communicationTemplateService: CommunicationTemplateServiceCreator\n safelinkRuleService: SafelinkRuleServiceCreator\n scheduledActionService: ScheduledActionServiceCreator\n queueService: QueueServiceCreator\n reportStatsService: ReportStatsServiceCreator\n setService: SetServiceCreator\n settingService: SettingServiceCreator\n strikeService: StrikeServiceCreator\n teamService: TeamServiceCreator\n appviewClient: Client\n pdsClient: Client | undefined\n chatClient: Client | undefined\n blobDiverter?: BlobDiverter\n signingKey: Keypair\n signingKeyId: number\n didCache: DidCache\n idResolver: IdResolver\n imgInvalidator?: ImageInvalidator\n videoInvalidator?: VideoInvalidator\n backgroundQueue: BackgroundQueue\n sequencer: Sequencer\n assignmentService: AssignmentService\n authVerifier: AuthVerifier\n verificationService: VerificationServiceCreator\n verificationIssuer: VerificationIssuerCreator\n}\n\nexport class AppContext {\n constructor(private opts: AppContextOptions) {}\n\n static async fromConfig(\n cfg: OzoneConfig,\n secrets: OzoneSecrets,\n overrides?: Partial<AppContextOptions>,\n register?: Registry,\n ): Promise<AppContext> {\n const db = new Database({\n url: cfg.db.postgresUrl,\n schema: cfg.db.postgresSchema,\n poolSize: cfg.db.poolSize,\n poolMaxUses: cfg.db.poolMaxUses,\n poolIdleTimeoutMs: cfg.db.poolIdleTimeoutMs,\n })\n const signingKey = await Secp256k1Keypair.import(secrets.signingKeyHex)\n const signingKeyId = await getSigningKeyId(db, signingKey.did())\n // Trust internal services to send us well-formed responses\n const clientOpts = { strictResponseProcessing: false }\n const appviewClient = new Client({ service: cfg.appview.url }, clientOpts)\n // OZONE_PDS_HEADERS is applied only to the operator-configured PDS.\n const pdsClient = cfg.pds\n ? new Client(\n { service: cfg.pds.url },\n { ...clientOpts, headers: secrets.pdsHeaders },\n )\n : undefined\n const chatClient = cfg.chat\n ? new Client({ service: cfg.chat.url }, clientOpts)\n : undefined\n\n const didCache = new MemoryCache(\n cfg.identity.cacheStaleTTL,\n cfg.identity.cacheMaxTTL,\n {\n maxEntries: cfg.identity.cacheMaxEntries,\n maxBytes: cfg.identity.cacheMaxBytes,\n maxDocBytes: cfg.identity.cacheMaxDocBytes,\n },\n )\n const idResolver = new IdResolver({\n plcUrl: cfg.identity.plcUrl,\n didCache,\n fetch: cfg.service.devMode ? globalThis.fetch : undefined,\n })\n\n const createAuthHeaders = (aud: string, lxm: string) =>\n createServiceAuthHeaders({\n iss: `${cfg.service.did}#atproto_labeler`,\n aud,\n lxm,\n keypair: signingKey,\n })\n\n const backgroundQueue = new BackgroundQueue(db, { concurrency: 20 })\n const blobDiverter = cfg.blobDivert\n ? new BlobDiverter(db, {\n idResolver,\n serviceConfig: cfg.blobDivert,\n devMode: cfg.service.devMode,\n })\n : undefined\n const eventPusher = new EventPusher(db, createAuthHeaders, {\n appview: cfg.appview.pushEvents ? cfg.appview : undefined,\n pds: cfg.pds ? { ...cfg.pds, headers: secrets.pdsHeaders } : undefined,\n })\n\n const communicationTemplateService = CommunicationTemplateService.creator()\n const safelinkRuleService = SafelinkRuleService.creator()\n const scheduledActionService = ScheduledActionService.creator()\n const teamService = TeamService.creator(\n appviewClient,\n cfg.appview.did,\n createAuthHeaders,\n )\n const queueService = QueueService.creator(cfg.service.did)\n const reportStatsService = ReportStatsService.creator()\n const setService = SetService.creator()\n const settingService = SettingService.creator()\n const strikeService = StrikeService.creator()\n const verificationService = VerificationService.creator()\n const verificationIssuer = VerificationIssuer.creator()\n const moderationServiceProfile = ModerationServiceProfile.creator(\n cfg,\n appviewClient,\n register,\n )\n const modService = ModerationService.creator(\n signingKey,\n signingKeyId,\n cfg,\n backgroundQueue,\n idResolver,\n eventPusher,\n appviewClient,\n createAuthHeaders,\n strikeService,\n overrides?.imgInvalidator,\n overrides?.videoInvalidator,\n )\n const assignmentService = AssignmentService.creator(\n {\n queueDurationMs: cfg.assignments.queueDurationMs,\n reportDurationMs: cfg.assignments.reportDurationMs,\n },\n queueService,\n teamService,\n )(db)\n\n const sequencer = new Sequencer(modService(db))\n\n const authVerifier = new AuthVerifier(idResolver, {\n serviceDid: cfg.service.did,\n adminPassword: secrets.adminPassword,\n teamService: teamService(db),\n })\n\n return new AppContext({\n db,\n cfg,\n modService,\n moderationServiceProfile,\n communicationTemplateService,\n safelinkRuleService,\n scheduledActionService,\n teamService,\n queueService,\n reportStatsService,\n setService,\n settingService,\n strikeService,\n appviewClient,\n pdsClient,\n chatClient,\n signingKey,\n signingKeyId,\n didCache,\n idResolver,\n backgroundQueue,\n sequencer,\n assignmentService,\n authVerifier,\n blobDiverter,\n verificationService,\n verificationIssuer,\n ...(overrides ?? {}),\n })\n }\n\n assignPort(port: number) {\n assert(\n !this.cfg.service.port || this.cfg.service.port === port,\n 'Conflicting port in config',\n )\n this.opts.cfg.service.port = port\n }\n\n get db(): Database {\n return this.opts.db\n }\n\n get cfg(): OzoneConfig {\n return this.opts.cfg\n }\n\n get modService(): ModerationServiceCreator {\n return this.opts.modService\n }\n\n get blobDiverter(): BlobDiverter | undefined {\n return this.opts.blobDiverter\n }\n\n get communicationTemplateService(): CommunicationTemplateServiceCreator {\n return this.opts.communicationTemplateService\n }\n\n get safelinkRuleService(): SafelinkRuleServiceCreator {\n return this.opts.safelinkRuleService\n }\n\n get scheduledActionService(): ScheduledActionServiceCreator {\n return this.opts.scheduledActionService\n }\n\n get teamService(): TeamServiceCreator {\n return this.opts.teamService\n }\n\n get queueService(): QueueServiceCreator {\n return this.opts.queueService\n }\n\n get reportStatsService(): ReportStatsServiceCreator {\n return this.opts.reportStatsService\n }\n\n get setService(): SetServiceCreator {\n return this.opts.setService\n }\n\n get settingService(): SettingServiceCreator {\n return this.opts.settingService\n }\n\n get strikeService(): StrikeServiceCreator {\n return this.opts.strikeService\n }\n\n get verificationService(): VerificationServiceCreator {\n return this.opts.verificationService\n }\n\n get verificationIssuer(): VerificationIssuerCreator {\n return this.opts.verificationIssuer\n }\n\n get moderationServiceProfile(): ModerationServiceProfileCreator {\n return this.opts.moderationServiceProfile\n }\n\n get appviewClient(): Client {\n return this.opts.appviewClient\n }\n\n get pdsClient(): Client | undefined {\n return this.opts.pdsClient\n }\n\n get chatClient(): Client | undefined {\n return this.opts.chatClient\n }\n\n get signingKey(): Keypair {\n return this.opts.signingKey\n }\n\n get signingKeyId(): number {\n return this.opts.signingKeyId\n }\n\n get plcClient(): plc.Client {\n return new plc.Client(this.cfg.identity.plcUrl)\n }\n\n get didCache(): DidCache {\n return this.opts.didCache\n }\n\n get idResolver(): IdResolver {\n return this.opts.idResolver\n }\n\n get backgroundQueue(): BackgroundQueue {\n return this.opts.backgroundQueue\n }\n\n get sequencer(): Sequencer {\n return this.opts.sequencer\n }\n\n get assignmentService(): AssignmentService {\n return this.opts.assignmentService\n }\n\n get authVerifier(): AuthVerifier {\n return this.opts.authVerifier\n }\n\n async serviceAuthHeaders(aud: string, lxm: string) {\n const iss = `${this.cfg.service.did}#atproto_labeler`\n return createServiceAuthHeaders({\n iss,\n aud,\n lxm,\n keypair: this.signingKey,\n })\n }\n\n async pdsAuth(lxm: string) {\n if (!this.cfg.pds) {\n return undefined\n }\n return this.serviceAuthHeaders(this.cfg.pds.did, lxm)\n }\n\n async appviewAuth(lxm: string) {\n return this.serviceAuthHeaders(this.cfg.appview.did, lxm)\n }\n\n async chatAuth(lxm: string) {\n if (!this.cfg.chat) {\n throw new Error('No chat service configured')\n }\n return this.serviceAuthHeaders(this.cfg.chat.did, lxm)\n }\n\n devOverride(overrides: Partial<AppContextOptions>) {\n this.opts = {\n ...this.opts,\n ...overrides,\n }\n }\n\n reqLabelers(req: express.Request): ParsedLabelers {\n const val = req.header(LABELER_HEADER_NAME)\n let parsed: ParsedLabelers | null\n try {\n parsed = parseLabelerHeader(val, this.cfg.service.did)\n } catch (err) {\n parsed = null\n }\n if (!parsed) return defaultLabelerHeader([])\n return parsed\n }\n}\n"]}
|
package/dist/daemon/context.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import type { OzoneConfig, OzoneSecrets } from '../config/index.js';
|
|
|
5
5
|
import { Database } from '../db/index.js';
|
|
6
6
|
import { EventPusher } from './event-pusher.js';
|
|
7
7
|
import { EventReverser } from './event-reverser.js';
|
|
8
|
-
import { MaterializedViewRefresher } from './materialized-view-refresher.js';
|
|
9
8
|
import { QueueRouter } from './queue-router.js';
|
|
10
9
|
import { ReportReporterDidBackfiller } from './report-reporter-did-backfiller.js';
|
|
11
10
|
import { ScheduledActionProcessor } from './scheduled-action-processor.js';
|
|
@@ -20,7 +19,6 @@ export type DaemonContextOptions = {
|
|
|
20
19
|
signingKey: Keypair;
|
|
21
20
|
eventPusher: EventPusher;
|
|
22
21
|
eventReverser: EventReverser;
|
|
23
|
-
materializedViewRefresher: MaterializedViewRefresher;
|
|
24
22
|
teamProfileSynchronizer: TeamProfileSynchronizer;
|
|
25
23
|
scheduledActionProcessor: ScheduledActionProcessor;
|
|
26
24
|
strikeExpiryProcessor: StrikeExpiryProcessor;
|
|
@@ -38,7 +36,6 @@ export declare class DaemonContext {
|
|
|
38
36
|
get backgroundQueue(): BackgroundQueue;
|
|
39
37
|
get eventPusher(): EventPusher;
|
|
40
38
|
get eventReverser(): EventReverser;
|
|
41
|
-
get materializedViewRefresher(): MaterializedViewRefresher;
|
|
42
39
|
get teamProfileSynchronizer(): TeamProfileSynchronizer;
|
|
43
40
|
get scheduledActionProcessor(): ScheduledActionProcessor;
|
|
44
41
|
get strikeExpiryProcessor(): StrikeExpiryProcessor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/daemon/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,aAAa,CAAA;AAE9C,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,iBAAiB,CAAA;AAIhE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AASzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/daemon/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,U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,CAAC,IAAI;IAAxB,YAAoB,IAAI,EAAE,oBAAoB,EAAI;IAElD,OAAa,UAAU,CACrB,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,YAAY,EACrB,SAAS,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAGzC,QAAQ,CAAC,EAAE,UAAU,CAAC,QAAQ,GAC7B,OAAO,CAAC,aAAa,CAAC,CAgHxB;IAED,IAAI,EAAE,IAAI,QAAQ,CAEjB;IAED,IAAI,GAAG,IAAI,WAAW,CAErB;IAED,IAAI,eAAe,IAAI,eAAe,CAErC;IAED,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,IAAI,aAAa,IAAI,aAAa,CAEjC;IAED,IAAI,uBAAuB,IAAI,uBAAuB,CAErD;IAED,IAAI,wBAAwB,IAAI,wBAAwB,CAEvD;IAED,IAAI,qBAAqB,IAAI,qBAAqB,CAEjD;IAED,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,IAAI,2BAA2B,IAAI,2BAA2B,CAE7D;IAED,IAAI,oBAAoB,IAAI,oBAAoB,GAAG,SAAS,CAE3D;IAED,IAAI,aAAa,IAAI,aAAa,GAAG,SAAS,CAE7C;IAEK,KAAK,kBAUV;IAEK,UAAU,kBAOf;IAEK,OAAO,kBAiBZ;CACF"}
|
package/dist/daemon/context.js
CHANGED
|
@@ -15,7 +15,6 @@ import { TeamService } from '../team/index.js';
|
|
|
15
15
|
import { getSigningKeyId } from '../util.js';
|
|
16
16
|
import { EventPusher } from './event-pusher.js';
|
|
17
17
|
import { EventReverser } from './event-reverser.js';
|
|
18
|
-
import { MaterializedViewRefresher } from './materialized-view-refresher.js';
|
|
19
18
|
import { QueueRouter } from './queue-router.js';
|
|
20
19
|
import { ReportReporterDidBackfiller } from './report-reporter-did-backfiller.js';
|
|
21
20
|
import { ScheduledActionProcessor } from './scheduled-action-processor.js';
|
|
@@ -61,7 +60,6 @@ export class DaemonContext {
|
|
|
61
60
|
const teamService = TeamService.creator(appviewClient, cfg.appview.did, createAuthHeaders);
|
|
62
61
|
const teamProfileSynchronizer = new TeamProfileSynchronizer(backgroundQueue, teamService(db), cfg.db.teamProfileRefreshIntervalMs);
|
|
63
62
|
const eventReverser = new EventReverser(db, modService);
|
|
64
|
-
const materializedViewRefresher = new MaterializedViewRefresher(backgroundQueue, cfg.db.materializedViewRefreshIntervalMs, cfg.db.materializedViewRefreshTimeoutMs);
|
|
65
63
|
const scheduledActionProcessor = new ScheduledActionProcessor(db, cfg.service.did, settingService, modService, scheduledActionService);
|
|
66
64
|
const strikeExpiryProcessor = new StrikeExpiryProcessor(db, strikeService, cfg.strikeSuspension, cfg.inbox.startAt);
|
|
67
65
|
const queueService = QueueService.creator(cfg.service.did);
|
|
@@ -80,7 +78,6 @@ export class DaemonContext {
|
|
|
80
78
|
signingKey,
|
|
81
79
|
eventPusher,
|
|
82
80
|
eventReverser,
|
|
83
|
-
materializedViewRefresher,
|
|
84
81
|
teamProfileSynchronizer,
|
|
85
82
|
scheduledActionProcessor,
|
|
86
83
|
strikeExpiryProcessor,
|
|
@@ -106,9 +103,6 @@ export class DaemonContext {
|
|
|
106
103
|
get eventReverser() {
|
|
107
104
|
return this.opts.eventReverser;
|
|
108
105
|
}
|
|
109
|
-
get materializedViewRefresher() {
|
|
110
|
-
return this.opts.materializedViewRefresher;
|
|
111
|
-
}
|
|
112
106
|
get teamProfileSynchronizer() {
|
|
113
107
|
return this.opts.teamProfileSynchronizer;
|
|
114
108
|
}
|
|
@@ -133,7 +127,6 @@ export class DaemonContext {
|
|
|
133
127
|
async start() {
|
|
134
128
|
this.eventPusher.start();
|
|
135
129
|
this.eventReverser.start();
|
|
136
|
-
this.materializedViewRefresher.start();
|
|
137
130
|
this.teamProfileSynchronizer.start();
|
|
138
131
|
this.scheduledActionProcessor.start();
|
|
139
132
|
this.strikeExpiryProcessor.start();
|
|
@@ -143,13 +136,11 @@ export class DaemonContext {
|
|
|
143
136
|
this.statsComputer?.start();
|
|
144
137
|
}
|
|
145
138
|
async processAll() {
|
|
146
|
-
// Sequential because the materialized view values depend on the events.
|
|
147
139
|
await this.eventPusher.processAll();
|
|
148
140
|
// Drain pending modEventReport rows into the report table so test code
|
|
149
141
|
// that calls processAll() after creating reports sees the report rows
|
|
150
142
|
// immediately (in production this happens via the 1-min poll).
|
|
151
143
|
await this.queueRouter.routeReports();
|
|
152
|
-
await this.materializedViewRefresher.run();
|
|
153
144
|
await this.teamProfileSynchronizer.run();
|
|
154
145
|
}
|
|
155
146
|
async destroy() {
|
|
@@ -157,7 +148,6 @@ export class DaemonContext {
|
|
|
157
148
|
await allFulfilled([
|
|
158
149
|
this.eventReverser.destroy(),
|
|
159
150
|
this.eventPusher.destroy(),
|
|
160
|
-
this.materializedViewRefresher.destroy(),
|
|
161
151
|
this.teamProfileSynchronizer.destroy(),
|
|
162
152
|
this.scheduledActionProcessor.destroy(),
|
|
163
153
|
this.strikeExpiryProcessor.destroy(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/daemon/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAgB,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,o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C,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,MAAM,YAAY,CAAC;gBACjB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;gBAC5B,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;gBAC1B,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE;gBACxC,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE;gBACtC,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE;gBACvC,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE;gBACpC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;gBAC1B,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE;gBAC1C,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE;gBACjC,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE;aAC9B,CAAC,CAAA;QACJ,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAA;YACpC,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAA;QACvB,CAAC;IACH,CAAC;CACF","sourcesContent":["import type * as prometheus from 'prom-client'\nimport { allFulfilled } from '@atproto/common'\nimport { type Keypair, Secp256k1Keypair } from '@atproto/crypto'\nimport { IdResolver } from '@atproto/identity'\nimport { Client } from '@atproto/lex-client'\nimport { createServiceAuthHeaders } from '@atproto/xrpc-server'\nimport { BackgroundQueue } from '../background.js'\nimport type { OzoneConfig, OzoneSecrets } from '../config/index.js'\nimport { Database } from '../db/index.js'\nimport { ModerationService } from '../mod-service/index.js'\nimport { StrikeService } from '../mod-service/strike.js'\nimport { QueueService } from '../queue/service.js'\nimport { ReportStatsService } from '../report/stats.js'\nimport { ScheduledActionService } from '../scheduled-action/service.js'\nimport { SettingService } from '../setting/service.js'\nimport { TeamService } from '../team/index.js'\nimport { getSigningKeyId } from '../util.js'\nimport { EventPusher } from './event-pusher.js'\nimport { EventReverser } from './event-reverser.js'\nimport { MaterializedViewRefresher } from './materialized-view-refresher.js'\nimport { QueueRouter } from './queue-router.js'\nimport { ReportReporterDidBackfiller } from './report-reporter-did-backfiller.js'\nimport { ScheduledActionProcessor } from './scheduled-action-processor.js'\nimport { StatsComputer } from './stats-computer.js'\nimport { StrikeExpiryProcessor } from './strike-expiry-processor.js'\nimport { TeamProfileSynchronizer } from './team-profile-synchronizer.js'\nimport { VerificationListener } from './verification-listener.js'\n\nexport type DaemonContextOptions = {\n db: Database\n cfg: OzoneConfig\n backgroundQueue: BackgroundQueue\n signingKey: Keypair\n eventPusher: EventPusher\n eventReverser: EventReverser\n materializedViewRefresher: MaterializedViewRefresher\n teamProfileSynchronizer: TeamProfileSynchronizer\n scheduledActionProcessor: ScheduledActionProcessor\n strikeExpiryProcessor: StrikeExpiryProcessor\n queueRouter: QueueRouter\n reportReporterDidBackfiller: ReportReporterDidBackfiller\n verificationListener?: VerificationListener\n statsComputer?: StatsComputer\n}\n\nexport class DaemonContext {\n constructor(private opts: DaemonContextOptions) {}\n\n static async fromConfig(\n cfg: OzoneConfig,\n secrets: OzoneSecrets,\n overrides?: Partial<DaemonContextOptions>,\n // Optional Prometheus registry, threaded to instrumented daemon jobs. When\n // omitted (metrics not opted in), those jobs collect nothing.\n register?: prometheus.Registry,\n ): Promise<DaemonContext> {\n const db = new Database({\n url: cfg.db.postgresUrl,\n schema: cfg.db.postgresSchema,\n })\n const signingKey = await Secp256k1Keypair.import(secrets.signingKeyHex)\n const signingKeyId = await getSigningKeyId(db, signingKey.did())\n\n const idResolver = new IdResolver({\n plcUrl: cfg.identity.plcUrl,\n fetch: cfg.service.devMode ? globalThis.fetch : undefined,\n })\n\n // Trust internal services to send us well-formed responses\n const appviewClient = new Client(\n { service: cfg.appview.url },\n { strictResponseProcessing: false },\n )\n const createAuthHeaders = (aud: string, lxm: string) =>\n createServiceAuthHeaders({\n iss: `${cfg.service.did}#atproto_labeler`,\n aud,\n lxm,\n keypair: signingKey,\n })\n\n const eventPusher = new EventPusher(db, createAuthHeaders, {\n appview: cfg.appview.pushEvents ? cfg.appview : undefined,\n pds: cfg.pds ? { ...cfg.pds, headers: secrets.pdsHeaders } : undefined,\n })\n\n const backgroundQueue = new BackgroundQueue(db, { concurrency: 20 })\n\n const settingService = SettingService.creator()\n const strikeService = StrikeService.creator()\n const modService = ModerationService.creator(\n signingKey,\n signingKeyId,\n cfg,\n backgroundQueue,\n idResolver,\n eventPusher,\n appviewClient,\n createAuthHeaders,\n strikeService,\n )\n const scheduledActionService = ScheduledActionService.creator()\n const teamService = TeamService.creator(\n appviewClient,\n cfg.appview.did,\n createAuthHeaders,\n )\n const teamProfileSynchronizer = new TeamProfileSynchronizer(\n backgroundQueue,\n teamService(db),\n cfg.db.teamProfileRefreshIntervalMs,\n )\n\n const eventReverser = new EventReverser(db, modService)\n\n const materializedViewRefresher = new MaterializedViewRefresher(\n backgroundQueue,\n cfg.db.materializedViewRefreshIntervalMs,\n cfg.db.materializedViewRefreshTimeoutMs,\n )\n\n const scheduledActionProcessor = new ScheduledActionProcessor(\n db,\n cfg.service.did,\n settingService,\n modService,\n scheduledActionService,\n )\n\n const strikeExpiryProcessor = new StrikeExpiryProcessor(\n db,\n strikeService,\n cfg.strikeSuspension,\n cfg.inbox.startAt,\n )\n\n const queueService = QueueService.creator(cfg.service.did)\n const queueRouter = new QueueRouter(db, queueService, register)\n const reportReporterDidBackfiller = new ReportReporterDidBackfiller(db)\n\n const reportStatsService = ReportStatsService.creator()\n const statsComputer = new StatsComputer(\n db,\n reportStatsService,\n cfg.stats.computerIntervalMinutes,\n )\n\n // Only spawn the listener if verifier config exists and a jetstream URL is provided\n const verificationListener =\n cfg.verifier && cfg.jetstreamUrl\n ? new VerificationListener(\n db,\n cfg.jetstreamUrl,\n cfg.verifier?.issuersToIndex,\n )\n : undefined\n\n return new DaemonContext({\n db,\n cfg,\n backgroundQueue,\n signingKey,\n eventPusher,\n eventReverser,\n materializedViewRefresher,\n teamProfileSynchronizer,\n scheduledActionProcessor,\n strikeExpiryProcessor,\n queueRouter,\n reportReporterDidBackfiller,\n verificationListener,\n statsComputer,\n ...(overrides ?? {}),\n })\n }\n\n get db(): Database {\n return this.opts.db\n }\n\n get cfg(): OzoneConfig {\n return this.opts.cfg\n }\n\n get backgroundQueue(): BackgroundQueue {\n return this.opts.backgroundQueue\n }\n\n get eventPusher(): EventPusher {\n return this.opts.eventPusher\n }\n\n get eventReverser(): EventReverser {\n return this.opts.eventReverser\n }\n\n get materializedViewRefresher(): MaterializedViewRefresher {\n return this.opts.materializedViewRefresher\n }\n\n get teamProfileSynchronizer(): TeamProfileSynchronizer {\n return this.opts.teamProfileSynchronizer\n }\n\n get scheduledActionProcessor(): ScheduledActionProcessor {\n return this.opts.scheduledActionProcessor\n }\n\n get strikeExpiryProcessor(): StrikeExpiryProcessor {\n return this.opts.strikeExpiryProcessor\n }\n\n get queueRouter(): QueueRouter {\n return this.opts.queueRouter\n }\n\n get reportReporterDidBackfiller(): ReportReporterDidBackfiller {\n return this.opts.reportReporterDidBackfiller\n }\n\n get verificationListener(): VerificationListener | undefined {\n return this.opts.verificationListener\n }\n\n get statsComputer(): StatsComputer | undefined {\n return this.opts.statsComputer\n }\n\n async start() {\n this.eventPusher.start()\n this.eventReverser.start()\n this.materializedViewRefresher.start()\n this.teamProfileSynchronizer.start()\n this.scheduledActionProcessor.start()\n this.strikeExpiryProcessor.start()\n this.queueRouter.start()\n this.reportReporterDidBackfiller.start()\n this.verificationListener?.start()\n this.statsComputer?.start()\n }\n\n async processAll() {\n // Sequential because the materialized view values depend on the events.\n await this.eventPusher.processAll()\n // Drain pending modEventReport rows into the report table so test code\n // that calls processAll() after creating reports sees the report rows\n // immediately (in production this happens via the 1-min poll).\n await this.queueRouter.routeReports()\n await this.materializedViewRefresher.run()\n await this.teamProfileSynchronizer.run()\n }\n\n async destroy() {\n try {\n await allFulfilled([\n this.eventReverser.destroy(),\n this.eventPusher.destroy(),\n this.materializedViewRefresher.destroy(),\n this.teamProfileSynchronizer.destroy(),\n this.scheduledActionProcessor.destroy(),\n this.strikeExpiryProcessor.destroy(),\n this.queueRouter.destroy(),\n this.reportReporterDidBackfiller.destroy(),\n this.verificationListener?.stop(),\n this.statsComputer?.destroy(),\n ])\n } finally {\n await this.backgroundQueue.destroy()\n await this.db.close()\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/daemon/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAgB,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,2BA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CAAC,KAAK,EAAE,CAAA;QACxB,IAAI,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAA;QACxC,IAAI,CAAC,oBAAoB,EAAE,KAAK,EAAE,CAAA;QAClC,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAA;QACnC,uEAAuE;QACvE,sEAAsE;QACtE,+DAA+D;QAC/D,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAA;QACrC,MAAM,IAAI,CAAC,uBAAuB,CAAC,GAAG,EAAE,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,MAAM,YAAY,CAAC;gBACjB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;gBAC5B,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;gBAC1B,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE;gBACtC,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE;gBACvC,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE;gBACpC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;gBAC1B,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE;gBAC1C,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE;gBACjC,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE;aAC9B,CAAC,CAAA;QACJ,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAA;YACpC,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAA;QACvB,CAAC;IACH,CAAC;CACF","sourcesContent":["import type * as prometheus from 'prom-client'\nimport { allFulfilled } from '@atproto/common'\nimport { type Keypair, Secp256k1Keypair } from '@atproto/crypto'\nimport { IdResolver } from '@atproto/identity'\nimport { Client } from '@atproto/lex-client'\nimport { createServiceAuthHeaders } from '@atproto/xrpc-server'\nimport { BackgroundQueue } from '../background.js'\nimport type { OzoneConfig, OzoneSecrets } from '../config/index.js'\nimport { Database } from '../db/index.js'\nimport { ModerationService } from '../mod-service/index.js'\nimport { StrikeService } from '../mod-service/strike.js'\nimport { QueueService } from '../queue/service.js'\nimport { ReportStatsService } from '../report/stats.js'\nimport { ScheduledActionService } from '../scheduled-action/service.js'\nimport { SettingService } from '../setting/service.js'\nimport { TeamService } from '../team/index.js'\nimport { getSigningKeyId } from '../util.js'\nimport { EventPusher } from './event-pusher.js'\nimport { EventReverser } from './event-reverser.js'\nimport { QueueRouter } from './queue-router.js'\nimport { ReportReporterDidBackfiller } from './report-reporter-did-backfiller.js'\nimport { ScheduledActionProcessor } from './scheduled-action-processor.js'\nimport { StatsComputer } from './stats-computer.js'\nimport { StrikeExpiryProcessor } from './strike-expiry-processor.js'\nimport { TeamProfileSynchronizer } from './team-profile-synchronizer.js'\nimport { VerificationListener } from './verification-listener.js'\n\nexport type DaemonContextOptions = {\n db: Database\n cfg: OzoneConfig\n backgroundQueue: BackgroundQueue\n signingKey: Keypair\n eventPusher: EventPusher\n eventReverser: EventReverser\n teamProfileSynchronizer: TeamProfileSynchronizer\n scheduledActionProcessor: ScheduledActionProcessor\n strikeExpiryProcessor: StrikeExpiryProcessor\n queueRouter: QueueRouter\n reportReporterDidBackfiller: ReportReporterDidBackfiller\n verificationListener?: VerificationListener\n statsComputer?: StatsComputer\n}\n\nexport class DaemonContext {\n constructor(private opts: DaemonContextOptions) {}\n\n static async fromConfig(\n cfg: OzoneConfig,\n secrets: OzoneSecrets,\n overrides?: Partial<DaemonContextOptions>,\n // Optional Prometheus registry, threaded to instrumented daemon jobs. When\n // omitted (metrics not opted in), those jobs collect nothing.\n register?: prometheus.Registry,\n ): Promise<DaemonContext> {\n const db = new Database({\n url: cfg.db.postgresUrl,\n schema: cfg.db.postgresSchema,\n })\n const signingKey = await Secp256k1Keypair.import(secrets.signingKeyHex)\n const signingKeyId = await getSigningKeyId(db, signingKey.did())\n\n const idResolver = new IdResolver({\n plcUrl: cfg.identity.plcUrl,\n fetch: cfg.service.devMode ? globalThis.fetch : undefined,\n })\n\n // Trust internal services to send us well-formed responses\n const appviewClient = new Client(\n { service: cfg.appview.url },\n { strictResponseProcessing: false },\n )\n const createAuthHeaders = (aud: string, lxm: string) =>\n createServiceAuthHeaders({\n iss: `${cfg.service.did}#atproto_labeler`,\n aud,\n lxm,\n keypair: signingKey,\n })\n\n const eventPusher = new EventPusher(db, createAuthHeaders, {\n appview: cfg.appview.pushEvents ? cfg.appview : undefined,\n pds: cfg.pds ? { ...cfg.pds, headers: secrets.pdsHeaders } : undefined,\n })\n\n const backgroundQueue = new BackgroundQueue(db, { concurrency: 20 })\n\n const settingService = SettingService.creator()\n const strikeService = StrikeService.creator()\n const modService = ModerationService.creator(\n signingKey,\n signingKeyId,\n cfg,\n backgroundQueue,\n idResolver,\n eventPusher,\n appviewClient,\n createAuthHeaders,\n strikeService,\n )\n const scheduledActionService = ScheduledActionService.creator()\n const teamService = TeamService.creator(\n appviewClient,\n cfg.appview.did,\n createAuthHeaders,\n )\n const teamProfileSynchronizer = new TeamProfileSynchronizer(\n backgroundQueue,\n teamService(db),\n cfg.db.teamProfileRefreshIntervalMs,\n )\n\n const eventReverser = new EventReverser(db, modService)\n\n const scheduledActionProcessor = new ScheduledActionProcessor(\n db,\n cfg.service.did,\n settingService,\n modService,\n scheduledActionService,\n )\n\n const strikeExpiryProcessor = new StrikeExpiryProcessor(\n db,\n strikeService,\n cfg.strikeSuspension,\n cfg.inbox.startAt,\n )\n\n const queueService = QueueService.creator(cfg.service.did)\n const queueRouter = new QueueRouter(db, queueService, register)\n const reportReporterDidBackfiller = new ReportReporterDidBackfiller(db)\n\n const reportStatsService = ReportStatsService.creator()\n const statsComputer = new StatsComputer(\n db,\n reportStatsService,\n cfg.stats.computerIntervalMinutes,\n )\n\n // Only spawn the listener if verifier config exists and a jetstream URL is provided\n const verificationListener =\n cfg.verifier && cfg.jetstreamUrl\n ? new VerificationListener(\n db,\n cfg.jetstreamUrl,\n cfg.verifier?.issuersToIndex,\n )\n : undefined\n\n return new DaemonContext({\n db,\n cfg,\n backgroundQueue,\n signingKey,\n eventPusher,\n eventReverser,\n teamProfileSynchronizer,\n scheduledActionProcessor,\n strikeExpiryProcessor,\n queueRouter,\n reportReporterDidBackfiller,\n verificationListener,\n statsComputer,\n ...(overrides ?? {}),\n })\n }\n\n get db(): Database {\n return this.opts.db\n }\n\n get cfg(): OzoneConfig {\n return this.opts.cfg\n }\n\n get backgroundQueue(): BackgroundQueue {\n return this.opts.backgroundQueue\n }\n\n get eventPusher(): EventPusher {\n return this.opts.eventPusher\n }\n\n get eventReverser(): EventReverser {\n return this.opts.eventReverser\n }\n\n get teamProfileSynchronizer(): TeamProfileSynchronizer {\n return this.opts.teamProfileSynchronizer\n }\n\n get scheduledActionProcessor(): ScheduledActionProcessor {\n return this.opts.scheduledActionProcessor\n }\n\n get strikeExpiryProcessor(): StrikeExpiryProcessor {\n return this.opts.strikeExpiryProcessor\n }\n\n get queueRouter(): QueueRouter {\n return this.opts.queueRouter\n }\n\n get reportReporterDidBackfiller(): ReportReporterDidBackfiller {\n return this.opts.reportReporterDidBackfiller\n }\n\n get verificationListener(): VerificationListener | undefined {\n return this.opts.verificationListener\n }\n\n get statsComputer(): StatsComputer | undefined {\n return this.opts.statsComputer\n }\n\n async start() {\n this.eventPusher.start()\n this.eventReverser.start()\n this.teamProfileSynchronizer.start()\n this.scheduledActionProcessor.start()\n this.strikeExpiryProcessor.start()\n this.queueRouter.start()\n this.reportReporterDidBackfiller.start()\n this.verificationListener?.start()\n this.statsComputer?.start()\n }\n\n async processAll() {\n await this.eventPusher.processAll()\n // Drain pending modEventReport rows into the report table so test code\n // that calls processAll() after creating reports sees the report rows\n // immediately (in production this happens via the 1-min poll).\n await this.queueRouter.routeReports()\n await this.teamProfileSynchronizer.run()\n }\n\n async destroy() {\n try {\n await allFulfilled([\n this.eventReverser.destroy(),\n this.eventPusher.destroy(),\n this.teamProfileSynchronizer.destroy(),\n this.scheduledActionProcessor.destroy(),\n this.strikeExpiryProcessor.destroy(),\n this.queueRouter.destroy(),\n this.reportReporterDidBackfiller.destroy(),\n this.verificationListener?.stop(),\n this.statsComputer?.destroy(),\n ])\n } finally {\n await this.backgroundQueue.destroy()\n await this.db.close()\n }\n }\n}\n"]}
|
package/dist/daemon/locks.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../src/daemon/locks.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,UAAY,CAAA
|
|
1
|
+
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../src/daemon/locks.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,UAAY,CAAA"}
|
package/dist/daemon/locks.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Stable seeds for pg advisory locks used to coordinate daemon work across
|
|
2
2
|
// instances. Each daemon hashes its seed with the database and schema.
|
|
3
3
|
export const STATS_COMPUTER_LOCK_ID = 7_239_401;
|
|
4
|
-
export const MATERIALIZED_VIEW_REFRESH_LOCK_ID = 7_239_402;
|
|
5
4
|
//# sourceMappingURL=locks.js.map
|
package/dist/daemon/locks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.js","sourceRoot":"","sources":["../../src/daemon/locks.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAA
|
|
1
|
+
{"version":3,"file":"locks.js","sourceRoot":"","sources":["../../src/daemon/locks.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAA","sourcesContent":["// Stable seeds for pg advisory locks used to coordinate daemon work across\n// instances. Each daemon hashes its seed with the database and schema.\nexport const STATS_COMPUTER_LOCK_ID = 7_239_401\n"]}
|
package/dist/db/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const PgPool: typeof import("pg").Pool;
|
|
|
4
4
|
type PgPool = InstanceType<typeof PgPool>;
|
|
5
5
|
import type { DatabaseSchema } from './schema/index.js';
|
|
6
6
|
import type { PgOptions } from './types.js';
|
|
7
|
-
export {
|
|
7
|
+
export { STATS_COMPUTER_LOCK_ID } from '../daemon/locks.js';
|
|
8
8
|
export declare class Database {
|
|
9
9
|
opts: PgOptions;
|
|
10
10
|
pool: PgPool;
|
package/dist/db/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAY1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,QAAA,MAAc,MAAM,0BAAuB,CAAA;AAC3C,KAAK,MAAM,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAA;AAIzC,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,mBAAmB,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAY1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,QAAA,MAAc,MAAM,0BAAuB,CAAA;AAC3C,KAAK,MAAM,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAA;AAIzC,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,mBAAmB,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAE3D,qBAAa,QAAQ;IASV,IAAI,EAAE,SAAS;IARxB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,cAAc,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;IAClB,KAAK,0BAAgC;IACrC,SAAS,UAAQ;IACjB,SAAS,UAAQ;IAEjB,YACS,IAAI,EAAE,SAAS,EACtB,SAAS,CAAC,EAAE;QAAE,EAAE,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAkDjD;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED,IAAI,aAAa,YAEhB;IAED,iBAAiB,SAEhB;IAED,oBAAoB,SAEnB;IAEK,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAsBjE;IAED,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,QAGtB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAI3B;IAIK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1B;IAEK,gBAAgB,CAAC,SAAS,EAAE,MAAM,yDAYvC;IAEK,sBAAsB,0DAY3B;CACF;eAEc,QAAQ;AA6BvB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,EAAE,CAAA;CACX,CAAA"}
|
package/dist/db/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const { Pool: PgPool, types: pgTypes } = pg;
|
|
|
7
7
|
import { dbLogger } from '../logger.js';
|
|
8
8
|
import * as migrations from './migrations/index.js';
|
|
9
9
|
import { CtxMigrationProvider } from './migrations/provider.js';
|
|
10
|
-
export {
|
|
10
|
+
export { STATS_COMPUTER_LOCK_ID } from '../daemon/locks.js';
|
|
11
11
|
export class Database {
|
|
12
12
|
constructor(opts, instances) {
|
|
13
13
|
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CAAC;QACD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAA;QAChE,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,KAAK,CAAA;QACb,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAChE,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAED,eAAe,QAAQ,CAAA;AAEvB,MAAM,WAAW,GAAG,CAAC,GAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,CAAA;AAC5E,MAAM,aAAa,GAAG,CAAC,GAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAEhF,QAAQ;AACR,UAAU;AAEV,MAAM,aAAa;IAAnB;QACU,WAAM,GAAG,KAAK,CAAA;IAkBxB,CAAC;IAhBC,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;IACpB,CAAC;IAED,cAAc,CAAC,IAA8B;QAC3C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,IAA+B;QAE/B,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;CACF;AAMD,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE,GAAE,CAAC,CAAA","sourcesContent":["import assert from 'node:assert'\nimport { EventEmitter } from 'node:events'\nimport {\n Kysely,\n type KyselyPlugin,\n type PluginTransformQueryArgs,\n type PluginTransformResultArgs,\n PostgresDialect,\n type QueryResult,\n type RootOperationNode,\n type UnknownRow,\n sql,\n} from 'kysely'\nimport { Migrator } from 'kysely/migration'\nimport pg from 'pg'\nconst { Pool: PgPool, types: pgTypes } = pg\ntype PgPool = InstanceType<typeof PgPool>\nimport { dbLogger } from '../logger.js'\nimport * as migrations from './migrations/index.js'\nimport { CtxMigrationProvider } from './migrations/provider.js'\nimport type { DatabaseSchema, DatabaseSchemaType } from './schema/index.js'\nimport type { PgOptions } from './types.js'\n\nexport {\n MATERIALIZED_VIEW_REFRESH_LOCK_ID,\n STATS_COMPUTER_LOCK_ID,\n} from '../daemon/locks.js'\n\nexport class Database {\n pool: PgPool\n db: DatabaseSchema\n migrator: Migrator\n txEvt = new EventEmitter<TxnEvents>()\n destroyed = false\n isPrimary = false\n\n constructor(\n public opts: PgOptions,\n instances?: { db: DatabaseSchema; pool: PgPool },\n ) {\n // if instances are provided, use those\n if (instances) {\n this.db = instances.db\n this.pool = instances.pool\n } else {\n // else create a pool & connect\n const { schema, url } = opts\n const pool =\n opts.pool ??\n new PgPool({\n connectionString: url,\n max: opts.poolSize,\n maxUses: opts.poolMaxUses,\n idleTimeoutMillis: opts.poolIdleTimeoutMs,\n })\n\n // Select count(*) and other pg bigints as js integer\n pgTypes.setTypeParser(pgTypes.builtins.INT8, (n) => parseInt(n, 10))\n\n // Setup schema usage, primarily for test parallelism (each test suite runs in its own pg schema)\n if (schema && !/^[a-z_]+$/i.test(schema)) {\n throw new Error(\n `Postgres schema must only contain [A-Za-z_]: ${schema}`,\n )\n }\n\n pool.on('error', onPoolError)\n pool.on('connect', (client) => {\n client.on('error', onClientError)\n // Used for trigram indexes, e.g. on actor search\n client.query('SET pg_trgm.word_similarity_threshold TO .4;')\n if (schema) {\n // Shared objects such as extensions will go in the public schema\n client.query(`SET search_path TO \"${schema}\",public;`)\n }\n })\n\n this.pool = pool\n this.db = new Kysely<DatabaseSchemaType>({\n dialect: new PostgresDialect({ pool }),\n })\n }\n\n this.migrator = new Migrator({\n db: this.db,\n migrationTableSchema: opts.schema,\n provider: new CtxMigrationProvider(migrations, 'pg'),\n })\n }\n\n get schema(): string | undefined {\n return this.opts.schema\n }\n\n get isTransaction() {\n return this.db.isTransaction\n }\n\n assertTransaction() {\n assert(this.isTransaction, 'Transaction required')\n }\n\n assertNotTransaction() {\n assert(!this.isTransaction, 'Cannot be in a transaction')\n }\n\n async transaction<T>(fn: (db: Database) => Promise<T>): Promise<T> {\n const leakyTxPlugin = new LeakyTxPlugin()\n const { dbTxn, txRes } = await this.db\n .withPlugin(leakyTxPlugin)\n .transaction()\n .execute(async (txn) => {\n const dbTxn = new Database(this.opts, {\n db: txn,\n pool: this.pool,\n })\n const txRes = await fn(dbTxn)\n .catch(async (err) => {\n leakyTxPlugin.endTx()\n // ensure that all in-flight queries are flushed & the connection is open\n await dbTxn.db.getExecutor().provideConnection(noopAsync)\n throw err\n })\n .finally(() => leakyTxPlugin.endTx())\n return { dbTxn, txRes }\n })\n dbTxn?.txEvt.emit('commit')\n return txRes\n }\n\n onCommit(fn: () => void) {\n this.assertTransaction()\n this.txEvt.once('commit', fn)\n }\n\n async close(): Promise<void> {\n if (this.destroyed) return\n await this.db.destroy()\n this.destroyed = true\n }\n\n // Lightweight connectivity check for readiness probes. Throws if the database\n // is unreachable.\n async ping(): Promise<void> {\n await sql`select 1`.execute(this.db)\n }\n\n async migrateToOrThrow(migration: string) {\n if (this.schema) {\n await this.db.schema.createSchema(this.schema).ifNotExists().execute()\n }\n const { error, results } = await this.migrator.migrateTo(migration)\n if (error) {\n throw error\n }\n if (!results) {\n throw new Error('An unknown failure occurred while migrating')\n }\n return results\n }\n\n async migrateToLatestOrThrow() {\n if (this.schema) {\n await this.db.schema.createSchema(this.schema).ifNotExists().execute()\n }\n const { error, results } = await this.migrator.migrateToLatest()\n if (error) {\n throw error\n }\n if (!results) {\n throw new Error('An unknown failure occurred while migrating')\n }\n return results\n }\n}\n\nexport default Database\n\nconst onPoolError = (err: Error) => dbLogger.error({ err }, 'db pool error')\nconst onClientError = (err: Error) => dbLogger.error({ err }, 'db client error')\n\n// utils\n// -------\n\nclass LeakyTxPlugin implements KyselyPlugin {\n private txOver = false\n\n endTx() {\n this.txOver = true\n }\n\n transformQuery(args: PluginTransformQueryArgs): RootOperationNode {\n if (this.txOver) {\n throw new Error('tx already failed')\n }\n return args.node\n }\n\n async transformResult(\n args: PluginTransformResultArgs,\n ): Promise<QueryResult<UnknownRow>> {\n return args.result\n }\n}\n\ntype TxnEvents = {\n commit: []\n}\n\nconst noopAsync = async () => {}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EACL,MAAM,EAIN,eAAe,EAIf,GAAG,GACJ,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAI/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAE3D,MAAM,OAAO,QAAQ;IAQnB,YACS,IAAe,EACtB,SAAgD;QADzC,SAAI,GAAJ,IAAI,CAAW;QALxB,UAAK,GAAG,IAAI,YAAY,EAAa,CAAA;QACrC,cAAS,GAAG,KAAK,CAAA;QACjB,cAAS,GAAG,KAAK,CAAA;QAMf,uCAAuC;QACvC,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAAA;YACtB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,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AM,SAAS,GAAG,KAAK,IAAI,EAAE,GAAE,CAAC,CAAA","sourcesContent":["import assert from 'node:assert'\nimport { EventEmitter } from 'node:events'\nimport {\n Kysely,\n type KyselyPlugin,\n type PluginTransformQueryArgs,\n type PluginTransformResultArgs,\n PostgresDialect,\n type QueryResult,\n type RootOperationNode,\n type UnknownRow,\n sql,\n} from 'kysely'\nimport { Migrator } from 'kysely/migration'\nimport pg from 'pg'\nconst { Pool: PgPool, types: pgTypes } = pg\ntype PgPool = InstanceType<typeof PgPool>\nimport { dbLogger } from '../logger.js'\nimport * as migrations from './migrations/index.js'\nimport { CtxMigrationProvider } from './migrations/provider.js'\nimport type { DatabaseSchema, DatabaseSchemaType } from './schema/index.js'\nimport type { PgOptions } from './types.js'\n\nexport { STATS_COMPUTER_LOCK_ID } from '../daemon/locks.js'\n\nexport class Database {\n pool: PgPool\n db: DatabaseSchema\n migrator: Migrator\n txEvt = new EventEmitter<TxnEvents>()\n destroyed = false\n isPrimary = false\n\n constructor(\n public opts: PgOptions,\n instances?: { db: DatabaseSchema; pool: PgPool },\n ) {\n // if instances are provided, use those\n if (instances) {\n this.db = instances.db\n this.pool = instances.pool\n } else {\n // else create a pool & connect\n const { schema, url } = opts\n const pool =\n opts.pool ??\n new PgPool({\n connectionString: url,\n max: opts.poolSize,\n maxUses: opts.poolMaxUses,\n idleTimeoutMillis: opts.poolIdleTimeoutMs,\n })\n\n // Select count(*) and other pg bigints as js integer\n pgTypes.setTypeParser(pgTypes.builtins.INT8, (n) => parseInt(n, 10))\n\n // Setup schema usage, primarily for test parallelism (each test suite runs in its own pg schema)\n if (schema && !/^[a-z_]+$/i.test(schema)) {\n throw new Error(\n `Postgres schema must only contain [A-Za-z_]: ${schema}`,\n )\n }\n\n pool.on('error', onPoolError)\n pool.on('connect', (client) => {\n client.on('error', onClientError)\n // Used for trigram indexes, e.g. on actor search\n client.query('SET pg_trgm.word_similarity_threshold TO .4;')\n if (schema) {\n // Shared objects such as extensions will go in the public schema\n client.query(`SET search_path TO \"${schema}\",public;`)\n }\n })\n\n this.pool = pool\n this.db = new Kysely<DatabaseSchemaType>({\n dialect: new PostgresDialect({ pool }),\n })\n }\n\n this.migrator = new Migrator({\n db: this.db,\n migrationTableSchema: opts.schema,\n provider: new CtxMigrationProvider(migrations, 'pg'),\n })\n }\n\n get schema(): string | undefined {\n return this.opts.schema\n }\n\n get isTransaction() {\n return this.db.isTransaction\n }\n\n assertTransaction() {\n assert(this.isTransaction, 'Transaction required')\n }\n\n assertNotTransaction() {\n assert(!this.isTransaction, 'Cannot be in a transaction')\n }\n\n async transaction<T>(fn: (db: Database) => Promise<T>): Promise<T> {\n const leakyTxPlugin = new LeakyTxPlugin()\n const { dbTxn, txRes } = await this.db\n .withPlugin(leakyTxPlugin)\n .transaction()\n .execute(async (txn) => {\n const dbTxn = new Database(this.opts, {\n db: txn,\n pool: this.pool,\n })\n const txRes = await fn(dbTxn)\n .catch(async (err) => {\n leakyTxPlugin.endTx()\n // ensure that all in-flight queries are flushed & the connection is open\n await dbTxn.db.getExecutor().provideConnection(noopAsync)\n throw err\n })\n .finally(() => leakyTxPlugin.endTx())\n return { dbTxn, txRes }\n })\n dbTxn?.txEvt.emit('commit')\n return txRes\n }\n\n onCommit(fn: () => void) {\n this.assertTransaction()\n this.txEvt.once('commit', fn)\n }\n\n async close(): Promise<void> {\n if (this.destroyed) return\n await this.db.destroy()\n this.destroyed = true\n }\n\n // Lightweight connectivity check for readiness probes. Throws if the database\n // is unreachable.\n async ping(): Promise<void> {\n await sql`select 1`.execute(this.db)\n }\n\n async migrateToOrThrow(migration: string) {\n if (this.schema) {\n await this.db.schema.createSchema(this.schema).ifNotExists().execute()\n }\n const { error, results } = await this.migrator.migrateTo(migration)\n if (error) {\n throw error\n }\n if (!results) {\n throw new Error('An unknown failure occurred while migrating')\n }\n return results\n }\n\n async migrateToLatestOrThrow() {\n if (this.schema) {\n await this.db.schema.createSchema(this.schema).ifNotExists().execute()\n }\n const { error, results } = await this.migrator.migrateToLatest()\n if (error) {\n throw error\n }\n if (!results) {\n throw new Error('An unknown failure occurred while migrating')\n }\n return results\n }\n}\n\nexport default Database\n\nconst onPoolError = (err: Error) => dbLogger.error({ err }, 'db pool error')\nconst onClientError = (err: Error) => dbLogger.error({ err }, 'db client error')\n\n// utils\n// -------\n\nclass LeakyTxPlugin implements KyselyPlugin {\n private txOver = false\n\n endTx() {\n this.txOver = true\n }\n\n transformQuery(args: PluginTransformQueryArgs): RootOperationNode {\n if (this.txOver) {\n throw new Error('tx already failed')\n }\n return args.node\n }\n\n async transformResult(\n args: PluginTransformResultArgs,\n ): Promise<QueryResult<UnknownRow>> {\n return args.result\n }\n}\n\ntype TxnEvents = {\n commit: []\n}\n\nconst noopAsync = async () => {}\n"]}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { Kysely } from 'kysely';
|
|
2
|
-
import type * as accountEventsStats from './account_events_stats.js';
|
|
3
|
-
import type * as accountRecordEventsStats from './account_record_events_stats.js';
|
|
4
|
-
import type * as accountRecordStatusStats from './account_record_status_stats.js';
|
|
5
2
|
import type * as accountStrike from './account_strike.js';
|
|
6
3
|
import type * as blobPushEvent from './blob_push_event.js';
|
|
7
4
|
import type * as communicationTemplate from './communication_template.js';
|
|
@@ -17,7 +14,6 @@ import type * as modEvent from './moderation_event.js';
|
|
|
17
14
|
import type * as modSubjectStatus from './moderation_subject_status.js';
|
|
18
15
|
import type * as moderatorAssignment from './moderator_assignment.js';
|
|
19
16
|
import type * as set from './ozone_set.js';
|
|
20
|
-
import type * as recordEventsStats from './record_events_stats.js';
|
|
21
17
|
import type * as recordPushEvent from './record_push_event.js';
|
|
22
18
|
import type * as repoPushEvent from './repo_push_event.js';
|
|
23
19
|
import type * as report from './report.js';
|
|
@@ -29,6 +25,6 @@ import type * as scheduledAction from './scheduled-action.js';
|
|
|
29
25
|
import type * as setting from './setting.js';
|
|
30
26
|
import type * as signingKey from './signing_key.js';
|
|
31
27
|
import type * as verification from './verification.js';
|
|
32
|
-
export type DatabaseSchemaType = modEvent.PartialDB & modSubjectStatus.PartialDB & report.PartialDB & reportActivity.PartialDB & reportQueue.PartialDB & label.PartialDB & signingKey.PartialDB & repoPushEvent.PartialDB & recordPushEvent.PartialDB & blobPushEvent.PartialDB & communicationTemplate.PartialDB & set.PartialDB & member.PartialDB & setting.PartialDB &
|
|
28
|
+
export type DatabaseSchemaType = modEvent.PartialDB & modSubjectStatus.PartialDB & report.PartialDB & reportActivity.PartialDB & reportQueue.PartialDB & label.PartialDB & signingKey.PartialDB & repoPushEvent.PartialDB & recordPushEvent.PartialDB & blobPushEvent.PartialDB & communicationTemplate.PartialDB & set.PartialDB & member.PartialDB & setting.PartialDB & accountStrike.PartialDB & verification.PartialDB & firehoseCursor.PartialDB & jobCursor.PartialDB & safelink.PartialDB & scheduledAction.PartialDB & moderatorAssignment.PartialDB & reportStat.PartialDB & expiringTag.PartialDB & inboxSeen.PartialDB & inboxNotification.PartialDB & inboxNotificationPreference.PartialDB;
|
|
33
29
|
export type DatabaseSchema = Kysely<DatabaseSchemaType>;
|
|
34
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,KAAK,KAAK,aAAa,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,KAAK,aAAa,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,KAAK,qBAAqB,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAK,KAAK,WAAW,MAAM,mBAAmB,CAAA;AACrD,OAA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AAC,SAAS,GACxB,WAAW,CAAC,SAAS,GACrB,KAAK,CAAC,SAAS,GACf,UAAU,CAAC,SAAS,GACpB,aAAa,CAAC,SAAS,GACvB,eAAe,CAAC,SAAS,GACzB,aAAa,CAAC,SAAS,GACvB,qBAAqB,CAAC,SAAS,GAC/B,GAAG,CAAC,SAAS,GACb,MAAM,CAAC,SAAS,GAChB,OAAO,CAAC,SAAS,GACjB,aAAa,CAAC,SAAS,GACvB,YAAY,CAAC,SAAS,GACtB,cAAc,CAAC,SAAS,GACxB,SAAS,CAAC,SAAS,GACnB,QAAQ,CAAC,SAAS,GAClB,eAAe,CAAC,SAAS,GACzB,mBAAmB,CAAC,SAAS,GAC7B,UAAU,CAAC,SAAS,GACpB,WAAW,CAAC,SAAS,GACrB,SAAS,CAAC,SAAS,GACnB,iBAAiB,CAAC,SAAS,GAC3B,2BAA2B,CAAC,SAAS,CAAA;AAEvC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"","sourcesContent":["import type { Kysely } from 'kysely'\nimport type * as
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/schema/index.ts"],"names":[],"mappings":"","sourcesContent":["import type { Kysely } from 'kysely'\nimport type * as accountStrike from './account_strike.js'\nimport type * as blobPushEvent from './blob_push_event.js'\nimport type * as communicationTemplate from './communication_template.js'\nimport type * as expiringTag from './expiring_tag.js'\nimport type * as firehoseCursor from './firehose_cursor.js'\nimport type * as inboxNotification from './inbox_notification.js'\nimport type * as inboxNotificationPreference from './inbox_notification_preference.js'\nimport type * as inboxSeen from './inbox_seen.js'\nimport type * as jobCursor from './job_cursor.js'\nimport type * as label from './label.js'\nimport type * as member from './member.js'\nimport type * as modEvent from './moderation_event.js'\nimport type * as modSubjectStatus from './moderation_subject_status.js'\nimport type * as moderatorAssignment from './moderator_assignment.js'\nimport type * as set from './ozone_set.js'\nimport type * as recordPushEvent from './record_push_event.js'\nimport type * as repoPushEvent from './repo_push_event.js'\nimport type * as report from './report.js'\nimport type * as reportActivity from './report_activity.js'\nimport type * as reportQueue from './report_queue.js'\nimport type * as reportStat from './report_stat.js'\nimport type * as safelink from './safelink.js'\nimport type * as scheduledAction from './scheduled-action.js'\nimport type * as setting from './setting.js'\nimport type * as signingKey from './signing_key.js'\nimport type * as verification from './verification.js'\n\nexport type DatabaseSchemaType = modEvent.PartialDB &\n modSubjectStatus.PartialDB &\n report.PartialDB &\n reportActivity.PartialDB &\n reportQueue.PartialDB &\n label.PartialDB &\n signingKey.PartialDB &\n repoPushEvent.PartialDB &\n recordPushEvent.PartialDB &\n blobPushEvent.PartialDB &\n communicationTemplate.PartialDB &\n set.PartialDB &\n member.PartialDB &\n setting.PartialDB &\n accountStrike.PartialDB &\n verification.PartialDB &\n firehoseCursor.PartialDB &\n jobCursor.PartialDB &\n safelink.PartialDB &\n scheduledAction.PartialDB &\n moderatorAssignment.PartialDB &\n reportStat.PartialDB &\n expiringTag.PartialDB &\n inboxSeen.PartialDB &\n inboxNotification.PartialDB &\n inboxNotificationPreference.PartialDB\n\nexport type DatabaseSchema = Kysely<DatabaseSchemaType>\n"]}
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ export class OzoneService {
|
|
|
40
40
|
app.use(cors({ maxAge: DAY / SECOND }));
|
|
41
41
|
app.use(loggerMiddleware);
|
|
42
42
|
app.use(compression());
|
|
43
|
-
const ctx = await AppContext.fromConfig(cfg, secrets, overrides);
|
|
43
|
+
const ctx = await AppContext.fromConfig(cfg, secrets, overrides, register);
|
|
44
44
|
let server = createServer([], {
|
|
45
45
|
validateResponse: false,
|
|
46
46
|
payload: {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAA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GAAG,KAAK,CAAA;QAC/B,IAAI,CAAC,UAAU,GAAG,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;QAClD,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;QACtC,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,CAAA;IACpC,CAAC;CACF;AAED,eAAe,YAAY,CAAA","sourcesContent":["import events from 'node:events'\nimport type http from 'node:http'\nimport type { AddressInfo } from 'node:net'\nimport compression from 'compression'\nimport cors from 'cors'\nimport express from 'express'\nimport { type HttpTerminator, createHttpTerminator } from 'http-terminator'\nimport * as prometheus from 'prom-client'\nimport { DAY, SECOND } from '@atproto/common'\nimport {\n type DidString,\n Procedure,\n Query,\n Subscription,\n walk,\n} from '@atproto/lex-schema'\nimport { createServer, extractUrlNsid } from '@atproto/xrpc-server'\nimport API, { health, wellKnown } from './api/index.js'\nimport type { OzoneConfig, OzoneSecrets } from './config/index.js'\nimport { AppContext, type AppContextOptions } from './context.js'\nimport type { Member } from './db/schema/member.js'\nimport * as error from './error.js'\nimport * as lexicons from './lexicons/index.js'\nimport { tools } from './lexicons/index.js'\nimport { dbLogger, loggerMiddleware } from './logger.js'\n\nexport * from './config/index.js'\nexport { AppContext } from './context.js'\nexport { EventPusher, EventReverser, OzoneDaemon } from './daemon/index.js'\nexport { Database } from './db/index.js'\nexport { type ImageInvalidator } from './image-invalidator.js'\nexport { VideoInvalidator } from './video-invalidator.js'\nexport { httpLogger } from './logger.js'\n\nconst KNOWN_METHODS = new Set<string>(\n walk(lexicons)\n .filter(\n (s) =>\n s instanceof Procedure ||\n s instanceof Query ||\n s instanceof Subscription,\n )\n .map((s) => s.nsid),\n)\n\nexport class OzoneService {\n public ctx: AppContext\n public app: express.Application\n public server?: http.Server\n private terminator?: HttpTerminator\n private dbStatsInterval?: NodeJS.Timeout\n\n constructor(opts: { ctx: AppContext; app: express.Application }) {\n this.ctx = opts.ctx\n this.app = opts.app\n }\n\n static async create(\n cfg: OzoneConfig,\n secrets: OzoneSecrets,\n overrides?: Partial<AppContextOptions>,\n // Optional Prometheus registry. Its presence is the collection gate: when\n // omitted (dev-env, tests, self-hosted distros that don't opt in), no\n // metrics are collected and no per-request timing overhead is incurred.\n register?: prometheus.Registry,\n ): Promise<OzoneService> {\n const app = express()\n app.set('trust proxy', true)\n app.use(cors({ maxAge: DAY / SECOND }))\n app.use(loggerMiddleware)\n app.use(compression())\n\n const ctx = await AppContext.fromConfig(cfg, secrets, overrides)\n\n let server = createServer([], {\n validateResponse: false,\n payload: {\n jsonLimit: 100 * 1024, // 100kb\n textLimit: 100 * 1024, // 100kb\n blobLimit: 5 * 1024 * 1024, // 5mb\n },\n })\n\n server = API(server, ctx)\n\n if (register) {\n // Collect standard metrics on the nodejs runtime (GC, event loop, etc).\n prometheus.collectDefaultMetrics({ prefix: 'ozone_', register })\n\n // Per-XRPC-method request timing. Labeled by nsid (e.g.\n // tools.ozone.moderation.emitEvent) so every method is covered without\n // per-endpoint code. This middleware runs above the xrpc router, so\n // req.route is not yet populated; we derive the nsid from the URL instead.\n const xrpcRequestDuration = new prometheus.Histogram({\n name: 'ozone_xrpc_request_duration_seconds',\n help: 'XRPC request duration in seconds, by method',\n labelNames: ['nsid', 'method', 'code'],\n registers: [register],\n })\n\n app.use((req, res, next) => {\n const nsid = extractUrlNsid(req.originalUrl)\n // Only record xrpc methods; non-xrpc paths (health, robots, frontend)\n // are skipped to keep the metric's label cardinality bounded.\n if (!nsid) return next()\n // extractUrlNsid only validates path *shape*, not that the method\n // exists. A caller can hit /xrpc/<well-formed-but-bogus-nsid> (served a\n // 501), so labeling by the raw nsid lets external traffic mint unbounded\n // series and grow prom-client's memory without limit. Bucket anything\n // that isn't a registered query/procedure under a single `unknown` label.\n const end = xrpcRequestDuration.startTimer()\n res.on('finish', () => {\n end({\n nsid: KNOWN_METHODS.has(nsid) ? nsid : 'unknown',\n method: req.method,\n code: res.statusCode,\n })\n })\n next()\n })\n }\n\n app.use(health.createRouter(ctx))\n app.use(wellKnown.createRouter(ctx))\n app.use(server.router)\n app.use(error.handler)\n\n return new OzoneService({ ctx, app })\n }\n\n async seedInitialMembers() {\n const members: Array<{ role: Member['role']; did: DidString }> = []\n this.ctx.cfg.access.admins.forEach((did) =>\n members.push({\n role: tools.ozone.team.defs.RoleAdmin,\n did,\n }),\n )\n this.ctx.cfg.access.triage.forEach((did) =>\n members.push({\n role: tools.ozone.team.defs.RoleTriage,\n did,\n }),\n )\n this.ctx.cfg.access.moderators.forEach((did) =>\n members.push({\n role: tools.ozone.team.defs.RoleModerator,\n did,\n }),\n )\n\n for (const member of members) {\n const service = this.ctx.teamService(this.ctx.db)\n await service.upsert({\n ...member,\n lastUpdatedBy: this.ctx.cfg.service.did,\n })\n }\n }\n\n async start(): Promise<http.Server> {\n if (this.dbStatsInterval) {\n throw new Error(`${this.constructor.name} already started`)\n }\n\n // Any moderator that are configured via env var may not exist in the database\n // so we need to sync them from env var to the database\n await this.seedInitialMembers()\n\n this.dbStatsInterval = setInterval(() => {\n dbLogger.info(\n {\n idleCount: this.ctx.db.pool.idleCount,\n totalCount: this.ctx.db.pool.totalCount,\n waitingCount: this.ctx.db.pool.waitingCount,\n },\n 'db pool stats',\n )\n dbLogger.info(\n this.ctx.backgroundQueue.getStats(),\n 'background queue stats',\n )\n }, 10000)\n await this.ctx.sequencer.start()\n const server = this.app.listen(this.ctx.cfg.service.port)\n this.server = server\n server.keepAliveTimeout = 90000\n this.terminator = createHttpTerminator({ server })\n await events.once(server, 'listening')\n const { port } = server.address() as AddressInfo\n this.ctx.assignPort(port)\n return server\n }\n\n async destroy(): Promise<void> {\n clearInterval(this.dbStatsInterval)\n this.dbStatsInterval = undefined\n\n // @TODO Use a disposable stack when Node24 becomes the min supported version\n try {\n await this.terminator?.terminate()\n } finally {\n try {\n await this.ctx.backgroundQueue.destroy()\n } finally {\n try {\n await this.ctx.sequencer.destroy()\n } finally {\n await this.ctx.db.close()\n }\n }\n }\n }\n}\n\nexport type MetricsServiceOpts = {\n // Optional readiness probe. Should reject/throw when the service cannot serve\n // traffic (e.g. database unreachable). When omitted, /readyz behaves like\n // /livez (process-alive only).\n readinessCheck?: () => Promise<void>\n}\n\n// A separate, pull-based Prometheus metrics server. Kept on its own port and\n// HTTP server so private metrics and ops probes are never exposed on the public\n// ozone server. Only started by an entrypoint when metrics are explicitly\n// opted in. Also serves Kubernetes-style liveness (/livez) and readiness\n// (/readyz) probes.\nexport class MetricsService {\n private terminator?: HttpTerminator\n\n constructor(public app: express.Application) {}\n\n static create(\n register: prometheus.Registry,\n opts: MetricsServiceOpts = {},\n ): MetricsService {\n const app = express()\n\n app.get('/metrics', async (_req, res) => {\n // Express 4 does not catch rejections from async handlers, so an\n // unguarded throw here (e.g. a custom collector failing) would surface as\n // an unhandledRejection and crash the process. Metrics are a passive\n // side-channel and must never take down the service.\n try {\n const metrics = await register.metrics()\n res.set('Content-Type', register.contentType)\n res.end(metrics)\n } catch {\n res.status(500).end()\n }\n })\n\n // Liveness: is the process up and the event loop responsive? No external\n // dependencies, so a transient dependency outage never causes a pod restart.\n app.get('/livez', (_req, res) => {\n res.send({ status: 'ok' })\n })\n\n // Readiness: can the service handle traffic right now? Runs the optional\n // readiness check (e.g. a db ping); a failure pulls the pod from the load\n // balancer without restarting it.\n app.get('/readyz', async (_req, res) => {\n if (!opts.readinessCheck) {\n return res.send({ status: 'ok' })\n }\n try {\n await opts.readinessCheck()\n res.send({ status: 'ok' })\n } catch {\n res.status(503).send({ status: 'not ready' })\n }\n })\n\n return new MetricsService(app)\n }\n\n async start(port: number): Promise<http.Server> {\n const server = this.app.listen(port)\n server.keepAliveTimeout = 90000\n this.terminator = createHttpTerminator({ server })\n await events.once(server, 'listening')\n return server\n }\n\n async destroy(): Promise<void> {\n await this.terminator?.terminate()\n }\n}\n\nexport default OzoneService\n"]}
|
|
1
|
+
{"version":3,"file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,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACpC,MAAM,CAAC,gBAAgB,GAAG,KAAK,CAAA;QAC/B,IAAI,CAAC,UAAU,GAAG,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;QAClD,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;QACtC,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,CAAA;IACpC,CAAC;CACF;AAED,eAAe,YAAY,CAAA","sourcesContent":["import events from 'node:events'\nimport type http from 'node:http'\nimport type { AddressInfo } from 'node:net'\nimport compression from 'compression'\nimport cors from 'cors'\nimport express from 'express'\nimport { type HttpTerminator, createHttpTerminator } from 'http-terminator'\nimport * as prometheus from 'prom-client'\nimport { DAY, SECOND } from '@atproto/common'\nimport {\n type DidString,\n Procedure,\n Query,\n Subscription,\n walk,\n} from '@atproto/lex-schema'\nimport { createServer, extractUrlNsid } from '@atproto/xrpc-server'\nimport API, { health, wellKnown } from './api/index.js'\nimport type { OzoneConfig, OzoneSecrets } from './config/index.js'\nimport { AppContext, type AppContextOptions } from './context.js'\nimport type { Member } from './db/schema/member.js'\nimport * as error from './error.js'\nimport * as lexicons from './lexicons/index.js'\nimport { tools } from './lexicons/index.js'\nimport { dbLogger, loggerMiddleware } from './logger.js'\n\nexport * from './config/index.js'\nexport { AppContext } from './context.js'\nexport { EventPusher, EventReverser, OzoneDaemon } from './daemon/index.js'\nexport { Database } from './db/index.js'\nexport { type ImageInvalidator } from './image-invalidator.js'\nexport { VideoInvalidator } from './video-invalidator.js'\nexport { httpLogger } from './logger.js'\n\nconst KNOWN_METHODS = new Set<string>(\n walk(lexicons)\n .filter(\n (s) =>\n s instanceof Procedure ||\n s instanceof Query ||\n s instanceof Subscription,\n )\n .map((s) => s.nsid),\n)\n\nexport class OzoneService {\n public ctx: AppContext\n public app: express.Application\n public server?: http.Server\n private terminator?: HttpTerminator\n private dbStatsInterval?: NodeJS.Timeout\n\n constructor(opts: { ctx: AppContext; app: express.Application }) {\n this.ctx = opts.ctx\n this.app = opts.app\n }\n\n static async create(\n cfg: OzoneConfig,\n secrets: OzoneSecrets,\n overrides?: Partial<AppContextOptions>,\n // Optional Prometheus registry. Its presence is the collection gate: when\n // omitted (dev-env, tests, self-hosted distros that don't opt in), no\n // metrics are collected and no per-request timing overhead is incurred.\n register?: prometheus.Registry,\n ): Promise<OzoneService> {\n const app = express()\n app.set('trust proxy', true)\n app.use(cors({ maxAge: DAY / SECOND }))\n app.use(loggerMiddleware)\n app.use(compression())\n\n const ctx = await AppContext.fromConfig(cfg, secrets, overrides, register)\n\n let server = createServer([], {\n validateResponse: false,\n payload: {\n jsonLimit: 100 * 1024, // 100kb\n textLimit: 100 * 1024, // 100kb\n blobLimit: 5 * 1024 * 1024, // 5mb\n },\n })\n\n server = API(server, ctx)\n\n if (register) {\n // Collect standard metrics on the nodejs runtime (GC, event loop, etc).\n prometheus.collectDefaultMetrics({ prefix: 'ozone_', register })\n\n // Per-XRPC-method request timing. Labeled by nsid (e.g.\n // tools.ozone.moderation.emitEvent) so every method is covered without\n // per-endpoint code. This middleware runs above the xrpc router, so\n // req.route is not yet populated; we derive the nsid from the URL instead.\n const xrpcRequestDuration = new prometheus.Histogram({\n name: 'ozone_xrpc_request_duration_seconds',\n help: 'XRPC request duration in seconds, by method',\n labelNames: ['nsid', 'method', 'code'],\n registers: [register],\n })\n\n app.use((req, res, next) => {\n const nsid = extractUrlNsid(req.originalUrl)\n // Only record xrpc methods; non-xrpc paths (health, robots, frontend)\n // are skipped to keep the metric's label cardinality bounded.\n if (!nsid) return next()\n // extractUrlNsid only validates path *shape*, not that the method\n // exists. A caller can hit /xrpc/<well-formed-but-bogus-nsid> (served a\n // 501), so labeling by the raw nsid lets external traffic mint unbounded\n // series and grow prom-client's memory without limit. Bucket anything\n // that isn't a registered query/procedure under a single `unknown` label.\n const end = xrpcRequestDuration.startTimer()\n res.on('finish', () => {\n end({\n nsid: KNOWN_METHODS.has(nsid) ? nsid : 'unknown',\n method: req.method,\n code: res.statusCode,\n })\n })\n next()\n })\n }\n\n app.use(health.createRouter(ctx))\n app.use(wellKnown.createRouter(ctx))\n app.use(server.router)\n app.use(error.handler)\n\n return new OzoneService({ ctx, app })\n }\n\n async seedInitialMembers() {\n const members: Array<{ role: Member['role']; did: DidString }> = []\n this.ctx.cfg.access.admins.forEach((did) =>\n members.push({\n role: tools.ozone.team.defs.RoleAdmin,\n did,\n }),\n )\n this.ctx.cfg.access.triage.forEach((did) =>\n members.push({\n role: tools.ozone.team.defs.RoleTriage,\n did,\n }),\n )\n this.ctx.cfg.access.moderators.forEach((did) =>\n members.push({\n role: tools.ozone.team.defs.RoleModerator,\n did,\n }),\n )\n\n for (const member of members) {\n const service = this.ctx.teamService(this.ctx.db)\n await service.upsert({\n ...member,\n lastUpdatedBy: this.ctx.cfg.service.did,\n })\n }\n }\n\n async start(): Promise<http.Server> {\n if (this.dbStatsInterval) {\n throw new Error(`${this.constructor.name} already started`)\n }\n\n // Any moderator that are configured via env var may not exist in the database\n // so we need to sync them from env var to the database\n await this.seedInitialMembers()\n\n this.dbStatsInterval = setInterval(() => {\n dbLogger.info(\n {\n idleCount: this.ctx.db.pool.idleCount,\n totalCount: this.ctx.db.pool.totalCount,\n waitingCount: this.ctx.db.pool.waitingCount,\n },\n 'db pool stats',\n )\n dbLogger.info(\n this.ctx.backgroundQueue.getStats(),\n 'background queue stats',\n )\n }, 10000)\n await this.ctx.sequencer.start()\n const server = this.app.listen(this.ctx.cfg.service.port)\n this.server = server\n server.keepAliveTimeout = 90000\n this.terminator = createHttpTerminator({ server })\n await events.once(server, 'listening')\n const { port } = server.address() as AddressInfo\n this.ctx.assignPort(port)\n return server\n }\n\n async destroy(): Promise<void> {\n clearInterval(this.dbStatsInterval)\n this.dbStatsInterval = undefined\n\n // @TODO Use a disposable stack when Node24 becomes the min supported version\n try {\n await this.terminator?.terminate()\n } finally {\n try {\n await this.ctx.backgroundQueue.destroy()\n } finally {\n try {\n await this.ctx.sequencer.destroy()\n } finally {\n await this.ctx.db.close()\n }\n }\n }\n }\n}\n\nexport type MetricsServiceOpts = {\n // Optional readiness probe. Should reject/throw when the service cannot serve\n // traffic (e.g. database unreachable). When omitted, /readyz behaves like\n // /livez (process-alive only).\n readinessCheck?: () => Promise<void>\n}\n\n// A separate, pull-based Prometheus metrics server. Kept on its own port and\n// HTTP server so private metrics and ops probes are never exposed on the public\n// ozone server. Only started by an entrypoint when metrics are explicitly\n// opted in. Also serves Kubernetes-style liveness (/livez) and readiness\n// (/readyz) probes.\nexport class MetricsService {\n private terminator?: HttpTerminator\n\n constructor(public app: express.Application) {}\n\n static create(\n register: prometheus.Registry,\n opts: MetricsServiceOpts = {},\n ): MetricsService {\n const app = express()\n\n app.get('/metrics', async (_req, res) => {\n // Express 4 does not catch rejections from async handlers, so an\n // unguarded throw here (e.g. a custom collector failing) would surface as\n // an unhandledRejection and crash the process. Metrics are a passive\n // side-channel and must never take down the service.\n try {\n const metrics = await register.metrics()\n res.set('Content-Type', register.contentType)\n res.end(metrics)\n } catch {\n res.status(500).end()\n }\n })\n\n // Liveness: is the process up and the event loop responsive? No external\n // dependencies, so a transient dependency outage never causes a pod restart.\n app.get('/livez', (_req, res) => {\n res.send({ status: 'ok' })\n })\n\n // Readiness: can the service handle traffic right now? Runs the optional\n // readiness check (e.g. a db ping); a failure pulls the pod from the load\n // balancer without restarting it.\n app.get('/readyz', async (_req, res) => {\n if (!opts.readinessCheck) {\n return res.send({ status: 'ok' })\n }\n try {\n await opts.readinessCheck()\n res.send({ status: 'ok' })\n } catch {\n res.status(503).send({ status: 'not ready' })\n }\n })\n\n return new MetricsService(app)\n }\n\n async start(port: number): Promise<http.Server> {\n const server = this.app.listen(port)\n server.keepAliveTimeout = 90000\n this.terminator = createHttpTerminator({ server })\n await events.once(server, 'listening')\n return server\n }\n\n async destroy(): Promise<void> {\n await this.terminator?.terminate()\n }\n}\n\nexport default OzoneService\n"]}
|
|
@@ -21,7 +21,7 @@ export declare const $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
|
21
21
|
}>>;
|
|
22
22
|
export type $Output<B = l.BinaryData> = l.InferPayload<typeof $output, B>;
|
|
23
23
|
export type $OutputBody<B = l.BinaryData> = l.InferPayloadBody<typeof $output, B>;
|
|
24
|
-
/** Get Atmosphere Explore content. Articles are recommended when algorithmic recommendations are enabled for the request, and curated otherwise; other sections are curated. Curated content is selected using the x-atproto-bsky-geo-country, x-atproto-bsky-geo-region, and x-atproto-bsky-topics request headers. Authentication is optional; authenticated requests include viewer-specific profile state. */
|
|
24
|
+
/** Get Atmosphere Explore content. Articles and photo galleries are recommended when their algorithmic recommendations are enabled for the request, and curated otherwise; other sections are curated. Curated content is selected using the x-atproto-bsky-geo-country, x-atproto-bsky-geo-region, and x-atproto-bsky-topics request headers. Authentication is optional; authenticated requests include viewer-specific profile state. */
|
|
25
25
|
declare const main: l.Query<"app.bsky.unspecced.getAtmosphereExploreTab", l.ParamsSchema<{
|
|
26
26
|
readonly langs: l.OptionalSchema<l.ArraySchema<l.StringSchema<{
|
|
27
27
|
readonly format: "language";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAtmosphereExploreTab.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAC;AACxC,OAAO,KAAK,aAAa,MAAM,6CAA6C,CAAC;AAC7E,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AAEnD,QAAA,MAAM,KAAK,+CAA+C,CAAC;AAE3D,KAAK,KAAK,GAAG,OAAO,KAAK,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,eAAO,MAAM,OAA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,EAAE,CAAC;AAExB,QAAA,MAAM,OAAO,0GAAm9B,CAAC;AAEj+B,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -9,7 +9,7 @@ const $nsid = "app.bsky.unspecced.getAtmosphereExploreTab";
|
|
|
9
9
|
export { $nsid };
|
|
10
10
|
export const $params = /*#__PURE__*/ l.params({ "langs": /*#__PURE__*/ l.optional(/*#__PURE__*/ l.array(/*#__PURE__*/ l.string({ "format": "language" }))) });
|
|
11
11
|
export const $output = /*#__PURE__*/ l.jsonPayload({ "announcementBanner": /*#__PURE__*/ l.optional(/*#__PURE__*/ l.ref((() => announcementBanner))), "articles": /*#__PURE__*/ l.ref((() => articleList)), "publications": /*#__PURE__*/ l.ref((() => publicationList)), "photos": /*#__PURE__*/ l.ref((() => galleryList)), "livestreams": /*#__PURE__*/ l.ref((() => livestreamList)), "apps": /*#__PURE__*/ l.array(/*#__PURE__*/ l.ref((() => appCard)), { "maxLength": 100 }) });
|
|
12
|
-
/** Get Atmosphere Explore content. Articles are recommended when algorithmic recommendations are enabled for the request, and curated otherwise; other sections are curated. Curated content is selected using the x-atproto-bsky-geo-country, x-atproto-bsky-geo-region, and x-atproto-bsky-topics request headers. Authentication is optional; authenticated requests include viewer-specific profile state. */
|
|
12
|
+
/** Get Atmosphere Explore content. Articles and photo galleries are recommended when their algorithmic recommendations are enabled for the request, and curated otherwise; other sections are curated. Curated content is selected using the x-atproto-bsky-geo-country, x-atproto-bsky-geo-region, and x-atproto-bsky-topics request headers. Authentication is optional; authenticated requests include viewer-specific profile state. */
|
|
13
13
|
const main = /*#__PURE__*/ l.query($nsid, $params, $output);
|
|
14
14
|
export { main };
|
|
15
15
|
const $lxm = $nsid;
|