@goatlab/fluent-firebase 0.7.26 → 0.7.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +64 -35
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,49 +1,78 @@
1
- <!-- PROJECT SHIELDS -->
1
+ # @goatlab/fluent-firebase
2
2
 
3
- [![Stargazers][stars-shield]][stars-url]
4
- [![Issues][issues-shield]][issues-url]
5
- [![MIT License][license-shield]][license-url]
6
- [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
3
+ Firebase/Firestore connector for the Goat Fluent query interface. Provides a type-safe, schema-validated query builder for Firebase Firestore with support for complex queries, batch operations, and relations.
7
4
 
8
- <!-- PROJECT LOGO -->
9
- <br />
10
- <p align="center">
11
- <a href="https://github.com/github_username/repo">
12
- <img src="https://docs.goatlab.io/logo.png" alt="Logo" width="150" height="150">
13
- </a>
5
+ ## Installation
14
6
 
15
- <h3 align="center">GOAT - FLUENT-FIREBASE</h3>
7
+ ```bash
8
+ npm install @goatlab/fluent-firebase
9
+ # or
10
+ yarn add @goatlab/fluent-firebase
11
+ # or
12
+ pnpm add @goatlab/fluent-firebase
13
+ ```
16
14
 
17
- <p align="center">
18
- Fluent - Time Saving (TS) utils
19
- <br />
20
- <a href="https://docs.goatlab.io/#/0.7.x/fluent/fluent"><strong>Explore the docs »</strong></a>
21
- <br />
22
- <br />
23
- ·
24
- <a href="https://github.com/goat-io/fluent/issues">Report Bug</a>
25
- ·
26
- <a href="https://github.com/goat-io/fluent/issues">Request Feature</a>
27
- </p>
28
- </p>
29
- </p>
15
+ ## Basic Usage
30
16
 
31
- # Goat - Fluent
17
+ ```typescript
18
+ import { FirebaseInit, FirebaseConnector } from '@goatlab/fluent-firebase'
19
+ import { z } from 'zod'
32
20
 
33
- Fluent query interface for Multiple database types and helpers for fast API generation and general App building.
21
+ // Initialize Firebase
22
+ FirebaseInit({
23
+ databaseName: 'your-project-id',
24
+ serviceAccount: './path/to/service-account.json', // optional
25
+ emulator: false // set to true for local development
26
+ })
34
27
 
35
- ## Supported Databases
28
+ // Define your schema
29
+ const UserSchema = z.object({
30
+ id: z.string(),
31
+ name: z.string(),
32
+ email: z.string().email(),
33
+ created: z.date()
34
+ })
36
35
 
37
- 1. Firebase\*
36
+ // Create a repository
37
+ class UserRepository extends FirebaseConnector<User> {
38
+ constructor() {
39
+ super({
40
+ entity: UserEntity, // Your TypeORM-style entity class
41
+ inputSchema: UserSchema,
42
+ outputSchema: UserSchema // optional, defaults to inputSchema
43
+ })
44
+ }
45
+ }
38
46
 
39
- ### Installing
47
+ // Use the repository
48
+ const userRepo = new UserRepository()
40
49
 
41
- To install this package in your project, you can use the following command within your terminal.
50
+ // Insert
51
+ const user = await userRepo.insert({
52
+ name: 'John Doe',
53
+ email: 'john@example.com'
54
+ })
42
55
 
43
- ```bash
44
- yarn add @goatlab/fluent-firebase
56
+ // Query
57
+ const users = await userRepo.findMany({
58
+ where: { email: 'john@example.com' },
59
+ limit: 10,
60
+ orderBy: [{ created: 'desc' }]
61
+ })
62
+
63
+ // Update
64
+ await userRepo.updateById(user.id, { name: 'Jane Doe' })
65
+
66
+ // Delete
67
+ await userRepo.deleteById(user.id)
45
68
  ```
46
69
 
47
- ### Documentation
70
+ ## Key Features
48
71
 
49
- To learn how to use this visit the [Goat Docs](https://docs.goatlab.io/#/0.7.x/fluent/fluent)
72
+ - **Type-safe queries** with TypeScript and Zod schema validation
73
+ - **Fluent query interface** compatible with other Goat Fluent connectors
74
+ - **Complex query support** including AND/OR conditions and multiple operators
75
+ - **Batch operations** for efficient bulk inserts and updates
76
+ - **Relations support** for loading related data
77
+ - **Firebase Emulator support** for local development and testing
78
+ - **Raw access** to Firebase Admin SDK when needed
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@goatlab/fluent-firebase",
3
- "version": "0.7.26",
3
+ "version": "0.7.27",
4
4
  "description": "Readable query Interface & API generator for TS and Node",
5
5
  "dependencies": {
6
6
  "@google-cloud/firestore": "^6.0.0",
7
7
  "firebase-admin": "^11.0.1",
8
8
  "@goatlab/js-utils": "0.8.42",
9
- "@goatlab/fluent": "0.7.42"
9
+ "@goatlab/fluent": "0.7.43"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/jest": "^27.4.1",