The same code seen by what it is for, and the rule each part follows. These cut across the modules above.
Storage & persistence
mod 01
Four tiers, one facade
FileSystem › IndexedDB › localStorage (Supabase retired from the customer path). DB._write, putItem/putHistory/putProduct/putAsset, purgeIds, clearCollection.
MODUS Picks the best store on the device; writes are upsert + surgical delete, never delete-all.
Stock engine
mod 02
Every quantity change
add (receive), consume (sign-out / install), transfer (move), signOutPassthrough (never-stocked).
MODUS Same-location match or a new line; material sign-out is a give, not a loan. Never bypassed.
NTI catalog
mod 02 / 07
The NTI↔Oracle map
_ntiNext, _ntiByPN, assignNTINumbers, openNTIWizard, runNTIMigration, exportNTIMap, importNTIMapFile, exportCatalogXLSX, resetNTIDatabase, confirmPartsImport.
MODUS NTI keys travel; Oracle/customer data stays on the device and OneDrive, stripped from anything shared.
OneDrive sync
mod 07
Two-way, lossless
FileSync.push (read-merge-write), pull (last-write-wins + tombstones), markDirty, noteDelete, _deepStrip / _deepHydrate.
MODUS Local-first; the shared file carries NTI only and rehydrates Oracle fields on the way back in.
Chain of custody
mod 05 / 07
Tamper-evident history
_sha256hex, _histCanon, _chainStamp, initHistoryChain, verifyIntegrity, historyRoot, runIntegrityCheck, resealHistory.
MODUS Each event is SHA-256-linked to the one before it; one root hash stands for the whole log. NTI-only payload.
Identity & roles
mod 05
Who can do what
Identity.load/set/clear/can, guardWrite, guardAdmin, identitySave, identitySignOut.
MODUS Admin / Lead / Tech / Read-only. Every change is stamped with a name; roles gate the sensitive tools.
Scanner & camera
mod 06
Camera or wired trigger
handleScannedBarcode, handleScannerTabCode, bay-scan flow, camera start/stop, the HID wedge listener, reset.
MODUS A lens or a hardware scanner becomes a clean code the rest of the app resolves and acts on.
Views & rendering
mod 05
Read state, paint, repaint
The render* family, modals, and screens for inventory, items, assets, sign-outs, sales orders, and the shelf viewer.
MODUS Reads the in-memory collections and repaints on every change.
Reports & export
mod 07
Read-only snapshots
export* (Excel / XLSX / CSV), print* (labels, pick lists, inventory reports), the reports-folder export.
MODUS Generates shareable, read-only snapshots; printing and Excel for the night shift.
Diagnostics & self-healing
mod 05
Detect, then fix safely
Diag, renderDiagnostics, and the one-tap fixes for duplicates, orphans, zero lines, barcode collisions, and accountability gaps.
MODUS Flags or moves data into a catch-bin; never deletes as a side effect.
Operator console
mod 07
59 commands
Cons, runConsoleCmd, consolePaste.
MODUS A command line into the live database for diagnostics, sync probes, and operations.
Assist (optional)
mod 07
Off until armed
AI.activate/off/level/_call/converse. Five modes from Local-only to Max.
MODUS Console-armed and hidden by default; Local-only makes no external calls. Paste a key for more.
Transactions
mod 05
Batch & reversible
Tx.run, Tx._commit, txUndo, txRedo.
MODUS Groups related writes into one reversible unit; the console can undo or redo them.