Reference

Types

Important exported types from @frappes/firebase.

Domain status and role types

type Role = "owner" | "manager" | "cashier" | "kitchen" | "viewer" | "banned"
type OrderSource = "in_store" | "delivery"
type OrderStatus = "new" | "accepted" | "in_prep" | "ready" | "completed" | "cancelled"

Core entity types

  • Tenant
  • Location
  • StaffMember
  • Product
  • Order
  • OrderEvent
  • BusinessDay
  • DailySummary

Query types

interface QueryCondition {
  fieldPath: string
  op: "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "array-contains"
  value: unknown
}

interface QuerySort {
  fieldPath: string
  direction: "asc" | "desc"
}

interface QueryOptions {
  where?: QueryCondition[]
  orderBy?: QuerySort[]
  limit?: number
}

Port and transaction contracts

interface FirestorePort {
  getDoc<T>(path: string): Promise<T | null>
  setDoc<T>(path: string, data: T, options?: { merge?: boolean }): Promise<void>
  updateDoc<T extends object>(path: string, data: Partial<T>): Promise<void>
  queryCollection<T>(collectionPath: string, options?: QueryOptions): Promise<Array<DocSnapshot<T>>>
  subscribeCollection<T>(
    collectionPath: string,
    callback: (docs: Array<DocSnapshot<T>>) => void,
    options?: QueryOptions,
  ): () => void
  runTransaction<T>(runner: (tx: FirestoreTransactionPort) => Promise<T>): Promise<T>
}

Implement this contract once and reuse it across all client instances.

Copyright © 2026