Reference

FirestoreCoreClient

Detailed reference for client methods.

Construction

const client = createFirestoreCoreClient({
  firestore,
  tenantId: "tenant_1",
  locationId: "loc_1", // optional but required by location-scoped methods
  actor: { uid: "staff_1", deviceId: "device_1" }, // optional
  now: () => new Date(), // optional
})

Context API

withContext(overrides)

Creates a new client sharing the same firestore and now, with updated tenantId, locationId, and/or actor.

Tenant and catalog methods

MethodPurpose
upsertTenant(data)Create/update tenant document with merge semantics.
upsertLocation(locationId, data)Create/update location document under tenant.
upsertStaff(uid, data)Create/update staff member document under tenant.
upsertProduct(productId, data)Create/update product document under tenant.
subscribeProducts(listener, options?)Live product stream from tenant products collection.

Order methods

MethodPurpose
createOrder(input, locationId?)Transactionally create order + created event.
updateOrderStatus(input)Validate transition, update order status, append status_changed event.
appendOrderEvent(orderId, event, locationId?)Append custom order event.
getOrder(orderId, locationId?)Fetch one order document.
listOrders(locationId?, options?)Query orders with where/orderBy/limit.
subscribeOrders(listener, options?, locationId?)Live stream for orders query.

Business day and summary methods

MethodPurpose
openBusinessDay(dateKey, locationId?)Mark date as open with openedAt.
closeBusinessDay(dateKey, input?)Mark date as closed with closedAt and actor UID.
setDailySummary(dateKey, summary, options?)Write or merge summary data for the date.
Methods that work on orders/business-day paths require a location context. Set locationId on client creation or pass it when the method allows.
Copyright © 2026