@nx-ddd/firestore 4.21.1 → 5.0.0
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/adapters/base/base.adapter.d.ts +1 -1
- package/decorators/decorators.d.ts +1 -1
- package/interfaces/interfaces.d.ts +3 -3
- package/package.json +22 -13
- package/path-builder/path-builder.d.ts +2 -2
- package/query/firestore.query.d.ts +1 -1
- package/query/firestore.query.js +6 -6
- package/query/firestore.query.js.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FirestoreCollection, FirestoreCollectionGroup, FirestoreDocument, ToFirestoreData, Timestamp } from '../../interfaces';
|
|
2
|
-
export
|
|
2
|
+
export type QueryFn<Data> = (collection?: any) => any;
|
|
3
3
|
export declare abstract class FirestoreAdapter<Date = any> {
|
|
4
4
|
protected abstract isTimestamp: (v: any) => v is Timestamp;
|
|
5
5
|
protected abstract isDate(v: any): v is Date;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const FIRESTORE_ANNOTATIONS = "firestore_annotations";
|
|
2
|
-
export
|
|
2
|
+
export type FirestoreFieldType = 'boolean' | 'number' | 'timestamp' | 'string' | 'geopoint' | 'null' | 'map' | 'array' | 'reference';
|
|
3
3
|
export interface FirestoreAnnotation {
|
|
4
4
|
type: FirestoreFieldType;
|
|
5
5
|
fieldName: string;
|
|
@@ -32,8 +32,8 @@ export interface TimestampConstructor {
|
|
|
32
32
|
fromDate(date: Date): Timestamp;
|
|
33
33
|
fromMillis(milliseconds: number): Timestamp;
|
|
34
34
|
}
|
|
35
|
-
export
|
|
36
|
-
export
|
|
35
|
+
export type FieldValue = any;
|
|
36
|
+
export type ToFirestoreData<Entity, Date> = {
|
|
37
37
|
[K in keyof Entity]: Entity[K] extends Date ? Timestamp | FieldValue : Entity[K];
|
|
38
38
|
};
|
|
39
39
|
export interface DocumentReference<DocumentData, OriginalReference = any> {
|
|
@@ -44,7 +44,7 @@ export interface DocumentReference<DocumentData, OriginalReference = any> {
|
|
|
44
44
|
delete(): Promise<void | any>;
|
|
45
45
|
stateChanges?: () => Observable<DocumentSnapshot<DocumentData>>;
|
|
46
46
|
}
|
|
47
|
-
export
|
|
47
|
+
export type FirestoreDocument<DocumentData> = DocumentReference<DocumentData>;
|
|
48
48
|
export interface FirestoreCollection<DocumentData, RawFirestoreCollection = any> {
|
|
49
49
|
__ref?: RawFirestoreCollection;
|
|
50
50
|
stateChanges?: () => Observable<DocumentChangeAction<DocumentData>[]>;
|
package/package.json
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/firestore",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@angular/animations": "15.2.3",
|
|
8
|
+
"@angular/common": "15.2.3",
|
|
9
|
+
"@angular/compiler": "15.2.3",
|
|
10
|
+
"@angular/core": "15.2.3",
|
|
11
|
+
"@angular/fire": "7.5.0",
|
|
12
|
+
"@angular/platform-browser": "15.2.3",
|
|
13
|
+
"@angular/platform-browser-dynamic": "15.2.3",
|
|
14
|
+
"dayjs": "1.10.7",
|
|
15
|
+
"firebase": "9.8.2",
|
|
16
|
+
"firebase-admin": "9.7.0",
|
|
17
|
+
"injection-js": "2.4.0",
|
|
18
|
+
"lodash.camelcase": "4.3.0",
|
|
19
|
+
"lodash.pick": "4.4.0",
|
|
20
|
+
"reflect-metadata": "0.1.13",
|
|
10
21
|
"rxjs": "7.5.0",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"lodash.camelcase": "^4.3.0",
|
|
18
|
-
"tslib": "^2.0.0"
|
|
22
|
+
"zone.js": "0.12.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@nx-ddd/common": "5.0.0",
|
|
26
|
+
"@nx-ddd/core": "5.0.0",
|
|
27
|
+
"tslib": "2.5.0"
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
type CollectionParamMap<Entity extends {
|
|
2
2
|
id: string;
|
|
3
3
|
}> = Partial<Entity>;
|
|
4
|
-
|
|
4
|
+
type DocParamMap<Entity extends {
|
|
5
5
|
id: string;
|
|
6
6
|
}> = CollectionParamMap<Entity> & Pick<Entity, 'id'>;
|
|
7
7
|
export declare class FirestorePathBuilder<Entity extends {
|
|
@@ -5,7 +5,7 @@ import { FirestoreConverter } from '../converter';
|
|
|
5
5
|
import { FirestoreDAO } from '../dao';
|
|
6
6
|
import { FirestorePathBuilder } from '../path-builder';
|
|
7
7
|
import { FirestoreCollection, FirestoreCollectionGroup, ToFirestoreData } from '../interfaces';
|
|
8
|
-
|
|
8
|
+
type CollectionRef<D> = FirestoreCollection<D> | FirestoreCollectionGroup<D>;
|
|
9
9
|
export declare class FirestoreQuery<Entity extends {
|
|
10
10
|
id: string;
|
|
11
11
|
} = any, FirestoreData = ToFirestoreData<Entity, dayjs.Dayjs>> extends FirestoreDAO<Entity, FirestoreData> {
|
package/query/firestore.query.js
CHANGED
|
@@ -5,12 +5,6 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const dao_1 = require("../dao");
|
|
7
7
|
class FirestoreQuery extends dao_1.FirestoreDAO {
|
|
8
|
-
constructor(adapter, converter, pathBuilder) {
|
|
9
|
-
super(adapter, converter);
|
|
10
|
-
this.pathBuilder = pathBuilder;
|
|
11
|
-
this.collection$ = new rxjs_1.ReplaySubject(1);
|
|
12
|
-
this.switchCollection();
|
|
13
|
-
}
|
|
14
8
|
switchCollection(paramMap) {
|
|
15
9
|
const collectionRef = paramMap ? this.collection(paramMap) : this.collectionGroup();
|
|
16
10
|
this.collection$.next(collectionRef);
|
|
@@ -19,6 +13,12 @@ class FirestoreQuery extends dao_1.FirestoreDAO {
|
|
|
19
13
|
var _a;
|
|
20
14
|
return (_a = this._list$) !== null && _a !== void 0 ? _a : (this._list$ = this.collection$.pipe((0, operators_1.switchMap)((collection) => this._listChanges(collection)), (0, operators_1.shareReplay)(1)));
|
|
21
15
|
}
|
|
16
|
+
constructor(adapter, converter, pathBuilder) {
|
|
17
|
+
super(adapter, converter);
|
|
18
|
+
this.pathBuilder = pathBuilder;
|
|
19
|
+
this.collection$ = new rxjs_1.ReplaySubject(1);
|
|
20
|
+
this.switchCollection();
|
|
21
|
+
}
|
|
22
22
|
listChanges(paramMap) {
|
|
23
23
|
this.switchCollection(paramMap);
|
|
24
24
|
return this.list$;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.query.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/query/firestore.query.ts"],"names":[],"mappings":";;;AACA,+BAAiD;AACjD,8CAA8F;AAG9F,gCAAsC;AAMtC,MAAa,cAGX,SAAQ,kBAAmC;
|
|
1
|
+
{"version":3,"file":"firestore.query.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/query/firestore.query.ts"],"names":[],"mappings":";;;AACA,+BAAiD;AACjD,8CAA8F;AAG9F,gCAAsC;AAMtC,MAAa,cAGX,SAAQ,kBAAmC;IAG3C,gBAAgB,CAAC,QAA0B;QACzC,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;QACpF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IACtC,CAAC;IAED,IAAc,KAAK;;QACjB,aAAO,IAAI,CAAC,MAAM,oCAAX,IAAI,CAAC,MAAM,GAAK,IAAI,C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