BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fable-ui/firebase-driver

Firebase Data Source Driver

fable-ui/firebase-driver
FreeUtility

Optional Fable UI data source driver for allowlisted Firestore resources.

Live preview

live · rendered by the registry
Rendered by fable-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://fable-ui.shobky.com/r/firebase-driver.json

Source

lib/fable-ui/drivers/firebase/firebase-driver.tsfable-ui.shobky.com/r/firebase-driver.json · first 6 KB
1import {
2 getDataValue,
3 queryLocalRows,
4 type DataActionInput,
5 type DataActionResult,
6 type DataFilter,
7 type DataQuery,
8 type DataQueryResult,
9 type DataRow,
10 type DataSourceContext,
11 type DataSourceDriver,
12 type ResourceConfig,
13 type ResourceRuntime,
14} from "@/lib/fable-ui/core"
15import type {
16 FirebaseAuthLike,
17 FirebaseDriverConfig,
18 FirestorePathParam,
19 FirestoreResourceSource,
20 FirestoreSdk,
21} from "./firebase-driver.types"
22
23async function loadFirestoreSdk(): Promise<FirestoreSdk> {
24 const moduleName = "firebase/firestore"
25 return (await import(moduleName)) as FirestoreSdk
26}
27
28function mapFirestoreError(error: unknown) {
29 const message = error instanceof Error ? error.message : String(error || "")
30 const code =
31 typeof error === "object" && error && "code" in error
32 ? String((error as { code?: unknown }).code)
33 : ""
34
35 if (/permission-denied|permission|forbidden/i.test(`${code} ${message}`)) {
36 return new Error("Firestore permission denied. Check authentication and security rules.")
37 }
38
39 if (/failed-precondition|index/i.test(`${code} ${message}`)) {
40 return new Error("Firestore query requires an index. Check the Firebase console index suggestion.")
41 }
42
43 if (/invalid-argument|invalid/i.test(`${code} ${message}`)) {
44 return new Error(`Firestore query is invalid: ${message}`)
45 }
46
47 return error instanceof Error ? error : new Error("Firestore request failed.")
48}
49
50function assertSafePathParam(key: string, value: string) {
51 if (!value || value.includes("/") || value.includes("..")) {
52 throw new Error(`Invalid Firestore path parameter "${key}".`)
53 }
54
55 return value
56}
57
58async function resolvePathParam(key: string, param: FirestorePathParam, ctx: DataSourceContext) {
59 const value = typeof param === "function" ? await param(ctx) : param
60 return assertSafePathParam(key, String(value))
61}
62
63async function resolveCollectionPath(source: FirestoreResourceSource, ctx: DataSourceContext) {
64 const params: Record<string, string> = {}
65
66 if (ctx.orgId) {
67 params.orgId = assertSafePathParam("orgId", String(ctx.orgId))
68 }
69
70 if (ctx.tenantId) {
71 params.tenantId = assertSafePathParam("tenantId", String(ctx.tenantId))
72 }
73
74 for (const [key, param] of Object.entries(source.pathParams ?? {})) {
75 params[key] = await resolvePathParam(key, param, ctx)
76 }
77
78 return source.collection.replace(/\{([^}]+)\}/g, (_match, key: string) => {
79 const value = params[key]
80
81 if (!value) {
82// … truncated

What it pulls in

npm packages

  • firebase

Other registry items

  • shobky/fable-ui/core

Files it writes

  • lib/fable-ui/drivers/firebase/firebase-driver.types.ts
  • lib/fable-ui/drivers/firebase/firebase-driver.ts
  • lib/fable-ui/drivers/firebase/index.ts

Facts

Registry
fable-ui
Type
registry:lib
Access
Free
Files written
3
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

Docs on fable-ui fable-ui.shobky.com shobky/fable-ui on GitHub Raw registry item This item as JSON

More from fable-ui

All 10 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Fable UI Corecorefable-uiUtilitiesFree2 deps · 9 files
REST Data Source Driverrest-driverfable-uiUtilitiesFreeno deps · 3 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex