@teincfood/core
v0.1.5
Published
TeincFood shared offline-first core — types, sync engine, local DB, reference data, and repositories for mobile + desktop
Readme
@teincfood/core
TeincFood shared offline-first core — single source of truth for mobile (TeincFoodBusiness) and desktop (TeincFoodDesktop).
What lives here (v0.1.0 backbone)
types/api/*— snake_case API contracts matching backendutils/*— currency, error, format, uuid, order-number (async), etc.sync/*— engine, command-queue, transports, routing-policy, pending-ordersdb/*— migrations + operations (driver-agnostic, takes aSqliteDriver)reference/*— versioned reference-data cacherepositories/*— order/pos repositoriesadapters/*— platform seams (KV, SQLite, HTTP, etc.)
Adapters
Apps supply platform adapters via createTeincCore({ storage, db, http, ... }):
KVStorage— asyncgetItem/setItem/removeItem(MMKV-wrapped on mobile,plugin-storeon desktop)SqliteDriver—execAsync/runAsync/getFirstAsync/getAllAsync/withTransactionAsyncHttpClient— axios instance with auth interceptors (token plumbing stays app-side)LanTransport—{ isAvailable(), execute(command) }
Usage
import { createTeincCore } from "@teincfood/core";
const core = createTeincCore({ storage, db, http });Apps re-export types via export * from "@teincfood/core" barrels to avoid churn.
Publishing
yarn build
npm publish --access publicRoadmap
- v0.2 services/stores/hooks
- v0.3 LAN protocol + orchestrator + restart/diagnostics
- v0.4 phoenix/events
