@nx-ddd/firestore 20.67.0 → 20.73.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable } from '@angular/core';
|
|
3
|
-
import
|
|
3
|
+
import * as adminFirestore from 'firebase-admin/firestore';
|
|
4
4
|
import { Subject } from 'rxjs';
|
|
5
5
|
import { FirestoreAdapter, provideFirestoreAdapter as provideFirestoreAdapter$1 } from '@nx-ddd/firestore';
|
|
6
6
|
|
|
@@ -25,15 +25,15 @@ function unwrapCollectionLike(collection) {
|
|
|
25
25
|
return collection.__ref;
|
|
26
26
|
}
|
|
27
27
|
class AdminFirestoreAdapter extends FirestoreAdapter {
|
|
28
|
-
firestore =
|
|
28
|
+
firestore = adminFirestore.getFirestore();
|
|
29
29
|
get FieldValue() {
|
|
30
|
-
return
|
|
30
|
+
return adminFirestore.FieldValue;
|
|
31
31
|
}
|
|
32
32
|
get Timestamp() {
|
|
33
|
-
return
|
|
33
|
+
return adminFirestore.Timestamp;
|
|
34
34
|
}
|
|
35
35
|
get FieldPath() {
|
|
36
|
-
return
|
|
36
|
+
return adminFirestore.FieldPath;
|
|
37
37
|
}
|
|
38
38
|
isTimestamp(v) {
|
|
39
39
|
return v instanceof this.Timestamp;
|
|
@@ -43,7 +43,7 @@ class AdminFirestoreAdapter extends FirestoreAdapter {
|
|
|
43
43
|
}
|
|
44
44
|
convertDateToTimestamp(date) {
|
|
45
45
|
if (this.dateAdapter.isDate(date) && this.dateAdapter.isValid(date)) {
|
|
46
|
-
return
|
|
46
|
+
return adminFirestore.Timestamp.fromDate(this.dateAdapter.getJsDate(date));
|
|
47
47
|
}
|
|
48
48
|
throw new Error(`Invalid date: ${date}`);
|
|
49
49
|
}
|
|
@@ -86,10 +86,10 @@ class AdminFirestoreAdapter extends FirestoreAdapter {
|
|
|
86
86
|
batch() {
|
|
87
87
|
return this.firestore.batch();
|
|
88
88
|
}
|
|
89
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
90
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
89
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdminFirestoreAdapter, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
90
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdminFirestoreAdapter });
|
|
91
91
|
}
|
|
92
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AdminFirestoreAdapter, decorators: [{
|
|
93
93
|
type: Injectable
|
|
94
94
|
}] });
|
|
95
95
|
function provideFirestoreAdapter() {
|
|
@@ -93,10 +93,10 @@ class FirebaseFirestoreAdapter extends FirestoreAdapter {
|
|
|
93
93
|
batch() {
|
|
94
94
|
return writeBatch(this.firestore);
|
|
95
95
|
}
|
|
96
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
97
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
96
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirebaseFirestoreAdapter, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
97
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirebaseFirestoreAdapter });
|
|
98
98
|
}
|
|
99
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirebaseFirestoreAdapter, decorators: [{
|
|
100
100
|
type: Injectable
|
|
101
101
|
}], ctorParameters: () => [{ type: undefined }] });
|
|
102
102
|
|
|
@@ -56,10 +56,10 @@ class DateAdapter {
|
|
|
56
56
|
convertToDate(value) {
|
|
57
57
|
return value;
|
|
58
58
|
}
|
|
59
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
60
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
59
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DateAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
60
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DateAdapter, providedIn: 'root' });
|
|
61
61
|
}
|
|
62
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DateAdapter, decorators: [{
|
|
63
63
|
type: Injectable,
|
|
64
64
|
args: [{ providedIn: 'root' }]
|
|
65
65
|
}] });
|
|
@@ -80,10 +80,10 @@ class DayjsAdapter {
|
|
|
80
80
|
convertToDayjs(value) {
|
|
81
81
|
return dayjs(value);
|
|
82
82
|
}
|
|
83
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
84
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
83
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DayjsAdapter, deps: [{ token: DateAdapter }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
84
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DayjsAdapter, providedIn: 'root' });
|
|
85
85
|
}
|
|
86
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
86
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: DayjsAdapter, decorators: [{
|
|
87
87
|
type: Injectable,
|
|
88
88
|
args: [{ providedIn: 'root' }]
|
|
89
89
|
}], ctorParameters: () => [{ type: DateAdapter }] });
|
|
@@ -472,10 +472,10 @@ class FirestoreQuery extends BaseFirestoreQuery {
|
|
|
472
472
|
get dao() {
|
|
473
473
|
return new FirestoreDAO(this.adapter, this.pathBuilder);
|
|
474
474
|
}
|
|
475
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
476
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
475
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirestoreQuery, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
476
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirestoreQuery });
|
|
477
477
|
}
|
|
478
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirestoreQuery, decorators: [{
|
|
479
479
|
type: Injectable
|
|
480
480
|
}] });
|
|
481
481
|
function getFirestoreQuery(entity, adapter = inject(FirestoreAdapter)) {
|
|
@@ -585,10 +585,10 @@ class CachedFirestoreQuery extends FirestoreQuery {
|
|
|
585
585
|
local: this.listChanges().pipe(map$1(items => items.length)),
|
|
586
586
|
});
|
|
587
587
|
}
|
|
588
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
589
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
588
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: CachedFirestoreQuery, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
589
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: CachedFirestoreQuery });
|
|
590
590
|
}
|
|
591
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
591
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: CachedFirestoreQuery, decorators: [{
|
|
592
592
|
type: Injectable
|
|
593
593
|
}] });
|
|
594
594
|
|
|
@@ -756,10 +756,10 @@ class FirestoreRepository extends BaseFirestoreRepository {
|
|
|
756
756
|
get pathBuilder() {
|
|
757
757
|
return pathBuilderFactory(this.collectionPath);
|
|
758
758
|
}
|
|
759
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
760
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
759
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirestoreRepository, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
760
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirestoreRepository });
|
|
761
761
|
}
|
|
762
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
762
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FirestoreRepository, decorators: [{
|
|
763
763
|
type: Injectable
|
|
764
764
|
}] });
|
|
765
765
|
function getFirestoreRepository(entity, adapter = inject(FirestoreAdapter)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/firestore",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.73.0",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"homepage": "https://github.com/xx-machina/plaform/tree/main/packages/@nx-ddd/firestore",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"url": "https://github.com/xx-machina/plaform.git"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@nx-ddd/common": "20.
|
|
13
|
-
"@nx-ddd/core": "20.
|
|
12
|
+
"@nx-ddd/common": "20.73.0",
|
|
13
|
+
"@nx-ddd/core": "20.73.0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"tslib": "^2.3.0"
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as adminFirestore from 'firebase-admin/firestore';
|
|
2
2
|
import { DocumentData, Transaction } from 'firebase-admin/firestore';
|
|
3
3
|
import { CollectionReference as CollectionReference$1, CollectionGroup as CollectionGroup$1, Query as Query$1, FirestoreAdapter, DocumentReference, QueryFn as QueryFn$1, WhereFilterOp } from '@nx-ddd/firestore';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
|
|
6
|
-
type CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionReference$1<AppModelType, DbModelType,
|
|
7
|
-
type CollectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionGroup$1<AppModelType, DbModelType,
|
|
8
|
-
type Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = Query$1<AppModelType, DbModelType,
|
|
9
|
-
type QueryFn<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = QueryFn$1<AppModelType, DbModelType,
|
|
10
|
-
type Origin<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> =
|
|
6
|
+
type CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionReference$1<AppModelType, DbModelType, adminFirestore.CollectionReference<AppModelType, DbModelType>>;
|
|
7
|
+
type CollectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionGroup$1<AppModelType, DbModelType, adminFirestore.CollectionGroup<AppModelType, DbModelType>>;
|
|
8
|
+
type Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = Query$1<AppModelType, DbModelType, adminFirestore.Query<AppModelType, DbModelType>>;
|
|
9
|
+
type QueryFn<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = QueryFn$1<AppModelType, DbModelType, adminFirestore.Query>;
|
|
10
|
+
type Origin<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = adminFirestore.CollectionReference<AppModelType, DbModelType> | adminFirestore.CollectionGroup<AppModelType, DbModelType> | adminFirestore.Query<AppModelType, DbModelType>;
|
|
11
11
|
type CollectionLike<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionReference<AppModelType, DbModelType> | CollectionGroup<AppModelType, DbModelType> | Query<AppModelType, DbModelType>;
|
|
12
|
-
type InferCollectionLike<O extends Origin> = O extends
|
|
12
|
+
type InferCollectionLike<O extends Origin> = O extends adminFirestore.CollectionReference<infer A, infer B> ? CollectionReference<A, B> : O extends adminFirestore.CollectionGroup<infer A, infer B> ? CollectionGroup<A, B> : O extends adminFirestore.Query<infer A, infer B> ? Query<A, B> : never;
|
|
13
13
|
declare function wrapCollectionLike<O extends Origin>(origin: O): InferCollectionLike<O>;
|
|
14
14
|
declare function unwrapCollectionLike<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collection: CollectionLike<AppModelType, DbModelType>): Origin<AppModelType, DbModelType>;
|
|
15
15
|
declare class AdminFirestoreAdapter<Date> extends FirestoreAdapter<Date> {
|
|
16
|
-
protected firestore:
|
|
17
|
-
get FieldValue(): typeof
|
|
18
|
-
get Timestamp(): typeof
|
|
19
|
-
get FieldPath(): typeof
|
|
20
|
-
protected isTimestamp(v: any): v is
|
|
21
|
-
protected isFieldValue(v: any): v is
|
|
22
|
-
convertDateToTimestamp(date: Date):
|
|
23
|
-
doc(path: string): DocumentReference<any,
|
|
16
|
+
protected firestore: adminFirestore.Firestore;
|
|
17
|
+
get FieldValue(): typeof adminFirestore.FieldValue;
|
|
18
|
+
get Timestamp(): typeof adminFirestore.Timestamp;
|
|
19
|
+
get FieldPath(): typeof adminFirestore.FieldPath;
|
|
20
|
+
protected isTimestamp(v: any): v is adminFirestore.Timestamp;
|
|
21
|
+
protected isFieldValue(v: any): v is adminFirestore.FieldValue;
|
|
22
|
+
convertDateToTimestamp(date: Date): adminFirestore.Timestamp;
|
|
23
|
+
doc(path: string): DocumentReference<any, adminFirestore.DocumentReference>;
|
|
24
24
|
collection<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(path: string): CollectionReference<AppModelType, DbModelType>;
|
|
25
25
|
collectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collectionId: string): CollectionGroup<AppModelType, DbModelType>;
|
|
26
26
|
runTransaction<T>(updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
|
|
@@ -28,7 +28,7 @@ declare class AdminFirestoreAdapter<Date> extends FirestoreAdapter<Date> {
|
|
|
28
28
|
where<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(key: string, evaluation: WhereFilterOp, value: unknown): QueryFn<AppModelType, DbModelType>;
|
|
29
29
|
orderBy<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(key: string, order?: 'asc' | 'desc'): QueryFn<AppModelType, DbModelType>;
|
|
30
30
|
limit<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(n: number): QueryFn<AppModelType, DbModelType>;
|
|
31
|
-
batch():
|
|
31
|
+
batch(): adminFirestore.WriteBatch;
|
|
32
32
|
static ɵfac: i0.ɵɵFactoryDeclaration<AdminFirestoreAdapter<any>, never>;
|
|
33
33
|
static ɵprov: i0.ɵɵInjectableDeclaration<AdminFirestoreAdapter<any>>;
|
|
34
34
|
}
|