@goatlab/fluent-firebase 0.6.16 → 0.7.2
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.
- package/README.md +22 -4
- package/dist/Firebase.d.ts +4 -2
- package/dist/Firebase.js +7 -5
- package/dist/FirebaseConnector.d.ts +29 -34
- package/dist/FirebaseConnector.js +349 -345
- package/dist/test/car.repository.d.ts +8 -0
- package/dist/test/car.repository.js +21 -0
- package/dist/test/goat.repository.d.ts +3 -4
- package/dist/test/goat.repository.js +9 -6
- package/dist/test/roles.repository.d.ts +8 -0
- package/dist/test/roles.repository.js +21 -0
- package/dist/test/roles_user.repository.d.ts +6 -0
- package/dist/test/roles_user.repository.js +15 -0
- package/dist/test/typeOrm.repository.d.ts +5 -0
- package/dist/test/typeOrm.repository.js +15 -0
- package/dist/test/user.repository.d.ts +10 -0
- package/dist/test/user.repository.js +29 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -95
- package/dist/firebaseConnector.http_spec.d.ts +0 -1
- package/dist/firebaseConnector.http_spec.js +0 -37
- package/dist/test/advanced/advancedTestSuite.d.ts +0 -1
- package/dist/test/advanced/advancedTestSuite.js +0 -114
- package/dist/test/advanced/firebase.repository.d.ts +0 -5
- package/dist/test/advanced/firebase.repository.js +0 -12
- package/dist/test/advanced/typeOrm.entity.d.ts +0 -16
- package/dist/test/advanced/typeOrm.entity.js +0 -57
- package/dist/test/basic/basicTestSuite.d.ts +0 -1
- package/dist/test/basic/basicTestSuite.js +0 -45
- package/dist/test/basic/goat.dto.d.ts +0 -8
- package/dist/test/basic/goat.dto.js +0 -18
- package/dist/test/basic/goat.entity.d.ts +0 -10
- package/dist/test/basic/goat.entity.js +0 -41
- package/dist/test/flock.d.ts +0 -4
- package/dist/test/flock.js +0 -25
- package/dist/test/relations/car/car.dto.d.ts +0 -5
- package/dist/test/relations/car/car.dto.js +0 -12
- package/dist/test/relations/car/car.entity.d.ts +0 -7
- package/dist/test/relations/car/car.entity.js +0 -32
- package/dist/test/relations/car/car.repositoryFirebase.d.ts +0 -8
- package/dist/test/relations/car/car.repositoryFirebase.js +0 -13
- package/dist/test/relations/relationsTestsSuite.d.ts +0 -1
- package/dist/test/relations/relationsTestsSuite.js +0 -93
- package/dist/test/relations/roles/role.dto.d.ts +0 -5
- package/dist/test/relations/roles/role.dto.js +0 -12
- package/dist/test/relations/roles/roles.entity.d.ts +0 -6
- package/dist/test/relations/roles/roles.entity.js +0 -29
- package/dist/test/relations/roles/roles.repositoryFirebase.d.ts +0 -8
- package/dist/test/relations/roles/roles.repositoryFirebase.js +0 -14
- package/dist/test/relations/roles/roles_user.dto.d.ts +0 -5
- package/dist/test/relations/roles/roles_user.dto.js +0 -12
- package/dist/test/relations/roles/roles_user.entity.d.ts +0 -5
- package/dist/test/relations/roles/roles_user.entity.js +0 -23
- package/dist/test/relations/roles/roles_users.repositoryFirebase.d.ts +0 -6
- package/dist/test/relations/roles/roles_users.repositoryFirebase.js +0 -11
- package/dist/test/relations/user/user.dto.d.ts +0 -5
- package/dist/test/relations/user/user.dto.js +0 -12
- package/dist/test/relations/user/user.entity.d.ts +0 -14
- package/dist/test/relations/user/user.entity.js +0 -56
- package/dist/test/relations/user/user.repositoryFirebase.d.ts +0 -10
- package/dist/test/relations/user/user.repositoryFirebase.js +0 -16
package/README.md
CHANGED
|
@@ -12,20 +12,38 @@
|
|
|
12
12
|
<img src="https://docs.goatlab.io/logo.png" alt="Logo" width="150" height="150">
|
|
13
13
|
</a>
|
|
14
14
|
|
|
15
|
-
<h3 align="center">GOAT-FLUENT</h3>
|
|
15
|
+
<h3 align="center">GOAT - FLUENT-FIREBASE</h3>
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
18
|
-
|
|
18
|
+
Fluent - Time Saving (TS) utils
|
|
19
19
|
<br />
|
|
20
|
-
<a href="https://docs.goatlab.io/#/0.
|
|
20
|
+
<a href="https://docs.goatlab.io/#/0.7.x/fluent/fluent"><strong>Explore the docs »</strong></a>
|
|
21
21
|
<br />
|
|
22
22
|
<br />
|
|
23
|
-
<a href="https://codesandbox.io/s/goat-nestjs-tytmv?file=/src/main.ts">View Demo</a>
|
|
24
23
|
·
|
|
25
24
|
<a href="https://github.com/goat-io/fluent/issues">Report Bug</a>
|
|
26
25
|
·
|
|
27
26
|
<a href="https://github.com/goat-io/fluent/issues">Request Feature</a>
|
|
28
27
|
</p>
|
|
28
|
+
</p>
|
|
29
29
|
</p>
|
|
30
30
|
|
|
31
31
|
# Goat - Fluent
|
|
32
|
+
|
|
33
|
+
Fluent query interface for Multiple database types and helpers for fast API generation and general App building.
|
|
34
|
+
|
|
35
|
+
## Supported Databases
|
|
36
|
+
|
|
37
|
+
1. Firebase\*
|
|
38
|
+
|
|
39
|
+
### Installing
|
|
40
|
+
|
|
41
|
+
To install this package in your project, you can use the following command within your terminal.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
yarn add @goatlab/fluent-firebase
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Documentation
|
|
48
|
+
|
|
49
|
+
To learn how to use this visit the [Goat Docs](https://docs.goatlab.io/#/0.7.x/fluent/fluent)
|
package/dist/Firebase.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as admin from 'firebase-admin';
|
|
2
2
|
import { getAuth as firebaseGetAuth } from 'firebase-admin/auth';
|
|
3
3
|
export declare type FirebaseUser = admin.auth.DecodedIdToken;
|
|
4
|
-
|
|
4
|
+
declare class FirebaseClass {
|
|
5
5
|
verifyIdToken: (token: string) => Promise<import("firebase-admin/auth").DecodedIdToken>;
|
|
6
6
|
getAuth: typeof firebaseGetAuth;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export declare const Firebase: FirebaseClass;
|
|
9
|
+
export {};
|
package/dist/Firebase.js
CHANGED
|
@@ -4,8 +4,10 @@ exports.Firebase = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const admin = tslib_1.__importStar(require("firebase-admin"));
|
|
6
6
|
const auth_1 = require("firebase-admin/auth");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
7
|
+
class FirebaseClass {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.verifyIdToken = (token) => admin.auth().verifyIdToken(token);
|
|
10
|
+
this.getAuth = auth_1.getAuth;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Firebase = new FirebaseClass();
|
|
@@ -1,41 +1,36 @@
|
|
|
1
1
|
import * as admin from 'firebase-admin';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export declare class FirebaseConnector<ModelDTO =
|
|
13
|
-
private
|
|
2
|
+
import { AnyObject, FluentQuery, LoadedResult, QueryOutput } from '@goatlab/fluent';
|
|
3
|
+
import { BaseConnector, FluentConnectorInterface } from '@goatlab/fluent';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { FindByIdFilter } from '@goatlab/fluent';
|
|
6
|
+
import { SingleQueryOutput } from '@goatlab/fluent';
|
|
7
|
+
export interface FirebaseConnectorParams<Input, Output> {
|
|
8
|
+
entity: any;
|
|
9
|
+
inputSchema: z.ZodType<Input>;
|
|
10
|
+
outputSchema?: z.ZodType<Output>;
|
|
11
|
+
}
|
|
12
|
+
export declare class FirebaseConnector<ModelDTO = AnyObject, InputDTO = ModelDTO, OutputDTO = InputDTO> extends BaseConnector<ModelDTO, InputDTO, OutputDTO> implements FluentConnectorInterface<ModelDTO, InputDTO, OutputDTO> {
|
|
13
|
+
private readonly inputSchema;
|
|
14
|
+
private readonly outputSchema;
|
|
14
15
|
private readonly collection;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
find(filter?: Filter): Promise<OutputDTO[]>;
|
|
20
|
-
paginate(paginator: Paginator): Promise<PaginatedData<OutputDTO>>;
|
|
16
|
+
private readonly entity;
|
|
17
|
+
constructor({ entity, inputSchema, outputSchema }: FirebaseConnectorParams<InputDTO, OutputDTO>);
|
|
18
|
+
insert(data: InputDTO): Promise<OutputDTO>;
|
|
19
|
+
insertMany(data: InputDTO[]): Promise<OutputDTO[]>;
|
|
21
20
|
raw(): admin.firestore.CollectionReference<ModelDTO>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
rawFirebase(): admin.firestore.Firestore;
|
|
22
|
+
protected loadRelatedData(data: any[], loadedKeys: AnyObject): Promise<admin.firestore.DocumentData[]>;
|
|
23
|
+
findMany<T extends FluentQuery<ModelDTO>>(query?: T): Promise<QueryOutput<T, ModelDTO, OutputDTO>>;
|
|
24
|
+
loadFirst(query?: FluentQuery<ModelDTO>): FirebaseConnector<ModelDTO, InputDTO, OutputDTO>;
|
|
25
|
+
private getGeneratedQueries;
|
|
26
|
+
private getFirebaseWhereQuery;
|
|
25
27
|
updateById(id: string, data: InputDTO): Promise<OutputDTO>;
|
|
26
28
|
replaceById(id: string, data: InputDTO): Promise<OutputDTO>;
|
|
27
|
-
clear(
|
|
28
|
-
deleteById(id: string): Promise<string>;
|
|
29
|
-
findById(id: string): Promise<OutputDTO>;
|
|
30
|
-
findByIds(ids: string[]): Promise<OutputDTO[] | null>;
|
|
31
|
-
private getPage;
|
|
32
|
-
private getPaginatorLimit;
|
|
33
|
-
private getPopulate;
|
|
34
|
-
private getGeneratedQuery;
|
|
35
|
-
private getFilters;
|
|
36
|
-
private getOrderBy;
|
|
37
|
-
private getLimit;
|
|
38
|
-
private getSkip;
|
|
39
|
-
private getSelect;
|
|
29
|
+
clear(): Promise<boolean>;
|
|
40
30
|
private deleteQueryBatch;
|
|
31
|
+
loadById(id: string): LoadedResult<this>;
|
|
32
|
+
protected clone(): any;
|
|
33
|
+
findByIds<T extends FindByIdFilter<ModelDTO>>(ids: string[], q?: T): Promise<QueryOutput<T, ModelDTO, OutputDTO>>;
|
|
34
|
+
findById<T extends FindByIdFilter<ModelDTO>>(id: string, q?: T): Promise<SingleQueryOutput<T, ModelDTO, OutputDTO>>;
|
|
35
|
+
requireById(id: string, q?: FindByIdFilter<ModelDTO>): Promise<SingleQueryOutput<FindByIdFilter<ModelDTO>, ModelDTO, OutputDTO>>;
|
|
41
36
|
}
|