@nx-ddd/firestore 16.2.0 → 17.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/README.md +76 -6
- package/adapters/admin/admin.adapter.d.ts +16 -12
- package/adapters/admin/admin.adapter.js +25 -23
- package/adapters/admin/admin.adapter.js.map +1 -1
- package/adapters/admin/index.js +1 -4
- package/adapters/admin/index.js.map +1 -1
- package/adapters/base/base.adapter.d.ts +8 -4
- package/adapters/base/base.adapter.js +80 -51
- package/adapters/base/base.adapter.js.map +1 -1
- package/adapters/base/index.js +1 -4
- package/adapters/base/index.js.map +1 -1
- package/adapters/firebase/firebase.adapter.d.ts +2 -2
- package/adapters/firebase/firebase.adapter.js +43 -41
- package/adapters/firebase/firebase.adapter.js.map +1 -1
- package/adapters/firebase/index.js +1 -4
- package/adapters/firebase/index.js.map +1 -1
- package/adapters/index.d.ts +0 -2
- package/adapters/index.js +1 -6
- package/adapters/index.js.map +1 -1
- package/converter/converter.d.ts +18 -12
- package/converter/converter.js +14 -28
- package/converter/converter.js.map +1 -1
- package/converter/index.js +1 -4
- package/converter/index.js.map +1 -1
- package/dao/firestore.dao.js +1 -5
- package/dao/firestore.dao.js.map +1 -1
- package/dao/index.js +1 -4
- package/dao/index.js.map +1 -1
- package/decorators/decorators.d.ts +4 -4
- package/decorators/decorators.js +26 -33
- package/decorators/decorators.js.map +1 -1
- package/decorators/index.js +1 -4
- package/decorators/index.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +7 -9
- package/index.js.map +1 -1
- package/interfaces/index.js +1 -4
- package/interfaces/index.js.map +1 -1
- package/interfaces/interfaces.js +1 -2
- package/interfaces/interfaces.js.map +1 -1
- package/package.json +17 -9
- package/path-builder/index.js +1 -4
- package/path-builder/index.js.map +1 -1
- package/path-builder/path-builder.js +7 -14
- package/path-builder/path-builder.js.map +1 -1
- package/query/firestore.query.d.ts +8 -3
- package/query/firestore.query.js +37 -17
- package/query/firestore.query.js.map +1 -1
- package/query/index.js +1 -4
- package/query/index.js.map +1 -1
- package/repository/index.d.ts +0 -1
- package/repository/index.js +1 -5
- package/repository/index.js.map +1 -1
- package/repository/repository.d.ts +12 -14
- package/repository/repository.js +26 -24
- package/repository/repository.js.map +1 -1
- package/testing/common.d.ts +1 -0
- package/testing/common.js +15 -15
- package/testing/common.js.map +1 -1
- package/testing/index.d.ts +0 -2
- package/testing/index.js +1 -6
- package/testing/index.js.map +1 -1
- package/repository/decorator.d.ts +0 -8
- package/repository/decorator.js +0 -41
- package/repository/decorator.js.map +0 -1
- package/testing/domain.d.ts +0 -12
- package/testing/domain.js +0 -22
- package/testing/domain.js.map +0 -1
- package/testing/repository.d.ts +0 -6
- package/testing/repository.js +0 -24
- package/testing/repository.js.map +0 -1
|
@@ -1,102 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class FirebaseFirestoreAdapter extends base_1.FirestoreAdapter {
|
|
10
|
-
constructor(firestore = (0, firestore_1.getFirestore)()) {
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { doc, collection, collectionGroup, FieldValue, Timestamp, setDoc, getDoc, getDocs, getFirestore, onSnapshot, deleteDoc, writeBatch, query, orderBy, limit, updateDoc, where, FieldPath } from 'firebase/firestore';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import { Subject } from 'rxjs';
|
|
5
|
+
import { FirestoreAdapter } from '../base';
|
|
6
|
+
import { Injectable } from '@angular/core';
|
|
7
|
+
let FirebaseFirestoreAdapter = class FirebaseFirestoreAdapter extends FirestoreAdapter {
|
|
8
|
+
constructor(firestore = getFirestore()) {
|
|
11
9
|
super();
|
|
12
10
|
this.firestore = firestore;
|
|
13
11
|
}
|
|
14
12
|
get FieldValue() {
|
|
15
|
-
return
|
|
13
|
+
return FieldValue;
|
|
16
14
|
}
|
|
17
15
|
get Timestamp() {
|
|
18
|
-
return
|
|
16
|
+
return Timestamp;
|
|
19
17
|
}
|
|
20
18
|
get FieldPath() {
|
|
21
|
-
return new
|
|
19
|
+
return new FieldPath();
|
|
22
20
|
}
|
|
23
21
|
isTimestamp(v) {
|
|
24
|
-
return v instanceof
|
|
22
|
+
return v instanceof Timestamp;
|
|
25
23
|
}
|
|
26
24
|
isFieldValue(v) {
|
|
27
25
|
return v instanceof this.FieldValue;
|
|
28
26
|
}
|
|
29
27
|
isDate(v) {
|
|
30
|
-
return
|
|
28
|
+
return dayjs.isDayjs(v);
|
|
31
29
|
}
|
|
32
30
|
convertDateToTimestamp(date) {
|
|
33
|
-
return
|
|
31
|
+
return Timestamp.fromDate(date.toDate());
|
|
34
32
|
}
|
|
35
33
|
convertTimestampToDate(timestamp) {
|
|
36
|
-
return (
|
|
34
|
+
return dayjs(timestamp.toDate());
|
|
37
35
|
}
|
|
38
36
|
doc(path) {
|
|
39
|
-
const docRef =
|
|
37
|
+
const docRef = doc(this.firestore, path);
|
|
40
38
|
return {
|
|
41
39
|
__ref: docRef,
|
|
42
|
-
exists: () =>
|
|
43
|
-
set: (data) =>
|
|
44
|
-
get: () =>
|
|
45
|
-
update: (data) =>
|
|
46
|
-
delete: () =>
|
|
40
|
+
exists: () => getDoc(docRef).then(doc => doc.exists()),
|
|
41
|
+
set: (data) => setDoc(docRef, data),
|
|
42
|
+
get: () => getDoc(docRef),
|
|
43
|
+
update: (data) => updateDoc(docRef, data),
|
|
44
|
+
delete: () => deleteDoc(docRef),
|
|
47
45
|
stateChanges: () => {
|
|
48
|
-
const subject = new
|
|
49
|
-
|
|
46
|
+
const subject = new Subject();
|
|
47
|
+
onSnapshot(docRef, (doc) => subject.next({ id: doc.id, ref: doc.ref, data: () => doc.data() }));
|
|
50
48
|
return subject.asObservable();
|
|
51
49
|
},
|
|
52
50
|
};
|
|
53
51
|
}
|
|
54
52
|
collection(path) {
|
|
55
|
-
const ref =
|
|
53
|
+
const ref = collection(this.firestore, path);
|
|
56
54
|
return {
|
|
57
55
|
__ref: ref,
|
|
58
56
|
stateChanges: () => {
|
|
59
|
-
const subject = new
|
|
60
|
-
|
|
57
|
+
const subject = new Subject();
|
|
58
|
+
onSnapshot(ref, (snapshot) => subject.next(snapshot.docChanges().map(change => ({
|
|
61
59
|
type: change.type, payload: { doc: change.doc },
|
|
62
60
|
}))));
|
|
63
61
|
return subject.asObservable();
|
|
64
62
|
},
|
|
65
|
-
get: () =>
|
|
63
|
+
get: () => getDocs(ref),
|
|
66
64
|
};
|
|
67
65
|
}
|
|
68
66
|
collectionGroup(collectionId) {
|
|
69
|
-
const ref =
|
|
67
|
+
const ref = collectionGroup(this.firestore, collectionId);
|
|
70
68
|
return {
|
|
71
69
|
__ref: ref,
|
|
72
70
|
stateChanges: () => {
|
|
73
|
-
const subject = new
|
|
74
|
-
|
|
71
|
+
const subject = new Subject();
|
|
72
|
+
onSnapshot(ref, (snapshot) => subject.next(snapshot.docChanges().map(change => ({
|
|
75
73
|
type: change.type, payload: { doc: change.doc },
|
|
76
74
|
}))));
|
|
77
75
|
return subject.asObservable();
|
|
78
76
|
},
|
|
79
|
-
get: () =>
|
|
77
|
+
get: () => getDocs(ref),
|
|
80
78
|
};
|
|
81
79
|
}
|
|
82
80
|
runTransaction() {
|
|
83
81
|
return;
|
|
84
82
|
}
|
|
85
83
|
query(collection, ...queryFnArray) {
|
|
86
|
-
return
|
|
84
|
+
return query(collection.__ref, ...queryFnArray.map(queryFn => queryFn()));
|
|
87
85
|
}
|
|
88
86
|
where(fieldPath, opStr, value) {
|
|
89
|
-
return () =>
|
|
87
|
+
return () => where(fieldPath, opStr, value);
|
|
90
88
|
}
|
|
91
89
|
orderBy(key, order = 'asc') {
|
|
92
|
-
return () =>
|
|
90
|
+
return () => orderBy(key, order);
|
|
93
91
|
}
|
|
94
92
|
limit(n) {
|
|
95
|
-
return () =>
|
|
93
|
+
return () => limit(n);
|
|
96
94
|
}
|
|
97
95
|
batch() {
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
96
|
+
return writeBatch(this.firestore);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
FirebaseFirestoreAdapter = __decorate([
|
|
100
|
+
Injectable(),
|
|
101
|
+
__metadata("design:paramtypes", [Object])
|
|
102
|
+
], FirebaseFirestoreAdapter);
|
|
103
|
+
export { FirebaseFirestoreAdapter };
|
|
102
104
|
//# sourceMappingURL=firebase.adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.adapter.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/firestore/src/lib/adapters/firebase/firebase.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firebase.adapter.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/firestore/src/lib/adapters/firebase/firebase.adapter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3N,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAA0B,MAAM,SAAS,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGpC,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,gBAA6B;IAEzE,YAAmB,YAAY,YAAY,EAAE;QAAI,KAAK,EAAE,CAAA;QAArC,cAAS,GAAT,SAAS,CAAiB;IAAY,CAAC;IAE1D,IAAI,UAAU;QACZ,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,I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CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBAC9E,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAC;iBAC9C,CAAC,CAAC,CAAC,CAAC,CAAC;gBACN,OAAO,OAAO,CAAC,YAAY,EAAE,CAAC;YAChC,CAAC;YACD,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;SACxB,CAAA;IACH,CAAC;IAED,cAAc;QACZ,OAAM;IACR,CAAC;IAED,KAAK,CAAO,UAAqC,EAAE,GAAG,YAA6B;QACjF,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,CAAO,SAAiB,EAAE,KAAoB,EAAE,KAAc;QACjE,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,CAAO,GAAW,EAAE,QAAwB,KAAK;QACtD,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAO,CAAS;QACnB,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,KAAK;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AA1GY,wBAAwB;IADpC,UAAU,EAAE;;GACA,wBAAwB,CA0GpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/firestore/src/lib/adapters/firebase/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/firestore/src/lib/adapters/firebase/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
package/adapters/index.d.ts
CHANGED
package/adapters/index.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./admin"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./base"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./firebase"), exports);
|
|
1
|
+
export * from './base';
|
|
7
2
|
//# sourceMappingURL=index.js.map
|
package/adapters/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/adapters/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
package/converter/converter.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { Dayjs } from 'dayjs';
|
|
2
1
|
import { FirestoreAdapter } from '../adapters/base';
|
|
3
|
-
import { DocumentSnapshot
|
|
4
|
-
export interface IFirestoreConverter<Entity
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { DocumentSnapshot } from '../interfaces';
|
|
3
|
+
export interface IFirestoreConverter<Entity extends {
|
|
4
|
+
id: string;
|
|
5
|
+
}> {
|
|
6
|
+
fromFirestore(doc: DocumentSnapshot<object>): Entity;
|
|
7
|
+
toFirestore(entity: Partial<Entity>): object;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
declare class BasicConverter<E extends {
|
|
10
|
+
id: string;
|
|
11
|
+
}> {
|
|
12
|
+
protected readonly Entity: new () => E;
|
|
13
|
+
protected readonly adapter: FirestoreAdapter;
|
|
14
|
+
constructor(Entity: new () => E, adapter: FirestoreAdapter);
|
|
15
|
+
fromFirestore(doc: DocumentSnapshot<any>): E;
|
|
16
|
+
toFirestore(entity: E): object;
|
|
14
17
|
}
|
|
15
|
-
export declare function
|
|
18
|
+
export declare function injectConverter<Entity extends {
|
|
19
|
+
id: string;
|
|
20
|
+
}>(Entity: new () => Entity): BasicConverter<Entity>;
|
|
21
|
+
export {};
|
package/converter/converter.js
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let FirestoreConverter = exports.FirestoreConverter = class FirestoreConverter {
|
|
9
|
-
get fields() {
|
|
10
|
-
const annotations = this.Entity[decorators_1.FIRESTORE_ANNOTATIONS];
|
|
11
|
-
return annotations.map(a => a.fieldName);
|
|
1
|
+
import { inject } from '@angular/core';
|
|
2
|
+
import { plainToInstanceWithValid } from '@nx-ddd/core/util';
|
|
3
|
+
import { FirestoreAdapter } from '../adapters/base';
|
|
4
|
+
class BasicConverter {
|
|
5
|
+
constructor(Entity, adapter) {
|
|
6
|
+
this.Entity = Entity;
|
|
7
|
+
this.adapter = adapter;
|
|
12
8
|
}
|
|
13
9
|
fromFirestore(doc) {
|
|
14
|
-
|
|
10
|
+
const data = this.adapter.fromFirestore(Object.assign(Object.assign({}, doc.data()), { id: doc.id }), this.Entity);
|
|
11
|
+
return plainToInstanceWithValid(this.Entity, data);
|
|
15
12
|
}
|
|
16
13
|
toFirestore(entity) {
|
|
17
|
-
|
|
18
|
-
return (0, lodash_pick_1.default)(data, this.fields);
|
|
14
|
+
return this.adapter.toFirestore(entity, this.Entity);
|
|
19
15
|
}
|
|
20
|
-
};
|
|
21
|
-
exports.FirestoreConverter = FirestoreConverter = tslib_1.__decorate([
|
|
22
|
-
(0, core_1.Injectable)()
|
|
23
|
-
], FirestoreConverter);
|
|
24
|
-
function createConverter(Entity, adapter) {
|
|
25
|
-
class Converter extends FirestoreConverter {
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
this.Entity = Entity;
|
|
29
|
-
this.adapter = adapter;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return new Converter();
|
|
33
16
|
}
|
|
34
|
-
|
|
17
|
+
export function injectConverter(Entity) {
|
|
18
|
+
const adapter = inject(FirestoreAdapter);
|
|
19
|
+
return new BasicConverter(Entity, adapter);
|
|
20
|
+
}
|
|
35
21
|
//# sourceMappingURL=converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/converter/converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/converter/converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAQpD,MAAM,cAAc;IAClB,YACqB,MAAmB,EACnB,OAAyB;QADzB,WAAM,GAAN,MAAM,CAAa;QACnB,YAAO,GAAP,OAAO,CAAkB;IAC1C,CAAC;IAEL,aAAa,CAAC,GAA0B;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,iCAClC,GAAG,CAAC,IAAI,EAAE,KACb,EAAE,EAAE,GAAG,CAAC,EAAE,KACT,IAAI,CAAC,MAAM,CAAC,CAAC;QAChB,OAAO,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,WAAW,CAAC,MAAS;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;CACF;AAED,MAAM,UAAU,eAAe,CAC7B,MAAwB;IAExB,MAAM,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACzC,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC"}
|
package/converter/index.js
CHANGED
package/converter/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/converter/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/converter/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/dao/firestore.dao.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FirestoreDAO = void 0;
|
|
4
|
-
class FirestoreDAO {
|
|
1
|
+
export class FirestoreDAO {
|
|
5
2
|
constructor(adapter) {
|
|
6
3
|
this.adapter = adapter;
|
|
7
4
|
}
|
|
@@ -21,5 +18,4 @@ class FirestoreDAO {
|
|
|
21
18
|
return paramMap ? this.collection(paramMap) : this.collectionGroup();
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
exports.FirestoreDAO = FirestoreDAO;
|
|
25
21
|
//# sourceMappingURL=firestore.dao.js.map
|
package/dao/firestore.dao.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.dao.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/dao/firestore.dao.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firestore.dao.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/dao/firestore.dao.ts"],"names":[],"mappings":"AAMA,MAAM,OAAgB,YAAY;IAMhC,YACY,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;IACjC,CAAC;IAEL,UAAU,CAAC,QAA0B;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAgB,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,eAAe;QACb,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAgB,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED,GAAG,CAAC,QAAwC;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAgB,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,aAAa,CAAC,QAA0B;QACtC,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IACvE,CAAC;CACF"}
|
package/dao/index.js
CHANGED
package/dao/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/dao/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/dao/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -28,10 +28,10 @@ export declare const Timestamp: (props?: {
|
|
|
28
28
|
export declare const Number: (props?: {
|
|
29
29
|
name?: string;
|
|
30
30
|
}) => (target: any, propName: string) => void;
|
|
31
|
-
export declare const Map: (childType
|
|
31
|
+
export declare const Map: (childType?: () => any, props?: {
|
|
32
32
|
name?: string;
|
|
33
33
|
}) => (target: any, propName: string) => void;
|
|
34
|
-
export declare const Array: (childType
|
|
34
|
+
export declare const Array: (childType?: () => any, props?: {
|
|
35
35
|
name?: string;
|
|
36
36
|
}) => (target: any, propName: string) => void;
|
|
37
37
|
export declare const Reference: (props?: {
|
|
@@ -59,10 +59,10 @@ export declare class Firestore {
|
|
|
59
59
|
static Number: (props?: {
|
|
60
60
|
name?: string;
|
|
61
61
|
}) => (target: any, propName: string) => void;
|
|
62
|
-
static Map: (childType
|
|
62
|
+
static Map: (childType?: () => any, props?: {
|
|
63
63
|
name?: string;
|
|
64
64
|
}) => (target: any, propName: string) => void;
|
|
65
|
-
static Array: (childType
|
|
65
|
+
static Array: (childType?: () => any, props?: {
|
|
66
66
|
name?: string;
|
|
67
67
|
}) => (target: any, propName: string) => void;
|
|
68
68
|
static Reference: (props?: {
|
package/decorators/decorators.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Firestore = exports.Reference = exports.Array = exports.Map = exports.Number = exports.Timestamp = exports.Boolean = exports.Geopoint = exports.Null = exports.String = exports.ID = exports.getFirestoreAnnotations = exports.FIRESTORE_ANNOTATIONS = void 0;
|
|
4
|
-
exports.FIRESTORE_ANNOTATIONS = 'firestore_annotations';
|
|
1
|
+
export const FIRESTORE_ANNOTATIONS = 'firestore_annotations';
|
|
5
2
|
;
|
|
6
3
|
function createDecorator(type, options = {}) {
|
|
7
4
|
return (props) => {
|
|
@@ -10,39 +7,35 @@ function createDecorator(type, options = {}) {
|
|
|
10
7
|
var _b;
|
|
11
8
|
const fieldName = (props === null || props === void 0 ? void 0 : props.name) || propName;
|
|
12
9
|
const ANNOTATION = { type, fieldName, propName, childType: options.childType };
|
|
13
|
-
(_a = (_b = target.constructor)[
|
|
14
|
-
target.constructor[
|
|
10
|
+
(_a = (_b = target.constructor)[FIRESTORE_ANNOTATIONS]) !== null && _a !== void 0 ? _a : (_b[FIRESTORE_ANNOTATIONS] = []);
|
|
11
|
+
target.constructor[FIRESTORE_ANNOTATIONS].push(ANNOTATION);
|
|
15
12
|
};
|
|
16
13
|
};
|
|
17
14
|
}
|
|
18
|
-
function getFirestoreAnnotations(target) {
|
|
15
|
+
export function getFirestoreAnnotations(target) {
|
|
19
16
|
var _a;
|
|
20
|
-
return (_a = target[
|
|
17
|
+
return (_a = target[FIRESTORE_ANNOTATIONS]) !== null && _a !== void 0 ? _a : [];
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
exports.Array = Array;
|
|
34
|
-
exports.Reference = createDecorator('reference');
|
|
35
|
-
class Firestore {
|
|
19
|
+
export const ID = createDecorator('id');
|
|
20
|
+
export const String = createDecorator('string');
|
|
21
|
+
export const Null = createDecorator('null');
|
|
22
|
+
export const Geopoint = createDecorator('geopoint');
|
|
23
|
+
export const Boolean = createDecorator('boolean');
|
|
24
|
+
export const Timestamp = createDecorator('timestamp');
|
|
25
|
+
export const Number = createDecorator('number');
|
|
26
|
+
export const Map = (childType, props) => createDecorator('map', { childType })(props);
|
|
27
|
+
export const Array = (childType, props) => createDecorator('array', { childType })(props);
|
|
28
|
+
export const Reference = createDecorator('reference');
|
|
29
|
+
export class Firestore {
|
|
36
30
|
}
|
|
37
|
-
|
|
38
|
-
Firestore.
|
|
39
|
-
Firestore.
|
|
40
|
-
Firestore.
|
|
41
|
-
Firestore.
|
|
42
|
-
Firestore.
|
|
43
|
-
Firestore.
|
|
44
|
-
Firestore.
|
|
45
|
-
Firestore.
|
|
46
|
-
Firestore.
|
|
47
|
-
Firestore.Reference = exports.Reference;
|
|
31
|
+
Firestore.ID = ID;
|
|
32
|
+
Firestore.String = String;
|
|
33
|
+
Firestore.Null = Null;
|
|
34
|
+
Firestore.Geopoint = Geopoint;
|
|
35
|
+
Firestore.Boolean = Boolean;
|
|
36
|
+
Firestore.Timestamp = Timestamp;
|
|
37
|
+
Firestore.Number = Number;
|
|
38
|
+
Firestore.Map = Map;
|
|
39
|
+
Firestore.Array = Array;
|
|
40
|
+
Firestore.Reference = Reference;
|
|
48
41
|
//# sourceMappingURL=decorators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/decorators/decorators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/decorators/decorators.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAS5D,CAAC;AAEF,SAAS,eAAe,CAAC,IAAwB,EAAE,UAA6B,EAAE;IAChF,OAAO,CAAC,KAAuB,EAAE,EAAE;QACjC,OAAO,CAAC,MAAW,EAAE,QAAgB,EAAE,EAAE;;;YACvC,MAAM,SAAS,GAAG,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,KAAI,QAAQ,CAAC;YAC1C,MAAM,UAAU,GAAwB,EAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAC,CAAC;YAClG,YAAA,MAAM,CAAC,WAAW,EAAC,qBAAqB,wCAArB,qBAAqB,IAAM,EAAE,EAAC;YACjD,MAAM,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7D,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,MAAW;;IACjD,OAAO,MAAA,MAAM,CA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/index.js
CHANGED
package/decorators/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/decorators/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
tslib_1.__exportStar(require("./query"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./repository"), exports);
|
|
1
|
+
export * from './adapters';
|
|
2
|
+
export * from './converter';
|
|
3
|
+
export * from './dao';
|
|
4
|
+
export * from './decorators';
|
|
5
|
+
export * from './path-builder';
|
|
6
|
+
export * from './query';
|
|
7
|
+
export * from './repository';
|
|
10
8
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/@nx-ddd/firestore/src/lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/@nx-ddd/firestore/src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
package/interfaces/index.js
CHANGED
package/interfaces/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/interfaces/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/interfaces/interfaces.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/interfaces/interfaces.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/interfaces/interfaces.ts"],"names":[],"mappings":"AAmBC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/firestore",
|
|
3
|
-
"version": "
|
|
4
|
-
"main": "./
|
|
3
|
+
"version": "17.0.0",
|
|
4
|
+
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
|
+
"homepage": "https://github.com/xx-machina/plaform/tree/main/packages/@nx-ddd/firestore",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/xx-machina/plaform.git"
|
|
10
|
+
},
|
|
6
11
|
"peerDependencies": {
|
|
7
|
-
"@
|
|
8
|
-
"@
|
|
12
|
+
"@angular/compiler": "^17.0.0",
|
|
13
|
+
"@angular/core": "^17.0.0",
|
|
14
|
+
"@nx-ddd/common": "17.0.0",
|
|
15
|
+
"@nx-ddd/core": "17.0.0",
|
|
16
|
+
"axios": "^1.0.0",
|
|
17
|
+
"class-validator-extended": "^3.2.0",
|
|
9
18
|
"dayjs": "1.11.10",
|
|
10
|
-
"firebase": "^
|
|
19
|
+
"firebase": "^10.7.0",
|
|
11
20
|
"firebase-admin": "^11.0.0",
|
|
12
21
|
"lodash-es": "^4.17.15",
|
|
13
|
-
"
|
|
14
|
-
"lodash.get": "^4.4.2",
|
|
15
|
-
"lodash.pick": "^4.4.0",
|
|
22
|
+
"reflect-metadata": "^0.1.13",
|
|
16
23
|
"rxjs": "^7.0.0",
|
|
17
24
|
"tslib": "^2.3.0"
|
|
18
25
|
},
|
|
19
26
|
"dependencies": {},
|
|
20
|
-
"
|
|
27
|
+
"module": "./src/lib/index.js",
|
|
28
|
+
"type": "module"
|
|
21
29
|
}
|
package/path-builder/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/path-builder/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/path-builder/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|