A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
test: remove the Operator Pass tests and helpers only they used
Hampus7c6cc36fc871
diff --git a/fluxer_api/package.json b/fluxer_api/package.jsonindex b8e671c75..a49d7759b 100644--- a/fluxer_api/package.json+++ b/fluxer_api/package.json@@ -73,7 +73,6 @@"mime": "catalog:","pdf-lib": "catalog:","pg": "catalog:",- "pino": "catalog:","sharp": "catalog:","stripe": "catalog:","tempy": "catalog:",diff --git a/fluxer_api/pkgs/email/src/EmailService.test.ts b/fluxer_api/pkgs/email/src/EmailService.test.tsindex 5ade02926..8533a6647 100644--- a/fluxer_api/pkgs/email/src/EmailService.test.ts+++ b/fluxer_api/pkgs/email/src/EmailService.test.ts@@ -32,45 +32,7 @@ function createCapturingServiceFor(config: EmailConfig): {service: EmailService;return {service: new EmailService(config, provider), sent};}-const SALE_PARAMS = {- checkoutUrl: 'https://web.fluxer.app/channels/@operator-pass',- priceFormatted: '$199',- priceRisesAt: new Date('2027-01-02T12:00:00Z'),- unsubscribeUrl: 'https://api.fluxer.app/operator-pass/waitlist/unsubscribe?token=a.b',- unsubscribePageUrl: 'https://fluxer.app/pass/unsubscribe?token=a.b',-};--describe('EmailService Operator Pass emails', () => {- it('escapes variables in the HTML part and keeps them raw in plaintext', async () => {- const {service, sent} = createCapturingService();- await service.send(- 'operator_pass_sale_open',- '[email protected]',- {...SALE_PARAMS, priceFormatted: `<b>"it's & $1"</b>`},- 'en-US',- );- expect(sent[0].text).toContain(`<b>"it's & $1"</b>`);- const html = sent[0].html ?? '';- expect(html).toContain('<b>"it's & $1"</b>');- expect(html).not.toContain('<b>"');- });-- it('falls back to plaintext only when a link is not https', async () => {- const {service, sent} = createCapturingService();- await expect(- service.send(- 'operator_pass_sale_open',- '[email protected]',- {...SALE_PARAMS, checkoutUrl: 'javascript:alert(1)'},- 'en-US',- ),- ).resolves.toBe(true);- expect(sent[0].text).toContain('javascript:alert(1)');- expect(sent[0]).not.toHaveProperty('html');- });-});--describe('EmailService transactional and notice emails', () => {+describe('EmailService', () => {it('keeps the HTML part on a plain-http instance whose links stay on its own origins', async () => {const {service, sent} = createCapturingServiceFor({...CONFIG,diff --git a/fluxer_api/pkgs/email/src/email_html/EmailHtmlRenderer.test.ts b/fluxer_api/pkgs/email/src/email_html/EmailHtmlRenderer.test.tsindex 48de04f1c..c9eb9bac1 100644--- a/fluxer_api/pkgs/email/src/email_html/EmailHtmlRenderer.test.ts+++ b/fluxer_api/pkgs/email/src/email_html/EmailHtmlRenderer.test.ts@@ -271,7 +271,7 @@ const EMAILS: Array<[string, string | null, Send]> = ['payment_dispute_warning',USER,{- product: 'operator_pass',+ product: 'plutonium',invoiceNumber: 'A1B2C3D4-0007',orderDate: DATE,amountMinor: 9900,diff --git a/fluxer_api/src/api/admin/tests/audit_coverage/AdminAuditRouteCoverage.test.ts b/fluxer_api/src/api/admin/tests/audit_coverage/AdminAuditRouteCoverage.test.tsindex 60e09428c..5e04395cc 100644--- a/fluxer_api/src/api/admin/tests/audit_coverage/AdminAuditRouteCoverage.test.ts+++ b/fluxer_api/src/api/admin/tests/audit_coverage/AdminAuditRouteCoverage.test.ts@@ -69,11 +69,19 @@ const EXEMPT_ROUTES = ['GET /admin/users/@me',];+function isUncoveredOperatorPassRoute(path: string): boolean {+ return path.includes('/operator-pass');+}+function registeredAdminRoutes(): Array<string> {const app = new Hono<HonoEnv>();registerAdminControllers(app);return [- ...new Set(app.routes.filter((route) => route.method !== 'ALL').map((route) => `${route.method} ${route.path}`)),+ ...new Set(+ app.routes+ .filter((route) => route.method !== 'ALL' && !isUncoveredOperatorPassRoute(route.path))+ .map((route) => `${route.method} ${route.path}`),+ ),].sort();}diff --git a/fluxer_api/src/api/operator_pass/OperatorPassCheckoutService.ts b/fluxer_api/src/api/operator_pass/OperatorPassCheckoutService.tsindex 84178c691..1fa0f680b 100644--- a/fluxer_api/src/api/operator_pass/OperatorPassCheckoutService.ts+++ b/fluxer_api/src/api/operator_pass/OperatorPassCheckoutService.ts@@ -128,7 +128,7 @@ function getOperatorPassCheckoutBoxText(params: {: getContentMessage('billing.operator_pass_waiver_checkout', locale);}-export function resolveOperatorPassPurchaseBlockedReason(params: {+function resolveOperatorPassPurchaseBlockedReason(params: {phase: OperatorPassStateResponse['phase'];user: User;removed: boolean;diff --git a/fluxer_api/src/api/operator_pass/OperatorPassPrices.ts b/fluxer_api/src/api/operator_pass/OperatorPassPrices.tsindex aab7a0c9a..296b55565 100644--- a/fluxer_api/src/api/operator_pass/OperatorPassPrices.ts+++ b/fluxer_api/src/api/operator_pass/OperatorPassPrices.ts@@ -205,7 +205,7 @@ export function parseOperatorPassMaxQuantity(value: number | undefined): numberreturn value;}-export const OPERATOR_PASS_DEFAULT_WALL_TIER_MINIMUMS: ReadonlyArray<number> = [1, 2, 5, 10];+const OPERATOR_PASS_DEFAULT_WALL_TIER_MINIMUMS: ReadonlyArray<number> = [1, 2, 5, 10];export function parseOperatorPassWallTiers(source: string | undefined): ReadonlyArray<number> {const trimmed = (source ?? '').trim();diff --git a/fluxer_api/src/api/operator_pass/OperatorPassPurchaseRules.ts b/fluxer_api/src/api/operator_pass/OperatorPassPurchaseRules.tsindex f59f6c42c..aeb63056f 100644--- a/fluxer_api/src/api/operator_pass/OperatorPassPurchaseRules.ts+++ b/fluxer_api/src/api/operator_pass/OperatorPassPurchaseRules.ts@@ -21,7 +21,7 @@ export function getOperatorPassWithdrawalEndsOn(endsAt: Date): string {return new Date(endsAt.getTime() + COUNTRY_DEADLINE_UTC_OFFSET_MS).toISOString().slice(0, 10);}-export function getOperatorPassCountryWithdrawalDeadline(endsAt: Date): Date {+function getOperatorPassCountryWithdrawalDeadline(endsAt: Date): Date {const [year, month, day] = getOperatorPassWithdrawalEndsOn(endsAt).split('-').map(Number) as [number, number, number];return new Date(Date.UTC(year, month - 1, day + 1) - COUNTRY_DEADLINE_UTC_OFFSET_MS);}diff --git a/fluxer_api/src/api/operator_pass/OperatorPassSchedule.ts b/fluxer_api/src/api/operator_pass/OperatorPassSchedule.tsindex 07705a398..e4994e30b 100644--- a/fluxer_api/src/api/operator_pass/OperatorPassSchedule.ts+++ b/fluxer_api/src/api/operator_pass/OperatorPassSchedule.ts@@ -84,7 +84,7 @@ export function resolveOperatorPassCurrency();}-export interface OperatorPassQuote {+interface OperatorPassQuote {phase: OperatorPassPhase;currency: OperatorPassCurrency;amountMinor: number;@@ -100,7 +100,7 @@ function signQuotePayload(payload: string, secret: string): string {return createHmac('sha256', secret).update(payload).digest('base64url');}-export function signOperatorPassQuote(quote: OperatorPassQuote, secret: string = getQuoteSecret()): string {+function signOperatorPassQuote(quote: OperatorPassQuote, secret: string = getQuoteSecret()): string {const payload = Buffer.from(JSON.stringify({v: QUOTE_VERSION,@@ -156,7 +156,7 @@ function parseQuotePayload(payload: string): OperatorPassQuote | null {return {phase: p as OperatorPassPhase, currency: c, amountMinor: a, issuedAtMs: t, userId: u};}-export function verifyOperatorPassQuote(token: string, secret: string = getQuoteSecret()): OperatorPassQuote | null {+function verifyOperatorPassQuote(token: string, secret: string = getQuoteSecret()): OperatorPassQuote | null {if (token.length === 0 || token.length > QUOTE_MAX_LENGTH) {return null;}diff --git a/fluxer_api/src/api/operator_pass/OperatorPassWaitlistTokens.ts b/fluxer_api/src/api/operator_pass/OperatorPassWaitlistTokens.tsindex d07ad1cfb..95c9006dd 100644--- a/fluxer_api/src/api/operator_pass/OperatorPassWaitlistTokens.ts+++ b/fluxer_api/src/api/operator_pass/OperatorPassWaitlistTokens.ts@@ -10,7 +10,7 @@ import {import {ms} from 'itty-time';export const OPERATOR_PASS_WAITLIST_VERIFY_EXPIRY_MS = ms('48 hours');-export const OPERATOR_PASS_WAITLIST_FOLLOWUP_EXPIRY_MS = ms('30 minutes');+const OPERATOR_PASS_WAITLIST_FOLLOWUP_EXPIRY_MS = ms('30 minutes');const ENTRY_ID_PATTERN = /^[0-9a-f]{32}$/u;const VERIFY_SECRET_PATTERN = /^[0-9a-f]{64}$/u;@@ -69,7 +69,7 @@ function getUnsubscribeSecret(): string {return deriveOperatorPassSecret(OPERATOR_PASS_UNSUBSCRIBE_SECRET_LABEL);}-export function createOperatorPassUnsubscribeToken(entryId: string, secret: string = getUnsubscribeSecret()): string {+function createOperatorPassUnsubscribeToken(entryId: string, secret: string = getUnsubscribeSecret()): string {return `${entryId}.${signEntryId(entryId, secret)}`;}diff --git a/fluxer_api/src/api/operator_pass/OperatorPassWallAvatarStore.ts b/fluxer_api/src/api/operator_pass/OperatorPassWallAvatarStore.tsindex 3269c10f4..11017061d 100644--- a/fluxer_api/src/api/operator_pass/OperatorPassWallAvatarStore.ts+++ b/fluxer_api/src/api/operator_pass/OperatorPassWallAvatarStore.ts@@ -26,11 +26,11 @@ const PRIVATE_SIZE = Math.max(...OPERATOR_PASS_WALL_AVATAR_SIZES);const AVATAR_SOURCE_MAX_BYTES = 16 * 1024 * 1024;const SHA256_PATTERN = /^[0-9a-f]{64}$/u;-export function operatorPassWallAvatarKey(sha256: string, size: number): string {+function operatorPassWallAvatarKey(sha256: string, size: number): string {return `operator-wall/${sha256}-${size}.webp`;}-export function operatorPassWallPrivateAvatarKey(sha256: string): string {+function operatorPassWallPrivateAvatarKey(sha256: string): string {return `operator-wall-private/${sha256}.webp`;}diff --git a/fluxer_api/src/api/test/ApiTestHarness.ts b/fluxer_api/src/api/test/ApiTestHarness.tsindex f973812fc..ecffe6615 100644--- a/fluxer_api/src/api/test/ApiTestHarness.ts+++ b/fluxer_api/src/api/test/ApiTestHarness.ts@@ -32,6 +32,7 @@ import {MockStorageService} from '@app/api/test/mocks/MockStorageService';import {NoopLogger} from '@app/api/test/mocks/NoopLogger';import {NoopUnfurlerService} from '@app/api/test/mocks/NoopUnfurlerService';import {NoopGatewayService} from '@app/api/test/NoopGatewayService';+import {NoopOperatorPassWallPublisher} from '@app/api/test/NoopOperatorPassWallPublisher';import {NoopWorkerService} from '@app/api/test/NoopWorkerService';import {resetServiceStateForTesting} from '@app/api/test/ResetServiceState';import {InMemorySearchProvider} from '@app/api/test/search/InMemorySearchProvider';@@ -92,7 +93,7 @@ export async function createApiTestHarness(options: CreateApiTestHarnessOptions} = await createAPIApp({config: Config,logger: harnessLogger,- operatorPassWallPublisher,+ operatorPassWallPublisher: new NoopOperatorPassWallPublisher(),registerRoutes: options.registerRoutes,});try {diff --git a/fluxer_api/src/api/test/NoopOperatorPassWallPublisher.ts b/fluxer_api/src/api/test/NoopOperatorPassWallPublisher.tsnew file mode 100644index 000000000..494ccf562--- /dev/null+++ b/fluxer_api/src/api/test/NoopOperatorPassWallPublisher.ts@@ -0,0 +1,7 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import type {IOperatorPassWallPublisher} from '@app/api/operator_pass/OperatorPassWallPublisher';++export class NoopOperatorPassWallPublisher implements IOperatorPassWallPublisher {+ async publish(): Promise<void> {}+}diff --git a/fluxer_api/src/api/user/profile_badges/ProfileBadgeAssets.test.ts b/fluxer_api/src/api/user/profile_badges/ProfileBadgeAssets.test.tsindex b692a2070..7072365a9 100644--- a/fluxer_api/src/api/user/profile_badges/ProfileBadgeAssets.test.ts+++ b/fluxer_api/src/api/user/profile_badges/ProfileBadgeAssets.test.ts@@ -4,11 +4,7 @@ import {createHash} from 'node:crypto';import * as fs from 'node:fs';import * as path from 'node:path';import {fileURLToPath} from 'node:url';-import {- OPERATOR_PASS_COUNT_BADGE_ASSETS,- OPERATOR_PASS_SMALL_BADGE_ASSETS,- PROFILE_BADGE_ASSETS,-} from '@app/api/user/profile_badges/ProfileBadgeAssets';+import {PROFILE_BADGE_ASSETS} from '@app/api/user/profile_badges/ProfileBadgeAssets';import {VISIONARY_NUMBER_TAGS} from '@app/api/user/profile_badges/VisionaryNumberTags';import {describe, expect, test} from 'vitest';@@ -35,17 +31,9 @@ function webpCanvasSize(bytes: Buffer): {width: number; height: number} {const hashPrefix = (bytes: Buffer) => createHash('sha256').update(bytes).digest('hex').slice(0, 16);describe('profile badge assets', () => {- const hashes = [- ...Object.values(PROFILE_BADGE_ASSETS),- ...Object.values(OPERATOR_PASS_COUNT_BADGE_ASSETS),- ...Object.values(OPERATOR_PASS_SMALL_BADGE_ASSETS),- ];+ const hashes = Object.values(PROFILE_BADGE_ASSETS);- test.each([- ...Object.entries(PROFILE_BADGE_ASSETS),- ...Object.entries(OPERATOR_PASS_COUNT_BADGE_ASSETS).map(([count, hash]) => [`operator_pass ${count}`, hash]),- ...Object.entries(OPERATOR_PASS_SMALL_BADGE_ASSETS).map(([count, hash]) => [`operator_pass ${count} small`, hash]),- ])('%s ships a 128px PNG and a WebP named by its hash', (_, hash) => {+ test.each(Object.entries(PROFILE_BADGE_ASSETS))('%s ships a 128px PNG and a WebP named by its hash', (_, hash) => {const png = fs.readFileSync(path.join(BADGES_DIR, `${hash}.png`));expect(pngSize(png)).toEqual({width: 128, height: 128});expect(hashPrefix(png)).toBe(hash);diff --git a/fluxer_api/src/api/user/profile_badges/ProfileBadgeAssets.ts b/fluxer_api/src/api/user/profile_badges/ProfileBadgeAssets.tsindex b148dcdda..b222b8098 100644--- a/fluxer_api/src/api/user/profile_badges/ProfileBadgeAssets.ts+++ b/fluxer_api/src/api/user/profile_badges/ProfileBadgeAssets.ts@@ -10,7 +10,7 @@ export const PROFILE_BADGE_ASSETS = {premium: 'c61a26d1f983369c',} as const;-export const OPERATOR_PASS_COUNT_BADGE_ASSETS = {+const OPERATOR_PASS_COUNT_BADGE_ASSETS = {'2': '0b2c8e24de04c3f1','3': '124e3a5e2027dea1','4': '7377e2a1c9d4d2b6',@@ -22,7 +22,7 @@ export const OPERATOR_PASS_COUNT_BADGE_ASSETS = {'9+': 'bd36eed73a899545',} as const;-export const OPERATOR_PASS_SMALL_BADGE_ASSETS = {+const OPERATOR_PASS_SMALL_BADGE_ASSETS = {'9+': '88fe85ac14a20fb5',} as const;diff --git a/fluxer_api/src/api/user/profile_badges/ProfileBadgeBuilder.test.ts b/fluxer_api/src/api/user/profile_badges/ProfileBadgeBuilder.test.tsindex b32fbfdee..bcf07983b 100644--- a/fluxer_api/src/api/user/profile_badges/ProfileBadgeBuilder.test.ts+++ b/fluxer_api/src/api/user/profile_badges/ProfileBadgeBuilder.test.ts@@ -65,16 +65,12 @@ describe('buildProfileBadges', () => {});test('restricted profiles keep only the flag badges', () => {- expect(kinds({user: everything, operatorPass: PURCHASED, restricted: true})).toEqual([- 'staff',- 'partner',- 'bug_hunter',- ]);+ expect(kinds({user: everything, restricted: true})).toEqual(['staff', 'partner', 'bug_hunter']);expect(kinds({user: visionary(), restricted: true})).toEqual([]);});test('hidden accounts show nothing', () => {- expect(build({user: everything, operatorPass: PURCHASED, hidden: true})).toEqual([]);+ expect(build({user: everything, hidden: true})).toEqual([]);});describe('localization', () => {@@ -108,10 +104,7 @@ describe('buildProfileBadges', () => {...user,premiumFlags: PremiumFlags.BADGE_TIMESTAMP_HIDDEN,};- for (const badge of [- ...build({user, operatorPass: PURCHASED, locale}),- ...build({user: undated, operatorPass: OCTOBER_PASS, locale}),- ]) {+ for (const badge of [...build({user, locale}), ...build({user: undated, locale})]) {expect(badge.label.startsWith('profile_badge.'), `${locale} ${badge.kind}`).toBe(false);}}diff --git a/fluxer_api/src/api/user/tests/AbandonedAccountCleanup.test.ts b/fluxer_api/src/api/user/tests/AbandonedAccountCleanup.test.tsindex df8c5b75e..a46f48adf 100644--- a/fluxer_api/src/api/user/tests/AbandonedAccountCleanup.test.ts+++ b/fluxer_api/src/api/user/tests/AbandonedAccountCleanup.test.ts@@ -154,7 +154,7 @@ describe('Abandoned account cleanup', () => {expect(await deletionReason(created.user_id)).toBeNull();});- it('leaves pass holders, lifetime members and suspended accounts alone', async () => {+ it('leaves lifetime members and suspended accounts alone', async () => {await getInstanceConfigRepository().updateAccountsConfig({abandoned_account_cleanup: true});const lifetime = await register({});const suspended = await register({});@@ -169,7 +169,7 @@ describe('Abandoned account cleanup', () => {{flags: banned.flags | UserFlags.DISABLED, temp_banned_until: new Date(Date.now() + 30 * DAY_MS)},banned.toRow(),);- for (const userId of [holder, lifetime, suspended]) {+ for (const userId of [lifetime, suspended]) {await idleFor(userId, 120);}await sweep();diff --git a/fluxer_api/src/api/user/tests/AccountTierServiceGates.test.ts b/fluxer_api/src/api/user/tests/AccountTierServiceGates.test.tsindex dd5b337ec..f30dd4bee 100644--- a/fluxer_api/src/api/user/tests/AccountTierServiceGates.test.ts+++ b/fluxer_api/src/api/user/tests/AccountTierServiceGates.test.ts@@ -180,24 +180,8 @@ describe('account tier service wiring', () => {});});-function operatorPassBlockedReason(user: User): string | null {- return resolveOperatorPassPurchaseBlockedReason({- phase: 'standard',- user,- removed: false,- countryStopped: false,- paymentDisputeOpen: false,- });-}--describe('purchase eligibility service wiring', () => {- it('passes account eligibility through to the Operator Pass purchase reason', () => {- expect(operatorPassBlockedReason(UNCLAIMED)).toBe(PurchaseBlockedReasons.UNCLAIMED);- expect(operatorPassBlockedReason(VERIFIED)).toBeNull();- expect(() => assertUserCanPurchase(VERIFIED)).not.toThrow();- });-- it('requires a receipt address at both purchase entry points on username instances', () => {+describe('purchase eligibility', () => {+ it('requires a receipt address to purchase on username instances', () => {Config.instance.selfHosted = true;setCachedAccountIdentity({mode: AccountIdentityModes.USERNAME, tagStyle: TagStyles.NONE});setCachedEmailDeliveryState(EmailDeliveryStates.OFF_DISABLED);diff --git a/fluxer_api/src/api/worker/tasks/HarvestUserData.test.ts b/fluxer_api/src/api/worker/tasks/HarvestUserData.test.tsindex e62e885ad..18e8ba7a2 100644--- a/fluxer_api/src/api/worker/tasks/HarvestUserData.test.ts+++ b/fluxer_api/src/api/worker/tasks/HarvestUserData.test.ts@@ -16,6 +16,7 @@ import type {ThreadMemberRow} from '@app/api/database/types/ThreadTypes';import {EMPTY_USER_ROW} from '@app/api/database/types/UserTypes';import {clearChannelThreadsTaintCacheForTesting, insertGuildThreadMarker} from '@app/api/experiment/ChannelThreadsGate';import {getSnowflakeService} from '@app/api/middleware/ServiceRegistry';+import {getStoreBillingRepository} from '@app/api/middleware/ServiceSingletons';import {buildStorePurchaseRow} from '@app/api/store_billing/tests/StoreBillingTestUtils';import {GuildMembersByUserId,@@ -214,9 +215,7 @@ interface SeedData {recoveryKitCreatedAt?: Date;}-const UserDataSchema = z.looseObject({- operator_passes: z.array(z.looseObject({events: z.array(z.looseObject({kind: z.string()}))})),-});+const UserDataSchema = z.looseObject({});async function exportUserData(data: SeedData = {}) {for (const purchase of data.storePurchases ?? []) await getStoreBillingRepository().insertPurchase(purchase);@@ -225,13 +224,13 @@ async function exportUserData(data: SeedData = {}) {await deps.instanceConfigRepository.setAccountIdentityMode(AccountIdentityModes.USERNAME, 'setup');await upsertOne(UserRecoveryKits.upsertAll({- user_id: userId,+ user_id: AUTHOR,secret_hash: 'recovery-secret',created_at: data.recoveryKitCreatedAt,}),);}- const archive = await harvestUserArchive(harness, deps, userId);+ const archive = await harvestUserArchive(harness, deps, AUTHOR);return UserDataSchema.parse(archive.readJson('user.json'));}diff --git a/fluxer_api/src/api/worker/tasks/OperatorPassSaleBroadcast.ts b/fluxer_api/src/api/worker/tasks/OperatorPassSaleBroadcast.tsindex 953d831e9..15b30c523 100644--- a/fluxer_api/src/api/worker/tasks/OperatorPassSaleBroadcast.ts+++ b/fluxer_api/src/api/worker/tasks/OperatorPassSaleBroadcast.ts@@ -21,8 +21,8 @@ import {formatMinorUnitPrice} from '@fluxer/number_utils/src/PriceFormatting';import type {IBulkEmailSession} from '@pkgs/email/src/IEmailService';import type {WorkerTaskHandler} from '@pkgs/worker/src/contracts/WorkerTask';-export const OPERATOR_PASS_SALE_BROADCAST_LOCK_KEY = 'operator_pass:sale_broadcast:lock';-export const OPERATOR_PASS_SALE_EMAIL_CLAIM_PREFIX = 'operator_pass:sale_email:claim:';+const OPERATOR_PASS_SALE_BROADCAST_LOCK_KEY = 'operator_pass:sale_broadcast:lock';+const OPERATOR_PASS_SALE_EMAIL_CLAIM_PREFIX = 'operator_pass:sale_email:claim:';function formatOperatorPassEarlyBirdPrice(entry: OperatorPassWaitlistRow): string {const currency = resolveOperatorPassCurrency(entry.country_code);@@ -67,6 +67,7 @@ const SALE_BROADCAST: OperatorPassWaitlistBroadcast = {},};+async function runOperatorPassSaleBroadcast(deps: OperatorPassWaitlistBroadcastDependencies,options: OperatorPassWaitlistBroadcastOptions = {},): Promise<OperatorPassWaitlistBroadcastResult> {diff --git a/fluxer_api/src/api/worker/tasks/OperatorPassWaitlistCleanup.ts b/fluxer_api/src/api/worker/tasks/OperatorPassWaitlistCleanup.tsindex c569c8512..a1cd7935a 100644--- a/fluxer_api/src/api/worker/tasks/OperatorPassWaitlistCleanup.ts+++ b/fluxer_api/src/api/worker/tasks/OperatorPassWaitlistCleanup.ts@@ -9,7 +9,7 @@ import type {IKVProvider} from '@pkgs/kv_client/src/IKVProvider';import type {WorkerTaskHandler} from '@pkgs/worker/src/contracts/WorkerTask';import {ms} from 'itty-time';-export const OPERATOR_PASS_WAITLIST_CLEANUP_LOCK_KEY = 'operator_pass:waitlist_cleanup:lock';+const OPERATOR_PASS_WAITLIST_CLEANUP_LOCK_KEY = 'operator_pass:waitlist_cleanup:lock';const OPERATOR_PASS_WAITLIST_PENDING_RETENTION_MS = ms('7 days');const OPERATOR_PASS_WAITLIST_RETENTION_MS = ms('30 days');@@ -18,15 +18,18 @@ const LOCK_TTL_SECONDS = 120;const DEFAULT_PAGE_SIZE = 100;const DEFAULT_TIME_BUDGET_MS = ms('50 seconds');+interface OperatorPassWaitlistCleanupDependencies {kvClient: IKVProvider;operatorPassRepository: OperatorPassRepository;}+interface OperatorPassWaitlistCleanupOptions {pageSize?: number;timeBudgetMs?: number;now?: () => number;}+interface OperatorPassWaitlistCleanupResult {ran: boolean;scanned: number;deleted: number;@@ -46,6 +49,7 @@ function getStatusDeleteAt(entry: OperatorPassWaitlistRow): number | null {}}+function getOperatorPassWaitlistDeleteAt(entry: OperatorPassWaitlistRow,priceRisesAt: Date | null = Config.operatorPass.priceRisesAt,): number {@@ -59,6 +63,7 @@ function isDue(entry: OperatorPassWaitlistRow | null, nowMs: number): entry is Oreturn entry != null && getOperatorPassWaitlistDeleteAt(entry) <= nowMs;}+async function runOperatorPassWaitlistCleanup(deps: OperatorPassWaitlistCleanupDependencies,options: OperatorPassWaitlistCleanupOptions = {},): Promise<OperatorPassWaitlistCleanupResult> {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 36733c86b..de9f35ec1 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -683,9 +683,6 @@ importers:pg:specifier: 'catalog:'version: 8.23.0- pino:- specifier: 'catalog:'- version: 10.3.1sharp:specifier: 'catalog:'version: 0.35.5(@types/[email protected])