Getting Started
API Overview
Main exports from @frappes/firebase.
Exports
imports.ts
import {
FirestoreCoreClient,
createFirestoreCoreClient,
createFirebaseFirestorePort,
canTransitionOrderStatus,
type FirestorePort,
type FirestoreCoreClientOptions,
type CreateOrderInput,
type UpdateOrderStatusInput,
} from "@frappes/firebase"
Core methods
Tenant and catalog
upsertTenant(data)upsertLocation(locationId, data)upsertStaff(uid, data)upsertProduct(productId, data)subscribeProducts(listener, options?)
Orders
createOrder(input, locationId?)updateOrderStatus(input)appendOrderEvent(orderId, event, locationId?)getOrder(orderId, locationId?)listOrders(locationId?, options?)subscribeOrders(listener, options?, locationId?)
Business day / reporting
openBusinessDay(dateKey, locationId?)closeBusinessDay(dateKey, { closedByUid?, locationId? })setDailySummary(dateKey, summary, { locationId?, merge? })
Context switching
Use withContext() to derive a client for another tenant/location/actor:
const tenantA = createFirestoreCoreClient({ firestore, tenantId: "tenant_a", locationId: "loc_1" })
const tenantB = tenantA.withContext({ tenantId: "tenant_b", locationId: "loc_2" })