Continues the incremental server TS migration (after utils/*.mts and
paymentValidation.cts): converts 10 services to .cts (CommonJS TypeScript,
run natively via Node type-stripping — no build step), type-checked by
tsconfig.server.json.
Migrated: totpService, amountSuggestionService, encryptionService,
paymentAccountingService, statusService, aprService, driftService,
analyticsService, spendingService, billMerchantRuleService.
- types/db.d.ts: shared minimal better-sqlite3 Db/Statement types (the lib
ships none), reused across the migrated modules.
- Every require of a migrated service updated to the explicit .cts extension
(extensionless require does not resolve .cts) across routes / services /
db migrations / server.js / workers / tests — require-only changes.
- package.json: check:server find pattern now includes *.cts (it silently
skipped .cts before, so paymentValidation.cts had no node --check gate).
Behavior-preserving (types only). Verified: typecheck:server 0,
check:server 0, full server suite 226/226, real boot → /api/health 200.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
billMerchantRuleService.syncBillPaymentsFromSimplefin (a money-CREATING
path): a rule-matched unmatched transaction becomes exactly one
provider_sync payment (cents, tx→matched), re-running is idempotent (no
dup — match-status filter + the UNIQUE(transaction_id) index), and a
non-matching tx is left alone. spendingService budgets: dollars↔cents
round-trip + set/update/clear. Suite 221 green.
(spreadsheet createPaymentFromImport dedupe is analogous to the payment
atomicity already covered in Track A; a full XLSX-parse test is deferred
as lower-value/high-setup.)
Co-Authored-By: Claude Opus 4.8 <[email protected]>