one directory per feature: schema.ts and queries.ts together
src/databases/officer_db/src/<feature>/{schema.ts,queries.ts}, replacing the
parallel schema/ and queries/ trees. 24 feature directories, 46 files moved with
git mv so history follows.
The parallel trees had drifted, which is what the restructure is really fixing:
four features were named differently on each side — app-store/sidecar-installs,
email/email-accounts, server/server-config
operations had a schema and NO query file: its task_logs is reached directly
from src/servers/api/task-logger.ts, bypassing this package's own boundary
integrations had queries and NO schema, because it spans two features'
tables — server_integrations and user_integrations
Both lopsided cases survive as directories holding one file, which states the
problem instead of hiding it across two trees.
Nothing outside the package changed how it imports. `officerdb`, `officerdb/types`
and `officerdb/db` resolve exactly as before; index.ts absorbed the path changes.
Added `"./*": "./src/*"` so the new layout is reachable — `officerdb/soulseek/schema`
— which one script needed, because soulseek is a plugin and therefore commented
out of the aggregator.
schema/index.ts became src/schema.ts, keeping the core/plugin split from earlier
tonight. drizzle.config.ts and the package's "./schema" export follow it.
Verified rather than assumed: all 52 files in the package parse, every relative
import resolves against the new layout (checked by walking each specifier to a
real file, since parsing does not check paths), and everything in the tree
importing officerdb still parses. Not typechecked — empty node_modules, frozen
installs.
One rewrite bug worth recording: the rule mapping a query module's sibling import
also matched the './schema' this pass had just written, turning it into
'../schema/queries' in 22 files. Caught by the resolver check, not by parsing —
both spellings parse fine.
Also corrects every path reference the move invalidated: src/databases/CLAUDE.md's
layout diagram, the root CLAUDE.md data section, three docs, and seven sidecar
comments naming queries/<x>.ts.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
// auth+forward proxy and holds NO InvoiceShelf credentials.
|
||||
//
|
||||
// The instance is CONFIGURED BY THE OWNER FROM THE UI and stored encrypted in `invoiceshelf_accounts` (see
|
||||
// databases/officer_db/src/queries/invoiceshelf.ts). It is deliberately no longer read from the environment:
|
||||
// databases/officer_db/src/invoiceshelf/queries.ts). It is deliberately no longer read from the environment:
|
||||
// Bun auto-loads `.env` into every process started in the platform directory, so an `INVOICESHELF_TOKEN`
|
||||
// there was also sitting in `officer`'s own `process.env` — a credential held by the one process that has no
|
||||
// code to use it and the largest attack surface in the system. Nothing in this file reads process.env.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// thin auth+forward proxy and holds NO Jellyfin credentials.
|
||||
//
|
||||
// The server is CONFIGURED BY THE OWNER FROM THE UI and stored encrypted in `jellyfin_servers` (see
|
||||
// databases/officer_db/src/queries/jellyfin.ts). Nothing in this file reads process.env — Bun auto-loads
|
||||
// databases/officer_db/src/jellyfin/queries.ts). Nothing in this file reads process.env — Bun auto-loads
|
||||
// `.env` into every process started in the platform directory, so a token there would also be sitting in
|
||||
// `officer`'s own environment: a credential held by the one process that has no code to use it.
|
||||
//
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// auth+forward proxy and holds NO Immich credentials.
|
||||
//
|
||||
// The instance is CONFIGURED BY THE OWNER FROM THE UI and stored encrypted in `photos_config` (see
|
||||
// databases/officer_db/src/queries/photos.ts). It is deliberately no longer read from the environment:
|
||||
// databases/officer_db/src/photos/queries.ts). It is deliberately no longer read from the environment:
|
||||
// Bun auto-loads `.env` into every process started in the platform directory, so an `IMMICH_API_KEY` there
|
||||
// was also sitting in `officer`'s own `process.env` — a credential held by the one process that has no code
|
||||
// to use it and the largest attack surface in the system. Nothing in this file reads process.env.
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getServiceCredentials } from 'officerdb';
|
||||
// auth+forward proxy and holds NO slskd credentials.
|
||||
//
|
||||
// The daemon is CONFIGURED BY THE OWNER FROM THE UI and stored encrypted in `service_connections` (see
|
||||
// databases/officer_db/src/queries/service-connections.ts). It is deliberately no longer read from the
|
||||
// databases/officer_db/src/service-connections/queries.ts). It is deliberately no longer read from the
|
||||
// environment: Bun auto-loads `.env` into every process started in the platform directory, so an
|
||||
// `SLSKD_API_KEY` there was also sitting in `officer`'s own process.env — a credential that drives the whole
|
||||
// Soulseek daemon, held by the one process with no code to use it. Nothing in this file reads process.env.
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getServiceCredentials } from 'officerdb';
|
||||
// a thin auth+forward proxy and holds NO Transmission credentials.
|
||||
//
|
||||
// The daemon is CONFIGURED BY THE OWNER FROM THE UI and stored in `service_connections` (see
|
||||
// databases/officer_db/src/queries/service-connections.ts), no longer read from the environment: Bun
|
||||
// databases/officer_db/src/service-connections/queries.ts), no longer read from the environment: Bun
|
||||
// auto-loads `.env` into every process started in the platform directory, so TRANSMISSION_* was also
|
||||
// sitting in `officer`'s own process.env, and pointing Officer at a daemon meant editing a file on the
|
||||
// server. Nothing in this file reads process.env.
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getKey } from 'officerdb/secret-store';
|
||||
|
||||
// The ONLY reader of WALLET_* env in the tree. Everything else — node URLs, macaroons, runes, LNDHub
|
||||
// credentials, NWC URIs — is per-wallet configuration the owner enters at runtime and lives encrypted in
|
||||
// Postgres (databases/officer_db/src/schema/wallet.ts), not here. Env holds only what is genuinely
|
||||
// Postgres (databases/officer_db/src/wallet/schema.ts), not here. Env holds only what is genuinely
|
||||
// deployment-wide: which chain we're on.
|
||||
//
|
||||
// WHERE CHAIN DATA COMES FROM IS NOT ENV. It used to be WALLET_ESPLORA_URL, which meant the one setting
|
||||
|
||||
Reference in New Issue
Block a user